:root,
:root[data-theme="dark"] {
  color-scheme: dark;
  --page: #071411;
  --ink: #effff7;
  --muted: #9bb4a9;
  --soft: #0d2119;
  --surface: rgba(13, 32, 26, .88);
  --surface-strong: #10271e;
  --line: rgba(169, 245, 204, .16);
  --green: #5ee6a5;
  --green-deep: #35c98a;
  --dark: #05110d;
  --white: #f6fff9;
  --purple: #b789ff;
  --shadow: 0 28px 70px rgba(0, 0, 0, .28);
  --danger-surface: #381f1c;
  --danger-text: #ffc5ba;
  --table-head: rgba(21, 55, 42, .78);
  --upload-surface: rgba(18, 46, 35, .52);
  --upload-hover: rgba(32, 83, 59, .6);
  --upload-file: rgba(21, 69, 48, .65);
  --glow-green: rgba(44, 190, 125, .18);
  --glow-purple: rgba(139, 92, 246, .12);
}

:root[data-theme="light"] {
  color-scheme: light;
  --page: #f1f8f4;
  --ink: #0b211b;
  --muted: #60776d;
  --soft: #fbfdfc;
  --surface: rgba(255, 255, 255, .9);
  --surface-strong: #ffffff;
  --line: rgba(20, 65, 49, .15);
  --green: #28bc7d;
  --green-deep: #0b8c5d;
  --dark: #071d17;
  --white: #fcfffd;
  --purple: #8355d9;
  --shadow: 0 22px 55px rgba(17, 63, 45, .1);
  --danger-surface: #fff1ed;
  --danger-text: #9c3f31;
  --table-head: rgba(239, 248, 242, .95);
  --upload-surface: rgba(255, 255, 255, .72);
  --upload-hover: rgba(229, 249, 237, .96);
  --upload-file: rgba(235, 251, 241, .95);
  --glow-green: rgba(77, 190, 136, .12);
  --glow-purple: rgba(139, 92, 246, .07);
}

* { box-sizing: border-box; }
html { min-width: 320px; background: var(--page); }
body {
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 8% 3%, var(--glow-green), transparent 29rem),
    radial-gradient(circle at 92% 19%, var(--glow-purple), transparent 25rem),
    linear-gradient(155deg, var(--page) 0%, var(--soft) 100%);
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  transition: background .25s ease, color .25s ease;
}

[hidden] { display: none !important; }
.shell { width: min(1160px, calc(100% - 48px)); margin: 0 auto; }
.ambient { position: fixed; pointer-events: none; filter: blur(1px); z-index: -1; border-radius: 999px; }
.ambient-one { width: 280px; height: 280px; top: 45%; right: -100px; background: rgba(77, 214, 145, .09); }
.ambient-two { width: 180px; height: 180px; bottom: 10%; left: -70px; background: rgba(126, 113, 235, .1); }

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 0 16px;
  border-bottom: 1px solid var(--line);
}
.brand { display: inline-flex; align-items: center; gap: 9px; color: var(--ink); text-decoration: none; font-size: 18px; font-weight: 750; letter-spacing: -.04em; }
.brand-logo { display: block; width: 36px; height: 36px; object-fit: contain; }
.topbar-actions { display: inline-flex; align-items: center; gap: 9px; }
.owner-password-field { display: inline-flex; }
.owner-password-field input {
  width: 118px;
  height: 36px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--ink);
  background: var(--surface);
  font: inherit;
  font-size: 11px;
  outline: none;
  transition: border-color .2s, box-shadow .2s, background .2s;
}
.owner-password-field input::placeholder { color: var(--muted); opacity: .8; }
.owner-password-field input:focus { border-color: var(--green); box-shadow: 0 0 0 3px rgba(40, 188, 125, .13); }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  background: var(--surface);
  cursor: pointer;
  font: inherit;
  font-size: 11px;
  font-weight: 750;
  transition: border-color .2s, color .2s, background .2s, transform .2s;
}
.theme-toggle:hover { border-color: rgba(94, 230, 165, .55); color: var(--ink); transform: translateY(-1px); }
.theme-icon { color: var(--green); font-size: 16px; line-height: 1; }

.page { padding: 34px 0 30px; }
.workspace-grid { display: grid; grid-template-columns: minmax(0, 1fr) 34px minmax(0, 1fr); gap: 28px; align-items: stretch; margin-top: 0; }
.panel {
  border: 1px solid var(--line);
  border-radius: 26px;
  background: var(--surface);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}
.input-panel { padding: 16px 0 0; }
.predictions-panel {
  display: flex;
  min-height: 590px;
  flex-direction: column;
  padding: 30px;
  color: var(--white);
  background: linear-gradient(145deg, rgba(9, 38, 28, .98), rgba(12, 26, 25, .98));
  box-shadow: 0 28px 70px rgba(4, 42, 27, .24);
}
.panel-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 15px; }
.animated-divider { position: relative; display: flex; min-height: 100%; align-items: stretch; justify-content: center; }
.animated-divider::before { width: 1px; content: ""; background: linear-gradient(180deg, transparent, var(--green), var(--purple), transparent); opacity: .65; }
.animated-divider::after { position: absolute; top: 11%; width: 7px; height: 7px; border-radius: 50%; content: ""; background: var(--green); box-shadow: 0 0 0 5px rgba(94, 230, 165, .12), 0 0 20px rgba(94, 230, 165, .75); animation: divider-flow 3.2s ease-in-out infinite; }
@keyframes divider-flow { 0%, 100% { opacity: .35; transform: translateY(-12px); } 50% { opacity: 1; transform: translateY(320px); } }
h1 { margin: 0; color: var(--ink); font-size: clamp(34px, 5vw, 52px); line-height: 1; letter-spacing: -.07em; font-weight: 760; }
h2 { margin: 0; font-size: 20px; line-height: 1.2; letter-spacing: -.045em; }
.predictions-panel h2 { color: #f2fff8; }
.prediction-meta { max-width: 260px; margin: 7px 0 0; color: #94b1a3; font-size: 11px; line-height: 1.45; }
.prediction-actions { display: flex; flex-direction: column; align-items: flex-end; gap: 12px; }

.upload-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 24px; }
.upload-card {
  display: flex;
  min-height: 112px;
  flex-direction: column;
  justify-content: center;
  padding: 14px;
  border: 1px dashed var(--line);
  border-radius: 17px;
  background: var(--upload-surface);
  cursor: pointer;
  transition: border-color .2s, background .2s, transform .2s;
}
.upload-card:hover, .upload-card.dragging { border-color: var(--green); background: var(--upload-hover); transform: translateY(-2px); }
.upload-card.has-file { border-style: solid; border-color: rgba(94, 230, 165, .46); background: var(--upload-file); }
.upload-card input { display: none; }
.upload-icon { display: inline-flex; width: 24px; height: 24px; align-items: center; justify-content: center; margin-bottom: 8px; border-radius: 8px; color: var(--green); background: rgba(94, 230, 165, .12); font-size: 15px; font-weight: 750; }
.upload-title { color: var(--ink); font-size: 13px; font-weight: 750; letter-spacing: -.02em; }
.upload-subtitle, .file-state { color: var(--muted); font-size: 11px; }
.upload-subtitle { margin-top: 4px; }
.file-state { overflow: hidden; margin-top: 12px; text-overflow: ellipsis; white-space: nowrap; }
.has-file .file-state { color: var(--green); font-weight: 700; }

.run-row { display: grid; grid-template-columns: minmax(180px, .7fr) minmax(0, 1.3fr); gap: 12px; align-items: end; margin-top: 22px; }
.field-group label { display: block; margin: 0 0 8px 2px; color: var(--muted); font-size: 11px; font-weight: 750; letter-spacing: .04em; text-transform: uppercase; }
select { width: 100%; height: 46px; padding: 0 13px; border: 1px solid var(--line); border-radius: 12px; color: var(--ink); background: var(--surface-strong); font: inherit; font-size: 13px; outline: none; }
select:focus { border-color: var(--green); box-shadow: 0 0 0 3px rgba(94, 230, 165, .12); }
select:disabled { cursor: not-allowed; opacity: .58; }
.field-hint { display: block; margin: 7px 2px 0; color: var(--muted); font-size: 10px; }
.data-summary { display: flex; gap: 24px; margin: 24px 0 0; padding: 13px 0 0; border-top: 1px solid var(--line); }
.data-summary div { display: flex; flex-direction: column; gap: 4px; }
.data-summary strong { color: var(--green); font-size: 16px; letter-spacing: -.04em; }
.data-summary span { color: var(--muted); font-size: 10px; }
.notice { display: flex; align-items: flex-start; gap: 8px; margin-top: 18px; padding: 11px 12px; border-radius: 11px; color: var(--danger-text); background: var(--danger-surface); font-size: 12px; line-height: 1.4; }
.notice-icon { display: inline-flex; width: 17px; height: 17px; flex: 0 0 auto; align-items: center; justify-content: center; border-radius: 50%; color: white; background: #e37361; font-size: 11px; font-weight: 800; }
.primary-button { display: flex; width: 100%; height: 53px; align-items: center; justify-content: space-between; margin-top: 23px; padding: 0 18px 0 20px; border: 0; border-radius: 13px; color: #05110d; background: var(--green); cursor: pointer; font: inherit; font-size: 13px; font-weight: 800; transition: transform .2s, background .2s, box-shadow .2s; }
.run-row .primary-button { margin-top: 0; }
.primary-button:hover:not(:disabled) { background: #82f4bb; box-shadow: 0 10px 26px rgba(28, 203, 133, .2); transform: translateY(-1px); }
.primary-button:disabled { cursor: not-allowed; opacity: .42; }
.button-arrow { color: #075b3c; font-size: 21px; font-weight: 400; }
.microcopy { margin: 12px 0 0; color: var(--muted); font-size: 10px; text-align: center; }

.status-badge { padding: 6px 9px; border-radius: 99px; font-size: 10px; font-weight: 750; }
.status-badge.idle { color: #86a69a; background: rgba(133, 182, 162, .11); }
.status-badge.working { color: #a9f5ca; background: rgba(60, 210, 140, .15); }
.status-badge.done { color: #0b5d3f; background: #b8f0ce; }
.status-badge.error { color: #ffc2b8; background: rgba(220, 94, 77, .2); }
.status-empty { display: flex; flex: 1; flex-direction: column; align-items: center; justify-content: center; min-height: 300px; color: #87a59a; font-size: 12px; line-height: 1.55; text-align: center; }
.pulse-orb { display: flex; width: 73px; height: 73px; align-items: center; justify-content: center; margin-bottom: 22px; border: 1px solid rgba(97, 229, 161, .34); border-radius: 50%; background: radial-gradient(circle, rgba(55, 202, 131, .26), transparent 65%); }
.pulse-orb span { width: 18px; height: 18px; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 9px rgba(40,188,125,.1), 0 0 28px rgba(40,188,125,.65); animation: breathe 2.4s ease-in-out infinite; }
@keyframes breathe { 0%,100% { transform: scale(.8); opacity: .7; } 50% { transform: scale(1.05); opacity: 1; } }
.prediction-content { display: flex; min-height: 0; flex: 1; flex-direction: column; }
.status-active { flex: 1; padding-top: 42px; }
.progress-meta { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; color: #b2c8bd; font-size: 11px; line-height: 1.4; }
.progress-meta strong { color: var(--green); font-size: 13px; }
.progress-track { height: 5px; margin-top: 13px; overflow: hidden; border-radius: 9px; background: rgba(255,255,255,.1); }
.progress-track span { display: block; width: 0; height: 100%; border-radius: inherit; background: linear-gradient(90deg, #1da86e, #70ecae); transition: width .45s ease; }
.step-list { display: grid; gap: 18px; margin-top: 39px; }
.step { display: flex; align-items: center; gap: 11px; color: #67877b; font-size: 11px; transition: color .3s; }
.step span { width: 8px; height: 8px; border: 1px solid #53776a; border-radius: 50%; transition: background .3s, border-color .3s, box-shadow .3s; }
.step.active, .step.complete { color: #d6f8e4; }
.step.active span, .step.complete span { border-color: var(--green); background: var(--green); box-shadow: 0 0 0 4px rgba(40,188,125,.12); }
.step.complete span { box-shadow: none; }
.queue-note { min-height: 18px; margin-top: 29px; color: #7e9b90; font-size: 10px; }
.prediction-table-wrap { min-height: 0; flex: 1; margin-top: 26px; overflow: hidden; }
.prediction-table-scroll { max-height: 465px; overflow: auto; border-top: 1px solid rgba(255,255,255,.1); border-bottom: 1px solid rgba(255,255,255,.1); }
.download-button { display: inline-flex; align-items: center; justify-content: space-between; gap: 12px; padding: 9px 11px; border-radius: 10px; color: #083b2a; background: #c8f7d8; text-decoration: none; font-size: 10px; font-weight: 800; transition: background .2s, transform .2s; }
.download-button:hover { background: #e0ffe9; transform: translateY(-1px); }
.download-button span { color: #0a7550; font-size: 17px; }

table { width: 100%; min-width: 620px; border-collapse: collapse; font-size: 11px; }
th { position: sticky; top: 0; padding: 13px 15px; color: #b8d9c7; border-bottom: 1px solid rgba(255,255,255,.12); background: #123326; font-size: 10px; font-weight: 800; letter-spacing: .06em; text-align: left; text-transform: uppercase; white-space: nowrap; }
td { max-width: 230px; overflow: hidden; padding: 13px 15px; border-bottom: 1px solid rgba(255,255,255,.08); color: #c0d6ca; text-overflow: ellipsis; white-space: nowrap; }
tr:last-child td { border-bottom: 0; }
.footer { display: flex; justify-content: space-between; gap: 15px; padding: 45px 0 20px; color: var(--muted); font-size: 10px; letter-spacing: .04em; text-transform: uppercase; }

@media (max-width: 760px) {
  .shell { width: min(100% - 28px, 560px); }
  .topbar { padding-top: 16px; }
  .page { padding-top: 24px; }
  .workspace-grid { grid-template-columns: 1fr; gap: 26px; }
  .animated-divider { display: none; }
  .predictions-panel { min-height: 460px; }
  .status-active { padding-top: 42px; }
  .input-panel { padding: 12px 0 0; }
  .predictions-panel { padding: 22px; border-radius: 21px; }
  .footer { align-items: flex-start; flex-direction: column; }
}

@media (max-width: 470px) {
  .owner-password-field input { width: 98px; }
  .upload-grid, .run-row { grid-template-columns: 1fr; }
  .upload-card { min-height: 104px; }
  .run-row .primary-button { margin-top: 4px; }
  .data-summary { justify-content: space-between; gap: 8px; }
  h1 { font-size: 38px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
