:root {
  --accent: #b45309; /* safety-amber 700 — single accent */
  --bg: #f4f4f5;
  --surface: #ffffff;
  --border: #e4e4e7;
  --radius: 8px;
}
body { font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }
.btn-primary { background: var(--accent); color: #fff; border-radius: var(--radius); padding: 0.5rem 1rem; font-size: 0.875rem; }
.btn-primary:active { transform: scale(0.98); }
.btn-ghost { border: 1px solid var(--border); border-radius: var(--radius); padding: 0.5rem 1rem; font-size: 0.875rem; background: #fff; }
.btn-ghost:active { transform: scale(0.98); }
.chip { border-radius: 999px; padding: 0.125rem 0.625rem; font-size: 0.75rem; font-weight: 600; white-space: nowrap; }
.chip-normal { background: #dcfce7; color: #166534; }
.chip-reorder { background: #fef3c7; color: #92400e; }
.chip-out { background: #fee2e2; color: #991b1b; }
.chip-over { background: #dbeafe; color: #1e40af; }
table.data { width: 100%; font-size: 0.875rem; }
table.data th { text-align: left; font-weight: 600; color: #52525b; padding: 0.5rem 0.75rem; border-bottom: 1px solid var(--border); }
table.data td { padding: 0.5rem 0.75rem; border-bottom: 1px solid var(--border); font-variant-numeric: tabular-nums; }
label.f { display: block; font-size: 0.8rem; font-weight: 600; margin-bottom: 0.25rem; }
input.f, select.f { width: 100%; border: 1px solid #d4d4d8; border-radius: var(--radius); padding: 0.5rem 0.75rem; font-size: 0.875rem; background: #fff; }
.err { color: #b91c1c; font-size: 0.78rem; margin-top: 0.25rem; }
.btn-danger { background: #b91c1c; color: #fff; border-radius: var(--radius); padding: 0.5rem 1rem; font-size: 0.875rem; }
.btn-danger:active { transform: scale(0.98); }
.btn-primary[disabled], .btn-ghost[disabled] { opacity: 0.5; cursor: not-allowed; }

/* Custom select (replaces native <select>) */
.ui-sel { position: relative; border: 1px solid #d4d4d8; border-radius: var(--radius); background: #fff; font-size: 0.875rem; cursor: pointer; display: flex; align-items: center; min-height: 42px; }
.ui-sel:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.ui-sel.open { border-color: var(--accent); }
.ui-sel-val { flex: 1; padding: 0.5rem 0.75rem; color: #3f3f46; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ui-sel.filled .ui-sel-val { color: #18181b; }
.ui-sel-ic { padding-right: 0.6rem; color: #71717a; display: flex; }
.ui-menu { position: absolute; top: calc(100% + 4px); left: 0; right: 0; z-index: 35; background: #fff; border: 1px solid var(--border); border-radius: var(--radius); box-shadow: 0 8px 24px rgba(0,0,0,.12); max-height: 260px; display: flex; flex-direction: column; }
.ui-menu-search { margin: 6px; border: 1px solid #d4d4d8; border-radius: 6px; padding: 6px 8px; font-size: 0.85rem; }
.ui-menu-list { overflow-y: auto; }
.ui-opt { padding: 8px 12px; cursor: pointer; font-size: 0.875rem; }
.ui-opt:hover, .ui-opt:focus { background: #f4f4f5; }
.ui-opt.sel { background: #fff7ed; font-weight: 600; }
.ui-opt.muted { color: #a1a1aa; cursor: default; }

/* Custom checkbox */
.ui-check { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; font-size: 0.85rem; }
.ui-check input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.ui-box { width: 18px; height: 18px; border: 1.5px solid #a1a1aa; border-radius: 4px; background: #fff; display: inline-flex; align-items: center; justify-content: center; color: transparent; flex: none; }
.ui-check input:checked + .ui-box { background: var(--accent); border-color: var(--accent); color: #fff; }
.ui-check input:focus-visible + .ui-box { outline: 2px solid var(--accent); outline-offset: 2px; }

/* Nav user menu */
.user-menu { position: relative; }
.user-menu-btn { display: flex; align-items: center; gap: 8px; border: 1px solid var(--border); border-radius: 999px; padding: 4px 10px 4px 4px; background: #fff; font-size: 0.85rem; cursor: pointer; }
.user-menu-btn:active { transform: scale(0.98); }
.avatar { width: 28px; height: 28px; border-radius: 999px; background: var(--accent); color: #fff; display: flex; align-items: center; justify-content: center; font-size: 0.75rem; font-weight: 700; flex: none; }
.user-menu-list { position: absolute; right: 0; top: calc(100% + 6px); z-index: 35; background: #fff; border: 1px solid var(--border); border-radius: var(--radius); box-shadow: 0 8px 24px rgba(0,0,0,.12); min-width: 190px; padding: 6px; }
.user-menu-list button { display: block; width: 100%; text-align: left; padding: 8px 10px; border-radius: 6px; font-size: 0.875rem; background: none; border: none; cursor: pointer; }
.user-menu-list button:hover { background: #f4f4f5; }
.user-menu-list .sep { border-top: 1px solid var(--border); margin: 4px 0; }
.user-menu-head { padding: 8px 10px 6px; }
.user-menu-head .nm { font-weight: 600; font-size: 0.9rem; }
.user-menu-head .em { color: #71717a; font-size: 0.75rem; }

/* Auth screen */
.auth-wrap { min-height: 100dvh; display: flex; align-items: center; justify-content: center; padding: 1rem; background: #18181b; }
.auth-card { width: 100%; max-width: 400px; background: #fff; border-radius: 12px; padding: 2rem; }
.auth-tabs { display: flex; gap: 4px; background: #f4f4f5; padding: 4px; border-radius: var(--radius); margin-bottom: 1.25rem; }
.auth-tabs button { flex: 1; padding: 8px; border: none; border-radius: 6px; font-size: 0.9rem; font-weight: 600; background: none; cursor: pointer; color: #52525b; }
.auth-tabs button.on { background: #fff; color: #18181b; box-shadow: 0 1px 3px rgba(0,0,0,.1); }

/* Loading skeleton (matches table shape) */
.skel-row { display: flex; gap: 12px; padding: 10px 12px; border-bottom: 1px solid var(--border); }
.skel { height: 14px; border-radius: 4px; background: linear-gradient(90deg, #f4f4f5 25%, #e4e4e7 50%, #f4f4f5 75%); background-size: 200% 100%; animation: skel 1.2s infinite; flex: 1; }
@keyframes skel { to { background-position: -200% 0; } }
.empty { padding: 2.5rem 1rem; text-align: center; color: #71717a; font-size: 0.9rem; }
@media (max-width: 767px) {
  #nav { display: none; }
  #nav.open { display: flex; position: fixed; top: 0; bottom: 0; left: 0; z-index: 40; width: 16rem; }
  #navScrim { display: none; }
  #navScrim.open { display: block; position: fixed; inset: 0; z-index: 30; background: rgba(0,0,0,.5); }
  #outlet { padding: 1rem; }
  table.data thead { display: none; }
  table.data tr { display: block; border-bottom: 2px solid var(--border); }
  table.data td { display: flex; justify-content: space-between; border: none; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

/* sortable headers + filter tabs */
th.sortable { cursor: pointer; user-select: none; }
th.sortable:hover { color: #18181b; }
.sort-ind { font-size: 10px; }
.tab { border: 1px solid var(--border); background: #fff; border-radius: 999px; padding: 0.25rem 0.75rem; font-size: 0.75rem; font-weight: 600; color: #52525b; cursor: pointer; display: inline-flex; gap: 0.375rem; align-items: center; }
.tab:hover { border-color: #a1a1aa; }
.tab-on { background: #18181b; border-color: #18181b; color: #fff; }
.tab-n { font-size: 10px; opacity: 0.7; font-variant-numeric: tabular-nums; }
