:root {
  --bg: #eef1f4;
  --panel: #ffffff;
  --ink: #12151a;
  --muted: #6b7280;
  --line: #e5e7eb;
  --accent: #0f766e;
  --accent-2: #115e59;
  --danger: #dc2626;
  --ok: #16a34a;
  --warn: #d97706;
  --side: #0f172a;
  --side-ink: #e2e8f0;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; min-height: 100%; }
body {
  font-family: "Segoe UI", system-ui, sans-serif;
  color: var(--ink);
  background: var(--bg);
}
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; }

.shell { display: flex; min-height: 100vh; }
.side {
  width: 250px;
  background: var(--side);
  color: var(--side-ink);
  display: flex;
  flex-direction: column;
  padding: 18px 14px;
  flex-shrink: 0;
}
.brand { display: flex; gap: 12px; align-items: center; padding: 8px 10px 22px; }
.brand strong { display: block; font-size: 15px; }
.brand span { font-size: 12px; opacity: .65; }
.brand-mark {
  width: 40px; height: 40px; border-radius: 12px;
  display: grid; place-items: center;
  background: linear-gradient(145deg, #14b8a6, #0f766e);
  color: #fff; font-weight: 800; letter-spacing: .04em;
}
.brand-mark.lg { width: 56px; height: 56px; font-size: 18px; margin: 0 auto 14px; }
.side nav { display: flex; flex-direction: column; gap: 4px; flex: 1; }
.side nav a {
  display: flex; align-items: center; gap: 10px;
  padding: 11px 12px; border-radius: 10px; color: #cbd5e1; font-weight: 600; font-size: 14px;
}
.side nav a:hover { background: rgba(255,255,255,.06); }
.side nav a.active { background: rgba(20,184,166,.18); color: #fff; }
.ico { width: 18px; text-align: center; opacity: .8; }
.side-foot { padding: 14px 10px 6px; border-top: 1px solid rgba(255,255,255,.08); }
.who { font-size: 13px; font-weight: 600; margin-bottom: 8px; }
.ghost-btn {
  background: transparent; border: 1px solid rgba(255,255,255,.2);
  color: #e2e8f0; border-radius: 8px; padding: 8px 10px; cursor: pointer; width: 100%;
}

.main { flex: 1; min-width: 0; }
.top {
  display: flex; justify-content: space-between; align-items: center;
  padding: 22px 28px 8px;
}
.top h1 { margin: 0; font-size: 24px; }
.content { padding: 12px 28px 40px; }
.pill {
  display: inline-flex; align-items: center;
  background: #ccfbf1; color: #115e59;
  font-size: 12px; font-weight: 700; padding: 6px 10px; border-radius: 999px;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 18px;
}
.panel-h { margin-bottom: 14px; }
.panel-h h2 { margin: 0 0 4px; font-size: 18px; }
.panel-h.row { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; }
.muted { color: var(--muted); font-size: 13px; margin: 0; }
.cards-4 {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px;
}
.stat {
  background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 16px 18px;
}
.stat span { display: block; color: var(--muted); font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; }
.stat strong { font-size: 28px; display: block; margin-top: 6px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.idea-list { margin: 8px 0 0; padding-left: 18px; color: #374151; line-height: 1.55; }
.idea-list li { margin: 8px 0; }

.btn, .btn.secondary {
  border: 0; border-radius: 10px; padding: 10px 14px; font-weight: 700; cursor: pointer;
  background: var(--accent); color: #fff; display: inline-flex; align-items: center; gap: 6px;
}
.btn:hover { background: var(--accent-2); }
.btn.secondary { background: #e5e7eb; color: #111827; }
.btn.danger { background: var(--danger); }
.btn.sm { padding: 7px 10px; font-size: 12px; }
.btn-row { display: flex; flex-wrap: wrap; gap: 8px; }
.linkish { border: 0; background: none; color: var(--accent); font-weight: 700; cursor: pointer; }

.toolbar { display: flex; gap: 10px; margin-bottom: 12px; }
.toolbar input, .toolbar select {
  border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; background: #fff;
}
.toolbar input { flex: 1; }

table.data { width: 100%; border-collapse: collapse; }
table.data th, table.data td {
  text-align: left; padding: 12px 10px; border-bottom: 1px solid #f1f5f9; font-size: 13px; vertical-align: middle;
}
table.data th { color: #6b7280; font-size: 11px; letter-spacing: .04em; text-transform: uppercase; }
.badge {
  display: inline-flex; align-items: center; padding: 3px 8px; border-radius: 999px;
  font-size: 11px; font-weight: 700; text-transform: uppercase;
}
.badge.green { background: #dcfce7; color: #166534; }
.badge.red { background: #fee2e2; color: #991b1b; }
.badge.yellow { background: #fef3c7; color: #92400e; }
.badge.gray { background: #f3f4f6; color: #4b5563; }

.login-body {
  min-height: 100vh; display: grid; place-items: center;
  background:
    radial-gradient(900px 400px at 10% 0%, rgba(20,184,166,.18), transparent 60%),
    radial-gradient(700px 360px at 90% 100%, rgba(15,23,42,.12), transparent 55%),
    var(--bg);
}
.login-card {
  width: min(420px, calc(100vw - 32px));
  background: #fff; border: 1px solid var(--line); border-radius: 20px; padding: 28px;
  box-shadow: 0 20px 50px rgba(15,23,42,.08);
  text-align: center;
}
.login-card h1 { margin: 0 0 6px; }
.stack { display: grid; gap: 12px; text-align: left; margin-top: 18px; }
.stack label { display: grid; gap: 6px; font-size: 13px; font-weight: 600; color: #374151; }
.stack input, .stack textarea, #cookiesEditor {
  width: 100%; border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; background: #fff;
}
#cookiesEditor { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; }
.err { color: var(--danger); font-size: 13px; font-weight: 600; }

.modal {
  display: none; position: fixed; inset: 0; background: rgba(15,23,42,.45);
  z-index: 40; align-items: center; justify-content: center; padding: 16px;
}
.modal.open { display: flex; }
.modal-card {
  width: min(520px, 100%); background: #fff; border-radius: 16px; padding: 20px; position: relative;
}
.modal-card.wide { width: min(820px, 100%); }
.modal-x {
  position: absolute; right: 12px; top: 10px; border: 0; background: #f3f4f6;
  width: 32px; height: 32px; border-radius: 8px; cursor: pointer; font-size: 18px;
}
.checks {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 8px; max-height: 280px; overflow: auto; padding: 8px; border: 1px solid var(--line); border-radius: 12px;
}
.checks label {
  display: flex; gap: 8px; align-items: flex-start; font-size: 13px; font-weight: 500;
  padding: 8px; border-radius: 8px; background: #f8fafc;
}
.label-row { display: flex; gap: 12px; align-items: center; margin-bottom: 8px; font-weight: 700; }
.check { display: flex; gap: 8px; align-items: center; font-weight: 600; }

.toast-wrap { position: fixed; top: 16px; right: 16px; z-index: 80; display: flex; flex-direction: column; gap: 8px; }
.toast {
  min-width: 240px; background: #111827; color: #fff; padding: 12px 14px; border-radius: 10px;
  font-size: 13px; font-weight: 600; box-shadow: 0 10px 24px rgba(0,0,0,.18);
}
.toast.ok { background: #059669; }
.toast.err { background: #dc2626; }

.log-pre {
  max-height: 55vh;
  overflow: auto;
  background: #0f172a;
  color: #e2e8f0;
  border-radius: 12px;
  padding: 14px;
  font-size: 12px;
  line-height: 1.45;
  white-space: pre-wrap;
}
.alert-list { display: grid; gap: 8px; }
.alert {
  padding: 10px 12px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 600;
  background: #fef3c7;
  color: #92400e;
}
.alert.error { background: #fee2e2; color: #991b1b; }
.alert.ok, .alert.ok-line { background: #dcfce7; color: #166534; }
.alert.warn { background: #fef3c7; color: #92400e; }

.scope-panel { margin-bottom: 4px; }
.scope-box {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 4px 0 10px;
}
.scope-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  border: 1px solid #d6dde8;
  border-radius: 10px;
  background: #f8fafc;
  cursor: pointer;
  font-weight: 600;
  font-size: 14px;
}
.scope-chip:has(input:checked) {
  border-color: #2563eb;
  background: #eff6ff;
  color: #1e3a8a;
}
.scope-chip input { width: 16px; height: 16px; }
.scope-note { margin: 0; color: #64748b; font-size: 13px; }
.scope-banner {
  margin-bottom: 12px;
  padding: 10px 14px;
  border-radius: 10px;
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  color: #1e3a8a;
  font-size: 13px;
}
.scope-banner a { color: #1d4ed8; font-weight: 700; }

@media (max-width: 980px) {
  .shell { flex-direction: column; }
  .side { width: 100%; }
  .cards-4, .grid-2 { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 640px) {
  .cards-4, .grid-2 { grid-template-columns: 1fr; }
  .content, .top { padding-left: 16px; padding-right: 16px; }
  .panel-h.row { flex-direction: column; }
}
