:root {
  --bg: #f6f8fb;
  --surface: #ffffff;
  --surface-soft: #eef3f7;
  --text: #132033;
  --muted: #64748b;
  --line: #d8e0ea;
  --brand: #16748a;
  --brand-dark: #0d4f61;
  --danger: #b42318;
  --ok: #15803d;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
}

.shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 270px 1fr;
}

.sidebar {
  background: #0b1422;
  color: #e5edf6;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.brand { font-size: 20px; font-weight: 800; }
.sub { color: #9fb2c8; font-size: 13px; line-height: 1.5; }
.nav button {
  width: 100%;
  border: 0;
  background: transparent;
  color: #cfe0f2;
  padding: 12px;
  text-align: left;
  border-radius: 8px;
  font: inherit;
  cursor: pointer;
}
.nav button.active { background: rgba(255,255,255,.1); color: #fff; }

.main {
  padding: 28px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
}

h1 { margin: 0; font-size: 26px; }
p { margin: 0; }

.grid {
  display: grid;
  grid-template-columns: 1.1fr .9fr;
  gap: 18px;
  align-items: start;
}

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 20px;
  box-shadow: 0 10px 28px rgba(15, 23, 42, .06);
}

.field { display: flex; flex-direction: column; gap: 7px; }
label { font-size: 13px; font-weight: 700; color: #475569; }
input, select, textarea {
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  padding: 12px;
  font: inherit;
  background: #fff;
  color: var(--text);
}
textarea { resize: vertical; min-height: 100px; }

.form { display: flex; flex-direction: column; gap: 14px; }
.row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.hidden { display: none !important; }

.btn {
  border: 0;
  border-radius: 8px;
  padding: 12px 16px;
  font-weight: 800;
  cursor: pointer;
}
.btn-primary { background: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-dark); }
.btn-ghost {
  background: #e8f0f4;
  color: var(--brand-dark);
}
.btn:disabled { opacity: .6; cursor: not-allowed; }

.drop {
  border: 1px dashed #9fb2c8;
  border-radius: 8px;
  padding: 22px;
  background: #fbfdff;
  cursor: pointer;
}
.drop strong { display: block; margin-bottom: 6px; }

.status {
  background: #0b1422;
  color: #dbeafe;
  border-color: transparent;
}
.pill {
  display: inline-flex;
  border-radius: 999px;
  background: rgba(255,255,255,.1);
  color: #a1e7ff;
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 800;
}
.progress {
  height: 10px;
  border-radius: 999px;
  background: rgba(255,255,255,.12);
  overflow: hidden;
}
.progress div { height: 100%; background: #1d8da4; width: 0%; }

.terminal {
  height: 360px;
  overflow: auto;
  background: #07111f;
  color: #59a7ff;
  border-radius: 8px;
  padding: 14px;
  font-family: Consolas, "Liberation Mono", monospace;
  font-size: 13px;
  line-height: 1.55;
}
.ts { color: #8aa0b7; margin-right: 8px; }
.ok { color: #6ee7b7; }
.err { color: #fca5a5; }
.warn { color: #fbbf24; }

.sheet-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 8px;
}
.sheet-list label {
  display: flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px;
  background: #fff;
}

.notice {
  padding: 12px;
  border-radius: 8px;
  background: #ecfeff;
  border: 1px solid #a5f3fc;
  color: #155e75;
  font-size: 13px;
  line-height: 1.45;
}

.onboarding-backdrop {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(8, 15, 28, .62);
}

.onboarding-card {
  width: min(760px, 100%);
  max-height: min(720px, calc(100vh - 40px));
  overflow: auto;
  background: #fff;
  border-radius: 8px;
  border: 1px solid #cbd5e1;
  box-shadow: 0 30px 80px rgba(2, 8, 23, .28);
}

.onboarding-media {
  min-height: 180px;
  background:
    linear-gradient(135deg, rgba(22,116,138,.9), rgba(13,79,97,.92)),
    url("https://images.unsplash.com/photo-1554224155-6726b3ff858f?auto=format&fit=crop&w=1400&q=80");
  background-size: cover;
  background-position: center;
  color: #fff;
  padding: 28px;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
}

.onboarding-media h2 {
  margin: 0;
  font-size: 28px;
  letter-spacing: 0;
}

.onboarding-media p {
  margin-top: 8px;
  color: rgba(255,255,255,.86);
  max-width: 560px;
  line-height: 1.45;
}

.onboarding-body {
  padding: 24px;
  display: grid;
  gap: 18px;
}

.onboarding-step-title {
  margin: 0;
  font-size: 20px;
}

.onboarding-step-text {
  color: #475569;
  line-height: 1.55;
  font-size: 14px;
}

.onboarding-progress {
  display: flex;
  gap: 6px;
  align-items: center;
}

.onboarding-dot {
  width: 28px;
  height: 6px;
  border-radius: 999px;
  background: #d8e0ea;
}

.onboarding-dot.active {
  background: var(--brand);
}

.onboarding-actions {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.tour-target {
  outline: 3px solid rgba(22, 116, 138, .42);
  outline-offset: 4px;
}

@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { min-height: auto; }
  .grid, .row { grid-template-columns: 1fr; }
  .topbar { align-items: flex-start; flex-direction: column; }
}
