/* Nine27 ops. Layout + primitives follow the TC Pilot ops dashboard (pane, field-input, label-mono, pill buttons,
   dark top bar with tabs). Colors are Nine27's navy + gold instead of TC Pilot's coral. */
:root {
  --font-sans: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-display: "Bricolage Grotesque", "Inter", system-ui, sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  --page: #F1F2F4;  --page-alt: #E7EAED;
  --surface: #FFFFFF;
  --ink: #0E1626;  --ink-2: #2A313C;  --muted: #646B76;  --subtle: #9AA0A9;
  --rule: #D9DCE0;  --rule-soft: #E6E8EB;
  --brand: #0F1B33;  --brand-deep: #0A1426;  --brand-soft: #EEF0F3;
  --accent: #D2AE66;  --accent-deep: #6B5226;  --accent-soft: #F5EEDD;
  --live: #0E7C66;  --live-soft: #D7EFE8;
  --danger: #B4432B;  --danger-soft: #FBE7E1;
  --shadow-pane: 0 1px 2px rgba(14, 22, 38, .05), 0 12px 32px -10px rgba(14, 22, 38, .10);
  color-scheme: light;
}
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; background: var(--page-alt); }
body { margin: 0; min-height: 100vh; font-family: var(--font-sans); font-size: 15px; line-height: 1.6; color: var(--ink); background: linear-gradient(180deg, var(--page) 0%, var(--page-alt) 100%) fixed; -webkit-font-smoothing: antialiased; }
h1, h2, h3 { font-family: var(--font-display); font-weight: 700; letter-spacing: -.02em; line-height: 1.05; color: var(--brand-deep); margin: 0; }
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
::selection { background: var(--accent-soft); }
.muted { color: var(--muted); margin: 0; }
code { font-family: var(--font-mono); font-size: .85em; padding: .1em .4em; border-radius: 6px; background: var(--brand-soft); color: var(--ink-2); }

/* primitives */
.pane { background: var(--surface); border: 1px solid var(--rule-soft); border-radius: 1rem; box-shadow: var(--shadow-pane); }
.label-mono { font-family: var(--font-mono); font-size: .65rem; font-weight: 500; text-transform: uppercase; letter-spacing: .2em; color: var(--subtle); }
.field { display: block; margin-bottom: 1.1rem; }
.field-label { display: block; font-size: .82rem; font-weight: 600; color: var(--ink-2); margin-bottom: .4rem; }
.field-label em { font-style: normal; font-weight: 400; color: var(--subtle); }
.field-hint { margin: -.4rem 0 0; font-size: .8rem; color: var(--muted); }
.field-error-text { margin: 0 0 .8rem; min-height: 1.2em; font-size: .85rem; color: var(--danger); }
.field-input {
  width: 100%; background: var(--surface); border: 1px solid var(--rule); border-radius: .65rem; padding: .7rem .85rem;
  font-size: 1rem; color: var(--ink); transition: border-color 140ms, box-shadow 140ms;
}
.field-input::placeholder { color: var(--subtle); }
.field-input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
textarea.field-input { resize: vertical; line-height: 1.55; }
textarea.tall { min-height: 320px; }
select.field-input { appearance: none; padding-right: 2.2rem; background: var(--surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%236B5226' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E") right .7rem center / 16px no-repeat; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: .5rem; font-weight: 600; font-size: 1rem; line-height: 1; border-radius: 999px; padding: .9rem 1.5rem; border: 1px solid transparent; text-decoration: none; cursor: pointer; white-space: nowrap; transition: background 140ms, box-shadow 140ms, transform 140ms, border-color 140ms, color 140ms; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .45; cursor: default; }
.btn.sm { padding: .55rem 1rem; font-size: .85rem; }
.btn.wide { width: 100%; }
.btn-accent { background: var(--brand); color: #fff; box-shadow: 0 8px 20px -10px rgba(10, 20, 38, .6); }
.btn-accent:hover:not(:disabled) { background: var(--brand-deep); transform: translateY(-2px); }
.btn-primary { background: var(--brand); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--brand-deep); }
.btn-ghost { background: var(--surface); color: var(--brand); border-color: var(--rule); }
.btn-ghost:hover:not(:disabled) { border-color: var(--accent); color: var(--accent-deep); transform: translateY(-2px); }
.btn-ghost.danger { color: var(--danger); }
.btn-ghost.danger:hover { border-color: var(--danger); color: var(--danger); }

.status-pill { font-family: var(--font-mono); font-size: .65rem; font-weight: 500; text-transform: uppercase; letter-spacing: .16em; padding: .35rem .7rem; border-radius: 999px; background: var(--brand-soft); color: var(--muted); white-space: nowrap; }
.status-pill.live { background: var(--live-soft); color: var(--live); }
.status-pill.scheduled { background: var(--accent-soft); color: var(--accent-deep); }
.status-pill:empty { display: none; }
.notice { border-radius: .75rem; padding: .85rem 1rem; font-size: .88rem; margin: .8rem 0 0; }
.notice-warn { background: var(--danger-soft); color: var(--ink-2); border: 1px solid rgba(180, 67, 43, .25); }

/* login */
.login { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; background: var(--brand-deep); }
.login-pane { width: 100%; max-width: 380px; padding: 2rem 1.75rem 1.75rem; }
.login-mark { width: 44px; height: 44px; color: var(--accent); margin-bottom: 1.1rem; }
.login h1 { font-size: 1.7rem; margin-bottom: .35rem; }
.login .muted { margin-bottom: 1.4rem; font-size: .92rem; }

/* shell */
.topbar { position: sticky; top: 0; z-index: 20; background: var(--brand-deep); color: #fff; }
.topbar-in { max-width: 1300px; margin: 0 auto; padding: .85rem 1.5rem 0; display: flex; flex-direction: column; gap: .75rem; }
.topbar-row { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.brand { display: inline-flex; align-items: center; gap: .6rem; text-decoration: none; font-family: var(--font-display); font-weight: 700; font-size: 1.05rem; letter-spacing: -.01em; }
.brand svg { width: 30px; height: 30px; color: var(--accent); }
.brand em { font-style: normal; color: var(--accent); }
.badge { font-family: var(--font-mono); font-size: .6rem; font-weight: 500; letter-spacing: .2em; text-transform: uppercase; padding: .25rem .55rem; border-radius: 999px; background: rgba(210, 174, 102, .22); color: #E9D3A3; }
.topbar-links { display: flex; align-items: center; gap: 1.1rem; font-size: .82rem; }
.topbar-links a, .topbar-links button { color: rgba(255, 255, 255, .6); text-decoration: none; background: none; border: 0; padding: 0; cursor: pointer; }
.topbar-links a:hover, .topbar-links button:hover { color: #fff; }
.tabs { display: flex; gap: .25rem; overflow-x: auto; }
.tabs a { padding: .6rem .9rem; font-size: .85rem; font-weight: 600; text-decoration: none; color: rgba(255, 255, 255, .55); border-bottom: 2px solid transparent; }
.tabs a.active { color: #fff; border-bottom-color: var(--accent); }
.tabs a:hover { color: #fff; }
.main { max-width: 1300px; margin: 0 auto; padding: 1.5rem; }
@media (max-width: 640px) { .topbar-in, .main { padding-left: 1rem; padding-right: 1rem; } }

.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem; margin-bottom: 1.25rem; }
.page-head h1 { font-size: 1.8rem; }
.page-head p { margin-top: .35rem; font-size: .9rem; }

/* weeks list */
.rows { display: grid; gap: .7rem; }
.row { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: .4rem 1rem; padding: 1.05rem 1.25rem; text-decoration: none; transition: border-color 140ms, transform 140ms; }
.row:hover { border-color: var(--accent); transform: translateY(-1px); }
.row strong { display: block; font-size: 1.02rem; color: var(--ink); }
.row .sub { font-size: .88rem; color: var(--muted); }
.empty { padding: 2.5rem 1.5rem; text-align: center; color: var(--muted); }

/* editor */
.edit-bar { position: sticky; top: 98px; z-index: 10; margin: -1.5rem -1.5rem 1.25rem; padding: 1rem 1.5rem; background: color-mix(in srgb, var(--page) 92%, transparent); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); border-bottom: 1px solid var(--rule-soft); }
.edit-bar-in { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .8rem 1rem; }
.edit-title h1 { font-size: 1.6rem; margin-top: .3rem; }
.back { text-decoration: none; }
.back:hover { color: var(--accent-deep); }
.edit-actions { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; }
.saved { min-width: 0; }
@media (max-width: 640px) { .edit-bar { top: 92px; margin: -1.5rem -1rem 1rem; padding: .85rem 1rem; } .edit-title h1 { font-size: 1.3rem; } }

.edit-grid { display: grid; gap: 1rem; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 980px) { .edit-grid { grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: 1.25rem; align-items: start; } }
.edit-col { display: grid; gap: 1rem; }
.block { padding: 1.35rem 1.35rem .35rem; }
.block h2 { font-size: 1.15rem; margin-bottom: 1rem; }
.row-2 { display: grid; grid-template-columns: minmax(0, 1fr) 120px; gap: .8rem; }
.hints { display: flex; flex-wrap: wrap; gap: .45rem 1rem; align-items: center; margin: -.3rem 0 1.1rem; font-size: .8rem; color: var(--muted); }

.days { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: .4rem; margin-bottom: 1.1rem; }
.day { display: grid; gap: .3rem; }
.day .label-mono { text-align: center; }
.day select { padding: .55rem 0; text-align: center; text-align-last: center; font-size: .7rem; letter-spacing: -.01em; font-weight: 600; background-image: none; border-radius: .6rem; }
.day select.t-vegan { background: var(--accent-soft); border-color: color-mix(in srgb, var(--accent) 45%, transparent); color: var(--accent-deep); }
.day select.t-fast { background: var(--brand); border-color: var(--brand); color: #fff; }
@media (max-width: 520px) { .days { grid-template-columns: repeat(4, minmax(0, 1fr)); } }

.video-prev { display: flex; gap: .9rem; align-items: center; margin: -.3rem 0 1rem; padding: .6rem; border-radius: .8rem; background: var(--brand-soft); }
.video-prev img { width: 128px; aspect-ratio: 16 / 9; object-fit: cover; border-radius: .5rem; flex: none; }
.video-prev p { margin: .2rem 0 0; font-size: .9rem; font-weight: 600; line-height: 1.35; }
#delete { justify-self: start; }

/* analytics */
.seg { display: inline-flex; padding: 3px; gap: 2px; border-radius: 999px; background: var(--surface); border: 1px solid var(--rule-soft); }
.seg button { padding: .5rem .95rem; border: 0; border-radius: 999px; background: none; font-size: .85rem; font-weight: 600; color: var(--muted); cursor: pointer; }
.seg button.on { background: var(--brand); color: #fff; }
@media (max-width: 640px) { #view-analytics .page-head { flex-direction: column; align-items: stretch; } .seg { justify-content: space-between; } .seg button { flex: 1; } }
.tiles { display: grid; gap: .7rem; grid-template-columns: repeat(2, minmax(0, 1fr)); margin-bottom: 1rem; }
@media (min-width: 760px) { .tiles { grid-template-columns: repeat(5, minmax(0, 1fr)); } }
.tile { padding: 1rem 1.1rem; }
.tile b { display: block; margin-top: .35rem; font-family: var(--font-display); font-size: 1.75rem; line-height: 1.1; color: var(--brand-deep); }
.tile .delta { display: inline-block; margin-top: .3rem; font-size: .78rem; font-weight: 600; color: var(--muted); }
.tile .delta.up { color: var(--live); }
.tile .delta.down { color: var(--danger); }
.tile.gold { background: var(--accent-soft); border-color: color-mix(in srgb, var(--accent) 40%, transparent); }
.chart-pane { margin-bottom: 1rem; padding-bottom: 1rem; }
.chart-head { display: flex; justify-content: space-between; align-items: baseline; }
.bars { display: flex; align-items: flex-end; gap: 3px; height: 140px; }
.bars i { flex: 1; min-height: 2px; border-radius: 3px 3px 0 0; background: var(--accent); position: relative; }
.bars i.zero { background: var(--rule-soft); }
.bars i:hover { background: var(--brand); }
.bars i:hover::after { content: attr(data-tip); position: absolute; bottom: calc(100% + 6px); left: 50%; transform: translateX(-50%); white-space: nowrap; padding: .25rem .5rem; border-radius: 6px; background: var(--brand-deep); color: #fff; font-size: .72rem; font-style: normal; z-index: 2; }
.bars-axis { display: flex; justify-content: space-between; margin-top: .4rem; }
.lists { display: grid; gap: 1rem; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 760px) { .lists { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 1100px) { .lists { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.mlist { list-style: none; margin: 0 0 1rem; padding: 0; display: grid; gap: .35rem; }
.mlist li { position: relative; display: flex; justify-content: space-between; gap: 1rem; padding: .45rem .65rem; border-radius: .5rem; font-size: .88rem; overflow: hidden; }
.mlist li span { position: relative; z-index: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mlist li b { position: relative; z-index: 1; font-weight: 600; }
.mlist li i { position: absolute; inset: 0 auto 0 0; background: var(--brand-soft); border-radius: .5rem; }
.mlist .none { color: var(--subtle); padding-left: 0; }
.as-of { margin-top: .5rem; text-align: center; }
.para-hint { margin: -.5rem 0 1.1rem; }
