:root {
  /* Deep forest — the studio's colour. Kept dark so white button text clears
     4.5:1 comfortably (11.1:1), and so it never reads as the lighter --green
     used for profit figures. */
  --accent: #1B4332;
  --accent-soft: #EAF1EC;
  --accent-2: #2F7A55;
  --ink: #1C1917;
  --ink-2: #44403C;
  --muted: #78716C;
  --faint: #A8A29E;
  --line: #E7E5E4;
  --line-2: #F1EFEE;
  --bg: #FBFAF8;
  --panel: #FFFFFF;
  --green: #2F6B4F;
  --green-bg: #E8F2ED;
  --amber: #9A6A1B;
  --amber-bg: #FBF1DE;
  --red: #A03434;
  --red-bg: #FAEAEA;
  --blue: #33557E;
  --blue-bg: #E9EFF6;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(28,25,23,.05), 0 8px 24px -12px rgba(28,25,23,.18);
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 14px/1.5 ui-sans-serif, -apple-system, "Segoe UI", Inter, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}
h1,h2,h3,h4 { margin: 0; font-weight: 600; letter-spacing: -.01em; }
a { color: var(--accent); text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }

/* ---------- layout ---------- */
#app { display: flex; min-height: 100vh; }
.sidebar {
  width: 232px; flex: 0 0 232px; background: #24201F; color: #E7E5E4;
  display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh;
}
.brand { padding: 20px 18px 16px; border-bottom: 1px solid rgba(255,255,255,.08); }
.brand .logo { font-family: Georgia, "Times New Roman", serif; font-size: 21px; letter-spacing: .5px; color: #fff; }
.brand .sub { font-size: 10.5px; color: #A8A29E; letter-spacing: 1.4px; text-transform: uppercase; margin-top: 3px; }
.nav { flex: 1; overflow-y: auto; padding: 12px 10px; }
.nav-group { font-size: 10px; letter-spacing: 1.2px; text-transform: uppercase; color: #78716C;
  padding: 14px 10px 6px; }
.nav a {
  display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 8px;
  color: #D6D3D1; font-size: 13.5px; margin-bottom: 1px;
}
.nav a:hover { background: rgba(255,255,255,.06); color: #fff; }
.nav a.active { background: var(--accent); color: #fff; }
.nav a .ico { width: 16px; text-align: center; opacity: .9; font-size: 14px; }
.nav a .badge { margin-left: auto; background: rgba(255,255,255,.14); border-radius: 20px;
  padding: 1px 7px; font-size: 11px; }
.side-foot { padding: 12px 14px; border-top: 1px solid rgba(255,255,255,.08); font-size: 12px; color: #A8A29E; }
.side-foot .who { color: #E7E5E4; font-weight: 500; }
.side-foot button { background: none; border: 0; color: #A8A29E; cursor: pointer; padding: 0; font-size: 12px; text-decoration: underline; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  display: flex; align-items: center; gap: 14px; padding: 16px 26px; background: var(--panel);
  border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 20;
}
.topbar h1 { font-size: 19px; }
.topbar .sub { color: var(--muted); font-size: 12.5px; margin-top: 1px; }
.topbar .spacer { flex: 1; }
/* page actions sit together; Create Document is always the rightmost control,
   set slightly apart so it reads as global rather than part of the screen */
#pa { display: flex; align-items: center; gap: 8px; }
#pa:not(:empty) { margin-right: 6px; padding-right: 14px; border-right: 1px solid var(--line); }
#newdoc { white-space: nowrap; }
.content { padding: 22px 26px 60px; }

/* ---------- controls ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 6px; padding: 7px 13px; border-radius: 8px;
  border: 1px solid var(--line); background: #fff; cursor: pointer; font-size: 13px; font-weight: 500;
  transition: .12s; white-space: nowrap;
}
.btn:hover { border-color: #D6D3D1; background: #FAFAF9; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { background: #143026; }
.btn.ghost { border-color: transparent; background: transparent; color: var(--muted); }
.btn.ghost:hover { background: var(--line-2); color: var(--ink); }
.btn.danger { color: var(--red); border-color: #EBDCDC; }
.btn.danger:hover { background: var(--red-bg); }
.btn.sm { padding: 4px 9px; font-size: 12px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

input[type=text], input[type=date], input[type=number], input[type=email], input[type=password],
select, textarea {
  width: 100%; padding: 7px 10px; border: 1px solid var(--line); border-radius: 8px; background: #fff;
  outline: none; transition: .12s;
}
input:focus, select:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
textarea { resize: vertical; min-height: 66px; }
label.f { display: block; margin-bottom: 12px; }
label.f > span { display: block; font-size: 11.5px; text-transform: uppercase; letter-spacing: .6px;
  color: var(--muted); margin-bottom: 4px; font-weight: 500; }
.grid { display: grid; gap: 0 14px; }
.g2 { grid-template-columns: 1fr 1fr; }
.g3 { grid-template-columns: repeat(3, 1fr); }
.g4 { grid-template-columns: repeat(4, 1fr); }

/* ---------- cards & tables ---------- */
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); }
.card + .card { margin-top: 18px; }
.card-head { display: flex; align-items: center; gap: 10px; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.card-head h3 { font-size: 14.5px; }
.card-head .spacer { flex: 1; }
.card-body { padding: 16px; }

table.data { width: 100%; border-collapse: collapse; }
table.data th {
  text-align: left; font-size: 10.5px; text-transform: uppercase; letter-spacing: .7px; color: var(--muted);
  padding: 9px 14px; border-bottom: 1px solid var(--line); font-weight: 600; background: #FCFBFA; white-space: nowrap;
}
table.data td { padding: 10px 14px; border-bottom: 1px solid var(--line-2); vertical-align: middle; }
table.data tbody tr:hover td { background: #FCFBFA; }
table.data tbody tr.clickable { cursor: pointer; }
table.data .num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
table.data td.strong { font-weight: 600; }
.empty { padding: 44px 16px; text-align: center; color: var(--faint); }
.empty .big { font-size: 26px; margin-bottom: 8px; }

/* ---------- kpi ---------- */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(178px, 1fr)); gap: 14px; margin-bottom: 18px; }
.kpi { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; }
.kpi .label { font-size: 10.5px; text-transform: uppercase; letter-spacing: .8px; color: var(--muted); font-weight: 600; }
.kpi .value { font-size: 23px; font-weight: 650; margin-top: 6px; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.kpi .foot { font-size: 11.5px; color: var(--faint); margin-top: 3px; }
.kpi.accent { background: linear-gradient(135deg, #1B4332, #2F7A55); border-color: #1B4332; color: #fff; }
.kpi.accent .label, .kpi.accent .foot { color: rgba(255,255,255,.75); }

/* ---------- badges ---------- */
.badge { display: inline-block; padding: 2px 9px; border-radius: 20px; font-size: 11.5px; font-weight: 600;
  background: var(--line-2); color: var(--ink-2); white-space: nowrap; }
.badge.green { background: var(--green-bg); color: var(--green); }
.badge.amber { background: var(--amber-bg); color: var(--amber); }
.badge.red { background: var(--red-bg); color: var(--red); }
.badge.blue { background: var(--blue-bg); color: var(--blue); }
.badge.grey { background: #F1EFEE; color: var(--muted); }

/* ---------- pipeline board ---------- */
.board { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(228px, 1fr); gap: 12px; overflow-x: auto; padding-bottom: 8px; }
.col { background: #F4F2F0; border-radius: var(--radius); padding: 10px; min-height: 150px; }
.col.over { background: var(--accent-soft); outline: 2px dashed var(--accent); }
.col-head { display: flex; align-items: center; justify-content: space-between; padding: 2px 4px 9px; }
.col-head .t { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .6px; color: var(--ink-2); }
.col-head .v { font-size: 11px; color: var(--muted); }
.tile { background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 10px 11px; margin-bottom: 8px;
  cursor: grab; box-shadow: 0 1px 2px rgba(28,25,23,.04); }
.tile:hover { border-color: #D6D3D1; }
.tile.dragging { opacity: .45; }
.tile .n { font-weight: 600; font-size: 13.2px; }
.tile .m { font-size: 11.8px; color: var(--muted); margin-top: 3px; display: flex; gap: 8px; flex-wrap: wrap; }
.tile .v { font-weight: 600; color: var(--accent); font-size: 12.5px; margin-top: 5px; }

/* ---------- modal ---------- */
.modal-bg { position: fixed; inset: 0; background: rgba(28,25,23,.42); display: flex; align-items: flex-start;
  justify-content: center; padding: 40px 16px; z-index: 100; overflow-y: auto; backdrop-filter: blur(2px); }
.modal { background: var(--panel); border-radius: 12px; width: 100%; max-width: 620px; box-shadow: var(--shadow);
  animation: pop .14s ease-out; }
.modal.wide { max-width: 1020px; }
@keyframes pop { from { transform: translateY(-8px); opacity: 0 } to { transform: none; opacity: 1 } }
.modal-head { display: flex; align-items: center; padding: 16px 18px; border-bottom: 1px solid var(--line); }
.modal-head h3 { font-size: 16px; flex: 1; }
.modal-body { padding: 18px; max-height: calc(100vh - 220px); overflow-y: auto; }
.modal-foot { display: flex; gap: 8px; justify-content: flex-end; padding: 14px 18px; border-top: 1px solid var(--line); }
.x { border: 0; background: none; font-size: 20px; color: var(--faint); cursor: pointer; line-height: 1; padding: 0 4px; }

/* ---------- doc editor ---------- */
.line-table { width: 100%; border-collapse: collapse; }
.line-table th { font-size: 10px; text-transform: uppercase; letter-spacing: .6px; color: var(--muted);
  padding: 6px 5px; text-align: left; border-bottom: 1px solid var(--line); font-weight: 600; }
.line-table td { padding: 4px 5px; border-bottom: 1px solid var(--line-2); }
.line-table input, .line-table select { padding: 5px 7px; font-size: 13px; }
.line-table .num input { text-align: right; }
.totbox { background: #FCFBFA; border: 1px solid var(--line); border-radius: 8px; padding: 12px 14px; }
.totrow { display: flex; justify-content: space-between; padding: 3px 0; font-size: 13.5px; }
.totrow.grand { border-top: 1px solid var(--line); margin-top: 6px; padding-top: 9px; font-size: 17px; font-weight: 700; color: var(--accent); }
.tax-note { font-size: 11.5px; color: var(--muted); margin-top: 8px; padding-top: 8px; border-top: 1px dashed var(--line); }

/* ---------- misc ---------- */
.toolbar { display: flex; gap: 8px; align-items: center; margin-bottom: 16px; flex-wrap: wrap; }
.toolbar input[type=text] { max-width: 260px; }
.toolbar select { width: auto; min-width: 130px; }
.tabs { display: flex; gap: 3px; border-bottom: 1px solid var(--line); margin-bottom: 18px; }
.tabs button { border: 0; background: none; padding: 9px 14px; cursor: pointer; color: var(--muted);
  border-bottom: 2px solid transparent; font-weight: 500; font-size: 13.5px; }
.tabs button.active { color: var(--accent); border-bottom-color: var(--accent); }
.bar { height: 7px; background: var(--line-2); border-radius: 4px; overflow: hidden; }
.bar > i { display: block; height: 100%; background: var(--accent); }
.split { display: grid; grid-template-columns: 1.65fr 1fr; gap: 18px; align-items: start; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.right { text-align: right; }
.mono { font-variant-numeric: tabular-nums; }
.warn { color: var(--accent); }
/* a real button that reads as a link — javascript: hrefs are refused by the CSP */
.linkish { background: none; border: 0; padding: 0; color: var(--accent); cursor: pointer;
  font: inherit; text-decoration: underline; }

/* "Where things stand" — one line per thing the customer owes us, owes an
   answer on, or has open work against. Reads as a list, not a table. */
.stand { padding: 10px 0; border-bottom: 1px solid var(--line-2); }
.stand:last-child { border-bottom: 0; }
.stand.clickable { cursor: pointer; margin: 0 -8px; padding-left: 8px; padding-right: 8px; border-radius: 6px; }
.stand.clickable:hover { background: #FCFBFA; }
.stand-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 3px; }
.stand-head { font-size: 10.5px; text-transform: uppercase; letter-spacing: .8px; color: var(--muted);
  font-weight: 600; margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line); }
.allocsum { display: flex; align-items: center; justify-content: space-between; gap: 12px;
  margin-top: 14px; padding: 11px 14px; background: var(--line-2); border-radius: var(--radius); font-size: 13px; }
.chart { display: flex; align-items: flex-end; gap: 8px; height: 140px; padding-top: 8px; }
.chart .b { flex: 1; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; gap: 5px; height: 100%; }
.chart .b > i { width: 100%; background: linear-gradient(180deg, #2F7A55, #1B4332); border-radius: 4px 4px 0 0; min-height: 2px; display: block; }
.chart .b > small { font-size: 10px; color: var(--muted); white-space: nowrap; }

/* two series side by side — revenue and cost. The pair passes the full
   colour-vision check suite against a white card (ΔE ≥ 15 in every mode). */
:root { --chart-1: #35A05F; --chart-2: #38699E; }
.chart .b .pair { display: flex; gap: 2px; align-items: flex-end; width: 100%; flex: 1; }
.chart .pair i { flex: 1; border-radius: 4px 4px 0 0; min-height: 2px; display: block; }
.chart i.s1 { background: var(--chart-1); }
.chart i.s2 { background: var(--chart-2); }
.legend { display: flex; gap: 14px; font-size: 12px; color: var(--muted); }
.legend .sw { width: 10px; height: 10px; border-radius: 3px; display: inline-block; margin-right: 5px; vertical-align: -1px; }
.legend .sw.s1 { background: var(--chart-1); }
.legend .sw.s2 { background: var(--chart-2); }

/* P&L statement rows */
.pl-row { display: flex; justify-content: space-between; gap: 12px; padding: 6px 0; font-size: 13px; }
.pl-row.pl-head { font-weight: 600; }
.pl-row.pl-sub { color: var(--ink-2); padding: 4px 0 4px 12px; font-size: 12.5px; }
.pl-row.pl-total { border-top: 1px solid var(--line); margin-top: 4px; padding-top: 9px; font-weight: 650; }
.pl-row.neg .mono, .pl-row.neg { color: var(--red); }

/* context banner in dialogs opened from inside a customer / project */
.ctx { background: var(--accent-soft); border: 1px solid #CFE0D5; color: var(--ink-2);
  border-radius: var(--radius); padding: 8px 12px; font-size: 12.5px; margin-bottom: 14px; }

/* dashboard "where to next" tiles — the welcome page, without the extra click */
.jump { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 18px; }
.jump-tile { display: flex; flex-direction: column; gap: 3px; padding: 14px 16px; background: var(--panel);
  border: 1px solid var(--line); border-radius: var(--radius); color: var(--ink); transition: .12s; }
.jump-tile:hover { border-color: var(--accent); box-shadow: 0 3px 12px rgba(27,67,50,.12); transform: translateY(-1px); }
.jump-tile .ji { font-size: 15px; color: var(--accent); line-height: 1; margin-bottom: 4px; }
.jump-tile .jl { font-weight: 650; font-size: 14px; }
.jump-tile .js { font-size: 11.5px; color: var(--muted); }
.jump-tile.alert .js { color: var(--accent); font-weight: 600; }

/* the Create Document button + its type menu */
.dcaret { opacity: .75; margin-left: 4px; font-size: 11px; }
/* above .modal-bg (100): the document viewer opens its output menu from inside
   a dialog, and a menu rendered behind the overlay cannot be clicked */
.popmenu { position: fixed; z-index: 160; background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: 0 10px 30px rgba(28,25,23,.16); padding: 6px; min-width: 190px; }
.popmenu button { display: block; width: 100%; text-align: left; background: none; border: 0;
  padding: 9px 12px; font: inherit; font-size: 13.5px; color: var(--ink); border-radius: 7px; cursor: pointer; }
.popmenu button:hover { background: var(--accent-soft); color: var(--accent); }
.toast { position: fixed; bottom: 22px; right: 22px; background: #24201F; color: #fff; padding: 11px 16px;
  border-radius: 8px; font-size: 13.5px; box-shadow: var(--shadow); z-index: 300; animation: pop .15s; }
.toast.err { background: var(--red); }

/* login */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: radial-gradient(1200px 600px at 50% -10%, #EAF1EC, var(--bg)); }
.login { width: 380px; background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 30px;
  box-shadow: var(--shadow); }
.login .logo { font-family: Georgia, serif; font-size: 27px; color: var(--accent); text-align: center; }
.login .sub { text-align: center; color: var(--muted); font-size: 11.5px; letter-spacing: 1.6px;
  text-transform: uppercase; margin: 4px 0 24px; }
.login .err { background: var(--red-bg); color: var(--red); padding: 8px 11px; border-radius: 7px;
  font-size: 12.5px; margin-bottom: 12px; }
.hint { text-align: center; font-size: 12px; color: var(--faint); margin-top: 16px; }

@media (max-width: 900px) {
  .sidebar { display: none; }
  .split, .g2, .g3, .g4 { grid-template-columns: 1fr; }
  .content { padding: 16px; }
}
@media print { .sidebar, .topbar { display: none; } }

/* ---- ship-to (consignee) block in the document editor ---- */
.shipto {
  border: 1px solid var(--line-2);
  border-radius: var(--r);
  padding: 10px 12px 12px;
  margin: 10px 0 4px;
  background: var(--surface-2, #FBFAF9);
}
.shipto-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 8px; }
.shipto-head h4 {
  font-size: 12px; text-transform: uppercase; letter-spacing: .6px;
  color: var(--muted); margin: 0; white-space: nowrap;
}
.shipto-prev { font-size: 12.8px; color: var(--text); line-height: 1.5; min-height: 18px; }
.shipto-prev:empty { display: none; }
.shipto .warn { color: var(--accent); }
.shipto .hide { display: none; }
#shipnote { text-align: right; }

/* ============================================================
   Document editor — laid out in the anatomy of the printed
   invoice, with a live preview of the real template beside it.
   ============================================================ */
.modal.xwide { max-width: min(1560px, 96vw); }

.hide { display: none !important; }
.doc-editor { display: grid; grid-template-columns: minmax(0, 1fr) 470px; gap: 18px; align-items: start; }
.doc-editor.no-preview { grid-template-columns: minmax(0, 1fr); }
.doc-editor.no-preview .doc-preview { display: none; }
.doc-form { min-width: 0; }

/* header strip: document title + number, as on the paper */
.paper-head {
  display: flex; align-items: baseline; gap: 12px;
  border: 1px solid var(--line); border-bottom: 0;
  padding: 8px 12px; background: var(--surface-2, #FBFAF9);
  border-radius: var(--r) var(--r) 0 0;
}
.paper-title { font-weight: 700; font-size: 14px; letter-spacing: .2px; }
.paper-no { font-size: 12px; color: var(--muted); font-family: var(--mono, monospace); }

/* The number is editable, but it should not look like an invitation. It reads
   as text until you touch it, then behaves like the field it is. */
.paper-no input {
  font: inherit; color: var(--ink); background: transparent;
  border: 1px solid transparent; border-radius: 4px;
  padding: 2px 6px; width: 15ch; text-align: right;
}
.paper-no input::placeholder { color: var(--muted); }
.paper-no input:hover { border-color: var(--line); }
.paper-no input:focus { border-color: var(--accent); background: var(--surface); outline: none; text-align: left; }
.paper-no-hint { font-size: 11px; color: var(--muted); margin-left: auto; }
.paper-no-hint.warn { color: var(--amber, #97591A); }

/* an area heading on a measurement sheet — a row that names a room rather than
   measuring one */
.sect-row td { background: var(--surface-2, #F6F7F5); }
.sect-row input { font-weight: 600; }

/* a hairline inside a dropdown: the entries below it behave differently — they
   ask a question before they open anything */
.popmenu .popsep { height: 1px; background: var(--line); margin: 4px 6px; }

/* the four boxes: supplier + meta on top, consignee + buyer below */
/* left column = the three parties stacked, right column = the reference grid,
   exactly as they sit on the printed page */
.paper-grid {
  display: grid; grid-template-columns: 1fr 1fr;
  border: 1px solid var(--line); border-radius: 0 0 var(--r) var(--r);
  overflow: hidden;
}
.paper-col { display: flex; flex-direction: column; min-width: 0; }
.paper-col.right { border-left: 1px solid var(--line-2); }
.paper-cell { padding: 9px 12px 11px; border-top: 1px solid var(--line-2); min-width: 0; }
.paper-col > .paper-cell:first-child { border-top: 0; }
.cell-label {
  display: flex; align-items: center; gap: 8px;
  font-size: 10.5px; text-transform: uppercase; letter-spacing: .7px;
  color: var(--muted); margin-bottom: 6px;
}
.cell-label select { width: auto; font-size: 11px; padding: 1px 4px; height: auto; }
.paper-cell.supplier a { font-size: 11px; display: inline-block; margin-top: 4px; }

/* compact label-above-input used inside the boxes */
.mf { display: block; margin-bottom: 6px; }
.mf > span { display: block; text-align: left; font-size: 10.5px; color: var(--muted);
  margin-bottom: 2px; letter-spacing: .2px; }
.mf input, .mf select, .mf textarea {
  width: 100%; font-size: 12.5px; padding: 4px 7px; height: auto; line-height: 1.35;
}
.mf textarea { resize: vertical; }
.mini-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; }
.mini-row { display: grid; grid-template-columns: 1fr 1fr; gap: 0 10px; }
select.bare { width: 100%; font-weight: 600; font-size: 13px; margin-bottom: 4px; }

.items-head { display: flex; align-items: center; gap: 8px; margin: 14px 0 6px; }
.items-head select { width: auto; max-width: 250px; }
.line-table th.ctr, .line-table td.ctr { text-align: center; }

.under-items { display: grid; grid-template-columns: 2fr 1fr; gap: 0 14px; margin-top: 10px; }
.paper-foot { display: grid; grid-template-columns: 1fr 320px; gap: 18px; margin-top: 12px; align-items: start; }
.paper-foot .decl { margin-top: 2px; line-height: 1.45; }

/* preview pane */
.doc-preview { position: sticky; top: 0; }
.prev-head {
  display: flex; justify-content: space-between; align-items: baseline;
  font-size: 11px; text-transform: uppercase; letter-spacing: .7px;
  color: var(--muted); margin-bottom: 6px;
}
.prev-head .warn { color: var(--accent); text-transform: none; letter-spacing: 0; }
.prev-frame {
  border: 1px solid var(--line); border-radius: var(--r); overflow: hidden;
  background: #fff; height: 72vh;
}
.prev-frame iframe { width: 100%; height: 100%; border: 0; background: #fff; }

@media (max-width: 1240px) {
  .doc-editor { grid-template-columns: minmax(0, 1fr); }
  .doc-preview { display: none; }
  .doc-editor:not(.no-preview) .doc-preview { display: block; }
  .doc-editor:not(.no-preview) { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 780px) {
  .paper-grid, .mini-grid, .mini-row, .under-items, .paper-foot { grid-template-columns: 1fr; }
  .paper-cell.supplier, .paper-cell.consignee { border-right: 0; }
  .paper-cell.meta { border-top: 1px solid var(--line-2); }
}

/* ---- purchase order upload ---- */
.drop {
  margin-top: 10px; padding: 22px 16px; text-align: center; cursor: pointer;
  border: 1.5px dashed var(--line); border-radius: var(--r);
  background: var(--surface-2, #FBFAF9); transition: border-color .12s, background .12s;
}
.drop:hover, .drop.over { border-color: var(--accent); background: var(--accent-soft, #F6EFEF); }
.drop .btn { margin-top: 8px; }
.po-hint { display: block; margin-top: 2px; min-height: 13px; font-size: 10.5px; }

/* ---- inline record actions inside the paper cells ---- */
.row-actions { margin-top: 5px; display: flex; align-items: center; gap: 7px; flex-wrap: wrap; }
.row-actions .btn { padding: 2px 8px; font-size: 11px; }
.row-actions select { width: auto; font-size: 11px; padding: 1px 4px; height: auto; }
