:root {
  color-scheme: light;
  --tone-h: 215;
  --tone-s: 82%;
  --bg: hsl(var(--tone-h) 22% 94%);
  --panel: hsl(var(--tone-h) 38% 99%);
  --panel-glass: hsl(var(--tone-h) 38% 99% / 0.86);
  --surface: hsl(var(--tone-h) 26% 96%);
  --surface-strong: hsl(var(--tone-h) 28% 92%);
  --text: hsl(var(--tone-h) 22% 13%);
  --muted: hsl(var(--tone-h) 12% 44%);
  --line: hsl(var(--tone-h) 20% 84%);
  --line-soft: hsl(var(--tone-h) 26% 92%);
  --glass-line: hsl(var(--tone-h) 22% 100% / 0.76);
  --primary: hsl(var(--tone-h) var(--tone-s) 46%);
  --primary-dark: hsl(var(--tone-h) var(--tone-s) 35%);
  --primary-line: hsl(var(--tone-h) 54% 82%);
  --primary-soft: hsl(var(--tone-h) 72% 95%);
  --primary-softer: hsl(var(--tone-h) 68% 97%);
  --primary-text: hsl(var(--tone-h) 62% 30%);
  --primary-shadow: hsl(var(--tone-h) var(--tone-s) 45% / 0.2);
  --hover-line: hsl(var(--tone-h) 20% 72%);
  --hover-bg: hsl(var(--tone-h) 32% 98%);
  --danger: #c23b4a;
  --ok: #16835a;
  --warning: #a15c07;
  --shadow: 0 1px 1px hsl(var(--tone-h) 30% 18% / 0.04), 0 16px 38px hsl(var(--tone-h) 30% 18% / 0.1);
  --shadow-strong: 0 1px 1px hsl(var(--tone-h) 30% 18% / 0.05), 0 22px 52px hsl(var(--tone-h) 30% 18% / 0.14);
  --inner-highlight: inset 0 1px 0 hsl(0 0% 100% / 0.72);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(180deg, hsl(var(--tone-h) 42% 99%) 0, var(--bg) 360px),
    var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Inter, ui-sans-serif, system-ui, sans-serif;
}

#app {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

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

button {
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: linear-gradient(180deg, hsl(var(--tone-h) 32% 100% / 0.98), var(--surface));
  color: var(--text);
  padding: 0 14px;
  cursor: pointer;
  font-weight: 650;
  box-shadow: var(--inner-highlight), 0 1px 1px hsl(var(--tone-h) 25% 20% / 0.04);
  transition: background 0.16s ease, border-color 0.16s ease, box-shadow 0.16s ease, color 0.16s ease;
}

button:hover {
  border-color: var(--hover-line);
  background: linear-gradient(180deg, #fff, var(--hover-bg));
  box-shadow: var(--inner-highlight), 0 2px 6px hsl(var(--tone-h) 25% 20% / 0.07);
}

button:focus-visible {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-shadow);
}

.primary {
  background: linear-gradient(180deg, hsl(var(--tone-h) var(--tone-s) 56%), var(--primary));
  border-color: var(--primary);
  color: #fff;
  box-shadow: var(--inner-highlight), 0 7px 18px var(--primary-shadow);
}

.primary:hover {
  background: linear-gradient(180deg, hsl(var(--tone-h) var(--tone-s) 50%), var(--primary-dark));
  border-color: var(--primary-dark);
}

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

.ghost {
  background: transparent;
}

.full {
  width: 100%;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: hsl(var(--tone-h) 36% 99% / 0.9);
  color: var(--text);
  padding: 10px 12px;
  outline: none;
  box-shadow: inset 0 1px 1px hsl(var(--tone-h) 25% 20% / 0.04);
  transition: border-color 0.16s ease, box-shadow 0.16s ease, background 0.16s ease;
}

textarea {
  resize: vertical;
}

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

label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 600;
}

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

h1 {
  font-size: 38px;
  line-height: 1.1;
}

h2 {
  font-size: 20px;
}

h3 {
  font-size: 15px;
  margin-top: 8px;
}

.auth-page {
  min-height: calc(100vh - 54px);
  display: grid;
  place-items: center;
  padding: 28px;
}

.auth-panel {
  width: min(460px, 100%);
  display: grid;
  gap: 22px;
  padding: 32px;
  background: var(--panel-glass);
  border: 1px solid var(--glass-line);
  border-radius: 8px;
  box-shadow: var(--shadow-strong), inset 0 0 0 1px hsl(var(--tone-h) 20% 70% / 0.12);
  backdrop-filter: blur(22px) saturate(1.25);
}

.auth-panel p {
  margin-top: 12px;
  color: var(--muted);
  line-height: 1.7;
}

.eyebrow,
.subtle,
.meta,
small {
  color: var(--muted);
}

.eyebrow {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

.tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  padding: 5px;
  border: 1px solid hsl(var(--tone-h) 18% 78% / 0.84);
  border-radius: 8px;
  background: hsl(var(--tone-h) 18% 88% / 0.76);
  box-shadow: inset 0 1px 2px hsl(var(--tone-h) 25% 20% / 0.1), 0 1px 0 hsl(0 0% 100% / 0.8);
}

.tabs button {
  border: 0;
  background: transparent;
  color: var(--muted);
  box-shadow: none;
}

.tabs .active {
  background: linear-gradient(180deg, hsl(var(--tone-h) var(--tone-s) 56%), var(--primary));
  color: #fff;
  box-shadow: var(--inner-highlight), 0 7px 18px var(--primary-shadow), 0 1px 2px hsl(var(--tone-h) 30% 18% / 0.18);
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 12px 28px;
  background: linear-gradient(180deg, hsl(var(--tone-h) 36% 100% / 0.9), hsl(var(--tone-h) 26% 96% / 0.82));
  border-bottom: 1px solid hsl(var(--tone-h) 20% 78% / 0.78);
  box-shadow: 0 1px 0 hsl(0 0% 100% / 0.75), 0 10px 26px hsl(var(--tone-h) 28% 20% / 0.08);
  backdrop-filter: blur(28px) saturate(1.45);
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.theme-picker {
  width: auto;
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 5px 8px;
  border: 1px solid hsl(var(--tone-h) 18% 78% / 0.84);
  border-radius: 8px;
  background: hsl(var(--tone-h) 36% 98% / 0.74);
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  box-shadow: var(--inner-highlight);
}

.theme-picker select {
  width: auto;
  min-width: 86px;
  min-height: 32px;
  padding: 4px 8px;
  border-radius: 6px;
  background: hsl(var(--tone-h) 38% 100% / 0.92);
  color: var(--text);
}

.saturation-picker {
  min-height: 42px;
  gap: 8px;
}

.saturation-picker input {
  width: 92px;
  min-height: 0;
  padding: 0;
  border: 0;
  accent-color: var(--primary);
  background: transparent;
  box-shadow: none;
}

.saturation-picker span:last-child {
  min-width: 36px;
  color: var(--text);
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.view-switch {
  display: flex;
  gap: 3px;
  padding: 5px;
  border: 1px solid hsl(var(--tone-h) 18% 76% / 0.88);
  border-radius: 10px;
  background: hsl(var(--tone-h) 18% 88% / 0.78);
  box-shadow: inset 0 1px 2px hsl(var(--tone-h) 25% 20% / 0.12), 0 1px 0 hsl(0 0% 100% / 0.84);
}

.view-switch button {
  min-height: 36px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: hsl(var(--tone-h) 14% 32%);
  padding: 0 14px;
  font-size: 14px;
  font-weight: 760;
  white-space: nowrap;
  box-shadow: none;
}

.view-switch button:hover {
  background: linear-gradient(180deg, hsl(var(--tone-h) 42% 100% / 0.95), hsl(var(--tone-h) 24% 91% / 0.92));
  color: hsl(var(--tone-h) 34% 16%);
  box-shadow: var(--inner-highlight), 0 2px 7px hsl(var(--tone-h) 25% 20% / 0.1);
}

.view-switch .active {
  background: linear-gradient(180deg, hsl(var(--tone-h) var(--tone-s) 58%), var(--primary));
  color: #fff;
  text-shadow: 0 1px 1px hsl(var(--tone-h) 45% 18% / 0.22);
  box-shadow: var(--inner-highlight), 0 8px 20px var(--primary-shadow), 0 1px 3px hsl(var(--tone-h) 35% 20% / 0.18);
}

.view-switch .active:hover {
  background: linear-gradient(180deg, hsl(var(--tone-h) var(--tone-s) 60%), var(--primary));
  color: #fff;
}

.brand {
  font-size: 18px;
  font-weight: 800;
}

.shell {
  width: min(1240px, calc(100% - 36px));
  margin: 22px auto 48px;
  flex: 1 0 auto;
}

.site-footer {
  flex: 0 0 auto;
  width: min(1240px, calc(100% - 36px));
  margin: 0 auto 18px;
  padding: 12px 0;
  color: var(--muted);
  font-size: 13px;
  text-align: center;
}

.site-footer a {
  color: var(--muted);
  text-decoration: none;
}

.site-footer a:hover {
  color: var(--primary);
  text-decoration: underline;
}

.notice {
  width: min(1240px, calc(100% - 36px));
  margin: 16px auto 0;
  padding: 12px 14px;
  border: 1px solid var(--primary-line);
  border-radius: 8px;
  background: var(--primary-soft);
  color: var(--primary-text);
  font-weight: 600;
}

.panel {
  background: var(--panel-glass);
  border: 1px solid var(--glass-line);
  border-radius: 8px;
  padding: 20px;
  box-shadow: var(--shadow), inset 0 0 0 1px hsl(var(--tone-h) 20% 70% / 0.1);
  backdrop-filter: blur(18px) saturate(1.16);
}

.grid {
  display: grid;
  gap: 18px;
}

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

.user-grid {
  grid-template-columns: 340px 1fr;
  align-items: stretch;
}

.user-tabs {
  display: inline-flex;
  gap: 3px;
  margin-bottom: 18px;
  padding: 5px;
  border: 1px solid hsl(var(--tone-h) 18% 78% / 0.84);
  border-radius: 10px;
  background: hsl(var(--tone-h) 18% 88% / 0.72);
  box-shadow: inset 0 1px 2px hsl(var(--tone-h) 25% 20% / 0.1), 0 1px 0 hsl(0 0% 100% / 0.82);
}

.user-tabs button {
  min-height: 36px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  padding: 0 15px;
  font-weight: 760;
  box-shadow: none;
}

.user-tabs button:hover {
  background: hsl(var(--tone-h) 36% 100% / 0.7);
  color: var(--text);
}

.user-tabs .active {
  background: linear-gradient(180deg, hsl(var(--tone-h) var(--tone-s) 56%), var(--primary));
  color: #fff;
  box-shadow: var(--inner-highlight), 0 7px 18px var(--primary-shadow), 0 1px 2px hsl(var(--tone-h) 30% 18% / 0.18);
}

.user-tabs .active:hover {
  color: #fff;
}

.history-page {
  display: grid;
  grid-template-columns: 360px 1fr;
  gap: 18px;
  align-items: start;
}

.result-panel {
  margin-top: 18px;
}

.form {
  display: grid;
  gap: 16px;
}

.compact {
  gap: 12px;
}

.toolbar {
  display: grid;
  grid-template-columns: 1fr 1fr 150px auto;
  gap: 10px;
  margin: 16px 0;
}

.table {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.row {
  display: grid;
  grid-template-columns: 1.2fr 1.2fr auto auto auto;
  gap: 10px;
  align-items: center;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: linear-gradient(180deg, hsl(var(--tone-h) 36% 100% / 0.84), hsl(var(--tone-h) 28% 97% / 0.72));
  box-shadow: var(--inner-highlight), 0 1px 2px hsl(var(--tone-h) 25% 20% / 0.04);
}

.user-row {
  grid-template-columns: 1fr 150px 150px 1fr auto auto;
}

.usage-filter {
  min-width: 240px;
}

.usage-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-top: 16px;
}

.usage-card {
  height: auto;
  min-height: 96px;
  display: grid;
  justify-items: start;
  gap: 4px;
  padding: 12px;
  text-align: left;
  background: linear-gradient(180deg, hsl(var(--tone-h) 36% 100% / 0.84), hsl(var(--tone-h) 28% 97% / 0.72));
  box-shadow: var(--inner-highlight), 0 1px 2px hsl(var(--tone-h) 25% 20% / 0.04);
}

.usage-card.selected {
  border-color: var(--primary);
  background: var(--primary-softer);
  box-shadow: 0 0 0 3px var(--primary-shadow);
}

.usage-card em {
  color: var(--primary);
  font-style: normal;
  font-size: 22px;
  font-weight: 800;
}

.usage-row {
  grid-template-columns: 1.1fr 1.45fr 1.35fr auto 1fr auto;
}

.usage-row > div {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.usage-row.selected {
  border-color: var(--primary);
  background: var(--primary-softer);
}

.usage-detail .conversation {
  margin-top: 0;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 58px;
  min-height: 30px;
  padding: 4px 9px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--panel);
  font-size: 13px;
  font-weight: 800;
}

.status-pill.done {
  border-color: #b7e1d0;
  background: #edfdf6;
  color: var(--ok);
}

.status-pill.error {
  border-color: #f0c3ca;
  background: #fff1f3;
  color: var(--danger);
}

.status-pill.running,
.status-pill.pending {
  border-color: var(--primary-line);
  background: var(--primary-soft);
  color: var(--primary);
}

.inline {
  display: flex;
  align-items: center;
  gap: 8px;
}

.inline input,
.check input {
  width: 16px;
  height: 16px;
  flex: 0 0 16px;
  margin: 0;
}

.workspace {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 18px;
}

.sidebar {
  display: grid;
  align-content: start;
  gap: 14px;
}

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

.project-list button {
  display: grid;
  gap: 5px;
  height: auto;
  padding: 12px;
  text-align: left;
  background: linear-gradient(180deg, hsl(var(--tone-h) 36% 100% / 0.84), hsl(var(--tone-h) 28% 97% / 0.72));
}

.project-list .selected {
  border-color: var(--primary);
  background: var(--primary-softer);
  box-shadow: 0 0 0 3px var(--primary-shadow);
}

.editor {
  min-height: 620px;
}

.split-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.split-title > div {
  display: flex;
  gap: 8px;
}

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

.compact-title button {
  min-height: 30px;
  padding: 0 10px;
  font-size: 13px;
}

.check-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.check,
.option-list .check {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  min-height: 38px;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: linear-gradient(180deg, hsl(var(--tone-h) 36% 100% / 0.84), hsl(var(--tone-h) 28% 97% / 0.72));
  color: var(--text);
  font-weight: 600;
  box-shadow: var(--inner-highlight), 0 1px 2px hsl(var(--tone-h) 25% 20% / 0.04);
}

.check:hover,
.option-list .check:hover {
  border-color: var(--hover-line);
  background: var(--panel);
}

.check span {
  min-width: 0;
  overflow-wrap: anywhere;
}

.toggle {
  justify-content: start;
  min-height: 42px;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
}

.prompt-list {
  display: grid;
  gap: 12px;
}

.prompt-item {
  display: grid;
  gap: 10px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: linear-gradient(180deg, hsl(var(--tone-h) 36% 100% / 0.82), hsl(var(--tone-h) 28% 97% / 0.7));
  box-shadow: var(--inner-highlight);
}

.prompt-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.prompt-actions span {
  display: flex;
  gap: 8px;
}

.controls,
.work {
  display: grid;
  align-content: start;
  gap: 16px;
}

.work {
  grid-template-rows: auto minmax(420px, 1fr) auto;
}

.option-list,
.model-list {
  display: grid;
  gap: 8px;
  grid-auto-rows: minmax(38px, auto);
}

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

.history-item {
  height: auto;
  min-height: 72px;
  display: grid;
  justify-items: start;
  gap: 4px;
  padding: 10px 12px;
  text-align: left;
  background: linear-gradient(180deg, hsl(var(--tone-h) 36% 100% / 0.84), hsl(var(--tone-h) 28% 97% / 0.72));
}

.history-item:hover {
  border-color: var(--primary);
  background: var(--primary-softer);
}

.history-item.selected {
  border-color: var(--primary);
  background: var(--primary-softer);
  box-shadow: 0 0 0 3px var(--primary-shadow);
}

.history-item strong,
.history-item span,
.history-item small {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.history-list-page {
  margin-top: 14px;
  max-height: calc(100vh - 240px);
  overflow: auto;
  padding-right: 2px;
}

.history-detail {
  min-height: 520px;
}

.attachment-section {
  display: grid;
  gap: 10px;
  margin-top: 16px;
  margin-bottom: 16px;
}

.attachment-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.attachment-card {
  display: grid;
  gap: 8px;
  min-width: 0;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: linear-gradient(180deg, hsl(var(--tone-h) 36% 100% / 0.84), hsl(var(--tone-h) 28% 97% / 0.72));
  color: var(--text);
  text-decoration: none;
}

.attachment-card:hover {
  border-color: var(--primary);
  background: var(--primary-softer);
}

.attachment-card img,
.file-badge {
  width: 100%;
  aspect-ratio: 4 / 3;
  border: 1px solid var(--line-soft);
  border-radius: 6px;
  background: var(--panel);
}

.attachment-card img {
  object-fit: contain;
}

.file-badge {
  display: grid;
  place-items: center;
  color: var(--primary);
  font-weight: 900;
}

.attachment-card strong,
.attachment-card small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dropzone {
  position: relative;
  min-height: 420px;
  height: 100%;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 10px;
  border: 2px dashed var(--primary-line);
  border-radius: 8px;
  background:
    linear-gradient(180deg, hsl(var(--tone-h) 72% 99% / 0.86), hsl(var(--tone-h) 70% 96% / 0.78));
  text-align: center;
  box-shadow: var(--inner-highlight), inset 0 0 0 1px hsl(var(--tone-h) 70% 92% / 0.9), 0 1px 2px hsl(var(--tone-h) 25% 20% / 0.04);
  transition: background 0.16s ease, border-color 0.16s ease, box-shadow 0.16s ease;
}

.dropzone.dragging {
  border-color: var(--primary);
  background: var(--primary-soft);
  box-shadow: 0 0 0 3px var(--primary-shadow);
}

.dropzone input {
  display: none;
}

.drop-title {
  font-size: 22px;
  font-weight: 800;
}

.busy {
  padding: 12px;
  border-radius: 8px;
  background: #fff7e8;
  color: var(--warning);
  border: 1px solid #f4d8a8;
}

.hidden {
  display: none;
}

.screenshot-overlay {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 24px;
  background: hsl(var(--tone-h) 30% 10% / 0.68);
}

.screenshot-panel {
  width: min(1120px, 100%);
  max-height: min(860px, calc(100vh - 48px));
  display: grid;
  gap: 12px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: 0 20px 60px hsl(var(--tone-h) 30% 10% / 0.28);
}

.screenshot-stage {
  position: relative;
  overflow: auto;
  max-height: calc(100vh - 180px);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.screenshot-canvas {
  display: block;
  width: 100%;
  height: auto;
  cursor: crosshair;
  user-select: none;
  touch-action: none;
}

.screenshot-selection {
  position: absolute;
  border: 2px solid var(--primary);
  background: hsl(var(--tone-h) var(--tone-s) 50% / 0.16);
  box-shadow: 0 0 0 9999px hsl(var(--tone-h) 30% 10% / 0.32);
  pointer-events: none;
}

.conversation-list {
  display: grid;
  gap: 12px;
}

.conversation {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-glass);
  overflow: hidden;
  box-shadow: 0 1px 2px hsl(var(--tone-h) 30% 18% / 0.05);
}

.conversation-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
}

.conversation-head > div {
  display: grid;
  gap: 4px;
}

.conversation.done .conversation-head span {
  color: var(--ok);
}

.conversation.error .conversation-head span {
  color: var(--danger);
}

.progress-wrap {
  display: grid;
  gap: 8px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  background: var(--panel);
}

.progress-track {
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--line-soft);
}

.progress-bar {
  height: 100%;
  border-radius: inherit;
  background: var(--primary);
  transition: width 0.35s ease;
}

.progress-wrap.done .progress-bar {
  background: var(--ok);
}

.progress-wrap.error .progress-bar {
  background: var(--danger);
}

.progress-text {
  color: var(--muted);
  font-size: 13px;
}

.summary-block {
  display: grid;
  gap: 8px;
  padding: 14px;
  border-bottom: 1px solid var(--line);
  background: var(--panel);
}

.summary-title {
  font-weight: 800;
}

.model-results {
  display: grid;
  gap: 10px;
  padding: 14px;
  background: var(--surface);
}

.model-result {
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background: hsl(var(--tone-h) 36% 99% / 0.88);
}

.model-result-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}

.model-result.done .model-result-head span {
  color: var(--ok);
}

.model-result.running .model-result-head span {
  color: var(--primary);
}

.model-result.pending .model-result-head span {
  color: var(--muted);
}

.model-result.error .model-result-head span {
  color: var(--danger);
}

.markdown-body {
  padding: 14px;
  line-height: 1.75;
}

.markdown-body h1,
.markdown-body h2,
.markdown-body h3,
.markdown-body h4,
.markdown-body h5,
.markdown-body h6 {
  margin: 0.6em 0 0.35em;
  line-height: 1.3;
}

.markdown-body h1:first-child,
.markdown-body h2:first-child,
.markdown-body h3:first-child,
.markdown-body p:first-child,
.markdown-body ul:first-child,
.markdown-body ol:first-child,
.markdown-body blockquote:first-child,
.markdown-body table:first-child,
.markdown-body pre:first-child {
  margin-top: 0;
}

.markdown-body p,
.markdown-body ul,
.markdown-body ol,
.markdown-body blockquote,
.markdown-body table,
.markdown-body pre {
  margin: 0.65em 0;
}

.markdown-body ul,
.markdown-body ol {
  padding-left: 1.35em;
}

.markdown-body blockquote {
  padding: 8px 12px;
  border-left: 4px solid var(--line);
  color: var(--muted);
  background: var(--surface);
}

.markdown-body table {
  width: 100%;
  border-collapse: collapse;
  overflow-x: auto;
}

.markdown-body th,
.markdown-body td {
  padding: 8px 10px;
  border: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

.markdown-body th {
  background: #f8fafc;
}

.markdown-body code {
  padding: 2px 5px;
  border-radius: 5px;
  background: #eef2f8;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.equation-block {
  margin: 0.8em 0;
  overflow-x: auto;
}

.equation-block .katex-display {
  margin: 0;
  text-align: left;
}

.equation-inline,
.equation-block {
  user-select: text;
}

.katex {
  font-size: 1.06em;
}

.markdown-body pre.code-block {
  overflow-x: auto;
  padding: 12px;
  border-radius: 8px;
  background: #111827;
  color: #f8fafc;
}

.markdown-body pre.code-block code {
  padding: 0;
  background: transparent;
  color: inherit;
}

pre {
  margin: 0;
  padding: 14px;
  white-space: pre-wrap;
  line-height: 1.7;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.empty {
  padding: 14px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  color: var(--muted);
  background: var(--surface);
}

.tall {
  min-height: 220px;
  display: grid;
  place-items: center;
  text-align: center;
}

@media (max-width: 860px) {
  .two,
  .user-grid,
  .history-page,
  .workspace,
  .toolbar,
  .row,
  .user-row,
  .usage-row,
  .usage-summary,
  .attachment-grid,
  .check-grid {
    grid-template-columns: 1fr;
  }

  .topbar {
    padding: 12px 18px;
    align-items: stretch;
    flex-direction: column;
  }

  .top-actions,
  .view-switch {
    flex-wrap: wrap;
  }

  .shell,
  .notice {
    width: min(100% - 24px, 1240px);
  }

  .auth-panel {
    padding: 22px;
  }

  .work {
    grid-template-rows: auto minmax(300px, auto) auto;
  }

  .dropzone {
    min-height: 300px;
  }

  h1 {
    font-size: 30px;
  }
}
