/* Large-text, high-contrast base styles. Tablet landscape first. */
:root {
  --bg: #f6f7f9;
  --surface: #ffffff;
  --text: #15202b;
  --muted: #5b6672;
  --line: #d9dee5;
  --primary: #1f5fbf;
  --primary-text: #ffffff;
  --green: #1a7f37;
  --amber: #b26a00;
  --red: #c0392b;
  --radius: 12px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}
* { box-sizing: border-box; }
html { font-size: 18px; }
body { margin: 0; font-family: var(--font); color: var(--text); background: var(--bg); line-height: 1.5; }
a { color: var(--primary); }
h1 { font-size: 1.9rem; margin: 0.4rem 0 1rem; }
h2 { font-size: 1.3rem; margin: 0 0 0.75rem; }
p { margin: 0 0 0.75rem; }
.muted { color: var(--muted); }

.topbar { display: flex; align-items: center; gap: 1.5rem; padding: 0.75rem 1.25rem; background: var(--surface); border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.brand { font-weight: 700; text-decoration: none; color: var(--text); font-size: 1.15rem; }
.nav { display: flex; gap: 0.25rem; flex-wrap: wrap; }
.nav a { padding: 0.5rem 0.8rem; border-radius: 8px; text-decoration: none; color: var(--text); min-height: 44px; display: inline-flex; align-items: center; }
.nav a.active, .nav a:hover { background: #e8eef9; color: var(--primary); }
.who { margin-left: auto; display: flex; align-items: center; gap: 0.75rem; }

.banner { padding: 0.6rem 1.25rem; }
.banner-admin { background: #fff4d6; border-bottom: 1px solid #f0d58c; }

.container { max-width: 1100px; margin: 0 auto; padding: 1.25rem; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.25rem; margin-bottom: 1.25rem; }
.card.narrow { max-width: 480px; margin: 3rem auto; }
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 1.25rem; }

label { display: block; margin: 0.75rem 0 0.25rem; font-weight: 600; }
input, select, textarea { font: inherit; width: 100%; padding: 0.6rem 0.75rem; border: 1px solid var(--line); border-radius: 8px; min-height: 44px; background: #fff; }
form.inline { display: flex; gap: 0.5rem; align-items: center; margin-top: 0.5rem; }
form.inline input { width: auto; flex: 1; }

.btn { display: inline-flex; align-items: center; justify-content: center; min-height: 44px; padding: 0.5rem 1rem; border-radius: 8px; border: 1px solid var(--line); background: #fff; color: var(--text); font: inherit; font-weight: 600; text-decoration: none; cursor: pointer; margin-top: 0.5rem; }
.btn-primary { background: var(--primary); color: var(--primary-text); border-color: var(--primary); }
.btn-wide { width: 100%; margin-top: 1.25rem; }
.btn-small { min-height: 36px; padding: 0.25rem 0.6rem; font-size: 0.9rem; margin-top: 0; }
button.link { background: none; border: none; color: var(--primary); font: inherit; cursor: pointer; padding: 0; text-decoration: underline; }

.alert { padding: 0.75rem 1rem; border-radius: 8px; border: 1px solid; }
.alert-error { background: #fdecea; border-color: #f5c6c2; color: #7a1f16; }
.alert-info { background: #e8f1ff; border-color: #bcd3f7; color: #16407f; }

.table { width: 100%; border-collapse: collapse; }
.table th, .table td { text-align: left; padding: 0.5rem 0.4rem; border-bottom: 1px solid var(--line); vertical-align: top; }
.table .actions { display: flex; gap: 0.4rem; flex-wrap: wrap; }
.table .actions form { margin: 0; }
details > summary { list-style: none; }
details > summary::-webkit-details-marker { display: none; }

.steps li { margin-bottom: 0.5rem; }
.footer { max-width: 1100px; margin: 2rem auto; padding: 0 1.25rem 2rem; color: var(--muted); font-size: 0.85rem; }

.tag { display: inline-block; padding: 0.1rem 0.5rem; border-radius: 999px; font-size: 0.85rem; background: #eef1f5; margin-right: 0.3rem; }
.tag-green { background: #e3f3e7; color: var(--green); }
.tag-amber { background: #fff1dc; color: var(--amber); }
.tag-red { background: #fdecea; color: var(--red); }

@media (max-width: 700px) {
  html { font-size: 17px; }
  .who { margin-left: 0; }
}

/* Explore / build */
.search-row { display: flex; gap: 0.5rem; }
.search-row input { flex: 1; }
.search-row .btn { margin-top: 0; }
.filters summary { cursor: pointer; margin: 0.5rem 0; color: var(--primary); }
.filter-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 0.75rem; }
.result-head { display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; align-items: flex-start; }
.result-head h2 { margin-bottom: 0.25rem; }
.result-facts { display: flex; flex-wrap: wrap; gap: 0.5rem 1.25rem; margin: 0.5rem 0; }
.result-actions { display: flex; gap: 0.5rem; flex-wrap: wrap; align-items: center; }
.result-actions form { margin: 0; }
.page-head { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 0.5rem; }
.page-actions { display: flex; gap: 0.4rem; flex-wrap: wrap; }
.page-actions form { margin: 0; }
.objective { font-size: 1.05rem; background: #eef3fb; padding: 0.6rem 0.9rem; border-radius: 8px; }
.build-grid { display: grid; grid-template-columns: minmax(300px, 2fr) minmax(320px, 3fr); gap: 1.25rem; }
@media (max-width: 900px) { .build-grid { grid-template-columns: 1fr; } }
.settings-form { display: grid; grid-template-columns: 1fr 1fr; gap: 0 0.75rem; }
.settings-form .btn { grid-column: 1 / -1; }
.mix-table td { vertical-align: middle; }
.weight-cell { min-width: 200px; }
.slider { width: 100%; min-height: 32px; }
.pct-box { white-space: nowrap; }
.pct-input { width: 4.5rem; display: inline-block; text-align: right; min-height: 36px; padding: 0.2rem 0.4rem; }
.cash-row td { background: #f3f5f8; }
.table.small { font-size: 0.92rem; }
.big-statement { font-size: 1.15rem; }
.pos { color: var(--green); }
.neg { color: var(--red); }
.ladder { display: grid; grid-template-columns: repeat(5, 1fr); gap: 0.4rem; }
.ladder-step { border: 1px solid var(--line); border-radius: 8px; padding: 0.5rem; font-size: 0.85rem; }
.ladder-step.current { border-color: var(--primary); background: #e8eef9; box-shadow: 0 0 0 2px var(--primary) inset; }
@media (max-width: 700px) { .ladder { grid-template-columns: 1fr; } }
.scorecard { list-style: none; padding: 0; margin: 0; }
.scorecard li { padding: 0.4rem 0; border-bottom: 1px solid var(--line); }
.light { display: inline-block; min-width: 4.2rem; text-align: center; padding: 0.05rem 0.4rem; border-radius: 999px; font-size: 0.8rem; font-weight: 700; text-transform: uppercase; }
.light-green { background: #e3f3e7; color: var(--green); }
.light-amber { background: #fff1dc; color: var(--amber); }
.light-red { background: #fdecea; color: var(--red); }
.light-info { background: #eef1f5; color: var(--muted); }
.bars { list-style: none; padding: 0; margin: 0; }
.bars li { position: relative; padding: 0.15rem 0.4rem; margin-bottom: 0.2rem; }
.bars .bar { position: absolute; left: 0; top: 0; bottom: 0; background: #dfe8f7; border-radius: 4px; z-index: 0; }
.bars li { z-index: 1; }
.bars li > :not(.bar) { position: relative; }
.plain-list { padding-left: 1.2rem; }
.views-table select { min-height: 38px; padding: 0.2rem 0.4rem; }
.views-table input[type=checkbox] { width: 1.4rem; height: 1.4rem; }
.review-item h3 { margin: 0.5rem 0; }

/* Dashboard / trades */
.headline { font-size: 2rem; font-weight: 700; margin: 0.25rem 0; }
.checkbox-row { display: flex; align-items: center; gap: 0.5rem; font-weight: 400; grid-column: 1 / -1; }
.checkbox-row input { width: 1.4rem; height: 1.4rem; min-height: 0; }
.row-flag td { background: #fff7e8; }
@media print { .topbar, .page-actions, .footer, .btn { display: none !important; } .card { border: none; } }

/* Learn / narrative */
.glossary dt { font-weight: 700; margin-top: 0.6rem; }
.glossary dd { margin: 0.1rem 0 0 0; }
.narrative { background: #f7fbff; border-color: #cfe0fb; }
.narrative p { font-size: 1.05rem; }

/* Tracker */
.tracker-controls { display: flex; flex-wrap: wrap; gap: 0.75rem; align-items: flex-start; margin-bottom: 0.5rem; }
.range-buttons { display: flex; gap: 0.3rem; flex-wrap: wrap; }
.range-buttons .btn { margin-top: 0; }
.toggles { display: flex; flex-wrap: wrap; gap: 0.3rem 0.8rem; align-items: center; }
.toggles .btn { margin-top: 0; }
.toggle { display: inline-flex; align-items: center; gap: 0.3rem; font-weight: 400; margin: 0; font-size: 0.9rem; }
.toggle input { width: 1.1rem; height: 1.1rem; min-height: 0; }
.swatch { display: inline-block; width: 14px; height: 4px; border-radius: 2px; }
.pie-row { display: grid; grid-template-columns: 1fr 1fr; gap: 0.75rem; margin-bottom: 0.5rem; }
.pie-row h3 { margin: 0 0 0.25rem; font-size: 1rem; }
@media (max-width: 700px) { .pie-row { grid-template-columns: 1fr; } }

/* Key figures and pie lenses */
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 0.6rem; }
.tile { border: 1px solid var(--line); border-radius: 10px; padding: 0.6rem 0.75rem; background: #fafbfd; }
.tile-label { font-size: 0.85rem; color: var(--muted); }
.tile-value { font-size: 1.6rem; font-weight: 700; line-height: 1.2; margin: 0.15rem 0; }
.tile-sub { font-size: 0.8rem; color: var(--muted); }
.lens-buttons { display: flex; flex-wrap: wrap; gap: 0.3rem; margin-bottom: 0.5rem; }
.lens-buttons .btn { margin-top: 0; }
.pie-wrap { max-width: 560px; margin: 0 auto; }
