/* ==========================================================================
   MeeQ PO System — White & Red Theme
   Typefaces: Syne (display) + DM Mono (body/data)
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Nunito:ital,wght@0,400;0,500;0,600;0,700;0,800;0,900;1,400&family=Nunito+Sans:wght@400;500;600;700&display=swap');

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg:           #ffffff;
  --surface:      #f8f8f8;
  --surface-2:    #f0f0f0;
  --border:       #e4e4e4;
  --border-mid:   #d0d0d0;
  --text:         #0a0a0a;
  --text-soft:    #444444;
  --muted:        #888888;
  --accent:       #cc0000;
  --accent-hover: #aa0000;
  --accent-dim:   rgba(204,0,0,0.07);
  --accent-glow:  rgba(204,0,0,0.15);
  --danger:       #cc0000;
  --danger-dim:   rgba(204,0,0,0.07);
  --danger-border:rgba(204,0,0,0.25);
  --warn:         #b45309;
  --warn-dim:     rgba(180,83,9,0.08);
  --success:      #166534;
  --success-dim:  rgba(22,101,52,0.08);
  --open-color:   #1d4ed8;
  --open-dim:     rgba(29,78,216,0.07);
  --open-border:  rgba(29,78,216,0.2);
  --shadow-sm:    0 1px 3px rgba(0,0,0,0.07);
  --shadow-md:    0 4px 16px rgba(0,0,0,0.09);
  --shadow-lg:    0 16px 48px rgba(0,0,0,0.13);
  --radius-sm:    8px;
  --radius:       12px;
  --radius-lg:    16px;
  --font:         'Nunito Sans', sans-serif;
  --font-display: 'Nunito', sans-serif;
}

html { scroll-behavior: smooth; }
html, body { min-height: 100%; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

.container { max-width: 1160px; margin: 0 auto; padding: 0 24px; position: relative; }

/* ==========================================================================
   TOPBAR
   ========================================================================== */
.topbar {
  background: #ffffff;
  border-bottom: 2px solid var(--accent);
  position: sticky;
  top: 0;
  z-index: 50;
}

.topbar .container { display: flex; align-items: center; height: 56px; gap: 0; }

.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; flex-shrink: 0; }
.brand-icon-img { width: 36px; height: 36px; border-radius: 8px; object-fit: cover; flex-shrink: 0; display: block; }
.brand-name { font-family: var(--font-display); font-weight: 800; font-size: 17px; color: var(--accent); letter-spacing: -0.5px; }
.brand-sep { width: 1px; height: 22px; background: var(--border-mid); margin: 0 20px; }

.topbar-nav { display: flex; align-items: center; gap: 4px; margin-left: auto; }
.nav-link { font-size: 12px; font-family: var(--font); padding: 6px 14px; border-radius: var(--radius-sm); color: var(--text-soft); text-decoration: none; transition: all 0.15s; font-weight: 500; }
.nav-link:hover { color: var(--accent); background: var(--accent-dim); }
.nav-link.active { color: var(--accent); font-weight: 600; }
.nav-divider { width: 1px; height: 18px; background: var(--border-mid); margin: 0 8px; }
.nav-logout { font-size: 11px; font-family: var(--font); padding: 5px 12px; border-radius: var(--radius-sm); color: var(--muted); background: none; border: 1px solid var(--border-mid); cursor: pointer; transition: all 0.15s; }
.nav-logout:hover { color: var(--accent); border-color: var(--accent); }

.steps { display: flex; gap: 2px; align-items: center; flex: 1; flex-wrap: wrap; }
.step { font-size: 11px; font-family: var(--font); padding: 5px 12px; border-radius: 20px; color: var(--muted); transition: all 0.2s; white-space: nowrap; }
.step.active { background: var(--accent); color: #fff; }
.step.done { color: var(--text-soft); }

/* ==========================================================================
   LAYOUT
   ========================================================================== */
main.container { padding-top: 28px; padding-bottom: 60px; }

h1 { font-family: var(--font-display); font-size: 26px; font-weight: 800; letter-spacing: -0.3px; color: var(--accent); margin-bottom: 4px; }
h2 { font-family: var(--font-display); font-size: 18px; font-weight: 700; color: var(--text); }
h3 { font-family: var(--font-display); font-size: 14px; font-weight: 700; color: var(--text); }
p.muted, .muted { color: var(--muted); }
.small { font-size: 11px; }
.text-success { color: var(--success) !important; }
.text-warn    { color: var(--warn)    !important; }
.text-accent  { color: var(--accent)  !important; }

/* ==========================================================================
   PANELS
   ========================================================================== */
.panel { display: none; animation: fadeIn 0.2s ease; }
.panel.active { display: block; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }

/* ==========================================================================
   CARD
   ========================================================================== */
.card { background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 24px; margin-top: 16px; box-shadow: var(--shadow-sm); }

/* ==========================================================================
   FIELDS
   ========================================================================== */
.field { display: flex; flex-direction: column; gap: 5px; margin-bottom: 14px; }
.field span, .field label { font-size: 10px; color: var(--muted); font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; }

.field input, .field select,
input[type="text"], input[type="number"], input[type="date"], input[type="password"],
select {
  padding: 9px 12px;
  background: var(--surface);
  border: 1px solid var(--border-mid);
  border-radius: var(--radius-sm);
  font-family: var(--font);
  font-size: 13px;
  color: var(--text);
  transition: border-color 0.15s, box-shadow 0.15s;
  outline: none;
  width: 100%;
  -webkit-appearance: none;
}
.field input:focus, .field select:focus, input:focus, select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
  background: #fff;
}
.field input:read-only, input:read-only { opacity: 0.55; cursor: default; }
.field input::placeholder, input::placeholder { color: var(--muted); }
select option { background: #fff; color: var(--text); }
input[type="date"]::-webkit-calendar-picker-indicator { cursor: pointer; opacity: 0.6; }

.row3 { display: grid; grid-template-columns: repeat(3,1fr); gap: 14px; }
.row4 { display: grid; grid-template-columns: repeat(4,1fr); gap: 14px; }
.totals-row { background: var(--surface); border: 1px solid var(--border); padding: 14px; border-radius: var(--radius-sm); margin-bottom: 4px; }

.section-title { margin: 20px 0 10px; font-size: 11px; font-weight: 700; font-family: var(--font); letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); display: flex; align-items: center; gap: 8px; }
.section-title.danger { color: var(--danger); }
.section-header-row { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }

.badge { background: var(--surface-2); color: var(--text-soft); font-size: 10px; padding: 2px 8px; border-radius: 10px; font-weight: 600; border: 1px solid var(--border-mid); }

/* ==========================================================================
   DROPZONE
   ========================================================================== */
.dropzone { border: 2px dashed var(--border-mid); border-radius: var(--radius); padding: 40px 30px; text-align: center; cursor: pointer; transition: all 0.2s; margin: 14px 0; background: var(--surface); }
.dropzone:hover, .dropzone.drag { border-color: var(--accent); background: var(--accent-dim); }
.dz-icon { display: inline-flex; align-items: center; justify-content: center; width: 48px; height: 48px; background: var(--accent); color: #fff; font-weight: 700; border-radius: var(--radius-sm); margin-bottom: 14px; font-size: 13px; letter-spacing: 0.05em; }
.dropzone a { color: var(--accent); text-decoration: none; font-weight: 600; }
.filename { margin-top: 10px; font-weight: 600; color: var(--accent); font-size: 12px; }

/* ==========================================================================
   TABLES
   ========================================================================== */
.table-wrap { overflow-x: auto; margin: 8px 0; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th { text-align: left; padding: 9px 12px; background: var(--surface-2); font-weight: 700; font-size: 10px; color: var(--text-soft); letter-spacing: 0.08em; text-transform: uppercase; border-bottom: 2px solid var(--border-mid); white-space: nowrap; }
td { padding: 10px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; color: var(--text); }
tr:last-child td { border-bottom: none; }
tr:hover td { background: var(--accent-dim); }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }

td input { width: 100%; padding: 4px 6px; border: 1px solid transparent; border-radius: 4px; background: transparent; font-size: 12px; font-family: var(--font); color: var(--text); transition: all 0.12s; }
td input:focus { border-color: var(--accent); background: #fff; outline: none; box-shadow: 0 0 0 2px var(--accent-glow); }
td input.num { text-align: right; }

tr.found   { background: rgba(22,101,52,0.04); }
tr.missing { background: var(--accent-dim); }

/* ==========================================================================
   STATUS PILLS
   ========================================================================== */
.status-pill { display: inline-flex; align-items: center; padding: 4px 12px; border-radius: 20px; font-size: 10px; font-weight: 700; letter-spacing: 0.07em; text-transform: uppercase; white-space: nowrap; }
.status-pill.found      { background: rgba(22,101,52,0.1);  color: #166534;         border: 1px solid rgba(22,101,52,0.25); }
.status-pill.missing    { background: var(--accent-dim);     color: var(--accent);   border: 1px solid var(--danger-border); }
.status-pill.draft-pill { background: rgba(180,83,9,0.1);   color: #92400e;         border: 1px solid rgba(180,83,9,0.25); }
.status-pill.open-pill  { background: var(--open-dim);       color: var(--open-color); border: 1px solid var(--open-border); }
.status-pill.received-pill { background: rgba(22,101,52,0.1); color: #166534; border: 1px solid rgba(22,101,52,0.25); }

/* ==========================================================================
   BUTTONS
   ========================================================================== */
.actions { margin-top: 22px; display: flex; gap: 8px; justify-content: flex-end; align-items: center; }

button, .button {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 9px 20px; border-radius: var(--radius-sm);
  border: 1px solid var(--border-mid);
  font-family: var(--font); font-size: 12px; font-weight: 600;
  cursor: pointer; background: var(--surface); color: var(--text-soft);
  text-decoration: none; transition: all 0.15s;
  letter-spacing: 0.02em; white-space: nowrap;
}
button:hover:not(:disabled), .button:hover { background: var(--surface-2); color: var(--text); border-color: var(--border-mid); }
button.primary, .button.primary { background: var(--accent); color: #ffffff; border-color: var(--accent); }
button.primary:hover:not(:disabled), .button.primary:hover { background: var(--accent-hover); box-shadow: 0 4px 14px var(--accent-glow); }
button.secondary { background: #fff; border-color: var(--border-mid); color: var(--text-soft); }
button.secondary:hover:not(:disabled) { background: var(--surface); color: var(--text); }
button.open-btn { background: var(--open-color); color: #fff; border-color: var(--open-color); }
button.open-btn:hover:not(:disabled) { background: #1e40af; }
button.danger-outline { background: transparent; border-color: var(--danger-border); color: var(--danger); }
button.danger-outline:hover:not(:disabled) { background: var(--danger-dim); }
button.danger-link { background: transparent; border: none; color: var(--muted); padding: 4px 8px; font-size: 16px; }
button.danger-link:hover { color: var(--danger); background: var(--danger-dim); }
button.danger-sm { background: transparent; border: none; color: var(--muted); padding: 4px 6px; font-size: 15px; cursor: pointer; transition: all 0.15s; border-radius: 4px; }
button.danger-sm:hover { color: var(--danger); background: var(--danger-dim); }
button:disabled, .button:disabled { opacity: 0.4; cursor: not-allowed; }
.small-btn { padding: 6px 12px; font-size: 11px; }

/* ==========================================================================
   MISSING PRODUCT CARDS
   ========================================================================== */
.missing-card { background: #fff; border: 1px solid var(--danger-border); border-left: 3px solid var(--danger); border-radius: var(--radius); padding: 16px; margin: 8px 0; }
.missing-card.created { border-left-color: var(--success); border-color: rgba(22,101,52,0.2); }
.missing-card h4 { margin: 0 0 12px; font-size: 12px; color: var(--danger); font-family: var(--font); font-weight: 600; }
.missing-card.created h4 { color: var(--success); }
.missing-card .row3 { gap: 10px; }
.missing-card .actions { margin-top: 10px; }

/* ==========================================================================
   SUMMARY BOX
   ========================================================================== */
.summary-box { background: var(--surface); border: 1px solid var(--border-mid); border-radius: var(--radius-sm); padding: 16px; font-family: var(--font); font-size: 12px; white-space: pre-wrap; color: var(--text-soft); line-height: 1.9; }

/* ==========================================================================
   PAGE HEADER
   ========================================================================== */
.page-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 24px; }
.page-actions { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.detail-page-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.detail-page-title { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.detail-page-title h1 { margin-bottom: 0; }

/* Meta grid */
.detail-meta-grid { display: grid; grid-template-columns: repeat(4,1fr); gap: 12px; }
.detail-meta-card { padding: 14px 16px; margin-top: 0; }
.meta-label { font-size: 10px; color: var(--muted); letter-spacing: 0.08em; text-transform: uppercase; margin-bottom: 4px; font-weight: 600; }
.meta-value { font-size: 13px; color: var(--text); font-weight: 600; }

/* ==========================================================================
   STATS BAR
   ========================================================================== */
.stats-bar { display: grid; grid-template-columns: repeat(5,1fr); gap: 12px; margin-bottom: 20px; }
.stat-item { background: #fff; border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 18px; display: flex; flex-direction: column; gap: 4px; box-shadow: var(--shadow-sm); }
.stat-value { font-family: var(--font-display); font-size: 24px; font-weight: 800; color: var(--text); line-height: 1; }
.stat-label { font-size: 10px; color: var(--muted); letter-spacing: 0.08em; text-transform: uppercase; font-weight: 600; }

/* ==========================================================================
   FILTER BAR
   ========================================================================== */
.filter-bar { display: flex; align-items: center; gap: 10px; margin-bottom: 16px; flex-wrap: wrap; }
.search-input { flex: 1; min-width: 200px; padding: 9px 14px; background: #fff; border: 1px solid var(--border-mid); border-radius: var(--radius-sm); font-family: var(--font); font-size: 12px; color: var(--text); outline: none; transition: border-color 0.15s, box-shadow 0.15s; }
.search-input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-glow); }
.search-input::placeholder { color: var(--muted); }
.filter-pills { display: flex; gap: 4px; }
.pill { padding: 6px 16px; border-radius: 20px; font-size: 12px; font-family: var(--font); font-weight: 600; border: 1px solid var(--border-mid); background: #fff; color: var(--muted); cursor: pointer; transition: all 0.15s; }
.pill:hover { color: var(--accent); border-color: var(--accent); }
.pill.active { background: var(--accent); color: #fff; border-color: var(--accent); }

/* ==========================================================================
   PO TABLE
   ========================================================================== */
.po-table-wrap { overflow-x: auto; border-radius: var(--radius); border: 1px solid var(--border); background: #fff; box-shadow: var(--shadow-sm); }
.po-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.po-table th { padding: 10px 14px; background: var(--surface-2); }
.po-table td { padding: 12px 14px; border-bottom: 1px solid var(--border); }
.po-table tr:last-child td { border-bottom: none; }
.po-row { cursor: pointer; transition: background 0.1s; }
.po-row:hover td { background: var(--accent-dim); }
.empty-row { text-align: center; color: var(--muted); padding: 40px !important; }
.row-actions { white-space: nowrap; text-align: right; }

/* ==========================================================================
   PROGRESS BARS
   ========================================================================== */
.progress-bar-large { height: 10px; background: var(--surface-2); border-radius: 5px; overflow: hidden; margin: 10px 0 6px; border: 1px solid var(--border); }
.progress-bar-fill { height: 100%; background: linear-gradient(90deg, #cc0000, #ff3333); border-radius: 5px; transition: width 0.5s cubic-bezier(0.4,0,0.2,1); }
.progress-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 4px; }
.progress-pct-label { font-family: var(--font-display); font-size: 20px; font-weight: 800; color: var(--accent); }
.progress-sub { font-size: 11px; color: var(--muted); }
.progress-mini { height: 6px; background: var(--surface-2); border-radius: 3px; overflow: hidden; min-width: 60px; margin-bottom: 2px; border: 1px solid var(--border); }
.progress-mini-fill { height: 100%; background: var(--accent); border-radius: 3px; transition: width 0.3s ease; }
.progress-mini-fill.full { background: var(--success); }
.progress-label { font-size: 10px; color: var(--muted); font-weight: 600; }
.progress-mini-wrap { display: flex; align-items: center; gap: 6px; }

/* ==========================================================================
   RECEIVE SCREEN
   ========================================================================== */
.bulk-bar { display: flex; align-items: center; justify-content: space-between; padding: 10px 14px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); margin-bottom: 12px; gap: 12px; flex-wrap: wrap; }
.check-all-label { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--text-soft); cursor: pointer; font-weight: 500; }
.check-all-label input[type="checkbox"] { width: 14px; height: 14px; accent-color: var(--accent); cursor: pointer; }
.bulk-actions { display: flex; gap: 8px; }
.receive-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.receive-table th { padding: 9px 12px; background: var(--surface-2); font-weight: 700; font-size: 10px; color: var(--text-soft); letter-spacing: 0.08em; text-transform: uppercase; border-bottom: 2px solid var(--border-mid); }
.receive-table td { padding: 11px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.receive-table tr:last-child td { border-bottom: none; }
.receive-row:hover td { background: var(--accent-dim); }
.receive-row--done td { opacity: 0.55; }
.receive-table input[type="checkbox"] { width: 14px; height: 14px; accent-color: var(--accent); cursor: pointer; }
.qty-input { width: 110px !important; padding: 7px 10px !important; background: var(--surface) !important; border: 1px solid var(--border-mid) !important; border-radius: var(--radius-sm) !important; font-family: var(--font) !important; font-size: 13px !important; color: var(--text) !important; text-align: right; }
.qty-input:focus { border-color: var(--accent) !important; box-shadow: 0 0 0 2px var(--accent-glow) !important; outline: none !important; background: #fff !important; }
.qty-input::placeholder { color: var(--muted) !important; font-size: 11px !important; }
.qty-input--done { opacity: 0.4; }
.done-tick { color: var(--success); font-size: 14px; font-weight: 700; }
.receive-footer { margin-top: 20px; }
.receive-footer-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 12px; }
.receive-footer-actions button, .receive-footer-actions a { padding: 11px 22px; font-size: 13px; }
.receive-errors { background: var(--danger-dim); border: 1px solid var(--danger-border); border-radius: var(--radius-sm); padding: 12px; font-size: 12px; color: var(--danger); }
.receive-errors ul { margin: 6px 0 0 16px; }
.adjust-note { background: rgba(180,83,9,0.07); border: 1px solid rgba(180,83,9,0.2); border-radius: var(--radius-sm); padding: 12px 16px; font-size: 12px; color: var(--warn); margin-bottom: 12px; }

/* ==========================================================================
   TOTALS
   ========================================================================== */
.totals-card { margin-top: 16px; }
.totals-summary { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); overflow: hidden; }
.total-row { display: flex; justify-content: space-between; padding: 10px 16px; border-bottom: 1px solid var(--border); font-size: 12px; color: var(--text-soft); }
.total-row:last-child { border-bottom: none; }
.total-row--grand { font-family: var(--font-display); font-weight: 800; font-size: 16px; color: var(--text); background: var(--surface-2); }

/* ==========================================================================
   DRAFT EDITING
   ========================================================================== */
.draft-input { background: var(--surface); border: 1px solid var(--border-mid); border-radius: var(--radius-sm); padding: 6px 10px; font-family: var(--font); font-size: 13px; color: var(--text); outline: none; transition: border-color 0.15s, box-shadow 0.15s; width: 100%; }
.draft-input:focus { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-glow); background: #fff; }
.draft-input.sku-input { font-weight: 700; }
.draft-input.qty-input { text-align: right; width: 70px; }
.draft-input.cost-input { text-align: right; width: 90px; }
.line-total-cell { text-align: right; font-variant-numeric: tabular-nums; color: var(--text-soft); }
.sku-loading { font-size: 10px; color: var(--open-color); display: none; margin-top: 2px; }
.sku-error   { font-size: 10px; color: var(--danger); display: none; margin-top: 2px; }
td.remove-col { width: 32px; text-align: center; }
.remove-btn { background: none; border: none; color: var(--muted); cursor: pointer; font-size: 16px; padding: 2px 6px; border-radius: 4px; transition: all 0.15s; }
.remove-btn:hover { color: var(--danger); background: var(--danger-dim); }
.add-item-row { background: var(--surface); }
.add-sku-wrap { display: flex; gap: 8px; align-items: center; padding: 12px 0 4px; }
.add-sku-input { flex: 1; max-width: 220px; }
.save-bar { display: flex; align-items: center; justify-content: space-between; padding: 10px 0 14px; gap: 12px; border-bottom: 1px solid var(--border); margin-bottom: 14px; }
.save-bar-left { font-size: 11px; color: var(--muted); }
.unsaved-dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--warn); margin-right: 6px; animation: pulse-dot 1.5s ease-in-out infinite; vertical-align: middle; }
@keyframes pulse-dot { 0%,100%{opacity:1}50%{opacity:0.3} }
.detail-header-fields { display: grid; grid-template-columns: repeat(2,1fr); gap: 12px; margin-bottom: 16px; }
@media(min-width:600px){ .detail-header-fields { grid-template-columns: repeat(4,1fr); } }
.header-field { display: flex; flex-direction: column; gap: 4px; }
.header-field .label { font-size: 10px; color: var(--muted); letter-spacing: 0.08em; text-transform: uppercase; font-weight: 600; }
.history-link { color: var(--accent); text-decoration: none; }
.history-link:hover { opacity: 0.7; }

/* ==========================================================================
   HISTORY
   ========================================================================== */
.delta { font-family: var(--font-display); font-weight: 700; font-size: 14px; }
.delta--pos { color: var(--success); }
.delta--neg { color: var(--danger); }

/* ==========================================================================
   EMPTY STATE
   ========================================================================== */
.empty-state { display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 80px 24px; gap: 12px; text-align: center; }
.empty-icon { font-size: 48px; margin-bottom: 4px; }
.empty-state h2 { font-family: var(--font-display); font-size: 20px; color: var(--text); }

/* ==========================================================================
   OVERLAY / LOADING
   ========================================================================== */
.overlay { position: fixed; inset: 0; background: rgba(255,255,255,0.75); backdrop-filter: blur(3px); display: flex; align-items: center; justify-content: center; z-index: 200; }
.overlay.hidden { display: none; }
.overlay-box { background: #fff; border: 1px solid var(--border-mid); padding: 24px 32px; border-radius: var(--radius-lg); display: flex; align-items: center; gap: 14px; font-weight: 600; font-size: 13px; box-shadow: var(--shadow-lg); color: var(--text); }
.spinner { width: 20px; height: 20px; border: 2px solid var(--border-mid); border-top-color: var(--accent); border-radius: 50%; animation: spin 0.7s linear infinite; flex-shrink: 0; }
.spinner.large { width: 32px; height: 32px; border-width: 3px; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ==========================================================================
   TOAST
   ========================================================================== */
.toast { position: fixed; bottom: 24px; right: 24px; background: var(--text); color: #fff; padding: 12px 18px; border-radius: var(--radius); z-index: 300; box-shadow: var(--shadow-lg); font-size: 12px; max-width: 400px; animation: slideToast 0.3s ease; font-weight: 500; }
@keyframes slideToast { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
.toast.hidden { display: none; }
.toast.error   { background: var(--danger); }
.toast.success { background: var(--success); }

/* ==========================================================================
   PO DONE STEP
   ========================================================================== */
.po-done-card { background: #fff; border: 1px solid rgba(204,0,0,0.2); border-top: 4px solid var(--accent); border-radius: var(--radius-lg); padding: 36px; margin-top: 16px; text-align: center; box-shadow: var(--shadow-md); }
.po-done-icon { font-size: 44px; margin-bottom: 12px; }
.po-done-card h2 { margin-bottom: 8px; color: var(--accent); }

/* ==========================================================================
   UTILITIES
   ========================================================================== */
.hidden { display: none !important; }

/* ==========================================================================
   RESPONSIVE
   ========================================================================== */
@media (max-width: 900px) {
  .stats-bar { grid-template-columns: repeat(3,1fr); }
  .detail-meta-grid { grid-template-columns: repeat(2,1fr); }
}
@media (max-width: 768px) {
  .row3, .row4 { grid-template-columns: 1fr; }
  .stats-bar { grid-template-columns: repeat(2,1fr); }
  .page-header, .detail-page-header { flex-direction: column; }
  .steps { display: none; }
  .brand-sep { display: none; }
  h1 { font-size: 22px; }
  .bulk-bar { flex-direction: column; align-items: flex-start; }
}
@media (max-width: 480px) {
  .container { padding: 0 14px; }
  .stats-bar { grid-template-columns: 1fr 1fr; gap: 8px; }
  .card { padding: 14px; }
  .filter-bar { flex-direction: column; align-items: stretch; }
  .detail-meta-grid { grid-template-columns: 1fr; }
}

/* ==========================================================================
   MANUAL INVOICE / CUSTOM PO SCREEN
   ========================================================================== */
.manual-po-form { max-width: 100%; }
.manual-header-grid { display: grid; grid-template-columns: repeat(2,1fr); gap: 14px; margin-bottom: 20px; }
@media(min-width:700px){ .manual-header-grid { grid-template-columns: repeat(4,1fr); } }
.manual-line-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.manual-line-table th { padding: 9px 10px; background: var(--surface-2); font-size: 10px; font-weight: 700; color: var(--text-soft); text-transform: uppercase; letter-spacing: 0.06em; border-bottom: 2px solid var(--border-mid); text-align: left; }
.manual-line-table th.num { text-align: right; }
.manual-line-table td { padding: 6px 8px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.manual-line-table tr:last-child td { border-bottom: none; }
.manual-line-table input { width: 100%; padding: 6px 8px; background: var(--surface); border: 1px solid var(--border-mid); border-radius: 6px; font-family: var(--font); font-size: 12px; color: var(--text); outline: none; }
.manual-line-table input:focus { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-glow); background: #fff; }
.manual-line-table input.num-input { text-align: right; }
.sku-lookup-wrap { display: flex; gap: 6px; align-items: center; }
.sku-lookup-wrap input { flex: 1; }
.sku-lookup-btn { padding: 6px 10px; font-size: 11px; white-space: nowrap; flex-shrink: 0; }
.sku-lookup-status { font-size: 10px; color: var(--muted); white-space: nowrap; }
.sku-lookup-status.found   { color: var(--success); }
.sku-lookup-status.error   { color: var(--danger); }
.sku-lookup-status.loading { color: var(--open-color); }
.add-line-row { display: flex; gap: 10px; align-items: center; padding: 10px 0; border-top: 1px dashed var(--border-mid); margin-top: 8px; }
.add-line-row input { max-width: 180px; }
.line-remove-btn { background: none; border: none; color: var(--muted); cursor: pointer; font-size: 16px; padding: 2px 6px; border-radius: 4px; transition: all 0.15s; line-height: 1; }
.line-remove-btn:hover { color: var(--danger); background: var(--danger-dim); }
.readonly-cell { color: var(--text-soft); font-size: 12px; text-align: right; }

/* ==========================================================================
   PO ACTIVITY LOG / HISTORY
   ========================================================================== */
.activity-timeline { display: flex; flex-direction: column; gap: 0; }
.activity-entry { display: flex; gap: 14px; padding: 14px 0; border-bottom: 1px solid var(--border); }
.activity-entry:last-child { border-bottom: none; }
.activity-dot-col { display: flex; flex-direction: column; align-items: center; gap: 0; flex-shrink: 0; }
.activity-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--accent); border: 2px solid #fff; box-shadow: 0 0 0 2px var(--border-mid); flex-shrink: 0; margin-top: 4px; }
.activity-dot.dot-draft  { background: var(--warn); }
.activity-dot.dot-open   { background: var(--open-color); }
.activity-dot.dot-receive{ background: var(--accent); }
.activity-dot.dot-adjust { background: var(--danger); }
.activity-line { width: 1px; background: var(--border-mid); flex: 1; margin-top: 4px; }
.activity-body { flex: 1; }
.activity-action { font-size: 13px; font-weight: 600; color: var(--text); }
.activity-meta   { font-size: 11px; color: var(--muted); margin-top: 2px; }
.activity-items  { margin-top: 6px; background: var(--surface); border: 1px solid var(--border); border-radius: 6px; padding: 8px 10px; font-size: 11px; }
.activity-item-row { display: flex; justify-content: space-between; padding: 3px 0; border-bottom: 1px solid var(--border); }
.activity-item-row:last-child { border-bottom: none; }

/* ==========================================================================
   MISSING PRODUCT — REMOVE OPTION
   ========================================================================== */
.missing-actions { display: flex; gap: 8px; align-items: center; }
.remove-line-btn { background: none; border: 1px solid var(--border-mid); color: var(--muted); padding: 5px 10px; border-radius: 6px; font-size: 11px; cursor: pointer; transition: all 0.15s; font-family: var(--font); }
.remove-line-btn:hover { color: var(--danger); border-color: var(--danger-border); background: var(--danger-dim); }
