/* WhyKite's app admin website: the same night sky as the parent website, with a page list beside the page from 900px up.
   Dark only, like the TV. The CSP has no font-src, so every web font is blocked: text uses the device's own fonts. */
:root {
  --bg: #14162B; --bg2: #1E2148; --card: #262A55; --card2: #2F3468; --line: #3A3F78;
  --edge: #6B73B8; /* a field's or button's outline: 3:1 on --card, so it reads as a control */
  --text: #F6F3EA; --muted: #C4C2DA;
  --sun: #FFC94D; --mint: #6FE3B5; --sky: #7CC4FF; --coral: #FF8A7A;
  --head: ui-rounded, "SF Pro Rounded", system-ui, sans-serif;
  --r: 16px;
  color-scheme: dark;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; } /* buttons set their own display, which would beat the browser's [hidden] */
html {
  background: var(--bg); color: var(--text); -webkit-text-size-adjust: 100%;
  font: 17px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", sans-serif; /* 16px and up: iOS doesn't zoom into fields */
}
body {
  margin: 0; min-height: 100vh; display: flex; flex-direction: column;
  background: radial-gradient(120% 50% at 50% -10%, var(--bg2), var(--bg) 70%) no-repeat;
  isolation: isolate; /* so a z-index: -1 decoration sits between body's sky and the page */
}
::selection { background: rgba(255, 201, 77, .35); }
html { scrollbar-color: var(--line) var(--bg); }
main:focus, h1:focus { outline: none; }
main[aria-busy="true"] { opacity: .6; transition: opacity .2s .2s; }

h1 { font: 600 1.8rem/1.2 var(--head); margin: 8px 0 12px; }
h2 { font: 600 1.2rem/1.3 var(--head); margin: 28px 0 8px; }
h3 { font: 600 1.05rem/1.3 var(--head); margin: 20px 0 8px; }
.card > h2:first-child { margin-top: 0; }
p, ul { margin: 0 0 12px; }
ul { padding-left: 1.2em; }
li { margin-bottom: 6px; }
a { color: var(--sky); text-underline-offset: .2em; text-decoration-thickness: 1px; }
:focus-visible { outline: 3px solid var(--sun); outline-offset: 2px; }
.lead { color: var(--muted); font-size: 1.05rem; text-wrap: pretty; }
h1, h2 { text-wrap: balance; }
.small, small { color: var(--muted); font-size: .9rem; }
.bad { color: var(--coral); }
.nowrap { white-space: nowrap; }

/* ---------- the shell: the bar, then the page list and the page. From 900px the list stands beside the page. ---------- */
.bar, .shell { width: 100%; max-width: 72rem; margin: 0 auto; padding-left: 16px; padding-right: 16px; }
.bar { padding-top: 8px; }
.brand { display: inline-flex; align-items: center; gap: 10px; min-height: 48px; color: var(--text); text-decoration: none; font: 600 1.3rem/1 var(--head); }
.shell { flex: 1; display: flex; flex-direction: column; }
.col { flex: 1; display: flex; flex-direction: column; min-width: 0; }
main { flex: 1; padding-bottom: 32px; }
/* On a phone the list is one row that scrolls sideways inside its own box. */
#nav { display: flex; gap: 4px; margin: 0 -16px; padding: 4px 16px 8px; overflow-x: auto; border-bottom: 1px solid var(--line); scrollbar-width: thin; }
#nav a { flex: none; display: flex; align-items: center; min-height: 48px; padding: 0 14px; color: var(--muted); font-weight: 600; white-space: nowrap; text-decoration: none; border-radius: 12px; transition: background-color .15s; }
#nav a:hover { color: var(--text); background: rgba(246, 243, 234, .05); }
#nav a[aria-current="page"] { color: var(--text); background: rgba(255, 201, 77, .15); box-shadow: inset 0 0 0 1px var(--sun); }
#notice:empty { display: none; }
#notice > * { margin: 16px 0 0; }
@media (min-width: 900px) {
  .bar { padding-top: 16px; }
  .shell { display: grid; grid-template-columns: 13rem minmax(0, 1fr); gap: 0 40px; padding-top: 8px; }
  #nav { align-self: start; position: sticky; top: 16px; flex-direction: column; margin: 0; padding: 0; overflow: visible; border: 0; }
  #nav a { padding: 0 16px; }
}
/* A wide table scrolls inside its own box, never the page. */
.scroll { margin: 0 0 16px; overflow-x: auto; background: var(--card); border-radius: var(--r); }
table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
th, td { padding: 10px 14px; text-align: left; white-space: nowrap; border-bottom: 1px solid var(--line); }
th { color: var(--muted); font-size: .9rem; font-weight: 600; }
tr:last-child td { border-bottom: 0; }
td.num, th.num { text-align: right; }

/* ---------- forms ---------- */
label { display: block; margin: 16px 0 6px; font-weight: 600; }
input, select, textarea { font: inherit; color: inherit; caret-color: var(--sun); }
textarea { display: block; resize: vertical; }
/* A field, or .tel around one: a dark well with a 1px edge. Focus turns the edge sky blue and adds a soft ring. */
input:not([type=checkbox]):not([type=radio]), select, textarea, .tel {
  width: 100%; min-height: 52px; padding: 12px 16px; background: var(--bg); border: 1px solid var(--edge); border-radius: 14px;
  transition: border-color .15s, box-shadow .15s;
}
input::placeholder { color: #9896BD; opacity: 1; } /* 6:1 on the well */
select { padding-left: 12px; padding-right: 8px; }
input:not([type=checkbox]):not([type=radio]):hover, select:hover, textarea:hover, .tel:hover { border-color: var(--muted); }
input:not([type=checkbox]):not([type=radio]):focus, select:focus, textarea:focus, .tel:focus-within {
  border-color: var(--sky); box-shadow: 0 0 0 1px var(--sky), 0 0 0 5px rgba(124, 196, 255, .2); outline: none;
}
.hint { margin: 8px 0 0; color: var(--muted); font-size: .9rem; text-wrap: pretty; }
.tel { display: flex; align-items: center; padding: 0; }
.tel span { flex: none; display: flex; align-items: center; gap: 12px; padding-left: 16px; color: var(--muted); font-weight: 600; }
.tel span::after { content: ""; width: 1px; height: 24px; background: var(--line); }
.tel > input[type=tel], .tel > input[type=tel]:focus { min-height: 50px; padding-left: 12px; border: 0; background: none; box-shadow: none; }
.otp { font-size: 1.4rem; font-variant-numeric: tabular-nums; letter-spacing: .4em; text-indent: .4em; text-align: center; }
.otp::placeholder { font-size: 1rem; letter-spacing: normal; }
button, .button {
  display: flex; align-items: center; justify-content: center; width: 100%; min-height: 52px; margin: 12px 0 0; padding: 12px 20px;
  font: 600 1.05rem/1.2 var(--head); color: var(--text); text-align: center; text-decoration: none;
  background: transparent; border: 1px solid var(--edge); border-radius: 14px; cursor: pointer;
  transition: background-color .15s, border-color .15s, transform .1s;
}
:is(button, .button):not(:disabled, [aria-disabled="true"]):hover { border-color: var(--muted); background: rgba(246, 243, 234, .05); }
:is(button, .button):not(:disabled, [aria-disabled="true"]):active { transform: translateY(1px); }
.primary { background: var(--sun); border-color: var(--sun); color: var(--bg); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .35), 0 8px 20px -12px rgba(0, 0, 0, .8); }
.primary:not(:disabled, [aria-disabled="true"]):hover { background: #FFD772; border-color: #FFD772; }
.danger, .danger:not(:disabled, [aria-disabled="true"]):hover { border-color: var(--coral); color: var(--coral); }
.danger:not(:disabled, [aria-disabled="true"]):hover { background: rgba(255, 138, 122, .08); }
button:disabled, button[aria-disabled="true"] { opacity: .55; cursor: default; }
button[aria-disabled="true"] { cursor: progress; } /* form() sets it while the request runs */
button.link { display: inline-flex; width: auto; margin: 0; padding: 0 4px; border: 0; color: var(--sky); font: inherit; text-decoration: underline; text-underline-offset: .2em; }
button.link:not(:disabled):hover { background: none; color: var(--text); }
.quiet, .quiet:not(:disabled, [aria-disabled="true"]):hover { border-color: transparent; color: var(--sky); } /* a lesser choice: Cancel, + Add */
.links { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px; margin-top: 8px; }
.err { margin: 10px 0 0; color: var(--coral); font-weight: 600; }
.note { margin: 10px 0 0; color: var(--mint); }
.err:empty, .note:empty { display: none; }
.flash { padding: 10px 14px; color: var(--mint); background: rgba(111, 227, 181, .12); border: 1px solid var(--mint); border-radius: 12px; }
.banner { margin: 0 0 16px; padding: 14px 16px; background: rgba(255, 201, 77, .1); border: 1px solid var(--sun); border-radius: var(--r); }
.banner.bad { color: var(--text); background: rgba(255, 138, 122, .12); border-color: var(--coral); }
.banner p { margin: 0; font-weight: 600; }
.card { margin: 16px 0; padding: 16px; background: var(--card); border: 0; border-radius: var(--r); }
dialog { width: min(34rem, calc(100% - 32px)); padding: 20px; color: var(--text); background: var(--card); border: 0; border-radius: var(--r); }
dialog::backdrop { background: rgba(10, 11, 25, .75); }
dialog h2 { margin-top: 0; }
dialog .lead { overflow-wrap: anywhere; } /* what changes can hold a pasted link */

fieldset { min-width: 0; margin: 0; padding: 0; border: 0; }
legend { float: left; width: 100%; margin: 16px 0 6px; padding: 0; font-weight: 600; } /* float: inside the box, like a label */
legend + * { clear: both; }
.check { display: flex; align-items: flex-start; gap: 12px; font-weight: 400; }
.check input { flex: none; width: 24px; height: 24px; margin: 2px 0 0; accent-color: var(--sun); }
summary { display: flex; align-items: center; gap: 8px; min-height: 48px; color: var(--sky); font-weight: 600; cursor: pointer; list-style: none; }
summary::-webkit-details-marker { display: none; }
summary::after { content: "›"; font-size: 1.3rem; transition: transform .15s; }
details[open] > summary::after { transform: rotate(90deg); }
.remove { margin-top: 8px; }
.remove > summary { color: var(--coral); }

/* ---------- lists of switches ---------- */
.rows { margin: 0; padding: 0; list-style: none; }
.rows > li { margin: 0; border-bottom: 1px solid var(--line); }
.rows details { padding-bottom: 8px; }
.rows summary { min-height: 36px; margin-top: -8px; color: var(--muted); font-size: .9rem; font-weight: 400; }
.empty { padding: 12px 0; }
.switch { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 64px; margin: 0; padding: 8px 0; font-weight: 400; cursor: pointer; }
.switch .name { display: block; font-weight: 600; }
.switch small { display: block; }
.switch > span { min-width: 0; overflow-wrap: anywhere; } /* a long link or topic wraps */
.switch .pill { display: inline-block; margin-left: 2px; vertical-align: .1em; }
.switch input {
  appearance: none; -webkit-appearance: none; flex: none; width: 52px; height: 32px; margin: 0; border-radius: 16px; cursor: pointer;
  background: radial-gradient(circle at 16px 50%, var(--muted) 10px, transparent 11px), var(--line);
}
.switch input:checked { background: radial-gradient(circle at 36px 50%, var(--bg) 10px, transparent 11px), var(--mint); }
.switch input:disabled { opacity: .4; cursor: default; }

/* ---------- safety rules ---------- */
.rule { padding: 8px 0; }
.rule .what { margin: 0 0 2px; overflow-wrap: anywhere; }
.rule small { display: block; }
.rule.gone .words { color: var(--muted); text-decoration: line-through; }

/* ---------- the safety test: each run opens its report ---------- */
.runs { margin: 0; padding: 0; list-style: none; }
.runs > li { margin: 0; border-bottom: 1px solid var(--line); }
.runs > li > details > summary { padding: 8px 0; color: var(--text); font-weight: 400; }
.runs .what { flex: 1; min-width: 0; }
.runs .what small { display: block; }
.runs .pill { display: inline-block; margin-right: 4px; }
.report { padding: 0 0 12px; overflow-wrap: anywhere; }
.report h3 { margin-top: 12px; }

/* ---------- queue and library: a line for each video or item, its steps, and its buttons ---------- */
.line { display: flex; flex-wrap: wrap; gap: 4px 12px; padding: 12px 0; }
.line > img { flex: none; width: 112px; height: 63px; object-fit: cover; background: var(--bg); border-radius: 8px; }
.line > .info { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.line .info p { margin: 0 0 2px; }
.line .info small { display: block; }
.line .name { font-weight: 600; }
.line .name .pill { display: inline-block; margin-left: 2px; vertical-align: .1em; }
.line > details { flex: 1 1 100%; padding: 0; }
.line > details > summary { min-height: 48px; margin: 0; color: var(--sky); font-size: 1rem; font-weight: 600; }
.acts { flex: 1 1 100%; display: flex; gap: 8px; }
.acts button { flex: 1; margin: 4px 0 0; }
@media (min-width: 640px) {
  .line > img { width: 160px; height: 90px; }
  .acts { flex: none; align-items: flex-start; }
  .acts button { flex: none; width: auto; min-width: 8rem; }
}
.steps { margin: 0 0 8px; padding: 0; list-style: none; }
.steps > li { margin: 0 0 8px; padding: 12px 14px; background: var(--card); border-radius: 12px; overflow-wrap: anywhere; }
.steps p { margin: 0 0 6px; }
.steps .pill { display: inline-block; margin-right: 2px; padding: 2px 10px; }
.steps small { display: block; }
.scene { font-size: 1.4rem; line-height: 1.3; }
.opts { margin: 0 0 6px; padding: 0; list-style: none; }
.opts li { margin: 0 0 6px; padding-left: 12px; border-left: 3px solid var(--line); }
.opts li.right { border-left-color: var(--mint); }
.opts .pill { display: inline-block; margin-left: 4px; padding: 2px 10px; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(9rem, 1fr)); gap: 12px; margin: 16px 0; }
.stats .card { margin: 0; }
.stats strong { display: block; }

/* ---------- filter chips ---------- */
.filter { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 12px; }
.filter button { width: auto; min-height: 48px; margin: 0; padding: 0 16px; font-weight: 400; }
.filter [aria-pressed="true"], .filter [aria-pressed="true"]:not(:disabled, [aria-disabled="true"]):hover { background: rgba(255, 201, 77, .15); border-color: var(--sun); box-shadow: inset 0 0 0 1px var(--sun); }

/* ---------- field and cost: the days, and tables that scroll inside their own box ---------- */
.days input { max-width: 10rem; }
.days select { max-width: 16rem; }
.out > div > h2 { margin-top: 24px; }
.stats strong { overflow-wrap: anywhere; } /* a big rupee amount wraps rather than runs out of its card */
.scroll { container-type: inline-size; } /* so a line under a row can be as wide as the box, whatever the table is */
tbody th[scope="row"] { position: sticky; left: 0; min-width: 7rem; max-width: 12rem; color: var(--text); font-size: 1rem; white-space: normal; overflow-wrap: anywhere; background: var(--card); box-shadow: inset -1px 0 0 var(--line); } /* a number slides under it */
.above > * { border-bottom: 0; }
.sub > td { max-width: 0; padding-top: 0; white-space: normal; } /* adds nothing to the table's width: its box is the scroll box's */
.sub > td > div { position: sticky; left: 14px; width: calc(100cqw - 28px); }
.sub p { margin: 0 0 4px; color: var(--muted); font-size: .9rem; overflow-wrap: anywhere; }
tbody th .link { min-height: 32px; } /* a family's number on Payments: short enough for a table row, still 32 px to tap */
#pay-timeline + .scroll th[scope="row"] { white-space: nowrap; overflow-wrap: normal; } /* a time stays on one line */

/* ---------- home: a card for each thing to watch, then the recent changes ---------- */
.top { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.pill { flex: none; padding: 4px 12px; font-size: .85rem; font-weight: 700; border-radius: 999px; }
.pill.ok { color: var(--bg); background: var(--mint); }
.pill.bad { color: var(--bg); background: var(--coral); }
.pill.idle { color: var(--text); background: var(--line); }
.tiles { display: grid; gap: 16px; margin: 16px 0; }
.tile { display: block; margin: 0; color: var(--text); text-decoration: none; transition: background-color .15s; }
.tile:hover { background: var(--card2); }
.tile h2 { margin: 0 0 4px; font-size: 1.15rem; }
.tile p:last-child { margin-bottom: 0; }
.stat { font-size: 1.05rem; }
.stat strong { font: 600 1.8rem/1.2 var(--head); }
@media (min-width: 640px) {
  .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .tile.wide { grid-column: 1 / -1; }
}
.log li { display: flex; gap: 12px; padding: 10px 0; }
.log time { flex: none; width: 4.6em; color: var(--muted); font-size: .9rem; font-variant-numeric: tabular-nums; }
.log small { display: block; }
.log p { margin: 0; overflow-wrap: anywhere; }
.signout { margin-top: 16px; }
.signout button { border-color: transparent; color: var(--muted); }
.who { margin: 24px 0 0; text-align: center; }

/* ---------- sign-in: Pip perched on the card's edge, a moon rising behind it, under the TV's night sky.
   route() puts .out on <body> while the sign-in page shows: no bar, no page list. ---------- */
body.out {
  background:
    radial-gradient(circle at 37px 52px, rgba(246, 243, 234, .5) 0 .9px, transparent 1.4px) 0 0 / 241px 241px,
    radial-gradient(circle at 190px 160px, rgba(246, 243, 234, .4) 0 .8px, transparent 1.3px) 0 0 / 241px 241px,
    radial-gradient(circle at 300px 60px, rgba(246, 243, 234, .75) 0 1.1px, transparent 1.6px) 0 0 / 373px 373px,
    radial-gradient(circle at 110px 290px, rgba(246, 243, 234, .55) 0 1px, transparent 1.5px) 0 0 / 373px 373px,
    radial-gradient(circle at 260px 340px, rgba(246, 243, 234, .6) 0 1.2px, transparent 1.7px) 0 0 / 461px 461px,
    radial-gradient(circle at 420px 210px, rgba(255, 233, 180, .9) 0 1.5px, transparent 2px) 0 0 / 557px 557px,
    radial-gradient(circle at 90px 470px, rgba(246, 243, 234, .7) 0 1.3px, transparent 1.8px) 0 0 / 557px 557px,
    radial-gradient(120% 60% at 50% -10%, var(--bg2), var(--bg) 70%) no-repeat;
}
body.out .bar, body.out #nav, body.out #notice { display: none; }
body.out .shell { display: flex; }
body.out main { display: flex; flex-direction: column; padding-top: 112px; }
.signin {
  position: relative; width: 100%; max-width: 26rem; margin: auto; padding: 32px 28px 24px;
  background: linear-gradient(var(--card), var(--bg2)); border: 1px solid rgba(246, 243, 234, .08); border-radius: 24px;
  box-shadow: 0 32px 64px -32px rgba(0, 0, 0, .8);
}
.signin::before { /* behind the card (z-index -1 in body's stacking context), so the card's edge is its horizon */
  content: ""; position: absolute; z-index: -1; top: -96px; left: 50%; width: 152px; aspect-ratio: 1; transform: translateX(-50%);
  border-radius: 50%; background: radial-gradient(closest-side, rgba(124, 196, 255, .17) 84%, rgba(124, 196, 255, 0)); /* the TV's glow */
}
.signin .perch { position: absolute; top: -90px; left: 50%; transform: translateX(-50%); } /* its feet on the card's top edge */
.signin h1, .signin .lead { text-align: center; text-wrap: balance; }
.signin h1 { margin: 0 0 8px; }
.signin .lead { margin-bottom: 4px; }
.signin form:nth-of-type(2) { animation: arrive .25s cubic-bezier(.16, 1, .3, 1); } /* the code form, once the text is sent */
.signin .fine { margin: 24px 0 0; padding-top: 16px; border-top: 1px solid rgba(246, 243, 234, .08); text-align: center; text-wrap: balance; }
@keyframes arrive { from { opacity: 0; transform: translateY(8px); } }
@media (max-width: 400px) { .signin { padding: 28px 20px 20px; } }
@media (max-width: 380px) { .signin h1 { font-size: 1.6rem; } } /* one line on a 360px phone */
@media (prefers-reduced-motion: reduce) { .signin form { animation: none; } }
