:root {
  --ink: #18343a;
  --muted: #718487;
  --line: #dfe8e6;
  --bg: #f4f7f6;
  --teal: #127c73;
  --pale: #e8f4f1;
  --white: #fff;
  --shadow: 0 8px 24px #15383a0a;
  font-family: "Segoe UI", Arial, sans-serif;
}
* { box-sizing: border-box; }
body { margin: 0; min-width: 320px; background: var(--bg); color: var(--ink); }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
.app-shell { min-height: 100vh; }
.topbar { min-height: 66px; display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 12px 24px; background: var(--white); border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 11px; font-weight: 700; }
.brand-mark { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 12px; background: #dceee9; color: var(--teal); font-size: 21px; }
.brand-sub { display: block; color: var(--muted); font-size: 10px; font-weight: 600; letter-spacing: .09em; }
.status { display: inline-flex; align-items: center; gap: 7px; padding: 7px 10px; border-radius: 20px; background: #fff6dd; color: #806324; font-size: 11px; font-weight: 600; }
.status-dot { width: 7px; height: 7px; border-radius: 50%; background: #d7a632; }
.content { width: min(1120px, 100%); margin: 0 auto; padding: 26px 24px 48px; }
.eyebrow { color: var(--teal); font-size: 10px; font-weight: 700; letter-spacing: .13em; text-transform: uppercase; }
h1 { margin: 4px 0; font-size: clamp(23px, 3vw, 30px); line-height: 1.15; letter-spacing: -.03em; }
h2 { margin: 0; font-size: 16px; }
.subtitle { margin: 0; color: var(--muted); font-size: 13px; }
.page-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 20px; }
.card { margin-bottom: 14px; padding: 20px; border: 1px solid var(--line); border-radius: 14px; background: var(--white); box-shadow: var(--shadow); }
.card-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 15px; }
.list-tools { display: flex; align-items: center; gap: 9px; min-width: 0; }
.search-control { width: min(250px, 26vw); min-height: 36px; padding: 8px 10px; font-size: 12px; }
.start-episode-form .form-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: end; }
.start-episode-action { grid-column: 1 / -1; display: flex; justify-content: flex-end; }
.helper { margin: 4px 0 0; color: var(--muted); font-size: 12px; }
.badge { padding: 5px 9px; border-radius: 20px; background: var(--pale); color: #48716c; font-size: 10px; font-weight: 700; white-space: nowrap; }
.form-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 13px; }
.field { display: block; min-width: 0; }
.field-label { display: block; margin-bottom: 5px; color: #536b6e; font-size: 11px; font-weight: 600; }
.field-choice { min-width: 0; margin: 0; padding: 0; border: 0; }
.choice-grid { display: flex; flex-wrap: wrap; gap: 8px; }
.choice-option { display: inline-flex; align-items: center; gap: 7px; min-height: 40px; padding: 8px 11px; border: 1px solid #d5e1df; border-radius: 9px; background: #fff; color: #405d61; font-size: 12px; }
.choice-option input { width: 17px; height: 17px; accent-color: var(--teal); }
.control { display: block; width: 100%; min-height: 43px; padding: 10px 11px; border: 1px solid #d5e1df; border-radius: 9px; background: #fff; color: var(--ink); }
.control:focus { outline: 3px solid #b8dfd6; border-color: var(--teal); }
textarea.control { min-height: 82px; resize: vertical; }
.span-2 { grid-column: span 2; }
.span-3 { grid-column: span 3; }
.span-all { grid-column: 1 / -1; }
.form-section { margin-top: 14px; padding-top: 14px; border-top: 1px solid #edf1f0; }
.section-title { display: flex; align-items: center; gap: 9px; margin-bottom: 12px; color: #315156; font-size: 12px; font-weight: 700; }
.section-code { display: grid; place-items: center; width: 23px; height: 23px; border-radius: 7px; background: var(--pale); color: var(--teal); }
.actions { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; margin-top: 18px; }
.button { min-height: 42px; padding: 10px 15px; border: 1px solid #d5e1df; border-radius: 9px; background: #fff; color: #405d61; font-size: 12px; font-weight: 700; }
.button:hover { background: #f5faf8; }
.button-primary { border-color: var(--teal); background: var(--teal); color: #fff; }
.button-primary:hover { background: #0d6c64; }
.button-danger { border-color: #e6c7c3; color: #9a4038; background: #fff; }
.button-danger:hover { background: #fff3f1; }
.button-quiet { border-color: transparent; background: transparent; color: var(--teal); }
.button-row { display: flex; flex-wrap: wrap; gap: 8px; }
.notice { margin: 0 0 16px; padding: 12px 14px; border: 1px solid #e8dfbd; border-radius: 10px; background: #fff9e8; color: #756330; font-size: 12px; line-height: 1.45; }
.message { margin-top: 12px; }
.empty { padding: 22px; border: 1px dashed #cad8d5; border-radius: 11px; color: var(--muted); text-align: center; font-size: 13px; }
.episode-list, .record-list { display: grid; gap: 9px; }
.episode-item { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 13px 14px; border: 1px solid var(--line); border-radius: 10px; background: #fff; }
.episode-main { min-width: 0; }
.episode-actions { flex-wrap: nowrap; }
.episode-title { font-size: 13px; font-weight: 700; }
.episode-meta, .record-meta { margin-top: 3px; color: var(--muted); font-size: 11px; }
.episode-id { margin-top: 5px; color: #8a9898; font-size: 10px; overflow-wrap: anywhere; }
.stats-row { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0; }
.stat-chip { padding: 7px 10px; border-radius: 8px; background: #f1f6f4; color: #4d696a; font-size: 11px; }
.record-item { padding: 11px 13px; border: 1px solid var(--line); border-radius: 9px; background: #fff; }
.record-type { color: #315156; font-size: 12px; font-weight: 700; }
.footer-note { margin-top: 20px; color: #889899; font-size: 10px; text-align: center; }
.required-mark { color: #b2534a; }
details.card > summary { cursor: pointer; list-style: none; }
details.card > summary::-webkit-details-marker { display: none; }
@media (max-width: 850px) {
  .content { padding: 21px 16px 36px; }
  .form-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .span-3 { grid-column: span 2; }
}
@media (max-width: 560px) {
  .topbar { min-height: 58px; padding: 10px 13px; }
  .content { padding: 17px 12px 28px; }
  .card { padding: 16px; border-radius: 12px; }
  .form-grid { grid-template-columns: 1fr 1fr; gap: 11px; }
  .span-2, .span-3 { grid-column: span 2; }
  .page-heading { align-items: flex-start; flex-direction: column; }
  .card-heading { flex-wrap: wrap; }
  .list-tools { width: 100%; }
  .list-tools .search-control { flex: 1; width: auto; min-width: 0; }
  .start-episode-form .form-grid { grid-template-columns: 1fr; }
  .start-episode-action { grid-column: auto; justify-content: stretch; }
  .start-episode-action .button { width: 100%; }
  .episode-item { align-items: flex-start; flex-direction: column; }
  .episode-actions, .episode-actions .button { width: 100%; }
  .button-row, .button-row .button { width: 100%; }
}
