@charset "UTF-8";
/* build: ui-redesign-20261021-1 */
/* ============================================================
   6MILE Self-Use Outbound - UI system
   Modern approval-console styling (sidebar + cards + large controls)
   ============================================================ */

:root {
  --bg: #f4f6fb;
  --surface: #ffffff;
  --surface-soft: #f8fafc;
  --ink: #0f172a;
  --ink-soft: #334155;
  --muted: #64748b;
  --muted-light: #94a3b8;
  --line: #e5e9f2;
  --line-strong: #d5dce8;
  --brand: #2563eb;
  --brand-dark: #1d4ed8;
  --brand-soft: #eef4ff;
  --success: #059669;
  --success-soft: #e8f7ef;
  --warning: #d97706;
  --warning-soft: #fff7e6;
  --danger: #dc2626;
  --danger-soft: #fef2f2;
  --violet: #7c3aed;
  --radius-sm: 9px;
  --radius: 14px;
  --radius-lg: 20px;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, .04);
  --shadow: 0 1px 2px rgba(15, 23, 42, .04), 0 10px 30px rgba(15, 23, 42, .06);
  --shadow-lg: 0 24px 70px rgba(15, 23, 42, .22);
  --font: "Inter", "Segoe UI", "PingFang SC", "Microsoft YaHei", system-ui, -apple-system, sans-serif;
}

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

html, body { min-height: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; }
a { color: inherit; }

.hidden { display: none !important; }
.main-view { display: block; }
.login-form { display: block; }

.sr-only {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0);
  white-space: nowrap; border: 0;
}

::selection { background: #dbeafe; }

/* ============================================================
   Login
   ============================================================ */
.login-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(900px 500px at 15% 0%, rgba(37, 99, 235, .30), transparent 60%),
    radial-gradient(700px 500px at 90% 100%, rgba(124, 58, 237, .22), transparent 55%),
    linear-gradient(140deg, #0b1220 0%, #111c33 55%, #172554 100%);
}

.login-card {
  width: min(430px, 100%);
  background: #fff;
  border-radius: 24px;
  padding: 38px 36px 30px;
  box-shadow: 0 40px 100px rgba(2, 6, 23, .55);
}

.login-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 26px; }

.login-mark {
  width: 46px; height: 46px;
  border-radius: 14px;
  display: grid; place-items: center;
  background: linear-gradient(135deg, var(--brand), var(--violet));
  color: #fff;
  font-size: 22px;
  font-weight: 800;
  box-shadow: 0 10px 22px rgba(37, 99, 235, .30);
}

.login-brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.login-brand-text strong { font-size: 20px; letter-spacing: .04em; color: #0f172a; }
.login-brand-text span { font-size: 11px; letter-spacing: .18em; text-transform: uppercase; color: var(--muted); margin-top: 2px; }

.login-heading { margin: 0 0 6px; font-size: 26px; letter-spacing: -.03em; }
.login-copy { margin: 0 0 24px; color: var(--muted); font-size: 13.5px; line-height: 1.6; }

.login-label { display: block; font-size: 12.5px; font-weight: 600; color: var(--ink-soft); margin: 0 0 7px; }

#loginUser, #loginCode {
  width: 100%;
  height: 48px;
  padding: 0 14px;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  background: #fbfcfe;
  font-size: 15px;
  margin-bottom: 16px;
  transition: border-color .2s, box-shadow .2s, background .2s;
}
#loginUser:focus, #loginCode:focus {
  outline: none;
  border-color: var(--brand);
  background: #fff;
  box-shadow: 0 0 0 4px rgba(37, 99, 235, .12);
}

.login-btn {
  width: 100%;
  height: 48px;
  margin-top: 8px;
  border: 0;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--brand), var(--brand-dark));
  color: #fff;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: .04em;
  box-shadow: 0 12px 24px rgba(37, 99, 235, .25);
  transition: transform .15s, box-shadow .2s, background .2s;
}
.login-btn:hover { transform: translateY(-1px); box-shadow: 0 16px 30px rgba(37, 99, 235, .30); }
.login-btn:disabled { background: #9db4e4; box-shadow: none; transform: none; }

.login-msg { min-height: 20px; margin-top: 14px; font-size: 13px; text-align: center; }
.login-msg.err { color: var(--danger); }
.login-msg.ok { color: var(--success); }
.login-foot { margin-top: 22px; padding-top: 16px; border-top: 1px solid var(--line); text-align: center; font-size: 11px; color: var(--muted-light); letter-spacing: .08em; }

/* ============================================================
   App shell
   ============================================================ */
.app-shell { display: flex; min-height: 100vh; }

.sidebar {
  width: 252px;
  flex: 0 0 252px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  padding: 20px 14px 16px;
  background: #fff;
  border-right: 1px solid var(--line);
  z-index: 70;
}

.brand { display: flex; align-items: center; gap: 11px; padding: 2px 8px 22px; }
.brand-mark {
  width: 40px; height: 40px;
  flex: 0 0 40px;
  border-radius: 12px;
  display: grid; place-items: center;
  background: linear-gradient(135deg, var(--brand), var(--violet));
  color: #fff;
  font-size: 19px;
  font-weight: 800;
  box-shadow: 0 8px 18px rgba(37, 99, 235, .22);
}
.brand-text { display: flex; flex-direction: column; line-height: 1.2; min-width: 0; }
.brand-text strong { font-size: 16px; letter-spacing: .03em; }
.brand-text span { font-size: 10px; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); margin-top: 3px; white-space: nowrap; }

.nav { display: flex; flex-direction: column; gap: 4px; }
.nav-label {
  padding: 16px 12px 6px;
  font-size: 10.5px;
  letter-spacing: .12em;
  text-transform: uppercase;
  font-weight: 700;
  color: var(--muted-light);
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 11px;
  width: 100%;
  min-height: 44px;
  padding: 0 12px;
  border: 1px solid transparent;
  border-radius: 11px;
  background: transparent;
  color: var(--ink-soft);
  font-size: 13.5px;
  font-weight: 600;
  text-align: left;
  transition: background .18s, color .18s, border-color .18s;
}
.nav-item:hover { background: var(--surface-soft); color: var(--ink); }
.nav-item.active { background: var(--brand-soft); color: var(--brand-dark); }
.nav-icon { width: 19px; height: 19px; flex: 0 0 19px; }

.sidebar-footer { margin-top: auto; padding-top: 18px; border-top: 1px solid var(--line); }
.user-card { display: flex; align-items: center; gap: 10px; padding: 8px 8px 12px; }
.avatar {
  width: 38px; height: 38px;
  flex: 0 0 38px;
  border-radius: 50%;
  display: grid; place-items: center;
  background: #e0e7ff;
  color: #3730a3;
  font-weight: 800;
  font-size: 15px;
}
.user-meta { display: flex; flex-direction: column; min-width: 0; }
.user-meta strong { font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-meta span { font-size: 11.5px; color: var(--muted); text-transform: capitalize; }

.sidebar-actions { display: flex; flex-direction: column; gap: 2px; padding: 2px 4px; }
.link-btn {
  border: 0;
  background: transparent;
  padding: 8px 8px;
  border-radius: 8px;
  text-align: left;
  color: var(--muted);
  font-size: 12.5px;
  font-weight: 500;
}
.link-btn:hover { background: var(--surface-soft); color: var(--ink); }
.link-btn.danger:hover { background: var(--danger-soft); color: var(--danger); }

/* ============================================================
   Main column / header
   ============================================================ */
.app-main { flex: 1; min-width: 0; display: flex; flex-direction: column; min-height: 100vh; }

.app-header {
  position: sticky;
  top: 0;
  z-index: 55;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  padding: 22px 30px 18px;
  background: rgba(255, 255, 255, .92);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}

.page-heading { min-width: 0; }
.page-kicker {
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: .13em;
  text-transform: uppercase;
  color: var(--brand);
  margin-bottom: 5px;
}
.page-heading h1 {
  margin: 0;
  font-size: 25px;
  line-height: 1.15;
  letter-spacing: -.035em;
  font-weight: 750;
}
.page-subtitle { margin: 6px 0 0; color: var(--muted); font-size: 13px; max-width: 640px; }
.page-meta { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.meta-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 28px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  font-size: 12px;
  color: var(--ink-soft);
}
.meta-pill .meta-label { color: var(--muted-light); font-size: 11px; }
.meta-pill b { font-weight: 650; }

.header-actions { display: flex; align-items: center; justify-content: flex-end; gap: 9px; flex-wrap: wrap; padding-top: 4px; }

.app-content { flex: 1; width: 100%; max-width: 1440px; margin: 0 auto; padding: 24px 30px 48px; }

/* ============================================================
   Buttons (shared)
   ============================================================ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 42px;
  padding: 0 17px;
  border: 1px solid transparent;
  border-radius: 10px;
  background: transparent;
  color: var(--ink-soft);
  font-size: 13.5px;
  font-weight: 650;
  white-space: nowrap;
  transition: background .18s, border-color .18s, box-shadow .18s, transform .12s;
}
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn:disabled { opacity: .48; }
.btn-primary {
  background: linear-gradient(135deg, var(--brand), var(--brand-dark));
  color: #fff;
  box-shadow: 0 8px 18px rgba(37, 99, 235, .22);
}
.btn-primary:hover:not(:disabled) { box-shadow: 0 10px 24px rgba(37, 99, 235, .30); }
.btn-secondary { background: #fff; border-color: var(--line-strong); color: var(--ink-soft); }
.btn-secondary:hover:not(:disabled) { border-color: #b9c6da; background: #fbfcff; }
.btn-ghost { background: var(--surface-soft); border-color: transparent; color: var(--ink-soft); }
.btn-ghost:hover:not(:disabled) { background: #eef2f7; }
.btn-danger { background: var(--danger); color: #fff; box-shadow: 0 8px 18px rgba(220, 38, 38, .18); }
.btn-danger:hover:not(:disabled) { background: #b91c1c; }
.btn-sm { min-height: 36px; padding: 0 13px; font-size: 12.5px; border-radius: 9px; }
.btn-icon { width: 42px; padding: 0; }

.btn-cancel, .btn-confirm, .btn-danger:not(.btn) {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 0 18px;
  border: 1px solid transparent;
  border-radius: 10px;
  font-size: 13.5px;
  font-weight: 650;
}
.btn-cancel { background: #f1f5f9; border-color: var(--line); color: var(--ink-soft); }
.btn-cancel:hover { background: #e9eef5; }
.btn-confirm { background: var(--brand); color: #fff; box-shadow: 0 8px 18px rgba(37, 99, 235, .18); }
.btn-confirm:hover { background: var(--brand-dark); }
.btn-confirm:disabled { background: #a8bde8; box-shadow: none; }
.btn-cancel + .btn-confirm, .btn-cancel + .btn-danger, .btn-confirm + .btn-danger { margin-left: 8px; }

.btn-ghost.hidden, .btn.hidden { display: none !important; }

/* ============================================================
   Surfaces / section headers
   ============================================================ */
.surface {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}
.entry-surface { padding: 18px 20px 20px; }
.table-surface { margin-top: 18px; overflow: hidden; }
.section-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  padding: 20px 22px 14px;
}
.section-head .btn { flex: 0 0 auto; }
.section-head h2 { margin: 0; font-size: 16px; letter-spacing: -.02em; }
.section-head p { margin: 3px 0 0; color: var(--muted); font-size: 12.5px; }

/* ============================================================
   Entry bar
   ============================================================ */
.entry-bar { display: flex; align-items: flex-end; gap: 12px; flex-wrap: wrap; }
.entry-bar .btn { min-height: 44px; }

.code-field { display: flex; flex-direction: column; gap: 5px; flex: 0 0 300px; }
.code-field label { font-size: 11px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
#codeInput {
  width: 100%;
  height: 48px;
  padding: 0 14px;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  background: #fbfcfe;
  font-size: 17px;
  font-weight: 600;
  letter-spacing: .02em;
  transition: border-color .2s, box-shadow .2s, background .2s;
}
#codeInput:focus { outline: none; border-color: var(--brand); background: #fff; box-shadow: 0 0 0 4px rgba(37, 99, 235, .12); }
#codeInput:disabled { background: #f1f5f9; color: var(--muted); }
#codeInput.ok { border-color: var(--success); background: #f2fbf7; }
#codeInput.err { border-color: var(--danger); background: #fff5f5; }

.match-status { font-size: 13px; color: var(--ink-soft); padding-bottom: 12px; }
.match-status.ok { color: var(--success); }
.match-status.err { color: var(--danger); }
.price-info { margin-left: auto; padding-bottom: 12px; font-size: 12px; color: var(--muted); }
.price-info.ok { color: var(--success); font-weight: 600; }
.price-info.none { color: var(--danger); font-weight: 600; }

/* ============================================================
   Read-only notice
   ============================================================ */
.readonly-banner {
  margin-top: 14px;
  padding: 12px 15px;
  border: 1px solid #fde68a;
  border-radius: 12px;
  background: #fffbeb;
  color: #92400e;
  font-size: 12.5px;
  line-height: 1.55;
}
.readonly-banner strong { color: #78350f; }

/* ============================================================
   Quick pick
   ============================================================ */
.quick-wrap { margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--line); }
.quick-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 11px; }
.quick-title { font-size: 13.5px; font-weight: 700; }
.quick-subtitle { display: block; font-size: 11.5px; color: var(--muted); margin-top: 2px; }
.quick-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 9px; }

.quick-item {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: space-between;
  gap: 5px;
  min-height: 86px;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: #fff;
  color: var(--ink);
  text-align: left;
  box-shadow: 0 1px 2px rgba(15, 23, 42, .03);
  transition: border-color .18s, box-shadow .18s, transform .15s;
  overflow: hidden;
}
.quick-item:hover { border-color: #bfdbfe; box-shadow: 0 10px 24px rgba(37, 99, 235, .09); transform: translateY(-1px); }
.quick-item:active { transform: translateY(0); }
.quick-item.is-nocode { background: linear-gradient(180deg, #fff, #f7fbff); }
.quick-item .quick-code { font-size: 17px; font-weight: 750; line-height: 1.1; letter-spacing: .01em; color: var(--brand-dark); }
.quick-item .quick-name {
  width: 100%;
  font-size: 11.5px;
  line-height: 1.3;
  color: var(--ink-soft);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  word-break: break-word;
}
.quick-item .quick-stock {
  display: inline-flex;
  align-items: center;
  min-height: 20px;
  padding: 0 7px;
  border-radius: 999px;
  background: #f1f5f9;
  color: #475569;
  font-size: 10.5px;
  font-weight: 650;
  text-transform: capitalize;
}
.quick-item.out { opacity: .45; filter: grayscale(.4); cursor: not-allowed; }
.quick-item.out:hover { transform: none; box-shadow: none; border-color: var(--line); }

/* ============================================================
   Items table
   ============================================================ */
.table-wrap { width: 100%; overflow-x: auto; }
table#itemsTable { width: 100%; border-collapse: separate; border-spacing: 0; background: #fff; min-width: 980px; }
#itemsTable th {
  position: sticky;
  top: 0;
  z-index: 2;
  padding: 11px 12px;
  border-bottom: 1px solid var(--line);
  background: #f8fafc;
  color: var(--muted);
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: .07em;
  text-transform: uppercase;
  text-align: left;
  white-space: nowrap;
}
#itemsTable td {
  padding: 9px 12px;
  border-bottom: 1px solid #eef2f7;
  font-size: 13px;
  vertical-align: middle;
  background: #fff;
}
#itemsTable tbody tr:hover td { background: #fafbff; }
#itemsTable tbody tr:last-child td { border-bottom: 0; }
#itemsTable td.center { text-align: center; }
#itemsTable td.right { text-align: right; font-variant-numeric: tabular-nums; }
#itemsTable td.name { max-width: 480px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; font-weight: 550; }
#itemsTable tr.anomaly td { background: #fffbeb; }
#itemsTable tr.nocode-row td { background: #f7fbff; }
#itemsTable tr.nocode-row td:first-child { box-shadow: inset 3px 0 0 var(--brand); }
#itemsTable td.purpose input {
  width: 100%;
  height: 34px;
  padding: 0 9px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: #fff;
  font-size: 12.5px;
  transition: border-color .15s, box-shadow .15s;
}
#itemsTable td.purpose input:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(37, 99, 235, .10); }
#itemsTable td.purpose input:disabled { background: #f1f5f9; color: var(--muted); border-color: #e5e9f2; }
#itemsTable td.purpose input.err { border-color: #fca5a5; background: #fff5f5; }

#itemsTable td.actions button {
  width: 30px; height: 30px;
  display: inline-grid; place-items: center;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 8px;
  background: var(--danger-soft);
  color: var(--danger);
  font-size: 15px;
  font-weight: 700;
}
#itemsTable td.actions button:hover { background: #fee2e2; }
#itemsTable td.actions .del-disabled {
  display: inline-grid; place-items: center;
  width: 30px; height: 30px;
  color: #cbd5e1;
  font-size: 15px;
  cursor: not-allowed;
}

#itemsTable td.prod-mark { text-align: center; }
#itemsTable td.prod-mark input {
  width: 18px; height: 18px;
  cursor: pointer;
  accent-color: var(--success);
}
#itemsTable td.prod-mark input:disabled { cursor: not-allowed; opacity: .38; }
#itemsTable td.empty-row {
  padding: 46px 20px;
  text-align: center;
  color: var(--muted);
  font-size: 13px;
  background: #fff;
}

.list-footer-actions {
  display: flex;
  justify-content: center;
  padding: 22px 0 4px;
}
.back-button {
  min-width: 230px;
  justify-content: center;
}

/* ============================================================
   Approval dashboard
   ============================================================ */
.approve-page { width: 100%; }
.approve-stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 13px; margin-bottom: 16px; }
.approve-stats.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }

.status-tabs {
  display: flex;
  align-items: center;
  gap: 3px;
  margin-bottom: 14px;
  padding: 4px;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  box-shadow: var(--shadow-sm);
  scrollbar-width: none;
}
.status-tabs::-webkit-scrollbar { display: none; }
.status-tab {
  flex: 0 0 auto;
  min-height: 40px;
  padding: 0 16px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  font-weight: 650;
  white-space: nowrap;
  transition: background .15s, color .15s;
}
.status-tab:hover { background: var(--surface-soft); color: var(--ink-soft); }
.status-tab.active { background: var(--brand-soft); color: var(--brand-dark); }
.filter-field.status-field { display: none; }
.stat-card {
  position: relative;
  overflow: hidden;
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  box-shadow: var(--shadow-sm);
}
.stat-card::after {
  content: "";
  position: absolute;
  right: -18px; top: -22px;
  width: 74px; height: 74px;
  border-radius: 50%;
  background: currentColor;
  opacity: .07;
}
.stat-card .stat-label { display: block; font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.stat-card .stat-value { display: block; margin-top: 5px; font-size: 28px; line-height: 1; font-weight: 780; letter-spacing: -.04em; }
.stat-card.stat-pending { color: var(--warning); }
.stat-card.stat-approved { color: var(--success); }
.stat-card.stat-rejected { color: var(--danger); }
.stat-card.stat-voided { color: #64748b; }
.stat-card .stat-label, .stat-card .stat-value { position: relative; z-index: 1; }
.stat-card .stat-label { color: var(--muted); }

.toolbar-card {
  display: flex;
  align-items: flex-end;
  gap: 12px;
  flex-wrap: wrap;
  padding: 14px 16px;
  margin-bottom: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  box-shadow: var(--shadow-sm);
}
.approve-filters { display: flex; align-items: flex-end; gap: 11px; flex-wrap: wrap; width: 100%; }
.filter-field { display: flex; flex-direction: column; gap: 5px; }
.filter-field > span { font-size: 10.5px; font-weight: 700; letter-spacing: .07em; text-transform: uppercase; color: var(--muted); }
.filter-field input, .filter-field select {
  height: 40px;
  min-width: 132px;
  padding: 0 11px;
  border: 1px solid var(--line-strong);
  border-radius: 9px;
  background: #fff;
  color: var(--ink-soft);
  font-size: 13px;
}
.filter-field input:focus, .filter-field select:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(37, 99, 235, .10); }

.toggle-rejected {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  padding: 0 12px;
  border: 1px solid var(--line-strong);
  border-radius: 9px;
  background: #fff;
  color: var(--ink-soft);
  font-size: 12.5px;
  font-weight: 550;
  cursor: pointer;
  user-select: none;
}
.toggle-rejected:hover { background: #f8faff; border-color: #b9c6da; }
.toggle-rejected input { width: 16px; height: 16px; margin: 0; accent-color: var(--brand); cursor: pointer; }
.btn-refresh { min-height: 40px; }
.btn-refresh:disabled { opacity: .5; }

.bulk-toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  padding: 10px 14px;
  margin-bottom: 12px;
  border: 1px solid #bcd7f4;
  border-radius: 12px;
  background: #eef6ff;
}
.bulk-toolbar.hidden { display: none; }
.bulk-info { font-size: 13px; font-weight: 650; color: #1e3a8a; }
.bulk-info b { font-size: 15px; }
.bulk-actions { display: flex; align-items: center; gap: 8px; margin-left: auto; }
.approve-select {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding-top: 2px;
  cursor: pointer;
}
.approve-select input {
  width: 18px;
  height: 18px;
  margin: 0;
  accent-color: var(--brand);
  cursor: pointer;
}

.approve-list { min-height: 240px; }

/* ============================================================
   Approval cards
   ============================================================ */
.approve-card {
  position: relative;
  overflow: hidden;
  margin-bottom: 12px;
  padding: 18px 20px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  box-shadow: var(--shadow-sm);
  transition: box-shadow .18s, border-color .18s, transform .12s;
}
.approve-card:hover { box-shadow: var(--shadow); }
.approve-card.status-pending {
  border-color: #f5c98d;
  background: #fff3e2;
}
.approve-card.status-approved {
  border-color: #a9e0c2;
  background: #e9f9f0;
}
.approve-card.is-approved-uncalc {
  border-color: #a9d3f5;
  background: #e8f4ff;
}
.approve-card.status-rejected {
  border-color: #f7b6c1;
  background: #ffeef1;
}
.approve-card.is-voided {
  border-color: #d7e0ea;
  background: #f4f7fa;
}
.approve-card.is-bulk-selected {
  outline: 3px solid rgba(37, 99, 235, .38);
  outline-offset: 2px;
}
.approve-card.is-approved-uncalc .uncalc-note { color: #0369a1; }

.approve-card-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.approve-title { display: flex; align-items: center; gap: 11px; min-width: 0; flex: 1; }
.approve-title > div { min-width: 0; flex: 1; }
.approve-title strong { display: block; font-size: 16px; letter-spacing: -.02em; }
.approve-id { margin-top: 3px; font-size: 10.5px; color: var(--muted-light); font-family: ui-monospace, "SFMono-Regular", Consolas, monospace; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }

.approve-actions { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; }
.approve-actions button {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 37px;
  padding: 0 14px;
  border: 1px solid transparent;
  border-radius: 9px;
  font-size: 12.5px;
  font-weight: 650;
  white-space: nowrap;
  transition: background .15s, border-color .15s, box-shadow .15s;
}
.approve-actions .btn-open { background: #fff; border-color: var(--line-strong); color: var(--ink-soft); }
.approve-actions .btn-open:hover { border-color: #b9c6da; background: #fbfcff; }
.approve-actions .btn-approve { background: var(--brand); color: #fff; box-shadow: 0 6px 14px rgba(37, 99, 235, .18); }
.approve-actions .btn-approve:hover { background: var(--brand-dark); }
.approve-actions .btn-reject { background: #fff; border-color: #fecaca; color: var(--danger); }
.approve-actions .btn-reject:hover { background: var(--danger-soft); }
.approve-actions .btn-void { background: #fff; border-color: #fcd34d; color: #92400e; }
.approve-actions .btn-void:hover { background: #fffbeb; }

.approve-card-body {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-top: 15px;
  padding-top: 14px;
  border-top: 1px dashed var(--line);
}
.approve-card-body span { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.approve-card-body i { font-style: normal; font-size: 10px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted-light); }
.approve-card-body b { font-size: 13px; font-weight: 600; color: var(--ink-soft); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.approve-meta-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 9px; }
.approve-meta-mini { font-size: 11.5px; color: var(--muted); }
.approve-meta-mini.ok { color: var(--success); }
.approve-meta-mini.warn { color: var(--warning); }

.type-badge {
  display: inline-flex;
  align-items: center;
  height: 26px;
  padding: 0 10px;
  border-radius: 999px;
  font-size: 10.5px;
  font-weight: 750;
  letter-spacing: .07em;
  text-transform: uppercase;
  white-space: nowrap;
}
.type-pending { background: var(--warning-soft); color: #b45309; }
.type-approved { background: var(--success-soft); color: #047857; }
.type-approved-uncalc { background: #e0f2fe; color: #0369a1; }
.type-rejected { background: var(--danger-soft); color: #b91c1c; }
.type-voided { background: #f1f5f9; color: #475569; }
.type-draft { background: #eef2ff; color: #4338ca; }
.type-final { background: #fff5d6; color: #b45309; }

.reject-comment {
  margin-top: 11px;
  padding: 10px 13px;
  border: 1px solid #fecaca;
  border-left: 3px solid #ef4444;
  border-radius: 9px;
  background: #fff7f7;
  font-size: 12.5px;
  color: #991b1b;
  line-height: 1.55;
  word-break: break-word;
}
.reject-comment strong { font-weight: 700; }
.approve-card.is-voided .reject-comment {
  border-color: #e2e8f0;
  border-left-color: #94a3b8;
  background: #f8fafc;
  color: #475569;
}

.approve-pager { display: flex; align-items: center; justify-content: flex-end; gap: 10px; padding: 14px 2px 0; }
.approve-pager .page-info { font-size: 12px; color: var(--muted); }
.pager-buttons { display: flex; gap: 7px; }

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 260px;
  padding: 30px;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
  background: #fff;
  text-align: center;
}
.empty-state .empty-icon {
  width: 52px; height: 52px;
  display: grid; place-items: center;
  border-radius: 16px;
  background: var(--brand-soft);
  color: var(--brand);
  font-size: 24px;
  margin-bottom: 12px;
}
.empty-state h3 { margin: 0 0 4px; font-size: 15px; }
.empty-state p { margin: 0; color: var(--muted); font-size: 12.5px; }

/* ============================================================
   Status bar
   ============================================================ */
.statusbar {
  position: sticky;
  bottom: 0;
  z-index: 60;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 42px;
  padding: 8px 30px;
  background: rgba(255, 255, 255, .96);
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 12px;
  backdrop-filter: blur(8px);
}
.statusbar .status-left, .statusbar .status-right { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; }
.statusbar .status-sep { color: #cbd5e1; }
#statusText { color: var(--ink-soft); font-weight: 600; }
#applicantText { color: var(--muted); }
#fileStatusText { color: var(--brand); font-weight: 700; font-size: 11px; letter-spacing: .05em; text-transform: uppercase; }
#summaryText { color: var(--muted); }

/* ============================================================
   Modals
   ============================================================ */
.modal {
  position: fixed;
  inset: 0;
  z-index: 300;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(15, 23, 42, .48);
  backdrop-filter: blur(3px);
}
.modal.hidden { display: none; }
.modal-box {
  width: min(560px, 94vw);
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border-radius: var(--radius-lg);
  background: #fff;
  box-shadow: var(--shadow-lg);
}
.modal-box.wide { width: min(1020px, 94vw); }

.modal-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 20px 24px 16px;
  border-bottom: 1px solid var(--line);
}
.modal-head h3 { margin: 0; font-size: 18px; letter-spacing: -.02em; }
.modal-sub { margin: 4px 0 0; color: var(--muted); font-size: 12.5px; }
.modal-head .close {
  width: 34px; height: 34px;
  flex: 0 0 34px;
  display: grid; place-items: center;
  border: 1px solid transparent;
  border-radius: 9px;
  background: var(--surface-soft);
  color: var(--muted);
  font-size: 20px;
  line-height: 1;
}
.modal-head .close:hover { background: #eef2f7; color: var(--ink); }

.modal-body { padding: 22px 24px; overflow: auto; }
.modal-body > .form-label:first-child { margin-top: 0; }
.modal-body .form-label { margin-top: 16px; }

.modal-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 14px 24px;
  border-top: 1px solid var(--line);
  background: var(--surface-soft);
}
.modal-foot-note { font-size: 11.5px; color: var(--muted-light); }
.modal-actions { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 20px; flex-wrap: wrap; }
.modal-actions.end { justify-content: flex-end; }
.modal-status { color: var(--muted); font-size: 12.5px; }
.modal-hint { margin: 0 0 12px; color: var(--muted); font-size: 12.5px; line-height: 1.6; }

.form-label { display: block; margin: 0 0 6px; font-size: 12px; font-weight: 650; color: var(--ink-soft); }
.form-select {
  width: 100%;
  height: 42px;
  padding: 0 11px;
  border: 1px solid var(--line-strong);
  border-radius: 9px;
  background: #fff;
  color: var(--ink-soft);
  font-size: 13.5px;
}
.form-select:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(37, 99, 235, .10); }
.form-textarea {
  width: 100%;
  min-height: 88px;
  padding: 10px 12px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: #fff;
  color: var(--ink);
  font-size: 13.5px;
  line-height: 1.55;
  resize: vertical;
}
.form-textarea:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(37, 99, 235, .10); }

.notice-box {
  padding: 12px 14px;
  margin-bottom: 18px;
  border: 1px solid #bfdbfe;
  border-radius: 11px;
  background: #eff6ff;
  color: #1e40af;
  font-size: 12.5px;
  line-height: 1.55;
}
.notice-box b { font-weight: 700; }

.void-summary {
  padding: 14px 16px;
  margin-bottom: 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface-soft);
}
.void-summary .void-title { font-size: 14px; font-weight: 700; margin-bottom: 3px; }
.void-summary .void-meta { font-size: 12px; color: var(--muted); line-height: 1.6; word-break: break-word; }

.export-summary {
  margin-bottom: 16px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--surface-soft);
  color: var(--muted);
  font-size: 12.5px;
  line-height: 1.6;
}

.export-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 48vh;
  overflow-y: auto;
  padding-right: 2px;
}
.export-mode-tabs {
  display: flex;
  gap: 5px;
  padding: 4px;
  margin-bottom: 14px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--surface-soft);
}
.export-mode-tabs button {
  flex: 1;
  min-height: 38px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  font-weight: 650;
  cursor: pointer;
}
.export-mode-tabs button.active {
  background: #fff;
  color: var(--brand);
  box-shadow: 0 1px 4px rgba(15, 23, 42, .10);
}
.export-option.incomplete {
  border-color: #f5c98d;
  background: #fff8ee;
  cursor: help;
}
.export-empty {
  padding: 28px 16px;
  text-align: center;
  color: var(--muted);
  font-size: 13px;
}
.export-option.incomplete .export-option-title { color: #b45309; }
.export-option.incomplete .export-option-check {
  border-color: #f5c98d;
  color: #b45309;
  background: #fff7e6;
}
.export-option-badge {
  display: inline-block;
  margin-left: 8px;
  padding: 2px 7px;
  border-radius: 999px;
  background: #fff1db;
  color: #b45309;
  font-size: 10px;
  font-weight: 700;
  vertical-align: 1px;
}
.export-option.incomplete:hover {
  border-color: #f0b768;
  background: #fff4e2;
}
.export-option {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: #fff;
  color: var(--ink-soft);
  text-align: left;
  transition: border-color .15s, background .15s, box-shadow .15s;
}
.export-option:hover { border-color: #bfdbfe; background: #f8fbff; }
.export-option.selected {
  border-color: var(--brand);
  background: var(--brand-soft);
  box-shadow: 0 0 0 2px rgba(37, 99, 235, .12);
}
.export-option-main { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.export-option-title { font-size: 14px; font-weight: 650; color: var(--ink); }
.export-option-meta { font-size: 11.5px; color: var(--muted); }
.export-option-check {
  width: 22px; height: 22px;
  flex: 0 0 22px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line-strong);
  border-radius: 50%;
  color: transparent;
  font-size: 12px;
  font-weight: 700;
}
.export-option.selected .export-option-check {
  border-color: var(--brand);
  background: var(--brand);
  color: #fff;
}
.export-pager {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 10px;
}
.export-selection { min-height: 18px; margin-top: 10px; color: var(--ink-soft); font-size: 12.5px; }

.pager-right { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.pager-left { display: flex; align-items: center; gap: 8px; }
.page-info { font-size: 12px; color: var(--muted); }

.btn-page {
  min-height: 38px;
  padding: 0 14px;
  border: 1px solid var(--line-strong);
  border-radius: 9px;
  background: #fff;
  color: var(--ink-soft);
  font-size: 12.5px;
  font-weight: 600;
}
.btn-page:hover:not(:disabled) { background: var(--surface-soft); }
.btn-page:disabled { opacity: .45; }

/* ============================================================
   Detail modal table
   ============================================================ */
.detail-meta {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}
.detail-meta > div { padding: 11px 13px; border: 1px solid var(--line); border-radius: 11px; background: var(--surface-soft); }
.detail-meta span { display: block; font-size: 10px; letter-spacing: .07em; text-transform: uppercase; color: var(--muted-light); font-weight: 700; }
.detail-meta b { display: block; margin-top: 3px; font-size: 13px; font-weight: 650; color: var(--ink-soft); word-break: break-word; }

.detail-table-wrap { overflow: auto; border: 1px solid var(--line); border-radius: 12px; }
.detail-table { width: 100%; border-collapse: collapse; font-size: 12.5px; min-width: 840px; }
.detail-table th {
  padding: 10px 11px;
  border-bottom: 1px solid var(--line);
  background: #f8fafc;
  color: var(--muted);
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  text-align: left;
  white-space: nowrap;
}
.detail-table td { padding: 9px 11px; border-bottom: 1px solid #eef2f7; vertical-align: middle; }
.detail-table tr:last-child td { border-bottom: 0; }
.detail-table td.num { text-align: right; font-variant-numeric: tabular-nums; }
.detail-table td.center { text-align: center; }
.detail-table td.name { font-weight: 600; }
.detail-table .prod-check { color: var(--success); font-weight: 700; }

/* ============================================================
   No-code picker
   ============================================================ */
.special-modal-box {
  width: min(940px, 94vw);
  max-height: 86vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border-radius: var(--radius-lg);
  background: #fff;
  box-shadow: var(--shadow-lg);
}
.special-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 20px;
  border-bottom: 1px solid var(--line);
  background: var(--surface-soft);
  flex-shrink: 0;
}
.special-search {
  flex: 1;
  min-width: 0;
  height: 40px;
  padding: 0 12px;
  border: 1px solid var(--line-strong);
  border-radius: 9px;
  background: #fff;
  font-size: 13px;
}
.special-search:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(37, 99, 235, .10); }
.btn-special-toggle {
  min-height: 40px;
  padding: 0 13px;
  border: 1px solid var(--line-strong);
  border-radius: 9px;
  background: #fff;
  color: var(--ink-soft);
  font-size: 12.5px;
  font-weight: 600;
  white-space: nowrap;
}
.btn-special-toggle:hover { background: #fff; border-color: #b9c6da; }
.btn-special-toggle.hidden { display: none; }

.special-list { flex: 1; overflow-y: auto; overflow-x: hidden; padding: 14px 18px; display: grid; gap: 9px; min-width: 0; }
.special-list.mode-single { grid-template-columns: minmax(0, 1fr); }
.special-list.mode-all { grid-template-columns: repeat(3, minmax(0, 1fr)); align-items: start; }

.special-item {
  display: flex;
  align-items: center;
  gap: 9px;
  min-height: 48px;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  cursor: pointer;
  transition: border-color .15s, background .15s, box-shadow .15s;
  overflow: hidden;
  min-width: 0;
}
.special-item:hover { border-color: #bfdbfe; background: #f8fbff; }
.special-item.active { border-color: var(--brand); background: #eff6ff; box-shadow: 0 0 0 3px rgba(37, 99, 235, .10); }
.special-item.out-of-stock { opacity: .5; background: #f8fafc; cursor: not-allowed; }
.special-code { flex: 0 0 auto; min-width: 34px; font-family: ui-monospace, Consolas, monospace; font-size: 13px; font-weight: 700; color: var(--brand-dark); }
.special-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; color: var(--ink-soft); }
.special-stock { flex: 0 0 auto; font-size: 11px; color: var(--success); white-space: nowrap; }
.special-stock b { font-weight: 700; }
.special-item .special-source {
  flex: 0 0 auto;
  padding: 2px 6px;
  border-radius: 999px;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: .04em;
  white-space: nowrap;
}
.special-item .special-source.coded { background: #eef4ff; color: #1d4ed8; }
.special-item .special-source.nocode { background: #e8f7ef; color: #047857; }
.special-item.out-of-stock .special-stock { color: var(--danger); }
.special-list.mode-all .special-item .special-source { display: none; }
.special-list.mode-all .special-item { padding: 7px 9px; }
.special-list.mode-all .special-code { font-size: 12px; min-width: 28px; }
.special-list.mode-all .special-stock { font-size: 10px; }
.special-empty { grid-column: 1 / -1; padding: 40px 20px; text-align: center; color: var(--muted); font-size: 13px; }
.special-pager {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  padding: 12px 20px;
  border-top: 1px solid var(--line);
  background: var(--surface-soft);
  flex-shrink: 0;
}
.special-pager .page-info { margin-right: auto; }

.special-tooltip {
  position: fixed;
  z-index: 9999;
  max-width: 360px;
  padding: 9px 12px;
  border-radius: 9px;
  background: #0f172a;
  color: #fff;
  font-size: 12px;
  line-height: 1.45;
  box-shadow: 0 10px 30px rgba(15, 23, 42, .25);
  pointer-events: none;
  word-break: break-word;
  white-space: normal;
}
.special-tooltip::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: -10px;
  transform: translateX(-50%);
  border: 5px solid transparent;
  border-top-color: #0f172a;
}
.special-tooltip.above::after { bottom: auto; top: -10px; border-top-color: transparent; border-bottom-color: #0f172a; }
.special-tooltip.hidden { display: none; }

/* ============================================================
   Quantity picker
   ============================================================ */
#qtyModal { z-index: 420; }
.qty-modal-box {
  width: 320px;
  padding: 20px 18px 16px;
  border-radius: 18px;
  background: #fff;
  box-shadow: var(--shadow-lg);
  text-align: center;
  animation: qtyPop .18s ease-out;
}
@keyframes qtyPop { from { transform: scale(.88); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.qty-modal-title { font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); margin-bottom: 7px; }
.qty-modal-product { margin: 0 0 12px; color: var(--muted); font-size: 11px; line-height: 1.35; max-height: 32px; overflow: hidden; word-break: break-word; }
.qty-list { display: flex; flex-direction: column; align-items: center; gap: 7px; margin-bottom: 12px; }
.qty-item {
  width: 76px;
  height: 54px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line-strong);
  border-radius: 11px;
  background: var(--surface-soft);
  color: var(--ink);
  font-size: 24px;
  font-weight: 750;
  cursor: pointer;
  transition: background .15s, border-color .15s, box-shadow .15s, transform .15s;
  user-select: none;
}
.qty-item:hover { background: #eff6ff; border-color: #bfdbfe; }
.qty-item.active { background: #fef3c7; border-color: #f59e0b; color: #92400e; box-shadow: 0 0 0 3px rgba(245, 158, 11, .18); transform: scale(1.04); }
.qty-custom { display: flex; gap: 8px; align-items: stretch; }
.qty-custom input {
  flex: 1;
  min-width: 0;
  height: 40px;
  padding: 0 11px;
  border: 1px solid var(--line-strong);
  border-radius: 9px;
  font-size: 14px;
}
.qty-custom .btn-confirm { min-height: 40px; padding: 0 16px; }
.qty-custom input:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(37, 99, 235, .10); }
.qty-tip { margin-top: 10px; color: var(--muted-light); font-size: 10px; line-height: 1.35; }

/* ============================================================
   Price preview / column select
   ============================================================ */
.preview-wrap { max-height: 54vh; overflow: auto; border: 1px solid var(--line); border-radius: 10px; }
.preview-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.preview-table th, .preview-table td { padding: 7px 9px; border-bottom: 1px solid #eef2f7; white-space: nowrap; max-width: 220px; overflow: hidden; text-overflow: ellipsis; }
.preview-table th { position: sticky; top: 0; z-index: 1; background: #f8fafc; text-align: center; vertical-align: top; }
.preview-table th.col-code { background: #eff6ff; }
.preview-table th.col-price { background: #fff7ed; }
.preview-table .col-head { display: flex; flex-direction: column; gap: 5px; align-items: center; min-width: 86px; }
.preview-table .col-name { font-size: 11px; font-weight: 700; color: var(--ink-soft); }
.preview-table .col-btn {
  min-height: 26px;
  padding: 0 8px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background: #fff;
  color: var(--ink-soft);
  font-size: 10.5px;
  font-weight: 600;
}
.preview-table .col-btn:hover { background: var(--surface-soft); }
.preview-table .col-btn.active-code { background: var(--brand); border-color: var(--brand); color: #fff; }
.preview-table .col-btn.active-price { background: #f59e0b; border-color: #f59e0b; color: #fff; }

/* ============================================================
   No-code maintenance table
   ============================================================ */
.modal-toolbar { display: flex; gap: 8px; flex-wrap: wrap; padding: 12px 24px; border-bottom: 1px solid var(--line); background: var(--surface-soft); }
.modal-toolbar .btn-confirm, .modal-toolbar .btn-danger { min-height: 38px; padding: 0 14px; font-size: 12.5px; }
.nocode-search-wrap {
  position: relative;
  flex: 1 1 280px;
  min-width: 220px;
  max-width: 440px;
  margin-left: auto;
}
.nocode-search-input {
  width: 100%;
  height: 40px;
  padding: 0 34px 0 12px;
  border: 1px solid var(--line-strong);
  border-radius: 9px;
  background: #fff;
  color: var(--ink-soft);
  font-size: 12.5px;
}
.nocode-search-input:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, .10);
}
.nocode-search-clear {
  position: absolute;
  top: 50%;
  right: 6px;
  transform: translateY(-50%);
  width: 28px;
  height: 28px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--muted);
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
}
.nocode-search-clear:hover { background: #eef2f7; color: var(--ink); }
@media (max-width: 700px) {
  .nocode-search-wrap { flex: 1 1 100%; max-width: none; margin-left: 0; }
}
.nocode-table { width: 100%; min-width: 820px; border-collapse: collapse; font-size: 12.5px; }
.nocode-table th, .nocode-table td { padding: 8px 9px; border-bottom: 1px solid #eef2f7; text-align: left; vertical-align: middle; }
.nocode-table td.price-missing { color: #94a3b8; }
#nocodeList { overflow-x: auto; }
.nocode-actions { display: flex; gap: 6px; justify-content: center; white-space: nowrap; }
.nocode-table th { background: #f8fafc; color: var(--muted); font-size: 10.5px; text-transform: uppercase; letter-spacing: .06em; }
.nocode-table .btn-mini {
  min-height: 30px;
  padding: 0 10px;
  border: 1px solid transparent;
  border-radius: 7px;
  font-size: 11.5px;
  font-weight: 600;
  margin: 0 2px;
}
.nocode-table .btn-mini.btn-edit { background: var(--brand-soft); color: var(--brand-dark); }
.nocode-table .btn-mini.btn-edit:hover { background: #dbeafe; }
.nocode-table .btn-mini.btn-del { background: var(--danger-soft); color: var(--danger); }
.nocode-table .btn-mini.btn-del:hover { background: #fee2e2; }

/* ============================================================
   Progress
   ============================================================ */
.progress-overlay { position: fixed; inset: 0; z-index: 460; display: flex; align-items: center; justify-content: center; background: rgba(15, 23, 42, .5); backdrop-filter: blur(3px); }
.progress-overlay.hidden { display: none; }
.progress-box { width: min(430px, 90vw); padding: 26px 28px; border-radius: 16px; background: #fff; box-shadow: var(--shadow-lg); text-align: center; }
.progress-title { margin-bottom: 14px; color: var(--ink); font-size: 15px; font-weight: 700; }
.progress-bar { height: 10px; overflow: hidden; border-radius: 999px; background: #e8edf5; }
.progress-fill { height: 100%; width: 0; border-radius: 999px; background: linear-gradient(90deg, var(--brand), var(--violet)); transition: width .2s; }
.progress-text { margin-top: 9px; color: var(--muted); font-size: 12px; }

/* ============================================================
   Toast
   ============================================================ */
.toast-stack {
  position: fixed;
  top: 18px;
  right: 22px;
  z-index: 600;
  display: flex;
  flex-direction: column;
  gap: 9px;
  pointer-events: none;
}
.toast {
  display: flex;
  align-items: center;
  gap: 9px;
  max-width: 360px;
  padding: 12px 15px;
  border-radius: 11px;
  background: #0f172a;
  color: #fff;
  font-size: 12.5px;
  font-weight: 550;
  box-shadow: 0 14px 34px rgba(15, 23, 42, .28);
  pointer-events: auto;
  animation: toastIn .22s ease-out;
}
.toast::before { content: ""; width: 7px; height: 7px; flex: 0 0 7px; border-radius: 50%; background: #4ade80; }
.toast.error { background: #7f1d1d; }
.toast.error::before { background: #fca5a5; }
.toast.hide { opacity: 0; transform: translateY(-6px); transition: opacity .2s, transform .2s; }
@keyframes toastIn { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: translateY(0); } }

/* ============================================================
   Legacy history bits (kept for compatibility)
   ============================================================ */
.history-item { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 10px 2px; border-bottom: 1px solid #eef2f7; }
.history-item .hinfo { font-size: 13px; }
.history-item .hact button { min-height: 34px; padding: 0 12px; border: 1px solid var(--line-strong); border-radius: 8px; background: #fff; font-size: 12px; }
.history-item .hact .btn-open { background: var(--brand-soft); color: var(--brand-dark); border-color: transparent; }
.history-item .hact .btn-del { background: var(--danger-soft); color: var(--danger); border-color: transparent; }

/* ============================================================
   Report capture container (PNG generation uses its own styles)
   ============================================================ */
.report-capture {
  position: absolute;
  left: 0;
  top: 0;
  width: 900px;
  padding: 24px;
  background: #fff;
  color: #222;
  font-family: var(--font);
  opacity: 0;
  pointer-events: none;
  z-index: -1;
}

/* ============================================================
   Responsive
   ============================================================ */
@media (max-width: 1200px) {
  .quick-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .approve-card-body { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .detail-meta { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 980px) {
  .app-shell { display: block; }
  .sidebar {
    position: static;
    width: 100%;
    height: auto;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    gap: 9px;
    padding: 9px 12px;
    overflow: visible;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }
  .brand { padding: 0; flex: 0 0 auto; }
  .brand-mark { width: 34px; height: 34px; flex-basis: 34px; border-radius: 10px; font-size: 16px; }
  .brand-text span { display: none; }
  .brand-text strong { font-size: 14px; }
  .nav { order: 3; flex: 1 0 100%; flex-direction: row; gap: 3px; overflow-x: auto; padding-bottom: 1px; }
  .nav-label { display: none !important; }
  .nav-item { width: auto; min-height: 38px; padding: 0 10px; white-space: nowrap; font-size: 12.5px; }
  .nav-icon { width: 17px; height: 17px; flex-basis: 17px; }
  .sidebar-footer { order: 2; margin: 0 0 0 auto; padding: 0; border: 0; display: flex; align-items: center; gap: 6px; flex: 0 0 auto; }
  .user-card { padding: 0; }
  .user-meta { display: none; }
  .avatar { width: 32px; height: 32px; flex-basis: 32px; font-size: 12px; }
  .sidebar-actions { flex-direction: row; padding: 0; }
  .link-btn { padding: 7px 8px; font-size: 11.5px; white-space: nowrap; }

  .app-header { position: static; padding: 18px 18px 16px; flex-direction: column; gap: 14px; }
  .header-actions { width: 100%; justify-content: flex-start; padding-top: 0; }
  .header-actions .btn { flex: 1 1 auto; }
  .app-content { padding: 16px 16px 34px; }
  .approve-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .statusbar { padding: 8px 16px; font-size: 11.5px; }
}

@media (max-width: 700px) {
  .page-heading h1 { font-size: 21px; }
  .page-subtitle { font-size: 12px; }
  .entry-surface { padding: 14px; }
  .entry-bar { align-items: stretch; }
  .code-field { flex-basis: 100%; }
  .price-info { margin-left: 0; padding-bottom: 0; }
  .match-status { padding-bottom: 0; }
  .quick-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .list-footer-actions { padding: 16px 0 2px; }
  .back-button { width: 100%; max-width: 360px; }
  .section-head { padding: 16px 16px 10px; flex-wrap: wrap; align-items: flex-start; }
  .section-head .btn { width: 100%; margin-top: 10px; }
  .surface { border-radius: 16px; }
  .table-surface { margin-top: 14px; }
  .approve-stats { gap: 9px; }
  .stat-card { padding: 13px 14px; }
  .stat-card .stat-value { font-size: 23px; }
  .status-tabs { position: sticky; top: 0; z-index: 30; margin-bottom: 12px; }
  .status-tab { min-height: 42px; padding: 0 14px; }
  .toolbar-card { padding: 12px; overflow: hidden; }
  .approve-filters {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 10px;
    align-items: end;
  }
  .filter-field { min-width: 0; }
  .filter-field:nth-child(3) { grid-column: 1 / -1; }
  .filter-field input, .filter-field select { width: 100%; min-width: 0; }
  .toggle-rejected { grid-column: 1 / -1; width: 100%; }
  #rejectedToggleWrap { display: none !important; }
  .approve-filters .btn-refresh { grid-column: 1 / -1; width: 100%; }
  .bulk-toolbar { align-items: stretch; }
  .bulk-actions { width: 100%; margin-left: 0; }
  .bulk-actions .btn { flex: 1; min-height: 42px; }
  .approve-select { align-self: flex-start; }
  .approve-card { padding: 15px; }
  .approve-card-header { flex-direction: column; align-items: stretch; }
  .approve-actions { width: 100%; }
  .approve-actions button { flex: 1; min-height: 44px; font-size: 13px; }
  .approve-actions .btn-open { flex: 0 0 auto; padding: 0 16px; }
  .approve-card-body { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .modal { padding: 10px; }
  .modal-box, .modal-box.wide { width: 100%; max-height: 92vh; }
  .modal-head, .modal-body, .modal-foot { padding-left: 16px; padding-right: 16px; }
  .modal-foot { padding-bottom: calc(14px + env(safe-area-inset-bottom)); }
  .detail-meta { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .detail-table { min-width: 0; table-layout: fixed; }
  .detail-table .col-no, .detail-table .col-unit, .detail-table .col-price { display: none; }
  .detail-table th, .detail-table td { padding: 8px 6px; font-size: 11.5px; }
  .detail-table .col-code { width: 60px; }
  .detail-table .col-qty { width: 34px; }
  .detail-table .col-total { width: 58px; }
  .detail-table .col-purpose { width: 26%; }
  .detail-table .col-prod { width: 58px; }
  .detail-table td.name, .detail-table td.col-purpose { white-space: normal; word-break: break-word; }
  .special-list.mode-all { grid-template-columns: minmax(0, 1fr); }
  .special-toolbar { flex-wrap: wrap; }
  .special-search { flex: 1 1 100%; }
  .qty-modal-box { width: min(320px, 88vw); }
  .toast-stack { top: 10px; right: 10px; left: 10px; }
  .toast { max-width: none; }
  .statusbar {
    flex-direction: column;
    align-items: flex-start;
    gap: 3px;
    padding-bottom: calc(8px + env(safe-area-inset-bottom));
  }
  .statusbar .status-right { display: none; }
  #loginUser, #loginCode, #codeInput, .form-select, .form-textarea,
  .special-search, .qty-custom input, #itemsTable td.purpose input,
  .filter-field input, .filter-field select { font-size: 16px; }
}

@media (max-width: 460px) {
  .brand-text { display: none; }
  .nav-item span { display: none; }
  .nav-item { min-width: 42px; justify-content: center; }
  .sidebar-actions .link-btn:not(.danger) { display: none; }
  .approve-stats { grid-template-columns: 1fr 1fr; }
  .detail-meta { grid-template-columns: 1fr; }
  .detail-table .col-code { display: none; }
  .detail-table .col-purpose { width: 32%; }
  .detail-table .col-prod { width: 52px; }
  .modal-foot { flex-direction: column; align-items: stretch; }
  .modal-foot .pager-right { justify-content: flex-end; width: 100%; }
  .modal-foot .pager-right .btn-confirm,
  .modal-foot .pager-right .btn-danger { flex: 1; }
  .header-actions .btn { flex: 1 1 46%; }
}

/* ============================================================
   Legacy shell compatibility
   The redesigned index.php no longer uses these selectors, but
   they are kept so an older cached page (old topbar/login card/
   approvals header) does not render as unstyled HTML during a
   partial deploy or an opcache/cache transition.
   ============================================================ */
.topbar {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 10px 20px;
  background: #1f3d7a;
  color: #fff;
  flex-wrap: wrap;
}
.topbar .brand { font-size: 18px; font-weight: 700; }
.topbar .meta { display: flex; gap: 14px; align-items: center; }
.topbar .meta label { font-size: 13px; display: flex; align-items: center; gap: 4px; }
.topbar .meta input[type="date"] { padding: 3px 6px; border-radius: 4px; border: none; font-size: 13px; }
.topbar .meta select { padding: 3px 6px; border-radius: 4px; border: none; font-size: 13px; }
.topbar .actions { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; }
.topbar .actions button {
  padding: 6px 12px;
  border: none;
  border-radius: 4px;
  background: #4a90e2;
  color: #fff;
  cursor: pointer;
  font-size: 13px;
}
.topbar .actions button:disabled { background: #8aa5c9; cursor: not-allowed; }
.period-label {
  background: #fff;
  color: #1f3d7a;
  padding: 3px 10px;
  border-radius: 4px;
  font-size: 13px;
  font-weight: 700;
}
.user-chip {
  background: rgba(255, 255, 255, .15);
  padding: 3px 10px;
  border-radius: 4px;
  font-size: 12px;
  color: #fff;
}
.date-text {
  display: inline-block;
  min-width: 96px;
  padding: 2px 6px;
  font: inherit;
  color: inherit;
  vertical-align: middle;
}
.btn-back {
  padding: 8px 14px;
  background: #4a90e2;
  color: #fff;
  border: none;
  border-radius: 4px;
  font-size: 13px;
  cursor: pointer;
  white-space: nowrap;
  margin-right: 8px;
}
.btn-back.hidden { display: none; }
.btn-quick-more {
  padding: 3px 10px;
  background: #4a90e2;
  color: #fff;
  border: none;
  border-radius: 4px;
  font-size: 12px;
  cursor: pointer;
}
.approve-page-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  padding: 16px 0;
  border-bottom: 1px solid #e0e4ea;
  margin-bottom: 16px;
}
.approve-page-header h2 { margin: 0; font-size: 20px; color: #1f3d7a; }
.approve-page-header .approve-filters label { font-size: 13px; color: #444; display: flex; align-items: center; gap: 4px; }
.approve-page-header .approve-filters input[type="date"],
.approve-page-header .approve-filters select {
  padding: 5px 10px;
  border: 1px solid #cfd8e3;
  border-radius: 4px;
  font-size: 13px;
  background: #fff;
}
.login-box {
  background: #fff;
  padding: 44px 40px 36px;
  border-radius: 14px;
  box-shadow: 0 24px 70px rgba(0, 0, 0, .35);
  width: 400px;
  max-width: 100%;
}
.login-logo {
  display: inline-block;
  font-size: 26px;
  font-weight: 700;
  color: #1f3d7a;
  letter-spacing: 2px;
}
.login-title {
  font-size: 14px;
  color: #888;
  letter-spacing: 4px;
  margin-top: 8px;
}
.history-item .hinfo .type-badge {
  display: inline-block;
  padding: 1px 6px;
  border-radius: 3px;
  font-size: 11px;
  margin-left: 6px;
  vertical-align: middle;
}
.history-item .hinfo .type-badge.type-draft { background: #e8eef7; color: #4a90e2; }
.history-item .hinfo .type-badge.type-final { background: #fff5d6; color: #b8860b; }
.history-item .hinfo .type-badge.type-approved { background: #eafaf1; color: #27ae60; }
.history-item .hinfo .type-badge.type-rejected { background: #fdecea; color: #e74c3c; }
