/* ============================================================
 * Illunise Admin skin — layered on top of styles.css + redesign.css
 * so cascade order (this file loaded LAST in index.html) gives us
 * override authority without editing the existing files.
 *
 * To disable the reskin, remove the <link> to this file in index.html.
 * Existing custom class rules keep working; this file redefines
 * tokens + shared component classes to the indigo Illunise look.
 * ============================================================ */

/* — Font (Inter) is loaded via <link> in index.html so the render
 *   isn't blocked by CSS parsing. This @import is a fallback. —      */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');

/* ============================================================
 * 1. Design tokens
 * ============================================================ */
:root {
  /* — Brand (indigo) — */
  --brand:        #FF1744;
  --brand-hover:  #E6002B;
  --brand-tint:   #FFF0F3;
  --brand-tint-2: #E0E7FF;
  --brand-soft:   #FF4D6D;
  --brand-mid:    #FF6B81;
  --brand-light:  #FFB1C0;
  --brand-border: #FFD0D9;

  /* Aliases for older code paths that already reference --primary */
  --primary:      #FF1744;
  --primary-hover:#E6002B;

  /* — Neutrals (slate) — */
  --ink:          #0F172A;
  --ink-body:     #1E293B;
  --ink-mute:     #475569;
  --ink-soft:     #64748B;
  --ink-faint:    #94A3B8;
  --line:         #E2E8F0;
  --line-soft:    #F1F5F9;
  --surface:      #FFFFFF;
  --surface-alt:  #F8FAFC;
  --bg:           #F1F5F9;

  /* Aliases for existing code that uses --text-1..4, --card, etc. */
  --text-1:       #0F172A;
  --text-2:       #1E293B;
  --text-3:       #475569;
  --text-4:       #94A3B8;
  --card:         #FFFFFF;
  --card-2:       #F8FAFC;
  --card-border:  #E2E8F0;

  /* — Semantic — */
  --success:      #16A34A;   --success-bg:  #DCFCE7;
  --warning:      #D97706;   --warning-bg:  #FEF3C7;
  --danger:       #DC2626;   --danger-bg:   #FEE2E2;
  --info:         #FF1744;

  /* Chip tints (used across existing hero/badge components) */
  --chip-green-bg:  #DCFCE7; --chip-green-fg: #16A34A;
  --chip-red-bg:    #FEE2E2; --chip-red-fg:   #DC2626;
  --chip-yellow-bg: #FEF3C7; --chip-yellow-fg:#D97706;
  --chip-purple-bg: #FFF0F3; --chip-purple-fg:#FF1744;
  --chip-blue-bg:   #E0F2FE; --chip-blue-fg:  #0369A1;

  /* — Radii — */
  --r-sm: 6px;
  --r:    8px;
  --r-md: 10px;
  --r-lg: 14px;
  --r-xl: 16px;
  --r-pill: 100px;
  --radius: 8px;                    /* older code uses --radius */

  /* — Elevation — */
  --shadow-xs:    0 1px 2px rgba(15,23,42,.04);
  --shadow-sm:    0 1px 2px rgba(15,23,42,.05);
  --shadow:       0 1px 3px rgba(15,23,42,.08);
  --shadow-md:    0 4px 12px rgba(15,23,42,.08);
  --shadow-brand: 0 4px 12px rgba(255, 23, 68,.25);
  --shadow-hero:  0 8px 24px rgba(255, 23, 68,.15);

  /* — Brand gradient (hero band + logo tile) — */
  --gradient-brand: linear-gradient(135deg, #FF1744 0%, #FF4D6D 100%);

  /* — Typography scale — */
  --fs-h1: 22px;  --fs-h2: 15px;  --fs-h3: 13px;
  --fs-body: 13px;  --fs-small: 12px;
  --fs-micro: 11px;  --fs-eyebrow: 10px;

  /* — Motion — */
  --ease: cubic-bezier(.4, 0, .2, 1);
}

/* ============================================================
 * 2. Base
 * ============================================================ */
body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--ink-body);
  -webkit-font-smoothing: antialiased;
}

/* ============================================================
 * 3. Layout — sidebar + main
 * The existing app already has .sidebar and a .main-content wrapper;
 * these rules re-tune them to the 240px Illunise shape without
 * changing the DOM structure.
 * ============================================================ */
.sidebar {
  position: fixed;
  top: 0; left: 0;
  width: 240px;
  height: 100vh;
  background: var(--surface);
  border-right: 1px solid var(--line);
  display: flex; flex-direction: column;
  z-index: 100;
  overflow-y: auto;
}

.sidebar-logo,
.sidebar .brand,
.sidebar .logo {
  display: flex; align-items: center; gap: 10px;
  padding: 20px 20px 16px;
  border-bottom: 1px solid var(--line);
  text-decoration: none;
}
.logo-icon {
  width: 36px; height: 36px;
  background: linear-gradient(135deg, var(--brand), var(--brand-soft));
  border-radius: var(--r);
  display: flex; align-items: center; justify-content: center;
  font-size: 18px; color: #fff;
}
.logo-text,
.sidebar .brand-name {
  font-size: 16px; font-weight: 700;
  color: var(--ink-body);
  letter-spacing: -0.3px;
}

.nav-section { padding: 12px 12px 4px; }
.nav-section-label {
  font-size: var(--fs-eyebrow);
  font-weight: 600;
  color: var(--ink-faint);
  text-transform: uppercase;
  letter-spacing: 0.8px;
  padding: 0 8px;
  margin-bottom: 4px;
}

.sidebar .nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px;
  border-radius: var(--r);
  text-decoration: none;
  font-size: 13.5px; font-weight: 500;
  color: var(--ink-soft);
  background: transparent;
  transition: background .15s var(--ease), color .15s var(--ease);
  margin-bottom: 2px;
  border-left: 3px solid transparent;
  cursor: pointer;
}
.sidebar .nav-item:hover {
  background: var(--surface-alt);
  color: var(--ink-body);
}
.sidebar .nav-item.active {
  background: var(--brand-tint);
  color: var(--brand);
  border-left: 3px solid var(--brand);
  border-radius: 0 var(--r) var(--r) 0;
}
.sidebar .nav-item .nav-icon {
  font-size: 14px;
  width: 20px;
  text-align: center;
  color: var(--ink-soft);
}
.sidebar .nav-item.active .nav-icon,
.sidebar .nav-item:hover .nav-icon { color: var(--brand); }

.main-content,
.content,
.app-main {
  margin-left: 240px;
  min-height: 100vh;
  padding: 24px;
  background: var(--bg);
}

/* ============================================================
 * 4. Topbar (page hero band)
 * Existing per-page .page-header blocks pick up this styling via
 * the new .topbar class when we cut over per-page in Phase 2.
 * Meanwhile the .page-header markup keeps its own layout rules.
 * ============================================================ */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; flex-wrap: wrap;
  margin-bottom: 24px;
  padding: 20px 24px;
  border-radius: var(--r-xl);
  background: var(--gradient-brand);
  box-shadow: var(--shadow-hero);
  color: #fff;
}
.topbar--flat {
  padding: 0;
  background: transparent;
  box-shadow: none;
  border-radius: 0;
  color: var(--ink);
  margin-bottom: 24px;
}

.breadcrumb {
  font-size: var(--fs-small);
  color: rgba(255,255,255,.7);
  display: flex; align-items: center; gap: 6px;
}
.breadcrumb .sep     { color: rgba(255,255,255,.3); }
.breadcrumb .current { color: #fff; font-weight: 600; }
.breadcrumb a        { color: rgba(255,255,255,.85); text-decoration: none; }
.breadcrumb a:hover  { color: #fff; text-decoration: underline; }

.topbar .page-title,
.topbar h1 {
  font-size: var(--fs-h1);
  font-weight: 800;
  color: #fff;
  margin-top: 4px;
  letter-spacing: -0.3px;
}
.topbar .page-title i,
.topbar h1 i { color: rgba(255,255,255,.9); }

.topbar--flat .breadcrumb          { color: var(--ink-faint); }
.topbar--flat .breadcrumb .sep     { color: #CBD5E1; }
.topbar--flat .breadcrumb .current { color: var(--ink-body); }
.topbar--flat .breadcrumb a        { color: var(--ink-mute); }
.topbar--flat .page-title,
.topbar--flat h1                   { color: var(--ink); font-weight: 700; }
.topbar--flat .page-title i,
.topbar--flat h1 i                 { color: inherit; }

/* ============================================================
 * 5. Cards, stats, section titles
 * ============================================================ */
.card {
  background: var(--surface);
  border-radius: var(--r-lg);
  border: 1px solid var(--line-soft);
  box-shadow: var(--shadow-xs);
  padding: 20px;
}
.card--identity { border-top: 3px solid var(--brand); }
.card--muted    { background: var(--surface-alt); }
.card--flush    { padding: 0; overflow: hidden; }

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}
.stat-card {
  background: var(--surface);
  border-radius: var(--r-lg);
  border: 1px solid var(--line-soft);
  box-shadow: var(--shadow-xs);
  padding: 20px;
  position: relative;
  overflow: hidden;
}
.stat-icon  { position: absolute; top: 16px; right: 16px; font-size: 24px; opacity: .15; }
.stat-label {
  font-size: var(--fs-micro); font-weight: 600;
  color: var(--ink-faint);
  text-transform: uppercase;
  letter-spacing: 0.6px;
  margin-bottom: 8px;
}
.stat-value {
  font-size: 28px; font-weight: 700; line-height: 1;
  margin-bottom: 4px; color: var(--ink);
  letter-spacing: -0.5px;
}
.stat-sub   { font-size: var(--fs-small); color: var(--ink-faint); }
.stat-blue  .stat-value, .stat-purple .stat-value { color: var(--brand); }
.stat-green .stat-value { color: var(--success); }
.stat-amber .stat-value { color: var(--warning); }
.stat-red   .stat-value { color: var(--danger); }

.section-title {
  font-size: var(--fs-h2); font-weight: 700; color: var(--ink);
  margin-bottom: 16px;
  display: flex; align-items: center; gap: 8px;
  letter-spacing: -0.2px;
}
.section-title i { color: var(--brand); }

/* Existing page-title-icon tiles picked up the indigo identity too */
.page-title-icon {
  background: linear-gradient(135deg, var(--brand-tint), var(--brand-tint-2));
  color: var(--brand);
}
.page-title-icon[data-tone="green"]  { background: var(--success-bg); color: var(--success); }
.page-title-icon[data-tone="red"]    { background: var(--danger-bg);  color: var(--danger); }
.page-title-icon[data-tone="purple"],
.page-title-icon[data-tone="blue"]   { background: var(--brand-tint); color: var(--brand); }
.page-title-icon[data-tone="amber"]  { background: var(--warning-bg); color: var(--warning); }

/* ============================================================
 * 6. Buttons — override the base .btn family with Illunise shapes
 * ============================================================ */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 9px 16px;
  border-radius: var(--r);
  font-size: var(--fs-body); font-weight: 600;
  cursor: pointer; border: none; text-decoration: none;
  transition: background .15s var(--ease),
              border-color .15s var(--ease),
              transform .1s var(--ease);
  line-height: 1.2;
}
.btn:active   { transform: scale(0.97); }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }

.btn-primary  { background: var(--brand); color: #fff; border: 1px solid var(--brand); }
.btn-primary:hover { background: var(--brand-hover); border-color: var(--brand-hover); color:#fff; }

.btn-outline,
.btn-secondary,
.btn-ghost {
  background: var(--surface);
  color: var(--ink-mute);
  border: 1px solid var(--line);
}
.btn-outline:hover,
.btn-secondary:hover,
.btn-ghost:hover {
  background: var(--surface-alt);
  border-color: var(--brand-border);
  color: var(--brand);
}

.btn-danger {
  background: var(--surface);
  color: var(--danger);
  border: 1px solid #FCA5A5;
}
.btn-danger:hover { background: var(--danger-bg); color: var(--danger); border-color: var(--danger); }

.btn-success { background: var(--success); color: #fff; border: 1px solid var(--success); }
.btn-success:hover { background: #15803D; border-color: #15803D; color:#fff; }

.btn-icon { width: 38px; height: 36px; padding: 0; justify-content: center; }
.btn-sm   { padding: 6px 12px; font-size: var(--fs-small); }

/* ============================================================
 * 7. Badges / pills
 * ============================================================ */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 10px;
  border-radius: var(--r-pill);
  font-size: 11.5px; font-weight: 600;
  white-space: nowrap;
  line-height: 1.4;
}
.badge-green,
.badge-success             { background: var(--success-bg); color: var(--success); }
.badge-amber,
.badge-warning             { background: var(--warning-bg); color: var(--warning); }
.badge-red,
.badge-danger              { background: var(--danger-bg);  color: var(--danger); }
.badge-blue,
.badge-purple,
.badge-primary,
.badge-info                { background: var(--brand-tint); color: var(--brand); }
.badge-gray,
.badge-secondary,
.badge-neutral             { background: var(--line-soft);  color: var(--ink-soft); }

/* ============================================================
 * 8. Filter bar & pills
 * ============================================================ */
.filter-bar {
  display: flex; align-items: center; gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}
.filter-pill {
  padding: 6px 14px;
  border-radius: var(--r-pill);
  font-size: 12.5px; font-weight: 500;
  border: 1.5px solid var(--line);
  background: var(--surface);
  color: var(--ink-soft);
  cursor: pointer;
  text-decoration: none;
  transition: all .15s var(--ease);
  white-space: nowrap;
}
.filter-pill:hover  { border-color: var(--brand); color: var(--brand); }
.filter-pill.active { background: var(--brand); color: #fff; border-color: var(--brand); }

/* ============================================================
 * 9. Tables
 * ============================================================ */
.table-wrap { overflow-x: auto; }
.card table,
table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--fs-body);
}
.card thead tr,
thead tr { background: var(--surface-alt); }

.card th,
th {
  padding: 10px 14px;
  text-align: left;
  font-size: var(--fs-micro); font-weight: 600;
  color: var(--ink-soft);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
  background: var(--surface-alt);
}
.card td,
td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--line-soft);
  color: var(--ink-mute);
  vertical-align: middle;
}
.card tr:last-child td,
tr:last-child td { border-bottom: none; }

.card tbody tr:hover td,
tbody tr:hover td { background: var(--surface-alt); }

/* ============================================================
 * 10. Inputs
 * ============================================================ */
.controls {
  display: flex; align-items: center; gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}
.search-input,
.select-input,
.form-control,
input[type="text"], input[type="number"], input[type="date"],
input[type="email"], input[type="password"], input[type="search"],
select, textarea {
  padding: 9px 14px;
  border: 1.5px solid var(--line);
  border-radius: var(--r);
  font-size: var(--fs-body);
  font-family: inherit;
  color: var(--ink-body);
  background: var(--surface);
  outline: none;
  transition: border-color .15s var(--ease), box-shadow .15s var(--ease);
}
.search-input { flex: 1; min-width: 200px; }
.select-input,
select { cursor: pointer; }

.search-input:focus, .select-input:focus,
.form-control:focus,
input:focus, select:focus, textarea:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-tint);
}

.form-group { margin-bottom: 16px; }
.form-label {
  display: block;
  font-size: var(--fs-small);
  font-weight: 600;
  color: var(--ink-mute);
  margin-bottom: 6px;
}
.form-error {
  display: none;
  font-size: var(--fs-micro);
  color: var(--danger);
  margin-top: 4px;
}
.form-group.has-error .form-control { border-color: var(--danger); }
.form-group.has-error .form-error   { display: block; }

.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 16px;
}
.empty-state {
  text-align: center;
  padding: 48px 24px;
  color: var(--ink-faint);
}
.empty-state i { font-size: 28px; color: var(--ink-faint); margin-bottom: 12px; display:block; }
.empty-state h3 { color: var(--ink-body); font-weight: 700; margin: 6px 0; font-size: var(--fs-h2); }
.empty-state p  { color: var(--ink-soft); font-size: var(--fs-small); }

/* ============================================================
 * 11. Component primitives — icon tiles & card headers
 * ============================================================ */
.icon-tile {
  width: 38px; height: 38px;
  border-radius: var(--r-md);
  background: var(--brand-tint);
  color: var(--brand);
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 15px;
  flex-shrink: 0;
}
.icon-tile--sm     { width: 30px; height: 30px; border-radius: 8px; font-size: 12px; }
.icon-tile--filled { background: var(--brand); color: #fff; box-shadow: var(--shadow-brand); }
.icon-tile--onhero { background: rgba(255,255,255,.16); color: #fff; box-shadow: none; }

.card-header {
  display: flex; align-items: center; gap: 12px;
  margin-bottom: 16px;
}
.card-header .card-title,
.card-header .title {
  font-size: var(--fs-h2); font-weight: 700; color: var(--ink);
  letter-spacing: -0.2px;
  display: flex; align-items: center; gap: 8px;
}
.card-header .card-title i,
.card-header .title i { color: var(--brand); }
.card-header .subtitle {
  font-size: var(--fs-micro); color: var(--ink-soft); margin-top: 2px;
}
.card-header .spacer { flex: 1; }

/* Progress bars used in existing gateway tables */
.progress-track {
  height: 4px;
  background: var(--line-soft);
  border-radius: var(--r-pill);
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  background: var(--brand);
  border-radius: var(--r-pill);
  transition: width .3s var(--ease);
}

/* ============================================================
 * 12. Utility classes the app already sprinkles around
 * ============================================================ */
.td-muted { color: var(--ink-faint); }
.text-success { color: var(--success) !important; }
.text-danger  { color: var(--danger)  !important; }
.text-warning { color: var(--warning) !important; }
.text-info,
.text-primary { color: var(--brand)   !important; }

.fw-500 { font-weight: 500; }
.fw-600 { font-weight: 600; }
.fw-700 { font-weight: 700; }

/* Charts / donuts inherit brand colors via CSS vars in the JS render */

/* ============================================================
 * 13. Modal shell — the existing App.showModal skin
 * ============================================================ */
#modalOverlay {
  background: rgba(15, 23, 42, .55);
  backdrop-filter: blur(2px);
}
#modalOverlay .modal,
#modalOverlay > div > div {
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-md);
}

/* ============================================================
 * 14. Cat/dog dots + small chart legend swatches inherit tokens
 * ============================================================ */
.cat-dot { display:inline-block; width:8px; height:8px; border-radius:2px; }

/* ============================================================
 * 15. Global app topbar → slim utility bar
 * The existing <header class="topbar"> at the top of .main-content
 * used to be a heavy hero band. We shrink it to a plain utility
 * strip since each page now owns its gradient hero (page-header).
 * ============================================================ */
.main-content > header.topbar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 8px; flex-wrap: wrap;
  padding: 2px 0 !important;
  margin-bottom: 6px !important;
  background: transparent !important;
  box-shadow: none !important;
  border-radius: 0 !important;
  color: var(--ink-body);
  border-bottom: none !important;
  min-height: 30px !important;
  min-height: 26px !important;
}
/* Compact icon-only buttons in the topbar */
.main-content > header.topbar .btn {
  width: 26px !important; height: 26px !important;
  min-height: 0 !important;
}
.main-content > header.topbar .btn i { font-size: 10.5px !important; }
/* Hamburger button — smaller */
.main-content > header.topbar .hamburger-btn {
  width: 26px; height: 26px;
  padding: 0;
  border-radius: var(--r-sm);
  border: 1px solid var(--line);
  background: var(--surface);
}
/* Filter select — matches the tight bar */
.main-content > header.topbar .filter-select { height: 24px !important; font-size: 11px !important; padding: 2px 22px 2px 10px !important; }
/* Breadcrumb — muted, tight */
.main-content > header.topbar .breadcrumb { font-size: 11px !important; }
.main-content > header.topbar .topbar-left,
.main-content > header.topbar .topbar-right { gap: 6px !important; }

/* ============================================================
 * 39. Sidebar tightening — pack more items in viewport, drop
 * excess vertical padding so ALL nav items fit above the footer.
 * ============================================================ */
.sidebar { padding: 0; }
.sidebar .sidebar-nav {
  padding: 8px 10px 6px !important;
  flex: 1 1 auto;
  overflow-y: auto;
  min-height: 0;
}
.sidebar .sidebar-nav .nav-section-label {
  padding: 10px 8px 4px !important;
  margin: 0 !important;
  font-size: 9.5px !important;
  letter-spacing: 1px;
}
.sidebar .nav-item {
  padding: 7px 12px !important;
  margin-bottom: 1px !important;
  font-size: 13px !important;
  gap: 9px !important;
}
.sidebar .nav-item .nav-icon { font-size: 13px !important; width: 18px !important; }

/* Sidebar-logo (top) tighter */
.sidebar .sidebar-logo {
  padding: 14px 14px 12px !important;
}

/* Footer chrome tighter so nav has more room */
.sidebar .sidebar-footer {
  padding: 8px 10px !important;
  gap: 6px !important;
}
.sidebar .user-card { padding: 6px !important; }
.sidebar .user-avatar { width: 28px !important; height: 28px !important; font-size: 11px !important; }
.sidebar .user-name  { font-size: 12px !important; }
.sidebar .user-status{ font-size: 10px !important; }
.sidebar .theme-toggle,
.sidebar .sidebar-footer-actions button {
  padding: 6px 8px !important;
  font-size: 11.5px !important;
}

/* ============================================================
 * 40. Card height equalisation — swap grid for FLEX on .two-col.
 * Grid stretch was intermittent because of nested display: flex
 * interactions; plain flexbox with align-items: stretch (default)
 * ALWAYS gives equal-height columns. Overrides both earlier
 * .two-col { display: grid } declarations via !important.
 * ============================================================ */
.two-col {
  display: flex !important;
  flex-direction: row !important;
  gap: 16px !important;
  align-items: stretch !important;
}
.two-col > * {
  flex: 1 1 0 !important;
  min-width: 0 !important;
}
.two-col > .card {
  display: flex !important;
  flex-direction: column !important;
}
/* Push the LAST child (mini-stats / button row) to the card bottom
 * so both cards visually bottom-align */
.two-col > .card > *:last-child { margin-top: auto; }
@media (max-width: 900px) {
  .two-col { flex-direction: column !important; }
  .two-col > * { flex: 1 1 auto !important; }
}

/* ============================================================
 * 41. Sidebar footer buttons — Logout (+ Users when visible)
 * were rendering invisibly. Force them visible with explicit
 * outlined-button styling and semantic-danger hover for logout.
 * ============================================================ */
.sidebar .sidebar-footer-actions {
  display: flex !important;
  gap: 6px !important;
  visibility: visible !important;
  opacity: 1 !important;
}
.sidebar .sidebar-footer-actions button {
  flex: 1 !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 5px !important;
  padding: 7px 10px !important;
  border-radius: var(--r) !important;
  border: 1px solid var(--line) !important;
  background: var(--surface) !important;
  color: var(--ink-mute) !important;
  font-size: 11.5px !important;
  font-weight: 600 !important;
  cursor: pointer !important;
  visibility: visible !important;
  opacity: 1 !important;
  transition: background .15s var(--ease), color .15s var(--ease), border-color .15s var(--ease);
}
.sidebar .sidebar-footer-actions button:hover {
  background: var(--surface-alt) !important;
  color: var(--brand) !important;
  border-color: var(--brand-border) !important;
}
.sidebar .sidebar-footer-actions .btn-logout {
  color: var(--ink-mute) !important;
}
.sidebar .sidebar-footer-actions .btn-logout:hover {
  background: var(--danger-bg) !important;
  color: var(--danger) !important;
  border-color: #FCA5A5 !important;
}
.sidebar .sidebar-footer-actions button i { font-size: 11px !important; }
.main-content > header.topbar .topbar-left,
.main-content > header.topbar .topbar-right {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
}
.main-content > header.topbar .breadcrumb {
  color: var(--ink-faint);
  font-size: var(--fs-small);
  display: flex; align-items: center; gap: 6px;
}
.main-content > header.topbar .breadcrumb .breadcrumb-home { color: var(--ink-mute); }
.main-content > header.topbar .breadcrumb .sep             { color: var(--ink-faint); }
.main-content > header.topbar .breadcrumb .current         { color: var(--ink-body); font-weight: 600; }
.main-content > header.topbar .topbar-date { display: none !important; }

/* Icon-only buttons in the global topbar — hide the .btn-label span,
 * rely on tooltips for the text. */
.main-content > header.topbar .btn .btn-label {
  display: none !important;
}
.main-content > header.topbar .btn {
  width: 36px; height: 36px; padding: 0 !important;
  justify-content: center;
  border-radius: var(--r-pill);
  gap: 0;
}
.main-content > header.topbar .btn i { font-size: 13px; }
/* Primary action stays visually distinct */
.main-content > header.topbar .btn.btn-primary { background: var(--brand); color:#fff; }
.main-content > header.topbar .btn.btn-primary:hover { background: var(--brand-hover); color:#fff; }

/* Filter select (replaces the Today/Yesterday/Custom/Range pills) —
 * one compact pill-shaped native <select> that opens the OS menu.
 * Zero horizontal footprint until clicked. */
.filter-select {
  appearance: none;
  -webkit-appearance: none;
  padding: 6px 30px 6px 14px;
  border-radius: var(--r-pill);
  border: 1.5px solid var(--line);
  background: var(--surface)
              url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'><path fill='%2364748B' d='M5 6L0 0h10z'/></svg>")
              no-repeat right 10px center;
  color: var(--ink-body);
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  height: 32px;
  transition: border-color .15s var(--ease), color .15s var(--ease);
  font-family: inherit;
}
.filter-select:hover  { border-color: var(--brand); color: var(--brand); }
.filter-select:focus  { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-tint); }

/* ============================================================
 * 16. Per-page hero (was .page-header) → Illunise gradient band
 * Every page's .page-header becomes the identity block: gradient,
 * indigo→violet, white text, right-side action slot.
 * ============================================================ */
.page-header {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; flex-wrap: wrap;
  margin-bottom: 24px;
  padding: 22px 26px;
  border-radius: var(--r-xl);
  background: var(--gradient-brand);
  box-shadow: var(--shadow-hero);
  color: #fff;
  border: none;
}
.page-header .page-title {
  display: flex; align-items: center; gap: 14px;
  color: #fff;
}
.page-header .page-title-icon {
  width: 44px; height: 44px;
  border-radius: var(--r-md);
  background: rgba(255,255,255,.18) !important;
  color: #fff !important;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
  box-shadow: none;
}
.page-header .page-title-text h1 {
  font-size: var(--fs-h1);
  font-weight: 800;
  color: #fff;
  letter-spacing: -0.3px;
  margin: 0 0 4px;
  line-height: 1.15;
}
.page-header .page-title-text p {
  font-size: var(--fs-small);
  color: rgba(255,255,255,.75);
  margin: 0;
  line-height: 1.4;
}
.page-header [id$="HeaderActions"] {
  display: flex; align-items: center; gap: 8px;
  flex-wrap: wrap;
}

/* Buttons sitting on the gradient hero — swap to translucent white
 * so they stay legible against the indigo background. */
.page-header .btn,
.page-header .btn.btn-secondary,
.page-header .btn.btn-ghost,
.page-header .btn.btn-outline {
  background: rgba(255,255,255,.15);
  color: #fff;
  border: 1px solid rgba(255,255,255,.22);
}
.page-header .btn:hover,
.page-header .btn.btn-secondary:hover,
.page-header .btn.btn-ghost:hover,
.page-header .btn.btn-outline:hover {
  background: rgba(255,255,255,.25);
  border-color: rgba(255,255,255,.32);
  color: #fff;
}
.page-header .btn.btn-primary {
  background: #fff;
  color: var(--brand);
  border: 1px solid #fff;
}
.page-header .btn.btn-primary:hover {
  background: var(--brand-tint);
  color: var(--brand-hover);
  border-color: var(--brand-tint);
}
.page-header .btn.btn-danger {
  background: rgba(255,255,255,.15);
  color: #FEE2E2;
  border: 1px solid rgba(254,226,226,.4);
}
.page-header .btn.btn-danger:hover {
  background: var(--danger);
  color: #fff;
  border-color: var(--danger);
}

/* ============================================================
 * 17. Sidebar polish — sidebar-logo icon tile, footer chrome
 * ============================================================ */
.sidebar .sidebar-logo {
  padding: 20px 20px 16px;
  border-bottom: 1px solid var(--line);
  gap: 10px;
}
.sidebar .sidebar-logo .logo-icon {
  width: 36px; height: 36px;
  background: linear-gradient(135deg, var(--brand), var(--brand-soft));
  border-radius: var(--r);
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 14px; font-weight: 800;
  color: #fff;
  letter-spacing: -0.5px;
}
.sidebar .sidebar-logo .logo-text h2 {
  font-size: 15px; font-weight: 700;
  color: var(--ink-body);
  letter-spacing: -0.3px;
  margin: 0;
}
.sidebar .sidebar-logo .logo-text span {
  font-size: 11px;
  color: var(--ink-faint);
  font-weight: 500;
}
.sidebar .sidebar-collapse {
  margin-left: auto;
  background: transparent;
  color: var(--ink-faint);
  border: none;
  cursor: pointer;
  padding: 6px;
  border-radius: var(--r-sm);
}
.sidebar .sidebar-collapse:hover { background: var(--surface-alt); color: var(--brand); }

.sidebar .sidebar-nav { padding: 12px; }
.sidebar .sidebar-nav .nav-section-label {
  font-size: var(--fs-eyebrow);
  font-weight: 600;
  color: var(--ink-faint);
  text-transform: uppercase;
  letter-spacing: 0.8px;
  padding: 12px 8px 6px;
  margin: 0;
}
.sidebar .sidebar-footer {
  margin-top: auto;
  padding: 12px;
  border-top: 1px solid var(--line);
  display: flex; flex-direction: column; gap: 10px;
}
.sidebar .user-card {
  display: flex; align-items: center; gap: 10px;
  padding: 8px;
  border-radius: var(--r);
  background: var(--surface-alt);
}
.sidebar .user-avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--brand), var(--brand-soft));
  color: #fff;
  display: inline-flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 12px;
}
.sidebar .user-name  { font-size: var(--fs-small); font-weight: 600; color: var(--ink-body); }
.sidebar .user-status{ font-size: var(--fs-micro); color: var(--ink-soft); display:flex; align-items:center; gap:4px; }
.sidebar .status-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--success); }

.sidebar .sidebar-footer-actions {
  display: flex; gap: 6px;
}
.sidebar .sidebar-footer-actions button {
  flex: 1;
  padding: 8px 10px;
  border-radius: var(--r);
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink-mute);
  font-size: var(--fs-small);
  font-weight: 600;
  cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  transition: background .15s, color .15s;
}
.sidebar .sidebar-footer-actions button:hover {
  background: var(--surface-alt);
  color: var(--brand);
  border-color: var(--brand-border);
}
.sidebar .sidebar-footer-actions .btn-logout:hover {
  background: var(--danger-bg);
  color: var(--danger);
  border-color: #FCA5A5;
}
.sidebar .theme-toggle {
  width: 100%;
  padding: 8px 10px;
  border-radius: var(--r);
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink-mute);
  font-size: var(--fs-small);
  font-weight: 600;
  cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
}
.sidebar .theme-toggle:hover { background: var(--surface-alt); color: var(--brand); }

/* ============================================================
 * 18. Section wrappers — .section utility used across pages
 * ============================================================ */
.section {
  margin-bottom: 20px;
}
.section:last-child { margin-bottom: 0; }

/* Existing tx-hero-row / pf-hero-row hero blocks: give them the
 * card look so they read as elevated widgets, not raw rows */
.tx-hero-row,
.pf-hero-row {
  background: var(--surface);
  border-radius: var(--r-lg);
  border: 1px solid var(--line-soft);
  box-shadow: var(--shadow-xs);
  padding: 20px;
}

/* ============================================================
 * 19. Toasts, tooltips — align to token palette
 * ============================================================ */
.toast {
  border-radius: var(--r);
  box-shadow: var(--shadow-md);
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink-body);
}
.toast-success .toast-icon { color: var(--success); }
.toast-error   .toast-icon { color: var(--danger); }
.toast-warning .toast-icon { color: var(--warning); }
.toast-info    .toast-icon { color: var(--brand); }

/* ============================================================
 * 20. Dark-mode friendliness — the app supports theme cycling.
 * Illunise skin sticks to light mode; when dark mode is active,
 * we invert the neutral tokens only (brand palette stays).
 * ============================================================ */
[data-theme="dark"] {
  --ink:          #F8FAFC;
  --ink-body:     #E2E8F0;
  --ink-mute:     #CBD5E1;
  --ink-soft:     #94A3B8;
  --ink-faint:    #64748B;
  --line:         #334155;
  --line-soft:    #1E293B;
  --surface:      #0F172A;
  --surface-alt:  #1E293B;
  --bg:           #0B1220;
  --text-1:       #F8FAFC;
  --text-2:       #E2E8F0;
  --text-3:       #CBD5E1;
  --text-4:       #94A3B8;
  --card:         #0F172A;
  --card-2:       #1E293B;
  --card-border:  #334155;
  --brand-tint:   #3A0A14;
  --brand-tint-2: #312E81;
}

/* ============================================================
 * 21. Grid utilities — reflow-friendly card layouts
 * ============================================================ */
.two-col   { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.three-col { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.auto-fit  { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 14px; }
@media (max-width: 900px) {
  .two-col, .three-col { grid-template-columns: 1fr; }
}

/* ============================================================
 * 22. Eyebrows, section dividers, chips, pills
 * ============================================================ */
.eyebrow {
  font-size: var(--fs-eyebrow);
  color: var(--ink-faint);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-weight: 700;
  display: inline-flex; align-items: center; gap: 5px;
}
.eyebrow i { color: inherit; opacity: .8; }

.section-divider {
  display: flex; align-items: center; gap: 10px;
  margin: 18px 0 10px;
  color: var(--ink-faint);
  font-size: var(--fs-eyebrow);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.section-divider::before,
.section-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--line);
}

.pill {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 4px 11px;
  border-radius: var(--r-pill);
  font-size: 11px;
  font-weight: 700;
  background: var(--brand-tint);
  color: var(--brand);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.pill--muted   { background: var(--line-soft);  color: var(--ink-soft); }
.pill--success { background: var(--success-bg); color: var(--success); }
.pill--warn    { background: var(--warning-bg); color: var(--warning); }
.pill--danger  { background: var(--danger-bg);  color: var(--danger); }

.chip {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 10px;
  border-radius: var(--r-pill);
  font-size: var(--fs-eyebrow);
  font-weight: 800;
  letter-spacing: 0.3px;
  background: var(--brand-tint);
  color: var(--brand);
  text-transform: uppercase;
}
.chip-neutral { background: var(--line-soft); color: var(--ink-soft); }

/* ============================================================
 * 23. Hero band (soft in-card gradient strip)
 * Used with .card--flush wrapper for "Live Status" style panels.
 * ============================================================ */
.hero-band {
  padding: 14px 18px;
  background: linear-gradient(135deg, var(--brand-tint) 0%, var(--surface-alt) 100%);
  border-bottom: 1px solid var(--line);
  display: flex; align-items: center; gap: 12px;
}
.hero-band .eyebrow { color: var(--ink-soft); }

/* ============================================================
 * 24. Setup panel (empty-state CTA — Recipe 5)
 * Colour is via inline var override on --setup-fg/-bg/-border,
 * defaults to indigo. Semantic variants: --danger / --success / --warn.
 * ============================================================ */
.setup-panel {
  display: flex; flex-direction: column; align-items: center; gap: 12px;
  padding: 26px 12px;
  background: var(--brand-tint);
  border: 1px dashed var(--brand-border);
  border-radius: 12px;
  text-align: center;
}
.setup-panel--danger  { background: var(--danger-bg);  border-color: #FCA5A5; }
.setup-panel--success { background: var(--success-bg); border-color: #86EFAC; }
.setup-panel--warn    { background: var(--warning-bg); border-color: #FCD34D; }
.setup-panel-icon {
  font-size: 26px;
  color: var(--brand);
}
.setup-panel--danger  .setup-panel-icon { color: var(--danger); }
.setup-panel--success .setup-panel-icon { color: var(--success); }
.setup-panel--warn    .setup-panel-icon { color: var(--warning); }
.setup-panel-btn {
  padding: 10px 20px;
  background: var(--brand);
  color: #fff;
  border: none;
  border-radius: 9px;
  font-size: 12.5px;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex; align-items: center; gap: 8px;
  transition: background .15s var(--ease), transform .1s var(--ease);
}
.setup-panel-btn:hover  { background: var(--brand-hover); transform: translateY(-1px); }
.setup-panel--danger  .setup-panel-btn { background: var(--danger); }
.setup-panel--danger  .setup-panel-btn:hover { background: #B91C1C; }
.setup-panel--success .setup-panel-btn { background: var(--success); }
.setup-panel--success .setup-panel-btn:hover { background: #15803D; }
.setup-panel--warn    .setup-panel-btn { background: var(--warning); }
.setup-panel--warn    .setup-panel-btn:hover { background: #B45309; }

/* ============================================================
 * 25. Entity card (Recipe 3 — the signature "big value + stats" card)
 * .ent-card wraps: .ent-head (tile + name + key + right-slot button),
 * .ent-amount (centered big number), .ent-stats (3-col mini stats),
 * optional .ent-foot (footer meta strip).
 * ============================================================ */
.ent-card {
  padding: 20px;
  border-top: 3px solid var(--brand);
}
.ent-head {
  display: flex; align-items: center; gap: 10px;
  margin-bottom: 18px;
}
.ent-tile {
  width: 44px; height: 44px;
  border-radius: 12px;
  display: grid; place-items: center;
  font-size: 19px;
  flex-shrink: 0;
  background: var(--brand-tint);
  color: var(--brand);
}
.ent-name {
  font-size: 15px; font-weight: 800;
  color: var(--ink);
  letter-spacing: -0.1px;
  display: flex; align-items: center; gap: 6px;
  line-height: 1.15;
}
.ent-key {
  font-size: 10.5px;
  color: var(--ink-faint);
  font-family: ui-monospace, monospace;
  margin-top: 2px;
}
.ent-btn {
  width: 32px; height: 32px;
  border-radius: 9px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink-mute);
  cursor: pointer;
  display: grid; place-items: center;
  font-size: 11px;
  transition: all .15s var(--ease);
  flex-shrink: 0;
}
.ent-btn:hover {
  background: var(--brand);
  color: #fff;
  border-color: var(--brand);
  transform: translateY(-1px);
}
.ent-amount        { text-align: center; padding: 4px 0 18px; }
.ent-amount-value  {
  font-size: 30px; font-weight: 800;
  letter-spacing: -0.8px;
  font-family: ui-monospace, monospace;
  line-height: 1.1;
  color: var(--ink);
}
.ent-stats {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px;
  margin-bottom: 10px;
}
.ent-stat {
  background: var(--surface-alt);
  border-radius: 12px;
  padding: 12px 6px;
  text-align: center;
  transition: background .15s var(--ease);
}
.ent-stat:hover { background: var(--brand-tint); }
.ent-stat-icon {
  width: 32px; height: 32px;
  border-radius: 50%;
  display: grid; place-items: center;
  margin: 0 auto 8px;
  font-size: 12px;
}
.ent-stat-val {
  font-size: 13px; font-weight: 800;
  font-family: ui-monospace, monospace;
  font-variant-numeric: tabular-nums;
  color: var(--ink);
}
.ent-stat-sub {
  font-size: 10px;
  color: var(--ink-faint);
  font-weight: 700;
  margin-top: 3px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}
.ent-foot {
  display: flex; align-items: center; gap: 10px;
  padding-top: 12px;
  margin-top: 8px;
  border-top: 1px dotted var(--line-soft);
  font-size: 10.5px;
  color: var(--ink-faint);
  flex-wrap: wrap;
}
.ent-foot-item {
  display: inline-flex; align-items: center; gap: 5px;
  font-weight: 700;
}

/* ============================================================
 * 26. Numeric column helper — line up digits in tables
 * ============================================================ */
.num, td.num, th.num {
  text-align: right;
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  color: var(--ink);
}

/* ============================================================
 * 27. Admin-info block (sidebar footer variant per spec)
 * Existing .user-card already covers our footer, this pairs
 * with it for pages that want the simpler .admin-info shape.
 * ============================================================ */
.admin-info {
  display: flex; align-items: center; gap: 10px;
}
.admin-avatar {
  width: 32px; height: 32px;
  background: linear-gradient(135deg, var(--brand), var(--brand-soft));
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: #fff;
  font-size: var(--fs-small);
  font-weight: 700;
}
.admin-name { font-size: var(--fs-body); font-weight: 600; color: var(--ink-body); }
.admin-role { font-size: var(--fs-micro); color: var(--ink-faint); }

/* ============================================================
 * 28. Auth page template (Template D)
 * body.auth centers a small card on a soft indigo gradient.
 * ============================================================ */
body.auth,
body.login {
  display: flex; align-items: center; justify-content: center;
  min-height: 100vh;
  background: linear-gradient(135deg, var(--brand-tint) 0%, var(--bg) 100%);
}
.auth-card,
.login-card {
  background: var(--surface);
  border-radius: var(--r-xl);
  box-shadow: 0 8px 32px rgba(255, 23, 68,0.12);
  padding: 40px 36px;
  width: 100%;
  max-width: 400px;
}
.auth-title { font-size: 22px; font-weight: 700; color: var(--ink); text-align: center; margin-bottom: 4px; }
.auth-sub   { font-size: 13px; color: var(--ink-faint); text-align: center; margin-bottom: 28px; }

/* ============================================================
 * 29. Icon-only button micro-affordance
 * When a button is icon-only, keep it compact + circular hover halo.
 * ============================================================ */
.btn-icon-only {
  width: 34px; height: 34px;
  padding: 0;
  border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  background: transparent;
  color: var(--ink-mute);
  border: 1px solid var(--line);
  cursor: pointer;
  transition: background .15s var(--ease), color .15s var(--ease), border-color .15s var(--ease);
}
.btn-icon-only:hover {
  background: var(--brand-tint);
  color: var(--brand);
  border-color: var(--brand-border);
}
.btn-icon-only.is-danger:hover {
  background: var(--danger-bg);
  color: var(--danger);
  border-color: #FCA5A5;
}

/* ============================================================
 * 30. Pagination — small button strip pattern
 * ============================================================ */
.pagination {
  display: flex; gap: 6px; justify-content: center;
  margin-top: 16px;
  flex-wrap: wrap;
}
.pagination .btn { min-width: 34px; justify-content: center; }

/* ============================================================
 * 31. Table cell affordances used across the app
 * ============================================================ */
td .row-icon {
  display: inline-flex; align-items: center; gap: 8px;
  color: var(--ink);
  font-weight: 700;
}
td .row-icon .icon-tile--sm { font-size: 11px; }

/* Monospace IDs in the ID column (existing pattern) */
td.mono, .mono {
  font-family: ui-monospace, 'JetBrains Mono', monospace;
  font-size: var(--fs-small);
  color: var(--brand);
  font-weight: 700;
}

/* ============================================================
 * 32. Font Awesome vertical alignment — subtle micro-tune
 * ============================================================ */
.fa-solid, .fa-regular, .fa-brands, .fas, .far, .fab {
  vertical-align: middle;
}

/* ============================================================
 * 33. Modal shell (Illunise dialog per spec §10)
 * Center-screen, 520px max, 16px radius, 20px drop shadow.
 * Existing App.showModal targets #modalOverlay + #modalBody, so
 * we style those. Additional dialogs that hand-roll HTML can
 * use these class names directly.
 * ============================================================ */
.illunise-modal-overlay {
  position: fixed; inset: 0;
  background: rgba(15,23,42,.4);
  z-index: 9998;
  display: none;
  align-items: center; justify-content: center;
  padding: 20px;
  backdrop-filter: blur(2px);
}
.illunise-modal-overlay.open { display: flex; }
.illunise-modal {
  background: var(--surface);
  border-radius: var(--r-xl);
  max-width: 520px;
  width: 100%;
  padding: 26px;
  box-shadow: 0 20px 60px rgba(15,23,42,.25);
  max-height: 90vh;
  overflow-y: auto;
}
.illunise-modal-title {
  font-size: 16px; font-weight: 800; color: var(--ink);
}
.illunise-modal-close {
  background: transparent; border: none;
  color: var(--ink-soft); cursor: pointer;
  font-size: 16px;
  width: 28px; height: 28px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: var(--r-sm);
}
.illunise-modal-close:hover { background: var(--line-soft); color: var(--ink); }
.illunise-modal-actions {
  display: flex; gap: 10px; margin-top: 24px;
}
.illunise-modal-actions .btn { flex: 1; justify-content: center; }

/* Existing App.showModal shell — style the persistent modal DOM
 * so it looks like the Illunise dialog too. */
#modalOverlay { padding: 20px; }
#modalOverlay .modal,
#modalOverlay > div:not([id]) {
  border-radius: var(--r-xl) !important;
  box-shadow: 0 20px 60px rgba(15,23,42,.25);
  max-width: 520px !important;
}
#modalTitleText { font-size: 16px; font-weight: 800; color: var(--ink); }

/* ============================================================
 * 34. Density polish — cap dense pages
 * ============================================================ */
.card + .card { margin-top: 16px; }

/* ============================================================
 * 35. Sidebar: force ALWAYS-EXPANDED
 * The app remembers a "collapsed" state in localStorage that hid
 * every nav label. Illunise design has one sidebar shape — always
 * expanded — so we override the collapsed state and hide the
 * collapse toggle entirely.
 * ============================================================ */
.sidebar,
.sidebar.collapsed { width: 240px !important; }
.sidebar.collapsed ~ .main-content,
.main-content            { margin-left: 240px !important; }

/* Force every collapsed-hidden element back to full visibility.
 * styles.css hides labels via opacity:0 + width:0 + overflow:hidden;
 * redesign.css uses display:none; we override ALL of them. */
.sidebar.collapsed .nav-label,
.sidebar.collapsed .logo-text,
.sidebar.collapsed .nav-section-label,
.sidebar.collapsed .user-info {
  display: inline-block !important;
  opacity: 1 !important;
  width: auto !important;
  height: auto !important;
  overflow: visible !important;
  visibility: visible !important;
  white-space: nowrap;
}
.sidebar.collapsed .logo-text        { display: block   !important; }
.sidebar.collapsed .nav-section-label{ display: block   !important; padding: 12px 8px 6px !important; }
.sidebar.collapsed .user-card,
.sidebar.collapsed .sidebar-footer-actions,
.sidebar.collapsed .theme-toggle,
.sidebar.collapsed .footer-row .theme-toggle {
  display: flex !important;
  opacity: 1 !important;
  visibility: visible !important;
}
.sidebar.collapsed .sidebar-footer-actions { flex-direction: row !important; }
.sidebar.collapsed .sidebar-footer-actions button {
  flex: 1 !important;
  width: auto !important;
  padding: 8px 10px !important;
}
.sidebar.collapsed .logo-icon         { display: flex !important; }
.sidebar.collapsed .sidebar-logo      { justify-content: flex-start !important; }
.sidebar.collapsed .nav-item {
  justify-content: flex-start !important;
  padding: 9px 12px !important;
}

/* Kill the toggle chevron — no collapse UI at all */
.sidebar-collapse, .sidebar .sidebar-collapse { display: none !important; }

/* Logo tile — small, tight, no heavy drop shadow */
.sidebar .sidebar-logo {
  padding: 16px 16px 14px !important;
  gap: 10px !important;
  align-items: center;
}
.sidebar .sidebar-logo .logo-icon {
  width: 36px !important;
  height: 36px !important;
  border-radius: var(--r) !important;
  background: linear-gradient(135deg, var(--brand), var(--brand-soft)) !important;
  box-shadow: none !important;
  font-size: 13px !important;
  font-weight: 800 !important;
  color: #fff !important;
  letter-spacing: -0.5px;
  flex-shrink: 0;
}
.sidebar .sidebar-logo .logo-text h2 {
  font-size: 14px !important;
  font-weight: 700 !important;
  color: var(--ink-body) !important;
  letter-spacing: -0.2px !important;
  line-height: 1.15;
  margin: 0 !important;
}
.sidebar .sidebar-logo .logo-text span {
  font-size: 9.5px !important;
  color: var(--ink-faint) !important;
  letter-spacing: 1.2px !important;
  font-weight: 700 !important;
  text-transform: uppercase;
}

/* ============================================================
 * 38. Tooltip — solid white box above the element, everywhere.
 * Overrides the app's data-tooltip::after so it pops against
 * any background (light or dark) with a proper shadow.
 * ============================================================ */
[data-tooltip] { position: relative; }
[data-tooltip]::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: calc(100% + 8px) !important;
  left: 50% !important;
  transform: translateX(-50%) !important;
  background: var(--surface) !important;
  color: var(--ink) !important;
  border: 1px solid var(--line) !important;
  box-shadow: var(--shadow-md) !important;
  font-size: 12px !important;
  font-weight: 600 !important;
  padding: 6px 10px !important;
  border-radius: var(--r-sm) !important;
  white-space: nowrap !important;
  pointer-events: none;
  opacity: 0;
  transition: opacity .12s var(--ease), transform .12s var(--ease);
  z-index: 10000;
  max-width: 320px;
  overflow: hidden;
  text-overflow: ellipsis;
}
/* Small tail below the tooltip pointing at the element */
[data-tooltip]::before {
  content: '';
  position: absolute;
  bottom: calc(100% + 3px);
  left: 50%;
  transform: translateX(-50%) rotate(45deg);
  width: 8px; height: 8px;
  background: var(--surface);
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  opacity: 0;
  transition: opacity .12s var(--ease);
  pointer-events: none;
  z-index: 10000;
}
[data-tooltip]:hover::after,
[data-tooltip]:hover::before { opacity: 1; }
[data-tooltip]:hover::after  { transform: translateX(-50%) translateY(-2px); }
/* Collapsed-sidebar tooltip variant is now redundant (we don't collapse) */
.sidebar.collapsed .nav-item::after,
.sidebar.collapsed .nav-item::before { display: none !important; }

/* ============================================================
 * 36. Page-header → FLAT compact strip (not a gradient hero)
 * The app's global topbar already shows breadcrumb + page name;
 * repeating that as a giant violet band underneath is a second
 * competing identity. Reduce .page-header to a lean icon-tile +
 * title + subtitle strip with right-aligned actions.
 * ============================================================ */
.page-header {
  padding: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
  color: var(--ink) !important;
  margin-bottom: 10px !important;
  border-radius: 0 !important;
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; flex-wrap: wrap;
  min-height: 32px;
}
.page-header .page-title {
  display: flex; align-items: center; gap: 8px;
  color: var(--ink);
}
.page-header .page-title-icon {
  width: 28px !important; height: 28px !important;
  border-radius: var(--r-sm) !important;
  background: var(--brand-tint) !important;
  color: var(--brand) !important;
  font-size: 12px !important;
  box-shadow: none !important;
  display: inline-flex; align-items: center; justify-content: center;
}
/* Tone variants for the flat page-title-icon */
.page-header .page-title-icon[data-tone="green"]  { background: var(--success-bg) !important; color: var(--success) !important; }
.page-header .page-title-icon[data-tone="red"]    { background: var(--danger-bg)  !important; color: var(--danger)  !important; }
.page-header .page-title-icon[data-tone="amber"]  { background: var(--warning-bg) !important; color: var(--warning) !important; }
.page-header .page-title-icon[data-tone="purple"],
.page-header .page-title-icon[data-tone="blue"]   { background: var(--brand-tint) !important; color: var(--brand)   !important; }
.page-header .page-title-text h1 {
  color: var(--ink) !important;
  font-size: 15px !important;
  font-weight: 700 !important;
  letter-spacing: -0.2px;
  margin: 0 !important;
  line-height: 1.15;
}
.page-header .page-title-text p {
  display: none !important;  /* all subtitles stripped; hide any stragglers */
}
/* Buttons in the flat header — normal Illunise style, not translucent-on-gradient */
.page-header .btn.btn-primary {
  background: var(--brand) !important;
  color: #fff !important;
  border: 1px solid var(--brand) !important;
}
.page-header .btn.btn-primary:hover {
  background: var(--brand-hover) !important;
  border-color: var(--brand-hover) !important;
}
.page-header .btn,
.page-header .btn.btn-secondary,
.page-header .btn.btn-outline,
.page-header .btn.btn-ghost {
  background: var(--surface);
  color: var(--ink-mute);
  border: 1px solid var(--line);
}
.page-header .btn:hover,
.page-header .btn.btn-secondary:hover,
.page-header .btn.btn-outline:hover,
.page-header .btn.btn-ghost:hover {
  background: var(--surface-alt);
  color: var(--brand);
  border-color: var(--brand-border);
}
.page-header .btn.btn-danger {
  background: var(--surface);
  color: var(--danger);
  border: 1px solid #FCA5A5;
}
.page-header .btn.btn-danger:hover {
  background: var(--danger-bg);
  color: var(--danger);
  border-color: var(--danger);
}

/* ============================================================
 * 37. Filter pill — style the inline-styled Today/Yesterday
 * buttons that dashboard.js and profits.js inject into the
 * topbar. They target button[onclick*="setFilterMode"].
 * ============================================================ */
button[onclick*="setFilterMode"] {
  height: 32px !important;
  padding: 6px 14px !important;
  border-radius: var(--r-pill) !important;
  border: 1.5px solid var(--line) !important;
  background: var(--surface) !important;
  color: var(--ink-soft) !important;
  font-size: 12.5px !important;
  font-weight: 600 !important;
  cursor: pointer;
  transition: all .15s var(--ease);
  white-space: nowrap;
}
button[onclick*="setFilterMode"]:hover {
  border-color: var(--brand) !important;
  color: var(--brand) !important;
}
/* Active state is applied via inline style — detect the indigo
 * background inline-set to var(--primary) and honour it */
button[onclick*="setFilterMode"][style*="var(--primary)"],
button[onclick*="setFilterMode"][style*="background:var(--brand)"] {
  background: var(--brand) !important;
  color: #fff !important;
  border-color: var(--brand) !important;
}
