:root {
  color-scheme: light;
  --paper: #f4f1ea;
  --surface: #fbfaf7;
  --ink: #1f2725;
  --muted: #68716d;
  --line: #d6d4cc;
  --deep: #173f3b;
  --teal: #24766d;
  --coral: #bd5d45;
  --amber: #b48531;
  --green: #2f7454;
  --shadow: 0 18px 50px rgba(31, 39, 37, 0.12);
  font-family: Inter, "Noto Sans SC", "Microsoft YaHei", system-ui, sans-serif;
  font-synthesis: none;
}

* { box-sizing: border-box; letter-spacing: 0; }
[hidden] { display: none !important; }
body { margin: 0; min-height: 100vh; background: var(--paper); color: var(--ink); }
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    linear-gradient(105deg, transparent 0 60%, rgba(36, 118, 109, 0.055) 60% 61%, transparent 61%),
    repeating-linear-gradient(0deg, transparent 0 45px, rgba(31, 39, 37, 0.025) 45px 46px);
}

.topbar {
  height: 64px;
  padding: 0 clamp(18px, 4vw, 64px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
  background: rgba(244, 241, 234, 0.94);
  backdrop-filter: blur(12px);
  position: sticky;
  top: 0;
  z-index: 10;
}
.brand { color: var(--deep); text-decoration: none; font-weight: 800; font-size: 18px; }
.brand span { color: var(--coral); font-weight: 600; }
.account { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: 13px; }
.avatar { width: 30px; height: 30px; border-radius: 50%; object-fit: cover; background: var(--line); }

main { width: min(1180px, calc(100% - 36px)); margin: 0 auto; padding: 38px 0 72px; }
h1, h2, p { margin-top: 0; }
h1 { font-family: Georgia, "Noto Serif SC", serif; font-size: 34px; line-height: 1.12; margin-bottom: 12px; }
h2 { font-size: 18px; margin-bottom: 18px; }
.eyebrow { color: var(--teal); font-size: 11px; font-weight: 800; margin-bottom: 8px; }
.lede, .muted { color: var(--muted); }
.lede { font-size: 17px; margin-bottom: 32px; }

.button, .quiet-button {
  border: 0;
  border-radius: 5px;
  min-height: 42px;
  padding: 0 18px;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.button:disabled { opacity: 0.55; cursor: wait; }
.primary { background: var(--deep); color: white; }
.primary:hover { background: #20564f; }
.secondary { background: transparent; color: var(--deep); box-shadow: inset 0 0 0 1px var(--deep); }
.secondary:hover { background: rgba(23, 63, 59, 0.07); }
.quiet-button { background: transparent; color: var(--teal); padding: 0 8px; min-height: 34px; }

.announcements { border-left: 3px solid var(--amber); padding: 12px 16px; margin-bottom: 28px; background: rgba(180, 133, 49, 0.08); }
.announcement { margin: 0; line-height: 1.6; }
.announcement + .announcement { margin-top: 8px; padding-top: 8px; border-top: 1px solid rgba(180, 133, 49, 0.25); }
.center-state { min-height: 50vh; display: grid; place-content: center; justify-items: center; color: var(--muted); }
.spinner { width: 26px; height: 26px; border: 2px solid var(--line); border-top-color: var(--teal); border-radius: 50%; animation: spin .8s linear infinite; margin-bottom: 12px; }
@keyframes spin { to { transform: rotate(360deg); } }

.guest { min-height: 66vh; display: grid; grid-template-columns: 1fr minmax(320px, 420px); gap: 80px; align-items: center; }
.guest h1 { font-size: clamp(42px, 7vw, 84px); max-width: 650px; }
.query-panel, .lookup { border-left: 1px solid var(--line); padding-left: 34px; }
label { display: grid; gap: 7px; font-size: 12px; font-weight: 700; color: var(--muted); }
input, select {
  width: 100%;
  height: 43px;
  border: 1px solid var(--line);
  border-radius: 5px;
  padding: 0 12px;
  color: var(--ink);
  background: var(--surface);
  font: inherit;
}
input:focus, select:focus { outline: 2px solid rgba(36, 118, 109, 0.25); border-color: var(--teal); }
form label + label { margin-top: 14px; }
form .button { margin-top: 18px; }
.form-error { min-height: 20px; margin: 12px 0 0; color: var(--coral); font-size: 13px; }

.activation { max-width: 680px; margin: 14vh auto 0; }
.inline-form { display: grid; grid-template-columns: 1fr auto; gap: 10px; }
.inline-form .button { margin: 0; }

.status-strip { display: grid; grid-template-columns: repeat(4, 1fr) minmax(240px, 1.6fr); border: 1px solid var(--line); background: rgba(251, 250, 247, 0.6); }
.status-strip > div { min-width: 0; padding: 13px 16px; border-right: 1px solid var(--line); }
.status-strip > div:last-child { border-right: 0; }
.status-strip span { display: block; color: var(--muted); font-size: 11px; margin-bottom: 4px; }
.status-strip strong { display: block; font-size: 18px; font-variant-numeric: tabular-nums; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.model-cell strong { font-size: 13px; line-height: 22px; }

.workspace { display: grid; grid-template-columns: minmax(0, 1fr) 330px; gap: 46px; padding: 46px 0; border-bottom: 1px solid var(--line); }
.section-heading { display: flex; align-items: end; justify-content: space-between; gap: 18px; }
.submission h1 { font-size: 30px; }
.upload-zone { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 12px; align-items: stretch; }
.upload-zone input[type=file] { position: absolute; opacity: 0; pointer-events: none; }
.upload-zone label { border: 1px dashed #9ca49f; min-height: 82px; padding: 16px; justify-content: center; cursor: pointer; }
.upload-zone label strong { color: var(--ink); font-size: 15px; }
.upload-zone label span { font-weight: 400; }
.upload-zone .button { margin: 0; min-width: 128px; }
.chart-picker { margin-top: 24px; padding-top: 22px; border-top: 1px solid var(--line); display: grid; grid-template-columns: 1fr minmax(260px, 360px); gap: 24px; align-items: end; }
.chart-picker form { display: grid; grid-template-columns: 1fr auto; gap: 10px; align-items: end; }
.chart-picker .button { margin: 0; }
.lookup form .button { width: 100%; }

.task-section { padding-top: 36px; }
.task-list { border-top: 1px solid var(--line); }
.task-row { display: grid; grid-template-columns: minmax(0, 1fr) 120px 150px 90px; gap: 16px; align-items: center; min-height: 72px; border-bottom: 1px solid var(--line); }
.task-title { min-width: 0; }
.task-title strong { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.task-title span, .task-time { color: var(--muted); font-size: 12px; }
.prediction { font-family: Georgia, serif; font-size: 23px; color: var(--deep); font-variant-numeric: tabular-nums; }
.status { font-size: 11px; font-weight: 800; color: var(--muted); }
.status.SUCCEEDED { color: var(--green); }
.status.FAILED, .status.CANCELLED, .status.EXPIRED { color: var(--coral); }
.task-open { justify-self: end; }
.empty { color: var(--muted); padding: 34px 0; }
.history-more { margin-top: 20px; }

dialog { width: min(520px, calc(100% - 28px)); border: 0; border-radius: 7px; padding: 30px; color: var(--ink); background: var(--surface); box-shadow: var(--shadow); }
dialog::backdrop { background: rgba(24, 31, 29, 0.52); backdrop-filter: blur(3px); }
.dialog-close { position: absolute; top: 12px; right: 14px; border: 0; background: transparent; font-size: 26px; color: var(--muted); cursor: pointer; }
.result-value { font-family: Georgia, serif; font-size: 66px; color: var(--deep); margin: 22px 0; font-variant-numeric: tabular-nums; }
.result-meta { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; border-top: 1px solid var(--line); padding-top: 18px; }
.result-meta span { display: block; color: var(--muted); font-size: 11px; }
.result-meta strong { display: block; margin-top: 5px; font-size: 13px; overflow-wrap: anywhere; }
.credentials { border-top: 1px solid var(--line); }
.credentials div { padding: 14px 0; border-bottom: 1px solid var(--line); }
.credentials dt { color: var(--muted); font-size: 11px; }
.credentials dd { margin: 5px 0 0; font-family: ui-monospace, Consolas, monospace; font-size: 16px; overflow-wrap: anywhere; }
#credentials-dialog .button + .button { margin-left: 8px; }

@media (max-width: 820px) {
  main { width: min(100% - 24px, 680px); padding-top: 24px; }
  .guest { grid-template-columns: 1fr; gap: 46px; align-content: center; }
  .query-panel, .lookup { border-left: 0; border-top: 1px solid var(--line); padding: 28px 0 0; }
  .status-strip { grid-template-columns: 1fr 1fr; }
  .status-strip > div { border-bottom: 1px solid var(--line); }
  .status-strip > div:nth-child(2n) { border-right: 0; }
  .status-strip > div:last-child { grid-column: 1 / -1; border-bottom: 0; }
  .workspace { grid-template-columns: 1fr; gap: 34px; }
  .chart-picker { grid-template-columns: 1fr; }
  .task-row { grid-template-columns: minmax(0, 1fr) 80px 70px; padding: 12px 0; }
  .task-time { display: none; }
}

@media (max-width: 520px) {
  .topbar { padding: 0 14px; }
  .account span { display: none; }
  .guest h1 { font-size: 44px; }
  .upload-zone, .chart-picker form, .inline-form { grid-template-columns: 1fr; }
  .upload-zone .button, .chart-picker .button { width: 100%; }
  .task-row { grid-template-columns: minmax(0, 1fr) 66px; }
  .task-row .status { grid-row: 2; }
  .task-open { grid-column: 2; grid-row: 1 / span 2; }
}
