:root {
  --ink: #262936;
  --muted: #697081;
  --line: #e4e7ef;
  --paper: #f7f8fb;
  --blue: #485ac7;
  --blue-dark: #3748aa;
}
body {
  font-family: "DM Sans", system-ui, sans-serif;
  background: var(--paper);
}
.topbar {
  height: 84px;
  padding: 0 max(24px, calc((100vw - 1240px) / 2));
  background: white;
  color: var(--ink);
  border-bottom: 1px solid var(--line);
}
.brand {
  font-size: 25px;
  font-weight: 600;
  letter-spacing: -1px;
  gap: 11px;
}
.brand-mark {
  width: 36px;
  height: 36px;
  font:
    600 28px/1 "DM Sans",
    sans-serif;
  letter-spacing: -2px;
  border: 0;
  border-radius: 10px;
  background: var(--ink);
  color: white;
  padding-bottom: 4px;
}
.brand-period {
  color: var(--blue);
}
.connection {
  color: var(--muted);
  font-size: 13px;
}
.text-button {
  color: var(--ink);
  border: 1px solid #d9dfe9;
  background: white;
  padding: 7px 13px;
  border-radius: 9px;
}
.text-button:hover {
  background: #f3f5fa;
}
.main {
  max-width: 1296px;
  padding: 34px 28px 0;
}
.page-heading {
  margin-bottom: 28px;
}
.page-heading h1 {
  font-size: clamp(28px, 3vw, 37px);
  font-weight: 500;
  letter-spacing: -1.2px;
}
.page-heading > p {
  font-size: 14px;
}
.eyebrow {
  font-family: inherit;
  letter-spacing: 0.08em;
  font-size: 12px;
  font-weight: 600;
}
.workspace {
  display: block;
  min-height: 0;
  border-radius: 20px;
  box-shadow: 0 4px 24px #26293604;
  overflow: visible;
  background: white;
}
.workspace-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 18px 26px 14px;
  gap: 18px;
}
.model-picker {
  position: relative;
  max-width: 100%;
  z-index: 5;
}
.model-picker > summary {
  list-style: none;
  display: flex;
  align-items: center;
  gap: 11px;
  border: 1px solid #dce0ec;
  padding: 9px 12px 9px 10px;
  border-radius: 12px;
  background: white;
  min-width: 238px;
  cursor: pointer;
  box-shadow: 0 2px 4px #26293603;
}
.model-picker > summary::-webkit-details-marker {
  display: none;
}
.model-picker > summary:hover,
.model-picker[open] > summary {
  background: #f8f9fd;
  border-color: #bbc5e1;
}
.model-picker > summary[aria-disabled="true"] {
  opacity: 0.5;
  cursor: wait;
}
.model-icon,
.option-icon {
  display: grid;
  place-items: center;
  width: 35px;
  height: 35px;
  flex-shrink: 0;
  border: 1px solid #d8dff7;
  border-radius: 9px;
  color: var(--blue);
  background: #f0f3ff;
  font: 500 16px var(--mono);
}
.active-model-copy {
  display: flex;
  flex: 1;
  flex-direction: column;
  line-height: 1.4;
}
.active-model-copy small {
  font-size: 11px;
  color: var(--muted);
}
.active-model-copy strong {
  font-size: 16px;
  font-weight: 600;
}
.chevron {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}
.model-picker[open] .chevron {
  transform: rotate(180deg);
}
.model-menu {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  width: 390px;
  max-width: calc(100vw - 64px);
  max-height: min(560px, 70vh);
  overflow: auto;
  background: white;
  padding: 8px;
  border: 1px solid #e0e4ee;
  border-radius: 15px;
  box-shadow:
    0 16px 50px #26293622,
    0 3px 8px #26293608;
}
.menu-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 11px 12px 14px;
  font-size: 14px;
  font-weight: 600;
  border-bottom: 1px solid var(--line);
}
.menu-heading span {
  font-size: 12px;
  font-weight: 400;
  color: var(--muted);
}
.model-group {
  padding-top: 8px;
}
.model-group + .model-group {
  border-top: 1px solid var(--line);
  margin-top: 6px;
}
.model-group-label {
  padding: 4px 12px 5px;
  margin: 0;
  text-transform: uppercase;
  color: var(--muted);
  font-size: 11px;
  letter-spacing: 0.07em;
  font-weight: 600;
}
.model-option {
  display: flex;
  width: 100%;
  align-items: flex-start;
  gap: 11px;
  padding: 12px;
  border: 0;
  border-radius: 10px;
  text-align: left;
  color: var(--ink);
  background: white;
}
.model-option:hover,
.model-option:focus-visible {
  background: #f4f6fb;
}
.model-option[aria-checked="true"] {
  background: #eef2ff;
}
.option-icon {
  height: 31px;
  width: 31px;
  font-size: 14px;
  margin-top: 3px;
}
.option-copy {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}
.option-copy strong {
  font-size: 15px;
  font-weight: 600;
}
.option-copy > span {
  font-size: 13px;
  color: var(--muted);
  line-height: 1.5;
}
.option-copy small {
  font-size: 11px;
  color: #727a8c;
}
.option-check {
  visibility: hidden;
  font-size: 17px;
  color: var(--blue);
  margin-top: 4px;
}
.model-option[aria-checked="true"] .option-check {
  visibility: visible;
}
.model-context {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 15px;
  flex-wrap: wrap;
}
.subject-chip {
  display: flex;
  gap: 8px;
  font-size: 13px;
  color: var(--muted);
  border: 1px solid var(--line);
  background: #fafbfc;
  padding: 5px 10px;
  border-radius: 7px;
}
.subject-chip strong {
  font-weight: 500;
  color: var(--ink);
}
.model-context .availability {
  margin: 0;
  font-family: inherit;
  font-size: 12px;
  color: var(--muted);
}
.model-context .availability.ready {
  color: var(--green);
}
.model-caption {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  padding: 0 27px 17px;
  color: var(--muted);
  font-size: 13px;
  border-bottom: 1px solid var(--line);
}
.model-caption > span:last-child {
  font-size: 12px;
  color: #7c8392;
  text-align: right;
}
.mode-tabs {
  padding: 23px 28px 0;
  min-height: 0;
  border-bottom: 0;
  gap: 7px;
}
.mode-tab {
  padding: 8px 15px;
  border: 1px solid transparent;
  border-radius: 9px;
  font-size: 14px;
  font-weight: 500;
}
.mode-tab:hover {
  background: #f5f6fa;
}
.mode-tab.active {
  background: #f0f3fc;
  border-color: #dce2f4;
  color: var(--blue);
}
.mode-view {
  padding: 25px 28px 28px;
}
.single-grid {
  grid-template-columns: minmax(0, 1.12fr) minmax(0, 0.88fr);
  gap: 28px;
}
.input-panel {
  padding: 6px 0;
}
.panel-heading .eyebrow {
  font-size: 11px;
  margin-bottom: 5px;
}
.panel-heading h2 {
  font-size: 20px;
  font-weight: 500;
  letter-spacing: -0.3px;
}
.counter {
  font-size: 11px;
  color: #858c9c;
}
.input-panel textarea {
  min-height: 215px;
  margin: 20px 0 16px;
  padding: 17px 18px;
  border: 1px solid #d9dfeb;
  border-radius: 13px;
  line-height: 1.8;
  box-shadow: 0 2px 4px #26293602;
}
.input-panel textarea::placeholder {
  color: #9298a7;
}
.hint {
  font-size: 13px;
  max-width: 170px;
}
.primary-button {
  background: var(--ink);
  border-color: var(--ink);
  font-size: 14px;
  font-weight: 500;
  border-radius: 10px;
  padding: 11px 18px;
}
.primary-button:hover:not(:disabled) {
  background: #3c4154;
}
.result-panel,
.bulk-result {
  background: #f7f8fc;
  border: 1px solid #e6eaf4;
  border-radius: 15px;
  padding: 25px;
  min-height: 340px;
}
.empty-state {
  text-align: center;
  align-items: center;
}
.empty-state h2 {
  font-size: 18px;
  font-weight: 500;
}
.empty-state p {
  font-size: 14px;
  line-height: 1.7;
  max-width: 260px;
}
.empty-symbol {
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  background: white;
  border: 1px solid #e0e5f0;
  border-radius: 13px;
  margin-bottom: 18px;
  color: #7c8bbd;
  font-size: 28px;
  line-height: 1;
}
.prediction-title strong {
  font-size: 29px;
  letter-spacing: -0.9px;
}
.confidence-pill {
  font-size: 12px;
  color: var(--blue);
  background: #eaf0ff;
  border-radius: 6px;
  padding: 5px 9px;
}
.probability-track {
  height: 6px;
  border-radius: 9px;
}
.probability-fill {
  background: #6b7fda;
  border-radius: 9px;
}
.result-model {
  font-size: 12px;
}
.prediction-kicker {
  font-family: inherit;
  font-size: 11px;
}
.target-select select {
  border-color: #d7deed;
  border-radius: 9px;
  padding: 9px 11px;
}
.secondary-button {
  border-color: #d1daf2;
  border-radius: 9px;
  color: var(--blue);
  font-weight: 500;
}
.secondary-button:hover {
  background: #edf2ff;
}
.field-label {
  font-size: 14px;
}
.explanation-panel {
  margin-top: 28px;
  border: 1px solid var(--line);
  border-radius: 15px;
  padding: 24px;
}
.explain-note {
  font-family: inherit;
  font-size: 12px;
}
.shap-context {
  font-size: 13px;
}
.shap-track {
  background: #f0f3f8;
  border-radius: 3px;
}
.shap-bar {
  border-radius: 2px;
}
.explain-side {
  border-color: var(--line);
}
.drop-zone {
  border-radius: 13px;
  border-color: #b7c2da;
  background: #fafbfe;
}
.upload-icon {
  border: 1px solid #e0e5f0;
  background: white;
  border-radius: 11px;
  width: 40px;
  height: 40px;
}
.drop-zone strong {
  font-size: 14px;
  font-weight: 500;
}
.upload-panel > input {
  border-color: #d9dfeb;
  border-radius: 10px;
}
.table-wrap {
  border-radius: 9px;
}
.preview-table th {
  background: #edf1f8;
}
.tiny-button {
  border-color: #d7dfee;
  border-radius: 8px;
}
.footer {
  font-size: 12px;
  color: #7b8292;
  padding: 22px 4px 28px;
}
.settings-dialog {
  border-radius: 17px;
  border-color: var(--line);
  padding: 26px;
}
.settings-dialog input {
  border-radius: 9px;
  border-color: #d9dfeb;
}
.settings-dialog::backdrop {
  background: #26293660;
}
.toast {
  background: var(--ink);
  border-radius: 12px;
  font-size: 14px;
}
@media (max-width: 980px) {
  .single-grid {
    grid-template-columns: 1fr 1fr;
    gap: 22px;
  }
  .input-footer {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
  }
  .hint {
    max-width: none;
  }
  .model-context .availability {
    display: none;
  }
  .model-context {
    gap: 8px;
  }
  .page-heading > p {
    max-width: 245px;
  }
  .bulk-grid {
    grid-template-columns: 1fr;
  }
}
@media (max-width: 700px) {
  .topbar {
    height: 74px;
    min-height: 74px;
    padding: 0 18px;
    flex-wrap: nowrap;
  }
  .brand {
    font-size: 23px;
  }
  .brand-mark {
    width: 33px;
    height: 33px;
    font-size: 26px;
  }
  .connection .status-dot,
  #connectionLabel {
    display: none;
  }
  .text-button {
    margin-left: 0;
    padding: 6px 10px;
  }
  .main {
    padding: 26px 15px 0;
  }
  .page-heading {
    margin-bottom: 23px;
  }
  .page-heading h1 {
    font-size: 29px;
    letter-spacing: -0.8px;
  }
  .workspace {
    border-radius: 16px;
  }
  .workspace-toolbar {
    padding: 16px;
    gap: 10px;
    flex-wrap: wrap;
  }
  .model-picker > summary {
    min-width: 208px;
    padding: 8px 10px;
  }
  .model-icon {
    width: 31px;
    height: 31px;
  }
  .active-model-copy strong {
    font-size: 15px;
  }
  .model-context {
    margin-left: auto;
  }
  .subject-chip {
    font-size: 12px;
    gap: 5px;
    padding: 4px 7px;
  }
  .model-menu {
    width: 360px;
    max-width: calc(100vw - 64px);
    max-height: 65vh;
  }
  .model-caption {
    padding: 0 17px 14px;
    font-size: 12px;
  }
  .model-caption > span:last-child {
    display: none;
  }
  .mode-tabs {
    padding: 18px 16px 0;
    gap: 3px;
  }
  .mode-tab {
    font-size: 13px;
    padding: 7px 11px;
  }
  .mode-view {
    padding: 22px 16px 16px;
  }
  .single-grid,
  .bulk-grid {
    grid-template-columns: 1fr;
    gap: 23px;
  }
  .input-panel textarea {
    min-height: 185px;
    font-size: 16px;
  }
  .panel-heading h2 {
    font-size: 19px;
  }
  .result-panel,
  .bulk-result {
    min-height: 250px;
    padding: 22px;
  }
  .explanation-panel {
    padding: 20px 16px;
  }
  .explain-grid {
    grid-template-columns: 1fr;
  }
  .section-heading {
    display: block;
  }
  .explain-note {
    text-align: left;
    display: block;
    max-width: none;
    margin-top: 10px;
  }
  .explain-side {
    padding: 10px 0;
    border-top: 1px solid var(--line);
    border-left: 0;
  }
  .footer {
    display: block;
  }
  .footer > span {
    display: block;
    margin-bottom: 7px;
  }
}

.portfolio-back { color: #586174; font-size: 12px; text-decoration: none; margin-right: 10px; white-space: nowrap; }
.portfolio-back:hover { color: #485ac7; }
@media(max-width: 520px) { .connection { flex-wrap: wrap; justify-content: flex-end; gap: 5px; } .portfolio-back { margin-right: 3px; } }
