/* Scout Factory control panel — light, calm, novice-friendly. */

* { box-sizing: border-box; }

:root {
  --ink: #1a2333;
  --ink-soft: #5b6577;
  --ink-faint: #8b94a5;
  --line: #e6eaf1;
  --bg: #f4f6fa;
  --card: #ffffff;
  --good: #16a34a;
  --good-bg: #ecfdf3;
  --warn: #b45309;
  --warn-bg: #fffbeb;
  --bad: #dc2626;
  --bad-bg: #fef2f2;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .05), 0 4px 16px rgba(16, 24, 40, .06);
}

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 15px;
  line-height: 1.55;
}

a { color: var(--brand-primary, #0084ff); }

/* ---------- layout ---------- */

.layout { display: flex; min-height: 100vh; }

.sidebar {
  width: 240px;
  flex: 0 0 240px;
  background: linear-gradient(180deg, var(--brand-surface-dark, #0b1b34), var(--brand-surface-dark2, #0a2e54));
  color: #e8edf6;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
}

.side-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 20px 18px 16px;
}

.side-brand-dot {
  width: 34px; height: 34px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--brand-primary, #0084ff), var(--brand-cta, #f59e0b));
  flex: 0 0 34px;
}

.side-brand-name { font-weight: 700; font-size: 15px; line-height: 1.2; }
.side-brand-sub { font-size: 12px; color: rgba(232, 237, 246, .6); }

.side-toggle { display: none; margin-left: auto; background: none; border: 0; color: #e8edf6; cursor: pointer; padding: 6px; }

.side-nav { display: flex; flex-direction: column; gap: 2px; padding: 8px 12px; flex: 1; }

.side-nav a {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 10px 12px;
  border-radius: 9px;
  color: rgba(232, 237, 246, .82);
  text-decoration: none;
  font-weight: 500;
  font-size: 14px;
}

.side-nav a:hover { background: rgba(255, 255, 255, .08); color: #fff; }
.side-nav a.active { background: rgba(255, 255, 255, .14); color: #fff; font-weight: 600; }
.side-nav a svg { opacity: .85; flex: 0 0 18px; }
.side-nav .side-logout { margin-top: 14px; color: rgba(232, 237, 246, .6); }

.side-foot { padding: 14px 20px 18px; font-size: 13px; }
.side-foot a { color: rgba(232, 237, 246, .7); text-decoration: none; display: flex; align-items: center; gap: 8px; }
.side-foot a:hover { color: #fff; }

.content {
  flex: 1;
  min-width: 0;
  padding: 32px 36px 64px;
  max-width: 1160px;
}

/* ---------- headings & cards ---------- */

.page-title { font-size: 24px; font-weight: 750; margin: 0 0 4px; letter-spacing: -.01em; }
.page-sub { color: var(--ink-soft); margin: 0 0 24px; font-size: 14.5px; }

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 22px 24px;
  margin-bottom: 20px;
}

.card h2 { font-size: 16.5px; font-weight: 700; margin: 0 0 2px; }
.card .card-help { color: var(--ink-soft); font-size: 13.5px; margin: 0 0 16px; }

.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 1100px) { .grid-4 { grid-template-columns: repeat(2, 1fr); } .grid-3 { grid-template-columns: 1fr; } }
@media (max-width: 640px) { .grid-2, .grid-4 { grid-template-columns: 1fr; } }

/* ---------- hero (home) ---------- */

.hero {
  display: flex;
  align-items: center;
  gap: 18px;
  flex-wrap: wrap;
}

.hero-name { font-size: 21px; font-weight: 750; }
.hero-url { font-size: 14px; }
.hero-actions { margin-left: auto; display: flex; gap: 10px; flex-wrap: wrap; }

.badge {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 5px 12px;
  border-radius: 999px;
  font-size: 12.5px;
  font-weight: 650;
}
.badge .dot { width: 8px; height: 8px; border-radius: 50%; }
.badge-live { background: var(--good-bg); color: var(--good); }
.badge-live .dot { background: var(--good); }
.badge-wait { background: var(--warn-bg); color: var(--warn); }
.badge-wait .dot { background: var(--warn); }
.badge-off { background: var(--bad-bg); color: var(--bad); }
.badge-off .dot { background: var(--bad); }

/* ---------- stat cards ---------- */

.stat { text-align: left; }
.stat .stat-value { font-size: 27px; font-weight: 750; letter-spacing: -.02em; }
.stat .stat-label { color: var(--ink-soft); font-size: 13px; margin-top: 2px; }

/* ---------- buttons ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid transparent;
  border-radius: 9px;
  padding: 9px 16px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  font-family: inherit;
  transition: filter .12s ease, background .12s ease;
}
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-primary { background: var(--brand-primary, #0084ff); color: #fff; }
.btn-primary:hover:not(:disabled) { filter: brightness(.93); }
.btn-secondary { background: #fff; color: var(--ink); border-color: #cfd6e2; }
.btn-secondary:hover:not(:disabled) { background: #f6f8fb; }
.btn-danger { background: #fff; color: var(--bad); border-color: #f3c1c1; }
.btn-danger:hover:not(:disabled) { background: var(--bad-bg); }
.btn-big { padding: 11px 20px; font-size: 15px; }

/* ---------- forms ---------- */

label.field-label { display: block; font-size: 13px; font-weight: 650; margin: 0 0 5px; color: var(--ink); }
.field-hint { font-size: 12.5px; color: var(--ink-faint); margin-top: 4px; }

input[type="text"], input[type="password"], input[type="number"],
input[type="email"], input[type="time"], select, textarea {
  width: 100%;
  border: 1px solid #cfd6e2;
  border-radius: 8px;
  padding: 9px 11px;
  font-size: 14px;
  font-family: inherit;
  color: var(--ink);
  background: #fff;
}
input:focus, select:focus, textarea:focus {
  outline: 2px solid color-mix(in srgb, var(--brand-primary, #0084ff) 30%, transparent);
  border-color: var(--brand-primary, #0084ff);
}
textarea { min-height: 88px; resize: vertical; }

.form-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; margin-bottom: 14px; }
.form-row-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.form-row-1 { grid-template-columns: 1fr; }
@media (max-width: 700px) { .form-row, .form-row-3 { grid-template-columns: 1fr; } }

.save-row { display: flex; align-items: center; gap: 12px; margin-top: 6px; }

/* ---------- switches ---------- */

.switch { position: relative; display: inline-flex; align-items: center; gap: 10px; cursor: pointer; user-select: none; }
.switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.switch .track {
  width: 42px; height: 24px;
  background: #cbd3e0;
  border-radius: 999px;
  position: relative;
  transition: background .15s ease;
  flex: 0 0 42px;
}
.switch .track::after {
  content: "";
  position: absolute;
  top: 3px; left: 3px;
  width: 18px; height: 18px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, .25);
  transition: left .15s ease;
}
.switch input:checked + .track { background: var(--good); }
.switch input:checked + .track::after { left: 21px; }
.switch .switch-label { font-weight: 600; font-size: 14px; }

/* ---------- chips ---------- */

.chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0; }
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: color-mix(in srgb, var(--brand-primary, #0084ff) 10%, #fff);
  border: 1px solid color-mix(in srgb, var(--brand-primary, #0084ff) 30%, #fff);
  color: var(--brand-primary-dark, #0a5bd6);
  border-radius: 999px;
  padding: 4px 6px 4px 12px;
  font-size: 13px;
  font-weight: 600;
}
.chip button {
  border: 0; background: none; cursor: pointer; color: inherit;
  font-size: 14px; line-height: 1; padding: 2px 5px; border-radius: 50%;
}
.chip button:hover { background: rgba(0, 0, 0, .08); }
.chip-add { display: flex; gap: 8px; align-items: center; }
.chip-add input { max-width: 180px; }

/* ---------- checklist ---------- */

.check-list { list-style: none; margin: 0; padding: 0; }
.check-item { border-top: 1px solid var(--line); }
.check-item:first-child { border-top: 0; }
.check-head {
  display: flex;
  align-items: center;
  gap: 13px;
  padding: 13px 4px;
  cursor: pointer;
  background: none;
  border: 0;
  width: 100%;
  text-align: left;
  font: inherit;
  color: inherit;
}
.check-head:hover .check-title { color: var(--brand-primary-dark, #0a5bd6); }
.check-title { font-weight: 600; font-size: 14.5px; flex: 1; }
.check-icon { flex: 0 0 24px; height: 24px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; }
.check-icon.done { background: var(--good-bg); color: var(--good); }
.check-icon.todo { background: var(--warn-bg); color: var(--warn); }
.check-icon.optional { background: #eef1f6; color: var(--ink-faint); }
.check-tag { font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--ink-faint); background: #eef1f6; padding: 3px 9px; border-radius: 999px; }
.check-chevron { color: var(--ink-faint); transition: transform .15s ease; }
.check-item.open .check-chevron { transform: rotate(180deg); }
.check-detail { display: none; padding: 2px 4px 18px 41px; color: var(--ink-soft); font-size: 14px; }
.check-item.open .check-detail { display: block; }
.check-detail ol { padding-left: 20px; margin: 8px 0; }
.check-detail li { margin-bottom: 6px; }
.check-detail code { background: #f0f3f8; border: 1px solid var(--line); border-radius: 5px; padding: 1px 6px; font-size: 12.5px; }
.check-manual { display: flex; align-items: center; gap: 8px; }

/* progress ring */
.ring-wrap { display: flex; align-items: center; gap: 18px; }
.ring { transform: rotate(-90deg); }
.ring .ring-bg { stroke: #e8ecf3; }
.ring .ring-fg { stroke: var(--good); transition: stroke-dashoffset .4s ease; }
.ring-num { font-size: 15px; font-weight: 750; }

/* ---------- activity feed ---------- */

.feed { list-style: none; margin: 0; padding: 0; }
.feed li { display: flex; gap: 12px; padding: 9px 0; border-top: 1px solid var(--line); font-size: 13.5px; }
.feed li:first-child { border-top: 0; }
.feed .feed-when { color: var(--ink-faint); white-space: nowrap; flex: 0 0 auto; min-width: 92px; }

/* ---------- tables ---------- */

.table-wrap { overflow-x: auto; }
table.panel-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.panel-table th { text-align: left; color: var(--ink-faint); font-size: 12px; text-transform: uppercase; letter-spacing: .04em; padding: 8px 10px; border-bottom: 1px solid var(--line); }
.panel-table td { padding: 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.panel-table tr:last-child td { border-bottom: 0; }

/* ---------- misc components ---------- */

.callout { border-radius: 10px; padding: 14px 16px; font-size: 14px; margin-bottom: 18px; }
.callout-warn { background: var(--warn-bg); border: 1px solid #fde5b8; color: var(--warn); }
.callout-info { background: color-mix(in srgb, var(--brand-primary, #0084ff) 7%, #fff); border: 1px solid color-mix(in srgb, var(--brand-primary, #0084ff) 22%, #fff); color: var(--ink); }
.callout h3 { margin: 0 0 4px; font-size: 14.5px; }
.callout p { margin: 0; }

.mix-total { font-weight: 700; font-size: 14px; }
.mix-total.bad { color: var(--bad); }
.mix-total.good { color: var(--good); }

/* dual range slider */
.range-wrap { position: relative; height: 34px; margin: 18px 2px 4px; }
.range-wrap input[type="range"] {
  position: absolute; left: 0; right: 0; top: 8px; width: 100%;
  -webkit-appearance: none; appearance: none; background: none; pointer-events: none; height: 18px; margin: 0;
}
.range-track { position: absolute; left: 0; right: 0; top: 14px; height: 6px; border-radius: 3px; background: #dde3ec; }
.range-fill { position: absolute; top: 14px; height: 6px; border-radius: 3px; background: var(--brand-primary, #0084ff); }
.range-wrap input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none; pointer-events: auto;
  width: 20px; height: 20px; border-radius: 50%;
  background: #fff; border: 3px solid var(--brand-primary, #0084ff);
  cursor: grab; box-shadow: 0 1px 4px rgba(0, 0, 0, .2);
}
.range-wrap input[type="range"]::-moz-range-thumb {
  pointer-events: auto; width: 15px; height: 15px; border-radius: 50%;
  background: #fff; border: 3px solid var(--brand-primary, #0084ff); cursor: grab;
}
.range-labels { display: flex; justify-content: space-between; font-size: 13px; color: var(--ink-soft); font-weight: 600; }

/* colour picker rows */
.palette-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
@media (max-width: 900px) { .palette-grid { grid-template-columns: 1fr; } }
.palette-item { display: flex; align-items: center; gap: 12px; border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; }
.palette-item input[type="color"] { width: 44px; height: 36px; border: 1px solid #cfd6e2; border-radius: 8px; padding: 2px; background: #fff; cursor: pointer; flex: 0 0 44px; }
.palette-name { font-weight: 650; font-size: 13.5px; }
.palette-desc { font-size: 12px; color: var(--ink-faint); }

/* author avatars */
.avatar { width: 38px; height: 38px; border-radius: 50%; object-fit: cover; display: inline-flex; align-items: center; justify-content: center; font-weight: 700; color: #fff; font-size: 14px; }

/* modal */
.modal-backdrop {
  display: none; position: fixed; inset: 0; background: rgba(15, 23, 42, .45);
  z-index: 60; align-items: flex-start; justify-content: center; padding: 40px 16px; overflow-y: auto;
}
.modal-backdrop.open { display: flex; }
.modal {
  background: #fff; border-radius: 14px; box-shadow: 0 20px 60px rgba(0, 0, 0, .3);
  width: 100%; max-width: 560px; padding: 24px 26px;
}
.modal h3 { margin: 0 0 14px; font-size: 17px; }

/* sparkline */
.spark { width: 100%; height: 48px; }
.spark polyline { fill: none; stroke: var(--brand-primary, #0084ff); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }

/* upload preview */
.upload-preview { max-width: 220px; max-height: 90px; border: 1px solid var(--line); border-radius: 8px; padding: 8px; background: repeating-conic-gradient(#f2f4f8 0% 25%, #fff 0% 50%) 50% / 18px 18px; }
.upload-preview.small { max-width: 48px; max-height: 48px; }

/* toast */
.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%) translateY(20px);
  background: var(--ink); color: #fff; padding: 11px 20px; border-radius: 10px;
  font-size: 14px; font-weight: 600; box-shadow: 0 8px 30px rgba(0, 0, 0, .25);
  opacity: 0; pointer-events: none; transition: opacity .2s ease, transform .2s ease; z-index: 100;
  max-width: min(90vw, 520px); text-align: center;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.err { background: var(--bad); }

/* login */
.login-body { display: flex; align-items: center; justify-content: center; min-height: 100vh; background: linear-gradient(160deg, var(--brand-surface-dark, #0b1b34), var(--brand-surface-dark2, #0a2e54)); }
.login-card { background: #fff; border-radius: 16px; box-shadow: 0 24px 80px rgba(0, 0, 0, .4); padding: 36px 38px; width: 100%; max-width: 400px; margin: 20px; }
.login-card h1 { font-size: 20px; margin: 0 0 4px; }
.login-card .login-sub { color: var(--ink-soft); font-size: 14px; margin: 0 0 22px; }
.login-error { background: var(--bad-bg); color: var(--bad); border-radius: 8px; padding: 10px 14px; font-size: 13.5px; margin-bottom: 14px; }

/* advanced tool grid */
.tool-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
@media (max-width: 1000px) { .tool-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 640px) { .tool-grid { grid-template-columns: 1fr; } }
.tool-card {
  display: block; background: #fff; border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px 18px; text-decoration: none; color: var(--ink); box-shadow: var(--shadow);
  transition: border-color .12s ease, transform .12s ease;
}
.tool-card:hover { border-color: var(--brand-primary, #0084ff); transform: translateY(-1px); }
.tool-card .tool-name { font-weight: 700; font-size: 14.5px; margin-bottom: 3px; color: var(--brand-primary-dark, #0a5bd6); }
.tool-card .tool-desc { font-size: 13px; color: var(--ink-soft); }

/* metric rows (analytics) */
.metric-row { display: flex; gap: 26px; flex-wrap: wrap; margin-bottom: 8px; }
.metric { min-width: 90px; }
.metric .m-value { font-size: 22px; font-weight: 750; }
.metric .m-label { font-size: 12px; color: var(--ink-faint); }

/* ---------- responsive: sidebar becomes top bar ---------- */

@media (max-width: 900px) {
  .layout { flex-direction: column; }
  .sidebar { width: 100%; flex: 0 0 auto; height: auto; position: static; }
  .side-brand { padding: 14px 18px; }
  .side-toggle { display: inline-flex; }
  .side-nav { display: none; padding-bottom: 10px; }
  .side-nav.open { display: flex; }
  .side-foot { display: none; }
  .content { padding: 22px 16px 48px; }
}
