/* Watch Atlas: foundations and shared interface components. */
:root {
  color-scheme: dark;
  --bg: #07111f;
  --bg-deep: #050c17;
  --panel: #102238;
  --panel-alt: #142a43;
  --line: #2b4058;
  --ink: #f3f7fc;
  --muted: #b6c5d8;
  --soft: #91a5bf;
  --accent: #85ceff;
  --primary: #2466d9;
  --primary-hover: #1955be;
  --violet: #b6b3ff;
  --gold: #e5c17d;
  --paper: #edf3fb;
  --paper-soft: #dfeaf7;
  --dark-ink: #102c48;
  --dark-muted: #4c6580;
  --font: "Segoe UI", Inter, Arial, Helvetica, sans-serif;
  --radius: 18px;
  --shadow: 0 18px 60px #00000025;
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 400 16px/1.6 var(--font);
  -webkit-font-smoothing: antialiased;
}
body, button, input, select, textarea { font-family: var(--font); }
h1, h2, h3, h4 { color: var(--ink); font-family: var(--font); font-weight: 700; letter-spacing: -.025em; }
h1 { font-size: clamp(32px, 4vw, 54px); line-height: 1.08; margin: 0; }
h2 { font-size: clamp(25px, 2.5vw, 34px); line-height: 1.2; margin: 0 0 10px; }
h3 { font-size: 21px; line-height: 1.3; margin: 0 0 12px; }
h4 { font-size: 17px; margin: 0 0 8px; }
p { color: var(--muted); margin: 0 0 16px; }
a { color: inherit; text-decoration: none; }
a:hover { color: var(--accent); }
button, input, select, textarea { font: inherit; }
button, summary, a { -webkit-tap-highlight-color: transparent; }
button {
  min-height: 44px;
  max-width: 100%;
  cursor: pointer;
  border: 1px solid #36516e;
  border-radius: 11px;
  padding: 10px 16px;
  background: #172d46;
  color: var(--ink);
  font-size: 14px;
  font-weight: 600;
  line-height: 1.35;
  transition: background .16s, border-color .16s, transform .16s;
}
button:hover { background: #23415f; border-color: #6689ad; }
button.accent { color: #fff; background: var(--primary); border-color: var(--primary); box-shadow: 0 5px 18px #2466d929; }
button.accent:hover { background: var(--primary-hover); border-color: var(--primary-hover); }
button:disabled, input:disabled, select:disabled, textarea:disabled { opacity: .5; cursor: not-allowed; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, summary:focus-visible {
  outline: 3px solid var(--accent); outline-offset: 4px;
}
input, select, textarea {
  width: 100%;
  min-width: 0;
  min-height: 46px;
  padding: 11px 13px;
  border: 1px solid #bacbe0;
  border-radius: 10px;
  background: var(--paper);
  color: var(--dark-ink);
  color-scheme: light;
  font-size: 16px;
  line-height: 1.4;
}
input::placeholder, textarea::placeholder { color: #637990; opacity: 1; }
input[type=checkbox] { width: 18px; height: 18px; min-height: 0; flex: 0 0 18px; accent-color: var(--primary); }
input[type=file] { font-size: 14px; padding: 8px; }
input[type=file]::file-selector-button { border: 0; border-radius: 7px; padding: 8px 11px; margin-right: 10px; background: #cfdef1; color: var(--dark-ink); font: 600 13px var(--font); cursor: pointer; }
input[readonly] { background: #dce7f4; }
textarea { min-height: 110px; resize: vertical; }
label { display: block; min-width: 0; color: var(--muted); font-size: 14px; font-weight: 600; margin: 14px 0 7px; }
label > input, label > select, label > textarea { margin-top: 7px; }
label.check { display: flex; gap: 9px; align-items: flex-start; font-weight: 400; }
label.check input { margin-top: 4px; }
small, .hint, .field-help { font-size: 14px; line-height: 1.55; color: var(--muted); }
.field-help { display: block; margin-top: 7px; font-size: 13px; font-weight: 400; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
.skip-link { position: fixed; top: -100px; left: 16px; z-index: 100; background: var(--paper); color: var(--dark-ink); border-radius: 9px; padding: 12px 18px; }
.skip-link:focus { top: 12px; }
main, #workspace, section, .panel, .layout, .grid article { min-width: 0; }
main { width: min(1480px, 100%); padding: 24px clamp(18px, 4vw, 56px) 0; margin: auto; }
#workspace { padding-bottom: 56px; }
#workspace:focus { outline: 0; }
#workspace h2[tabindex="-1"]:focus { outline: 0; }
.brand { display: inline-flex; align-items: center; gap: 10px; white-space: nowrap; font-size: 18px; font-weight: 650; letter-spacing: .13em; color: var(--ink); }
.brand b { color: var(--accent); font-weight: 800; }
.brand img { width: 38px; height: 38px; }
.eyebrow { color: var(--accent); font-size: 11px; font-weight: 750; letter-spacing: .12em; text-transform: uppercase; margin: 0 0 9px; }
.section-heading { margin: 18px 0 24px; display: flex; align-items: flex-end; justify-content: space-between; gap: 18px; }
.section-heading h2 { margin-bottom: 8px; }
.section-heading p:not(.eyebrow) { max-width: 760px; margin: 0; font-size: 15px; }
.section-heading .eyebrow { margin-bottom: 7px; }
.panels { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px; align-items: start; }
.panel { padding: 26px; border: 1px solid #ffffff0b; border-radius: var(--radius); background: var(--panel); }
.panel h3 { margin-top: 0; }
.panel p { font-size: 15px; }
.compact { max-width: 960px; margin: 0 auto; }
.compact > .panel + .panel { margin-top: 24px; }
.actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin: 20px 0; }
.actions:last-child { margin-bottom: 0; }
.actions a { min-height: 44px; display: inline-flex; align-items: center; }
.help-link { color: var(--accent); text-decoration: underline; text-underline-offset: 3px; overflow-wrap: anywhere; }
.text-button { border: 0; background: transparent; color: var(--accent); padding-left: 0; padding-right: 0; box-shadow: none; }
.text-button:hover { background: transparent; color: var(--ink); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 16px 0; }
.chip, .pill { border-radius: 999px; }
.chip { font-size: 13px; padding: 9px 14px; }
.chip.selected, .chip[aria-pressed=true] { color: #092746; border-color: var(--accent); background: var(--accent); }
.pill { display: inline-flex; align-items: center; padding: 6px 11px; border: 1px solid var(--line); color: var(--muted); font-size: 13px; margin: 3px; }
.notice { padding: 16px 18px; border-radius: 12px; border: 1px solid #4f789f66; background: #163451; color: #d6eafe; font-size: 14px; }
.danger { color: #ffc1b6; border-color: #a86a62; }
.plain-steps { padding-left: 23px; margin: 20px 0; }
.plain-steps li { padding-left: 3px; margin: 16px 0; color: var(--muted); }
.plain-steps strong { color: var(--ink); }
code { display: block; max-width: 100%; padding: 14px 16px; border-radius: 10px; background: #061626; color: #c0e5ff; font: 13px/1.6 Consolas, monospace; white-space: pre-wrap; overflow-wrap: anywhere; word-break: break-word; }
.row-list { display: grid; gap: 9px; max-height: 600px; overflow-y: auto; padding-right: 4px; scrollbar-width: thin; scrollbar-color: #688db2 #12283e; }
.row-item { display: flex; align-items: center; gap: 8px; padding: 12px; border-radius: 12px; background: #071a2c; min-width: 0; }
.row-item span { flex: 1; min-width: 0; overflow-wrap: anywhere; font-size: 14px; color: var(--ink); }
.row-item button { min-width: 44px; min-height: 44px; padding: 8px; }
.row-item[draggable=true], [data-addon][draggable=true] { cursor: grab; }
.row-title { display: flex; align-items: center; gap: 10px; }
.row-title strong { font-weight: 600; }
.row-number { display: inline-flex; align-items: center; justify-content: center; flex: 0 0 23px; width: 23px; height: 23px; border-radius: 7px; color: var(--soft); background: #102d48; font-size: 11px; }
.setup-panels { margin-bottom: 24px; }
.setup-rows { background: var(--paper); color: var(--dark-ink); border-color: #d4e3f6; }
.setup-rows h3 { color: var(--dark-ink); }
.setup-rows p, .setup-rows .hint { color: var(--dark-muted); }
.setup-rows .eyebrow { color: #3d6598; }
.setup-rows .row-item { background: #fff; border: 1px solid #d0deef; }
.setup-rows .row-title { color: var(--dark-ink); }
.setup-rows .row-number { background: #e8eff8; color: #567190; }
.setup-rows .row-item button, .setup-rows #reset-lineup { color: #235286; background: #eaf1fb; border-color: #c9d9ed; }
.setup-rows .row-item button:hover, .setup-rows #reset-lineup:hover { background: #d7e7fa; border-color: #94b3d8; }
.setup-rows .row-list { scrollbar-color: #819fc0 #d6e2f0; }
.setup-rows .empty { background: #e2ecf9; color: #48617e; border-color: #9eb5d2; }
.add-collection-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; max-height: 600px; overflow-y: auto; padding-right: 4px; margin: 20px 0; scrollbar-width: thin; scrollbar-color: #688db2 #12283e; }
.add-collection-grid button { text-align: left; padding: 15px; background: #1b3653; border-color: #2f5274; border-radius: 12px; }
.add-collection-grid button:hover { background: #264970; border-color: #688db2; }
.add-collection-grid strong { display: block; color: #e7f2ff; margin-bottom: 6px; font-size: 14px; font-weight: 650; }
.add-collection-grid small { display: block; color: #b7c9dd; font-size: 12px; font-weight: 400; line-height: 1.55; }
.setup-extras { margin-top: 24px; }
.recipe { display: flex; align-items: center; gap: 9px; padding: 13px 0; border-bottom: 1px solid var(--line); }
.recipe span { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.recipe button { min-width: 44px; }
.inline { display: flex; align-items: center; gap: 9px; }
.inline > input { flex: 1; }
.starter-panel { margin-bottom: 24px; }
.starter-panel[open] { display: grid; gap: 12px; }
.starter-panel select { max-width: 420px; }
.starter-panel > button { justify-self: start; }
.starter-panel h3 { margin: 0 0 8px; }
.starter-panel p { margin-bottom: 0; }
.setup-guide { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; margin: 22px 0 28px; }
.step-card { display: flex; align-items: flex-start; gap: 14px; background: var(--paper); color: var(--dark-ink); padding: 22px; border-radius: 16px; }
.step-card > div { min-width: 0; }
.step-card strong { display: block; margin: 0 0 6px; font-size: 15px; line-height: 1.4; }
.step-card h3, .step-card strong { color: var(--dark-ink); }
.step-card p { color: var(--dark-muted); margin: 0; font-size: 14px; }
.step-card > span { display: inline-flex; align-items: center; justify-content: center; flex: 0 0 34px; width: 34px; height: 34px; border-radius: 10px; background: #d3e2f5; color: var(--primary); font-weight: 750; }
details.panel > summary { font-size: 18px; font-weight: 700; color: var(--ink); cursor: pointer; }
details.panel[open] > summary { margin-bottom: 22px; }
details > summary { cursor: pointer; color: var(--accent); }
details > summary:focus-visible { border-radius: 7px; }
details > summary { min-height: 44px; display: flex; align-items: center; gap: 8px; }
details > summary::before { content: '›'; display: inline-block; font-size: 21px; line-height: 1; color: var(--accent); transform: rotate(0); transition: transform .16s; }
details[open] > summary::before { transform: rotate(90deg); }
details > summary::-webkit-details-marker { display: none; }
details > summary { list-style: none; }
details > summary span { min-width: 0; }
dialog {
  max-width: calc(100vw - 32px);
  width: min(980px, calc(100vw - 48px));
  max-height: min(90vh, 940px);
  margin: auto;
  padding: 32px;
  background: #102339;
  color: var(--ink);
  border: 1px solid #507291;
  border-radius: 24px;
  box-shadow: 0 28px 100px #0009;
  overflow: auto;
}
dialog::backdrop { background: #020a15cf; backdrop-filter: blur(8px); }
dialog h2 { padding-right: 40px; }
dialog > .eyebrow { padding-right: 46px; line-height: 1.5; }
dialog p { font-size: 15px; }
.close { position: absolute; right: 15px; top: 15px; min-width: 44px; width: 44px; height: 44px; padding: 0; font-size: 26px; border-radius: 50%; background: #244059; border: 0; }
.detail-layout { display: grid; grid-template-columns: 210px minmax(0, 1fr); gap: 28px; }
.detail-layout > div:first-child img { display: block; width: 100%; aspect-ratio: 2 / 3; object-fit: cover; border-radius: 14px; box-shadow: 0 12px 30px #0004; }
.detail-layout h2 { font-size: 30px; padding-right: 34px; }
.detail-layout h3 { margin-top: 24px; font-size: 18px; }
.details-meta { color: var(--accent); font-size: 14px; }
.source-list { color: var(--muted); font-size: 14px; padding-left: 22px; }
.source-list li { margin: 8px 0; overflow-wrap: anywhere; }
.provider-info { margin-top: 26px; padding-top: 18px; border-top: 1px solid var(--line); }
.provider-info .pill { min-height: 44px; padding: 10px 13px; }
.provider-info .chips { gap: 7px; }
.install-options { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; margin: 24px 0; }
.install-options .panel { background: #19334f; }
.install-options .panel:first-child { border-color: #77baff; }
.install-options h3 { font-size: 23px; }
.guide-steps { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 22px; margin: 25px 0; }
.guide-steps section { padding-top: 16px; border-top: 1px solid #52718d; }
.guide-steps section > span { color: var(--gold); font-size: 13px; font-weight: 700; }
.guide-steps h3 { font-size: 19px; margin: 12px 0 8px; }
.guide-steps p { font-size: 14px; margin: 0; }
.metrics { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; margin: 24px 0; }
.metric { padding: 23px; border-radius: 16px; background: #15314d; border: 1px solid #ffffff09; }
.metric strong { display: block; font-size: 38px; font-weight: 750; line-height: 1.2; letter-spacing: -.03em; margin-bottom: 10px; color: var(--accent); }
.metric span { font-size: 13px; color: var(--muted); }
table { width: 100%; border-collapse: collapse; font-size: 14px; table-layout: fixed; }
td, th { text-align: left; border-bottom: 1px solid var(--line); padding: 13px 9px; vertical-align: top; overflow-wrap: anywhere; }
th { color: var(--muted); font-weight: 600; }
.chart { display: flex; align-items: flex-end; gap: 4px; height: 160px; border-bottom: 1px solid var(--line); margin: 24px 0; }
.chart:has(>p) { height: auto; min-height: 70px; }
.bar { background: linear-gradient(var(--accent), #3983d3); min-width: 4px; flex: 1; border-radius: 5px 5px 0 0; }
.job-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px; margin: 20px 0; }
.job-grid h3 { font-size: 18px; }
.job-grid p { font-size: 14px; }
.health-state { display: inline-block; margin-bottom: 14px; padding: 5px 11px; border: 1px solid #498caf; border-radius: 999px; color: var(--accent); font-size: 12px; font-weight: 650; }
.health-state.waiting { color: var(--gold); border-color: #ab8849; }
.health-summary { background: linear-gradient(115deg, #173652, #223456); }
.health-summary h3 { font-size: 30px; color: #deedff; }
.room-sharing { margin: 16px 0 26px; }
.room-votes { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 10px; }
.room-votes button { padding: 8px 12px; min-height: 44px; font-size: 13px; }
.room-votes button[aria-pressed=true] { color: var(--dark-ink); background: var(--accent); border-color: var(--accent); }
.empty, .catalog-error { padding: 32px 24px; border: 1px dashed #4b6580; border-radius: 18px; color: var(--muted); text-align: center; background: #102238; }
.empty .actions { justify-content: center; }
.catalog-error { margin: 18px 0; }
.loading { padding: 52px 20px; color: var(--muted); text-align: center; }
.sync-state { font-size: 13px; margin: 0 0 16px; color: var(--accent); }
.sync-state:empty { display: none; }
body:not([data-view=setup]):not([data-view=shelves]) #sync-state { display: none; }
.shelf-tools { margin-top: 32px; padding-top: 16px; border-top: 1px solid var(--line); }
.shelf-tools > summary { font-size: 14px; margin-bottom: 14px; }
.shelf-pagination { margin-top: 24px; }
[data-shelf=favorites].selected { color: #30210b; background: var(--gold); border-color: var(--gold); }
#favorite-title { color: var(--gold); border-color: #826c47; }
#toast { display: none; position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); width: max-content; max-width: min(560px, calc(100vw - 32px)); background: var(--paper); color: var(--dark-ink); border: 1px solid #8badd2; border-radius: 13px; box-shadow: var(--shadow); padding: 15px 20px; z-index: 100; font-size: 14px; }
footer { border-top: 1px solid #ffffff10; padding: 32px clamp(18px, 4vw, 56px) 42px; display: flex; justify-content: space-between; gap: 36px; max-width: 1600px; margin: 0 auto; }
footer .brand { font-size: 17px; margin-bottom: 10px; }
footer p { font-size: 13px; margin: 7px 0; line-height: 1.6; }
.footer-tag { font-size: 12px; color: var(--soft); }
.footer-links { max-width: 620px; }
.footer-links button { border: 0; background: transparent; min-height: 44px; padding: 8px 12px 8px 0; font-size: 13px; color: var(--muted); }
.footer-links button:hover { color: var(--accent); }
.footer-links a { text-decoration: underline; text-underline-offset: 3px; }
@media (max-width: 1000px) {
  .metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .setup-guide { gap: 12px; }
}
@media (max-width: 800px) {
  main { padding-left: 22px; padding-right: 22px; }
  .panels { grid-template-columns: 1fr; gap: 18px; }
  .setup-guide, .guide-steps { grid-template-columns: 1fr; }
  .step-card { padding: 18px; }
  .step-card h3 { margin-bottom: 5px; font-size: 18px; }
  .guide-steps { gap: 18px; }
  .guide-steps section { padding-top: 12px; }
  footer { flex-direction: column; gap: 24px; }
}
@media (max-width: 600px) {
  main { padding: 18px 16px 0; }
  .section-heading { margin: 14px 0 20px; align-items: flex-start; }
  .section-heading h2 { font-size: 25px; }
  .section-heading p:not(.eyebrow) { font-size: 14px; }
  .panel { padding: 19px; border-radius: 16px; }
  .panel p { font-size: 14px; }
  .install-options { grid-template-columns: 1fr; }
  dialog { width: calc(100vw - 20px); max-width: calc(100vw - 20px); padding: 25px 18px; border-radius: 20px; max-height: 90dvh; }
  dialog h2 { font-size: 26px; }
  .detail-layout { grid-template-columns: 1fr; gap: 20px; }
  .detail-layout > div:first-child img { max-width: 145px; }
  .detail-layout h2 { font-size: 26px; }
  .row-item { padding: 9px; gap: 6px; }
  .row-item span { font-size: 13px; }
  .row-item button { padding: 7px; }
  .add-collection-grid { max-height: 480px; }
  .row-title { gap: 7px; }
  .row-number { flex-basis: 21px; width: 21px; }
  .metric { padding: 19px; }
  .metric strong { font-size: 32px; }
  .job-grid { grid-template-columns: 1fr; }
  .health-summary h3 { font-size: 25px; }
  footer { padding: 28px 16px 34px; }
}
@media (max-width: 360px) {
  .metrics { grid-template-columns: 1fr; }
  .row-item { flex-wrap: wrap; }
  .row-item > span { flex: 1 1 calc(100% - 165px); }
  .add-collection-grid { grid-template-columns: 1fr; }
  .inline { flex-wrap: wrap; }
  .inline > input { flex-basis: 100%; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}
/* Native hidden semantics must win over every component layout. */
[hidden] { display: none !important; }
