/* =====================================================================
   Sales Leads Register — styles
   Deep-sea navy chrome, brass for targets, quiet white work surfaces.
   ===================================================================== */
:root {
  --ink: #102a38;
  --ink-2: #1b3d4f;
  --ink-3: #2c5568;
  --ground: #eef1f2;
  --paper: #ffffff;
  --text: #1b2830;
  --muted: #5d6e78;
  --line: #d8dee2;
  --line-soft: #e8ecee;
  --brass: #b07d2b;
  --brass-soft: #f4ead8;
  --teal: #1f7a8c;
  --teal-soft: #e1eff2;
  --good: #2e7d4f;
  --good-soft: #e3f1e8;
  --bad: #b4413b;
  --bad-soft: #f7e3e1;
  --warn: #a8661c;
  --warn-soft: #fbeedd;
  --radius: 6px;
  --font: "IBM Plex Sans", "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
  color: var(--text);
  background: var(--ground);
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3 { margin: 0; line-height: 1.25; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--teal); }
[hidden] { display: none !important; }
.num { font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
:focus-visible { outline: 2px solid var(--brass); outline-offset: 2px; }

/* ------------------------------------------------------------ buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 36px; padding: 0 14px;
  border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--paper); color: var(--text);
  font-weight: 500; cursor: pointer; white-space: nowrap;
}
.btn:hover { border-color: var(--ink-3); }
.btn:disabled { opacity: .55; cursor: default; }
.btn-primary { background: var(--ink); border-color: var(--ink); color: #fff; }
.btn-primary:hover { background: var(--ink-2); border-color: var(--ink-2); }
.btn-danger { color: var(--bad); border-color: #e6c4c1; }
.btn-danger:hover { background: var(--bad-soft); border-color: var(--bad); }
.btn-block { width: 100%; height: 42px; }
.btn-sm { height: 30px; padding: 0 10px; font-size: 13px; }
.link-btn {
  background: none; border: 0; padding: 0; cursor: pointer;
  color: inherit; text-decoration: underline; text-underline-offset: 3px;
}

/* ------------------------------------------------------------- fields */
.field { display: flex; flex-direction: column; gap: 4px; }
.field > span { font-size: 12.5px; font-weight: 500; color: var(--muted); }
.field input, .field select, .field textarea, .tool-input, .tool-select {
  height: 36px; padding: 0 10px;
  border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--paper); min-width: 0;
}
.field input, .field select, .field textarea { width: 100%; }
.field textarea { height: auto; min-height: 76px; padding: 8px 10px; resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus, .tool-input:focus, .tool-select:focus {
  outline: none; border-color: var(--teal); box-shadow: 0 0 0 3px var(--teal-soft);
}
.field .req { color: var(--bad); }
.form-error {
  margin: 0; padding: 8px 10px; border-radius: var(--radius);
  background: var(--bad-soft); color: var(--bad); font-size: 13px;
}

/* ============================================================== LOGIN */
.login-body { background: var(--ink); }
.login { display: grid; grid-template-columns: 1.1fr 1fr; min-height: 100vh; }
.login-art {
  position: relative; overflow: hidden; color: #fff;
  display: flex; align-items: flex-end; padding: 56px;
}
.soundings { position: absolute; inset: 0; width: 100%; height: 100%; color: rgba(255,255,255,.12); }
.soundings .bars rect { fill: rgba(255,255,255,.08); }
.soundings .trend { stroke: var(--brass); stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }
.login-art-text { position: relative; max-width: 30em; }
.login-art-text h1 { font-size: 34px; font-weight: 600; letter-spacing: -.01em; }
.login-art-text p { margin: 12px 0 0; color: rgba(255,255,255,.75); font-size: 16px; }
.login-panel { background: var(--paper); display: flex; align-items: center; justify-content: center; padding: 40px 24px; }
.login-form { width: 100%; max-width: 340px; display: flex; flex-direction: column; gap: 16px; }
.login-form h2 { font-size: 24px; font-weight: 600; }
.login-brand { padding-bottom: 26px; margin-bottom: 12px; border-bottom: 1px solid var(--line); }
.login-logo { display: block; width: 230px; max-width: 72%; height: auto; }
@media (max-width: 820px) { .login-logo { width: 190px; } }
.login-form p { margin: -8px 0 4px; }
@media (max-width: 820px) {
  .login { grid-template-columns: 1fr; }
  .login-art { min-height: 220px; padding: 28px; }
  .login-art-text h1 { font-size: 26px; }
}

/* ============================================================== SHELL */
.shell { display: grid; grid-template-columns: 236px 1fr; min-height: 100vh; }
.side {
  position: sticky; top: 0; height: 100vh;
  display: flex; flex-direction: column;
  background: var(--ink); color: #dfe8ec;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 20px 18px 18px; }
.brand svg rect { fill: rgba(255,255,255,.25); }
.brand svg path { stroke: var(--brass); }
.brand strong { display: block; color: #fff; font-size: 15px; font-weight: 600; }
.brand span { display: block; font-size: 12px; color: rgba(255,255,255,.55); }
.nav { display: flex; flex-direction: column; padding: 8px 10px; gap: 2px; flex: 1; }
.nav a {
  display: flex; align-items: center; justify-content: space-between;
  padding: 9px 12px; border-radius: var(--radius);
  color: rgba(255,255,255,.78); text-decoration: none; font-weight: 500;
}
.nav a:hover { background: rgba(255,255,255,.06); color: #fff; }
.nav a.active { background: var(--ink-2); color: #fff; box-shadow: inset 3px 0 0 var(--brass); }
.nav-count {
  min-width: 22px; padding: 0 6px; border-radius: 11px;
  background: var(--bad); color: #fff; font-size: 11.5px; text-align: center; line-height: 20px;
}
.side-foot { padding: 14px 18px 18px; border-top: 1px solid rgba(255,255,255,.08); }
.cur-switch { display: flex; align-items: center; gap: 0; margin: 0 18px 14px; font-size: 12.5px; color: rgba(255,255,255,.6); }
.cur-switch span { margin-right: auto; }
.cur-switch button {
  background: transparent; border: 1px solid rgba(255,255,255,.22); color: rgba(255,255,255,.8);
  padding: 4px 11px; font-size: 12px; font-weight: 600; cursor: pointer; letter-spacing: .02em;
}
.cur-switch button:first-of-type { border-radius: 4px 0 0 4px; }
.cur-switch button:last-of-type { border-radius: 0 4px 4px 0; border-left: 0; }
.cur-switch button.active { background: var(--brass); border-color: var(--brass); color: #fff; }
.fx-hint { font-size: 12px; color: var(--teal); margin-top: 3px; }
.rate-form { display: flex; align-items: flex-end; gap: 12px; flex-wrap: wrap; }
.rate-form .field { width: 220px; }
.rate-form .muted { font-size: 12.5px; padding-bottom: 9px; }
.me { display: flex; align-items: center; gap: 10px; }
.me strong { display: block; color: #fff; font-weight: 500; font-size: 13.5px; }
.me > div > span { display: block; font-size: 12px; color: rgba(255,255,255,.55); }
.avatar {
  width: 34px; height: 34px; border-radius: 50%; flex: none;
  display: grid; place-items: center;
  background: var(--brass); color: #fff; font-weight: 600; font-size: 13px;
}
.side-actions { display: flex; gap: 14px; margin-top: 12px; font-size: 12.5px; color: rgba(255,255,255,.7); }
.side-actions .link-btn:hover { color: #fff; }
.scrim { display: none; }

.main { min-width: 0; display: flex; flex-direction: column; }
.top {
  position: sticky; top: 0; z-index: 5;
  display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
  padding: 14px 28px; min-height: 64px;
  background: rgba(238,241,242,.94); backdrop-filter: blur(6px);
  border-bottom: 1px solid var(--line);
}
.top h1 { font-size: 20px; font-weight: 600; margin-right: auto; }
.top-tools { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.menu-btn { display: none; background: none; border: 0; padding: 4px; cursor: pointer; color: var(--ink); }
.view { padding: 24px 28px 48px; outline: none; }

@media (max-width: 960px) {
  .shell { grid-template-columns: 1fr; }
  .side {
    position: fixed; left: 0; top: 0; z-index: 30; width: 260px;
    transform: translateX(-100%); transition: transform .2s ease;
  }
  .shell.menu-open .side { transform: none; }
  .shell.menu-open .scrim { display: block; position: fixed; inset: 0; z-index: 20; background: rgba(16,42,56,.4); }
  .menu-btn { display: block; }
  .top { padding: 12px 16px; }
  .view { padding: 16px; }
}

/* ============================================================ PANELS */
.panel {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  min-width: 0;
}
.panel-head {
  display: flex; align-items: baseline; justify-content: space-between; gap: 12px;
  padding: 14px 18px 0;
}
.panel-head h2 { font-size: 15px; font-weight: 600; }
.panel-head .muted { font-size: 12.5px; }
.panel-body { padding: 14px 18px 18px; }
.chart-box { position: relative; height: 280px; }
.chart-box.tall { height: 320px; }
.grid { display: grid; gap: 16px; margin-top: 16px; }
.grid-2-1 { grid-template-columns: 2fr 1fr; }
.grid-1-1 { grid-template-columns: 1fr 1fr; }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid.top-align { align-items: start; }
@media (max-width: 1180px) { .grid-2-1, .grid-3 { grid-template-columns: 1fr 1fr; } }
@media (max-width: 760px) { .grid-2-1, .grid-1-1, .grid-3 { grid-template-columns: 1fr; } }

/* ------------------------------------------- KPI ledger (signature) */
.ledger {
  display: grid; grid-template-columns: repeat(5, 1fr) 1.5fr;
  background: var(--ink); color: #fff; border-radius: var(--radius); overflow: hidden;
}
.ledger-cell { padding: 18px 20px; border-right: 1px solid rgba(255,255,255,.09); min-width: 0; }
.ledger-cell:last-child { border-right: 0; }
.ledger-label { font-size: 12.5px; color: rgba(255,255,255,.62); }
.ledger-value { font-size: 24px; font-weight: 600; margin-top: 4px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.ledger-sub { font-size: 12px; color: rgba(255,255,255,.55); margin-top: 2px; }
.ledger-target { background: var(--ink-2); }
.gauge { margin-top: 10px; height: 8px; border-radius: 4px; background: rgba(255,255,255,.12); overflow: hidden; }
.gauge > i { display: block; height: 100%; background: var(--brass); border-radius: 4px; }
.gauge.over > i { background: #4fae78; }
.ledger-target .ledger-value { color: #f2d7a6; }
@media (max-width: 1180px) {
  .ledger { grid-template-columns: repeat(3, 1fr); }
  .ledger-cell { border-bottom: 1px solid rgba(255,255,255,.09); }
  .ledger-target { grid-column: span 3; }
}
@media (max-width: 560px) {
  .ledger { grid-template-columns: 1fr 1fr; }
  .ledger-target { grid-column: span 2; }
  .ledger-value { font-size: 20px; }
}

/* ------------------------------------------------------------ lists */
.mini-list { list-style: none; margin: 0; padding: 0; }
.mini-list li {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 0; border-top: 1px solid var(--line-soft); cursor: pointer;
}
.mini-list li:first-child { border-top: 0; }
.mini-list li:hover .mini-title { color: var(--teal); }
.mini-main { flex: 1; min-width: 0; }
.mini-title { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mini-sub { font-size: 12.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mini-side { text-align: right; font-size: 13px; white-space: nowrap; }
.date-chip { display: inline-block; padding: 1px 8px; border-radius: 10px; font-size: 12px; font-weight: 500; background: var(--line-soft); }
.date-chip.overdue { background: var(--bad-soft); color: var(--bad); }
.date-chip.today { background: var(--warn-soft); color: var(--warn); }
.empty { padding: 28px 8px; text-align: center; color: var(--muted); }
.empty strong { display: block; color: var(--text); font-weight: 500; margin-bottom: 4px; }

/* ------------------------------------------------------------ tables */
.table-wrap { overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; font-size: 13.5px; }
table.data th {
  text-align: left; font-weight: 600; font-size: 12.5px; color: var(--muted);
  padding: 10px 12px; border-bottom: 1px solid var(--line); white-space: nowrap;
  background: #f7f9f9; position: sticky; top: 0;
}
table.data th.sortable { cursor: pointer; user-select: none; }
table.data th.sortable:hover { color: var(--text); }
table.data th .arrow { font-size: 10px; margin-left: 4px; }
table.data td { padding: 10px 12px; border-bottom: 1px solid var(--line-soft); vertical-align: middle; }
table.data tbody tr.clickable { cursor: pointer; }
table.data tbody tr.clickable:hover { background: #f5f8f9; }
table.data .r { text-align: right; white-space: nowrap; }
table.data .cell-sub { overflow-wrap: anywhere; }
.cell-main { font-weight: 500; }
.cell-sub { font-size: 12.5px; color: var(--muted); }
.lead-no { font-size: 12.5px; color: var(--muted); white-space: nowrap; }

.pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 2px 9px 2px 8px; border-radius: 12px;
  font-size: 12px; font-weight: 500; white-space: nowrap;
  background: var(--line-soft); color: var(--text);
}
.pill::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--pill, #7a8b99); }
.prio-High { color: var(--bad); font-weight: 500; }
.prio-Low { color: var(--muted); }
.bar-cell { display: flex; align-items: center; gap: 8px; min-width: 140px; }
.bar-track { flex: 1; height: 6px; border-radius: 3px; background: var(--line-soft); overflow: hidden; }
.bar-track > i { display: block; height: 100%; background: var(--brass); }
.bar-track.good > i { background: var(--good); }

/* ------------------------------------------------- register toolbar */
.toolbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.tool-input { width: 240px; }
.tool-select { padding-right: 6px; }
.tool-date { width: 140px; }
.toolbar .spacer { flex: 1; }
.summary-line { display: flex; flex-wrap: wrap; gap: 18px; padding: 10px 18px; font-size: 13px; color: var(--muted); border-bottom: 1px solid var(--line-soft); }
.summary-line b { color: var(--text); font-weight: 600; }
.pager { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 18px; font-size: 13px; color: var(--muted); }
.pager .btns { display: flex; gap: 6px; }

/* ------------------------------------------------------- targets grid */
.target-grid td, .target-grid th { padding: 8px 6px; }
.target-grid th:first-child, .target-grid td:first-child { padding-left: 14px; }
.target-grid input {
  width: 82px; height: 30px; padding: 0 6px; text-align: right;
  border: 1px solid var(--line); border-radius: 4px; font-variant-numeric: tabular-nums;
}
.target-grid input:focus { outline: none; border-color: var(--teal); box-shadow: 0 0 0 2px var(--teal-soft); }
.target-grid .ach { display: block; font-size: 11.5px; text-align: right; margin-top: 2px; }
.ach.hit { color: var(--good); }
.ach.miss { color: var(--muted); }
.target-grid td.name { white-space: nowrap; }
.target-grid .total { font-weight: 600; text-align: right; white-space: nowrap; }
.target-grid tr.dirty td:first-child { box-shadow: inset 3px 0 0 var(--brass); }

/* ============================================================= MODAL */
.modal-back {
  position: fixed; inset: 0; z-index: 50;
  background: rgba(16,42,56,.45);
  display: flex; align-items: flex-start; justify-content: center;
  padding: 40px 16px; overflow-y: auto;
}
.modal {
  width: 100%; max-width: 560px; background: var(--paper);
  border-radius: 8px; box-shadow: 0 20px 50px rgba(16,42,56,.25);
  animation: modal-in .16s ease-out;
}
.modal.wide { max-width: 1080px; }
@keyframes modal-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .modal { animation: none; } .side { transition: none; } }
.modal-head { display: flex; align-items: center; gap: 12px; padding: 18px 22px; border-bottom: 1px solid var(--line); }
.modal-head h2 { font-size: 17px; font-weight: 600; flex: 1; }
.modal-head .x { background: none; border: 0; font-size: 22px; line-height: 1; cursor: pointer; color: var(--muted); padding: 4px; }
.modal-body { padding: 20px 22px; }
.modal-foot { display: flex; align-items: center; gap: 8px; padding: 14px 22px; border-top: 1px solid var(--line); background: #f7f9f9; border-radius: 0 0 8px 8px; }
.modal-foot .spacer { flex: 1; }

.lead-layout { display: grid; grid-template-columns: minmax(0, 1fr) 360px; }
.lead-layout > .modal-body:first-child { border-right: 1px solid var(--line); }
@media (max-width: 900px) {
  .lead-layout { grid-template-columns: 1fr; }
  .lead-layout > .modal-body:first-child { border-right: 0; border-bottom: 1px solid var(--line); }
}
fieldset { border: 0; margin: 0 0 18px; padding: 0; }
legend { font-weight: 600; font-size: 13.5px; margin-bottom: 10px; padding: 0; color: var(--ink); }
.form-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.form-grid .span-2 { grid-column: span 2; }
.form-grid .span-3 { grid-column: 1 / -1; }
@media (max-width: 640px) { .form-grid { grid-template-columns: 1fr; } .form-grid .span-2 { grid-column: auto; } }

.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { position: relative; padding: 0 0 16px 20px; }
.timeline li::before { content: ""; position: absolute; left: 4px; top: 7px; width: 7px; height: 7px; border-radius: 50%; background: var(--teal); }
.timeline li::after { content: ""; position: absolute; left: 7px; top: 18px; bottom: 0; width: 1px; background: var(--line); }
.timeline li:last-child::after { display: none; }
.timeline .t-head { font-size: 12.5px; color: var(--muted); }
.timeline .t-head b { color: var(--text); font-weight: 600; }
.timeline .t-note { white-space: pre-wrap; word-break: break-word; }
.activity-form { display: flex; flex-direction: column; gap: 10px; padding-bottom: 16px; margin-bottom: 16px; border-bottom: 1px solid var(--line); }
.activity-form .row { display: grid; grid-template-columns: minmax(0, .8fr) minmax(0, 1.2fr); gap: 10px; }
.side-title { font-weight: 600; font-size: 13.5px; color: var(--ink); margin-bottom: 10px; }
.meta-line { font-size: 12.5px; color: var(--muted); margin-top: 8px; }


/* -------------------------------------------------------- quotations */
.quotes { margin-top: 22px; padding-top: 18px; border-top: 1px solid var(--line); }
.quotes-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.quotes-head h3 { font-size: 13.5px; font-weight: 600; color: var(--ink); }
.quote-group { border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: 12px; overflow: hidden; }
.quote-group-head { display: flex; align-items: center; gap: 10px; padding: 8px 12px; background: #f7f9f9; border-bottom: 1px solid var(--line); }
.quote-group-head .spacer, .quote-actions .spacer { flex: 1; }
.quote-rev { padding: 12px; border-top: 1px solid var(--line-soft); }
.quote-group-head + .quote-rev { border-top: 0; }
.quote-rev.superseded { background: #fafbfb; }
.quote-rev.superseded .quote-amt { color: var(--muted); font-weight: 500; }
.quote-rev-main { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.rev-tag { font-weight: 600; font-size: 12px; padding: 1px 7px; border-radius: 4px; background: var(--ink); color: #fff; }
.superseded .rev-tag { background: var(--line); color: var(--muted); }
.quote-amt { font-weight: 600; font-size: 14.5px; }
.quote-rev-meta { font-size: 12.5px; color: var(--muted); margin-top: 4px; }
.quote-remarks { font-size: 13px; margin-top: 4px; }
.quote-actions { display: flex; align-items: center; gap: 14px; margin-top: 8px; font-size: 13px; flex-wrap: wrap; }
.quote-actions .link-btn { color: var(--teal); }
.link-btn.danger { color: var(--bad); }
.file-link {
  display: inline-flex; align-items: center; gap: 6px; min-width: 0; max-width: 100%;
  background: none; border: 0; padding: 0; cursor: pointer; color: var(--teal); font-weight: 500; text-align: left;
}
.file-link > span:first-of-type { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-link:hover > span:first-of-type { text-decoration: underline; }
.quote-history { margin-top: 8px; font-size: 12.5px; }
.quote-history summary { cursor: pointer; color: var(--muted); }
.quote-history ul { list-style: none; margin: 6px 0 0 2px; padding: 0 0 0 10px; border-left: 2px solid var(--line); }
.quote-history li { padding: 3px 0; }
.quote-form { border: 1px solid #b9d6dc; background: #f4f9fa; border-radius: var(--radius); padding: 14px; margin-bottom: 14px; }
.quote-form-title { font-weight: 600; margin-bottom: 10px; }
.quote-form-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 12px; }
.quote-form input[type=file] { height: auto; padding: 6px; background: var(--paper); }
.check { display: flex; align-items: center; gap: 8px; font-size: 13px; cursor: pointer; }
.check input { width: 16px; height: 16px; accent-color: var(--ink); }
p.small { font-size: 12.5px; margin: 8px 0 0; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; padding: 12px 18px; border-bottom: 1px solid var(--line-soft); }
.chips:empty { display: none; }
.chip {
  display: flex; flex-direction: column; align-items: flex-start; gap: 2px; min-width: 120px;
  padding: 7px 12px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--paper);
  cursor: pointer; text-align: left;
}
.chip:hover { border-color: var(--ink-3); }
.chip.active { border-color: var(--ink); box-shadow: inset 0 0 0 1px var(--ink); }
.chip-top { display: flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--muted); }
.chip-top::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--pill); }
.chip b { font-size: 16px; font-weight: 600; }


/* ------------------------------------------------------ file viewer */
.viewer-back { position: fixed; inset: 0; z-index: 70; background: rgba(16,42,56,.6); display: flex; padding: 24px; }
.viewer { flex: 1; display: flex; flex-direction: column; max-width: 1100px; margin: 0 auto; background: var(--paper);
  border-radius: 8px; overflow: hidden; box-shadow: 0 20px 50px rgba(16,42,56,.35); }
.viewer-head { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.viewer-head > div { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.viewer-head > div span { font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.viewer-head a.btn { text-decoration: none; }
.viewer-head .x { background: none; border: 0; font-size: 24px; line-height: 1; cursor: pointer; color: var(--muted); padding: 2px 6px; }
.viewer-body { flex: 1; min-height: 0; background: #e9edef; overflow: auto; }
.viewer-frame { width: 100%; height: 100%; min-height: 70vh; border: 0; display: block; background: #fff; }
.viewer-img { padding: 20px; display: flex; justify-content: center; }
.viewer-img img { max-width: 100%; height: auto; box-shadow: 0 2px 10px rgba(0,0,0,.15); background: #fff; }
.viewer-msg { height: 100%; min-height: 50vh; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 10px; text-align: center; color: var(--muted); padding: 24px; }
.viewer-msg svg { width: 40px; height: 40px; color: var(--teal); }
.viewer-msg strong { color: var(--text); }
@media (max-width: 640px) { .viewer-back { padding: 0; } .viewer { border-radius: 0; } }

.toast-action { display: flex; align-items: center; gap: 12px; }
.toast-action span { flex: 1; }
.toast-action .btn { background: #fff; color: var(--ink); border-color: #fff; }
.toast-action .x { background: none; border: 0; color: rgba(255,255,255,.7); font-size: 18px; cursor: pointer; padding: 0 2px; }
.client-box { position: relative; display: inline-flex; }
.tool-client { width: 200px; padding-right: 30px; }
.client-clear { position: absolute; right: 4px; top: 50%; transform: translateY(-50%); width: 24px; height: 24px;
  border: 0; border-radius: 50%; background: transparent; color: var(--muted); font-size: 17px; line-height: 1; cursor: pointer; }
.client-clear:hover { background: var(--line-soft); color: var(--text); }
.tool-client:placeholder-shown + .client-clear { display: none; }
.tool-client::-webkit-calendar-picker-indicator { display: none !important; }
.client-clear:focus-visible { outline-offset: 0; }
.tool-label { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); }
.file-cell { white-space: nowrap; }
.file-cell .link-btn { color: var(--teal); margin-right: 12px; }

/* ---------------------------------------------------------- reminders */
.side-title-row { display: flex; align-items: center; justify-content: space-between; }
.side-title-row .link-btn { font-weight: 400; font-size: 12.5px; color: var(--teal); }
.rem-none { font-size: 12.5px; margin: 0 0 16px; }
.rem-mini { list-style: none; margin: 0 0 16px; padding: 0; }
.rem-mini li { display: flex; gap: 10px; align-items: flex-start; justify-content: space-between; padding: 8px 0; border-top: 1px solid var(--line-soft); font-size: 13px; }
.rem-mini li:first-child { border-top: 0; }
.rem-mini .link-btn { color: var(--teal); font-size: 12.5px; }
#remFormArea.quote-form { margin-bottom: 14px; }
.rem-fields { display: flex; flex-direction: column; gap: 10px; }
.rem-fields .row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.rem-section { margin-bottom: 16px; }
.rem-list { list-style: none; margin: 0; padding: 4px 18px 8px; }
.rem-item { display: flex; gap: 14px; padding: 10px 0; border-top: 1px solid var(--line-soft); }
.rem-item:first-child { border-top: 0; }
.rem-tag { flex: none; width: 78px; font-size: 11.5px; font-weight: 600; padding: 2px 0; text-align: center; border-radius: 4px;
  background: var(--line-soft); color: var(--ink-2); }
.kind-custom .rem-tag { background: var(--brass-soft); color: #7a5418; }
.kind-followup .rem-tag { background: var(--teal-soft); color: var(--teal); }
.kind-quote_expiry .rem-tag, .kind-quote_waiting .rem-tag { background: #ebe8f4; color: #5a4b8a; }
.kind-idle .rem-tag { background: var(--warn-soft); color: var(--warn); }
.kind-target .rem-tag { background: var(--bad-soft); color: var(--bad); }
.kind-rfq .rem-tag { background: #fde8d8; color: #9a4a12; }
.head-rfq { font-size: 12.5px; color: var(--muted); display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.rfq-note { margin: -4px 0 10px; font-size: 13px; color: var(--ink-2); }
.rem-main { flex: 1; min-width: 0; }
.rem-title { font-weight: 500; }
.rem-link { background: none; border: 0; padding: 0; font: inherit; color: var(--text); cursor: pointer; text-align: left; }
.rem-link:hover { color: var(--teal); text-decoration: underline; }
.rem-detail { font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.rem-side { display: flex; align-items: center; gap: 10px; text-align: right; font-size: 12.5px; flex-wrap: wrap; justify-content: flex-end; }
.rem-item { align-items: center; }
.rem-group + .rem-group { border-top: 1px solid var(--line); }
.rem-group-head { padding: 12px 18px 0; font-size: 12.5px; font-weight: 600; color: var(--ink-2); }
.rem-more { display: block; margin: 0 18px 12px; color: var(--teal); font-size: 13px; }
.rem-actions { display: flex; align-items: center; gap: 8px; }
.rem-snooze { height: 30px; font-size: 12.5px; }
.rem-done { padding: 0; }
.rem-done summary { padding: 14px 18px; cursor: pointer; font-weight: 600; font-size: 15px; }
.rem-item.is-done .rem-title { color: var(--muted); text-decoration: line-through; }
@media (max-width: 640px) {
  .rem-item { flex-wrap: wrap; }
  .rem-tag { width: auto; padding: 2px 8px; }
  .rem-side { width: 100%; flex-direction: row; justify-content: space-between; align-items: center; }
}

/* ------------------------------------------------------------ reports */
.reports { display: grid; grid-template-columns: 260px minmax(0, 1fr); gap: 16px; align-items: start; }
.report-list { display: flex; flex-direction: column; gap: 6px; position: sticky; top: 80px; }
.report-pick { display: flex; flex-direction: column; gap: 2px; text-align: left; padding: 10px 12px; cursor: pointer;
  background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); }
.report-pick strong { font-weight: 600; font-size: 13.5px; }
.report-pick span { font-size: 12px; color: var(--muted); line-height: 1.35; }
.report-pick:hover { border-color: var(--ink-3); }
.report-pick.active { border-color: var(--ink); box-shadow: inset 3px 0 0 var(--brass), inset 0 0 0 1px var(--ink); }
.report-head { padding: 16px 18px 12px; border-bottom: 1px solid var(--line-soft); }
.report-head h2 { font-size: 17px; font-weight: 600; margin-bottom: 4px; }
.report-head .muted { font-size: 12.5px; }
.report-summary { font-weight: 500; margin-top: 6px; }
.report-table td.wrap { min-width: 260px; white-space: normal; }
.report-table tfoot td { font-weight: 600; background: #f3f5f6; border-top: 2px solid var(--ink); padding: 10px 12px; white-space: nowrap; }
.report-table td, .report-table th { white-space: nowrap; }
@media (max-width: 1000px) {
  .reports { grid-template-columns: 1fr; }
  .report-list { position: static; flex-direction: row; overflow-x: auto; padding-bottom: 4px; }
  .report-pick { min-width: 200px; }
}

/* ------------------------------------------- breakdown, settings, PO */
.tabs { display: flex; gap: 4px; margin-bottom: 12px; border-bottom: 1px solid var(--line); }
.tab { background: none; border: 0; border-bottom: 3px solid transparent; padding: 10px 16px; font-weight: 600; color: var(--muted); cursor: pointer; margin-bottom: -1px; }
.tab:hover { color: var(--text); }
.tab.active { color: var(--ink); border-bottom-color: var(--brass); }
.bd-chart { padding: 16px 18px 0; }
.inline-add { display: flex; gap: 8px; margin-bottom: 12px; flex-wrap: wrap; }
.inline-add .tool-input { flex: 1; min-width: 200px; }
.row-actions { white-space: nowrap; text-align: right; }
.row-actions .link-btn { color: var(--teal); margin-left: 12px; }
.row-actions .link-btn.danger { color: var(--bad); }
.po-set { background: var(--good-soft); border-radius: var(--radius); padding: 12px 14px 14px; }
.po-set legend { float: left; width: 100%; margin-bottom: 10px; }
.po-set legend + .form-grid { clear: both; }
.po-file { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; font-size: 13px; }
.po-file .link-btn { color: var(--teal); }
.po-file .link-btn.danger { color: var(--bad); }
.form-hint { margin: 0; }
.js-po-fields { margin: 0; }

/* ============================================================ TOASTS */
.toasts { position: fixed; right: 20px; bottom: 20px; z-index: 60; display: flex; flex-direction: column; gap: 8px; }
.toast {
  min-width: 240px; max-width: 380px; padding: 11px 14px; border-radius: var(--radius);
  background: var(--ink); color: #fff; box-shadow: 0 10px 30px rgba(16,42,56,.25); font-size: 13.5px;
}
.toast.error { background: var(--bad); }

.loading { padding: 60px 0; text-align: center; color: var(--muted); }
.notice { padding: 10px 14px; border-radius: var(--radius); background: var(--teal-soft); color: var(--ink-2); font-size: 13px; margin-bottom: 14px; }

@media print {
  .side, .top-tools, .menu-btn, .toolbar, .pager { display: none !important; }
  .shell { display: block; }
  body { background: #fff; }
}
