/* ============================================================
   Ledgerline UI — light rebuild of app.css
   Drop-in replacement for public_html/assets/css/app.css
   Same class names as before; no PHP changes required.
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Instrument+Sans:wght@400;500;600;700&family=IBM+Plex+Mono:wght@400;500;600&display=swap');

:root {
  --color-bg: #f6f8f8;
  --color-surface: #ffffff;
  --color-surface-2: #f0f3f3;
  --color-surface-3: #fbfcfc;
  --color-border: #e4eaea;
  --color-border-soft: #f1f4f4;
  --color-text: #101619;
  --color-text-soft: #26343a;
  --color-text-muted: #5d6d73;
  --color-text-faint: #8d9a9f;
  --color-primary: #14676f;
  --color-primary-hover: #0e4d54;
  --color-primary-tint: #e6efef;
  --color-positive: #0f7a55;
  --color-positive-tint: #e3f3ec;
  --color-negative: #c33b2e;
  --color-negative-tint: #fbeae7;
  --color-warning: #8a6a1f;
  --color-warning-tint: #fdf6e8;
  --color-warning-border: #f0dfb8;
  --radius: 14px;
  --radius-sm: 8px;
  --radius-lg: 20px;
  --max-width: 1240px;
  --font-body: 'Instrument Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-mono: 'IBM Plex Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
  --shadow-sm: 0 1px 2px rgba(16,22,25,.06);
  --shadow-md: 0 4px 16px rgba(16,22,25,.06);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--color-bg);
  color: var(--color-text);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--color-primary); text-decoration: none; }
a:hover { color: var(--color-primary-hover); text-decoration: underline; }
::selection { background: #cfe4e5; }
:focus-visible { outline: 2px solid var(--color-primary); outline-offset: 2px; }

.container { max-width: var(--max-width); margin: 0 auto; padding: 0 40px; }

/* ---------- header ---------- */

header.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  border-bottom: 1px solid var(--color-border);
  background: rgba(246,248,248,.88);
  backdrop-filter: blur(10px);
}
header.site-header .bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 40px;
  height: 64px;
  padding: 0 40px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 600;
  font-size: 17px;
  letter-spacing: -.01em;
  color: var(--color-text);
}
.brand::before {
  content: '';
  width: 22px;
  height: 22px;
  border-radius: 6px;
  background: var(--color-primary);
  flex: none;
}
.brand:hover { text-decoration: none; color: var(--color-text); }

nav.main-nav { display: flex; gap: 28px; align-items: center; }
nav.main-nav a { color: var(--color-text-muted); font-size: 14.5px; font-weight: 500; }
nav.main-nav a:hover { color: var(--color-text); text-decoration: none; }
nav.main-nav form { display: flex; align-items: center; }
nav.main-nav .btn { margin-top: 0; }

main { min-height: 60vh; padding: 36px 0 72px; }

/* ---------- footer ---------- */

footer.site-footer {
  border-top: 1px solid var(--color-border);
  color: var(--color-text-muted);
  font-size: 13px;
  padding: 28px 0 40px;
  margin-top: 40px;
}
footer.site-footer a { color: var(--color-text-muted); }
footer.site-footer a:hover { color: var(--color-text); }
footer.site-footer nav { display: flex; gap: 20px; flex-wrap: wrap; margin-top: 10px; }

/* ---------- surfaces ---------- */

.card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 32px 36px;
}
.card + .card { margin-top: 20px; }

.auth-shell { max-width: 460px; margin: 40px auto; }
.auth-shell .card { padding: 36px; }

/* ---------- type ---------- */

h1 { font-size: 34px; line-height: 1.15; letter-spacing: -.025em; font-weight: 600; margin: 0 0 12px; }
h2 { font-size: 20px; letter-spacing: -.015em; font-weight: 600; margin: 0 0 16px; }
h3 { font-size: 16px; font-weight: 600; margin: 24px 0 10px; }
p { text-wrap: pretty; }
p.lede { color: var(--color-text-muted); font-size: 17px; line-height: 1.6; margin-top: 0; }

/* ---------- forms ---------- */

label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: .01em;
  color: var(--color-text-soft);
  margin: 20px 0 7px;
}
label:first-child { margin-top: 0; }

input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="date"],
input[type="search"],
textarea,
select {
  width: 100%;
  padding: 11px 14px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  color: var(--color-text);
  font-family: var(--font-body);
  font-size: 15px;
  transition: border-color .12s ease, box-shadow .12s ease;
}
input:hover, textarea:hover, select:hover { border-color: #cfd9da; }
input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(20,103,111,.14);
}
input::placeholder, textarea::placeholder { color: var(--color-text-faint); }
textarea { min-height: 120px; font-family: inherit; line-height: 1.55; }
select { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--color-text-muted) 50%), linear-gradient(135deg, var(--color-text-muted) 50%, transparent 50%); background-position: calc(100% - 18px) 55%, calc(100% - 13px) 55%; background-size: 5px 5px, 5px 5px; background-repeat: no-repeat; padding-right: 36px; }

.checkbox-row { display: flex; align-items: flex-start; gap: 10px; margin-top: 18px; }
.checkbox-row input { margin-top: 3px; accent-color: var(--color-primary); }
.checkbox-row label { margin: 0; font-weight: 400; font-size: 14.5px; color: var(--color-text-soft); }

.field-error { color: var(--color-negative); font-size: 13px; margin-top: 6px; }
.field-hint { color: var(--color-text-muted); font-size: 13px; margin-top: 6px; }
.form-footer { margin-top: 22px; font-size: 14px; color: var(--color-text-muted); text-align: center; }

/* ---------- buttons ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: var(--color-primary);
  color: #fff;
  border: 1px solid var(--color-primary);
  border-radius: var(--radius-sm);
  padding: 10px 20px;
  font-family: var(--font-body);
  font-size: 14.5px;
  font-weight: 600;
  line-height: 1.3;
  cursor: pointer;
  margin-top: 24px;
  transition: background .12s ease, border-color .12s ease;
}
.btn:hover { background: var(--color-primary-hover); border-color: var(--color-primary-hover); color: #fff; text-decoration: none; }
.btn:active { background: #0a3c42; border-color: #0a3c42; }
.btn:disabled, .btn[aria-disabled="true"] { opacity: .45; cursor: not-allowed; }
.btn-block { display: flex; width: 100%; }
.btn-secondary { background: var(--color-surface); color: var(--color-text); border-color: var(--color-border); }
.btn-secondary:hover { background: var(--color-surface-2); border-color: #cfd9da; color: var(--color-text); }
.btn-danger { background: var(--color-negative); border-color: var(--color-negative); }
.btn-danger:hover { background: #a52f24; border-color: #a52f24; }

/* ---------- alerts ---------- */

.alert {
  border-radius: var(--radius);
  padding: 14px 18px;
  margin-bottom: 20px;
  font-size: 14.5px;
  line-height: 1.55;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  color: var(--color-text-soft);
}
.alert a { font-weight: 600; }
.alert-success { background: var(--color-positive-tint); border-color: #c3e5d6; color: #0b5f3f; }
.alert-success a { color: #0b5f3f; }
.alert-error { background: var(--color-negative-tint); border-color: #f0cdc7; color: #93281d; }
.alert-error a { color: #93281d; }
.alert-warning { background: var(--color-warning-tint); border-color: var(--color-warning-border); color: #6b5320; }

/* ---------- text helpers ---------- */

.text-muted { color: var(--color-text-muted); }
.text-positive { color: var(--color-positive); font-variant-numeric: tabular-nums; }
.text-negative { color: var(--color-negative); font-variant-numeric: tabular-nums; }
.text-center { text-align: center; }

/* ---------- badges & pills ---------- */

.badge {
  display: inline-block;
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: .05em;
  text-transform: uppercase;
  padding: 5px 10px;
  border-radius: 6px;
  background: var(--color-primary-tint);
  border: none;
  color: var(--color-primary);
  vertical-align: middle;
}
.badge-neutral { background: var(--color-surface-2); color: var(--color-text-muted); }
.badge-positive { background: var(--color-positive-tint); color: #0b5f3f; }
.badge-negative { background: var(--color-negative-tint); color: #93281d; }

.pill {
  display: inline-block;
  font-size: 12px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--color-surface-2);
  color: var(--color-text-muted);
}
.pill-ok { background: var(--color-positive-tint); color: #0b5f3f; }
.pill-bad { background: var(--color-negative-tint); color: #93281d; }
.pill-warn { background: var(--color-warning-tint); color: #6b5320; }

/* ---------- ticker chip (optional, add class="ticker" to symbols) ---------- */

.ticker {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: .06em;
  background: var(--color-text);
  color: #fff;
  padding: 5px 10px;
  border-radius: 7px;
}

/* ---------- tables ---------- */

table.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14.5px;
  font-variant-numeric: tabular-nums;
}
table.data-table th,
table.data-table td {
  text-align: left;
  padding: 12px 20px 12px 0;
  border-bottom: 1px solid var(--color-border-soft);
  vertical-align: top;
}
table.data-table th {
  color: var(--color-text-muted);
  font-weight: 600;
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: .08em;
  white-space: nowrap;
}
table.data-table tr:last-child th,
table.data-table tr:last-child td { border-bottom: none; }
table.data-table tbody tr:hover td { background: var(--color-surface-3); }
table.data-table td strong { font-family: var(--font-mono); font-weight: 600; letter-spacing: .04em; }

/* numeric-looking cells read better in mono; opt in with class="num" */
.num, td.num, th.num { font-family: var(--font-mono); font-variant-numeric: tabular-nums; text-align: right; }

/* ---------- details / accordions ---------- */

details { border-top: 1px solid var(--color-border-soft); }
details > summary {
  cursor: pointer;
  font-size: 14.5px;
  font-weight: 600;
  padding: 12px 0;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 8px;
}
details > summary::-webkit-details-marker { display: none; }
details > summary::before { content: '+'; color: var(--color-primary); font-family: var(--font-mono); font-weight: 500; }
details[open] > summary::before { content: '–'; }

/* ---------- charts / images ---------- */

img { max-width: 100%; }
.card img { border-radius: 12px; border: 1px solid var(--color-border); }

/* ---------- disclaimer ---------- */

.disclaimer-block {
  font-size: 12.5px;
  line-height: 1.6;
  color: var(--color-text-muted);
  border-top: 1px solid var(--color-border);
  padding-top: 18px;
  margin-top: 32px;
  max-width: 820px;
}
.disclaimer-block.text-center { margin-left: auto; margin-right: auto; }

hr { border: none; border-top: 1px solid var(--color-border); margin: 32px 0; }

/* ============================================================
   Recommendation detail page
   Used by app/views/member/recommendations/show.php
   ============================================================ */

.rec-back { font-size: 13.5px; color: var(--color-text-muted); font-weight: 500; display: inline-block; margin-bottom: 20px; }

.rec-head { display: flex; flex-wrap: wrap; gap: 32px; align-items: flex-start; justify-content: space-between; }
.rec-head h1 { font-size: 38px; margin: 16px 0 8px; }
.rec-head-id { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.rec-head-meta { margin: 0; font-size: 14.5px; color: var(--color-text-muted); }
.rec-quotes { display: flex; gap: 14px; flex-wrap: wrap; }
.quote-tile {
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 16px 22px;
  min-width: 170px;
}
.quote-tile .label { font-size: 11.5px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--color-text-faint); }
.quote-tile .figure { font-family: var(--font-mono); font-size: 30px; font-weight: 600; letter-spacing: -.02em; margin-top: 8px; font-variant-numeric: tabular-nums; }
.quote-tile .sub { font-family: var(--font-mono); font-size: 14px; font-weight: 500; margin-top: 4px; font-variant-numeric: tabular-nums; }
.quote-tile .note { font-size: 13px; color: var(--color-text-faint); margin-top: 6px; }

.rec-panel { background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius-lg); overflow: hidden; margin-top: 20px; }
.rec-panel-head { padding: 28px 36px 0; display: flex; align-items: baseline; justify-content: space-between; gap: 20px; flex-wrap: wrap; }
.rec-panel-head h2 { margin: 0; }
.rec-panel-head .note { font-size: 13px; color: var(--color-text-faint); }

/* price ladder */
.ladder { padding: 28px 36px 12px; }
.ladder-labels { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; align-items: end; margin-bottom: 18px; }
.ladder-labels .lab { font-size: 11.5px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; }
.ladder-labels .val { font-family: var(--font-mono); font-size: 20px; font-weight: 600; margin-top: 5px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.ladder-labels .sub { font-size: 12.5px; color: var(--color-text-faint); margin-top: 3px; }
.ladder-labels .stop .lab { color: var(--color-negative); }
.ladder-labels .zone { text-align: center; }
.ladder-labels .zone .lab { color: var(--color-primary); }
.ladder-labels .target { text-align: right; }
.ladder-labels .target .lab { color: var(--color-positive); }

.ladder-track { position: relative; height: 22px; }
.ladder-track .rail { position: absolute; left: 0; right: 0; top: 8px; height: 6px; border-radius: 3px; background: linear-gradient(90deg, #f3d6d1, #e6eff0 30%, #cfe4e5 55%, #bfe4d3); }
.ladder-track .band { position: absolute; top: 0; height: 22px; border-radius: 6px; background: var(--color-primary); opacity: .16; }
.ladder-track .cap { position: absolute; top: 0; width: 3px; height: 22px; border-radius: 2px; }
.ladder-track .cap-stop { left: 0; background: var(--color-negative); }
.ladder-track .cap-target { right: 0; background: var(--color-positive); }
.ladder-track .now { position: absolute; top: 4px; width: 14px; height: 14px; margin-left: -7px; border-radius: 50%; background: var(--color-text); border: 3px solid #fff; box-shadow: 0 0 0 1px var(--color-text); }
.ladder-now { position: relative; height: 34px; margin-top: 8px; }
.ladder-now span { position: absolute; transform: translateX(-50%); background: var(--color-text); color: #fff; font-family: var(--font-mono); font-size: 12.5px; font-weight: 500; padding: 5px 10px; border-radius: 7px; white-space: nowrap; }

.param-grid { display: grid; grid-template-columns: repeat(4, 1fr); border-top: 1px solid var(--color-border-soft); }
.param-grid > div { padding: 22px 36px; border-right: 1px solid var(--color-border-soft); }
.param-grid > div:last-child { border-right: none; }
.param-grid .label { font-size: 11.5px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--color-text-faint); }
.param-grid .value { font-family: var(--font-mono); font-size: 26px; font-weight: 600; margin-top: 8px; font-variant-numeric: tabular-nums; }

.range52 { padding: 24px 36px 28px; border-top: 1px solid var(--color-border-soft); background: var(--color-surface-3); }
.range52 .head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 12px; }
.range52 .head .lab { font-size: 11.5px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--color-text-faint); }
.range52 .head .ends { font-family: var(--font-mono); font-size: 13px; color: var(--color-text-muted); font-variant-numeric: tabular-nums; }
.range52 .bar { position: relative; height: 8px; border-radius: 4px; background: #eef1f1; }
.range52 .fill { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 4px; background: var(--color-primary); opacity: .22; }
.range52 .pin { position: absolute; top: -5px; width: 3px; height: 18px; border-radius: 2px; background: var(--color-text); }

/* two-column body */
.rec-grid { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 20px; margin-top: 20px; align-items: start; }
.rec-main { display: flex; flex-direction: column; gap: 20px; min-width: 0; }
.rec-rail { display: flex; flex-direction: column; gap: 20px; position: sticky; top: 88px; }
.rec-rail .card { padding: 26px 28px 28px; }
.rec-rail .card h2 { font-size: 17px; margin-bottom: 18px; }

.thesis { font-size: 16.5px; line-height: 1.65; color: var(--color-text-soft); max-width: 64ch; }
.thesis p { margin: 0 0 18px; }
.thesis blockquote { border-left: 3px solid var(--color-primary); padding: 2px 0 2px 18px; margin: 24px 0 0; color: var(--color-text); font-size: 16px; }

.chart-thumb { display: block; }
.chart-thumb img { width: 100%; border-radius: 12px; border: 1px solid var(--color-border); display: block; }
.chart-thumb p { margin: 8px 0 0; font-size: 13px; color: var(--color-text-faint); }
.chart-list { display: flex; flex-direction: column; gap: 16px; }

.kv { display: flex; flex-direction: column; font-variant-numeric: tabular-nums; }
.kv .row { display: flex; justify-content: space-between; gap: 16px; padding: 10px 0; border-top: 1px solid var(--color-border-soft); font-size: 14px; }
.kv .row span:first-child { color: var(--color-text-muted); }
.kv .row span:last-child { font-family: var(--font-mono); text-align: right; }

.updates { display: flex; flex-direction: column; gap: 20px; }
.update { display: flex; gap: 14px; }
.update .stem { flex: none; display: flex; flex-direction: column; align-items: center; }
.update .dot { width: 9px; height: 9px; border-radius: 50%; background: #c9d4d6; margin-top: 5px; }
.update:first-child .dot { background: var(--color-primary); }
.update .line { width: 1px; flex: 1; background: var(--color-border); margin-top: 6px; }
.update:last-child .line { display: none; }
.update .when { font-size: 12.5px; color: var(--color-text-faint); display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.update p { margin: 6px 0 0; font-size: 14.5px; line-height: 1.55; color: var(--color-text-soft); }

/* financials */
.fin-controls { display: flex; align-items: baseline; justify-content: space-between; gap: 20px; flex-wrap: wrap; margin-bottom: 24px; }
.seg { display: flex; gap: 4px; background: var(--color-surface-2); padding: 4px; border-radius: 10px; }
.seg button { border: 0; background: transparent; color: var(--color-text); font-family: var(--font-body); font-size: 13px; font-weight: 600; padding: 6px 14px; border-radius: 7px; cursor: pointer; }
.seg button[aria-selected="true"] { background: var(--color-surface); box-shadow: var(--shadow-sm); }

.fin-tabs { display: flex; gap: 26px; border-bottom: 1px solid var(--color-border-soft); margin-bottom: 4px; }
.fin-tabs button { position: relative; border: 0; background: none; font-family: var(--font-body); font-size: 14.5px; font-weight: 500; color: var(--color-text-muted); padding: 0 0 12px; cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.fin-tabs button:hover { color: var(--color-text); }
.fin-tabs button[aria-selected="true"] { color: var(--color-text); border-bottom-color: var(--color-primary); }

.fin-panel[hidden] { display: none; }
.fin-scroll { overflow-x: auto; }
table.fin { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
table.fin th, table.fin td { padding: 11px 0 11px 20px; white-space: nowrap; border-top: 1px solid var(--color-border-soft); }
table.fin thead th { border-top: none; border-bottom: 1px solid var(--color-border-soft); padding-top: 16px; padding-bottom: 12px; font-family: var(--font-mono); font-size: 13px; font-weight: 500; color: var(--color-text-muted); text-align: right; }
table.fin thead th:first-child { font-family: var(--font-body); font-size: 11.5px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--color-text-faint); text-align: left; padding-left: 0; }
table.fin thead th:last-child { color: var(--color-text); font-weight: 600; }
table.fin tbody td { font-family: var(--font-mono); font-size: 14px; color: var(--color-text-muted); text-align: right; }
table.fin tbody td:first-child { font-family: var(--font-body); font-size: 14.5px; color: var(--color-text-soft); text-align: left; padding-left: 0; white-space: normal; }
table.fin tbody td:last-child { color: var(--color-text); font-weight: 500; }
table.fin tbody tr.emphasis td { font-weight: 600; color: var(--color-text); }

@media (max-width: 1100px) {
  .rec-grid { grid-template-columns: 1fr; }
  .rec-rail { position: static; }
  .param-grid { grid-template-columns: repeat(2, 1fr); }
  .param-grid > div:nth-child(2) { border-right: none; }
  .param-grid > div:nth-child(3), .param-grid > div:nth-child(4) { border-top: 1px solid var(--color-border-soft); }
}

@media (max-width: 900px) {
  .container { padding: 0 20px; }
  .rec-head h1 { font-size: 28px; }
  .ladder, .rec-panel-head, .range52 { padding-left: 20px; padding-right: 20px; }
  .param-grid > div { padding: 18px 20px; }
  header.site-header .bar { padding: 0 20px; height: auto; flex-wrap: wrap; gap: 12px; padding-top: 12px; padding-bottom: 12px; }
  .card { padding: 24px 20px; border-radius: var(--radius); }
  h1 { font-size: 27px; }
  nav.main-nav { gap: 16px; }
  main { padding: 24px 0 48px; }
}
