/* ============================================================
   JB CHICKEN — admin.css
   Brand palette from the public site (cream / ink / red / gold).
   Light, professional, responsive (desktop sidebar + mobile drawer).
   ============================================================ */

:root {
  --cream: #faf3e7;
  --paper: #fffdf8;
  --ink: #1c120c;
  --ink-soft: #3a2a1e;
  --muted: #6b584a;
  --line: #eadfd0;
  --red: #d13b22;
  --red-deep: #ad2c13;
  --gold: #eda139;
  --gold-soft: #f7ce8b;
  --ok: #1e7d43;
  --warn: #b25c00;
  --err: #b3261e;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(28, 18, 12, .06), 0 6px 24px rgba(28, 18, 12, .07);
  --sidebar-w: 250px;
  --sidebar-w-collapsed: 68px;
  font-size: 16px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--cream);
  color: var(--ink);
  min-height: 100vh;
}
[hidden] { display: none !important; }
a { color: var(--red-deep); }
button { font: inherit; cursor: pointer; }
h1, h2, h3, h4 { margin: 0 0 .4em; line-height: 1.25; }
p { line-height: 1.55; }

/* ============================ LOGIN ============================ */
.login-view {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(1200px 500px at 80% -10%, rgba(237, 161, 57, .18), transparent 60%),
    radial-gradient(900px 420px at -10% 110%, rgba(209, 59, 34, .10), transparent 55%),
    var(--cream);
}
.login-card {
  width: 100%;
  max-width: 400px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 20px;
  box-shadow: var(--shadow);
  padding: 40px 34px 30px;
  text-align: center;
}
.login-logo {
  width: 56px; height: 56px; border-radius: 50%;
  object-fit: cover; background: var(--ink); padding: 4px;
}
.login-logo-fallback {
  width: 56px; height: 56px; border-radius: 50%;
  background: var(--ink); color: var(--gold-soft);
  display: inline-grid; place-items: center; font-weight: 800; font-size: 20px;
  border: 3px solid var(--gold);
  margin-bottom: 16px;
}
.login-brand h1 { font-size: 1.45rem; margin: 14px 0 6px; }
.login-brand h1 strong { color: var(--red); }
.login-sub { color: var(--muted); font-size: .95rem; margin: 0 0 24px; }

.google-btn {
  width: 100%;
  display: inline-flex; align-items: center; justify-content: center; gap: 12px;
  background: #fff;
  color: #3c4043;
  border: 1px solid #dadce0;
  border-radius: 10px;
  padding: 12px 18px;
  font-size: 1rem; font-weight: 600;
  box-shadow: 0 1px 2px rgba(0,0,0,.05);
  transition: box-shadow .15s ease, transform .05s;
}
.google-btn:hover { box-shadow: 0 2px 8px rgba(0,0,0,.12); }
.google-btn:active { transform: translateY(1px); }
.google-btn[disabled] { opacity: .55; cursor: progress; }
.google-btn .spinner { border-color: rgba(0,0,0,.2); border-top-color: #4285F4; }

.login-banner {
  text-align: left;
  border-radius: 10px;
  padding: 10px 12px;
  font-size: .92rem;
  margin-bottom: 18px;
  border: 1px solid #f3c8c2;
  background: #fdf0ee;
  color: var(--err);
}
.login-banner.warn { border-color: #f5d9ad; background: #fdf6ea; color: var(--warn); }

.login-note { color: var(--muted); font-size: .82rem; margin: 20px 0 0; }
.login-back { display: inline-block; margin-top: 18px; font-size: .9rem; }

/* ============================ APP SHELL ============================ */
.app { display: grid; grid-template-columns: var(--sidebar-w) 1fr; min-height: 100vh; transition: grid-template-columns .18s ease; }
.app.collapsed { grid-template-columns: var(--sidebar-w-collapsed) 1fr; }
.app.collapsed .si-label, .app.collapsed .side-brand-name, .app.collapsed .side-collapse { display: none; }

/* ---- sidebar ---- */
.sidebar {
  background: var(--ink);
  color: #f4ead9;
  display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh;
}
.side-head {
  display: flex; align-items: center; gap: 10px;
  padding: 18px 16px 14px;
  border-bottom: 1px solid rgba(244, 234, 217, .12);
}
.side-logo { width: 34px; height: 34px; border-radius: 50%; object-fit: cover; background: var(--gold); padding: 2px; }
.side-logo-fallback {
  width: 34px; height: 34px; border-radius: 50%; flex: 0 0 34px;
  background: var(--red); color: #fff; display: grid; place-items: center; font-weight: 800; font-size: 13px;
}
.side-head strong { display: block; font-size: .98rem; letter-spacing: .02em; }
.side-head small { color: var(--gold-soft); font-size: .72rem; opacity: .9; }
.side-collapse {
  margin-left: auto; background: none; border: 0; color: #f4ead9;
  font-size: 1rem; opacity: .6; padding: 4px;
}
.side-collapse:hover { opacity: 1; }

.side-nav { flex: 1; overflow-y: auto; padding: 10px 8px 16px; }
.side-nav .si-label { white-space: nowrap; }
.side-item {
  display: flex; align-items: center; gap: 12px;
  color: #e8ddca; text-decoration: none;
  padding: 9px 12px; margin: 2px 0;
  border-radius: 10px; font-size: .92rem;
  transition: background .12s ease, color .12s ease;
}
.side-item:hover { background: rgba(255, 255, 255, .07); color: #fff; }
.side-item.active { background: var(--red); color: #fff; box-shadow: 0 2px 8px rgba(0,0,0,.25); }
.sidebar .si-ico { width: 20px; height: 20px; display: inline-grid; place-items: center; flex: 0 0 20px; opacity: .85; }
.side-nav .si-ico svg { width: 18px; height: 18px; fill: currentColor; }
.side-sep { font-size: .68rem; text-transform: uppercase; letter-spacing: .12em; color: rgba(244,234,217,.45); padding: 14px 12px 4px; }
.app.collapsed .side-sep { display: none; }

.side-foot { border-top: 1px solid rgba(244, 234, 217, .12); padding: 8px; }

/* ---- topbar ---- */
.main-col { display: flex; flex-direction: column; min-width: 0; }
.topbar {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; gap: 14px;
  background: rgba(255, 253, 248, .92);
  backdrop-filter: blur(6px);
  border-bottom: 1px solid var(--line);
  padding: 10px 22px;
  min-height: 58px;
}
.topbar-title { display: flex; align-items: center; gap: 12px; min-width: 0; }
.topbar-title h2 { margin: 0; font-size: 1.08rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.branch-chip {
  font-size: .72rem; background: var(--cream); border: 1px solid var(--line);
  color: var(--muted); border-radius: 999px; padding: 3px 10px; white-space: nowrap;
}
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.userchip { display: flex; align-items: center; gap: 8px; font-size: .88rem; padding: 4px 8px; border-radius: 999px; }
.userchip img { border-radius: 50%; object-fit: cover; background: var(--gold-soft); }
.btn-logout {
  background: none; border: 1px solid var(--line); color: var(--ink-soft);
  border-radius: 8px; padding: 6px 12px; font-size: .82rem;
}
.btn-logout:hover { background: var(--cream); color: var(--red-deep); border-color: var(--red-deep); }
.topbar-bell { position: relative; color: var(--ink-soft); display: grid; place-items: center; padding: 6px; border-radius: 8px; }
.topbar-bell:hover { background: var(--cream); }
.notif-count {
  position: absolute; top: 0; right: 0;
  background: var(--red); color: #fff; font-size: .62rem; font-style: normal;
  border-radius: 999px; min-width: 15px; height: 15px; display: grid; place-items: center; padding: 0 3px;
}
.drawer-open { display: none; background: none; border: 0; color: var(--ink); padding: 6px; }
.drawer-backdrop { position: fixed; inset: 0; background: rgba(28,18,12,.45); z-index: 40; }

/* ---- content ---- */
.content { padding: 26px 26px 60px; max-width: 1150px; width: 100%; }
.content-head { margin-bottom: 18px; }
.content-head p.muted { margin: 0; }

.grid-kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 14px; margin-bottom: 22px; }
.kpi {
  background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px 18px; box-shadow: var(--shadow);
}
.kpi .kpi-label { font-size: .8rem; color: var(--muted); display: flex; gap: 6px; align-items: center; }
.kpi .kpi-value { font-size: 1.75rem; font-weight: 750; margin-top: 4px; letter-spacing: -.01em; }
.kpi .kpi-hint { font-size: .74rem; color: var(--muted); }

.card {
  background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 18px 20px; box-shadow: var(--shadow); margin-bottom: 20px;
}
.card > h3 { font-size: 1rem; margin-bottom: 12px; display: flex; align-items: center; gap: 8px; }
.card-sub { color: var(--muted); font-size: .86rem; margin: -6px 0 14px; }

/* filter chips */
.chips { display: flex; gap: 8px; flex-wrap: wrap; margin: 8px 0 18px; }
.chip {
  border: 1px solid var(--line); background: #fff; color: var(--ink-soft);
  border-radius: 999px; padding: 6px 14px; font-size: .84rem;
}
.chip.active { background: var(--ink); color: #fff; border-color: var(--ink); }
.chip:hover:not(.active) { border-color: var(--gold); }

/* badges */
.badge { display: inline-block; font-size: .72rem; font-weight: 600; border-radius: 999px; padding: 3px 10px; }
.badge.ok { background: #e5f3ea; color: var(--ok); }
.badge.warn { background: #fdf3e3; color: var(--warn); }
.badge.err { background: #fbeae8; color: var(--err); }
.badge.mut { background: #f1ece4; color: var(--muted); }

/* tables */
.tbl-wrap { overflow-x: auto; }
table.tbl { width: 100%; border-collapse: collapse; font-size: .9rem; }
.tbl th {
  text-align: left; font-size: .74rem; text-transform: uppercase; letter-spacing: .07em;
  color: var(--muted); padding: 10px 12px; border-bottom: 1px solid var(--line); white-space: nowrap;
}
.tbl td { padding: 11px 12px; border-bottom: 1px solid #f3ecdf; vertical-align: middle; }
.tbl tr:hover td { background: #fdfaf3; }
.tbl td.actions { text-align: right; white-space: nowrap; }
.tbl .num { font-variant-numeric: tabular-nums; }
.tbl img.thumb { width: 40px; height: 40px; border-radius: 9px; object-fit: cover; background: var(--cream); }

/* buttons */
.btn {
  display: inline-flex; align-items: center; gap: 7px;
  border: 1px solid transparent; border-radius: 9px;
  padding: 8px 15px; font-size: .87rem; font-weight: 600;
  text-decoration: none; transition: filter .12s;
}
.btn-primary { background: var(--red); color: #fff; }
.btn-primary:hover { filter: brightness(1.07); }
.btn-ghost { background: #fff; border-color: var(--line); color: var(--ink-soft); }
.btn-ghost:hover { border-color: var(--gold); }
.btn-danger { background: #fff; border-color: #f0c9c4; color: var(--err); }
.btn-danger:hover { background: var(--err); color: #fff; border-color: var(--err); }
.btn-sm { padding: 5px 10px; font-size: .78rem; border-radius: 7px; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }

.icon-btn { background: none; border: 0; padding: 6px; border-radius: 7px; color: var(--muted); line-height: 0; }
.icon-btn:hover { background: var(--cream); color: var(--ink); }
.icon-btn.danger:hover { color: var(--err); }

/* forms */
.field { margin-bottom: 14px; }
.field label { display: block; font-size: .82rem; font-weight: 600; color: var(--ink-soft); margin-bottom: 5px; }
.field input, .field select, .field textarea {
  width: 100%; border: 1px solid var(--line); border-radius: 9px;
  padding: 9px 12px; font: inherit; background: #fff; color: var(--ink);
}
.field input:focus, .field select:focus, .field textarea:focus {
  outline: 2px solid var(--gold-soft); border-color: var(--gold);
}
.field textarea { min-height: 88px; resize: vertical; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.field-hint { font-size: .76rem; color: var(--muted); margin-top: 4px; }
.form-error { color: var(--err); font-size: .85rem; margin: 6px 0 0; }
.switch { position: relative; width: 38px; height: 22px; flex: 0 0 38px; }
.switch input { position: absolute; inset: 0; opacity: 0; cursor: pointer; z-index: 1; width: 100%; height: 100%; margin: 0; }
.switch em {
  position: absolute; inset: 0; border-radius: 999px; background: #d8cdbc; transition: background .15s; border: 0;
}
.switch em::after {
  content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px;
  border-radius: 50%; background: #fff; transition: transform .15s;
}
.switch input:checked + em { background: var(--ok); }
.switch input:checked + em::after { transform: translateX(16px); }
.switch input:focus-visible + em { outline: 2px solid var(--gold); outline-offset: 2px; }

/* search + toolbar */
.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 16px; }
.toolbar input[type="search"] {
  flex: 1; min-width: 200px; border: 1px solid var(--line); border-radius: 9px; padding: 9px 13px; font: inherit; background: #fff;
}
.toolbar input[type="search"]:focus { outline: 2px solid var(--gold-soft); border-color: var(--gold); }
.toolbar select { border: 1px solid var(--line); border-radius: 9px; padding: 8px 10px; font: inherit; background: #fff; }

/* toast */
.toast-wrap { position: fixed; bottom: 22px; right: 22px; z-index: 100; display: flex; flex-direction: column; gap: 10px; }
.toast {
  background: var(--ink); color: #fff; border-radius: 10px; padding: 11px 16px;
  font-size: .88rem; box-shadow: var(--shadow); max-width: 340px;
  animation: toast-in .18s ease;
}
.toast.ok { background: #14532d; }
.toast.err { background: #7f1d1d; }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* modal */
.modal { position: fixed; inset: 0; z-index: 90; display: grid; place-items: center; padding: 20px; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(28, 18, 12, .5); }
.modal-panel {
  position: relative; width: 100%; max-width: 560px; max-height: 88vh; overflow: auto;
  background: var(--paper); border-radius: 16px; box-shadow: 0 18px 60px rgba(0,0,0,.3);
  animation: toast-in .16s ease;
}
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px 0; }
.modal-head h3 { margin: 0; font-size: 1.05rem; }
.modal-x { background: none; border: 0; font-size: 1rem; color: var(--muted); padding: 6px; }
.modal-x:hover { color: var(--ink); }
.modal-body { padding: 16px 20px 20px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 18px; }

/* empty states */
.empty {
  text-align: center; padding: 36px 20px; color: var(--muted);
  border: 1.5px dashed var(--line); border-radius: var(--radius); background: #fdfaf4;
}
.empty .empty-ico { font-size: 1.6rem; margin-bottom: 8px; }
.empty strong { color: var(--ink-soft); display: block; margin-bottom: 4px; }
.empty p { margin: 0; font-size: .88rem; }

/* charts */
.bars { display: flex; align-items: flex-end; gap: 6px; height: 150px; padding-top: 10px; }
.bars .bar-col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 4px; min-width: 0; }
.bars .bar {
  width: 100%; max-width: 38px; background: linear-gradient(180deg, var(--gold) 0%, var(--red) 100%);
  border-radius: 6px 6px 2px 2px; min-height: 2px;
}
.bars .bar-lab { font-size: .62rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.legend { display: flex; gap: 16px; font-size: .78rem; color: var(--muted); margin-top: 10px; flex-wrap: wrap; }
.legend b { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 5px; }

/* seo row + misc */
.row-flex { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.mut { color: var(--muted); }
.small { font-size: .8rem; }
.mono { font-family: ui-monospace, Consolas, monospace; font-size: .82rem; }
.pv-note {
  background: #fdf8ee; border: 1px solid var(--gold-soft); color: #7a5a1e;
  border-radius: 10px; padding: 10px 14px; font-size: .84rem; margin-bottom: 16px;
}
.divider { height: 1px; background: var(--line); margin: 18px 0; }
.tabs { display: flex; gap: 6px; border-bottom: 1px solid var(--line); margin-bottom: 16px; flex-wrap: wrap; }
.tab {
  background: none; border: 0; padding: 9px 15px; font-size: .88rem; color: var(--muted);
  border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.tab.active { color: var(--red-deep); border-bottom-color: var(--red); font-weight: 600; }

/* loader */
.spinner {
  width: 15px; height: 15px; border: 2px solid rgba(255,255,255,.35); border-top-color: #fff;
  border-radius: 50%; animation: spin .7s linear infinite; display: inline-block; vertical-align: -2px;
}
.spinner.dark { border-color: rgba(28,18,12,.2); border-top-color: var(--ink); }
@keyframes spin { to { transform: rotate(360deg); } }
.loading-block { display: grid; place-items: center; padding: 60px 0; color: var(--muted); gap: 10px; }

/* activity log list */
.log-list { list-style: none; margin: 0; padding: 0; }
.log-list li { display: flex; gap: 12px; padding: 8px 2px; border-bottom: 1px dashed #f0e7d8; font-size: .84rem; align-items: baseline; }
.log-list time { color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; flex: 0 0 130px; font-size: .76rem; }
.log-list .log-actor { color: var(--ink-soft); font-weight: 600; }

/* ============================ RESPONSIVE ============================ */
@media (max-width: 980px) {
  .app { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed; z-index: 50; width: var(--sidebar-w);
    transform: translateX(-100%); transition: transform .2s ease;
  }
  .sidebar.open { transform: none; }
  .app.collapsed .si-label, .app.collapsed .side-brand-name { display: block; }
  .app.collapsed { grid-template-columns: 1fr; }
  .drawer-open { display: grid; place-items: center; }
  .content { padding: 18px 14px 50px; }
  .field-row { grid-template-columns: 1fr; }
  .userchip span { display: none; }
  .login-card { padding: 30px 22px 24px; }
}
@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}
