/* Altura OS, inside the GoldenOS console.
   Altura's own identity: Cormorant Garamond for display, Jost for text, the
   cream-and-ink palette. The console has no theme toggle (its <html> is fixed
   to the night palette), so Altura follows the device: light by default, dark
   under prefers-color-scheme. Fonts are not self-hosted yet, so each family
   falls back to the console's own (Bodoni Moda, Bricolage Grotesque) and the
   CSP stays font-src 'self'. */

:root {
  --al-bg: #f7f4ee;
  --al-surface: #fff;
  --al-surface2: #f1ede4;
  --al-line: #ded7c9;
  --al-text: #162234;
  --al-muted: #4a5568;
  --al-blue: #2481a2;
  --al-gold: #b98b4b;
  --al-pink: #8e2338;
  --al-good: #2e7d5b;
  --al-warn: #b36e12;
  --al-bad: #b9453f;
  --al-focus: #2481a2;
  --al-serif: "Cormorant Garamond", "Bodoni Moda", Georgia, "Times New Roman", serif;
  --al-sans: "Jost", "Bricolage Grotesque", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --al-shadow: 0 1px 2px rgba(22, 34, 52, .05), 0 8px 24px rgba(22, 34, 52, .06);
  --al-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --al-bg: #0b1220;
    --al-surface: #121b2a;
    --al-surface2: #16202f;
    --al-line: #26313f;
    --al-text: #ede7da;
    --al-muted: #a9b2c0;
    --al-blue: #57a8c8;
    --al-gold: #d2a661;
    --al-pink: #c9546d;
    --al-good: #5fbf93;
    --al-warn: #e3a24f;
    --al-bad: #e07a72;
    --al-focus: #57a8c8;
    --al-shadow: 0 1px 0 rgba(255, 255, 255, .03), 0 12px 30px rgba(0, 0, 0, .4);
    --al-scheme: dark;
  }
}

body.gos[data-view="altura"] { background: var(--al-bg); }

.altura {
  color-scheme: var(--al-scheme);
  color: var(--al-text);
  font-family: var(--al-sans);
  font-size: 15px;
  line-height: 1.5;
  max-width: 1180px;
  overflow-wrap: anywhere;
}
.altura *, .altura *::before, .altura *::after { box-sizing: border-box; }
.altura h1, .altura h2, .altura h3 { font-family: var(--al-serif); color: var(--al-text); margin: 0; font-weight: 600; letter-spacing: 0; }
.altura p { margin: 0; }
.altura :focus-visible { outline: 2px solid var(--al-focus); outline-offset: 2px; border-radius: 6px; }
.al-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.al-muted { color: var(--al-muted); }

/* ------------------------------------------------------------------ head */
.al-head { display: flex; flex-wrap: wrap; gap: 16px 24px; align-items: flex-end; justify-content: space-between; margin-bottom: 18px; }
.al-eyebrow { font-size: 12px; letter-spacing: .14em; text-transform: uppercase; color: var(--al-gold); font-weight: 500; }
.al-title h1 { font-size: clamp(30px, 5vw, 44px); line-height: 1.05; margin-top: 2px; }
.al-biz { color: var(--al-muted); margin-top: 4px; }
.al-range { display: flex; flex-wrap: wrap; gap: 6px; }
.al-chip {
  font: inherit; font-size: 13.5px; color: var(--al-text); background: var(--al-surface);
  border: 1px solid var(--al-line); border-radius: 999px; padding: 7px 13px; cursor: pointer; min-height: 36px;
}
.al-chip:hover { border-color: var(--al-gold); }
.al-chip[aria-pressed="true"] { background: var(--al-text); border-color: var(--al-text); color: var(--al-bg); }

/* ------------------------------------------------------------------ tabs */
.al-tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--al-line); margin-bottom: 22px; overflow-x: auto; scrollbar-width: none; }
.al-tabs::-webkit-scrollbar { display: none; }
.al-tabs button {
  font: inherit; font-size: 14.5px; color: var(--al-muted); background: none; border: 0;
  border-bottom: 2px solid transparent; padding: 10px 12px; cursor: pointer; white-space: nowrap; min-height: 44px;
}
.al-tabs button:hover { color: var(--al-text); }
.al-tabs button[aria-selected="true"] { color: var(--al-text); border-bottom-color: var(--al-gold); font-weight: 500; }
.al-panel:focus { outline: none; }

/* --------------------------------------------------------------- status */
.al-statusbar { display: flex; flex-wrap: wrap; gap: 10px 16px; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.al-status {
  display: inline-flex; flex-wrap: wrap; align-items: center; gap: 4px 10px;
  background: var(--al-surface); border: 1px solid var(--al-line); border-radius: 14px; padding: 9px 14px;
  --tone: var(--al-muted);
}
.al-status[data-tone="good"] { --tone: var(--al-good); }
.al-status[data-tone="gold"] { --tone: var(--al-gold); }
.al-status[data-tone="blue"] { --tone: var(--al-blue); }
.al-status[data-tone="warn"] { --tone: var(--al-warn); }
.al-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--tone); flex: none; }
.al-status[data-tone="good"] .al-dot { box-shadow: 0 0 0 4px color-mix(in srgb, var(--al-good) 22%, transparent); }
.al-status-label { display: grid; line-height: 1.2; }
.al-status-label small { font-size: 11px; text-transform: uppercase; letter-spacing: .1em; color: var(--al-muted); }
.al-status-label b { font-weight: 600; color: var(--tone); }
.al-status[data-tone="muted"] .al-status-label b { color: var(--al-text); }
.al-status-line { color: var(--al-muted); font-size: 13.5px; }
.al-range-text { color: var(--al-muted); font-size: 14px; }

.al-caveats { background: var(--al-surface2); border: 1px solid var(--al-line); border-left: 3px solid var(--al-gold); border-radius: 12px; padding: 12px 16px; margin-bottom: 22px; }
.al-caveats h3 { font-size: 18px; margin-bottom: 6px; }
.al-caveats ul { margin: 0; padding-left: 18px; }
.al-caveats > ul > li { margin: 4px 0; }
.al-caveat-list { color: var(--al-muted); font-size: 14px; }

/* -------------------------------------------------------------- sections */
.al-section { margin: 0 0 30px; }
.al-section-head { display: flex; flex-wrap: wrap; gap: 4px 14px; align-items: baseline; margin-bottom: 12px; }
.al-section-head h2 { font-size: 24px; }
.al-section-head p { color: var(--al-muted); font-size: 14px; }
.al-sub-h { font-size: 19px; margin: 16px 0 8px; }

/* ----------------------------------------------------------------- cards */
.al-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 220px), 1fr)); gap: 12px; }
.al-card {
  background: var(--al-surface); border: 1px solid var(--al-line); border-radius: 16px;
  padding: 14px 16px; box-shadow: var(--al-shadow); display: grid; gap: 4px; align-content: start; min-width: 0;
}
.al-card h3 { font-family: var(--al-sans); font-size: 13px; font-weight: 500; color: var(--al-muted); text-transform: uppercase; letter-spacing: .06em; }
.al-figure { font-family: var(--al-serif); font-size: clamp(26px, 6vw, 32px); font-weight: 600; line-height: 1.15; font-variant-numeric: lining-nums tabular-nums; }
.al-figure.is-unknown { color: var(--al-muted); }
.al-reason { color: var(--al-muted); font-size: 13.5px; }
.al-sub { font-size: 13.5px; color: var(--al-text); }
.al-card[data-tone="bad"] .al-figure { color: var(--al-bad); }
.al-card[data-tone="warn"] .al-figure { color: var(--al-warn); }
.al-card[data-tone="gold"] .al-figure { color: var(--al-gold); }
.al-card[data-tone="muted"] { background: var(--al-surface2); box-shadow: none; }
.al-def { margin-top: 4px; font-size: 13px; color: var(--al-muted); }
.al-def summary { cursor: pointer; width: fit-content; color: var(--al-blue); list-style: none; }
.al-def summary::-webkit-details-marker { display: none; }
.al-def summary::before { content: "+ "; }
.al-def[open] summary::before { content: "− "; }
.al-def p { margin-top: 4px; }

/* ----------------------------------------------------------------- chart */
.al-figure-chart { margin: 0; background: var(--al-surface); border: 1px solid var(--al-line); border-radius: 16px; padding: 14px 14px 10px; }
.al-chart { display: block; width: 100%; height: 190px; }
.al-bar { fill: var(--al-blue); }
.al-bar:hover { fill: var(--al-gold); }
.al-axis { stroke: var(--al-line); stroke-width: 1; vector-effect: non-scaling-stroke; }
.al-ticks { display: flex; justify-content: space-between; color: var(--al-muted); font-size: 12px; margin-top: 4px; }
.al-sub[data-tone="warn"] { color: var(--al-warn); font-weight: 500; }
.al-figure-chart figcaption { color: var(--al-muted); font-size: 13px; margin-top: 6px; }

/* --------------------------------------------------------- notes & states */
.al-note { display: grid; gap: 2px; background: var(--al-surface2); border: 1px solid var(--al-line); border-radius: 12px; padding: 14px 16px; }
.al-note b { font-weight: 600; }
.al-note span { color: var(--al-muted); font-size: 14px; }
.al-note-error { border-color: color-mix(in srgb, var(--al-bad) 45%, var(--al-line)); }
.al-note-error b { color: var(--al-bad); }
.al-loading { display: flex; gap: 10px; align-items: center; color: var(--al-muted); padding: 22px 4px; }
.al-spinner { width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--al-line); border-top-color: var(--al-gold); animation: al-spin .8s linear infinite; }
@keyframes al-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .al-spinner { animation: none; } }
.al-msg { font-size: 14px; min-height: 1.4em; color: var(--al-muted); }
.al-msg[data-kind="good"] { color: var(--al-good); }
.al-msg[data-kind="gold"] { color: var(--al-gold); font-weight: 500; }
.al-msg[data-kind="error"] { color: var(--al-bad); }

.al-pill {
  display: inline-block; font-size: 12px; font-weight: 500; line-height: 1.5; padding: 1px 9px; margin-left: 6px;
  border-radius: 999px; background: var(--al-surface2); border: 1px solid var(--al-line); color: var(--al-muted);
  vertical-align: middle; white-space: nowrap;
}
.al-pill[data-tone="good"] { color: var(--al-good); border-color: color-mix(in srgb, var(--al-good) 40%, var(--al-line)); }
.al-pill[data-tone="gold"] { color: var(--al-gold); border-color: color-mix(in srgb, var(--al-gold) 50%, var(--al-line)); }
.al-pill[data-tone="warn"] { color: var(--al-warn); border-color: color-mix(in srgb, var(--al-warn) 45%, var(--al-line)); }
.al-pill[data-tone="bad"] { color: var(--al-bad); border-color: color-mix(in srgb, var(--al-bad) 45%, var(--al-line)); }

/* ----------------------------------------------------------------- table */
.al-table-wrap { overflow-x: auto; background: var(--al-surface); border: 1px solid var(--al-line); border-radius: 16px; max-width: 100%; }
.al-table { width: 100%; border-collapse: collapse; font-size: 14px; font-variant-numeric: tabular-nums; }
.al-table th, .al-table td { padding: 10px 12px; text-align: right; border-bottom: 1px solid var(--al-line); white-space: nowrap; }
.al-table thead th { font-weight: 500; color: var(--al-muted); font-size: 12.5px; text-transform: uppercase; letter-spacing: .05em; background: var(--al-surface2); }
.al-table th:first-child { text-align: left; }
.al-table tbody th { font-weight: 500; }
.al-table tbody th small { display: block; font-weight: 400; color: var(--al-muted); font-size: 12px; }
.al-table tbody tr:last-child > * { border-bottom: 0; }
.al-table .is-bad { color: var(--al-bad); font-weight: 600; }
.al-table .is-warn { color: var(--al-warn); font-weight: 600; }
.al-foot { color: var(--al-muted); font-size: 12.5px; padding: 8px 12px 10px; }

/* ----------------------------------------------------------------- lists */
.al-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.al-item { background: var(--al-surface); border: 1px solid var(--al-line); border-radius: 14px; padding: 13px 15px; min-width: 0; }
.al-item[data-status="submitted"] { border-left: 3px solid var(--al-gold); }
.al-item-top { display: flex; gap: 10px 16px; justify-content: space-between; align-items: flex-start; flex-wrap: wrap; }
.al-item-top > div:first-child { min-width: 0; flex: 1 1 220px; }
.al-item h3 { font-family: var(--al-sans); font-size: 16px; font-weight: 500; }
.al-meta { color: var(--al-muted); font-size: 13.5px; display: block; }
.al-item-amt { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; text-align: right; }
.al-item-amt b { font-family: var(--al-serif); font-size: 22px; font-weight: 600; font-variant-numeric: lining-nums tabular-nums; }
.al-item-extra { margin-top: 8px; font-size: 13.5px; color: var(--al-muted); display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: center; }
.al-item-extra .al-pill { margin-left: 0; }
.al-quote { margin-top: 6px; font-style: italic; color: var(--al-muted); font-size: 14px; }
.al-basis { margin-top: 4px; font-size: 12px; color: var(--al-muted); }
.al-group { margin-bottom: 20px; scroll-margin-top: 90px; }
.al-group h3 { font-size: 20px; margin-bottom: 8px; }
.al-group h3 .al-muted { font-family: var(--al-sans); font-size: 13.5px; font-weight: 400; }

.al-inv-left { display: flex; gap: 12px; align-items: flex-start; }
.al-inv-left label { cursor: pointer; min-width: 0; }
.al-check { width: 20px; height: 20px; margin: 2px 0 0; accent-color: var(--al-blue); flex: none; }

.al-decide { margin-top: 12px; padding-top: 12px; border-top: 1px dashed var(--al-line); display: grid; gap: 8px; }
.al-decide-btns { display: flex; flex-wrap: wrap; gap: 8px; }

.al-terms { margin-top: 6px; font-size: 14px; }
.al-terms.is-unset { color: var(--al-warn); }
.al-terms-host:not(:empty) { margin-top: 12px; padding-top: 12px; border-top: 1px dashed var(--al-line); }

/* -------------------------------------------------------------- buckets */
.al-buckets { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 140px), 1fr)); gap: 10px; }
.al-bucket {
  display: grid; gap: 2px; text-decoration: none; color: var(--al-text);
  background: var(--al-surface); border: 1px solid var(--al-line); border-radius: 14px; padding: 11px 13px;
}
.al-bucket:hover { border-color: var(--al-gold); }
.al-bucket small { color: var(--al-muted); font-size: 12.5px; text-transform: uppercase; letter-spacing: .05em; }
.al-bucket b { font-family: var(--al-serif); font-size: 22px; font-weight: 600; font-variant-numeric: lining-nums tabular-nums; }
.al-bucket[data-tone="bad"] b { color: var(--al-bad); }
.al-bucket[data-tone="warn"] b { color: var(--al-warn); }
.al-bucket[data-tone="gold"] b { color: var(--al-gold); }

/* ----------------------------------------------------------------- forms */
.al-form { background: var(--al-surface); border: 1px solid var(--al-line); border-radius: 16px; padding: 16px; }
.al-terms-form { background: var(--al-surface2); }
.al-fields { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 200px), 1fr)); gap: 12px 14px; }
.al-field { display: grid; gap: 5px; align-content: start; min-width: 0; }
.al-field.al-wide { grid-column: 1 / -1; }
.al-field label { font-size: 13.5px; color: var(--al-muted); font-weight: 500; }
.al-field label small { font-weight: 400; opacity: .8; }
.al-hint { font-size: 12.5px; color: var(--al-muted); }
.altura input[type="text"], .altura input[type="date"], .altura input[type="number"], .altura select, .altura textarea, .al-input {
  font: inherit; font-size: 15px; color: var(--al-text); background: var(--al-bg);
  border: 1px solid var(--al-line); border-radius: 10px; padding: 9px 11px; min-height: 42px; width: 100%; min-width: 0;
}
.altura textarea { resize: vertical; }
.altura input:focus, .altura select:focus, .altura textarea:focus { border-color: var(--al-blue); outline: 2px solid color-mix(in srgb, var(--al-blue) 30%, transparent); outline-offset: 0; }
.al-money-in { position: relative; display: block; }
.al-money-in > span { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--al-muted); pointer-events: none; }
.al-money-in input { padding-left: 26px !important; font-variant-numeric: tabular-nums; }
.al-checkline { display: flex; gap: 10px; align-items: center; }
.al-checkline input { width: 20px; height: 20px; accent-color: var(--al-blue); }
.al-checkline label { color: var(--al-text); font-weight: 400; }
.al-inline { display: flex; gap: 8px; flex-wrap: wrap; }
.al-inline input { flex: 1 1 160px; width: auto; }
.al-dates { list-style: none; padding: 0; margin: 4px 0 0; display: flex; flex-wrap: wrap; gap: 6px; }
.al-dates li { display: inline-flex; align-items: center; gap: 4px; background: var(--al-surface); border: 1px solid var(--al-line); border-radius: 999px; padding: 2px 4px 2px 11px; font-size: 13.5px; }
.al-x { font: inherit; background: none; border: 0; color: var(--al-muted); cursor: pointer; width: 28px; height: 28px; border-radius: 50%; }
.al-x:hover { color: var(--al-bad); }
.al-actions { display: flex; flex-wrap: wrap; gap: 10px 14px; align-items: center; margin-top: 14px; }
.al-alloc { display: grid; gap: 8px; }
.al-alloc-row { display: grid; grid-template-columns: 1fr minmax(120px, 170px); gap: 8px; align-items: center; }
.al-alloc-row label { font-size: 14px; }

.al-btn {
  font: inherit; font-size: 14px; font-weight: 500; color: var(--al-text); background: var(--al-surface);
  border: 1px solid var(--al-line); border-radius: 999px; padding: 8px 16px; min-height: 40px; cursor: pointer;
  transition: border-color .15s, background-color .15s;
}
.al-btn:hover { border-color: var(--al-gold); }
.al-btn:disabled { opacity: .55; cursor: progress; }
.al-btn-primary { background: var(--al-text); border-color: var(--al-text); color: var(--al-bg); }
.al-btn-primary:hover { background: var(--al-blue); border-color: var(--al-blue); }
.al-btn-good { border-color: color-mix(in srgb, var(--al-good) 55%, var(--al-line)); color: var(--al-good); }
.al-btn-good:hover { background: var(--al-good); color: #fff; border-color: var(--al-good); }
.al-btn-warn { border-color: color-mix(in srgb, var(--al-warn) 55%, var(--al-line)); color: var(--al-warn); }
.al-btn-quiet { border-color: transparent; background: transparent; color: var(--al-muted); }
.al-btn-quiet:hover { color: var(--al-text); }

/* The outlet's building in the hub drawer links here. */
.drawer-altura { display: inline-block; text-decoration: none; margin: 0 0 18px; }

/* ----------------------------------------------------------------- phone */
@media (max-width: 560px) {
  .al-head { align-items: stretch; }
  .al-range { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin: 0 -2px; padding: 2px; }
  .al-range::-webkit-scrollbar { display: none; }
  .al-chip { white-space: nowrap; }
  .al-grid { grid-template-columns: 1fr 1fr; gap: 8px; }
  .al-card { padding: 12px; }
  .al-card h3 { font-size: 11.5px; }
  .al-figure { font-size: 21px; }
  .al-buckets { grid-template-columns: 1fr 1fr; }
  .al-fields { grid-template-columns: 1fr 1fr; gap: 10px; }
  .al-form { padding: 12px; }
  .al-item-amt { align-items: flex-start; text-align: left; }
  .al-alloc-row { grid-template-columns: 1fr; }
  .al-chart { height: 150px; }
  .al-decide-btns .al-btn { flex: 1 1 auto; }
}
