/* ==========================================================================
   Devjix Clients — UI
   Brand: blue #0550c4 → green #5fb515 (from the Devjix D)
   ========================================================================== */
:root {
  --blue: #0550c4; --blue-2: #1a6cf0; --green: #5fb515; --green-2: #7ad12c;
  --brand-rgb: 5 80 196;
  --grad: linear-gradient(135deg, #0550c4 0%, #1a6cf0 45%, #5fb515 100%);
  --grad-soft: linear-gradient(135deg, rgb(5 80 196 / .1), rgb(95 181 21 / .1));
  --page: #f2f5fa; --surface: #ffffff; --surface-2: #f7f9fc; --line: #e3e8f0; --line-2: #d3dae6;
  --text: #0e1730; --text-2: #3d4a63; --muted: #6b7890;
  --ok: #16a34a; --ok-bg: #e7f7ed; --warn: #c27803; --warn-bg: #fff4dc; --bad: #dc2626; --bad-bg: #fde8e8;
  --info: #0550c4; --info-bg: #e6efff; --gray-bg: #eef1f6;
  --shadow: 0 1px 2px rgb(14 23 48 / .05), 0 8px 24px -12px rgb(14 23 48 / .14);
  --shadow-lg: 0 24px 48px -20px rgb(14 23 48 / .35);
  --r: 18px; --r-sm: 12px;
  --ease-spring: cubic-bezier(.34, 1.56, .64, 1);
  --side: 268px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --page: #080d1a; --surface: #111a2e; --surface-2: #0d1526; --line: #1f2a42; --line-2: #2a3754;
    --text: #e6ecf7; --text-2: #b4c0d6; --muted: #8291ab;
    --ok-bg: rgb(22 163 74 / .16); --warn-bg: rgb(234 179 8 / .14); --bad-bg: rgb(220 38 38 / .16); --info-bg: rgb(26 108 240 / .18); --gray-bg: #1a2439;
    --ok: #4ade80; --warn: #facc15; --bad: #f87171; --info: #6ea8ff;
    --shadow: 0 1px 2px rgb(0 0 0 / .3), 0 10px 30px -14px rgb(0 0 0 / .6);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --page: #080d1a; --surface: #111a2e; --surface-2: #0d1526; --line: #1f2a42; --line-2: #2a3754;
  --text: #e6ecf7; --text-2: #b4c0d6; --muted: #8291ab;
  --ok-bg: rgb(22 163 74 / .16); --warn-bg: rgb(234 179 8 / .14); --bad-bg: rgb(220 38 38 / .16); --info-bg: rgb(26 108 240 / .18); --gray-bg: #1a2439;
  --ok: #4ade80; --warn: #facc15; --bad: #f87171; --info: #6ea8ff;
  --shadow: 0 1px 2px rgb(0 0 0 / .3), 0 10px 30px -14px rgb(0 0 0 / .6);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; min-height: 100vh; background: var(--page); color: var(--text); font: 400 14px/1.5 Poppins, system-ui, -apple-system, "Segoe UI", sans-serif; -webkit-font-smoothing: antialiased; overflow-x: hidden; }
a { color: inherit; text-decoration: none; }
img { max-width: 100%; }
h1, h2, h3, h4 { margin: 0; line-height: 1.25; font-weight: 700; }
p { margin: 0; }
.i { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; vertical-align: middle; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.mono { font-family: ui-monospace, "Cascadia Code", Consolas, monospace; font-size: 13px; }
.nowrap { white-space: nowrap; }
.right { text-align: right; }
.hide { display: none !important; }
.grad-text { background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
::selection { background: rgb(var(--brand-rgb) / .2); }

/* ---------------------------------------------------------------- layout */
.app { display: grid; grid-template-columns: var(--side) minmax(0, 1fr); min-height: 100vh; }
.side { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; padding: 18px 14px; background: var(--surface); border-right: 1px solid var(--line); overflow-y: auto; }
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 18px; }
.brand .d3 { width: 52px; height: 52px; flex: none; }
.brand b { display: block; font-size: 19px; font-weight: 800; letter-spacing: .5px; }
.brand small { display: block; font-size: 10.5px; font-weight: 600; letter-spacing: 1.6px; text-transform: uppercase; color: var(--green); }
.nav-sec { font-size: 10.5px; font-weight: 700; letter-spacing: 1.4px; text-transform: uppercase; color: var(--muted); padding: 14px 12px 6px; }
.nav a { display: flex; align-items: center; gap: 12px; padding: 10px 12px; margin: 2px 0; border-radius: 12px; color: var(--text-2); font-weight: 500; transition: background .2s, color .2s; position: relative; }
.nav a:hover { background: var(--surface-2); color: var(--text); }
.nav a.on { background: var(--grad-soft); color: var(--blue); font-weight: 600; }
:root[data-theme="dark"] .nav a.on { color: #8fbaff; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .nav a.on { color: #8fbaff; } }
.nav a.on::before { content: ""; position: absolute; left: -14px; top: 9px; bottom: 9px; width: 4px; border-radius: 0 4px 4px 0; background: var(--grad); }
.nav .count { margin-left: auto; font-size: 11px; font-weight: 600; background: var(--gray-bg); color: var(--muted); padding: 1px 8px; border-radius: 20px; }
.side-foot { margin-top: auto; padding-top: 14px; }
.user-card { display: flex; align-items: center; gap: 10px; padding: 10px; border-radius: 14px; background: var(--surface-2); border: 1px solid var(--line); }
.user-card .who { min-width: 0; flex: 1; } .user-card .who b { display: block; font-size: 13px; } .user-card .who small { display: block; color: var(--muted); font-size: 11.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar { position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 12px; padding: 14px 28px; background: color-mix(in srgb, var(--page) 82%, transparent); backdrop-filter: saturate(1.6) blur(14px); -webkit-backdrop-filter: saturate(1.6) blur(14px); border-bottom: 1px solid transparent; }
.topbar.scrolled { border-bottom-color: var(--line); }
.topbar .mlogo { display: none; }
.topbar h1 { font-size: 21px; font-weight: 700; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.topbar .crumb { font-size: 12px; color: var(--muted); display: block; font-weight: 500; }
.topbar .grow { flex: 1; min-width: 0; }
.top-search { position: relative; width: min(320px, 32vw); }
.top-search input { width: 100%; height: 40px; padding: 0 14px 0 38px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); color: var(--text); font: inherit; }
.top-search .i { position: absolute; left: 12px; top: 11px; color: var(--muted); }
.icon-btn { width: 40px; height: 40px; display: inline-grid; place-items: center; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); color: var(--text-2); cursor: pointer; flex: none; transition: transform .15s, background .2s; }
.icon-btn:hover { background: var(--surface-2); color: var(--text); }
.icon-btn:active { transform: scale(.92); }
.content { padding: 8px 28px 48px; width: 100%; max-width: 1400px; }

/* ---------------------------------------------------------------- cards / grid */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow); }
.card-h { display: flex; align-items: center; gap: 10px; padding: 16px 18px; border-bottom: 1px solid var(--line); }
.card-h h3 { font-size: 15px; font-weight: 700; }
.card-h .grow { flex: 1; }
.card-b { padding: 18px; }
.grid { display: grid; gap: 16px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.g-main { grid-template-columns: minmax(0, 1.65fr) minmax(0, 1fr); }
.stack > * + * { margin-top: 16px; }
.row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.mb { margin-bottom: 16px; } .mt { margin-top: 16px; }

/* stat tiles */
.stat { position: relative; overflow: hidden; padding: 18px; }
.stat .lbl { font-size: 12.5px; color: var(--muted); font-weight: 500; display: flex; align-items: center; gap: 8px; }
.stat .val { font-size: 26px; font-weight: 800; margin-top: 6px; letter-spacing: -.5px; }
.stat .sub { font-size: 12px; color: var(--muted); margin-top: 2px; }
.stat .ic { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; color: #fff; background: var(--grad); box-shadow: 0 8px 16px -8px rgb(var(--brand-rgb) / .7); }
.stat.hero { background: var(--grad); color: #fff; border: 0; }
.stat.hero .lbl, .stat.hero .sub { color: rgb(255 255 255 / .85); }
.stat.hero .ic { background: rgb(255 255 255 / .2); box-shadow: none; }
.stat.hero::after { content: ""; position: absolute; right: -40px; bottom: -60px; width: 180px; height: 180px; border-radius: 50%; border: 28px solid rgb(255 255 255 / .1); }

/* bars chart */
.bars { display: flex; align-items: flex-end; gap: 10px; height: 150px; padding-top: 10px; }
.bars .b { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; height: 100%; justify-content: flex-end; }
.bars .b i { display: block; width: 100%; max-width: 38px; border-radius: 8px 8px 4px 4px; background: var(--grad); min-height: 4px; transform-origin: bottom; animation: grow .9s var(--ease-spring) both; }
.bars .b small { font-size: 11px; color: var(--muted); }
.bars .b em { font-style: normal; font-size: 10.5px; color: var(--text-2); font-weight: 600; white-space: nowrap; }
@keyframes grow { from { transform: scaleY(0); } }

/* ---------------------------------------------------------------- buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 40px; padding: 0 16px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); color: var(--text); font: 600 13.5px Poppins, system-ui, sans-serif; cursor: pointer; white-space: nowrap; transition: transform .15s, box-shadow .2s, background .2s; }
.btn:hover { background: var(--surface-2); }
.btn:active { transform: scale(.96); }
.btn.primary { background: var(--grad); color: #fff; border: 0; box-shadow: 0 10px 20px -10px rgb(var(--brand-rgb) / .8); }
.btn.primary:hover { box-shadow: 0 14px 26px -10px rgb(var(--brand-rgb) / .9); filter: brightness(1.05); }
.btn.green { background: var(--green); color: #fff; border: 0; }
.btn.danger { color: var(--bad); }
.btn.danger:hover { background: var(--bad-bg); }
.btn.ghost { background: transparent; border-color: transparent; }
.btn.sm { height: 32px; padding: 0 12px; font-size: 12.5px; border-radius: 10px; }
.btn.block { width: 100%; }
.btn .i { width: 17px; height: 17px; }

/* ---------------------------------------------------------------- badges / chips */
.badge { display: inline-flex; align-items: center; gap: 5px; padding: 3px 10px; border-radius: 30px; font-size: 11.5px; font-weight: 600; white-space: nowrap; background: var(--gray-bg); color: var(--text-2); }
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .8; }
.b-paid, .b-active, .b-completed, .b-ok { background: var(--ok-bg); color: var(--ok); }
.b-sent, .b-in_progress, .b-review, .b-devjix { background: var(--info-bg); color: var(--info); }
.b-partial, .b-pending, .b-lead, .b-soon, .b-on_hold, .b-maintenance { background: var(--warn-bg); color: var(--warn); }
.b-overdue, .b-expired, .b-cancelled { background: var(--bad-bg); color: var(--bad); }
.b-draft, .b-inactive, .b-none { background: var(--gray-bg); color: var(--muted); }
.tag { display: inline-flex; align-items: center; gap: 6px; padding: 2px 9px; border-radius: 8px; font-size: 11.5px; font-weight: 600; border: 1px solid var(--line); color: var(--text-2); background: var(--surface-2); }
.tag .dot { width: 8px; height: 8px; border-radius: 50%; }

.chips { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
.chips::-webkit-scrollbar { display: none; }
.chip { flex: none; display: inline-flex; align-items: center; gap: 7px; height: 34px; padding: 0 14px; border-radius: 30px; border: 1px solid var(--line); background: var(--surface); color: var(--text-2); font-weight: 500; font-size: 13px; transition: all .2s; }
.chip:hover { border-color: var(--line-2); color: var(--text); }
.chip.on { background: var(--text); color: var(--surface); border-color: var(--text); }
.chip .n { font-size: 11px; opacity: .7; }

/* ---------------------------------------------------------------- avatar */
.av { --h: 210; width: 42px; height: 42px; flex: none; border-radius: 13px; display: grid; place-items: center; font-weight: 700; font-size: 14px; color: #fff; background: linear-gradient(135deg, hsl(var(--h) 75% 50%), hsl(calc(var(--h) + 50) 70% 45%)); box-shadow: inset 0 0 0 1px rgb(255 255 255 / .15); }
.av.logo { background: #fff; padding: 4px; box-shadow: inset 0 0 0 1px var(--line); }
.av.logo img { width: 100%; height: 100%; object-fit: contain; display: block; }
.logo-pick { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.logo-pick .prev { width: 72px; height: 72px; border-radius: 18px; border: 2px dashed var(--line-2); display: grid; place-items: center; background: #fff; overflow: hidden; flex: none; color: var(--muted); }
.logo-pick .prev img { width: 100%; height: 100%; object-fit: contain; }
.av.lg { width: 64px; height: 64px; border-radius: 20px; font-size: 22px; }
.av.sm { width: 34px; height: 34px; border-radius: 10px; font-size: 12px; }

/* ---------------------------------------------------------------- lists / tables */
.list { list-style: none; margin: 0; padding: 0; }
.li { display: flex; align-items: center; gap: 12px; padding: 12px 18px; border-bottom: 1px solid var(--line); transition: background .15s; }
.li:last-child { border-bottom: 0; }
a.li:hover { background: var(--surface-2); }
.li .main-t { flex: 1; min-width: 0; }
.li .main-t b { display: block; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.li .main-t small { display: block; color: var(--muted); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.li .end { text-align: right; flex: none; }
.li .end b { display: block; font-weight: 700; }

.table-wrap { overflow-x: auto; }
table.t { width: 100%; border-collapse: collapse; }
.t th { text-align: left; font-size: 11.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .6px; color: var(--muted); padding: 12px 16px; border-bottom: 1px solid var(--line); background: var(--surface-2); white-space: nowrap; }
.t td { padding: 13px 16px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.t tr:last-child td { border-bottom: 0; }
.t tbody tr { transition: background .15s; }
.t tbody tr:hover { background: var(--surface-2); }
.t tr[data-href] { cursor: pointer; }
.t .cl { display: flex; align-items: center; gap: 10px; min-width: 0; }
.t .cl b { display: block; font-weight: 600; } .t .cl small { color: var(--muted); font-size: 12px; }

.empty { text-align: center; padding: 48px 20px; color: var(--muted); }
.empty .i { width: 42px; height: 42px; stroke-width: 1.5; color: var(--line-2); margin-bottom: 8px; }
.empty b { display: block; color: var(--text); font-size: 15px; margin-bottom: 4px; }

/* client cards */
.client-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }
.ccard { padding: 18px; display: flex; flex-direction: column; gap: 14px; transition: transform .25s var(--ease-spring), box-shadow .25s; }
.ccard:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); }
.ccard .top { display: flex; gap: 12px; align-items: center; }
.ccard .top .nm { min-width: 0; flex: 1; }
.ccard .top b { display: block; font-size: 15px; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ccard .top small { display: block; color: var(--muted); font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ccard .meta { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; text-align: center; padding: 10px 6px; border-radius: 12px; background: var(--surface-2); }
.ccard .meta b { display: block; font-size: 15px; } .ccard .meta small { font-size: 10.5px; color: var(--muted); }
.ccard .contact { display: flex; flex-direction: column; gap: 4px; font-size: 12.5px; color: var(--text-2); }
.ccard .contact span { display: flex; align-items: center; gap: 8px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.ccard .contact .i { width: 14px; height: 14px; color: var(--muted); }

/* client hero */
.chero { padding: 22px; display: flex; gap: 18px; align-items: center; flex-wrap: wrap; position: relative; overflow: hidden; }
.chero::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 4px; background: var(--grad); }
.chero .info { flex: 1; min-width: 220px; }
.chero h2 { font-size: 22px; font-weight: 800; }
.chero .links { display: flex; flex-wrap: wrap; gap: 6px 16px; margin-top: 8px; color: var(--text-2); font-size: 13px; }
.chero .links a, .chero .links span { display: inline-flex; align-items: center; gap: 6px; }
.chero .links .i { width: 15px; height: 15px; color: var(--muted); }
.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); border-top: 1px solid var(--line); }
.kpis > div { padding: 14px 18px; border-right: 1px solid var(--line); }
.kpis > div:last-child { border-right: 0; }
.kpis small { color: var(--muted); font-size: 12px; } .kpis b { display: block; font-size: 18px; font-weight: 700; }

/* tabs */
.tabs { display: flex; gap: 4px; padding: 4px; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; overflow-x: auto; scrollbar-width: none; margin-bottom: 16px; }
.tabs::-webkit-scrollbar { display: none; }
.tabs a { flex: none; display: inline-flex; align-items: center; gap: 8px; padding: 8px 14px; border-radius: 10px; font-weight: 500; color: var(--text-2); font-size: 13.5px; transition: all .2s; }
.tabs a .n { font-size: 11px; background: var(--gray-bg); padding: 0 7px; border-radius: 10px; color: var(--muted); }
.tabs a.on { background: var(--grad); color: #fff; box-shadow: 0 8px 16px -10px rgb(var(--brand-rgb) / .9); }
.tabs a.on .n { background: rgb(255 255 255 / .22); color: #fff; }

/* progress */
.prog { height: 7px; border-radius: 10px; background: var(--gray-bg); overflow: hidden; }
.prog i { display: block; height: 100%; border-radius: 10px; background: var(--grad); }

/* timeline (work log) */
.tl { position: relative; padding-left: 26px; }
.tl::before { content: ""; position: absolute; left: 8px; top: 6px; bottom: 6px; width: 2px; background: var(--line); }
.tl .ev { position: relative; padding: 0 0 18px; }
.tl .ev::before { content: ""; position: absolute; left: -23px; top: 5px; width: 12px; height: 12px; border-radius: 50%; background: var(--grad); box-shadow: 0 0 0 4px var(--surface); }
.tl .ev b { font-weight: 600; } .tl .ev p { color: var(--text-2); font-size: 13px; margin-top: 3px; white-space: pre-line; }

/* service cards */
.svc { padding: 16px 18px; display: flex; flex-direction: column; gap: 10px; }
.svc .h { display: flex; align-items: flex-start; gap: 10px; }
.svc .h .t { flex: 1; min-width: 0; } .svc .h b { display: block; font-weight: 700; font-size: 15px; }
.svc p { color: var(--text-2); font-size: 13px; white-space: pre-line; }
.svc .f { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12.5px; color: var(--muted); }
.svc .f span { display: inline-flex; align-items: center; gap: 5px; } .svc .f .i { width: 14px; height: 14px; }

/* vault */
.cred { display: flex; flex-direction: column; gap: 10px; padding: 16px; }
.cred .h { display: flex; align-items: center; gap: 12px; }
.cred .h .ic { width: 38px; height: 38px; border-radius: 11px; display: grid; place-items: center; background: var(--info-bg); color: var(--info); flex: none; }
.cred .h .t { flex: 1; min-width: 0; } .cred .h b { display: block; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; } .cred .h small { color: var(--muted); font-size: 12px; }
.secret { display: flex; align-items: center; gap: 6px; padding: 7px 7px 7px 12px; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--line); min-width: 0; }
.secret label { font-size: 11px; color: var(--muted); width: 92px; flex: none; font-weight: 600; text-transform: uppercase; letter-spacing: .4px; }
.secret .v { flex: 1; min-width: 0; font-family: ui-monospace, Consolas, monospace; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.secret .v.masked { letter-spacing: 2px; color: var(--muted); }
.secret button { width: 30px; height: 30px; border: 0; border-radius: 8px; background: transparent; color: var(--muted); display: grid; place-items: center; cursor: pointer; flex: none; }
.secret button:hover { background: var(--surface); color: var(--text); }
.secret button .i { width: 16px; height: 16px; }
.vault-banner { display: flex; gap: 12px; align-items: center; padding: 14px 16px; border-radius: 14px; background: var(--grad-soft); border: 1px solid var(--line); font-size: 13px; color: var(--text-2); }
.vault-banner .i { color: var(--green); width: 22px; height: 22px; }

/* settings: invoice design picker */
.tpl-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px; }
.tpl { position: relative; display: flex; flex-direction: column; gap: 4px; padding: 10px; border: 2px solid var(--line); border-radius: 16px; background: var(--surface); cursor: pointer; transition: border-color .2s, transform .2s var(--ease-spring), box-shadow .2s; }
.tpl:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.tpl input { position: absolute; opacity: 0; pointer-events: none; }
.tpl.on, .tpl:has(input:checked) { border-color: var(--blue-2); box-shadow: 0 0 0 4px rgb(var(--brand-rgb) / .14); }
.tpl:has(input:checked)::after { content: "✓"; position: absolute; top: 8px; right: 8px; width: 22px; height: 22px; border-radius: 50%; background: var(--blue-2); color: #fff; font-size: 12px; font-weight: 800; display: grid; place-items: center; }
.tpl b { font-size: 13px; margin-top: 4px; } .tpl small { font-size: 11px; color: var(--muted); line-height: 1.35; }
.tpl-prev { display: flex; flex-direction: column; gap: 5px; height: 150px; padding: 0 0 0; border-radius: 10px; background: #fff; border: 1px solid #e6ebf2; overflow: hidden; }
.tpl-prev i { display: block; }
.tp-head { position: relative; display: flex; align-items: center; height: 30px; padding: 0 9px; border-bottom: 2px solid var(--p); overflow: hidden; }
.tp-logo { position: relative; z-index: 1; width: 30px; height: 8px; border-radius: 3px; background: linear-gradient(90deg, var(--p2), var(--a)); }
.tp-co { position: absolute; right: 0; bottom: 0; width: 48%; height: 18px; background: var(--p); clip-path: polygon(18% 0, 100% 0, 100% 100%, 0 100%); }
.tp-co::before { content: ""; position: absolute; }
.tp-head::after { content: ""; position: absolute; right: 0; top: 0; width: 24%; height: 12px; background: var(--a); clip-path: polygon(30% 0, 100% 0, 100% 100%, 0 100%); }
.tp-title { display: flex; align-items: center; gap: 5px; padding: 2px 9px; }
.tp-title i { width: 34px; height: 10px; border-radius: 2px 5px 5px 2px; border-left: 3px solid var(--a); background: color-mix(in srgb, var(--p) 12%, #fff); }
.tp-title::after { content: ""; flex: 1; height: 1px; background: #e2e8f0; }
.tp-row { display: flex; gap: 5px; padding: 0 9px; }
.tp-bill { flex: 1.6; height: 22px; border: 1px solid #dbe3ee; border-radius: 4px; }
.tp-due { flex: 1; height: 22px; border-radius: 4px; background: var(--p); border-left: 3px solid var(--a); }
.tp-table { display: flex; flex-direction: column; gap: 3px; padding: 0 9px; }
.tp-table i { height: 6px; border-radius: 2px; background: var(--s); }
.th-filled .tp-th { height: 8px; background: var(--p); }
.th-line .tp-th { height: 6px; background: transparent; border-bottom: 2px solid var(--p); border-radius: 0; }
.tp-foot { position: relative; margin-top: auto; height: 12px; border-top: 2px solid var(--p); }
.tp-foot::before { content: ""; position: absolute; left: 0; top: 0; width: 64%; height: 10px; background: var(--p); clip-path: polygon(0 0, 100% 0, calc(100% - 6px) 100%, 0 100%); }
.tp-foot::after { content: ""; position: absolute; left: 0; bottom: 0; width: 70%; height: 2px; background: var(--a); }

/* settings: automation */
.auto-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.auto-col { padding: 14px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface-2); display: flex; flex-direction: column; gap: 10px; }
.auto-col h4 { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.switch { display: flex; align-items: center; gap: 10px; cursor: pointer; font-size: 13px; font-weight: 500; }
.switch input { position: absolute; opacity: 0; pointer-events: none; }
.switch span { position: relative; width: 40px; height: 22px; flex: none; border-radius: 22px; background: var(--line-2); transition: background .2s; }
.switch span::after { content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgb(0 0 0 / .25); transition: transform .25s var(--ease-spring); }
.switch input:checked + span { background: var(--green); }
.switch input:checked + span::after { transform: translateX(18px); }
.switch input:focus-visible + span { outline: 3px solid rgb(var(--brand-rgb) / .3); }
.wa-box { display: flex; gap: 18px; align-items: center; margin-top: 10px; padding: 14px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface-2); }
.wa-qr { width: 180px; height: 180px; flex: none; display: grid; place-items: center; border-radius: 12px; background: #fff; border: 1px solid var(--line); overflow: hidden; }
.wa-qr img { width: 100%; height: 100%; display: block; }
.wa-qr .ok { width: 72px; height: 72px; border-radius: 50%; display: grid; place-items: center; background: #25d366; color: #fff; }
.wa-qr .ok .i { width: 36px; height: 36px; }
.wa-info { min-width: 0; display: flex; flex-direction: column; gap: 6px; align-items: flex-start; }
.wa-info > b { font-size: 15px; }
@media (max-width: 760px) { .auto-grid { grid-template-columns: 1fr; } .wa-box { flex-direction: column; align-items: stretch; } .wa-qr { margin: 0 auto; } }

/* WhatsApp logs */
.wa-conn { display: flex; align-items: center; gap: 14px; padding: 14px 18px; }
.wa-conn b { display: block; } .wa-conn small { display: block; font-size: 12.5px; }
.wa-dot { width: 12px; height: 12px; border-radius: 50%; background: #dc2626; box-shadow: 0 0 0 4px rgb(220 38 38 / .15); flex: none; }
.wa-conn.on .wa-dot { background: #25d366; box-shadow: 0 0 0 4px rgb(37 211 102 / .2); animation: wa-pulse 2s infinite; }
@keyframes wa-pulse { 50% { box-shadow: 0 0 0 7px rgb(37 211 102 / .08); } }
.wa-log { display: flex; gap: 14px; align-items: flex-start; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.wa-log:last-child { border-bottom: 0; }
.wa-ic { width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center; flex: none; color: #fff; background: #25d366; }
.wa-ic.failed { background: #dc2626; }
.wa-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.wa-top { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.wa-top .tag .i { width: 12px; height: 12px; }
.wa-cap { font-size: 12.5px; color: var(--text-2); white-space: pre-line; background: var(--surface-2); border-radius: 0 12px 12px 12px; padding: 8px 12px; max-width: 520px;
  display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden; }
.wa-err { font-size: 12px; color: var(--bad); display: flex; align-items: center; gap: 6px; }
.wa-err .i { width: 14px; height: 14px; }
.wa-end { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; flex: none; }
.wa-end small { font-size: 11.5px; white-space: nowrap; }
@media (max-width: 760px) { .wa-log { padding: 12px 14px; } .wa-end small { font-size: 10.5px; } }

/* settings: repeatable rows */
.rep > * + * { margin-top: 8px; }
.rep-row { display: grid; gap: 8px; align-items: center; padding: 8px; border-radius: 14px; background: var(--surface-2); border: 1px solid var(--line); }
.rep-row .input { height: 42px; }
.rep-phone { grid-template-columns: minmax(0, 1fr) minmax(0, 1.6fr) auto; }
.rep-bank { grid-template-columns: repeat(2, minmax(0, 1fr)) auto; }
.rep-bank .rep-rm { grid-column: 3; grid-row: 1; }
@media (max-width: 760px) {
  .rep-phone { grid-template-columns: minmax(0, 1fr) auto; } .rep-phone [data-k=label] { grid-column: 1 / -1; }
  .rep-bank { grid-template-columns: minmax(0, 1fr) auto; } .rep-bank .input { grid-column: 1; }
}

/* vault: extra field rows */
#cfRows > * + * { margin-top: 8px; }
.cf-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr) auto auto; gap: 8px; align-items: center; padding: 8px; border-radius: 14px; background: var(--surface-2); border: 1px solid var(--line); }
.cf-row .input { height: 42px; }
.cf-sec { font-size: 12.5px; white-space: nowrap; }
@media (max-width: 760px) {
  .cf-row { grid-template-columns: minmax(0, 1fr) auto auto; }
  .cf-row .cf-label { grid-column: 1 / -1; }
  .cf-row .cf-val { grid-column: 1 / 2; }
}

/* hosting */
.host { padding: 16px; display: flex; flex-direction: column; gap: 12px; }
.host .h { display: flex; gap: 12px; align-items: center; }
.host .h .ic { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; color: #fff; background: var(--grad); flex: none; }
.host .h .t { flex: 1; min-width: 0; } .host .h b { display: block; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; } .host .h small { color: var(--muted); font-size: 12px; }
.kv { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 14px; font-size: 12.5px; }
.kv div { min-width: 0; } .kv small { display: block; color: var(--muted); font-size: 11px; } .kv span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }

/* ---------------------------------------------------------------- forms */
.form-card { max-width: 980px; }
.fgrid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 16px; }
.fgrid .full { grid-column: 1 / -1; }
.fgrid.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.field label { display: block; font-size: 12.5px; font-weight: 600; color: var(--text-2); margin-bottom: 6px; }
.field label .req { color: var(--bad); }
.input, .field input:not([type=checkbox]):not([type=color]):not([type=range]), .field select, .field textarea {
  width: 100%; height: 44px; padding: 0 14px; border-radius: 12px; border: 1px solid var(--line-2); background: var(--surface); color: var(--text); font: 400 14px Poppins, system-ui, sans-serif; transition: border-color .2s, box-shadow .2s; }
.field textarea { height: auto; min-height: 96px; padding: 11px 14px; resize: vertical; line-height: 1.5; }
.field select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24' fill='none' stroke='%236b7890' stroke-width='2'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; padding-right: 38px; }
.input:focus, .field input:focus, .field select:focus, .field textarea:focus { outline: none; border-color: var(--blue-2); box-shadow: 0 0 0 4px rgb(var(--brand-rgb) / .14); }
.field .hint { font-size: 11.5px; color: var(--muted); margin-top: 5px; }
.field .err, .err-msg { font-size: 12px; color: var(--bad); margin-top: 5px; }
.field.has-err input, .field.has-err select, .field.has-err textarea { border-color: var(--bad); }
.check { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; font-weight: 500; }
.check input { width: 18px; height: 18px; accent-color: var(--blue); }
.pw-wrap { position: relative; } .pw-wrap input { padding-right: 84px !important; }
.pw-wrap .pw-tools { position: absolute; right: 6px; top: 6px; display: flex; gap: 2px; }
.pw-wrap .pw-tools button { width: 32px; height: 32px; border: 0; background: transparent; color: var(--muted); border-radius: 8px; cursor: pointer; display: grid; place-items: center; }
.pw-wrap .pw-tools button:hover { background: var(--surface-2); color: var(--text); }
.form-actions { display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; padding: 16px 18px; border-top: 1px solid var(--line); background: var(--surface-2); border-radius: 0 0 var(--r) var(--r); }
.form-actions .left { margin-right: auto; }
.section-t { grid-column: 1 / -1; font-size: 12px; font-weight: 700; letter-spacing: 1px; text-transform: uppercase; color: var(--muted); padding-top: 8px; display: flex; align-items: center; gap: 10px; }
.section-t::after { content: ""; flex: 1; height: 1px; background: var(--line); }
input[type=range] { width: 100%; accent-color: var(--blue); }
input[type=color] { width: 44px; height: 44px; border: 1px solid var(--line-2); border-radius: 12px; padding: 4px; background: var(--surface); cursor: pointer; }

/* invoice items editor */
.items-ed { width: 100%; border-collapse: separate; border-spacing: 0 8px; }
.items-ed th { text-align: left; font-size: 11.5px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .5px; padding: 0 6px; }
.items-ed td { padding: 0 4px; vertical-align: top; }
.items-ed input { width: 100%; height: 42px; padding: 0 12px; border-radius: 10px; border: 1px solid var(--line-2); background: var(--surface); color: var(--text); font: 400 14px Poppins, system-ui, sans-serif; }
.items-ed input:focus { outline: none; border-color: var(--blue-2); box-shadow: 0 0 0 3px rgb(var(--brand-rgb) / .14); }
.items-ed .det { margin-top: 6px; height: 34px; font-size: 12.5px; color: var(--text-2); }
.items-ed .amt { height: 42px; display: flex; align-items: center; justify-content: flex-end; font-weight: 600; padding-right: 6px; white-space: nowrap; }
.items-ed .rm { width: 36px; height: 42px; border: 0; background: transparent; color: var(--muted); border-radius: 10px; cursor: pointer; display: grid; place-items: center; }
.items-ed .rm:hover { background: var(--bad-bg); color: var(--bad); }
.totals { margin-left: auto; width: min(360px, 100%); display: grid; gap: 8px; }
.totals .r { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.totals .r input { width: 110px; height: 36px; text-align: right; }
.totals .grand { padding-top: 10px; border-top: 2px dashed var(--line); font-size: 18px; font-weight: 800; }

/* ---------------------------------------------------------------- invoice document (always light, print-ready) */
.inv { --navy: #0b2a6b; --navy-2: #1450b8; --green: #5fb515; --ink: #0e1730; --ink-2: #3d4a63; --mute: #6b7890; --rule: #dfe7f3; --soft: #f1f6fd;
  position: relative; width: 794px; min-height: 1123px; margin: 0 auto; display: flex; flex-direction: column; background: #fff; color: var(--ink); overflow: hidden; isolation: isolate;
  box-shadow: 0 1px 2px rgb(14 23 48 / .06), 0 24px 48px -28px rgb(14 23 48 / .3); font-size: 12px; }
.inv-sheet { width: 100%; overflow: hidden; }
.inv .i { width: 14px; height: 14px; }
.inv-mark { position: absolute; left: 50%; top: 52%; width: 300px; transform: translate(-50%, -50%); opacity: .55; z-index: -1; pointer-events: none; }
.inv-head { position: relative; display: flex; align-items: center; height: 100px; flex: none; padding: 0 30px; border-bottom: 3px solid var(--navy); overflow: hidden; }
.inv-logo { position: relative; z-index: 2; height: 46px; width: auto; display: block; flex: none; }
.inv-flag-accent { position: absolute; right: 0; top: 0; width: 24%; height: 52px; background: var(--green); clip-path: polygon(30% 0, 100% 0, 100% 100%, 0 100%); }
.inv-flag { position: absolute; right: 0; bottom: 0; width: 40%; height: 64px; display: flex; align-items: center; justify-content: flex-end; padding-right: 32px; background: linear-gradient(100deg, var(--navy), var(--navy-2)); clip-path: polygon(58px 0, 100% 0, 100% 100%, 0 100%); }
.inv-flag h2 { color: #fff; font-size: 33px; font-weight: 800; letter-spacing: 2px; line-height: 1; }
.inv-company { display: flex; justify-content: space-between; align-items: flex-start; gap: 20px; padding: 14px 30px 0; }
.inv-co { display: flex; flex-direction: column; gap: 1px; font-size: 11px; color: var(--ink-2); min-width: 0; }
.inv-co b { color: var(--navy); font-size: 15px; font-weight: 800; letter-spacing: .3px; margin-bottom: 3px; }
.inv-co span { display: flex; align-items: center; gap: 8px; line-height: 1.45; }
.inv-co .i { color: var(--navy-2); flex: none; width: 13px; height: 13px; }
.inv-number { text-align: right; flex: none; padding: 8px 14px; border-radius: 10px; background: var(--soft); border-left: 3px solid var(--green); }
.inv-number small { display: block; font-size: 10px; font-weight: 700; letter-spacing: .8px; text-transform: uppercase; color: var(--mute); }
.inv-number b { font-size: 15px; font-weight: 800; color: var(--navy); letter-spacing: .5px; }
.inv-body { position: relative; flex: 1; display: flex; flex-direction: column; padding: 14px 30px 12px; }
.inv-meta { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); gap: 16px; margin-bottom: 14px; align-items: start; }
.inv-bill { position: relative; border: 1px solid #cfdcf0; border-radius: 12px; padding: 20px 16px 12px; margin-top: 12px; background: rgb(255 255 255 / .7); }
.inv-bill .inv-tab { position: absolute; top: -12px; left: 16px; background: var(--navy); color: #fff !important; font-size: 10.5px; font-weight: 700; letter-spacing: .6px; text-transform: uppercase; padding: 5px 14px; border-radius: 30px; }
.inv-bill-row { display: flex; gap: 12px; align-items: flex-start; }
.inv-client-logo { width: 48px; height: 48px; object-fit: contain; border-radius: 10px; border: 1px solid var(--rule); padding: 4px; flex: none; background: #fff; }
.inv-bill b { display: block; font-size: 14.5px; font-weight: 700; margin-bottom: 2px; }
.inv-bill span { display: block; font-size: 12px; color: var(--ink-2); line-height: 1.6; }
.inv-bill .inv-contact { display: flex; align-items: center; gap: 2px 8px; flex-wrap: wrap; }
.inv-bill .inv-contact .nw { display: inline-flex; align-items: center; gap: 5px; overflow-wrap: anywhere; min-width: 0; }
.inv-bill .inv-contact .i { width: 13px; height: 13px; color: var(--navy); } .inv-bill .inv-contact i { font-style: normal; color: var(--mute); }
.inv-side { display: grid; gap: 6px; }
.inv-date { display: flex; align-items: center; gap: 10px; background: var(--soft); border-radius: 10px; padding: 6px 12px; }
.inv-date .ic { width: 28px; height: 28px; border-radius: 8px; display: grid; place-items: center; background: #fff; color: var(--navy-2); flex: none; }
.inv-date .ic .i { width: 15px; height: 15px; }
.inv-date small { display: block; font-size: 10px; color: var(--mute); text-transform: uppercase; letter-spacing: .5px; }
.inv-date b { font-size: 13px; }
.inv-due { background: var(--navy); color: #fff; border-radius: 12px; padding: 10px 14px; border-left: 5px solid var(--green); }
.inv-due small { display: block; font-size: 10.5px; font-weight: 700; letter-spacing: .6px; text-transform: uppercase; opacity: .9; }
.inv-due b { font-size: 22px; font-weight: 800; white-space: nowrap; letter-spacing: -.3px; }
.inv-due em { font-style: normal; font-size: 11px; font-weight: 500; opacity: .85; }
.inv-table { border: 1px solid var(--rule); border-radius: 12px; overflow: hidden; background: rgb(255 255 255 / .55); }
.inv-items { width: 100%; border-collapse: collapse; }
.inv-items th { background: transparent; color: #fff; font-size: 12px; font-weight: 700; text-align: left; padding: 0 16px; height: 34px; vertical-align: middle; }
/* header colour painted once behind the whole row (cell backgrounds leave hairline seams in print) */
.inv-table { background-image: linear-gradient(var(--navy), var(--navy)); background-size: 100% 34px; background-repeat: no-repeat; }
.th-line .inv-table { background-image: none; }
.th-line .inv-items th { background: transparent; color: var(--navy); border-bottom: 2px solid var(--navy); text-transform: uppercase; font-size: 11px; letter-spacing: .8px; }
.th-line .inv-table { border-radius: 0; border-left: 0; border-right: 0; }
.inv-items td { padding: 8px 16px; border-bottom: 1px solid var(--rule); vertical-align: top; font-size: 13px; }
.inv-items .r { text-align: right; white-space: nowrap; }
.inv-items .c-n { width: 44px; }
.inv-items td small { display: block; color: var(--mute); font-size: 11px; margin-top: 1px; }
.inv-items .inv-qm { display: none; }
.inv-sum .r { display: flex; justify-content: flex-end; gap: 12px; padding: 5px 16px; font-size: 12.5px; color: var(--ink-2); }
.inv-sum .r span:first-child { width: 180px; text-align: left; } .inv-sum .r span:last-child { min-width: 110px; text-align: right; color: var(--ink); white-space: nowrap; }
.inv-sum .total { background: linear-gradient(90deg, #fff, var(--soft) 35%); padding: 8px 16px; margin-top: 2px; }
.inv-sum .total span { font-size: 16px !important; font-weight: 800; color: var(--navy) !important; }
.inv-sum .paid span:last-child { color: #15803d !important; }
.inv-sum .bal span { font-weight: 800; color: #dc2626 !important; }
.inv-pay, .inv-box { margin-top: 12px; padding: 10px 16px; border: 1px solid #cfdcf0; border-left: 3px solid var(--navy-2); border-radius: 12px; background: rgb(255 255 255 / .7); }
.inv-pay h4, .inv-box h4 { display: flex; align-items: center; gap: 7px; font-size: 11.5px; font-weight: 800; color: var(--navy-2); text-transform: uppercase; letter-spacing: .5px; margin-bottom: 6px; }
.inv-pay p, .inv-box p { font-size: 12px; color: var(--ink-2); white-space: pre-line; line-height: 1.55; }
.inv-pay > p { margin-top: 8px; }
.inv-box { display: flex; gap: 10px; align-items: flex-start; }
.inv-box .ic { width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; background: var(--navy-2); color: #fff; flex: none; }
.inv-box .ic .i { width: 13px; height: 13px; }
.inv-box h4 { margin-bottom: 2px; }
.inv-banks { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 8px; }
.inv-bank { display: flex; gap: 10px; align-items: flex-start; background: var(--soft); border-radius: 10px; padding: 7px 11px; font-size: 11.5px; }
.inv-bank-ic { width: 28px; height: 28px; flex: none; display: grid; place-items: center; border-radius: 8px; background: var(--navy); color: #fff; }
.inv-bank-ic .i { width: 15px; height: 15px; }
.inv-bank-logo { width: 30px; height: 30px; flex: none; display: block; object-fit: contain; border-radius: 8px; background: #fff; padding: 2px; box-shadow: 0 0 0 1px var(--rule); }
.inv-bank-d { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.inv-bank b { font-size: 12.5px; }
.inv-bank span { display: flex; gap: 6px; overflow-wrap: anywhere; }
.inv-bank em { font-style: normal; color: var(--mute); flex: none; width: 48px; font-size: 11px; }
.inv-bank .muted-note { color: var(--mute); font-size: 11px; }
.inv-items tbody tr:nth-child(even) td { background: rgb(241 246 253 / .5); }
.inv-words { padding: 7px 16px 8px; border-top: 1px dashed var(--rule); font-size: 12px; font-style: italic; color: var(--ink-2); }
.inv-words span { font-style: normal; font-size: 10px; font-weight: 700; letter-spacing: .6px; text-transform: uppercase; color: var(--mute); margin-right: 8px; }
.inv-terms { opacity: .62; border-left-color: var(--rule) !important; }
.inv-terms .ic { background: var(--mute) !important; }
.inv-terms h4 { color: var(--ink-2) !important; }
.inv-terms ol { margin: 3px 0 0; padding-left: 16px; font-size: 10.5px; line-height: 1.5; color: var(--ink-2); }
.inv-terms li::marker { color: var(--mute); font-weight: 700; }
.inv-row2 { display: grid; grid-template-columns: minmax(0, 1fr) 280px; gap: 12px; align-items: start; margin-top: 12px; }
.inv-row2.solo { grid-template-columns: minmax(0, 1fr) 280px; } .inv-row2.solo .inv-scan { grid-column: 2; }
.inv-notes-col { display: flex; flex-direction: column; gap: 10px; } .inv-notes-col > .inv-box { margin-top: 0; flex: 1; }
.inv-scan { display: flex; gap: 12px; align-items: center; padding: 12px; border: 1px solid #cfdcf0; border-radius: 12px; background: rgb(255 255 255 / .8); }
.inv-qr { width: 84px; height: 84px; flex: none; border-radius: 8px; padding: 4px; background: #fff; border: 1px solid var(--rule); image-rendering: pixelated; }
.inv-scan-t { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.inv-scan-t b { font-size: 12.5px; color: var(--navy); white-space: nowrap; } .inv-scan-t small { font-size: 10.5px; color: var(--mute); }
.inv-barcode { width: 100%; max-width: 130px; height: 30px; margin-top: 6px; image-rendering: pixelated; }
.inv-scan-t code { font: 600 10px ui-monospace, Consolas, monospace; letter-spacing: 1.5px; color: var(--ink-2); }
.inv-thanks { display: flex; justify-content: space-between; align-items: center; gap: 14px; flex-wrap: wrap; margin-top: auto; padding-top: 16px; }
.inv-thanks b { display: block; font-size: 15px; font-weight: 800; }
.inv-thanks > div:first-child > span { font-style: italic; color: var(--ink-2); font-size: 12.5px; } .inv-thanks em { color: var(--green); font-weight: 700; }
.inv-sign { position: relative; width: 190px; padding-top: 62px; text-align: center; flex: none; }
.inv-seal { position: absolute; left: 50%; top: -18px; width: 104px; height: 104px; transform: translateX(-50%) rotate(-12deg); opacity: .88; pointer-events: none; }
.inv-sign-line { display: block; height: 1.5px; background: var(--ink); margin-bottom: 6px; }
.inv-sign b { font-size: 12.5px; font-weight: 700; letter-spacing: .5px; color: var(--ink); }
.inv-foot { position: relative; display: flex; align-items: stretch; justify-content: space-between; gap: 16px; flex: none; border-top: 3px solid var(--navy); }
.inv-foot-bar { position: relative; z-index: 1; display: flex; align-items: center; flex-wrap: wrap; gap: 6px 14px; max-width: 70%; padding: 15px 70px 21px 30px; color: #fff; font-size: 12px;
  background: linear-gradient(100deg, var(--navy), var(--navy-2)); clip-path: polygon(0 0, 100% 0, calc(100% - 44px) 100%, 0 100%); }
.inv-foot-bar a { display: inline-flex; align-items: center; gap: 7px; color: #fff; white-space: nowrap; }
.inv-foot-bar .i { width: 14px; height: 14px; color: var(--green); }
.inv-foot-bar > i { width: 1px; height: 14px; background: rgb(255 255 255 / .3); }
.inv-foot-accent { position: absolute; z-index: 2; left: 0; bottom: 0; width: calc(70% + 18px); max-width: 100%; height: 6px; background: var(--green); clip-path: polygon(0 0, 100% 0, calc(100% - 5px) 100%, 0 100%); }
.inv-social { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; padding: 10px 30px 14px 0; }
.inv-social a { width: 28px; height: 28px; border-radius: 50%; display: block; transition: transform .2s; }
.inv-social a:hover { transform: translateY(-2px); }
.inv-social img { width: 28px; height: 28px; display: block; }
.inv-stamp { position: absolute; right: 34px; top: 0; transform: rotate(-12deg); border: 3px solid #16a34a; color: #16a34a; font-size: 22px; font-weight: 900; letter-spacing: 5px; padding: 1px 14px; border-radius: 9px; opacity: .75; pointer-events: none; }
@media print {
  .inv { box-shadow: none; border: 0; border-radius: 0; }
  .toast, .sheet, .sheet-bg { display: none !important; }
  .inv, .inv * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}

/* ---------------------------------------------------------------- alerts / toast */
.alert { display: flex; gap: 10px; align-items: center; padding: 12px 16px; border-radius: 14px; margin-bottom: 16px; font-weight: 500; }
.alert.ok { background: var(--ok-bg); color: var(--ok); } .alert.err { background: var(--bad-bg); color: var(--bad); }
.toast { position: fixed; left: 50%; top: 18px; z-index: 200; transform: translate(-50%, -140%); display: flex; align-items: center; gap: 10px; padding: 12px 18px; border-radius: 14px; background: var(--text); color: var(--surface); font-weight: 500; box-shadow: var(--shadow-lg); transition: transform .5s var(--ease-spring); max-width: calc(100vw - 32px); }
.toast.show { transform: translate(-50%, 0); }
.toast.err .i { color: #f87171; } .toast.ok .i { color: #4ade80; }

/* ---------------------------------------------------------------- sheet / modal */
.sheet-bg { position: fixed; inset: 0; z-index: 90; background: rgb(8 13 26 / .45); backdrop-filter: blur(4px); opacity: 0; pointer-events: none; transition: opacity .3s; }
.sheet { position: fixed; z-index: 91; left: 50%; bottom: 0; width: min(560px, 100%); transform: translate(-50%, 110%); background: var(--surface); border-radius: 26px 26px 0 0; padding: 10px 18px calc(22px + env(safe-area-inset-bottom)); box-shadow: var(--shadow-lg); transition: transform .45s var(--ease-spring); max-height: 88vh; overflow-y: auto; }
.sheet::before { content: ""; display: block; width: 44px; height: 5px; border-radius: 5px; background: var(--line-2); margin: 0 auto 12px; }
.sheet.open { transform: translate(-50%, 0); }
.sheet-bg.open { opacity: 1; pointer-events: auto; }
.sheet h3 { font-size: 17px; margin-bottom: 4px; } .sheet > p { color: var(--muted); font-size: 13px; margin-bottom: 14px; }
@media (min-width: 761px) {
  .sheet { top: 50%; bottom: auto; border-radius: 24px; transform: translate(-50%, -40%) scale(.96); opacity: 0; pointer-events: none; transition: transform .35s var(--ease-spring), opacity .25s; padding-top: 22px; }
  .sheet::before { display: none; }
  .sheet.open { transform: translate(-50%, -50%) scale(1); opacity: 1; pointer-events: auto; }
}
.qa-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.qa { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 16px 8px; border-radius: 18px; background: var(--surface-2); border: 1px solid var(--line); font-weight: 600; font-size: 12.5px; text-align: center; transition: transform .2s var(--ease-spring), border-color .2s; opacity: 0; transform: translateY(14px) scale(.9); }
.sheet.open .qa { opacity: 1; transform: none; transition: transform .45s var(--ease-spring), opacity .3s; }
.sheet.open .qa:nth-child(2) { transition-delay: .03s; } .sheet.open .qa:nth-child(3) { transition-delay: .06s; } .sheet.open .qa:nth-child(4) { transition-delay: .09s; } .sheet.open .qa:nth-child(5) { transition-delay: .12s; } .sheet.open .qa:nth-child(6) { transition-delay: .15s; }
.qa:active { transform: scale(.94); }
.qa .ic { width: 46px; height: 46px; border-radius: 15px; display: grid; place-items: center; color: #fff; background: var(--grad); box-shadow: 0 10px 18px -10px rgb(var(--brand-rgb) / .8); }
.qa .ic.g { background: linear-gradient(135deg, #5fb515, #2f9e44); }
.qa .ic.d { background: linear-gradient(135deg, #0e1730, #3d4a63); }

/* ---------------------------------------------------------------- loader (Three.js D) */
.boot { position: fixed; inset: 0; z-index: 500; display: grid; place-items: center; background: radial-gradient(1200px 600px at 50% 40%, #102454 0%, #070c1a 60%); transition: opacity .6s ease, visibility .6s; }
.boot.done { opacity: 0; visibility: hidden; }
.boot[hidden] { display: none; }
.boot .wrap { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.boot .d3 { width: min(220px, 52vw); height: min(220px, 52vw); }
.boot .d3.d3-fallback { background: url(/icons/devjix-d.png) center / 70% no-repeat; animation: pulse 1.2s ease-in-out infinite; }
.boot .word { color: #fff; font-weight: 800; letter-spacing: 10px; font-size: 22px; padding-left: 10px; }
.boot .tag { background: none; border: 0; color: #7ad12c; letter-spacing: 3px; font-size: 10.5px; text-transform: uppercase; }
.boot .bar { width: 160px; height: 3px; border-radius: 3px; background: rgb(255 255 255 / .1); overflow: hidden; margin-top: 14px; }
.boot .bar i { display: block; height: 100%; width: 40%; border-radius: 3px; background: linear-gradient(90deg, #1a6cf0, #7ad12c); animation: slide 1.1s ease-in-out infinite; }
@keyframes slide { 0% { transform: translateX(-100%); } 100% { transform: translateX(260%); } }
@keyframes pulse { 50% { transform: scale(.92); opacity: .8; } }
.navload { position: fixed; top: 0; left: 0; right: 0; height: 3px; z-index: 400; pointer-events: none; }
.navload i { display: block; height: 100%; width: 0; background: var(--grad); box-shadow: 0 0 12px rgb(var(--brand-rgb) / .8); transition: width 8s cubic-bezier(.1, .7, .2, 1); }
.navload.go i { width: 92%; }

.d3 { position: relative; }
.d3-canvas { width: 100%; height: 100%; display: block; }
.d3.d3-fallback { background: url(/icons/devjix-d.png) center / 78% no-repeat; }

/* ---------------------------------------------------------------- mobile bottom bar (wave + bubble, D in centre) */
.bottom-bar { display: none; }
@media (max-width: 760px) {
  .bottom-bar { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); position: fixed; left: 12px; right: 12px; z-index: 50;
    bottom: max(12px, env(safe-area-inset-bottom)); height: 64px; border-radius: 22px; max-width: 520px; margin: 0 auto;
    background: var(--surface); border: 1px solid var(--line); box-shadow: 0 16px 34px -14px rgb(15 23 42 / .35); }
  .bottom-bar.bb-svg { background: transparent; border-color: transparent; box-shadow: none; }
  .bb-shape { position: absolute; left: 0; top: -36px; overflow: visible; z-index: 0; pointer-events: none;
    filter: drop-shadow(0 12px 20px rgb(15 23 42 / .16)) drop-shadow(0 1px 1.5px rgb(15 23 42 / .08)); }
  .bb-shape path { fill: var(--surface); stroke: var(--line); stroke-width: 1; }
  .bb-ind { position: absolute; top: 0; width: 0; height: 0; z-index: 0; pointer-events: none; transition: opacity .3s, transform .3s; }
  .bb-ind i { position: absolute; width: 50px; height: 50px; left: -25px; top: -44px; border-radius: 50%; background: var(--grad);
    box-shadow: 0 0 0 5px color-mix(in srgb, var(--page) 91%, var(--text) 9%), 0 12px 20px -6px rgb(var(--brand-rgb) / .6); }
  .bottom-bar.bb-move .bb-ind i { animation: bb-pop .55s var(--ease-spring); }
  .bottom-bar[data-on="-1"] .bb-ind { opacity: 0; transform: scale(.3); }
  @keyframes bb-pop { 0% { transform: scale(.55); } 60% { transform: scale(1.1); } 100% { transform: scale(1); } }
  .bb-tab { position: relative; z-index: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; min-width: 0; height: 100%;
    color: var(--text-2); font: 600 10.5px Poppins, sans-serif; background: none; border: 0; cursor: pointer; text-decoration: none; -webkit-tap-highlight-color: transparent; padding: 0; }
  .bb-ic { display: grid; place-items: center; transition: transform .5s var(--ease-spring), color .3s, scale .15s; }
  .bb-ic .i { width: 21px; height: 21px; }
  .bb-l { white-space: nowrap; transition: color .3s; }
  .bb-tab:active .bb-ic { scale: .82; }
  .bb-tab.on { color: var(--text); }
  .bb-tab.on .bb-ic { transform: translateY(-43px); color: #fff; transition-delay: .06s; }
  .bb-tab.on .bb-l { font-weight: 800; }

  /* centre D orb */
  .bb-d { justify-content: flex-end; padding-bottom: 7px; }
  .bb-d .orb { position: absolute; left: 50%; top: -34px; width: 62px; height: 62px; margin-left: -31px; border-radius: 50%;
    background: radial-gradient(circle at 35% 30%, #ffffff, #eef3fb 70%);
    box-shadow: 0 0 0 5px color-mix(in srgb, var(--page) 91%, var(--text) 9%), 0 14px 24px -10px rgb(var(--brand-rgb) / .65), inset 0 -4px 10px rgb(5 80 196 / .12);
    transition: transform .4s var(--ease-spring); }
  :root[data-theme="dark"] .bb-d .orb { background: radial-gradient(circle at 35% 30%, #1e2a46, #0d1526 75%); }
  @media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .bb-d .orb { background: radial-gradient(circle at 35% 30%, #1e2a46, #0d1526 75%); } }
  .bb-d .orb::before { content: ""; position: absolute; inset: -3px; border-radius: 50%; padding: 2px; background: conic-gradient(from 0deg, #0550c4, #1a6cf0, #5fb515, #7ad12c, #0550c4);
    -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0); -webkit-mask-composite: xor; mask-composite: exclude; animation: spin 6s linear infinite; }
  .bb-d .orb .d3 { position: absolute; inset: 6px; }
  .bb-d:active .orb { transform: scale(.9); }
  .bb-d.open .orb { transform: rotate(0) scale(1.06); }
  .bb-d .bb-l { background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; font-weight: 800; }
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------------------------------------------------------------- more page */
.more-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.more-item { display: flex; flex-direction: column; gap: 10px; padding: 16px; }
.more-item .ic { width: 44px; height: 44px; border-radius: 14px; display: grid; place-items: center; color: #fff; background: var(--grad); }
.more-item b { font-weight: 700; } .more-item small { color: var(--muted); font-size: 12px; display: block; }

/* ---------------------------------------------------------------- auth */
.auth { min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr; }
.auth .art { position: relative; overflow: hidden; background: radial-gradient(900px 600px at 30% 30%, #12306e, #070c1a 70%); color: #fff; display: flex; flex-direction: column; justify-content: center; align-items: center; padding: 40px; text-align: center; }
.auth .art .d3 { width: min(360px, 70%); aspect-ratio: 1; }
.auth .art h2 { font-size: 30px; font-weight: 800; letter-spacing: 1px; margin-top: 10px; }
.auth .art p { opacity: .75; max-width: 380px; margin-top: 8px; }
.auth .art .grid-bg { position: absolute; inset: 0; background-image: linear-gradient(rgb(255 255 255 / .04) 1px, transparent 1px), linear-gradient(90deg, rgb(255 255 255 / .04) 1px, transparent 1px); background-size: 40px 40px; mask-image: radial-gradient(circle at 50% 50%, #000 30%, transparent 75%); }
.auth .form { display: flex; align-items: center; justify-content: center; padding: 32px 20px; }
.auth .box { width: min(400px, 100%); }
.auth .box h1 { font-size: 26px; font-weight: 800; margin: 18px 0 4px; }
.auth .box > p { color: var(--muted); margin-bottom: 24px; }
.auth .box .field { margin-bottom: 14px; }
.auth .logo-m { height: 34px; }

/* ---------------------------------------------------------------- responsive */
@media (max-width: 1200px) {
  .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .g-main { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 1000px) {
  :root { --side: 84px; }
  .side { padding: 16px 10px; align-items: center; }
  .brand { padding: 0 0 12px; } .brand .txt, .nav-sec, .nav a span, .nav .count, .user-card .who, .side-foot .btn span { display: none; }
  .nav a { justify-content: center; padding: 12px; } .nav a.on::before { left: -10px; }
  .user-card { padding: 6px; border: 0; background: none; }
  .g3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 760px) {
  .app { display: block; }
  .side { display: none; }
  .topbar { padding: 12px 16px; padding-top: max(12px, env(safe-area-inset-top)); }
  .topbar .mlogo { display: block; width: 36px; height: 36px; flex: none; }
  .topbar h1 { font-size: 18px; }
  .top-search { display: none; }
  .content { padding: 4px 16px calc(130px + env(safe-area-inset-bottom)); }
  .g2, .g3, .fgrid, .fgrid.g3 { grid-template-columns: minmax(0, 1fr); }
  .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  .stat { padding: 14px; } .stat .val { font-size: 20px; }
  .card-h, .card-b { padding: 14px; } .li { padding: 12px 14px; }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kpis > div:nth-child(2) { border-right: 0; } .kpis > div:nth-child(-n+2) { border-bottom: 1px solid var(--line); }
  .chero { padding: 18px; } .chero h2 { font-size: 19px; }
  .client-grid { grid-template-columns: minmax(0, 1fr); }
  .page-actions .btn span { display: none; } .page-actions .btn { padding: 0 12px; }
  .hide-m { display: none !important; }
  .form-actions { position: sticky; bottom: calc(86px + env(safe-area-inset-bottom)); z-index: 5; border-radius: 16px; border: 1px solid var(--line); box-shadow: var(--shadow-lg); margin: 0 -2px; }
  .form-actions .btn { flex: 1; }
  .form-actions .left { flex: 0 0 auto; }

  /* tables → stacked cards */
  table.t.stackable thead { display: none; }
  table.t.stackable, .t.stackable tbody, .t.stackable tr, .t.stackable td { display: block; width: 100%; }
  .t.stackable tr { padding: 12px 14px; border-bottom: 1px solid var(--line); display: grid; grid-template-columns: 1fr auto; gap: 4px 10px; }
  .t.stackable td { padding: 0; border: 0; }
  .t.stackable td[data-l]::before { content: attr(data-l) " · "; color: var(--muted); font-size: 11.5px; }
  .t.stackable td.c-main { grid-column: 1 / 2; } .t.stackable td.c-end { grid-column: 2; grid-row: 1; text-align: right; }
  .t.stackable td.c-sub { grid-column: 1 / -1; font-size: 12.5px; color: var(--text-2); }
  .t.stackable td.c-hide { display: none; }

  /* invoice items editor */
  .items-ed thead { display: none; }
  .items-ed, .items-ed tbody, .items-ed tr { display: block; }
  .items-ed tr { display: grid; grid-template-columns: 1fr 1fr auto; gap: 8px; padding: 12px; border: 1px solid var(--line); border-radius: 14px; margin-bottom: 10px; background: var(--surface-2); }
  .items-ed td { padding: 0; }
  .items-ed td.c-desc { grid-column: 1 / -1; }
  .items-ed td.c-amt { grid-column: 1 / 3; } .items-ed td.c-amt .amt { justify-content: flex-start; }
  .items-ed td.c-rm { grid-column: 3; grid-row: 3; }


  .auth { grid-template-columns: 1fr; }
  .auth .art { min-height: 38vh; padding: 28px 20px 20px; }
  .auth .art .d3 { width: 180px; } .auth .art h2 { font-size: 22px; } .auth .art p { display: none; }
  .more-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 380px) { .g4 { grid-template-columns: minmax(0, 1fr); } .qa-grid { grid-template-columns: repeat(2, 1fr); } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition-duration: .01ms !important; } }

/* standalone PWA tweaks */
@media (display-mode: standalone) { .install-only-browser { display: none !important; } }
@media print {
  .side, .topbar, .bottom-bar, .no-print, .boot, .navload { display: none !important; }
  .app { display: block; } .content { padding: 0; max-width: none; } body { background: #fff; }
}
