/* JOHNVIVZ design system — presentation only.
   Loaded after app.css and inventory-theme.css; overrides visuals without changing markup hooks. */

:root {
  --navy: #102957;
  --blue: #0866d9;
  --blue-strong: #0553b3;
  --blue-soft: #e8f1fd;
  --bg: #f4f7fb;
  --surface: #ffffff;
  --text: #172b4d;
  --text-soft: #75839a;
  --border: #e1e8f2;
  --border-strong: #cbd7e8;
  --success: #15803d;  --success-bg: #e7f6ec; --success-line: #bfe5cc;
  --warning: #c2570c;  --warning-bg: #fff1e0; --warning-line: #f6d3a8;
  --danger: #b91c1c;   --danger-bg: #fde8e8;  --danger-line: #f3bcbc;
  --info: #0b57c4;     --info-bg: #e5f0ff;    --info-line: #bcd5f6;
  --neutral: #4b5b75;  --neutral-bg: #eef1f6; --neutral-line: #d6dde8;
  --radius: 10px;
  --radius-sm: 8px;
  --shadow-sm: 0 1px 2px #0f1f3d0d, 0 1px 3px #0f1f3d0a;
  --shadow-md: 0 6px 18px #0f1f3d14;
  --shadow-lg: 0 18px 48px #0f1f3d2e;
  --sidebar-w: 264px;
  --sidebar-w-collapsed: 76px;
  --topbar-h: 68px;
  --focus: 0 0 0 3px #0866d933;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

html { scroll-behavior: smooth; }
body, .app-body { background: var(--bg); color: var(--text); -webkit-font-smoothing: antialiased; }
.app-shell { overflow-x: clip; }
.main-panel { min-width: 0; }

/* ---------- Sidebar (fixed on desktop) ---------- */
.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 30;
  display: flex;
  flex-direction: column;
  width: var(--sidebar-w);
  height: 100vh;
  height: 100dvh;
  padding: 18px 12px 14px;
  background: var(--navy);
  color: #c3d3ee;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: #ffffff30 transparent;
  transition: width .2s ease, transform .22s ease;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 12px 18px; margin-bottom: 4px; border-bottom: 1px solid #ffffff1a; text-decoration: none; }
.brand-short { display: none; width: 40px; height: 40px; place-items: center; border-radius: 11px; background: var(--blue); color: #fff; font-weight: 800; font-size: 15px; letter-spacing: .02em; }
.brand-wordmark { color: #fff; font-size: 18px; font-weight: 800; letter-spacing: .05em; }
.brand small { display: block; margin-top: 2px; color: #9fb6dc; font-size: 10.5px; font-weight: 500; letter-spacing: .16em; text-transform: uppercase; }
.nav-list { display: grid; gap: 2px; align-content: start; flex: 1; }
.nav-section { margin: 14px 12px 4px; color: #8ea6cf; font-size: 10.5px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; }
.nav-section:first-child { margin-top: 6px; }
.nav-link {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  color: #c3d3ee;
  font-size: 13.5px;
  font-weight: 500;
  text-decoration: none;
  transition: background .15s, color .15s;
}
.nav-link:hover { background: #ffffff14; color: #fff; }
.nav-link.active { background: #ffffff22; color: #fff; font-weight: 600; box-shadow: none; }
.nav-link.active::before { content: ""; position: absolute; left: -12px; top: 8px; bottom: 8px; width: 3px; border-radius: 0 3px 3px 0; background: #4cc2ff; }
.nav-link > span { display: block; flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nav-link > i svg, .sidebar-help > i svg, .sidebar-logout button > i svg { width: 18px; height: 18px; stroke-width: 1.9; }
.nav-link > i, .sidebar-help > i, .sidebar-logout button > i { display: inline-flex; align-items: center; justify-content: center; width: 18px; height: 18px; flex: none; font-style: normal; }
.sidebar-bottom { margin-top: 10px; padding-top: 10px; border-top: 1px solid #ffffff1a; display: grid; gap: 2px; }
.sidebar-help, .sidebar-logout button {
  display: flex; align-items: center; gap: 12px; width: 100%;
  padding: 10px 12px; border: 0; border-radius: var(--radius-sm);
  background: transparent; color: #c3d3ee; font: inherit; font-size: 13.5px; font-weight: 500; text-align: left; cursor: pointer;
  transition: background .15s, color .15s;
}
.sidebar-help:hover, .sidebar-logout button:hover { background: #ffffff14; color: #fff; }
.sidebar-logout { margin: 0; padding: 0; border: 0; }
.nav-overlay { display: none; }

/* ---------- Top bar ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  height: var(--topbar-h);
  padding: 0 32px;
  background: #ffffffee;
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
}
.topbar-left { display: flex; align-items: center; gap: 14px; min-width: 0; }
.topbar-logo-link { display: inline-flex; flex: none; }
.topbar-logo { width: 104px; max-width: 26vw; height: auto; object-fit: contain; }
.breadcrumbs { min-width: 0; padding-left: 14px; border-left: 1px solid var(--border); }
.breadcrumbs ol { display: flex; align-items: center; gap: 0; margin: 0; padding: 0; list-style: none; font-size: 13px; color: var(--text-soft); white-space: nowrap; }
.breadcrumbs li { display: inline-flex; align-items: center; min-width: 0; }
.breadcrumbs li + li::before { content: "/"; margin: 0 8px; color: #b3bfd1; }
.breadcrumbs a { color: var(--text-soft); text-decoration: none; }
.breadcrumbs a:hover { color: var(--blue); text-decoration: underline; }
.breadcrumbs li[aria-current] { color: var(--text); font-weight: 600; overflow: hidden; text-overflow: ellipsis; }
.nav-toggle {
  display: inline-grid; place-items: center; width: 38px; height: 38px; flex: none;
  border: 1px solid var(--border); border-radius: var(--radius-sm); background: #fff; color: var(--text); cursor: pointer;
  transition: background .15s, border-color .15s;
}
.nav-toggle:hover { background: var(--blue-soft); border-color: #b7cff7; }
.nav-toggle svg { width: 18px; height: 18px; }
.topbar-actions { display: flex; align-items: center; gap: 18px; margin-left: auto; flex: none; }
.user-chip { display: flex; flex-direction: column; align-items: flex-end; font-size: 13px; font-weight: 600; color: var(--text); line-height: 1.25; }
.user-chip small { margin-top: 3px; padding: 1px 8px; border-radius: 999px; background: var(--blue-soft); color: var(--blue-strong); font-size: 10.5px; font-weight: 600; text-transform: capitalize; }

/* Notification bell + dropdown */
.notif-menu { position: relative; }
.notif-button {
  position: relative; display: inline-grid; place-items: center; width: 40px; height: 40px;
  border: 1px solid var(--border); border-radius: 50%; background: #fff; color: #3f5578; text-decoration: none;
  transition: background .15s, border-color .15s, color .15s;
}
.notif-button:hover, .notif-button.active, .notif-button[aria-expanded="true"] { background: var(--blue-soft); border-color: #b7cff7; color: var(--blue); }
.notif-button > i { display: inline-flex; width: 20px; height: 20px; align-items: center; justify-content: center; font-style: normal; }
.notif-button > i svg { width: 20px; height: 20px; }
.nav-count { background: #ef4444; color: #fff; font-weight: 700; }
.nav-count:empty { display: none; }
.notif-count {
  position: absolute; top: -5px; right: -5px; min-width: 18px; height: 18px; margin: 0; padding: 0 5px;
  border: 2px solid #fff; border-radius: 999px; box-sizing: border-box; font-size: 10px; line-height: 14px; text-align: center;
}
.notif-panel {
  position: absolute; top: calc(100% + 10px); right: 0; z-index: 40; width: 380px; max-width: calc(100vw - 24px);
  background: #fff; border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow-lg); overflow: hidden;
  animation: pop .14s ease-out;
}
.notif-panel[hidden] { display: none; }
.notif-panel-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 14px 16px; border-bottom: 1px solid var(--border); }
.notif-panel-head strong { font-size: 14px; }
.notif-panel-head form { margin: 0; }
.notif-link { border: 0; background: none; padding: 0; color: var(--blue); font: inherit; font-size: 12px; font-weight: 600; cursor: pointer; }
.notif-link:hover { text-decoration: underline; }
.notif-list { max-height: min(380px, 60vh); overflow-y: auto; }
.notif-item { display: flex; gap: 12px; padding: 12px 16px; border-bottom: 1px solid #edf1f7; color: var(--text); text-decoration: none; transition: background .12s; }
.notif-item:hover, .notif-item:focus-visible { background: #f5f9ff; }
.notif-body { display: grid; gap: 2px; min-width: 0; font-size: 13px; }
.notif-body strong { font-weight: 650; overflow-wrap: anywhere; }
.notif-stock { color: var(--text-soft); font-size: 12px; }
.notif-stock b { color: var(--text); }
.notif-body time { color: #98a5ba; font-size: 11px; }
.notif-empty { margin: 0; padding: 28px 16px; text-align: center; color: var(--text-soft); font-size: 13px; }
.notif-footer { display: block; padding: 12px 16px; background: #f7faff; color: var(--blue); text-align: center; font-size: 12.5px; font-weight: 600; text-decoration: none; }
.notif-footer:hover { text-decoration: underline; }
.sev { flex: none; align-self: flex-start; padding: 2px 8px; border-radius: 999px; border: 1px solid; font-size: 10.5px; font-weight: 700; white-space: nowrap; }
.sev-critical { background: var(--danger-bg); color: var(--danger); border-color: var(--danger-line); }
.sev-warning { background: var(--warning-bg); color: var(--warning); border-color: var(--warning-line); }
.sev-ok { background: var(--success-bg); color: var(--success); border-color: var(--success-line); }
.sev-info { background: var(--info-bg); color: var(--info); border-color: var(--info-line); }
@keyframes pop { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }

.print-header { display: none; }

/* ---------- Page layout ---------- */
.page-content { max-width: 1600px; margin: 0 auto; padding: 28px 32px 48px; }
.page-heading { margin-bottom: 22px; }
.page-heading h1 { margin: 2px 0 4px; font-size: 24px; letter-spacing: -.02em; color: var(--text); }
.eyebrow { color: var(--blue); font-size: 10.5px; letter-spacing: .14em; }
.muted { color: var(--text-soft); }
.heading-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.app-footer { padding: 18px; color: var(--text-soft); font-size: 11px; }

/* ---------- Cards ---------- */
.panel, .stat-card, .auth-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-sm); }
.panel { padding: 20px; }
.panel-heading { margin-bottom: 14px; }
.panel-heading h2 { font-size: 15px; font-weight: 650; color: var(--text); }
.panel-heading a { color: var(--blue); font-size: 12px; font-weight: 600; }
.panel-heading a:hover { text-decoration: underline; }
.stats-grid { gap: 14px; margin-bottom: 16px; }
.stat-card,
.stat-card.tone-blue, .stat-card.tone-green, .stat-card.tone-amber,
.stat-card.tone-red, .stat-card.tone-violet, .stat-card.tone-slate { background: var(--surface); border-color: var(--border); padding: 18px 20px 18px 22px; }
.stat-card::before { left: 0; top: 0; bottom: 0; width: 4px; border-radius: 10px 0 0 10px; }
.stat-card > span { color: var(--text-soft); font-size: 12.5px; font-weight: 600; }
.stat-card strong { margin: 6px 0 2px; font-size: 28px; }
.stat-card small { color: #8a97ad; font-size: 11px; }
.stat-card:hover { transform: translateY(-1px); box-shadow: var(--shadow-md); }
.dashboard-grid { gap: 16px; margin-top: 16px; }
.chart-wrap { height: 250px; }

/* ---------- Tables ---------- */
.table-panel { padding: 0; overflow: hidden; }
.table-wrap { -webkit-overflow-scrolling: touch; }
table { border-collapse: separate; border-spacing: 0; }
th { position: sticky; top: 0; padding: 12px 16px; background: #f3f7fd; border-bottom: 1px solid var(--border); color: var(--text-soft); font-size: 11px; letter-spacing: .06em; }
td { padding: 13px 16px; border-top: 0; border-bottom: 1px solid #edf1f7; color: var(--text); font-size: 13px; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr { transition: background .12s; }
tbody tr:hover { background: #f6f9fe; }
.table-panel table { min-width: 640px; }
.table-summary { margin: 0; padding: 12px 16px; border-top: 1px solid #edf1f7; }
td.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
td.num-strong { font-weight: 700; }
tr.row-danger { background: #fff8f8; box-shadow: inset 3px 0 var(--danger); }
tr.row-warning { background: #fffaf3; box-shadow: inset 3px 0 #f59e0b; }
tr.row-resolved td { color: var(--text-soft); }
.stock-figure { font-weight: 700; }
.stock-critical { color: var(--danger); }
.stock-warning { color: var(--warning); }
.stock-ok { color: var(--success); }

.empty-state { padding: 40px 16px !important; color: var(--text-soft); font-size: 13px; text-align: center; }
.empty-state::before { content: "∅"; display: block; margin-bottom: 8px; color: #b3bfd1; font-size: 26px; line-height: 1; }

/* Badges (added by app-shell.js from existing cell text) */
.badge, .status-pill { display: inline-flex; align-items: center; padding: 3px 10px; border: 1px solid; border-radius: 999px; font-size: 11.5px; font-weight: 600; line-height: 1.4; text-transform: capitalize; white-space: nowrap; }
.status-pill { background: var(--info-bg); color: var(--info); border-color: var(--info-line); }
.badge-success { background: var(--success-bg); color: var(--success); border-color: var(--success-line); }
.badge-warning { background: var(--warning-bg); color: var(--warning); border-color: var(--warning-line); }
.badge-danger { background: var(--danger-bg); color: var(--danger); border-color: var(--danger-line); }
.badge-info { background: var(--info-bg); color: var(--info); border-color: var(--info-line); }
.badge-neutral { background: var(--neutral-bg); color: var(--neutral); border-color: var(--neutral-line); }

/* Row actions */
.actions-cell { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.table-action {
  display: inline-flex; align-items: center; padding: 4px 10px; border: 1px solid #d3e1fb; border-radius: 6px;
  background: #f5f9ff; color: var(--blue); font-size: 12px; font-weight: 600; line-height: 1.4; text-decoration: none; cursor: pointer;
  transition: background .12s, border-color .12s;
}
.table-action:hover { background: #e6efff; border-color: #b7cff7; text-decoration: none; }
.table-action.danger-link { background: var(--danger-bg); color: var(--danger); border-color: var(--danger-line); }
.table-action.danger-link:hover { background: #fbd5d5; }

/* ---------- Filters ---------- */
.filter-form { gap: 10px; padding: 14px 16px; background: #fafcff; border-bottom: 1px solid var(--border); }
.filter-form .button { height: 38px; }
.clear-link { padding: 10px 6px; color: var(--blue); font-weight: 600; }
.clear-link:hover { text-decoration: underline; }

/* ---------- Buttons ---------- */
.button {
  position: relative; min-height: 38px; padding: 9px 16px; border-radius: var(--radius-sm);
  font-size: 13px; font-weight: 600; transition: background .15s, box-shadow .15s, border-color .15s;
}
.button:hover { transform: none; }
.button:active { transform: translateY(1px); }
.button-primary, .button-primary:hover { background-image: none; }
.button-primary { background: var(--blue); color: #fff; box-shadow: 0 1px 2px #0866d940; }
.button-primary:hover { background: var(--blue-strong); box-shadow: 0 3px 8px #0866d933; }
.button-secondary { background: #fff; color: #2a4266; border: 1px solid var(--border-strong); }
.button-secondary:hover { background: #f3f7fd; border-color: #b0c3de; }
.button-danger { background: #dc2626; color: #fff; border: 0; }
.button-danger:hover { background: #b91c1c; }
.button.is-loading { color: transparent !important; pointer-events: none; }
.button.is-loading::after { content: ""; position: absolute; width: 16px; height: 16px; border: 2px solid #ffffffb0; border-top-color: transparent; border-radius: 50%; animation: spin .7s linear infinite; }
.button-secondary.is-loading::after { border-color: #5b6b85; border-top-color: transparent; }
@keyframes spin { to { transform: rotate(360deg); } }
.button:focus-visible, .nav-link:focus-visible, .table-action:focus-visible, .sidebar-help:focus-visible,
.sidebar-logout button:focus-visible, .nav-toggle:focus-visible, .notif-button:focus-visible, .notif-item:focus-visible,
.notif-link:focus-visible, .pw-toggle:focus-visible, .modal-close:focus-visible { outline: 2px solid #38bdf8; outline-offset: 2px; }

/* ---------- Forms ---------- */
.stack-form { gap: 14px; }
.stack-form label, .filter-form label, .status-form label { color: #3f5578; font-size: 12px; font-weight: 600; }
.stack-form input, .stack-form select, .stack-form textarea, .filter-form input, .filter-form select, .status-form select {
  min-height: 40px; padding: 9px 12px; border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  background: #fff; color: var(--text); font-size: 13px; transition: border-color .15s, box-shadow .15s;
}
.stack-form textarea { min-height: 84px; }
.stack-form input:hover, .stack-form select:hover, .stack-form textarea:hover, .filter-form input:hover, .filter-form select:hover { border-color: #aebfdc; }
.stack-form input:focus, .stack-form select:focus, .stack-form textarea:focus,
.filter-form input:focus, .filter-form select:focus, .status-form select:focus { border-color: var(--blue); box-shadow: var(--focus); }
.stack-form input::placeholder, .filter-form input::placeholder, .stack-form textarea::placeholder { color: #9aa7bb; }
.stack-form input[readonly] { background: #f1f5fb; border-style: dashed; color: #3f5578; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; letter-spacing: .03em; cursor: not-allowed; }
.stack-form input[readonly]:focus { border-color: var(--border-strong); box-shadow: none; }
.form-panel { top: calc(var(--topbar-h) + 16px); }
.form-panel .panel-heading { padding-bottom: 12px; border-bottom: 1px solid #edf1f7; }
.status-form { padding: 14px 16px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }
.detail-grid { padding: 18px 20px; }
.detail-grid .muted { font-size: 11.5px; font-weight: 600; letter-spacing: .05em; text-transform: uppercase; }
.required { color: #dc2626; }
.pw-wrap { position: relative; display: block; }
.pw-wrap input { width: 100%; padding-right: 62px; }
.pw-toggle { position: absolute; top: 50%; right: 8px; transform: translateY(-50%); padding: 4px 8px; border: 0; border-radius: 6px; background: transparent; color: var(--blue); font: inherit; font-size: 12px; font-weight: 600; cursor: pointer; }
.pw-toggle:hover { background: var(--blue-soft); }

/* ---------- Alerts / notifications page ---------- */
.notice { padding: 12px 16px; border-radius: var(--radius-sm); font-size: 13px; font-weight: 500; }
.notice-success { background: var(--success-bg); border-color: var(--success-line); color: var(--success); }
.notice-error { background: var(--danger-bg); border-color: var(--danger-line); color: var(--danger); }
.notification-item { padding: 12px 4px; }
.notification-dot { background: var(--blue); box-shadow: 0 0 0 3px #0866d326; }

/* ---------- Modals ---------- */
.modal-backdrop { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; padding: 16px; background: #0b1b3a8c; backdrop-filter: blur(2px); animation: fade .14s ease-out; }
.modal-backdrop[hidden] { display: none; }
.modal { width: min(560px, 100%); max-height: calc(100vh - 32px); overflow-y: auto; padding: 22px; background: #fff; border-radius: 14px; box-shadow: var(--shadow-lg); animation: pop .16s ease-out; }
.modal-sm { width: min(420px, 100%); }
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.modal-head h2 { margin: 0; font-size: 17px; }
.modal p { margin: 0 0 4px; color: var(--text); font-size: 14px; line-height: 1.5; }
.modal p.muted { margin-top: 14px; color: var(--text-soft); font-size: 12px; }
.modal-close { width: 32px; height: 32px; border: 0; border-radius: 8px; background: transparent; color: var(--text-soft); font-size: 22px; line-height: 1; cursor: pointer; }
.modal-close:hover { background: var(--neutral-bg); color: var(--text); }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 20px; }
.shortcut-table { width: 100%; min-width: 0; white-space: normal; }
.shortcut-table td { padding: 9px 4px; font-size: 13px; }
.shortcut-table td:first-child { width: 46%; white-space: nowrap; }
kbd { display: inline-block; min-width: 24px; padding: 2px 7px; border: 1px solid var(--border-strong); border-bottom-width: 2px; border-radius: 6px; background: #f6f8fc; color: var(--text); font: 600 12px ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; text-align: center; }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }

/* ---------- Auth pages ---------- */
.auth-page { background: radial-gradient(circle at 20% 0%, #e0ecfd, var(--bg) 55%); }
.auth-card { padding: 36px 34px; border-radius: 14px; box-shadow: 0 12px 40px #0f1f3d14; }
.auth-card h1 { font-size: 23px; }
.auth-logo { max-height: 120px; margin-bottom: 14px; }

/* ---------- Desktop / tablet-landscape layout ---------- */
@media (min-width: 801px) {
  .main-panel { margin-left: var(--sidebar-w); }
  .app-shell ~ .app-footer { margin-left: var(--sidebar-w); }
  .sidebar-collapsed .sidebar { width: var(--sidebar-w-collapsed); padding-left: 10px; padding-right: 10px; }
  .sidebar-collapsed .main-panel, .sidebar-collapsed .app-shell ~ .app-footer { margin-left: var(--sidebar-w-collapsed); }
  .sidebar-collapsed .brand { justify-content: center; padding-left: 0; padding-right: 0; }
  .sidebar-collapsed .brand-wordmark, .sidebar-collapsed .nav-section, .sidebar-collapsed .nav-link > span,
  .sidebar-collapsed .sidebar-help > span, .sidebar-collapsed .sidebar-logout button > span { display: none; }
  .sidebar-collapsed .brand-short { display: grid; }
  .sidebar-collapsed .nav-link, .sidebar-collapsed .sidebar-help, .sidebar-collapsed .sidebar-logout button { justify-content: center; padding-left: 0; padding-right: 0; }
  .sidebar-collapsed .nav-link.active::before { left: -10px; }
}

@media (max-width: 1100px) {
  .page-content { padding: 24px 22px 44px; }
  .topbar { padding: 0 22px; }
  .breadcrumbs li:not([aria-current]):not(:first-child) { display: none; }
}

/* ---------- Tablet / mobile: navigation drawer ---------- */
@media (max-width: 800px) {
  .sidebar { width: min(284px, 86vw); transform: translateX(-100%); box-shadow: none; z-index: 60; }
  .nav-open .sidebar { transform: none; box-shadow: var(--shadow-lg); }
  .nav-overlay { position: fixed; inset: 0; z-index: 50; display: block; background: #0b1b3a73; opacity: 0; visibility: hidden; transition: opacity .2s, visibility .2s; }
  .nav-open .nav-overlay { opacity: 1; visibility: visible; }
  .nav-open { overflow: hidden; }
  .topbar { height: 60px; padding: 0 16px; }
  .topbar-logo { width: 92px; }
  .form-panel { position: static; }
  .page-content { padding: 20px 16px 40px; }
  .heading-actions { width: 100%; }
}

@media (max-width: 520px) {
  .topbar { gap: 8px; padding: 0 12px; }
  .topbar-left { gap: 10px; }
  .breadcrumbs { display: none; }
  .topbar-actions { gap: 10px; }
  .user-chip span { max-width: 96px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .page-content { padding: 16px 12px 36px; }
  .page-heading h1 { font-size: 21px; }
  .stat-card strong { font-size: 22px; }
  .filter-form label { min-width: 100%; }
  .filter-form .button { flex: 1; }
  .auth-card { padding: 28px 20px; }
  .notif-panel { position: fixed; top: 64px; right: 12px; left: 12px; width: auto; max-width: none; }
  .modal-actions { flex-direction: column-reverse; }
  .modal-actions .button { width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
}

/* ---------- Print ---------- */
@media print {
  .sidebar, .nav-overlay, .topbar, .modal-backdrop, .notif-button { display: none !important; }
  .main-panel, .app-shell ~ .app-footer { margin-left: 0 !important; }
  .print-header { display: block; padding: 0 0 10px; margin-bottom: 14px; border-bottom: 2px solid var(--navy); color: var(--navy); font-size: 12pt; font-weight: 700; }
  .badge, .status-pill { border: 0; background: none !important; color: #000 !important; padding: 0; font-weight: 600; }
  tr.row-danger, tr.row-warning { box-shadow: none; background: none; }
  th { position: static; background: #eef2f8 !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .empty-state::before { display: none; }
}

/* ---------- Product image upload + thumbnails ---------- */
.image-upload { position: relative; display: grid; gap: 8px; }
.stack-form .image-input { position: absolute; width: 1px; height: 1px; min-height: 0; padding: 0; border: 0; opacity: 0; overflow: hidden; clip: rect(0 0 0 0); }
.image-drop {
  display: grid; justify-items: center; gap: 4px; padding: 18px 14px;
  border: 1.5px dashed var(--border-strong); border-radius: var(--radius); background: #fafcff;
  color: var(--text-soft); text-align: center; cursor: pointer; transition: border-color .15s, background .15s, box-shadow .15s;
}
.image-drop > i { display: inline-flex; width: 28px; height: 28px; align-items: center; justify-content: center; color: var(--blue); font-style: normal; font-size: 22px; }
.image-drop > i svg { width: 28px; height: 28px; }
.image-drop strong { color: var(--text); font-size: 13px; font-weight: 600; }
.image-drop small { font-size: 11.5px; font-weight: 400; }
.image-drop:hover, .image-upload.is-dragging .image-drop { border-color: var(--blue); background: var(--blue-soft); }
.image-upload:focus-within .image-drop { border-color: var(--blue); box-shadow: var(--focus); }
.image-preview { display: flex; align-items: center; gap: 12px; padding: 10px; border: 1px solid var(--border); border-radius: var(--radius); background: #fff; }
.image-preview[hidden], .image-drop[hidden], .image-error[hidden] { display: none; }
.image-upload.is-dragging .image-preview { border-color: var(--blue); background: var(--blue-soft); }
.image-preview img { width: 72px; height: 72px; flex: none; border: 1px solid var(--border); border-radius: 8px; background: #f1f5fb; object-fit: cover; }
.image-meta { display: grid; gap: 4px; min-width: 0; }
.image-name { color: var(--text-soft); font-size: 12px; font-weight: 400; overflow-wrap: anywhere; }
.image-actions { display: flex; gap: 12px; }
.image-link { padding: 0; border: 0; background: none; color: var(--blue); font: inherit; font-size: 12px; font-weight: 600; cursor: pointer; }
.image-link:hover { text-decoration: underline; }
.image-link-danger { color: var(--danger); }
.image-link:focus-visible { outline: 2px solid #38bdf8; outline-offset: 2px; border-radius: 3px; }
.image-error { color: var(--danger); font-size: 12px; font-weight: 500; }
.cell-thumb { display: inline-flex; align-items: center; gap: 10px; }
.thumb { display: inline-block; width: 36px; height: 36px; flex: none; border: 1px solid var(--border); border-radius: 7px; background: #f1f5fb; object-fit: cover; }
.product-hero { display: flex; justify-content: center; margin-bottom: 16px; padding: 14px; }
.product-hero-image { max-width: 100%; max-height: 260px; border-radius: 8px; object-fit: contain; }

/* ---------- Add Product modal + full-width product list ---------- */
.modal-form { display: flex; flex-direction: column; width: min(760px, 100%); max-height: calc(100vh - 32px); max-height: calc(100dvh - 32px); padding: 0; overflow: hidden; }
.modal-form .modal-head { align-items: flex-start; margin: 0; padding: 18px 22px 14px; border-bottom: 1px solid var(--border); }
.modal-form .modal-head h2 { font-size: 18px; }
.modal-form .modal-head p.muted { margin: 2px 0 0; font-size: 12px; }
.modal-form .stack-form { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 16px; padding: 18px 22px 0; overflow-y: auto; align-content: start; }
.modal-form .stack-form > * { min-width: 0; }
.modal-form .form-section { grid-column: 1 / -1; margin: 6px 0 -4px; padding-bottom: 6px; border-bottom: 1px solid #edf1f7; color: var(--text-soft); font-size: 11px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; }
.modal-form .form-section:first-of-type, .modal-form .form-error + .form-section { margin-top: 0; }
.modal-form .field-wide, .modal-form .form-error { grid-column: 1 / -1; }
.modal-form .form-error { margin: 0; }
.modal-form .form-error[hidden] { display: none; }
.modal-form .modal-actions { position: sticky; bottom: 0; grid-column: 1 / -1; margin: 6px -22px 0; padding: 14px 22px; background: #fff; border-top: 1px solid var(--border); }
.module-layout:not(.with-form) { grid-template-columns: minmax(0, 1fr); }
.filter-form label:first-child { flex: 2 1 220px; }
@media (max-width: 640px) {
  .modal-backdrop:has(.modal-form) { padding: 0; align-items: end; }
  .modal-form { width: 100%; max-height: 94vh; max-height: 94dvh; border-radius: 16px 16px 0 0; }
  .modal-form .stack-form { grid-template-columns: minmax(0, 1fr); padding: 16px 16px 0; }
  .modal-form .modal-head { padding: 16px; }
  .modal-form .modal-actions { margin: 6px -16px 0; padding: 12px 16px; flex-direction: row; }
  .modal-form .modal-actions .button { flex: 1; width: auto; }
}

/* Shortcut hint inside the Add button */
.btn-kbd { margin-left: 8px; min-width: 0; padding: 0 6px; border: 1px solid #ffffff59; border-radius: 5px; background: #ffffff1f; color: #ffffffd9; font: 600 10.5px/16px ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; letter-spacing: .03em; text-transform: uppercase; }
@media (max-width: 800px) { .btn-kbd { display: none; } }
