/* ============================================================
   Parko.ai Cash Flow — SAP Fiori Horizon (2026) design language
   Brand: Parko plum #9B0064 / orange #FF9500
   ============================================================ */
:root {
  /* Parko brand */
  --plum: #9B0064;
  --plum-dark: #7a004f;
  --plum-light: #c2006e;
  --orange: #FF9500;
  --orange-dark: #e08500;

  /* Fiori Horizon tokens */
  --sapBackgroundColor: #f5f5f7;
  --sapTile-Background: #ffffff;
  --sapContent-LabelColor: #556b82;
  --sapTextColor: #1d2d3e;
  --sapNeutralBorderColor: #d9d9d9;
  --sapPositiveColor: #256f3a;
  --sapNegativeColor: #aa0808;
  --sapCriticalColor: #e76500;
  --sapInformativeColor: #0070f2;
  --shell-height: 56px;
  --radius-card: 16px;
  --shadow-card: 0 0 2px 0 rgba(34,54,73,0.16), 0 2px 4px 0 rgba(34,54,73,0.12);
  --shadow-card-hover: 0 0 2px 0 rgba(34,54,73,0.20), 0 8px 16px 0 rgba(34,54,73,0.16);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: 'Inter', '72', 'Segoe UI', sans-serif;
  background: var(--sapBackgroundColor);
  color: var(--sapTextColor);
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
}

/* ================= SHELL BAR ================= */
#shell-bar {
  position: sticky; top: 0; z-index: 100;
  height: var(--shell-height);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 20px;
  background: linear-gradient(120deg, #1a0535 0%, #2b0a3d 45%, #3d0a2e 100%);
  box-shadow: 0 2px 8px rgba(0,0,0,0.25);
  gap: 16px;
}
.shell-left { display: flex; align-items: center; }
.brand { display: flex; align-items: center; gap: 12px; }
.brand-mark {
  width: 36px; height: 36px; border-radius: 10px;
  background: linear-gradient(135deg, var(--plum), var(--plum-light));
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 18px;
  box-shadow: 0 2px 10px rgba(155,0,100,0.5);
}
.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-name { color: #fff; font-weight: 800; font-size: 17px; letter-spacing: -0.02em; }
.brand-ai { color: var(--orange); }
.brand-sub { color: rgba(255,255,255,0.55); font-size: 10.5px; font-weight: 500; letter-spacing: 0.08em; text-transform: uppercase; }

.shell-nav { display: flex; gap: 4px; flex: 1; justify-content: center; flex-wrap: wrap; }
.nav-tab {
  background: transparent; border: none; cursor: pointer;
  color: rgba(255,255,255,0.72);
  font-family: inherit; font-size: 13px; font-weight: 600;
  padding: 8px 14px; border-radius: 8px;
  display: inline-flex; align-items: center; gap: 7px;
  transition: background .15s, color .15s;
}
.nav-tab i { font-size: 12px; opacity: .85; }
.nav-tab:hover { background: rgba(255,255,255,0.10); color: #fff; }
.nav-tab.active {
  background: rgba(155,0,100,0.45);
  color: #fff;
  box-shadow: inset 0 0 0 1px rgba(255,149,0,0.45);
}

.shell-right { display: flex; align-items: center; gap: 14px; }
.period-chip {
  color: rgba(255,255,255,0.85); font-size: 12.5px; font-weight: 600;
  background: rgba(255,255,255,0.10); border: 1px solid rgba(255,255,255,0.15);
  padding: 6px 14px; border-radius: 100px;
  display: inline-flex; align-items: center; gap: 8px;
  white-space: nowrap;
}
.period-chip i { color: var(--orange); }
.avatar {
  width: 34px; height: 34px; border-radius: 50%;
  background: linear-gradient(135deg, var(--orange), var(--orange-dark));
  color: #fff; font-weight: 800; font-size: 12px;
  display: flex; align-items: center; justify-content: center;
}

/* ================= MAIN ================= */
#main-content { max-width: 1440px; margin: 0 auto; padding: 24px 24px 64px; }

.page-header { margin-bottom: 20px; display: flex; align-items: flex-end; justify-content: space-between; flex-wrap: wrap; gap: 12px; }
.page-title { font-size: 24px; font-weight: 800; letter-spacing: -0.02em; color: var(--sapTextColor); }
.page-subtitle { font-size: 13px; color: var(--sapContent-LabelColor); margin-top: 4px; font-weight: 500; }

/* ================= FIORI TILES / KPI CARDS ================= */
.kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; margin-bottom: 24px; }
.kpi-tile {
  background: var(--sapTile-Background);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
  padding: 18px 20px;
  transition: box-shadow .2s, transform .2s;
  position: relative; overflow: hidden;
  border-top: 3px solid transparent;
}
.kpi-tile:hover { box-shadow: var(--shadow-card-hover); transform: translateY(-2px); }
.kpi-tile.accent-plum { border-top-color: var(--plum); }
.kpi-tile.accent-orange { border-top-color: var(--orange); }
.kpi-tile.accent-green { border-top-color: var(--sapPositiveColor); }
.kpi-tile.accent-red { border-top-color: var(--sapNegativeColor); }
.kpi-tile.accent-blue { border-top-color: var(--sapInformativeColor); }
.kpi-label {
  font-size: 12px; font-weight: 600; color: var(--sapContent-LabelColor);
  text-transform: uppercase; letter-spacing: 0.06em;
  display: flex; align-items: center; gap: 8px; margin-bottom: 10px;
}
.kpi-label i { color: var(--plum); font-size: 13px; }
.kpi-value { font-size: 26px; font-weight: 800; letter-spacing: -0.02em; line-height: 1.1; }
.kpi-value.positive { color: var(--sapPositiveColor); }
.kpi-value.negative { color: var(--sapNegativeColor); }
.kpi-detail { font-size: 12px; color: var(--sapContent-LabelColor); margin-top: 6px; font-weight: 500; }
.kpi-value small { font-size: 14px; font-weight: 600; color: var(--sapContent-LabelColor); }

/* Hero KPI (net cash) */
.kpi-hero {
  background: linear-gradient(120deg, #1a0535 0%, #3d0a2e 100%);
  color: #fff;
}
.kpi-hero .kpi-label { color: rgba(255,255,255,0.65); }
.kpi-hero .kpi-label i { color: var(--orange); }
.kpi-hero .kpi-value { color: #fff; }
.kpi-hero .kpi-detail { color: rgba(255,255,255,0.65); }

/* ================= PANELS / CARDS ================= */
.panel {
  background: var(--sapTile-Background);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
  margin-bottom: 20px;
  overflow: hidden;
}
.panel-header {
  padding: 16px 20px;
  display: flex; align-items: center; justify-content: space-between;
  border-bottom: 1px solid #eef1f4;
  gap: 12px; flex-wrap: wrap;
}
.panel-title { font-size: 15px; font-weight: 700; display: flex; align-items: center; gap: 10px; }
.panel-title i { color: var(--plum); font-size: 14px; }
.panel-title .count-badge {
  background: rgba(155,0,100,0.08); color: var(--plum);
  font-size: 11px; font-weight: 700; padding: 2px 10px; border-radius: 100px;
}
.panel-body { padding: 0; }
.panel-body.padded { padding: 20px; }

.dash-grid { display: grid; grid-template-columns: 1.2fr 1fr; gap: 20px; }
@media (max-width: 980px) { .dash-grid { grid-template-columns: 1fr; } }

/* ================= FIORI TABLE ================= */
.fiori-table { width: 100%; border-collapse: collapse; }
.fiori-table th {
  text-align: left; font-size: 11.5px; font-weight: 700;
  color: var(--sapContent-LabelColor); text-transform: uppercase; letter-spacing: 0.05em;
  padding: 10px 20px; background: #fafbfc; border-bottom: 1px solid #eef1f4;
}
.fiori-table td {
  padding: 12px 20px; font-size: 13.5px; border-bottom: 1px solid #f2f4f6;
  vertical-align: middle;
}
.fiori-table tbody tr { transition: background .12s; }
.fiori-table tbody tr:hover { background: rgba(155,0,100,0.03); }
.fiori-table .num { text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; }
.fiori-table tfoot td {
  font-weight: 800; background: #fafbfc; border-top: 2px solid #e5e9ed; border-bottom: none;
  padding: 13px 20px;
}
.row-actions { display: flex; gap: 6px; justify-content: flex-end; opacity: 0; transition: opacity .15s; }
.fiori-table tr:hover .row-actions { opacity: 1; }
.icon-btn {
  width: 28px; height: 28px; border-radius: 7px; border: none; cursor: pointer;
  background: transparent; color: var(--sapContent-LabelColor); font-size: 12px;
  display: inline-flex; align-items: center; justify-content: center;
  transition: background .15s, color .15s;
}
.icon-btn:hover { background: rgba(155,0,100,0.10); color: var(--plum); }
.icon-btn.danger:hover { background: rgba(170,8,8,0.10); color: var(--sapNegativeColor); }

/* Status badges */
.status-badge {
  font-size: 11px; font-weight: 700; padding: 3px 10px; border-radius: 100px;
  display: inline-flex; align-items: center; gap: 5px;
  cursor: pointer; user-select: none; border: 1px solid transparent;
}
.status-open { background: rgba(0,112,242,0.08); color: var(--sapInformativeColor); border-color: rgba(0,112,242,0.2); }
.status-confirmed { background: rgba(231,101,0,0.08); color: var(--sapCriticalColor); border-color: rgba(231,101,0,0.2); }
.status-paid { background: rgba(37,111,58,0.08); color: var(--sapPositiveColor); border-color: rgba(37,111,58,0.2); }

/* ================= BUTTONS ================= */
.btn {
  font-family: inherit; font-size: 13px; font-weight: 700;
  padding: 9px 18px; border-radius: 9px; border: none; cursor: pointer;
  display: inline-flex; align-items: center; gap: 8px;
  transition: transform .15s, box-shadow .15s, background .15s;
}
.btn-primary {
  background: linear-gradient(135deg, var(--plum), var(--plum-light));
  color: #fff; box-shadow: 0 2px 10px rgba(155,0,100,0.3);
}
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 4px 16px rgba(155,0,100,0.4); }
.btn-ghost { background: transparent; color: var(--sapContent-LabelColor); border: 1px solid var(--sapNeutralBorderColor); }
.btn-ghost:hover { background: #f2f4f6; }
.btn-sm { padding: 7px 14px; font-size: 12.5px; }

/* ================= WATERFALL / SUMMARY LIST ================= */
.summary-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 11px 20px; border-bottom: 1px solid #f2f4f6; font-size: 13.5px;
}
.summary-row:last-child { border-bottom: none; }
.summary-row .lbl { color: var(--sapTextColor); font-weight: 500; display: flex; align-items: center; gap: 9px; }
.summary-row .lbl i { width: 16px; text-align: center; font-size: 12px; color: var(--sapContent-LabelColor); }
.summary-row .val { font-weight: 700; font-variant-numeric: tabular-nums; }
.summary-row.total {
  background: #fafbfc; font-weight: 800; border-top: 2px solid #e5e9ed;
}
.summary-row.grand {
  background: linear-gradient(120deg, rgba(155,0,100,0.06), rgba(255,149,0,0.06));
  border-top: 2px solid var(--plum);
}
.summary-row.grand .val { font-size: 16px; color: var(--plum); }
.val.pos { color: var(--sapPositiveColor); }
.val.neg { color: var(--sapNegativeColor); }

/* ================= CHART ================= */
.chart-wrap { position: relative; height: 300px; padding: 16px 20px 20px; }

/* ================= FORMS ================= */
.form-group { margin-bottom: 16px; }
.form-label { display: block; font-size: 12px; font-weight: 700; color: var(--sapContent-LabelColor); margin-bottom: 6px; text-transform: uppercase; letter-spacing: 0.04em; }
.form-input, .form-select {
  width: 100%; font-family: inherit; font-size: 14px;
  padding: 10px 14px; border-radius: 9px;
  border: 1px solid var(--sapNeutralBorderColor);
  background: #fff; color: var(--sapTextColor);
  transition: border-color .15s, box-shadow .15s;
}
.form-input:focus, .form-select:focus {
  outline: none; border-color: var(--plum);
  box-shadow: 0 0 0 3px rgba(155,0,100,0.12);
}
.settings-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 16px; }

/* ================= MODAL ================= */
#modal-backdrop {
  position: fixed; inset: 0; z-index: 200;
  background: rgba(26,5,53,0.45); backdrop-filter: blur(3px);
  display: flex; align-items: center; justify-content: center; padding: 20px;
}
#modal-backdrop.hidden { display: none; }
#modal {
  background: #fff; border-radius: 18px; width: 100%; max-width: 460px;
  box-shadow: 0 24px 64px rgba(0,0,0,0.3);
  animation: modalIn .22s ease-out;
}
@keyframes modalIn { from { opacity: 0; transform: translateY(16px) scale(.98); } to { opacity: 1; transform: none; } }
#modal-header {
  padding: 18px 22px; display: flex; align-items: center; justify-content: space-between;
  border-bottom: 1px solid #eef1f4;
}
#modal-title { font-size: 16px; font-weight: 800; }
#modal-close {
  border: none; background: transparent; cursor: pointer; font-size: 16px;
  color: var(--sapContent-LabelColor); width: 32px; height: 32px; border-radius: 8px;
}
#modal-close:hover { background: #f2f4f6; }
#modal-body { padding: 22px; }
#modal-footer { padding: 16px 22px; display: flex; justify-content: flex-end; gap: 10px; border-top: 1px solid #eef1f4; }

/* ================= TOAST ================= */
#toast-container { position: fixed; bottom: 24px; right: 24px; z-index: 300; display: flex; flex-direction: column; gap: 10px; }
.toast {
  background: #1d2d3e; color: #fff; font-size: 13.5px; font-weight: 600;
  padding: 13px 20px; border-radius: 12px; box-shadow: 0 8px 24px rgba(0,0,0,0.25);
  display: flex; align-items: center; gap: 10px;
  animation: toastIn .25s ease-out;
}
.toast.success i { color: #6dd58c; }
.toast.error i { color: #ff8888; }
@keyframes toastIn { from { opacity: 0; transform: translateX(30px); } to { opacity: 1; transform: none; } }

/* ================= EMPTY STATE ================= */
.empty-state { text-align: center; padding: 48px 20px; color: var(--sapContent-LabelColor); }
.empty-state i { font-size: 36px; opacity: .3; margin-bottom: 12px; display: block; }

/* ================= RESPONSIVE ================= */
#sicap-filter-bar .panel-body > div:first-child { }
@media (max-width: 1000px) {
  #sicap-filter-bar .panel-body > div:first-child { grid-template-columns: 1fr 1fr !important; }
}
@media (max-width: 560px) {
  #sicap-filter-bar .panel-body > div:first-child { grid-template-columns: 1fr !important; }
}

@media (max-width: 860px) {
  #shell-bar { flex-wrap: wrap; height: auto; padding: 10px 14px; }
  .shell-nav { order: 3; width: 100%; justify-content: flex-start; overflow-x: auto; padding: 6px 0 2px; }
  .nav-tab { white-space: nowrap; font-size: 12px; padding: 7px 10px; }
  #main-content { padding: 16px 14px 48px; }
  .kpi-value { font-size: 22px; }
  .brand-sub { display: none; }
}
