/* Impact Analysis tile. Tokens follow the console's brand book (Dark Blue + White,
   Yellow / Light Blue accents, greys to separate information). */
:root {
  --navy: #273859; --navy-hover: #1d2b45; --yellow: #f2cd5c; --light-blue: #5ce9f2;
  --grey: #f1f1f1; --mid-grey: #dddddd;
  --page-bg: var(--grey); --card-bg: #fff; --card-border: var(--mid-grey); --input-border: #c9ced9;
  --text: #273859; --text-body: #3b4a6b; --muted: #6b7691; --faint: #9aa3b8;
  --green-bg: #dcfce7; --green-text: #166534; --red-bg: #fee2e2; --red-text: #991b1b; --red-border: #fecaca;
  --amber-bg: #fdf3d2; --amber-text: #6b5410; --blue-bg: #e9edf5;
  --font-heading: 'Montserrat', 'Segoe UI', Arial, sans-serif; --font-body: 'Roboto', 'Segoe UI', Arial, sans-serif;
  --radius: 10px; --shadow: 0 1px 2px rgba(39, 56, 89, 0.08);
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body { background: var(--page-bg); color: var(--text-body); font: 15px/1.5 var(--font-body); }
h1, h2, h3, h4 { font-family: var(--font-heading); color: var(--text); margin: 0 0 .4rem; font-weight: 600; line-height: 1.25; }
h1 { font-size: 1.35rem; } h2 { font-size: 1.1rem; } h3 { font-size: .95rem; }
p { margin: 0 0 .75rem; }
a { color: var(--navy); }
button, input, select, textarea { font: inherit; }
.muted { color: var(--muted); } .faint { color: var(--faint); } .small { font-size: .85rem; }
.hidden { display: none !important; }
.boot { display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 60vh; color: var(--muted); }
.spinner { width: 28px; height: 28px; border: 3px solid var(--mid-grey); border-top-color: var(--navy); border-radius: 50%; animation: spin .8s linear infinite; margin-bottom: 12px; }
@keyframes spin { to { transform: rotate(360deg); } }

/* shell */
.topbar { background: #fff; border-bottom: 1px solid var(--card-border); display: flex; align-items: center; gap: 18px; padding: 0 20px; height: 54px; position: sticky; top: 0; z-index: 5; }
.topbar .title { font-family: var(--font-heading); font-weight: 600; color: var(--navy); display: flex; align-items: center; gap: 10px; }
.topbar .title .dot { width: 10px; height: 10px; border-radius: 50%; background: linear-gradient(135deg, var(--yellow), var(--light-blue)); }
.tabs { display: flex; gap: 4px; margin-left: 8px; }
.tabs button { background: none; border: 0; padding: 8px 12px; border-radius: 8px; color: var(--muted); cursor: pointer; font-weight: 500; }
.tabs button:hover { background: var(--grey); color: var(--navy); }
.tabs button.active { background: var(--blue-bg); color: var(--navy); }
.who { margin-left: auto; display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: .9rem; }
.who .avatar { width: 30px; height: 30px; border-radius: 50%; background: var(--navy); color: #fff; display: inline-flex; align-items: center; justify-content: center; font-weight: 600; font-size: .8rem; }
.page { max-width: 1120px; margin: 0 auto; padding: 22px 20px 48px; }
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 16px; flex-wrap: wrap; }
.card { background: var(--card-bg); border: 1px solid var(--card-border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px 20px; margin-bottom: 16px; }
.card.dashed { border-style: dashed; box-shadow: none; background: transparent; }
.grid { display: grid; gap: 14px; }
.grid.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .grid.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); } .grid.cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 860px) { .grid.cols-3, .grid.cols-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 560px) { .grid.cols-2, .grid.cols-3, .grid.cols-4 { grid-template-columns: 1fr; } .topbar { gap: 8px; padding: 0 12px; } .who .name { display: none; } }

/* buttons, pills, notices */
.btn { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--navy); background: var(--navy); color: #fff; padding: 8px 14px; border-radius: 8px; cursor: pointer; font-weight: 500; text-decoration: none; }
.btn:hover { background: var(--navy-hover); } .btn:disabled { opacity: .55; cursor: default; }
.btn.secondary { background: #fff; color: var(--navy); border-color: var(--input-border); } .btn.secondary:hover { background: var(--grey); }
.btn.accent { background: var(--light-blue); border-color: var(--light-blue); color: var(--navy); } .btn.accent:hover { background: #3fdbe6; }
.btn.danger { background: #fff; color: var(--red-text); border-color: var(--red-border); } .btn.danger:hover { background: var(--red-bg); }
.btn.sm { padding: 5px 10px; font-size: .85rem; }
.btn-row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.pill { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: .78rem; font-weight: 500; background: var(--blue-bg); color: var(--navy); }
.pill.green { background: var(--green-bg); color: var(--green-text); } .pill.red { background: var(--red-bg); color: var(--red-text); } .pill.amber { background: var(--amber-bg); color: var(--amber-text); } .pill.grey { background: var(--grey); color: var(--muted); }
.notice { padding: 10px 14px; border-radius: 8px; border: 1px solid var(--card-border); background: var(--blue-bg); margin-bottom: 14px; }
.notice.error { background: var(--red-bg); border-color: var(--red-border); color: var(--red-text); }
.notice.ok { background: var(--green-bg); color: var(--green-text); border-color: #bbf7d0; }
.notice.amber { background: var(--amber-bg); color: var(--amber-text); border-color: var(--yellow); }

/* forms */
.field { display: flex; flex-direction: column; gap: 4px; margin-bottom: 12px; }
.field label { font-weight: 500; color: var(--text); font-size: .9rem; }
.field .help { color: var(--muted); font-size: .8rem; }
.field .req { color: var(--red-text); margin-left: 3px; }
.control { border: 1px solid var(--input-border); border-radius: 8px; padding: 8px 10px; background: #fff; color: var(--text); width: 100%; }
.control:focus { outline: 2px solid var(--light-blue); outline-offset: 0; border-color: var(--navy); }
.control.invalid { border-color: var(--red-text); }
.feedback { color: var(--red-text); font-size: .8rem; display: none; }
.field.invalid .feedback { display: block; }
.money { position: relative; } .money .control { padding-left: 24px; } .money::before { content: '$'; position: absolute; left: 10px; top: 9px; color: var(--muted); }
.fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 18px; }
@media (max-width: 700px) { .fields { grid-template-columns: 1fr; } }
.section { padding: 14px 0 4px; border-top: 1px solid var(--card-border); }
.section:first-child { border-top: 0; padding-top: 4px; }
.section h3 { margin-bottom: 10px; }
.repeatable .row { display: flex; gap: 8px; margin-bottom: 8px; }
.repeatable .row .control { flex: 1; }

/* wizard */
.steps { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 10px; }
.steps button { border: 1px solid var(--input-border); background: #fff; color: var(--muted); border-radius: 999px; padding: 5px 12px 5px 6px; cursor: pointer; display: inline-flex; align-items: center; gap: 8px; font-size: .85rem; }
.steps button .n { width: 22px; height: 22px; border-radius: 50%; background: var(--mid-grey); color: var(--navy); display: inline-flex; align-items: center; justify-content: center; font-weight: 600; font-size: .75rem; }
.steps button.active { border-color: var(--navy); color: var(--navy); background: var(--blue-bg); } .steps button.active .n { background: var(--navy); color: #fff; }
.steps button.done .n { background: var(--light-blue); }
.progress { height: 5px; background: var(--mid-grey); border-radius: 999px; overflow: hidden; margin-bottom: 18px; }
.progress div { height: 100%; background: linear-gradient(90deg, var(--yellow), var(--light-blue)); transition: width .25s; }
.step-head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; margin-bottom: 8px; }
.wizard-foot { display: flex; justify-content: space-between; gap: 10px; margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--card-border); flex-wrap: wrap; }

/* results */
.tiles { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 16px; }
@media (max-width: 900px) { .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.tile { background: #fff; border: 1px solid var(--card-border); border-radius: var(--radius); padding: 12px 14px; }
.tile .label { color: var(--muted); font-size: .78rem; text-transform: uppercase; letter-spacing: .02em; }
.tile .value { font-family: var(--font-heading); font-weight: 600; color: var(--navy); font-size: 1.25rem; margin-top: 4px; }
.tile .value.neg { color: var(--red-text); }
.preview { width: 100%; height: 78vh; min-height: 520px; border: 1px solid var(--card-border); border-radius: var(--radius); background: #fff; }
.seg { display: inline-flex; border: 1px solid var(--input-border); border-radius: 8px; overflow: hidden; }
.seg button { border: 0; background: #fff; padding: 7px 12px; cursor: pointer; color: var(--muted); border-right: 1px solid var(--input-border); }
.seg button:last-child { border-right: 0; } .seg button.active { background: var(--navy); color: #fff; }

/* tables */
table { width: 100%; border-collapse: collapse; font-size: .9rem; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--card-border); vertical-align: top; }
th { background: var(--grey); color: var(--muted); font-weight: 500; font-size: .78rem; text-transform: uppercase; letter-spacing: .02em; position: sticky; top: 0; z-index: 1; }
tr.overridden td { background: var(--amber-bg); }
tr.click { cursor: pointer; } tr.click:hover td { background: #f7f8fb; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
.table-wrap { overflow: auto; max-height: 70vh; border: 1px solid var(--card-border); border-radius: var(--radius); background: #fff; }
.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 12px; }
.toolbar .control { width: auto; min-width: 180px; }
.inline-input { width: 110px; padding: 4px 8px; border: 1px solid var(--input-border); border-radius: 6px; text-align: right; }
.subtabs { display: flex; gap: 4px; flex-wrap: wrap; margin-bottom: 14px; border-bottom: 1px solid var(--card-border); }
.subtabs button { background: none; border: 0; border-bottom: 2px solid transparent; padding: 8px 12px; color: var(--muted); cursor: pointer; font-weight: 500; margin-bottom: -1px; }
.subtabs button.active { color: var(--navy); border-bottom-color: var(--navy); }
.logo-box { width: 120px; height: 60px; border: 1px dashed var(--input-border); border-radius: 8px; display: flex; align-items: center; justify-content: center; background: #fff; overflow: hidden; }
.logo-box img { max-width: 100%; max-height: 100%; }
.kv { display: grid; grid-template-columns: 180px 1fr; gap: 6px 14px; font-size: .9rem; }
.kv dt { color: var(--muted); } .kv dd { margin: 0; }
code, pre { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .85rem; }
pre { background: var(--grey); padding: 10px 12px; border-radius: 8px; overflow: auto; }
.keybox { background: var(--amber-bg); border: 1px solid var(--yellow); border-radius: 8px; padding: 10px 12px; margin: 10px 0; word-break: break-all; }
