:root {
    --color-bg: #f8fafc;
    --color-surface: #ffffff;
    --color-text: #0f172a;
    --color-muted: #64748b;
    --color-border: #e2e8f0;
    --color-primary: #1d4ed8;
    --color-reported: #64748b;
    --color-wrong: #dc2626;
    --color-wrong-bg: #fef2f2;
    --color-refund: #15803d;
    --color-refund-bg: #f0fdf4;
    --color-accent: #0ea5e9;
    --radius: 12px;
    --shadow: 0 1px 3px rgba(15, 23, 42, 0.08);
    --font: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    --max-width: 920px;
}

* { box-sizing: border-box; }
html { font-size: 18px; scroll-behavior: smooth; }
body {
    margin: 0;
    font-family: var(--font);
    background: var(--color-bg);
    color: var(--color-text);
    line-height: 1.6;
}

a { color: var(--color-primary); text-decoration-thickness: 2px; }
a:hover { text-decoration: underline; }

.container { max-width: var(--max-width); margin: 0 auto; padding: 1.5rem; }

.site-header {
    background: var(--color-surface);
    border-bottom: 1px solid var(--color-border);
    position: sticky;
    top: 0;
    z-index: 100;
}
.site-header .inner {
    max-width: 1100px;
    margin: 0 auto;
    padding: 0.75rem 1.5rem;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 1rem;
    justify-content: space-between;
}
.brand { font-weight: 700; font-size: 1.1rem; color: var(--color-text); text-decoration: none; }
.nav { display: flex; flex-wrap: wrap; gap: 0.5rem 1rem; font-size: 0.95rem; }
.nav a { color: var(--color-muted); text-decoration: none; padding: 0.25rem 0; }
.nav a:hover, .nav a.active { color: var(--color-primary); }

.hero-box {
    background: linear-gradient(135deg, #eff6ff, #f0fdf4);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    padding: 2rem;
    margin-bottom: 2rem;
}
.hero-box h1 { margin-top: 0; font-size: 1.75rem; line-height: 1.3; }
.lead { font-size: 1.15rem; color: var(--color-muted); }

.summary-strip {
    background: var(--color-refund-bg);
    border: 2px solid #86efac;
    border-radius: var(--radius);
    padding: 1.5rem 2rem;
    margin: 1.5rem 0;
    text-align: center;
}
.summary-strip .amount { font-size: 2.5rem; font-weight: 800; color: var(--color-refund); display: block; }
.summary-strip .label { font-size: 1rem; color: var(--color-muted); }

.card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    padding: 1.5rem;
    margin-bottom: 1.25rem;
    box-shadow: var(--shadow);
}
.card h2, .card h3 { margin-top: 0; }

.important-first {
    background: #fffbeb;
    border-left: 4px solid #f59e0b;
    padding: 1rem 1.25rem;
    margin-bottom: 1.5rem;
    border-radius: 0 var(--radius) var(--radius) 0;
}
.important-first strong { display: block; margin-bottom: 0.25rem; }

.steps { counter-reset: step; list-style: none; padding: 0; }
.steps li {
    counter-increment: step;
    padding: 1rem 1rem 1rem 3.5rem;
    position: relative;
    margin-bottom: 0.75rem;
    background: var(--color-surface);
    border-radius: var(--radius);
    border: 1px solid var(--color-border);
}
.steps li::before {
    content: counter(step);
    position: absolute;
    left: 1rem;
    top: 1rem;
    width: 2rem;
    height: 2rem;
    background: var(--color-primary);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.9rem;
}

.amount-reported { color: var(--color-reported); font-weight: 600; }
.amount-wrong { color: var(--color-wrong); font-weight: 700; }
.amount-refund { color: var(--color-refund); font-weight: 700; }

.year-grid { display: grid; gap: 1rem; }
@media (min-width: 640px) { .year-grid { grid-template-columns: repeat(2, 1fr); } }
.year-card {
    display: block;
    text-decoration: none;
    color: inherit;
    background: var(--color-surface);
    border: 2px solid var(--color-border);
    border-radius: var(--radius);
    padding: 1.5rem;
    transition: border-color 0.15s, box-shadow 0.15s;
}
.year-card:hover { border-color: var(--color-primary); box-shadow: 0 4px 12px rgba(29,78,216,0.12); }
.year-card .year-label { font-size: 2rem; font-weight: 800; color: var(--color-primary); }
.year-card .wrong { font-size: 1.5rem; font-weight: 700; color: var(--color-wrong); }

.btn {
    display: inline-block;
    padding: 0.65rem 1.25rem;
    border-radius: 8px;
    font-weight: 600;
    text-decoration: none;
    border: none;
    cursor: pointer;
    font-size: 1rem;
}
.btn-primary { background: var(--color-primary); color: white; }
.btn-secondary { background: var(--color-surface); color: var(--color-text); border: 1px solid var(--color-border); }
.btn:hover { opacity: 0.92; }

.simpler-toggle {
    margin-top: 0.75rem;
    font-size: 0.9rem;
    color: var(--color-primary);
    background: none;
    border: none;
    cursor: pointer;
    text-decoration: underline;
    padding: 0;
}
.simpler-panel {
    display: none;
    margin-top: 0.75rem;
    padding: 1rem;
    background: #f1f5f9;
    border-radius: 8px;
    font-size: 0.95rem;
}
.simpler-panel.open { display: block; }

.term {
    border-bottom: 1px dotted var(--color-muted);
    cursor: help;
    position: relative;
    color: var(--color-primary);
}
.term:focus { outline: 2px solid var(--color-primary); outline-offset: 2px; border-radius: 2px; }
.term:hover::after, .term:focus::after {
    content: attr(data-tip);
    position: absolute;
    left: 0;
    top: 100%;
    margin-top: 0.4rem;
    z-index: 200;
    width: max-content;
    max-width: 300px;
    background: var(--color-text);
    color: #fff;
    padding: 0.6rem 0.75rem;
    border-radius: 8px;
    font-size: 0.85rem;
    line-height: 1.45;
    font-weight: 400;
    box-shadow: 0 4px 16px rgba(15, 23, 42, 0.25);
}
.tooltip-wrap { position: relative; display: inline; }

.amount-link { text-decoration: none; border-bottom: 2px solid transparent; }
.amount-link:hover, .amount-link:focus { border-bottom-color: currentColor; }
.summary-strip .amount-link .amount { text-decoration: underline; text-decoration-thickness: 3px; }

.threemin { border-left: 4px solid var(--color-primary); }
.threemin-list { padding-left: 1.25rem; }
.threemin-list li { margin-bottom: 0.6rem; }

.rule-figure {
    display: flex;
    align-items: flex-end;
    gap: 1rem;
    margin: 1.25rem 0;
    padding: 1rem;
    background: #f8fafc;
    border-radius: var(--radius);
}
.rule-col { flex: 1; text-align: center; }
.rule-bar {
    height: 120px;
    border: 2px solid var(--color-border);
    border-radius: 8px;
    background: #fff;
    display: flex;
    align-items: flex-end;
    overflow: hidden;
}
.rule-fill { width: 100%; }
.rule-fill-ok { background: var(--color-refund); }
.rule-fill-bad { background: var(--color-wrong); }
.rule-cap { font-size: 0.9rem; margin-top: 0.5rem; font-weight: 600; }
.rule-verdict { font-size: 0.85rem; margin-top: 0.25rem; font-weight: 700; }
.rule-verdict-ok { color: var(--color-refund); }
.rule-verdict-bad { color: var(--color-wrong); }
.rule-line {
    align-self: stretch;
    border-left: 2px dashed var(--color-wrong);
    display: flex;
    align-items: center;
}
.rule-line span {
    writing-mode: vertical-rl;
    transform: rotate(180deg);
    font-size: 0.75rem;
    color: var(--color-wrong);
    padding: 0 0.25rem;
    font-weight: 600;
}

table.data { width: 100%; border-collapse: collapse; font-size: 0.95rem; }
table.data th, table.data td { padding: 0.75rem; text-align: left; border-bottom: 1px solid var(--color-border); }
table.data th { background: #f1f5f9; font-weight: 600; }
table.data tr:hover td { background: #f8fafc; }

.badge {
    display: inline-block;
    padding: 0.2rem 0.6rem;
    border-radius: 999px;
    font-size: 0.8rem;
    font-weight: 600;
}
.badge-ok { background: #dcfce7; color: #166534; }
.badge-pending { background: #fef3c7; color: #92400e; }
.badge-wrong { background: #fee2e2; color: #991b1b; }

table.data tr.row-wrong td { background: #fef2f2; }
table.data tr.row-wrong:hover td { background: #fee2e2; }
table.data tr.row-ok td { background: #f0fdf4; }
table.data tr.row-ok:hover td { background: #dcfce7; }

.muted-small { color: var(--color-muted); font-size: 0.85rem; }

.filters { display: flex; flex-wrap: wrap; gap: 0.75rem; margin-bottom: 1.5rem; }
.filters input, .filters select {
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--color-border);
    border-radius: 8px;
    font-size: 1rem;
}

.pdf-viewer { width: 100%; height: 75vh; border: 1px solid var(--color-border); border-radius: var(--radius); }

.timeline { list-style: none; padding: 0; border-left: 3px solid var(--color-border); margin-left: 1rem; }
.timeline li { padding: 0 0 1.5rem 1.5rem; position: relative; }
.timeline li::before {
    content: '';
    position: absolute;
    left: -0.55rem;
    top: 0.35rem;
    width: 0.9rem;
    height: 0.9rem;
    background: var(--color-primary);
    border-radius: 50%;
    border: 2px solid white;
}

.login-box { max-width: 420px; margin: 4rem auto; }
.login-box input { width: 100%; padding: 0.75rem; margin-bottom: 1rem; border: 1px solid var(--color-border); border-radius: 8px; font-size: 1rem; }

.alert-error { background: var(--color-wrong-bg); color: var(--color-wrong); padding: 0.75rem; border-radius: 8px; margin-bottom: 1rem; }
.alert-success { background: var(--color-refund-bg); color: var(--color-refund); padding: 0.75rem; border-radius: 8px; margin-bottom: 1rem; }

.form-field { margin-bottom: 1rem; }
.form-field label { display: block; font-weight: 600; margin-bottom: 0.35rem; }
.form-input { width: 100%; padding: 0.75rem; border: 1px solid var(--color-border); border-radius: 8px; font-size: 1rem; }
.form-check { display: flex; align-items: center; gap: 0.5rem; }
.form-check label { margin: 0; font-weight: 500; }
.form-check input { width: auto; }
.form-field ul { color: var(--color-wrong); margin: 0.25rem 0 0; padding-left: 1.25rem; font-size: 0.9rem; }

.btn-danger { background: var(--color-wrong); color: white; }

.tour-banner {
    background: #eff6ff;
    border: 1px dashed var(--color-primary);
    padding: 1rem;
    border-radius: var(--radius);
    margin-bottom: 1.5rem;
}

@media print {
    .site-header, .nav, .btn, .simpler-toggle, .no-print { display: none !important; }
    body { background: white; font-size: 12pt; }
    .card { break-inside: avoid; box-shadow: none; }
}

@media (max-width: 600px) {
    html { font-size: 16px; }
    .summary-strip .amount { font-size: 2rem; }
}
