:root {
  color-scheme: light;
  --bg: #f4f6f8;
  --surface: #ffffff;
  --surface-muted: #f8fafb;
  --ink: #17212b;
  --ink-soft: #52606d;
  --ink-faint: #7b8794;
  --line: #dce2e8;
  --line-strong: #c8d0d9;
  --primary: #2764d7;
  --primary-hover: #1d4fab;
  --primary-soft: #eaf1ff;
  --green: #16835d;
  --green-soft: #e4f5ee;
  --amber: #a15c00;
  --amber-soft: #fff2d5;
  --red: #bc3442;
  --red-soft: #fce8ea;
  --violet: #7652a7;
  --shadow-modal: 0 24px 60px rgb(23 33 43 / 18%);
  --radius: 6px;
  --topbar-height: 72px;
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
  font-synthesis: none;
}

* {
  box-sizing: border-box;
  letter-spacing: 0;
}

html {
  min-width: 320px;
  background: var(--bg);
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background: var(--bg);
  font-size: 14px;
  line-height: 1.45;
}

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

button {
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

svg {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
  stroke-width: 1.8;
}

.skip-link {
  position: fixed;
  z-index: 100;
  top: 8px;
  left: 8px;
  padding: 8px 12px;
  color: #ffffff;
  background: var(--ink);
  border-radius: 4px;
  transform: translateY(-150%);
}

.skip-link:focus {
  transform: translateY(0);
}

.app-shell {
  width: min(100%, 1600px);
  min-height: 100vh;
  margin: 0 auto;
  background: var(--bg);
}

.topbar {
  min-height: var(--topbar-height);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 12px 24px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}

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

.brand-mark {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  color: #ffffff;
  background: var(--ink);
  border-radius: var(--radius);
}

.brand-mark svg {
  width: 21px;
  height: 21px;
}

h1,
h2,
h3,
p {
  margin: 0;
}

h1 {
  font-size: 18px;
  font-weight: 700;
  line-height: 1.25;
}

.brand-lockup p {
  margin-top: 2px;
  color: var(--ink-faint);
  font-size: 12px;
}

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

.worker-state {
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 0 10px;
  color: var(--ink-soft);
  background: var(--surface-muted);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}

.status-dot {
  width: 7px;
  height: 7px;
  background: var(--ink-faint);
  border-radius: 50%;
}

.worker-state[data-state="healthy"] .status-dot {
  background: var(--green);
  box-shadow: 0 0 0 3px var(--green-soft);
}

.worker-state[data-state="error"] .status-dot {
  background: var(--red);
  box-shadow: 0 0 0 3px var(--red-soft);
}

.button,
.icon-button {
  min-height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius);
  font-weight: 650;
  transition:
    background-color 140ms ease,
    border-color 140ms ease,
    color 140ms ease;
}

.button {
  gap: 8px;
  padding: 0 14px;
  border: 1px solid transparent;
}

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

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

.button-secondary {
  color: var(--ink);
  background: var(--surface);
  border-color: var(--line-strong);
}

.button-secondary:hover {
  background: var(--surface-muted);
  border-color: #aeb8c3;
}

.button-danger {
  color: #ffffff;
  background: var(--red);
  border-color: var(--red);
}

.button-danger:hover {
  background: #982735;
}

.icon-button {
  width: 36px;
  padding: 0;
  color: var(--ink-soft);
  background: transparent;
  border: 1px solid transparent;
}

.icon-button:hover {
  color: var(--ink);
  background: #edf1f4;
}

.icon-button.danger:hover {
  color: var(--red);
  background: var(--red-soft);
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
[role="button"]:focus-visible {
  outline: 3px solid rgb(39 100 215 / 25%);
  outline-offset: 1px;
}

.error-banner {
  min-height: 44px;
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 12px 24px 0;
  padding: 7px 8px 7px 12px;
  color: #84212c;
  background: var(--red-soft);
  border: 1px solid #efbdc3;
  border-radius: var(--radius);
}

.error-banner span {
  min-width: 0;
  flex: 1;
}

.error-banner .icon-button {
  color: #84212c;
}

.view-switcher {
  width: max-content;
  display: flex;
  gap: 2px;
  margin: 14px 24px 0;
  padding: 3px;
  background: #e8edf2;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.view-option {
  min-height: 32px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 0 11px;
  color: var(--ink-soft);
  background: transparent;
  border: 0;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 650;
}

.view-option:hover {
  color: var(--ink);
}

.view-option.active {
  color: var(--ink);
  background: var(--surface);
  box-shadow: 0 1px 2px rgb(23 33 43 / 10%);
}

.view-option svg {
  width: 15px;
  height: 15px;
}

.metrics {
  min-height: 94px;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin: 16px 24px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.metric {
  min-width: 0;
  display: grid;
  grid-template-columns: auto 1fr;
  grid-template-rows: auto auto;
  align-content: center;
  column-gap: 8px;
  padding: 16px 20px;
  border-right: 1px solid var(--line);
}

.metric:last-child {
  border-right: 0;
}

.metric-label {
  grid-column: 1 / -1;
  color: var(--ink-soft);
  font-size: 12px;
  font-weight: 650;
}

.metric strong {
  align-self: baseline;
  font-size: 26px;
  line-height: 1.2;
}

.metric-detail {
  align-self: end;
  overflow: hidden;
  padding-bottom: 3px;
  color: var(--ink-faint);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dashboard {
  min-height: calc(100vh - var(--topbar-height) - 126px);
  display: grid;
  grid-template-columns: minmax(280px, 340px) minmax(0, 1fr);
  margin: 0 24px 24px;
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.model-panel {
  min-width: 0;
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--line);
}

.panel-heading {
  min-height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px 10px 18px;
}

.panel-heading h2,
.model-header h2 {
  font-size: 16px;
  line-height: 1.3;
}

.panel-heading span {
  color: var(--ink-faint);
  font-size: 12px;
}

.search-field {
  height: 38px;
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 14px 12px;
  padding: 0 10px;
  color: var(--ink-faint);
  background: var(--surface-muted);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.search-field:focus-within {
  color: var(--primary);
  background: var(--surface);
  border-color: #8cace6;
  box-shadow: 0 0 0 3px rgb(39 100 215 / 10%);
}

.search-field input {
  width: 100%;
  min-width: 0;
  height: 100%;
  padding: 0;
  background: transparent;
  border: 0;
  outline: 0;
}

.search-field input::placeholder {
  color: #8d98a4;
}

.search-field.compact {
  width: min(360px, 100%);
  margin: 0;
}

.model-list {
  min-height: 240px;
  flex: 1;
  overflow: auto;
  border-top: 1px solid var(--line);
}

.model-row {
  width: 100%;
  min-height: 76px;
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 11px 12px 11px 16px;
  text-align: left;
  background: var(--surface);
  border: 0;
  border-bottom: 1px solid #e8edf1;
}

.model-row:hover {
  background: var(--surface-muted);
}

.model-row.active {
  background: var(--primary-soft);
  box-shadow: inset 3px 0 0 var(--primary);
}

.row-avatar,
.model-avatar {
  position: relative;
  display: grid;
  place-items: center;
  color: #314152;
  background: #e5eaf0;
  border: 1px solid #d3dae2;
  border-radius: 50%;
  font-weight: 750;
  text-transform: uppercase;
}

.row-avatar {
  width: 38px;
  height: 38px;
  font-size: 12px;
}

.row-presence,
.presence-ring {
  position: absolute;
  right: -1px;
  bottom: 0;
  width: 10px;
  height: 10px;
  background: #9aa5b1;
  border: 2px solid var(--surface);
  border-radius: 50%;
}

.model-row.active .row-presence {
  border-color: var(--primary-soft);
}

.online {
  background: var(--green);
}

.model-row-main {
  min-width: 0;
}

.model-row-title {
  display: flex;
  align-items: center;
  gap: 6px;
}

.model-row-title strong {
  min-width: 0;
  overflow: hidden;
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.model-row-meta {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-top: 4px;
  color: var(--ink-faint);
  font-size: 11px;
}

.meta-separator {
  width: 3px;
  height: 3px;
  background: #b4bec8;
  border-radius: 50%;
}

.chat-indicator {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--violet);
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
}

.chat-indicator svg {
  width: 13px;
  height: 13px;
}

.row-chevron {
  color: #99a4af;
}

.loading-list {
  display: grid;
  gap: 1px;
}

.empty-list {
  min-height: 180px;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 9px;
  padding: 24px;
  color: var(--ink-faint);
  font-size: 12px;
  text-align: center;
}

.empty-list svg {
  width: 22px;
  height: 22px;
}

.loading-list span {
  height: 76px;
  background: linear-gradient(90deg, #f5f7f9, #edf1f4, #f5f7f9);
  background-size: 220% 100%;
  animation: shimmer 1.4s linear infinite;
}

@keyframes shimmer {
  to {
    background-position: -220% 0;
  }
}

.workspace {
  min-width: 0;
  min-height: 600px;
  background: var(--surface);
}

.workspace-empty {
  min-height: 100%;
  display: grid;
  place-content: center;
  justify-items: center;
  padding: 48px 24px;
  text-align: center;
}

.empty-icon {
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  margin-bottom: 14px;
  color: var(--ink-soft);
  background: #edf1f4;
  border-radius: 50%;
}

.empty-icon svg {
  width: 23px;
  height: 23px;
}

.workspace-empty h2 {
  font-size: 17px;
}

.workspace-empty p {
  margin: 5px 0 18px;
  color: var(--ink-faint);
}

.workspace-content {
  min-height: 100%;
}

.model-header {
  min-height: 86px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 14px 20px;
  border-bottom: 1px solid var(--line);
}

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

.model-avatar {
  width: 46px;
  height: 46px;
  flex: 0 0 auto;
  font-size: 14px;
}

.presence-ring {
  width: 12px;
  height: 12px;
  border-color: var(--surface);
}

.identity-line {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 8px;
}

.identity-line h2 {
  max-width: min(48vw, 520px);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.phase-badge {
  max-width: 140px;
  overflow: hidden;
  padding: 2px 7px;
  color: var(--ink-soft);
  background: #eef1f4;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 750;
  text-overflow: ellipsis;
  text-transform: uppercase;
  white-space: nowrap;
}

.phase-badge.online {
  color: #0d6849;
  background: var(--green-soft);
}

.model-metadata {
  display: flex;
  flex-wrap: wrap;
  gap: 5px 10px;
  margin-top: 5px;
  color: var(--ink-faint);
  font-size: 11px;
}

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

.room-summary {
  display: grid;
  grid-template-columns: minmax(220px, 0.9fr) minmax(320px, 1.4fr);
  gap: 24px;
  padding: 14px 20px;
  border-bottom: 1px solid var(--line);
  background: #fafbfc;
}

.room-topic {
  min-width: 0;
  display: flex;
  align-items: flex-start;
  gap: 10px;
}

.room-topic > svg {
  width: 17px;
  height: 17px;
  flex: 0 0 auto;
  margin-top: 2px;
  color: #4a6478;
}

.room-topic div,
.goal-heading > div {
  min-width: 0;
  display: grid;
  gap: 3px;
}

.room-topic span,
.goal-heading span:first-child {
  color: var(--ink-faint);
  font-size: 10px;
  font-weight: 750;
  text-transform: uppercase;
}

.room-topic strong,
.goal-heading strong {
  overflow: hidden;
  color: var(--ink);
  font-size: 12px;
  line-height: 1.4;
  text-overflow: ellipsis;
}

.room-topic strong {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.goal-heading strong {
  white-space: nowrap;
}

.goal-live {
  min-width: 0;
}

.goal-heading,
.goal-meta,
.goal-history-heading,
.goal-history-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.goal-count {
  flex: 0 0 auto;
  color: var(--ink-soft);
  font-size: 11px;
  font-weight: 700;
}

.goal-progress {
  width: 100%;
  height: 8px;
  overflow: hidden;
  margin-top: 8px;
  background: #dfe4e8;
  border-radius: 4px;
}

.goal-progress > span {
  width: 0;
  height: 100%;
  display: block;
  background: #168568;
  border-radius: inherit;
  transition: width 240ms ease;
}

.goal-live.inactive .goal-progress > span {
  background: #8b98a3;
}

.goal-meta {
  margin-top: 5px;
  color: var(--ink-faint);
  font-size: 10px;
}

.goal-history-list,
.topic-history-list {
  display: grid;
}

.goal-history-row,
.topic-history-row {
  display: grid;
  gap: 8px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
}

.goal-history-row:last-child,
.topic-history-row:last-child {
  border-bottom: 0;
}

.goal-history-heading strong,
.topic-history-heading strong {
  min-width: 0;
  overflow: hidden;
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.topic-history-heading strong {
  overflow-wrap: anywhere;
  white-space: normal;
}

.goal-status,
.topic-status {
  flex: 0 0 auto;
  padding: 2px 6px;
  color: var(--ink-soft);
  background: #eef1f4;
  border-radius: 4px;
  font-size: 9px;
  font-weight: 750;
  text-transform: uppercase;
}

.goal-status.active,
.topic-status.active,
.goal-status.completed {
  color: #0d6849;
  background: #e1f3ec;
}

.goal-status.replaced,
.goal-status.reset {
  color: #825414;
  background: #fff0d5;
}

.goal-progress.compact {
  height: 6px;
  margin-top: 0;
}

.goal-history-meta {
  color: var(--ink-faint);
  font-size: 10px;
}

.topic-history-heading,
.topic-history-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.topic-history-meta {
  color: var(--ink-faint);
  font-size: 10px;
}

.switch-control {
  min-height: 36px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--ink-soft);
  font-size: 12px;
  font-weight: 650;
  cursor: pointer;
  white-space: nowrap;
}

.switch-control input {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  opacity: 0;
}

.switch-track {
  width: 34px;
  height: 20px;
  display: flex;
  align-items: center;
  padding: 2px;
  background: #aeb8c2;
  border-radius: 10px;
  transition: background-color 140ms ease;
}

.switch-thumb {
  width: 16px;
  height: 16px;
  background: #ffffff;
  border-radius: 50%;
  box-shadow: 0 1px 3px rgb(23 33 43 / 28%);
  transition: transform 140ms ease;
}

.switch-control input:checked + .switch-track {
  background: var(--primary);
}

.switch-control input:checked + .switch-track .switch-thumb {
  transform: translateX(14px);
}

.switch-control input:focus-visible + .switch-track {
  outline: 3px solid rgb(39 100 215 / 25%);
  outline-offset: 2px;
}

.switch-control input:disabled + .switch-track {
  cursor: wait;
  opacity: 0.55;
}

.alerts-off {
  color: #8a3d35;
  background: #f8e9e6;
}

.tabs {
  height: 49px;
  display: flex;
  align-items: stretch;
  gap: 2px;
  padding: 0 16px;
  border-bottom: 1px solid var(--line);
}

.tab {
  position: relative;
  min-width: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 0 12px;
  color: var(--ink-soft);
  background: transparent;
  border: 0;
  font-size: 12px;
  font-weight: 650;
}

.tab::after {
  position: absolute;
  right: 10px;
  bottom: -1px;
  left: 10px;
  height: 2px;
  background: transparent;
  content: "";
}

.tab:hover {
  color: var(--ink);
}

.tab.active {
  color: var(--primary);
}

.tab.active::after {
  background: var(--primary);
}

.tab svg {
  width: 16px;
  height: 16px;
}

.tab-count {
  min-width: 20px;
  height: 18px;
  display: inline-grid;
  place-items: center;
  padding: 0 5px;
  color: var(--ink-faint);
  background: #edf1f4;
  border-radius: 4px;
  font-size: 10px;
}

.tab.active .tab-count {
  color: var(--primary);
  background: var(--primary-soft);
}

.tab-panel {
  min-height: 460px;
}

.data-toolbar {
  min-height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 10px 18px;
  background: var(--surface-muted);
  border-bottom: 1px solid var(--line);
}

.segmented-control {
  height: 34px;
  display: inline-flex;
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
}

.segment {
  min-width: 76px;
  padding: 0 12px;
  color: var(--ink-soft);
  background: transparent;
  border: 0;
  border-right: 1px solid var(--line);
  font-size: 11px;
  font-weight: 700;
}

.segment:last-child {
  border-right: 0;
}

.segment:hover {
  color: var(--ink);
  background: var(--surface-muted);
}

.segment.active {
  color: var(--primary);
  background: var(--primary-soft);
}

.tipper-summary-band {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  background: #fbfcfd;
  border-bottom: 1px solid var(--line);
}

.tipper-summary-band > div {
  min-width: 0;
  display: grid;
  gap: 2px;
  padding: 12px 18px;
  border-right: 1px solid var(--line);
}

.tipper-summary-band > div:last-child {
  border-right: 0;
}

.tipper-summary-band span,
.tipper-fact span {
  color: var(--ink-faint);
  font-size: 9px;
  font-weight: 750;
  text-transform: uppercase;
}

.tipper-summary-band strong {
  overflow: hidden;
  font-size: 17px;
  text-overflow: ellipsis;
}

.tipper-list {
  min-height: 400px;
  max-height: calc(100vh - 420px);
  overflow: auto;
}

.tipper-row {
  min-height: 66px;
  display: grid;
  grid-template-columns:
    32px minmax(170px, 1.5fr) minmax(100px, 0.8fr)
    minmax(88px, 0.7fr) minmax(58px, 0.4fr) minmax(118px, 0.8fr);
  align-items: center;
  gap: 12px;
  padding: 10px 18px;
  border-bottom: 1px solid #e9edf1;
}

.tipper-row:hover {
  background: var(--surface-muted);
}

.tipper-rank {
  color: var(--ink-faint);
  font-size: 10px;
  font-weight: 750;
}

.tipper-identity {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 9px;
}

.tipper-identity > div {
  min-width: 0;
}

.tipper-identity strong,
.tipper-identity > div > span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tipper-identity strong {
  font-size: 12px;
}

.tipper-identity > div > span {
  margin-top: 2px;
  color: var(--ink-faint);
  font-size: 10px;
}

.tipper-fact {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.tipper-fact strong {
  overflow: hidden;
  color: #344250;
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tipper-total strong {
  color: #765214;
}

.tipper-time {
  color: var(--ink-faint);
  font-size: 10px;
  text-align: right;
  white-space: nowrap;
}

.select-field {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--ink-soft);
  font-size: 11px;
  font-weight: 650;
}

.select-field select {
  height: 34px;
  padding: 0 28px 0 9px;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
}

.chat-feed {
  max-height: calc(100vh - 350px);
  min-height: 400px;
  overflow: auto;
}

.chat-message {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) auto;
  gap: 10px;
  padding: 12px 18px;
  border-bottom: 1px solid #e9edf1;
}

.chat-message:hover {
  background: var(--surface-muted);
}

.sender-avatar {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  color: #4d3c65;
  background: #eee8f5;
  border-radius: 50%;
  font-size: 10px;
  font-weight: 750;
  text-transform: uppercase;
}

.chat-content {
  min-width: 0;
}

.chat-sender {
  display: flex;
  align-items: baseline;
  gap: 7px;
  font-size: 12px;
}

.chat-sender strong {
  max-width: 260px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.message-type {
  color: var(--ink-faint);
  font-size: 10px;
  text-transform: uppercase;
}

.chat-body {
  overflow-wrap: anywhere;
  margin-top: 3px;
  color: #334150;
  font-size: 13px;
  white-space: pre-wrap;
}

.chat-body.deleted {
  color: var(--ink-faint);
  font-style: italic;
  text-decoration: line-through;
}

.tip-summary {
  width: max-content;
  max-width: 100%;
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 5px;
  padding: 6px 9px;
  color: #704800;
  background: var(--amber-soft);
  border: 1px solid #efd7a6;
  border-radius: var(--radius);
}

.tip-summary svg {
  color: var(--amber);
}

.tip-summary div,
.tip-summary strong,
.tip-summary span {
  min-width: 0;
}

.tip-summary strong,
.tip-summary span {
  display: block;
}

.tip-summary strong {
  font-size: 12px;
}

.tip-summary span {
  overflow-wrap: anywhere;
  color: #805913;
  font-size: 10px;
}

.chat-time {
  padding-top: 1px;
  color: var(--ink-faint);
  font-size: 10px;
  white-space: nowrap;
}

.show-list {
  min-height: 460px;
  overflow: auto;
}

.show-row {
  display: grid;
  grid-template-columns: minmax(160px, 1.8fr) minmax(100px, 0.7fr) minmax(
      140px,
      1fr
    ) minmax(110px, 0.8fr);
  gap: 16px;
  align-items: center;
  padding: 14px 18px;
  border-bottom: 1px solid #e9edf1;
}

.show-row:hover {
  background: var(--surface-muted);
}

.show-topic {
  min-width: 0;
}

.show-topic strong {
  display: block;
  overflow: hidden;
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.show-topic span,
.show-cell span {
  display: block;
  margin-bottom: 3px;
  color: var(--ink-faint);
  font-size: 10px;
  font-weight: 650;
  text-transform: uppercase;
}

.show-cell {
  min-width: 0;
  overflow: hidden;
  color: #344250;
  font-size: 12px;
  text-overflow: ellipsis;
}

.show-phase {
  display: inline-flex;
  align-items: center;
  padding: 3px 7px;
  color: var(--ink-soft);
  background: #edf1f4;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 750;
  text-transform: uppercase;
}

.show-phase.active {
  color: #0d6849;
  background: var(--green-soft);
}

.show-phase.announced {
  color: var(--amber);
  background: var(--amber-soft);
}

.show-phase.ended {
  color: var(--ink-soft);
  background: #edf1f4;
}

.empty-state,
.loading-state {
  min-height: 360px;
  display: grid;
  place-content: center;
  justify-items: center;
  padding: 30px;
  color: var(--ink-faint);
  text-align: center;
}

.empty-state svg,
.loading-state svg {
  width: 26px;
  height: 26px;
  margin-bottom: 10px;
}

.loading-state svg {
  animation: spin 0.9s linear infinite;
}

.is-spinning svg {
  animation: spin 0.9s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.modal {
  width: min(460px, calc(100vw - 32px));
  padding: 0;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  box-shadow: var(--shadow-modal);
}

.modal::backdrop {
  background: rgb(23 33 43 / 48%);
}

.modal-compact {
  width: min(400px, calc(100vw - 32px));
}

.modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  padding: 18px 20px;
  border-bottom: 1px solid var(--line);
}

.modal-header h2 {
  font-size: 17px;
}

.modal-header p {
  margin-top: 4px;
  color: var(--ink-faint);
  font-size: 12px;
}

.modal-body {
  display: grid;
  gap: 18px;
  padding: 20px;
}

.field {
  display: grid;
  gap: 7px;
  color: var(--ink-soft);
  font-size: 12px;
  font-weight: 650;
}

.field input {
  width: 100%;
  height: 40px;
  padding: 0 11px;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
}

.field select {
  width: 100%;
  height: 40px;
  padding: 0 30px 0 11px;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
}

.field input:focus {
  border-color: #8cace6;
}

.field select:focus {
  border-color: #8cace6;
  outline: 3px solid rgb(39 100 215 / 25%);
  outline-offset: 1px;
}

.discover-view {
  min-height: calc(100vh - 150px);
  margin: 16px 24px 24px;
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.discover-header {
  min-height: 76px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
}

.discover-header h2 {
  font-size: 16px;
}

.discover-header p {
  margin-top: 3px;
  color: var(--ink-faint);
  font-size: 12px;
}

.discover-filters {
  display: grid;
  grid-template-columns: minmax(220px, 2fr) minmax(160px, 1fr) minmax(160px, 1fr);
  gap: 14px;
  padding: 14px 18px 18px;
  background: var(--surface-muted);
  border-bottom: 1px solid var(--line);
}

.input-with-icon {
  height: 40px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 10px;
  color: var(--ink-faint);
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
}

.input-with-icon:focus-within {
  color: var(--primary);
  border-color: #8cace6;
  outline: 3px solid rgb(39 100 215 / 12%);
  outline-offset: 1px;
}

.input-with-icon input {
  height: 100%;
  padding: 0;
  background: transparent;
  border: 0;
  outline: 0;
}

.discover-result-heading {
  min-height: 52px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 10px 18px;
  border-bottom: 1px solid var(--line);
}

.discover-result-heading h3 {
  font-size: 13px;
}

.discover-result-heading span {
  color: var(--ink-faint);
  font-size: 11px;
}

.discover-show-list {
  min-height: 420px;
}

.discover-show-row {
  display: grid;
  grid-template-columns:
    minmax(180px, 1.8fr) minmax(95px, 0.65fr) minmax(145px, 1fr)
    minmax(115px, 0.75fr) auto;
  gap: 16px;
  align-items: center;
  padding: 14px 18px;
  border-bottom: 1px solid #e9edf1;
}

.discover-show-row:hover {
  background: var(--surface-muted);
}

.discover-show-row .button {
  min-height: 34px;
  padding: 0 10px;
  font-size: 11px;
}

.most-watched-filters {
  grid-template-columns: repeat(2, minmax(180px, 260px));
}

.most-watched-list {
  min-height: 420px;
}

.most-watched-row {
  min-height: 84px;
  display: grid;
  grid-template-columns:
    34px 112px minmax(180px, 1.5fr) minmax(100px, 0.7fr)
    minmax(78px, 0.55fr) auto;
  align-items: center;
  gap: 14px;
  padding: 10px 18px;
  border-bottom: 1px solid #e9edf1;
}

.most-watched-row:hover {
  background: var(--surface-muted);
}

.most-watched-row.top-ranked {
  box-shadow: inset 3px 0 0 #d39a25;
}

.watch-rank {
  color: var(--ink-faint);
  font-size: 11px;
}

.most-watched-row.top-ranked .watch-rank {
  color: #8a5d0d;
}

.performer-preview {
  width: 112px;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  display: grid;
  place-items: center;
  color: #4d3c65;
  background: #eee8f5;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  font-size: 12px;
  font-weight: 750;
}

.performer-preview img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}

.watched-identity {
  min-width: 0;
}

.watched-identity strong,
.watched-identity span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.watched-identity strong {
  font-size: 13px;
}

.watched-identity span {
  margin-top: 4px;
  color: var(--ink-faint);
  font-size: 10px;
}

.viewer-count {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  color: #2764a6;
}

.viewer-count > div {
  min-width: 0;
}

.viewer-count strong,
.viewer-count span {
  display: block;
}

.viewer-count strong {
  overflow: hidden;
  color: var(--ink);
  font-size: 15px;
  text-overflow: ellipsis;
}

.viewer-count span {
  color: var(--ink-faint);
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
}

.watched-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 7px;
}

.watched-actions .button {
  min-height: 34px;
  padding: 0 10px;
  font-size: 11px;
}

.login-page {
  display: grid;
  place-items: center;
  padding: 24px;
  background: #eef2f5;
}

.login-shell {
  width: min(100%, 390px);
}

.login-panel {
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  box-shadow: 0 18px 48px rgb(23 33 43 / 12%);
}

.login-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 20px;
  border-bottom: 1px solid var(--line);
}

.login-brand > div:last-child {
  min-width: 0;
}

.login-brand span {
  color: var(--ink-faint);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
}

.login-brand h1 {
  margin-top: 2px;
  font-size: 20px;
}

.login-form {
  display: grid;
  gap: 16px;
  padding: 20px;
}

.login-form .button {
  width: 100%;
  min-height: 40px;
}

.login-error {
  padding: 9px 10px;
  color: #84212c;
  background: var(--red-soft);
  border: 1px solid #efbdc3;
  border-radius: var(--radius);
  font-size: 12px;
}

.checkbox-row {
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr);
  align-items: start;
  gap: 10px;
  padding: 12px;
  background: var(--surface-muted);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  cursor: pointer;
}

.checkbox-row input {
  width: 16px;
  height: 16px;
  margin: 2px 0 0;
  accent-color: var(--primary);
}

.checkbox-row strong,
.checkbox-row small {
  display: block;
}

.checkbox-row strong {
  font-size: 13px;
}

.checkbox-row small {
  margin-top: 2px;
  color: var(--ink-faint);
  font-size: 11px;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 12px 20px 18px;
}

.toast-region {
  position: fixed;
  z-index: 90;
  right: 18px;
  bottom: 18px;
  display: grid;
  gap: 8px;
  pointer-events: none;
}

.toast {
  max-width: min(380px, calc(100vw - 36px));
  display: flex;
  align-items: flex-start;
  gap: 9px;
  padding: 11px 13px;
  color: #ffffff;
  background: #263442;
  border-radius: var(--radius);
  box-shadow: 0 10px 30px rgb(23 33 43 / 20%);
  font-size: 12px;
}

.toast.success {
  background: #126548;
}

.toast.error {
  background: #8f2934;
}

.toast svg {
  width: 16px;
  height: 16px;
  margin-top: 1px;
}

[hidden] {
  display: none !important;
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition: none !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
}

@media (max-width: 900px) {
  .metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .metric:nth-child(2) {
    border-right: 0;
  }

  .metric:nth-child(-n + 2) {
    border-bottom: 1px solid var(--line);
  }

  .dashboard {
    grid-template-columns: minmax(240px, 290px) minmax(0, 1fr);
  }

  .model-actions .switch-control > span:last-child {
    display: none;
  }

  .tab {
    padding: 0 9px;
  }

  .tab svg {
    display: none;
  }

  .show-row {
    grid-template-columns: minmax(140px, 1.5fr) minmax(90px, 0.7fr);
  }

  .show-row > :nth-child(3),
  .show-row > :nth-child(4) {
    display: none;
  }

  .discover-show-row {
    grid-template-columns: minmax(160px, 1.5fr) minmax(90px, 0.7fr) auto;
  }

  .discover-show-row > :nth-child(3),
  .discover-show-row > :nth-child(4) {
    display: none;
  }

  .most-watched-row {
    grid-template-columns:
      28px 96px minmax(150px, 1fr) minmax(90px, 0.7fr) auto;
  }

  .most-watched-row > .show-phase {
    display: none;
  }
}

@media (max-width: 680px) {
  :root {
    --topbar-height: auto;
  }

  .topbar {
    align-items: flex-start;
    padding: 12px 14px;
  }

  .brand-lockup p,
  .worker-state {
    display: none;
  }

  .topbar-actions {
    gap: 5px;
  }

  .topbar-actions .button {
    width: 36px;
    padding: 0;
  }

  .topbar-actions .button span {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
  }

  .error-banner,
  .metrics,
  .dashboard,
  .discover-view {
    margin-right: 12px;
    margin-left: 12px;
  }

  .view-switcher {
    width: auto;
    margin: 12px 12px 0;
  }

  .view-option {
    min-width: 0;
    flex: 1;
    justify-content: center;
  }

  .metrics {
    margin-top: 12px;
    margin-bottom: 12px;
  }

  .metric {
    padding: 12px 14px;
  }

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

  .metric-detail {
    display: none;
  }

  .dashboard {
    min-height: 0;
    display: block;
    overflow: visible;
  }

  .model-panel {
    max-height: 360px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .model-list {
    max-height: 232px;
  }

  .workspace {
    min-height: 520px;
  }

  .model-header {
    min-height: 98px;
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
    padding: 14px;
  }

  .room-summary {
    grid-template-columns: minmax(0, 1fr);
    gap: 14px;
    padding: 12px 14px;
  }

  .room-topic strong,
  .goal-heading strong {
    white-space: normal;
  }

  .goal-heading,
  .goal-history-heading,
  .goal-history-meta,
  .topic-history-heading,
  .topic-history-meta {
    align-items: flex-start;
    flex-direction: column;
    gap: 4px;
  }

  .model-avatar {
    display: none;
  }

  .identity-line {
    align-items: flex-start;
    flex-direction: column;
    gap: 4px;
  }

  .identity-line h2 {
    max-width: 48vw;
  }

  .model-actions {
    width: 100%;
    justify-content: flex-start;
    gap: 8px 14px;
  }

  .model-actions .switch-control > span:last-child {
    display: inline;
  }

  .model-actions .icon-button {
    margin-left: auto;
  }

  .tabs {
    height: auto;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    padding: 0 5px;
  }

  .tab {
    min-height: 48px;
    padding: 0 5px;
    font-size: 11px;
  }

  .tab-count {
    display: none;
  }

  .data-toolbar {
    align-items: stretch;
    flex-direction: column;
    gap: 8px;
    padding: 10px 12px;
  }

  .search-field.compact {
    width: 100%;
  }

  .select-field {
    justify-content: space-between;
  }

  .chat-feed {
    max-height: none;
  }

  .tipper-summary-band > div {
    padding: 10px 12px;
  }

  .tipper-summary-band strong {
    font-size: 15px;
  }

  .tipper-list {
    max-height: none;
  }

  .tipper-row {
    grid-template-columns: 24px minmax(0, 1fr) auto;
    gap: 7px 9px;
    padding: 11px 12px;
  }

  .tipper-rank {
    grid-column: 1;
    grid-row: 1 / span 3;
  }

  .tipper-identity {
    grid-column: 2;
    grid-row: 1;
  }

  .tipper-total {
    grid-column: 3;
    grid-row: 1;
    text-align: right;
  }

  .tipper-largest {
    grid-column: 2;
    grid-row: 2;
  }

  .tipper-count-fact {
    grid-column: 3;
    grid-row: 2;
    text-align: right;
  }

  .tipper-time {
    grid-column: 2 / 4;
    grid-row: 3;
    text-align: left;
  }

  .chat-message {
    grid-template-columns: 30px minmax(0, 1fr);
    padding: 11px 12px;
  }

  .chat-time {
    grid-column: 2;
    grid-row: 2;
  }

  .show-row {
    padding: 12px;
  }

  .discover-view {
    min-height: 620px;
    margin-top: 12px;
  }

  .discover-header {
    align-items: flex-start;
    padding: 14px;
  }

  .discover-header p {
    max-width: 210px;
  }

  .discover-header .button {
    width: 36px;
    flex: 0 0 auto;
    padding: 0;
  }

  .discover-header .button span {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
  }

  .discover-filters {
    grid-template-columns: 1fr;
    gap: 10px;
    padding: 12px;
  }

  .discover-result-heading {
    padding: 10px 12px;
  }

  .discover-show-row {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 10px;
    padding: 12px;
  }

  .discover-show-row > :nth-child(2),
  .discover-show-row > :nth-child(3),
  .discover-show-row > :nth-child(4) {
    display: none;
  }

  .most-watched-row {
    grid-template-columns: 24px 84px minmax(0, 1fr);
    gap: 7px 10px;
    padding: 11px 12px;
  }

  .watch-rank {
    grid-column: 1;
    grid-row: 1 / span 3;
  }

  .performer-preview {
    width: 84px;
    grid-column: 2;
    grid-row: 1 / span 3;
  }

  .watched-identity {
    grid-column: 3;
    grid-row: 1;
  }

  .viewer-count {
    grid-column: 3;
    grid-row: 2;
  }

  .watched-actions {
    grid-column: 2 / 4;
    grid-row: 4;
    justify-content: flex-start;
  }

  .watched-actions .button {
    flex: 1;
  }
}
