/* ══════════════════════════════════════════════════════════════════════════════
   Pakrox Web — premium design system
   Dark navy topbar · refined neutral surfaces · brand-orange accent ·
   tabular numerics · soft long shadows · smooth motion.
   ══════════════════════════════════════════════════════════════════════════════ */

:root {
  /* Brand */
  --brand:         #ff6a13;          /* refined orange — slightly warmer */
  --brand-2:       #ea580c;
  --brand-soft:    #fff4ec;
  --brand-tint:    rgba(255,106,19,0.10);
  --brand-glow:    rgba(255,106,19,0.40);

  /* Ink (text + dark surfaces) */
  --ink-900:       #0a0e1a;
  --ink-800:       #0f1525;
  --ink-700:       #1c2436;
  --ink-600:       #334155;
  --ink-500:       #475569;
  --ink-400:       #64748b;
  --ink-300:       #94a3b8;
  --ink-200:       #cbd5e1;

  /* Surfaces */
  --bg:            #f6f7fb;
  --surface:       #ffffff;
  --surface-2:     #fafbfd;
  --surface-3:     #f1f3f9;
  --hairline:      #e9ecf2;
  --hairline-2:    #dde2ec;

  /* Semantic */
  --green:         #10b981;
  --green-soft:    #ecfdf5;
  --red:           #ef4444;
  --red-soft:      #fef2f2;
  --amber:         #f59e0b;
  --amber-soft:    #fffbeb;
  --blue:          #3b82f6;
  --blue-soft:     #eff6ff;
  --violet:        #8b5cf6;
  --violet-soft:   #f5f3ff;

  /* Shadows — soft, layered, premium feel */
  --shadow-xs:     0 1px 2px rgba(15,21,37,0.04);
  --shadow-sm:     0 1px 2px rgba(15,21,37,0.04), 0 2px 6px rgba(15,21,37,0.04);
  --shadow:        0 1px 3px rgba(15,21,37,0.05), 0 8px 18px rgba(15,21,37,0.06);
  --shadow-lg:     0 4px 6px rgba(15,21,37,0.04), 0 20px 40px rgba(15,21,37,0.08);
  --shadow-xl:     0 8px 12px rgba(15,21,37,0.06), 0 32px 60px rgba(15,21,37,0.12);
  --shadow-brand:  0 8px 24px rgba(255,106,19,0.32);

  /* Radii */
  --r-xs: 6px;
  --r-sm: 8px;
  --r:    12px;
  --r-lg: 16px;
  --r-xl: 22px;

  /* Motion */
  --ease:          cubic-bezier(0.4, 0, 0.2, 1);
  --ease-out:      cubic-bezier(0.16, 1, 0.3, 1);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; tab-size: 4; }

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-feature-settings: 'cv11', 'ss01', 'ss03';
  font-size: 14px;
  line-height: 1.5;
  background: var(--bg);
  color: var(--ink-900);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  letter-spacing: -0.005em;
  padding-bottom: env(safe-area-inset-bottom);
}

a { color: #1d4ed8; text-decoration: none; transition: color 0.15s var(--ease); }
a:hover { text-decoration: none; color: var(--brand-2); }
button { font-family: inherit; cursor: pointer; }

input, select, textarea {
  font-family: inherit; font-size: 14px;
  padding: 10px 13px; border-radius: var(--r-sm);
  border: 1px solid var(--hairline-2);
  background: #fff; outline: none;
  width: 100%;
  color: var(--ink-900);
  transition: border-color 0.15s var(--ease), box-shadow 0.15s var(--ease);
}
input::placeholder, textarea::placeholder { color: var(--ink-300); }
input:focus, select:focus, textarea:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-tint);
}

::selection { background: var(--brand); color: #fff; }

.mono, .num { font-family: 'JetBrains Mono', 'SF Mono', Menlo, monospace; font-variant-numeric: tabular-nums; font-feature-settings: 'tnum'; }

/* ── Top bar (glass, dark) ───────────────────────────────────────── */
.topbar {
  position: sticky; top: 0; z-index: 50;
  height: 60px;
  height: calc(60px + env(safe-area-inset-top));
  padding-top: env(safe-area-inset-top);
  background: rgba(10,14,26,0.85);
  -webkit-backdrop-filter: saturate(180%) blur(18px);
  backdrop-filter: saturate(180%) blur(18px);
  color: #fff;
  display: flex; align-items: center; gap: 12px;
  padding-left: 16px; padding-right: 16px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  box-shadow: 0 1px 0 rgba(255,255,255,0.04), 0 8px 32px rgba(0,0,0,0.18);
}
.menu-btn {
  background: transparent; color: #fff; border: none;
  padding: 8px; border-radius: var(--r-sm);
  display: flex; align-items: center; justify-content: center;
  transition: background 0.15s var(--ease);
}
.menu-btn:hover { background: rgba(255,255,255,0.08); }
.menu-btn:active { background: rgba(255,255,255,0.16); }
.menu-btn svg { width: 22px; height: 22px; }

.brand { display: flex; align-items: center; gap: 11px; flex: 1; min-width: 0; }
.brand-mark {
  width: 32px; height: 32px;
  background: linear-gradient(135deg, var(--brand) 0%, #ff8a3d 100%);
  border-radius: 9px;
  display: flex; align-items: center; justify-content: center;
  font-weight: 900; color: #fff; font-size: 16px;
  box-shadow: 0 6px 16px var(--brand-glow), inset 0 1px 0 rgba(255,255,255,0.25);
  letter-spacing: -0.04em;
}
.brand-name {
  font-weight: 700; font-size: 14px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  letter-spacing: -0.015em;
  color: rgba(255,255,255,0.96);
}

.user-chip {
  display: flex; align-items: center; gap: 9px;
  padding: 4px 7px 4px 4px; border-radius: 99px;
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.08);
  font-size: 12px;
}
.user-avatar {
  width: 28px; height: 28px;
  background: linear-gradient(135deg, var(--brand) 0%, #ff8a3d 100%);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 12px; color: #fff;
  box-shadow: 0 2px 6px var(--brand-glow);
}
.user-name-wrap { display: flex; flex-direction: column; line-height: 1.15; min-width: 0; }
.user-name { font-weight: 600; max-width: 120px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: rgba(255,255,255,0.94); }
.logout-btn {
  background: transparent; color: rgba(255,255,255,0.78); border: none;
  padding: 7px; border-radius: 7px; display: flex;
  transition: background 0.15s var(--ease), color 0.15s var(--ease);
}
.logout-btn:hover { background: rgba(255,255,255,0.16); color: #fff; }
.logout-btn svg { width: 16px; height: 16px; }

@media (max-width: 480px) {
  .user-name { display: none; }
  .user-chip .badge { display: none; }
}

.badge {
  display: inline-flex; align-items: center;
  padding: 2px 8px; border-radius: 99px;
  font-size: 9.5px; font-weight: 700; letter-spacing: 0.04em;
  text-transform: uppercase;
  background: var(--surface-3); color: var(--ink-500);
  border: 1px solid var(--hairline);
}
.badge.admin   { background: var(--brand-soft); color: var(--brand-2); border-color: rgba(255,106,19,0.18); }
.badge.success { background: var(--green-soft); color: #047857; border-color: rgba(16,185,129,0.18); }
.badge.danger  { background: var(--red-soft); color: #b91c1c; border-color: rgba(239,68,68,0.18); }
.badge.warning { background: var(--amber-soft); color: #92400e; border-color: rgba(245,158,11,0.18); }
.badge.info    { background: var(--blue-soft); color: #1e40af; border-color: rgba(59,130,246,0.18); }

/* ── Side nav ────────────────────────────────────────────────────── */
.sidenav {
  position: fixed; top: calc(60px + env(safe-area-inset-top)); bottom: 0; left: 0;
  width: 256px;
  background: var(--surface);
  border-right: 1px solid var(--hairline);
  z-index: 40;
  transform: translateX(-100%);
  transition: transform 0.3s var(--ease-out);
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--ink-200) transparent;
}
.sidenav::-webkit-scrollbar { width: 6px; }
.sidenav::-webkit-scrollbar-thumb { background: var(--ink-200); border-radius: 3px; }
.sidenav.open { transform: translateX(0); box-shadow: 4px 0 32px rgba(15,21,37,0.16); }
.nav-inner { padding: 16px 12px 100px; display: flex; flex-direction: column; gap: 1px; }
.nav-link {
  display: flex; align-items: center; gap: 11px;
  padding: 10px 12px; border-radius: var(--r-sm);
  font-weight: 500; color: var(--ink-500); background: transparent;
  border: none; width: 100%; text-align: left; font-size: 13.5px;
  letter-spacing: -0.005em;
  transition: background 0.12s var(--ease), color 0.12s var(--ease);
  cursor: pointer; position: relative;
}
.nav-link:hover { background: var(--surface-3); color: var(--ink-900); text-decoration: none; }
.nav-link.active {
  background: var(--brand-tint); color: var(--brand-2); font-weight: 600;
}
.nav-link.active::before {
  content: ''; position: absolute; left: 0; top: 8px; bottom: 8px;
  width: 3px; background: var(--brand); border-radius: 0 3px 3px 0;
}
.nav-link.tenant-btn { font-size: 13px; padding-left: 12px; font-weight: 500; }
.nav-ico {
  display: inline-flex; align-items: center; justify-content: center;
  width: 18px; height: 18px; flex-shrink: 0; opacity: 0.85;
}
.nav-ico svg { width: 18px; height: 18px; stroke-width: 1.8; }
.nav-link.active .nav-ico { opacity: 1; }
.nav-section-title {
  font-size: 10px; font-weight: 700; color: var(--ink-300);
  text-transform: uppercase; letter-spacing: 0.08em;
  padding: 14px 12px 6px;
}
.sidenav hr { border: none; height: 1px; background: var(--hairline); margin: 10px 6px; }

.page-overlay {
  position: fixed; inset: 0; background: rgba(10,14,26,0.55);
  backdrop-filter: blur(2px);
  z-index: 30; display: none;
}
.page-overlay.show { display: block; }

/* ── Mobile bottom nav ───────────────────────────────────────────── */
.bottom-nav {
  position: fixed; left: 0; right: 0; bottom: 0;
  display: flex; justify-content: space-around;
  background: rgba(255,255,255,0.96);
  -webkit-backdrop-filter: saturate(180%) blur(18px);
  backdrop-filter: saturate(180%) blur(18px);
  border-top: 1px solid var(--hairline);
  z-index: 35;
  padding: 8px 8px calc(8px + env(safe-area-inset-bottom));
  box-shadow: 0 -8px 24px rgba(15,21,37,0.06);
}
.bnav-link {
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px;
  padding: 6px 4px; border-radius: 10px;
  color: var(--ink-400); font-size: 10.5px; font-weight: 600;
  text-decoration: none;
  letter-spacing: -0.005em;
  transition: color 0.15s var(--ease);
}
.bnav-link .nav-ico { width: 22px; height: 22px; opacity: 0.85; }
.bnav-link .nav-ico svg { width: 22px; height: 22px; stroke-width: 1.8; }
.bnav-link:hover { text-decoration: none; color: var(--ink-700); }
.bnav-link.active { color: var(--brand-2); }
.bnav-link.active .nav-ico { opacity: 1; }
.bnav-link.active .nav-ico svg { stroke-width: 2.1; }

@media (min-width: 980px) {
  .sidenav { transform: none; box-shadow: none; }
  .menu-btn { display: none; }
  .page-overlay { display: none !important; }
  .main { margin-left: 256px; }
  .bottom-nav { display: none; }
}

/* ── Main content ────────────────────────────────────────────────── */
.main {
  padding: 18px 16px;
  min-height: calc(100vh - 60px);
  padding-bottom: 96px; /* space for bottom-nav on mobile */
}
@media (min-width: 980px) { .main { padding: 28px 32px; padding-bottom: 36px; max-width: 1400px; } }

.page-head { margin-bottom: 20px; }
.page-head h1 {
  font-size: 24px; font-weight: 800; margin: 0;
  letter-spacing: -0.024em; color: var(--ink-900);
  line-height: 1.2;
}
.page-head p { font-size: 13px; color: var(--ink-400); margin: 6px 0 0; font-weight: 500; }

.back-link { font-size: 12px; color: var(--ink-400); display: inline-flex; align-items: center; gap: 4px; margin-bottom: 8px; font-weight: 500; }
.back-link:hover { color: var(--ink-900); text-decoration: none; }
.muted { color: var(--ink-400); }

/* ── KPI cards ───────────────────────────────────────────────────── */
.kpi-row {
  display: grid; gap: 12px; margin-bottom: 18px;
  grid-template-columns: repeat(2, 1fr);
}
@media (min-width: 720px) {
  .kpi-row { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; }
}
.kpi-card {
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: var(--r);
  padding: 14px 16px;
  box-shadow: var(--shadow-xs);
  position: relative; overflow: hidden;
  display: flex; flex-direction: column;
  min-width: 0;             /* let children shrink in flex/grid */
  transition: transform 0.18s var(--ease-out), box-shadow 0.18s var(--ease-out), border-color 0.18s var(--ease-out);
}
.kpi-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow);
  border-color: var(--hairline-2);
}
.kpi-head {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 8px; margin-bottom: 10px;
  min-width: 0;
}
.kpi-label {
  font-size: 10.5px; font-weight: 700; color: var(--ink-400);
  text-transform: uppercase; letter-spacing: 0.06em;
  flex: 1; min-width: 0;
  line-height: 1.3;
  word-break: break-word;
}
.kpi-icon {
  width: 30px; height: 30px; border-radius: 9px;
  display: flex; align-items: center; justify-content: center;
  background: var(--surface-3); color: var(--ink-500);
  flex-shrink: 0;
}
.kpi-icon svg { width: 15px; height: 15px; stroke-width: 2; }
.kpi-card.success .kpi-icon { background: var(--green-soft); color: var(--green); }
.kpi-card.danger .kpi-icon  { background: var(--red-soft); color: var(--red); }
.kpi-card.warning .kpi-icon { background: var(--amber-soft); color: var(--amber); }
.kpi-card.info .kpi-icon    { background: var(--blue-soft); color: var(--blue); }
.kpi-card.brand .kpi-icon   { background: var(--brand-soft); color: var(--brand-2); }
.kpi-value {
  font-size: 20px; font-weight: 800; color: var(--ink-900);
  letter-spacing: -0.025em;
  font-variant-numeric: tabular-nums;
  line-height: 1.2;
  min-width: 0;
  word-break: break-word;          /* never let huge numbers escape the card */
  overflow-wrap: anywhere;
}
.kpi-value .cur {
  font-size: 12px; color: var(--ink-400); font-weight: 600;
  margin-right: 4px; letter-spacing: 0;
  display: inline-block;
}
.kpi-caption {
  font-size: 11px; color: var(--ink-400);
  margin-top: 5px; font-weight: 500;
  line-height: 1.35;
}
@media (min-width: 720px) {
  .kpi-card { padding: 16px 18px; }
  .kpi-value { font-size: 22px; }
}

/* ── Card / sections ─────────────────────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: var(--r);
  padding: 18px;
  margin-bottom: 18px;
  box-shadow: var(--shadow-xs);
}
.card-head {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 14px; gap: 12px; flex-wrap: wrap;
}
.card-head h2 {
  font-size: 14.5px; font-weight: 700; margin: 0;
  letter-spacing: -0.015em; color: var(--ink-900);
}
.card-head .sub { font-size: 11px; font-weight: 600; color: var(--ink-400); letter-spacing: 0.02em; }
.link-btn {
  font-size: 12px; color: var(--brand-2); font-weight: 600;
  display: inline-flex; align-items: center; gap: 4px;
  padding: 4px 8px; border-radius: 6px;
  transition: background 0.15s var(--ease);
}
.link-btn:hover { background: var(--brand-soft); text-decoration: none; }
.card-body-text { font-size: 13px; line-height: 1.65; color: var(--ink-500); margin-bottom: 12px; }
.card-form { margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--hairline); }
.card-form h3 { font-size: 13px; font-weight: 700; margin: 0 0 12px; color: var(--ink-900); }

.form-grid {
  display: grid; gap: 12px; align-items: end;
  grid-template-columns: 1fr;
}
@media (min-width: 600px) {
  .form-grid { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
}
.form-grid label {
  display: flex; flex-direction: column; gap: 6px;
  font-size: 11px; font-weight: 600; color: var(--ink-500);
  text-transform: uppercase; letter-spacing: 0.06em;
}

/* ── Tables ─────────────────────────────────────────────────────── */
.table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin: 0 -16px;
  padding: 0 16px;
  scrollbar-width: thin;
}
@media (min-width: 980px) { .table-wrap { margin: 0; padding: 0; } }
.data-table { width: 100%; border-collapse: collapse; font-size: 13px; min-width: 540px; }
.data-table th {
  background: var(--surface-2);
  color: var(--ink-500);
  padding: 11px 14px;
  text-align: left;
  font-size: 10.5px; font-weight: 700;
  letter-spacing: 0.06em; text-transform: uppercase;
  white-space: nowrap;
  border-bottom: 1px solid var(--hairline);
  border-top: 1px solid var(--hairline);
}
.data-table th.r { text-align: right; }
.data-table th.c { text-align: center; }
.data-table td {
  padding: 13px 14px;
  border-bottom: 1px solid var(--hairline);
  vertical-align: top;
  font-variant-numeric: tabular-nums;
  color: var(--ink-700);
}
.data-table tbody tr { transition: background 0.1s var(--ease); }
.data-table tbody tr:hover td { background: var(--surface-2); }
.data-table td.r { text-align: right; }
.data-table td.c { text-align: center; }
.data-table td.dr { color: #dc2626; font-weight: 600; }
.data-table td.cr { color: #047857; font-weight: 600; }
.data-table tfoot td {
  background: var(--surface-3);
  font-weight: 700; color: var(--ink-900);
  border-top: 2px solid var(--ink-200);
}
.data-table .empty-row { padding: 40px; text-align: center; color: var(--ink-300); font-style: italic; font-size: 13px; }
.cell-link { color: #1d4ed8; font-weight: 600; }
.cell-link:hover { color: var(--brand-2); }

/* ── Buttons ─────────────────────────────────────────────────────── */
.primary, .secondary, .danger {
  padding: 10px 18px; border-radius: var(--r-sm); border: 1px solid;
  font-weight: 600; font-size: 13px; display: inline-flex;
  align-items: center; gap: 6px;
  letter-spacing: -0.005em;
  transition: transform 0.1s var(--ease), box-shadow 0.18s var(--ease), opacity 0.15s var(--ease), background 0.15s var(--ease);
}
.primary {
  background: linear-gradient(180deg, var(--ink-700), var(--ink-900));
  color: #fff; border-color: var(--ink-900);
  box-shadow: 0 1px 0 rgba(255,255,255,0.06) inset, 0 1px 2px rgba(15,21,37,0.18);
}
.primary:hover { box-shadow: 0 1px 0 rgba(255,255,255,0.06) inset, 0 4px 12px rgba(15,21,37,0.25); }
.primary:active { transform: translateY(1px); }
.secondary { background: #fff; color: var(--ink-900); border-color: var(--hairline-2); }
.secondary:hover { border-color: var(--ink-300); background: var(--surface-2); }
.danger { background: var(--red-soft); color: #b91c1c; border-color: rgba(239,68,68,0.32); }
.danger:hover { background: #fecaca; }
.primary.block { width: 100%; justify-content: center; padding: 12px; }
.primary.brand {
  background: linear-gradient(180deg, var(--brand), var(--brand-2));
  border-color: var(--brand-2);
  box-shadow: 0 1px 0 rgba(255,255,255,0.18) inset, var(--shadow-brand);
}
.primary.brand:hover { box-shadow: 0 1px 0 rgba(255,255,255,0.18) inset, 0 12px 32px var(--brand-glow); }
.small { padding: 6px 12px; font-size: 11.5px; border-radius: 6px; }

/* ── Filter bar ──────────────────────────────────────────────────── */
.filter-bar {
  display: grid; gap: 10px; margin-bottom: 18px;
  grid-template-columns: 1fr;
  background: var(--surface); padding: 14px;
  border: 1px solid var(--hairline); border-radius: var(--r);
  box-shadow: var(--shadow-xs);
}
.filter-bar input { width: auto; }
.filter-bar .lbl {
  display: flex; flex-direction: column; gap: 5px;
  font-size: 10.5px; font-weight: 700; color: var(--ink-500);
  text-transform: uppercase; letter-spacing: 0.06em;
}
@media (min-width: 720px) {
  .filter-bar { grid-template-columns: 2fr 1fr 1fr auto auto; align-items: end; }
}

/* ── Tabs ────────────────────────────────────────────────────────── */
.tab-row { display: flex; gap: 6px; margin-top: 14px; flex-wrap: wrap; }
.tab {
  padding: 8px 16px; border-radius: 99px;
  border: 1px solid var(--hairline-2); background: #fff; color: var(--ink-500);
  font-size: 12px; font-weight: 600;
  display: inline-flex; align-items: center; gap: 6px;
  transition: all 0.15s var(--ease);
}
.tab:hover { border-color: var(--ink-400); color: var(--ink-900); text-decoration: none; }
.tab.active {
  background: var(--ink-900); color: #fff; border-color: var(--ink-900);
  box-shadow: 0 2px 6px rgba(15,21,37,0.18);
}
.tab svg { width: 14px; height: 14px; }

/* ── Auth (login) ────────────────────────────────────────────────── */
.auth-wrap {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  padding: 28px;
  background:
    radial-gradient(ellipse at 18% 22%, rgba(255,106,19,0.18), transparent 45%),
    radial-gradient(ellipse at 82% 80%, rgba(59,130,246,0.18), transparent 45%),
    linear-gradient(140deg, #050816 0%, #0a0e1a 50%, #050816 100%);
  position: relative; overflow: hidden;
}
.auth-wrap::before {
  content: ''; position: absolute; inset: 0;
  background-image:
    radial-gradient(circle at 1px 1px, rgba(255,255,255,0.06) 1px, transparent 0);
  background-size: 28px 28px;
  pointer-events: none;
}
.auth-card {
  background: rgba(255,255,255,0.97);
  -webkit-backdrop-filter: blur(20px); backdrop-filter: blur(20px);
  border-radius: 22px; padding: 40px 36px;
  width: 100%; max-width: 440px;
  box-shadow: 0 32px 80px rgba(0,0,0,0.45), 0 12px 24px rgba(0,0,0,0.18);
  border: 1px solid rgba(255,255,255,0.12);
  position: relative; z-index: 1;
}
.auth-brand { text-align: center; margin-bottom: 30px; }
.auth-logo {
  width: 60px; height: 60px;
  background: linear-gradient(135deg, var(--brand), #ff8a3d);
  border-radius: 16px;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 28px; font-weight: 900; color: #fff;
  box-shadow: 0 8px 24px var(--brand-glow), inset 0 1px 0 rgba(255,255,255,0.3);
  letter-spacing: -0.04em;
}
.auth-brand h1 { font-size: 23px; font-weight: 800; margin: 16px 0 6px; letter-spacing: -0.025em; }
.auth-brand p { font-size: 13px; color: var(--ink-400); margin: 0; font-weight: 500; }
.auth-card label {
  display: block; font-size: 11px; font-weight: 700; color: var(--ink-500);
  text-transform: uppercase; letter-spacing: 0.06em;
  margin: 18px 0 7px;
}
.error-banner {
  background: var(--red-soft); color: #b91c1c;
  padding: 11px 14px; border-radius: var(--r-sm);
  font-size: 13px; font-weight: 500; margin-bottom: 14px;
  border: 1px solid rgba(239,68,68,0.22);
}
.info-banner {
  background: var(--blue-soft); color: #1e40af;
  padding: 11px 14px; border-radius: var(--r-sm);
  font-size: 13px; margin-bottom: 14px;
  border: 1px solid rgba(59,130,246,0.22);
}

/* ── Empty state ─────────────────────────────────────────────────── */
.empty-state {
  text-align: center; padding: 80px 24px;
  background: var(--surface); border-radius: var(--r);
  border: 1px solid var(--hairline); box-shadow: var(--shadow-xs);
}
.empty-icon {
  width: 80px; height: 80px;
  margin: 0 auto 20px;
  border-radius: 22px;
  background: linear-gradient(135deg, var(--surface-3), #fff);
  border: 1px solid var(--hairline);
  display: flex; align-items: center; justify-content: center;
  color: var(--ink-300);
  box-shadow: var(--shadow-sm);
}
.empty-icon svg { width: 36px; height: 36px; stroke-width: 1.5; }
.empty-state h1 { font-size: 22px; font-weight: 800; letter-spacing: -0.022em; }
.empty-state p { color: var(--ink-400); margin: 8px auto 24px; max-width: 440px; line-height: 1.6; font-size: 13.5px; }

/* ── Chart ───────────────────────────────────────────────────────── */
.chart-wrap { padding: 8px 0 0; }
.chart-svg { display: block; width: 100%; height: 200px; }
.chart-legend {
  display: flex; gap: 12px; align-items: center;
  font-size: 11px; color: var(--ink-400); font-weight: 600;
  margin-top: 8px;
}
.chart-legend .dot { width: 8px; height: 8px; border-radius: 2px; background: var(--brand); display: inline-block; }
.chart-axis { font-size: 9.5px; fill: var(--ink-300); font-family: 'Inter', sans-serif; font-weight: 600; }
.chart-grid { stroke: var(--hairline); stroke-dasharray: 2 4; }

/* ── Bars chart fallback ─────────────────────────────────────────── */
.bars { display: flex; align-items: flex-end; gap: 4px; height: 160px; }
.bar-col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 4px; min-width: 0; }
.bar { width: 100%; background: linear-gradient(180deg, var(--brand) 0%, var(--brand-2) 100%); border-radius: 4px 4px 0 0; min-height: 2px; transition: opacity 0.15s var(--ease); }
.bar:hover { opacity: 0.85; }
.bar-label { font-size: 9px; color: var(--ink-300); font-weight: 600; }

/* ── Party cards ─────────────────────────────────────────────────── */
.party-grid {
  display: grid; gap: 10px;
  grid-template-columns: 1fr;
}
@media (min-width: 600px) {
  .party-grid { grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 12px; }
}
.party-card {
  display: block;
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: var(--r);
  padding: 16px;
  color: var(--ink-900);
  box-shadow: var(--shadow-xs);
  transition: transform 0.18s var(--ease-out), box-shadow 0.18s var(--ease-out), border-color 0.18s var(--ease-out);
  position: relative; overflow: hidden;
}
.party-card::before {
  content: ''; position: absolute; left: 0; top: 0; bottom: 0;
  width: 3px; background: linear-gradient(180deg, var(--brand), var(--brand-2));
  opacity: 0.85;
}
.party-card:hover {
  text-decoration: none;
  transform: translateY(-2px);
  box-shadow: var(--shadow);
  border-color: var(--hairline-2);
}
.party-card-name { font-size: 14.5px; font-weight: 700; letter-spacing: -0.015em; }
.party-card-meta { font-size: 11.5px; color: var(--ink-400); margin-top: 3px; font-weight: 500; }
.party-card-bal {
  font-size: 14px; font-weight: 700; margin-top: 12px;
  font-variant-numeric: tabular-nums;
}
.party-card-bal.danger  { color: #b91c1c; }
.party-card-bal.success { color: #047857; }
.party-card-bal.muted   { color: var(--ink-400); font-weight: 500; }

/* ── Ledger ──────────────────────────────────────────────────────── */
.ledger-summary {
  display: grid; gap: 10px; margin-bottom: 18px;
  grid-template-columns: repeat(2, 1fr);
}
@media (min-width: 720px) {
  .ledger-summary { grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }
}
.ledger-banner {
  background: linear-gradient(135deg, #1d4ed8, #1e40af);
  color: #fff; text-align: center; padding: 11px;
  font-weight: 700; font-size: 12px; letter-spacing: 1.5px;
  text-transform: uppercase;
  margin-bottom: 0;
  border-radius: 10px 10px 0 0;
  box-shadow: 0 4px 12px rgba(29,78,216,0.22);
}
.ledger-table th { font-size: 10.5px; }

/* ── Reports list ────────────────────────────────────────────────── */
.report-grid {
  display: grid; gap: 10px;
  grid-template-columns: 1fr;
}
@media (min-width: 600px) {
  .report-grid { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 12px; }
}
.report-tile {
  display: flex; justify-content: space-between; align-items: center;
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: var(--r);
  padding: 14px 16px;
  font-weight: 600; color: var(--ink-900);
  box-shadow: var(--shadow-xs);
  transition: all 0.18s var(--ease-out);
  position: relative; overflow: hidden;
}
.report-tile:hover {
  border-color: var(--brand);
  text-decoration: none;
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}
.report-tile-name { font-size: 13.5px; letter-spacing: -0.012em; }
.report-tile-arrow {
  color: var(--ink-300);
  display: flex; align-items: center;
  transition: transform 0.18s var(--ease-out), color 0.18s var(--ease-out);
}
.report-tile:hover .report-tile-arrow {
  color: var(--brand);
  transform: translateX(3px);
}

/* ── Activity feed ───────────────────────────────────────────────── */
.activity-list { display: flex; flex-direction: column; gap: 0; }
.activity-row {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 0; border-bottom: 1px solid var(--hairline);
}
.activity-row:last-child { border-bottom: none; }
.activity-icon {
  width: 36px; height: 36px; border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  background: var(--surface-3); color: var(--ink-500);
  flex-shrink: 0;
}
.activity-icon.success { background: var(--green-soft); color: var(--green); }
.activity-icon.danger  { background: var(--red-soft); color: var(--red); }
.activity-icon svg { width: 18px; height: 18px; }
.activity-body { flex: 1; min-width: 0; }
.activity-title { font-size: 13px; font-weight: 600; color: var(--ink-900); letter-spacing: -0.005em; }
.activity-meta { font-size: 11.5px; color: var(--ink-400); margin-top: 2px; }
.activity-amount { font-size: 13px; font-weight: 700; color: var(--ink-900); font-variant-numeric: tabular-nums; }

/* ── Two-column layout ───────────────────────────────────────────── */
.split-2 {
  display: grid; gap: 16px;
  grid-template-columns: 1fr;
}
@media (min-width: 980px) { .split-2 { grid-template-columns: 2fr 1fr; gap: 20px; } }

/* ── Report print ────────────────────────────────────────────────── */
.report-print, .invoice-print {
  background: #fff; padding: 22px; border-radius: var(--r);
  border: 1px solid var(--hairline); box-shadow: var(--shadow-xs);
}
.report-shop-block {
  display: flex; align-items: center; gap: 14px;
  padding-bottom: 12px; border-bottom: 2px solid var(--ink-900);
  margin-bottom: 16px;
}
.inv-logo { max-height: 64px; max-width: 120px; object-fit: contain; }
.inv-shop { font-size: 19px; font-weight: 800; letter-spacing: -0.022em; }
.inv-meta { font-size: 11px; color: var(--ink-400); line-height: 1.6; margin-top: 4px; }
.report-title { font-size: 19px; font-weight: 800; margin: 0 0 4px; letter-spacing: -0.022em; }
.report-period { font-size: 11.5px; color: var(--ink-400); margin-bottom: 14px; }

/* ── Invoice print ───────────────────────────────────────────────── */
.inv-header {
  display: flex; justify-content: space-between; align-items: flex-start;
  padding-bottom: 14px; border-bottom: 2px solid var(--brand);
  margin-bottom: 16px; gap: 16px; flex-wrap: wrap;
}
.inv-no-block { text-align: right; }
.inv-pill {
  display: inline-block;
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
  color: #fff; padding: 5px 14px; border-radius: 99px;
  font-size: 10px; font-weight: 800; letter-spacing: 1px;
  text-transform: uppercase;
}
.inv-no { font-size: 22px; font-weight: 800; margin-top: 6px; letter-spacing: -0.022em; }
.inv-date { font-size: 11.5px; color: var(--ink-400); }
.party-block {
  background: var(--surface-2);
  border-left: 3px solid var(--brand);
  padding: 12px 16px; border-radius: 6px;
  margin-bottom: 14px;
}
.party-label { font-size: 9.5px; font-weight: 800; color: var(--ink-400); text-transform: uppercase; letter-spacing: 0.06em; }
.party-name { font-size: 14.5px; font-weight: 800; margin-top: 3px; letter-spacing: -0.012em; }
.party-meta { font-size: 11px; color: var(--ink-400); }
.inv-items { width: 100%; border-collapse: collapse; margin-bottom: 14px; font-size: 12.5px; }
.inv-items th { background: var(--ink-900); color: #fff; padding: 10px 12px; text-align: left; font-size: 10px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; }
.inv-items th.r { text-align: right; }
.inv-items td { padding: 10px 12px; border-bottom: 1px solid var(--hairline); vertical-align: top; }
.inv-items td.r { text-align: right; }
.inv-totals { margin-left: auto; max-width: 320px; }
.inv-totals .row { display: flex; justify-content: space-between; padding: 7px 14px; font-size: 12.5px; border-bottom: 1px solid var(--hairline); }
.inv-totals .row.grand {
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
  color: #fff; font-size: 15px; font-weight: 800;
  padding: 13px 16px; border-radius: 8px; margin-top: 8px;
  box-shadow: var(--shadow-brand);
}
.inv-footer { display: flex; justify-content: space-between; margin-top: 16px; font-size: 11px; padding-top: 12px; border-top: 1px solid var(--hairline); }

/* ── Action bar ──────────────────────────────────────────────────── */
.action-bar { display: flex; gap: 8px; justify-content: flex-end; margin-top: 16px; flex-wrap: wrap; }

/* ── Token / code ────────────────────────────────────────────────── */
.token-display {
  display: inline-block;
  background: var(--surface-3); padding: 5px 10px; border-radius: 6px;
  font-family: 'JetBrains Mono', monospace; font-size: 11px;
  word-break: break-all; max-width: 280px;
  border: 1px solid var(--hairline);
}
.copy-btn {
  margin-left: 4px; padding: 4px 10px; font-size: 10.5px; font-weight: 600;
  background: #fff; border: 1px solid var(--hairline-2); border-radius: 6px;
  color: var(--ink-500); cursor: pointer;
  transition: all 0.15s var(--ease);
}
.copy-btn:hover { color: var(--ink-900); border-color: var(--ink-300); }
.code-block {
  background: linear-gradient(180deg, var(--ink-800), var(--ink-900));
  color: #e2e8f0; padding: 16px 18px; border-radius: var(--r-sm);
  font-family: 'JetBrains Mono', monospace; font-size: 12px;
  overflow-x: auto; line-height: 1.65;
  border: 1px solid var(--ink-700);
}
.inline-detail { display: inline-block; }
.inline-form { display: flex; gap: 6px; margin-top: 4px; }
.inline-form input { width: 140px; padding: 6px 10px; font-size: 11.5px; }

/* ── Animations ──────────────────────────────────────────────────── */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: none; }
}
.kpi-row > .kpi-card,
.card,
.party-card,
.report-tile { animation: fadeUp 0.32s var(--ease-out) both; }
.kpi-row > .kpi-card:nth-child(1) { animation-delay: 0ms; }
.kpi-row > .kpi-card:nth-child(2) { animation-delay: 40ms; }
.kpi-row > .kpi-card:nth-child(3) { animation-delay: 80ms; }
.kpi-row > .kpi-card:nth-child(4) { animation-delay: 120ms; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ── Print ───────────────────────────────────────────────────────── */
@media print {
  @page { size: A4 portrait; margin: 14mm; }
  body { background: #fff; padding: 0; }
  .topbar, .sidenav, .filter-bar, .action-bar, .no-print, .menu-btn, .page-overlay, .bottom-nav { display: none !important; }
  .main { margin: 0; padding: 0; }
  .page-head { display: none; }
  .card { border: none; box-shadow: none; padding: 0; margin: 0; }
  .table-wrap { overflow: visible; margin: 0; padding: 0; }
  .data-table { min-width: auto; }
  tr { page-break-inside: avoid; }
  .invoice-print, .report-print { border: none; padding: 0; box-shadow: none; }
}
