/* Capital Buckets — web (UHNW planning tool) */

:root {
  --bg: #0c1017;
  --bg-elevated: #141a24;
  --bg-card: #161d2a;
  --border: rgba(255, 255, 255, 0.08);
  --border-strong: rgba(255, 255, 255, 0.14);
  --text: #e8edf5;
  --text-secondary: #9aa8bc;
  --text-muted: #6b7a90;
  --accent: #c4a35a;
  --accent-soft: rgba(196, 163, 90, 0.14);
  --accent-text: #e4c97a;
  --danger: #e0a06a;
  --radius: 12px;
  --shadow: 0 12px 40px rgba(0, 0, 0, 0.35);
  --font: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
  --font-sans: "Segoe UI", system-ui, -apple-system, sans-serif;
  --font-mono: "SF Mono", ui-monospace, Menlo, Consolas, monospace;
  --max: 1100px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  color-scheme: dark;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.5;
  color: var(--text);
  background:
    radial-gradient(1200px 600px at 10% -10%, rgba(196, 163, 90, 0.08), transparent 55%),
    radial-gradient(900px 500px at 100% 0%, rgba(80, 120, 180, 0.08), transparent 50%),
    var(--bg);
}

.mono {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
}

.app-header {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 24px;
  border-bottom: 1px solid var(--border);
  background: rgba(12, 16, 23, 0.85);
  backdrop-filter: blur(12px);
}

.brand {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.brand-title {
  font-family: var(--font);
  font-size: 1.25rem;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.brand-sub {
  font-size: 0.75rem;
  color: var(--text-muted);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.header-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

main {
  max-width: var(--max);
  margin: 0 auto;
  padding: 28px 24px 64px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.hero h1 {
  font-family: var(--font);
  font-size: clamp(1.75rem, 3vw, 2.25rem);
  font-weight: 700;
  margin: 0 0 8px;
  letter-spacing: 0.01em;
}

.hero p {
  margin: 0;
  max-width: 52rem;
  color: var(--text-secondary);
  font-size: 0.95rem;
}

.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px 22px 22px;
}

.card-header {
  margin-bottom: 16px;
}

.card-title {
  font-family: var(--font);
  font-size: 1.15rem;
  font-weight: 600;
  margin: 0 0 4px;
}

.card-subtitle {
  margin: 0;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.capital-row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 20px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 220px;
}

.field label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.field input {
  font-family: var(--font-mono);
  font-size: 1.1rem;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid var(--border-strong);
  background: var(--bg-elevated);
  color: var(--text);
  min-width: 280px;
  max-width: 100%;
}

.field input:focus {
  outline: 2px solid rgba(196, 163, 90, 0.45);
  outline-offset: 1px;
  border-color: var(--accent);
}

.parsed-box {
  margin-left: auto;
  text-align: right;
}

.parsed-box .label {
  display: block;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
}

.parsed-box .value {
  font-size: 1.35rem;
  font-weight: 600;
  color: var(--accent-text);
}

.btn {
  font-family: var(--font-sans);
  font-size: 0.875rem;
  font-weight: 600;
  padding: 8px 14px;
  border-radius: 8px;
  border: 1px solid var(--border-strong);
  background: var(--bg-elevated);
  color: var(--text);
  cursor: pointer;
}

.btn:hover {
  border-color: var(--accent);
  color: var(--accent-text);
}

.btn-primary {
  background: linear-gradient(180deg, #d4b56a, #a8883e);
  border-color: transparent;
  color: #1a1408;
}

.btn-primary:hover {
  filter: brightness(1.06);
  color: #1a1408;
}

.btn-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-bottom: 12px;
}

.metric {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  padding: 8px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

.metric:last-child {
  border-bottom: none;
}

.metric.emphasis .metric-value {
  color: var(--accent-text);
  font-weight: 600;
}

.metric-label {
  display: block;
  font-weight: 500;
}

.metric-secondary {
  display: block;
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: 2px;
}

.metric-value {
  white-space: nowrap;
  font-size: 0.95rem;
}

.subsection-title {
  font-size: 0.85rem;
  font-weight: 600;
  margin: 4px 0 8px;
  color: var(--text-secondary);
}

.section-rule {
  border: none;
  border-top: 1px solid var(--border);
  margin: 12px 0;
}

.callout {
  margin-top: 14px;
  padding: 12px 14px;
  border-radius: 8px;
  background: var(--accent-soft);
  border: 1px solid rgba(196, 163, 90, 0.2);
  color: var(--text-secondary);
  font-size: 0.82rem;
  line-height: 1.45;
}

.muted {
  color: var(--text-muted);
  margin: 0;
}

.error-banner {
  margin: 0 0 12px;
  padding: 8px 12px;
  border-radius: 8px;
  background: rgba(224, 160, 106, 0.12);
  border: 1px solid rgba(224, 160, 106, 0.35);
  color: var(--danger);
  font-size: 0.82rem;
  font-weight: 500;
}

.table-wrap {
  overflow-x: auto;
  margin-top: 8px;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.data-table th,
.data-table td {
  padding: 8px 10px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}

.data-table th {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  font-weight: 600;
}

.data-table .num {
  text-align: right;
  white-space: nowrap;
}

.data-table tfoot td {
  border-bottom: none;
  padding-top: 12px;
}

.emphasis-cell {
  color: var(--accent-text);
  font-weight: 600;
}

.pct-input {
  width: 72px;
  padding: 6px 8px;
  border-radius: 6px;
  border: 1px solid var(--border-strong);
  background: var(--bg-elevated);
  color: var(--text);
  font-size: 0.9rem;
}

.pct-input:focus {
  outline: 2px solid rgba(196, 163, 90, 0.4);
  border-color: var(--accent);
}

.cat-name {
  font-weight: 500;
}

.travel-breakdown {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-top: 4px;
  font-size: 0.78rem;
  color: var(--text-muted);
}

.projection-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: flex-end;
  margin-bottom: 12px;
}

.projection-controls .field input {
  min-width: 100px;
  width: 100px;
  font-size: 1rem;
}

.footer-note {
  font-size: 0.75rem;
  color: var(--text-muted);
  line-height: 1.45;
  max-width: 52rem;
}

@media (max-width: 720px) {
  .app-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .parsed-box {
    margin-left: 0;
    text-align: left;
  }

  .field input {
    min-width: 0;
    width: 100%;
  }

  .capital-row {
    flex-direction: column;
    align-items: stretch;
  }
}

@media print {
  body {
    background: white;
    color: black;
  }

  .app-header,
  .btn,
  .header-actions {
    display: none !important;
  }

  .card {
    box-shadow: none;
    border: 1px solid #ccc;
    break-inside: avoid;
    background: white;
  }

  .metric-value,
  .emphasis-cell,
  .parsed-box .value {
    color: black !important;
  }

  main {
    max-width: none;
    padding: 12px;
  }
}
