:root {
  --bg: #eef3f8;
  --ink: #0a0d14;
  --muted: #5f6876;
  --line: rgba(10, 13, 20, 0.12);
  --glass: rgba(255, 255, 255, 0.62);
  --glass-strong: rgba(255, 255, 255, 0.82);
  --blue: #0a66ff;
  --teal: #009f8f;
  --warm: #e2552d;
  --bad: #d04a35;
  --warn: #b87513;
  --ok-soft: rgba(0, 159, 143, 0.12);
  --bad-soft: rgba(208, 74, 53, 0.12);
  --warn-soft: rgba(184, 117, 19, 0.13);
  --shadow: 0 24px 58px rgba(15, 23, 42, 0.12);
  --shadow-soft: 0 14px 34px rgba(15, 23, 42, 0.08);
  --inner-light: inset 0 1px 0 rgba(255, 255, 255, 0.78);
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  overflow-x: clip;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background-color: var(--bg);
  background-image:
    linear-gradient(rgba(15, 23, 42, 0.024) 1px, transparent 1px),
    linear-gradient(90deg, rgba(15, 23, 42, 0.024) 1px, transparent 1px),
    linear-gradient(140deg, rgba(10, 102, 255, 0.06), transparent 32rem),
    linear-gradient(180deg, #f9fbfd 0, #ffffff 34rem, #eef3f8 100%);
  background-size: 52px 52px, 52px 52px, auto, auto;
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

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

button,
input,
select,
textarea {
  border: 1px solid var(--line);
  border-radius: 8px;
}

button {
  min-height: 34px;
  padding: 0 12px;
  background: rgba(255, 255, 255, 0.74);
  color: var(--ink);
  font-weight: 760;
  cursor: pointer;
  transition:
    transform 180ms var(--ease),
    background 180ms var(--ease),
    border-color 180ms var(--ease),
    opacity 180ms var(--ease);
}

button:hover {
  transform: translateY(-1px);
  border-color: rgba(10, 102, 255, 0.24);
  background: rgba(10, 102, 255, 0.08);
}

button:disabled {
  cursor: wait;
  opacity: 0.55;
}

button[data-loading="true"]::before {
  content: "";
  display: inline-block;
  width: 12px;
  height: 12px;
  margin-right: 7px;
  vertical-align: -2px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: spin 720ms linear infinite;
}

button.primary {
  border-color: rgba(10, 102, 255, 0.18);
  background: var(--blue);
  color: #fff;
  box-shadow: 0 12px 24px rgba(10, 102, 255, 0.18);
}

button.danger {
  border-color: rgba(208, 74, 53, 0.22);
  background: rgba(208, 74, 53, 0.10);
  color: #9d2f20;
}

button.ghost {
  color: var(--muted);
}

input,
select,
textarea {
  min-height: 36px;
  width: 100%;
  min-width: 0;
  padding: 0 10px;
  background: rgba(255, 255, 255, 0.78);
  color: var(--ink);
}

textarea {
  min-height: 132px;
  padding: 10px;
  resize: vertical;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  font-size: 12px;
  line-height: 1.5;
}

input:focus,
select:focus,
textarea:focus,
button:focus-visible {
  outline: none;
  border-color: rgba(10, 102, 255, 0.48);
  box-shadow: 0 0 0 4px rgba(10, 102, 255, 0.1);
}

h1,
h2,
h3,
p {
  margin: 0;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 62px;
  padding: 9px clamp(18px, 3vw, 36px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.72);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.76), rgba(255, 255, 255, 0.46)),
    rgba(255, 255, 255, 0.45);
  box-shadow: var(--inner-light), 0 18px 46px rgba(15, 23, 42, 0.10);
  backdrop-filter: blur(34px) saturate(1.72);
  -webkit-backdrop-filter: blur(34px) saturate(1.72);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.brand-logo {
  width: 108px;
  max-height: 38px;
  object-fit: contain;
}

.brand-copy {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 3px;
}

.brand-copy h1 {
  font-size: 15px;
  letter-spacing: 0;
}

#subtitle,
.last-updated,
.view-tab span,
.metric span,
.card-subtitle,
.list-row span,
.form-row span,
.pill,
.hint,
.mono-small {
  color: var(--muted);
  font-size: 11px;
}

.top-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  min-width: 0;
}

.shell {
  width: min(1420px, calc(100vw - 28px));
  margin: 0 auto;
  padding: 18px 0 48px;
}

.view-switcher {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 16px;
  padding: 6px;
  border: 1px solid rgba(255, 255, 255, 0.70);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.42);
  box-shadow: var(--inner-light), var(--shadow-soft);
  backdrop-filter: blur(22px);
}

.view-tab {
  display: flex;
  min-width: 0;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  padding: 9px 11px;
  background: transparent;
  text-align: left;
}

.view-tab.active {
  background: var(--glass-strong);
  border-color: rgba(10, 102, 255, 0.22);
  box-shadow: var(--shadow-soft);
}

.view-tab b {
  font-size: 13px;
}

.notice {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-bottom: 12px;
  padding: 12px 14px;
  border: 1px solid rgba(10, 102, 255, 0.18);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.72);
  box-shadow: var(--inner-light), var(--shadow-soft);
  color: #243044;
  font-size: 13px;
}

.notice[data-tone="bad"] {
  border-color: rgba(208, 74, 53, 0.24);
  background: rgba(255, 247, 245, 0.88);
  color: #9d2f20;
}

.notice[data-busy="true"]::before {
  content: "";
  flex: 0 0 auto;
  width: 14px;
  height: 14px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: spin 720ms linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.dashboard {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: 14px;
}

.panel-card {
  min-width: 0;
  min-height: 168px;
  padding: 14px;
  border: 1px solid rgba(255, 255, 255, 0.72);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.78), rgba(255, 255, 255, 0.54)),
    var(--glass);
  box-shadow: var(--inner-light), var(--shadow-soft);
  backdrop-filter: blur(24px) saturate(1.25);
  -webkit-backdrop-filter: blur(24px) saturate(1.25);
}

.span-3 { grid-column: span 3; }
.span-4 { grid-column: span 4; }
.span-5 { grid-column: span 5; }
.span-6 { grid-column: span 6; }
.span-7 { grid-column: span 7; }
.span-8 { grid-column: span 8; }
.span-12 { grid-column: span 12; }

.card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.card-title {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}

.card-title h2 {
  font-size: 15px;
  letter-spacing: 0;
}

.card-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.hero {
  display: grid;
  min-height: 178px;
  grid-template-columns: minmax(0, 1.3fr) minmax(260px, 0.7fr);
  gap: 14px;
  align-items: stretch;
}

.hero-main {
  display: flex;
  min-width: 0;
  flex-direction: column;
  justify-content: space-between;
  gap: 16px;
}

.hero-main strong {
  font-size: clamp(34px, 5vw, 58px);
  line-height: 0.95;
  letter-spacing: 0;
}

.hero-line {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.status-pill,
.pill {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 0 9px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.62);
  font-weight: 760;
}

.status-pill.ok {
  border-color: rgba(0, 159, 143, 0.22);
  background: var(--ok-soft);
  color: #087365;
}

.status-pill.bad {
  border-color: rgba(208, 74, 53, 0.24);
  background: var(--bad-soft);
  color: #9d2f20;
}

.status-pill.warn {
  border-color: rgba(184, 117, 19, 0.25);
  background: var(--warn-soft);
  color: #8a570d;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.metric {
  display: flex;
  min-width: 0;
  flex-direction: column;
  justify-content: center;
  gap: 4px;
  min-height: 70px;
  padding: 11px;
  border: 1px solid rgba(10, 13, 20, 0.08);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.48);
}

.metric b {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 20px;
}

.metric small {
  color: var(--muted);
  font-size: 11px;
}

.list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.list-row {
  display: grid;
  grid-template-columns: minmax(110px, 0.45fr) minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  min-height: 38px;
  padding: 8px 10px;
  border: 1px solid rgba(10, 13, 20, 0.08);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.46);
}

.list-row b,
.list-row code {
  min-width: 0;
  overflow-wrap: anywhere;
}

.guide-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.guide-box {
  min-width: 0;
  padding: 12px;
  border: 1px solid rgba(10, 13, 20, 0.08);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.46);
}

.guide-box h3 {
  margin: 0 0 8px;
  font-size: 13px;
  letter-spacing: 0;
}

.guide-steps {
  margin: 0;
  padding-left: 18px;
  color: #243044;
  font-size: 12px;
  line-height: 1.65;
}

.guide-steps li {
  padding-left: 2px;
}

.guide-note {
  margin-top: 10px;
  color: var(--warn);
  font-size: 12px;
  font-weight: 720;
}

code,
.mono,
.mono-small {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.form-row {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 5px;
}

.form-row.full {
  grid-column: 1 / -1;
}

.switch-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 40px;
  padding: 8px 10px;
  border: 1px solid rgba(10, 13, 20, 0.08);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.46);
}

.switch-row input {
  width: 18px;
  min-height: 18px;
}

.job-log {
  height: 240px;
  padding: 10px;
  overflow: auto;
  border: 1px solid rgba(10, 13, 20, 0.10);
  border-radius: 8px;
  background: rgba(10, 13, 20, 0.82);
  color: #e6edf7;
  font-size: 12px;
  line-height: 1.55;
  white-space: pre-wrap;
}

.progress {
  position: relative;
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(10, 13, 20, 0.09);
}

.progress i {
  display: block;
  width: var(--value, 0%);
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--teal), var(--blue));
  transition: width 320ms var(--ease);
}

.login-overlay {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 20px;
  background:
    linear-gradient(180deg, rgba(238, 243, 248, 0.86), rgba(255, 255, 255, 0.92)),
    rgba(238, 243, 248, 0.88);
  backdrop-filter: blur(24px);
}

.login-card {
  width: min(360px, 100%);
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 18px;
  border: 1px solid rgba(255, 255, 255, 0.78);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.82);
  box-shadow: var(--inner-light), var(--shadow);
}

.login-card img {
  width: 132px;
  height: auto;
}

.login-card h2 {
  font-size: 18px;
}

.login-card label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
}

.login-card button {
  background: var(--blue);
  color: #fff;
}

#loginError {
  min-height: 18px;
  color: var(--bad);
  font-size: 12px;
}

.empty {
  display: grid;
  place-items: center;
  min-height: 130px;
  color: var(--muted);
  font-size: 13px;
}

@media (max-width: 1050px) {
  .span-3,
  .span-4,
  .span-5,
  .span-6,
  .span-7,
  .span-8 {
    grid-column: span 6;
  }

  .hero {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 760px) {
  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .top-actions {
    width: 100%;
    justify-content: space-between;
  }

  .view-switcher {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .dashboard {
    grid-template-columns: 1fr;
  }

  .span-3,
  .span-4,
  .span-5,
  .span-6,
  .span-7,
  .span-8,
  .span-12 {
    grid-column: 1;
  }

  .form-grid,
  .metric-grid,
  .guide-grid {
    grid-template-columns: 1fr;
  }

  .list-row {
    grid-template-columns: 1fr;
  }
}
