:root {
  --bg: #f5f7fa;
  --panel: #ffffff;
  --panel-strong: #f8fafc;
  --text: #172033;
  --muted: #647085;
  --line: #dbe3ee;
  --line-strong: #c8d4e2;
  --primary: #1f5fbd;
  --primary-dark: #184ea1;
  --cyan: #0891b2;
  --green: #16875b;
  --amber: #b7791f;
  --red: #c2413d;
  --shadow: 0 12px 32px rgba(28, 39, 58, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(180deg, rgba(31, 95, 189, 0.07), transparent 300px),
    var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 0;
}

.hidden {
  display: none !important;
}

.auth-view {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.auth-card {
  width: min(440px, 100%);
  background: rgba(255, 255, 255, 0.94);
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: 0 18px 44px rgba(28, 39, 58, 0.12);
  padding: 22px;
}

.auth-brand {
  margin-bottom: 20px;
}

.auth-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #eef2f7;
  margin-bottom: 16px;
}

.auth-tabs button {
  min-height: 36px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font-weight: 750;
}

.auth-tabs button.active {
  background: #fff;
  color: var(--primary-dark);
  box-shadow: 0 1px 4px rgba(26, 36, 56, 0.12);
}

.auth-form {
  display: grid;
  gap: 12px;
}

.auth-form label {
  display: grid;
  gap: 7px;
}

.auth-form label span {
  color: #344156;
  font-size: 13px;
  font-weight: 650;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

.topbar {
  min-height: 72px;
  padding: 12px 22px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.88);
  backdrop-filter: blur(12px);
  position: sticky;
  top: 0;
  z-index: 10;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.brand-mark {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: #e6f0ff;
  color: var(--primary-dark);
  font-weight: 800;
  border: 1px solid #bfdbfe;
}

h1 {
  margin: 0;
  font-size: 19px;
  line-height: 1.2;
}

.brand p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.status-strip {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}

.pill {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 4px 10px;
  border-radius: 999px;
  background: #eef6ff;
  color: #1e5faa;
  border: 1px solid #d6e8ff;
  font-size: 12px;
  white-space: nowrap;
}

.pill.ok {
  background: #eaf8f0;
  color: var(--green);
  border-color: #c7ead7;
}

.pill.warn {
  background: #fff8e8;
  color: var(--amber);
  border-color: #f5dfad;
}

.pill.bad {
  background: #fff0ef;
  color: var(--red);
  border-color: #f3c7c3;
}

.pill.neutral {
  background: #f3f6fa;
  color: var(--muted);
  border-color: var(--line);
}

.model-picker {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
}

select,
input,
textarea {
  width: 100%;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  color: var(--text);
  background: #fff;
  outline: none;
}

select,
input {
  min-height: 38px;
  padding: 8px 10px;
}

textarea {
  resize: vertical;
  min-height: 76px;
  padding: 10px 12px;
  line-height: 1.5;
}

select:focus,
input:focus,
textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 10px 28px rgba(28, 39, 58, 0.07);
}

.app-shell {
  min-height: 100vh;
}

.app-shell.session-mode {
  background:
    radial-gradient(circle at 18% 0%, rgba(13, 148, 136, 0.16), transparent 280px),
    #0a0f14;
}

.app-shell.session-mode .topbar {
  background: rgba(10, 15, 20, 0.92);
  border-bottom-color: #223027;
}

.app-shell.session-mode .brand h1,
.app-shell.session-mode .model-picker {
  color: #d9efe4;
}

.app-shell.session-mode .brand p {
  color: #91a799;
}

.app-shell.session-mode .brand-mark {
  background: #10251d;
  border-color: #1f4c3a;
  color: #9ef0c4;
}

.app-shell.session-mode .pill.neutral,
.app-shell.session-mode .model-picker select {
  background: #101820;
  color: #bdd4c6;
  border-color: #263a31;
}

.app-shell.session-mode .secondary-button {
  background: #111a20;
  color: #cfe7d8;
  border-color: #2a3d34;
}

.app-shell.session-mode .secondary-button:hover {
  border-color: #4b8066;
}

.dashboard-page,
.cli-page {
  display: grid;
  gap: 16px;
  max-width: 1440px;
  margin: 0 auto;
  padding: 16px;
}

.session-start-panel {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 18px;
}

.session-start-panel h2,
.cli-header h2 {
  margin: 0;
  font-size: 20px;
}

.session-start-panel p,
.cli-header p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.dashboard-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: 16px;
  align-items: start;
}

.sessions-panel,
.result-panel {
  align-self: start;
  position: sticky;
  top: 90px;
  padding: 14px;
  max-height: calc(100vh - 104px);
  overflow: auto;
}

.session-list {
  display: grid;
  gap: 8px;
}

.session-card {
  display: grid;
  gap: 6px;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdff;
  padding: 11px;
  text-align: left;
}

.session-card strong {
  font-size: 14px;
}

.session-card span,
.session-card small {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}

.cli-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 16px 18px;
  background: #0d151b;
  color: #dceee4;
  border-color: #24372f;
  box-shadow: none;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
}

.cli-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 410px;
  gap: 16px;
  align-items: start;
}

.terminal-panel {
  min-height: calc(100vh - 130px);
  display: grid;
  grid-template-rows: minmax(360px, 1fr) auto auto;
  padding: 14px;
  background: #050907;
  color: #d6f8df;
  border-color: #1f3a2e;
  box-shadow: 0 16px 46px rgba(0, 0, 0, 0.26);
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
}

.terminal-log {
  display: grid;
  align-content: start;
  gap: 14px;
  overflow: auto;
  min-height: 360px;
  max-height: calc(100vh - 300px);
  padding: 4px;
}

.terminal-message {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr);
  gap: 10px;
  line-height: 1.65;
  white-space: pre-wrap;
  font-size: 13px;
}

.terminal-prefix {
  color: #69d99f;
  font-weight: 800;
  text-align: right;
}

.terminal-message.user .terminal-prefix {
  color: #f4d35e;
}

.terminal-message.error {
  color: #fecaca;
}

.terminal-composer {
  display: grid;
  gap: 10px;
  padding-top: 12px;
  border-top: 1px solid #1f3a2e;
}

.terminal-composer textarea {
  min-height: 108px;
  background: #07100b;
  color: #e4ffed;
  border-color: #254837;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
}

.composer-actions {
  display: flex;
  justify-content: flex-end;
}

.session-side {
  display: grid;
  gap: 14px;
  position: sticky;
  top: 90px;
  max-height: calc(100vh - 104px);
  overflow: auto;
}

.session-mode .session-side .panel,
.session-mode .result-panel {
  background: #0d151b;
  color: #dceee4;
  border-color: #24372f;
  box-shadow: none;
}

.session-mode .session-side input,
.session-mode .session-side textarea,
.session-mode .session-side select {
  background: #080f13;
  color: #e0f2e9;
  border-color: #2a3d34;
}

.session-mode .session-side .panel-title,
.session-mode .basket-header,
.session-mode details > summary,
.session-mode .form-group > label,
.session-mode .session-profile-grid label span {
  color: #dceee4;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
}

.session-mode .muted,
.session-mode .hint,
.session-mode .candidate-card p,
.session-mode .basket-card p,
.session-mode .prompt-card span {
  color: #8fa99a;
}

.compact-intake {
  padding: 14px;
}

.session-profile-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  align-items: end;
}

.session-profile-grid > label {
  display: grid;
  gap: 8px;
}

.panel-title,
.basket-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
  font-weight: 700;
}

.muted,
.hint {
  color: var(--muted);
  font-size: 12px;
  font-weight: 400;
}

.form-group {
  display: grid;
  gap: 8px;
  margin-bottom: 0;
}

.form-group > label,
.grid-two label span,
.session-profile-grid label span,
.prompt-box span {
  color: #344156;
  font-size: 13px;
  font-weight: 650;
}

.grid-two {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 8px;
}

.grid-two label {
  display: grid;
  gap: 7px;
}

.segmented {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 1fr;
  gap: 4px;
  padding: 4px;
  background: #eef2f7;
  border-radius: 8px;
  border: 1px solid var(--line);
}

.dashboard-filter-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  padding: 10px;
  margin-bottom: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
}

.dashboard-filter-group {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: min(280px, 100%);
}

.dashboard-filter-group > span {
  color: #344156;
  font-size: 13px;
  font-weight: 750;
  white-space: nowrap;
}

.dashboard-segmented {
  min-width: 170px;
  flex: 1;
}

.segmented button,
.tabs button {
  min-height: 32px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
}

.segmented button.active,
.tabs button.active {
  background: #fff;
  color: var(--primary-dark);
  box-shadow: 0 1px 4px rgba(26, 36, 56, 0.12);
  font-weight: 700;
}

.session-mode .segmented,
.session-mode .tabs {
  background: #080f13;
  border-color: #2a3d34;
}

.session-mode .segmented button,
.session-mode .tabs button {
  color: #8fa99a;
}

.session-mode .segmented button.active,
.session-mode .tabs button.active {
  background: #143224;
  color: #a8f3c4;
  box-shadow: inset 0 0 0 1px #2f674c;
}

.check-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.check-grid label {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 34px;
  padding: 6px 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-strong);
  color: #334155;
  font-size: 13px;
}

.check-grid input {
  width: auto;
  min-height: auto;
}

.intake-panel {
  padding: 16px;
}

.compact-title {
  margin-top: 4px;
}

.advanced-preferences {
  overflow: hidden;
}

.advanced-preferences {
  margin-top: 14px;
  border-top: 1px solid var(--line);
  padding-top: 10px;
}

details > summary {
  cursor: pointer;
  color: #334155;
  font-weight: 750;
  list-style: none;
}

details > summary::-webkit-details-marker {
  display: none;
}

details > summary::before {
  content: "+";
  display: inline-grid;
  place-items: center;
  width: 20px;
  height: 20px;
  margin-right: 8px;
  border-radius: 6px;
  background: #eef2f7;
  color: var(--muted);
}

details[open] > summary::before {
  content: "-";
}

.advanced-grid {
  display: grid;
  grid-template-columns: minmax(260px, 1.2fr) minmax(220px, 0.9fr) minmax(220px, 0.9fr);
  gap: 14px;
  padding-top: 12px;
}

.primary-button,
.secondary-button,
.icon-button {
  border: 1px solid transparent;
  border-radius: 8px;
  min-height: 38px;
  padding: 8px 12px;
  font-weight: 700;
}

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

.session-mode .primary-button {
  background: #197044;
  color: #f2fff7;
  border-color: #2f8f5d;
}

.session-mode .primary-button:hover {
  background: #238251;
}

.primary-button:hover {
  background: var(--primary-dark);
}

.primary-button:disabled {
  background: #9bb8f2;
  cursor: wait;
}

.secondary-button,
.icon-button {
  background: #f8fafc;
  color: #334155;
  border-color: var(--line);
}

.compact {
  min-height: 30px;
  padding: 5px 9px;
  font-size: 12px;
}

.icon-button {
  width: 34px;
  padding: 0;
}

.chips,
.category-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.chip {
  border: 1px solid var(--line);
  background: #f8fafc;
  color: #334155;
  border-radius: 999px;
  padding: 5px 9px;
  font-size: 12px;
}

.chip:hover {
  border-color: #b8c6d8;
  background: #fff;
}

.session-mode .chip,
.session-mode .prompt-card,
.session-mode .check-grid label,
.session-mode .candidate-card,
.session-mode .basket-card,
.session-mode .metric {
  background: #101820;
  border-color: #263a31;
  color: #dceee4;
}

.home-band {
  display: grid;
  grid-template-columns: minmax(220px, 0.8fr) minmax(360px, 1.2fr);
  gap: 14px;
}

.trend-panel {
  padding: 14px;
}

.summary-card,
.score-cards {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  min-height: 86px;
  box-shadow: var(--shadow);
}

.summary-card {
  padding: 15px;
  display: grid;
  align-content: center;
  gap: 8px;
}

.summary-card span {
  color: var(--muted);
  font-size: 12px;
}

.summary-card strong {
  font-size: 15px;
  line-height: 1.45;
}

.score-cards {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  padding: 10px;
}

.score-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-strong);
  padding: 10px;
  min-width: 0;
}

.score-card span {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.score-card strong {
  display: block;
  margin-top: 4px;
  font-size: 16px;
}

.dashboard-stats,
.tier-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  margin-top: 12px;
}

.tier-grid {
  align-items: start;
}

.subject-summary-card,
.subject-tier-group,
.tier-card {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdff;
}

.subject-summary-card {
  min-height: 96px;
  display: grid;
  gap: 7px;
}

.subject-summary-card.active,
.subject-tier-group.active {
  border-color: #a9c8ff;
  background: #f5f9ff;
}

.subject-summary-card div {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
}

.subject-summary-card p {
  margin: 0;
  color: #344156;
  font-size: 13px;
}

.subject-summary-card span,
.subject-summary-card small,
.tier-card span,
.tier-card small {
  color: var(--muted);
  font-size: 12px;
}

.subject-summary-card strong,
.tier-card strong {
  font-size: 20px;
}

.subject-summary-card.loading {
  grid-column: 1 / -1;
  min-height: 54px;
  color: var(--muted);
}

.subject-tier-group {
  display: grid;
  gap: 9px;
}

.subject-tier-group h3 {
  margin: 0;
  font-size: 13px;
}

.subject-tier-group > div {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
}

.tier-card {
  min-height: 78px;
  display: grid;
  align-content: center;
  gap: 5px;
}

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

.trend-table-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 12px;
  min-width: 0;
}

.trend-table-card h3 {
  margin: 0 0 9px;
  font-size: 13px;
}

.mini-table {
  overflow-x: auto;
}

.mini-table table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
  font-size: 12px;
}

.mini-table th,
.mini-table td {
  border-bottom: 1px solid var(--line);
  padding: 7px 6px;
  text-align: left;
  vertical-align: top;
  word-break: break-word;
}

.mini-table th {
  color: var(--muted);
  font-weight: 650;
}

.mini-empty {
  min-height: 54px;
  padding: 14px;
}

.recommendations-panel {
  padding-top: 14px;
}

.prompt-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
  margin-bottom: 10px;
}

.prompt-card {
  min-height: 72px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-strong);
  padding: 12px;
  text-align: left;
  display: grid;
  align-content: space-between;
  gap: 10px;
}

.prompt-card strong {
  font-size: 14px;
}

.prompt-card span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}

.timeline {
  display: grid;
  gap: 6px;
  margin: 12px 0;
}

.timeline-item {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  padding: 7px 9px;
  border-radius: 8px;
  background: #0c1711;
  border: 1px solid #1f3a2e;
  color: #addbc0;
  font-size: 12px;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
}

.timeline-item.ok {
  border-color: #275e43;
  background: #0f2419;
}

.timeline-item.bad {
  border-color: #7f2d2d;
  background: #2a1212;
  color: #ffd5d5;
}

.composer {
  display: flex;
  justify-content: flex-end;
}

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

.history-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 11px;
  line-height: 1.35;
  background: #fff;
  table-layout: fixed;
}

.history-table th,
.history-table td {
  border: 1px solid var(--line);
  padding: 4px 5px;
  text-align: right;
  overflow-wrap: anywhere;
}

.history-table th:first-child,
.history-table td:first-child {
  text-align: left;
}

.history-table th {
  color: #475569;
  background: #f1f5f9;
  font-weight: 750;
}

.session-mode .history-table {
  background: #0b1217;
  color: #dceee4;
}

.session-mode .history-table th,
.session-mode .history-table td {
  border-color: #263a31;
}

.session-mode .history-table th {
  background: #101d17;
  color: #b7d6c5;
}

.tabs {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 4px;
  background: #eef2f7;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  margin-bottom: 12px;
}

.candidate-list,
.basket-list {
  display: grid;
  gap: 9px;
}

.candidate-list {
  min-height: 260px;
  max-height: 48vh;
  overflow: auto;
  margin-bottom: 16px;
}

.basket-list {
  max-height: 260px;
  overflow: auto;
}

.candidate-card,
.basket-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 11px;
  display: grid;
  gap: 8px;
}

.candidate-card h3,
.basket-card h3 {
  margin: 0;
  font-size: 14px;
  line-height: 1.35;
}

.candidate-card p,
.basket-card p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.metric-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
}

.metric {
  border-radius: 7px;
  background: var(--panel-strong);
  padding: 7px;
  min-width: 0;
}

.metric span {
  display: block;
  color: var(--muted);
  font-size: 11px;
}

.metric strong {
  display: block;
  margin-top: 3px;
  font-size: 12px;
  overflow-wrap: anywhere;
}

.candidate-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.empty {
  color: var(--muted);
  font-size: 13px;
  place-items: center;
  text-align: center;
  padding: 28px 14px;
  border: 1px dashed var(--line-strong);
  border-radius: 8px;
  background: #f8fafc;
}

@media (max-width: 1180px) {
  .dashboard-layout,
  .cli-layout {
    grid-template-columns: 1fr;
  }

  .sessions-panel,
  .session-side,
  .result-panel {
    grid-column: 1 / -1;
    position: static;
    max-height: none;
  }

  .candidate-list {
    max-height: none;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .session-profile-grid,
  .advanced-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 820px) {
  .topbar {
    height: auto;
    align-items: flex-start;
    flex-direction: column;
  }

  .status-strip {
    width: 100%;
    justify-content: flex-start;
  }

  .sessions-panel,
  .session-side,
  .result-panel {
    position: static;
    max-height: none;
  }

  .session-start-panel,
  .cli-header,
  .report-actions {
    align-items: flex-start;
    justify-content: flex-start;
    flex-direction: column;
  }

  .home-band,
  .dashboard-stats,
  .tier-grid,
  .dashboard-grid,
  .prompt-grid,
  .session-profile-grid,
  .advanced-grid,
  .candidate-list {
    grid-template-columns: 1fr;
  }

  .subject-tier-group > div {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .score-cards {
    grid-template-columns: repeat(2, 1fr);
  }

  .terminal-panel {
    min-height: 640px;
  }

  .terminal-message {
    grid-template-columns: 38px minmax(0, 1fr);
  }
}

/* Terminal workbench */
.session-mode .cli-page {
  max-width: none;
  min-height: calc(100vh - 72px);
  padding: 10px;
  gap: 10px;
}

.session-mode .cli-header {
  max-width: 1680px;
  width: 100%;
  margin: 0 auto;
  min-height: 54px;
  padding: 10px 14px;
  border-radius: 8px;
}

.session-mode .cli-layout {
  display: block;
  max-width: 1680px;
  width: 100%;
  margin: 0 auto;
}

.session-mode .terminal-panel {
  min-height: calc(100vh - 154px);
  padding: 0;
  overflow: hidden;
  background: #050907;
  border-color: #244232;
}

.terminal-window {
  display: grid;
  grid-template-rows: 38px minmax(0, 1fr);
  min-height: calc(100vh - 154px);
  background: #050907;
}

.terminal-window-bar {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  min-height: 38px;
  padding: 0 12px;
  border-bottom: 1px solid #1f3a2e;
  background: #0b1410;
  color: #9fb8a9;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  font-size: 12px;
}

.terminal-dots {
  display: flex;
  gap: 6px;
}

.terminal-dots span {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: #315241;
}

.terminal-dots span:nth-child(1) {
  background: #e06c75;
}

.terminal-dots span:nth-child(2) {
  background: #e5c07b;
}

.terminal-dots span:nth-child(3) {
  background: #98c379;
}

.terminal-title {
  color: #d6f8df;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.terminal-shortcuts {
  color: #6f8778;
  white-space: nowrap;
}

.terminal-split {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(340px, 31%);
  min-height: 0;
}

.terminal-main-pane {
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  min-width: 0;
  min-height: calc(100vh - 192px);
  border-right: 1px solid #1f3a2e;
}

.xterm-viewport-shell {
  min-height: 420px;
  height: calc(100vh - 278px);
  padding: 12px 12px 0;
  overflow: hidden;
}

.xterm-viewport-shell .xterm {
  height: 100%;
}

.fallback-log {
  display: none;
}

.terminal-composer {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: end;
  gap: 10px;
  padding: 10px 12px;
  border-top: 1px solid #1f3a2e;
  background: #07100b;
}

.prompt-token {
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  color: #a8f3c4;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  font-size: 13px;
  white-space: nowrap;
}

.terminal-composer textarea {
  min-height: 34px;
  max-height: 132px;
  padding: 7px 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: #e4ffed;
  box-shadow: none;
}

.terminal-composer textarea:focus {
  border: 0;
  box-shadow: none;
}

.terminal-send {
  min-width: 58px;
  border-radius: 6px;
}

.terminal-rail {
  position: static;
  max-height: calc(100vh - 192px);
  overflow: auto;
  display: grid;
  align-content: start;
  gap: 0;
  background: #08110d;
  border-left: 1px solid #0c1711;
}

.terminal-rail .rail-section {
  border: 0;
  border-bottom: 1px solid #1f3a2e;
  border-radius: 0;
  box-shadow: none;
  padding: 12px;
  background: transparent;
}

.terminal-rail .result-panel {
  position: static;
  max-height: none;
  overflow: visible;
}

.terminal-rail .panel-title,
.terminal-rail .basket-header {
  min-height: 24px;
  margin-bottom: 9px;
  color: #a8f3c4;
  font-size: 12px;
  text-transform: uppercase;
}

.terminal-rail input,
.terminal-rail select {
  min-height: 32px;
  border-radius: 6px;
}

.terminal-rail .session-profile-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.terminal-rail .advanced-grid {
  grid-template-columns: 1fr;
}

.terminal-rail .prompt-card,
.terminal-rail .candidate-card,
.terminal-rail .basket-card,
.terminal-rail .metric,
.terminal-rail .check-grid label {
  border-radius: 6px;
  background: #0b1711;
}

.terminal-rail .prompt-card {
  min-height: auto;
  padding: 9px;
}

.terminal-rail .candidate-list {
  max-height: 34vh;
  min-height: 120px;
}

.terminal-rail .basket-list {
  max-height: 160px;
}

.terminal-rail .history-table {
  display: none;
}

.timeline-rail .timeline {
  margin: 0;
}

@media (max-width: 1180px) {
  .terminal-split {
    grid-template-columns: 1fr;
  }

  .terminal-main-pane {
    border-right: 0;
    border-bottom: 1px solid #1f3a2e;
  }

  .terminal-rail {
    max-height: none;
  }

  .xterm-viewport-shell {
    height: 52vh;
  }
}

@media (max-width: 720px) {
  .terminal-window-bar {
    grid-template-columns: auto minmax(0, 1fr);
  }

  .terminal-shortcuts {
    display: none;
  }

  .terminal-composer {
    grid-template-columns: 1fr auto;
  }

  .prompt-token {
    grid-column: 1 / -1;
    min-height: 18px;
  }

  .terminal-rail .session-profile-grid {
    grid-template-columns: 1fr;
  }
}

/* Unified dark dashboard shell */
body {
  background:
    radial-gradient(circle at 18% 0%, rgba(13, 148, 136, 0.16), transparent 280px),
    #0a0f14;
  color: #dceee4;
}

.topbar,
.panel,
.auth-card,
.trend-table-card,
.summary-card,
.score-cards,
.subject-summary-card,
.subject-tier-group,
.tier-card,
.session-card {
  background: #0d151b;
  color: #dceee4;
  border-color: #24372f;
  box-shadow: 0 16px 46px rgba(0, 0, 0, 0.2);
}

.topbar {
  background: rgba(10, 15, 20, 0.92);
}

.brand h1,
.session-start-panel h2,
.cli-header h2,
.trend-table-card h3,
.subject-tier-group h3 {
  color: #dceee4;
}

.brand p,
.session-start-panel p,
.cli-header p,
.muted,
.hint,
.score-card span,
.subject-summary-card span,
.subject-summary-card small,
.tier-card span,
.tier-card small,
.mini-table th,
.session-card span,
.session-card small {
  color: #8fa99a;
}

.brand-mark {
  background: #10251d;
  border-color: #1f4c3a;
  color: #9ef0c4;
}

select,
input,
textarea,
.model-picker select {
  background: #080f13;
  color: #e0f2e9;
  border-color: #2a3d34;
}

.dashboard-filter-row,
.segmented,
.tabs,
.auth-tabs {
  background: #080f13;
  border-color: #2a3d34;
}

.dashboard-filter-group > span,
.form-group > label,
.grid-two label span,
.session-profile-grid label span,
.prompt-box span,
.auth-form label span {
  color: #dceee4;
}

.segmented button,
.tabs button,
.auth-tabs button {
  color: #8fa99a;
}

.segmented button.active,
.tabs button.active,
.auth-tabs button.active {
  background: #143224;
  color: #a8f3c4;
  box-shadow: inset 0 0 0 1px #2f674c;
}

.secondary-button,
.icon-button,
.chip,
.score-card,
.prompt-card,
.candidate-card,
.basket-card,
.metric,
.check-grid label,
.empty {
  background: #101820;
  border-color: #263a31;
  color: #dceee4;
}

.mini-table td,
.mini-table th {
  border-bottom-color: #24372f;
}

.session-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: stretch;
  padding: 0;
}

.session-resume {
  display: grid;
  gap: 6px;
  min-width: 0;
  border: 0;
  background: transparent;
  color: inherit;
  padding: 11px;
  text-align: left;
}

.session-delete {
  align-self: stretch;
  min-width: 58px;
  border: 0;
  border-left: 1px solid #24372f;
  background: #141b22;
  color: #ffaaa5;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  font-size: 11px;
}

.session-delete:hover {
  background: #2a1212;
}

.terminal-nav-button {
  border: 0;
  background: transparent;
  padding: 0;
  text-align: left;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  cursor: pointer;
}

.terminal-nav-button:hover {
  color: #a8f3c4;
}
