:root {
  color-scheme: light;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  color: #192c40;
  background: #f4f6f8;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
  --ink: #192c40;
  --muted: #647587;
  --navy: #10283b;
  --navy-soft: #18394f;
  --teal: #087b7b;
  --teal-dark: #066566;
  --teal-pale: #e8f4f2;
  --gold: #dbad62;
  --line: #dce4e9;
  --surface: #fff;
  --shadow: 0 12px 32px rgba(21, 44, 62, .055);
}

* { box-sizing: border-box; }
body {
  min-width: 320px;
  margin: 0;
  line-height: 1.6;
  background:
    radial-gradient(ellipse at 10% 0%, rgba(216, 230, 232, .52), transparent 38rem),
    #f4f6f8;
}
a { color: var(--teal-dark); text-underline-offset: 4px; text-decoration-thickness: 1px; }
a:hover { color: #034e54; }
header {
  position: relative;
  display: flex;
  min-height: 78px;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 15px max(5%, calc((100% - 1160px)/2));
  color: #f5f8fa;
  background: linear-gradient(112deg, #10283b 0%, #16364b 66%, #1b4052 100%);
  box-shadow: 0 3px 14px rgba(10, 31, 47, .14);
}
header::after {
  position: absolute;
  right: 6%;
  bottom: 0;
  width: 170px;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(219, 173, 98, .7), transparent);
  content: '';
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 14px;
  color: #fff;
  text-decoration: none;
}
.brand-logo { display: block; width: auto; height: 58px; padding: 3px 5px; border-radius: 3px; background: #fff; }
.brand span { color: #bbccd4; font-size: 1rem; font-weight: 600; letter-spacing: .02em; }
nav, .actions { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
header nav { gap: 16px; font-size: .92rem; }
header nav form { margin: 0; }
header nav .secondary { border-color: rgba(255,255,255,.25); background: transparent; color: white; }
header nav .secondary:hover { background: rgba(255,255,255,.1); }
main { max-width: 1160px; min-height: 70vh; margin: 38px auto 64px; padding: 0 24px; }
h1, h2, h3, h4 { color: var(--ink); font-family: inherit; line-height: 1.28; }
h1 { margin: 5px 0 12px; font-size: clamp(1.8rem, 4vw, 2.55rem); font-weight: 750; letter-spacing: -.04em; }
h2 { margin: 0 0 12px; font-size: 1.35rem; letter-spacing: -.025em; }
h3 { margin: 17px 0 8px; font-size: 1.05rem; }
p { margin: 10px 0; }
.heading { display: flex; align-items: center; justify-content: space-between; gap: 24px; margin: 26px 0; }
.heading > div { min-width: 0; }
.heading p:not(.eyebrow) { color: var(--muted); }
.eyebrow { margin: 0 0 7px; color: #547b80; font-size: .72rem; font-weight: 700; letter-spacing: .16em; text-transform: uppercase; }
.panel {
  padding: 26px;
  border: 1px solid rgba(213, 224, 231, .9);
  border-radius: 15px;
  background: var(--surface);
  box-shadow: var(--shadow);
}
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 310px), 1fr)); gap: 18px; }
.cards > .panel { transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease; }
.cards > .panel:hover { transform: translateY(-2px); border-color: #c5d8d9; box-shadow: 0 16px 34px rgba(21, 44, 62, .09); }
.cards > article h2 { margin-top: 13px; }
.cards > article h2 a { color: var(--ink); text-decoration: none; }
.cards > article h2 a:hover { color: var(--teal-dark); }
.narrow { max-width: 510px; margin: 58px auto; }
.narrow h1 { font-size: clamp(1.7rem, 4vw, 2.1rem); }
.form-panel { max-width: 760px; margin: 0 auto; }
.notice { padding: 14px 17px; border: 1px solid #d8e7e9; border-left: 3px solid #5b9292; border-radius: 9px; background: #eef5f5; color: #315565; }
.message { margin: 0 0 22px; padding: 13px 17px; border: 1px solid #c7e3d7; border-radius: 10px; background: #eaf6f0; color: #245941; }
.message.info { border-color: #d1e2e9; background: #edf5f8; color: #315565; }
.message.warning { border-color: #eedfbf; background: #fbf5e8; color: #775a22; }
.message.error { border-color: #edcdcd; background: #fbefef; color: #842f36; }
.badge { display: inline-flex; align-items: center; min-height: 27px; padding: 3px 10px; border: 1px solid #d7e8e5; border-radius: 999px; background: var(--teal-pale); color: #216b68; font-size: .76rem; font-weight: 700; letter-spacing: .025em; }
button, .button {
  display: inline-flex;
  min-height: 42px;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 9px 17px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: var(--teal);
  color: #fff;
  font: inherit;
  font-size: .93rem;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
  transition: background .15s ease, transform .15s ease, box-shadow .15s ease;
}
button:hover, .button:hover { transform: translateY(-1px); background: var(--teal-dark); color: #fff; box-shadow: 0 5px 14px rgba(8, 123, 123, .17); }
button:active, .button:active { transform: translateY(0); }
.secondary { border-color: #ccd9df; background: #fff; color: #284e61; }
.secondary:hover { border-color: #a9c3c8; background: #f2f8f7; color: #174753; box-shadow: none; }
.danger { color: #a1393d; }
.danger:hover { color: #7f2029; }
.destructive { background: #a43f45; }
.destructive:hover { background: #862f36; }
.actions { margin-top: 16px; }
label { display: block; margin: 17px 0 6px; color: #2a4052; font-size: .91rem; font-weight: 700; }
input, select, textarea {
  display: block;
  width: 100%;
  min-height: 43px;
  padding: 9px 12px;
  border: 1px solid #cbd7de;
  border-radius: 8px;
  outline: 0;
  background: #fff;
  color: var(--ink);
  font: inherit;
  transition: border-color .15s ease, box-shadow .15s ease;
}
textarea { min-height: 105px; resize: vertical; }
input:hover, select:hover, textarea:hover { border-color: #9fb5bf; }
input:focus, select:focus, textarea:focus { border-color: #4f9692; box-shadow: 0 0 0 3px rgba(8, 123, 123, .12); }
input[type="checkbox"], input[type="radio"] { display: inline-block; width: auto; min-height: 0; accent-color: var(--teal); }
.helptext { display: block; margin-top: 5px; color: var(--muted); font-size: .84rem; }
.errorlist { margin: 7px 0; padding-left: 21px; color: #a1393d; font-size: .9rem; }
.muted, footer { color: var(--muted); font-size: .88rem; }
footer { padding: 25px 20px 32px; border-top: 1px solid #e3e9ed; text-align: center; }
.calculation-overlay { position: fixed; z-index: 1000; inset: 0; display: grid; place-items: center; padding: 20px; background: rgba(17, 34, 48, .58); backdrop-filter: blur(3px); }
.calculation-overlay[hidden] { display: none; }
.calculation-dialog { width: min(100%, 430px); padding: 34px 30px 28px; border: 1px solid #dbe6e8; border-radius: 18px; background: #fff; box-shadow: 0 25px 80px rgba(8, 26, 40, .28); text-align: center; }
.calculation-dialog h2 { margin: 16px 0 5px; }
.calculation-dialog p { margin: 8px 0; }
.calculation-dialog .muted { margin-top: 17px; font-size: .85rem; }
.calculation-spinner { display: inline-block; width: 48px; height: 48px; border: 4px solid #d9eeea; border-top-color: var(--teal); border-right-color: var(--teal); border-radius: 50%; animation: calculation-spin .8s linear infinite; }
@keyframes calculation-spin { to { transform: rotate(360deg); } }
form[data-calculation-form] button:disabled { background: #577e7d; cursor: wait; transform: none; box-shadow: none; }
details { margin: 17px 0; padding: 13px 16px; border: 1px solid var(--line); border-radius: 10px; background: rgba(255,255,255,.75); }
summary { color: #2c5061; font-weight: 700; cursor: pointer; }
summary:hover { color: var(--teal-dark); }
dl { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(70px, .8fr); gap: 7px 14px; margin: 17px 0; padding: 15px; border-radius: 10px; background: #f6f8f9; font-size: .9rem; }
dt { color: var(--muted); }
dd { margin: 0; color: #294253; font-weight: 600; text-align: right; }
article { margin: 17px 0; }
article > ul, section > ul { padding-left: 22px; }
.calendar-panel { margin-top: 24px; }
.calendar-panel .heading { margin-top: 0; }
.month-picker { display: flex; align-items: end; flex-wrap: wrap; gap: 9px; }
.month-picker label { width: 100%; margin: 0; }
.month-picker input { width: auto; min-width: 155px; }
.month-nav { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 16px; margin: 7px 0 12px; }
.month-nav > :last-child { text-align: right; }
.month-nav h3 { margin: 8px 0; text-align: center; }
.calendar-scroll { overflow-x: auto; }
.calendar-grid { width: 100%; min-width: 490px; table-layout: fixed; border-collapse: separate; border-spacing: 5px; }
.calendar-grid caption { padding: 4px 0 10px; color: var(--muted); text-align: left; }
.calendar-grid th { padding: 7px 8px; color: #70818e; font-size: .77rem; font-weight: 700; text-align: left; text-transform: uppercase; letter-spacing: .07em; }
.calendar-grid td { height: 88px; padding: 0; border: 1px solid #e4eaed; border-radius: 9px; background: #fafbfc; vertical-align: top; }
.calendar-night { display: flex; min-height: 88px; flex-direction: column; gap: 8px; padding: 10px; border-radius: 8px; background: linear-gradient(145deg, #e9f4f2, #f4f8f7); text-decoration: none; transition: background .15s ease, transform .15s ease; }
.calendar-night:hover { transform: scale(1.015); background: #d8ebe7; }
.calendar-night strong { color: #1d4254; font-size: 1.03rem; }
.calendar-night span { color: #50706f; font-size: .7rem; line-height: 1.3; }
.calendar-outside { display: block; min-height: 88px; padding: 10px; border-radius: 8px; background: #f2f4f5; color: #9aa6ad; }
.night-section { margin-top: 22px; }
.night-section > h2:first-child { margin-bottom: 13px; }
.night-section article { padding: 16px 18px; border: 1px solid #e1e8eb; border-radius: 10px; background: #fbfcfc; }
.night-section article h3 { margin-top: 8px; }
.night-section article ul { margin-bottom: 0; }
.section-heading { display: flex; align-items: end; justify-content: space-between; gap: 22px; }
.section-heading h2 { margin-bottom: 4px; }
.section-heading p { margin: 0; }
.plot-controls { display: flex; align-items: end; gap: 9px; }
.plot-controls label { margin: 0; white-space: nowrap; }
.plot-controls select { width: auto; min-width: 90px; }
.table-scroll { width: 100%; overflow-x: auto; margin: 14px 0; border: 1px solid #dfe7eb; border-radius: 10px; }
.data-table { width: 100%; border-collapse: collapse; background: #fff; font-size: .9rem; }
.data-table caption { padding: 11px 14px; background: #f5f8f9; color: var(--muted); font-size: .82rem; text-align: left; }
.data-table th, .data-table td { padding: 11px 13px; border-bottom: 1px solid #e6ecef; text-align: left; vertical-align: top; }
.data-table thead th { background: #edf3f5; color: #345061; font-size: .77rem; font-weight: 700; letter-spacing: .04em; white-space: nowrap; }
.data-table tbody tr:last-child > * { border-bottom: 0; }
.data-table tbody tr:nth-child(even) { background: #fafcfc; }
.data-table tbody th { color: #263e50; font-weight: 700; }
.data-table thead th span { color: #718391; font-size: .72rem; font-weight: 500; letter-spacing: 0; }
.totals-table { min-width: 850px; }
.totals-table td:not(:last-child) { white-space: nowrap; }
.source-appointments { min-width: 180px; }
.source-appointments summary { color: #1d5364; cursor: pointer; }
.source-appointments summary:hover { color: #087c78; }
.source-appointments summary span { display: block; margin-top: 4px; color: var(--muted); font-size: .76rem; font-weight: 500; }
.source-appointments[open] { min-width: 300px; }
.source-appointments .table-scroll { min-width: 0; margin: 12px 0 2px; }
.appointment-table { min-width: 590px; font-size: .82rem; }
.appointment-table th, .appointment-table td { padding: 8px 10px; white-space: nowrap; }
.source-appointments > .muted { margin: 10px 0 2px; font-size: .82rem; font-weight: 500; }
.schedule-summary > h3 { margin-top: 24px; }
.summary-section-heading p { margin: 0; color: var(--muted); }
.timeline-heading { display: flex; align-items: end; justify-content: space-between; gap: 22px; margin-top: 28px; }
.timeline-heading h3 { margin: 0 0 5px; }
.timeline-heading p { margin: 0; color: var(--muted); }
.timeline-controls { display: flex; align-items: end; flex-wrap: wrap; justify-content: flex-end; gap: 10px; }
.timeline-controls label { min-width: 145px; margin: 0; font-size: .8rem; }
.timeline-controls input { min-width: 145px; margin-top: 4px; }
.timeline-controls button { min-height: 39px; }
.timeline-scales, .timeline-date-nav { display: flex; align-items: end; gap: 4px; }
.timeline-scales button { min-height: 39px; padding: 8px 11px; background: #eaf0f2; color: #36505e; }
.timeline-scales button[aria-pressed="true"] { background: #155c68; color: #fff; }
.timeline-date-nav { gap: 6px; }
.timeline-date-nav button { min-width: 39px; padding: 7px; }
.timeline-date-nav button:disabled { cursor: not-allowed; opacity: .45; }
.timeline-figure { margin: 10px 0 24px; }
.timeline-figure figcaption { margin-left: 2px; }
.timeline-scroll { max-width: 100%; margin-top: 8px; overflow: auto; border: 1px solid #d6e0e3; border-radius: 9px; background: #fff; }
.timeline-scroll:focus-visible { outline: 3px solid #4d9ba0; outline-offset: 2px; }
.timeline-scroll svg { display: block; max-width: none; font-family: inherit; }
.timeline-details { min-height: 1.4em; margin: 8px 2px 0; color: #3d5865; font-size: .84rem; }
.timeline-axis-label { fill: #536c78; font-size: 12px; font-weight: 700; }
.timeline-night-label { fill: #465e6a; font-size: 11px; font-weight: 700; }
.timeline-source-label { fill: #233d4b; font-size: 12px; }
.timeline-visit { cursor: help; }
.timeline-visit:focus { outline: none; }
.timeline-visit:focus rect, .timeline-visit:hover rect { stroke: #163e4d; stroke-width: 2.5; }
.timeline-visit-count { fill: #fff; font-size: 12px; font-weight: 700; pointer-events: none; }
.timeline-moon { cursor: help; }
.timeline-moon:focus { outline: none; }
.timeline-moon:focus circle { stroke: #147d83; stroke-width: 2.5; }
.timeline-moon-percent { fill: #536c78; font-size: 9px; font-weight: 600; }
.timeline-empty { fill: #607985; font-size: 14px; }
.timeline-legend { display: flex; flex-wrap: wrap; gap: 8px 16px; margin: 10px 0 0; padding: 0; list-style: none; }
.timeline-legend li { display: flex; align-items: center; gap: 6px; color: #415a66; font-size: .8rem; }
.timeline-swatch { width: 11px; height: 11px; flex: 0 0 11px; border-radius: 3px; }
.count-explainer { background: #f5f8f8; border-color: #d7e4e4; }
.count-explainer li + li { margin-top: 7px; }
.count-explainer p { margin-top: 15px; }
.schedule-state { margin: 18px 0; border-left: 4px solid #82939b; }
.schedule-state { display: flex; align-items: center; justify-content: space-between; gap: 24px; }
.schedule-state > div:first-child { min-width: 0; }
.schedule-state .actions { justify-content: flex-end; margin: 0; }
.plan-commands { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 18px 0; }
.plan-commands form { margin: 0; }
.detail-grid { display: grid; grid-template-columns: minmax(150px, .4fr) 1fr; gap: 7px 18px; }
.detail-grid dt { color: var(--muted); font-weight: 700; }
.detail-grid dd { margin: 0; }
.schedule-state h2 { margin: 3px 0 8px; font-size: 1.2rem; }
.schedule-state p:last-child { margin-bottom: 0; }
.schedule-state .button { margin-top: 4px; }
.state-warning { color: #a34e25; }
.state-review { color: #80570b; }
.state-approved { color: #087c64; }
.replan-callout { display: flex; align-items: center; justify-content: space-between; gap: 24px; margin: 22px 0; padding: 22px 24px; border: 1px solid #b8d9d1; border-radius: 14px; background: linear-gradient(110deg, #eaf6f2, #f5faf8); }
.replan-callout h2 { margin: 2px 0 5px; font-size: 1.25rem; }
.replan-callout p:last-child { margin: 0; color: #526d70; }
.replan-button { min-height: 52px; padding: 12px 24px; font-size: 1rem; white-space: nowrap; box-shadow: 0 6px 15px rgba(8, 123, 123, .16); }
.coverage-table { width: auto; min-width: min(100%, 560px); }
.sequence-group + .sequence-group { border-top: 3px solid #dce7e9; }
.sequence-group th[scope="rowgroup"] { min-width: 180px; background: #f3f7f7; vertical-align: middle; }
.sequence-name, .sequence-kind { display: block; }
.sequence-kind { margin-top: 4px; color: var(--muted); font-size: .8rem; font-weight: 500; }
.diagnostic-table { min-width: 740px; }
.diagnostic-table td:nth-child(2) { min-width: 300px; }
.violation-list { margin: 0; padding-left: 18px; }
.violation-list li + li { margin-top: 4px; }
.gap-diagnostic { padding: 0; overflow: hidden; }
.gap-diagnostic summary { padding: 14px 16px; background: #f7f9fa; }
.gap-diagnostic .table-scroll { margin: 0; border: 0; border-top: 1px solid #e1e8eb; border-radius: 0; }
.import-panel { max-width: 800px; }
.import-plan-picker { display: grid; grid-template-columns: minmax(180px, 1fr) auto; align-items: end; gap: 10px; margin: 22px 0; padding: 18px; border: 1px solid #e3eaed; border-radius: 11px; background: #f8fafb; }
.import-plan-picker label { grid-column: 1 / -1; margin: 0; }
.import-plan-picker select { min-width: 0; }
.import-source-form { margin-top: 24px; }
.import-list-heading { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 12px; }
.import-list-heading h2 { margin: 0; }
.import-list-heading p { margin: 4px 0 0; }
.import-source-row { display: flex; align-items: flex-start; gap: 13px; margin: 0; padding: 14px 15px; border: 1px solid #e1e8eb; border-bottom: 0; background: white; cursor: pointer; }
.import-source-row:nth-of-type(even) { background: #fafcfc; }
.import-source-row:first-of-type { border-radius: 10px 10px 0 0; }
.import-source-row:last-of-type { border-bottom: 1px solid #e1e8eb; border-radius: 0 0 10px 10px; }
.import-source-row input { flex: 0 0 auto; margin: 5px 0 0; }
.import-source-copy { display: flex; min-width: 0; flex-direction: column; gap: 2px; }
.import-source-copy strong { color: #213b4d; }
.import-source-copy span { color: var(--muted); font-size: .87rem; font-weight: 400; }
.import-source-copy small { color: #956b2c; font-size: .82rem; }
.import-source-disabled { background: #f3f5f6 !important; cursor: default; }
.import-source-disabled .import-source-copy strong { color: #788791; }
.import-note { margin: 15px 0; }
.visibility-plot { display: block; width: 100%; height: auto; margin: 18px auto 8px; border-radius: 8px; }
form p { margin: 0 0 12px; }
form p label { margin-top: 15px; }
form p input, form p select, form p textarea { margin-top: 4px; }
form > .actions, form > button { margin-top: 18px; }
:focus-visible { outline: 3px solid #e1b362; outline-offset: 3px; }
@media (max-width: 700px) {
  header { min-height: 70px; padding: 13px 20px; }
  header::after { right: 20px; width: 110px; }
  main { margin: 28px auto 46px; padding: 0 17px; }
  .heading { align-items: flex-start; flex-direction: column; gap: 13px; margin: 21px 0; }
  .schedule-state { align-items: stretch; flex-direction: column; gap: 12px; }
  .schedule-state .actions { justify-content: flex-start; }
  .panel { padding: 20px; border-radius: 13px; }
  .month-nav { gap: 7px; font-size: .8rem; }
  .month-nav h3 { font-size: .92rem; }
  .section-heading { align-items: flex-start; flex-direction: column; }
  .timeline-heading { align-items: stretch; flex-direction: column; gap: 14px; }
  .timeline-controls { justify-content: flex-start; }
  .timeline-scales { width: 100%; }
  .timeline-scales button { flex: 1; padding: 8px 7px; }
  .timeline-date-nav { flex: 1; }
  .timeline-date-nav label { flex: 1; }
  .timeline-date-nav input { width: 100%; }
  .plot-controls { width: 100%; flex-wrap: wrap; }
  .replan-callout { align-items: stretch; flex-direction: column; gap: 14px; }
  .replan-button { width: 100%; }
}
@media (max-width: 460px) {
  header { align-items: flex-start; flex-direction: column; gap: 9px; }
  header nav { align-self: stretch; justify-content: space-between; }
  .brand-logo { height: 48px; }
  main { padding: 0 13px; }
  .panel { padding: 17px; }
  .actions { gap: 9px; }
  .actions .button, .actions button { flex: 1 1 auto; }
  .month-picker { align-items: stretch; width: 100%; }
  .month-picker input { flex: 1; }
  dl { grid-template-columns: 1fr; gap: 2px; }
  dd { margin-bottom: 8px; text-align: left; }
  .import-plan-picker { grid-template-columns: 1fr; }
  .import-plan-picker label { grid-column: auto; }
  .import-plan-picker button { width: 100%; }
  .import-list-heading { align-items: flex-start; flex-direction: column; }
  .plot-controls select { flex: 1; }
  .data-table th, .data-table td { padding: 9px 10px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; }
  .calculation-spinner { animation: none; border-color: var(--teal); border-right-color: #d9eeea; }
}
