/* Blue Boa Office — design system
   Brand: cyan #00E5D1 on black/white. Dark sidebar, light workspace.
   Fonts: Space Grotesk (display) · Inter (body) · IBM Plex Mono (numerals/captions) */

:root {
  --cyan: #00E5D1;
  --cyan-dim: #00BFAE;
  --teal: #0B8577;        /* interactive text on light — 4.5:1 */
  --ink: #0C1211;
  --ink-2: #37413F;
  --muted: #5C6664;
  --paper: #F4F7F6;
  --card: #FFFFFF;
  --line: #E2E8E6;
  --line-strong: #C9D2D0;
  --side-bg: #0A100F;
  --side-line: #1C2523;
  --ok: #147D48;   --ok-bg: #E3F4EB;
  --warn: #8A5A00; --warn-bg: #FCF0D8;
  --bad: #B3261E;  --bad-bg: #FBE7E5;
  --info: #0B6E85; --info-bg: #E1F2F7;
  --neutral: #4C5654; --neutral-bg: #ECF0EF;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(12, 18, 17, .05), 0 4px 16px rgba(12, 18, 17, .06);
  --font-body: 'Inter', system-ui, -apple-system, sans-serif;
  --font-display: 'Space Grotesk', var(--font-body);
  --font-mono: 'IBM Plex Mono', ui-monospace, monospace;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.55;
  color: var(--ink);
  background: var(--paper);
  min-height: 100vh;
}

a { color: var(--teal); text-decoration: none; }
a:hover { text-decoration: underline; }
:focus-visible { outline: 2px solid var(--cyan-dim); outline-offset: 2px; border-radius: 4px; }

h1, h2, h3 { font-family: var(--font-display); letter-spacing: -.01em; }
h1 { font-size: 24px; font-weight: 600; }
h2 { font-size: 18px; font-weight: 600; }
h3 { font-size: 15px; font-weight: 600; }

.mono, .num { font-family: var(--font-mono); font-size: .92em; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.right { text-align: right; }
.nowrap { white-space: nowrap; }

/* ---------------------------------------------------------------- layout */
.shell { display: flex; min-height: 100vh; }

.sidebar {
  width: 232px; flex-shrink: 0;
  background: var(--side-bg); color: #C7D2D0;
  display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh;
}
.side-brand {
  display: flex; align-items: center; gap: 10px;
  padding: 18px 18px 16px; border-bottom: 1px solid var(--side-line);
}
.side-brand img { width: 90px; height: 90px; object-fit: contain; }
.side-brand b {
  font-family: var(--font-display); font-size: 15px; color: #fff; font-weight: 600;
}
.side-brand span { color: var(--cyan); }
.side-nav { padding: 12px 10px; flex: 1; overflow-y: auto; }
.side-nav a {
  display: flex; align-items: center; gap: 11px;
  padding: 10px 12px; margin: 2px 0;
  border-radius: 8px; color: #A9B6B3; font-size: 14px; font-weight: 500;
  min-height: 40px;
}
.side-nav a:hover { background: #131B1A; color: #fff; text-decoration: none; }
.side-nav a.active { background: #14201E; color: var(--cyan); }
.side-nav a.active svg { stroke: var(--cyan); }
.side-nav svg { width: 18px; height: 18px; stroke: currentColor; flex-shrink: 0; }
.side-sep { border-top: 1px solid var(--side-line); margin: 10px 12px; }
.side-user {
  padding: 14px 18px; border-top: 1px solid var(--side-line);
  font-size: 13px;
}
.side-user b { color: #fff; display: block; font-weight: 600; }
.side-user .role { color: var(--cyan); font-family: var(--font-mono); font-size: 11px; text-transform: uppercase; letter-spacing: .06em; }
.side-user a { color: #A9B6B3; margin-right: 10px; }

.main { flex: 1; min-width: 0; padding: 26px 30px 60px; }
.page-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; flex-wrap: wrap; margin-bottom: 20px;
}
.page-head .sub { color: var(--muted); font-size: 13px; margin-top: 2px; }

/* mobile */
.menu-btn { display: none; }
@media (max-width: 860px) {
  .shell { flex-direction: column; }
  .sidebar { width: 100%; height: auto; position: static; }
  .side-nav { display: none; padding-bottom: 8px; }
  .sidebar.open .side-nav { display: block; }
  .side-user { display: none; }
  .sidebar.open .side-user { display: block; }
  .menu-btn {
    display: inline-flex; align-items: center; justify-content: center;
    margin-left: auto; margin-right: 14px;
    background: none; border: 1px solid var(--side-line); border-radius: 8px;
    width: 44px; height: 44px; cursor: pointer;
  }
  .menu-btn svg { stroke: #C7D2D0; width: 20px; height: 20px; }
  .side-brand { border-bottom: 0; }
  .sidebar { display: flex; flex-direction: column; }
  .side-top { display: flex; align-items: center; border-bottom: 1px solid var(--side-line); }
  .main { padding: 18px 14px 50px; }
}
@media (min-width: 861px) { .side-top { display: contents; } }

/* ---------------------------------------------------------------- cards */
.card {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 20px; margin-bottom: 18px;
}
.card h2 { margin-bottom: 14px; }
.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: 1fr 1fr; }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 1100px) { .grid-4 { grid-template-columns: 1fr 1fr; } }
@media (max-width: 700px) { .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; } }

/* KPI tiles */
.kpi { padding: 16px 18px; }
.kpi .label {
  font-family: var(--font-mono); font-size: 11px; letter-spacing: .08em;
  text-transform: uppercase; color: var(--muted);
}
.kpi .value { font-family: var(--font-display); font-size: 26px; font-weight: 600; margin-top: 4px; }
.kpi .value.accent { color: var(--teal); }
.kpi .hint { font-size: 12px; color: var(--muted); margin-top: 2px; }

/* ---------------------------------------------------------------- buttons */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  font: 600 14px var(--font-body);
  padding: 0 16px; height: 40px;
  border-radius: 8px; border: 1px solid var(--line-strong);
  background: var(--card); color: var(--ink);
  cursor: pointer; transition: background .18s, border-color .18s, color .18s;
  text-decoration: none !important; white-space: nowrap;
}
.btn:hover { background: var(--paper); border-color: var(--muted); }
.btn svg { width: 16px; height: 16px; stroke: currentColor; }
.btn-primary { background: var(--ink); border-color: var(--ink); color: var(--cyan); }
.btn-primary:hover { background: #1A2422; border-color: #1A2422; }
.btn-danger { color: var(--bad); border-color: #E5B5B2; }
.btn-danger:hover { background: var(--bad-bg); border-color: var(--bad); }
.btn-sm { height: 32px; padding: 0 11px; font-size: 13px; border-radius: 7px; }
.btn[disabled] { opacity: .55; cursor: not-allowed; }
.btn-icon { padding: 0; width: 40px; justify-content: center; }

/* ---------------------------------------------------------------- badges */
.badge {
  display: inline-flex; align-items: center; gap: 6px;
  font: 600 12px var(--font-body);
  padding: 3px 10px; border-radius: 999px; white-space: nowrap;
}
.badge::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.b-draft, .b-new       { color: var(--neutral); background: var(--neutral-bg); }
.b-sent, .b-contacted  { color: var(--info); background: var(--info-bg); }
.b-proposal            { color: var(--warn); background: var(--warn-bg); }
.b-accepted, .b-paid, .b-won, .b-active { color: var(--ok); background: var(--ok-bg); }
.b-declined, .b-overdue, .b-lost, .b-cancelled { color: var(--bad); background: var(--bad-bg); }
.b-expired, .b-archived { color: var(--warn); background: var(--warn-bg); }

/* ---------------------------------------------------------------- tables */
.table-wrap { overflow-x: auto; }
table.list { width: 100%; border-collapse: collapse; font-size: 14px; }
table.list th {
  font-family: var(--font-mono); font-size: 11px; letter-spacing: .07em;
  text-transform: uppercase; color: var(--muted); font-weight: 500;
  text-align: left; padding: 8px 12px; border-bottom: 1px solid var(--line-strong);
  white-space: nowrap;
}
table.list td { padding: 11px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.list tr:hover td { background: #F8FBFA; }
table.list a.rowlink { font-weight: 600; color: var(--ink); }
table.list a.rowlink:hover { color: var(--teal); }
table.list td.num, table.list th.num { text-align: right; font-family: var(--font-mono); }
.empty {
  text-align: center; color: var(--muted); padding: 40px 20px; font-size: 14px;
}

/* ---------------------------------------------------------------- forms */
label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 5px; }
label .opt { color: var(--muted); font-weight: 400; }
input[type=text], input[type=email], input[type=password], input[type=number],
input[type=date], input[type=file], select, textarea {
  width: 100%; font: 400 14px var(--font-body); color: var(--ink);
  background: #fff; border: 1px solid var(--line-strong); border-radius: 8px;
  padding: 9px 12px; min-height: 40px;
  transition: border-color .15s;
}
textarea { min-height: 80px; resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: var(--cyan-dim); outline: none; box-shadow: 0 0 0 3px rgba(0, 229, 209, .18); }
.field { margin-bottom: 14px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 18px; }
@media (max-width: 700px) { .form-grid { grid-template-columns: 1fr; } }
.form-actions { display: flex; gap: 10px; margin-top: 18px; flex-wrap: wrap; }
.check { display: flex; align-items: center; gap: 9px; font-size: 14px; font-weight: 500; cursor: pointer; }
.check input { width: 18px; height: 18px; min-height: 0; accent-color: var(--teal); }

.flash {
  background: var(--ink); color: var(--cyan);
  border-radius: 8px; padding: 11px 16px; margin-bottom: 16px;
  font-size: 14px; font-weight: 500;
}
.error-box {
  background: var(--bad-bg); color: var(--bad);
  border: 1px solid #E5B5B2; border-radius: 8px;
  padding: 11px 16px; margin-bottom: 16px; font-size: 14px;
}

/* filter bar */
.filters {
  display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; margin-bottom: 16px;
}
.filters .field { margin: 0; }
.filters input, .filters select { min-width: 130px; }
.filters label { font-size: 11px; font-family: var(--font-mono); text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }

/* ---------------------------------------------------------------- kanban */
.kanban { display: grid; grid-template-columns: repeat(5, 1fr); gap: 12px; align-items: start; }
@media (max-width: 1100px) { .kanban { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 640px) { .kanban { grid-template-columns: 1fr; } }
.kcol {
  background: #EDF1F0; border-radius: var(--radius); padding: 10px; min-height: 120px;
  border-top: 3px solid var(--line-strong);
}
.kcol[data-stage=new] { border-top-color: var(--neutral); }
.kcol[data-stage=contacted] { border-top-color: var(--info); }
.kcol[data-stage=proposal] { border-top-color: var(--warn); }
.kcol[data-stage=won] { border-top-color: var(--ok); }
.kcol[data-stage=lost] { border-top-color: var(--bad); }
.kcol h3 {
  font-family: var(--font-mono); font-size: 11px; text-transform: uppercase;
  letter-spacing: .08em; color: var(--ink-2); padding: 2px 4px 10px;
  display: flex; justify-content: space-between;
}
.kcard {
  background: #fff; border: 1px solid var(--line); border-radius: 8px;
  padding: 10px 12px; margin-bottom: 8px; cursor: grab; box-shadow: var(--shadow);
}
.kcard b { display: block; font-size: 14px; }
.kcard .kv { font-family: var(--font-mono); font-size: 12px; color: var(--teal); }
.kcard .kc { font-size: 12px; color: var(--muted); }
.kcard.dragging { opacity: .5; }
.kcol.dragover { outline: 2px dashed var(--cyan-dim); outline-offset: -4px; }

/* ---------------------------------------------------------------- misc */
.doc-total-row td { font-weight: 700; border-top: 2px solid var(--ink); }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line-strong); margin-bottom: 20px; flex-wrap: wrap; }
.tabs a {
  padding: 9px 16px; font-size: 14px; font-weight: 600; color: var(--muted);
  border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.tabs a:hover { color: var(--ink); text-decoration: none; }
.tabs a.active { color: var(--teal); border-bottom-color: var(--cyan); }

.detail-list { font-size: 14px; }
.detail-list div { display: flex; padding: 7px 0; border-bottom: 1px solid var(--line); gap: 12px; }
.detail-list dt { width: 130px; flex-shrink: 0; color: var(--muted); font-size: 13px; }
.detail-list dd { margin: 0; }

.receipt-thumb { width: 46px; height: 46px; object-fit: cover; border-radius: 6px; border: 1px solid var(--line); }

/* login screen */
.login-wrap {
  min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center;
  background: var(--side-bg); padding: 20px;
}
.login-hero { display: flex; flex-direction: column; align-items: center; gap: 10px; margin-bottom: 30px; }
.login-hero img { width: 170px; height: 170px; object-fit: contain; }
.login-hero b { font-family: var(--font-display); font-size: 20px; color: #fff; letter-spacing: .04em; }
.login-hero span { color: var(--cyan); }
.login-card {
  width: 100%; max-width: 400px; background: #fff; border-radius: 14px;
  padding: 34px 32px; box-shadow: 0 24px 60px rgba(0, 0, 0, .4);
}
.login-card .logo { display: flex; align-items: center; gap: 10px; margin-bottom: 22px; }
.login-card .logo img { width: 34px; height: 34px; }
.login-card .logo b { font-family: var(--font-display); font-size: 17px; }
.login-card .logo span { color: var(--cyan-dim); }
.login-card h1 { font-size: 19px; margin-bottom: 4px; }
.login-card .sub { color: var(--muted); font-size: 13px; margin-bottom: 20px; }
.login-card .btn { width: 100%; justify-content: center; height: 44px; margin-top: 4px; }
.login-links { margin-top: 16px; font-size: 13px; text-align: center; }
.totp-input { font-family: var(--font-mono); font-size: 22px; letter-spacing: .4em; text-align: center; }

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

/* ---------------------------------------------------------------- print (A4 documents & reports) */
@media print {
  body { background: #fff; }
  .sidebar, .page-head .actions, .no-print, .flash { display: none !important; }
  .main { padding: 0; }
  .card { border: none; box-shadow: none; padding: 0; }
  .pdf-page { page-break-after: always; }
}

/* ---------------------------------------------------------------- v2: view toggle, dots, shares */
.view-toggle { display: flex; margin: 0 14px 12px; background: var(--side-line); border-radius: 8px; padding: 3px; gap: 3px; }
.view-toggle a { flex: 1; text-align: center; font-size: 12px; font-weight: 600; color: #A9B6B3; padding: 6px 4px; border-radius: 6px; }
.view-toggle a.on { background: var(--cyan); color: var(--side-bg); }
.view-toggle a:hover { text-decoration: none; }

.dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; vertical-align: middle; margin-right: 6px; }
.dot-green { background: #1FA35E; } .dot-amber { background: #E8A317; } .dot-red { background: #D93025; }
.dot-grey { background: #A6B0AE; } .dot-blue { background: #2F7BD3; }
tr.st-red td:first-child { box-shadow: inset 3px 0 0 #D93025; }
tr.st-amber td:first-child { box-shadow: inset 3px 0 0 #E8A317; }
tr.st-green td:first-child { box-shadow: inset 3px 0 0 #1FA35E; }
tr.st-blue td:first-child { box-shadow: inset 3px 0 0 #2F7BD3; }
.badge.b-partial { color: var(--warn); background: var(--warn-bg); }
.badge.b-matched { color: var(--ok); background: var(--ok-bg); }
.badge.b-unmatched { color: var(--bad); background: var(--bad-bg); }
.badge.b-ignored { color: var(--info); background: var(--info-bg); }

.shares-box { border: 1px dashed var(--line-strong); border-radius: var(--radius); padding: 12px 14px; margin-top: 6px; }
.shares-box .row { display: flex; gap: 10px; align-items: center; margin-bottom: 8px; }
.shares-box .row select { flex: 1; }
.shares-box .row input { width: 90px; text-align: right; }
.shares-box .sum { font-family: var(--font-mono); font-size: 13px; color: var(--muted); }
.shares-box .sum.bad { color: var(--bad); font-weight: 600; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12.5px; color: var(--muted); margin: 6px 0 12px; }

.bank-row.sel { background: #F0FBFA; }
.bank-panel { border-left: 3px solid var(--cyan); }
.suggest { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; margin-bottom: 6px; }
.suggest .conf { font-family: var(--font-mono); font-size: 11px; text-transform: uppercase; letter-spacing: .08em; padding: 2px 7px; border-radius: 5px; }
.conf-strong { background: var(--ok-bg); color: var(--ok); } .conf-medium { background: var(--info-bg); color: var(--info); } .conf-weak { background: var(--neutral-bg); color: var(--neutral); }
.kpi .value.red { color: var(--bad); }

/* ---------------------------------------------------------------- v2: how-to steps */
details.howto { border: 1px solid var(--line); border-radius: var(--radius); background: var(--paper); padding: 0; }
details.howto summary { cursor: pointer; padding: 11px 14px; font-weight: 600; color: var(--teal); list-style: none; }
details.howto summary::-webkit-details-marker { display: none; }
details.howto[open] summary { border-bottom: 1px solid var(--line); }
details.howto .steps { padding: 12px 18px 6px 36px; font-size: 14px; }
details.howto .steps li { margin-bottom: 10px; line-height: 1.5; }
details.howto .steps li::marker { font-family: var(--font-mono); color: var(--teal); font-weight: 600; }
details.howto p { padding: 0 14px 12px; }
