/* ==========================================================================
   Amortization Table — stylesheet
   Palette: deep ink + emerald accent + warm neutrals
   ========================================================================== */

:root {
    --ink:        #0f1c1a;
    --ink-soft:   #38524d;
    --paper:      #f6f4ee;
    --surface:    #ffffff;
    --line:       #e3e0d6;
    --emerald:    #0f7a5a;
    --emerald-dk: #0a5b43;
    --amber:      #b8862f;
    --radius:     14px;
    --shadow:     0 1px 2px rgba(15, 28, 26, 0.06), 0 8px 24px rgba(15, 28, 26, 0.06);
}

* { box-sizing: border-box; }

html, body { margin: 0; }

body {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    color: var(--ink);
    background: var(--paper);
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
}

.container {
    width: 100%;
    max-width: 1080px;
    margin-inline: auto;
    padding-inline: 1.25rem;
}

/* ---------- Header ---------- */
.site-header {
    position: sticky;
    top: 0;
    z-index: 20;
    background: rgba(246, 244, 238, 0.85);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--line);
}

.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 64px;
}

.brand {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    text-decoration: none;
    color: var(--ink);
    font-weight: 700;
    font-size: 1.15rem;
}

.brand-mark {
    display: grid;
    place-items: center;
    width: 34px;
    height: 34px;
    border-radius: 9px;
    background: var(--emerald);
    color: #fff;
    font-size: 1.1rem;
}

.brand-text strong { color: var(--emerald); }

.header-nav {
    display: flex;
    gap: 1.5rem;
}

.header-nav a {
    color: var(--ink-soft);
    text-decoration: none;
    font-weight: 500;
    font-size: 0.95rem;
}

.header-nav a:hover { color: var(--emerald); }

/* ---------- Hero ---------- */
.hero {
    padding: 4rem 0 2.5rem;
}

.eyebrow {
    text-transform: uppercase;
    letter-spacing: 0.12em;
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--emerald);
    margin: 0 0 0.75rem;
}

.hero h1 {
    font-size: clamp(2rem, 5vw, 3.1rem);
    line-height: 1.08;
    margin: 0 0 1rem;
    max-width: 18ch;
    text-wrap: balance;
}

.hero-sub {
    max-width: 60ch;
    color: var(--ink-soft);
    font-size: 1.05rem;
    margin: 0;
}

/* ---------- Cards ---------- */
.card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 1.5rem;
    box-shadow: var(--shadow);
}

.card-title {
    font-size: 1.05rem;
    margin: 0 0 1.25rem;
}

/* ---------- Calculator grid ---------- */
.calc-grid {
    display: grid;
    grid-template-columns: 1.1fr 0.9fr;
    gap: 1.5rem;
    align-items: start;
    margin-bottom: 1.5rem;
}

@media (max-width: 820px) {
    .calc-grid { grid-template-columns: 1fr; }
}

.field {
    display: block;
    margin-bottom: 1.1rem;
}

.field-label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    margin-bottom: 0.4rem;
}

.field-label em {
    font-style: normal;
    font-weight: 400;
    color: var(--ink-soft);
}

.field-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

input[type="text"],
input[type="number"],
input[type="search"] {
    width: 100%;
    font: inherit;
    padding: 0.7rem 0.85rem;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: var(--paper);
    color: var(--ink);
    transition: border-color 0.15s, box-shadow 0.15s;
}

input:focus {
    outline: none;
    border-color: var(--emerald);
    box-shadow: 0 0 0 3px rgba(15, 122, 90, 0.15);
}

.input-affix {
    position: relative;
    display: flex;
    align-items: center;
}

.input-affix .affix {
    position: absolute;
    left: 0.85rem;
    color: var(--ink-soft);
    font-weight: 500;
    pointer-events: none;
}

.input-affix .affix-end {
    left: auto;
    right: 0.85rem;
}

.input-affix .affix ~ input { padding-left: 1.8rem; }
.input-affix input + .affix-end ~ input { padding-right: 2.2rem; }
.input-affix:has(.affix-end) input { padding-right: 2.6rem; }

/* ---------- Buttons ---------- */
.form-actions {
    display: flex;
    gap: 0.75rem;
    margin-top: 0.5rem;
    flex-wrap: wrap;
}

.btn {
    font: inherit;
    font-weight: 600;
    padding: 0.7rem 1.25rem;
    border-radius: 10px;
    border: 1px solid transparent;
    cursor: pointer;
    transition: background 0.15s, transform 0.05s;
}

.btn:active { transform: translateY(1px); }

.btn-primary {
    background: var(--emerald);
    color: #fff;
}

.btn-primary:hover { background: var(--emerald-dk); }

.btn-ghost {
    background: transparent;
    color: var(--emerald);
    border-color: var(--emerald);
}

.btn-ghost:hover { background: rgba(15, 122, 90, 0.08); }

/* ---------- Alerts ---------- */
.alert {
    margin: 1rem 0 0;
    padding: 0.7rem 0.9rem;
    border-radius: 10px;
    font-size: 0.9rem;
}

.alert-error {
    background: #fcebea;
    color: #9b1c17;
}

.alert-success {
    background: #e6f4ee;
    color: var(--emerald-dk);
}

/* ---------- Summary ---------- */
.summary-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.85rem;
}

.stat {
    padding: 1rem;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--paper);
}

.stat-feature {
    grid-column: 1 / -1;
    background: var(--ink);
    border-color: var(--ink);
    color: #fff;
}

.stat-label {
    display: block;
    font-size: 0.8rem;
    color: var(--ink-soft);
    margin-bottom: 0.3rem;
}

.stat-feature .stat-label { color: rgba(255, 255, 255, 0.7); }

.stat-value {
    font-family: 'Spline Sans Mono', monospace;
    font-size: 1.4rem;
    font-weight: 600;
}

.stat-feature .stat-value { font-size: 2rem; }

.empty-state {
    color: var(--ink-soft);
    margin: 0;
}

/* ---------- Tables ---------- */
.table-card { margin-bottom: 1.5rem; }

.table-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

.table-head .card-title { margin: 0; }

#tableFilter { max-width: 200px; }

.table-scroll {
    overflow-x: auto;
    border: 1px solid var(--line);
    border-radius: 12px;
}

table.schedule {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.92rem;
    min-width: 560px;
}

table.schedule th {
    text-align: left;
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--ink-soft);
    background: var(--paper);
    padding: 0.75rem 1rem;
    position: sticky;
    top: 0;
}

table.schedule td {
    padding: 0.65rem 1rem;
    border-top: 1px solid var(--line);
    font-variant-numeric: tabular-nums;
}

table.schedule tbody tr:hover { background: rgba(15, 122, 90, 0.04); }

td.pos { color: var(--emerald-dk); }
td.neg { color: var(--amber); }

/* ---------- Footer ---------- */
.site-footer {
    border-top: 1px solid var(--line);
    margin-top: 2rem;
    padding: 1.75rem 0;
    color: var(--ink-soft);
    font-size: 0.9rem;
}
