/* Shared component styles for the mockups. Visual language from input/prototype.html. */
:root {
  --bg: #F4F6FA; --panel: #FFFFFF; --panel-2: #F8FAFC; --border: #E2E8F0; --border-2: #CBD5E1;
  --text: #0F172A; --text-2: #334155; --muted: #64748B; --dim: #94A3B8;
  --red: #FA5A46; --red-h: #E04835; --red-soft: #FEF1EF;
  --live: #059669; --live-soft: #ECFDF5; --reload: #B45309; --reload-soft: #FFFBEB; --rebuild: #DC2626; --rebuild-soft: #FEF2F2;
  --implied: #7C3AED; --implied-soft: #F5F3FF; --info: #2563EB; --info-soft: #EFF6FF; --warn: #B45309; --warn-soft: #FFFBEB;
  --font: 'Inter', system-ui, sans-serif; --mono: 'JetBrains Mono', ui-monospace, monospace; --racing: 'Rajdhani', 'Inter', sans-serif;
  --radius: 8px;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { font-family: var(--font); color: var(--text); background: var(--bg); -webkit-font-smoothing: antialiased; font-size: 13px; }
button { font: inherit; color: inherit; cursor: pointer; }
button:disabled { cursor: not-allowed; }
a { color: var(--info); text-decoration: none; }
a:hover { text-decoration: underline; }
.mono { font-family: var(--mono); }
.ms { font-family: 'Material Symbols Outlined'; font-weight: normal; font-style: normal; font-size: 16px; line-height: 1; display: inline-block; vertical-align: -3px; font-variation-settings: 'FILL' 0, 'wght' 400; }
::-webkit-scrollbar { width: 6px; height: 6px; } ::-webkit-scrollbar-thumb { background: var(--border-2); border-radius: 3px; } ::-webkit-scrollbar-track { background: transparent; }

/* ---------- badges ---------- */
.badge { display: inline-flex; align-items: center; gap: 3px; font-family: var(--mono); font-size: 10px; font-weight: 600; letter-spacing: .02em; padding: 2px 6px; border-radius: 4px; border: 1px solid transparent; white-space: nowrap; }
.badge .ms { font-size: 12px; vertical-align: 0; }
.b-t3 { color: var(--live); background: var(--live-soft); border-color: #A7F3D0; }
.b-t2 { color: var(--reload); background: var(--reload-soft); border-color: #FDE68A; }
.b-t1 { color: var(--rebuild); background: var(--rebuild-soft); border-color: #FECACA; }
.b-tR { color: #fff; background: var(--rebuild); }
.b-pending { color: #fff; background: var(--red); }
.b-implied { color: var(--implied); background: var(--implied-soft); border-color: #DDD6FE; }
.b-lock { color: var(--text-2); background: #F1F5F9; border-color: var(--border); }
.b-warn { color: var(--warn); background: var(--warn-soft); border-color: #FDE68A; }
.b-proposed { color: var(--muted); border: 1px dashed var(--border-2); background: transparent; }
.b-rec { color: var(--live); background: var(--live-soft); border-color: #A7F3D0; }
.b-also { color: var(--muted); background: #F1F5F9; border-color: var(--border); }
.b-ro { color: var(--muted); background: #F1F5F9; }

/* ---------- setting card ---------- */
.card { background: rgba(255,255,255,.92); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; display: flex; flex-direction: column; gap: 10px; transition: border-color .15s, box-shadow .15s; position: relative; scroll-margin-top: 16px; }
.card:hover { border-color: var(--border-2); }
.card.is-focus { border-color: var(--red); box-shadow: 0 0 0 3px rgba(250,90,70,.12); }
.card.is-pending::before { content: ''; position: absolute; left: -1px; top: 10px; bottom: 10px; width: 3px; border-radius: 2px; background: var(--red); }
.card.is-implied::before { content: ''; position: absolute; left: -1px; top: 10px; bottom: 10px; width: 3px; border-radius: 2px; background: var(--implied); }
.card.st-locked .ctl, .card.st-blocked .ctl, .card.st-readOnly .ctl { opacity: .55; }
.card-head { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; }
.card-label { font-weight: 600; font-size: 13.5px; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.card-help { color: var(--muted); font-size: 12px; margin-top: 2px; line-height: 1.45; max-width: 64ch; }
.badges { display: flex; gap: 4px; flex-wrap: wrap; justify-content: flex-end; flex-shrink: 0; }
.readouts { display: flex; flex-direction: column; gap: 2px; }
.readout { font-family: var(--mono); font-size: 11.5px; color: var(--text-2); display: flex; gap: 6px; align-items: baseline; }
.readout::before { content: '↳'; color: var(--dim); }
.readout.warn { color: var(--warn); font-weight: 600; }
.reason { font-size: 12px; color: var(--text-2); background: var(--panel-2); border: 1px solid var(--border); border-radius: 6px; padding: 6px 9px; display: flex; gap: 6px; align-items: baseline; flex-wrap: wrap; }
.reason.blocked { background: var(--warn-soft); border-color: #FDE68A; }
.reason.implied { background: var(--implied-soft); border-color: #DDD6FE; }
.reason .fix { font-weight: 600; }
.linkish { background: none; border: 0; padding: 0; color: var(--info); font-weight: 600; }
.linkish:hover { text-decoration: underline; }

/* ---------- controls ---------- */
.seg { display: inline-flex; flex-wrap: wrap; background: #F1F5F9; border: 1px solid var(--border); border-radius: 7px; padding: 3px; gap: 2px; }
.seg button { border: 0; background: transparent; padding: 5px 11px; border-radius: 5px; font-size: 12px; font-weight: 500; color: var(--muted); }
.seg button:hover:not(:disabled) { color: var(--text); background: rgba(255,255,255,.7); }
.seg button.on { background: var(--red); color: #fff; font-weight: 600; box-shadow: 0 1px 2px rgba(0,0,0,.12); }
.seg button:disabled { color: var(--dim); text-decoration: line-through; text-decoration-color: rgba(148,163,184,.6); }
.seg button.on:disabled { text-decoration: none; color: #fff; }
.chips { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 6px; }
.chip { text-align: left; border: 1px solid var(--border); background: var(--panel); border-radius: 7px; padding: 7px 10px; display: flex; flex-direction: column; gap: 2px; }
.chip:hover:not(:disabled) { border-color: var(--border-2); background: var(--panel-2); }
.chip.on { border-color: var(--red); background: var(--red-soft); box-shadow: inset 0 0 0 1px var(--red); }
.chip:disabled { opacity: .5; }
.chip-label { font-weight: 600; font-size: 12.5px; display: flex; gap: 5px; align-items: center; }
.chip-sub { font-family: var(--mono); font-size: 10.5px; color: var(--muted); line-height: 1.35; }
.chip.on .chip-sub { color: var(--text-2); }
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 8px; }
.tile { text-align: left; border: 1px solid var(--border); background: var(--panel); border-radius: 8px; padding: 10px 12px; display: flex; flex-direction: column; gap: 4px; position: relative; }
.tile:hover:not(:disabled) { border-color: var(--border-2); }
.tile.on { border-color: var(--red); box-shadow: inset 0 0 0 1px var(--red); background: var(--red-soft); }
.tile:disabled { background: var(--panel-2); }
.tile:disabled .tile-label { color: var(--muted); }
.tile-top { display: flex; justify-content: space-between; gap: 6px; align-items: center; }
.tile-label { font-weight: 600; font-size: 13px; display: flex; align-items: center; gap: 6px; }
.tile-label .dot { width: 12px; height: 12px; border-radius: 50%; border: 2px solid var(--border-2); flex-shrink: 0; }
.tile.on .dot { border-color: var(--red); background: radial-gradient(circle, var(--red) 45%, transparent 50%); }
.tile-sub { font-size: 11.5px; color: var(--muted); line-height: 1.4; }
.tile-why { font-size: 11.5px; color: var(--warn); line-height: 1.4; }
.tile-why.dep { color: var(--text-2); }
.tile-tags { display: flex; gap: 4px; flex-wrap: wrap; }
.slider { display: flex; align-items: center; gap: 12px; }
.slider input[type=range] { -webkit-appearance: none; appearance: none; flex: 1; height: 4px; background: var(--border); border-radius: 99px; outline: none; max-width: 420px; }
.slider input[type=range]::-webkit-slider-thumb { -webkit-appearance: none; width: 16px; height: 16px; border-radius: 50%; background: #fff; border: 2.5px solid var(--red); box-shadow: 0 1px 3px rgba(0,0,0,.15); cursor: pointer; }
.slider input[type=range]:disabled::-webkit-slider-thumb { border-color: var(--dim); }
.slider output { font-family: var(--mono); font-size: 12px; font-weight: 600; min-width: 84px; text-align: center; padding: 4px 8px; border: 1px solid var(--border); background: var(--panel-2); border-radius: 5px; }
.toggle { width: 38px; height: 22px; border-radius: 99px; background: var(--border-2); border: 0; position: relative; transition: background .15s; flex-shrink: 0; }
.toggle::after { content: ''; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0,0,0,.2); transition: transform .15s; }
.toggle.on { background: var(--red); }
.toggle.on::after { transform: translateX(16px); }
.toggle-row { display: flex; align-items: center; gap: 10px; font-size: 12px; color: var(--muted); }
select.sel { font: inherit; font-size: 12.5px; padding: 6px 10px; border: 1px solid var(--border); border-radius: 6px; background: var(--panel); min-width: 260px; }
.pipeline { display: flex; flex-direction: column; gap: 4px; font-family: var(--mono); font-size: 12px; background: #0F172A; color: #E2E8F0; padding: 10px 12px; border-radius: 6px; }
.pipeline div:first-child { color: #fff; font-weight: 600; }

/* ---------- ledger ---------- */
.led-group { margin-bottom: 12px; }
.led-group-h { display: flex; align-items: center; justify-content: space-between; font-family: var(--mono); font-size: 10px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--dim); margin-bottom: 6px; }
.led { background: var(--panel); border: 1px solid var(--border); border-radius: 7px; padding: 8px 10px; margin-bottom: 6px; }
.led-top { display: flex; justify-content: space-between; align-items: center; gap: 6px; font-weight: 600; font-size: 12px; }
.led-top .lbl { cursor: pointer; }
.led-top .lbl:hover { color: var(--red); }
.led-val { font-family: var(--mono); font-size: 11px; color: var(--muted); margin-top: 2px; }
.led-val b { color: var(--text); }
.led-child { margin: 6px 0 0 8px; padding-left: 8px; border-left: 2px solid #DDD6FE; font-size: 11.5px; }
.led-child .why { color: var(--muted); font-size: 11px; }
.led-sys { border-style: dashed; }
.icon-btn { border: 0; background: transparent; color: var(--dim); padding: 2px; border-radius: 4px; }
.icon-btn:hover { color: var(--text); background: #F1F5F9; }
.empty { color: var(--dim); font-size: 12px; text-align: center; padding: 18px 6px; border: 1px dashed var(--border); border-radius: 7px; }

/* ---------- inspector ---------- */
.insp h4 { margin: 0 0 4px; font-size: 13px; }
.insp .kv { display: grid; grid-template-columns: 96px 1fr; gap: 3px 8px; font-size: 11.5px; }
.insp .kv dt { color: var(--dim); font-family: var(--mono); font-size: 10.5px; text-transform: uppercase; letter-spacing: .03em; padding-top: 1px; }
.insp .kv dd { margin: 0; color: var(--text-2); }
.insp .sub { font-family: var(--mono); font-size: 10px; text-transform: uppercase; letter-spacing: .06em; color: var(--dim); margin: 12px 0 5px; font-weight: 600; }
.metrics { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.metric { background: var(--panel); border: 1px solid var(--border); border-radius: 7px; padding: 7px 9px; }
.metric .k { font-family: var(--mono); font-size: 9.5px; text-transform: uppercase; color: var(--dim); letter-spacing: .04em; }
.metric .v { font-family: var(--mono); font-weight: 600; font-size: 14px; margin-top: 1px; }
.metric .d { font-family: var(--mono); font-size: 10.5px; }
.d.cost { color: var(--rebuild); } .d.gain { color: var(--live); }
.note { font-size: 11.5px; color: var(--muted); line-height: 1.45; }
.dep-link { display: inline-block; margin: 0 4px 4px 0; font-size: 11px; padding: 2px 7px; border-radius: 4px; background: #F1F5F9; border: 1px solid var(--border); cursor: pointer; }
.dep-link:hover { border-color: var(--red); color: var(--red); }

/* ---------- toast / modal ---------- */
.toast { position: fixed; left: 50%; bottom: 84px; transform: translateX(-50%); background: #0F172A; color: #fff; padding: 9px 16px; border-radius: 8px; font-size: 12.5px; box-shadow: 0 8px 24px rgba(15,23,42,.25); display: flex; gap: 10px; align-items: center; z-index: 60; }
.spinner { width: 14px; height: 14px; border: 2px solid rgba(255,255,255,.3); border-top-color: #fff; border-radius: 50%; animation: spin .7s linear infinite; }
/* Large spinner used by the rebuild dialog. */
.spinner.lg { margin: 4px auto 12px; border-color: rgba(250,90,70,.25); border-top-color: var(--red); width: 26px; height: 26px; }
@keyframes spin { to { transform: rotate(360deg); } }
.overlay { position: fixed; inset: 0; background: rgba(15,23,42,.55); backdrop-filter: blur(2px); display: flex; align-items: center; justify-content: center; z-index: 70; }
.modal { background: var(--panel); border-radius: 12px; padding: 22px 24px; width: min(480px, 92vw); box-shadow: 0 20px 50px rgba(15,23,42,.3); }
.modal h3 { margin: 0 0 6px; font-family: var(--racing); font-size: 20px; text-transform: uppercase; letter-spacing: .03em; }
.modal p { color: var(--muted); margin: 0 0 14px; line-height: 1.5; }
.btn { border: 1px solid var(--border); background: var(--panel); padding: 8px 14px; border-radius: 6px; font-size: 12px; font-weight: 600; letter-spacing: .03em; }
.btn:hover:not(:disabled) { background: var(--panel-2); }
.btn-primary { background: var(--red); color: #fff; border-color: var(--red); }
.btn-primary:hover:not(:disabled) { background: var(--red-h); }
.btn:disabled { opacity: .45; }
.countdown { font-family: var(--mono); font-size: 34px; font-weight: 700; color: var(--red); }
pre.diff { font-family: var(--mono); font-size: 11px; background: #0F172A; color: #E2E8F0; padding: 12px; border-radius: 6px; max-height: 50vh; overflow: auto; }
