/* styles.css — AI Cost Calculator. Refined dark (Linear/Vercel feel). */

:root {
  --bg-base: #f5fbff;
  --bg-surface: #ffffff;
  --bg-surface-hover: #f1f8fd;
  --bg-subtle: #eaf3fa;
  --border: #d0e2f1;
  --border-subtle: #e0edf7;
  --accent: #14BBA6;
  --accent-hover: #2fd7c2;
  --accent-muted: #14bba629;
  --text-primary: #0a2a45;
  --text-secondary: #446683;
  --text-tertiary: #6e8ca8;
  --warning: #F59E0B;
  --destructive: #EF4444;
  /* legacy aliases */
  --bg: var(--bg-base); --card: var(--bg-surface); --accent: #14BBA6;
  --text: var(--text-primary); --secondary: var(--text-secondary); --warn: var(--warning);
  --input-border: var(--border);
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { background: radial-gradient(1200px 600px at 50% -240px, #d8eefd 0%, transparent 60%), var(--bg-base); color: var(--text-primary); font-family: "Geist", system-ui, sans-serif; font-weight: 400; line-height: 1.6; margin: 0; min-width: 375px; -webkit-font-smoothing: antialiased; }
.accent { color: var(--accent); }
.text-secondary { color: var(--text-secondary); }
h1, h2, h3 { font-weight: 600; letter-spacing: -0.02em; }

.header { display: flex; justify-content: space-between; align-items: center; padding: 16px 24px; height: 60px; border-bottom: 1px solid var(--border-subtle); }
.header-left { display: flex; align-items: center; gap: 16px; }
.back-link { color: var(--text-secondary); text-decoration: none; font-size: .9rem; transition: color 200ms ease; }
.back-link:hover { color: var(--accent); }
.logo { display: inline-flex; align-items: center; gap: 8px; font-weight: 600; font-size: 1.05rem; color: var(--text-primary); text-decoration: none; }
.logo-img { display: inline-block; width: auto; height: 29px; }
.logo-fallback { display: none; }
.tagline { color: var(--text-secondary); font-size: .85rem; }
@media (max-width: 920px) { .back-link { display: none; } }
@media (max-width: 640px) { .tagline { display: none; } }
@media (max-width: 640px) { .logo-img { height: 24px; } }

.progress { height: 3px; background: var(--bg-subtle); border-radius: 999px; }
.progress-fill { height: 100%; width: 25%; background: var(--accent); border-radius: 999px; transition: width .4s ease; }
.step-indicator { color: var(--text-tertiary); font-size: 11px; font-weight: 500; letter-spacing: 0.08em; text-transform: uppercase; padding: 16px 24px 0; max-width: 720px; margin: 0 auto; }
.wrap { max-width: 720px; margin: 0 auto; padding: 24px 24px 80px; }

.card { background: var(--bg-surface); border: 1px solid var(--border); border-radius: 12px; padding: 2rem; transition: all 200ms ease; }
.card.insight { border-left: 3px solid var(--accent); background: var(--accent-muted); padding: 1.5rem 2rem; }
.card.pro { border-color: var(--accent); }

.input { background: var(--bg-subtle); border: 1px solid var(--border); color: var(--text-primary); border-radius: 8px; padding: 10px 14px; font-size: .9rem; font-family: inherit; }
.input::placeholder { color: var(--text-tertiary); }
.input:focus { outline: none; border-color: var(--accent); }
.btn-primary { background: var(--accent); color: #05324f; font-weight: 600; border: none; border-radius: 8px; padding: 10px 20px; cursor: pointer; font-family: inherit; transition: background 200ms ease; }
.btn-primary:hover { background: var(--accent-hover); }
.btn-ghost { background: transparent; color: var(--text-primary); border: 1px solid var(--border); border-radius: 8px; padding: 10px 20px; cursor: pointer; font-family: inherit; transition: all 200ms ease; }
.btn-ghost:hover { border-color: var(--accent); color: var(--accent); }
.nav-row { display: flex; justify-content: space-between; gap: 12px; margin-top: 24px; }
.error { color: var(--destructive); font-size: .85rem; }
label, .label { font-size: 11px; font-weight: 500; letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-tertiary); }

.role-head, .role-row { display: grid; grid-template-columns: 32px 1fr 64px 120px; gap: 8px; align-items: center; }
.role-head { color: var(--text-tertiary); font-size: 11px; font-weight: 500; letter-spacing: 0.08em; text-transform: uppercase; padding: 0 0 10px; }
.role-row { padding: 14px 8px; border-bottom: 1px solid var(--border-subtle); }
.role-row .rrm { background: none; border: none; color: var(--text-tertiary); cursor: pointer; }
.chk { display: block; margin-bottom: 6px; }

.tool-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 12px; }
.tool-card { background: var(--bg-surface); border: 1px solid var(--border); border-radius: 8px; padding: 1rem; cursor: pointer; display: flex; flex-direction: column; gap: 4px; transition: all 200ms ease; }
.tool-card strong { font-weight: 500; }
.tool-card small { color: var(--text-tertiary); font-size: .8rem; }
.tool-card:hover { border-color: var(--accent-muted); background: var(--bg-surface-hover); }
.tool-card.sel { border-color: var(--accent); background: var(--accent-muted); }
.adopt-grid { display: grid; gap: 12px; }
.adopt { display: flex; flex-direction: column; gap: 4px; border: 1px solid var(--border); border-left: 3px solid var(--border); border-radius: 8px; padding: 1.25rem; cursor: pointer; transition: all 200ms ease; }
.adopt strong { font-weight: 500; color: var(--text-primary); }
.adopt small { color: var(--text-secondary); font-size: .85rem; }
.adopt input { display: none; }
.adopt.sel { border-color: var(--accent); border-left: 3px solid var(--accent); background: var(--accent-muted); }
.mode-grid { display: grid; gap: 12px; grid-template-columns: 1fr 1fr; }
.mode-grid .adopt { padding: 1rem 1.1rem; }
.mode-grid .adopt strong { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.rec-pill { display: inline-block; background: var(--accent); color: #05324f; font-weight: 600; border-radius: 999px; padding: 2px 9px; font-size: .68rem; letter-spacing: .02em; }
@media (max-width: 480px) { .mode-grid { grid-template-columns: 1fr; } }
.seg-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.seg { background: var(--bg-surface); border: 1px solid var(--border); color: var(--text-primary); border-radius: 8px; padding: .7rem; cursor: pointer; transition: all 200ms ease; }
.seg.sel { border-color: var(--accent); background: var(--accent-muted); }
@media (max-width: 480px) { .seg-grid { grid-template-columns: 1fr 1fr; } }

.chart-row { display: grid; grid-template-columns: 120px 1fr 70px; gap: 12px; align-items: center; margin-bottom: 12px; }
.chart-label { font-size: .85rem; color: var(--text-secondary); }
.chart-bar { background: var(--bg-subtle); border-radius: 2px; height: 14px; overflow: hidden; }
.chart-fill { display: block; height: 100%; background: var(--accent); border-radius: 2px; }
.chart-amt { text-align: right; font-size: .85rem; }
.split { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.split-cell { display: flex; flex-direction: column; gap: 3px; border: 1px solid var(--border); border-radius: 8px; padding: 12px 14px; background: var(--bg-subtle); }
.split-cell strong { font-size: 1.25rem; font-weight: 600; }
.split-per { font-size: .8rem; color: var(--text-tertiary); font-weight: 400; }
.split-label { font-size: .8rem; color: var(--text-secondary); display: flex; align-items: center; gap: 7px; }
.split-tag { font-style: normal; font-size: .62rem; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; border-radius: 999px; padding: 2px 7px; }
.split-cell:first-child .split-tag { background: var(--accent-muted); color: var(--accent); }
.split-cell:last-child .split-tag { background: rgba(245,158,11,.15); color: var(--warning); }
@media (max-width: 480px) { .split { grid-template-columns: 1fr; } }
.risk-pill { display: inline-block; background: rgba(245,158,11,.15); color: var(--warning); border-radius: 999px; padding: 5px 12px; margin: 3px; font-size: .8rem; }

.banner { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; background: var(--bg-surface); border: 1px solid var(--border); border-left: 3px solid var(--accent); border-radius: 8px; padding: 16px; max-width: 720px; margin: 16px auto 0; }
.banner-in { flex: 1; min-width: 140px; }
.banner button#banner-x { background: none; border: none; color: var(--text-secondary); cursor: pointer; margin-left: auto; }

.override { display: flex; gap: 8px; margin-top: 8px; }
.override label { display: flex; flex-direction: column; font-size: .7rem; color: var(--text-secondary); flex: 1; min-width: 0; }
.override .input { width: 100%; min-width: 0; padding: .4rem .55rem; font-size: .8rem; }
.restart-wrap { text-align: center; margin-top: 32px; }

.fade-in { animation: fade .35s ease; }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
details summary { cursor: pointer; color: var(--accent); font-size: .9rem; }

::-webkit-scrollbar { width: 10px; }
::-webkit-scrollbar-track { background: var(--bg-base); }
::-webkit-scrollbar-thumb { background: #9ebbd5; border-radius: 5px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

@media (max-width: 480px) {
  .card { padding: 1.5rem; }
  .nav-row .btn-primary { flex: 1; }
}

/* Print-only elements are hidden on screen, revealed in @media print. */
.print-only { display: none; }

@media print {
  @page { margin: 18mm 16mm; }
  * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }

  body { background: #fff !important; color: var(--text-primary); font-size: 10.5pt; line-height: 1.5; }
  .header, .progress, .step-indicator, #banner, .nav-row, .pro,
  #export-card, #email-card, .restart-wrap, button { display: none !important; }
  .fade-in { animation: none !important; }

  .wrap { max-width: 100%; padding: 0; margin: 0; }

  /* Document title block */
  h2 { font-size: 18pt; margin: 0 0 4px; letter-spacing: -0.02em; }
  #wizard-content > p.text-secondary { margin: 0 0 22px; color: var(--text-secondary); }

  /* Branded print header */
  .print-only { display: block; }
  .print-header {
    display: flex !important;
    align-items: flex-end;
    justify-content: space-between;
    gap: 24px;
    padding: 0 0 16px;
    margin: 0 0 26px;
    border-bottom: 2px solid var(--accent);
    break-after: avoid;
  }
  .print-logo { height: 40px; width: auto; flex: 0 0 auto; }
  .print-meta { text-align: right; line-height: 1.45; min-width: 0; }
  .print-meta-title { font-weight: 600; font-size: 12pt; color: var(--text-primary); margin: 0; letter-spacing: -0.01em; }
  .print-meta-sub { font-size: 9.5pt; color: var(--text-secondary); margin: 2px 0 0; }
  .print-meta-date { font-size: 8.5pt; color: var(--text-tertiary); margin: 2px 0 0; }

  /* Cards */
  .card {
    break-inside: avoid;
    box-shadow: none;
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 18px 20px;
    margin: 0 0 14px;
    background: #fff;
  }
  .card.insight { border-left: 3px solid var(--accent); background: var(--accent-muted); padding: 18px 20px; }
  .card h3 { margin-top: 0; }

  /* Headline numbers keep emphasis but sit on the page calmly */
  .text-4xl { font-size: 26pt; line-height: 1.1; }

  /* Tables: tidy rules and breathing room */
  #breakdown, #formula { display: block !important; margin-top: 12px; }
  table { width: 100%; border-collapse: collapse; }
  thead th { padding: 0 6px 6px; border-bottom: 1px solid var(--border); font-size: 9pt; }
  tbody td { padding: 5px 6px; border-bottom: 1px solid var(--border-subtle); }
  tbody tr:last-child td { border-bottom: none; }
  tr.font-semibold td { border-top: 1px solid var(--border); border-bottom: none; padding-top: 7px; }

  /* Branded print footer */
  .print-footer {
    margin-top: 24px;
    padding-top: 12px;
    border-top: 1px solid var(--border-subtle);
    text-align: center;
    font-size: 8.5pt;
    color: var(--text-tertiary);
    letter-spacing: 0.01em;
  }
}
