:root {
  --ink: #18243a;
  --muted: #69778c;
  --blue: #4a86e8;
  --blue-dark: #2558a7;
  --blue-soft: #eaf2ff;
  --sky: #c8e5f8;
  --green: #20a66a;
  --line: #e0e6ef;
  --surface: #fff;
  --background: #f6f8fc;
  --shadow: 0 12px 32px rgba(30, 55, 90, .08);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; color: var(--ink); background: var(--background); font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; line-height: 1.5; -webkit-font-smoothing: antialiased; transition: color .2s, background-color .2s; }
button, textarea, input { font: inherit; }
button { cursor: pointer; }
.container { width: min(1160px, calc(100% - 40px)); margin-inline: auto; }
.skip-link { position: fixed; z-index: 20; top: 8px; left: 8px; padding: 8px 12px; color: white; background: var(--blue-dark); border-radius: 7px; transform: translateY(-150%); }
.skip-link:focus { transform: translateY(0); }

.site-header { height: 66px; display: flex; align-items: center; background: rgba(255,255,255,.95); border-bottom: 1px solid var(--line); backdrop-filter: blur(10px); }
.brand, .local-pill, .source-title, .card-top, .actions, .result-heading, .toolbar, .table-meta, .footer-inner { display: flex; align-items: center; }
.header-inner { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 20px; }
.card-top, .result-heading, .table-meta, .footer-inner { justify-content: space-between; }
.brand { gap: 10px; color: var(--ink); text-decoration: none; font-weight: 700; }
.brand strong { color: var(--blue); }
.brand-mark { width: 37px; height: 37px; display: grid; place-items: center; color: white; background: #19345f; border-radius: 10px; }
.local-pill { justify-self: end; gap: 8px; padding: 6px 11px; color: #49617b; background: #f1f5f9; border: 1px solid #e1e7ed; border-radius: 999px; font-size: .75rem; font-weight: 650; }
.local-pill i { width: 7px; height: 7px; background: var(--green); border-radius: 50%; box-shadow: 0 0 0 3px rgba(32,166,106,.13); }
.header-tools { justify-self: end; display: flex; align-items: center; gap: 8px; }
.main-nav { display: flex; align-items: center; gap: 3px; padding: 4px; background: #f2f5f8; border: 1px solid #e3e8ee; border-radius: 10px; }
.main-nav a { padding: 7px 12px; color: #69768a; border-radius: 7px; text-decoration: none; font-size: .73rem; font-weight: 700; transition: color .15s, background .15s, box-shadow .15s; }
.main-nav a:hover { color: var(--blue-dark); background: rgba(255,255,255,.75); }
.main-nav a.active { color: white; background: var(--blue-dark); box-shadow: 0 3px 9px rgba(37,88,167,.15); }
.theme-toggle { width: 36px; height: 36px; display: grid; place-items: center; padding: 0; color: #52657d; background: #f5f7fa; border: 1px solid #dfe5ec; border-radius: 9px; cursor: pointer; transition: color .15s, background .15s, border-color .15s, transform .15s; }
.theme-toggle:hover { color: var(--blue-dark); background: white; border-color: #bdc8d5; transform: translateY(-1px); }
.theme-toggle:focus-visible { outline: 3px solid rgba(74,134,232,.22); outline-offset: 2px; }
.sun-icon { display: none; }

.hero { padding-block: 62px 37px; text-align: center; }
.eyebrow { margin: 0 0 9px; color: var(--blue); font-size: .75rem; font-weight: 850; letter-spacing: .14em; text-transform: uppercase; }
.hero h1 { max-width: 790px; margin: auto; font-size: clamp(2rem, 4.1vw, 3.35rem); line-height: 1.09; letter-spacing: -.045em; }
.hero h1 span { color: var(--blue-dark); }
.hero-copy { max-width: 710px; margin: 18px auto 0; color: var(--muted); font-size: 1rem; }
.formula-note { width: fit-content; display: flex; align-items: center; gap: 8px; margin: 21px auto 0; padding: 8px 12px; color: #346399; background: var(--blue-soft); border: 1px solid #d2e2fb; border-radius: 9px; font-size: .76rem; font-weight: 650; }

.workspace { padding-bottom: 58px; }
.input-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.input-card { min-width: 0; padding: 20px; background: var(--surface); border: 1px solid var(--line); border-top: 4px solid var(--blue); border-radius: 14px; box-shadow: var(--shadow); }
.wd-card { border-top-color: #6c8ebf; }.dp-card { border-top-color: var(--blue); }.scb-card { border-top-color: #65afd8; }
.card-top { gap: 12px; margin-bottom: 17px; }
.source-title { gap: 10px; }
.source-icon { width: 30px; height: 30px; display: grid; place-items: center; color: #2b63ac; background: var(--blue-soft); border-radius: 8px; font-size: .76rem; font-weight: 850; }
.source-title h2 { margin: 0; font-size: 1rem; }.source-title p { margin: 2px 0 0; color: var(--muted); font-size: .71rem; }
.count-pill { flex: none; padding: 5px 8px; color: #657286; background: #f3f6fa; border-radius: 999px; font-size: .68rem; font-weight: 750; }
.input-card label { display: block; padding: 8px 11px; color: white; background: var(--blue); border-radius: 8px 8px 0 0; font-size: .69rem; font-weight: 800; letter-spacing: .065em; text-transform: uppercase; }
textarea { width: 100%; min-width: 0; min-height: 245px; display: block; resize: vertical; padding: 13px; color: #293a51; background: #fbfcfe; border: 1px solid #dce3ec; border-top: 0; border-radius: 0 0 8px 8px; outline: none; font-family: "SFMono-Regular", Consolas, monospace; font-size: .8rem; line-height: 1.7; transition: border-color .17s, box-shadow .17s, background .17s; }
textarea:focus { background: white; border-color: #80a9e7; box-shadow: 0 0 0 3px rgba(74,134,232,.11); }
textarea::placeholder { color: #a1adbb; }
.input-card small { display: block; margin-top: 9px; color: #8a96a6; font-size: .69rem; }
.input-card small.warning { color: #b56c14; }
.actions { justify-content: center; gap: 10px; margin-top: 23px; }
.button { min-height: 42px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 9px 17px; border: 1px solid transparent; border-radius: 9px; font-size: .8rem; font-weight: 750; transition: transform .15s, background .15s, border-color .15s; }
.button:hover { transform: translateY(-1px); }.button:active { transform: none; }
.button:focus-visible, input:focus-visible { outline: 3px solid rgba(74,134,232,.2); outline-offset: 2px; }
.primary-button { min-width: 170px; color: white; background: var(--blue-dark); box-shadow: 0 8px 20px rgba(37,88,167,.18); }.primary-button:hover { background: #194781; }
.secondary-button { color: #536176; background: white; border-color: var(--line); }.secondary-button:hover { border-color: #bdc8d6; }
.shortcut { margin-left: 5px; color: #929cac; font-size: .68rem; } kbd { padding: 2px 5px; background: white; border: 1px solid #d8dee7; border-bottom-width: 2px; border-radius: 4px; font-family: inherit; font-size: .62rem; }
.validation { max-width: 720px; margin: 16px auto 0; padding: 10px 13px; color: #995510; background: #fff6e9; border: 1px solid #f0d6b6; border-radius: 8px; text-align: center; font-size: .77rem; }

.result-section { padding: 54px 0 68px; background: white; border-top: 1px solid var(--line); }
.result-heading { gap: 20px; margin-bottom: 19px; }.result-heading h2 { margin: 0; font-size: 1.6rem; letter-spacing: -.03em; }.result-heading > p { color: #8d98a8; font-size: .72rem; }
.summary-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 11px; margin-bottom: 20px; }
.summary-grid article { position: relative; overflow: hidden; min-height: 112px; padding: 15px 17px; background: #f8fafe; border: 1px solid #e2e8f0; border-radius: 11px; }
.summary-grid article::before { content: ""; position: absolute; inset: 0 auto 0 0; width: 3px; background: #7f9bc2; }
.summary-grid span { color: #647287; font-size: .69rem; font-weight: 800; letter-spacing: .055em; text-transform: uppercase; }.summary-grid strong { display: block; margin: 5px 0 1px; color: #2a466d; font-size: 1.78rem; line-height: 1.2; }.summary-grid small { color: #939dab; font-size: .65rem; }
.summary-grid .total-card { background: var(--blue-soft); border-color: #d4e2f8; }.summary-grid .total-card::before { background: var(--blue); }.summary-grid .total-card strong { color: var(--blue-dark); }
.result-panel { overflow: hidden; border: 1px solid var(--line); border-radius: 13px; box-shadow: 0 8px 24px rgba(30,55,90,.05); }
.toolbar { gap: 10px; justify-content: flex-end; padding: 14px 16px; background: #fafbfd; border-bottom: 1px solid var(--line); }
.search-field { width: min(270px, 100%); height: 39px; display: flex; align-items: center; gap: 7px; padding: 0 10px; color: #8d98a7; background: white; border: 1px solid #d9e1ea; border-radius: 8px; }
.search-field:focus-within { border-color: #7fa8e7; box-shadow: 0 0 0 3px rgba(74,134,232,.09); }.search-field input { width: 100%; min-width: 0; padding: 0; color: var(--ink); background: transparent; border: 0; outline: 0; font-size: .77rem; }
.copy-button { color: white; background: var(--blue); }.copy-button:hover { background: #3674d3; }
.table-meta { padding: 10px 16px; color: #7e8999; background: white; border-bottom: 1px solid var(--line); font-size: .69rem; }.table-meta strong { color: #44536a; }.table-meta span:last-child { padding: 3px 7px; color: #386ba9; background: var(--blue-soft); border-radius: 5px; font-weight: 750; }
.table-wrap { overflow-x: auto; } table { width: 100%; border-collapse: collapse; font-size: .76rem; } thead { background: #f5f7fa; } th { padding: 10px 15px; color: #687589; border-bottom: 1px solid var(--line); text-align: left; font-size: .65rem; letter-spacing: .06em; text-transform: uppercase; } th:first-child { width: 75px; text-align: center; } td { padding: 12px 15px; color: #566377; border-bottom: 1px solid #edf0f4; } tbody tr:last-child td { border-bottom: 0; } tbody tr:hover { background: #fafcff; } td:first-child { color: #8b96a6; text-align: center; font-variant-numeric: tabular-nums; } td:nth-child(2) { color: #253a57; font-family: "SFMono-Regular", Consolas, monospace; font-weight: 750; } .status-chip { display: inline-flex; align-items: center; gap: 6px; padding: 4px 8px; color: #326cae; background: var(--blue-soft); border-radius: 999px; font-size: .64rem; font-weight: 750; }.status-chip::before { content: ""; width: 6px; height: 6px; background: var(--blue); border-radius: 50%; }
.empty-result { min-height: 210px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 5px; color: #8fa0b5; text-align: center; }.empty-result[hidden] { display: none; }.empty-result strong { margin-top: 5px; color: #4b607e; font-size: .88rem; }.empty-result span { font-size: .72rem; }

footer { padding: 25px 0; color: #8995a5; border-top: 1px solid var(--line); font-size: .71rem; }.footer-inner { gap: 20px; }.footer-inner span:first-child { color: #536176; font-weight: 750; }
.toast { position: fixed; z-index: 30; right: 22px; bottom: 22px; max-width: calc(100% - 44px); padding: 11px 15px; color: white; background: #203653; border-radius: 9px; box-shadow: 0 10px 28px rgba(0,0,0,.18); font-size: .77rem; font-weight: 650; opacity: 0; pointer-events: none; transform: translateY(10px); transition: opacity .2s, transform .2s; }.toast.show { opacity: 1; transform: none; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }

:root[data-theme="dark"] {
  --ink: #e7edf7;
  --muted: #9ba9bd;
  --blue: #66a2ef;
  --blue-dark: #3f78c1;
  --blue-soft: #172d49;
  --sky: #254c67;
  --green: #36ca83;
  --line: #29384e;
  --surface: #111d2e;
  --background: #0a1422;
  --shadow: 0 14px 34px rgba(0,0,0,.2);
}
:root[data-theme="dark"] .site-header { background: rgba(10,20,34,.94); }
:root[data-theme="dark"] .brand-mark { background: #254d82; }
:root[data-theme="dark"] .local-pill,
:root[data-theme="dark"] .main-nav,
:root[data-theme="dark"] .theme-toggle { color: #a9b7c9; background: #111f32; border-color: #29394f; }
:root[data-theme="dark"] .main-nav a { color: #91a0b5; }
:root[data-theme="dark"] .main-nav a:hover { color: #dbe7f7; background: #18283c; }
:root[data-theme="dark"] .main-nav a.active { color: white; background: #3b70b5; }
:root[data-theme="dark"] .theme-toggle:hover { color: #f6cb69; background: #18283c; border-color: #3b4c63; }
:root[data-theme="dark"] .moon-icon { display: none; }
:root[data-theme="dark"] .sun-icon { display: block; }
:root[data-theme="dark"] .formula-note { color: #8ebcf3; border-color: #2d4d72; }
:root[data-theme="dark"] .source-icon { color: #8fbcf3; }
:root[data-theme="dark"] .count-pill { color: #a5b2c4; background: #172438; }
:root[data-theme="dark"] textarea,
:root[data-theme="dark"] .search-field,
:root[data-theme="dark"] .secondary-button,
:root[data-theme="dark"] kbd { color: #d8e2ef; background: #0d1828; border-color: #2c3c52; }
:root[data-theme="dark"] textarea:focus { background: #101d2f; }
:root[data-theme="dark"] textarea::placeholder,
:root[data-theme="dark"] .search-field input::placeholder { color: #708096; }
:root[data-theme="dark"] .validation { color: #efb976; background: #352517; border-color: #63421f; }
:root[data-theme="dark"] .result-section { background: #0d1827; }
:root[data-theme="dark"] .summary-grid article { background: #121f31; border-color: #2a394e; }
:root[data-theme="dark"] .summary-grid span { color: #a2afc0; }
:root[data-theme="dark"] .summary-grid strong { color: #8fb9ee; }
:root[data-theme="dark"] .summary-grid small { color: #8391a5; }
:root[data-theme="dark"] .summary-grid .total-card { background: #172d49; border-color: #2d4d72; }
:root[data-theme="dark"] .summary-grid .total-card strong { color: #84b4ef; }
:root[data-theme="dark"] .result-panel { background: var(--surface); }
:root[data-theme="dark"] .toolbar,
:root[data-theme="dark"] .table-meta { background: #101d2e; }
:root[data-theme="dark"] thead { background: #172438; }
:root[data-theme="dark"] th,
:root[data-theme="dark"] td { border-color: #25344a; }
:root[data-theme="dark"] td { color: #afbbcb; }
:root[data-theme="dark"] td:nth-child(2) { color: #d6e2f0; }
:root[data-theme="dark"] tbody tr:hover { background: #152338; }
:root[data-theme="dark"] .empty-result strong { color: #b7c4d6; }
:root[data-theme="dark"] footer { background: #0a1422; }
:root[data-theme="dark"] .footer-inner span:first-child { color: #b4c0d1; }

@media (max-width: 860px) {
  .input-grid { grid-template-columns: 1fr; }
  textarea { min-height: 185px; }
  .summary-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 600px) {
  .container { width: calc(100% - 28px); max-width: 1160px; }
  .site-header { height: 60px; }.header-inner { grid-template-columns: auto 1fr auto; gap: 8px; }.brand { font-size: .87rem; }.brand-mark { width: 34px; height: 34px; }.brand > span:last-child, .local-pill { display: none; }.main-nav { justify-self: end; padding: 3px; }.main-nav a { padding: 6px 9px; font-size: .67rem; }.header-tools { gap: 0; }.theme-toggle { width: 34px; height: 34px; }
  .hero { padding-block: 43px 29px; }.hero h1 { font-size: 2rem; }.hero-copy { font-size: .88rem; }.formula-note { width: 100%; justify-content: center; }
  .input-card { padding: 17px; }.actions { flex-wrap: wrap; }.shortcut { width: 100%; margin: 1px 0 0; text-align: center; }
  .result-heading { display: block; }.result-heading > p { margin-bottom: 0; }.summary-grid { gap: 8px; }.summary-grid article { min-height: 102px; padding: 13px; }.summary-grid strong { font-size: 1.55rem; }
  .toolbar { flex-wrap: wrap; }.search-field, .copy-button { width: 100%; }.copy-button { flex: 1; }
  th, td { padding-inline: 11px; }.footer-inner { flex-direction: column; align-items: flex-start; gap: 3px; }
}
@media (max-width: 400px) { .actions .button { width: 100%; } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; } }
