/* Calculator and KYC pages — Lunawat's burgundy-and-gold theme. */
:root {
    --tool-bg: #180000;
    --tool-panel: #300000;
    --tool-panel-2: #490300;
    --tool-wine: #3b0000;
    --tool-wine-light: #5b0700;
    --tool-gold: #efb72f;
    --tool-gold-light: #ffe16a;
    --tool-gold-dark: #ad6500;
    --tool-text: #fff9ed;
    --tool-muted: #dbcda9;
    --tool-field: #fff9ed;
    --tool-field-text: #321000;
    --tool-border: rgba(239, 183, 47, .58);
    --tool-danger: #b42336;
    --tool-shadow: 0 18px 45px rgba(0, 0, 0, .34);
}

* { box-sizing: border-box; }

body.tool-page {
    margin: 0;
    background:
        radial-gradient(circle at 50% 0, rgba(116, 12, 0, .42), transparent 38%),
        linear-gradient(180deg, #3f0000, var(--tool-bg)) !important;
    color: var(--tool-text);
    font-family: Montserrat, Arial, sans-serif;
    line-height: 1.5;
}

.tool-shell { min-height: 100vh; background: transparent; }

.tool-header {
    background: linear-gradient(180deg, #470100, #2b0000);
    border-bottom: 1px solid var(--tool-gold);
}

.tool-brand {
    min-height: 142px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 8px 20px;
}

.tool-brand img {
    content: url("../assets/lunawats-logo.svg");
    width: min(460px, 80vw);
    height: 116px;
    object-fit: contain;
    filter: drop-shadow(0 3px 2px rgba(0, 0, 0, .45));
}

.tool-nav {
    background: linear-gradient(100deg, #dda019, var(--tool-gold-light) 48%, #d99a14);
    border-top: 1px solid #ffea91;
    border-bottom: 1px solid var(--tool-gold-dark);
}

.tool-nav__inner {
    max-width: 1180px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    margin: auto;
    padding: 0 16px;
}

.tool-nav a {
    min-height: 50px;
    display: flex;
    align-items: center;
    padding: 0 14px;
    border-bottom: 2px solid transparent;
    color: #321000;
    font-size: 12px;
    font-weight: 800;
    letter-spacing: .03em;
    text-decoration: none;
    text-transform: uppercase;
}

.tool-nav a:hover,
.tool-nav a:focus-visible,
.tool-nav a[aria-current="page"] {
    background: var(--tool-wine);
    border-bottom-color: var(--tool-gold-light);
    color: var(--tool-gold-light);
}

.tool-main {
    width: min(1120px, calc(100% - 32px));
    margin: 0 auto;
    padding: 56px 0 72px;
}

.tool-intro { max-width: 740px; margin-bottom: 30px; }

.tool-intro h1 {
    margin: 0 0 10px;
    color: var(--tool-gold-light);
    font-size: clamp(2rem, 5vw, 4rem);
    line-height: 1.04;
    letter-spacing: -.03em;
    text-shadow: 0 2px 2px rgba(0, 0, 0, .45);
}

.tool-intro p { margin: 0; color: var(--tool-muted); font-size: 1rem; }

.tool-panel {
    overflow: hidden;
    background: linear-gradient(135deg, var(--tool-panel-2), var(--tool-panel));
    border: 1px solid var(--tool-border);
    border-radius: 14px;
    box-shadow: var(--tool-shadow);
}

.tool-panel__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    padding: 22px 26px;
    background: var(--tool-wine-light);
    border-bottom: 1px solid var(--tool-border);
}

.tool-panel__head h2 { margin: 0; color: var(--tool-gold-light); font-size: 1.2rem; }

.gst-badge {
    padding: 6px 11px;
    border-radius: 999px;
    background: var(--tool-gold);
    color: #321000;
    font-size: .78rem;
    font-weight: 800;
    white-space: nowrap;
}

.tool-body { padding: 28px; }

.form-section {
    margin: 0 0 28px;
    padding: 0 0 28px;
    border: 0;
    border-bottom: 1px solid var(--tool-border);
}

.form-section:last-of-type { margin-bottom: 8px; border-bottom: 0; }
.form-section legend { margin: 0 0 18px; padding: 0; color: var(--tool-gold-light); font-size: 1.08rem; font-weight: 700; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px 22px; }
.field--wide { grid-column: 1 / -1; }
.field label { display: block; margin: 0 0 7px; color: var(--tool-gold-light); font-size: .88rem; font-weight: 700; }
.required { color: #ff7b8e; }

.field input,
.field select,
.field textarea {
    width: 100%;
    min-height: 48px;
    padding: 11px 13px;
    background: var(--tool-field);
    border: 1px solid var(--tool-gold-dark);
    border-radius: 8px;
    color: var(--tool-field-text);
    font: inherit;
    outline: none;
}

.field textarea { min-height: 104px; resize: vertical; }
.field input::placeholder, .field textarea::placeholder { color: #806f58; }
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--tool-gold-light); box-shadow: 0 0 0 3px rgba(239, 183, 47, .23); }
.field small { display: block; margin-top: 6px; color: var(--tool-muted); font-size: .76rem; }

.calc-table-wrap { width: 100%; overflow-x: auto; margin-bottom: 14px; }
.calc-table { width: 100%; border-collapse: collapse; table-layout: fixed; color: var(--tool-text); }
.calc-table th { padding: 13px 12px; background: linear-gradient(90deg, #dda019, var(--tool-gold-light), #dda019); color: #321000; font-size: .78rem; font-weight: 800; letter-spacing: .02em; text-align: left; text-transform: uppercase; }
.calc-table th:first-child { border-radius: 8px 0 0 8px; }
.calc-table th:last-child { width: 58px; border-radius: 0 8px 8px 0; }
.calc-table td { padding: 12px; border-bottom: 1px solid var(--tool-border); color: var(--tool-text); vertical-align: middle; }
.calc-table td:first-child, .calc-table th:first-child { width: 24%; }
.calc-table td:nth-child(2), .calc-table th:nth-child(2) { width: 18%; }
.calc-table td:nth-child(3), .calc-table th:nth-child(3) { width: 24%; }
.calc-table td:nth-child(4), .calc-table th:nth-child(4) { width: 23%; }

.calc-table input,
.calc-table select {
    width: 100%;
    min-height: 44px;
    padding: 9px 10px;
    background: var(--tool-field);
    border: 1px solid var(--tool-gold-dark);
    border-radius: 8px;
    color: var(--tool-field-text);
    font: inherit;
}

.calc-table input:focus, .calc-table select:focus { outline: 0; border-color: var(--tool-gold-light); box-shadow: 0 0 0 3px rgba(239, 183, 47, .23); }
.calc-amount { display: block; color: var(--tool-text); font-variant-numeric: tabular-nums; white-space: nowrap; }

.remove-row-button {
    width: 38px;
    height: 38px;
    border: 1px solid rgba(255, 123, 142, .6);
    border-radius: 8px;
    background: var(--tool-wine-deep, #210000);
    color: #ff8a9a;
    font-size: 1.45rem;
    line-height: 1;
    cursor: pointer;
}

.remove-row-button:hover, .remove-row-button:focus-visible { background: var(--tool-danger); border-color: #ff8a9a; color: #fff; }

.add-row-button,
.tool-button {
    min-height: 44px;
    border: 1px solid var(--tool-gold-dark);
    border-radius: 8px;
    background: linear-gradient(100deg, #d99b19, var(--tool-gold-light), #d99b19);
    color: #321000;
    font: inherit;
    font-weight: 800;
    cursor: pointer;
}

.add-row-button { display: flex; align-items: center; gap: 7px; margin: 0 0 26px auto; padding: 0 15px; }
.tool-button { min-height: 46px; padding: 0 22px; }
.add-row-button:hover, .add-row-button:focus-visible, .tool-button:hover, .tool-button:focus-visible { background: var(--tool-gold-light); }
.tool-button--secondary { background: transparent; border-color: var(--tool-gold); color: var(--tool-gold-light); }
.tool-button--secondary:hover, .tool-button--secondary:focus-visible { background: var(--tool-wine-light); color: var(--tool-gold-light); }

.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; margin: -1px; padding: 0; border: 0; clip: rect(0, 0, 0, 0); white-space: nowrap; }
.summary { width: 100%; margin-left: 0; border-top: 1px solid var(--tool-border); }
.summary-row { display: flex; justify-content: space-between; gap: 24px; padding: 13px 0; border-bottom: 1px solid var(--tool-border); }
.summary-row span:first-child { color: var(--tool-muted); }
.summary-row strong { color: var(--tool-text); font-variant-numeric: tabular-nums; }
.summary-row--total { padding-top: 18px; border-bottom: 0; color: var(--tool-gold-light); font-size: 1.25rem; }
.summary-row--total strong { color: var(--tool-gold-light); }
.actions { display: flex; align-items: center; gap: 12px; margin-top: 26px; }
.form-status { margin: 0; color: var(--tool-muted); }
.form-status.is-success { color: #7cdaa9; }
.form-status.is-error { color: #ff8a9a; }

.tool-footer {
    padding: 24px 16px;
    background: var(--tool-wine-deep, #210000);
    border-top: 3px solid var(--tool-gold);
    color: var(--tool-muted);
    font-size: .85rem;
    text-align: center;
}

@media (max-width: 760px) {
    .tool-brand { min-height: 112px; }
    .tool-brand img { width: min(230px, 78vw); height: 80px; }
    .tool-nav__inner { justify-content: flex-start; overflow-x: auto; flex-wrap: nowrap; }
    .tool-nav a { white-space: nowrap; }
    .tool-main { padding: 36px 0 52px; }
    .tool-panel__head { align-items: flex-start; }
    .tool-body { padding: 20px; }
    .form-grid { grid-template-columns: 1fr; }
    .field--wide { grid-column: auto; }
    .actions { align-items: stretch; flex-direction: column; }
    .tool-button { width: 100%; }
    .calc-table { min-width: 720px; table-layout: auto; }
    .calc-table td:first-child, .calc-table th:first-child { width: 180px; }
    .calc-table td:nth-child(2), .calc-table th:nth-child(2) { width: 135px; }
    .calc-table td:nth-child(3), .calc-table th:nth-child(3) { width: 170px; }
    .calc-table td:nth-child(4), .calc-table th:nth-child(4) { width: 155px; }
}

@media (prefers-reduced-motion: reduce) {
    * { scroll-behavior: auto !important; }
}
