/* Flythrough — admin panel */
@font-face { font-family: "Bricolage Grotesque"; src: url("../fonts/bricolage.woff2") format("woff2"); font-weight: 200 800; font-display: swap; }
@font-face { font-family: "Instrument Sans"; src: url("../fonts/instrument-sans.woff2") format("woff2"); font-weight: 400 700; font-display: swap; }
@font-face { font-family: "Hind Siliguri"; src: url("../fonts/hind-siliguri-400.woff2") format("woff2"); font-weight: 400; font-display: swap; unicode-range: U+0951-0952, U+0964-0965, U+0980-09FE, U+200C-200D, U+25CC; }
@font-face { font-family: "Hind Siliguri"; src: url("../fonts/hind-siliguri-600.woff2") format("woff2"); font-weight: 500 800; font-display: swap; unicode-range: U+0951-0952, U+0964-0965, U+0980-09FE, U+200C-200D, U+25CC; }

:root {
  --ink: #10151B; --ink-2: #1A222C; --paper: #F6F3EC; --card: #FFFFFF; --text: #1B2129; --muted: #667080; --line: #E3DED3; --line-2: #D2CCBE;
  --accent: #E9A23B; --accent-ink: #7A4A05; --good: #1F7A4D; --good-bg: #E5F3EA; --bad: #B3261E; --bad-bg: #FBE9E7; --info-bg: #EEF2F7;
  --display: "Bricolage Grotesque", "Hind Siliguri", system-ui, sans-serif;
  --body: "Instrument Sans", "Hind Siliguri", system-ui, sans-serif;
  --r: 10px;
}
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--paper); color: var(--text); font: 400 .95rem/1.55 var(--body); -webkit-font-smoothing: antialiased; }
h1, h2, h3, p, ul, ol, dl, dd, figure { margin: 0; padding: 0; }
ul, ol { list-style: none; }
a { color: inherit; }
img { max-width: 100%; display: block; }
button, input, textarea, select { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
[x-cloak] { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.nowrap { white-space: nowrap; }
.right { text-align: right; }
.grow { flex: 1; min-width: 0; }

/* ---------- shell ---------- */
.shell { display: grid; grid-template-columns: 15.5rem minmax(0, 1fr); min-height: 100vh; }
.side { background: var(--ink); color: #E9E4D9; padding: 1.25rem .85rem; position: sticky; top: 0; height: 100vh; overflow: auto; display: flex; flex-direction: column; gap: 1.5rem; }
.side-brand { display: flex; align-items: center; gap: .6rem; padding: .25rem .6rem; font: 600 1.2rem/1.1 var(--display); text-decoration: none; }
.side-brand svg { width: 1.4rem; height: 1.4rem; color: var(--accent); flex: none; }
.side-brand small { display: block; font: 400 .72rem/1.2 var(--body); color: #8D97A5; margin-top: .15rem; }
.side nav { display: grid; gap: .15rem; }
.side h2 { font-size: .72rem; font-weight: 500; color: #8D97A5; padding: 0 .65rem; margin: .9rem 0 .35rem; }
.side a.item { display: flex; align-items: center; gap: .7rem; padding: .55rem .65rem; border-radius: 8px; text-decoration: none; font-weight: 500; color: #C9CED6; }
.side a.item:hover { background: var(--ink-2); color: #fff; }
.side a.item[aria-current="page"] { background: var(--ink-2); color: #fff; box-shadow: inset 2px 0 0 var(--accent); }
.side a.item svg { width: 1.1rem; height: 1.1rem; flex: none; opacity: .85; }
.side a.item b { margin-left: auto; background: var(--accent); color: var(--ink); border-radius: 999px; font-size: .72rem; padding: .05rem .45rem; }
.side-foot { margin-top: auto; display: grid; gap: .5rem; padding: .75rem .65rem 0; border-top: 1px solid #27313D; font-size: .85rem; color: #8D97A5; }
.side-foot a { color: #C9CED6; text-decoration: none; }
.side-foot a:hover { color: #fff; }
.side-foot button { background: none; border: 0; padding: 0; color: #C9CED6; cursor: pointer; text-align: left; }
.main { padding: clamp(1rem, 3vw, 2.25rem); min-width: 0; }
.topbar { display: none; }
@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: fixed; inset: 0 auto 0 0; width: 16rem; z-index: 60; transform: translateX(-100%); transition: transform .25s; }
  .nav-open .side { transform: none; box-shadow: 0 0 0 100vmax rgba(0, 0, 0, .45); }
  .topbar { display: flex; align-items: center; gap: .75rem; padding: .7rem 1rem; background: var(--ink); color: #fff; position: sticky; top: 0; z-index: 50; font: 600 1.05rem var(--display); }
  .topbar button { width: 2.5rem; height: 2.5rem; border-radius: 8px; border: 1px solid #2B3644; background: none; color: #fff; cursor: pointer; }
}

/* ---------- page ---------- */
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 1rem; margin-bottom: 1.5rem; }
.page-head h1 { font: 600 clamp(1.5rem, 2.6vw, 2rem)/1.15 var(--display); letter-spacing: -.02em; }
.page-head p { color: var(--muted); margin-top: .3rem; max-width: 46rem; }
.crumbs { font-size: .85rem; color: var(--muted); margin-bottom: .4rem; }
.crumbs a { text-decoration: none; }
.crumbs a:hover { text-decoration: underline; }
.actions { display: flex; flex-wrap: wrap; gap: .5rem; margin-left: auto; align-items: center; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: clamp(1rem, 2vw, 1.5rem); }
.card + .card { margin-top: 1.25rem; }
.card h2 { font: 600 1.1rem/1.3 var(--display); margin-bottom: .25rem; }
.card h2 + p { color: var(--muted); margin-bottom: 1rem; }
.card-head { display: flex; flex-wrap: wrap; align-items: center; gap: .75rem; margin-bottom: 1rem; }
.card-head h2 { margin: 0; }
.cols { display: grid; grid-template-columns: minmax(0, 1fr) 21rem; gap: 1.25rem; align-items: start; }
.cols-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1.25rem; align-items: start; }
@media (max-width: 1100px) { .cols, .cols-2 { grid-template-columns: 1fr; } }
.stack > * + * { margin-top: 1.25rem; }

/* ---------- buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: .45rem; min-height: 2.4rem; padding: .45rem .95rem; border-radius: 8px; border: 1px solid var(--line-2); background: var(--card); font-weight: 600; font-size: .9rem; text-decoration: none; cursor: pointer; white-space: nowrap; }
.btn:hover { border-color: #B5AE9E; }
.btn-primary { background: var(--ink); border-color: var(--ink); color: #fff; }
.btn-primary:hover { background: #222C38; border-color: #222C38; }
.btn-accent { background: var(--accent); border-color: var(--accent); color: var(--ink); }
.btn-danger { color: var(--bad); }
.btn-danger:hover { border-color: var(--bad); background: var(--bad-bg); }
.btn-sm { min-height: 2rem; padding: .25rem .65rem; font-size: .82rem; }
.btn-icon { width: 2rem; min-height: 2rem; padding: 0; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.link { background: none; border: 0; padding: 0; color: var(--accent-ink); font-weight: 600; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }

/* ---------- forms ---------- */
.field { display: grid; gap: .35rem; margin-bottom: 1.1rem; align-content: start; }
.field > label, .label { font-weight: 600; font-size: .9rem; }
.field .help { color: var(--muted); font-size: .84rem; }
.input, .field input[type="text"], .field input[type="email"], .field input[type="password"], .field input[type="number"], .field input[type="url"], .field input[type="search"], .field select, .field textarea {
  width: 100%; padding: .55rem .7rem; border-radius: 8px; border: 1px solid var(--line-2); background: #fff; }
.field textarea { min-height: 5.5rem; resize: vertical; }
.field textarea.code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .85rem; min-height: 8rem; }
.input:focus, .field input:focus, .field select:focus, .field textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(233, 162, 59, .25); }
.field .err, .err { color: var(--bad); font-size: .85rem; font-weight: 500; }
.row { display: grid; grid-template-columns: repeat(auto-fit, minmax(12rem, 1fr)); gap: 0 1rem; }
.check { display: flex; align-items: flex-start; gap: .6rem; margin-bottom: 1.1rem; font-weight: 500; cursor: pointer; }
.check input { width: 1.1rem; height: 1.1rem; margin-top: .2rem; accent-color: var(--ink); flex: none; }
.color { display: flex; align-items: center; gap: .6rem; }
.color input[type="color"] { width: 2.6rem; height: 2.4rem; padding: .15rem; border: 1px solid var(--line-2); border-radius: 8px; background: #fff; cursor: pointer; }
.color input[type="text"] { max-width: 8rem; font-variant-numeric: tabular-nums; }
.langs { display: inline-flex; border: 1px solid var(--line-2); border-radius: 8px; overflow: hidden; background: #fff; }
.langs button { border: 0; background: none; padding: .35rem .8rem; font-weight: 600; font-size: .85rem; cursor: pointer; }
.langs button[aria-pressed="true"] { background: var(--ink); color: #fff; }
.savebar { position: sticky; bottom: 0; z-index: 5; display: flex; flex-wrap: wrap; align-items: center; gap: .75rem; margin: 1.25rem -1px -1px; padding: .85rem 1rem; background: color-mix(in srgb, var(--paper) 92%, transparent); backdrop-filter: blur(8px); border: 1px solid var(--line); border-radius: var(--r); }
.image-field { display: flex; flex-wrap: wrap; align-items: center; gap: .75rem; }
.image-field .thumb { width: 6.5rem; height: 4.5rem; border-radius: 8px; border: 1px dashed var(--line-2); background: repeating-conic-gradient(#F1EDE4 0 25%, #fff 0 50%) 0 0 / 14px 14px; display: grid; place-items: center; overflow: hidden; color: var(--muted); font-size: .75rem; }
.image-field .thumb img { width: 100%; height: 100%; object-fit: contain; }
.list { display: grid; gap: .6rem; }
.list-item { border: 1px solid var(--line); border-radius: 8px; padding: .85rem .85rem .1rem; background: #FCFBF8; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: .75rem; }
.list-item .field { margin-bottom: .75rem; }
.list-tools { display: flex; flex-direction: column; gap: .3rem; }

/* ---------- tables, badges, flash ---------- */
.table-wrap { overflow-x: auto; margin: 0 -.25rem; }
table.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; font-size: .8rem; font-weight: 600; color: var(--muted); padding: .5rem .6rem; border-bottom: 1px solid var(--line); white-space: nowrap; }
.table td { padding: .7rem .6rem; border-bottom: 1px solid var(--line); vertical-align: top; }
.table tr:last-child td { border-bottom: 0; }
.badge { display: inline-flex; align-items: center; gap: .3rem; padding: .1rem .55rem; border-radius: 999px; font-size: .78rem; font-weight: 600; background: var(--info-bg); color: #3B4757; white-space: nowrap; }
.badge.good { background: var(--good-bg); color: var(--good); }
.badge.warn { background: #FCF0DA; color: var(--accent-ink); }
.badge.bad { background: var(--bad-bg); color: var(--bad); }
.flash { display: flex; gap: .6rem; padding: .8rem 1rem; border-radius: var(--r); margin-bottom: 1.25rem; font-weight: 500; }
.flash.ok { background: var(--good-bg); color: #14532F; border: 1px solid #BFE0CC; }
.flash.error { background: var(--bad-bg); color: #7F1D17; border: 1px solid #F1C4BF; }
.flash.note { background: #FCF0DA; color: #5F3A04; border: 1px solid #EFD6A6; }
.empty { text-align: center; padding: 2.5rem 1rem; color: var(--muted); }
.empty strong { display: block; color: var(--text); font: 600 1.05rem var(--display); margin-bottom: .3rem; }
.tabs { display: flex; flex-wrap: wrap; gap: .25rem; border-bottom: 1px solid var(--line); margin-bottom: 1.25rem; }
.tabs a { padding: .55rem .85rem; text-decoration: none; font-weight: 600; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tabs a[aria-current="page"] { color: var(--text); border-bottom-color: var(--accent); }
.kv { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: .45rem 1.25rem; }
.kv dt { color: var(--muted); }
.kv dd { font-weight: 500; overflow-wrap: anywhere; }
.pager { display: flex; gap: .5rem; justify-content: flex-end; margin-top: 1rem; align-items: center; }

/* ---------- dashboard ---------- */
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr)); gap: 1rem; margin-bottom: 1.25rem; }
.tile { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 1rem 1.1rem; text-decoration: none; display: block; }
.tile span { color: var(--muted); font-size: .85rem; }
.tile strong { display: block; font: 600 2rem/1.1 var(--display); letter-spacing: -.02em; margin-top: .2rem; font-variant-numeric: tabular-nums; }
.bars { display: flex; align-items: flex-end; gap: 4px; height: 5.5rem; margin-top: .75rem; }
.bars i { flex: 1; background: var(--line); border-radius: 3px 3px 0 0; min-height: 3px; }
.bars i.on { background: var(--accent); }

/* ---------- scenes & sections lists ---------- */
.rows-list { display: grid; gap: .5rem; }
.row-item { display: flex; align-items: center; gap: .85rem; padding: .6rem .7rem; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
.row-item .thumb { width: 5.5rem; aspect-ratio: 16 / 9; border-radius: 6px; background: var(--ink); overflow: hidden; flex: none; display: grid; place-items: center; color: #8D97A5; font-size: .72rem; }
.row-item .thumb img { width: 100%; height: 100%; object-fit: cover; }
.row-item .num { font: 600 .85rem var(--body); color: var(--muted); font-variant-numeric: tabular-nums; width: 1.6rem; }
.row-item strong { display: block; }
.row-item.off { background: #FAF8F3; }
.row-item.off strong { color: var(--muted); }

/* ---------- video uploader ---------- */
.uploader { border: 1px solid var(--line); border-radius: var(--r); padding: 1rem; background: #FCFBF8; }
.uploader + .uploader { margin-top: 1rem; }
.uploader-head { display: flex; flex-wrap: wrap; gap: .75rem; align-items: center; margin-bottom: .75rem; }
.uploader-head h3 { font: 600 1rem var(--display); }
.uploader-view { display: grid; grid-template-columns: 12rem minmax(0, 1fr); gap: 1rem; align-items: center; }
.uploader-view.portrait { grid-template-columns: 6.5rem minmax(0, 1fr); }
.uploader .poster { border-radius: 8px; background: var(--ink); overflow: hidden; aspect-ratio: 16 / 9; display: grid; place-items: center; color: #8D97A5; font-size: .8rem; text-align: center; padding: .5rem; }
.uploader-view.portrait .poster { aspect-ratio: 9 / 16; }
.uploader .poster img, .uploader .poster canvas { width: 100%; height: 100%; object-fit: cover; }
.meter { height: 8px; border-radius: 999px; background: var(--line); overflow: hidden; margin: .6rem 0 .4rem; }
.meter i { display: block; height: 100%; width: 0; background: var(--accent); transition: width .2s; }
@media (max-width: 560px) { .uploader-view { grid-template-columns: 1fr; } }

/* ---------- media ---------- */
.media-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(9rem, 1fr)); gap: .75rem; }
.media-item { border: 1px solid var(--line); border-radius: 8px; overflow: hidden; background: #fff; }
.media-item .pic { aspect-ratio: 4 / 3; background: repeating-conic-gradient(#F1EDE4 0 25%, #fff 0 50%) 0 0 / 14px 14px; }
.media-item .pic img { width: 100%; height: 100%; object-fit: contain; }
.media-item p { padding: .4rem .55rem; font-size: .78rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.media-item form { padding: 0 .55rem .55rem; }
button.media-item { padding: 0; cursor: pointer; text-align: left; }
button.media-item:hover { border-color: var(--accent); }
.modal { border: 0; border-radius: 12px; padding: 0; width: min(56rem, 94vw); max-height: 88vh; }
.modal::backdrop { background: rgba(16, 21, 27, .55); }
.modal-head { display: flex; align-items: center; gap: .75rem; padding: 1rem 1.25rem; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: #fff; }
.modal-head h2 { font: 600 1.1rem var(--display); margin-right: auto; }
.modal-body { padding: 1.25rem; }

/* ---------- history ---------- */
.history li { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; padding: .6rem 0; border-bottom: 1px solid var(--line); font-size: .88rem; }
.history li:last-child { border-bottom: 0; }
.history form { margin-left: auto; }

/* ---------- auth & installer ---------- */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 1.5rem; background: var(--ink); }
.auth-card { width: min(27rem, 100%); background: var(--card); border-radius: 14px; padding: clamp(1.5rem, 4vw, 2.25rem); }
.auth-card.wide { width: min(46rem, 100%); }
.auth-card h1 { font: 600 1.6rem/1.15 var(--display); letter-spacing: -.02em; }
.auth-card > p { color: var(--muted); margin: .4rem 0 1.5rem; }
.auth-card h2 { font: 600 1.05rem var(--display); margin: 1.75rem 0 .75rem; padding-top: 1.25rem; border-top: 1px solid var(--line); }
.auth-brand { display: flex; align-items: center; gap: .5rem; font: 600 1rem var(--display); margin-bottom: 1.5rem; color: var(--accent-ink); }
.auth-brand svg { width: 1.3rem; height: 1.3rem; }
.checks { display: grid; grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr)); gap: .4rem 1.5rem; }
.checks li { display: flex; gap: .5rem; align-items: baseline; font-size: .9rem; }
.checks li::before { content: "✓"; color: var(--good); font-weight: 700; }
.checks li.no::before { content: "✕"; color: var(--bad); }
.checks li.opt::before { content: "!"; color: var(--accent-ink); }
.checks small { display: block; color: var(--bad); }
.checks li.opt small { color: var(--accent-ink); }
.auth-foot { text-align: center; color: #8D97A5; font-size: .82rem; margin-top: 1.25rem; }
.auth-foot a { color: #C9CED6; }
