@import url("https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=JetBrains+Mono:wght@500;600&display=swap");

:root {
  --slate-900: #0f172a;
  --slate-800: #1e293b;
  --slate-700: #334155;
  --slate-600: #475569;
  --slate-100: #f1f5f9;
  --slate-50: #f8fafc;
  --amber: #f59e0b;
  --amber-dark: #d97706;
  --amber-light: #fef3c7;
  --green: #10b981;
  --green-dark: #059669;
  --red: #ef4444;
  --white: #ffffff;
  --text: #0f172a;
  --muted: #64748b;
  --border: #e2e8f0;
  --rail-w: 72px;
  --font: "Inter", system-ui, sans-serif;
  --mono: "JetBrains Mono", monospace;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: var(--font);
  background: var(--slate-50);
  color: var(--text);
  line-height: 1.6;
  font-size: 15px;
  display: flex;
  min-height: 100vh;
}

a { color: var(--green-dark); text-decoration: none; }
a:hover { text-decoration: underline; }

.rail {
  width: var(--rail-w);
  background: var(--slate-900);
  position: fixed;
  top: 0; bottom: 0; left: 0;
  z-index: 200;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 1rem 0;
  gap: 0.35rem;
}

.rail-logo {
  width: 44px; height: 44px;
  background: var(--amber);
  border-radius: 10px;
  display: grid; place-items: center;
  font-weight: 800; font-size: 0.55rem;
  color: var(--slate-900);
  letter-spacing: -0.02em;
  margin-bottom: 1rem;
  text-decoration: none;
  line-height: 1.1;
  text-align: center;
}

.rail-btn {
  width: 48px; height: 48px;
  border: none; background: transparent;
  color: var(--slate-600);
  border-radius: 10px;
  cursor: pointer;
  font-size: 1.25rem;
  display: grid; place-items: center;
  transition: all 0.2s;
  position: relative;
}

.rail-btn:hover { background: var(--slate-800); color: var(--white); }
.rail-btn.active { background: var(--slate-800); color: var(--amber); }
.rail-btn.active::before {
  content: "";
  position: absolute; left: 0; top: 8px; bottom: 8px;
  width: 3px; background: var(--amber);
  border-radius: 0 2px 2px 0;
}

.shell { margin-left: var(--rail-w); flex: 1; min-width: 0; }

.topbar {
  background: var(--white);
  border-bottom: 1px solid var(--border);
  padding: 0.85rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  position: sticky; top: 0; z-index: 50;
}

.topbar-brand h1 { font-size: 1.1rem; font-weight: 700; }
.topbar-brand p { font-size: 0.78rem; color: var(--muted); }

.global-search { flex: 1; max-width: 480px; position: relative; }
.global-search input {
  width: 100%;
  padding: 0.65rem 1rem 0.65rem 2.5rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-family: inherit;
  font-size: 0.9rem;
  background: var(--slate-50);
}
.global-search input:focus {
  outline: 2px solid var(--amber);
  border-color: var(--amber);
  background: var(--white);
}
.global-search::before {
  content: "⌕";
  position: absolute; left: 0.85rem; top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
}

.search-dropdown {
  position: absolute;
  top: calc(100% + 4px); left: 0; right: 0;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.1);
  max-height: 320px;
  overflow-y: auto;
  display: none;
  z-index: 60;
}
.search-dropdown.show { display: block; }
.search-hit {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  font-size: 0.88rem;
}
.search-hit:hover { background: var(--amber-light); }
.search-hit .type {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--amber-dark);
}

.panel { display: none; padding: 1.5rem; animation: panelIn 0.3s ease; }
.panel.active { display: block; }
@keyframes panelIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.panel-head { margin-bottom: 1.5rem; }
.panel-head h2 { font-size: 1.5rem; font-weight: 700; margin-bottom: 0.25rem; }
.panel-head p { color: var(--muted); font-size: 0.92rem; }

.dash-grid {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 1rem;
}

.widget {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.25rem;
}
.widget.span-4 { grid-column: span 4; }
.widget.span-6 { grid-column: span 6; }
.widget.span-8 { grid-column: span 8; }
.widget.span-12 { grid-column: span 12; }

.widget-head {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 1rem;
}
.widget-icon {
  width: 36px; height: 36px;
  border-radius: 8px;
  display: grid; place-items: center;
  font-size: 1.1rem;
}
.widget-icon.amber { background: var(--amber-light); }
.widget-icon.green { background: #d1fae5; }
.widget-icon.slate { background: var(--slate-100); }
.widget-head h3 { font-size: 0.92rem; font-weight: 600; }
.widget-head span { font-size: 0.75rem; color: var(--muted); display: block; }

.stat-row { display: flex; gap: 1.5rem; flex-wrap: wrap; }
.stat-box strong {
  font-family: var(--mono);
  font-size: 1.75rem;
  color: var(--amber-dark);
  display: block;
}
.stat-box span { font-size: 0.78rem; color: var(--muted); }

.quick-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 0.5rem; }
.quick-link {
  padding: 0.65rem 0.85rem;
  background: var(--slate-50);
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 0.82rem;
  font-weight: 500;
  cursor: pointer;
  text-align: left;
  font-family: inherit;
}
.quick-link:hover { border-color: var(--amber); background: var(--amber-light); }

.chip-row { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.chip {
  padding: 0.4rem 0.75rem;
  background: var(--slate-50);
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 0.8rem;
  cursor: pointer;
  font-family: inherit;
}
.chip:hover { border-color: var(--green); }
.chip.active { background: #d1fae5; border-color: var(--green); font-weight: 600; }

.gauge-num {
  font-family: var(--mono);
  font-size: 2.5rem;
  font-weight: 600;
  text-align: center;
  color: var(--green-dark);
  margin: 0.5rem 0;
}
.gauge-num.warn { color: var(--amber-dark); }
.gauge-num.danger { color: var(--red); }
.gauge-bar { height: 6px; background: var(--border); border-radius: 999px; overflow: hidden; }
.gauge-fill {
  height: 100%;
  background: var(--green);
  border-radius: 999px;
  transition: width 0.4s, background 0.3s;
  width: 0%;
}
.gauge-fill.warn { background: var(--amber); }
.gauge-fill.danger { background: var(--red); }
.gauge-note { font-size: 0.82rem; color: var(--muted); text-align: center; margin-top: 0.5rem; }

.quiz-q { font-weight: 600; font-size: 0.9rem; margin-bottom: 0.75rem; }
.quiz-opts { display: flex; flex-direction: column; gap: 0.4rem; }
.quiz-opt {
  padding: 0.6rem 0.85rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--white);
  text-align: left;
  font-family: inherit;
  font-size: 0.85rem;
  cursor: pointer;
}
.quiz-opt:hover { border-color: var(--amber); }
.quiz-opt.ok { border-color: var(--green); background: #d1fae5; }
.quiz-opt.no { border-color: var(--red); background: #fee2e2; }
.quiz-meta {
  display: flex;
  justify-content: space-between;
  font-size: 0.78rem;
  color: var(--muted);
  margin-bottom: 0.75rem;
}
.quiz-timer { font-family: var(--mono); color: var(--amber-dark); font-weight: 600; }

.check-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0.35rem; }
.check-item {
  display: flex; align-items: center; gap: 0.5rem;
  padding: 0.5rem 0.65rem;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.82rem;
}
.check-item:hover { background: var(--slate-50); }
.check-item.done { opacity: 0.55; text-decoration: line-through; }
.check-item input { accent-color: var(--green); }

.ring-wrap {
  display: flex; align-items: center; gap: 1rem;
  margin-top: 0.75rem; padding-top: 0.75rem;
  border-top: 1px solid var(--border);
}
.ring-svg { width: 56px; height: 56px; transform: rotate(-90deg); }
.ring-bg { fill: none; stroke: var(--border); stroke-width: 6; }
.ring-fg {
  fill: none; stroke: var(--green); stroke-width: 6;
  stroke-linecap: round;
  stroke-dasharray: 163;
  stroke-dashoffset: 163;
  transition: stroke-dashoffset 0.4s;
}

.slider-wrap input[type="range"] { width: 100%; margin: 0.75rem 0; accent-color: var(--amber); }
.calc-row {
  display: flex; justify-content: space-between;
  font-size: 0.88rem;
  padding: 0.4rem 0;
  border-bottom: 1px dashed var(--border);
}
.calc-row strong { font-family: var(--mono); color: var(--green-dark); }
.calc-row.highlight strong { color: var(--amber-dark); }

.tl-row { display: flex; align-items: flex-start; gap: 1.25rem; }
.tl-unit {
  background: #111; padding: 8px; border-radius: 8px;
  display: flex; flex-direction: column; gap: 6px;
}
.tl-unit i {
  width: 22px; height: 22px; border-radius: 50%;
  background: #333; display: block;
}
.tl-unit i.on-r { background: var(--red); box-shadow: 0 0 10px var(--red); }
.tl-unit i.on-y { background: var(--amber); box-shadow: 0 0 10px var(--amber); }
.tl-unit i.on-g { background: var(--green); box-shadow: 0 0 10px var(--green); }
.tl-qs { flex: 1; }
.tl-q { margin-bottom: 0.65rem; }
.tl-q p { font-size: 0.82rem; font-weight: 600; margin-bottom: 0.35rem; }
.tl-btns { display: flex; gap: 0.35rem; }
.tl-btn {
  flex: 1; padding: 0.4rem;
  border: 1px solid var(--border);
  background: var(--white);
  border-radius: 4px;
  font-size: 0.78rem;
  cursor: pointer;
  font-family: inherit;
}
.tl-btn.sel { border-color: var(--amber); background: var(--amber-light); font-weight: 600; }
.tl-result { font-size: 0.85rem; color: var(--muted); margin-top: 0.75rem; }

.wizard { display: flex; gap: 0.5rem; margin-bottom: 1rem; overflow-x: auto; }
.w-step { flex: 1; min-width: 70px; text-align: center; cursor: pointer; }
.w-dot {
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--border); color: var(--muted);
  display: grid; place-items: center;
  font-size: 0.8rem; font-weight: 700;
  margin: 0 auto 0.35rem;
}
.w-step.active .w-dot { background: var(--amber); color: var(--slate-900); }
.w-step.done .w-dot { background: var(--green); color: #fff; }
.w-step span { font-size: 0.68rem; color: var(--muted); }
.w-content h4 { font-size: 0.95rem; margin-bottom: 0.5rem; }
.w-content p, .w-content li { font-size: 0.85rem; color: var(--muted); }
.w-content ul { padding-left: 1.1rem; margin-top: 0.5rem; }
.w-nav { display: flex; justify-content: space-between; margin-top: 1rem; }

.split-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }

.chat-box {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  height: 420px;
}
.chat-head {
  padding: 0.85rem 1rem;
  border-bottom: 1px solid var(--border);
  font-weight: 600;
  font-size: 0.9rem;
}
.chat-body { flex: 1; overflow-y: auto; padding: 1rem; }
.msg { margin-bottom: 0.75rem; max-width: 90%; }
.msg.bot .bubble {
  background: var(--slate-50);
  border-radius: 4px 12px 12px 12px;
  padding: 0.75rem 1rem;
  font-size: 0.88rem;
  border: 1px solid var(--border);
}
.msg.user .bubble {
  background: var(--amber-light);
  border-radius: 12px 4px 12px 12px;
  padding: 0.65rem 0.9rem;
  font-size: 0.85rem;
  margin-left: auto;
  text-align: right;
}
.msg-opts { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-top: 0.5rem; }
.msg-opt {
  padding: 0.4rem 0.75rem;
  border: 1px solid var(--amber);
  background: var(--white);
  color: var(--amber-dark);
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
}
.msg-opt:hover { background: var(--amber); color: var(--slate-900); }
.chat-foot {
  padding: 0.75rem;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 0.5rem;
}
.chat-foot input {
  flex: 1;
  padding: 0.6rem 0.85rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-family: inherit;
}
.chat-foot button {
  background: var(--green);
  color: #fff;
  border: none;
  padding: 0.6rem 1rem;
  border-radius: 8px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
}

.faq-filters { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-bottom: 1rem; }
.faq-filter {
  padding: 0.35rem 0.75rem;
  border: 1px solid var(--border);
  background: var(--white);
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
}
.faq-filter.active { background: var(--slate-900); color: #fff; border-color: var(--slate-900); }
.faq-scroll { max-height: 340px; overflow-y: auto; }
.faq-item {
  border: 1px solid var(--border);
  border-radius: 8px;
  margin-bottom: 0.5rem;
  background: var(--white);
}
.faq-item.hidden { display: none; }
.faq-item button {
  width: 100%; text-align: left;
  padding: 0.75rem 1rem;
  background: none; border: none;
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
}
.faq-item .ans { display: none; padding: 0 1rem 0.75rem; font-size: 0.82rem; color: var(--muted); }
.faq-item.open .ans { display: block; }
.faq-item.open { border-color: var(--amber); }

.guide-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1rem;
}
.guide-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.15rem;
  cursor: pointer;
  border-top: 3px solid var(--amber);
  transition: transform 0.2s;
}
.guide-card:hover { transform: translateY(-2px); box-shadow: 0 6px 20px rgba(0,0,0,0.08); }
.guide-card.hidden { display: none; }
.guide-card .cat {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--amber-dark);
}
.guide-card h4 { font-size: 0.95rem; margin: 0.4rem 0; }
.guide-card p { font-size: 0.82rem; color: var(--muted); }

.glossary-inline { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-top: 1rem; }
.gloss-chip {
  padding: 0.35rem 0.65rem;
  background: var(--slate-100);
  border-radius: 4px;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  font-family: var(--mono);
}
.gloss-chip:hover { background: var(--amber-light); }
.gloss-tip {
  margin-top: 0.75rem;
  padding: 0.75rem;
  background: var(--amber-light);
  border-radius: 8px;
  font-size: 0.85rem;
  display: none;
}
.gloss-tip.show { display: block; }

.contact-grid {
  display: grid;
  grid-template-columns: 1fr 1.1fr;
  gap: 1.5rem;
  max-width: 900px;
}
.info-card {
  background: var(--slate-900);
  color: #fff;
  border-radius: 12px;
  padding: 1.75rem;
}
.info-card h3 { font-size: 1.2rem; margin-bottom: 0.5rem; }
.info-card > p { opacity: 0.8; font-size: 0.9rem; margin-bottom: 1.25rem; }
.info-line {
  margin-bottom: 1rem;
  font-size: 0.88rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid rgba(255,255,255,0.1);
}
.info-line strong {
  display: block;
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--amber);
  margin-bottom: 0.2rem;
}

.form-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.75rem;
}
.form-group { margin-bottom: 1rem; }
.form-group label { display: block; font-size: 0.82rem; font-weight: 600; margin-bottom: 0.35rem; }
.form-group input, .form-group textarea, .form-group select {
  width: 100%;
  padding: 0.65rem 0.85rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-family: inherit;
}
.form-group textarea { min-height: 100px; resize: vertical; }

.btn {
  padding: 0.7rem 1.35rem;
  background: var(--amber);
  color: var(--slate-900);
  border: none;
  border-radius: 8px;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
}
.btn:hover { background: var(--amber-dark); color: #fff; }
.btn-ghost { background: var(--slate-100); color: var(--text); border: 1px solid var(--border); }
.btn-sm { padding: 0.45rem 0.85rem; font-size: 0.82rem; }
.honeypot { position: absolute; left: -9999px; opacity: 0; height: 0; }

.legal-box {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.75rem;
  max-width: 800px;
}
.legal-box h3 { font-size: 1.1rem; margin-bottom: 0.25rem; }
.legal-box .upd { font-size: 0.8rem; color: var(--muted); margin-bottom: 1rem; }
.legal-box h4 { font-size: 0.9rem; color: var(--amber-dark); margin: 1rem 0 0.35rem; }
.legal-box p, .legal-box li { font-size: 0.86rem; color: var(--muted); margin-bottom: 0.45rem; }
.legal-box ul { padding-left: 1.2rem; }

.modal-bg {
  position: fixed; inset: 0;
  background: rgba(15,23,42,0.5);
  z-index: 300;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}
.modal-bg.open { display: flex; }
.modal {
  background: var(--white);
  border-radius: 12px;
  width: min(540px, 100%);
  max-height: 80vh;
  overflow-y: auto;
  border-top: 4px solid var(--amber);
}
.modal-head {
  padding: 1.15rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
}
.modal-x { background: var(--slate-100); border: none; width: 30px; height: 30px; border-radius: 6px; cursor: pointer; }
.modal-body { padding: 1.15rem; font-size: 0.9rem; color: var(--muted); }

.shell-footer {
  padding: 1.25rem 1.5rem;
  border-top: 1px solid var(--border);
  background: var(--white);
  font-size: 0.78rem;
  color: var(--muted);
  line-height: 1.7;
}

.cookie {
  position: fixed;
  bottom: 0;
  left: var(--rail-w);
  right: 0;
  background: var(--slate-900);
  color: #fff;
  padding: 0.85rem 1.5rem;
  z-index: 250;
  display: none;
  border-top: 3px solid var(--amber);
}
.cookie.show { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.cookie p { font-size: 0.85rem; flex: 1; }

.toast {
  position: fixed;
  bottom: 1.5rem; right: 1.5rem;
  background: var(--green);
  color: #fff;
  padding: 0.75rem 1.15rem;
  border-radius: 8px;
  font-weight: 600;
  z-index: 400;
  transform: translateY(100px);
  opacity: 0;
  transition: all 0.35s;
}
.toast.show { transform: translateY(0); opacity: 1; }

.mobile-nav { display: none; }

@media (max-width: 1024px) {
  .dash-grid .widget.span-4,
  .dash-grid .widget.span-6,
  .dash-grid .widget.span-8 { grid-column: span 12; }
  .split-2 { grid-template-columns: 1fr; }
  .contact-grid { grid-template-columns: 1fr; }
  .check-grid { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
  .rail { display: none; }
  .shell { margin-left: 0; padding-bottom: 60px; }
  .cookie { left: 0; }
  .mobile-nav {
    display: flex;
    position: fixed;
    bottom: 0; left: 0; right: 0;
    background: var(--slate-900);
    justify-content: space-around;
    padding: 0.5rem;
    z-index: 200;
  }
  .mobile-nav button {
    background: none; border: none;
    color: var(--slate-600);
    font-size: 1.25rem;
    padding: 0.5rem;
    cursor: pointer;
  }
  .mobile-nav button.active { color: var(--amber); }
  .global-search { max-width: 100%; flex-basis: 100%; }
  .topbar { flex-wrap: wrap; }
}
