/* Narith Internal Hub — admin panel. Same brand tokens as the employee page. */
:root {
  --brand: #0d8ec0;
  --brand-strong: #0b7aa6;
  --brand-strong-hover: #09668b;
  --brand-on-soft: #09668b;
  --brand-soft: #e8f4fa;
  --on-brand: #ffffff;
  --bg: #f6f8fa;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --border: #e6e9ee;
  --border-strong: #d3d8e0;
  --text: #0f172a;
  --muted: #5b6b80;
  --danger: #b42318;
  --danger-soft: #fdecea;
  --ok: #067647;
  --ok-soft: #e7f6ee;
  --warn: #93370d;
  --warn-soft: #fef4e6;
  --radius-lg: 14px;
  --radius-md: 10px;
  --radius-sm: 8px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color-scheme: light;
}
:root[data-theme="dark"] {
  --brand: #29a8d8;
  --brand-strong: #29a8d8;
  --brand-strong-hover: #52bde6;
  --brand-on-soft: #29a8d8;
  --brand-soft: #0e2a38;
  --on-brand: #0b0e14;
  --bg: #0b0e14;
  --surface: #111725;
  --surface-2: #0e1420;
  --border: #1e2836;
  --border-strong: #2a3648;
  --text: #e6e9ef;
  --muted: #94a3b8;
  --danger: #f97066;
  --danger-soft: #3a1512;
  --ok: #47cd89;
  --ok-soft: #0d2a1c;
  --warn: #fdb022;
  --warn-soft: #33240b;
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; font: 15px/1.5 var(--font); color: var(--text); background: var(--bg); padding-bottom: 96px; }
h1, h2, h3, p { margin: 0; }
a { color: var(--brand-strong); }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; border-radius: 6px; }
[hidden] { display: none !important; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.skip-link { position: absolute; left: 16px; top: -48px; z-index: 100; padding: 8px 14px; border-radius: var(--radius-sm); background: var(--brand-strong); color: var(--on-brand); font-weight: 600; text-decoration: none; }
.skip-link:focus { top: 12px; }
.wrap { width: 100%; max-width: 1040px; margin: 0 auto; padding: 0 24px; }

/* Header */
.top { position: sticky; top: 0; z-index: 20; background: var(--surface); border-bottom: 1px solid var(--border); }
.top-inner { display: flex; align-items: center; gap: 16px; min-height: 60px; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 12px; }
.brand-name { font-weight: 800; letter-spacing: 0.06em; color: var(--brand-strong); }
.brand-divider { width: 1px; height: 22px; background: var(--border-strong); }
.brand-title { font-weight: 600; }
.brand-badge { margin-left: 6px; padding: 2px 8px; border-radius: 999px; font-size: 0.72rem; font-weight: 700; background: var(--brand-soft); color: var(--brand-on-soft); vertical-align: 1px; }
.top-actions { margin-left: auto; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.who { color: var(--muted); font-size: 0.875rem; margin-right: 4px; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 8px 14px; border-radius: var(--radius-sm); border: 1px solid var(--border-strong);
  background: var(--surface); color: var(--text); font: inherit; font-size: 0.875rem; font-weight: 600;
  cursor: pointer; text-decoration: none; white-space: nowrap;
}
.btn:hover { border-color: var(--brand); color: var(--brand-on-soft); }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }
.btn--primary { background: var(--brand-strong); border-color: var(--brand-strong); color: var(--on-brand); }
.btn--primary:hover { background: var(--brand-strong-hover); border-color: var(--brand-strong-hover); color: var(--on-brand); }
.btn--ghost { background: transparent; }
.btn--danger { color: var(--danger); }
.btn--danger:hover { border-color: var(--danger); color: var(--danger); background: var(--danger-soft); }
.btn--sm { padding: 5px 10px; font-size: 0.8rem; }
.icon-btn { width: 32px; height: 32px; padding: 0; }

/* Notices */
.notice { margin: 20px 0 0; padding: 12px 16px; border-radius: var(--radius-md); border: 1px solid var(--border); background: var(--surface); }
.notice.is-ok { background: var(--ok-soft); border-color: transparent; color: var(--ok); }
.notice.is-error { background: var(--danger-soft); border-color: transparent; color: var(--danger); }
.notice ul { margin: 8px 0 0; padding-left: 20px; }
.loading { padding: 48px 0; color: var(--muted); text-align: center; }

/* Tabs */
.tabs { position: relative; display: flex; gap: 4px; margin: 24px 0 16px; border-bottom: 1px solid var(--border); overflow-x: auto; }
.tab {
  padding: 10px 14px; border: 0; border-bottom: 2px solid transparent; margin-bottom: -1px;
  background: none; color: var(--muted); font: inherit; font-weight: 600; cursor: pointer; white-space: nowrap;
}
.tab:hover { color: var(--text); }
.tab[aria-selected="true"] { color: var(--brand-on-soft); border-bottom-color: var(--brand); }
.tab-count { margin-left: 6px; padding: 1px 7px; border-radius: 999px; font-size: 0.72rem; background: var(--surface-2); border: 1px solid var(--border); color: var(--muted); }

/* Sections + cards */
.section-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 14px; flex-wrap: wrap; }
.section-head h2 { font-size: 1.15rem; }
.section-head p { color: var(--muted); font-size: 0.875rem; margin-top: 2px; max-width: 64ch; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 16px; }
.card--sub { background: var(--surface-2); border-radius: var(--radius-md); padding: 12px; }
.card-head { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; flex-wrap: wrap; }
.card-title { font-weight: 700; margin-right: auto; min-width: 0; overflow-wrap: anywhere; }
.card-tools { display: flex; gap: 6px; }
.empty { padding: 28px; text-align: center; color: var(--muted); border: 1px dashed var(--border-strong); border-radius: var(--radius-lg); }

.pill { display: inline-flex; align-items: center; padding: 2px 9px; border-radius: 999px; font-size: 0.72rem; font-weight: 700; white-space: nowrap; }
.pill--live { background: var(--ok-soft); color: var(--ok); }
.pill--soon { background: var(--surface-2); color: var(--muted); border: 1px solid var(--border); }
.pill--warn { background: var(--warn-soft); color: var(--warn); }

/* Form fields */
.grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 16px; }
.span-2 { grid-column: 1 / -1; }
.field { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.field-label { font-size: 0.8rem; font-weight: 600; color: var(--muted); }
.field input, .field select, .field textarea {
  width: 100%; padding: 8px 10px; border-radius: var(--radius-sm); border: 1px solid var(--border-strong);
  background: var(--surface); color: var(--text); font: inherit; font-size: 0.9rem;
}
.field textarea { min-height: 90px; resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus { outline: 2px solid var(--brand); outline-offset: 0; border-color: var(--brand); }
.field input[aria-invalid="true"], .field textarea[aria-invalid="true"] { border-color: var(--danger); }
.hint { font-size: 0.78rem; color: var(--muted); min-height: 0; }
.hint.is-error { color: var(--danger); }
.items { display: flex; flex-direction: column; gap: 10px; margin-top: 12px; }
.row-actions { display: flex; gap: 8px; margin-top: 12px; flex-wrap: wrap; }
.mt { margin-top: 12px; }
.mb { margin-bottom: 12px; }
.sub-head { margin: 24px 0 10px; font-size: 1rem; }
.card h3 { font-size: 1rem; margin-bottom: 4px; }
.card h3 + p { margin-bottom: 12px; font-size: 0.875rem; }
.field--action { justify-content: flex-end; }

/* Image upload */
.image-box { display: flex; gap: 12px; align-items: flex-start; flex-wrap: wrap; }
.thumb { width: 200px; max-width: 100%; aspect-ratio: 16 / 9; object-fit: cover; border-radius: var(--radius-sm); border: 1px solid var(--border); background: var(--surface-2); }
.thumb-empty { display: grid; place-items: center; color: var(--muted); font-size: 0.8rem; }
.image-fields { flex: 1 1 240px; display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.file-label { position: relative; }
.file-label input[type="file"] { position: absolute; inset: 0; opacity: 0; cursor: pointer; }

/* Tables */
.table { width: 100%; border-collapse: collapse; font-size: 0.875rem; }
.table th, .table td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--border); vertical-align: top; }
.table th { color: var(--muted); font-weight: 600; font-size: 0.78rem; }
.table-wrap { position: relative; overflow-x: auto; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 4px 12px; }
.muted { color: var(--muted); }

/* Sign-in */
.auth { max-width: 420px; margin: 48px auto; }
.auth .card { padding: 24px; }
.auth h1 { font-size: 1.3rem; margin-bottom: 4px; }
.auth p.muted { margin-bottom: 18px; }
.auth form { display: flex; flex-direction: column; gap: 14px; }

/* Publish bar */
.publish-bar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; background: var(--surface); border-top: 1px solid var(--border); box-shadow: 0 -4px 16px rgba(15, 23, 42, 0.08); }
.publish-inner { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 64px; flex-wrap: wrap; padding-top: 10px; padding-bottom: 10px; }
.publish-actions { display: flex; gap: 8px; }
#publish-text { font-weight: 600; }

@media (max-width: 720px) {
  .wrap { padding: 0 16px; }
  .grid { grid-template-columns: minmax(0, 1fr); }
  .who { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; }
}
