/* Media Server panel: one stylesheet for landing, auth, dashboard and admin pages. */

:root {
  --bg: #f6f7f9;
  --surface: #ffffff;
  --surface-2: #f1f3f6;
  --text: #16191f;
  --muted: #5d6573;
  --border: #e1e4ea;
  --accent: #2458e6;
  --accent-hover: #1c47bd;
  --accent-soft: #e8eefd;
  --accent-text: #ffffff;
  --ok: #17803d;
  --ok-soft: #e6f4ea;
  --warn: #9a6200;
  --warn-soft: #fff4dc;
  --bad: #c42b2b;
  --bad-soft: #fdecec;
  --info: #5b3cc4;
  --info-soft: #efeafd;
  --code-bg: #0f1623;
  --code-text: #dfe6f2;
  --radius: 10px;
  --shadow: 0 1px 2px rgb(16 24 40 / 0.05);
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0e1116;
    --surface: #161a21;
    --surface-2: #1c212a;
    --text: #e7eaf0;
    --muted: #97a0ae;
    --border: #2a303b;
    --accent: #6b93ff;
    --accent-hover: #86a7ff;
    --accent-soft: #1b2744;
    --accent-text: #0b1020;
    --ok: #4cc27a;
    --ok-soft: #13291c;
    --warn: #e3b04b;
    --warn-soft: #2d2412;
    --bad: #ff7676;
    --bad-soft: #341818;
    --info: #b3a2ff;
    --info-soft: #221c3d;
    --code-bg: #0a0d12;
    --shadow: none;
    color-scheme: dark;
  }
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.6 "Hind Siliguri", "Noto Sans Bengali", system-ui, -apple-system, "Segoe UI", sans-serif;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { line-height: 1.3; margin: 0 0 0.5em; }
h1 { font-size: 1.6rem; }
h2 { font-size: 1.15rem; }
h3 { font-size: 1rem; }
p { margin: 0 0 1em; }
code {
  font: 0.86em ui-monospace, SFMono-Regular, Consolas, monospace;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: 0.05em 0.35em;
  overflow-wrap: anywhere;
}
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.muted { color: var(--muted); }
.center { text-align: center; }
.prewrap { white-space: pre-wrap; overflow-wrap: anywhere; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.hp { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }
.inline { display: inline; }

/* ---- Top bar ---- */
.topbar { background: var(--surface); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 10; }
.topbar-inner { max-width: 1200px; margin: 0 auto; padding: 10px 16px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.brand { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 1.1rem; color: var(--text); }
.brand:hover { text-decoration: none; }
.brand-mark { color: var(--accent); font-size: 1.3rem; }
.topnav { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.topnav > a:not(.btn) { color: var(--muted); }
.whoami { color: var(--muted); font-size: 0.95rem; }
.app .topbar-inner { max-width: 1320px; }

/* ---- Buttons ---- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 8px 16px; border-radius: 8px; border: 1px solid transparent;
  font: inherit; font-weight: 600; line-height: 1.4; cursor: pointer; text-decoration: none;
}
.btn:hover { text-decoration: none; }
.btn-primary { background: var(--accent); color: var(--accent-text); }
.btn-primary:hover { background: var(--accent-hover); }
.btn-ghost { background: transparent; color: var(--text); border-color: var(--border); }
.btn-ghost:hover { background: var(--surface-2); }
.btn-danger { background: var(--bad); color: #fff; }
.btn-danger-ghost { background: transparent; color: var(--bad); border-color: var(--border); }
.btn-danger-ghost:hover { background: var(--bad-soft); }
.btn-link { color: var(--accent); background: none; padding-left: 4px; padding-right: 4px; }
.btn-sm { padding: 4px 10px; font-size: 0.875rem; }
.btn-lg { padding: 11px 22px; font-size: 1.05rem; }
.btn-block { width: 100%; }

/* ---- Cards, alerts, badges ---- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; margin-bottom: 16px; box-shadow: var(--shadow); min-width: 0; }
.card-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; margin-bottom: 8px; }
.card-head h2 { margin: 0; }
.alert { border-radius: 8px; padding: 12px 14px; margin-bottom: 16px; border: 1px solid transparent; overflow-wrap: anywhere; }
.alert-ok { background: var(--ok-soft); color: var(--ok); border-color: color-mix(in srgb, var(--ok) 25%, transparent); }
.alert-warn { background: var(--warn-soft); color: var(--warn); border-color: color-mix(in srgb, var(--warn) 25%, transparent); }
.alert-bad { background: var(--bad-soft); color: var(--bad); border-color: color-mix(in srgb, var(--bad) 25%, transparent); }
.alert a { color: inherit; text-decoration: underline; }
.badge { display: inline-block; font-size: 0.78rem; font-weight: 600; padding: 2px 9px; border-radius: 999px; vertical-align: middle; white-space: nowrap; }
.badge-ok { background: var(--ok-soft); color: var(--ok); }
.badge-warn { background: var(--warn-soft); color: var(--warn); }
.badge-bad { background: var(--bad-soft); color: var(--bad); }
.badge-muted { background: var(--surface-2); color: var(--muted); }
.badge-info { background: var(--info-soft); color: var(--info); }

/* ---- Public pages ---- */
.public-main { max-width: 1200px; margin: 0 auto; padding: 32px 16px 56px; }
.hero { display: grid; grid-template-columns: 1.1fr 1fr; gap: 40px; align-items: center; padding: 24px 0 40px; }
.hero h1 { font-size: 2.3rem; }
.eyebrow { color: var(--accent); font-weight: 600; margin-bottom: 8px; }
.lead { font-size: 1.1rem; color: var(--muted); }
.hero-cta { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.hero-code pre { background: var(--code-bg); color: var(--code-text); border-radius: 12px; padding: 22px; overflow-x: auto; margin: 0; font-size: 0.9rem; }
.hero-code code { background: none; border: 0; color: inherit; padding: 0; }
.section { padding: 28px 0; }
.section-title { font-size: 1.4rem; text-align: center; margin-bottom: 24px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.feature { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; }
.feature-icon { display: inline-grid; place-items: center; width: 40px; height: 40px; border-radius: 10px; background: var(--accent-soft); color: var(--accent); font-size: 1.2rem; margin-bottom: 10px; }
.feature p { color: var(--muted); margin: 0; }
.steps { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 12px; counter-reset: none; }
.steps li { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; display: flex; flex-direction: column; gap: 4px; }
.steps li span:last-child { color: var(--muted); font-size: 0.92rem; }
.step-no { display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; background: var(--accent); color: var(--accent-text); font-weight: 700; }
.footer { border-top: 1px solid var(--border); color: var(--muted); font-size: 0.9rem; }
.auth-card { max-width: 440px; margin: 16px auto; padding: 28px; }
.narrow { max-width: 520px; margin: 24px auto; }
.err-code { font-size: 3rem; font-weight: 800; color: var(--accent); }

/* ---- Dashboard shell ---- */
.shell { max-width: 1320px; margin: 0 auto; display: grid; grid-template-columns: 250px minmax(0, 1fr); gap: 24px; padding: 20px 16px 48px; }
.sidebar { position: sticky; top: 72px; align-self: start; display: flex; flex-direction: column; gap: 18px; }
.nav-group { display: flex; flex-direction: column; gap: 2px; }
.nav-title { font-size: 0.78rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); padding: 0 10px 4px; }
.sidebar a { display: flex; justify-content: space-between; align-items: center; padding: 7px 10px; border-radius: 8px; color: var(--text); }
.sidebar a:hover { background: var(--surface-2); text-decoration: none; }
.sidebar a.active { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.count { background: var(--bad); color: #fff; border-radius: 999px; font-size: 0.75rem; padding: 0 7px; font-weight: 700; }
.content { min-width: 0; }
.page-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; margin-bottom: 16px; flex-wrap: wrap; }
.page-head h1 { margin-bottom: 4px; }
.page-head p { margin: 0; }
.crumbs { margin: 0 0 4px; font-size: 0.9rem; color: var(--muted); }

.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 16px; }
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; display: flex; flex-direction: column; gap: 2px; color: var(--text); }
.stat-link:hover { border-color: var(--accent); text-decoration: none; }
.stat-attn { border-color: var(--warn); background: var(--warn-soft); }
.stat-label { color: var(--muted); font-size: 0.9rem; }
.stat-value { font-size: 1.7rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.stat-sub { color: var(--muted); font-size: 0.85rem; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; align-items: start; }
.grid-2 > .card { margin-bottom: 0; }
.grid-2 { margin-bottom: 16px; }

.onboarding { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.onboarding li { display: flex; align-items: center; gap: 10px; }
.onboarding .dot { width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--border); display: inline-grid; place-items: center; font-size: 0.8rem; flex: none; }
.onboarding li.done { color: var(--muted); }
.onboarding li.done .dot { background: var(--ok); border-color: var(--ok); color: #fff; }
.empty { text-align: center; padding: 24px; color: var(--muted); }

/* ---- Tables ---- */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 0.95rem; }
.table th { text-align: left; font-weight: 600; color: var(--muted); font-size: 0.85rem; border-bottom: 1px solid var(--border); padding: 8px 10px; white-space: nowrap; }
.table td { border-bottom: 1px solid var(--border); padding: 10px; vertical-align: top; }
.table tr:last-child td { border-bottom: 0; }
.table-compact td { padding: 6px 10px; font-size: 0.9rem; }
.clip { max-width: 320px; overflow-wrap: anywhere; }
.kv { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 8px 16px; margin: 12px 0; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; overflow-wrap: anywhere; }
.pager { display: flex; justify-content: space-between; align-items: center; padding-top: 12px; }
.filter-tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 12px; }
.filter-tabs a { padding: 6px 14px; border-radius: 999px; border: 1px solid var(--border); color: var(--text); background: var(--surface); }
.filter-tabs a.active { background: var(--accent); color: var(--accent-text); border-color: var(--accent); }
.search { display: flex; gap: 8px; }
.search input { min-width: 260px; }
.actions { display: flex; flex-direction: column; gap: 10px; align-items: flex-start; }

/* ---- Forms ---- */
.form-card { max-width: 760px; }
.field { margin-bottom: 16px; border: 0; padding: 0; min-width: 0; }
.field label, .field legend { display: block; font-weight: 600; margin-bottom: 6px; }
.req { color: var(--bad); }
input[type="text"], input[type="email"], input[type="password"], input[type="url"], input[type="number"], input[type="search"], select, textarea {
  width: 100%; font: inherit; color: var(--text); background: var(--surface);
  border: 1px solid var(--border); border-radius: 8px; padding: 9px 12px;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: 0; border-color: var(--accent); }
input:disabled { background: var(--surface-2); color: var(--muted); }
textarea { resize: vertical; }
.has-error input, .has-error textarea, .has-error select { border-color: var(--bad); }
.hint { color: var(--muted); font-size: 0.88rem; margin: 6px 0 0; }
.error { color: var(--bad); font-size: 0.9rem; margin: 6px 0 0; }
.checks { display: grid; gap: 8px; }
.check { display: flex; gap: 10px; align-items: flex-start; font-weight: normal !important; cursor: pointer; }
.check input { margin-top: 5px; }
.check small { color: var(--muted); }
.form-actions { display: flex; gap: 10px; }
.inline-form { display: flex; align-items: center; gap: 8px; }
.inline-form select { width: auto; }

/* ---- Usage bar ---- */
.usage { margin: 8px 0 12px; }
.usage-bar { height: 10px; background: var(--surface-2); border-radius: 999px; overflow: hidden; border: 1px solid var(--border); }
.usage-fill { display: block; height: 100%; border-radius: 999px; }
.usage-ok { background: var(--ok); }
.usage-warn { background: var(--warn); }
.usage-bad { background: var(--bad); }
.usage-text { font-size: 0.88rem; color: var(--muted); margin-top: 4px; }
.w-0 { width: 0; } .w-5 { width: 5%; } .w-10 { width: 10%; } .w-15 { width: 15%; } .w-20 { width: 20%; }
.w-25 { width: 25%; } .w-30 { width: 30%; } .w-35 { width: 35%; } .w-40 { width: 40%; } .w-45 { width: 45%; }
.w-50 { width: 50%; } .w-55 { width: 55%; } .w-60 { width: 60%; } .w-65 { width: 65%; } .w-70 { width: 70%; }
.w-75 { width: 75%; } .w-80 { width: 80%; } .w-85 { width: 85%; } .w-90 { width: 90%; } .w-95 { width: 95%; } .w-100 { width: 100%; }

/* ---- Code blocks & tabs ---- */
.code { background: var(--code-bg); border-radius: 10px; overflow: hidden; margin: 12px 0; }
.code-head { display: flex; justify-content: space-between; align-items: center; padding: 6px 10px 6px 14px; color: #8b96a8; font-size: 0.8rem; border-bottom: 1px solid #1f2836; }
.code pre { margin: 0; padding: 14px; overflow-x: auto; color: var(--code-text); font-size: 0.86rem; line-height: 1.55; }
.code code { background: none; border: 0; padding: 0; color: inherit; overflow-wrap: normal; }
.copy { background: transparent; border: 1px solid #334055; color: #cdd6e4; border-radius: 6px; padding: 2px 10px; font: inherit; font-size: 0.8rem; cursor: pointer; }
.copy:hover { background: #1c2533; }
.file-actions .copy { color: var(--text); border-color: var(--border); }
.tab-list { display: flex; gap: 4px; flex-wrap: wrap; border-bottom: 1px solid var(--border); margin-top: 8px; }
.tab { background: none; border: 0; border-bottom: 2px solid transparent; padding: 8px 12px; font: inherit; color: var(--muted); cursor: pointer; }
.tab[aria-selected="true"] { color: var(--accent); border-bottom-color: var(--accent); font-weight: 600; }
.tab-list:not(.ready) { display: none; }
.tab-panel[hidden] { display: none; }

/* ---- Guide ---- */
.guide { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 20px; align-items: start; }
.toc { position: sticky; top: 72px; font-size: 0.92rem; }
.toc ol { padding-left: 1.2em; margin: 8px 0 0; }
.toc li { margin: 4px 0; }
.guide-body h2 { scroll-margin-top: 80px; }
.checklist { padding-left: 1.2em; }
.checklist li { margin: 6px 0; }
.key-reveal .code pre { font-size: 1rem; }

/* ---- File manager ---- */
.file-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 14px; }
.file-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; display: flex; flex-direction: column; }
.file-thumb { aspect-ratio: 4 / 3; background: var(--surface-2); display: grid; place-items: center; }
.file-thumb img { width: 100%; height: 100%; object-fit: cover; }
.pdf-icon { font-weight: 800; color: var(--bad); border: 2px solid var(--bad); border-radius: 6px; padding: 6px 10px; }
.file-meta { padding: 10px 12px 4px; display: flex; flex-direction: column; gap: 2px; font-size: 0.9rem; min-width: 0; }
.file-meta strong { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.file-actions { display: flex; justify-content: space-between; gap: 6px; padding: 8px 12px 12px; margin-top: auto; }

/* ---- Responsive ---- */
@media (max-width: 960px) {
  .hero { grid-template-columns: 1fr; }
  .grid-3 { grid-template-columns: 1fr 1fr; }
  .steps { grid-template-columns: 1fr 1fr; }
  .shell { grid-template-columns: 1fr; }
  .sidebar { position: static; flex-direction: row; overflow-x: auto; gap: 8px; }
  .nav-group { flex-direction: row; gap: 4px; align-items: center; }
  .nav-title { display: none; }
  .sidebar a { white-space: nowrap; }
  .stats { grid-template-columns: 1fr 1fr; }
  .grid-2 { grid-template-columns: 1fr; }
  .guide { grid-template-columns: 1fr; }
  .toc { position: static; }
}

@media (max-width: 600px) {
  .hero h1 { font-size: 1.7rem; }
  .grid-3, .steps { grid-template-columns: 1fr; }
  .whoami { display: none; }
  .search { width: 100%; }
  .search input { min-width: 0; }
  .kv { grid-template-columns: 1fr; gap: 2px; }
  .kv dd { margin-bottom: 8px; }
  .auth-card { padding: 20px; }
}

/* ---- Account recovery & verification ---- */
.forgot { text-align: right; margin: -6px 0 14px; font-size: 0.92rem; }
.big-icon { display: inline-grid; place-items: center; width: 56px; height: 56px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); font-size: 1.6rem; margin-bottom: 8px; }
.verify-banner { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.verify-banner .btn { color: var(--text); }
.head-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.verified { color: var(--ok); font-weight: 700; }
.mt { margin-top: 20px; }
.small { font-size: 0.85rem; margin-top: 10px; }
