/* northline BUSINESS HUB – demo ERP styles (shared by login.html and dashboard.html) */
:root {
  --navy-950: #15123a;
  --navy-900: #1e1b4b;
  --navy-800: #28246a;
  --navy-700: #312e81;
  --violet: #6d5dfc;
  --violet-600: #7c3aed;
  --violet-100: #ede9fe;
  --violet-50: #f5f3ff;
  --bg: #f6f5fd;
  --card: #ffffff;
  --text: #1c1a3a;
  --muted: #6b6a85;
  --border: #e8e6f4;
  --green: #15803d;
  --green-bg: #dcfce7;
  --orange: #c2410c;
  --orange-bg: #ffedd5;
  --red: #dc2626;
  --red-bg: #fee2e2;
  --blue: #2563eb;
  --blue-bg: #dbeafe;
  --gray-bg: #f1f0f7;
  --radius: 18px;
  --shadow: 0 1px 2px rgba(30, 27, 75, .04), 0 8px 24px rgba(30, 27, 75, .07);
  --shadow-lg: 0 24px 60px rgba(21, 18, 58, .28);
  --font: "Plus Jakarta Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
img, svg { display: block; }
a { color: var(--violet-600); }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
h1, h2, h3, h4 { margin: 0; line-height: 1.25; letter-spacing: -.01em; }
p { margin: 0; }
[tabindex="-1"]:focus { outline: none; }
:focus-visible { outline: 3px solid rgba(109, 93, 252, .55); outline-offset: 2px; }
.sr-only {
  position: absolute !important; left: 0; top: 0; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.muted { color: var(--muted); }
.num { text-align: right; font-variant-numeric: tabular-nums; }
.nowrap { white-space: nowrap; }

/* ---------- Demo banner ---------- */
.demo-banner {
  background: #fff7e6;
  color: #5b3b00;
  border-bottom: 1px solid #f6dfb0;
  font-size: 13px;
  font-weight: 500;
  text-align: center;
  padding: 8px 16px;
  line-height: 1.4;
}
.demo-banner a { color: #5b21b6; font-weight: 700; text-decoration: none; margin-left: 6px; white-space: nowrap; }
.demo-banner a:hover { text-decoration: underline; }

/* ---------- Wordmark ---------- */
.wordmark { display: inline-flex; align-items: center; gap: 11px; color: inherit; text-decoration: none; }
.wm-mark { width: 38px; height: 38px; flex: none; }
.wm-text { display: flex; flex-direction: column; line-height: 1; }
.wm-name { font-weight: 800; font-size: 22px; letter-spacing: -.03em; }
.wm-sub { font-size: 10px; font-weight: 700; letter-spacing: .26em; text-transform: uppercase; opacity: .72; margin-top: 5px; }

/* ---------- Buttons & forms ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 1px solid transparent; border-radius: 12px;
  padding: 10px 16px; font-weight: 600; font-size: 14px; line-height: 1.2;
  text-decoration: none; transition: background .15s, box-shadow .15s, transform .05s, border-color .15s;
  white-space: nowrap;
}
.btn:active { transform: translateY(1px); }
.btn svg { width: 17px; height: 17px; }
.btn-primary { background: var(--violet); color: #fff; box-shadow: 0 6px 16px rgba(109, 93, 252, .3); }
.btn-primary:hover { background: #5b4bf0; }
.btn-secondary { background: var(--violet-100); color: #4c1d95; }
.btn-secondary:hover { background: #e2dcfd; }
.btn-ghost { background: #fff; border-color: var(--border); color: var(--text); }
.btn-ghost:hover { border-color: #cfc9f3; background: var(--violet-50); }
.btn-danger { background: #fff; border-color: #f5c2c2; color: var(--red); }
.btn-danger:hover { background: var(--red-bg); }
.btn-success { background: var(--green-bg); color: var(--green); }
.btn-success:hover { background: #c9f5d8; }
.btn-sm { padding: 7px 11px; font-size: 13px; border-radius: 10px; }
.btn[disabled] { opacity: .5; cursor: not-allowed; box-shadow: none; }
.icon-btn {
  display: inline-grid; place-items: center; width: 36px; height: 36px; border-radius: 10px;
  border: 1px solid var(--border); background: #fff; color: var(--muted);
}
.icon-btn:hover { color: var(--text); background: var(--violet-50); }
.icon-btn svg { width: 18px; height: 18px; }

.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field > span, .field-label { font-size: 13px; font-weight: 600; color: #3b3960; }
.input, .field input, .field select, .field textarea {
  width: 100%; border: 1px solid #dcd9ee; background: #fff; border-radius: 12px;
  padding: 11px 13px; font-size: 14.5px; transition: border-color .15s, box-shadow .15s;
}
.input:focus, .field input:focus, .field select:focus, .field textarea:focus {
  outline: none; border-color: var(--violet); box-shadow: 0 0 0 4px rgba(109, 93, 252, .15);
}
.field input[aria-invalid="true"] { border-color: var(--red); }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.form-grid .span-2 { grid-column: 1 / -1; }
.form-actions { display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; margin-top: 18px; }
.form-error { color: var(--red); font-size: 13.5px; font-weight: 600; min-height: 0; }
.form-error:empty { display: none; }
.hint-text { font-size: 12.5px; color: var(--muted); }

/* ---------- Pills ---------- */
.pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 10px; border-radius: 999px;
  font-size: 11.5px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; white-space: nowrap;
}
.pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.pill-paid, .pill-accepted, .pill-ok { background: var(--green-bg); color: var(--green); }
.pill-open, .pill-sent { background: var(--orange-bg); color: var(--orange); }
.pill-overdue, .pill-low { background: var(--red-bg); color: var(--red); }
.pill-draft { background: var(--gray-bg); color: #55536f; }
.pill-converted, .pill-onorder { background: var(--blue-bg); color: var(--blue); }

/* ================= LOGIN PAGE ================= */
.login-page { min-height: 100vh; display: flex; flex-direction: column; background: var(--bg); }
.login-wrap { flex: 1; display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); }
.login-brand {
  position: relative; overflow: hidden;
  background: radial-gradient(circle at 85% 10%, rgba(124, 58, 237, .45), transparent 45%),
              linear-gradient(160deg, var(--navy-900) 0%, var(--navy-700) 100%);
  color: #fff; padding: 48px 56px; display: flex; flex-direction: column; gap: 36px;
}
.login-brand::after {
  content: ""; position: absolute; right: -120px; bottom: -120px; width: 360px; height: 360px;
  border-radius: 50%; border: 60px solid rgba(255, 255, 255, .04);
}
.login-brand h1 { font-size: clamp(28px, 3.2vw, 40px); font-weight: 800; letter-spacing: -.03em; max-width: 520px; }
.login-brand h1 em { font-style: normal; color: #c4b5fd; }
.login-brand .lead { color: #c7c5ee; max-width: 470px; margin-top: 14px; font-size: 16px; }
.feature-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 14px; max-width: 470px; }
.feature-list li { display: flex; gap: 12px; align-items: flex-start; color: #e3e1fb; font-size: 14.5px; }
.feature-list .fi {
  flex: none; width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center;
  background: rgba(255, 255, 255, .09); color: #c4b5fd;
}
.feature-list .fi svg { width: 16px; height: 16px; }
.feature-list strong { color: #fff; display: block; font-weight: 700; }
.brand-preview {
  margin-top: auto; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; max-width: 520px; position: relative; z-index: 1;
}
.bp-card {
  background: rgba(255, 255, 255, .08); border: 1px solid rgba(255, 255, 255, .12);
  border-radius: 14px; padding: 14px; backdrop-filter: blur(6px);
}
.bp-card span { font-size: 12px; color: #c7c5ee; display: block; }
.bp-card strong { font-size: 22px; font-weight: 800; }
.bp-card.warn strong { color: #fca5a5; }

.login-panel { display: flex; align-items: center; justify-content: center; padding: 40px 24px 96px; }
.login-card { width: 100%; max-width: 420px; }
.login-card h2 { font-size: 28px; font-weight: 800; letter-spacing: -.02em; }
.login-card .sub { color: var(--muted); margin: 6px 0 26px; }
.login-form { display: grid; gap: 16px; }
.pw-wrap { position: relative; }
.pw-wrap input { padding-right: 70px; }
.pw-toggle {
  position: absolute; right: 6px; top: 50%; transform: translateY(-50%);
  border: 0; background: transparent; color: var(--violet-600); font-weight: 700; font-size: 13px; padding: 8px 10px; border-radius: 8px;
}
.pw-toggle:hover { background: var(--violet-50); }
.role-switch { border: 0; margin: 0; padding: 0; min-width: 0; }
.role-switch legend { padding: 0; margin-bottom: 6px; font-size: 13px; font-weight: 600; color: #3b3960; }
.role-opts { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; background: var(--gray-bg); padding: 5px; border-radius: 14px; }
.role-switch label { position: relative; }
.role-switch input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.role-switch .opt {
  display: flex; flex-direction: column; align-items: center; padding: 9px 8px; border-radius: 10px;
  font-weight: 700; font-size: 14px; color: var(--muted); transition: .15s; text-align: center; line-height: 1.25;
}
.role-switch .opt small { font-weight: 500; font-size: 11.5px; }
.role-switch input:checked + .opt { background: #fff; color: var(--text); box-shadow: 0 2px 8px rgba(30, 27, 75, .1); }
.role-switch input:focus-visible + .opt { outline: 3px solid rgba(109, 93, 252, .55); }
.login-row { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; font-size: 13.5px; }
.link-btn { border: 0; background: none; padding: 0; color: var(--violet-600); font-weight: 600; font-size: 13.5px; }
.link-btn:hover { text-decoration: underline; }
.login-form .btn-primary { width: 100%; padding: 13px 16px; font-size: 15px; }
.login-msg { border-radius: 12px; padding: 10px 13px; font-size: 13.5px; font-weight: 600; }
.login-msg.error { background: var(--red-bg); color: #991b1b; }
.login-msg.info { background: var(--violet-50); color: #4c1d95; }
.shake { animation: shake .4s; }
@keyframes shake { 0%, 100% { transform: none; } 20%, 60% { transform: translateX(-6px); } 40%, 80% { transform: translateX(6px); } }
.hint-box {
  margin-top: 22px; border: 1px dashed #c9c1fb; background: var(--violet-50);
  border-radius: 16px; padding: 16px; display: grid; gap: 10px;
}
.hint-box .hb-title { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 13.5px; color: #4c1d95; }
.hint-box dl { margin: 0; display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; font-size: 13.5px; }
.hint-box dt { color: var(--muted); }
.hint-box dd { margin: 0; font-weight: 700; font-family: ui-monospace, "SFMono-Regular", Consolas, monospace; font-size: 13px; word-break: break-all; }
.login-foot { margin-top: 22px; font-size: 12.5px; color: var(--muted); text-align: center; }

/* ================= DASHBOARD ================= */
.app {
  display: grid; grid-template-columns: 264px minmax(0, 1fr); min-height: calc(100vh - 36px);
  background: linear-gradient(90deg, var(--navy-700) 264px, transparent 264px);
}
.sidebar {
  position: sticky; top: 0; height: calc(100vh - 36px); overflow-y: auto;
  background: linear-gradient(180deg, var(--navy-900) 0%, var(--navy-700) 100%);
  color: #fff; display: flex; flex-direction: column; padding: 26px 18px 20px; z-index: 40;
}
.sidebar .wordmark { padding: 0 8px 26px; }
.nav-label { font-size: 11px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: #8f8cc7; padding: 0 12px; margin: 8px 0 8px; }
.nav { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.nav a, .nav button {
  width: 100%; display: flex; align-items: center; gap: 12px; padding: 11px 14px;
  border-radius: 999px; color: #d4d2f5; text-decoration: none; font-weight: 600; font-size: 14.5px;
  border: 0; background: transparent; text-align: left; transition: background .15s, color .15s;
}
.nav a svg, .nav button svg { width: 19px; height: 19px; flex: none; opacity: .9; }
.nav a:hover, .nav button:hover { background: rgba(255, 255, 255, .08); color: #fff; }
.nav a.active { background: var(--violet); color: #fff; box-shadow: 0 8px 20px rgba(109, 93, 252, .45); }
.nav .count { margin-left: auto; background: rgba(255, 255, 255, .14); font-size: 11.5px; padding: 1px 8px; border-radius: 999px; font-weight: 700; }
.nav a.active .count { background: rgba(255, 255, 255, .25); }
.sidebar-foot { margin-top: auto; padding-top: 18px; display: grid; gap: 10px; }
.user-chip { display: flex; align-items: center; gap: 11px; padding: 12px; border-radius: 16px; background: rgba(255, 255, 255, .07); }
.avatar {
  width: 38px; height: 38px; border-radius: 50%; flex: none; display: grid; place-items: center;
  font-weight: 800; color: #fff; background: linear-gradient(135deg, #8b7bff, #7c3aed); font-size: 15px;
}
.user-chip strong { display: block; font-size: 14px; }
.user-chip span { font-size: 12px; color: #b5b2e6; }
.sidebar .logout { color: #fca5a5; }
.sidebar .logout:hover { background: rgba(252, 165, 165, .12); color: #fecaca; }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 14px;
  padding: 16px 32px; background: rgba(246, 245, 253, .88); backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(232, 230, 244, .8);
}
.topbar .menu-btn { display: none; }
.topbar .page-title { font-size: 17px; font-weight: 800; }
.topbar .crumb { color: var(--muted); font-size: 13px; }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 12px; }
.badge-limited {
  display: inline-flex; align-items: center; gap: 6px; padding: 6px 11px; border-radius: 999px;
  background: var(--orange-bg); color: var(--orange); font-size: 12px; font-weight: 700;
}
.badge-limited svg { width: 14px; height: 14px; }
.badge-role { display: inline-flex; padding: 6px 11px; border-radius: 999px; background: var(--violet-100); color: #4c1d95; font-size: 12px; font-weight: 700; }
.topbar .today { font-size: 13px; color: var(--muted); font-weight: 500; }
.topbar .avatar { width: 36px; height: 36px; font-size: 14px; }

.content { padding: 28px 32px 110px; overflow-x: clip; }
.view { display: grid; gap: 22px; animation: fadeIn .25s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
.view-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.view-head h1 { font-size: 28px; font-weight: 800; letter-spacing: -.03em; }
.view-head p { color: var(--muted); margin-top: 4px; }
.view-head .actions { display: flex; gap: 10px; flex-wrap: wrap; }

.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 22px; min-width: 0; border: 1px solid rgba(232, 230, 244, .6); }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.card-head h2 { font-size: 17px; font-weight: 800; }
.card-head p { color: var(--muted); font-size: 13px; margin-top: 2px; }
.card-pad-0 { padding: 0; }
.card-pad-0 .card-head { padding: 20px 22px 0; }

/* stats */
.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 18px; }
.stat { display: flex; align-items: center; gap: 16px; }
.stat-icon { width: 52px; height: 52px; border-radius: 16px; display: grid; place-items: center; flex: none; }
.stat-icon svg { width: 24px; height: 24px; }
.si-violet { background: var(--violet-100); color: var(--violet-600); }
.si-indigo { background: #e0e7ff; color: #4338ca; }
.si-red { background: var(--red-bg); color: var(--red); }
.si-green { background: var(--green-bg); color: var(--green); }
.stat .label { font-size: 13px; color: var(--muted); font-weight: 600; }
.stat .value { font-size: 30px; font-weight: 800; letter-spacing: -.03em; line-height: 1.1; font-variant-numeric: tabular-nums; }
.stat .value.sm { font-size: 24px; }
.stat .trend { font-size: 12px; font-weight: 600; color: var(--muted); }
.trend.up { color: var(--green); }
.trend.down { color: var(--red); }

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

/* bar chart */
.chart { position: relative; height: 240px; margin-top: 6px; }
.chart.tall { height: 300px; }
.chart .grid { position: absolute; left: 0; right: 0; top: 10px; bottom: 26px; display: flex; flex-direction: column; justify-content: space-between; }
.chart .gl { height: 0; border-top: 1px dashed #e4e1f3; position: relative; }
.chart .gl span { position: absolute; left: 0; top: -9px; font-size: 11px; color: var(--muted); background: #fff; padding-right: 6px; line-height: 18px; }
.chart .bars { position: absolute; left: 38px; right: 0; top: 10px; bottom: 0; display: flex; gap: 4px; }
.bcol { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.btrack { position: relative; flex: 1; }
.bar {
  position: absolute; bottom: 0; left: 50%; transform: translateX(-50%);
  width: 62%; max-width: 34px; min-height: 3px; border-radius: 8px 8px 3px 3px;
  background: linear-gradient(180deg, #a99cff 0%, #8b7bff 100%); cursor: pointer; transition: filter .15s, background .15s;
}
.bar.cur { background: linear-gradient(180deg, #8b5cf6 0%, var(--violet-600) 100%); }
.bar:hover, .bar:focus { filter: brightness(.92); outline: none; }
.bar:focus-visible { box-shadow: 0 0 0 3px rgba(109, 93, 252, .4); }
.bar::after {
  content: attr(data-tip); position: absolute; bottom: calc(100% + 8px); left: 50%; transform: translateX(-50%);
  background: var(--navy-900); color: #fff; font-size: 12px; font-weight: 600; padding: 6px 9px; border-radius: 8px;
  white-space: nowrap; opacity: 0; pointer-events: none; transition: opacity .15s; z-index: 5;
  box-shadow: 0 6px 16px rgba(21, 18, 58, .25);
}
.bar.tl::after { left: 0; transform: none; }
.bar.tr::after { left: auto; right: 0; transform: none; }
.bar:hover::after, .bar:focus::after { opacity: 1; }
.blabel { height: 26px; line-height: 26px; text-align: center; font-size: 11.5px; color: var(--muted); font-weight: 600; overflow: hidden; }
.chart-legend { display: flex; gap: 16px; font-size: 12.5px; color: var(--muted); flex-wrap: wrap; }
.chart-legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }

/* tables */
.table-wrap { position: relative; overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table { width: 100%; border-collapse: collapse; font-size: 14px; min-width: 620px; }
.table th {
  text-align: left; font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .07em;
  color: var(--muted); padding: 12px 14px; border-bottom: 1px solid var(--border); white-space: nowrap; background: #fcfbff;
}
.table td { padding: 13px 14px; border-bottom: 1px solid #f0eef8; vertical-align: middle; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr:hover td { background: #fbfaff; }
.table .id { font-weight: 700; white-space: nowrap; }
.table .cust strong { display: block; font-weight: 600; }
.table .cust span { font-size: 12.5px; color: var(--muted); }
.table td.actions { white-space: nowrap; text-align: right; }
.table td.actions .btn + .btn { margin-left: 6px; }
.table tr.row-low td { background: #fff6f6; }
.table tr.row-low td:first-child { box-shadow: inset 3px 0 0 var(--red); }
.table tr.row-low:hover td { background: #ffeeee; }
.table tfoot td { font-weight: 800; border-top: 1px solid var(--border); background: #fcfbff; }
.link-row { display: block; border: 0; background: none; padding: 0; text-align: left; color: inherit; font-weight: 700; }
#quote-form-card { scroll-margin-top: 90px; }
.link-row:hover { color: var(--violet-600); text-decoration: underline; }
.empty { text-align: center; color: var(--muted); padding: 30px 14px !important; }
.stock-bar { width: 70px; height: 6px; border-radius: 6px; background: #eeecf7; overflow: hidden; margin-top: 5px; }
.stock-bar i { display: block; height: 100%; background: var(--green); border-radius: 6px; }
.row-low .stock-bar i { background: var(--red); }

/* toolbar */
.toolbar { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; padding: 0 22px 16px; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip {
  border: 1px solid var(--border); background: #fff; border-radius: 999px; padding: 7px 13px;
  font-size: 13px; font-weight: 600; color: var(--muted); display: inline-flex; gap: 7px; align-items: center;
}
.chip b { font-size: 11.5px; background: var(--gray-bg); border-radius: 999px; padding: 0 7px; color: var(--muted); }
.chip:hover { border-color: #cfc9f3; color: var(--text); }
.chip[aria-pressed="true"] { background: var(--navy-900); border-color: var(--navy-900); color: #fff; }
.chip[aria-pressed="true"] b { background: rgba(255, 255, 255, .18); color: #fff; }
.search { position: relative; flex: 1; min-width: 200px; max-width: 360px; }
.search svg { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); width: 17px; height: 17px; color: var(--muted); pointer-events: none; }
.search input { padding-left: 38px; }
.check { display: inline-flex; align-items: center; gap: 8px; font-size: 13.5px; font-weight: 600; color: #3b3960; cursor: pointer; }
.check input { width: 17px; height: 17px; accent-color: var(--violet); margin: 0; }

/* lists */
.mini-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.mini-list li { display: flex; align-items: center; gap: 12px; padding: 10px 4px; border-bottom: 1px solid #f0eef8; }
.mini-list li:last-child { border-bottom: 0; }
.mini-list .ml-icon { width: 38px; height: 38px; border-radius: 12px; flex: none; display: grid; place-items: center; background: var(--red-bg); color: var(--red); }
.mini-list .ml-icon svg { width: 18px; height: 18px; }
.mini-list .ml-main { flex: 1; min-width: 0; }
.mini-list .ml-main strong { display: block; font-size: 14px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mini-list .ml-main span { font-size: 12.5px; color: var(--muted); }
.mini-list .ml-val { font-weight: 800; color: var(--red); font-size: 15px; white-space: nowrap; }

/* quote form */
.lines { width: 100%; border-collapse: collapse; min-width: 560px; }
.lines th { text-align: left; font-size: 12px; font-weight: 700; color: var(--muted); padding: 0 6px 8px; text-transform: uppercase; letter-spacing: .06em; }
.lines td { padding: 5px 6px; vertical-align: middle; }
.lines input { width: 100%; border: 1px solid #dcd9ee; border-radius: 10px; padding: 9px 11px; font-size: 14px; background: #fff; }
.lines input:focus { outline: none; border-color: var(--violet); box-shadow: 0 0 0 3px rgba(109, 93, 252, .15); }
.lines .c-q { width: 90px; }
.lines .c-p { width: 140px; }
.lines .c-t { width: 120px; }
.lines .c-x { width: 46px; }
.lines td.ql-t { font-weight: 700; text-align: right; white-space: nowrap; }
.totals { margin-left: auto; width: 100%; max-width: 320px; display: grid; gap: 8px; margin-top: 8px; }
.totals div { display: flex; justify-content: space-between; font-size: 14.5px; }
.totals span { color: var(--muted); }
.totals .grand { border-top: 1px solid var(--border); padding-top: 10px; font-size: 18px; }
.totals .grand span { color: var(--text); font-weight: 700; }
.totals .grand strong { color: var(--violet-600); font-weight: 800; }
.qf-foot { display: flex; justify-content: space-between; align-items: flex-start; gap: 20px; flex-wrap: wrap; margin-top: 14px; }

/* report bits */
.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 18px; }
.kpi .label { font-size: 13px; color: var(--muted); font-weight: 600; }
.kpi .value { font-size: 24px; font-weight: 800; letter-spacing: -.02em; margin-top: 4px; font-variant-numeric: tabular-nums; }
.kpi .sub { font-size: 12px; color: var(--muted); }
.hbars { list-style: none; margin: 0; padding: 0; display: grid; gap: 14px; }
.hbars .hb-top { display: flex; justify-content: space-between; gap: 10px; font-size: 13.5px; }
.hbars .hb-top strong { font-weight: 600; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hbars .hb-top span { font-weight: 700; white-space: nowrap; font-variant-numeric: tabular-nums; }
.hbars .hb-track { height: 9px; background: #efedf9; border-radius: 9px; margin-top: 6px; overflow: hidden; }
.hbars .hb-track i { display: block; height: 100%; border-radius: 9px; background: linear-gradient(90deg, #8b7bff, var(--violet-600)); }
.hbars .hb-sub { font-size: 12px; color: var(--muted); margin-top: 3px; }

/* settings */
.settings-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 22px; align-items: start; }
.settings-grid .span-2 { grid-column: 1 / -1; }
.perm-table td, .perm-table th { text-align: center; }
.perm-table td:first-child, .perm-table th:first-child { text-align: left; }
.perm-table input { width: 18px; height: 18px; accent-color: var(--violet); }
.role-tag { display: inline-flex; padding: 3px 9px; border-radius: 999px; font-size: 12px; font-weight: 700; }
.role-owner { background: var(--violet-100); color: #5b21b6; }
.role-manager { background: #e0e7ff; color: #3730a3; }
.role-staff { background: var(--gray-bg); color: #55536f; }
.backup { display: grid; gap: 12px; }
.backup-row { display: flex; align-items: center; gap: 14px; padding: 14px; border-radius: 14px; background: #faf9ff; border: 1px solid var(--border); }
.backup-row .bi { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; background: var(--green-bg); color: var(--green); flex: none; }
.backup-row .bi.v { background: var(--violet-100); color: var(--violet-600); }
.backup-row .bi svg { width: 20px; height: 20px; }
.backup-row strong { display: block; font-size: 14px; }
.backup-row span { font-size: 12.5px; color: var(--muted); }
.danger-zone { display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; border: 1px solid #f5c2c2; background: #fffafa; }
.danger-zone h2 { font-size: 16px; font-weight: 800; }
.danger-zone p { color: var(--muted); font-size: 13.5px; margin-top: 3px; }
.note { font-size: 12.5px; color: var(--muted); background: var(--violet-50); border-radius: 12px; padding: 10px 12px; margin-top: 14px; }

/* overlays */
.overlay { position: fixed; inset: 0; background: rgba(15, 13, 40, .5); z-index: 60; animation: fadeIn .2s; }
body.no-scroll { overflow: hidden; }

/* side panel (CRM) */
.side-panel {
  position: fixed; top: 0; right: 0; bottom: 0; width: 440px; max-width: 100%; z-index: 70;
  background: #fff; box-shadow: var(--shadow-lg); display: flex; flex-direction: column;
  transform: translateX(100%); visibility: hidden; transition: transform .3s ease, visibility 0s linear .3s;
}
.side-panel.open { transform: none; visibility: visible; transition: transform .3s ease; }
.sp-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 18px 22px; border-bottom: 1px solid var(--border); }
.sp-head h2 { font-size: 16px; font-weight: 800; }
.sp-body { padding: 22px; overflow-y: auto; flex: 1; display: grid; gap: 20px; align-content: start; }
.cp-hero { display: flex; gap: 14px; align-items: center; }
.cp-hero .avatar { width: 54px; height: 54px; font-size: 19px; border-radius: 16px; }
.cp-hero h3 { font-size: 19px; font-weight: 800; }
.cp-hero p { color: var(--muted); font-size: 13.5px; }
.cp-meta { display: grid; gap: 8px; font-size: 13.5px; }
.cp-meta div { display: flex; gap: 10px; }
.cp-meta dt { width: 70px; flex: none; color: var(--muted); }
.cp-meta dd { margin: 0; font-weight: 600; word-break: break-word; }
.cp-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.cp-stats div { background: #faf9ff; border: 1px solid var(--border); border-radius: 14px; padding: 12px; }
.cp-stats span { display: block; font-size: 11.5px; color: var(--muted); font-weight: 600; }
.cp-stats strong { font-size: 15px; font-weight: 800; }
.cp-section h4 { font-size: 13px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin-bottom: 8px; }
.history { list-style: none; margin: 0; padding: 0; border: 1px solid var(--border); border-radius: 14px; overflow: hidden; }
.history li { display: flex; align-items: center; gap: 10px; padding: 11px 13px; border-bottom: 1px solid #f0eef8; font-size: 13.5px; }
.history li:last-child { border-bottom: 0; }
.history .h-main { flex: 1; min-width: 0; }
.history .h-main strong { display: block; }
.history .h-main span { color: var(--muted); font-size: 12.5px; }
.history .h-amt { font-weight: 700; white-space: nowrap; }

/* modal */
.modal { position: fixed; inset: 0; z-index: 90; display: flex; align-items: flex-start; justify-content: center; padding: 32px 16px; overflow-y: auto; }
.modal-backdrop { position: fixed; inset: 0; background: rgba(15, 13, 40, .55); }
.modal-dialog { position: relative; width: 100%; max-width: 780px; background: var(--bg); border-radius: 22px; box-shadow: var(--shadow-lg); animation: pop .2s ease; }
@keyframes pop { from { opacity: 0; transform: translateY(10px) scale(.98); } to { opacity: 1; transform: none; } }
.modal-bar { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 16px 20px; flex-wrap: wrap; }
.modal-bar h2 { font-size: 16px; font-weight: 800; }
.modal-bar .mb-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.modal-body { padding: 0 20px 20px; }

/* printable invoice */
.invoice-doc { background: #fff; border-radius: 16px; padding: 40px; color: #1c1a3a; box-shadow: var(--shadow); position: relative; overflow: hidden; }
.inv-top { display: flex; justify-content: space-between; gap: 24px; flex-wrap: wrap; padding-bottom: 24px; border-bottom: 3px solid var(--violet); }
.inv-top .wordmark { color: var(--navy-900); }
.inv-biz { font-size: 12.5px; color: var(--muted); margin-top: 12px; line-height: 1.6; }
.inv-title { text-align: right; }
.inv-title h3 { font-size: 30px; font-weight: 800; letter-spacing: .08em; color: var(--navy-900); }
.inv-title dl { margin: 10px 0 0; display: grid; grid-template-columns: auto auto; gap: 3px 14px; font-size: 13px; justify-content: end; }
.inv-title dt { color: var(--muted); }
.inv-title dd { margin: 0; font-weight: 700; text-align: right; }
.inv-parties { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; margin: 24px 0; font-size: 13.5px; line-height: 1.6; }
.inv-parties h4 { font-size: 11px; text-transform: uppercase; letter-spacing: .12em; color: var(--violet-600); margin-bottom: 6px; }
.inv-items { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.inv-items th { text-align: left; background: var(--navy-900); color: #fff; padding: 10px 12px; font-size: 11.5px; text-transform: uppercase; letter-spacing: .08em; }
.inv-items th:first-child { border-radius: 8px 0 0 8px; }
.inv-items th:last-child { border-radius: 0 8px 8px 0; }
.inv-items td { padding: 11px 12px; border-bottom: 1px solid #eeecf6; }
.inv-items .num { text-align: right; }
.inv-sum { display: flex; justify-content: flex-end; margin-top: 16px; }
.inv-sum dl { margin: 0; width: 100%; max-width: 280px; display: grid; grid-template-columns: 1fr auto; gap: 7px 0; font-size: 14px; }
.inv-sum dt { color: var(--muted); }
.inv-sum dd { margin: 0; padding-left: 16px; text-align: right; font-weight: 600; font-variant-numeric: tabular-nums; }
.inv-sum .gt { border-top: 2px solid var(--navy-900); padding-top: 9px; font-size: 17px; font-weight: 800; color: var(--navy-900); }
.inv-foot { margin-top: 30px; padding-top: 16px; border-top: 1px solid #eeecf6; font-size: 12.5px; color: var(--muted); display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.stamp {
  position: absolute; bottom: 96px; left: 44px; transform: rotate(-12deg);
  border: 3px solid currentColor; border-radius: 10px; padding: 4px 14px; font-weight: 800; font-size: 22px; letter-spacing: .12em; opacity: .22;
}
.stamp.paid { color: var(--green); }
.stamp.overdue { color: var(--red); }
.stamp.open { color: var(--orange); }

/* toasts (bottom-left, clear of the chat button) */
.toasts { position: fixed; left: 20px; bottom: 20px; z-index: 120; display: grid; gap: 10px; max-width: min(380px, calc(100vw - 110px)); }
.toast {
  display: flex; align-items: center; gap: 10px; background: var(--navy-900); color: #fff;
  border-radius: 14px; padding: 12px 14px; font-size: 13.5px; font-weight: 500; box-shadow: var(--shadow-lg);
  opacity: 0; transform: translateY(10px); transition: opacity .25s, transform .25s;
}
.toast.show { opacity: 1; transform: none; }
.toast .t-ico { width: 24px; height: 24px; border-radius: 50%; flex: none; display: grid; place-items: center; background: rgba(74, 222, 128, .18); color: #4ade80; }
.toast.warn .t-ico { background: rgba(251, 146, 60, .2); color: #fdba74; }
.toast .t-ico svg { width: 14px; height: 14px; }
.toast .t-act { margin-left: auto; border: 0; background: rgba(255, 255, 255, .14); color: #fff; font-weight: 700; font-size: 12.5px; padding: 6px 10px; border-radius: 8px; white-space: nowrap; }
.toast .t-act:hover { background: rgba(255, 255, 255, .24); }

/* ---------- Responsive ---------- */
@media (max-width: 1180px) {
  .stats, .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-2-1 { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 960px) {
  .login-wrap { grid-template-columns: minmax(0, 1fr); }
  .login-brand { padding: 32px 24px; gap: 22px; }
  .brand-preview { margin-top: 0; }
  .login-panel { padding: 32px 20px 100px; }
  .grid-2, .settings-grid { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 900px) {
  .app { grid-template-columns: minmax(0, 1fr); background: none; min-height: 100vh; }
  .sidebar {
    position: fixed; top: 0; left: 0; bottom: 0; height: auto; width: 284px; max-width: 86vw; z-index: 80;
    transform: translateX(-100%); visibility: hidden; transition: transform .3s ease, visibility 0s linear .3s;
    box-shadow: var(--shadow-lg);
  }
  .sidebar.open { transform: none; visibility: visible; transition: transform .3s ease; }
  .topbar { background: var(--navy-900); color: #fff; border-bottom: 0; padding: 12px 16px; backdrop-filter: none; }
  .topbar .menu-btn { display: inline-grid; background: rgba(255, 255, 255, .1); border-color: transparent; color: #fff; }
  .topbar .crumb, .topbar .today { display: none; }
  .badge-role { background: rgba(255, 255, 255, .14); color: #fff; }
  .content { padding: 20px 16px 110px; }
}
@media (max-width: 760px) {
  .login-brand .feature-list, .login-brand .lead { display: none; }
  .login-brand h1 { font-size: 24px; }
  .brand-preview { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
  .bp-card { padding: 10px; }
  .bp-card strong { font-size: 18px; }
  .form-grid { grid-template-columns: minmax(0, 1fr); }
  .view-head h1 { font-size: 23px; }
  .card { padding: 18px; border-radius: 16px; }
  .card-pad-0 { padding: 0; }
  .card-pad-0 .card-head { padding: 18px 18px 0; }
  .toolbar { padding: 0 18px 14px; }
  .search { max-width: none; }
  .stats { gap: 12px; }
  .stat { flex-direction: column; align-items: flex-start; gap: 10px; }
  .stat-icon { width: 42px; height: 42px; border-radius: 13px; }
  .stat-icon svg { width: 20px; height: 20px; }
  .stat .value { font-size: 25px; }
  .stat .value.sm { font-size: 19px; }
  .kpis { gap: 12px; }
  .kpi .value { font-size: 19px; }
  .chart { height: 210px; }
  .chart.tall { height: 240px; }
  .chart .bars { left: 30px; gap: 2px; }
  .bar { width: 70%; border-radius: 5px 5px 2px 2px; }
  .blabel { font-size: 10px; }
  .invoice-doc { padding: 22px; }
  .inv-title { text-align: left; }
  .inv-title dl { justify-content: start; }
  .inv-title dd { text-align: left; }
  .inv-parties { grid-template-columns: minmax(0, 1fr); gap: 14px; }
  .stamp { bottom: 70px; left: 22px; font-size: 16px; }
  .inv-items-wrap { overflow-x: auto; }
  .inv-items { min-width: 460px; }
  .modal { padding: 12px 8px; }
  .modal-body { padding: 0 10px 12px; }
  .modal-bar { padding: 12px 12px; }
  .toasts { left: 12px; bottom: 16px; }
}
@media (max-width: 400px) {
  .topbar .badge-role { display: none; }
  .stat .value { font-size: 22px; }
}

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

/* ---------- Print: only the invoice ---------- */
@media print {
  * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  @page { margin: 12mm; }
  body.modal-open { background: #fff; overflow: visible; }
  body.modal-open > *:not(#inv-modal) { display: none !important; }
  body.modal-open #inv-modal { position: static; display: block; padding: 0; overflow: visible; }
  #inv-modal .modal-backdrop, #inv-modal .modal-bar { display: none !important; }
  #inv-modal .modal-dialog { box-shadow: none; max-width: none; background: #fff; border-radius: 0; animation: none; }
  #inv-modal .modal-body { padding: 0; }
  .invoice-doc { box-shadow: none; padding: 0; border-radius: 0; }
  .inv-items { min-width: 0 !important; }
}
