:root {
  color-scheme: light;
  --ink: #092236;
  --muted: #62727f;
  --paper: #f4f7f5;
  --card: #ffffff;
  --line: #d9e2df;
  --teal: #087f74;
  --teal-dark: #05635b;
  --amber: #f2b84b;
  --red: #ba3b3b;
  --shadow: 0 16px 45px rgba(4, 35, 49, 0.08);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--paper); color: var(--ink); }
button, input, select { font: inherit; }
button { cursor: pointer; }

.masthead {
  display: flex; align-items: flex-end; justify-content: space-between; gap: 2rem;
  padding: 3.5rem max(2rem, calc((100vw - 1420px) / 2));
  color: white; background: linear-gradient(125deg, #061b2b 0%, #0b4150 58%, #087f74 100%);
}
h1, h2, p { margin-top: 0; }
h1 { margin-bottom: .6rem; font-size: clamp(2.2rem, 5vw, 4.7rem); letter-spacing: -.055em; line-height: .95; }
h2 { margin-bottom: .75rem; font-size: 1.35rem; letter-spacing: -.025em; }
.eyebrow { margin-bottom: .65rem; color: #8dd8ce; font-size: .72rem; font-weight: 800; letter-spacing: .16em; }
.lede { max-width: 690px; margin-bottom: 0; color: #c9dcdf; font-size: 1.05rem; line-height: 1.55; }
.status-card { min-width: 260px; display: flex; gap: .8rem; align-items: center; padding: 1rem 1.1rem; border: 1px solid rgba(255,255,255,.18); border-radius: 16px; background: rgba(0,0,0,.16); backdrop-filter: blur(10px); }
.status-card strong, .status-card small { display: block; }
.status-card small { margin-top: .2rem; color: #c9dcdf; }
.status-dot { width: 12px; height: 12px; flex: 0 0 auto; border-radius: 50%; background: var(--amber); box-shadow: 0 0 0 5px rgba(242,184,75,.15); }
.status-dot.ok { background: #64d6a5; box-shadow: 0 0 0 5px rgba(100,214,165,.15); }
.status-dot.error { background: #ff7c72; box-shadow: 0 0 0 5px rgba(255,124,114,.15); }

main { width: min(1420px, calc(100% - 4rem)); margin: -1.4rem auto 5rem; }
.summary-grid { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 1rem; }
.summary-grid article, .panel { border: 1px solid var(--line); border-radius: 18px; background: var(--card); box-shadow: var(--shadow); }
.summary-grid article { padding: 1.15rem 1.3rem; }
.summary-grid span { display: block; margin-bottom: .35rem; color: var(--muted); font-size: .78rem; }
.summary-grid strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 1.05rem; }
.panel { padding: 1.3rem; }
.toolbar { display: flex; align-items: flex-end; gap: 1rem; margin-top: 1rem; }
.field { margin-bottom: 1rem; }
.field.grow { flex: 1; }
.field.compact { width: 180px; }
label { display: block; margin-bottom: .4rem; color: #39505e; font-size: .78rem; font-weight: 750; }
input, select { width: 100%; min-height: 44px; padding: .66rem .72rem; border: 1px solid #cbd7d3; border-radius: 10px; background: white; color: var(--ink); }
input:focus, select:focus { outline: 3px solid rgba(8,127,116,.14); border-color: var(--teal); }
.button { min-height: 44px; padding: .7rem 1rem; border: 1px solid var(--teal); border-radius: 10px; background: var(--teal); color: white; font-weight: 750; }
.button:hover { background: var(--teal-dark); }
.button:disabled { opacity: .45; cursor: not-allowed; }
.button.secondary { border-color: #c9d6d2; background: #f9fbfa; color: var(--ink); }
.button.secondary:hover { background: #edf3f1; }
.button.danger { border-color: var(--red); background: var(--red); }
.button.ghost { border-color: transparent; background: transparent; }
.button.danger-text { color: var(--red); }
.button.full { width: 100%; }

.message { margin-top: 1rem; padding: .9rem 1.1rem; border-radius: 12px; background: #e5f4ef; color: #07594f; }
.message.error { background: #fbe8e6; color: #902d2d; }
.workspace { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 1.3rem; margin-top: 1.7rem; }
.section-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem; margin-bottom: .4rem; }
.section-heading h2 { margin-bottom: 0; font-size: 1.8rem; }
.section-heading .eyebrow { color: var(--teal); }
.help { color: var(--muted); font-size: .88rem; line-height: 1.5; }
.slot-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: .85rem; margin-top: 1.2rem; }
.slot-card { min-height: 155px; display: grid; grid-template-columns: 58px minmax(0,1fr); gap: 1rem; padding: 1rem; border: 1px solid var(--line); border-radius: 16px; background: white; text-align: left; box-shadow: 0 8px 24px rgba(4,35,49,.045); }
.slot-card:hover { border-color: #8ebcb6; transform: translateY(-1px); }
.slot-number { display: grid; place-items: center; width: 58px; height: 58px; border-radius: 14px; background: #092b3c; color: white; font-size: 1.45rem; font-weight: 850; }
.slot-card h3 { margin: .1rem 0 .35rem; font-size: 1.05rem; }
.slot-card p { margin-bottom: .5rem; color: var(--muted); font-size: .8rem; line-height: 1.4; }
.pill { display: inline-block; margin: .15rem .3rem .15rem 0; padding: .22rem .48rem; border-radius: 999px; background: #edf5f2; color: #176b61; font-size: .68rem; font-weight: 800; }
.pill.inherited { background: #fff2d9; color: #8a5a00; }
.empty-slot { color: #82919a; }
.side-stack { display: grid; gap: 1rem; align-content: start; }
.side-stack .eyebrow { color: var(--teal); }
.asset-library { display: grid; gap: .55rem; max-height: 330px; overflow: auto; margin-top: 1rem; }
.asset-row { display: grid; grid-template-columns: 52px minmax(0,1fr); gap: .65rem; align-items: center; padding: .5rem; border: 1px solid var(--line); border-radius: 10px; }
.asset-row img { width: 52px; height: 42px; object-fit: cover; border-radius: 6px; background: #e7eeeb; }
.asset-row strong, .asset-row small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.asset-row strong { font-size: .78rem; }
.asset-row small { margin-top: .15rem; color: var(--muted); font-size: .68rem; }
.revision-list { display: grid; gap: .6rem; }
.revision { padding: .75rem; border: 1px solid var(--line); border-radius: 10px; }
.revision-row { display: flex; justify-content: space-between; gap: .5rem; }
.revision strong { display: block; font-size: .8rem; }
.revision small { display: block; margin-top: .25rem; color: var(--muted); font-size: .7rem; }
.revision .button { min-height: 32px; padding: .35rem .55rem; font-size: .7rem; }

dialog { width: min(680px, calc(100% - 2rem)); border: 0; border-radius: 20px; padding: 0; color: var(--ink); box-shadow: 0 28px 100px rgba(0,0,0,.28); }
dialog::backdrop { background: rgba(2,19,29,.66); backdrop-filter: blur(4px); }
dialog form { padding: 1.5rem; }
.dialog-heading { display: flex; justify-content: space-between; gap: 1rem; }
.dialog-heading .eyebrow { color: var(--teal); }
.icon-button { width: 38px; height: 38px; border: 0; border-radius: 50%; background: #edf2f0; color: var(--ink); font-size: 1.5rem; }
.two-column { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
details { margin: .3rem 0 1.2rem; padding: .8rem; border: 1px solid var(--line); border-radius: 10px; }
summary { cursor: pointer; font-size: .82rem; font-weight: 750; }
.schedule-fields { margin-top: 1rem; }
.schedule-fields .field { margin-bottom: 0; }
.dialog-actions { display: grid; grid-template-columns: auto 1fr auto auto; gap: .7rem; align-items: center; }

@media (max-width: 980px) {
  .masthead { align-items: stretch; flex-direction: column; }
  .status-card { min-width: 0; }
  .summary-grid { grid-template-columns: 1fr 1fr; }
  .workspace { grid-template-columns: 1fr; }
  .side-stack { grid-template-columns: repeat(2,1fr); }
  .history-panel { grid-column: 1 / -1; }
}
@media (max-width: 680px) {
  .masthead { padding: 2.5rem 1.15rem 3rem; }
  main { width: calc(100% - 1.4rem); }
  .summary-grid, .slot-grid, .side-stack, .two-column { grid-template-columns: 1fr; }
  .toolbar, .section-heading { align-items: stretch; flex-direction: column; }
  .field.compact { width: auto; }
  .toolbar .button, .section-heading .button { width: 100%; }
  .dialog-actions { grid-template-columns: 1fr 1fr; }
  .dialog-actions span { display: none; }
}
