@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

/* ================================================================
   Design tokens — "Editorial Minimalist" (fashion-magazine / creative
   studio portfolio language, per the UX spec): cream + ink, thin hairline
   borders instead of shadows, one sans-serif family, tight display type,
   black-fill buttons that invert to outline on hover. Applied on top of
   the existing component structure — no functional/markup changes here.
   ================================================================ */
:root {
  /* ---- Color System ---- */
  --color-ink: #111111;             /* near-black — headings, primary text, CTA fill */
  --color-secondary-text: #5E5A54;  /* muted warm gray — secondary text, meta */
  --color-background: #F6F3EC;      /* cream page background */
  --color-surface: #FFFFFF;         /* card/input surface, sits slightly lighter than bg */
  --color-surface-muted: #EFEBE1;   /* muted cream — table headers, subtle fills */
  --color-border: #B9B5AC;          /* thin hairline border, used everywhere instead of shadow */
  --color-border-strong: #8C877D;
  --color-text-primary: var(--color-ink);
  --color-text-secondary: var(--color-secondary-text);
  --color-text-muted: #9A958D;
  --color-accent: #8B5A3C;          /* muted terracotta — the one warm accent, used sparingly */
  --color-success: #5B6B45;
  --color-error: #A5432F;
  --color-warning: #A67C2E;

  /* legacy aliases kept so existing markup/JS class names keep working */
  --primary: var(--color-ink);
  --primary-dark: var(--color-ink);
  --soft-blue: #4B5A6B;
  --dusty-pink: var(--color-accent);
  --dusty-pink-dark: #6E3B24;
  --light-gray: var(--color-background);
  --card: var(--color-surface);
  --border: var(--color-border);
  --text: var(--color-text-primary);
  --muted: var(--color-text-secondary);

  /* Status semantics — muted earth tones, never bright/decorative */
  --available: #5B6B45;             /* olive green */
  --borrowed: #4B5A6B;               /* slate blue */
  --review: #8B5D6B;                 /* mauve */
  --out-of-stock-test: #A5432F;      /* brick red — Gửi KH Test Chất Lượng */
  --out-of-stock-gift: #A67C2E;      /* ochre — Tặng KH Trải Nghiệm */
  --pending-return: #7A756D;         /* warm gray */
  --pending-borrow: #B4633E;         /* terracotta — chờ duyệt mượn */
  --pending-transfer: #6E5B94;        /* muted plum — chờ duyệt chuyển Team */

  /* ---- Spacing (8pt grid) ---- */
  --space-1: 4px;  --space-2: 8px;  --space-3: 12px; --space-4: 16px;
  --space-6: 24px; --space-8: 32px; --space-12: 48px; --space-16: 64px;
  --space-20: 80px; --space-24: 96px;

  /* ---- Radius — minimal, never pill-shaped ---- */
  --radius-sm: 2px;
  --radius-md: 3px;
  --radius-lg: 4px;
  --radius-card: 4px;
  --radius-xl: 6px;
  --radius-2xl: 8px;
  --radius-pill: 3px; /* repurposed: editorial buttons/tags are rectangular, not pill */

  /* ---- Shadow — none anywhere; hairline borders do the separating work ---- */
  --shadow-soft: none;
  --shadow-medium: none;
  --shadow-hover: none;
  --shadow-inner: none;
  --shadow-strong: none;

  /* ---- Glass — removed; kept as aliases so nothing breaks ---- */
  --glass-bg: var(--color-surface);
  --glass-bg-strong: var(--color-surface);
  --glass-border: 1px solid var(--color-border);
  --glass-shadow: none;

  --container-width: 1240px;
  --motion-fast: 160ms;
  --motion-base: 320ms;
  --motion-slow: 600ms;
  --ease-out-soft: cubic-bezier(.22, 1, .36, 1);

  font-family: 'Inter', 'Helvetica Neue', Arial, sans-serif;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; scroll-behavior: auto !important; }
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--color-background); color: var(--color-text-primary); line-height: 1.6; -webkit-font-smoothing: antialiased; }
a { color: inherit; }
button { font-family: inherit; cursor: pointer; }
h1, h2, h3, .heading-font { font-family: 'Inter', sans-serif; color: var(--color-ink); font-weight: 500; line-height: 1.1; letter-spacing: -.02em; }
p { line-height: 1.65; }

:focus-visible {
  outline: 2px solid var(--color-ink);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

/* Section-reveal animation — plays once whenever the router swaps #app's content */
@keyframes pageReveal { from { opacity: 0; transform: translateY(24px); } to { opacity: 1; transform: translateY(0); } }
#app.page-enter { animation: pageReveal var(--motion-slow) var(--ease-out-soft); }

/* ---------- Top bar — flat, hairline border, no blur/shadow ---------- */
header.topbar {
  display: flex; align-items: center; justify-content: space-between;
  background: var(--color-background); border-bottom: 1px solid var(--color-border); box-shadow: none;
  color: var(--color-text-primary); padding: 22px clamp(20px, 5vw, 40px);
  position: sticky; top: 0; z-index: 50;
  transition: background var(--motion-base) var(--ease-out-soft);
}
header.topbar.scrolled { background: var(--color-surface); }
header.topbar .brand { display:flex; align-items:center; gap:10px; font-weight: 600; font-size: 15px; cursor: pointer; font-family: 'Inter', sans-serif; color: var(--color-ink); text-transform: uppercase; letter-spacing: .06em; }
header.topbar .brand .dot { width:9px; height:9px; border-radius: 2px; background: var(--color-ink); }
header.topbar nav { display: flex; align-items: center; gap: 4px; font-size: 12px; font-family: 'Inter', sans-serif; flex-wrap: wrap; }
header.topbar nav .navlink { padding: 8px 2px; margin: 0 12px; border-radius: 0; border-bottom: 2px solid transparent; font-weight: 600; text-transform: uppercase; letter-spacing: .07em; color: var(--color-text-primary); cursor: pointer; transition: border-color var(--motion-fast) ease, color var(--motion-fast) ease; }
header.topbar nav .navlink:hover { border-bottom-color: var(--color-border); }
header.topbar nav .navlink.active { border-bottom-color: var(--color-ink); }
header.topbar .user-chip { background: transparent; border: 1px solid var(--color-border); color: var(--color-ink); padding: 7px 14px; border-radius: var(--radius-sm); font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; }
header.topbar .hamburger-btn { display: none; }

/* ---------- Mobile hamburger nav — full-screen cream panel, no shadow/blur ---------- */
.mobile-nav-overlay {
  position: fixed; inset: 0; z-index: 150; background: var(--color-background);
  display: flex; flex-direction: column; padding: 20px clamp(20px, 6vw, 40px);
  transform: translateX(100%); transition: transform var(--motion-base) var(--ease-out-soft);
}
.mobile-nav-overlay.open { transform: translateX(0); }
.mobile-nav-overlay .mobile-nav-close { align-self: flex-end; background: none; border: none; font-size: 30px; line-height: 1; color: var(--color-ink); padding: 4px 8px; }
.mobile-nav-overlay nav { display: flex; flex-direction: column; margin-top: var(--space-8); }
.mobile-nav-overlay .navlink { display: block; padding: 18px 4px; border-bottom: 1px solid var(--color-border); font-size: 16px; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; color: var(--color-ink); cursor: pointer; }
.mobile-nav-overlay .navlink:last-of-type { border-bottom: none; }
.mobile-nav-overlay .user-chip { display: inline-block; align-self: flex-start; margin: var(--space-4) 0 0; border: 1px solid var(--color-border); padding: 8px 14px; border-radius: var(--radius-sm); font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; color: var(--color-ink); }

/* ---------- Buttons — black-fill, invert-to-outline on hover ---------- */
.btn {
  border: 1px solid var(--color-ink); border-radius: var(--radius-sm); padding: 13px 26px; font-size: 12.5px;
  height: 46px; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font-weight: 600; font-family: 'Inter', sans-serif; letter-spacing: .06em; text-transform: uppercase;
  transition: background var(--motion-fast) ease, color var(--motion-fast) ease, border-color var(--motion-fast) ease;
}
.btn:hover:not(:disabled) { box-shadow: none; }
.btn:active:not(:disabled) { transform: scale(.98); }
.btn-primary { background: var(--color-ink); color: #fff; }
.btn-primary:hover:not(:disabled) { background: transparent; color: var(--color-ink); }
.btn-accent { background: transparent; border-color: var(--color-accent); color: var(--color-accent); }
.btn-accent:hover:not(:disabled) { background: var(--color-accent); color: #fff; }
.btn-outline { background: transparent; border: 1px solid var(--color-border); color: var(--color-text-primary); }
.btn-outline:hover:not(:disabled) { background: var(--color-ink); border-color: var(--color-ink); color: #fff; box-shadow: none; }
.btn-danger { background: transparent; border-color: var(--color-error); color: var(--color-error); }
.btn-danger:hover:not(:disabled) { background: var(--color-error); color: #fff; }
.btn-text { background: none; border: none; color: var(--color-ink); padding: 6px 4px; font-weight: 600; height: auto; text-transform: none; letter-spacing: normal; font-size: 14px; }
.btn-text:hover:not(:disabled) { color: var(--color-text-secondary); box-shadow: none; }
.btn-text .arrow { display: inline-block; transition: transform var(--motion-fast) ease; }
.btn-text:hover:not(:disabled) .arrow { transform: translateX(4px); }
.btn:disabled { background: transparent !important; border-color: var(--color-border) !important; color: var(--color-text-muted) !important; cursor: not-allowed; box-shadow: none; }
.btn-sm { padding: 7px 16px; height: 34px; font-size: 11px; }

/* Loading state: spinner replaces leading content via ::before, label dims */
.btn.is-loading { pointer-events: none; color: transparent !important; position: relative; }
.btn.is-loading::after {
  content: ''; position: absolute; inset: 0; margin: auto; width: 16px; height: 16px;
  border-radius: 50%; border: 2px solid rgba(255,255,255,.4); border-top-color: #fff;
  animation: btnSpin .7s linear infinite;
}
.btn-outline.is-loading::after, .btn-accent.is-loading::after, .btn-danger.is-loading::after { border: 2px solid rgba(17,17,17,.25); border-top-color: var(--color-ink); }
@keyframes btnSpin { to { transform: rotate(360deg); } }

main { max-width: var(--container-width); margin: 0 auto; padding: var(--space-8) clamp(16px, 4vw, 40px); }
.crumbs { font-size: 12px; color: var(--color-text-secondary); margin-bottom: var(--space-4); text-transform: uppercase; letter-spacing: .04em; }
.crumbs span { cursor: pointer; }
.crumbs span:hover { text-decoration: underline; color: var(--color-ink); }

.season-header { display:flex; align-items:baseline; justify-content:space-between; margin-bottom: var(--space-6); flex-wrap: wrap; gap: var(--space-2); }
.season-header h1, .season-header h2 { font-size: 36px; margin: 0; font-weight: 500; letter-spacing: -.02em; line-height: 1.05; }
.season-header .stat { color: var(--color-text-secondary); font-size: 13px; font-weight: 500; text-transform: uppercase; letter-spacing: .04em; }

/* ---------- Homepage banner — large full-width image + overlay text, Admin-editable
   (settings-table JSON via server/homeSettings.js), rendered before the Season/BST list. ---------- */
.home-banner { position: relative; margin: var(--space-6) 0 var(--space-16); border-radius: var(--radius-lg); overflow: hidden; border: 1px solid var(--color-border); }
.home-banner-image { width: 100%; height: 460px; background-size: cover; background-position: center; background-color: var(--color-surface-muted); }
.home-banner-overlay {
  position: absolute; inset: 0; display: flex; flex-direction: column; justify-content: flex-end;
  padding: var(--space-8); background: linear-gradient(180deg, rgba(17,17,17,0) 40%, rgba(17,17,17,.74) 100%);
}
.home-banner-kicker { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .14em; color: #F6F3EC; margin-bottom: var(--space-3); }
.home-banner-title { font-size: clamp(26px, 4vw, 46px); font-weight: 500; line-height: 1.1; letter-spacing: -.02em; color: #FFFFFF; max-width: 760px; margin: 0 0 var(--space-3); }
.home-banner-subtitle { font-size: 15px; color: rgba(255,255,255,.86); max-width: 600px; margin: 0 0 var(--space-4); line-height: 1.5; }
.home-banner-cta { align-self: flex-start; background: #FFFFFF; color: var(--color-ink); border-color: #FFFFFF; }
.home-banner-cta:hover { background: transparent; color: #FFFFFF; border-color: #FFFFFF; }

/* ---------- Homepage BST list — compact 2-up card grid on desktop:
   each BST is a smaller vertical card (image on top, info below), 2 columns side by side
   on desktop/tablet, 1 column on mobile. Hover zooms the image + inverts the view button. ---------- */
.season-block { margin-bottom: var(--space-16); }
.project-list { display: grid; grid-template-columns: repeat(2, 1fr); gap: var(--space-6) var(--space-6); }
.project-row { display: flex; flex-direction: column; gap: var(--space-3); border: 1px solid var(--color-border); border-radius: var(--radius-lg); padding: var(--space-4); cursor: pointer; transition: border-color var(--motion-fast) ease; }
.project-row:hover { border-color: var(--color-ink); }
.project-row .project-info { display: flex; flex-direction: column; gap: var(--space-2); }
.project-name { font-size: 16px; font-weight: 600; text-transform: uppercase; letter-spacing: .01em; color: var(--color-ink); line-height: 1.25; }
.project-meta { font-size: 11px; color: var(--color-text-secondary); text-transform: uppercase; letter-spacing: .04em; }
.project-view-btn { align-self: flex-start; pointer-events: none; }
.project-row:hover .project-view-btn { background: var(--color-ink); border-color: var(--color-ink); color: #fff; }
.project-row .project-image-wrap { overflow: hidden; border-radius: var(--radius-md); aspect-ratio: 16 / 9; background: var(--color-surface-muted); }
.project-image-wrap img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform var(--motion-slow) var(--ease-out-soft); }
.project-row:hover .project-image-wrap img { transform: scale(1.04); }

/* ---------- Scroll-triggered fade-up reveal (spec §16) ---------- */
.reveal-up { opacity: 0; transform: translateY(24px); transition: opacity 700ms cubic-bezier(.22,1,.36,1), transform 700ms cubic-bezier(.22,1,.36,1); }
.reveal-up.is-visible { opacity: 1; transform: translateY(0); }

/* ---------- BST cards ---------- */
.grid-bst { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px,1fr)); gap: var(--space-6); }
.bst-card { background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius-card); overflow: hidden; transition: border-color var(--motion-base) var(--ease-out-soft); box-shadow: none; cursor: pointer; }
.bst-card:hover { border-color: var(--color-ink); }
.bst-card img { width: 100%; height: 140px; object-fit: cover; display:block; transition: transform var(--motion-slow) var(--ease-out-soft); }
.bst-card:hover img { transform: scale(1.025); }
.bst-card .body { padding: var(--space-4); }
.bst-card .name { font-weight: 600; font-size: 14px; margin-bottom: var(--space-2); font-family: 'Inter', sans-serif; color: var(--color-ink); text-transform: uppercase; letter-spacing: .03em; }
.avail-pill { display:inline-block; font-size: 11px; padding: 3px 10px; border-radius: var(--radius-sm); background: var(--color-surface-muted); color: var(--available); font-weight: 700; text-transform: uppercase; letter-spacing: .03em; }
.avail-pill.low { background: var(--color-surface-muted); color: var(--out-of-stock-test); }

.toolbar { display: flex; gap: var(--space-3); align-items: center; margin-bottom: var(--space-4); flex-wrap: wrap; }
.toolbar .spacer { flex: 1; }
.search-box { padding: 11px 16px 11px 38px; border: 1px solid var(--color-border); border-radius: var(--radius-sm); font-size: 13.5px; min-width: 220px; font-family: inherit; background: var(--color-surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%235E5A54' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cline x1='21' y1='21' x2='16.65' y2='16.65'/%3E%3C/svg%3E") no-repeat 13px center; transition: border-color var(--motion-fast) ease; }
.search-box:focus { outline: none; border-color: var(--color-ink); box-shadow: none; }

/* ---------- Product list (hairline-divided rows, no card shadow) ---------- */
.product-list { display: flex; flex-direction: column; gap: 0; border-top: 1px solid var(--color-border); }
.product-row {
  background: transparent; border: none; border-bottom: 1px solid var(--color-border); border-radius: 0;
  padding: var(--space-4) var(--space-2); display: flex; align-items: center; gap: var(--space-4); box-shadow: none;
  transition: background var(--motion-base) ease;
}
.product-row:hover { background: rgba(17,17,17,.03); }
.product-row .chk { flex: 0 0 auto; }
.product-row .chk input[type="checkbox"] { width: 20px; height: 20px; accent-color: var(--color-ink); }
.product-row .main-info { flex: 1; min-width: 0; }
.product-row .code { font-weight: 600; font-family: 'Inter', sans-serif; font-size: 14.5px; color: var(--color-ink); }
.product-row .meta { font-size: 12.5px; color: var(--color-text-secondary); margin-top: 2px; }
.product-row .side-info { text-align: right; flex: 0 0 auto; font-size: 12.5px; color: var(--color-text-secondary); min-width: 150px; }
.product-row .pitch-list { font-size: 12px; color: var(--color-text-secondary); margin-top: 4px; }

table.product-table { width: 100%; border-collapse: collapse; background: var(--color-surface); border-radius: var(--radius-lg); overflow: hidden; box-shadow: none; border: 1px solid var(--color-border); }
table.product-table th, table.product-table td { padding: 13px 15px; font-size: 13px; border-bottom: 1px solid var(--color-border); text-align: left; }
table.product-table th { background: var(--color-surface-muted); font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--color-text-secondary); font-family: 'Inter', sans-serif; font-weight: 700; }
table.product-table tr:last-child td { border-bottom: none; }
table.product-table tr { transition: background var(--motion-fast) ease; }
table.product-table tbody tr:hover { background: var(--color-surface-muted); }

.status-badge { padding: 4px 11px; border-radius: var(--radius-sm); font-size: 11px; font-weight: 700; font-family: 'Inter', sans-serif; white-space: nowrap; text-transform: uppercase; letter-spacing: .03em; border: 1px solid transparent; }
.status-available { background: var(--color-surface-muted); color: var(--available); border-color: rgba(91,107,69,.3); }
.status-borrowed { background: var(--color-surface-muted); color: var(--borrowed); border-color: rgba(75,90,107,.3); }
.status-review { background: var(--color-surface-muted); color: var(--review); border-color: rgba(139,93,107,.3); }
.status-out_of_stock_test { background: var(--color-surface-muted); color: var(--out-of-stock-test); border-color: rgba(165,67,47,.3); }
.status-out_of_stock_gift { background: var(--color-surface-muted); color: var(--out-of-stock-gift); border-color: rgba(166,124,46,.3); }
.status-pending_return { background: var(--color-surface-muted); color: var(--pending-return); border-color: var(--color-border); }
.status-pending_borrow { background: var(--color-surface-muted); color: var(--pending-borrow); border-color: rgba(180,99,62,.3); }
.status-pending_transfer { background: var(--color-surface-muted); color: var(--pending-transfer); border-color: rgba(110,91,148,.3); }
.recall-days { font-size: 11px; font-weight: 700; margin-left: 6px; }
.recall-days.overdue { color: var(--color-error); }
.recall-days.ok { color: var(--review); }

/* ---------- Thêm Hành Động menu ---------- */
.action-menu { display:flex; flex-direction: column; gap: var(--space-2); }
.action-menu-btn {
  display:flex; align-items:center; justify-content: space-between; gap: 10px;
  width: 100%; text-align: left; padding: 14px 16px; border-radius: var(--radius-md);
  border: 1px solid var(--color-border); background: var(--color-surface); font-size: 14px; font-family: 'Inter', sans-serif; font-weight: 600;
  transition: border-color var(--motion-fast) ease, background var(--motion-fast) ease;
}
.action-menu-btn:hover:not(:disabled) { border-color: var(--color-ink); background: var(--color-surface-muted); }
.action-menu-btn:disabled { opacity: .45; cursor: not-allowed; }
.action-menu-btn .desc { display:block; font-size: 12px; color: var(--color-text-secondary); font-weight: 400; margin-top: 3px; font-family: 'Inter', sans-serif; text-transform: none; letter-spacing: normal; }
.action-menu-btn .dot { display: inline-block; width: 9px; height: 9px; margin-right: 8px; border-radius: 2px; flex: 0 0 auto; vertical-align: middle; }
.dot-review { background: var(--review); }
.dot-test { background: var(--out-of-stock-test); }
.dot-gift { background: var(--out-of-stock-gift); }
.dot-return { background: var(--pending-return); }

.reason-hint { font-size: 12px; color: var(--color-text-secondary); margin-top: -8px; margin-bottom: var(--space-3); }

/* ---------- Reports / approval queue ---------- */
.report-table-wrap { overflow-x: auto; }
.pill-count { display:inline-block; min-width: 22px; text-align:center; padding: 2px 9px; border-radius: var(--radius-sm); font-size: 12px; font-weight: 700; background: var(--color-surface-muted); color: var(--color-ink); border: 1px solid var(--color-border); }
.nav-badge { background: var(--color-ink); color: #fff; border-radius: var(--radius-sm); font-size: 10px; font-weight: 700; padding: 1px 7px; margin-left: 6px; }

/* ---------- Modals (flat surface, hairline border, no glass/shadow) ---------- */
.modal-overlay { position: fixed; inset: 0; background: rgba(17,17,17,.45); display: flex; align-items: center; justify-content: center; z-index: 100; padding: 20px; animation: fadeIn var(--motion-base) ease; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.modal {
  background: var(--color-background); border: 1px solid var(--color-border); border-radius: var(--radius-xl); padding: var(--space-8);
  width: 100%; max-width: 480px; max-height: 88vh; overflow-y: auto; box-shadow: none;
  animation: modalIn var(--motion-base) var(--ease-out-soft);
}
@keyframes modalIn { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: translateY(0); } }
.modal.wide { max-width: 760px; }
.modal h2 { margin-top: 0; font-size: 19px; font-family: 'Inter', sans-serif; }
.form-row { margin-bottom: var(--space-4); position: relative; }
.form-row label { display:block; font-size: 11px; margin-bottom: 6px; color: var(--color-text-secondary); font-weight: 700; font-family: 'Inter', sans-serif; text-transform: uppercase; letter-spacing: .05em; }
.form-row input, .form-row select, .form-row textarea {
  width: 100%; padding: 12px 14px; border: 1px solid var(--color-border); border-radius: var(--radius-md);
  font-size: 14.5px; font-family: inherit; background: var(--color-surface); color: var(--color-text-primary);
  transition: border-color var(--motion-fast) ease;
}
.form-row input:focus, .form-row select:focus, .form-row textarea:focus { outline: none; border-color: var(--color-ink); box-shadow: none; }
.form-row input:disabled, .form-row select:disabled, .form-row textarea:disabled { background: var(--color-surface-muted); color: var(--color-text-muted); cursor: not-allowed; }
.form-row.has-error input, .form-row.has-error select, .form-row.has-error textarea { border-color: var(--color-error); }
.form-row.has-success input, .form-row.has-success select, .form-row.has-success textarea { border-color: var(--color-success); }
.modal-actions { display:flex; gap: var(--space-3); justify-content: flex-end; margin-top: var(--space-6); }
.error-msg { color: var(--color-error); font-size: 13px; margin: 8px 0; }
.hint { color: var(--color-text-secondary); font-size: 12px; }

.tabs { display:flex; gap: 4px; margin-bottom: var(--space-4); border-bottom: 1px solid var(--color-border); }
.tab { padding: 10px 18px; font-size: 12.5px; border-bottom: 2px solid transparent; cursor:pointer; color: var(--color-text-secondary); font-family: 'Inter', sans-serif; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; transition: color var(--motion-fast) ease, border-color var(--motion-fast) ease; }
.tab.active { border-color: var(--color-ink); color: var(--color-ink); }

.dropzone { border: 1px dashed var(--color-border); border-radius: var(--radius-lg); padding: var(--space-8); text-align:center; color: var(--color-text-secondary); cursor:pointer; transition: border-color var(--motion-fast) ease, background var(--motion-fast) ease; }
.dropzone:hover { border-color: var(--color-ink); background: var(--color-surface-muted); }
.scan-item { display:flex; gap: var(--space-3); border: 1px solid var(--color-border); border-radius: var(--radius-md); padding: var(--space-3); margin-bottom: var(--space-2); align-items: flex-start; background: var(--color-surface); }
.scan-item img { width: 70px; height: 70px; object-fit: cover; border-radius: var(--radius-sm); }
.scan-item .info { flex: 1; font-size: 13px; }
.scan-item .info input { margin-top: 4px; }

.card-block { background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius-card); padding: var(--space-6); margin-bottom: var(--space-6); box-shadow: none; }
.card-block h3 { margin-top:0; font-size: 15px; font-family: 'Inter', sans-serif; text-transform: uppercase; letter-spacing: .03em; }
.stat-row { display:flex; gap: var(--space-4); flex-wrap: wrap; }
.stat-tile { flex: 1; min-width: 140px; background: var(--color-surface-muted); border-radius: var(--radius-lg); padding: var(--space-4); }
.stat-tile .num { font-size: 28px; font-weight: 600; color: var(--color-ink); font-family: 'Inter', sans-serif; letter-spacing: -.01em; }
.stat-tile .label { font-size: 11px; color: var(--color-text-secondary); font-weight: 500; text-transform: uppercase; letter-spacing: .04em; }

/* ---- Guide page ("Hướng dẫn sử dụng") ---- */
.guide-steps { list-style: none; margin: 0; padding: 0; counter-reset: guide-step; }
.guide-step { counter-increment: guide-step; display: flex; gap: var(--space-4); align-items: flex-start; padding: var(--space-3) 0; border-bottom: 1px solid var(--color-border); }
.guide-step:last-child { border-bottom: none; }
.guide-step::before { content: counter(guide-step); flex: none; width: 26px; height: 26px; border-radius: 50%; border: 1px solid var(--color-ink); display:flex; align-items:center; justify-content:center; font-size: 12px; font-weight: 700; font-family: 'Inter', sans-serif; }
.guide-step .body { flex: 1; font-size: 13.5px; line-height: 1.55; }
.guide-step .body b { font-weight: 600; }
.guide-actions-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: var(--space-4); }
.guide-action-card { border: 1px solid var(--color-border); border-radius: var(--radius-card); padding: var(--space-4); background: var(--color-surface); }
.guide-action-card .name { font-size: 12.5px; font-weight: 700; font-family: 'Inter', sans-serif; text-transform: uppercase; letter-spacing: .03em; margin-bottom: 6px; }
.guide-action-card .desc { font-size: 12.5px; color: var(--color-text-secondary); line-height: 1.5; }

.subnav { display:flex; gap: var(--space-2); margin-bottom: var(--space-6); flex-wrap: wrap; }
.subnav .navlink { padding: 9px 18px; border-radius: var(--radius-sm); background: transparent; border: 1px solid var(--color-border); font-size: 12px; cursor:pointer; font-family: 'Inter', sans-serif; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; color: var(--color-text-primary); transition: background var(--motion-fast) ease, color var(--motion-fast) ease, border-color var(--motion-fast) ease; }
.subnav .navlink:hover { border-color: var(--color-ink); }
.subnav .navlink.active { background: var(--color-ink); color:#fff; border-color: var(--color-ink); }

.checkbox-cell { width: 30px; }
.empty-state { text-align:center; padding: var(--space-12) var(--space-6); color: var(--color-text-secondary); }
.toast { position: fixed; bottom: 24px; right: 24px; background: var(--color-ink); color:#fff; padding: 14px 22px; border-radius: var(--radius-lg); font-size: 14px; z-index: 200; box-shadow: none; font-family: 'Inter', sans-serif; animation: toastIn var(--motion-base) var(--ease-out-soft); }
@keyframes toastIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
.toast.error { background: var(--color-error); }
select.inline-action { font-size: 12px; padding: 5px 8px; border-radius: var(--radius-sm); border: 1px solid var(--color-border); }

.action-list-btn { display: block; width: 100%; text-align: left; padding: 12px 14px; border-radius: var(--radius-md); border: 1px solid var(--color-border); background: var(--color-surface); font-size: 14px; margin-bottom: var(--space-2); font-family: 'Inter', sans-serif; font-weight: 600; transition: border-color var(--motion-fast) ease, background var(--motion-fast) ease; }
.action-list-btn:hover { border-color: var(--color-ink); background: var(--color-surface-muted); }
.action-list-btn .desc { display: block; font-size: 12px; color: var(--color-text-secondary); font-weight: 400; margin-top: 2px; font-family: 'Inter', sans-serif; text-transform: none; letter-spacing: normal; }

.badge-tag { display: inline-block; padding: 3px 10px; border-radius: var(--radius-sm); font-size: 10.5px; font-weight: 700; background: var(--color-surface-muted); color: var(--color-ink); text-transform: uppercase; letter-spacing: .03em; }

/* ---------- Layer / Tier tags: business-mandated colors, kept unchanged
   under the neutral palette — Hero = xanh lá, Mass = đỏ, Future = xanh dương ---------- */
.layer-tag { display: inline-block; padding: 3px 11px; border-radius: var(--radius-sm); font-size: 10.5px; font-weight: 700; font-family: 'Inter', sans-serif; white-space: nowrap; background: var(--color-surface-muted); color: var(--color-text-secondary); text-transform: uppercase; letter-spacing: .03em; }
.layer-tag.layer-hero { background: rgba(27,122,75,.12); color: #1B7A4B; }
.layer-tag.layer-mass { background: rgba(192,57,43,.12); color: #C0392B; }
.layer-tag.layer-future { background: rgba(29,95,209,.12); color: #1D5FD1; }

/* ---------- Qty (tồn kho khả dụng) inline editor — Admin only ---------- */
.qty-editor { display: inline-flex; align-items: center; gap: 6px; margin-top: 6px; }
.qty-editor label { font-size: 11px; color: var(--color-text-secondary); font-weight: 600; }
.qty-editor input[type="number"] { width: 56px; padding: 5px 8px; border: 1px solid var(--color-border); border-radius: var(--radius-sm); font-size: 12.5px; text-align: center; }
.qty-editor input[type="number"]:focus { outline: none; border-color: var(--color-ink); box-shadow: none; }

/* ---------- Ma Trận Vải (Faslink fabric matrix) ----------
   Layout mirrors the original "Ma Trận Lớp Mặc" tool: stat header, Hero/Mass/Future legend,
   a 3-column grid (Nhóm sản phẩm | Mùa ÊM | Faslink Core Product), grouped by Layer, so the
   product-tier structure stays visually intact instead of collapsing into a flat list. */
.matrix-stats { display: flex; gap: var(--space-3); flex-wrap: wrap; margin-bottom: var(--space-4); }
.matrix-stat { flex: 1; min-width: 140px; background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius-lg); padding: var(--space-3) var(--space-4); box-shadow: none; }
.matrix-stat .num { font-family: 'Inter', sans-serif; font-size: 26px; font-weight: 600; line-height: 1.1; letter-spacing: -.01em; }
.matrix-stat .label { font-size: 11px; color: var(--color-text-secondary); font-weight: 600; letter-spacing: .04em; text-transform: uppercase; margin-top: 4px; }
.matrix-stat.covered .num { color: var(--available); }
.matrix-stat.gap .num { color: var(--color-text-muted); }
.matrix-stat.total .num { color: var(--color-ink); }

.matrix-legend { display: flex; gap: var(--space-4); align-items: center; flex-wrap: wrap; padding: var(--space-2) 0 var(--space-4); font-size: 12px; color: var(--color-text-secondary); }
.matrix-legend .tier-chip { font-family: 'Inter', sans-serif; font-size: 10px; font-weight: 700; letter-spacing: .05em; padding: 3px 9px; border-radius: var(--radius-sm); color: #fff; text-transform: uppercase; }
.matrix-legend .tier-chip.hero { background: #1B7A4B; }
.matrix-legend .tier-chip.mass { background: #C0392B; }
.matrix-legend .tier-chip.future { background: #1D5FD1; }

.matrix-scroll { overflow-x: auto; border-radius: var(--radius-lg); box-shadow: none; }
.matrix-grid { min-width: 1080px; background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius-lg); overflow: hidden; }

.matrix-colheader { display: flex; background: var(--color-ink); color: #fff; position: sticky; top: 0; z-index: 2; }
.matrix-colheader > div { padding: 12px 16px; font-family: 'Inter', sans-serif; font-size: 11px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; }
.matrix-colheader .col-group { width: 240px; flex: none; background: rgba(255,255,255,.06); }
.matrix-colheader .col-em { flex: 1; background: rgba(255,255,255,.03); }
.matrix-colheader .col-run { flex: 1; background: rgba(255,255,255,.1); }

.matrix-layer-bar { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); padding: 9px 16px; background: var(--color-surface-muted); border-top: 1px solid var(--color-border); border-bottom: 1px solid var(--color-border); }
.matrix-layer-bar .layer-title { font-family: 'Inter', sans-serif; font-weight: 700; font-size: 12.5px; color: var(--color-ink); text-transform: uppercase; letter-spacing: .03em; }
.matrix-layer-bar .layer-note { font-size: 12px; color: var(--color-text-muted); margin-left: 8px; }
.matrix-layer-bar .layer-badges { display: flex; gap: 6px; flex: none; }
.matrix-layer-bar .layer-badges span { font-family: 'Inter', sans-serif; font-size: 10px; font-weight: 700; padding: 3px 8px; border-radius: var(--radius-sm); background: var(--color-surface); color: var(--color-text-secondary); border: 1px solid var(--color-border); }
.matrix-layer-bar .layer-badges .b-em { color: var(--available); }
.matrix-layer-bar .layer-badges .b-run { color: var(--borrowed); }

.matrix-group-row { display: flex; border-top: 1px solid var(--color-border); }
.matrix-group-row.is-gap { background: rgba(17,17,17,.015); }
.matrix-group-info { width: 240px; flex: none; padding: 12px 14px; display: flex; flex-direction: column; gap: 5px; border-right: 1px solid var(--color-border); border-left: 3px solid var(--color-ink); }
.matrix-group-row.is-gap .matrix-group-info { border-left-color: var(--color-border); }
.matrix-group-info .g-name { font-family: 'Inter', sans-serif; font-weight: 700; font-size: 13px; color: var(--color-text-primary); }
.matrix-group-info .g-desc { font-size: 11px; color: var(--color-text-muted); }
.matrix-group-info .g-status { align-self: flex-start; font-size: 10px; font-weight: 700; padding: 3px 8px; border-radius: var(--radius-sm); margin-top: 2px; text-transform: uppercase; letter-spacing: .03em; }
.matrix-group-info .g-status.yes { background: var(--color-surface-muted); color: var(--available); }
.matrix-group-info .g-status.no { background: var(--color-surface-muted); color: var(--color-text-muted); }

.matrix-col-em, .matrix-col-run { flex: 1; padding: 10px; display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); align-content: start; gap: 8px; border-right: 1px solid var(--color-border); }
.matrix-col-run { border-right: none; }
.matrix-col-em { background: rgba(91,107,69,.03); }
.matrix-col-run { background: rgba(75,90,107,.03); }
.matrix-empty-cell { font-size: 12px; color: var(--color-text-muted); padding: 4px 2px; }

.matrix-card { border: 1px solid var(--color-border); border-left: 3px solid var(--color-ink); border-radius: var(--radius-sm); background: var(--color-surface); padding: 8px 10px; display: flex; flex-direction: column; gap: 4px; box-shadow: none; transition: border-color var(--motion-base) ease; }
.matrix-card:hover { border-color: var(--color-ink); }
.matrix-card.is-run { border-left-color: var(--borrowed); }
.matrix-card .season-tag { align-self: flex-start; font-family: 'Inter', sans-serif; font-size: 9px; font-weight: 700; letter-spacing: .04em; padding: 2px 7px; border-radius: var(--radius-sm); background: var(--color-surface-muted); color: var(--available); text-transform: uppercase; }
.matrix-card.is-run .season-tag { color: var(--borrowed); }
.matrix-card .card-top { display: flex; align-items: center; gap: 6px; }
.matrix-card .tier-chip { font-family: 'Inter', sans-serif; font-size: 9px; font-weight: 700; letter-spacing: .05em; padding: 2px 6px; border-radius: var(--radius-sm); color: #fff; flex: none; text-transform: uppercase; }
.matrix-card .card-name { font-weight: 600; font-size: 12.5px; color: var(--color-text-primary); }
.matrix-card .card-line { align-self: flex-start; font-size: 10px; font-weight: 600; padding: 2px 6px; border-radius: var(--radius-sm); background: var(--color-surface-muted); color: var(--color-text-secondary); }
.matrix-card .card-spec { font-size: 10.5px; color: var(--color-text-muted); }
.matrix-card .card-bottom { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.matrix-card .card-code { font-family: 'Inter', sans-serif; font-size: 10px; font-weight: 700; color: var(--color-text-primary); background: var(--color-surface-muted); padding: 1px 6px; border-radius: var(--radius-sm); white-space: nowrap; }
.matrix-card .card-price { font-size: 10.5px; color: var(--color-text-muted); white-space: nowrap; }
.matrix-card .card-links { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 2px; }
.matrix-card .card-links a, .matrix-card .card-links button { font-size: 10.5px; }

.matrix-footer-note { font-size: 11px; color: var(--color-text-muted); padding: var(--space-3) 0; line-height: 1.5; }

/* ---------- Quote / emphasis text — italic Inter, no separate serif family ---------- */
.quote-emphasis { font-family: 'Inter', sans-serif; font-style: italic; color: var(--color-ink); font-weight: 400; }

/* ================================================================
   Responsive — mobile-first adjustments (spec §9/§17). This app is also
   used from a phone camera for QR/tag scanning, so mobile ergonomics
   matter in practice, not just on paper.
   Breakpoints: tablet 768–1024px, mobile <768px.
   ================================================================ */
@media (max-width: 1024px) {
  main { padding: var(--space-6) var(--space-4); }
  .season-header h1, .season-header h2 { font-size: 28px; }
  .grid-bst { grid-template-columns: repeat(auto-fill, minmax(180px,1fr)); gap: var(--space-4); }
  .card-block { padding: var(--space-4); }
  .home-banner { margin-bottom: var(--space-8); }
  .home-banner-image { height: 360px; }
  .project-list { gap: var(--space-4); }
  .project-name { font-size: 15px; }
}

@media (max-width: 768px) {
  header.topbar { padding: 16px var(--space-4); position: relative; }
  header.topbar .brand { font-size: 13px; }
  header.topbar nav { display: none; }
  header.topbar .hamburger-btn {
    display: flex; flex-direction: column; justify-content: center; gap: 5px;
    width: 32px; height: 32px; background: none; border: none; padding: 0;
  }
  header.topbar .hamburger-btn span { display: block; width: 100%; height: 1.5px; background: var(--color-ink); }
  header.topbar .user-chip { padding: 6px 10px; font-size: 10px; }
  .season-header { flex-direction: column; align-items: flex-start; }
  .season-header h1, .season-header h2 { font-size: 24px; }
  .grid-bst { grid-template-columns: 1fr 1fr; gap: var(--space-3); }
  .home-banner-image { height: 260px; }
  .home-banner-overlay { padding: var(--space-4); }
  .home-banner-title { max-width: 100%; }
  .project-list { grid-template-columns: 1fr; gap: var(--space-4); }
  .project-name { font-size: 17px; }
  .toolbar { flex-direction: column; align-items: stretch; }
  .toolbar .btn { width: 100%; }
  .search-box { width: 100%; min-width: 0; }
  .product-row { flex-wrap: wrap; }
  .product-row .side-info { text-align: left; min-width: 0; width: 100%; margin-top: 4px; }
  .product-row .side-info > div:last-child { display: flex; }
  .modal { padding: var(--space-6); max-width: 100%; }
  .modal-actions { flex-direction: column-reverse; }
  .modal-actions .btn { width: 100%; }
  .btn, .btn-sm { min-height: 44px; } /* touch target */
  .stat-tile { min-width: 100%; }
  table.product-table { display: block; overflow-x: auto; white-space: nowrap; }
}
