/* =====================================================================
   UAT Foods ERP - application stylesheet
   ===================================================================== */
:root {
  --brand-900: #0f2a24;
  --brand-800: #143a31;
  --brand-700: #1b4d40;
  --brand-600: #23624f;
  --brand-500: #2f7d63;
  --brand-100: #e3f1eb;
  --brand-50:  #f2f8f5;
  --accent:    #c9852b;

  --bg:        #f4f6f8;
  --surface:   #ffffff;
  --surface-2: #f8fafb;
  --border:    #e2e7ec;
  --border-strong: #cfd6dd;
  --text:      #1d2733;
  --text-2:    #4d5b6a;
  --muted:     #7b8794;

  --ok:        #1e7f4f;  --ok-bg: #e6f4ec;
  --warn:      #9a6200;  --warn-bg: #fdf3dc;
  --danger:    #b42318;  --danger-bg: #fdecea;
  --info:      #1f5fa8;  --info-bg: #e8f0fb;

  --radius: 8px;
  --radius-sm: 6px;
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, .06);
  --shadow: 0 4px 16px rgba(16, 24, 40, .08);
  --shadow-lg: 0 20px 48px rgba(16, 24, 40, .18);
  --sidebar-w: 248px;
  --topbar-h: 58px;
  --font: "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: "Cascadia Mono", Consolas, "SFMono-Regular", Menlo, monospace;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; font-family: var(--font); font-size: 14px; color: var(--text); background: var(--bg); line-height: 1.45; }
a { color: var(--brand-600); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { margin: 0; font-weight: 600; color: var(--text); }
h1 { font-size: 22px; } h2 { font-size: 17px; } h3 { font-size: 15px; } h4 { font-size: 13px; }
button, input, select, textarea { font: inherit; color: inherit; }
.num, td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.mono { font-family: var(--mono); font-size: 12.5px; }
.muted { color: var(--muted); }
.text-2 { color: var(--text-2); }
.small { font-size: 12px; }
.strong { font-weight: 600; }
.pos { color: var(--ok); } .neg { color: var(--danger); }
.hidden { display: none !important; }
.nowrap { white-space: nowrap; }
.mt-0 { margin-top: 0; } .mt-1 { margin-top: 8px; } .mt-2 { margin-top: 16px; } .mt-3 { margin-top: 24px; }
.mb-1 { margin-bottom: 8px; } .mb-2 { margin-bottom: 16px; }
.flex { display: flex; gap: 8px; align-items: center; }
.flex-wrap { flex-wrap: wrap; }
.spacer { flex: 1; }
.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid-5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }
@media (max-width: 1400px) { .grid-5 .stat .value { font-size: 20px; } }
@media (max-width: 1100px) { .grid-4, .grid-5 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .grid-5 .stat .value { font-size: 24px; } }
@media (max-width: 720px) { .grid-2, .grid-3, .grid-4, .grid-5 { grid-template-columns: minmax(0, 1fr); } }

/* ---------------------------------------------------------------- layout */
.app { display: flex; min-height: 100vh; }
.sidebar {
  width: var(--sidebar-w); background: var(--brand-900); color: #c9d8d2; position: fixed; inset: 0 auto 0 0;
  display: flex; flex-direction: column; z-index: 40; transition: transform .2s ease;
}
.sidebar .brand { display: flex; align-items: center; gap: 10px; padding: 16px 18px; height: var(--topbar-h); border-bottom: 1px solid rgba(255,255,255,.07); }
.brand-mark { width: 32px; height: 32px; border-radius: 8px; background: var(--brand-500); display: grid; place-items: center; color: #fff; font-weight: 700; font-size: 13px; letter-spacing: .5px; }
.brand-name { color: #fff; font-weight: 600; font-size: 15px; line-height: 1.1; }
.brand-sub { font-size: 11px; color: #8fb1a5; }
.nav { flex: 1; overflow-y: auto; padding: 10px 10px 20px; }
.nav-section { font-size: 10.5px; text-transform: uppercase; letter-spacing: .8px; color: #6f9184; padding: 14px 10px 6px; }
.nav a { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: var(--radius-sm); color: #c9d8d2; font-size: 13.5px; text-decoration: none; }
.nav a:hover { background: rgba(255,255,255,.06); color: #fff; }
.nav a.active { background: var(--brand-600); color: #fff; }
.nav svg { width: 17px; height: 17px; flex: none; opacity: .9; }
.sidebar-foot { padding: 12px 18px; font-size: 11px; color: #6f9184; border-top: 1px solid rgba(255,255,255,.07); }

.main { flex: 1; margin-left: var(--sidebar-w); min-width: 0; display: flex; flex-direction: column; }
.topbar {
  height: var(--topbar-h); background: var(--surface); border-bottom: 1px solid var(--border); display: flex; align-items: center;
  gap: 12px; padding: 0 22px; position: sticky; top: 0; z-index: 30;
}
.topbar .menu-btn { display: none; }
.crumbs { font-size: 13px; color: var(--muted); }
.crumbs strong { color: var(--text); font-weight: 600; }
.user-menu { position: relative; }
.user-btn { display: flex; align-items: center; gap: 10px; background: none; border: 1px solid transparent; padding: 5px 8px; border-radius: var(--radius); cursor: pointer; }
.user-btn:hover { background: var(--surface-2); border-color: var(--border); }
.avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--brand-100); color: var(--brand-700); display: grid; place-items: center; font-weight: 600; font-size: 13px; }
.user-meta { text-align: left; line-height: 1.15; }
.user-meta .n { font-weight: 600; font-size: 13px; }
.user-meta .r { font-size: 11.5px; color: var(--muted); }
.dropdown { position: absolute; right: 0; top: calc(100% + 6px); background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); min-width: 200px; padding: 6px; display: none; z-index: 50; }
.dropdown.open { display: block; }
.dropdown button, .dropdown a { display: block; width: 100%; text-align: left; background: none; border: 0; padding: 8px 10px; border-radius: var(--radius-sm); cursor: pointer; color: var(--text); font-size: 13.5px; }
.dropdown button:hover, .dropdown a:hover { background: var(--surface-2); text-decoration: none; }
.demo-banner { background: var(--warn-bg); color: var(--warn); font-size: 12px; padding: 4px 10px; border-radius: 999px; font-weight: 600; }

.content { padding: 22px; max-width: 1480px; width: 100%; }
.page-head { display: flex; align-items: flex-end; gap: 12px; margin-bottom: 18px; flex-wrap: wrap; }
.page-head .titles { flex: 1; min-width: 220px; }
.page-head p { margin: 4px 0 0; color: var(--text-2); font-size: 13px; }
.page-actions { display: flex; gap: 8px; flex-wrap: wrap; }

@media (max-width: 960px) {
  .sidebar { transform: translateX(-100%); }
  .app.nav-open .sidebar { transform: none; box-shadow: var(--shadow-lg); }
  .main { margin-left: 0; }
  .topbar .menu-btn { display: inline-flex; }
  .content { padding: 16px; }
  .user-meta { display: none; }
}

/* ----------------------------------------------------------------- cards */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-sm); }
.card-head { display: flex; align-items: center; gap: 10px; padding: 14px 16px; border-bottom: 1px solid var(--border); }
.card-head h3 { flex: 1; }
.card-body { padding: 16px; }
.card-body.flush { padding: 0; }
.stat { padding: 16px; }
.stat .label { font-size: 12px; text-transform: uppercase; letter-spacing: .5px; color: var(--muted); font-weight: 600; }
.stat .value { font-size: 24px; font-weight: 650; margin-top: 6px; font-variant-numeric: tabular-nums; letter-spacing: -.3px; }
.stat .sub { font-size: 12.5px; color: var(--text-2); margin-top: 4px; }
.stat.accent { border-left: 3px solid var(--brand-500); }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 6px 18px; font-size: 13.5px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; font-weight: 500; }
.summary-strip { display: flex; flex-wrap: wrap; gap: 0; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
.summary-strip > div { flex: 1; min-width: 150px; padding: 12px 16px; border-right: 1px solid var(--border); }
.summary-strip > div:last-child { border-right: 0; }
.summary-strip .label { font-size: 11.5px; color: var(--muted); text-transform: uppercase; letter-spacing: .4px; font-weight: 600; }
.summary-strip .value { font-size: 18px; font-weight: 650; font-variant-numeric: tabular-nums; margin-top: 2px; }

/* --------------------------------------------------------------- buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 36px; padding: 0 14px; border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong); background: var(--surface); color: var(--text); cursor: pointer; font-weight: 500; font-size: 13.5px; white-space: nowrap;
}
.btn:hover { background: var(--surface-2); text-decoration: none; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn svg { width: 16px; height: 16px; }
.btn-primary { background: var(--brand-600); border-color: var(--brand-600); color: #fff; }
.btn-primary:hover { background: var(--brand-700); }
.btn-danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-danger:hover { background: #911c13; }
.btn-ghost { border-color: transparent; background: transparent; }
.btn-ghost:hover { background: var(--surface-2); }
.btn-sm { height: 30px; padding: 0 10px; font-size: 12.5px; }
.btn-lg { height: 46px; padding: 0 22px; font-size: 15px; }
.btn-icon { width: 32px; padding: 0; }
.btn.loading { position: relative; color: transparent !important; }
.btn.loading::after { content: ""; position: absolute; width: 16px; height: 16px; border: 2px solid rgba(255,255,255,.6); border-top-color: #fff; border-radius: 50%; animation: spin .7s linear infinite; }
.btn:not(.btn-primary):not(.btn-danger).loading::after { border-color: var(--border-strong); border-top-color: var(--brand-600); }
@keyframes spin { to { transform: rotate(360deg); } }

/* ----------------------------------------------------------------- forms */
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 16px; }
.form-grid.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.form-grid.cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.form-grid .span-2 { grid-column: span 2; }
.form-grid .span-all { grid-column: 1 / -1; }
@media (max-width: 720px) { .form-grid, .form-grid.cols-3, .form-grid.cols-4 { grid-template-columns: minmax(0, 1fr); } .form-grid .span-2 { grid-column: auto; } }
.field label { display: block; font-size: 12.5px; font-weight: 600; color: var(--text-2); margin-bottom: 5px; }
.field label .req { color: var(--danger); margin-left: 2px; }
.field .hint { font-size: 11.5px; color: var(--muted); margin-top: 4px; }
.field .err { font-size: 12px; color: var(--danger); margin-top: 4px; display: none; }
.field.invalid .err { display: block; }
.field.invalid .input { border-color: var(--danger); box-shadow: 0 0 0 3px var(--danger-bg); }
.input {
  width: 100%; height: 36px; padding: 0 10px; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); background: var(--surface);
  outline: none; transition: border-color .12s, box-shadow .12s;
}
textarea.input { height: auto; min-height: 70px; padding: 8px 10px; resize: vertical; }
.input:focus { border-color: var(--brand-500); box-shadow: 0 0 0 3px var(--brand-100); }
.input:disabled, .input[readonly] { background: var(--surface-2); color: var(--text-2); }
.input.num { text-align: right; }
select.input { padding-right: 6px; }
.input-sm { height: 30px; font-size: 13px; }
.check { display: inline-flex; align-items: center; gap: 7px; cursor: pointer; font-size: 13.5px; }
.check input { width: 16px; height: 16px; accent-color: var(--brand-600); }
.segmented { display: inline-flex; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); overflow: hidden; }
.segmented button { border: 0; background: var(--surface); padding: 0 14px; height: 34px; cursor: pointer; font-weight: 500; border-right: 1px solid var(--border-strong); }
.segmented button:last-child { border-right: 0; }
.segmented button.active { background: var(--brand-600); color: #fff; }
.filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.filters .input { width: auto; min-width: 140px; }
.filters .search { min-width: 220px; }

/* ---------------------------------------------------------------- tables */
.table-wrap { overflow-x: auto; }
table.table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.table th { text-align: left; font-size: 11.5px; text-transform: uppercase; letter-spacing: .4px; color: var(--muted); font-weight: 600; background: var(--surface-2); padding: 9px 12px; border-bottom: 1px solid var(--border); white-space: nowrap; }
.table td { padding: 9px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tbody tr:hover td { background: #fafcfb; }
.table tbody tr.clickable { cursor: pointer; }
.table tfoot td { font-weight: 650; background: var(--surface-2); border-top: 1px solid var(--border-strong); }
.table tr.row-muted td { color: var(--muted); }
.table .actions { text-align: right; white-space: nowrap; }
.table.compact td, .table.compact th { padding: 6px 10px; }
.table.fixed { table-layout: fixed; }
.table.fixed td { white-space: normal; }
.lines-table select.input { min-width: 220px; }
.stat .value { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pos-product { color: var(--text); }
.table input.input { height: 32px; }
.table-foot { display: flex; align-items: center; gap: 12px; padding: 10px 14px; font-size: 13px; color: var(--text-2); flex-wrap: wrap; }
.pager { display: flex; gap: 4px; align-items: center; }

.state { padding: 40px 20px; text-align: center; color: var(--muted); }
.state .ico { font-size: 28px; margin-bottom: 6px; opacity: .6; }
.state.error { color: var(--danger); }
.skeleton { height: 12px; background: linear-gradient(90deg, #eef1f4 25%, #f6f8fa 50%, #eef1f4 75%); background-size: 200% 100%; animation: shimmer 1.2s infinite; border-radius: 4px; }
@keyframes shimmer { to { background-position: -200% 0; } }

/* ---------------------------------------------------------------- badges */
.badge { display: inline-flex; align-items: center; gap: 5px; padding: 2px 9px; border-radius: 999px; font-size: 11.5px; font-weight: 600; white-space: nowrap; background: var(--surface-2); color: var(--text-2); border: 1px solid var(--border); }
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .8; }
.badge.plain::before { display: none; }
.badge.ok { background: var(--ok-bg); color: var(--ok); border-color: transparent; }
.badge.warn { background: var(--warn-bg); color: var(--warn); border-color: transparent; }
.badge.danger { background: var(--danger-bg); color: var(--danger); border-color: transparent; }
.badge.info { background: var(--info-bg); color: var(--info); border-color: transparent; }
.badge.pending { background: #fff6e5; color: #8a5a00; border: 1px dashed #e0b45c; }

/* ------------------------------------------------------------------ tabs */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--border); margin-bottom: 16px; overflow-x: auto; }
.tabs button { background: none; border: 0; padding: 10px 14px; cursor: pointer; color: var(--text-2); font-weight: 500; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tabs button:hover { color: var(--text); }
.tabs button.active { color: var(--brand-600); border-bottom-color: var(--brand-600); font-weight: 600; }

/* ---------------------------------------------------------------- modals */
.modal-backdrop { position: fixed; inset: 0; background: rgba(15, 23, 32, .45); z-index: 100; display: flex; align-items: flex-start; justify-content: center; padding: 6vh 16px; overflow-y: auto; }
.modal { background: var(--surface); border-radius: 10px; box-shadow: var(--shadow-lg); width: 100%; max-width: 560px; display: flex; flex-direction: column; max-height: 88vh; }
.modal.lg { max-width: 860px; } .modal.xl { max-width: 1120px; } .modal.sm { max-width: 420px; }
.modal-head { display: flex; align-items: center; padding: 16px 20px; border-bottom: 1px solid var(--border); }
.modal-head h2 { flex: 1; }
.modal-body { padding: 18px 20px; overflow-y: auto; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 20px; border-top: 1px solid var(--border); background: var(--surface-2); border-radius: 0 0 10px 10px; }
.close-x { background: none; border: 0; font-size: 22px; line-height: 1; cursor: pointer; color: var(--muted); padding: 2px 6px; border-radius: 4px; }
.close-x:hover { background: var(--surface-2); color: var(--text); }

/* ---------------------------------------------------------------- toasts */
.toasts { position: fixed; right: 18px; bottom: 18px; display: flex; flex-direction: column; gap: 8px; z-index: 200; max-width: 380px; }
.toast { background: var(--text); color: #fff; padding: 11px 14px; border-radius: var(--radius); box-shadow: var(--shadow); font-size: 13.5px; display: flex; gap: 10px; align-items: flex-start; animation: slidein .18s ease; border-left: 4px solid var(--muted); }
.toast.success { border-left-color: #3fbf7f; } .toast.error { border-left-color: #f0645a; } .toast.warn { border-left-color: #f0b44b; }
@keyframes slidein { from { transform: translateY(8px); opacity: 0; } }

/* ------------------------------------------------------------------ alerts */
.alert { padding: 10px 14px; border-radius: var(--radius-sm); font-size: 13.5px; border: 1px solid transparent; }
.alert.info { background: var(--info-bg); color: var(--info); }
.alert.warn { background: var(--warn-bg); color: var(--warn); }
.alert.danger { background: var(--danger-bg); color: var(--danger); }
.alert.ok { background: var(--ok-bg); color: var(--ok); }

.with-side { display: grid; gap: 16px; grid-template-columns: minmax(0, 1fr) 340px; align-items: start; }
@media (max-width: 1100px) { .with-side { grid-template-columns: minmax(0, 1fr); } }
.sub-head { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; flex-wrap: wrap; }
.sub-head p { margin: 2px 0 0; color: var(--text-2); font-size: 13px; }

/* ------------------------------------------------------------------- POS */
.pos-layout { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 16px; align-items: start; }
@media (max-width: 1100px) { .pos-layout { grid-template-columns: minmax(0, 1fr); } }
.pos-products { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 10px; }
.pos-product { text-align: left; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px; cursor: pointer; display: flex; flex-direction: column; gap: 4px; transition: border-color .12s, box-shadow .12s; }
.pos-product:hover { border-color: var(--brand-500); box-shadow: 0 0 0 3px var(--brand-100); }
.pos-product:disabled { opacity: .5; cursor: not-allowed; box-shadow: none; border-color: var(--border); }
.pos-product .nm { font-weight: 600; font-size: 13.5px; }
.pos-product .pr { font-size: 15px; font-weight: 650; color: var(--brand-700); font-variant-numeric: tabular-nums; }
.pos-product .st { font-size: 12px; color: var(--muted); }
.pos-cart { position: sticky; top: calc(var(--topbar-h) + 16px); }
.pos-total { font-size: 28px; font-weight: 700; font-variant-numeric: tabular-nums; color: var(--brand-800); }
.cart-line { display: grid; grid-template-columns: 1fr 74px 90px 28px; gap: 6px; align-items: center; padding: 8px 0; border-bottom: 1px dashed var(--border); }
.cart-line .nm { font-weight: 600; font-size: 13px; }
.cart-line .sub { font-size: 11.5px; color: var(--muted); }

/* --------------------------------------------------------------- charts */
.chart { width: 100%; position: relative; }
.chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart .bar { fill: var(--brand-500); }
.chart .bar:hover, .chart .hit:hover + .bar { fill: var(--brand-700); }
.chart .grid-line { stroke: #edf0f3; stroke-width: 1; }
.chart .axis-label { fill: var(--muted); font-size: 11px; }
.chart-tip { position: absolute; pointer-events: none; background: var(--text); color: #fff; padding: 6px 9px; border-radius: 6px; font-size: 12px; white-space: nowrap; transform: translate(-50%, -110%); box-shadow: var(--shadow); display: none; z-index: 5; }
.chart-tip b { font-variant-numeric: tabular-nums; }
.hbar { display: grid; grid-template-columns: minmax(0, 1fr) 110px; gap: 4px 10px; align-items: center; font-size: 13px; }
.hbar .track { grid-column: 1 / -1; height: 6px; background: #eef2f0; border-radius: 3px; overflow: hidden; margin-bottom: 8px; }
.hbar .fill { height: 100%; background: var(--brand-500); border-radius: 3px; }

.list-plain { list-style: none; margin: 0; padding: 0; }
.list-plain li { display: flex; gap: 10px; align-items: center; padding: 9px 16px; border-bottom: 1px solid var(--border); font-size: 13.5px; }
.list-plain li:last-child { border-bottom: 0; }

.lines-table td { padding: 6px 6px; }
.lines-table td:first-child { padding-left: 0; }
.cost-box { background: var(--brand-50); border: 1px solid var(--brand-100); border-radius: var(--radius); padding: 14px 16px; }
.cost-box .row { display: flex; justify-content: space-between; padding: 3px 0; font-size: 13.5px; }
.cost-box .row.total { border-top: 1px solid var(--brand-100); margin-top: 6px; padding-top: 8px; font-weight: 700; font-size: 15px; }

/* ----------------------------------------------------------------- login */
.login-page { min-height: 100vh; display: grid; grid-template-columns: 1fr 1fr; }
.login-art { background: linear-gradient(160deg, var(--brand-800), var(--brand-900)); color: #d7e7e0; padding: 48px; display: flex; flex-direction: column; justify-content: space-between; }
.login-art h1 { color: #fff; font-size: 30px; line-height: 1.2; max-width: 420px; }
.login-art p { max-width: 420px; color: #a9c6bb; }
.login-form-wrap { display: grid; place-items: center; padding: 32px 16px; background: var(--surface); }
.login-form { width: 100%; max-width: 360px; }
.login-form h2 { font-size: 22px; margin-bottom: 4px; }
@media (max-width: 860px) { .login-page { grid-template-columns: 1fr; } .login-art { display: none; } }

/* ------------------------------------------------------------- print area */
#print-root { display: none; }
.doc { font-family: var(--font); color: #000; font-size: 12.5px; }
.doc h1 { font-size: 18px; margin: 0; }
.doc .doc-head { display: flex; justify-content: space-between; align-items: flex-start; border-bottom: 2px solid #000; padding-bottom: 8px; margin-bottom: 10px; gap: 12px; }
.doc .doc-title { font-size: 15px; font-weight: 700; letter-spacing: 1px; text-align: right; }
.doc table { width: 100%; border-collapse: collapse; margin: 8px 0; }
.doc th, .doc td { border: 1px solid #555; padding: 4px 6px; text-align: left; }
.doc th { background: #eee; font-size: 11px; text-transform: uppercase; }
.doc .num { text-align: right; }
.doc .meta { display: grid; grid-template-columns: 1fr 1fr; gap: 3px 16px; margin: 6px 0; }
.doc .totals { margin-left: auto; width: 60%; }
.doc .totals td { border: 0; padding: 2px 6px; }
.doc .totals tr.grand td { border-top: 2px solid #000; font-weight: 700; font-size: 14px; }
.doc .sign { display: flex; justify-content: space-between; margin-top: 40px; gap: 30px; }
.doc .sign div { flex: 1; border-top: 1px solid #000; text-align: center; padding-top: 4px; font-size: 11px; }
.doc .foot { text-align: center; margin-top: 14px; font-size: 11px; }
.doc .stamp { display: inline-block; border: 2px solid #000; padding: 2px 10px; font-weight: 700; letter-spacing: 1px; }
.doc.paper-A5 { max-width: 148mm; margin: 0 auto; }
.doc.paper-A4 { max-width: 190mm; margin: 0 auto; }
.doc.paper-80mm { width: 76mm; font-size: 11px; }
.doc.paper-80mm .doc-head { flex-direction: column; align-items: center; text-align: center; }
.doc.paper-80mm .doc-title { text-align: center; }
.doc.paper-80mm th, .doc.paper-80mm td { border: 0; border-bottom: 1px dashed #000; padding: 3px 2px; }
.doc.paper-80mm .meta { grid-template-columns: 1fr; }
.doc.paper-80mm .totals { width: 100%; }
.doc.report h1 { font-size: 16px; }

@media print {
  @page { margin: 10mm; }
  body { background: #fff; }
  body > *:not(#print-root) { display: none !important; }
  #print-root { display: block !important; }
  .doc { break-inside: auto; }
  .doc tr { break-inside: avoid; }
}
