:root {
  color-scheme: light;
  --ink: #192d2a;
  --muted: #5d625e;
  --faint: #f7f2eb;
  --paper: #fffaf4;
  --line: #ded6cb;
  --green: #203b36;
  --sage: #dfe6d9;
  --sand: #eee3d6;
  --clay: #b95619;
  --shadow: 0 18px 50px rgba(38, 32, 25, 0.08);
  --serif: Georgia, "Times New Roman", serif;
  --sans: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  background: radial-gradient(circle at 65% 8%, rgba(211, 179, 142, 0.22), transparent 34%), var(--paper);
  color: #1b2323;
  font-family: var(--sans);
}

button,
a {
  font: inherit;
}

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: 270px;
  padding: 42px 18px 24px;
  background: linear-gradient(145deg, #142522, #203a35);
  color: #fbf7ef;
  display: flex;
  flex-direction: column;
  gap: 42px;
  z-index: 5;
}

.brand {
  color: inherit;
  text-decoration: none;
  text-align: center;
  text-transform: uppercase;
  letter-spacing: 7px;
  line-height: 1.15;
}

.brand span {
  display: block;
  font-size: 13px;
}

.brand strong {
  display: block;
  margin: 6px 0;
  font-size: 29px;
  font-weight: 300;
}

.nav {
  display: grid;
  gap: 10px;
}

.nav-link {
  min-height: 56px;
  padding: 0 20px;
  color: #f7f4eb;
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 16px;
  border-radius: 8px;
}

.nav-link.is-active,
.nav-link:hover {
  background: rgba(255, 255, 255, 0.11);
}

svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex: none;
}

.profile {
  margin-top: auto;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 10px;
}

.profile strong,
.profile small {
  display: block;
}

.profile small {
  color: rgba(255, 255, 255, 0.7);
}

.avatar {
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.22);
  font-size: 20px;
}

.sidebar-cover {
  margin: auto auto 0;
  width: min(172px, 78%);
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: 8px;
  box-shadow: 0 18px 36px rgba(0, 0, 0, 0.24);
}

.shell {
  margin-left: 270px;
  padding: 34px 36px 42px;
}

.masthead {
  display: grid;
  grid-template-columns: minmax(360px, 0.85fr) minmax(480px, 1.15fr);
  gap: 36px;
  align-items: start;
}

.intro {
  padding: 12px 12px 0;
}

.intro p,
.production-strip p,
.reader-head p,
.dialog-head p {
  margin: 0 0 18px;
  color: #343c3c;
}

h1,
h2,
h3 {
  margin: 0;
  color: var(--ink);
}

h1 {
  max-width: 600px;
  font-family: var(--serif);
  font-size: clamp(44px, 4.4vw, 74px);
  font-weight: 500;
  line-height: 0.98;
}

.intro span {
  display: block;
  margin-top: 24px;
  color: var(--muted);
  font-size: 18px;
}

.hero {
  position: relative;
  min-height: 318px;
  overflow: hidden;
  border-radius: 8px;
  box-shadow: var(--shadow);
  isolation: isolate;
}

.hero::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, rgba(17, 28, 26, 0.72), rgba(17, 28, 26, 0.1) 58%);
  z-index: 1;
}

.hero img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 74%;
  transform: scale(1.02);
}

.hero-copy {
  position: absolute;
  left: 52px;
  bottom: 44px;
  z-index: 2;
  color: #fff6ed;
}

.hero-copy p {
  margin: 0;
  font-family: var(--serif);
  font-size: clamp(24px, 2vw, 34px);
  line-height: 1.15;
}

.hero-copy span {
  display: block;
  width: 52px;
  height: 2px;
  margin-top: 24px;
  background: var(--clay);
}

.metrics {
  margin-top: 24px;
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 18px;
}

.metrics article,
.panel,
.production-strip {
  border: 1px solid var(--line);
  background: rgba(255, 250, 244, 0.78);
  box-shadow: 0 8px 26px rgba(40, 32, 24, 0.035);
}

.metrics article {
  min-height: 112px;
  border-radius: 8px;
  padding: 22px 20px;
  display: flex;
  align-items: center;
  gap: 18px;
}

.metric-icon {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--sand);
  color: var(--ink);
  font-family: var(--serif);
  font-size: 32px;
}

.metrics strong,
.metrics small {
  display: block;
}

.metrics strong {
  font-size: 21px;
  line-height: 1.1;
}

.metrics small {
  margin-top: 6px;
  color: var(--muted);
}

.status-card strong {
  font-family: var(--serif);
  font-size: 24px;
  font-weight: 500;
}

.pulse {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: #f2e8dc;
  position: relative;
}

.pulse::before,
.pulse::after {
  content: "";
  position: absolute;
  top: 20px;
  height: 2px;
  background: var(--clay);
}

.pulse::before {
  left: 9px;
  width: 24px;
}

.pulse::after {
  left: 20px;
  width: 2px;
  height: 22px;
  top: 10px;
  box-shadow: -7px 6px 0 var(--clay), 7px -3px 0 var(--clay);
}

.workspace {
  margin-top: 26px;
  display: grid;
  grid-template-columns: minmax(420px, 0.95fr) minmax(520px, 1fr);
  gap: 24px;
  align-items: start;
}

.panel {
  border-radius: 8px;
  overflow: hidden;
}

.panel-head,
.reader-head,
.dialog-head {
  padding: 22px 26px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
}

.panel-head {
  border-bottom: 1px solid var(--line);
}

.panel h2,
.production-strip h2,
.dialog-head h2 {
  font-family: var(--serif);
  font-size: 26px;
  font-weight: 500;
}

.episodes {
  display: grid;
}

.episode-row {
  border: 0;
  border-bottom: 1px solid var(--line);
  background: transparent;
  text-align: left;
  padding: 16px 20px 16px 18px;
  min-height: 106px;
  display: grid;
  grid-template-columns: 54px 1fr auto 22px;
  align-items: center;
  gap: 20px;
  cursor: pointer;
  color: inherit;
}

.episode-row:last-child {
  border-bottom: 0;
}

.episode-row:hover,
.episode-row.is-selected {
  background: rgba(223, 230, 217, 0.42);
}

.episode-number {
  width: 48px;
  height: 64px;
  border-radius: 6px;
  display: grid;
  place-items: center;
  background: var(--sand);
  color: var(--ink);
  font-family: var(--serif);
  font-size: 23px;
}

.episode-row h3 {
  font-size: 19px;
  line-height: 1.2;
}

.episode-row p {
  margin: 8px 0 0;
  color: #303735;
  line-height: 1.45;
}

.tag {
  min-width: 96px;
  padding: 8px 12px;
  border-radius: 6px;
  background: var(--sage);
  color: #243430;
  text-align: center;
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.tag[data-tone="warm"] {
  background: #f2dfcf;
  color: #6e3511;
}

.chevron {
  color: var(--muted);
  font-size: 30px;
}

.reader-head {
  align-items: flex-start;
}

.reader-head p,
.dialog-head p {
  margin-bottom: 8px;
  text-transform: uppercase;
  font-size: 12px;
  letter-spacing: 0.08em;
}

.tabs {
  display: flex;
  gap: 36px;
  padding: 0 26px;
  border-bottom: 1px solid var(--line);
  overflow-x: auto;
}

.tab {
  border: 0;
  border-bottom: 2px solid transparent;
  background: transparent;
  padding: 18px 0 16px;
  cursor: pointer;
  color: #4d504f;
  text-transform: uppercase;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.04em;
  white-space: nowrap;
}

.tab.is-active {
  color: #101c1a;
  border-color: #101c1a;
}

.tab-content {
  min-height: 370px;
  padding: 26px 30px 32px;
  line-height: 1.62;
}

.tab-content h3 {
  margin: 0 0 8px;
  font-size: 15px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.tab-content p {
  margin: 0 0 22px;
}

.tab-content ul {
  margin: 0;
  padding-left: 18px;
}

.tab-content li {
  margin-bottom: 12px;
}

.reader-actions {
  padding: 20px 26px;
  border-top: 1px solid var(--line);
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
}

.primary-button,
.ghost-button,
.icon-button {
  border: 1px solid var(--line);
  border-radius: 6px;
  min-height: 42px;
  padding: 0 18px;
  cursor: pointer;
}

.primary-button {
  background: var(--green);
  color: #fffaf4;
  border-color: var(--green);
}

.ghost-button {
  background: rgba(255, 255, 255, 0.42);
  color: #182622;
}

.icon-button {
  width: 42px;
  padding: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--ink);
  font-size: 30px;
  line-height: 1;
}

.production-strip {
  margin-top: 26px;
  border-radius: 8px;
  padding: 26px;
  display: grid;
  grid-template-columns: minmax(260px, 0.7fr) minmax(420px, 1.3fr);
  gap: 34px;
  align-items: center;
}

.production-strip p {
  margin-bottom: 8px;
  text-transform: uppercase;
  font-size: 12px;
  letter-spacing: 0.08em;
}

.production-strip ol {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}

.production-strip li {
  border-left: 1px solid var(--line);
  padding-left: 18px;
  display: grid;
  gap: 8px;
}

.production-strip strong {
  font-family: var(--serif);
  font-size: 26px;
  color: var(--clay);
}

.production-strip span {
  color: #303735;
  line-height: 1.45;
}

.script-dialog {
  width: min(920px, calc(100vw - 32px));
  max-height: min(820px, calc(100vh - 32px));
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
  color: #1b2323;
  box-shadow: 0 24px 80px rgba(25, 35, 35, 0.24);
}

.script-dialog::backdrop {
  background: rgba(18, 29, 27, 0.52);
}

.dialog-head {
  position: sticky;
  top: 0;
  background: var(--paper);
  border-bottom: 1px solid var(--line);
}

#dialogBody {
  padding: 26px 34px 40px;
  line-height: 1.7;
}

#dialogBody h3 {
  margin: 26px 0 8px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-size: 14px;
}

#dialogBody p {
  margin: 0 0 14px;
}

@media (max-width: 1450px) {
  .metrics {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (max-width: 1180px) {
  .sidebar {
    position: static;
    width: auto;
    min-height: auto;
    padding: 18px 22px;
    flex-direction: row;
    align-items: center;
    gap: 24px;
  }

  .brand {
    text-align: left;
  }

  .brand strong {
    font-size: 22px;
  }

  .nav {
    grid-auto-flow: column;
    overflow-x: auto;
    flex: 1;
  }

  .nav-link {
    white-space: nowrap;
  }

  .profile {
    display: none;
  }

  .sidebar-cover {
    display: none;
  }

  .shell {
    margin-left: 0;
  }

  .masthead,
  .workspace,
  .production-strip {
    grid-template-columns: 1fr;
  }

}

@media (max-width: 760px) {
  .sidebar {
    display: block;
    position: static;
    padding: 14px;
    background: linear-gradient(145deg, #142522, #203a35);
    box-shadow: 0 12px 28px rgba(20, 37, 34, 0.22);
  }

  .brand {
    display: block;
    text-align: center;
    margin-bottom: 12px;
    letter-spacing: 4px;
  }

  .brand span {
    font-size: 10px;
  }

  .brand strong {
    margin: 3px 0;
    font-size: 22px;
  }

  .nav {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-auto-flow: row;
    gap: 8px;
    overflow: visible;
    flex: none;
  }

  .nav-link {
    min-height: 44px;
    justify-content: center;
    padding: 0 10px;
    font-size: 14px;
    text-align: center;
    white-space: normal;
  }

  .nav-link svg {
    display: none;
  }

  .shell {
    padding: 18px 14px 30px;
  }

  .intro {
    padding: 0;
  }

  h1 {
    font-size: 37px;
    line-height: 1;
  }

  .intro span {
    margin-top: 16px;
    font-size: 16px;
  }

  .hero {
    min-height: 0;
    aspect-ratio: 1;
    margin-top: 18px;
    background: #142522;
  }

  .hero::after,
  .hero-copy {
    display: none;
  }

  .hero img {
    object-fit: contain;
    object-position: center;
    transform: none;
  }

  .hero-copy {
    left: 20px;
    right: 20px;
    bottom: 22px;
  }

  .hero-copy p {
    font-size: 24px;
  }

  .hero-copy span {
    margin-top: 16px;
  }

  .metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    margin-top: 16px;
  }

  .production-strip ol {
    grid-template-columns: 1fr;
  }

  .metrics article {
    min-height: 98px;
    padding: 14px;
    align-items: flex-start;
    flex-direction: column;
    gap: 10px;
  }

  .status-card {
    grid-column: 1 / -1;
  }

  .metric-icon {
    width: 44px;
    height: 44px;
    font-size: 28px;
  }

  .metrics strong {
    font-size: 18px;
  }

  .status-card strong {
    font-size: 24px;
  }

  .pulse {
    width: 38px;
    height: 38px;
  }

  .workspace {
    margin-top: 18px;
    gap: 18px;
  }

  .panel h2,
  .production-strip h2,
  .dialog-head h2 {
    font-size: 23px;
  }

  .panel-head {
    align-items: flex-start;
  }

  .panel-head .ghost-button {
    min-height: 38px;
    padding: 0 12px;
  }

  .episode-row {
    grid-template-columns: 46px 1fr;
    gap: 14px;
    min-height: 96px;
    padding: 14px;
  }

  .episode-row .tag,
  .chevron {
    grid-column: 2;
  }

  .episode-number {
    width: 42px;
    height: 56px;
    font-size: 21px;
  }

  .episode-row h3 {
    font-size: 17px;
  }

  .episode-row p {
    font-size: 14px;
  }

  .tag {
    min-width: 0;
    width: fit-content;
    padding: 7px 10px;
    font-size: 11px;
  }

  .reader-head,
  .panel-head,
  .dialog-head {
    padding: 18px;
  }

  .reader-head {
    display: grid;
    gap: 12px;
  }

  .tabs {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0;
    padding: 0;
    overflow: visible;
  }

  .tab {
    min-height: 48px;
    padding: 0 8px;
    display: grid;
    place-items: center;
    border-right: 1px solid var(--line);
    border-bottom: 1px solid var(--line);
    font-size: 12px;
  }

  .tab:nth-child(even) {
    border-right: 0;
  }

  .tab-content,
  #dialogBody {
    padding: 22px 18px 28px;
  }

  .tab-content {
    min-height: 0;
  }

  .reader-actions {
    padding: 16px 18px 18px;
    display: grid;
    grid-template-columns: 1fr;
  }

  .primary-button,
  .ghost-button {
    width: 100%;
  }

  .production-strip {
    margin-top: 18px;
    padding: 20px 18px;
    gap: 22px;
  }

  .script-dialog {
    width: calc(100vw - 18px);
    max-height: calc(100vh - 18px);
  }
}

@media print {
  .sidebar,
  .hero,
  .reader-actions,
  .tabs,
  .ghost-button,
  .primary-button {
    display: none;
  }

  .shell {
    margin: 0;
    padding: 0;
  }

  .masthead,
  .workspace,
  .metrics,
  .production-strip,
  .production-strip ol {
    display: block;
  }

  .panel,
  .metrics article,
  .production-strip {
    break-inside: avoid;
    box-shadow: none;
  }
}
