/* KiDraht Radar — glass pastel (02 UI/UX BLUEPRINT). Palette proposals: navy #172A38, petrol #245563,
   mist #EFF4F2, teal #58AEB0, peach #F4C9B7, sand #F2EBDD, mint #B4D9C8. */
:root {
  --navy: #172a38; --petrol: #245563; --mist: #eff4f2; --teal: #58aeb0; --peach: #f4c9b7; --sand: #f2ebdd; --mint: #b4d9c8;
  --bg: var(--mist); --ink: #152633; --ink-2: #3f5866; --ink-3: #5f7681;
  --glass: rgba(255, 255, 255, .62); --glass-line: rgba(255, 255, 255, .78); --glass-edge: rgba(23, 42, 56, .10);
  --field: rgba(255, 255, 255, .78); --field-line: rgba(23, 42, 56, .16);
  --accent: #23807f; --accent-ink: #fff; --ok: #2c7a5c; --warn: #9a4a2c; --warn-bg: rgba(244, 201, 183, .55);
  --shadow: 0 24px 60px -24px rgba(23, 42, 56, .35), 0 2px 6px rgba(23, 42, 56, .06);
  --radius: 22px; --blur: 18px;
  color-scheme: light;
}
:root[data-theme="night"] {
  --bg: #0f1d27; --ink: #eef4f2; --ink-2: #c3d3d6; --ink-3: #93a9b0;
  --glass: rgba(23, 42, 56, .58); --glass-line: rgba(180, 217, 200, .18); --glass-edge: rgba(0, 0, 0, .35);
  --field: rgba(15, 29, 39, .62); --field-line: rgba(180, 217, 200, .22);
  --accent: #58aeb0; --accent-ink: #0f1d27; --ok: #b4d9c8; --warn: #f4c9b7; --warn-bg: rgba(244, 201, 183, .14);
  --shadow: 0 30px 70px -26px rgba(0, 0, 0, .7), 0 1px 0 rgba(255, 255, 255, .04) inset;
  color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; height: 100%; }
body {
  font: 15px/1.5 Manrope, "Segoe UI", system-ui, -apple-system, sans-serif;
  color: var(--ink); background: var(--bg); -webkit-font-smoothing: antialiased; overflow-x: hidden;
}
button, input, select { font: inherit; color: inherit; }
.num { font-variant-numeric: tabular-nums; }

/* ---------- scene: photo slot + neutral fallback (no text in imagery) ---------- */
.scene { position: fixed; inset: 0; z-index: 0; overflow: hidden;
  background:
    radial-gradient(120% 90% at 78% 30%, rgba(244, 201, 183, .75), transparent 55%),
    radial-gradient(90% 80% at 95% 85%, rgba(180, 217, 200, .7), transparent 60%),
    linear-gradient(160deg, #f6f1e8 0%, #e6efec 45%, #cfe3df 100%); }
:root[data-theme="night"] .scene { background:
    radial-gradient(70% 60% at 78% 34%, rgba(244, 201, 183, .20), transparent 60%),
    radial-gradient(90% 80% at 90% 90%, rgba(88, 174, 176, .26), transparent 60%),
    linear-gradient(165deg, #0c1720 0%, #172a38 50%, #1d3e4a 100%); }
.scene-photo { position: absolute; inset: 0; background-size: cover; background-position: 62% center; opacity: 0; transition: opacity .9s ease; }
.scene-photo.on { opacity: 1; }
.ripples { position: absolute; right: 18%; top: 62%; width: 0; height: 0; }
.ripples i { position: absolute; left: 50%; top: 50%; width: 560px; height: 560px; margin: -280px 0 0 -280px; border-radius: 50%;
  border: 1px solid rgba(35, 128, 127, .22); transform: scale(.2); opacity: 0; animation: ripple 9s cubic-bezier(.2, .6, .3, 1) infinite; }
.ripples i:nth-child(2) { animation-delay: 3s; } .ripples i:nth-child(3) { animation-delay: 6s; }
:root[data-theme="night"] .ripples i { border-color: rgba(88, 174, 176, .30); }
body.has-photo .ripples { display: none; }
@keyframes ripple { 0% { transform: scale(.15); opacity: 0; } 15% { opacity: .9; } 100% { transform: scale(1.15); opacity: 0; } }

/* ---------- top bar (scrolls away, compact) ---------- */
.bar { position: relative; z-index: 2; display: flex; align-items: center; justify-content: space-between; padding: 18px clamp(16px, 4vw, 48px); }
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; letter-spacing: .01em; font-size: 16px; }
.brand img { border-radius: 8px; display: block; }
body.has-photo .brand, body.has-photo .icon-btn { text-shadow: 0 1px 10px rgba(255, 255, 255, .7); }
:root[data-theme="night"] body.has-photo .brand, :root[data-theme="night"] body.has-photo .icon-btn { text-shadow: 0 1px 10px rgba(0, 0, 0, .6); }
body.has-photo .icon-btn { background: color-mix(in srgb, var(--glass) 70%, transparent); }
.brand b { font-weight: 700; }
.bar-tools { display: flex; gap: 6px; }
.icon-btn { min-width: 44px; height: 44px; padding: 0 10px; border: 0; border-radius: 999px; background: transparent; color: var(--ink-2);
  font-size: 12px; font-weight: 700; letter-spacing: .08em; cursor: pointer; display: inline-grid; place-items: center; }
.icon-btn:hover { color: var(--ink); background: var(--glass); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---------- stage + glass card in the calm 40% zone ---------- */
.stage { position: relative; z-index: 1; min-height: calc(100dvh - 80px); display: flex; align-items: center; padding: 8px clamp(16px, 6vw, 96px) 40px; }
.card { width: min(460px, 100%); background: var(--glass); border: 1px solid var(--glass-line); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 28px 28px 24px; backdrop-filter: blur(var(--blur)) saturate(1.2); -webkit-backdrop-filter: blur(var(--blur)) saturate(1.2);
  animation: rise .45s ease both; }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } }

.eyebrow { display: flex; align-items: center; gap: 8px; margin: 0 0 10px; font-size: 11px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: var(--ink-3); }
.dots { display: inline-flex; gap: 5px; }
.dots i { width: 6px; height: 6px; border-radius: 50%; background: var(--field-line); }
.dots i.on { background: var(--accent); width: 18px; border-radius: 6px; }
h1 { margin: 0 0 6px; font-size: clamp(24px, 3.2vw, 30px); line-height: 1.15; letter-spacing: -.015em; font-weight: 700; }
.lead { margin: 0 0 20px; color: var(--ink-2); }

label.field { display: block; margin: 0 0 12px; }
label.field > span { display: block; font-size: 12px; font-weight: 600; color: var(--ink-2); margin: 0 0 6px; }
.input { width: 100%; height: 48px; padding: 0 14px; border-radius: 14px; border: 1px solid var(--field-line); background: var(--field); outline: none; transition: border-color .2s, box-shadow .2s; }
.input:focus { border-color: var(--accent); box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 18%, transparent); }
select.input { appearance: none; background-image: linear-gradient(45deg, transparent 50%, currentColor 50%), linear-gradient(135deg, currentColor 50%, transparent 50%);
  background-position: calc(100% - 20px) 21px, calc(100% - 15px) 21px; background-size: 5px 5px; background-repeat: no-repeat; }

.btn { height: 48px; padding: 0 20px; border-radius: 999px; border: 0; background: var(--accent); color: var(--accent-ink); font-weight: 700; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; transition: transform .15s, filter .2s; }
.btn:hover { filter: brightness(1.06); } .btn:active { transform: translateY(1px); }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.btn.ghost { background: transparent; color: var(--ink-2); padding: 0 12px; text-decoration: none; }
.row { display: flex; gap: 10px; align-items: center; }
.row.end { justify-content: space-between; margin-top: 18px; }
.row .input { flex: 1; }

.msg { margin: 10px 0 0; font-size: 13px; color: var(--warn); }
.msg:empty { display: none; }
.hint { font-size: 12px; color: var(--ink-3); margin: 10px 0 0; }

/* identity fields with evidence */
.facts { display: grid; gap: 8px; margin: 0 0 6px; }
.fact { display: grid; grid-template-columns: 22px 1fr; gap: 10px; align-items: start; padding: 10px 12px; border-radius: 14px; background: var(--field); border: 1px solid var(--field-line); }
.fact svg { margin-top: 3px; color: var(--ink-3); }
.fact .k { font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-3); }
.fact input { width: 100%; border: 0; background: transparent; padding: 0; height: 24px; outline: none; font-weight: 600; }
.fact .src { font-size: 11px; color: var(--ink-3); }
.fact .src.owner { color: var(--accent); }
.fact.missing { border-style: dashed; border-color: color-mix(in srgb, var(--warn) 55%, transparent); }
.fact.missing .src { color: var(--warn); font-weight: 700; letter-spacing: .04em; text-transform: uppercase; }

.fact-select { width: 100%; height: 26px; border: 0; background: transparent; padding: 0; font-weight: 600; outline: none; }
.fact-select option { color: #152633; }
.comps { margin-top: 16px; }
.pills { display: flex; flex-wrap: wrap; gap: 6px; margin: 12px 0 0; }
.pill { display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 12px; border-radius: 999px; background: var(--field); border: 1px solid var(--field-line); font-size: 13px; font-weight: 700; }
.pill svg { color: var(--accent); }
.comp-form { display: grid; grid-template-columns: 1fr 1fr auto; gap: 8px; }
@media (max-width: 720px) { .comp-form { grid-template-columns: 1fr auto; } .comp-form .input:first-child { grid-column: 1 / -1; } }
.btn.sm { padding: 0 14px; }

/* module toggles */
.mods { display: grid; gap: 8px; }
.mod { display: grid; grid-template-columns: 36px 1fr auto; gap: 12px; align-items: center; padding: 12px; border-radius: 16px; background: var(--field); border: 1px solid var(--field-line); }
.mod .ic { width: 36px; height: 36px; border-radius: 12px; display: grid; place-items: center; background: color-mix(in srgb, var(--accent) 14%, transparent); color: var(--accent); }
.mod b { display: block; font-size: 14px; }
.mod small { display: block; color: var(--ink-3); font-size: 12px; line-height: 1.35; }
.switch { position: relative; width: 46px; height: 28px; flex: none; }
.switch input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; }
.switch span { position: absolute; inset: 0; border-radius: 999px; background: var(--field-line); transition: background .2s; pointer-events: none; }
.switch span::after { content: ""; position: absolute; left: 3px; top: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .25); transition: transform .2s; }
.switch input:checked + span { background: var(--accent); }
.switch input:checked + span::after { transform: translateX(18px); }
.switch input:disabled + span { opacity: .45; }
.tag { font-size: 11px; font-weight: 700; color: var(--ink-3); }

/* competitors */
.list { display: grid; gap: 6px; margin: 0 0 10px; padding: 0; list-style: none; }
.list li { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 12px; border-radius: 12px; background: var(--field); border: 1px solid var(--field-line); font-size: 14px; }
.list li small { color: var(--ink-3); }
.chip { font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 999px; background: color-mix(in srgb, var(--accent) 16%, transparent); color: var(--accent); }
.chip.wait { background: var(--warn-bg); color: var(--warn); }
.mini { height: 32px; min-width: 32px; padding: 0 8px; border-radius: 10px; border: 0; background: transparent; color: var(--ink-2); cursor: pointer; }
.mini:hover { background: var(--glass); color: var(--ink); }

/* risks — big letters (owner principle) */
.risks { margin: 16px 0 0; padding: 14px 16px; border-radius: 16px; background: var(--warn-bg); color: var(--ink); }
.risks h2 { margin: 0 0 8px; font-size: 13px; letter-spacing: .12em; text-transform: uppercase; color: var(--warn); }
.risks ul { margin: 0; padding-left: 18px; font-size: 13px; font-weight: 700; letter-spacing: .01em; text-transform: uppercase; line-height: 1.45; }
.status { display: flex; align-items: center; gap: 8px; font-weight: 700; }
.status i { width: 10px; height: 10px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 0 4px color-mix(in srgb, var(--ok) 22%, transparent); }
.badge-test { display: inline-block; margin-left: 6px; padding: 2px 8px; border-radius: 6px; background: var(--peach); color: var(--navy); font-size: 11px; font-weight: 800; letter-spacing: .1em; }

/* ---------- phone: scene on top, card in the calm lower 45% ---------- */
@media (max-width: 720px) {
  body { font-size: 14px; }
  .bar { padding: 10px 12px; }
  .brand { font-size: 15px; }
  .stage { align-items: flex-end; min-height: calc(100dvh - 64px); padding: 0 10px calc(10px + env(safe-area-inset-bottom)); }
  .card { padding: 18px 16px 14px; border-radius: 20px; --blur: 8px; }
  h1 { font-size: 21px; }
  .lead { margin-bottom: 14px; }
  .ripples { right: 50%; top: 26%; }
  .ripples i { width: 380px; height: 380px; margin: -190px 0 0 -190px; }
  .btn { height: 44px; padding: 0 16px; }
  .input { height: 44px; }
  .mod { padding: 10px; gap: 10px; }
  .facts { gap: 6px; }
  .lead.opt { display: none; }
  h1 + .mods { margin-top: 12px; }
  .mods { gap: 6px; }
  .list li { padding: 6px 10px; }
  .comps { margin-top: 12px; }
  .row.end { margin-top: 12px; }
  .fact { padding: 8px 10px; gap: 8px; }
  .fact input, .fact-select { height: 22px; }
  .risks ul { font-size: 12px; }
}
@media (max-width: 360px) { .card { padding: 16px 12px 12px; } .row.url { flex-wrap: wrap; } .row.url .btn { width: 100%; } }
@media (prefers-reduced-motion: reduce) { .ripples i, .card { animation: none; } .ripples i:first-child { opacity: .6; transform: scale(.7); } .scene-photo { transition: none; } }

/* M2: change list with evidence trace */
.changes { margin: 14px 0 0; }
.changes-list li.change, .changes-list li.source { display: grid; gap: 4px; align-items: start; justify-content: stretch; }
.change-head { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; min-width: 0; }
.change-head strong { font-size: 14px; overflow-wrap: anywhere; }
.change-val { font-size: 14px; color: var(--ink-2, var(--ink)); }
.change-ev { font-size: 12px; color: var(--ink-3); overflow-wrap: anywhere; }
.change-ev a { color: var(--accent); text-decoration: underline; text-underline-offset: 2px; }
/* M4 source readiness */
.chip.ok { background: color-mix(in srgb, var(--ok) 18%, transparent); color: var(--ok); }
.chip.miss { background: transparent; color: var(--ink-3); border: 1px solid var(--field-line); font-weight: 600; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.source .row { margin-top: 8px; gap: 8px; }
.source .btn { min-height: 36px; padding: 6px 12px; font-size: 13px; }
.source .btn[disabled] { opacity: .45; cursor: not-allowed; }
.source .hint { margin: 0; font-size: 12px; }
