/* Edge Lab - premium dark research terminal. Dark is primary; light follows the iPhone setting. */
:root {
  --bg: #0b0d10; --bg2: #12161b; --card: #161b22; --line: #232a33; --slate: #2b333d;
  --text: #eef1f4; --muted: #9aa4b1; --faint: #6b7583;
  --pos: #3fae7f; --neg: #d1605a; --warn: #d6a640; --res: #7f8cf0; --res2: #a58cf0;
  --pos-bg: rgba(63, 174, 127, .12); --neg-bg: rgba(209, 96, 90, .12); --warn-bg: rgba(214, 166, 64, .12);
  --res-bg: rgba(127, 140, 240, .12);
  --r: 14px; --tap: 44px;
  --sat: env(safe-area-inset-top, 0px); --sab: env(safe-area-inset-bottom, 0px);
  --sal: env(safe-area-inset-left, 0px); --sar: env(safe-area-inset-right, 0px);
}
/* V2.6 theme system: SYSTEM (default) follows iOS; LIGHT / DARK are explicit choices saved on the phone */
:root[data-theme="light"] {
  --bg: #eef0f3; --bg2: #f7f8fa; --card: #fbfbfc; --line: #dde1e6; --slate: #d3d9df;
  --text: #15191e; --muted: #536070; --faint: #737e8c;
  --pos: #1f8a5c; --neg: #b7443e; --warn: #9a7110; --res: #4f5bd5; --res2: #7a5bd5;
  --pos-bg: rgba(31, 138, 92, .12); --neg-bg: rgba(183, 68, 62, .12); --warn-bg: rgba(154, 113, 16, .14);
  --res-bg: rgba(79, 91, 213, .12);
}
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    --bg: #eef0f3; --bg2: #f7f8fa; --card: #fbfbfc; --line: #dde1e6; --slate: #d3d9df;
    --text: #12161b; --muted: #556170; --faint: #7a8594;
    --pos: #1f8a5c; --neg: #b7443e; --warn: #a57a12; --res: #4f5bd5; --res2: #7a5bd5;
  }
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--bg); color: var(--text);
  font: 15px/1.4 -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, sans-serif;
  -webkit-text-size-adjust: 100%; }
body { padding: calc(var(--sat) + 0px) var(--sar) calc(var(--sab) + 72px) var(--sal); min-height: 100vh; }
header#top { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; justify-content: space-between;
  gap: 8px; padding: calc(var(--sat) + 10px) 16px 10px; margin-top: calc(-1 * var(--sat));
  background: color-mix(in srgb, var(--bg) 92%, transparent); backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px); border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 8px; font-weight: 650; letter-spacing: .2px; }
.logo { width: 26px; height: 26px; border-radius: 7px; flex: none; display: block; box-shadow: 0 0 0 1px var(--line); }
.brand span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.offline-brand { margin: 8px 0 12px; }
.mode { display: flex; gap: 4px; flex-wrap: wrap; justify-content: flex-end; }
.pill { font-size: 10.5px; font-weight: 700; letter-spacing: .4px; padding: 3px 7px; border-radius: 999px; }
.pill.paper { background: var(--pos-bg); color: var(--pos); }
.pill.research { background: var(--res-bg); color: var(--res); }
.pill.lock { background: var(--neg-bg); color: var(--neg); }
.banner { margin: 10px 16px 0; padding: 10px 12px; border-radius: 10px; font-size: 13.5px; }
.banner.warn { background: var(--warn-bg); color: var(--warn); }
.banner.info { background: var(--res-bg); color: var(--res); display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.hidden { display: none !important; }
.fresh { display: flex; align-items: center; gap: 8px; padding: 8px 16px 0; color: var(--muted); font-size: 12.5px; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--faint); flex: none; }
.dot.live { background: var(--pos); } .dot.stale { background: var(--warn); } .dot.off { background: var(--neg); }
#refresh { margin-left: auto; }
main { padding: 8px 16px 16px; }
h1 { font-size: 22px; margin: 10px 0 4px; letter-spacing: -.2px; }
h2 { font-size: 13px; margin: 18px 0 8px; color: var(--muted); text-transform: uppercase; letter-spacing: .7px; font-weight: 650; }
p.sub { margin: 0 0 10px; color: var(--muted); font-size: 13.5px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 12px 14px; margin: 8px 0; }
.card.mission { background: linear-gradient(160deg, var(--card), var(--bg2)); }
.mission .m { font-size: 15.5px; font-weight: 600; }
.mission .t { color: var(--muted); font-size: 12.5px; margin-top: 4px; }
.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.kpi { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; min-width: 0; }
.kpi .l { color: var(--muted); font-size: 11.5px; text-transform: uppercase; letter-spacing: .5px; }
.kpi .v { font-size: 19px; font-weight: 650; margin-top: 2px; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.pos { color: var(--pos); } .neg { color: var(--neg); } .warn { color: var(--warn); } .res { color: var(--res); } .muted { color: var(--muted); }
.row { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; padding: 7px 0; border-top: 1px solid var(--line); }
.row:first-child { border-top: 0; }
.row .k { color: var(--muted); font-size: 13.5px; flex: 1 1 auto; min-width: 0; }
.row .v { font-variant-numeric: tabular-nums; text-align: right; font-size: 14px; overflow-wrap: anywhere; }
.tag { display: inline-block; font-size: 10.5px; font-weight: 700; letter-spacing: .4px; padding: 3px 7px; border-radius: 6px;
  background: var(--slate); color: var(--text); white-space: nowrap; }
.tag.VALIDATED, .tag.LIVE, .tag.OK, .tag.ON, .tag.RUNNING, .tag.CONNECTED { background: var(--pos-bg); color: var(--pos); }
.tag.REJECTED, .tag.DEGRADED, .tag.OFFLINE, .tag.THROTTLED, .tag.OFF, .tag.LOCKED, .tag.DISABLED { background: var(--neg-bg); color: var(--neg); }
.tag.PROMISING, .tag.HOLDOUT, .tag.VALIDATION, .tag.WATCH, .tag.STALE, .tag.CHECK, .tag.SLOW, .tag.WEAKENING { background: var(--warn-bg); color: var(--warn); }
.tag.RESEARCH, .tag.UNVALIDATED, .tag.COLLECTING, .tag.INSUFFICIENT { background: var(--res-bg); color: var(--res); }
.item { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 11px 12px; margin: 8px 0; }
.item .h { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.item .t { font-weight: 600; font-size: 14.5px; overflow-wrap: anywhere; }
.item .why { color: var(--muted); font-size: 13px; margin-top: 6px; }
.item .nums { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin-top: 8px; font-size: 12.5px; }
.item .nums div { min-width: 0; } .item .nums b { display: block; font-size: 14px; font-variant-numeric: tabular-nums; }
.item .nums span { color: var(--faint); font-size: 11px; }
details { margin-top: 6px; } summary { color: var(--res); font-size: 13px; cursor: pointer; min-height: 32px; display: flex; align-items: center; }
.seg { display: flex; gap: 6px; overflow-x: auto; padding: 4px 0 8px; scrollbar-width: none; }
.seg::-webkit-scrollbar { display: none; }
.seg button { flex: none; }
button, .btn { min-height: var(--tap); padding: 0 14px; border-radius: 10px; border: 1px solid var(--line); background: var(--bg2);
  color: var(--text); font: inherit; font-weight: 600; }
button.on { background: var(--res-bg); color: var(--res); border-color: transparent; }
button.ghost { min-height: 32px; padding: 0 10px; font-size: 12.5px; background: transparent; }
input[type=password] { width: 100%; min-height: var(--tap); border-radius: 10px; border: 1px solid var(--line); background: var(--bg2);
  color: var(--text); padding: 0 12px; font: inherit; }
.toggle { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 10px 0; border-top: 1px solid var(--line); }
.toggle:first-child { border-top: 0; }
.menu a { display: flex; justify-content: space-between; align-items: center; min-height: 52px; padding: 0 4px;
  color: var(--text); text-decoration: none; border-top: 1px solid var(--line); font-weight: 550; }
.menu a:first-child { border-top: 0; } .menu a::after { content: "›"; color: var(--faint); font-size: 20px; }
nav#tabs { position: fixed; left: 0; right: 0; bottom: 0; z-index: 6; display: grid; grid-template-columns: repeat(6, 1fr);
  padding: 6px max(6px, var(--sal)) calc(6px + var(--sab)) max(6px, var(--sar)); border-top: 1px solid var(--line);
  background: color-mix(in srgb, var(--bg) 94%, transparent); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); }
nav#tabs a { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; min-height: 48px;
  color: var(--faint); text-decoration: none; font-size: 10px; font-weight: 600; white-space: nowrap; }
nav#tabs a.on { color: var(--res); }
.ic { width: 22px; height: 22px; display: block; background: currentColor; -webkit-mask: var(--m) center/contain no-repeat; mask: var(--m) center/contain no-repeat; }
.ic.home { --m: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M3 11l9-7 9 7v9a1 1 0 0 1-1 1h-5v-6h-6v6H4a1 1 0 0 1-1-1z'/%3E%3C/svg%3E"); }
.ic.opp { --m: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M4 6h16v2H4zm0 5h16v2H4zm0 5h10v2H4z'/%3E%3C/svg%3E"); }
.ic.board { --m: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M4 20V10h3v10zm6.5 0V4h3v16zM17 20v-7h3v7z'/%3E%3C/svg%3E"); }
.ic.perp { --m: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M3 17l5-6 4 3 6-8 3 2-8 11-4-3-4 5z'/%3E%3C/svg%3E"); }
.ic.more { --m: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Ccircle cx='5' cy='12' r='2'/%3E%3Ccircle cx='12' cy='12' r='2'/%3E%3Ccircle cx='19' cy='12' r='2'/%3E%3C/svg%3E"); }
.signature { text-align: center; color: var(--faint); font-size: 12px; letter-spacing: 1.5px; margin: 26px 0 8px; }
.note { color: var(--faint); font-size: 12px; margin-top: 8px; }
.stale-view main, .stale-view .item, .stale-view .card { opacity: .62; }
.ic.guess { --m: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 2a10 10 0 1 0 0 20 10 10 0 0 0 0-20zm0 4a6 6 0 1 1 0 12 6 6 0 0 1 0-12zm0 3a3 3 0 1 0 0 6 3 3 0 0 0 0-6z'/%3E%3C/svg%3E"); }
/* V2.5 */
.light { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 6px; vertical-align: middle; }
.light.GREEN { background: var(--pos); } .light.YELLOW { background: var(--warn); } .light.RED { background: var(--neg); }
.tag.GREEN, .tag.SHADOW { background: var(--pos-bg); color: var(--pos); }
.tag.YELLOW, .tag.DELAYED, .tag.IDEA, .tag.NEUTRAL { background: var(--warn-bg); color: var(--warn); }
.tag.RED, .tag.RETIRED, .tag.BROKEN, .tag.LIVE.BLOCKED, .tag.BLOCKED, .tag.UNAUTHORIZED { background: var(--neg-bg); color: var(--neg); }
.tag.SIMULATED, .tag.HISTORICAL, .tag.CANARY, .tag.NOT, .tag.NONE { background: var(--res-bg); color: var(--res); }
.ocard { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 12px 14px; margin: 8px 0; }
.ocard .top { display: flex; justify-content: space-between; align-items: center; gap: 8px; font-weight: 700; letter-spacing: .3px; }
.ocard .act { font-size: 18px; font-weight: 700; margin: 6px 0 2px; }
textarea, input[type=search] { width: 100%; min-height: var(--tap); border-radius: 10px; border: 1px solid var(--line);
  background: var(--bg2); color: var(--text); padding: 10px 12px; font: inherit; }
textarea { min-height: 80px; }
.big { font-size: 20px; font-weight: 700; }
.linkitem { display: block; color: inherit; text-decoration: none; }
pre.raw { white-space: pre-wrap; overflow-wrap: anywhere; font-size: 11.5px; margin: 0; }
.row .k { overflow-wrap: anywhere; min-width: 5.5em; }
/* V2.6: density (layout only) */
:root[data-density="compact"] body { font-size: 14px; }
:root[data-density="compact"] .card, :root[data-density="compact"] .item { padding: 8px 10px; margin: 6px 0; }
:root[data-density="compact"] .row { padding: 4px 0; }
:root[data-density="compact"] h2 { margin: 12px 0 6px; }
/* V2.6: Best Guess - calm, large, beginner-first */
.bg-card { background: var(--card); border: 1px solid var(--line); border-radius: 18px; padding: 16px; margin: 12px 0; }
.bg-card .top { display: flex; justify-content: space-between; align-items: center; font-weight: 700; letter-spacing: .4px; }
.bg-card .layer { padding: 12px 0; border-top: 1px solid var(--line); }
.bg-card .layer:first-of-type { border-top: 0; }
.bg-card .lbl { color: var(--muted); font-size: 12px; letter-spacing: .8px; font-weight: 700; }
.bg-card .guess { font-size: 44px; font-weight: 800; letter-spacing: 1px; line-height: 1.1; margin-top: 4px; }
.bg-card .guess.YES, .bg-card .guess.LONG { color: var(--pos); }
.bg-card .guess.NO, .bg-card .guess.SHORT { color: var(--neg); }
.bg-card .guess.FLAT, .bg-card .guess.none { color: var(--muted); }
.bg-card .sub2 { color: var(--muted); font-size: 15px; margin-top: 4px; }
.bg-card .edge { font-size: 19px; font-weight: 650; margin-top: 4px; }
.bg-card .action { font-size: 30px; font-weight: 800; margin-top: 2px; }
.bg-card .btns { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 6px; }
.bg-card .explain { font-size: 16px; line-height: 1.5; margin: 10px 0 0; }
.star { min-height: 36px; padding: 0 10px; font-size: 18px; background: transparent; border-color: transparent; color: var(--faint); }
.star.on { color: var(--warn); }
button.gl { min-height: 30px; padding: 0 8px; font-size: 12px; background: transparent; color: var(--res); border-color: transparent; }
.chips button.gl { border-color: var(--line); margin: 3px 2px; }
.hero .huge { font-size: 30px; font-weight: 800; margin: 4px 0; }
.fstep { display: grid; grid-template-columns: 1fr auto; gap: 2px 8px; padding: 6px 0; }
.fstep meter { grid-column: 1 / -1; width: 100%; height: 10px; }
.tiles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.tile { border-radius: 12px; padding: 10px; border: 1px solid var(--line); min-width: 0; }
.tile .tt { font-weight: 650; font-size: 13px; overflow-wrap: anywhere; } .tile .tv { font-size: 18px; font-weight: 700; margin-top: 4px; }
.tile .ts { color: var(--faint); font-size: 11px; }
.tile.RED { background: var(--neg-bg); } .tile.YELLOW { background: var(--warn-bg); } .tile.GREEN { background: var(--pos-bg); }
.tile.GRAYC { background: var(--bg2); }
.sheet { position: fixed; inset: 0; z-index: 20; background: rgba(0, 0, 0, .45); display: flex; align-items: flex-end; }
.sheet-in { background: var(--card); width: 100%; border-radius: 18px 18px 0 0; padding: 18px 18px calc(18px + var(--sab));
  font-size: 16px; line-height: 1.5; }
.tag.WAIT, .tag.HOLD, .tag.AGING, .tag.MODERATE, .tag.ESTIMATED, .tag.ASSUMED, .tag.DEGRADED, .tag.PREVIEW { background: var(--warn-bg); color: var(--warn); }
.tag.PASS, .tag.WEAK, .tag.UNKNOWN, .tag.BELOW, .tag.SIMULATED { background: var(--slate); color: var(--text); }
.tag.FRESH, .tag.STRONG, .tag.VERIFIED, .tag.STABLE, .tag.BUY { background: var(--pos-bg); color: var(--pos); }
.tag.STALE, .tag.CRITICAL, .tag.NEVER { background: var(--neg-bg); color: var(--neg); }
.row .v .tag { white-space: normal; text-align: right; }
/* deployment: the mode strip is always visible under the header (never scrolls away) */
.modestrip { position: sticky; top: calc(var(--sat) + 47px); z-index: 4; margin: 0; padding: 6px 16px;
  font-size: 11.5px; font-weight: 750; letter-spacing: .4px; text-align: center;
  background: var(--neg-bg); color: var(--neg); border-bottom: 1px solid var(--line);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); }
html { overscroll-behavior-y: none; }
body { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
main, .card, .item, .bg-card, input, textarea, pre { -webkit-user-select: text; user-select: text; }
button.gl { min-height: 40px; }
summary { min-height: 44px; }
.install ol { padding-left: 20px; margin: 6px 0; } .install li { margin: 8px 0; line-height: 1.45; }
@media (orientation: landscape) and (max-height: 500px) { .modestrip { position: static; } }
a.linkbtn { display: inline-flex; align-items: center; text-decoration: none; color: var(--res); }
.row .k { overflow-wrap: break-word; word-break: normal; }
.item .t { overflow-wrap: break-word; }

/* Candle Wick Labs branding (2.6.2) */
.brandhero { display: flex; align-items: center; gap: 12px; margin: 6px 0 14px; }
.brandhero .bn { font-size: 20px; font-weight: 700; letter-spacing: .2px; }
.logo.big { width: 56px; height: 56px; border-radius: 13px; }
.tag.HEALTHY, .tag.ans.POSITIVE { background: var(--pos-bg); color: var(--pos); }
.tag.ans.NEGATIVE { background: var(--neg-bg); color: var(--neg); }
.tag.ans.NONE, .tag.ans.INSUFFICIENT { background: var(--warn-bg); color: var(--warn); }
.bg-card .edge .tag.ans { font-size: 15px; vertical-align: 2px; }
.bg-card .edge .why { font-size: 15px; font-weight: 500; }
