/* Secondary workspaces: editorial hierarchy over quiet, functional surfaces. */
.mono-text,
.mono-input {
  font-family: var(--mono, "Geist Mono", ui-monospace, monospace);
  font-variant-numeric: tabular-nums;
}
.meta-divider {
  padding: 0 10px;
  color: var(--muted);
}
.back-link {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 12px;
}
.page-footnote,
.panel-footnote {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.7;
}
.page-footnote {
  margin: 24px 0;
}
.panel-footnote {
  margin: 20px 0 0;
}
.field-help {
  line-height: 1.65;
  margin: 12px 0 0;
}
.form-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  margin-top: 24px;
}
.form-footer p {
  margin: 0;
  max-width: 340px;
}
.form-footer button {
  flex-shrink: 0;
}
.quiet-empty {
  padding: 32px 8px;
  text-align: center;
}
.quiet-empty h3 {
  font-size: 16px;
  font-weight: 500;
  margin: 0 0 8px;
}
.quiet-empty p {
  margin: 8px 0;
}
.quiet-empty-mark {
  display: inline-grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 50%;
  color: var(--muted);
  margin-bottom: 8px;
}

/* Two equally valid entry methods, with a single primary action. */
.manual-layout {
  display: grid;
  grid-template-columns: minmax(0, 0.8fr) minmax(0, 1.2fr);
  gap: 24px;
  align-items: start;
}
.manual-layout > .panel {
  padding: 32px;
}
.method-icon {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 12px;
  color: var(--fg);
  margin-bottom: 32px;
  background: #101012;
}
.method-icon svg {
  width: 24px;
  height: 24px;
}
.manual-url h2 {
  font-size: 24px;
  margin-bottom: 12px;
}
.manual-url > p.muted {
  max-width: 320px;
  line-height: 1.75;
}
.manual-url form {
  margin-top: 28px;
}
.manual-url .primary {
  margin-top: 16px;
}
.manual-url .field-help {
  margin-top: 16px;
}
.manual-next {
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  padding-top: 24px;
  margin-top: 32px;
}
.manual-next ol {
  list-style: none;
  counter-reset: steps;
  display: grid;
  gap: 16px;
  margin: 20px 0 0;
  padding: 0;
}
.manual-next li {
  counter-increment: steps;
  display: flex;
  align-items: baseline;
  gap: 12px;
  color: var(--muted);
  font-size: 13px;
}
.manual-next li:before {
  content: "0" counter(steps);
  font-size: 10px;
  letter-spacing: 0.04em;
  font-family: var(--mono, ui-monospace, monospace);
  color: #888e90;
}
.manual-next strong {
  font-weight: 500;
  color: var(--fg);
}
.manual-text .section-head {
  align-items: center;
}
.manual-text .section-head h2 {
  margin: 8px 0 0;
  font-size: 24px;
}
.manual-text textarea {
  min-height: 260px;
}
.manual-text .form-footer {
  align-items: flex-start;
  flex-direction: column;
  gap: 16px;
}
.manual-text .form-footer p {
  max-width: none;
}

/* Source controls stay scannable while longer error details stay available. */
.source-management {
  padding: 0 !important;
  overflow: hidden;
}
.source-management > summary {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 24px 28px;
  list-style: none;
}
.source-management > summary:after {
  content: "⌄";
  font-size: 18px;
  font-weight: 400;
  margin-left: auto;
  color: var(--muted);
  transform: rotate(-90deg);
}
.source-management[open] > summary:after {
  transform: rotate(0);
}
.source-management[open] > summary {
  margin-bottom: 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}
.source-management > summary::-webkit-details-marker {
  display: none;
}
.section-description {
  padding: 0 28px;
  margin: 18px 0;
}
.source-table {
  min-width: 860px;
}
.source-table th:first-child,
.source-table td:first-child {
  padding-left: 28px;
}
.source-table th:last-child,
.source-table td:last-child {
  padding-right: 28px;
}
.source-table td {
  vertical-align: middle;
  padding-top: 20px;
  padding-bottom: 20px;
}
.source-table th {
  background: #06060a;
}
.source-table .source-name {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 13px;
  min-width: 135px;
}
.source-name strong {
  font-weight: 500;
}
.source-monogram {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  background: #101012;
  color: #a1a4a5;
  font-size: 14px;
  font-family: var(--serif, Georgia, serif);
}
.source-kind {
  display: block;
  margin-top: 4px;
  font-size: 11px;
}
.source-error-details {
  max-width: 215px;
  margin-top: 8px;
}
.source-error-details summary {
  font-size: 11px;
  font-weight: 400;
  color: var(--muted);
}
.source-error-details p {
  margin: 8px 0 0;
  overflow-wrap: anywhere;
}
.source-error-details[open] > summary {
  margin-bottom: 4px;
}
.source-state-note {
  max-width: 190px;
  margin: 8px 0 0;
  overflow-wrap: anywhere;
}
.source-table .inline-form {
  align-items: center;
  gap: 6px;
}
.source-table .inline-form input {
  width: 74px;
  font-size: 12px;
  min-height: 36px;
  padding: 8px;
}
.source-table button {
  min-height: 36px;
  padding: 8px 10px;
  font-size: 11px;
}
.source-table .actions {
  gap: 6px;
  flex-wrap: nowrap;
}
.source-date-cell {
  white-space: nowrap;
}
.signal-history {
  padding: 0 !important;
  overflow: hidden;
  margin-top: 32px;
}
.signal-history > .section-head {
  padding: 24px 28px;
  margin: 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}
.signal-history h2 {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 8px;
}
.signal-history .signal-table th:first-child,
.signal-history .signal-table td:first-child {
  padding-left: 28px;
}
.signal-history .signal-table th:last-child,
.signal-history .signal-table td:last-child {
  padding-right: 28px;
}
.signal-table th {
  background: #06060a;
}
.signal-table {
  min-width: 700px;
}
.signal-table td {
  vertical-align: middle;
  padding-top: 18px;
  padding-bottom: 18px;
}
.signal-table td:first-child {
  width: 52%;
  min-width: 260px;
  line-height: 1.6;
}
.signal-table td:last-child {
  white-space: nowrap;
}
.signal-title {
  font-size: 13px;
}
.signal-title > span {
  color: var(--muted);
  white-space: nowrap;
}

/* Metrics use real values, typography, and a restrained row rhythm. */
.period-switch {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 3px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 8px;
  background: #0a0a0c;
}
.period-switch > a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 32px;
  padding: 6px 14px;
  border-radius: 5px;
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}
.period-switch > a.active {
  background: #1b1b1d;
  color: #fcfdff;
}
.quality-metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 12px;
  background: #0a0a0c;
  margin-bottom: 24px;
  overflow: hidden;
}
.quality-metric {
  padding: 28px 24px;
  display: flex;
  align-items: flex-start;
  flex-direction: column;
  gap: 14px;
  border-right: 1px solid rgba(255, 255, 255, 0.08);
}
.quality-metric:last-child {
  border: 0;
}
.quality-metric > span {
  font-size: 12px;
}
.quality-metric strong {
  font-size: 32px;
  font-weight: 400;
  line-height: 1.15;
  letter-spacing: -1.2px;
  font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere;
}
.quality-metric small {
  font-size: 11px;
}
.quality-columns {
  gap: 24px;
}
.quality-columns .section-head,
.latency-panel > .section-head {
  margin-bottom: 24px;
}
.quality-columns .section-head h2,
.latency-panel > .section-head h2 {
  margin-top: 8px;
}
.quality-columns .stat-line {
  padding: 15px 0;
  font-size: 13px;
  border-color: rgba(255, 255, 255, 0.06);
}
.quality-columns .stat-line strong {
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}
.latency-panel table {
  min-width: 570px;
}
.latency-panel th:not(:first-child),
.latency-panel td:not(:first-child) {
  text-align: right;
}
.cost-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border-top: 1px solid rgba(255, 255, 255, 0.14);
  padding-top: 24px;
  margin-top: 24px;
  font-size: 12px;
}
.cost-summary strong {
  font-size: 18px;
  font-weight: 400;
  font-variant-numeric: tabular-nums;
}

/* Prompt editing and explicit experiments form separate work areas. */
.prompt-workspace {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(320px, 0.85fr);
  align-items: start;
  gap: 24px;
}
.prompt-main,
.prompt-side {
  min-width: 0;
}
.prompt-workspace .section-head h2 {
  margin-top: 8px;
}
.prompt-editor .section-head {
  align-items: center;
}
.prompt-editor .code-editor-label {
  font-size: 12px;
  color: var(--muted);
}
.prompt-editor .prompt-code {
  font-family: var(--mono, "Geist Mono", ui-monospace, monospace);
  font-size: 12px;
  line-height: 1.85;
  padding: 20px;
  background: #06060a;
  border-radius: 12px;
  tab-size: 2;
  min-height: 430px;
}
.prompt-editor .form-footer {
  flex-direction: column;
  align-items: flex-start;
  gap: 16px;
}
.prompt-editor .form-footer p {
  max-width: none;
}
.prompt-workspace .version-row {
  padding: 16px 0;
  border-color: rgba(255, 255, 255, 0.08);
}
.prompt-workspace .version-row > div {
  min-width: 0;
  overflow-wrap: anywhere;
}
.prompt-workspace .version-row strong {
  font-weight: 500;
  font-size: 12px;
}
.prompt-workspace .version-row p {
  font-size: 11px;
  line-height: 1.65;
  margin: 6px 0 0;
}
.prompt-workspace .version-row form,
.prompt-workspace .version-row > .pill {
  flex-shrink: 0;
}
.prompt-workspace .version-row button {
  font-size: 11px;
  padding: 7px 10px;
}
.prompt-versions > summary {
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
}
.prompt-versions[open] > summary {
  padding-bottom: 18px;
  margin-bottom: 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}
.event-selection {
  padding: 0;
  border: 0;
  min-width: 0;
  margin: 24px 0 18px;
}
.event-selection legend {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
  margin-bottom: 12px;
  gap: 12px;
}
.prompt-run .event-pick {
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 8px;
  background: #06060a;
  padding: 0 14px;
  margin: 0;
  max-height: 300px;
}
.prompt-run .event-pick > .check {
  align-items: flex-start;
  line-height: 1.7;
  padding: 14px 0;
  margin: 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}
.prompt-run .event-pick > .check:last-child {
  border-bottom: 0;
}
.prompt-run .event-pick input {
  margin-top: 3px;
}
.prompt-run .event-pick .check span {
  min-width: 0;
  overflow-wrap: anywhere;
}
.run-row-end {
  display: flex;
  gap: 14px;
  align-items: center;
  color: var(--muted);
}
.run-row {
  gap: 12px;
}
.lab-pending {
  display: flex;
  align-items: center;
  gap: 20px;
}
.lab-pending h2 {
  margin-bottom: 8px;
}
.lab-pending p {
  margin: 0;
}
.lab-result > .section-head h2 {
  line-height: 1.6;
  font-size: 18px;
  max-width: 800px;
  margin-top: 8px;
}
.lab-result .diff-head {
  padding: 12px 16px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 8px 8px 0 0;
  background: #101012;
  font-size: 12px;
  gap: 20px;
}
.lab-result .diff-wrap {
  background: #06060a;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-top: 0;
  border-radius: 0 0 8px 8px;
}
.lab-result .diff {
  min-width: 650px;
  font-size: 11px;
  font-family: var(--mono, ui-monospace, monospace);
}
.lab-result .diff_header,
.lab-result .diff_next {
  background: #101012;
  color: var(--muted);
}
.lab-result .diff_add {
  background: rgba(17, 255, 153, 0.09);
  color: #a0dfbe;
}
.lab-result .diff_sub {
  background: rgba(255, 32, 71, 0.11);
  color: #ffabb9;
}
.lab-result .diff_chg {
  background: rgba(255, 197, 61, 0.12);
  color: #e2cb93;
}
.lab-quality-note {
  font-size: 12px;
  margin: 18px 0 0;
}

/* Settings gathers the newsroom tools above the existing preferences form. */
.settings-tools-section {
  margin-bottom: 44px;
}
.settings-tools-head {
  margin-bottom: 20px;
}
.settings-tools-head h2 {
  font-size: 20px;
  font-weight: 500;
  margin: 0 0 8px;
}
.settings-tools-head p {
  margin: 0;
  line-height: 1.7;
}
.settings-tools {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}
.settings-tool {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) 18px;
  align-items: center;
  gap: 18px;
  min-height: 120px;
  padding: 24px;
  border: 1px solid var(--line, rgba(255, 255, 255, 0.1));
  border-radius: 10px;
  color: var(--fg);
  background: #080808;
  text-decoration: none;
  transition: border-color .15s ease, background-color .15s ease;
}
.settings-tool:hover,
.settings-tool:focus-visible {
  border-color: rgba(255, 255, 255, 0.32);
  background: #111;
  color: var(--fg);
  text-decoration: none;
}
.settings-tool:focus-visible {
  outline: 2px solid var(--fg);
  outline-offset: 4px;
}
.settings-tool-icon {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 9px;
  color: #b7b7b7;
}
.settings-tool-copy {
  display: grid;
  gap: 8px;
  min-width: 0;
}
.settings-tool-copy strong {
  font-size: 15px;
  font-weight: 500;
  line-height: 1.4;
}
.settings-tool-copy > span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.65;
}
.settings-tool-arrow {
  display: flex;
  color: var(--muted);
}
@media (prefers-reduced-motion: reduce) {
  .settings-tool { transition: none; }
}
.settings-section {
  display: grid;
  grid-template-columns: minmax(200px, 0.55fr) minmax(0, 1.45fr);
  gap: 48px;
  padding: 30px 0;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}
.settings-description {
  padding-top: 6px;
}
.telegram-settings { scroll-margin-top: 24px; margin-top: 30px; }
.telegram-guide { margin: 22px 0; }
.telegram-guide ol { padding-left: 22px; color: var(--muted); font-size: 13px; line-height: 1.8; }
.telegram-guide li + li { margin-top: 12px; }
.telegram-guide strong { color: var(--fg); }
.telegram-connection-actions { margin-top: 22px; gap: 12px; align-items: baseline; }
[data-telegram-form] > button { margin-top: 12px; }
.settings-description h2 {
  font-size: 20px;
  margin: 12px 0;
}
.settings-description > p.muted {
  max-width: 270px;
  line-height: 1.75;
  font-size: 13px;
}
.settings-fields {
  margin-bottom: 0 !important;
  padding: 28px !important;
}
.settings-fields > label:first-child {
  margin-top: 0;
}
.settings-fields .section-head {
  margin-bottom: 24px;
  align-items: center;
}
.settings-fields .section-head h3 {
  font-size: 15px;
  font-weight: 500;
  margin: 0;
}
.settings-note {
  padding-top: 24px;
  margin-top: 24px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}
.settings-note > strong {
  font-size: 13px;
  font-weight: 500;
}
.settings-note > p {
  line-height: 1.75;
  margin: 8px 0 0;
}
.brand-colors {
  border: 0;
  padding: 0;
  margin: 28px 0 0;
  min-width: 0;
}
.brand-colors legend {
  font-size: 13px;
  margin-bottom: 12px;
}
.color-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}
.color-field {
  display: flex !important;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 0 !important;
  padding: 12px 14px;
  background: #06060a;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  font-size: 12px;
}
.color-field input[type="color"] {
  width: 32px;
  height: 32px;
  min-height: 32px;
  margin: 0;
  padding: 2px;
  border-radius: 6px;
  background: #101012;
  flex-shrink: 0;
  cursor: pointer;
}
.logo-field {
  margin-top: 28px;
  padding-top: 24px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}
.logo-field label {
  margin-top: 0;
}
.logo-field input[type="file"] {
  padding: 12px;
  font-size: 12px;
  max-width: 100%;
}
.logo-field input::file-selector-button {
  padding: 8px 12px;
  color: var(--fg);
  font: inherit;
  background: #101012;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 6px;
  margin-right: 12px;
  cursor: pointer;
}
.connection-row {
  padding: 18px 0 !important;
}
.connection-row:first-child {
  padding-top: 0 !important;
}
.connection-row strong {
  font-size: 13px;
  font-weight: 500;
}
.connection-row p {
  margin: 6px 0 0;
  line-height: 1.6;
}
.settings-save {
  margin-top: 0;
  padding: 24px 0 8px;
}

/* Entry screen: a calm, editorial composition with one bright invitation. */
/* Giriş: tek ortalanmış kart, sayfa kaydırılmaz. */
.login-main {
  display: flex !important;
  align-items: center;
  justify-content: center;
  height: 100dvh;
  min-height: 100svh;
  padding: 24px !important;
  background: #000 !important;
  overflow: hidden;
}
.login-main > .page-content {
  width: 100%;
  display: flex;
  justify-content: center;
}
.login-stage {
  position: relative;
  width: min(100%, 384px);
  /* Optik denge: tam ortada duran bir form gözle biraz aşağıda görünür. */
  margin-bottom: 4vh;
}
/* Kartın arkasındaki tek yumuşak ışık; ikinci bir katman veya çerçeve parıltısı eklenmez. */
.login-aura {
  position: absolute;
  inset: -55% -70%;
  pointer-events: none;
  background: radial-gradient(ellipse at 50% 42%, rgba(255, 255, 255, 0.07), transparent 62%);
}
.login-card {
  position: relative;
  display: block;
  margin: 0;
}
.login-mark {
  display: block;
  width: 92px;
  margin: 0 auto 34px;
}
.login-title {
  font-family: var(--serif, Georgia, serif);
  font-size: 34px;
  font-weight: 400;
  letter-spacing: -0.8px;
  line-height: 1.1;
  text-align: center;
  margin: 0 0 26px;
}
/* Alan ve gönderme düğmesi tek nesne gibi davranır; ayrı bir buton satırı yoktur. */
.login-field {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 6px 6px 16px;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  background: #0a0a0c;
  transition: border-color 0.18s, background 0.18s;
}
.login-field:focus-within {
  border-color: rgba(255, 255, 255, 0.42);
  background: #101012;
}
.login-field.invalid {
  border-color: var(--red, #ff2047);
}
.login-field input {
  flex: 1;
  min-width: 0;
  margin: 0;
  padding: 12px 0;
  border: 0;
  background: none;
  color: var(--fg);
  /* 16 px: mobil tarayıcı odakta sayfayı yakınlaştırmasın. */
  font-size: 16px;
}
.login-field input:focus {
  outline: none;
}
.login-field input::placeholder {
  color: var(--ash);
}
/* Tarayıcının otomatik doldurma rengi koyu temayı mavi bir kutuyla bozuyordu. */
.login-field input:-webkit-autofill,
.login-field input:-webkit-autofill:hover,
.login-field input:-webkit-autofill:focus {
  -webkit-text-fill-color: var(--fg);
  -webkit-box-shadow: 0 0 0 1000px #0a0a0c inset;
  caret-color: var(--fg);
}
.login-field button {
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 9px;
  background: var(--fg);
  color: #000;
  cursor: pointer;
  transition: opacity 0.16s;
}
.login-field button:hover {
  opacity: 0.85;
}
.login-card .form-error {
  /* Tek satırlık uyarı; global kutu/çerçeve bu sade ekranda ağır duruyor. */
  margin: 14px 0 0;
  padding: 0;
  border: 0;
  background: none;
  text-align: center;
  font-size: 12px;
}
.login-note {
  margin: 24px 0 0;
  text-align: center;
  font-size: 11px;
  color: var(--ash);
}
/* Alçak pencerede (yatay telefon) kart kırpılmasın. */
@media (max-height: 560px) {
  .login-mark {
    width: 72px;
    margin-bottom: 20px;
  }
  .login-title {
    font-size: 26px;
    margin-bottom: 18px;
  }
  .login-note {
    margin-top: 16px;
  }
}
@media (prefers-reduced-motion: reduce) {
  .login-field,
  .login-field button {
    transition: none;
  }
}

.error-page {
  max-width: 850px;
  margin: 72px auto 48px;
  padding: 24px 0;
  text-align: center;
}
.error-code {
  display: block;
  font-family: var(--serif, Georgia, serif);
  font-size: 140px;
  line-height: 1;
  color: #252529;
  letter-spacing: -8px;
  margin-bottom: 36px;
}
.error-page .display-title {
  font-size: clamp(30px, 4vw, 48px);
  line-height: 1.2;
  max-width: 760px;
  margin: 20px auto 32px;
  overflow-wrap: anywhere;
}
.error-page .actions {
  justify-content: center;
}

@media (max-width: 1279px) {
  .prompt-workspace {
    grid-template-columns: minmax(0, 1fr) minmax(300px, 0.8fr);
    gap: 20px;
  }
  .quality-metric {
    padding: 24px 18px;
  }
  .quality-metric strong {
    font-size: 28px;
  }
  .settings-section {
    gap: 28px;
    grid-template-columns: minmax(180px, 0.55fr) minmax(0, 1.45fr);
  }
  .manual-layout {
    gap: 20px;
  }
  .manual-layout > .panel {
    padding: 24px;
  }
}
@media (max-width: 1023px) {
  .manual-layout {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr);
  }
  .prompt-workspace {
    grid-template-columns: minmax(0, 1fr);
  }
  .prompt-side {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    align-items: start;
    gap: 24px;
  }
  .prompt-editor .prompt-code {
    min-height: 360px;
  }
}
@media (max-width: 767px) {
  .settings-tools-section { margin-bottom: 32px; }
  .settings-tools { grid-template-columns: minmax(0, 1fr); gap: 12px; }
  .settings-tool { min-height: 108px; padding: 20px; gap: 14px; }
  body:is(
      [data-page="signals"],
      [data-page="quality"],
      [data-page="prompts"],
      [data-page="lab"],
      [data-page="manual"],
      [data-page="settings"]
    )
    .page-head {
    flex-direction: column;
    align-items: flex-start;
  }
  body:is(
      [data-page="signals"],
      [data-page="quality"],
      [data-page="prompts"],
      [data-page="lab"],
      [data-page="manual"],
      [data-page="settings"]
    )
    .page-head
    > div {
    min-width: 0;
    max-width: 100%;
  }
  .page-head .actions {
    max-width: 100%;
  }
  .manual-layout,
  .settings-section {
    grid-template-columns: minmax(0, 1fr);
    gap: 20px;
  }
  .manual-layout > .panel {
    padding: 24px;
  }
  .manual-next {
    margin-top: 24px;
    padding-top: 20px;
  }
  .method-icon {
    margin-bottom: 24px;
  }
  .manual-text textarea {
    min-height: 240px;
  }
  .quality-metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .quality-metric:nth-child(2) {
    border-right: 0;
  }
  .quality-metric:nth-child(-n + 2) {
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  }
  .quality-metric {
    gap: 12px;
  }
  .quality-metric strong {
    font-size: 30px;
  }
  .quality-columns {
    grid-template-columns: minmax(0, 1fr);
    gap: 0;
  }
  .period-switch > a {
    min-height: 38px;
  }
  .source-management > summary,
  .signal-history > .section-head {
    padding: 20px;
  }
  .section-description {
    padding: 0 20px;
  }
  .source-table th:first-child,
  .source-table td:first-child,
  .signal-history .signal-table th:first-child,
  .signal-history .signal-table td:first-child {
    padding-left: 20px;
  }
  .source-table button {
    min-height: 44px;
    padding: 10px 12px;
  }
  .source-table .inline-form input {
    min-height: 44px;
    width: 84px;
  }
  .source-table {
    min-width: 930px;
  }
  .prompt-side {
    grid-template-columns: minmax(0, 1fr);
    gap: 0;
  }
  .settings-section {
    padding: 24px 0;
  }
  .settings-description {
    padding: 0;
  }
  .settings-description > p.muted {
    max-width: none;
    margin-bottom: 0;
  }
  .settings-fields {
    padding: 24px !important;
  }
  .settings-fields .section-head {
    flex-wrap: wrap;
    gap: 12px;
  }
  .settings-save {
    flex-direction: column;
    align-items: stretch;
  }
  .settings-save button {
    align-self: flex-start;
  }
  .color-field input[type="color"] {
    width: 40px;
    height: 40px;
    min-height: 40px;
  }
  .connection-row {
    align-items: flex-start;
    gap: 12px;
  }
  .connection-row .pill {
    white-space: normal;
    flex-shrink: 0;
    max-width: 100px;
  }
  .error-page {
    margin: 40px auto;
  }
  .error-code {
    font-size: 110px;
  }
  .lab-pending {
    gap: 14px;
  }
  .lab-result .section-head h2 {
    font-size: 16px;
  }
}
@media (max-width: 425px) {
  .login-main {
    padding: 24px 20px !important;
  }
  .manual-layout > .panel,
  .settings-fields {
    padding: 20px !important;
  }
  .quality-metric {
    padding: 22px 16px;
  }
  .quality-metric strong {
    font-size: 27px;
  }
  .quality-metric > span {
    font-size: 11px;
  }
  .quality-metric small {
    font-size: 10px;
  }
  .color-grid {
    grid-template-columns: minmax(0, 1fr);
  }
  .form-footer {
    flex-direction: column;
    align-items: flex-start;
    gap: 16px;
  }
  .prompt-editor .prompt-code {
    padding: 14px;
    font-size: 11px;
  }
  .run-row .pill {
    font-size: 10px;
  }
  .cost-summary {
    flex-wrap: wrap;
  }
}
