:root {
  --ink: #182a08;
  --bg: #ffffff;
  --ink-2: rgba(24, 42, 8, 0.62);
  --ink-3: rgba(24, 42, 8, 0.40);
  --ink-line: rgba(24, 42, 8, 0.12);
  --ink-line-2: rgba(24, 42, 8, 0.08);
  --ink-fill: rgba(24, 42, 8, 0.05);
  --ink-fill-2: rgba(24, 42, 8, 0.09);
  --shadow: 0 1px 2px rgba(24, 42, 8, 0.04), 0 8px 30px rgba(24, 42, 8, 0.06);
  --radius: 16px;
  --radius-sm: 10px;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --sidebar-w: 248px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--ink);
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

button, input, textarea { font-family: inherit; }

[hidden] { display: none !important; }

/* ---------- boot splash ---------- */
.boot {
  position: fixed; inset: 0;
  display: grid; place-items: center;
  background: var(--bg); z-index: 100;
  transition: opacity 0.4s var(--ease);
}
.boot.is-hidden { opacity: 0; pointer-events: none; }
.boot-logo {
  width: 30px; height: 30px; border-radius: 9px; display: block;
  animation: pulse 1.1s var(--ease) infinite;
}
@keyframes pulse {
  0%, 100% { transform: scale(0.82); opacity: 0.55; }
  50% { transform: scale(1); opacity: 1; }
}

/* ---------- logo ---------- */
.logo {
  display: block; object-fit: cover; flex: none;
  border-radius: 7px; user-select: none; -webkit-user-drag: none;
}
.logo-sm { width: 24px; height: 24px; border-radius: 7px; }
.logo-lg { width: 42px; height: 42px; border-radius: 13px; }

/* ---------- login ---------- */
.login-view {
  position: fixed; inset: 0;
  display: grid; place-items: center;
  padding: 24px;
  animation: fade-in 0.5s var(--ease);
}
.login-card {
  width: 100%; max-width: 340px;
  display: flex; flex-direction: column; align-items: center;
  gap: 18px; text-align: center;
}
.login-title {
  font-size: 20px; font-weight: 600; letter-spacing: -0.02em; margin: 2px 0 6px;
}
.login-card .field { width: 100%; }
.login-step { width: 100%; display: flex; flex-direction: column; gap: 14px; align-items: stretch; }
.login-hint { font-size: 13px; color: var(--ink-3); margin: 2px 0 0; text-align: center; line-height: 1.5; }
.login-email-ref { color: var(--ink); font-weight: 600; }
.input-otp { text-align: center; letter-spacing: 8px; font-size: 20px; font-weight: 600; }
.login-subactions { display: flex; justify-content: center; gap: 18px; margin-top: 2px; }
.linkbtn { border: none; background: transparent; color: var(--ink-3); font-size: 12.5px; font-weight: 600; cursor: pointer; padding: 4px; transition: color 0.2s var(--ease); }
.linkbtn:hover { color: var(--ink); }
.login-error {
  font-size: 13px; color: var(--ink); opacity: 0.7; margin: -4px 0 0;
  animation: shake 0.32s var(--ease);
}
@keyframes shake {
  10%, 90% { transform: translateX(-1px); }
  30%, 70% { transform: translateX(2px); }
  50% { transform: translateX(-3px); }
}

/* ---------- inputs / buttons ---------- */
.input {
  width: 100%; height: 46px; padding: 0 16px;
  border: 1px solid var(--ink-line);
  border-radius: var(--radius-sm);
  background: var(--bg); color: var(--ink);
  font-size: 15px; outline: none;
  transition: border-color 0.2s var(--ease), box-shadow 0.2s var(--ease);
}
.input::placeholder { color: var(--ink-3); }
.input:focus {
  border-color: var(--ink);
  box-shadow: 0 0 0 3px var(--ink-fill-2);
}

.btn {
  position: relative;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 44px; padding: 0 22px;
  border: 1px solid transparent; border-radius: var(--radius-sm);
  font-size: 14.5px; font-weight: 600; letter-spacing: -0.01em;
  cursor: pointer; user-select: none;
  transition: transform 0.12s var(--ease), background 0.2s var(--ease), opacity 0.2s var(--ease);
}
.btn:active { transform: scale(0.97); }
.btn:disabled { cursor: default; opacity: 0.55; }
.btn-primary { background: var(--ink); color: var(--bg); }
.btn-primary:hover:not(:disabled) { background: #20380c; }
.btn-block { width: 100%; }

.spinner {
  width: 15px; height: 15px; border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.35);
  border-top-color: #fff;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- app shell ---------- */
.app { display: flex; min-height: 100vh; animation: fade-in 0.5s var(--ease); }

.sidebar {
  width: var(--sidebar-w); flex: none;
  border-right: 1px solid var(--ink-line-2);
  padding: 22px 16px;
  display: flex; flex-direction: column; justify-content: space-between;
  position: sticky; top: 0; height: 100vh;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 6px 8px 22px; }
.brand-name { font-size: 16px; font-weight: 700; letter-spacing: -0.02em; }

.nav { display: flex; flex-direction: column; gap: 3px; }
.nav-item {
  display: flex; align-items: center; gap: 11px;
  width: 100%; padding: 10px 12px;
  border: none; background: transparent; color: var(--ink-2);
  border-radius: var(--radius-sm); cursor: pointer;
  font-size: 14.5px; font-weight: 500; text-align: left; white-space: nowrap;
  transition: background 0.2s var(--ease), color 0.2s var(--ease);
}
.nav-item:hover { background: var(--ink-fill); color: var(--ink); }
.nav-item.is-active { background: var(--ink-fill-2); color: var(--ink); font-weight: 600; }
.nav-ico { width: 19px; height: 19px; flex: none; }

.sidebar-bottom { display: flex; flex-direction: column; gap: 12px; }
.divider { height: 1px; background: var(--ink-line-2); }
.profile {
  display: flex; align-items: center; gap: 11px;
  padding: 8px 10px; border-radius: var(--radius-sm); cursor: pointer;
  transition: background 0.2s var(--ease);
}
.profile:hover { background: var(--ink-fill); }
.profile:hover .profile-out { opacity: 0.6; }
.avatar {
  width: 32px; height: 32px; border-radius: 50%; flex: none;
  background: var(--ink); color: var(--bg);
  display: grid; place-items: center;
  font-size: 13px; font-weight: 600; overflow: hidden;
  background-size: cover; background-position: center;
}
.profile-name {
  flex: 1; font-size: 14px; font-weight: 600; letter-spacing: -0.01em;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.profile-out { width: 17px; height: 17px; flex: none; color: var(--ink); opacity: 0; transition: opacity 0.2s var(--ease); }

/* ---------- mobile bar + drawer (hidden on desktop) ---------- */
.mobile-bar {
  display: none; align-items: center; gap: 12px;
  padding: 11px 14px; border-bottom: 1px solid var(--ink-line-2);
  position: sticky; top: 0; background: var(--bg); z-index: 40;
}
.hamburger {
  width: 40px; height: 40px; flex: none; border: none; background: transparent;
  color: var(--ink); border-radius: 10px; display: grid; place-items: center;
  cursor: pointer; transition: background 0.2s var(--ease);
}
.hamburger:hover { background: var(--ink-fill); }
.hamburger svg { width: 22px; height: 22px; }
.scrim {
  display: none; position: fixed; inset: 0;
  background: rgba(24, 42, 8, 0.45); z-index: 70;
  animation: fade-in 0.2s var(--ease);
}

/* ---------- content ---------- */
.content { flex: 1; min-width: 0; padding: 48px 56px; }
.page { display: none; max-width: 820px; }
.page.is-active { display: block; animation: page-in 0.45s var(--ease); }
.page[data-page="spytools"] { max-width: none; }
.page[data-page="violation"] { max-width: none; }
@keyframes page-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

.page-head { margin-bottom: 26px; }
.page-title { font-size: 28px; font-weight: 700; letter-spacing: -0.03em; margin: 0; }

.panel { display: flex; flex-direction: column; gap: 22px; }

/* Violation AI: legend sits to the right of the text field when there is room */
.va-layout { display: grid; grid-template-columns: 1fr; gap: 22px; align-items: start; }
.va-main { display: flex; flex-direction: column; gap: 22px; min-width: 0; }
@media (min-width: 1080px) {
  .va-layout { grid-template-columns: 1fr 1fr; }
  .va-aside { position: sticky; top: 24px; }
}

/* ---------- composer ---------- */
.composer {
  border: 1px solid var(--ink-line);
  border-radius: var(--radius);
  padding: 8px; background: var(--bg);
  box-shadow: var(--shadow);
  transition: border-color 0.2s var(--ease), box-shadow 0.2s var(--ease);
}
.composer:focus-within { border-color: rgba(24, 42, 8, 0.3); }
.script-input {
  width: 100%; border: none; resize: none; outline: none;
  background: transparent; color: var(--ink);
  font-size: 15.5px; line-height: 1.6; padding: 14px 14px 6px;
  min-height: 132px; max-height: 420px;
}
.script-input::placeholder { color: var(--ink-3); }
.composer-foot {
  display: flex; align-items: center; justify-content: space-between;
  padding: 6px 8px 6px 14px;
}
.char-count { font-size: 12.5px; color: var(--ink-3); font-variant-numeric: tabular-nums; }

/* ---------- analyzing ---------- */
.analyzing { animation: fade-in 0.4s var(--ease); }
.analyzing-num {
  display: flex; align-items: baseline; gap: 1px;
  font-size: 52px; font-weight: 700; letter-spacing: -0.04em;
  font-variant-numeric: tabular-nums; line-height: 1; margin-bottom: 16px;
}
.pct-sign { font-size: 26px; font-weight: 600; opacity: 0.5; }
.track {
  height: 10px; border-radius: 99px; background: var(--ink-fill-2);
  overflow: hidden;
}
.track-fill {
  height: 100%; width: 0%; border-radius: 99px; background: var(--ink);
  transition: width 0.25s var(--ease);
}
.shimmer { position: relative; overflow: hidden; }
.shimmer::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.35), transparent);
  transform: translateX(-100%);
  animation: shimmer 1.4s var(--ease) infinite;
}
@keyframes shimmer { to { transform: translateX(100%); } }

/* ---------- results ---------- */
.results { display: flex; flex-direction: column; gap: 18px; }
.r-anim { opacity: 0; transform: translateY(10px); animation: rise 0.5s var(--ease) forwards; }
@keyframes rise { to { opacity: 1; transform: none; } }

.risk {
  border: 1px solid var(--ink-line); border-radius: var(--radius);
  padding: 24px; box-shadow: var(--shadow);
}
.risk-top { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 16px; }
.risk-num {
  display: flex; align-items: baseline; gap: 2px;
  font-size: 52px; font-weight: 700; letter-spacing: -0.04em;
  font-variant-numeric: tabular-nums; line-height: 1;
}
.risk-num .pct-sign { font-size: 26px; }
.risk-label { font-size: 13px; font-weight: 600; color: var(--ink-2); text-transform: uppercase; letter-spacing: 0.06em; }
.risk .track-fill { transition: width 1s var(--ease); }

.section-label {
  font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.07em;
  color: var(--ink-3); margin: 4px 2px 0;
}

.v-card {
  border: 1px solid var(--ink-line); border-radius: var(--radius);
  padding: 18px 20px; background: var(--bg);
}
.v-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
.v-type { font-size: 15px; font-weight: 600; letter-spacing: -0.01em; }
.sev { display: flex; gap: 3px; align-items: center; }
.sev-seg { width: 14px; height: 5px; border-radius: 99px; background: var(--ink-line); }
.sev-seg.on { background: var(--ink); }
.v-quote {
  font-size: 14.5px; line-height: 1.6; color: var(--ink);
  padding: 10px 14px; border-left: 2px solid var(--ink);
  background: var(--ink-fill); border-radius: 0 8px 8px 0; margin: 0 0 10px;
}
.v-ref { font-size: 13.5px; line-height: 1.55; color: var(--ink-2); margin: 0; }

.reco {
  border: 1px solid var(--ink-line); border-radius: var(--radius);
  padding: 18px 20px; background: var(--ink-fill);
}
.reco-text { font-size: 14.5px; line-height: 1.6; margin: 8px 0 0; color: var(--ink); }

.clear-state {
  display: flex; align-items: center; gap: 14px;
  border: 1px solid var(--ink-line); border-radius: var(--radius);
  padding: 22px 24px; box-shadow: var(--shadow);
}
.clear-check {
  width: 40px; height: 40px; border-radius: 50%; flex: none;
  border: 2px solid var(--ink); display: grid; place-items: center;
}
.clear-check svg { width: 20px; height: 20px; }
.clear-title { font-size: 16px; font-weight: 600; margin: 0; }

/* ---------- info card (what you get) ---------- */
.info-card { background: var(--ink-fill); border-radius: var(--radius); padding: 18px 22px; }
.info-title { font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.07em; color: var(--ink-3); margin: 0 0 14px; }
.info-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 11px; }
.info-list li { display: flex; align-items: center; gap: 11px; font-size: 14.5px; color: var(--ink); }
.info-list svg { width: 18px; height: 18px; flex: none; color: var(--ink); }

/* ---------- risk legend ---------- */
.legend-list { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; }
.legend-row { display: flex; align-items: center; gap: 16px; padding: 13px 18px; border-radius: var(--radius-sm); }
.legend-range { flex: none; width: 70px; font-weight: 700; font-size: 13.5px; color: var(--ink); font-variant-numeric: tabular-nums; }
.legend-desc { font-size: 13.5px; line-height: 1.45; color: var(--ink-2); }
.legend-row:nth-child(1) { background: rgba(24, 42, 8, 0.03); }
.legend-row:nth-child(2) { background: rgba(24, 42, 8, 0.05); }
.legend-row:nth-child(3) { background: rgba(24, 42, 8, 0.07); }
.legend-row:nth-child(4) { background: rgba(24, 42, 8, 0.10); }
.legend-row:nth-child(5) { background: rgba(24, 42, 8, 0.13); }
.legend-row:nth-child(6) { background: rgba(24, 42, 8, 0.16); }
.legend-row:nth-child(7) { background: rgba(24, 42, 8, 0.20); }

/* ---------- history ---------- */
.history { display: flex; flex-direction: column; gap: 12px; }
.history-head { display: flex; align-items: center; justify-content: space-between; }
.history-clear {
  border: none; background: transparent; color: var(--ink-3);
  font-size: 12.5px; font-weight: 600; cursor: pointer;
  padding: 4px 10px; border-radius: 8px;
  transition: background 0.2s var(--ease), color 0.2s var(--ease);
}
.history-clear:hover { background: var(--ink-fill); color: var(--ink); }
.history-list { display: flex; flex-direction: column; gap: 8px; }
.hist-row {
  display: flex; align-items: center; gap: 14px; width: 100%; text-align: left;
  border: 1px solid var(--ink-line); background: var(--bg);
  border-radius: var(--radius-sm); padding: 13px 16px; cursor: pointer;
  transition: background 0.2s var(--ease), border-color 0.2s var(--ease);
}
.hist-row:hover { background: var(--ink-fill); border-color: rgba(24, 42, 8, 0.2); }
.hist-pct { flex: none; width: 50px; font-weight: 700; font-size: 17px; color: var(--ink); font-variant-numeric: tabular-nums; }
.hist-pct-sign { font-size: 11px; font-weight: 600; opacity: 0.5; margin-left: 1px; }
.hist-script { flex: 1; min-width: 0; font-size: 13.5px; color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hist-time { flex: none; font-size: 12px; color: var(--ink-3); white-space: nowrap; }

/* ---------- disclaimer ---------- */
.disclaimer { font-size: 12.5px; line-height: 1.55; color: var(--ink-3); text-align: left; font-style: italic; margin: 0; }

/* ---------- empty (spytools) ---------- */
.empty {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 16px; padding: 90px 0; color: var(--ink-3);
}
.empty-mark { width: 30px; height: 30px; border-radius: 9px; background: var(--ink-fill-2); }
.empty-text { font-size: 14px; font-weight: 500; margin: 0; }

@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }

/* ---------- spytools ---------- */
.hidden { display: none !important; }

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

.lang-toggle { display: inline-flex; border: 1px solid var(--ink-line); border-radius: 9px; overflow: hidden; }
.lang-btn {
  padding: 6px 13px; border: none; background: var(--bg); color: var(--ink-2);
  font-size: 12.5px; font-weight: 600; cursor: pointer;
  transition: background 0.2s var(--ease), color 0.2s var(--ease);
}
.lang-btn:hover { background: var(--ink-fill); }
.lang-btn.is-active { background: var(--ink); color: var(--bg); }

.st-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.st-tools { margin-top: 20px; }

.card {
  border: 1px solid var(--ink-line); border-radius: var(--radius);
  padding: 22px; background: var(--bg); box-shadow: var(--shadow);
}
.card-head { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; }
.card-ico {
  width: 38px; height: 38px; border-radius: 50%; flex: none;
  background: var(--ink-fill-2); display: grid; place-items: center; color: var(--ink);
}
.card-ico svg { width: 19px; height: 19px; }
.card-title { font-size: 16px; font-weight: 600; letter-spacing: -0.01em; margin: 0; }

.steps { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 16px; }
.step { display: flex; gap: 12px; }
.step-num {
  width: 24px; height: 24px; flex: none; border-radius: 50%;
  background: var(--ink-fill-2); color: var(--ink);
  display: grid; place-items: center; font-size: 12px; font-weight: 600;
}
.step-body { font-size: 14px; line-height: 1.55; color: var(--ink-2); padding-top: 1px; }
.link { color: var(--ink); font-weight: 500; text-decoration: none; border-bottom: 1px solid var(--ink-line); }
.link:hover { border-bottom-color: var(--ink); }
#faq-open { margin-top: 24px; }

.cred-box {
  background: var(--ink-fill); border: 1px solid var(--ink-line-2);
  border-radius: var(--radius-sm); padding: 12px 14px; margin-top: 10px;
}
.cred-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.cred-key { font-size: 13.5px; font-weight: 600; color: var(--ink); }
.cred-val { font-size: 13.5px; color: var(--ink-2); word-break: break-all; }
.cred-val.pw { letter-spacing: 0.02em; }
.blur-pw { filter: blur(5px); user-select: none; }

.icon-btn {
  width: 30px; height: 30px; flex: none; margin-left: auto;
  border: none; background: transparent; color: var(--ink-3);
  border-radius: 8px; cursor: pointer; display: grid; place-items: center;
  transition: background 0.2s var(--ease), color 0.2s var(--ease);
}
.icon-btn:hover { background: var(--ink-fill-2); color: var(--ink); }
.icon-btn svg { width: 16px; height: 16px; }
.icon-btn .ico-check { display: none; }
.icon-btn.copied { color: var(--ink); }
.icon-btn.copied .ico-copy { display: none; }
.icon-btn.copied .ico-check { display: block; }

.tool-badge {
  width: 38px; height: 38px; border-radius: 50%; flex: none;
  background: var(--ink-fill-2); color: var(--ink);
  display: grid; place-items: center; font-size: 14px; font-weight: 700;
}
.tool-card .btn-block { margin-top: 16px; }

.video {
  position: relative; width: 100%; aspect-ratio: 16 / 9;
  border-radius: var(--radius-sm); overflow: hidden; border: 1px solid var(--ink-line);
}
.video iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }

/* modals */
.modal {
  position: fixed; inset: 0; z-index: 60;
  background: rgba(24, 42, 8, 0.45);
  display: flex; align-items: center; justify-content: center; padding: 20px;
  animation: fade-in 0.2s var(--ease);
}
.modal-box {
  background: var(--bg); border: 1px solid var(--ink-line); border-radius: var(--radius);
  padding: 24px; max-width: 460px; width: 100%;
  box-shadow: 0 24px 70px rgba(24, 42, 8, 0.22);
  animation: modal-in 0.28s var(--ease);
}
@keyframes modal-in { from { opacity: 0; transform: translateY(10px) scale(0.98); } to { opacity: 1; transform: none; } }
.modal-head { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.modal-ico {
  width: 40px; height: 40px; border-radius: 50%; flex: none;
  background: var(--ink-fill-2); display: grid; place-items: center; color: var(--ink);
}
.modal-ico svg { width: 20px; height: 20px; }
.modal-title { font-size: 16px; font-weight: 600; margin: 0; }
.modal-text { font-size: 14px; line-height: 1.6; color: var(--ink-2); margin: 0 0 14px; }
.modal-note {
  background: var(--ink-fill); border-left: 2px solid var(--ink);
  border-radius: 0 8px 8px 0; padding: 12px 14px; margin-bottom: 18px;
}
.modal-note p { margin: 0; font-size: 13.5px; line-height: 1.55; font-weight: 500; color: var(--ink); }
.faq-q { font-size: 14px; font-weight: 600; color: var(--ink); margin: 0 0 8px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; }
.btn-ghost { background: transparent; border: 1px solid var(--ink-line); color: var(--ink); }
.btn-ghost:hover:not(:disabled) { background: var(--ink-fill); }

/* ---------- responsive ---------- */
/* Stack the Spytools panels before two columns get cramped */
@media (max-width: 980px) {
  .st-grid { grid-template-columns: 1fr; }
}

/* Mobile: sidebar becomes a slide-in drawer opened from the header */
@media (max-width: 720px) {
  .app { flex-direction: column; }
  .mobile-bar { display: flex; }
  .sidebar {
    position: fixed; top: 0; left: 0; height: 100vh; width: 268px;
    transform: translateX(-100%);
    transition: transform 0.3s var(--ease);
    z-index: 80; border-right: 1px solid var(--ink-line-2);
    box-shadow: 0 0 50px rgba(24, 42, 8, 0.16);
  }
  .app.nav-open .sidebar { transform: none; }
  .app.nav-open .scrim { display: block; }
  .content { padding: 22px 18px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::after { animation: none !important; transition: none !important; }
}
