:root {
  --navy: #2b245b;
  --navy-deep: #1f1a45;
  --navy-soft: #4a4578;
  --orange: #f55c3d;
  --orange-deep: #e04a2c;
  --bg0: #f7f7fb;
  --bg1: #ffffff;
  --ink: #2b245b;
  --muted: #6b688c;
  --line: rgba(43, 36, 91, 0.14);
  --accent: var(--orange);
  --accent-2: var(--navy);
  --danger: #c62828;
  --panel: #ffffff;
  --font-display: "Source Sans 3", "Segoe UI", "Helvetica Neue", Helvetica, Arial, sans-serif;
  --font-body: "Source Sans 3", "Segoe UI", "Helvetica Neue", Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

html, body {
  margin: 0;
  height: 100%;
  color: var(--ink);
  font-family: var(--font-body);
  background: var(--bg0);
  overflow-x: hidden;
}

body {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

.atmosphere {
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(70vw 45vh at 8% -5%, rgba(245, 92, 61, 0.10), transparent 55%),
    radial-gradient(55vw 40vh at 95% 0%, rgba(43, 36, 91, 0.08), transparent 50%),
    linear-gradient(180deg, #ffffff 0%, #f4f4f9 55%, #efeff6 100%);
}

.topbar {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  flex-shrink: 0;
  padding: 0.85rem clamp(1rem, 3vw, 2rem) 0.75rem;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.96);
}

.topbar-row {
  display: flex;
  flex-wrap: nowrap;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  min-width: 0;
  width: 100%;
}

.topbar-brand-left {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  min-width: 0;
  flex: 1 1 auto;
}

.menu-toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 4px;
  width: 2.25rem;
  height: 2.25rem;
  padding: 0.4rem;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: #fff;
  cursor: pointer;
  flex-shrink: 0;
}

.menu-toggle span {
  display: block;
  height: 2px;
  width: 100%;
  background: var(--navy);
  border-radius: 1px;
}

.menu-close,
.sidenav-head {
  display: none;
}

.nav-backdrop {
  display: none;
}

.topbar-row-meta {
  align-items: center;
  min-height: 2rem;
}

.user-bar {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.55rem;
  min-width: 0;
  margin-left: auto;
}

.user-bar-side {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: flex-start;
  gap: 0.45rem;
  margin: 0.65rem 0 0;
  padding: 0.85rem 0.4rem 0;
  border-top: 1px solid var(--line);
  width: 100%;
}

.user-bar-side .user-email {
  max-width: 100%;
  font-size: 0.75rem;
}

.user-bar-side .logout-btn {
  width: 100%;
}

.user-email {
  max-width: 16rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--navy);
}

.logout-btn {
  padding: 0.4rem 0.7rem;
  font-size: 0.78rem;
  flex-shrink: 0;
}

.login-gate {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.2rem;
  background: rgba(247, 247, 251, 0.96);
}

body.authed .login-gate {
  display: none;
}

body:not(.authed) .app-shell,
body:not(.authed) .footnote {
  visibility: hidden;
}

.login-card {
  width: min(24rem, 100%);
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  padding: 1.4rem 1.3rem 1.3rem;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
}

.login-kicker {
  margin: 0;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.login-card h1 {
  margin: 0;
  font-size: 1.45rem;
  color: var(--navy);
}

.login-copy {
  margin: 0;
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 500;
  line-height: 1.45;
}

.login-error {
  margin: 0;
  color: var(--danger);
  font-size: 0.85rem;
  font-weight: 600;
}

.login-switch {
  margin: 0.15rem 0 0;
  text-align: center;
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 500;
}

.reader-chip {
  max-width: 14rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  padding: 0.4rem 0.75rem;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: #fff;
  color: var(--navy);
  font-size: 0.78rem;
  font-weight: 600;
}

.brand-block {
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.2rem;
}

.brand-logo {
  height: 28px;
  width: auto;
  display: block;
  flex-shrink: 0;
  margin-left: auto;
}

.brand {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(1.35rem, 2.4vw, 1.85rem);
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: 0.01em;
  color: var(--navy);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}

.brand-sub {
  margin: 0;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 500;
  letter-spacing: 0.01em;
}

.status-pill {
  padding: 0.45rem 0.85rem;
  border: 1px solid var(--line);
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--muted);
  background: #fff;
  white-space: nowrap;
}

.status-pill[data-state="ready"] {
  color: var(--navy);
  border-color: rgba(43, 36, 91, 0.35);
  background: rgba(43, 36, 91, 0.06);
}
.status-pill[data-state="demo"] {
  color: var(--orange-deep);
  border-color: rgba(245, 92, 61, 0.4);
  background: rgba(245, 92, 61, 0.08);
}
.status-pill[data-state="error"] {
  color: var(--danger);
  border-color: rgba(198, 40, 40, 0.35);
  background: rgba(198, 40, 40, 0.06);
}

.app-shell {
  flex: 1;
  display: flex;
  min-height: 0;
  overflow: hidden;
}

.sidenav {
  width: 232px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  padding: 1rem 0.85rem 1.1rem;
  border-right: 1px solid var(--line);
  background: #fff;
}

.sidenav-label {
  margin: 0 0.4rem 0.35rem;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.nav-btn {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.12rem;
  width: 100%;
  border: 0;
  border-left: 3px solid transparent;
  border-radius: 4px;
  background: transparent;
  color: var(--navy-soft);
  text-align: left;
  padding: 0.7rem 0.75rem;
  cursor: pointer;
  font: inherit;
}

.nav-btn:hover {
  background: rgba(43, 36, 91, 0.05);
}

.nav-btn.active {
  background: rgba(43, 36, 91, 0.07);
  border-left-color: var(--orange);
  color: var(--navy);
}

.nav-btn-title {
  font-size: 0.95rem;
  font-weight: 700;
}

.nav-btn-title em {
  font-style: normal;
  margin-left: 0.4rem;
  padding: 0.08rem 0.42rem;
  border-radius: 99px;
  background: rgba(43, 36, 91, 0.1);
  font-size: 0.72rem;
  font-weight: 700;
}

.nav-btn-sub {
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--muted);
}

.sidenav-note {
  margin-top: auto;
  padding: 0.75rem 0.4rem 0;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 500;
  line-height: 1.45;
}

.app-main {
  flex: 1;
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.study-view,
.worklist-view {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.study-chrome {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 1rem;
  flex-shrink: 0;
  padding: 0.85rem clamp(1rem, 2.4vw, 1.8rem) 0.7rem;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.7);
}

.study-kicker {
  margin: 0 0 0.15rem;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.study-title {
  margin: 0;
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--navy);
}

.study-save-state {
  margin: 0.2rem 0 0;
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--muted);
}

.study-save-state[data-kind="saved"] { color: #2e7d32; }
.study-save-state[data-kind="saving"] { color: var(--navy-soft); }
.study-save-state[data-kind="error"] { color: var(--danger); }

.study-chrome-actions {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  flex-shrink: 0;
}

.code-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.28rem 0.55rem;
  border-radius: 4px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  background: rgba(43, 36, 91, 0.08);
  color: var(--navy);
}

.code-badge[data-code="N"] { background: #e8f5e9; color: #1b5e20; }
.code-badge[data-code="M"] { background: #fdecea; color: #b71c1c; }
.code-badge[data-code="B"] { background: #fff8e1; color: #f57f17; }
.code-badge[data-code="CI"] { background: #ede7f6; color: #4527a0; }

.worklist-view {
  padding: 1rem clamp(1rem, 2.4vw, 1.8rem) 1.2rem;
  overflow: auto;
}

.worklist-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 1rem;
  margin-bottom: 1rem;
}

.worklist-head h1 {
  margin: 0;
  font-size: 1.45rem;
  color: var(--navy);
}

.worklist-head p {
  margin: 0.25rem 0 0;
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 500;
}

.worklist-tools {
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
  margin-bottom: 0.9rem;
}

.worklist-tools input[type="search"] {
  max-width: 28rem;
}

.filter-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.filter-chip {
  border: 1px solid var(--line);
  border-radius: 99px;
  background: #fff;
  color: var(--navy-soft);
  padding: 0.32rem 0.75rem;
  font: inherit;
  font-size: 0.78rem;
  font-weight: 650;
  cursor: pointer;
}

.filter-chip.active {
  border-color: var(--navy);
  background: var(--navy);
  color: #fff;
}

.worklist-table-wrap {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 4px;
  overflow: auto;
}

.worklist-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.worklist-table th,
.worklist-table td {
  padding: 0.75rem 0.85rem;
  text-align: left;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}

.worklist-table th {
  font-size: 0.68rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 700;
  background: #fafafc;
}

.worklist-table tbody tr {
  cursor: pointer;
}

.worklist-table tbody tr:hover {
  background: rgba(43, 36, 91, 0.04);
}

.study-cell {
  font-weight: 700;
  color: var(--navy);
}

.study-cell-sub {
  margin-top: 0.15rem;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 500;
}

.status-tag {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--navy-soft);
}

.status-tag[data-status="edited"] { color: var(--orange-deep); }

.row-actions {
  white-space: nowrap;
  text-align: right;
}

.link-btn {
  border: 0;
  background: none;
  color: var(--navy);
  font: inherit;
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
  padding: 0.2rem 0.35rem;
}

.link-btn.danger { color: var(--danger); }

.worklist-empty {
  padding: 2.5rem 1.2rem;
  text-align: center;
  color: var(--muted);
}

.worklist-empty p {
  margin: 0 0 0.4rem;
}

.workspace {
  flex: 1;
  display: flex;
  gap: 0;
  padding: 0.9rem clamp(1rem, 2.4vw, 1.8rem) 1rem;
  align-items: stretch;
  min-height: 0;
  overflow: hidden;
}

.compose {
  flex: 1 1 auto;
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  max-width: none;
}

.headline {
  margin: 0 0 0.4rem;
  font-family: var(--font-display);
  font-size: clamp(1.55rem, 2.6vw, 2rem);
  font-weight: 650;
  line-height: 1.2;
  letter-spacing: -0.01em;
  max-width: none;
  color: var(--navy);
}

.lede {
  margin: 0 0 0.9rem;
  color: var(--muted);
  max-width: none;
  line-height: 1.55;
  font-size: 0.95rem;
  font-weight: 450;
}

.view-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-rows: 1fr 1fr;
  gap: 0.75rem;
  margin-bottom: 0.85rem;
  flex: 1 1 auto;
  min-height: 12rem;
}

.view-slot {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 0;
  height: 100%;
  border: 1px dashed rgba(43, 36, 91, 0.28);
  border-radius: 4px;
  background: var(--panel);
  cursor: pointer;
  overflow: hidden;
  transition: border-color 180ms ease, background 180ms ease;
}

.view-slot:hover,
.view-slot:focus-within {
  border-color: var(--orange);
  background: rgba(245, 92, 61, 0.04);
}

.view-slot.filled {
  border-style: solid;
  border-color: rgba(43, 36, 91, 0.28);
}

.view-name {
  position: absolute;
  top: 0.55rem;
  left: 0.7rem;
  font-size: 0.72rem;
  font-weight: 650;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--navy-soft);
  z-index: 1;
}

.view-hint {
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 500;
}

.view-slot img {
  display: none;
  width: 100%;
  height: 100%;
  object-fit: cover;
  position: absolute;
  inset: 0;
  opacity: 0.95;
}

.view-slot.filled img { display: block; }
.view-slot.filled .view-hint { display: none; }

.meta-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
  margin-bottom: 0.85rem;
}

label span {
  display: block;
  margin-bottom: 0.3rem;
  font-size: 0.72rem;
  font-weight: 650;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--navy-soft);
}

input, textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: #fff;
  color: var(--ink);
  padding: 0.7rem 0.8rem;
  font: inherit;
  font-weight: 500;
}

input:focus, textarea:focus, select:focus {
  outline: 2px solid rgba(245, 92, 61, 0.35);
  border-color: rgba(245, 92, 61, 0.55);
}

textarea {
  resize: vertical;
  min-height: 4.25rem;
  line-height: 1.45;
}

.prompt-label {
  display: block;
  margin-bottom: 0.85rem;
  flex-shrink: 0;
}

.meta-row,
.actions {
  flex-shrink: 0;
}

.actions {
  display: flex;
  gap: 0.65rem;
  flex-wrap: wrap;
}

.btn-primary, .btn-ghost {
  border: 0;
  border-radius: 4px;
  padding: 0.8rem 1.15rem;
  font: inherit;
  font-weight: 650;
  letter-spacing: 0.02em;
  cursor: pointer;
}

.btn-primary {
  background: var(--orange);
  color: #fff;
}

.btn-primary:hover {
  background: var(--orange-deep);
}

.btn-primary:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.btn-ghost {
  background: #fff;
  color: var(--navy);
  border: 1px solid var(--line);
}

.btn-ghost:hover {
  border-color: rgba(43, 36, 91, 0.35);
}

.report {
  flex: 0 0 0;
  width: 0;
  max-width: 0;
  min-width: 0;
  min-height: 0;
  opacity: 0;
  overflow: hidden;
  margin-left: 0;
  padding: 1.15rem 0 1.25rem 0;
  border: 1px solid transparent;
  border-radius: 4px;
  background: #fff;
  transform: translateX(36px);
  pointer-events: none;
  display: flex;
  flex-direction: column;
  transition:
    flex-basis 480ms cubic-bezier(0.22, 1, 0.36, 1),
    width 480ms cubic-bezier(0.22, 1, 0.36, 1),
    max-width 480ms cubic-bezier(0.22, 1, 0.36, 1),
    opacity 380ms ease,
    transform 480ms cubic-bezier(0.22, 1, 0.36, 1),
    padding 480ms ease,
    margin-left 480ms ease,
    border-color 480ms ease;
}

.workspace.report-visible .report {
  flex: 1 1 46%;
  width: auto;
  max-width: none;
  opacity: 1;
  overflow: hidden;
  margin-left: clamp(1.25rem, 3vw, 2.5rem);
  padding: 1.15rem 1.2rem 1.25rem;
  border-color: var(--line);
  transform: translateX(0);
  pointer-events: auto;
}

.report-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.75rem;
  flex-shrink: 0;
  margin-bottom: 0.35rem;
  padding-bottom: 0.75rem;
  border-bottom: 2px solid var(--navy);
}

.report-head h2 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--navy);
}

.report-head p {
  margin: 0.35rem 0 0;
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 500;
}

.report-back {
  display: none;
}

.report-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  justify-content: flex-end;
  align-items: center;
}

.report-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  justify-content: flex-end;
  align-items: center;
}

.report-actions .btn-primary,
.report-actions .btn-ghost {
  padding: 0.55rem 0.85rem;
  font-size: 0.8rem;
}

.report-stream-wrap {
  position: relative;
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
  margin-top: 0.75rem;
}

.report-waiting {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: flex-start;
  gap: 0.7rem;
  padding: 0.95rem 1rem;
  border: 1px solid rgba(43, 36, 91, 0.18);
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.96);
  color: var(--navy-soft);
  font-size: 0.88rem;
  font-weight: 600;
}

.report-waiting p {
  margin: 0;
}

.bounce-dots {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  height: 1rem;
}

.bounce-dots span {
  width: 0.45rem;
  height: 0.45rem;
  border-radius: 50%;
  background: var(--orange);
  animation: bounce-dot 1.05s ease-in-out infinite;
}

.bounce-dots span:nth-child(2) {
  animation-delay: 0.15s;
  background: var(--navy);
}

.bounce-dots span:nth-child(3) {
  animation-delay: 0.3s;
}

@keyframes bounce-dot {
  0%, 80%, 100% {
    transform: translateY(0);
    opacity: 0.45;
  }
  40% {
    transform: translateY(-0.35rem);
    opacity: 1;
  }
}

.report-body {
  margin: 0;
  white-space: pre-wrap;
  word-break: break-word;
  font-family: var(--font-body);
  font-size: 0.95rem;
  font-weight: 500;
  line-height: 1.55;
  min-height: 0;
  flex: 1 1 auto;
  width: 100%;
  resize: none;
  color: var(--navy-deep);
}

.report-body:not([readonly]) {
  border-color: rgba(245, 92, 61, 0.45);
  box-shadow: inset 0 0 0 1px rgba(245, 92, 61, 0.08);
}

.report-body.streaming {
  border-color: rgba(43, 36, 91, 0.3);
}

.edit-hint {
  margin: 0.55rem 0 0;
  color: var(--navy-soft);
  font-size: 0.8rem;
  font-weight: 500;
}

.edit-hint.dirty {
  color: var(--orange-deep);
}

.footnote {
  flex-shrink: 0;
  padding: 0 clamp(1rem, 3vw, 2.5rem) 0.9rem;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 500;
}

@media (max-width: 960px) {
  .app-shell {
    flex-direction: column;
    overflow: auto;
  }
  body.nav-open {
    overflow: hidden;
  }
  .menu-toggle {
    display: inline-flex;
  }
  .menu-close {
    display: inline-flex;
    border: 0;
    background: none;
    color: var(--navy);
    font: inherit;
    font-size: 0.8rem;
    font-weight: 700;
    cursor: pointer;
    padding: 0.2rem 0.35rem;
  }
  .sidenav-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.35rem;
  }
  .sidenav-head .sidenav-label {
    margin: 0;
  }
  .nav-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 55;
    background: rgba(31, 26, 69, 0.42);
    opacity: 0;
    pointer-events: none;
    transition: opacity 220ms ease;
  }
  .nav-backdrop:not([hidden]) {
    opacity: 1;
    pointer-events: auto;
  }
  .sidenav {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 60;
    width: min(18.5rem, 84vw);
    flex-direction: column;
    align-items: stretch;
    gap: 0.35rem;
    padding: 1rem 0.9rem 1.15rem;
    border-right: 1px solid var(--line);
    border-bottom: 0;
    background: #fff;
    transform: translateX(-105%);
    transition: transform 260ms cubic-bezier(0.22, 1, 0.36, 1);
    box-shadow: 8px 0 28px rgba(31, 26, 69, 0.12);
    overflow: auto;
  }
  body.nav-open .sidenav {
    transform: translateX(0);
  }
  .sidenav-label {
    display: block;
  }
  .sidenav-note {
    display: none;
  }
  .lede,
  .study-chrome {
    display: none;
  }
  .nav-btn {
    width: 100%;
    flex: 0 0 auto;
    padding: 0.75rem 0.8rem;
    border-left: 3px solid transparent;
    border-bottom: 0;
    align-items: flex-start;
    text-align: left;
  }
  .nav-btn-sub {
    display: block;
  }
  .nav-btn.active {
    border-left-color: var(--orange);
    border-bottom-color: transparent;
  }
  .user-bar-side:not([hidden]) {
    display: flex !important;
    margin-top: auto;
  }
  .workspace {
    flex-direction: column;
    overflow: auto;
    padding: 0.75rem 0.85rem 1rem;
  }
  .view-grid {
    min-height: 14rem;
    flex: 0 0 auto;
  }
  .view-slot {
    min-height: 7rem;
  }
  .report {
    transform: translateY(24px);
  }
  .report-back {
    display: inline-flex;
  }
  .workspace.report-visible {
    padding: 0.45rem 0.55rem 0.55rem;
    overflow: hidden;
    min-height: 0;
    flex: 1;
  }
  .workspace.report-visible .compose {
    display: none;
  }
  .workspace.report-visible .report {
    flex: 1 1 auto;
    width: 100%;
    max-width: none;
    min-height: 0;
    margin: 0;
    transform: none;
    border-radius: 0;
  }
  .workspace.report-visible .edit-hint {
    display: none;
  }
  body:has(.workspace.report-visible) .footnote {
    display: none;
  }
  body:has(.workspace.report-visible) .app-shell,
  body:has(.workspace.report-visible) .app-main,
  body:has(.workspace.report-visible) .study-view {
    min-height: 0;
    flex: 1;
    overflow: hidden;
  }
  .meta-row {
    grid-template-columns: 1fr;
    gap: 0.55rem;
  }
  .worklist-head {
    flex-direction: column;
    align-items: stretch;
  }
  .worklist-tools input[type="search"] {
    max-width: none;
  }
  .worklist-table th:nth-child(3),
  .worklist-table td:nth-child(3),
  .worklist-table th:nth-child(4),
  .worklist-table td:nth-child(4),
  .worklist-table th:nth-child(6),
  .worklist-table td:nth-child(6) {
    display: none;
  }
}

@media (max-width: 720px) {
  .topbar {
    padding: 0.65rem 0.85rem;
    gap: 0.45rem;
  }
  .brand {
    font-size: 1.1rem;
  }
  .brand-sub {
    display: none;
  }
  .brand-logo {
    height: 22px;
  }
  .topbar-row-meta {
    min-height: 0;
  }
  .logout-btn {
    padding: 0.32rem 0.5rem;
    font-size: 0.72rem;
  }
  .actions {
    flex-direction: column;
  }
  .actions .btn-primary,
  .actions .btn-ghost,
  .worklist-head .btn-primary {
    width: 100%;
  }
  .report-head {
    flex-direction: column;
  }
  .report-toolbar,
  .report-actions {
    width: 100%;
    justify-content: stretch;
  }
  .report-actions .btn-primary,
  .report-actions .btn-ghost {
    flex: 1;
  }
  .prompt-label textarea {
    min-height: 3.4rem;
  }
  .footnote {
    padding: 0 0.85rem 0.75rem;
    font-size: 0.7rem;
  }
  .filter-row {
    gap: 0.3rem;
  }
  .filter-chip {
    padding: 0.28rem 0.55rem;
    font-size: 0.72rem;
  }
}

@media (max-width: 480px) {
  .view-grid {
    gap: 0.45rem;
    min-height: 12rem;
  }
  .view-slot {
    min-height: 5.5rem;
  }
  .view-name {
    top: 0.35rem;
    left: 0.45rem;
    font-size: 0.65rem;
  }
  .view-hint {
    font-size: 0.72rem;
  }
  .workspace.report-visible .report {
    padding: 0.7rem 0.7rem 0.8rem;
  }
}
