/* Stokku — inventory UI (VibeCoder theme) */
:root {
  --ink: #1F1B3A;
  --muted: #635F82;
  --line: rgba(31, 27, 58, .10);
  --indigo: #4F46E5;
  --violet: #8B5CF6;
  --grad: linear-gradient(135deg, #4F46E5 0%, #8B5CF6 100%);
  --grad-soft: linear-gradient(135deg, rgba(79, 70, 229, .12), rgba(139, 92, 246, .12));
  --surface: rgba(255, 255, 255, .62);
  --surface-solid: #ffffff;
  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 18px 40px -22px rgba(59, 48, 138, .38), 0 2px 8px -4px rgba(31, 27, 58, .12);
  --shadow-sm: 0 6px 16px -12px rgba(59, 48, 138, .45);
  --ok: #0f9d6b;
  --ok-bg: rgba(16, 185, 129, .13);
  --warn: #b45309;
  --warn-bg: rgba(245, 158, 11, .16);
  --danger: #c0264a;
  --danger-bg: rgba(244, 63, 94, .13);
  --info: #1d4ed8;
  --info-bg: rgba(59, 130, 246, .14);
  --sidebar-w: 258px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  color: var(--ink);
  background: #F3F0FF;
  font-size: 14.5px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}
a { color: var(--indigo); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { margin: 0; font-weight: 650; letter-spacing: -.015em; }
p { margin: 0; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.nowrap { white-space: nowrap; }
.right { text-align: right; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12.5px; }
.grow { flex: 1; }

/* ---------- ambient background ---------- */
.ambient { position: fixed; inset: 0; z-index: 0; overflow: hidden; pointer-events: none; }
.blob { position: absolute; border-radius: 50%; filter: blur(80px); opacity: .55; }
.blob.b1 { width: 520px; height: 520px; background: #C7D2FE; top: -160px; left: -120px; }
.blob.b2 { width: 460px; height: 460px; background: #FBCFE8; top: 20%; right: -140px; opacity: .45; }
.blob.b3 { width: 500px; height: 500px; background: #BAE6FD; bottom: -220px; left: 32%; opacity: .4; }

/* ---------- app shell ---------- */
.app { position: relative; z-index: 1; display: flex; min-height: 100vh; }

.sidebar {
  width: var(--sidebar-w);
  flex: 0 0 var(--sidebar-w);
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding: 22px 16px;
  background: rgba(255, 255, 255, .55);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border-right: 1px solid rgba(255, 255, 255, .7);
  box-shadow: 1px 0 0 rgba(31, 27, 58, .05);
  z-index: 30;
}
.brand { display: flex; align-items: center; gap: 11px; padding: 4px 8px 6px; }
.brand-mark {
  width: 38px; height: 38px; border-radius: 12px;
  background: var(--grad); color: #fff;
  display: grid; place-items: center;
  box-shadow: 0 10px 22px -12px rgba(79, 70, 229, .9);
  flex: 0 0 auto;
}
.brand-mark .ico { width: 20px; height: 20px; }
.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-text strong { font-size: 17px; letter-spacing: -.02em; }
.brand-text small { color: var(--muted); font-size: 11px; letter-spacing: .09em; text-transform: uppercase; }

.nav { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 16px; padding-bottom: 8px; }
.nav-group { display: flex; flex-direction: column; gap: 3px; }
.nav-section {
  font-size: 10.5px; letter-spacing: .1em; text-transform: uppercase;
  color: #8b87a8; font-weight: 650; padding: 0 12px 6px;
}
.nav-link {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px; border-radius: 11px;
  color: #3c3760; font-weight: 500; font-size: 13.5px;
  transition: background .16s ease, color .16s ease, transform .16s ease;
}
.nav-link .ico { width: 17px; height: 17px; opacity: .8; flex: 0 0 auto; }
.nav-link:hover { background: rgba(79, 70, 229, .08); color: var(--indigo); text-decoration: none; }
.nav-link.active {
  background: var(--grad); color: #fff;
  box-shadow: 0 12px 22px -16px rgba(79, 70, 229, 1);
}
.nav-link.active .ico { opacity: 1; }

.sidebar-foot { display: flex; flex-direction: column; gap: 10px; border-top: 1px solid var(--line); padding-top: 14px; }
.user-chip { display: flex; align-items: center; gap: 10px; padding: 0 4px; }
.avatar {
  width: 34px; height: 34px; border-radius: 50%;
  background: var(--grad-soft); color: var(--indigo);
  display: grid; place-items: center; font-weight: 700; font-size: 14px;
  border: 1px solid rgba(79, 70, 229, .18);
  flex: 0 0 auto;
}
.user-meta { display: flex; flex-direction: column; line-height: 1.2; min-width: 0; }
.user-meta strong { font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-meta small { color: var(--muted); font-size: 11.5px; }
.logout-form { margin: 0; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  display: none;
  align-items: center; gap: 12px;
  padding: 12px 16px;
  background: rgba(255, 255, 255, .7);
  backdrop-filter: blur(16px) saturate(180%);
  border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 20;
}
.menu-btn {
  border: 1px solid var(--line); background: #fff; color: var(--ink);
  width: 36px; height: 36px; border-radius: 10px; font-size: 17px; cursor: pointer;
}
.topbar-title { font-weight: 650; flex: 1; }
.pill {
  background: var(--grad-soft); color: var(--indigo);
  border: 1px solid rgba(79, 70, 229, .16);
  padding: 4px 10px; border-radius: 999px; font-size: 11.5px; font-weight: 650;
}

.content { padding: 30px 34px 60px; max-width: 1380px; width: 100%; }

/* ---------- page head ---------- */
.page-head {
  display: flex; flex-wrap: wrap; align-items: flex-end; gap: 16px;
  justify-content: space-between; margin-bottom: 26px;
}
.page-head h1 { font-size: 25px; }
.page-head .sub { color: var(--muted); font-size: 13.5px; margin-top: 4px; }
.page-actions { display: flex; gap: 10px; flex-wrap: wrap; }

/* base icon size — an inline <svg viewBox> without width/height defaults to 300x150 */
.ico { width: 18px; height: 18px; flex: 0 0 auto; display: inline-block; vertical-align: -3px; }

/* ---------- cards ---------- */
.card {
  background: var(--surface);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border: 1px solid rgba(255, 255, 255, .75);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px 22px;
  margin-bottom: 22px;
}
.card-head {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 16px; margin-bottom: 16px;
}
.card-head h2 { font-size: 15.5px; }
.card-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.card.flush { padding: 0; overflow: hidden; }
.card.flush .card-head { padding: 20px 22px 0; }
.card.flush .table-wrap { border: none; border-radius: 0; }

/* ---------- stats ---------- */
.stat-grid {
  display: grid; gap: 18px;
  grid-template-columns: repeat(auto-fit, minmax(215px, 1fr));
  margin-bottom: 24px;
}
.stat {
  background: var(--surface);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border: 1px solid rgba(255, 255, 255, .75);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px 20px;
  position: relative; overflow: hidden;
}
.stat::after {
  content: ''; position: absolute; inset: 0 0 auto 0; height: 3px; background: var(--grad); opacity: .85;
}
.stat-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.stat-label { font-size: 12px; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); font-weight: 600; }
.stat-ico {
  width: 32px; height: 32px; border-radius: 10px; display: grid; place-items: center;
  background: var(--grad-soft); color: var(--indigo);
}
.stat-ico .ico { width: 17px; height: 17px; }
.stat-value { font-size: 24px; font-weight: 700; letter-spacing: -.03em; margin-top: 10px; }
.stat-foot { font-size: 12.5px; color: var(--muted); margin-top: 4px; }
.stat.warn::after { background: linear-gradient(135deg, #f59e0b, #f43f5e); }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  padding: 9px 16px; border-radius: 11px; font-size: 13.5px; font-weight: 600;
  border: 1px solid transparent; cursor: pointer; transition: transform .12s ease, box-shadow .16s ease, background .16s ease;
  font-family: inherit; line-height: 1.25;
}
.btn:hover { text-decoration: none; transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn .ico { width: 16px; height: 16px; }
.btn-primary { background: var(--grad); color: #fff; box-shadow: 0 14px 26px -16px rgba(79, 70, 229, .95); }
.btn-primary:hover { box-shadow: 0 18px 30px -16px rgba(79, 70, 229, 1); }
.btn-secondary { background: rgba(255, 255, 255, .85); color: var(--ink); border-color: var(--line); box-shadow: var(--shadow-sm); }
.btn-secondary:hover { background: #fff; color: var(--indigo); }
.btn-ghost { background: transparent; color: var(--muted); border-color: var(--line); }
.btn-ghost:hover { background: rgba(255, 255, 255, .7); color: var(--ink); }
.btn-danger { background: var(--danger-bg); color: var(--danger); border-color: rgba(192, 38, 74, .2); }
.btn-danger:hover { background: rgba(244, 63, 94, .2); }
.btn-sm { padding: 6px 11px; font-size: 12.5px; border-radius: 9px; }
.btn-block { width: 100%; }
.btn-icon { padding: 6px 9px; }

/* ---------- forms ---------- */
.form-grid { display: grid; gap: 18px 20px; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field.span-2 { grid-column: span 2; }
.field.full { grid-column: 1 / -1; }
label { font-size: 12.5px; font-weight: 600; color: #46416b; }
label .req { color: var(--danger); }
input[type=text], input[type=number], input[type=password], input[type=date], input[type=email], input[type=tel], select, textarea {
  width: 100%; font-family: inherit; font-size: 13.5px; color: var(--ink);
  background: rgba(255, 255, 255, .82);
  border: 1px solid rgba(31, 27, 58, .14);
  border-radius: var(--radius-sm);
  padding: 9px 12px;
  transition: border-color .15s ease, box-shadow .15s ease, background .15s ease;
}
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--indigo);
  box-shadow: 0 0 0 3px rgba(79, 70, 229, .14);
  background: #fff;
}
input:disabled, select:disabled { background: rgba(245, 243, 255, .7); color: var(--muted); }
textarea { resize: vertical; min-height: 74px; }
.hint { font-size: 11.5px; color: var(--muted); }
.form-actions {
  display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap;
  margin-top: 22px; padding-top: 18px; border-top: 1px solid var(--line);
}
.filter-bar {
  display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end;
  margin-bottom: 18px;
}
.filter-bar .field { gap: 4px; }
.filter-bar input, .filter-bar select { min-width: 140px; }
.filter-bar .search { min-width: 220px; flex: 1; }
.inline-form { display: inline; margin: 0; }

/* ---------- tables ---------- */
.table-wrap {
  overflow-x: auto; border: 1px solid var(--line); border-radius: 12px;
  background: rgba(255, 255, 255, .5); max-width: 100%;
}
table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
thead th {
  text-align: left; font-size: 11px; letter-spacing: .06em; text-transform: uppercase;
  color: var(--muted); font-weight: 650;
  padding: 11px 14px; background: rgba(243, 240, 255, .75);
  border-bottom: 1px solid var(--line); white-space: nowrap;
}
tbody td { padding: 11px 14px; border-bottom: 1px solid rgba(31, 27, 58, .06); vertical-align: middle; }
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: rgba(255, 255, 255, .55); }
td.right, th.right { text-align: right; }
.table-name { font-weight: 600; }
.table-sub { font-size: 11.5px; color: var(--muted); }
.row-actions { display: flex; gap: 6px; justify-content: flex-end; flex-wrap: wrap; }
.table-foot { display: flex; justify-content: space-between; align-items: center; gap: 14px; padding: 14px 4px 2px; flex-wrap: wrap; }

/* ---------- badges ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 9px; border-radius: 999px; font-size: 11.5px; font-weight: 650;
  border: 1px solid transparent; white-space: nowrap;
}
.badge-success { background: var(--ok-bg); color: var(--ok); border-color: rgba(15, 157, 107, .18); }
.badge-danger { background: var(--danger-bg); color: var(--danger); border-color: rgba(192, 38, 74, .18); }
.badge-warning { background: var(--warn-bg); color: var(--warn); border-color: rgba(180, 83, 9, .18); }
.badge-info { background: var(--info-bg); color: var(--info); border-color: rgba(29, 78, 216, .18); }
.badge-muted, .badge-neutral { background: rgba(99, 95, 130, .1); color: #59557a; border-color: rgba(99, 95, 130, .16); }
.badge-grad { background: var(--grad-soft); color: var(--indigo); border-color: rgba(79, 70, 229, .2); }

/* ---------- flash ---------- */
.flash {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 11px 16px; border-radius: 12px; font-size: 13.5px; font-weight: 500;
  margin-bottom: 20px; border: 1px solid transparent;
}
.flash-ok { background: rgba(16, 185, 129, .12); color: #0b7a54; border-color: rgba(16, 185, 129, .22); }
.flash-err { background: rgba(244, 63, 94, .1); color: var(--danger); border-color: rgba(244, 63, 94, .22); }
.flash-close { background: none; border: none; font-size: 18px; line-height: 1; cursor: pointer; color: inherit; opacity: .6; }

/* ---------- empty / pager ---------- */
.empty { text-align: center; padding: 40px 16px; color: var(--muted); }
.empty-icon { font-size: 28px; margin-bottom: 8px; opacity: .7; }
.empty p { margin-bottom: 12px; }
.pager { display: flex; align-items: center; gap: 10px; justify-content: flex-end; flex-wrap: wrap; }
.page-btn {
  padding: 6px 12px; border-radius: 9px; font-size: 12.5px; font-weight: 600;
  background: rgba(255, 255, 255, .85); border: 1px solid var(--line); color: var(--ink);
}
.page-btn:hover { text-decoration: none; color: var(--indigo); border-color: rgba(79, 70, 229, .3); }
.page-btn.disabled { opacity: .45; }
.page-info { font-size: 12.5px; color: var(--muted); }

/* ---------- misc blocks ---------- */
.split { display: grid; gap: 22px; grid-template-columns: 1.55fr 1fr; align-items: start; }
.split-even { display: grid; gap: 22px; grid-template-columns: 1fr 1fr; align-items: start; }
/* grid children default to min-width:auto, which lets wide tables blow the column out */
.split > *, .split-even > * { min-width: 0; }
.detail-list { display: grid; gap: 12px 18px; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); }
.detail-list .dt { font-size: 11.5px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 650; }
.detail-list .dd { font-weight: 600; margin-top: 2px; }
.chart { display: flex; align-items: flex-end; gap: 14px; height: 168px; padding: 10px 4px 0; }
.chart-col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 8px; height: 100%; justify-content: flex-end; }
.chart-bars { display: flex; gap: 4px; align-items: flex-end; height: 100%; width: 100%; justify-content: center; }
.chart-bar { width: 13px; border-radius: 5px 5px 3px 3px; min-height: 3px; transition: height .3s ease; }
.chart-bar.in { background: linear-gradient(180deg, #8B5CF6, #4F46E5); }
.chart-bar.out { background: linear-gradient(180deg, #fda4af, #f43f5e); }
.chart-label { font-size: 11px; color: var(--muted); }
.legend { display: flex; gap: 16px; font-size: 12px; color: var(--muted); margin-top: 12px; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.dot { width: 9px; height: 9px; border-radius: 3px; display: inline-block; }
.dot.in { background: #4F46E5; }
.dot.out { background: #f43f5e; }
.quick-grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
.quick-tile {
  display: flex; flex-direction: column; gap: 8px; align-items: flex-start;
  padding: 15px 16px; border-radius: 13px;
  background: rgba(255, 255, 255, .72); border: 1px solid var(--line);
  color: var(--ink); font-weight: 600; font-size: 13px;
  transition: transform .14s ease, box-shadow .16s ease, border-color .16s ease;
}
.quick-tile:hover { text-decoration: none; transform: translateY(-2px); box-shadow: var(--shadow-sm); border-color: rgba(79, 70, 229, .3); }
.quick-tile .ico { width: 20px; height: 20px; color: var(--indigo); }

/* ---------- barcode / label ---------- */
.barcode { max-width: 100%; height: auto; background: #fff; border-radius: 8px; }
.label-sheet {
  background: #fff; border: 1px solid var(--line); border-radius: 14px;
  padding: 18px; display: inline-flex; flex-direction: column; gap: 6px; min-width: 260px;
}
.label-sheet .l-name { font-weight: 700; font-size: 14px; }
.label-sheet .l-meta { font-size: 12px; color: var(--muted); }
.label-sheet .l-price { font-weight: 700; color: var(--indigo); }
.barcode-box { flex: 0 0 auto; display: flex; flex-direction: column; align-items: center; gap: 4px; }

/* ---------- opname / po line editor ---------- */
.lines { display: flex; flex-direction: column; gap: 10px; }
.line-row { display: grid; grid-template-columns: 1fr 110px 140px 90px 38px; gap: 10px; align-items: center; }
.line-head { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 650; }
.line-row input, .line-row select { padding: 8px 10px; }
.btn-remove { background: var(--danger-bg); color: var(--danger); border: 1px solid rgba(192, 38, 74, .18); border-radius: 9px; width: 34px; height: 34px; cursor: pointer; font-size: 16px; line-height: 1; }
.po-total { display: flex; justify-content: flex-end; gap: 10px; align-items: baseline; margin-top: 14px; font-weight: 650; }
.po-total strong { font-size: 18px; }

/* ---------- login ---------- */
.auth-body { display: block; }
.auth-wrap { position: relative; z-index: 1; min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 16px; padding: 28px 18px; }
.auth-card {
  width: 100%; max-width: 404px;
  background: rgba(255, 255, 255, .68);
  backdrop-filter: blur(22px) saturate(180%);
  -webkit-backdrop-filter: blur(22px) saturate(180%);
  border: 1px solid rgba(255, 255, 255, .8);
  border-radius: 20px;
  box-shadow: 0 30px 60px -30px rgba(59, 48, 138, .5);
  padding: 30px 28px;
}
.auth-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 22px; }
.auth-brand strong { display: block; font-size: 19px; letter-spacing: -.02em; }
.auth-brand small { color: var(--muted); font-size: 12px; }
.auth-card form { display: flex; flex-direction: column; gap: 16px; margin-top: 4px; }
.auth-card h2 { font-size: 17px; }
.auth-foot { color: var(--muted); font-size: 12px; text-align: center; }
.auth-aside { font-size: 12px; color: var(--muted); background: rgba(255,255,255,.6); border: 1px dashed rgba(79,70,229,.3); padding: 10px 12px; border-radius: 10px; margin-top: 16px; }

/* ---------- print ---------- */
@media print {
  body { background: #fff; }
  .sidebar, .topbar, .page-head, .ambient, .card-head .card-actions, .no-print { display: none !important; }
  .content { padding: 0; }
  .card { box-shadow: none; border: none; background: #fff; }
}
.label-print-grid { display: flex; flex-wrap: wrap; gap: 14px; }

/* ---------- responsive ---------- */
@media (max-width: 1080px) {
  .split, .split-even { grid-template-columns: 1fr; }
}
@media (max-width: 860px) {
  .topbar { display: flex; }
  .sidebar {
    position: fixed; left: 0; top: 0; transform: translateX(-102%);
    transition: transform .22s ease; box-shadow: 20px 0 60px -30px rgba(31, 27, 58, .5);
  }
  .sidebar.open { transform: translateX(0); }
  .content { padding: 20px 16px 50px; }
  .page-head { margin-bottom: 20px; }
  .page-head h1 { font-size: 21px; }
  .card { padding: 16px; }
  .line-row { grid-template-columns: 1fr 1fr; }
  .line-row .line-head { display: none; }
}
@media (max-width: 560px) {
  .stat-value { font-size: 21px; }
  .page-actions { width: 100%; }
  .page-actions .btn { flex: 1; }
}

/* ============================ logo / brand images ============================ */
.brand-mark-img { background: #fff; padding: 3px; overflow: hidden; }
.brand-mark-img img { width: 100%; height: 100%; object-fit: contain; border-radius: 9px; display: block; }

.logo-preview {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  padding: 10px 12px; border: 1px dashed rgba(79, 70, 229, .3); border-radius: 12px;
  background: rgba(255, 255, 255, .55);
}
.logo-preview img { max-height: 64px; max-width: 180px; object-fit: contain; background: #fff; border-radius: 8px; padding: 4px; border: 1px solid var(--line); }
.logo-preview .logo-empty { font-size: 12px; color: var(--muted); }

/* ============================ PO approval / fulfilment ============================ */
.timeline { display: flex; gap: 0; flex-wrap: wrap; margin: 4px 0 2px; }
.tl-step { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--muted); padding-right: 14px; }
.tl-step .tl-dot {
  width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center;
  border: 1px solid var(--line); background: rgba(255, 255, 255, .8); font-size: 11px; font-weight: 700;
}
.tl-step.done { color: var(--ok); }
.tl-step.done .tl-dot { background: var(--ok-bg); border-color: rgba(15, 157, 107, .35); color: var(--ok); }
.tl-step.active { color: var(--indigo); font-weight: 600; }
.tl-step.active .tl-dot { background: var(--grad-soft); border-color: rgba(79, 70, 229, .4); color: var(--indigo); }
.tl-arrow { color: #b9b4d4; padding: 0 8px 0 0; }

tr.line-approved td { background: rgba(16, 185, 129, .05); }
tr.line-rejected td { background: rgba(244, 63, 94, .06); }
tr.line-pending td { background: rgba(245, 158, 11, .05); }
.line-actions { display: flex; gap: 6px; justify-content: flex-end; flex-wrap: wrap; }
.line-actions form { margin: 0; }
.price-input { width: 118px; text-align: right; padding: 6px 8px !important; }
.qty-input { width: 92px; text-align: right; padding: 6px 8px !important; }

.notice {
  display: flex; gap: 10px; align-items: flex-start;
  padding: 12px 14px; border-radius: 12px; font-size: 13px;
  background: rgba(79, 70, 229, .07); border: 1px solid rgba(79, 70, 229, .16); color: #3c3760;
  margin-bottom: 18px;
}
.notice strong { color: var(--ink); }
.notice .ico { width: 18px; height: 18px; margin-top: 1px; color: var(--indigo); }
.notice.warn { background: rgba(245, 158, 11, .12); border-color: rgba(180, 83, 9, .2); color: #7c4a08; }

/* ============================ printable document ============================ */
.doc-body { background: #eef0f6; padding: 0; }
.doc-toolbar {
  position: sticky; top: 0; z-index: 5;
  display: flex; gap: 10px; justify-content: space-between; align-items: center;
  padding: 10px 16px; background: rgba(255, 255, 255, .92);
  border-bottom: 1px solid var(--line); backdrop-filter: blur(8px);
}
.doc {
  width: 210mm; min-height: 297mm; margin: 18px auto 40px; padding: 16mm 14mm;
  background: #fff; color: #1a1a1a; font-size: 11.5px; line-height: 1.45;
  box-shadow: 0 20px 50px -24px rgba(31, 27, 58, .45);
}
/* Kop surat: logo perusahaan rata KIRI, teks identitas tetap rata TENGAH halaman */
.doc-head {
  position: relative; display: block; text-align: center;
  border-bottom: 2.5px solid #1F1B3A; padding-bottom: 12px; min-height: 34px;
}
/* padding simetris = titik tengah teks tetap di tengah halaman walau logo ada di kiri */
.doc-head.has-logo { padding-left: 168px; padding-right: 168px; }
.doc-logo {
  position: absolute; left: 0; top: 2px;
  max-height: 62px; max-width: 150px; object-fit: contain;
}
.doc-logo.logo-fallback { display: none; }
.doc-company-text { display: flex; flex-direction: column; align-items: center; gap: 2px; }
.doc-company-text strong {
  font-size: 17px; letter-spacing: .04em; text-transform: uppercase; color: #111; line-height: 1.25;
}
.doc-company-text span { font-size: 10.5px; color: #555; line-height: 1.35; }
/* tabel lebar tidak boleh membuat halaman melebar di layar kecil */
.doc-body-content { overflow-x: auto; }
.doc-title { text-align: center; margin: 14px 0 12px; }
.doc-title h1 { font-size: 16px; text-transform: uppercase; letter-spacing: .06em; }
.doc-no { font-size: 11px; color: #444; margin-top: 2px; }
.doc-sub { font-size: 11px; color: #555; margin-top: 2px; }
.doc-meta {
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 4px 18px;
  margin: 0 0 12px; font-size: 11px;
}
.doc-meta > div { display: flex; gap: 6px; }
.doc-meta .dt { color: #666; min-width: 92px; }
.doc-meta .dd { font-weight: 600; color: #111; }
.doc-table { width: 100%; border-collapse: collapse; font-size: 10.8px; margin-top: 4px; }
.doc-table th, .doc-table td { border: 1px solid #c9c9c9; padding: 5px 7px; text-align: left; vertical-align: top; }
.doc-table th { background: #f0f0f5; font-size: 10px; text-transform: uppercase; letter-spacing: .04em; }
.doc-table .right { text-align: right; }
.doc-table tfoot td { background: #fafafd; font-weight: 700; }
.doc-table .doc-empty { text-align: center; color: #777; padding: 18px; }
.doc-summary { margin-top: 12px; font-size: 11px; }
.doc-summary .sum-line { display: flex; justify-content: space-between; gap: 12px; padding: 3px 0; border-top: 1px dotted #ccc; }
.doc-summary .sum-line.total { border-top: 1.5px solid #333; font-weight: 700; font-size: 12px; }
.doc-signs { display: flex; justify-content: space-around; gap: 20px; margin-top: 34px; }
.doc-sign { text-align: center; min-width: 130px; font-size: 11px; }
.doc-sign-role { color: #555; }
.doc-sign-space { height: 58px; }
.doc-sign-name { border-top: 1px solid #333; padding-top: 3px; font-weight: 600; min-width: 130px; }
.doc-foot {
  display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  margin-top: 26px; padding-top: 6px; border-top: 1px solid #ddd;
  font-size: 9.5px; color: #777;
}

@media print {
  @page { size: A4; margin: 12mm; }
  html, body { background: #fff !important; }
  .doc-body { padding: 0; }
  .doc-toolbar { display: none !important; }
  .doc {
    width: auto; min-height: 0; margin: 0; padding: 0;
    box-shadow: none; font-size: 10.5px;
  }
  .doc-table { font-size: 10px; }
  .doc-signs { page-break-inside: avoid; }
  .doc-foot { page-break-inside: avoid; }
  .doc-body-content { overflow: visible; }
  thead { display: table-header-group; }
  tr { page-break-inside: avoid; }
}

@media (max-width: 1080px) {
  .doc { width: 100%; margin: 12px auto; padding: 20px; min-height: 0; }
  .doc-meta { grid-template-columns: 1fr; }
  .doc-signs { flex-wrap: wrap; gap: 28px; }
}

/* ============================ report tabs & quick ranges ============================ */
.tab-bar { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 20px; }
.tab {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 8px 14px; border-radius: 11px; font-size: 13px; font-weight: 600;
  background: rgba(255, 255, 255, .8); border: 1px solid var(--line); color: #3c3760;
  transition: background .16s ease, color .16s ease, box-shadow .16s ease;
}
.tab .ico { width: 15px; height: 15px; opacity: .8; }
.tab:hover { text-decoration: none; border-color: rgba(79, 70, 229, .35); color: var(--indigo); }
.tab.active { background: var(--grad); color: #fff; border-color: transparent; box-shadow: 0 12px 24px -18px rgba(79, 70, 229, 1); }
.tab.active .ico { opacity: 1; }

.quick-links { display: inline-flex; gap: 8px; flex-wrap: wrap; align-items: center; font-size: 12.5px; }
.quick-links a {
  padding: 6px 10px; border-radius: 9px; border: 1px dashed rgba(79, 70, 229, .35);
  color: var(--indigo); font-weight: 600; background: rgba(255, 255, 255, .6);
}
.quick-links a:hover { text-decoration: none; background: #fff; }

.doc-logo-demo .doc-head { border-bottom: 2px solid var(--ink); padding-bottom: 10px; }
.doc-logo-demo .doc-company-text strong { font-size: 14px; }
/* layar sempit: ruang kiri-kanan tidak cukup, logo pindah ke atas (tetap tidak menutupi teks) */
@media (max-width: 700px) {
  .doc-head.has-logo { padding-left: 0; padding-right: 0; }
  .doc-logo { position: static; display: block; margin: 0 auto 8px; max-height: 52px; max-width: 130px; }
}
@media (max-width: 860px) {
  .tab-bar { gap: 6px; }
  .tab { padding: 7px 11px; font-size: 12.5px; }
}

/* ============================ checklist penerimaan PO ============================ */
.stack-form { display: flex; flex-direction: column; gap: 14px; }
.po-pick-row { display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap; }
.po-pick-row .field { flex: 1; min-width: 260px; }
table input[type="checkbox"] { width: 18px; height: 18px; accent-color: var(--indigo); cursor: pointer; }
tr.line-qty-short td { background: rgba(245, 158, 11, .07); }
