/* Panchang admin console — clean, modern, light-first with dark mode. */
:root {
  --bg: #f7f7f8; --card: #ffffff; --soft: #f4f4f5; --line: #ececee; --line-strong: #e1e1e5;
  --ink: #18181b; --ink-2: #3f3f46; --muted: #71717a;
  --accent: #ea580c; --accent-soft: #fff1e8; --accent-ink: #ffffff;
  --good: #16a34a; --good-soft: #ecfdf3; --bad: #dc2626; --bad-soft: #fef2f2; --warn: #d97706; --warn-soft: #fffbeb;
  --info: #2563eb; --info-soft: #eff6ff;
  --r-sm: 10px; --r: 14px; --r-lg: 20px;
  --shadow: 0 1px 2px rgba(24, 24, 27, .04), 0 8px 24px rgba(24, 24, 27, .05);
  --shadow-lg: 0 24px 64px rgba(24, 24, 27, .18);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0c0c0e; --card: #151518; --soft: #1c1c20; --line: #232328; --line-strong: #2e2e34;
    --ink: #f4f4f5; --ink-2: #d4d4d8; --muted: #a1a1aa;
    --accent: #fb7a2e; --accent-soft: #2a1709; --accent-ink: #0c0c0e;
    --good-soft: #0d2617; --bad-soft: #2a0f0f; --warn-soft: #2a1d07; --info-soft: #0e1a33;
    --shadow: none; --shadow-lg: 0 24px 64px rgba(0, 0, 0, .6);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink); font: 14px/1.5 Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; -webkit-font-smoothing: antialiased; }
[hidden] { display: none !important; }
.muted { color: var(--muted); }
h1, h2, h3, p { margin: 0; }
a { color: inherit; }
.ic { width: 18px; height: 18px; flex: none; }

/* Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 36px; padding: 0 14px; border-radius: var(--r-sm); border: 1px solid var(--line-strong); background: var(--card); color: var(--ink); font: inherit; font-weight: 600; cursor: pointer; transition: background .15s, border-color .15s, transform .05s; white-space: nowrap; }
.btn:hover { background: var(--soft); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: default; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .2); }
.btn.primary:hover { filter: brightness(.96); }
.btn.good { background: var(--good); border-color: var(--good); color: #fff; }
.btn.danger { color: var(--bad); border-color: color-mix(in srgb, var(--bad) 30%, var(--line-strong)); }
.btn.danger:hover { background: var(--bad-soft); }
.btn.danger.solid { background: var(--bad); color: #fff; border-color: var(--bad); }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.sm { height: 30px; padding: 0 10px; font-size: 13px; border-radius: 8px; }
.btn.lg { height: 44px; font-size: 15px; }
.btn.block { width: 100%; }
.icon-btn { width: 36px; height: 36px; display: grid; place-items: center; border-radius: var(--r-sm); border: 1px solid var(--line-strong); background: var(--card); color: var(--ink-2); cursor: pointer; }
.icon-btn:hover { background: var(--soft); }
input, textarea, select { font: inherit; color: var(--ink); background: var(--card); border: 1px solid var(--line-strong); border-radius: var(--r-sm); padding: 9px 12px; width: 100%; }
input:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent); }

/* Sign in */
.login { min-height: 100vh; display: grid; place-items: center; padding: 16px; background: radial-gradient(1200px 600px at 50% -10%, var(--accent-soft), transparent 70%), var(--bg); }
.login-card { width: min(400px, 100%); background: var(--card); border: 1px solid var(--line); border-radius: 24px; padding: 36px 32px; display: grid; gap: 20px; box-shadow: var(--shadow-lg); }
.login-card h1 { font-size: 22px; letter-spacing: -.3px; }
.field { display: grid; gap: 6px; font-size: 13px; font-weight: 600; color: var(--ink-2); }
.form-error { color: var(--bad); font-weight: 500; }
.brand-mark { width: 36px; height: 36px; border-radius: 11px; display: grid; place-items: center; color: #fff; font-size: 18px; background: linear-gradient(135deg, #fb923c, #ea580c); box-shadow: 0 6px 16px rgba(234, 88, 12, .3); }
.brand-mark.lg { width: 52px; height: 52px; font-size: 26px; border-radius: 15px; }
img.brand-mark { display: block; object-fit: cover; background: none; }

/* Shell */
.shell { display: grid; grid-template-columns: 252px 1fr; min-height: 100vh; }
.side { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: 8px; padding: 20px 14px; background: var(--card); border-right: 1px solid var(--line); }
.brand { display: flex; gap: 10px; align-items: center; padding: 4px 8px 16px; }
.brand div { display: grid; line-height: 1.25; }
.brand b { font-size: 15px; }
.brand span { font-size: 12px; color: var(--muted); }
#nav { display: grid; gap: 2px; flex: 1; align-content: start; }
.nav-label { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); padding: 14px 12px 6px; }
#nav button, #nav a, .nav-foot { display: flex; align-items: center; gap: 10px; height: 38px; padding: 0 12px; border-radius: var(--r-sm); border: 0; background: none; font: inherit; font-weight: 500; color: var(--ink-2); cursor: pointer; text-decoration: none; text-align: left; position: relative; }
#nav button:hover, #nav a:hover, .nav-foot:hover { background: var(--soft); color: var(--ink); }
#nav .on { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
#nav .on::before { content: ""; position: absolute; left: -14px; top: 9px; bottom: 9px; width: 3px; border-radius: 0 3px 3px 0; background: var(--accent); }
.badge { margin-left: auto; font-style: normal; background: var(--bad); color: #fff; border-radius: 99px; min-width: 20px; height: 20px; padding: 0 6px; font-size: 11px; font-weight: 700; display: grid; place-items: center; }
.nav-foot { color: var(--muted); }

.main { min-width: 0; padding: 28px clamp(16px, 3.2vw, 40px) 64px; max-width: 1240px; width: 100%; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }
.page-head h1 { font-size: 24px; letter-spacing: -.4px; line-height: 1.2; }
.page-head p { margin-top: 2px; }
.tools { display: flex; gap: 8px; align-items: center; }
.search { display: flex; align-items: center; gap: 8px; height: 36px; padding: 0 12px; width: 280px; background: var(--card); border: 1px solid var(--line-strong); border-radius: var(--r-sm); color: var(--muted); }
.search:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent); }
.search input { border: 0; padding: 0; box-shadow: none !important; background: transparent; }

/* Segmented tabs */
.tabs { display: inline-flex; gap: 2px; padding: 3px; margin-bottom: 20px; background: var(--soft); border: 1px solid var(--line); border-radius: 12px; }
.tabs button { height: 30px; padding: 0 14px; border: 0; border-radius: 9px; background: none; font: inherit; font-weight: 500; color: var(--muted); cursor: pointer; display: inline-flex; align-items: center; gap: 6px; }
.tabs button.on { background: var(--card); color: var(--ink); font-weight: 600; box-shadow: 0 1px 3px rgba(24, 24, 27, .08); }
.tabs .count { font-size: 11px; font-weight: 700; padding: 0 6px; border-radius: 99px; background: var(--line); color: var(--ink-2); }

/* Cards & sections */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow); }
.section-title { display: flex; align-items: baseline; justify-content: space-between; margin: 32px 0 12px; }
.section-title h2 { font-size: 15px; font-weight: 600; }
.grid { display: grid; gap: 16px; }
.grid.kpi { grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); }
.grid.two { grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); }

.kpi-card { padding: 18px 20px; display: grid; gap: 14px; }
.kpi-top { display: flex; align-items: center; justify-content: space-between; color: var(--muted); font-weight: 500; }
.kpi-icon { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; background: var(--soft); color: var(--ink-2); }
.kpi-value { font-size: 28px; font-weight: 700; letter-spacing: -.6px; line-height: 1; font-variant-numeric: tabular-nums; }
.kpi-sub { font-size: 12px; color: var(--muted); }
.kpi-sub .up { color: var(--good); font-weight: 600; }

.attention { padding: 18px 20px; display: flex; gap: 14px; align-items: center; cursor: pointer; transition: transform .12s, box-shadow .12s; }
.attention:hover { transform: translateY(-1px); box-shadow: 0 12px 32px rgba(24, 24, 27, .08); }
.attention .dot { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; flex: none; }
.attention.bad .dot { background: var(--bad-soft); color: var(--bad); }
.attention.warn .dot { background: var(--warn-soft); color: var(--warn); }
.attention.info .dot { background: var(--info-soft); color: var(--info); }
.attention.calm .dot { background: var(--good-soft); color: var(--good); }
.attention b { font-size: 22px; line-height: 1.1; display: block; font-variant-numeric: tabular-nums; }
.attention .grow { flex: 1; }
.attention .go { color: var(--muted); }

/* Lists */
.list-row { display: flex; align-items: center; gap: 12px; padding: 12px 20px; border-top: 1px solid var(--line); }
.list-row:first-child { border-top: 0; }
.list-row .grow { flex: 1; min-width: 0; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px; border-bottom: 1px solid var(--line); }
.card-head h3 { font-size: 15px; }

.avatar { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; font-size: 14px; flex: none; color: var(--accent); background: var(--accent-soft); }
.avatar.lg { width: 56px; height: 56px; font-size: 22px; }
.name { font-weight: 600; }
.meta { color: var(--muted); font-size: 12.5px; }

/* Table */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th { text-align: left; font-size: 12px; font-weight: 600; color: var(--muted); padding: 12px 20px; border-bottom: 1px solid var(--line); background: var(--soft); white-space: nowrap; }
th:first-child { border-top-left-radius: var(--r-lg); }
th:last-child { border-top-right-radius: var(--r-lg); }
td { padding: 12px 20px; border-bottom: 1px solid var(--line); vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
tbody tr { cursor: pointer; transition: background .1s; }
tbody tr:hover { background: var(--soft); }
.num { font-variant-numeric: tabular-nums; text-align: right; }
th.num { text-align: right; }

/* Badges */
.pill { display: inline-flex; align-items: center; gap: 5px; height: 22px; padding: 0 9px; border-radius: 99px; font-size: 12px; font-weight: 600; white-space: nowrap; background: var(--soft); color: var(--ink-2); }
.pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .8; }
.pill.plain::before { display: none; }
.pill.good { background: var(--good-soft); color: var(--good); }
.pill.bad { background: var(--bad-soft); color: var(--bad); }
.pill.warn { background: var(--warn-soft); color: var(--warn); }
.pill.info { background: var(--info-soft); color: var(--info); }

/* Moderation cards */
.mod-card { padding: 20px; display: grid; gap: 14px; }
.mod-head { display: flex; align-items: center; gap: 12px; }
.mod-head .grow { flex: 1; min-width: 0; }
.mod-body { display: flex; gap: 14px; }
.mod-body img { width: 120px; height: 90px; object-fit: cover; border-radius: 12px; flex: none; border: 1px solid var(--line); }
.mod-text { white-space: pre-wrap; word-break: break-word; color: var(--ink-2); }
.quote { background: var(--soft); border-left: 3px solid var(--accent); border-radius: 0 12px 12px 0; padding: 12px 14px; color: var(--ink-2); white-space: pre-wrap; }
.tags { display: flex; flex-wrap: wrap; gap: 6px; }
.mod-actions { display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; padding-top: 14px; border-top: 1px solid var(--line); }
.stack { display: grid; gap: 12px; }

/* Empty & loading */
.empty { padding: 64px 24px; text-align: center; display: grid; justify-items: center; gap: 8px; }
.empty .glyph { width: 56px; height: 56px; border-radius: 16px; display: grid; place-items: center; background: var(--good-soft); color: var(--good); margin-bottom: 6px; }
.empty .glyph .ic { width: 26px; height: 26px; }
.empty b { font-size: 15px; }
.skeleton { display: grid; gap: 12px; }
.skeleton div { height: 72px; border-radius: var(--r-lg); background: linear-gradient(90deg, var(--soft), var(--line), var(--soft)); background-size: 200% 100%; animation: shimmer 1.2s infinite; }
@keyframes shimmer { to { background-position: -200% 0; } }

/* Drawer */
.drawer { border: 0; padding: 0; margin: 0 0 0 auto; height: 100vh; max-height: 100vh; width: min(520px, 100vw); background: var(--bg); color: var(--ink); box-shadow: var(--shadow-lg); }
.drawer[open] { animation: slide .22s ease-out; }
@keyframes slide { from { transform: translateX(24px); opacity: 0; } }
.drawer::backdrop { background: rgba(9, 9, 11, .35); backdrop-filter: blur(2px); }
#drawerBody { display: grid; gap: 16px; padding: 20px; }
.drawer-top { display: flex; justify-content: flex-end; }
.profile { padding: 24px; display: grid; justify-items: center; gap: 6px; text-align: center; }
.profile h2 { font-size: 20px; }
.profile-actions { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; justify-content: center; }
.stats-row { display: grid; grid-template-columns: repeat(3, 1fr); border-top: 1px solid var(--line); width: 100%; margin-top: 14px; padding-top: 14px; }
.stats-row b { display: block; font-size: 18px; }

/* Modal */
.modal { border: 0; padding: 0; border-radius: 20px; width: min(440px, calc(100vw - 32px)); background: var(--card); color: var(--ink); box-shadow: var(--shadow-lg); }
.modal::backdrop { background: rgba(9, 9, 11, .4); backdrop-filter: blur(2px); }
.modal form { padding: 24px; display: grid; gap: 12px; }
.modal h3 { font-size: 17px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 8px; }

/* Toasts */
.toasts { position: fixed; top: 20px; right: 20px; display: grid; gap: 8px; z-index: 20; }
.toast { display: flex; align-items: center; gap: 10px; min-width: 260px; background: var(--card); color: var(--ink); border: 1px solid var(--line); border-left: 4px solid var(--good); padding: 12px 16px; border-radius: 12px; font-weight: 500; box-shadow: var(--shadow-lg); animation: pop .2s ease-out; }
.toast.err { border-left-color: var(--bad); }
@keyframes pop { from { transform: translateY(-6px); opacity: 0; } }

/* Phones: navigation becomes a bottom bar */
.show-sm { display: none; }
@media (max-width: 800px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: fixed; inset: auto 0 0 0; height: auto; flex-direction: row; padding: 6px 8px calc(6px + env(safe-area-inset-bottom)); border-right: 0; border-top: 1px solid var(--line); z-index: 10; }
  .brand, .nav-label, .nav-foot { display: none; }
  #nav { display: flex; justify-content: space-around; gap: 0; }
  #nav button, #nav a { flex-direction: column; height: auto; gap: 2px; font-size: 11px; padding: 6px 4px; min-width: 0; flex: 1; }
  #nav .on::before { display: none; }
  .badge { position: absolute; top: 0; right: 4px; min-width: 16px; height: 16px; font-size: 10px; }
  .main { padding-bottom: 100px; }
  .page-head { align-items: flex-start; flex-wrap: nowrap; }
  .page-head:has(.search:not([hidden])) { flex-wrap: wrap; }
  .search { flex: 1; width: auto; }
  .tools { flex: none; }
  .page-head:has(.search:not([hidden])) .tools { width: 100%; }
  .toasts { left: 16px; right: 16px; top: auto; bottom: 90px; }
  .mod-body { flex-direction: column; }
  .mod-body img { width: 100%; height: 180px; }
  .hide-sm { display: none; }
  .show-sm { display: inline; }
}

.login-logo { display: block; width: 100%; aspect-ratio: 3 / 2; object-fit: cover; border-radius: 16px; background: #000; }
