:root {
  color-scheme: light;
  --ink: #0c1b36;
  --ink-soft: #334663;
  --muted: #5a6d87;
  --blue: #2563eb;
  --blue-strong: #1d4ed8;
  --cyan: #0ea5e9;
  --line: #d8e5f5;
  --line-strong: #bdd3ee;
  --glass: rgba(255, 255, 255, 0.86);
  --shadow: 0 24px 60px -32px rgba(30, 64, 175, 0.28), 0 6px 20px rgba(15, 23, 42, 0.04);
  --gradient: linear-gradient(120deg, #2563eb 0%, #0ea5e9 100%);
  --gradient-hover: linear-gradient(120deg, #1d4ed8 0%, #0284c7 100%);
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "HarmonyOS Sans SC", "Microsoft YaHei", system-ui, sans-serif;
  color: var(--ink);
}
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
body {
  margin: 0;
  min-width: 300px;
  min-height: 100vh;
  background:
    radial-gradient(1050px 540px at 50% -160px, rgba(37, 99, 235, 0.16), transparent 70%),
    radial-gradient(820px 480px at 88% 6%, rgba(14, 165, 233, 0.14), transparent 60%),
    radial-gradient(760px 480px at 6% 16%, rgba(99, 102, 241, 0.09), transparent 62%),
    linear-gradient(180deg, #eef5ff 0%, #f6faff 48%, #edf6ff 100%);
  background-attachment: fixed;
  line-height: 1.58;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--blue-strong); text-decoration: none; }
button, input, select, textarea { font: inherit; }
:focus-visible { outline: 3px solid rgba(37, 99, 235, 0.35); outline-offset: 2px; }
button, a.primary, a.ghost-btn { cursor: pointer; }
button, .pill, .primary, .ghost-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.48rem;
  padding: 0.58rem 0.95rem;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #ffffff;
  color: #1e3658;
  font-weight: 650;
  font-size: 0.88rem;
  transition: transform 0.14s, background 0.18s, border-color 0.18s, box-shadow 0.18s;
  white-space: nowrap;
}
button:hover:not(:disabled), .pill:hover, .ghost-btn:hover {
  background: #eff6ff;
  border-color: #acc9f7;
}
button:active:not(:disabled) { transform: translateY(1px); }
button:disabled { cursor: not-allowed; opacity: 0.62; }
.small-btn { padding: 0.42rem 0.72rem; font-size: 0.78rem; border-radius: 10px; }
.danger-btn:hover:not(:disabled) { background: #fef2f2; border-color: #fca5a5; color: #b91c1c; }
.primary {
  background: var(--gradient);
  color: #ffffff;
  border: 0;
  box-shadow: 0 10px 24px -10px rgba(37, 99, 235, 0.68);
  min-height: 46px;
  font-weight: 700;
}
.primary:hover:not(:disabled) {
  background: var(--gradient-hover);
  color: #ffffff;
  box-shadow: 0 12px 28px -8px rgba(29, 78, 216, 0.75);
}
.full-btn { width: 100%; margin-top: 0.65rem; min-height: 50px; font-size: 0.96rem; letter-spacing: 0.02em; }
.wrap { width: min(1080px, calc(100% - 36px)); margin-inline: auto; }
.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  background: rgba(255, 255, 255, 0.78);
  border-bottom: 1px solid rgba(219, 231, 246, 0.85);
  backdrop-filter: blur(18px) saturate(160%);
}
.bar, .brand, .section-head, .actions, .label-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}
.bar, .section-head, .label-row { justify-content: space-between; }
.bar { min-height: 68px; }
.brand { color: var(--ink); font-size: 20px; line-height: 1.05; }
.brand img { border-radius: 12px; box-shadow: 0 6px 18px -6px rgba(37, 99, 235, 0.55); }
.brand strong { font-weight: 800; letter-spacing: -0.02em; }
.brand small {
  display: block;
  font-size: 9.5px;
  font-weight: 800;
  letter-spacing: 0.24em;
  color: var(--muted);
  margin-top: 3px;
}
.brand-badge {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--blue-strong);
  background: #eff6ff;
  border: 1px solid #cde0fc;
  padding: 0.22rem 0.58rem;
  border-radius: 999px;
  margin-left: 0.2rem;
}
.pill, .tag { font-size: 0.76rem; border-radius: 999px; padding: 0.34rem 0.74rem; }
.pill i, .slots i {
  width: 8px;
  height: 8px;
  flex: none;
  border-radius: 50%;
  background: #10b981;
  box-shadow: 0 0 0 4px rgba(16, 185, 129, 0.16);
}
.pill[data-state="busy"] i { background: #2563eb; box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.18); }
.pill[data-state="limited"] i { background: #d97706; box-shadow: 0 0 0 4px rgba(217, 119, 6, 0.18); }

.hero {
  display: grid;
  grid-template-columns: 1.38fr 0.92fr;
  align-items: center;
  gap: 24px;
  padding: 44px 0 34px;
}
h1, h2, h3, p { margin: 0; }
h1 { font-size: clamp(2.15rem, 4.8vw, 3.55rem); letter-spacing: -0.045em; line-height: 1.12; font-weight: 850; }
h1 em {
  font-style: normal;
  background: linear-gradient(108deg, #1d4ed8 0%, #0ea5e9 95%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
h2 { font-size: clamp(1.2rem, 2.4vw, 1.5rem); letter-spacing: -0.02em; }
h3 { font-size: 1.02rem; }
.eyebrow, .art-label {
  font: 700 0.72rem/1.4 ui-monospace, "JetBrains Mono", Consolas, monospace;
  letter-spacing: 0.14em;
  color: #1e50a2;
  margin-bottom: 0.5rem;
}
.lede { color: var(--ink-soft); max-width: 50ch; margin-top: 0.85rem; font-size: 0.96rem; }
.chips, .slots, .steps { list-style: none; padding: 0; margin: 1.1rem 0 0; display: flex; gap: 0.55rem; flex-wrap: wrap; }
.chips li, .tag {
  background: rgba(240, 247, 255, 0.92);
  border: 1px solid #cfe2fc;
  color: #1d4b98;
  font-weight: 700;
}
.chips li { padding: 0.34rem 0.72rem; border-radius: 999px; font-size: 0.76rem; }

.art {
  min-height: 248px;
  display: grid;
  isolation: isolate;
  place-items: center;
  position: relative;
  border: 1px solid rgba(255, 255, 255, 0.95);
  border-radius: 30px;
  background:
    radial-gradient(circle at 62% 38%, rgba(255, 255, 255, 0.85), transparent 64%),
    repeating-linear-gradient(90deg, rgba(117, 158, 224, 0.09) 0 1px, transparent 1px 26px),
    repeating-linear-gradient(rgba(117, 158, 224, 0.09) 0 1px, transparent 1px 26px),
    linear-gradient(145deg, #e3efff 0%, #c6edff 100%);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.art img { z-index: 1; transform: rotate(-8deg); border-radius: 26px; box-shadow: 10px 22px 38px -14px rgba(28, 76, 174, 0.6); }
.orbit { position: absolute; width: 76%; height: 56%; border: 1px solid rgba(255, 255, 255, 0.9); border-radius: 50%; transform: rotate(-22deg); }
.orbit-inner { width: 58%; height: 42%; transform: rotate(24deg); }
.spark { position: absolute; top: 18%; right: 22%; color: #1767b5; font-size: 1.65rem; }
.art-label { position: absolute; bottom: 0.85rem; right: 1.1rem; margin: 0; font-size: 0.62rem; opacity: 0.82; }

.card {
  background: var(--glass);
  border: 1px solid rgba(255, 255, 255, 0.96);
  border-radius: 22px;
  box-shadow: var(--shadow), 0 0 0 1px rgba(191, 214, 242, 0.45);
  backdrop-filter: blur(14px);
}
.workspace, .runtime, .login { padding: clamp(18px, 3.2vw, 30px); margin-bottom: 20px; }
.tabs {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 6px;
  margin: 1.1rem 0 1.35rem;
  padding: 5px;
  background: #eaf3ff;
  border: 1px solid var(--line);
  border-radius: 15px;
}
.tabs button { border-color: transparent; background: transparent; padding: 0.64rem; }
.tabs [aria-pressed="true"] { background: #ffffff; color: #1643ad; box-shadow: 0 4px 12px -6px rgba(37, 75, 146, 0.45); }

.field-block { margin-bottom: 1.05rem; }
.label-row { margin-bottom: 7px; flex-wrap: wrap; }
.label-row label { margin: 0; font-weight: 750; font-size: 0.9rem; }
.label-tools { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
input, select, textarea {
  width: 100%;
  min-width: 0;
  padding: 0.74rem 0.88rem;
  border: 1px solid #c7d9ef;
  border-radius: 12px;
  background: #ffffff;
  color: var(--ink);
  transition: border-color 0.16s, box-shadow 0.16s;
}
textarea { font-family: ui-monospace, "JetBrains Mono", Consolas, monospace; font-size: 0.83rem; resize: vertical; }
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--blue);
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.12);
}
.input-row { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 8px; }
.field-hint { margin-top: 6px; font-size: 0.8rem; color: var(--muted); }
.field-hint[data-tone="ok"] { color: #047857; font-weight: 600; }
.field-hint[data-tone="warn"] { color: #b45309; font-weight: 600; }

.notice {
  background: #eaf3ff;
  color: #184480;
  border: 1px solid #c3dcf8;
  border-radius: 13px;
  padding: 0.78rem 1rem;
  margin: 0.85rem 0;
  font-size: 0.88rem;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.notice[data-tone="error"] { background: #fef2f2; color: #991b1b; border-color: #fecaca; }
.notice[data-tone="success"] { background: #ecfdf5; color: #065f46; border-color: #a7f3d0; }

.result {
  margin-top: 1.25rem;
  padding: clamp(14px, 2.5vw, 22px);
  background: linear-gradient(180deg, #f6faff 0%, #eff6ff 100%);
  border: 1px solid var(--line-strong);
  border-radius: 18px;
  overflow-wrap: anywhere;
}
.result[data-state="verified"] {
  background: linear-gradient(180deg, #ecfdf5 0%, #f0fdf4 100%);
  border-color: #86efac;
}
.result[data-state="failed"] {
  background: linear-gradient(180deg, #fffbeb 0%, #fef3c7 45%, #fffbeb 100%);
  border-color: #fcd34d;
}
.facts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin-top: 0.75rem; }
dt { color: var(--muted); font-size: 0.76rem; }
dd { margin: 2px 0 0; font-weight: 700; font-size: 0.88rem; }
.steps {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  margin: 1.15rem 0 0.9rem;
  text-align: center;
  font-size: 0.78rem;
  gap: 6px;
}
.steps li { color: var(--muted); font-weight: 600; }
.steps b {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  margin: 0 auto 0.35rem;
  border-radius: 50%;
  background: #e1ecfc;
  color: #274c88;
  font-size: 0.82rem;
}
.steps [aria-current="step"] { color: var(--blue-strong); font-weight: 750; }
.steps [aria-current="step"] b {
  background: var(--gradient);
  color: #ffffff;
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.18);
}
.steps .complete { color: #047857; }
.steps .complete b { background: #bbf7d0; color: #065f46; }
progress {
  appearance: none;
  width: 100%;
  height: 10px;
  border: 0;
  border-radius: 99px;
  background: #dbe8fb;
  overflow: hidden;
  margin-top: 8px;
}
progress::-webkit-progress-bar { background: #dbe8fb; }
progress::-webkit-progress-value { background: var(--gradient); border-radius: 99px; transition: width 0.35s ease; }
progress::-moz-progress-bar { background: var(--gradient); }
.status-callout {
  margin-top: 0.85rem;
  padding: 0.78rem 0.95rem;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.76);
  border: 1px solid rgba(191, 211, 238, 0.7);
  font-size: 0.88rem;
  color: var(--ink);
}
.result-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 0.9rem; }

.slots { display: grid; grid-template-columns: repeat(auto-fit, minmax(145px, 1fr)); }
.slots li {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.74rem 0.88rem;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: #f8fbff;
  font-size: 0.85rem;
  font-weight: 650;
}
.slots small { margin-left: auto; color: var(--muted); font-weight: 600; }
.slots .occupied { background: #eff6ff; border-color: #b9d5fb; }
.slots .occupied i { background: #2563eb; box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.18); }

.guide { margin-top: 26px; }
.guide-grid, .metrics, .admin-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-top: 14px;
}
.admin-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); margin-bottom: 20px; }
.guide-grid article, .metrics article { padding: 18px; }
.guide-grid p { margin-top: 6px; color: var(--muted); font-size: 0.86rem; }
.number {
  display: inline-block;
  margin-bottom: 10px;
  border-radius: 10px;
  background: #e8f1ff;
  color: #1d4ed8;
  padding: 0.26rem 0.58rem;
  font: 800 0.95rem ui-monospace, monospace;
}
footer {
  margin-top: 32px;
  padding: 20px 0 28px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.78rem;
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
}

/* Admin Specific */
.admin-hero { padding: 32px 0 22px; }
.admin-hero h1 { font-size: clamp(2rem, 4vw, 3rem); }
.login { max-width: 460px; margin: 24px auto; }
.login label { display: block; margin: 14px 0 6px; font-weight: 700; }
.login button { margin-top: 14px; width: 100%; }
.metrics { grid-template-columns: repeat(5, minmax(0, 1fr)); margin-bottom: 20px; }
.metrics span { display: block; color: var(--muted); font-size: 0.8rem; font-weight: 600; }
.metrics strong { display: block; margin-top: 4px; font-size: 1.85rem; color: #1845ad; font-variant-numeric: tabular-nums; }
.form-grid-3 { display: grid; grid-template-columns: 110px 110px minmax(0, 1fr) auto; gap: 8px; align-items: end; }
.conc-row { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0 14px; }
.conc-row button[aria-pressed="true"] {
  background: var(--gradient);
  color: #fff;
  border-color: transparent;
}
#filters { display: grid; grid-template-columns: auto minmax(0, 1fr) auto auto; gap: 8px; margin: 1rem 0; }
.table-scroll { overflow: auto; margin-top: 10px; border: 1px solid var(--line); border-radius: 14px; background: #fff; }
table { width: 100%; border-collapse: collapse; text-align: left; font-size: 0.83rem; min-width: 680px; }
th, td { padding: 0.68rem 0.78rem; border-bottom: 1px solid var(--line); overflow-wrap: anywhere; vertical-align: middle; }
th { background: #eef5ff; color: #214172; font-weight: 750; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: #f6faff; }
.mono { font-family: ui-monospace, "JetBrains Mono", Consolas, monospace; font-size: 0.8rem; }
.row-actions { display: flex; gap: 5px; flex-wrap: wrap; }
.divider { border: 0; border-top: 1px solid var(--line); margin: 18px 0; }
.tag[data-status="used"], .tag[data-status="verified"] { background: #dcfce7; color: #065f46; border-color: #86efac; }
.tag[data-status="running"] { background: #dbeafe; color: #1e40af; border-color: #93c5fd; }
.tag[data-status="failed"], .tag[data-status="disabled"] { background: #fef3c7; color: #92400e; border-color: #fcd34d; }
.spinner {
  display: none;
  width: 1em;
  height: 1em;
  border: 2px solid rgba(255, 255, 255, 0.45);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
button[aria-busy="true"] .spinner { display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }

@media (max-width: 820px) {
  .hero { grid-template-columns: 1fr; padding: 28px 0 20px; }
  .art { min-height: 170px; }
  .art img { width: 76px; height: 76px; border-radius: 20px; }
  .metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .guide-grid, .admin-grid, .form-grid-3 { grid-template-columns: 1fr; }
}
@media (max-width: 520px) {
  .wrap { width: calc(100% - 24px); }
  .input-row, #filters { grid-template-columns: 1fr; }
  .steps { font-size: 0.68rem; }
  .facts { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
