:root {
  color-scheme: light dark;
  --bg: #f5f1ea;
  --panel: rgba(255, 255, 255, 0.82);
  --panel-strong: #ffffff;
  --text: #161719;
  --muted: #68707d;
  --line: rgba(22, 23, 25, 0.12);
  --brand: #121212;
  --brand-2: #df704d;
  --good: #138a54;
  --warn: #a06700;
  --bad: #b3261e;
  --shadow: 0 24px 70px rgba(40, 32, 20, 0.16);
  --radius: 24px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #111111;
    --panel: rgba(31, 31, 31, 0.78);
    --panel-strong: #1f1f1f;
    --text: #f7f2ea;
    --muted: #a9a29a;
    --line: rgba(247, 242, 234, 0.13);
    --brand: #f7f2ea;
    --brand-2: #ff9168;
    --shadow: 0 24px 70px rgba(0, 0, 0, 0.36);
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  background:
    radial-gradient(circle at 12% 8%, rgba(223, 112, 77, 0.24), transparent 30rem),
    radial-gradient(circle at 82% 10%, rgba(45, 93, 255, 0.13), transparent 24rem),
    linear-gradient(135deg, var(--bg), color-mix(in srgb, var(--bg), #000 4%));
}

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

button { cursor: pointer; }

button:disabled { cursor: not-allowed; opacity: 0.55; }

.shell {
  width: min(1440px, calc(100% - 32px));
  margin: 0 auto;
  padding: 28px 0 48px;
}

.hero {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  align-items: flex-end;
  padding: 30px;
  border: 1px solid var(--line);
  border-radius: calc(var(--radius) + 8px);
  background: linear-gradient(145deg, var(--panel), color-mix(in srgb, var(--panel), transparent 20%));
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.hero h1, .hero h2, .card h2, .admin-header h2, .provider-editor h3 {
  margin: 0;
  letter-spacing: -0.04em;
}

.hero h1 { font-size: clamp(2.3rem, 6vw, 5.6rem); line-height: 0.92; max-width: 820px; }
.subtitle { margin: 16px 0 0; color: var(--muted); max-width: 700px; }
.eyebrow { margin: 0 0 8px; color: var(--brand-2); font-size: 0.78rem; font-weight: 800; text-transform: uppercase; letter-spacing: 0.16em; }
.hero-actions { display: flex; align-items: end; gap: 12px; flex-wrap: wrap; justify-content: flex-end; min-width: min(440px, 100%); }

.workspace {
  display: grid;
  grid-template-columns: minmax(360px, 0.92fr) minmax(420px, 1.08fr);
  gap: 20px;
  margin-top: 20px;
}

.card, .admin-shell, .request-shell {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.card { padding: 24px; min-width: 0; }
.composer-card { align-self: start; }
.section-heading { display: flex; justify-content: space-between; gap: 18px; align-items: center; margin-bottom: 20px; }
.section-heading h2, .section-heading h3 { font-size: 1.5rem; }

.field { display: grid; gap: 8px; color: var(--muted); font-size: 0.9rem; font-weight: 650; }
.field.compact { min-width: 260px; }
.field.wide { grid-column: 1 / -1; }
.field small { font-weight: 500; color: var(--muted); }
.field code { color: var(--brand-2); }

input[type="text"], input[type="password"], input[type="url"], select, textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 12px 14px;
  color: var(--text);
  background: color-mix(in srgb, var(--panel-strong), transparent 10%);
  outline: none;
}

textarea { resize: vertical; min-height: 80px; }
input:focus, select:focus, textarea:focus { border-color: var(--brand-2); box-shadow: 0 0 0 4px color-mix(in srgb, var(--brand-2), transparent 82%); }
input[type="range"] { width: 100%; accent-color: var(--brand-2); }

.button {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 11px 16px;
  color: var(--text);
  background: var(--panel-strong);
  font-weight: 750;
  transition: transform 0.18s ease, border-color 0.18s ease, background 0.18s ease;
}

.button:hover { transform: translateY(-1px); border-color: color-mix(in srgb, var(--brand-2), var(--line) 30%); }
.button.primary { color: color-mix(in srgb, var(--bg), white 76%); background: var(--brand); border-color: var(--brand); }
.button.secondary { background: color-mix(in srgb, var(--brand-2), transparent 88%); border-color: color-mix(in srgb, var(--brand-2), transparent 54%); }
.button.ghost { background: transparent; }
.button.danger { color: var(--bad); }
.actions-row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; margin-top: 20px; }
.actions-row.right { justify-content: flex-end; }

.upload-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin: 18px 0; }
.upload-box {
  display: grid;
  gap: 8px;
  min-height: 154px;
  align-content: center;
  justify-items: center;
  text-align: center;
  border: 1.5px dashed color-mix(in srgb, var(--muted), transparent 48%);
  border-radius: 20px;
  background: color-mix(in srgb, var(--panel-strong), transparent 32%);
  padding: 18px;
  cursor: pointer;
}
.upload-box input, .file-button input { display: none; }
.upload-icon { display: inline-grid; place-items: center; width: 48px; height: 48px; border-radius: 16px; color: white; background: var(--brand-2); font-size: 0.72rem; font-weight: 900; letter-spacing: 0.1em; }
.upload-box small { color: var(--muted); }

.asset-preview { display: grid; gap: 10px; }
.asset-item {
  display: grid;
  grid-template-columns: 88px 1fr auto;
  gap: 12px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 10px;
  background: color-mix(in srgb, var(--panel-strong), transparent 18%);
}
.asset-item img, .asset-item video { width: 88px; height: 62px; object-fit: cover; border-radius: 12px; background: #000; }
.asset-meta strong { display: block; word-break: break-all; }
.asset-meta small { color: var(--muted); }

.param-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 18px; }
.range-field b { color: var(--brand-2); }

.notice {
  margin-top: 16px;
  padding: 12px 14px;
  border-radius: 16px;
  border: 1px solid color-mix(in srgb, var(--brand-2), transparent 52%);
  color: var(--text);
  background: color-mix(in srgb, var(--brand-2), transparent 88%);
}
.notice.error { border-color: color-mix(in srgb, var(--bad), transparent 45%); background: color-mix(in srgb, var(--bad), transparent 88%); }
.notice.success { border-color: color-mix(in srgb, var(--good), transparent 45%); background: color-mix(in srgb, var(--good), transparent 90%); }

.task-list { display: grid; gap: 14px; }
.empty-state { border: 1px dashed var(--line); border-radius: 20px; padding: 34px; text-align: center; color: var(--muted); }
.task-card { border: 1px solid var(--line); border-radius: 20px; padding: 16px; background: color-mix(in srgb, var(--panel-strong), transparent 14%); }
.task-top { display: flex; justify-content: space-between; gap: 12px; align-items: start; }
.task-title { margin: 0; font-size: 1rem; line-height: 1.4; }
.task-meta { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; color: var(--muted); font-size: 0.84rem; }
.badge { display: inline-flex; align-items: center; border-radius: 999px; padding: 5px 10px; background: color-mix(in srgb, var(--muted), transparent 86%); color: var(--text); font-size: 0.78rem; font-weight: 800; }
.badge.pending, .badge.running { background: color-mix(in srgb, var(--warn), transparent 84%); color: var(--warn); }
.badge.succeeded { background: color-mix(in srgb, var(--good), transparent 84%); color: var(--good); }
.badge.failed { background: color-mix(in srgb, var(--bad), transparent 84%); color: var(--bad); }
.task-video { width: 100%; max-height: 420px; margin-top: 14px; border-radius: 16px; background: #050505; }
.task-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 14px; }
.details { margin-top: 12px; }
.details summary { cursor: pointer; color: var(--muted); font-weight: 750; }
.code-block { overflow: auto; max-height: 420px; padding: 14px; border-radius: 16px; border: 1px solid var(--line); background: color-mix(in srgb, var(--panel-strong), #000 8%); font-size: 0.82rem; line-height: 1.5; white-space: pre-wrap; word-break: break-word; }

dialog { border: 0; padding: 0; background: transparent; color: var(--text); width: min(1180px, calc(100% - 24px)); }
dialog::backdrop { background: rgba(0, 0, 0, 0.58); backdrop-filter: blur(4px); }
.admin-dialog { width: min(1280px, calc(100% - 20px)); }
.admin-shell, .request-shell { padding: 22px; max-height: min(900px, calc(100vh - 28px)); overflow: auto; }
.admin-header { display: flex; justify-content: space-between; gap: 18px; align-items: start; margin-bottom: 18px; }
.admin-header p:not(.eyebrow) { margin: 8px 0 0; color: var(--muted); }
.admin-layout { display: grid; grid-template-columns: 280px 1fr; gap: 18px; }
.provider-list-panel { display: grid; align-content: start; gap: 14px; }
.admin-toolbar { display: flex; gap: 8px; flex-wrap: wrap; }
.admin-toolbar.stacked { display: grid; }
.file-button { text-align: center; }
.provider-list { display: grid; gap: 8px; max-height: 560px; overflow: auto; }
.provider-list button { text-align: left; border-radius: 16px; padding: 12px; background: color-mix(in srgb, var(--panel-strong), transparent 14%); }
.provider-list button.active { border-color: var(--brand-2); background: color-mix(in srgb, var(--brand-2), transparent 86%); }
.provider-list small { display: block; color: var(--muted); margin-top: 4px; word-break: break-all; }
.provider-editor { min-width: 0; }
.editor-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.editor-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.check-field { display: flex; align-items: center; gap: 10px; color: var(--muted); font-weight: 750; margin-top: 28px; }
.check-field input { width: 18px; height: 18px; accent-color: var(--brand-2); }

@media (max-width: 980px) {
  .hero, .section-heading, .admin-header { align-items: stretch; flex-direction: column; }
  .hero-actions { justify-content: stretch; }
  .workspace, .admin-layout { grid-template-columns: 1fr; }
  .field.compact { min-width: 0; }
}

@media (max-width: 640px) {
  .shell { width: min(100% - 18px, 1440px); padding-top: 9px; }
  .hero, .card, .admin-shell, .request-shell { padding: 16px; border-radius: 20px; }
  .upload-grid, .param-grid, .editor-grid { grid-template-columns: 1fr; }
  .asset-item { grid-template-columns: 72px 1fr; }
  .asset-item button { grid-column: 1 / -1; }
  .asset-item img, .asset-item video { width: 72px; height: 54px; }
}
