:root {
  color-scheme: light;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: #17324d;
  background: #f4f7f6;
  font-synthesis: none;
  --ink: #17324d;
  --muted: #58707c;
  --line: #cedbde;
  --surface: #ffffff;
  --brand: #073b4c;
  --accent: #0f766e;
  --accent-dark: #0b5f59;
  --success: #166534;
  --error: #b42318;
  --soft: #e8f3f1;
  --radius: 12px;
}

* { box-sizing: border-box; }
html, body { margin: 0; max-width: 100%; min-height: 100%; overflow-x: hidden; }
body { line-height: 1.55; }
a { color: #075985; text-underline-offset: 3px; }
h1, h2, h3 { color: var(--brand); line-height: 1.2; }
h1 { margin: 0 0 .75rem; font-size: clamp(1.75rem, 4vw, 2.45rem); letter-spacing: -.03em; }
h2 { margin: 0 0 .75rem; font-size: 1.15rem; }
p { margin: .45rem 0 1rem; }
small, .note { color: var(--muted); }

.header {
  min-height: 68px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: .8rem max(1rem, calc((100% - 1200px) / 2));
  background: var(--brand);
  color: #fff;
}
.header a { color: #fff; text-decoration: none; font-weight: 760; letter-spacing: .01em; }
.header small { color: #cde2e5; font-weight: 500; }
.session { flex: 0 0 auto; padding: .3rem .62rem; border: 1px solid #557985; border-radius: 999px; color: #d8e8ea; font-size: .82rem; white-space: nowrap; }
.session.ready { color: #d8f7ea; border-color: #5f9f8b; }

.layout { display: grid; grid-template-columns: 238px minmax(0, 1fr); max-width: 1200px; margin: 0 auto; min-width: 0; }
.tree { min-width: 0; padding: 1.25rem 1rem; background: var(--surface); border-right: 1px solid var(--line); }
.tree details { border-bottom: 1px solid #e7edef; padding: .3rem 0 .65rem; margin-bottom: .35rem; }
.tree summary { padding: .42rem .3rem; font-size: .9rem; font-weight: 750; cursor: pointer; color: var(--brand); }
.tree ul { list-style: none; padding: 0 0 0 .55rem; margin: .15rem 0 0; }
.tree li { min-width: 0; }
.tree a { display: block; padding: .42rem .55rem; border-radius: 7px; color: #385463; text-decoration: none; overflow-wrap: anywhere; }
.tree a:hover { background: #f0f5f4; }
.tree a[aria-current="page"], .tree a.current { font-weight: 750; color: #064e3b; background: var(--soft); }

.main { width: 100%; min-width: 0; max-width: 962px; padding: 1.7rem clamp(1rem, 3vw, 2rem) 3rem; }
.breadcrumb { margin: 0 0 .9rem; color: var(--muted); font-size: .84rem; }
.card { min-width: 0; margin: 1rem 0; padding: clamp(1rem, 2.5vw, 1.3rem); background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 4px 18px rgb(7 59 76 / 5%); }
.grid, .form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(220px, 100%), 1fr)); gap: .9rem; align-items: start; }
.grid > *, .form-grid > *, form { min-width: 0; }
.full { grid-column: 1 / -1; }
.inline-form { display: flex; flex-wrap: wrap; align-items: end; gap: .8rem; }
.inline-form > label { flex: 1 1 210px; min-width: 0; }
.form-actions { display: flex; flex-wrap: wrap; gap: .7rem; align-items: center; }
.form-section { padding-top: .2rem; }

label { display: grid; gap: .32rem; color: #304c5a; font-size: .91rem; font-weight: 650; }
input, select, textarea, button { max-width: 100%; font: inherit; }
input, select, textarea { width: 100%; min-height: 43px; padding: .58rem .65rem; color: var(--ink); background: #fff; border: 1px solid #aebfc4; border-radius: 7px; }
input:focus, select:focus, textarea:focus { outline: 3px solid rgb(15 118 110 / 18%); border-color: var(--accent); }
.checkbox { display: flex; grid-template-columns: auto 1fr; align-items: center; gap: .55rem; font-weight: 550; }
.checkbox input { width: 18px; min-height: 18px; }
button, .button { display: inline-flex; min-height: 42px; align-items: center; justify-content: center; padding: .55rem .9rem; border: 1px solid var(--accent); border-radius: 7px; background: var(--accent); color: #fff; cursor: pointer; text-decoration: none; font-weight: 720; }
button:hover, .button:hover { background: var(--accent-dark); }
button:disabled { cursor: progress; opacity: .55; }
.button.secondary { color: var(--accent); background: #fff; }

.notice { min-height: 1.55em; margin: .7rem 0; color: var(--muted); overflow-wrap: anywhere; }
.notice.success, .success { color: var(--success); }
.notice.error, .error { color: var(--error); }
.notice.error { padding: .7rem .8rem; border-left: 4px solid var(--error); background: #fff3f1; }

.metrics { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .8rem; margin: 1rem 0; }
.metric-card { display: grid; gap: .1rem; padding: 1rem; border-radius: var(--radius); background: var(--brand); color: #fff; }
.metric-card strong { font-size: clamp(1.6rem, 4vw, 2.25rem); line-height: 1; }
.metric-card span { color: #cde2e5; font-size: .9rem; }
.plain-list { margin: 0; padding: 0; list-style: none; }
.plain-list li { display: flex; justify-content: space-between; gap: 1rem; padding: .55rem 0; border-bottom: 1px solid #e7edef; }
.plain-list li:last-child { border-bottom: 0; }
.empty { color: var(--muted); }

.table-wrap { width: 100%; overflow-x: auto; overscroll-behavior-inline: contain; -webkit-overflow-scrolling: touch; }
table { width: 100%; min-width: 900px; border-collapse: collapse; }
th, td { padding: .68rem .62rem; border-bottom: 1px solid #dce5e7; text-align: left; vertical-align: top; overflow-wrap: normal; word-break: normal; }
th { color: #435d68; background: #f7f9f9; font-size: .8rem; letter-spacing: .03em; text-transform: uppercase; white-space: nowrap; }
td:nth-child(5), td:nth-child(6) { white-space: nowrap; }
td strong, td span { display: block; }
td span { margin-top: .18rem; color: #425f6b; }
.technical { margin-top: .45rem; color: var(--muted); font-size: .82rem; }
.technical summary { cursor: pointer; }
pre { max-width: 100%; margin: .45rem 0 0; padding: .65rem; overflow: auto; border-radius: 7px; background: #f3f6f6; white-space: pre-wrap; overflow-wrap: anywhere; font: .77rem/1.45 ui-monospace, SFMono-Regular, Menlo, monospace; }
.rehearsal-log { margin: .8rem 0 0; padding-left: 1.4rem; }
.rehearsal-log li { padding: .24rem 0; overflow-wrap: anywhere; }

@media (max-width: 720px) {
  .header { min-height: 60px; align-items: flex-start; }
  .header a { max-width: calc(100% - 110px); }
  .layout { display: block; }
  .tree { padding: .55rem .8rem; border-right: 0; border-bottom: 1px solid var(--line); }
  .tree details { margin: 0; padding: .1rem 0 .28rem; }
  .tree summary { padding: .35rem .25rem; }
  .tree ul { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .2rem; padding: 0; }
  .tree a { padding: .42rem; font-size: .86rem; }
  .main { padding: 1.15rem .85rem 2.5rem; }
  .card { margin: .8rem 0; padding: .9rem; }
  .metrics { gap: .45rem; }
  .metric-card { padding: .75rem .6rem; }
  .metric-card span { font-size: .76rem; }
  .inline-form, .form-actions { align-items: stretch; }
  .inline-form > label, .inline-form > button, .form-actions > * { flex: 1 1 100%; }
  table { min-width: 900px; }
}
