@font-face {
  font-family: "Ubuntu";
  font-style: normal;
  font-weight: 400;
  src: url("./fonts/Ubuntu-Regular.ttf") format("truetype");
}

@font-face {
  font-family: "Ubuntu";
  font-style: italic;
  font-weight: 400;
  src: url("./fonts/Ubuntu-Italic.ttf") format("truetype");
}

@font-face {
  font-family: "Ubuntu";
  font-style: normal;
  font-weight: 700;
  src: url("./fonts/Ubuntu-Bold.ttf") format("truetype");
}

/* ─── Design tokens ─────────────────────────────────────────── */
:root {
  color-scheme: light;

  /* Surface */
  --bg:               #f2ece2;
  --bg-accent:        #e4dace;
  --surface:          rgba(255, 253, 248, 0.96);
  --surface-strong:   #fffefb;
  --surface-alt:      #f9f5ee;

  /* Lines */
  --line:             rgba(80, 60, 30, 0.10);
  --line-strong:      rgba(80, 60, 30, 0.20);

  /* Text */
  --text:             #1e160a;
  --muted:            #72614e;

  /* Brand */
  --accent:           #a06826;
  --accent-strong:    #7a4c12;
  --accent-soft:      rgba(160, 104, 38, 0.12);

  /* Semantic */
  --danger:           #c0463b;
  --danger-soft:      rgba(192, 70, 59, 0.11);
  --success:          #197a5a;
  --success-soft:     rgba(25, 122, 90, 0.11);
  --warning:          #c4831a;

  /* Shadows */
  --shadow-sm:        0 2px 8px rgba(30, 18, 6, 0.07);
  --shadow:           0 8px 28px rgba(30, 18, 6, 0.10), 0 2px 6px rgba(30, 18, 6, 0.06);
  --shadow-lg:        0 20px 52px rgba(30, 18, 6, 0.13), 0 4px 12px rgba(30, 18, 6, 0.06);
  --shadow-xl:        0 32px 72px rgba(30, 18, 6, 0.16), 0 8px 20px rgba(30, 18, 6, 0.07);

  /* Backgrounds */
  --body-background:
    radial-gradient(ellipse 60% 40% at 0% 0%,   rgba(160, 104, 38, 0.13), transparent),
    radial-gradient(ellipse 50% 40% at 100% 100%, rgba(100, 64, 18, 0.09), transparent),
    linear-gradient(160deg, #faf6ef 0%, #ede5d5 55%, #f8f4ec 100%);

  --sidebar-background: linear-gradient(175deg, #1a0f04 0%, #3a240e 60%, #2c1a08 100%);
  --sidebar-text: #fff8f0;
  --sidebar-link-bg: rgba(255, 246, 230, 0.05);
  --sidebar-link-border: rgba(230, 195, 130, 0.10);
  --sidebar-link-text: rgba(255, 238, 208, 0.82);

  --hero-background: linear-gradient(145deg, #1e0f04 0%, #7a4c12 60%, #a06828 100%);
  --brand-background: linear-gradient(135deg, #f5d49a, #c07e30);
  --brand-text: #3a240d;

  /* Radii — max 7px across all widgets */
  --radius-xs: 3px;
  --radius-sm: 5px;
  --radius-md: 7px;
  --radius-lg: 7px;
  --radius-xl: 7px;
  --radius-2xl: 7px;

  /* Typography */
  --font-body:    "Ubuntu", "Trebuchet MS", sans-serif;
  --font-heading: "Ubuntu", "Trebuchet MS", sans-serif;

  /* Animation */
  --ease-out:  cubic-bezier(0.22, 1, 0.36, 1);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* ─── Theme: Midnight ───────────────────────────────────────── */
:root[data-theme="midnight"] {
  color-scheme: dark;
  --bg:               #090e15;
  --bg-accent:        #101923;
  --surface:          rgba(14, 22, 32, 0.96);
  --surface-strong:   #0c1520;
  --surface-alt:      #111d29;
  --line:             rgba(120, 148, 178, 0.14);
  --line-strong:      rgba(120, 148, 178, 0.26);
  --text:             #e6edf5;
  --muted:            #8fa3b8;
  --accent:           #4a90d9;
  --accent-strong:    #2e6eb8;
  --accent-soft:      rgba(74, 144, 217, 0.14);
  --danger:           #df6b62;
  --danger-soft:      rgba(223, 107, 98, 0.13);
  --success:          #38b38a;
  --success-soft:     rgba(56, 179, 138, 0.13);
  --warning:          #e3a649;
  --shadow-sm:        0 2px 8px rgba(0,0,0,0.24);
  --shadow:           0 8px 28px rgba(0,0,0,0.32), 0 2px 6px rgba(0,0,0,0.20);
  --shadow-lg:        0 20px 52px rgba(0,0,0,0.42), 0 4px 12px rgba(0,0,0,0.22);
  --shadow-xl:        0 32px 72px rgba(0,0,0,0.52), 0 8px 20px rgba(0,0,0,0.24);
  --body-background:
    radial-gradient(ellipse 55% 40% at 0% 0%,    rgba(74, 144, 217, 0.13), transparent),
    radial-gradient(ellipse 45% 35% at 100% 100%, rgba(56, 179, 138, 0.10), transparent),
    linear-gradient(160deg, #07101a 0%, #0d1928 55%, #09121e 100%);
  --sidebar-background: linear-gradient(175deg, #050d14 0%, #0c1927 60%, #071020 100%);
  --sidebar-text: #ecf5ff;
  --sidebar-link-bg: rgba(230, 248, 255, 0.04);
  --sidebar-link-border: rgba(120, 160, 210, 0.10);
  --sidebar-link-text: rgba(220, 238, 255, 0.82);
  --hero-background: linear-gradient(145deg, #060e18 0%, #193255 60%, #2e6eb8 100%);
  --brand-background: linear-gradient(135deg, #1a3556, #4a90d9);
  --brand-text: #eef8ff;
}

/* ─── Theme: Emerald ────────────────────────────────────────── */
:root[data-theme="emerald"] {
  --bg:               #eaf6ef;
  --bg-accent:        #d4ede2;
  --surface:          rgba(250, 255, 252, 0.96);
  --surface-strong:   #ffffff;
  --surface-alt:      #edf8f3;
  --line:             rgba(20, 80, 58, 0.11);
  --line-strong:      rgba(20, 80, 58, 0.21);
  --text:             #12392b;
  --muted:            #587d6f;
  --accent:           #17825f;
  --accent-strong:    #0f6849;
  --accent-soft:      rgba(23, 130, 95, 0.12);
  --danger:           #be5454;
  --danger-soft:      rgba(190, 84, 84, 0.11);
  --success:          #17825f;
  --success-soft:     rgba(23, 130, 95, 0.11);
  --warning:          #c88b2a;
  --body-background:
    radial-gradient(ellipse 60% 40% at 0% 0%,    rgba(23, 130, 95, 0.15), transparent),
    radial-gradient(ellipse 50% 40% at 100% 100%, rgba(80, 170, 130, 0.10), transparent),
    linear-gradient(160deg, #f6fdf9 0%, #e5f5ed 55%, #f7fcf9 100%);
  --sidebar-background: linear-gradient(175deg, #082d20 0%, #155e44 60%, #0e4a34 100%);
  --sidebar-text: #eafef4;
  --sidebar-link-bg: rgba(244, 255, 249, 0.05);
  --sidebar-link-border: rgba(140, 220, 190, 0.12);
  --sidebar-link-text: rgba(230, 254, 244, 0.84);
  --hero-background: linear-gradient(145deg, #072018 0%, #166048 60%, #209d74 100%);
  --brand-background: linear-gradient(135deg, #bff0d6, #1da876);
  --brand-text: #0d3525;
}

/* ─── Theme: Executive ──────────────────────────────────────── */
:root[data-theme="executive"] {
  --bg:               #eef2f9;
  --bg-accent:        #dce5f2;
  --surface:          rgba(255, 255, 255, 0.96);
  --surface-strong:   #ffffff;
  --surface-alt:      #f4f7fd;
  --line:             rgba(20, 40, 75, 0.11);
  --line-strong:      rgba(20, 40, 75, 0.21);
  --text:             #162840;
  --muted:            #5e748e;
  --accent:           #2960c8;
  --accent-strong:    #1a45a0;
  --accent-soft:      rgba(41, 96, 200, 0.12);
  --danger:           #c45350;
  --danger-soft:      rgba(196, 83, 80, 0.11);
  --success:          #1e7e6c;
  --success-soft:     rgba(30, 126, 108, 0.11);
  --warning:          #cc8a26;
  --body-background:
    radial-gradient(ellipse 60% 40% at 100% 0%,  rgba(41, 96, 200, 0.13), transparent),
    radial-gradient(ellipse 50% 40% at 0% 100%,  rgba(30, 126, 108, 0.10), transparent),
    linear-gradient(160deg, #f6faff 0%, #eaf0f9 55%, #f8fbff 100%);
  --sidebar-background: linear-gradient(175deg, #0d1e3a 0%, #1c3a6a 60%, #152f58 100%);
  --sidebar-text: #eef6ff;
  --sidebar-link-bg: rgba(236, 247, 255, 0.05);
  --sidebar-link-border: rgba(120, 165, 230, 0.12);
  --sidebar-link-text: rgba(225, 242, 255, 0.84);
  --hero-background: linear-gradient(145deg, #0a1830 0%, #1c3a6a 60%, #2960c8 100%);
  --brand-background: linear-gradient(135deg, #d8e8ff, #5a8ee8);
  --brand-text: #152f58;
}

/* ─── Theme: Glass ──────────────────────────────────────────── */
:root[data-theme="glass"] {
  --bg:               #e8f5f3;
  --bg-accent:        #d2ede9;
  --surface:          rgba(250, 255, 254, 0.74);
  --surface-strong:   rgba(255, 255, 255, 0.92);
  --surface-alt:      rgba(234, 250, 248, 0.80);
  --line:             rgba(15, 95, 90, 0.15);
  --line-strong:      rgba(15, 95, 90, 0.28);
  --text:             #0f3038;
  --muted:            #537880;
  --accent:           #0c9c92;
  --accent-strong:    #076e6a;
  --accent-soft:      rgba(12, 156, 146, 0.14);
  --danger:           #c25265;
  --danger-soft:      rgba(194, 82, 101, 0.12);
  --success:          #148665;
  --success-soft:     rgba(20, 134, 101, 0.12);
  --warning:          #be8a2d;
  --shadow:           0 8px 32px rgba(12, 68, 76, 0.15), 0 2px 8px rgba(12, 68, 76, 0.08);
  --shadow-lg:        0 24px 60px rgba(12, 68, 76, 0.20), 0 4px 14px rgba(12, 68, 76, 0.10);
  --body-background:
    linear-gradient(135deg, rgba(255,255,255,.58), rgba(255,255,255,0) 36%),
    radial-gradient(ellipse 55% 45% at 15% 12%, rgba(45, 215, 190, 0.28), transparent),
    radial-gradient(ellipse 45% 40% at 84% 16%, rgba(120, 215, 250, 0.22), transparent),
    linear-gradient(160deg, #ebf7f6 0%, #d5ece9 50%, #f5fafe 100%);
  --sidebar-background: linear-gradient(175deg, rgba(6, 46, 54, 0.92) 0%, rgba(10, 98, 93, 0.84) 60%);
  --sidebar-text: #f0fffd;
  --sidebar-link-bg: rgba(255, 255, 255, 0.09);
  --sidebar-link-border: rgba(200, 255, 250, 0.18);
  --sidebar-link-text: rgba(234, 255, 252, 0.90);
  --hero-background: linear-gradient(145deg, rgba(4, 44, 52, 0.94), rgba(14, 148, 138, 0.80));
  --brand-background: linear-gradient(135deg, rgba(236, 254, 255, 0.94), rgba(18, 188, 168, 0.84));
  --brand-text: #063c40;
}

/* ─── Theme: Fire ───────────────────────────────────────────── */
:root[data-theme="fire"] {
  --bg:               #fff0e5;
  --bg-accent:        #fecfaa;
  --surface:          rgba(255, 250, 244, 0.96);
  --surface-strong:   #fffaf6;
  --surface-alt:      #ffede0;
  --line:             rgba(130, 28, 28, 0.15);
  --line-strong:      rgba(130, 28, 28, 0.28);
  --text:             #2c150c;
  --muted:            #7e4e32;
  --accent:           #da2020;
  --accent-strong:    #981818;
  --accent-soft:      rgba(218, 32, 32, 0.12);
  --danger:           #b81818;
  --danger-soft:      rgba(184, 24, 24, 0.12);
  --success:          #17705a;
  --success-soft:     rgba(23, 112, 90, 0.12);
  --warning:          #f59e0b;
  --shadow:           0 8px 28px rgba(130, 28, 28, 0.14), 0 2px 6px rgba(130, 28, 28, 0.08);
  --shadow-lg:        0 24px 56px rgba(130, 28, 28, 0.20), 0 4px 12px rgba(130, 28, 28, 0.10);
  --body-background:
    radial-gradient(ellipse 55% 45% at 12% 16%, rgba(240, 68, 68, 0.24), transparent),
    radial-gradient(ellipse 45% 38% at 86% 18%, rgba(245, 158, 11, 0.24), transparent),
    linear-gradient(160deg, #fff6ed 0%, #ffddba 50%, #fff8f0 100%);
  --sidebar-background: linear-gradient(175deg, #420c08 0%, #7f1d1d 60%, #6a1212 100%);
  --sidebar-text: #fff6ed;
  --sidebar-link-bg: rgba(255, 237, 213, 0.07);
  --sidebar-link-border: rgba(252, 178, 110, 0.16);
  --sidebar-link-text: rgba(255, 246, 237, 0.90);
  --hero-background: linear-gradient(145deg, #420c08 0%, #991b1b 55%, #da2020 80%, #f59e0b 100%);
  --brand-background: linear-gradient(135deg, #fecba0, #ef4444 60%, #f59e0b);
  --brand-text: #3a1408;
}

/* ─── Theme: Ice ────────────────────────────────────────────── */
:root[data-theme="ice"] {
  --bg:               #e8f8ff;
  --bg-accent:        #d4f0fb;
  --surface:          rgba(248, 253, 255, 0.92);
  --surface-strong:   #ffffff;
  --surface-alt:      #e8f8ff;
  --line:             rgba(10, 118, 148, 0.15);
  --line-strong:      rgba(10, 118, 148, 0.26);
  --text:             #103040;
  --muted:            #4e7282;
  --accent:           #0280c4;
  --accent-strong:    #0164a0;
  --accent-soft:      rgba(2, 128, 196, 0.12);
  --danger:           #be5070;
  --danger-soft:      rgba(190, 80, 112, 0.11);
  --success:          #0d8878;
  --success-soft:     rgba(13, 136, 120, 0.12);
  --warning:          #c28020;
  --shadow:           0 8px 28px rgba(6, 86, 120, 0.12), 0 2px 6px rgba(6, 86, 120, 0.07);
  --shadow-lg:        0 24px 56px rgba(6, 86, 120, 0.16), 0 4px 12px rgba(6, 86, 120, 0.08);
  --body-background:
    linear-gradient(135deg, rgba(255,255,255,.74), rgba(255,255,255,0) 40%),
    radial-gradient(ellipse 55% 45% at 10% 14%, rgba(186, 230, 253, 0.54), transparent),
    radial-gradient(ellipse 45% 38% at 84% 16%, rgba(34, 215, 240, 0.20), transparent),
    linear-gradient(160deg, #f5fcff 0%, #daf0fb 52%, #ffffff 100%);
  --sidebar-background: linear-gradient(175deg, #052e4a 0%, #0c6e94 60%, #095a7c 100%);
  --sidebar-text: #eefbff;
  --sidebar-link-bg: rgba(224, 248, 255, 0.08);
  --sidebar-link-border: rgba(186, 230, 253, 0.22);
  --sidebar-link-text: rgba(232, 249, 255, 0.90);
  --hero-background: linear-gradient(145deg, #042840 0%, #0c6e94 60%, #0280c4 100%);
  --brand-background: linear-gradient(135deg, #e8f8ff, #7ad2fc 52%, #38bdf8);
  --brand-text: #0c3448;
}

/* ─── Reset & Base ──────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }

body {
  background: var(--body-background);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, h5, h6 {
  margin: 0;
  font-family: var(--font-heading);
  line-height: 1.2;
}

button, input, select, textarea { font: inherit; }
a { color: inherit; text-decoration: none; }

button {
  transition:
    transform .16s var(--ease-out),
    box-shadow .16s var(--ease-out),
    background-color .16s ease,
    border-color .16s ease,
    opacity .16s ease;
}
button:hover:not(:disabled) { transform: translateY(-1px); }
button:active:not(:disabled) { transform: translateY(0); }
button:disabled { opacity: .52; cursor: not-allowed; transform: none !important; }

.hidden { display: none !important; }
.text-right { text-align: right; }

/* ─── Shell ─────────────────────────────────────────────────── */
.app-shell {
  min-height: 100vh;
  padding: 20px;
  position: relative;
  z-index: 1;
}

/* ─── Eyebrow ───────────────────────────────────────────────── */
.eyebrow {
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: .20em;
  font-weight: 700;
  color: var(--accent);
}

/* ─── Login ─────────────────────────────────────────────────── */
.login-view {
  min-height: calc(100vh - 40px);
  display: grid;
  grid-template-columns: minmax(360px, 480px) minmax(440px, 1fr);
  gap: 24px;
  align-items: stretch;
}

.login-panel {
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-2xl);
  box-shadow: var(--shadow-xl);
  backdrop-filter: blur(16px) saturate(1.1);
  padding: 44px 40px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 22px;
}

.login-panel h1 {
  font-size: clamp(1.75rem, 2.4vw, 2.75rem);
  line-height: 1.08;
  letter-spacing: -.01em;
}

.lead, .workspace-copy, .panel-head p, .hero-panel p, .summary-note {
  color: var(--muted);
  line-height: 1.68;
  font-size: 14.5px;
}

/* ─── Login art ─────────────────────────────────────────────── */
.login-art {
  background: var(--hero-background);
  border-radius: var(--radius-2xl);
  box-shadow: var(--shadow-xl);
  color: rgba(255, 248, 238, 0.92);
  padding: 36px;
  display: grid;
  gap: 20px;
  align-content: end;
  position: relative;
  overflow: hidden;
}

.login-art::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 60% 55% at 100% 0%, rgba(255,255,255,.09), transparent),
    radial-gradient(ellipse 50% 45% at 0% 100%, rgba(255,255,255,.06), transparent);
  pointer-events: none;
}

.login-art::after {
  content: "";
  position: absolute;
  top: -1px;
  left: 24px;
  right: 24px;
  height: 1px;
  background: linear-gradient(90deg, rgba(255,255,255,.28), rgba(255,255,255,0));
  pointer-events: none;
}

.preview-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  position: relative;
}

.preview-card {
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(255, 255, 255, 0.10);
  border-radius: var(--radius-xl);
  padding: 18px;
  display: grid;
  gap: 10px;
  backdrop-filter: blur(8px);
  transition: background .2s ease, border-color .2s ease;
}

.preview-card:hover {
  background: rgba(255, 255, 255, 0.11);
  border-color: rgba(255, 255, 255, 0.16);
}

.preview-hero {
  min-height: 220px;
  align-content: end;
  background: rgba(255, 255, 255, 0.05);
}

.preview-tag {
  display: inline-flex;
  width: fit-content;
  padding: 5px 11px;
  border-radius: 999px;
  font-size: 10.5px;
  letter-spacing: .14em;
  text-transform: uppercase;
  font-weight: 700;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.16);
}

.preview-card strong {
  font-size: 14px;
  line-height: 1.45;
}

/* ─── Auth form ─────────────────────────────────────────────── */
.auth-form, .field, .compact-field { display: grid; gap: 7px; }

.field span, .compact-field span {
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: .10em;
  color: var(--muted);
  font-weight: 700;
}

.input-action-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
}

.input-action-btn { min-width: 72px; padding-inline: 14px; }

/* Inline-tag input: [prefix label] [input] [suffix label] */
.input-with-tag {
  display: flex;
  align-items: center;
  border: 1.5px solid var(--line);
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--bg);
  transition: border-color .15s;
}
.input-with-tag:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.input-with-tag input {
  flex: 1;
  border: none;
  background: transparent;
  padding: 8px 10px;
  font-size: 13.5px;
  color: var(--text);
  outline: none;
  min-width: 0;
}
.input-tag,
.input-tag-right {
  padding: 0 10px;
  font-size: 11.5px;
  font-weight: 700;
  color: var(--muted);
  background: var(--surface-alt);
  white-space: nowrap;
  align-self: stretch;
  display: flex;
  align-items: center;
  letter-spacing: .04em;
  border-right: 1.5px solid var(--line);
}
.input-tag-right {
  border-right: none;
  border-left: 1.5px solid var(--line);
}

.login-meta-row { display: flex; justify-content: flex-end; }

.text-link {
  font-size: 13px;
  font-weight: 700;
  color: var(--accent-strong);
  transition: color .15s ease;
}
.text-link:hover { color: var(--accent); }

/* ─── Inputs ────────────────────────────────────────────────── */
input, select, textarea {
  width: 100%;
  border-radius: var(--radius-md);
  border: 1.5px solid var(--line-strong);
  padding: 11px 14px;
  background: var(--surface-strong);
  color: var(--text);
  outline: none;
  transition: border-color .15s ease, box-shadow .15s ease;
}

input:focus, select:focus, textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

input::placeholder, textarea::placeholder { color: var(--muted); opacity: .7; }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.invoice-customer-typeahead {
  position: relative;
  display: grid;
  gap: 8px;
}

.invoice-customer-search-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
}

.invoice-customer-results {
  position: absolute;
  z-index: 60;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  display: grid;
  gap: 6px;
  max-height: 280px;
  overflow: auto;
  padding: 8px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-md);
  background: var(--surface-strong);
  box-shadow: var(--shadow-lg);
}

.invoice-customer-option {
  width: 100%;
  display: grid;
  gap: 3px;
  text-align: left;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  background: transparent;
  color: var(--text);
  cursor: pointer;
}

.invoice-customer-option:hover,
.invoice-customer-option.active {
  border-color: var(--line-strong);
  background: var(--surface-alt);
}

.invoice-customer-option strong {
  font-size: 13.5px;
  line-height: 1.35;
}

.invoice-customer-option small,
.invoice-customer-empty {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.invoice-customer-empty { padding: 10px 12px; }

/* ─── Shared card surfaces ──────────────────────────────────── */
.connection-card, .status-card, .panel-pill, .mini-stat-card, .summary-card, .detail-block, .detail-summary, .detail-stat-grid > article {
  background: var(--surface-alt);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
}

.connection-card, .status-card { padding: 14px 16px; font-size: 14px; }
.connection-card code { font-size: 12.5px; word-break: break-all; }

.status-card { line-height: 1.6; }
.status-card.error { border-color: rgba(192, 70, 59, 0.32); color: var(--danger); background: var(--danger-soft); }

.api-config-card { display: grid; gap: 14px; }
.api-config-card summary {
  display: grid;
  gap: 4px;
  cursor: pointer;
  font-weight: 700;
  font-size: 14px;
}
.api-config-card summary::marker { color: var(--accent); }
.api-config-card summary small { color: var(--muted); font-weight: 500; }
.api-config-card[open] summary { margin-bottom: 10px; }
.api-config-grid { margin-bottom: 12px; }
.api-config-actions { margin-bottom: 6px; }
.error-text { color: var(--danger); }

/* ─── Layout helpers ────────────────────────────────────────── */
.login-actions, .workspace-actions, .hero-actions, .detail-actions, .modal-actions, .pager-actions, .toolbar-row, .section-head, .panel-head, .summary-row {
  display: flex;
  gap: 10px;
  align-items: center;
}
.login-actions, .modal-actions { justify-content: flex-start; }
.workspace-actions, .toolbar-row, .panel-head, .section-head { flex-wrap: wrap; }

.invoice-filter-row {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) minmax(140px, 180px) auto auto;
  gap: 8px;
  align-items: center;
}

.invoice-filter-row input,
.invoice-filter-row select,
.invoice-filter-row button {
  min-width: 0;
  width: 100%;
}

/* ─── Buttons ───────────────────────────────────────────────── */
.primary-btn, .ghost-btn, .danger-btn, .anchor-btn {
  border-radius: var(--radius-md);
  padding: 10px 18px;
  border: 1.5px solid transparent;
  cursor: pointer;
  font-weight: 700;
  font-size: 14px;
  white-space: nowrap;
  letter-spacing: .01em;
}

.primary-btn.is-loading, .ghost-btn.is-loading, .danger-btn.is-loading {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.button-spinner {
  width: 15px;
  height: 15px;
  border-radius: 50%;
  border: 2px solid currentColor;
  border-right-color: transparent;
  flex: 0 0 auto;
  animation: spin .7s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.primary-btn {
  background: linear-gradient(135deg, var(--accent), var(--accent-strong));
  color: #fffdf8;
  box-shadow: 0 4px 14px rgba(0,0,0,.14), 0 1px 3px rgba(0,0,0,.08);
  border-color: transparent;
}
.primary-btn:hover:not(:disabled) {
  box-shadow: 0 8px 22px rgba(0,0,0,.18), 0 2px 6px rgba(0,0,0,.10);
}

.ghost-btn, .anchor-btn {
  background: rgba(255,255,255,.46);
  border-color: var(--line-strong);
  color: var(--text);
  box-shadow: var(--shadow-sm);
}
.ghost-btn:hover:not(:disabled) {
  background: rgba(255,255,255,.72);
  border-color: var(--accent);
  color: var(--accent-strong);
}

.danger-btn {
  background: var(--danger-soft);
  border-color: rgba(192,70,59,.22);
  color: var(--danger);
}
.danger-btn:hover:not(:disabled) {
  background: var(--danger);
  color: #fff;
  border-color: transparent;
}

/* Theme-specific button overrides */
:root[data-theme="glass"] .primary-btn,
:root[data-theme="glass"] .table-btn:not(.danger) {
  background: linear-gradient(135deg, rgba(12,156,146,.96), rgba(6,110,106,.88));
  border-color: rgba(200,255,252,.42);
  box-shadow: 0 6px 20px rgba(12, 118, 110, .22);
}

:root[data-theme="glass"] .ghost-btn,
:root[data-theme="glass"] .anchor-btn,
:root[data-theme="glass"] .chip,
:root[data-theme="glass"] .panel-pill {
  background: rgba(255,255,255,.58);
  border-color: rgba(255,255,255,.52);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.58);
}

:root[data-theme="fire"] .primary-btn,
:root[data-theme="fire"] .table-btn:not(.danger) {
  background: linear-gradient(135deg, #7f1d1d, #da2020 58%, #f59e0b);
  border-color: rgba(252,180,110,.46);
  box-shadow: 0 6px 20px rgba(130, 28, 28, .22);
}

:root[data-theme="fire"] .ghost-btn,
:root[data-theme="fire"] .anchor-btn,
:root[data-theme="fire"] .chip,
:root[data-theme="fire"] .panel-pill {
  background: rgba(255, 236, 212, .66);
  border-color: rgba(248, 110, 110, .32);
  color: #431407;
}

:root[data-theme="ice"] .primary-btn,
:root[data-theme="ice"] .table-btn:not(.danger) {
  background: linear-gradient(135deg, #0164a0, #0280c4 58%, #65e0f8);
  border-color: rgba(186, 230, 253, .66);
  box-shadow: 0 6px 20px rgba(6, 86, 120, .18);
}

:root[data-theme="ice"] .ghost-btn,
:root[data-theme="ice"] .anchor-btn,
:root[data-theme="ice"] .chip,
:root[data-theme="ice"] .panel-pill {
  background: rgba(238, 249, 255, .76);
  border-color: rgba(120, 210, 252, .40);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.76);
}

/* ─── Workspace shell ───────────────────────────────────────── */
.workspace {
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr);
  gap: 20px;
  min-height: calc(100vh - 40px);
  align-items: start;
  transition: grid-template-columns .28s cubic-bezier(0.22, 1, 0.36, 1);
}

/* ─── Sidebar ───────────────────────────────────────────────── */
.sidebar {
  transition: padding .28s cubic-bezier(0.22, 1, 0.36, 1);
  background: var(--sidebar-background);
  color: var(--sidebar-text);
  border-radius: var(--radius-2xl);
  border: 1px solid rgba(255,255,255,.08);
  padding: 22px 18px;
  position: sticky;
  top: 20px;
  max-height: calc(100vh - 40px);
  overflow: auto;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 20px;
  box-shadow: 0 32px 70px rgba(8, 9, 12, 0.28), inset 0 1px 0 rgba(255,255,255,.07);
  isolation: isolate;
}

.sidebar::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background:
    radial-gradient(ellipse 70% 36% at 50% 0%, rgba(255,255,255,.12), transparent),
    radial-gradient(ellipse 50% 30% at 50% 100%, rgba(255,255,255,.05), transparent);
  pointer-events: none;
  z-index: -1;
}

@keyframes sidebarOrbDrift {
  0%, 100% { opacity: .20; transform: scale(1) translate(0, 0); }
  50%       { opacity: .34; transform: scale(1.18) translate(10px, -14px); }
}
.sidebar::after {
  content: "";
  position: absolute;
  width: 220px;
  height: 220px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(160,104,38,.38) 0%, transparent 70%);
  bottom: 50px;
  left: -60px;
  filter: blur(52px);
  pointer-events: none;
  z-index: -1;
  animation: sidebarOrbDrift 7s ease-in-out infinite;
}

.sidebar-top { display: grid; gap: 20px; }

/* Brand lockup */
.brand-lockup {
  display: flex;
  align-items: center;
  gap: 13px;
  padding: 4px 2px;
  justify-content: space-between;
}

@keyframes brandMarkGlow {
  0%, 100% { box-shadow: 0 10px 24px rgba(0,0,0,.22), inset 0 1px 0 rgba(255,255,255,.38); }
  50%       { box-shadow: 0 10px 24px rgba(0,0,0,.22), inset 0 1px 0 rgba(255,255,255,.38), 0 0 20px 3px rgba(160,104,38,.28); }
}
.brand-mark {
  width: 52px;
  height: 52px;
  border-radius: var(--radius-lg);
  display: grid;
  place-items: center;
  font-family: var(--font-heading);
  background: var(--brand-background);
  color: var(--brand-text);
  font-size: 18px;
  font-weight: 700;
  box-shadow: 0 10px 24px rgba(0,0,0,.22), inset 0 1px 0 rgba(255,255,255,.38);
  letter-spacing: -.01em;
  flex-shrink: 0;
  animation: brandMarkGlow 4s ease-in-out infinite;
  transition: width .28s cubic-bezier(.22,1,.36,1), height .28s cubic-bezier(.22,1,.36,1), font-size .28s cubic-bezier(.22,1,.36,1), border-radius .28s cubic-bezier(.22,1,.36,1);
}

.brand-copy { display: grid; gap: 4px; }
.brand-copy h2 { margin: 0; font-size: 20px; letter-spacing: .02em; color: #fff; }

.sidebar-brand-note {
  margin: 0;
  color: rgba(255,255,255,.60);
  line-height: 1.5;
  font-size: 12px;
}

.premium-badge {
  display: inline-flex;
  width: fit-content;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(255,255,255,.09);
  border: 1px solid rgba(255,255,255,.14);
  font-size: 9.5px;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: rgba(255,255,255,.76);
  font-weight: 700;
}

/* Nav */
.sidebar-nav { display: grid; gap: 4px; }

.nav-btn {
  border-radius: var(--radius-md);
  background: var(--sidebar-link-bg);
  border: 1px solid var(--sidebar-link-border);
  color: var(--sidebar-link-text);
  width: 100%;
  padding: 11px 14px 11px 16px;
  text-align: left;
  display: flex;
  align-items: center;
  gap: 12px;
  position: relative;
  overflow: hidden;
  box-shadow: none;
  transition: background .18s ease, border-color .18s ease, color .18s ease, transform .16s var(--ease-out), box-shadow .16s ease;
}

.nav-btn:hover:not(:disabled) { transform: translateY(0) translateX(2px); }

.nav-btn-icon {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: var(--radius-sm);
  background: rgba(255,255,255,.07);
  border: 1px solid rgba(255,255,255,.09);
  flex-shrink: 0;
  transition: background .18s ease;
}

.nav-btn-icon svg {
  width: 16px;
  height: 16px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
  opacity: .82;
}

.nav-btn-text { display: grid; gap: 2px; flex: 1; min-width: 0; }
.nav-label { font-weight: 700; font-size: 13.5px; }

.nav-btn small {
  color: rgba(255,255,255,.52);
  line-height: 1.4;
  font-size: 11.5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.nav-btn-featured {
  background: linear-gradient(135deg, rgba(255,255,255,.18), rgba(255,255,255,.06));
  color: rgba(255,255,255,.96);
  border-color: rgba(255,255,255,.22);
  box-shadow: 0 8px 22px rgba(0,0,0,.14), inset 0 1px 0 rgba(255,255,255,.14);
  margin-bottom: 4px;
}

.nav-btn-featured .nav-btn-icon {
  background: rgba(255,255,255,.14);
  border-color: rgba(255,255,255,.18);
}

.nav-btn.active {
  background: linear-gradient(135deg, rgba(160,104,38,.24), rgba(160,104,38,.10));
  border-color: rgba(255,255,255,.20);
  box-shadow: 0 6px 18px rgba(0,0,0,.12), inset 3px 0 0 rgba(160,104,38,.72), inset 0 1px 0 rgba(255,255,255,.10);
  color: rgba(255,255,255,.96);
}

.nav-btn.active .nav-btn-icon {
  background: rgba(160,104,38,.28);
  border-color: rgba(160,104,38,.42);
}

.nav-btn.active .nav-btn-icon svg { opacity: 1; filter: drop-shadow(0 0 4px rgba(255,180,60,.45)); }
.nav-btn-featured .nav-btn-icon svg { opacity: 1; }

/* Active indicator — amber inset left bar (no abs positioning needed) */
/* ::after freed for collapsed tooltips — dot removed */

/* Shimmer on featured nav button */
@keyframes shimmerSlide {
  0%   { transform: translateX(-100%) skewX(-12deg); }
  100% { transform: translateX(280%) skewX(-12deg); }
}
.nav-btn-featured::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent 20%, rgba(255,255,255,.16) 50%, transparent 80%);
  transform: translateX(-100%) skewX(-12deg);
  animation: shimmerSlide 3s ease-in-out infinite;
  pointer-events: none;
}

.sidebar-link {
  border-radius: var(--radius-md);
  background: var(--sidebar-link-bg);
  border: 1px solid var(--sidebar-link-border);
  color: var(--sidebar-link-text);
  display: block;
  padding: 11px 14px;
  font-size: 14px;
}

.sidebar-heading {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: .18em;
  color: rgba(255,255,255,.52);
  margin-bottom: 8px;
  font-weight: 700;
}

/* Sidebar footer */
.sidebar-foot { display: grid; gap: 12px; }

.sidebar-session-card {
  padding: 12px 14px;
  border-radius: var(--radius-lg);
  border: 1px solid rgba(255,255,255,.10);
  background: rgba(255,255,255,.04);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.06);
  display: flex;
  align-items: center;
  gap: 11px;
}

.session-avatar {
  width: 34px;
  height: 34px;
  min-width: 34px;
  border-radius: 50%;
  background: linear-gradient(135deg, rgba(160,104,38,.65), rgba(192,100,45,.50));
  border: 1px solid rgba(160,104,38,.45);
  display: grid;
  place-items: center;
  font-size: 14px;
  font-weight: 700;
  color: rgba(255,255,255,.92);
  text-transform: uppercase;
  box-shadow: 0 0 12px rgba(160,104,38,.22);
  flex-shrink: 0;
}

.session-info {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.session-info #sidebarUserSummary {
  margin: 0;
  font-size: 12.5px;
  font-weight: 600;
  color: rgba(255,255,255,.88);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.session-info .sidebar-session-meta {
  font-size: 10.5px;
  color: rgba(255,255,255,.42);
}

.sidebar-session-card p {
  margin: 0;
  font-weight: 700;
  color: rgba(255,255,255,.92);
  font-size: 14px;
}

.sidebar-session-meta {
  display: block;
  margin-top: 5px;
  color: rgba(255,255,255,.58);
  line-height: 1.5;
  font-size: 12px;
}

/* ─── Workspace main ────────────────────────────────────────── */
.workspace-main { display: grid; gap: 18px; min-width: 0; }

.workspace-header {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow);
  backdrop-filter: blur(14px);
  padding: 0;
  display: flex;
  flex-direction: column;
  align-items: stretch;
}

.workspace-header h1 {
  font-size: 22px;
  letter-spacing: -.01em;
}

.workspace-header .workspace-copy {
  display: none;
}

/* ─── Notice/Toast ──────────────────────────────────────────── */
.notice {
  position: fixed;
  right: 28px;
  bottom: 28px;
  z-index: 9999;
  width: min(400px, calc(100vw - 56px));
  padding: 14px 18px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--line);
  background: var(--surface);
  box-shadow: var(--shadow-xl);
  font-weight: 700;
  font-size: 14px;
  animation: noticeIn .2s var(--ease-out) both;
}
.notice.error { color: var(--danger); border-color: rgba(192,70,59,.26); background: var(--danger-soft); }
.notice.success { color: var(--success); border-color: rgba(25,128,95,.24); background: var(--success-soft); }

@keyframes noticeIn {
  from { opacity: 0; transform: translateY(12px) scale(.96); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* ─── Pages ─────────────────────────────────────────────────── */
.page-section { display: grid; gap: 16px; }

.hero-panel, .panel-card, .metric-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow);
  backdrop-filter: blur(12px);
}

.hero-panel {
  padding: 24px 28px;
  display: flex;
  justify-content: space-between;
  gap: 20px;
  align-items: end;
  background:
    linear-gradient(180deg, rgba(255,255,255,.04), rgba(255,255,255,0)),
    var(--surface);
}

.hero-panel h3 {
  font-size: 20px;
  letter-spacing: -.01em;
  margin-top: 5px;
}

.panel-card { padding: 24px; }

/* ─── Metrics ───────────────────────────────────────────────── */
.metrics-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.65fr) repeat(3, minmax(0, 1fr));
  gap: 14px;
}

/* Featured first card in each metrics row */
.metrics-grid .metric-card:nth-child(1) strong,
.metrics-grid .metric-card:nth-child(5) strong {
  font-size: 32px;
}
.metrics-grid .metric-card:nth-child(1) .metric-icon-wrap,
.metrics-grid .metric-card:nth-child(5) .metric-icon-wrap {
  width: 44px;
  height: 44px;
  opacity: .16;
}

.metric-card {
  padding: 22px 20px 20px;
  display: grid;
  gap: 8px;
  position: relative;
  overflow: hidden;
  background:
    linear-gradient(180deg, rgba(255,255,255,.52), rgba(255,255,255,0)),
    var(--surface);
}

.metric-card::before {
  content: "";
  position: absolute;
  inset: 0 auto auto 0;
  width: 100%;
  height: 3px;
  background: linear-gradient(90deg, var(--accent) 0%, transparent 75%);
}

.metric-card::after {
  content: "";
  position: absolute;
  right: -20px;
  top: -20px;
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: radial-gradient(circle, var(--accent-soft), transparent 68%);
  pointer-events: none;
}

.metric-card span {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .10em;
  color: var(--muted);
  font-weight: 700;
}

.metric-card strong { font-size: 26px; line-height: 1.1; letter-spacing: -.01em; }
.metric-card small { line-height: 1.5; color: var(--muted); font-size: 12.5px; }
.mini-stat-card span { font-size: 11px; text-transform: uppercase; letter-spacing: .10em; color: var(--muted); font-weight: 700; }
.mini-stat-card strong { font-size: 24px; line-height: 1.1; }

.accent-card {
  background: var(--hero-background);
  color: rgba(255, 250, 244, .95);
  border-color: transparent;
}
.accent-card span, .accent-card small { color: rgba(255,255,255,.72); }
.accent-card::before { background: linear-gradient(90deg, rgba(255,255,255,.88), rgba(255,255,255,0)); }
.accent-card::after  { background: radial-gradient(circle, rgba(255,255,255,.16), transparent 68%); }

/* ─── Widget grid ───────────────────────────────────────────── */
.widget-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr);
  grid-template-rows: auto auto auto;
  grid-template-areas:
    "recent  collection"
    "recent  customers"
    "inventory inventory";
  gap: 14px;
}

.overview-widget {
  position: relative;
  overflow: hidden;
  padding: 22px;
  background:
    linear-gradient(180deg, rgba(255,255,255,.58), rgba(255,255,255,0)),
    var(--surface);
}

.overview-widget::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse 60% 50% at 100% 0%, var(--accent-soft), transparent);
  pointer-events: none;
}

.overview-widget::after {
  content: "";
  position: absolute;
  left: 22px;
  right: 22px;
  top: 0;
  height: 1px;
  background: linear-gradient(90deg, rgba(255,255,255,.70), rgba(255,255,255,0));
}

.widget-recent::before   { background: radial-gradient(ellipse at 100% 0%, rgba(47,99,199,.10), transparent); }
.widget-collection::before{ background: radial-gradient(ellipse at 100% 0%, rgba(25,128,95,.10), transparent); }
.widget-customers::before { background: radial-gradient(ellipse at 100% 0%, rgba(155,108,47,.10), transparent); }
.widget-inventory::before { background: radial-gradient(ellipse at 100% 0%, rgba(197,133,30,.12), transparent); }

/* Grid area assignments */
.widget-recent     { grid-area: recent; }
.widget-collection { grid-area: collection; }
.widget-customers  { grid-area: customers; }
.widget-inventory  { grid-area: inventory; }

/* Recent invoices is the primary widget — emphasise its top bar */
.widget-recent::after {
  background: linear-gradient(90deg, var(--accent-soft), rgba(255,255,255,0));
  opacity: .9;
}

/* Make the recent list scrollable when content overflows in the taller layout */
.widget-recent .stack-list {
  overflow-y: auto;
  max-height: 620px;
}

/* ─── Tables ────────────────────────────────────────────────── */
.table-wrap {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
}

.data-table { width: 100%; border-collapse: collapse; min-width: 820px; }

.data-table th, .data-table td {
  padding: 13px 14px;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
  font-size: 14px;
}

.data-table tr:last-child td { border-bottom: none; }

.data-table th {
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: .10em;
  color: var(--muted);
  background: var(--surface-alt);
  font-weight: 700;
}

.data-table tbody tr {
  transition: background .12s ease;
}

.data-table tbody tr:hover {
  background: rgba(160, 104, 38, 0.04);
}

.table-actions { display: inline-flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }

.table-icon-btn {
  width: 34px;
  height: 34px;
  justify-content: center;
  padding: 0;
  border-radius: 10px;
}

.table-icon-btn svg {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.table-icon-btn.share {
  color: var(--accent);
  background: var(--accent-soft);
  border-color: color-mix(in srgb, var(--accent) 30%, transparent);
}

.table-btn, .chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  border-radius: var(--radius-sm);
  padding: 6px 11px;
  border: 1px solid var(--line);
  background: var(--surface-alt);
  color: var(--text);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
}

.chip.success { color: var(--success); background: var(--success-soft); border-color: rgba(25,128,95,.22); }
.chip.warning { color: var(--warning); background: rgba(196,131,26,.10); border-color: rgba(196,131,26,.22); }
.chip.danger  { color: var(--danger);  background: var(--danger-soft);  border-color: rgba(192,70,59,.22); }
.chip.info    { color: var(--accent);  background: var(--accent-soft);  border-color: rgba(160,104,38,.22); }

/* ─── Empty & pager ─────────────────────────────────────────── */
.empty-state, .detail-empty {
  padding: 36px 24px;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius-md);
  color: var(--muted);
  text-align: center;
  font-size: 14px;
}

.pager-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-top: 12px;
  font-size: 13.5px;
  color: var(--muted);
}

/* ─── Stack / list rows ─────────────────────────────────────── */
.stack-list, .line-items, .dynamic-list { display: grid; gap: 10px; }

.stack-row, .line-item {
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background:
    linear-gradient(180deg, rgba(255,255,255,.38), rgba(255,255,255,0)),
    var(--surface-alt);
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.38);
  font-size: 14px;
}

.stack-row strong:first-child { font-size: 14.5px; }
.stack-row strong:last-child  { color: var(--title, var(--text)); }
.stack-row small, .stack-meta { color: var(--muted); display: block; margin-top: 3px; line-height: 1.5; font-size: 12.5px; }

/* ─── Detail panel ──────────────────────────────────────────── */
.detail-panel { align-self: start; }
.detail-content { display: grid; gap: 12px; }

.detail-summary {
  padding: 14px 16px;
  display: grid;
  gap: 7px;
}
.detail-summary strong { font-size: 20px; }

.detail-block {
  padding: 14px 16px;
  display: grid;
  gap: 10px;
}
.detail-block-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.detail-actions { flex-wrap: wrap; }

.mini-stat-card, .detail-stat-grid > article {
  padding: 14px 16px;
  display: grid;
  gap: 7px;
  background:
    linear-gradient(180deg, rgba(255,255,255,.38), rgba(255,255,255,0)),
    var(--surface-alt);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.38);
}

.summary-note {
  padding: 12px 16px;
  border-radius: var(--radius-md);
  background: rgba(255,255,255,.42);
  border: 1px solid var(--line);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.38);
  font-size: 13.5px;
}

/* ─── Split shell ───────────────────────────────────────────── */
.split-shell { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(300px, .9fr); gap: 14px; }
.collection-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.detail-stat-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.theme-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.field-wide { grid-column: 1 / -1; }
.settings-shell { align-items: start; }
.settings-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }

/* ─── Panel head ────────────────────────────────────────────── */
.panel-head { justify-content: space-between; }
.panel-head h4 { font-size: 17px; letter-spacing: -.01em; }
.panel-head > div { display: grid; gap: 3px; }
.section-head { justify-content: space-between; padding-bottom: 6px; border-bottom: 1px solid var(--line); }

.panel-pill {
  padding: 6px 12px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .10em;
  font-weight: 700;
}

/* ─── Modal ─────────────────────────────────────────────────── */
.modal-shell {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: grid;
  place-items: center;
  padding: 20px;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(8, 14, 22, 0.62);
  backdrop-filter: blur(4px);
}

.modal-dialog {
  position: relative;
  width: min(740px, calc(100vw - 32px));
  max-height: calc(100vh - 32px);
  overflow: auto;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-2xl);
  box-shadow: var(--shadow-xl);
  backdrop-filter: blur(20px);
  padding: 28px;
  animation: modalIn .22s var(--ease-out) both;
}

@keyframes modalIn {
  from { opacity: 0; transform: translateY(16px) scale(.97); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

.modal-wide { width: min(1020px, calc(100vw - 32px)); }

.modal-head {
  display: flex;
  justify-content: space-between;
  align-items: start;
  gap: 16px;
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--line);
}

.modal-head h4 { font-size: 18px; letter-spacing: -.01em; }
.modal-body { display: grid; gap: 16px; }
.workspace-form-body { display: grid; gap: 16px; }
.form-section { display: grid; gap: 12px; }

.dynamic-item {
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface-alt);
  padding: 14px;
  display: grid;
  gap: 10px;
}

.dynamic-item-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr)) auto;
  gap: 10px;
  align-items: end;
}

/* ─── Quantity field + embedded multiplier ──────────────────── */
.qty-wrap { display: grid; }

.qty-input-row {
  position: relative;
  display: flex;
}

.qty-input-row input[type="number"] {
  flex: 1;
  padding-right: 38px;
}

.qty-wrap--on .qty-input-row input[type="number"] {
  border-bottom-left-radius: 0;
  border-bottom-right-radius: 0;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

/* The × toggle embedded in the right edge of the input */
.qty-mult-toggle {
  position: absolute;
  right: 5px;
  top: 50%;
  transform: translateY(-50%);
  width: 26px;
  height: 26px;
  border-radius: var(--radius-xs);
  border: none;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  font-weight: 700;
  line-height: 1;
  padding: 0;
  flex-shrink: 0;
  transition: background .15s, color .15s, border-radius .15s;
  z-index: 1;
}
.qty-mult-toggle:hover {
  background: var(--accent-soft);
  color: var(--accent);
  transform: translateY(-50%); /* cancel global button lift — keeps absolute position */
}
.qty-wrap--on .qty-mult-toggle {
  background: var(--accent);
  color: #fff;
  border-radius: var(--radius-sm);
}
.qty-wrap--on .qty-mult-toggle:hover {
  background: var(--accent-strong);
  transform: translateY(-50%);
}

/* Panel that appears below the input */
.qty-mult-panel {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 7px 10px;
  background: var(--accent-soft);
  border: 1.5px solid var(--accent);
  border-top: none;
  border-radius: 0 0 var(--radius-md) var(--radius-md);
  flex-wrap: wrap;
}

.qmp-sym {
  font-size: 13px;
  font-weight: 800;
  color: var(--accent);
  opacity: .65;
  flex-shrink: 0;
  line-height: 1;
  user-select: none;
}

.qmp-val,
.qmp-lbl {
  padding: 4px 7px;
  font-size: 13px;
  font-weight: 600;
  border-radius: var(--radius-sm);
  background: var(--surface-strong);
  border: 1.5px solid var(--line-strong);
  color: var(--text);
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.qmp-val { width: 62px; }
.qmp-lbl { width: 70px; }
.qmp-val:focus,
.qmp-lbl:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-soft);
}
.qmp-val::-webkit-inner-spin-button,
.qmp-val::-webkit-outer-spin-button { opacity: 0; }
.qmp-val:hover::-webkit-inner-spin-button,
.qmp-val:hover::-webkit-outer-spin-button { opacity: .5; }

.qmp-divider {
  flex: 1;
  min-width: 4px;
}

.qmp-eq {
  font-size: 12px;
  font-weight: 800;
  color: var(--accent);
  opacity: .65;
  flex-shrink: 0;
  line-height: 1;
  user-select: none;
}

.qmp-result {
  font-size: 14px;
  font-weight: 800;
  color: var(--accent-strong);
  flex-shrink: 0;
  min-width: 20px;
  letter-spacing: -.01em;
}

.payment-detail-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr)) auto;
  gap: 10px;
  align-items: end;
}

.summary-card {
  padding: 16px 18px;
  display: grid;
  gap: 9px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface-alt);
}

.summary-row { justify-content: space-between; font-size: 14px; }
.summary-row.total {
  padding-top: 10px;
  border-top: 1px solid var(--line);
  font-size: 15px;
}
.summary-row strong { font-size: inherit; }

/* ─── Wizard ────────────────────────────────────────────────── */
.wizard-shell { display: grid; gap: 16px; }

.wizard-progress {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 8px;
}

.settings-wizard-shell { display: grid; gap: 16px; }
.settings-wizard-progress {
  grid-template-columns: repeat(5, minmax(0, 1fr));
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 10px;
}

.wizard-step {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px;
  border: 1.5px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface-alt);
  color: var(--muted);
  text-align: left;
  cursor: pointer;
  transition: border-color .15s ease, box-shadow .15s ease, background .15s ease, color .15s ease;
}

.wizard-step:hover { border-color: var(--line-strong); color: var(--text); }

.wizard-step.active {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--text);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.wizard-step.complete {
  background: var(--success-soft);
  border-color: rgba(25,128,95,.24);
  color: var(--success);
}

.wizard-step-index {
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  border-radius: var(--radius-sm);
  background: var(--surface-strong);
  border: 1px solid var(--line);
  font-weight: 700;
  font-size: 12px;
  flex-shrink: 0;
}

.wizard-step.active .wizard-step-index {
  background: var(--accent);
  color: #fff;
  border-color: transparent;
}

.wizard-step.complete .wizard-step-index {
  background: var(--success);
  color: #fff;
  border-color: transparent;
}

.wizard-step-copy { display: grid; gap: 2px; }
.wizard-step-copy small { color: var(--muted); line-height: 1.4; font-size: 11px; }
.wizard-step.active .wizard-step-copy small { color: var(--muted); }

.wizard-panel { display: grid; gap: 14px; }

.wizard-split {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(240px, .8fr);
  gap: 14px;
  align-items: start;
}

.wizard-aside { align-self: start; }

.compact-summary-grid { grid-template-columns: 1fr; margin-bottom: 7px; }

.wizard-actions { justify-content: flex-end; }
.invoice-workspace-hero { align-items: center; }
.invoice-workspace-card { padding: 24px; }
.invoice-receipt-card { display: grid; gap: 12px; }
.invoice-receipt-meta { display: grid; gap: 6px; }
.invoice-receipt-meta strong { font-size: 14px; color: var(--text); overflow-wrap: anywhere; }
.invoice-receipt-meta p { margin: 0; color: var(--muted); line-height: 1.55; }

/* ─── Settings ──────────────────────────────────────────────── */
.section-head h5 { font-size: 15px; }

.logo-settings-shell {
  display: grid;
  grid-template-columns: minmax(200px, 280px) minmax(0, 1fr);
  gap: 14px;
  align-items: start;
}

.logo-preview-card {
  min-height: 170px;
  border: 1.5px dashed var(--line-strong);
  border-radius: var(--radius-md);
  background: var(--surface-alt);
  display: grid;
  place-items: center;
  padding: 18px;
}

.logo-preview-empty {
  color: var(--muted);
  text-align: center;
  line-height: 1.6;
  font-size: 13px;
}

.logo-settings-actions { display: grid; gap: 12px; }

#settingsLogoPreviewImage {
  max-width: 100%;
  max-height: 130px;
  object-fit: contain;
}

/* ─── Template chooser ──────────────────────────────────────── */
.template-choice-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.template-choice-card {
  border-radius: var(--radius-md);
  border: 1.5px solid var(--line);
  background: var(--surface-alt);
  padding: 12px;
  display: grid;
  gap: 9px;
  text-align: left;
  cursor: pointer;
  transition: border-color .15s ease, box-shadow .15s ease;
}

.template-choice-card:hover { border-color: var(--line-strong); }

.template-choice-card.active {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.template-choice-swatch {
  height: 110px;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(15, 23, 42, 0.08);
  padding: 10px;
  display: grid;
  gap: 7px;
  align-content: start;
}

.template-swatch-bar   { display: block; width: 100%; height: 7px; border-radius: 999px; background: currentColor; opacity: .9; }
.template-swatch-panel { display: block; width: 46%; height: 26px; border-radius: var(--radius-sm); border: 1px solid currentColor; opacity: .5; }
.template-swatch-lines { display: block; width: 100%; height: 40px; border-radius: var(--radius-sm); border: 1px dashed currentColor; opacity: .32; }

.template-choice-classic   { background: linear-gradient(180deg, #ffffff, #f8fafc); color: #2563eb; }
.template-choice-executive { background: linear-gradient(180deg, #0f172a, #1f2937); color: #dbeafe; }
.template-choice-studio    { background: linear-gradient(180deg, #fffdf8, #f7efe2); color: #b45309; }
.template-choice-watermark { background: linear-gradient(180deg, #f5fffd, #e0f4f1); color: #0f766e; }
.template-choice-glass { background: linear-gradient(135deg, rgba(255,255,255,.92), rgba(255,255,255,.46)), linear-gradient(180deg, #ecfeff, #d4f4ee); color: #0f9f95; }
.template-choice-fire  { background: radial-gradient(circle at 18% 18%, rgba(245,158,11,.3), transparent 34%), linear-gradient(180deg, #451a03, #991b1b 58%, #ffedd5); color: #fed7aa; }
.template-choice-ice   { background: linear-gradient(135deg, rgba(255,255,255,.95), rgba(186,230,253,.7)), linear-gradient(180deg, #f8fdff, #dff3ff); color: #0284c7; }
.template-choice-yanga { background: radial-gradient(circle at 18% 18%, rgba(251,191,36,.4), transparent 36%), linear-gradient(180deg, #451a03, #92400e 55%, #fef3c7); color: #fde68a; }
.template-choice-simba { background: radial-gradient(circle at 18% 18%, rgba(220,38,38,.3), transparent 34%), linear-gradient(180deg, #3b0000, #7f1d1d 55%, #fee2e2); color: #fecaca; }

.watermark-settings-shell {
  display: grid;
  grid-template-columns: minmax(200px, .62fr) minmax(0, 1fr);
  gap: 14px;
  margin-top: 16px;
}

.watermark-preview-card {
  min-height: 150px;
  border: 1.5px dashed var(--line-strong);
  border-radius: var(--radius-md);
  background: var(--surface-alt);
  display: grid;
  place-items: center;
  padding: 16px;
  overflow: hidden;
}

#settingsWatermarkPreviewImage { max-width: 100%; max-height: 120px; object-fit: contain; opacity: .60; }

/* ─── Toggle card ───────────────────────────────────────────── */
.toggle-card {
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface-alt);
  padding: 14px;
  display: grid;
  gap: 7px;
  transition: border-color .15s ease;
}

.toggle-card:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.toggle-card.disabled { opacity: .58; }

.send-channel-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.send-channel-card {
  min-height: 120px;
  align-content: start;
}

.send-channel-panel {
  display: grid;
  gap: 14px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface-alt);
}

.send-channel-panel-head {
  margin-bottom: 0;
}

.send-template-preview {
  display: grid;
  gap: 8px;
}

.send-template-preview-body {
  min-height: 116px;
  padding: 14px 16px;
  border-radius: var(--radius-md);
  border: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(15, 118, 110, .06), rgba(15, 118, 110, .02)), var(--surface);
  color: var(--text);
  line-height: 1.6;
  white-space: pre-wrap;
}

.account-security-card { margin-top: 16px; }
.two-factor-channel-actions { flex-wrap: wrap; }

.checkbox-row { display: flex; gap: 9px; align-items: center; font-weight: 700; font-size: 14px; }
.checkbox-row input { width: 17px; height: 17px; margin: 0; flex-shrink: 0; accent-color: var(--accent); }

.channel-wizard-shell {
  display: grid;
  grid-template-columns: minmax(220px, 260px) minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}

.channel-wizard-rail {
  display: grid;
  gap: 10px;
  padding: 12px;
  border-radius: var(--radius-md);
  border: 1px solid var(--line);
  background: var(--surface);
  position: sticky;
  top: 16px;
}

.channel-step {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 12px;
  border-radius: var(--radius-md);
  border: 1px solid var(--line);
  background: var(--surface-alt);
  color: var(--muted);
  text-align: left;
  cursor: pointer;
  transition: border-color .15s ease, box-shadow .15s ease, background .15s ease, color .15s ease;
}

.channel-step:hover {
  border-color: var(--line-strong);
  color: var(--text);
}

.channel-step.active {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--text);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.channel-step.complete {
  border-color: rgba(25,128,95,.24);
  background: var(--success-soft);
  color: var(--success);
}

.channel-step-index {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--surface-strong);
  font-size: 12px;
  font-weight: 700;
  flex-shrink: 0;
}

.channel-step.active .channel-step-index {
  background: var(--accent);
  color: #fff;
  border-color: transparent;
}

.channel-step.complete .channel-step-index {
  background: var(--success);
  color: #fff;
  border-color: transparent;
}

.channel-step-copy {
  display: grid;
  gap: 2px;
}

.channel-step-copy small {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.4;
}

.channel-panel {
  display: grid;
  gap: 16px;
}

.channel-wizard-body {
  display: grid;
  gap: 14px;
}

.channel-inline-actions {
  display: flex;
  gap: 12px;
  margin-top: 16px;
  flex-wrap: wrap;
}

.channel-inner-form {
  display: grid;
  gap: 12px;
  margin-top: 16px;
}

.settings-status-card {
  display: flex;
  gap: 16px;
  align-items: center;
  padding: 16px;
  border-radius: var(--radius-md);
  background: var(--surface-alt);
  border: 1px solid var(--line);
}

.settings-status-icon {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(148, 163, 184, .12);
  color: var(--muted);
  flex-shrink: 0;
}

.settings-status-idle { background: rgba(148,163,184,.12); color: var(--muted); }
.settings-status-ok { background: rgba(34,197,94,.14); color: #22c55e; }
.settings-status-msg { font-size: 13px; color: var(--muted); line-height: 1.55; }

.settings-info-note {
  padding: 14px 16px;
  border-radius: var(--radius-md);
  background: var(--surface-alt);
  border: 1px dashed var(--line-strong);
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
}

.wa-template-list { display: grid; gap: 10px; }

.wa-template-item {
  display: grid;
  gap: 10px;
  padding: 14px 16px;
  border-radius: var(--radius-md);
  background: var(--surface-alt);
  border: 1px solid var(--line);
}

.wa-template-item-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
}

.wa-template-item-head > div:first-child {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.wa-template-item-head strong {
  color: var(--text);
  font-size: 14px;
  overflow-wrap: anywhere;
}

.wa-template-item-head span {
  color: var(--muted);
  font-size: 11px;
}

.wa-template-item p {
  margin: 0;
  color: var(--text-soft);
  font-size: 13px;
  line-height: 1.55;
  white-space: pre-wrap;
}

.wa-template-item-actions {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}

.wa-template-item-actions button {
  border: 1px solid var(--line-strong);
  background: transparent;
  color: var(--muted);
  border-radius: 999px;
  padding: 7px 12px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}

.wa-template-item-actions button:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.wa-template-item-actions button.danger:hover {
  border-color: var(--danger);
  color: var(--danger);
}

.wa-template-token-row,
.wa-template-field-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.wa-template-token-row code {
  display: inline-flex;
  align-items: center;
  padding: 5px 9px;
  border-radius: 999px;
  background: rgba(59, 130, 246, .10);
  color: var(--accent);
  font-size: 12px;
  font-weight: 700;
}

.wa-template-field-help { display: grid; gap: 8px; }

.wa-template-field-chips button {
  border: 1px solid var(--line-strong);
  background: transparent;
  color: var(--muted);
  border-radius: 999px;
  padding: 6px 11px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}

.wa-template-field-chips button:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.wa-template-live-preview {
  padding: 12px 14px;
  border-radius: var(--radius-md);
  border: 1px solid var(--line);
  background: rgba(15, 23, 42, .06);
  color: var(--text-soft);
  font-size: 13px;
  line-height: 1.6;
  min-height: 52px;
  white-space: pre-wrap;
}

.wa-template-json-input {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  min-height: 220px;
}

.wa-template-required-fields {
  padding: 12px 14px;
  border-radius: var(--radius-md);
  border: 1px solid var(--line);
  background: rgba(15, 23, 42, .04);
  color: var(--muted);
  font-size: 12px;
  line-height: 1.55;
}

.wa-template-required-fields code { color: var(--accent); }

.wa-template-required-fields.is-error {
  border-color: rgba(239, 68, 68, .35);
  color: var(--danger);
}

.template-token-note {
  display: grid;
  gap: 5px;
  border-left: 3px solid var(--accent);
}

.template-token-note code {
  color: var(--accent-strong);
  font-weight: 800;
}

.overdue-reminder-card {
  position: relative;
  overflow: hidden;
  background:
    radial-gradient(circle at 100% 0, rgba(245, 158, 11, .12), transparent 34%),
    var(--surface);
}

.reminder-channel-grid {
  display: grid;
  grid-template-columns: 1.15fr 1fr 1fr;
  gap: 12px;
  margin-bottom: 18px;
}

.reminder-master-toggle {
  border-color: rgba(245, 158, 11, .34);
  background: rgba(245, 158, 11, .06);
}

.reminder-field-help { margin: 4px 0 18px; }

.reminder-template-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.08fr) minmax(280px, .92fr);
  gap: 18px;
  align-items: start;
}

.reminder-editor-stack,
.reminder-preview-stack {
  display: grid;
  gap: 12px;
}

.reminder-preview-card {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 18px;
  background: var(--surface-strong);
  box-shadow: var(--shadow-xs);
}

.reminder-email-preview::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 4px;
  background: linear-gradient(90deg, var(--accent), #38bdf8);
}

.reminder-preview-label {
  display: block;
  margin-bottom: 10px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .09em;
  text-transform: uppercase;
}

.reminder-preview-card strong {
  display: block;
  color: var(--text);
  font-size: 15px;
  line-height: 1.4;
}

.reminder-preview-card p {
  margin: 10px 0 0;
  color: var(--text-soft);
  font-size: 13px;
  line-height: 1.65;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.reminder-preview-cta {
  display: inline-flex;
  margin-top: 14px;
  border-radius: 9px;
  padding: 9px 12px;
  background: var(--accent);
  color: #fff;
  font-size: 11px;
  font-weight: 800;
}

.reminder-sms-preview {
  border-radius: 18px 18px 18px 5px;
  background: color-mix(in srgb, var(--accent-soft) 55%, var(--surface-strong));
}

.reminder-sms-preview small {
  display: block;
  margin-top: 10px;
  color: var(--muted);
  font-size: 10px;
  text-align: right;
}

@media (max-width: 900px) {
  .reminder-channel-grid,
  .reminder-template-grid { grid-template-columns: 1fr; }
}

.credits-cards-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.credits-wallet-card {
  position: relative;
  overflow: hidden;
  border-radius: var(--radius-md);
  border: 1px solid var(--line);
  background:
    radial-gradient(circle at top right, rgba(15, 118, 110, .10), transparent 36%),
    linear-gradient(180deg, var(--surface), var(--surface-alt));
  padding: 18px;
  display: grid;
  gap: 10px;
}

.credits-wallet-card::after {
  content: "";
  position: absolute;
  inset: auto -30px -30px auto;
  width: 120px;
  height: 120px;
  border-radius: 999px;
  background: rgba(15, 118, 110, .06);
}

.credits-wallet-card.low-balance {
  border-color: rgba(217, 119, 6, .40);
  background:
    radial-gradient(circle at top right, rgba(245, 158, 11, .18), transparent 38%),
    linear-gradient(180deg, rgba(255, 251, 235, .92), var(--surface-alt));
}

.credits-wallet-card.empty-balance {
  border-color: rgba(220, 38, 38, .36);
  background:
    radial-gradient(circle at top right, rgba(220, 38, 38, .18), transparent 36%),
    linear-gradient(180deg, rgba(254, 242, 242, .95), var(--surface-alt));
}

.cwc-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.cwc-channel-badge {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  border-radius: 999px;
  padding: .34rem .78rem;
  font-size: .75rem;
  font-weight: 700;
  letter-spacing: .02em;
  line-height: 1;
}

.cwc-channel-badge.sms {
  background: rgba(2, 132, 199, .12);
  color: #0369a1;
}

.cwc-channel-badge.wa {
  background: rgba(34, 197, 94, .12);
  color: #15803d;
}

.cwc-status-dot {
  width: 12px;
  height: 12px;
  border-radius: 999px;
  display: inline-block;
  background: rgba(148, 163, 184, .45);
  box-shadow: 0 0 0 5px rgba(148, 163, 184, .10);
}

.cwc-status-dot.good {
  background: #22c55e;
  box-shadow: 0 0 0 5px rgba(34, 197, 94, .12);
}

.cwc-status-dot.low {
  background: #f59e0b;
  box-shadow: 0 0 0 5px rgba(245, 158, 11, .14);
}

.cwc-status-dot.empty {
  background: #ef4444;
  box-shadow: 0 0 0 5px rgba(239, 68, 68, .14);
}

.cwc-balance {
  position: relative;
  z-index: 1;
  font-size: 2rem;
  font-weight: 700;
  color: var(--text);
  line-height: 1;
}

.cwc-label,
.cwc-usage {
  position: relative;
  z-index: 1;
}

.cwc-label {
  font-size: .84rem;
  color: var(--muted);
}

.cwc-usage {
  font-size: .82rem;
  color: var(--text-soft);
}

.cwc-low-alert {
  position: relative;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  width: fit-content;
  border-radius: 999px;
  padding: .36rem .74rem;
  background: rgba(245, 158, 11, .14);
  color: #b45309;
  font-size: .78rem;
  font-weight: 600;
}

.cwc-low-alert.empty-alert {
  background: rgba(220, 38, 38, .12);
  color: #b91c1c;
}

.credits-topup-btn {
  position: relative;
  z-index: 1;
  margin-top: 6px;
  border: none;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--accent), color-mix(in srgb, var(--accent) 72%, #ffffff 28%));
  color: #fff;
  padding: .82rem 1rem;
  font: 700 .86rem/1 "Ubuntu", sans-serif;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  cursor: pointer;
  transition: transform .15s ease, opacity .15s ease;
}

.credits-topup-btn:hover {
  opacity: .88;
  transform: translateY(-1px);
}

.credits-threshold-card {
  margin-top: 2px;
}

.credits-threshold-grid {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-top: 16px;
}

.credits-threshold-row {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}

.credits-threshold-label {
  min-width: 180px;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
  font-weight: 600;
}

.credits-threshold-input-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.credits-threshold-input {
  width: 120px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text);
  padding: .72rem .82rem;
  font: 500 .92rem/1 "Ubuntu", sans-serif;
}

.credits-threshold-input:focus,
.credits-amount-input:focus {
  outline: none;
  border-color: var(--accent);
}

.credits-threshold-unit {
  color: var(--muted);
  font-size: .82rem;
}

.credits-save-threshold-btn {
  border: 1px solid var(--line-strong);
  background: var(--surface);
  color: var(--text);
  border-radius: 10px;
  padding: .68rem .92rem;
  font: 700 .82rem/1 "Ubuntu", sans-serif;
  cursor: pointer;
}

.credits-info-box {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 15px 16px;
  border-radius: var(--radius-md);
  border: 1px dashed var(--line-strong);
  background: var(--surface-alt);
}

.credits-info-icon {
  color: var(--accent);
  flex-shrink: 0;
  margin-top: 2px;
}

.credits-info-box strong {
  display: block;
  margin-bottom: 4px;
  font-size: .9rem;
}

.credits-info-box p {
  margin: 0;
  color: var(--muted);
  line-height: 1.55;
}

.credits-modal {
  position: fixed;
  inset: 0;
  z-index: 1600;
}

.credits-modal.hidden {
  display: none;
}

.credits-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, .54);
  backdrop-filter: blur(4px);
}

.credits-modal-inner {
  position: relative;
  z-index: 1;
  width: min(92vw, 520px);
  margin: min(12vh, 88px) auto 0;
  border-radius: var(--radius-lg);
  border: 1px solid var(--line);
  background: var(--surface);
  box-shadow: 0 26px 70px rgba(15, 23, 42, .28);
}

.credits-modal-header,
.credits-modal-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 20px;
}

.credits-modal-header {
  border-bottom: 1px solid var(--line);
}

.credits-modal-header h4 {
  margin: 0;
  font-size: 1.05rem;
  color: var(--text);
}

.credits-modal-close {
  border: none;
  background: transparent;
  color: var(--muted);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.credits-modal-body {
  padding: 18px 20px;
}

.credits-modal-footer {
  border-top: 1px solid var(--line);
  justify-content: flex-end;
}

.credits-quick-amounts {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.credits-quick-btn {
  border: 1px solid var(--line);
  background: var(--surface-alt);
  color: var(--text);
  border-radius: 999px;
  padding: .48rem .82rem;
  font: 700 .82rem/1 "Ubuntu", sans-serif;
  cursor: pointer;
}

.credits-quick-btn:hover,
.credits-quick-btn.selected {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent);
}

.credits-amount-wrap {
  display: flex;
  flex-direction: column;
  gap: 5px;
  margin-bottom: 10px;
}

.credits-amount-wrap label {
  font-size: .82rem;
  color: var(--muted);
  font-weight: 600;
}

.credits-amount-input {
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--surface-alt);
  color: var(--text);
  padding: .85rem .95rem;
  font: 500 .95rem/1 "Ubuntu", sans-serif;
}

.credits-modal-price-note {
  color: var(--muted);
  font-size: .84rem;
  line-height: 1.5;
}

/* ─── Review ────────────────────────────────────────────────── */
.review-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.review-card {
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface-alt);
  padding: 14px;
  display: grid;
  gap: 7px;
}

.review-card span {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .10em;
  color: var(--muted);
  font-weight: 700;
}

.invoice-review-shell { display: grid; gap: 16px; }

.invoice-review-overview {
  display: none;
  grid-template-columns: minmax(0, 1.45fr) minmax(260px, .75fr);
  gap: 14px;
  align-items: start;
}

.invoice-review-shell.details-open .invoice-review-overview {
  display: grid;
}

.review-details-toggle-btn {
  font-size: 12px;
  padding: 6px 14px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-md);
  color: var(--muted);
  flex-shrink: 0;
  transition: color .15s, border-color .15s;
}

.review-details-toggle-btn[aria-expanded="true"] {
  color: var(--accent);
  border-color: var(--accent);
}

.invoice-review-summary { align-self: stretch; }
.invoice-review-summary .summary-row { padding-block: 3px; }
.invoice-review-preview { padding: 18px; gap: 16px; }
.invoice-preview-toolbar { display: grid; gap: 7px; }

.invoice-preview-design-row {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: linear-gradient(180deg, rgba(255,255,255,.62), rgba(255,255,255,.34));
}

.invoice-preview-design-row-bottom {
  background: var(--surface);
}

.preview-design-group {
  display: grid;
  grid-template-columns: 120px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
}

.preview-design-label {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .10em;
  text-transform: uppercase;
}

.preview-design-options {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 2px;
  scrollbar-width: thin;
}

.preview-design-chip {
  min-width: max-content;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface-strong);
  color: var(--text);
  padding: 7px 10px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
}

.preview-design-chip:hover {
  border-color: var(--line-strong);
}

.preview-design-chip.active {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent-strong);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.preview-design-swatch {
  width: 28px;
  height: 20px;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(15, 23, 42, .10);
  flex: 0 0 auto;
}

/* ─── Send step attachment card (send-attach-*) ─────────────── */
.send-aside {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.send-attach-card {
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-md);
  background: var(--surface-strong);
  overflow: hidden;
  cursor: pointer;
  transition: border-color .15s ease, box-shadow .15s ease, transform .1s ease;
  display: flex;
  flex-direction: column;
  outline: none;
}
.send-attach-card:hover {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
  transform: translateY(-1px);
}
.send-attach-card:focus-visible {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.send-attach-card:active { transform: translateY(0); }

.send-attach-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 14px;
  background: var(--accent-soft);
  border-bottom: 1px solid var(--line);
}
.send-attach-pdf-icon {
  width: 26px;
  height: 26px;
  flex-shrink: 0;
  color: var(--accent);
}
.send-attach-header-text { min-width: 0; }
.send-attach-filename {
  display: block;
  font-size: 12px;
  font-weight: 700;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.send-attach-filetype {
  display: block;
  font-size: 10px;
  color: var(--muted);
  margin-top: 1px;
}

.send-attach-paper {
  background: #fff;
  padding: 12px 14px 10px;
  display: flex;
  flex-direction: column;
  gap: 9px;
  color: #222;
}
.send-attach-paper-top {
  display: flex;
  align-items: center;
  gap: 8px;
}
.send-attach-paper-logo {
  width: 26px;
  height: 26px;
  border-radius: 4px;
  background: var(--accent);
  opacity: .8;
  flex-shrink: 0;
}
.send-attach-paper-bizname {
  font-size: 10.5px;
  font-weight: 800;
  color: #111;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  letter-spacing: -.01em;
}
.send-attach-paper-body {
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.send-attach-line {
  height: 6px;
  border-radius: 2px;
  background: #e8e8e8;
}
.send-attach-line.w-full  { width: 100%; }
.send-attach-line.w-80    { width: 80%; }
.send-attach-line.w-60    { width: 60%; }
.send-attach-line.w-40    { width: 40%; }
.send-attach-divider {
  height: 1px;
  background: #ddd;
  margin: 2px 0;
}
.send-attach-total-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 2px;
}
.send-attach-total-label {
  font-size: 10px;
  font-weight: 700;
  color: #888;
  text-transform: uppercase;
  letter-spacing: .06em;
}
.send-attach-total-val {
  font-size: 13px;
  font-weight: 800;
  color: var(--accent-strong);
  letter-spacing: -.01em;
}

.send-attach-meta {
  padding: 9px 14px 10px;
  display: flex;
  flex-direction: column;
  gap: 5px;
  border-top: 1px solid var(--line);
}
.send-attach-meta-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 6px;
}
.send-attach-meta-key {
  font-size: 10px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .06em;
  font-weight: 600;
  flex-shrink: 0;
}
.send-attach-meta-val {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text);
  text-align: right;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 160px;
}
.send-attach-meta-val--accent { color: var(--accent-strong); font-weight: 800; font-size: 12px; }

.send-email-summary { margin: 0; }

/* ─── Invoice preview lightbox ──────────────────────────────── */
.inv-lightbox {
  position: fixed;
  inset: 0;
  z-index: 9900;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.inv-lightbox.hidden { display: none; }
.inv-lightbox-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, .72);
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
  cursor: pointer;
}
.inv-lightbox-shell {
  position: relative;
  z-index: 1;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 860px;
  max-height: 92vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 32px 96px rgba(0, 0, 0, .45);
  animation: lightboxIn .2s ease;
}
@keyframes lightboxIn {
  from { opacity: 0; transform: scale(.97) translateY(8px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}
.inv-lightbox-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 13px 20px;
  border-bottom: 1px solid var(--line);
  flex-shrink: 0;
}
.inv-lightbox-head span {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
}
.inv-lightbox-close-btn { padding: 5px 12px; font-size: 13px; }
.inv-lightbox-body {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  background: var(--surface-alt);
  -webkit-overflow-scrolling: touch;
}
.inv-lightbox-body .native-invoice-preview {
  max-width: 800px;
  margin: 0 auto;
  box-shadow: 0 4px 24px rgba(0,0,0,.15);
}
.inv-lightbox-foot {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  padding: 12px 20px;
  border-top: 1px solid var(--line);
  flex-shrink: 0;
}

@media (max-width: 680px) {
  .inv-lightbox { padding: 0; }
  .inv-lightbox-shell { max-height: 100dvh; border-radius: 0; border: none; }
  .send-channel-grid { grid-template-columns: 1fr; }
  .send-email-summary { display: none; }
}

/* ─── Native invoice preview ───────────────────────────────── */
.native-preview-card {
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface-alt);
  padding: 14px;
  display: grid;
  gap: 12px;
}

.native-invoice-preview {
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: linear-gradient(180deg, rgba(255,255,255,.72), rgba(255,255,255,.94));
  padding: 24px;
  overflow: auto;
  display: flex;
  justify-content: center;
  min-height: 640px;
  position: relative;
}

.native-invoice-preview.is-rendering-pdf {
  overflow: hidden;
}

.native-invoice-preview.is-rendering-pdf::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 6;
  background: rgba(255,255,255,.76);
  backdrop-filter: blur(2px);
}

.native-invoice-preview.is-rendering-pdf::after {
  content: attr(data-loading-label);
  position: absolute;
  z-index: 7;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  padding: 12px 16px 12px 42px;
  border-radius: var(--radius-md);
  border: 1px solid var(--line-strong);
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-lg);
  font-size: 14px;
  font-weight: 800;
  white-space: nowrap;
}

.invoice-review-controls {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  align-items: start;
}

.invoice-review-controls > .form-section { grid-column: 1 / -1; }

/* ─── Stamp & signature ─────────────────────────────────────── */
.stamp-settings-card {
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface-alt);
  padding: 16px;
}

.stamp-upload-grid, .stamp-preview-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.stamp-preview-card {
  min-height: 120px;
  border: 1.5px dashed var(--line-strong);
  border-radius: var(--radius-md);
  background: var(--surface);
  padding: 12px;
  display: grid;
  gap: 7px;
  place-items: center;
  text-align: center;
}

.stamp-preview-card span {
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: .12em;
  color: var(--muted);
  font-weight: 700;
}

.stamp-preview-card img {
  max-width: 100%;
  max-height: 76px;
  object-fit: contain;
}

.signature-draw-card {
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface);
  padding: 14px;
  display: grid;
  gap: 10px;
}

#signatureDrawCanvas {
  width: 100%;
  height: 190px;
  border: 1.5px dashed var(--line-strong);
  border-radius: var(--radius-md);
  background: rgba(255,255,255,.96);
  touch-action: none;
  cursor: crosshair;
}

.stamp-actions { justify-content: flex-end; }

/* ─── Theme grid ────────────────────────────────────────────── */
.theme-card {
  border-radius: var(--radius-lg);
  border: 1.5px solid var(--line);
  background: var(--surface-alt);
  padding: 16px;
  display: grid;
  gap: 10px;
  cursor: pointer;
  text-align: left;
  transition: border-color .15s ease, box-shadow .15s ease;
}

.theme-card:hover { border-color: var(--line-strong); }
.theme-card.active { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.theme-card strong { font-size: 14px; }
.theme-card small { color: var(--muted); font-size: 12.5px; }

.theme-swatch {
  height: 100px;
  border-radius: var(--radius-md);
  border: 1px solid rgba(255,255,255,.16);
}

.theme-linen     { background: linear-gradient(135deg, #fff8ef 0%, #d9ba8d 100%); }
.theme-midnight  { background: linear-gradient(135deg, #101922 0%, #4282c4 100%); }
.theme-emerald   { background: linear-gradient(135deg, #eff9f3 0%, #19805f 100%); }
.theme-executive { background: linear-gradient(135deg, #f6f9ff 0%, #406dcd 100%); }
.theme-glass {
  background:
    linear-gradient(135deg, rgba(255,255,255,.75), rgba(255,255,255,.18)),
    radial-gradient(circle at 18% 16%, rgba(45,212,191,.52), transparent 28%),
    linear-gradient(135deg, #ecfeff 0%, #8ddfd7 100%);
}
.theme-fire {
  background:
    radial-gradient(circle at 20% 18%, #fbbf24, transparent 24%),
    linear-gradient(135deg, #431407 0%, #dc2626 48%, #f97316 100%);
}
.theme-ice {
  background:
    linear-gradient(135deg, rgba(255,255,255,.92), rgba(255,255,255,.16)),
    radial-gradient(circle at 18% 16%, #bae6fd, transparent 30%),
    linear-gradient(135deg, #f8fdff 0%, #38bdf8 100%);
}

/* ─── Offline indicator ─────────────────────────────────────── */
.offline-indicator {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 6px 12px 6px 10px;
  border-radius: var(--radius-md);
  background: var(--danger-soft);
  border: 1px solid rgba(192,70,59,.28);
  color: var(--danger);
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
  animation: offlinePulse 2.4s ease-in-out infinite;
}

@keyframes offlinePulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: .78; }
}

.offline-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--danger);
  flex-shrink: 0;
}

.offline-queue-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  background: var(--danger);
  color: #fff;
  font-size: 10px;
  font-weight: 800;
}

/* Offline mode — syncing state */
.offline-indicator.syncing {
  background: rgba(196,131,26,.11);
  border-color: rgba(196,131,26,.28);
  color: var(--warning);
  animation: none;
}
.offline-indicator.syncing .offline-dot {
  background: var(--warning);
  animation: offlinePulse 1s ease-in-out infinite;
}

/* ─── Offline settings panel ────────────────────────────────── */
.offline-status-card {
  display: grid;
  gap: 14px;
  padding: 18px 0 0;
}

.offline-state-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 14px 16px;
  border-radius: var(--radius-md);
  border: 1px solid var(--line);
  background: var(--surface-alt);
}

.offline-state-label {
  display: grid;
  gap: 3px;
}

.offline-state-label strong {
  font-size: 14px;
}

.offline-state-label small {
  color: var(--muted);
  font-size: 12.5px;
  line-height: 1.5;
}

.offline-approval-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 700;
  white-space: nowrap;
}

.offline-approval-badge.approved {
  background: var(--success-soft);
  color: var(--success);
  border: 1px solid rgba(25,122,90,.22);
}

.offline-approval-badge.pending {
  background: rgba(196,131,26,.11);
  color: var(--warning);
  border: 1px solid rgba(196,131,26,.24);
}

.offline-approval-badge.not-requested {
  background: var(--surface-alt);
  color: var(--muted);
  border: 1px solid var(--line);
}

.offline-pending-list {
  display: grid;
  gap: 10px;
  padding-top: 14px;
}

.offline-request-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 12px 16px;
  border-radius: var(--radius-md);
  border: 1px solid var(--line);
  background: var(--surface-alt);
}

.offline-request-info {
  display: grid;
  gap: 2px;
}

.offline-request-info strong { font-size: 13.5px; }
.offline-request-info small  { color: var(--muted); font-size: 12px; }

.offline-request-actions { display: flex; gap: 8px; flex-shrink: 0; }

.offline-sync-strip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 10px 16px;
  border-radius: var(--radius-md);
  border: 1px solid var(--line);
  background: var(--surface-alt);
  font-size: 13px;
}

.offline-sync-count {
  font-weight: 700;
  color: var(--warning);
}

/* ─── Floating theme dock ───────────────────────────────────── */
/* ─── Header theme picker ───────────────────────────────────── */
.hdr-theme-wrap { position: relative; }

.hdr-theme-btn {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 8px 12px;
  border-radius: var(--radius-md);
  border: 1.5px solid var(--line-strong);
  background: var(--surface-strong);
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: border-color .15s, background .15s, color .15s;
}
.hdr-theme-btn:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent-strong);
  transform: none; /* no lift — just a clean state change */
}

.hdr-theme-swatch {
  width: 14px;
  height: 14px;
  border-radius: var(--radius-xs);
  border: 1px solid rgba(0,0,0,.12);
  flex-shrink: 0;
}

.hdr-theme-chevron {
  opacity: .5;
  flex-shrink: 0;
  transition: transform .15s;
}
.hdr-theme-btn[aria-expanded="true"] .hdr-theme-chevron {
  transform: rotate(180deg);
}

.hdr-theme-drop {
  position: absolute;
  top: calc(100% + 5px);
  right: 0;
  width: max-content;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-xl);
  backdrop-filter: blur(12px);
  padding: 8px;
  display: grid;
  gap: 6px;
  z-index: 200;
  animation: noticeIn .14s var(--ease-out) both;
}

#hdrThemeOptions {
  display: flex;
  gap: 5px;
}

.hdr-theme-opt {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  padding: 5px;
  width: 54px;
  border-radius: var(--radius-sm);
  border: 1.5px solid transparent;
  background: transparent;
  color: var(--text);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .02em;
  cursor: pointer;
  text-align: center;
  transition: background .12s, border-color .12s, color .12s;
}
.hdr-theme-opt:hover {
  background: var(--surface-alt);
  transform: none;
}
.hdr-theme-opt.active {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent-strong);
}
.hdr-theme-opt .theme-swatch {
  width: 100%;
  height: 28px;
  border-radius: var(--radius-xs);
  flex-shrink: 0;
}

.hdr-theme-divider {
  height: 1px;
  background: var(--line);
  margin: 4px 0;
}

.hdr-theme-studio-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 9px;
  border-radius: var(--radius-sm);
  border: none;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  text-align: left;
  width: 100%;
  transition: color .12s, background .12s;
}
.hdr-theme-studio-btn:hover {
  color: var(--accent);
  background: var(--surface-alt);
  transform: none;
}

/* Hide the old floating dock */
.floating-theme-dock {
  display: none !important;
}

.floating-theme-button {
  width: 52px;
  height: 52px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--line-strong);
  background: var(--surface);
  box-shadow: var(--shadow-lg);
  display: grid;
  place-items: center;
  padding: 8px;
  cursor: pointer;
  transition: box-shadow .18s ease, transform .16s var(--ease-out);
}

.floating-theme-button:hover { box-shadow: var(--shadow-xl); }
.floating-theme-button img { width: 32px; height: 32px; object-fit: contain; }

.floating-theme-panel {
  width: min(272px, calc(100vw - 48px));
  border-radius: var(--radius-xl);
  border: 1px solid var(--line);
  background: var(--surface);
  box-shadow: var(--shadow-xl);
  backdrop-filter: blur(16px);
  padding: 14px;
  display: grid;
  gap: 10px;
  animation: noticeIn .18s var(--ease-out) both;
}

.floating-theme-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  font-size: 14px;
}

.floating-theme-options { display: grid; gap: 6px; }

.floating-theme-option {
  border-radius: var(--radius-md);
  border: 1.5px solid var(--line);
  background: var(--surface-alt);
  color: var(--text);
  padding: 8px;
  display: grid;
  grid-template-columns: 50px minmax(0, 1fr);
  gap: 9px;
  align-items: center;
  text-align: left;
  font-weight: 700;
  font-size: 13px;
  cursor: pointer;
  transition: border-color .15s ease, box-shadow .15s ease;
}

.floating-theme-option:hover { border-color: var(--line-strong); }
.floating-theme-option.active { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-soft); }
.floating-theme-option .theme-swatch { height: 30px; border-radius: var(--radius-sm); }

/* ─── Native invoice sheet ──────────────────────────────────── */
.native-invoice-sheet {
  position: relative;
  display: grid;
  gap: 16px;
  width: min(100%, 1100px);
  min-width: 860px;
  margin: 0 auto;
  padding: 28px;
  color: var(--text);
  border: 1px var(--border-style, solid) var(--line);
  border-radius: var(--radius-md);
  background: linear-gradient(180deg, rgba(255,255,255,.94), rgba(255,255,255,.98)), var(--sheet);
  box-shadow: 0 20px 48px rgba(0,0,0,.07);
}

.native-invoice-sheet > *:not(.native-watermark-image):not(.native-paid-badge-image) {
  position: relative;
  z-index: 1;
}

.native-watermark-image {
  position: absolute;
  top: 30%;
  left: 18%;
  width: 64%;
  max-height: 44%;
  object-fit: contain;
  opacity: .09;
  z-index: 0;
  pointer-events: none;
}

.native-paid-badge-image {
  position: absolute;
  top: auto;
  right: 28px;
  left: auto;
  bottom: 28px;
  width: 128px;
  height: auto;
  object-fit: contain;
  z-index: 3;
  opacity: .92;
  transform: rotate(8deg);
  filter: drop-shadow(0 8px 14px rgba(15,23,42,.14));
  pointer-events: none;
}

.native-invoice-header,
.native-parties-grid,
.native-bottom-grid {
  display: grid;
  gap: 12px;
}

.native-invoice-header,
.native-bottom-grid { grid-template-columns: minmax(0, 1.3fr) minmax(250px, .8fr); align-items: stretch; }
.native-bottom-grid { align-items: start; }
.native-bottom-grid-totals-only { grid-template-columns: minmax(0, 1.3fr) minmax(250px, .8fr); }
.native-bottom-grid-totals-only .native-total-card { grid-column: 2; }
.native-parties-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }

.native-invoice-brand { display: grid; gap: 7px; align-content: center; }

.native-brand-head {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 14px;
  align-items: center;
}

.native-brand-copy-block { display: grid; gap: 5px; }

.native-logo-box { width: 148px; height: 148px; border: 0; border-radius: 0; background: transparent; display: grid; place-items: center; padding: 0; }
.native-logo-image { max-width: 100%; max-height: 100%; object-fit: contain; }

.native-brand-kicker,
.native-party-card span,
.native-summary-card span,
.native-copy-card span,
.native-payment-type {
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: .12em;
  color: var(--muted);
  font-weight: 700;
}

.native-brand-copy { color: var(--muted); line-height: 1.6; }

.native-invoice-brand h3,
.native-meta-number,
.native-grand-total,
.native-grand-total strong { color: var(--title); }

.native-meta-card,
.native-party-card,
.native-summary-card,
.native-line-card,
.native-copy-card,
.native-total-card,
.native-payment-card {
  border: 1px var(--border-style, solid) var(--line);
  border-radius: var(--radius-sm);
  background: var(--sheet);
}

.native-meta-card,
.native-party-card,
.native-summary-card,
.native-copy-card,
.native-total-card,
.native-payment-card { padding: 14px 16px; }

.native-meta-card { display: grid; gap: 9px; text-align: right; align-content: center; }
.native-meta-title { color: var(--accent); font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .16em; }
.native-meta-number { font-size: 26px; line-height: 1; font-family: var(--font-heading); }

.native-status-badge {
  justify-self: end;
  display: inline-flex;
  padding: 7px 12px;
  border-radius: var(--radius-sm);
  background: var(--accent-soft);
  border: 1px solid var(--line);
  color: var(--accent);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
}

.native-party-card,
.native-summary-card,
.native-total-card { display: grid; gap: 9px; }

.native-summary-card > div,
.native-total-card > div { display: flex; justify-content: space-between; gap: 12px; }

.native-line-card { padding: 0; overflow: hidden; }

.native-line-table { width: 100%; border-collapse: collapse; table-layout: fixed; }

.native-line-table th, .native-line-table td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}

.native-line-table th {
  background: var(--surface-alt);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--muted);
  text-align: left;
}

.native-line-table col.native-col-index     { width: 7%; }
.native-line-table col.native-col-description { width: 43%; }
.native-line-table col.native-col-qty         { width: 12%; }
.native-line-table col.native-col-unit        { width: 19%; }
.native-line-table col.native-col-amount      { width: 19%; }

.native-line-table th.native-col-index, .native-line-table td.native-col-index { text-align: center; }
.native-line-table th.native-col-description, .native-line-table td.native-col-description { text-align: left; }
.native-line-table th.native-col-qty, .native-line-table td.native-col-qty,
.native-line-table th.native-col-unit, .native-line-table td.native-col-unit,
.native-line-table th.native-col-amount, .native-line-table td.native-col-amount { text-align: right; }

.native-line-table td.native-col-qty,
.native-line-table td.native-col-unit,
.native-line-table td.native-col-amount { white-space: nowrap; }

.native-line-meta { margin-top: 3px; color: var(--muted); font-size: 11.5px; }
.native-table-empty { padding: 20px; color: var(--muted); text-align: center; }

.native-notes-stack, .native-payment-grid { display: grid; gap: 10px; }
.native-payment-section { width: 100%; }
.native-payment-grid { width: 100%; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 10px; }
.native-payment-card { min-width: 0; }
.native-empty-note { color: var(--muted); }
.native-copy-value { line-height: 1.7; font-weight: 600; }

.native-payment-table { width: 100%; border-collapse: collapse; margin-top: 5px; }
.native-payment-table td { padding: 4px 0; font-size: 11.5px; vertical-align: top; }
.native-payment-table td:first-child { color: var(--muted); }
.native-payment-table td:last-child { text-align: right; font-weight: 700; }

/* ─── Invoice template variants ─────────────────────────────── */
.native-template-executive .native-invoice-header {
  background: #0f172a;
  border-radius: var(--radius-md);
  padding: 18px;
}

.native-template-executive .native-brand-kicker,
.native-template-executive .native-brand-copy,
.native-template-executive .native-invoice-brand h3,
.native-template-executive .native-meta-title,
.native-template-executive .native-meta-number { color: #f8fafc; }

.native-template-executive .native-meta-card {
  background: rgba(255,255,255,.06);
  border-color: rgba(255,255,255,.18);
}

.native-template-executive .native-status-badge {
  color: #f8fafc;
  border-color: rgba(255,255,255,.18);
  background: rgba(255,255,255,.12);
}

.native-template-executive .native-line-table th { background: #e8eef8; }

.native-invoice-sheet.native-template-studio { border-top: 9px solid var(--accent); }
.native-template-studio .native-invoice-header { border-bottom: 1px dashed var(--line); padding-bottom: 14px; }
.native-template-studio .native-line-table th { background: #f6efe4; }
.native-template-studio .native-copy-card,
.native-template-studio .native-payment-card,
.native-template-studio .native-party-card,
.native-template-studio .native-summary-card,
.native-template-studio .native-total-card { background: #fffdf8; }

.native-invoice-sheet.native-template-glass {
  background: linear-gradient(135deg, rgba(255,255,255,.88), rgba(255,255,255,.64)), linear-gradient(180deg, #fbfffe, #eaf8f6);
  box-shadow: 0 28px 60px rgba(12,66,76,.16), inset 0 1px 0 rgba(255,255,255,.72);
}

.native-template-glass .native-invoice-header {
  padding: 18px;
  border: 1px solid rgba(165, 220, 215, .70);
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, rgba(255,255,255,.72), rgba(208,244,240,.50));
}

.native-template-glass .native-meta-card,
.native-template-glass .native-party-card,
.native-template-glass .native-summary-card,
.native-template-glass .native-copy-card,
.native-template-glass .native-payment-card,
.native-template-glass .native-total-card,
.native-template-glass .native-line-card {
  background: rgba(255,255,255,.74);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.80);
  backdrop-filter: blur(12px);
}

.native-invoice-sheet.native-template-fire {
  border-top: 9px solid var(--accent);
  background: radial-gradient(circle at 12% 8%, rgba(245,158,11,.14), transparent 28%), linear-gradient(180deg, #fff9f2, #fff0e0);
}

.native-template-fire .native-invoice-header {
  padding: 18px;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, #451a03, #991b1b 58%, #dc2626);
}

.native-template-fire .native-brand-copy,
.native-template-fire .native-invoice-brand h3,
.native-template-fire .native-meta-title,
.native-template-fire .native-meta-number { color: #fff7ed; }

.native-template-fire .native-meta-card { background: rgba(255,255,255,.08); border-color: rgba(254,215,170,.28); }

.native-template-fire .native-status-badge {
  color: #fff7ed;
  border-color: rgba(254,215,170,.28);
  background: rgba(254,215,170,.14);
}

.native-template-fire .native-line-table th { background: #ffead5; color: #7c2d12; }

.native-invoice-sheet.native-template-ice {
  background: linear-gradient(135deg, rgba(255,255,255,.94), rgba(255,255,255,.76)), linear-gradient(180deg, #f8fdff, #eaf8ff);
  box-shadow: 0 24px 52px rgba(6,86,120,.12);
}

.native-template-ice .native-invoice-header {
  padding: 18px;
  border: 1px solid rgba(186,230,253,.76);
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, rgba(240,249,255,.96), rgba(186,230,253,.62));
}

.native-template-ice .native-meta-card,
.native-template-ice .native-party-card,
.native-template-ice .native-summary-card,
.native-template-ice .native-copy-card,
.native-template-ice .native-payment-card,
.native-template-ice .native-total-card,
.native-template-ice .native-line-card { border-color: rgba(10,116,144,.16); }

.native-template-ice .native-line-table th { background: #e0f2fe; }

/* ─── Yanga theme (amber/golden) ───────────────────────────── */
.native-invoice-sheet.native-template-yanga {
  background: radial-gradient(circle at 90% 8%, rgba(251,191,36,.18), transparent 32%), linear-gradient(180deg, #fffbeb, #fef3c7);
  border-top: 9px solid #d97706;
}

.native-template-yanga .native-invoice-header {
  padding: 18px;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, #451a03, #92400e 55%, #b45309);
}

.native-template-yanga .native-brand-copy,
.native-template-yanga .native-invoice-brand h3,
.native-template-yanga .native-meta-title,
.native-template-yanga .native-meta-number { color: #fef3c7; }

.native-template-yanga .native-meta-card {
  background: rgba(255,255,255,.10);
  border-color: rgba(253,230,138,.32);
}

.native-template-yanga .native-status-badge {
  color: #fef3c7;
  border-color: rgba(253,230,138,.36);
  background: rgba(253,230,138,.16);
}

.native-template-yanga .native-line-table th { background: #fef3c7; color: #78350f; }

.native-template-yanga .native-summary-card,
.native-template-yanga .native-copy-card,
.native-template-yanga .native-payment-card,
.native-template-yanga .native-party-card,
.native-template-yanga .native-total-card { background: #fffdf5; }

/* ─── Simba theme (warm red/lion) ──────────────────────────── */
.native-invoice-sheet.native-template-simba {
  background: radial-gradient(circle at 10% 10%, rgba(220,38,38,.12), transparent 30%), linear-gradient(180deg, #fff8f8, #fee2e2);
  border-top: 9px solid #b91c1c;
}

.native-template-simba .native-invoice-header {
  padding: 18px;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, #3b0000, #7f1d1d 55%, #b91c1c);
}

.native-template-simba .native-brand-copy,
.native-template-simba .native-invoice-brand h3,
.native-template-simba .native-meta-title,
.native-template-simba .native-meta-number { color: #fef2f2; }

.native-template-simba .native-meta-card {
  background: rgba(255,255,255,.10);
  border-color: rgba(252,165,165,.34);
}

.native-template-simba .native-status-badge {
  color: #fef2f2;
  border-color: rgba(252,165,165,.36);
  background: rgba(252,165,165,.16);
}

.native-template-simba .native-line-table th { background: #fee2e2; color: #7f1d1d; }

.native-template-simba .native-summary-card,
.native-template-simba .native-copy-card,
.native-template-simba .native-payment-card,
.native-template-simba .native-party-card,
.native-template-simba .native-total-card { background: #fff8f8; }

.native-grand-total {
  padding-top: 10px;
  border-top: 1px solid var(--line);
  color: var(--accent);
  font-size: 17px;
}

.native-invoice-footer {
  padding-top: 4px;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
  font-size: 11.5px;
  border-top: 1px solid var(--line);
}

/* ─── Stamp / signature placement ───────────────────────────── */
.native-stamp-section {
  padding: 50px;
  display: flex;
  justify-content: flex-end;
}

.native-stamp-block {
  width: min(440px, 100%);
  display: grid;
  gap: 16px;
  justify-items: end;
  text-align: right;
}

.native-stamp-names {
  display: grid;
  gap: 6px;
  width: 100%;
  padding-top: 10px;
  border-top: 1px dashed var(--line);
}

.native-stamp-names div { display: flex; justify-content: space-between; gap: 12px; }
.native-stamp-names span { color: var(--muted); font-weight: 700; }
.native-stamp-names strong { color: var(--title); }

.native-stamp-images {
  position: relative;
  width: min(310px, 100%);
  height: 210px;
  pointer-events: none;
}

.native-signature-image {
  position: absolute;
  left: 50%;
  top: 44%;
  z-index: 2;
  max-width: 56%;
  max-height: 38%;
  object-fit: contain;
  transform: translate(-50%, -50%);
}

.native-stamp-image {
  position: absolute;
  right: 0;
  bottom: 0;
  width: 100%;
  height: 100%;
  max-width: none;
  max-height: none;
  object-fit: contain;
}

/* ─── Theme-specific glass/fire/ice card tweaks ─────────────── */
:root[data-theme="glass"] .login-panel,
:root[data-theme="glass"] .panel-card,
:root[data-theme="glass"] .hero-panel,
:root[data-theme="glass"] .metric-card,
:root[data-theme="glass"] .workspace-header,
:root[data-theme="glass"] .modal-dialog {
  border-color: rgba(255,255,255,.40);
  box-shadow: 0 24px 64px rgba(10,76,88,.18), inset 0 1px 0 rgba(255,255,255,.52);
  backdrop-filter: blur(22px) saturate(1.18);
}

:root[data-theme="glass"] .table-wrap,
:root[data-theme="glass"] .review-card,
:root[data-theme="glass"] .native-preview-card,
:root[data-theme="glass"] .mini-stat-card,
:root[data-theme="glass"] .summary-card,
:root[data-theme="glass"] .detail-block {
  border-color: rgba(255,255,255,.50);
  background: rgba(255,255,255,.56);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.54);
}

:root[data-theme="fire"] .hero-panel, :root[data-theme="fire"] .login-art {
  box-shadow: 0 28px 70px rgba(130,28,28,.24);
}

:root[data-theme="fire"] .panel-card,
:root[data-theme="fire"] .metric-card,
:root[data-theme="fire"] .workspace-header,
:root[data-theme="fire"] .table-wrap,
:root[data-theme="fire"] .review-card,
:root[data-theme="fire"] .native-preview-card,
:root[data-theme="fire"] .mini-stat-card,
:root[data-theme="fire"] .summary-card,
:root[data-theme="fire"] .detail-block {
  border-color: rgba(240,68,68,.26);
  background:
    radial-gradient(circle at 0 0, rgba(245,158,11,.10), transparent 34%),
    var(--surface);
}

:root[data-theme="fire"] .table-wrap,
:root[data-theme="fire"] .empty-state,
:root[data-theme="fire"] .panel-pill { border-style: dashed; }

:root[data-theme="fire"] .data-table th {
  background: linear-gradient(135deg, rgba(130,28,28,.10), rgba(245,158,11,.16));
  color: #7f1d1d;
}

:root[data-theme="ice"] .login-panel,
:root[data-theme="ice"] .panel-card,
:root[data-theme="ice"] .hero-panel,
:root[data-theme="ice"] .metric-card,
:root[data-theme="ice"] .workspace-header,
:root[data-theme="ice"] .modal-dialog {
  border-color: rgba(186,230,253,.52);
  box-shadow: 0 24px 56px rgba(6,86,120,.14), inset 0 1px 0 rgba(255,255,255,.64);
  backdrop-filter: blur(18px) saturate(1.08);
}

:root[data-theme="ice"] .table-wrap,
:root[data-theme="ice"] .review-card,
:root[data-theme="ice"] .native-preview-card,
:root[data-theme="ice"] .mini-stat-card,
:root[data-theme="ice"] .summary-card,
:root[data-theme="ice"] .detail-block {
  border-color: rgba(120,210,252,.40);
  background: linear-gradient(135deg, rgba(255,255,255,.84), rgba(224,242,254,.64)), var(--surface);
}

:root[data-theme="ice"] .table-wrap,
:root[data-theme="ice"] .empty-state,
:root[data-theme="ice"] .panel-pill { border-style: dotted; }

:root[data-theme="ice"] .data-table th {
  background: linear-gradient(135deg, rgba(240,249,255,.96), rgba(186,230,253,.74));
  color: #075985;
}

/* ─── Background texture overlays ───────────────────────────── */
:root[data-theme="glass"] body::before,
:root[data-theme="fire"] body::before,
:root[data-theme="ice"] body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  opacity: .34;
}

:root[data-theme="glass"] body::before {
  background-image: radial-gradient(rgba(12,156,146,.18) 1px, transparent 1px);
  background-size: 22px 22px;
}

:root[data-theme="fire"] body::before {
  background-image:
    linear-gradient(120deg, rgba(218,32,32,.07), transparent 42%),
    radial-gradient(rgba(130,28,28,.22) 1px, transparent 1px);
  background-size: auto, 20px 20px;
}

:root[data-theme="ice"] body::before {
  background-image:
    linear-gradient(135deg, rgba(255,255,255,.42), transparent 38%),
    radial-gradient(rgba(2,128,196,.20) 1px, transparent 1px);
  background-size: auto, 18px 18px;
}

/* ─── Responsive ────────────────────────────────────────────── */
@media (max-width: 1280px) {
  .metrics-grid    { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .theme-grid      { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .wizard-progress { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .settings-wizard-progress { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .channel-wizard-shell { grid-template-columns: 1fr; }
  .channel-wizard-rail {
    position: static;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .credits-cards-row { grid-template-columns: 1fr; }
}

@media (max-width: 1080px) {
  .workspace          { grid-template-columns: 1fr; }
  .split-shell, .widget-grid, .login-view, .wizard-split { grid-template-columns: 1fr; }
  .widget-grid {
    grid-template-rows: auto;
    grid-template-areas:
      "recent"
      "collection"
      "customers"
      "inventory";
  }
  .settings-grid      { grid-template-columns: 1fr; }
  .invoice-review-overview, .invoice-review-controls { grid-template-columns: 1fr; }
  .logo-settings-shell, .watermark-settings-shell { grid-template-columns: 1fr; }
  .stamp-upload-grid, .stamp-preview-grid { grid-template-columns: 1fr; }
  .native-stamp-section { padding: 24px 0; }
  .native-stamp-block { justify-items: stretch; text-align: left; }
  .native-stamp-images { align-self: start; }
  .template-choice-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .sidebar { position: static; top: auto; max-height: none; overflow: visible; }
  .native-invoice-header, .native-parties-grid, .native-bottom-grid { grid-template-columns: 1fr; }
  .native-bottom-grid-totals-only .native-total-card { grid-column: auto; }
  .native-meta-card { text-align: left; }
  .native-status-badge { justify-self: start; }
  .native-payment-grid { grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); overflow: visible; }
  .wizard-progress { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 760px) {
  .app-shell { padding: 12px; }
  .workspace-header, .hero-panel, .panel-card, .metric-card, .login-panel, .login-art, .modal-dialog { padding: 16px; }
  .metrics-grid, .form-grid, .detail-stat-grid, .collection-grid, .theme-grid, .review-grid, .wizard-progress { grid-template-columns: 1fr; }
  .invoice-filter-row { grid-template-columns: 1fr; }
  .dynamic-item-grid, .payment-detail-grid { grid-template-columns: 1fr; }
  .data-table { min-width: 760px; }
  .workspace-actions { align-items: stretch; }
  .native-invoice-preview { padding: 10px; }
  .native-invoice-sheet { min-width: 680px; padding: 16px; }
  .native-brand-head { grid-template-columns: 1fr; }
  .native-payment-grid { grid-template-columns: 1fr; }
  .floating-theme-dock { right: 16px; bottom: 16px; }
  .wizard-progress { grid-template-columns: 1fr; }
  .channel-wizard-rail { grid-template-columns: 1fr; }
  .template-choice-grid { grid-template-columns: 1fr; }
  .preview-design-group { grid-template-columns: 1fr; align-items: start; }
  .invoice-preview-design-row { padding: 10px; }
}

/* ─── Polish & micro-details ────────────────────────────────── */

/* Subtle scrollbar styling */
::-webkit-scrollbar { width: 7px; height: 7px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--line-strong); border-radius: 999px; }
::-webkit-scrollbar-thumb:hover { background: var(--muted); }

/* Sidebar scrollbar */
.sidebar::-webkit-scrollbar { width: 4px; }
.sidebar::-webkit-scrollbar-thumb { background: rgba(255,255,255,.18); }
.sidebar::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,.32); }

/* Workspace header border accent */
.workspace-header::after {
  content: none;
}

/* Filter group — visually separates primary actions from date/business controls */
.hdr-filter-group {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  padding-left: 14px;
  border-left: 1px solid var(--line-strong);
}

/* Compact field layout for workspace header controls */
.compact-field {
  display: grid;
  gap: 5px;
  min-width: 120px;
}

.compact-field span {
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: .12em;
  color: var(--muted);
  font-weight: 700;
}

.compact-field input,
.compact-field select {
  padding: 8px 10px;
  font-size: 13px;
}

/* Panel pill refinement */
.panel-pill { border-radius: var(--radius-sm); }

/* Table btn hover */
.table-btn:hover:not(:disabled) {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-soft);
  transform: translateY(-1px);
}

/* Toolbar row spacing */
.toolbar-row {
  padding-bottom: 4px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 4px;
}

/* payment method row */
.payment-method-row { align-items: center; }

/* section-head spacing */
.section-head {
  padding-bottom: 8px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 2px;
}

/* stack-meta utility */
.stack-meta { color: var(--muted); font-size: 12.5px; line-height: 1.55; display: block; }

/* Section head title size */
.section-head h4 { font-size: 16px; }
.section-head h5 { font-size: 14px; }

/* Smooth page-section entry */
.page-section:not(.hidden) { animation: pageFadeIn .22s var(--ease-out) both; }

@keyframes pageFadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* Hero panel headline spacing */
.hero-panel h3 { font-size: 19px; margin-top: 4px; }
.hero-panel .eyebrow { margin-bottom: 2px; }

/* Metric accent card text */
.accent-card strong { font-size: 28px; }

/* Login panel eyebrow */
.login-panel .eyebrow { font-size: 11px; }

/* Connection card summary text */
#apiConfigSummary { font-size: 11.5px; }

/* Better modal close button */
.modal-head .ghost-btn { flex-shrink: 0; }

/* Wizard nav active badge pulse */
@keyframes activePulse {
  0%, 100% { box-shadow: 0 0 10px rgba(255,255,255,.36); }
  50%       { box-shadow: 0 0 18px rgba(255,255,255,.56); }
}
.nav-btn.active::after { animation: activePulse 2.4s ease infinite; }

/* Input file styling tweak */
input[type="file"] {
  padding: 8px 12px;
  font-size: 13px;
  cursor: pointer;
}

/* Number inputs — remove spinners */
input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button { opacity: 1; }

/* Hover rows in stack list */
.stack-row { transition: border-color .12s ease, background .12s ease; }
.stack-row:hover { border-color: var(--accent); }

/* Panel card inner gap reset for nested sections */
.panel-card .form-section + .form-section { margin-top: 4px; }

/* Danger btn in sidebar matches a more refined look */
#logoutButton {
  border-radius: var(--radius-md);
  font-size: 14px;
  padding: 10px 16px;
  transition: background .18s ease, color .18s ease, border-color .18s ease, transform .16s var(--ease-out);
}

/* Status pill for invoice workspace */
.panel-pill#invoiceWorkspaceStatusPill {
  font-size: 12px;
  border-radius: var(--radius-sm);
}

/* ══════════════════════════════════════════════════════════════
   ENHANCED UI — Immersive widgets, metrics, hero, sidebar
══════════════════════════════════════════════════════════════ */

/* ─ Brand collapse button (top of sidebar, always visible) ── */
.brand-collapse-btn {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-md);
  background: rgba(255,255,255,.07);
  border: 1px solid rgba(255,255,255,.13);
  color: rgba(255,255,255,.52);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  align-self: center;
  transition: background .18s ease, color .18s ease, border-color .18s ease;
}
.brand-collapse-btn:hover {
  background: rgba(255,255,255,.15);
  color: rgba(255,255,255,.92);
  border-color: rgba(255,255,255,.22);
}
.brand-collapse-icon {
  transition: transform .28s var(--ease-out);
}
.sidebar.collapsed .brand-collapse-icon {
  transform: rotate(180deg);
}
.sidebar.collapsed .brand-collapse-btn {
  background: rgba(255,255,255,.10);
  color: rgba(255,255,255,.72);
}
@media (max-width: 1080px) {
  .brand-collapse-btn { display: none; }
}

/* ─ Workspace header — sticky topbar ─────────────────────── */
.workspace-header {
  position: relative;
  top: 0;
  z-index: 40;
  background: var(--surface);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
}

/* ─ Hero overview panel ──────────────────────────────────── */
.hero-overview-panel {
  display: grid;
  gap: 0;
  padding: 0;
  overflow: hidden;
  position: relative;
}

.hero-overview-panel::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 55% 70% at 90% 10%, rgba(160,104,38,.18), transparent),
    radial-gradient(ellipse 40% 60% at 10% 90%, rgba(100,60,10,.12), transparent);
  pointer-events: none;
}

.hero-main-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 20px;
  padding: 24px 28px 20px;
}

.hero-text { flex: 1; min-width: 0; }

.hero-revenue-strip {
  display: flex;
  align-items: center;
  gap: 0;
  padding: 14px 28px;
  border-top: 1px solid rgba(255,255,255,.10);
  background: rgba(0,0,0,.12);
  backdrop-filter: blur(8px);
  flex-wrap: wrap;
  gap: 20px;
}

.hero-rev-stat {
  display: grid;
  gap: 3px;
}

.hero-rev-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: .13em;
  color: rgba(255,255,255,.52);
  font-weight: 700;
}

.hero-rev-value {
  font-size: 18px;
  font-weight: 800;
  letter-spacing: -.01em;
  color: rgba(255,255,255,.90);
}

.hero-rev-collected { color: rgba(80,220,140,.92); }
.hero-rev-outstanding { color: rgba(255,180,60,.88); }

.hero-rev-divider {
  width: 1px;
  height: 36px;
  background: rgba(255,255,255,.14);
  flex-shrink: 0;
}

.hero-rev-meter {
  display: grid;
  gap: 6px;
  flex: 1;
  min-width: 140px;
}

.hero-rev-track {
  height: 5px;
  background: rgba(255,255,255,.14);
  border-radius: 999px;
  overflow: hidden;
}

.hero-rev-fill {
  height: 100%;
  background: linear-gradient(90deg, rgba(80,220,140,.7), rgba(80,220,140,.9));
  border-radius: inherit;
  transition: width .7s var(--ease-out);
}

.hero-rev-caption {
  font-size: 11px;
  color: rgba(255,255,255,.48);
  font-weight: 600;
  letter-spacing: .02em;
}

/* ─── Invoice Command Panel ──────────────────────────────────────────────────── */

.cmd-panel {
  position: relative;
  overflow: hidden;
  border-radius: var(--radius-xl);
  border: 1px solid rgba(255,255,255,.14);
  background: var(--hero-background);
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  isolation: isolate;
}

/* Inner top-highlight */
.cmd-panel::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 1px;
  background: linear-gradient(90deg, rgba(255,255,255,.22), rgba(255,255,255,.06) 60%, transparent);
  pointer-events: none;
  z-index: 2;
}

/* Ambient drifting orbs */
@keyframes cmdOrbDrift1 {
  0%, 100% { transform: scale(1) translate(0, 0);      opacity: .22; }
  50%       { transform: scale(1.24) translate(-22px, 16px); opacity: .32; }
}
@keyframes cmdOrbDrift2 {
  0%, 100% { transform: scale(1) translate(0, 0);      opacity: .14; }
  50%       { transform: scale(1.16) translate(20px, -14px); opacity: .22; }
}
.cmd-orb {
  position: absolute;
  border-radius: 50%;
  pointer-events: none;
  z-index: 0;
}
.cmd-orb-1 {
  width: 360px; height: 360px;
  background: radial-gradient(circle, var(--accent) 0%, transparent 65%);
  top: -120px; right: -100px;
  filter: blur(72px);
  animation: cmdOrbDrift1 9s ease-in-out infinite;
}
.cmd-orb-2 {
  width: 260px; height: 260px;
  background: radial-gradient(circle, rgba(255,255,255,.10) 0%, transparent 65%);
  bottom: -90px; left: -70px;
  filter: blur(52px);
  animation: cmdOrbDrift2 13s ease-in-out infinite;
}

/* Header row */
.cmd-header {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  padding: 22px 28px 0;
  border-bottom: 1px solid rgba(255,255,255,.07);
  padding-bottom: 14px;
}
.cmd-eyebrow-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

@keyframes cmdLivePing {
  0%, 100% { box-shadow: 0 0 0 0 rgba(80,220,140,.55); }
  60%       { box-shadow: 0 0 0 5px rgba(80,220,140,0); }
}
.cmd-live-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: rgba(80,220,140,.95);
  flex-shrink: 0;
  animation: cmdLivePing 2.2s ease-in-out infinite;
}
.cmd-eyebrow-text {
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .18em;
  color: rgba(255,255,255,.48);
}
.cmd-badge-row {
  display: flex;
  align-items: center;
  gap: 10px;
}
.cmd-status-badge {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .04em;
  padding: 3px 11px;
  border-radius: 999px;
  border: 1px solid rgba(80,220,140,.30);
  background: rgba(80,220,140,.10);
  color: rgba(80,220,140,.95);
  transition: background .35s, color .35s, border-color .35s;
}
.cmd-status-badge.warning {
  border-color: rgba(255,180,60,.38);
  background: rgba(255,180,60,.12);
  color: rgba(255,180,60,.98);
}
.cmd-status-badge.danger {
  border-color: rgba(255,90,80,.35);
  background: rgba(255,90,80,.10);
  color: rgba(255,110,100,.98);
}
.cmd-date-chip {
  font-size: 10.5px;
  font-weight: 600;
  color: rgba(255,255,255,.32);
  letter-spacing: .04em;
}

/* Main content row */
.cmd-main {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 18px;
  padding: 20px 28px 26px;
}
.cmd-headline-block { flex: 1; min-width: 0; }
.cmd-headline {
  font-size: 26px;
  font-weight: 800;
  letter-spacing: -.028em;
  color: rgba(255,255,255,.97);
  margin: 0 0 5px;
  line-height: 1.2;
}
.cmd-sub {
  font-size: 13.5px;
  color: rgba(255,255,255,.54);
  margin: 0;
  line-height: 1.6;
}
.cmd-actions-block {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  flex-shrink: 0;
}

@keyframes cmdShimmer {
  0%   { transform: translateX(-100%) skewX(-12deg); }
  100% { transform: translateX(280%)  skewX(-12deg); }
}
.cmd-primary-btn {
  position: relative;
  overflow: hidden;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 10px 20px;
  border-radius: 10px;
  font-size: 13.5px;
  font-weight: 700;
  letter-spacing: .01em;
  background: linear-gradient(135deg, rgba(160,104,38,.92), rgba(192,100,45,.88));
  border: 1px solid rgba(160,104,38,.55);
  color: rgba(255,255,255,.97);
  cursor: pointer;
  box-shadow: 0 2px 14px rgba(160,104,38,.32), inset 0 1px 0 rgba(255,255,255,.20);
  transition: transform .18s var(--ease-out), box-shadow .18s ease;
}
.cmd-primary-btn::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent 20%, rgba(255,255,255,.18) 50%, transparent 80%);
  transform: translateX(-100%) skewX(-12deg);
  animation: cmdShimmer 3.8s ease-in-out infinite;
  pointer-events: none;
}
.cmd-primary-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 24px rgba(160,104,38,.44), inset 0 1px 0 rgba(255,255,255,.24);
}
.cmd-ghost-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 17px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 600;
  background: rgba(255,255,255,.06);
  border: 1px solid rgba(255,255,255,.14);
  color: rgba(255,255,255,.72);
  cursor: pointer;
  transition: background .18s, color .18s, transform .18s;
}
.cmd-ghost-btn:hover {
  background: rgba(255,255,255,.11);
  color: rgba(255,255,255,.96);
  transform: translateY(-1px);
}

/* KPI strip */
.cmd-kpi-strip {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 24px;
  padding: 18px 28px;
  border-top: 1px solid rgba(255,255,255,.10);
  background: rgba(0,0,0,.22);
  backdrop-filter: blur(12px);
}
.cmd-kpi { display: flex; flex-direction: column; gap: 4px; }
.cmd-kpi-label {
  font-size: 9.5px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .15em;
  color: rgba(255,255,255,.40);
}
.cmd-kpi-value {
  font-size: 21px;
  font-weight: 800;
  letter-spacing: -.018em;
  color: rgba(255,255,255,.92);
  transition: color .3s;
}
.cmd-kpi-green { color: rgba(80,220,140,.95); }
.cmd-kpi-amber { color: rgba(255,180,60,.92); }
.cmd-kpi-red   { color: rgba(255,110,100,.95); }
.cmd-kpi-sep {
  width: 1px;
  height: 40px;
  background: rgba(255,255,255,.15);
  flex-shrink: 0;
}
.cmd-kpi-meter {
  flex: 1;
  min-width: 150px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.cmd-meter-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.cmd-rate-pct {
  font-size: 11.5px;
  font-weight: 800;
  color: rgba(80,220,140,.90);
  letter-spacing: .03em;
}
.cmd-meter-track {
  height: 5px;
  background: rgba(255,255,255,.12);
  border-radius: 999px;
  overflow: hidden;
}
@keyframes cmdFillPulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: .72; }
}
.cmd-meter-fill {
  height: 100%;
  background: linear-gradient(90deg, rgba(80,220,140,.68), rgba(80,220,140,.95));
  border-radius: inherit;
  transition: width .85s var(--ease-out);
  animation: cmdFillPulse 3.2s ease-in-out infinite;
}

@media (max-width: 640px) {
  .cmd-header, .cmd-main { padding-inline: 18px; }
  .cmd-kpi-strip { padding-inline: 18px; }
  .cmd-headline { font-size: 19px; }
  .cmd-kpi-sep { display: none; }
  .cmd-kpi-strip { gap: 14px; }
}

/* ─ Metric card variants ─────────────────────────────────── */
.metric-card {
  transition: transform .2s var(--ease-out), box-shadow .2s ease;
}

.metric-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

.metric-icon-wrap {
  position: absolute;
  right: 14px;
  bottom: 14px;
  width: 32px;
  height: 32px;
  opacity: .12;
}

.metric-icon-wrap svg {
  width: 100%;
  height: 100%;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.metric-paid::before { background: linear-gradient(90deg, var(--success) 0%, transparent 75%); }
.metric-paid::after  { background: radial-gradient(circle, var(--success-soft), transparent 68%); }
.metric-paid .metric-icon-wrap { color: var(--success); opacity: .22; }

.metric-pending::before { background: linear-gradient(90deg, var(--warning) 0%, transparent 75%); }
.metric-pending::after  { background: radial-gradient(circle, rgba(196,131,26,.13), transparent 68%); }
.metric-pending .metric-icon-wrap { color: var(--warning); opacity: .22; }

.metric-overdue::before { background: linear-gradient(90deg, var(--danger) 0%, transparent 75%); }
.metric-overdue::after  { background: radial-gradient(circle, var(--danger-soft), transparent 68%); }
.metric-overdue .metric-icon-wrap { color: var(--danger); opacity: .22; }

/* ─ Collection bars ─────────────────────────────────────── */
.collection-bars {
  display: grid;
  gap: 11px;
  margin: 4px 0;
}

.coll-bar-row {
  display: grid;
  grid-template-columns: 62px 1fr 36px;
  align-items: center;
  gap: 10px;
}

.coll-bar-label {
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
  text-align: right;
  white-space: nowrap;
}

.coll-bar-track {
  height: 10px;
  background: var(--surface-alt);
  border: 1px solid var(--line);
  border-radius: 999px;
  overflow: hidden;
}

.coll-bar-fill {
  height: 100%;
  border-radius: inherit;
  transition: width .65s var(--ease-out);
  min-width: 0;
}

.coll-paid    { background: linear-gradient(90deg, var(--success), color-mix(in srgb, var(--success) 80%, #fff)); }
.coll-sent    { background: linear-gradient(90deg, #2563eb, #60a5fa); }
.coll-draft   { background: linear-gradient(90deg, var(--muted), color-mix(in srgb, var(--muted) 60%, #fff)); }
.coll-overdue { background: linear-gradient(90deg, var(--danger), color-mix(in srgb, var(--danger) 80%, #f97316)); }
.coll-void    { background: linear-gradient(90deg, rgba(100,100,100,.5), rgba(140,140,140,.4)); }

.coll-bar-count {
  font-size: 13px;
  font-weight: 800;
  color: var(--text);
  text-align: right;
  line-height: 1;
}

/* ─ Recent invoice rows (clickable with status accent) ───── */
.stack-row--inv {
  cursor: pointer;
  border-left: 3px solid var(--line-strong);
  padding-left: 13px;
  transition: border-color .18s ease, transform .18s var(--ease-out), box-shadow .18s ease, background .18s ease;
  justify-content: space-between;
}

.stack-row--inv:hover {
  transform: translateX(3px);
  box-shadow: var(--shadow);
}

.stack-row--inv.tone-success { border-left-color: var(--success); }
.stack-row--inv.tone-success:hover { background: linear-gradient(180deg, rgba(255,255,255,.52), rgba(255,255,255,0)), var(--success-soft); }

.stack-row--inv.tone-danger  { border-left-color: var(--danger); }
.stack-row--inv.tone-danger:hover  { background: linear-gradient(180deg, rgba(255,255,255,.52), rgba(255,255,255,0)), var(--danger-soft); }

.stack-row--inv.tone-info    { border-left-color: #2563eb; }
.stack-row--inv.tone-info:hover    { background: linear-gradient(180deg, rgba(255,255,255,.52), rgba(255,255,255,0)), rgba(37,99,235,.07); }

.stack-row--inv.tone-warning { border-left-color: var(--warning); }
.stack-row--inv.tone-warning:hover { background: linear-gradient(180deg, rgba(255,255,255,.52), rgba(255,255,255,0)), rgba(196,131,26,.08); }

.stack-row-main  { display: grid; gap: 4px; flex: 1; min-width: 0; }
.stack-row-end   { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; flex-shrink: 0; }
.stack-row-value { font-size: 14px; font-weight: 800; color: var(--text); white-space: nowrap; }
.stack-row-open-hint {
  font-size: 11px;
  color: var(--accent);
  opacity: 0;
  transition: opacity .15s ease;
  white-space: nowrap;
}
.stack-row--inv:hover .stack-row-open-hint { opacity: 1; }

.chip-xs { font-size: 10px; padding: 2px 7px; border-radius: 999px; }

/* ─ Overview quick-action strip ─────────────────────────── */
.overview-quick-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

/* ─ Widget card hover lift ───────────────────────────────── */
.overview-widget {
  transition: box-shadow .2s ease, transform .2s var(--ease-out);
}
.overview-widget:hover {
  box-shadow: var(--shadow-lg);
}

/* ══════════════════════════════════════════════════════════════
   HEADER TOOLBAR — New Invoice button + sidebar toggle
══════════════════════════════════════════════════════════════ */

.hdr-new-invoice-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 8px 16px 8px 12px;
  border-radius: var(--radius-md, 8px);
  border: 1px solid var(--accent, #0f766e);
  background: var(--accent, #0f766e);
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: .01em;
  cursor: pointer;
  transition: background .18s ease, border-color .18s ease, transform .16s var(--ease-out, cubic-bezier(.22,.68,0,1.2)), box-shadow .16s ease;
  box-shadow: 0 2px 10px rgba(0,0,0,.18);
  white-space: nowrap;
  flex-shrink: 0;
}

.hdr-new-invoice-btn:hover:not(:disabled) {
  background: color-mix(in srgb, var(--accent, #0f766e) 85%, #000);
  border-color: color-mix(in srgb, var(--accent, #0f766e) 85%, #000);
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(0,0,0,.22);
}

.hdr-new-invoice-btn:active { transform: translateY(0); }

.hdr-new-invoice-label { font-weight: 600; }

@media (max-width: 760px) {
  .hdr-new-invoice-label { display: none; }
  .hdr-new-invoice-btn { padding: 8px 10px; }
}

.hdr-sidebar-toggle-btn {
  display: none;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: var(--radius-md, 8px);
  border: 1px solid var(--line, rgba(0,0,0,.12));
  background: var(--surface, #fff);
  color: var(--muted, #666);
  cursor: pointer;
  transition: background .18s ease, color .18s ease, border-color .18s ease;
  flex-shrink: 0;
}

@media (min-width: 1081px) {
  .hdr-sidebar-toggle-btn {
    display: inline-flex;
  }
}

.hdr-sidebar-toggle-btn:hover {
  background: var(--surface-alt);
  color: var(--text);
  border-color: var(--line-strong);
}

.workspace.sidebar-collapsed .hdr-sidebar-toggle-btn {
  background: var(--accent-soft);
  border-color: rgba(160,104,38,.30);
  color: var(--accent);
}

/* ══════════════════════════════════════════════════════════════
   HEADER — 2-row redesign
══════════════════════════════════════════════════════════════ */

.hdr-main {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 16px 24px;
}

.hdr-left {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.hdr-brand-mark {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-lg);
  background: var(--accent-soft);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent);
  flex-shrink: 0;
}

.hdr-title-block { min-width: 0; }

.hdr-eyebrow {
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: .12em;
  color: var(--muted);
  font-weight: 700;
  margin-bottom: 2px;
}

.hdr-title-block h1 {
  font-size: 20px;
  letter-spacing: -.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 340px;
}

.hdr-right {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.hdr-icon-group {
  display: flex;
  align-items: center;
  gap: 2px;
  background: var(--surface-alt);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 3px;
}

.hdr-icon-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: var(--radius-sm);
  background: transparent;
  border: none;
  color: var(--muted);
  cursor: pointer;
  transition: background .15s, color .15s;
  flex-shrink: 0;
  padding: 0;
}
.hdr-icon-btn:hover { background: var(--surface); color: var(--text); }

/* ── Draft reminder button ── */
.hdr-draft-btn {
  position: relative;
  color: var(--warning, #d07840);
}
.hdr-draft-btn:hover {
  background: rgba(208, 120, 64, .10);
  color: var(--warning, #d07840);
}
@keyframes draftPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(208,120,64,.55); }
  50%       { box-shadow: 0 0 0 5px rgba(208,120,64,.0); }
}
.hdr-draft-badge {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--warning, #d07840);
  border: 1.5px solid var(--bg, #fff);
  animation: draftPulse 1.8s ease-in-out infinite;
}

/* ── Create Invoice mode (unsaved) — download button repurposed ── */
.btn-create-mode {
  background: linear-gradient(135deg, var(--accent, #0f766e), color-mix(in srgb, var(--accent, #0f766e) 80%, #000)) !important;
  color: #fff !important;
  border-color: transparent !important;
  box-shadow: 0 2px 12px rgba(0,0,0,.18) !important;
  gap: 6px;
  display: inline-flex;
  align-items: center;
}
.btn-create-mode:hover:not(:disabled) {
  filter: brightness(1.08);
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(0,0,0,.22) !important;
}

.workspace.sidebar-collapsed #hdrSidebarToggleButton {
  background: var(--accent-soft);
  color: var(--accent);
}

.hdr-controls {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  padding: 10px 24px 16px;
  border-top: 1px solid var(--line);
}

.hdr-date-range {
  display: flex;
  align-items: center;
  gap: 8px;
}

.hdr-date-arrow {
  color: var(--muted);
  flex-shrink: 0;
}

/* ── Global header search ──────────────────────────────────── */
.hdr-search-wrap {
  position: relative;
  flex: 1;
  min-width: 220px;
  max-width: 380px;
  /* inherits compact-field grid — adds label + inner + dropdown */
}

.hdr-search-inner {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--surface-alt);
  border: 1.5px solid var(--line);
  border-radius: var(--radius-md);
  padding: 0 10px;
  height: 34px;
  transition: border-color .15s, box-shadow .15s;
}
.hdr-search-inner:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.hdr-search-icon {
  color: var(--muted);
  flex-shrink: 0;
  pointer-events: none;
}

.hdr-search-inner input {
  flex: 1;
  border: none;
  background: transparent;
  padding: 0;
  font-size: 13px;
  color: var(--text);
  outline: none;
  min-width: 0;
}
.hdr-search-inner input::placeholder { color: var(--muted); }
.hdr-search-inner input::-webkit-search-cancel-button { display: none; }

.hdr-search-clear {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--muted);
  color: var(--surface);
  border: none;
  cursor: pointer;
  padding: 0;
  flex-shrink: 0;
  opacity: .7;
  transition: opacity .12s, background .12s;
}
.hdr-search-clear:hover { opacity: 1; background: var(--text); }

.hdr-search-results {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: 0 12px 40px rgba(0,0,0,.16), 0 2px 8px rgba(0,0,0,.08);
  z-index: 300;
  max-height: 400px;
  overflow-y: auto;
  padding: 6px;
}

.hdr-search-group-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: var(--muted);
  font-weight: 700;
  padding: 8px 10px 3px;
}

.hdr-search-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background .12s;
  text-align: left;
  border: none;
  background: transparent;
  width: 100%;
  color: var(--text);
}
.hdr-search-item:hover { background: var(--surface-alt); }

.hdr-search-item-icon {
  width: 30px;
  height: 30px;
  border-radius: var(--radius-sm);
  background: var(--accent-soft);
  color: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.hdr-search-item-body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.hdr-search-item-title {
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.hdr-search-item-sub {
  font-size: 11.5px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.hdr-search-divider {
  height: 1px;
  background: var(--line);
  margin: 6px 0 2px;
}

.hdr-search-footer {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  font-size: 12px;
  color: var(--muted);
  cursor: pointer;
  border-radius: var(--radius-sm);
  border: none;
  background: transparent;
  width: 100%;
  text-align: left;
  transition: background .12s, color .12s;
}
.hdr-search-footer:hover { background: var(--surface-alt); color: var(--accent); }

.hdr-search-empty,
.hdr-search-spinner {
  padding: 20px 12px;
  text-align: center;
  color: var(--muted);
  font-size: 13px;
}

@media (max-width: 760px) {
  .hdr-main { padding: 12px 16px; gap: 10px; }
  .hdr-controls { padding: 8px 16px 12px; gap: 8px; }
  .hdr-title-block h1 { font-size: 17px; max-width: 180px; }
  .hdr-brand-mark { width: 30px; height: 30px; }
  .hdr-search-wrap { min-width: 160px; max-width: 100%; }
}

/* ══════════════════════════════════════════════════════════════
   SIDEBAR COLLAPSE — immersive icon-pill mode
══════════════════════════════════════════════════════════════ */

/* Collapse toggle button — desktop only */
.sidebar-collapse-btn { display: none; }
@media (min-width: 1081px) {
  .sidebar-collapse-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 9px 14px;
    border-radius: var(--radius-md, 8px);
    border: 1px solid rgba(255,255,255,.10);
    background: rgba(255,255,255,.05);
    color: rgba(255,255,255,.55);
    font-size: 12.5px;
    font-weight: 500;
    cursor: pointer;
    transition: background .18s ease, color .18s ease, border-color .18s ease;
  }
  .sidebar-collapse-btn:hover {
    background: rgba(255,255,255,.10);
    color: rgba(255,255,255,.85);
    border-color: rgba(255,255,255,.18);
  }
}

.sidebar-collapse-icon {
  flex-shrink: 0;
  transition: transform .28s var(--ease-out, cubic-bezier(.22,.68,0,1.2));
}

/* Collapsed workspace grid */
@media (min-width: 1081px) {
  .workspace.sidebar-collapsed {
    grid-template-columns: 64px minmax(0, 1fr);
    transition: grid-template-columns .28s var(--ease-out, cubic-bezier(.22,.68,0,1.2));
  }
}

/* ── Collapsed sidebar ─────────────────────────────────────── */
.sidebar.collapsed {
  padding: 22px 8px;
  overflow: visible;
}

/* Hide text content */
.sidebar.collapsed .brand-copy,
.sidebar.collapsed .sidebar-brand-note,
.sidebar.collapsed .sidebar-heading,
.sidebar.collapsed #sidebarUserSummary,
.sidebar.collapsed .sidebar-session-meta,
.sidebar.collapsed .premium-badge,
.sidebar.collapsed .sidebar-collapse-label,
.sidebar.collapsed .sidebar-text,
.sidebar.collapsed .session-info { display: none; }

.sidebar.collapsed .brand-lockup { justify-content: center; gap: 0; }

/* Brand mark → same 44×44 size and radius as nav pills */
.sidebar.collapsed .brand-mark {
  width: 44px;
  height: 44px;
  min-width: 44px;
  font-size: 15px;
  border-radius: 12px;
}

/* Hide collapse chevron when collapsed — hdr-sidebar-toggle handles expand */
.sidebar.collapsed .brand-collapse-btn { display: none; }

/* Nav buttons → 44×44 centered icon pills */
.sidebar.collapsed .nav-btn {
  justify-content: center;
  gap: 0;
  padding: 0;
  width: 44px;
  height: 44px;
  min-width: 44px;
  border-radius: 12px;
  margin-inline: auto;
  overflow: visible;
  transform: none;
}
.sidebar.collapsed .nav-btn:hover:not(:disabled) { transform: translateY(-1px); }
.sidebar.collapsed .nav-btn-text { display: none; }

/* Kill shimmer and free ::before/::after for tooltips */
.sidebar.collapsed .nav-btn::before { content: none; animation: none; }
.sidebar.collapsed .nav-btn::after  { content: none; }

/* Active pill — amber glow */
.sidebar.collapsed .nav-btn.active {
  background: linear-gradient(135deg, rgba(160,104,38,.36), rgba(160,104,38,.18));
  border-color: rgba(160,104,38,.45);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,.14),
    0 0 0 1px rgba(160,104,38,.38),
    0 6px 20px rgba(160,104,38,.26);
}
.sidebar.collapsed .nav-btn.active .nav-btn-icon {
  background: rgba(160,104,38,.30);
  border-color: rgba(160,104,38,.50);
}
.sidebar.collapsed .nav-btn.active .nav-btn-icon svg {
  opacity: 1;
  filter: drop-shadow(0 0 5px rgba(255,180,60,.55));
}

/* Featured pill glow */
.sidebar.collapsed .nav-btn-featured {
  background: linear-gradient(135deg, rgba(255,255,255,.22), rgba(255,255,255,.09));
  border-color: rgba(255,255,255,.22);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,.20),
    0 0 0 1px rgba(255,255,255,.18),
    0 4px 18px rgba(255,255,255,.09);
}

/* Icon sizing bump */
.sidebar.collapsed .nav-btn-icon { width: 30px; height: 30px; }

.sidebar.collapsed .sidebar-collapse-icon { transform: rotate(180deg); }

.sidebar.collapsed .sidebar-collapse-btn {
  justify-content: center;
  padding: 9px 10px;
}

.sidebar.collapsed #logoutButton {
  justify-content: center;
  font-size: 0;
  padding: 10px;
  gap: 0;
  overflow: visible;
}

/* Avatar alone in collapsed card */
.sidebar.collapsed .sidebar-session-card {
  flex-direction: column;
  align-items: center;
  padding: 8px 6px;
  gap: 0;
}

/* ── Tooltips — arrow + label ──────────────────────────────── */
.sidebar.collapsed .nav-btn[data-tooltip],
.sidebar.collapsed #logoutButton[data-tooltip] { position: relative; }

/* Arrow triangle */
.sidebar.collapsed .nav-btn[data-tooltip]::before,
.sidebar.collapsed #logoutButton[data-tooltip]::before {
  content: "";
  position: absolute;
  left: calc(100% + 7px);
  top: 50%;
  transform: translateY(-50%);
  width: 0;
  height: 0;
  border-top: 5px solid transparent;
  border-bottom: 5px solid transparent;
  border-right: 6px solid rgba(14,14,20,.96);
  pointer-events: none;
  opacity: 0;
  transition: opacity .15s ease;
  z-index: 201;
}

/* Tooltip text box */
.sidebar.collapsed .nav-btn[data-tooltip]::after,
.sidebar.collapsed #logoutButton[data-tooltip]::after {
  content: attr(data-tooltip);
  position: absolute;
  left: calc(100% + 13px);
  top: 50%;
  transform: translateY(-50%);
  background: rgba(14,14,20,.96);
  color: rgba(255,255,255,.92);
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
  padding: 5px 11px;
  border-radius: 7px;
  pointer-events: none;
  opacity: 0;
  transition: opacity .15s ease;
  z-index: 200;
  border: 1px solid rgba(255,255,255,.10);
  box-shadow: 0 4px 18px rgba(0,0,0,.40);
}

.sidebar.collapsed .nav-btn[data-tooltip]:hover::before,
.sidebar.collapsed .nav-btn[data-tooltip]:hover::after,
.sidebar.collapsed #logoutButton[data-tooltip]:hover::before,
.sidebar.collapsed #logoutButton[data-tooltip]:hover::after { opacity: 1; }

/* ══════════════════════════════════════════════════════════════
   BOOT LOADER — immersive full-screen
══════════════════════════════════════════════════════════════ */
.boot-loader {
  position: fixed;
  inset: 0;
  z-index: 10001;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(155deg, #140801 0%, #3a200a 45%, #1e0e04 100%);
  overflow: hidden;
  transition: opacity .45s var(--ease-out), transform .45s var(--ease-out);
}
.boot-loader.fade-out {
  opacity: 0;
  pointer-events: none;
}

/* Background orbs */
.boot-orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(70px);
  pointer-events: none;
}
.boot-orb-1 {
  width: 480px; height: 480px;
  background: radial-gradient(circle, rgba(160,104,38,.25) 0%, transparent 70%);
  top: -120px; left: -100px;
  animation: orbDrift1 8s ease-in-out infinite alternate;
}
.boot-orb-2 {
  width: 340px; height: 340px;
  background: radial-gradient(circle, rgba(192,70,59,.14) 0%, transparent 70%);
  bottom: -80px; right: -60px;
  animation: orbDrift2 11s ease-in-out infinite alternate;
}
.boot-orb-3 {
  width: 220px; height: 220px;
  background: radial-gradient(circle, rgba(160,104,38,.12) 0%, transparent 70%);
  top: 40%; left: 60%;
  animation: orbDrift3 14s ease-in-out infinite alternate;
}
@keyframes orbDrift1 { from { transform: translate(0,0) scale(1); } to { transform: translate(60px,40px) scale(1.08); } }
@keyframes orbDrift2 { from { transform: translate(0,0); } to { transform: translate(-40px,-30px) scale(1.1); } }
@keyframes orbDrift3 { from { transform: translate(0,0); } to { transform: translate(-50px,30px); } }

/* Main content column */
.boot-content {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 28px;
  width: min(380px, 90vw);
}

/* Logo orbit */
.boot-logo-wrap {
  position: relative;
  width: 100px;
  height: 100px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.boot-orbit-ring {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 1.5px solid rgba(160,104,38,.3);
  animation: bootOrbitSpin 3s linear infinite;
}
.boot-orbit-ring::before {
  content: '';
  position: absolute;
  inset: -1px;
  border-radius: 50%;
  border: 1.5px solid transparent;
  border-top-color: var(--accent);
  border-right-color: rgba(160,104,38,.4);
}
.boot-orbit-dot {
  position: absolute;
  width: 8px;
  height: 8px;
  background: var(--accent);
  border-radius: 50%;
  top: -4px;
  left: calc(50% - 4px);
  box-shadow: 0 0 8px 3px rgba(160,104,38,.6);
  transform-origin: 50% 54px;
  animation: bootOrbitSpin 3s linear infinite;
}
@keyframes bootOrbitSpin {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}
.boot-logo-icon {
  width: 72px;
  height: 72px;
  border-radius: var(--radius-xl);
  background: linear-gradient(135deg, rgba(160,104,38,.22) 0%, rgba(160,104,38,.08) 100%);
  border: 1.5px solid rgba(160,104,38,.35);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 28px rgba(160,104,38,.18), inset 0 1px 0 rgba(255,255,255,.06);
  animation: bootLogoPulse 2.5s ease-in-out infinite;
}
@keyframes bootLogoPulse {
  0%, 100% { box-shadow: 0 0 28px rgba(160,104,38,.18), inset 0 1px 0 rgba(255,255,255,.06); }
  50%       { box-shadow: 0 0 48px rgba(160,104,38,.36), inset 0 1px 0 rgba(255,255,255,.08); }
}
.boot-logo-icon svg { width: 40px; height: 40px; }

/* Brand */
.boot-brand { text-align: center; }
.boot-brand-name {
  font-size: 22px;
  font-weight: 800;
  color: rgba(255,255,255,.92);
  letter-spacing: -.02em;
}
.boot-brand-tag {
  font-size: 12px;
  color: var(--accent);
  font-weight: 600;
  letter-spacing: .06em;
  margin-top: 3px;
}

/* Step list */
.boot-steps {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 100%;
}
.boot-step {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-radius: var(--radius);
  background: rgba(255,255,255,.04);
  border: 1px solid rgba(255,255,255,.06);
  opacity: .35;
  transition: all .4s var(--ease-out);
}
.boot-step.active {
  opacity: 1;
  background: rgba(160,104,38,.10);
  border-color: rgba(160,104,38,.22);
}
.boot-step.done {
  opacity: .7;
  background: rgba(160,104,38,.06);
  border-color: rgba(160,104,38,.14);
}
.boot-step-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: rgba(255,255,255,.2);
  flex-shrink: 0;
  transition: all .4s;
}
.boot-step.active .boot-step-dot {
  background: var(--accent);
  box-shadow: 0 0 8px rgba(160,104,38,.7);
  animation: livePulse 1.5s ease-in-out infinite;
}
.boot-step.done .boot-step-dot {
  background: var(--accent);
  box-shadow: none;
  animation: none;
}
.boot-step-label {
  font-size: 13px;
  font-weight: 600;
  color: rgba(255,255,255,.75);
}
.boot-step.active .boot-step-label { color: rgba(255,255,255,.95); }

/* Progress track */
.boot-progress-track {
  width: 100%;
  height: 3px;
  background: rgba(255,255,255,.08);
  border-radius: 999px;
  overflow: hidden;
}
.boot-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), #e0a050);
  border-radius: inherit;
  width: 0%;
  transition: width .55s var(--ease-out);
  box-shadow: 0 0 8px rgba(160,104,38,.5);
}

/* Status text */
.boot-loader-text {
  font-size: 12px;
  color: rgba(255,255,255,.38);
  font-weight: 500;
  text-align: center;
  transition: opacity .3s;
}

@keyframes livePulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%       { opacity: .5; transform: scale(1.35); }
}

/* Mobile usability layer */
@media (max-width: 820px) {
  html { scroll-padding-top: 76px; }
  body { overflow-x: hidden; }

  .app-shell {
    padding: 0;
  }

  .login-view {
    min-height: 100svh;
    grid-template-columns: 1fr;
  }

  .login-panel {
    min-height: 100svh;
    padding: max(18px, env(safe-area-inset-top)) 16px max(18px, env(safe-area-inset-bottom));
    justify-content: center;
  }

  .login-panel h1 {
    font-size: clamp(28px, 9vw, 42px);
    line-height: 1.04;
  }

  .login-art,
  .api-config-card {
    display: none;
  }

  .workspace {
    display: block;
    min-height: 100svh;
  }

  .sidebar {
    position: sticky;
    top: 0;
    z-index: 30;
    max-height: none;
    padding: 10px 10px 8px;
    border-radius: 0;
  }

  .sidebar-top {
    gap: 8px;
  }

  .brand-lockup {
    min-height: 44px;
  }

  .brand-copy h2,
  .premium-badge,
  .brand-collapse-btn,
  .sidebar-foot,
  .nav-btn-text small {
    display: none !important;
  }

  .brand-mark {
    width: 38px;
    height: 38px;
    min-width: 38px;
  }

  .sidebar-nav {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding: 2px 2px 6px;
    scroll-snap-type: x proximity;
    -webkit-overflow-scrolling: touch;
  }

  .sidebar-nav::-webkit-scrollbar {
    display: none;
  }

  .nav-btn {
    flex: 0 0 auto;
    min-width: 76px;
    min-height: 44px;
    padding: 8px 10px;
    justify-content: center;
    scroll-snap-align: start;
  }

  .nav-btn-icon {
    width: 24px;
    height: 24px;
  }

  .nav-btn-text {
    display: block;
  }

  .nav-label {
    font-size: 12px;
    white-space: nowrap;
  }

  .workspace-main {
    min-width: 0;
  }

  .workspace-header {
    position: relative;
    top: 0;
    z-index: 20;
    padding: 12px;
    border-radius: 0;
    margin: 0;
  }

  .workspace-header-main,
  .workspace-header-top,
  .workspace-actions,
  .hdr-filter-group,
  .hdr-search-wrap {
    width: 100%;
  }

  .workspace-header-main,
  .workspace-header-top {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .workspace-title-block h1 {
    font-size: 22px;
    line-height: 1.12;
  }

  .workspace-copy {
    display: none;
  }

  .workspace-actions,
  .hdr-filter-group {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    padding-left: 0;
    border-left: 0;
  }

  .hdr-search-wrap,
  .hdr-new-invoice-btn {
    grid-column: 1 / -1;
  }

  .compact-field {
    min-width: 0;
  }

  .compact-field input,
  .compact-field select,
  .hdr-search-wrap input,
  .field input,
  .field select,
  .field textarea {
    min-height: 44px;
    font-size: 16px;
  }

  .page-section {
    padding: 12px;
  }

  .hero-panel {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
    padding: 16px;
    border-radius: var(--radius-md);
  }

  .hero-panel h3 {
    font-size: 22px;
    line-height: 1.15;
  }

  .hero-actions,
  .modal-actions,
  .wizard-actions,
  .pager-row,
  .pager-actions,
  .toolbar-row,
  .invoice-filter-row {
    display: grid;
    grid-template-columns: 1fr;
    width: 100%;
    gap: 8px;
  }

  .hero-actions > *,
  .modal-actions > *,
  .wizard-actions > *,
  .pager-actions > *,
  .toolbar-row > *,
  .invoice-filter-row > * {
    width: 100%;
  }

  .metrics-grid,
  .widget-grid,
  .form-grid,
  .settings-grid,
  .split-shell,
  .invoice-review-shell,
  .review-grid,
  .detail-stat-grid,
  .collection-grid,
  .template-choice-grid,
  .theme-grid,
  .wizard-split,
  .compact-summary-grid,
  .stamp-upload-grid,
  .stamp-preview-grid {
    grid-template-columns: 1fr !important;
  }

  .panel-card,
  .metric-card,
  .widget-card,
  .summary-card,
  .native-preview-card,
  .invoice-workspace-card {
    padding: 14px;
    border-radius: var(--radius-md);
  }

  .table-wrap {
    overflow: visible;
    border: 0;
    background: transparent;
    box-shadow: none;
  }

  .data-table,
  .data-table tbody,
  .data-table tr,
  .data-table td {
    display: block;
    width: 100%;
    min-width: 0 !important;
  }

  .data-table thead {
    display: none;
  }

  .data-table tr {
    margin-bottom: 10px;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: var(--radius-md);
    background: var(--surface);
    box-shadow: var(--shadow-sm);
  }

  .data-table td {
    display: grid;
    grid-template-columns: minmax(92px, 38%) 1fr;
    gap: 10px;
    align-items: start;
    padding: 8px 0;
    border: 0;
    overflow-wrap: anywhere;
  }

  .data-table td::before {
    content: "Detail";
    color: var(--muted);
    font-size: 11px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: .08em;
  }

  #invoiceTableBody td:nth-child(1)::before { content: "Invoice"; }
  #invoiceTableBody td:nth-child(2)::before { content: "Customer"; }
  #invoiceTableBody td:nth-child(3)::before { content: "Creator"; }
  #invoiceTableBody td:nth-child(4)::before { content: "Status"; }
  #invoiceTableBody td:nth-child(5)::before { content: "Total"; }
  #invoiceTableBody td:nth-child(6)::before { content: "Actions"; }

  #customerTableBody td:nth-child(1)::before { content: "Customer"; }
  #customerTableBody td:nth-child(2)::before { content: "Mobile"; }
  #customerTableBody td:nth-child(3)::before { content: "Email"; }
  #customerTableBody td:nth-child(4)::before { content: "Actions"; }

  #productTableBody td:nth-child(1)::before { content: "Product"; }
  #productTableBody td:nth-child(2)::before { content: "Pricing"; }
  #productTableBody td:nth-child(3)::before { content: "Stock"; }
  #productTableBody td:nth-child(4)::before { content: "Actions"; }

  .data-table td:last-child {
    grid-template-columns: 1fr;
  }

  .data-table td:last-child::before {
    margin-bottom: 4px;
  }

  .data-table td:last-child button,
  .data-table td:last-child a,
  .table-action-btn,
  .mini-action-btn {
    width: 100%;
    min-height: 40px;
    margin-top: 6px;
  }

  .wizard-progress {
    display: flex;
    overflow-x: auto;
    gap: 8px;
    padding-bottom: 6px;
    scroll-snap-type: x proximity;
    -webkit-overflow-scrolling: touch;
  }

  .wizard-step {
    flex: 0 0 164px;
    min-height: 58px;
    scroll-snap-align: start;
  }

  .wizard-step-copy small {
    display: none;
  }

  .invoice-workspace-hero {
    position: relative;
    top: 0;
    z-index: 18;
  }

  .invoice-review-shell {
    gap: 12px;
  }

  .invoice-preview-toolbar {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .native-preview-card {
    overflow: hidden;
  }

  .native-invoice-preview {
    padding: 0;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .native-invoice-sheet {
    min-width: 0;
    width: 100%;
    padding: 14px;
    box-shadow: none;
  }

  .native-line-table {
    min-width: 0;
    font-size: 12px;
  }

  .native-line-table th,
  .native-line-table td {
    padding: 7px 5px;
  }

  .dynamic-item,
  .dynamic-row,
  .payment-detail-row,
  .charge-row {
    padding: 12px;
  }

  .dynamic-item-grid,
  .payment-detail-grid {
    grid-template-columns: 1fr !important;
  }

  .invoice-customer-search-row,
  .input-action-row {
    grid-template-columns: 1fr;
  }

  .input-action-btn {
    width: 100%;
  }

  .modal-dialog {
    width: calc(100vw - 20px);
    max-height: calc(100svh - 20px);
    padding: 14px;
    border-radius: var(--radius-md);
  }

  .offline-panel,
  .two-factor-settings-card {
    padding: 14px;
  }

  .floating-theme-dock {
    right: 12px;
    bottom: calc(12px + env(safe-area-inset-bottom));
  }
}

@media (max-width: 460px) {
  .workspace-actions,
  .hdr-filter-group {
    grid-template-columns: 1fr;
  }

  .page-section {
    padding: 10px;
  }

  .workspace-header {
    top: 0;
  }

  .invoice-workspace-hero {
    top: 0;
  }

  .data-table td {
    grid-template-columns: 1fr;
  }

  .data-table td::before {
    margin-bottom: -4px;
  }

  .metric-card strong,
  .mini-stat-card strong {
    font-size: 22px;
  }

  .summary-row {
    gap: 8px;
    align-items: start;
  }
}

/* ═══════════════════════════════════════════ OFFLINE LOGO BADGE ═ */

.offline-logo-badge {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  background: rgba(196, 131, 26, .10);
  border: 1px solid rgba(196, 131, 26, .30);
  border-radius: 8px;
  margin-top: 8px;
  color: var(--warning);
  font-size: 12px;
}

.offline-logo-badge > svg {
  flex-shrink: 0;
}

.olb-info {
  flex: 1;
  min-width: 0;
}

.olb-title {
  font-weight: 700;
  font-size: 12px;
  color: var(--warning);
}

.olb-meta {
  font-size: 11px;
  color: var(--muted);
  margin-top: 1px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.olb-clear-btn {
  flex-shrink: 0;
  background: transparent;
  border: 1px solid rgba(196, 131, 26, .40);
  color: var(--warning);
  border-radius: 5px;
  padding: 4px 10px;
  font: 600 11px/1 "Ubuntu", sans-serif;
  cursor: pointer;
  white-space: nowrap;
  transition: background .15s, color .15s;
}

.olb-clear-btn:hover {
  background: rgba(196, 131, 26, .15);
  color: var(--text);
}

/* ═══════════════════════════════════════════════ PWA UPDATE BANNER ═ */

.sw-update-banner {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 9990;
  background: linear-gradient(90deg, #0e4e3e 0%, #12312f 60%, #0e3845 100%);
  border-bottom: 1px solid rgba(255, 255, 255, .08);
  box-shadow: 0 4px 20px rgba(0, 0, 0, .35);
  animation: sw-drop .35s cubic-bezier(.22,1,.36,1) both;
}

@keyframes sw-drop {
  from { transform: translateY(-100%); opacity: 0; }
  to   { transform: translateY(0);     opacity: 1; }
}

.sw-update-inner {
  display: flex;
  align-items: center;
  gap: 12px;
  max-width: 960px;
  margin: 0 auto;
  padding: 9px 20px;
}

.sw-update-inner > svg {
  flex-shrink: 0;
  color: #4ade80;
}

.sw-update-inner > span {
  flex: 1;
  font-size: 13px;
  color: rgba(255, 255, 255, .80);
}

.sw-update-btn {
  padding: 6px 18px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 6px;
  font: 600 12px/1 "Ubuntu", sans-serif;
  cursor: pointer;
  white-space: nowrap;
  transition: opacity .15s;
}

.sw-update-btn:hover { opacity: .84; }

.sw-update-dismiss {
  background: transparent;
  border: 1px solid rgba(255, 255, 255, .22);
  color: rgba(255, 255, 255, .55);
  border-radius: 6px;
  padding: 5px 12px;
  font: 12px/1 "Ubuntu", sans-serif;
  cursor: pointer;
  white-space: nowrap;
  transition: border-color .15s, color .15s;
}

.sw-update-dismiss:hover {
  border-color: rgba(255, 255, 255, .45);
  color: rgba(255, 255, 255, .85);
}

/* ═══════════════════════════════════════════ ITEM IMPORT MODAL ═ */

.modal-dialog--lg { max-width: 680px; }

/* Section head multiple action buttons */
.section-head-btns {
  display: flex;
  align-items: center;
  gap: 6px;
}

.ghost-btn--icon {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

/* Step bar */
.iim-step-bar {
  display: flex;
  align-items: center;
  gap: 0;
  padding: 14px 24px;
  border-bottom: 1px solid var(--line);
  background: var(--surface-alt);
}

.iim-step {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  white-space: nowrap;
  transition: color .2s;
}

.iim-step span {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--line-strong);
  color: var(--muted);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  transition: background .2s, color .2s;
}

.iim-step--active {
  color: var(--accent);
}

.iim-step--active span {
  background: var(--accent);
  color: #fff;
}

.iim-step--done {
  color: var(--success);
}

.iim-step--done span {
  background: var(--success);
  color: #fff;
}

.iim-step-line {
  flex: 1;
  height: 1px;
  background: var(--line);
  min-width: 20px;
  margin: 0 10px;
}

/* Upload step */
.iim-upload {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.iim-drop-zone {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 52px 24px;
  border: 2px dashed var(--line-strong);
  border-radius: 12px;
  background: var(--surface-alt);
  cursor: pointer;
  transition: border-color .2s, background .2s, box-shadow .2s;
  text-align: center;
  color: var(--muted);
  user-select: none;
}

.iim-drop-zone:hover,
.iim-drop-zone--over {
  border-color: var(--accent);
  background: var(--accent-soft);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.iim-drop-zone svg {
  color: var(--accent);
  opacity: .65;
  transition: opacity .2s, transform .2s;
}

.iim-drop-zone:hover svg,
.iim-drop-zone--over svg {
  opacity: 1;
  transform: translateY(-3px);
}

.iim-drop-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
}

.iim-drop-sub {
  font-size: 13px;
  color: var(--muted);
}

.iim-drop-link {
  color: var(--accent);
  text-decoration: underline;
  cursor: pointer;
}

.iim-drop-formats {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .09em;
  text-transform: uppercase;
  color: var(--muted);
  margin-top: 6px;
  opacity: .7;
}

.iim-hint {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.65;
  padding: 10px 14px;
  background: var(--surface-alt);
  border-radius: 8px;
  border-left: 3px solid var(--accent-soft);
}

.iim-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  padding: 52px 24px;
  color: var(--muted);
  font-size: 13px;
}

.iim-error-zone {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 36px 24px;
  text-align: center;
}

/* Mapping step */
.iim-map-wrap {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.iim-step-hint {
  font-size: 13px;
  color: var(--muted);
  margin: 0;
  line-height: 1.5;
}

.iim-map-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.iim-map-table th {
  text-align: left;
  padding: 8px 14px;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: .07em;
  text-transform: uppercase;
  color: var(--muted);
  border-bottom: 1px solid var(--line);
  background: var(--surface-alt);
}

.iim-map-row {
  border-bottom: 1px solid var(--line);
  transition: background .15s;
}

.iim-map-row:last-child { border-bottom: none; }

.iim-map-row:hover { background: var(--surface-alt); }

.iim-map-row td {
  padding: 11px 14px;
  vertical-align: middle;
}

.iim-col-name {
  font-weight: 600;
  color: var(--text);
  font-size: 13px;
}

.iim-col-preview {
  font-size: 11px;
  color: var(--muted);
  margin-top: 3px;
  max-width: 240px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-style: italic;
}

.iim-field-select {
  width: 100%;
  padding: 7px 10px;
  border: 1px solid var(--line-strong);
  border-radius: 7px;
  background: var(--surface);
  color: var(--text);
  font: 13px "Ubuntu", sans-serif;
  cursor: pointer;
  transition: border-color .15s, box-shadow .15s;
}

.iim-field-select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-soft);
}

.iim-map-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 4px;
  border-top: 1px solid var(--line);
}

/* Preview step */
.iim-preview-wrap {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.iim-preview-count {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  font-weight: 700;
  color: var(--success);
  padding: 11px 16px;
  background: var(--success-soft);
  border-radius: 8px;
  border: 1px solid rgba(25, 122, 90, .15);
}

.iim-preview-scroll {
  max-height: 290px;
  overflow-y: auto;
  border: 1px solid var(--line);
  border-radius: 10px;
}

.iim-preview-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.iim-preview-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--surface-alt);
  padding: 9px 14px;
  text-align: left;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: .07em;
  text-transform: uppercase;
  color: var(--muted);
  border-bottom: 1px solid var(--line);
}

.iim-preview-table td {
  padding: 9px 14px;
  border-bottom: 1px solid var(--line);
  color: var(--text);
}

.iim-preview-table tbody tr:last-child td { border-bottom: none; }

.iim-preview-table tbody tr:hover td { background: var(--surface-alt); }

.iim-preview-more td {
  color: var(--muted) !important;
  font-style: italic;
  text-align: center;
  font-size: 12px;
}

.iim-warn {
  font-size: 12px;
  color: var(--warning);
  padding: 8px 12px;
  background: rgba(196, 131, 26, .08);
  border-radius: 6px;
  border-left: 3px solid var(--warning);
}

/* ─── Users / Team Management ────────────────────────────────── */

.member-list {
  display: grid;
  gap: 10px;
  padding: 14px;
}

.member-card {
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--surface);
  border: 1.5px solid var(--line);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  transition: border-color .18s;
}

.member-card:hover {
  border-color: var(--line-strong);
}

.member-card--revoked {
  opacity: .65;
  background: var(--surface-alt);
}

.member-avatar {
  flex: 0 0 40px;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--accent-strong));
  color: #fffdf8;
  font-weight: 700;
  font-size: 17px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.member-info {
  flex: 1;
  min-width: 0;
  display: grid;
  gap: 5px;
}

.member-name-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.member-name {
  font-size: 15px;
  color: var(--text);
}

.member-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 12px;
  font-size: 12px;
  color: var(--muted);
}

.member-actions {
  display: flex;
  gap: 7px;
  flex-shrink: 0;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.ghost-btn--sm,
.danger-btn--sm {
  padding: 6px 12px;
  font-size: 12px;
  border-radius: var(--radius-sm);
}

/* Role badges */
.role-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 9px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
  white-space: nowrap;
}

.role-badge--owner   { background: rgba(124, 58, 237, .13); color: #6d28d9; }
.role-badge--manager { background: rgba(37, 99, 235, .13);  color: #1d4ed8; }
.role-badge--cashier { background: rgba(5, 150, 105, .13);  color: #047857; }
.role-badge--driver  { background: rgba(234, 88, 12, .13);  color: #c2410c; }
.role-badge--staff   { background: rgba(100, 116, 139, .13); color: #475569; }
.role-badge--viewer  { background: rgba(80, 60, 30, .10);   color: var(--muted); }

/* Member status badges */
.member-status-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 9px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .03em;
  white-space: nowrap;
}

.member-status-badge--active  { background: var(--success-soft); color: var(--success); }
.member-status-badge--revoked { background: var(--danger-soft);  color: var(--danger); }

.member-owner-tag {
  display: inline-flex;
  align-items: center;
  padding: 2px 9px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .04em;
  background: rgba(124, 58, 237, .1);
  color: #6d28d9;
}

.panel-head-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.search-input {
  padding: 8px 12px;
  border: 1.5px solid var(--line-strong);
  border-radius: var(--radius-md);
  background: var(--surface);
  color: var(--text);
  font-size: 13px;
  min-width: 220px;
  outline: none;
}
.search-input:focus {
  border-color: var(--accent);
}

@media (max-width: 640px) {
  .member-card { flex-wrap: wrap; }
  .member-actions { width: 100%; justify-content: flex-start; }
  .search-input { min-width: 140px; width: 100%; }
  .panel-head-actions { flex-wrap: wrap; width: 100%; }
}

/* ══════════════════════════════════════════════════════════════
   MOBILE BOTTOM NAVIGATION & RESPONSIVE POLISH
   ══════════════════════════════════════════════════════════════ */

/* Hide mobile elements on desktop by default */
.mobile-logout-btn {
  display: none !important;
}
.mobile-bottom-nav {
  display: none !important;
}

@media (max-width: 760px) {
  /* Hide desktop sidebar */
  .sidebar {
    display: none !important;
  }
  
  /* Hide desktop sidebar collapse toggle in header */
  #hdrSidebarToggleButton {
    display: none !important;
  }
  
  /* Add bottom padding to prevent navigation bar overlap */
  .workspace-main {
    padding-bottom: 90px !important;
  }

  /* Make workspace header part of the regular scroll on mobile */
  .workspace-header {
    position: relative !important;
    top: 0 !important;
    margin-bottom: 15px !important;
    background: var(--surface) !important;
  }
  
  /* Show mobile logout button */
  .mobile-logout-btn {
    display: inline-flex !important;
  }
  
  /* ──────────────────────────────────────────────────────────────
     Mobile bottom navigation — theme-aware · immersive · v2
     Background, border, text and active accent all pull from the
     active theme's --sidebar-* and --accent variables.
     ────────────────────────────────────────────────────────────── */

  @keyframes bnavPipIn   { from{opacity:0;transform:scaleX(0)} to{opacity:1;transform:scaleX(1)} }
  @keyframes bnavBounce  { 0%{transform:scale(1.18) translateY(-3px)} 60%{transform:scale(1.24) translateY(-4px)} 100%{transform:scale(1.18) translateY(-2px)} }
  @keyframes bnavRipple  { to{transform:scale(4);opacity:0} }

  .mobile-bottom-nav {
    display: flex !important;
    position: fixed;
    bottom: 0; left: 0; right: 0;
    height: 72px;
    z-index: 999;
    align-items: center;
    justify-content: space-around;

    /* Uses each theme's sidebar gradient — fully theme-aware */
    background: var(--sidebar-background);
    backdrop-filter: blur(28px) saturate(1.6);
    -webkit-backdrop-filter: blur(28px) saturate(1.6);

    /* Theme-aware border + immersive inset highlight */
    box-shadow:
      0 -1px 0 var(--sidebar-link-border),
      0 -8px 36px rgba(0, 0, 0, 0.52),
      inset 0 1px 0 rgba(255, 255, 255, 0.05);

    /* Safe area for iPhones with home bar */
    padding: 0 8px;
    padding-bottom: env(safe-area-inset-bottom, 0px);
  }

  /* Each regular nav tab */
  .mobile-bottom-nav .nav-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    background: transparent;
    border: none;
    color: var(--sidebar-link-text);
    font-size: 9px;
    font-weight: 700;
    letter-spacing: .55px;
    text-transform: uppercase;
    cursor: pointer;
    flex: 1;
    min-width: 0;
    height: 100%;
    padding: 6px 4px 8px;
    border-radius: 10px;
    margin: 0 2px;
    position: relative;
    overflow: hidden;
    opacity: 0.70;
    transition:
      color .2s ease,
      opacity .2s ease,
      background .2s ease,
      transform .2s cubic-bezier(.34,1.56,.64,1);
  }

  .mobile-bottom-nav .nav-btn:hover {
    opacity: 1;
    color: var(--sidebar-text);
    transform: translateY(-1px);
  }

  /* Icon wrapper */
  .mobile-bottom-nav .nav-btn .nav-btn-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    flex-shrink: 0;
    transition: transform .22s cubic-bezier(.34,1.56,.64,1), filter .2s ease;
  }

  .mobile-bottom-nav .nav-btn .nav-btn-icon svg {
    width: 22px;
    height: 22px;
    stroke-width: 1.9;
    display: block;
    transition: inherit;
  }

  /* Label */
  .mobile-bottom-nav .nav-btn .nav-btn-text {
    font-size: 9px;
    font-weight: 700;
    letter-spacing: .5px;
    text-transform: uppercase;
    line-height: 1;
    opacity: .72;
    transition: opacity .2s ease, color .2s ease;
  }

  /* ── Active state ──────────────────────────────── */
  .mobile-bottom-nav .nav-btn.active {
    color: var(--sidebar-text) !important;
    opacity: 1;
    background: var(--sidebar-link-bg);
    transform: none;
  }

  /* Animated glowing pip bar above active icon */
  .mobile-bottom-nav .nav-btn.active::before {
    content: '';
    position: absolute;
    top: 0;
    left: 18%; right: 18%;
    height: 2.5px;
    border-radius: 0 0 4px 4px;
    background: linear-gradient(90deg, transparent, var(--accent), transparent);
    box-shadow: 0 0 8px var(--accent), 0 0 16px var(--accent-soft);
    animation: bnavPipIn .28s var(--ease-spring, cubic-bezier(.34,1.56,.64,1)) both;
  }

  /* Icon lift + accent glow when active */
  .mobile-bottom-nav .nav-btn.active .nav-btn-icon {
    transform: scale(1.18) translateY(-2px);
    filter: drop-shadow(0 2px 7px var(--accent));
    animation: bnavBounce .55s var(--ease-spring, cubic-bezier(.34,1.56,.64,1)) both;
  }

  .mobile-bottom-nav .nav-btn.active .nav-btn-icon svg {
    stroke-width: 2.2;
  }

  /* Accent-colored label when active */
  .mobile-bottom-nav .nav-btn.active .nav-btn-text {
    color: var(--accent);
    opacity: 1;
  }

  /* ── Featured center button — New Invoice ────── */
  .mobile-bottom-nav .nav-btn-featured {
    /* Float above the bar */
    position: relative;
    top: -15px;

    /* Fixed size circle */
    flex: 0 0 58px !important;
    width: 58px !important;
    height: 58px !important;
    padding: 0 !important;
    border-radius: 50% !important;
    border: none !important;
    opacity: 1 !important;
    gap: 0 !important;

    /* Theme-aware accent gradient */
    background: linear-gradient(135deg, var(--accent) 0%, var(--accent-strong) 100%) !important;
    color: #fff !important;

    display: flex !important;
    align-items: center !important;
    justify-content: center !important;

    /* Floating ring that uses sidebar bg — seamlessly "floats through" the bar */
    box-shadow:
      0 0 0 3.5px var(--sidebar-background),
      0 6px 22px rgba(0, 0, 0, 0.48),
      0 2px 8px var(--accent-soft);

    transition:
      transform .22s cubic-bezier(.34,1.56,.64,1),
      box-shadow .22s ease !important;
  }

  .mobile-bottom-nav .nav-btn-featured:hover {
    transform: scale(1.10) translateY(-5px) !important;
    box-shadow:
      0 0 0 3.5px var(--sidebar-background),
      0 12px 32px rgba(0, 0, 0, 0.52),
      0 4px 16px var(--accent-soft) !important;
  }

  .mobile-bottom-nav .nav-btn-featured:active {
    transform: scale(.93) !important;
  }

  .mobile-bottom-nav .nav-btn-featured .nav-btn-icon {
    width: 28px;
    height: 28px;
    transform: none !important;
    filter: none !important;
    animation: none !important;
    transition: none !important;
  }

  .mobile-bottom-nav .nav-btn-featured .nav-btn-icon svg {
    width: 26px;
    height: 26px;
    stroke-width: 2.5;
    stroke: #fff;
    transition: none;
  }

  /* Hide label and active pip on the featured button */
  .mobile-bottom-nav .nav-btn-featured .nav-btn-text { display: none !important; }
  .mobile-bottom-nav .nav-btn-featured::before { display: none !important; }

  /* Tap ripple dots (added via JS) */
  .mobile-bottom-nav .bnav-tap-ripple {
    position: absolute;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.18);
    transform: scale(0);
    pointer-events: none;
    animation: bnavRipple .52s cubic-bezier(.22,.68,0,1) forwards;
  }
  
  /* Header adjustments for smaller screens */
  .hdr-main {
    flex-wrap: nowrap;
    justify-content: space-between;
    gap: 8px;
  }
  
  .hdr-right {
    gap: 8px;
  }

  .hdr-theme-wrap {
    display: none !important;
  }

  /* Make sure data tables are scrollable */
  .table-wrap {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  
  /* Adjust toolbar rows */
  .toolbar-row {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
  }

  /* Date range input controls on mobile header */
  .hdr-controls {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
    padding: 12px 0;
  }
  
  .hdr-date-range {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    width: 100%;
    align-items: center;
  }
  
  .hdr-search-wrap {
    width: 100%;
  }

  /* Wizard progress scrollable on mobile */
  .wizard-progress, .settings-wizard-progress {
    display: flex;
    overflow-x: auto;
    padding-bottom: 8px;
    -webkit-overflow-scrolling: touch;
    gap: 12px;
  }
  
  .wizard-step {
    flex-shrink: 0;
    min-width: 120px;
  }
  
  /* Workspace hero buttons stack */
  .hero-panel {
    flex-direction: column;
    align-items: stretch;
    gap: 16px;
  }
  
  .hero-actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
    width: 100%;
  }
  
  .hero-actions .primary-btn, .hero-actions .ghost-btn {
    width: 100%;
  }
}

/* ── Clickable metric card pointers ──────────────────────────── */
.metric-card {
  cursor: pointer;
}

/* ── Global Loader Overlay ────────────────────────────────────── */
.loader-overlay {
  position: fixed;
  inset: 0;
  z-index: 10002;
  background: rgba(15, 23, 42, 0.42);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 1;
  transition: opacity 0.3s ease;
}
.loader-overlay.hidden {
  display: none !important;
  opacity: 0;
  pointer-events: none;
}
.loader-card {
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(16px);
  padding: 24px 36px;
  border-radius: 16px;
  box-shadow: var(--shadow-2xl);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  border: 1px solid rgba(255, 255, 255, 0.3);
  max-width: 90%;
  width: 280px;
  text-align: center;
}
:root[data-theme="glass"] .loader-card {
  background: rgba(230, 245, 242, 0.85);
}
:root[data-theme="fire"] .loader-card {
  background: rgba(255, 248, 242, 0.85);
}
:root[data-theme="ice"] .loader-card {
  background: rgba(245, 252, 255, 0.85);
}
.loader-spinner {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 3px solid var(--accent-soft);
  border-right-color: var(--accent);
  animation: spin 0.85s linear infinite;
}
.loader-card span {
  font-weight: 500;
  color: var(--title);
  font-size: 15px;
  letter-spacing: -0.01em;
}

/* ─── Language selector — login panel ────────────────────────── */
.lp-top-meta {
  display: flex;
  justify-content: flex-end;
  margin: 0 0 22px;
}

.lp-lang-field {
  display: grid;
  gap: 5px;
  min-width: 140px;
}

.lp-lang-field > span {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--muted);
}

.lp-lang-field select {
  width: 100%;
  height: 38px;
  padding: 0 10px;
  border-radius: 8px;
  border: 1px solid var(--line-strong);
  background: var(--surface-alt);
  color: var(--text);
  font-size: 13px;
  outline: none;
  cursor: pointer;
}

.lp-lang-field select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

/* ─── Language selector — workspace header ───────────────────── */
.compact-field--language {
  flex-shrink: 0;
}

.permission-fieldset {
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 16px 18px 18px;
  background: color-mix(in srgb, var(--surface) 86%, white 14%);
}

.permission-fieldset legend {
  padding: 0 8px;
  font-size: 11px;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--muted);
}

.permission-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px 14px;
}

.permission-grid label {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  padding: 10px 12px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: color-mix(in srgb, var(--surface-alt) 84%, white 16%);
}

.permission-grid input[type="checkbox"] {
  margin: 0;
}

.tax-item-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
  padding: 8px 10px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: color-mix(in srgb, var(--surface-alt) 88%, white 12%);
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}

.tax-item-toggle input[type="checkbox"] {
  margin: 0;
}

.hdr-notification-wrap {
  position: relative;
}

.hdr-notification-btn {
  overflow: visible;
}

.hdr-notification-badge {
  position: absolute;
  top: -5px;
  right: -4px;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #f97316, #ef4444);
  color: #fff;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .02em;
  box-shadow: 0 10px 22px rgba(239, 68, 68, .28);
}

.hdr-notification-panel {
  position: absolute;
  top: calc(100% + 12px);
  right: 0;
  width: min(380px, calc(100vw - 32px));
  max-height: min(70vh, 560px);
  display: grid;
  grid-template-rows: auto 1fr;
  overflow: hidden;
  border-radius: 22px;
  border: 1px solid rgba(148, 163, 184, .18);
  background:
    radial-gradient(circle at top right, rgba(15, 118, 110, .14), transparent 34%),
    linear-gradient(180deg, rgba(255,255,255,.96), rgba(245,248,251,.96));
  box-shadow: 0 28px 80px rgba(15, 23, 42, .24);
  backdrop-filter: blur(22px);
  z-index: 50;
}

.hdr-notification-head {
  display: flex;
  justify-content: space-between;
  align-items: start;
  gap: 12px;
  padding: 16px 18px 14px;
  border-bottom: 1px solid var(--line);
}

.hdr-notification-head strong {
  display: block;
  font-size: 15px;
  color: var(--title);
}

.hdr-notification-head small {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}

.hdr-notification-list {
  display: grid;
  gap: 10px;
  padding: 12px;
  overflow: auto;
}

.hdr-notification-empty {
  display: grid;
  gap: 6px;
  padding: 24px 18px;
  text-align: center;
  color: var(--muted);
}

.hdr-notification-item {
  display: grid;
  gap: 10px;
  padding: 14px 14px 13px;
  border-radius: 18px;
  border: 1px solid rgba(148, 163, 184, .16);
  background: rgba(255, 255, 255, .78);
}

.hdr-notification-item.unread {
  border-color: rgba(15, 118, 110, .22);
  background: linear-gradient(180deg, rgba(240, 253, 250, .94), rgba(255,255,255,.94));
}

.hdr-notification-item-head,
.hdr-notification-item-foot {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
}

.hdr-notification-item-head time,
.hdr-notification-item-foot span {
  color: var(--muted);
  font-size: 11px;
}

.hdr-notification-item strong {
  color: var(--title);
  font-size: 14px;
}

.hdr-notification-item p {
  margin: 0;
  color: var(--text-soft);
  font-size: 13px;
  line-height: 1.55;
}

.hdr-notification-level {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 22px;
  padding: 0 9px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .08em;
  background: rgba(148, 163, 184, .14);
  color: var(--muted);
}

.hdr-notification-level--success {
  background: rgba(34, 197, 94, .12);
  color: #15803d;
}

.hdr-notification-level--warning,
.hdr-notification-level--danger {
  background: rgba(249, 115, 22, .14);
  color: #c2410c;
}

.invoice-items-deck {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.invoice-items-stat {
  display: grid;
  gap: 6px;
  padding: 14px 16px;
  border-radius: 18px;
  border: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(255,255,255,.7), rgba(248,250,252,.92));
}

.invoice-items-stat span {
  color: var(--muted);
  font-size: 11px;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.invoice-items-stat strong {
  color: var(--title);
  font-size: 14px;
}

.invoice-items-stat--soft {
  background: linear-gradient(135deg, rgba(15, 118, 110, .08), rgba(255,255,255,.94));
}

.invoice-line-card {
  gap: 14px;
  padding: 16px;
  border-radius: 22px;
  background:
    radial-gradient(circle at top right, rgba(15, 118, 110, .08), transparent 30%),
    linear-gradient(180deg, rgba(255,255,255,.84), rgba(247,250,252,.96));
  box-shadow: 0 18px 48px rgba(15, 23, 42, .06);
}

.invoice-line-card-head {
  display: flex;
  justify-content: space-between;
  align-items: start;
  gap: 16px;
}

.invoice-line-card-copy {
  display: grid;
  gap: 5px;
  min-width: 0;
}

.invoice-line-index {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  min-height: 24px;
  padding: 0 10px;
  border-radius: 999px;
  background: rgba(15, 118, 110, .08);
  color: var(--accent);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.invoice-line-card-copy strong {
  color: var(--title);
  font-size: 16px;
  line-height: 1.25;
}

.invoice-line-card-copy small,
.invoice-line-metrics span {
  color: var(--muted);
  font-size: 12px;
}

.invoice-line-total {
  display: grid;
  gap: 4px;
  min-width: 118px;
  padding: 12px 14px;
  border-radius: 16px;
  background: rgba(15, 23, 42, .035);
  text-align: right;
}

.invoice-line-total span {
  color: var(--muted);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: .08em;
}

.invoice-line-total strong {
  color: var(--title);
  font-size: 15px;
}

.invoice-line-card-grid {
  display: grid;
  grid-template-columns: 1.05fr 1.6fr .8fr .8fr;
  gap: 12px;
  align-items: start;
}

.invoice-line-description {
  grid-column: auto;
}

.invoice-line-card-foot {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 14px;
  flex-wrap: wrap;
}

.invoice-line-metrics {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.invoice-line-metrics strong {
  color: var(--title);
  font-size: 12px;
}

.tax-item-toggle {
  min-width: 240px;
  flex: 1 1 260px;
}

@media (max-width: 960px) {
  .hdr-notification-panel {
    right: -56px;
  }

  .invoice-items-deck,
  .invoice-line-card-grid {
    grid-template-columns: 1fr;
  }

  .invoice-line-card-head,
  .invoice-line-card-foot {
    grid-template-columns: 1fr;
    display: grid;
  }

  .invoice-line-total {
    text-align: left;
    min-width: 0;
  }
}

@media (max-width: 640px) {
  .hdr-notification-panel {
    position: fixed;
    top: 76px;
    right: 16px;
    left: 16px;
    width: auto;
    max-height: calc(100dvh - 120px);
  }

  .credits-threshold-row {
    flex-direction: column;
    align-items: flex-start;
  }

  .credits-threshold-label {
    min-width: 0;
  }

  .credits-modal-inner {
    width: calc(100vw - 20px);
    margin-top: 16px;
    border-radius: var(--radius-md);
  }
}
