/* Pasok — styles derived from design/*.dc.html. No inline styles (CSP). */
:root {
  --primary: #0F5F59; --primary-hover: #0B4743; --text: #17211D; --muted: #56625C; --text-2: #3C4843;
  --bg: #F5F6F3; --card: #FFFFFF; --border: #E1E4DE; --border-soft: #EEF0EC; --input: #CBD1CA; --nav-active: #E3EFEC;
  --green-bg: #E3EFEC; --green: #0B4743; --amber-bg: #FDF1DC; --amber: #7A4A00; --blue-bg: #E6ECF7; --blue: #23407A;
  --red-bg: #FBE4E1; --red: #9B2C1F; --grey-bg: #EEF0EC; --grey: #3C4843;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: 'Plus Jakarta Sans', system-ui, sans-serif; color: var(--text); background: var(--bg); font-size: 14px; }
a { color: var(--primary); } a:hover { color: var(--primary-hover); }
h1 { margin: 0; font-size: 28px; font-weight: 800; }
h2 { margin: 0; font-size: 17px; font-weight: 700; }
h2.lg { font-size: 18px; font-weight: 800; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.muted { color: var(--muted); } .small { font-size: 12px; } .s13 { font-size: 13px; }
.strong { font-weight: 600; } .bold { font-weight: 700; } .x-bold { font-weight: 800; }
.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.nowrap { white-space: nowrap; } .mono { font-family: ui-monospace, Menlo, monospace; font-size: 13px; color: var(--text-2); }
.t-red { color: var(--red); } .t-amber { color: var(--amber); } .t-green { color: var(--green); }
.stack { display: flex; flex-direction: column; } .gap4 { gap: 4px; } .gap6 { gap: 6px; } .gap12 { gap: 12px; } .gap16 { gap: 16px; }
.row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
/* a labelled field next to a button: line the button up with the input, not the label */
.row.field-row { align-items: flex-end; }
.between { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.end { justify-content: flex-end; }
.inline { display: inline; margin: 0; }

/* layout */
.app { min-height: 100vh; display: flex; flex-wrap: wrap; }
.side { flex: 1 1 240px; max-width: 100%; background: var(--card); border-right: 1px solid var(--border); padding: 24px 16px; display: flex; flex-direction: column; gap: 2px; }
.brand { display: flex; align-items: center; gap: 10px; padding: 0 8px 20px; }
/* Logo mark (static/logo-mark.png, white background) */
.logo { width: 36px; height: 36px; border-radius: 10px; background: #fff; border: 1px solid var(--border); object-fit: contain; flex: none; display: block; }
.brand-name { font-weight: 700; font-size: 15px; line-height: 1.25; }
.nav-sec { font-size: 11px; font-weight: 700; letter-spacing: .06em; color: var(--muted); padding: 16px 12px 6px; }
.nav-sec:first-of-type { padding-top: 12px; }
.nav-link { display: block; padding: 12px; border-radius: 8px; text-decoration: none; font-size: 14px; color: var(--text-2); font-weight: 500; }
.nav-link:hover { background: var(--bg); color: var(--text); }
.nav-link.active { background: var(--nav-active); color: var(--primary); font-weight: 700; }
.nav-links { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.menu-btn { display: none; }
.side-user { margin-top: auto; padding: 16px 12px 0; border-top: 1px solid var(--border-soft); display: flex; flex-direction: column; gap: 6px; }
.linkbtn { font: inherit; font-size: 13px; padding: 6px 0; background: none; border: 0; color: var(--primary); text-decoration: underline; cursor: pointer; text-align: left; }
.main { flex: 999 1 560px; min-width: 0; padding: 32px 40px; display: flex; flex-direction: column; gap: 24px; }
.head { display: flex; flex-wrap: wrap; gap: 16px; align-items: flex-end; justify-content: space-between; }
.eyebrow { font-size: 13px; color: var(--muted); }
.split { display: flex; flex-wrap: wrap; gap: 16px; align-items: flex-start; }
.split > .wide { flex: 999 1 560px; min-width: 0; }
.split > .narrow { flex: 1 1 340px; min-width: 0; }
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; }
.two-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(420px, 100%), 1fr)); gap: 16px; }
.fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; }
.fields.tight { grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; }
.pair { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }

/* cards */
.card { background: var(--card); border: 1px solid var(--border); border-radius: 12px; padding: 20px; display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.card.pad24 { padding: 24px; gap: 16px; } .card.gap20 { gap: 20px; }
.stat { gap: 6px; } .stat-label { font-size: 13px; color: var(--muted); } .stat-value { font-size: 26px; font-weight: 800; } .stat-sub { font-size: 12px; color: var(--muted); }
.big { font-size: 22px; font-weight: 800; }

/* forms */
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
label, .label { font-size: 13px; font-weight: 600; }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=search], input[type=date], select, textarea {
  font: inherit; font-size: 14px; padding: 11px 14px; border: 1px solid var(--input); border-radius: 8px; color: var(--text); background: #fff; width: 100%; min-width: 0;
}
select { padding: 11px 12px; }
/* inputs and buttons share one height so they line up side by side */
input[type=text], input[type=email], input[type=password], input[type=number], input[type=search], input[type=date], select { min-height: 44px; }
.btn { min-height: 44px; }
.btn-sm { min-height: 36px; }
.btn-icon { min-height: 0; }
input.qty, input.price { min-height: 0; }
/* inside an inline row, controls keep their natural width (phones override below) */
.row > select, .row > input:not(.search) { width: auto; max-width: 100%; }
.row > input.qty, .row > input.price { min-height: 44px; }
/* reset-password cell in the users table: input + button on one line */
.pw-row { flex-wrap: nowrap; }
.row > input.pw { width: 200px; }
.between > .totals-box { margin-left: auto; }
.between > .filter-row { flex-basis: 100%; }
.filter-row > select { flex: 1 1 100%; }
textarea { resize: vertical; }
input[readonly] { background: var(--bg); border-color: var(--border); }
input:focus-visible, select:focus-visible, textarea:focus-visible, button:focus-visible, a:focus-visible { outline: 2px solid var(--primary); outline-offset: 1px; }
input.emph { border-color: var(--primary); font-weight: 700; }
input.qty { width: 90px; text-align: right; padding: 8px 10px; }
input.price { width: 140px; text-align: right; padding: 8px 10px; }
input.search { width: 240px; }
.check { display: flex; align-items: center; gap: 10px; font-size: 14px; font-weight: 400; }
.check input { width: 20px; height: 20px; accent-color: var(--primary); margin: 0; flex: none; }
.form-error { background: var(--red-bg); color: var(--red); border-radius: 8px; padding: 10px 14px; font-size: 13px; font-weight: 600; }

/* buttons */
.btn { font: inherit; display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 12px 18px; border-radius: 8px; border: 1px solid var(--input); background: #fff; color: var(--text); text-decoration: none; font-size: 14px; font-weight: 600; cursor: pointer; white-space: nowrap; }
.btn:hover { background: var(--bg); color: var(--text); }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; font-weight: 700; }
.btn-primary:hover { background: var(--primary-hover); border-color: var(--primary-hover); color: #fff; }
.btn-outline { border-color: var(--primary); color: var(--primary); font-weight: 700; }
.btn-outline:hover { color: var(--primary-hover); }
.btn-dashed { border: 1px dashed var(--primary); color: var(--primary); padding: 10px 16px; }
.btn-danger { border-color: var(--red); color: var(--red); }
.btn-danger:hover { background: var(--red-bg); color: var(--red); }
.btn-sm { font-size: 13px; padding: 8px 12px; font-weight: 500; }
.btn-icon { width: 36px; height: 36px; padding: 0; }
.btn-icon svg { width: 16px; height: 16px; }

/* tables */
/* position: relative keeps absolutely positioned children (.sr-only headers) inside the scroll box */
.table-wrap { overflow-x: auto; position: relative; }
table { border-collapse: collapse; width: 100%; }
th { text-align: left; font-size: 12px; font-weight: 600; color: var(--muted); padding: 10px 12px; border-bottom: 1px solid var(--border); white-space: nowrap; }
td { font-size: 14px; padding: 12px; border-bottom: 1px solid var(--border-soft); vertical-align: middle; }
th.num, td.num { text-align: right; }
tr.warn { background: #FFFAF0; } tr.sel { background: #F0F7F5; }
tr.click { cursor: pointer; }
.cell { display: flex; flex-direction: column; min-width: 180px; }
td.pname { min-width: 180px; }
.mt12 { margin-top: 12px; }
.empty { color: var(--muted); text-align: center; padding: 24px; }
details.audit-detail summary { cursor: pointer; list-style: none; }
details.audit-detail summary::-webkit-details-marker { display: none; }
.audit-extra { font-size: 12px; color: var(--muted); margin-top: 6px; word-break: break-all; }

/* pills & chips */
.pill { display: inline-block; padding: 4px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.pill-green { background: var(--green-bg); color: var(--green); } .pill-amber { background: var(--amber-bg); color: var(--amber); }
.pill-blue { background: var(--blue-bg); color: var(--blue); } .pill-red { background: var(--red-bg); color: var(--red); }
.pill-grey { background: var(--grey-bg); color: var(--grey); }
.stock-low { display: inline-block; padding: 3px 10px; border-radius: 999px; background: var(--amber-bg); color: var(--amber); font-weight: 700; }
.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip { padding: 6px 12px; border-radius: 999px; border: 1px solid var(--input); font-size: 13px; font-weight: 600; color: var(--text); text-decoration: none; }
.chip:hover { color: var(--text); background: var(--bg); }
.chip.on { background: var(--text); border-color: var(--text); color: #fff; }
.chip.zero { border-style: dashed; color: var(--muted); font-weight: 400; }

/* notes & summaries */
.note { background: var(--bg); border-radius: 8px; padding: 12px 14px; font-size: 13px; color: var(--text-2); line-height: 1.5; }
.note-warn { background: var(--amber-bg); color: #5C3800; }
.note-red { background: var(--red-bg); color: var(--red); }
.markup-box { background: var(--green-bg); border-radius: 8px; padding: 12px 14px; display: flex; justify-content: space-between; align-items: center; }
.markup-box span { font-size: 13px; color: var(--green); font-weight: 600; } .markup-box output { font-size: 18px; font-weight: 800; color: var(--green); }
.sum { display: flex; justify-content: space-between; font-size: 14px; gap: 12px; }
.sum > :first-child { color: var(--muted); } .sum > :last-child { font-variant-numeric: tabular-nums; }
.sum-big { display: flex; justify-content: space-between; font-size: 18px; font-weight: 800; }
.sum-total { display: flex; justify-content: space-between; align-items: baseline; padding-top: 12px; border-top: 1px solid var(--border); }
.sum-total > :first-child { font-size: 15px; font-weight: 700; } .sum-total > :last-child { font-size: 24px; font-weight: 800; font-variant-numeric: tabular-nums; }
.ppn-box { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 14px; border-radius: 8px; background: var(--bg); }
.ppn-box .check { font-weight: 600; } .ppn-box .check input { width: 22px; height: 22px; cursor: pointer; }
.totals-box { min-width: 280px; display: flex; flex-direction: column; gap: 8px; }
.activity { display: flex; flex-direction: column; gap: 2px; padding: 8px 0; border-bottom: 1px solid var(--border-soft); }
.flash { border-radius: 8px; padding: 12px 14px; font-size: 14px; font-weight: 600; background: var(--green-bg); color: var(--green); }
.flash.err { background: var(--red-bg); color: var(--red); }
.danger-zone { border-top: 1px solid var(--border-soft); padding-top: 12px; }

/* login */
.login { min-height: 100vh; display: flex; flex-wrap: wrap; }
.login-hero { flex: 1 1 420px; background: var(--primary); color: #fff; padding: 56px; display: flex; flex-direction: column; justify-content: space-between; gap: 40px; }
.login-hero .logo { width: 44px; height: 44px; border-radius: 12px; border: 0; padding: 3px; }
.login-hero h1 { font-size: 40px; line-height: 1.15; max-width: 460px; }
.login-hero p { margin: 0; font-size: 16px; line-height: 1.6; color: #D5E7E3; max-width: 460px; }
.on-dark { color: #D5E7E3; font-size: 13px; }
.login-side { flex: 1 1 420px; display: flex; align-items: center; justify-content: center; padding: 48px 24px; }
.login-card { width: 100%; max-width: 400px; background: #fff; border: 1px solid var(--border); border-radius: 16px; padding: 36px; display: flex; flex-direction: column; gap: 20px; }
.login-card h2 { font-size: 24px; font-weight: 800; }
.login-card input { padding: 12px 14px; }
.login-card .btn { padding: 13px 18px; font-size: 15px; }

/* print: A4 invoice */
.print-shell { background: #E9EBE6; min-height: 100vh; padding: 24px 16px; display: flex; flex-direction: column; align-items: center; gap: 16px; }
.toolbar { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; }
.a4 { width: 794px; max-width: 100%; min-height: 1123px; padding: 56px; background: #fff; color: var(--text); display: flex; flex-direction: column; gap: 28px; box-shadow: 0 1px 3px rgba(0,0,0,.12); }
.a4 .hdr { display: flex; justify-content: space-between; align-items: flex-start; gap: 24px; }
.a4 .logo { width: 52px; height: 52px; border: 0; border-radius: 0; }
.a4 .co { display: flex; gap: 14px; align-items: flex-start; }
.a4 .co-name { font-size: 20px; font-weight: 800; }
.a4 .co-line, .a4 .t2 { font-size: 14px; color: var(--text-2); }
.a4 .title { font-size: 34px; font-weight: 800; letter-spacing: .04em; color: var(--primary); }
.a4 .inv-no { font-size: 15px; font-weight: 700; }
.a4 .right { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.a4 .bill { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px; padding: 20px; background: var(--bg); border-radius: 10px; }
.a4 .cap { font-size: 13px; font-weight: 700; color: var(--muted); letter-spacing: .05em; }
.a4 .bill-name { font-size: 16px; font-weight: 700; }
.a4 .meta { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 16px; align-content: start; font-size: 14px; }
.a4 .meta > :nth-child(odd) { color: var(--muted); } .a4 .meta > :nth-child(even) { font-weight: 600; text-align: right; }
.a4 th { font-size: 13px; font-weight: 700; color: var(--text-2); padding: 10px 8px; border-bottom: 2px solid var(--text); }
.a4 td { font-size: 15px; padding: 12px 8px; border-bottom: 1px solid var(--border); vertical-align: top; }
.a4 td .sub { font-size: 13px; color: var(--muted); }
.a4 .foot { display: flex; justify-content: space-between; gap: 32px; align-items: flex-start; }
.a4 .words { flex: 1 1 0; display: flex; flex-direction: column; gap: 6px; font-size: 14px; line-height: 1.5; }
.a4 .words i { font-style: italic; }
.a4 .totals { width: 300px; display: flex; flex-direction: column; gap: 8px; }
.a4 .totals .sum { font-size: 15px; } .a4 .totals .sum > :first-child { color: var(--text-2); }
.a4 .grand { display: flex; justify-content: space-between; align-items: baseline; padding: 12px 14px; margin-top: 4px; background: var(--primary); color: #fff; border-radius: 8px; }
.a4 .grand > :first-child { font-size: 15px; font-weight: 700; } .a4 .grand > :last-child { font-size: 20px; font-weight: 800; }
.a4 .sign-row { margin-top: auto; display: flex; justify-content: space-between; gap: 32px; align-items: flex-end; padding-top: 24px; border-top: 1px solid var(--border); }
.a4 .sign { display: flex; flex-direction: column; align-items: center; gap: 64px; min-width: 200px; font-size: 14px; color: var(--text-2); }
.a4 .sign b { color: var(--text); border-top: 1px solid var(--text); padding-top: 6px; width: 100%; text-align: center; }
.a4 .stamp { font-size: 22px; font-weight: 800; color: var(--red); border: 3px solid var(--red); border-radius: 8px; padding: 4px 12px; align-self: flex-end; }

/* dot matrix preview */
.dm { width: 912px; max-width: 100%; overflow-x: auto; padding: 40px 72px; background: #fff; color: #000; box-shadow: 0 1px 3px rgba(0,0,0,.12); }
.dm pre { margin: 0; font-family: 'Courier Prime', 'Courier New', monospace; font-size: 16px; line-height: 20px; white-space: pre; color: #000; }

/* ---------- Mobile / small tablets ---------- */
@media screen and (max-width: 760px) {
  .app { display: block; }
  .side { position: sticky; top: 0; z-index: 30; max-width: none; padding: 10px 16px; border-right: 0; border-bottom: 1px solid var(--border); gap: 0; }
  .brand { padding: 0; gap: 10px; }
  .brand-text { flex: 1; min-width: 0; }
  .menu-btn { display: inline-flex; align-items: center; gap: 6px; font: inherit; font-size: 14px; font-weight: 600; color: var(--text);
    background: #fff; border: 1px solid var(--input); border-radius: 8px; padding: 0 12px; min-height: 44px; cursor: pointer; }
  .menu-btn svg { width: 20px; height: 20px; }
  .nav-links { display: none; max-height: calc(100vh - 70px); overflow-y: auto; padding-top: 8px; }
  .side.open .nav-links { display: flex; }
  .nav-sec { padding: 12px 12px 4px; }
  .nav-link { padding: 12px; }
  .side-user { margin-top: 8px; }

  .main { padding: 16px; gap: 16px; }
  h1 { font-size: 22px; }
  .head { align-items: stretch; gap: 12px; }
  .head > .row, .head > .row form { width: 100%; }
  .head > .row > .btn, .head > .btn { flex: 1 1 auto; }
  input.search { width: 100%; }
  .card, .card.pad24 { padding: 16px; }
  .stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .stat-value { font-size: 18px; } .big { font-size: 18px; }
  .two-grid, .fields, .fields.tight { grid-template-columns: minmax(0, 1fr); }
  .totals-box { min-width: 0; width: 100%; }
  .between > .row { width: 100%; }
  .row > select, .row > .field { flex: 1 1 100%; }
  td, th { padding: 10px 8px; }

  /* table.rtable: each row becomes a small card; labels come from data-label */
  table.rtable thead { display: none; }
  table.rtable, table.rtable tbody { display: block; }
  table.rtable tr { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 12px; padding: 12px 0; border-bottom: 1px solid var(--border-soft); position: relative; }
  table.rtable tr.warn, table.rtable tr.sel { padding-left: 8px; padding-right: 8px; }
  table.rtable td { display: block; padding: 0; border: 0; text-align: left; white-space: normal; }
  table.rtable td.full { grid-column: 1 / -1; }
  table.rtable td.full .cell { min-width: 0; }
  table.rtable td.act { position: absolute; top: 8px; right: 0; }
  table.rtable td.act ~ td, table.rtable tr:has(td.act) td.full { padding-right: 52px; }
  table.rtable td[data-label]::before { content: attr(data-label); display: block; font-size: 12px; font-weight: 600; color: var(--muted); margin-bottom: 2px; }
  table.rtable input.qty, table.rtable input.price { width: 100%; text-align: left; }

  /* touch targets + no iOS zoom on focus */
  input[type=text], input[type=email], input[type=password], input[type=number], input[type=search], input[type=date], select, textarea { font-size: 16px; }
  .btn { min-height: 44px; }
  .btn-sm { min-height: 40px; }
  .btn-icon { width: 44px; height: 44px; }
  .chip { padding: 9px 14px; }

  .login-hero { flex-basis: 100%; padding: 20px 16px; gap: 12px; justify-content: flex-start; }
  .login-hero h1 { font-size: 20px; }
  .login-hero p, .login-hero > .on-dark { display: none; }
  .login-side { flex-basis: 100%; padding: 20px 16px 32px; align-items: flex-start; }
  .login-card { padding: 24px; }

  .print-shell { padding: 12px 8px; }
  .toolbar { width: 100%; } .toolbar .btn { flex: 1 1 auto; }
  .a4 { padding: 20px 16px; gap: 20px; min-height: 0; }
  .a4 .hdr, .a4 .foot, .a4 .sign-row { flex-wrap: wrap; }
  .a4 .right { align-items: flex-start; }
  .a4 .title { font-size: 26px; }
  .a4 .bill { grid-template-columns: minmax(0, 1fr); padding: 14px; }
  .a4 .totals { width: 100%; }
  .a4 table { display: block; overflow-x: auto; }
  .dm { padding: 16px; }
  .dm pre { font-size: 12px; line-height: 16px; }
}

@media print {
  @page { size: A4; margin: 0; }
  /* keep the invoice's fills (total box, billing panel) even when the
     browser's "Background graphics" option is off */
  .a4, .a4 * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  body { background: #fff; }
  .toolbar, .no-print { display: none !important; }
  .print-shell { background: #fff; padding: 0; display: block; }
  .a4 { box-shadow: none; width: 210mm; min-height: 297mm; max-width: none; }
  .dm { box-shadow: none; padding: 0; width: auto; overflow: visible; }
}
