:root {
  color-scheme: light;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Arial, sans-serif;
  line-height: 1.57;
  color: #252d29;
  background: #fafbf9;
  --ink: #252d29;
  --muted: #555f5a;
  --green: #23533f;
  --line: #dbe1dd;
  --paper: #fff;
  --topbar-height: 63px;
}
* { box-sizing: border-box; }
html { scroll-padding-top: var(--topbar-height); }
[hidden] { display: none !important; }
body { margin: 0; }
a { color: inherit; }
button, input { font: inherit; }
button, summary, .file-button { cursor: pointer; }
:focus-visible { outline: 3px solid #248369; outline-offset: 4px; }
.shell { width: min(1120px, calc(100% - 56px)); margin-inline: auto; }
.topbar { position: sticky; top: 0; z-index: 10; background: var(--paper); color: var(--ink); border-bottom: 1px solid var(--line); }
.topbar-content { min-height: 62px; display: flex; align-items: center; justify-content: space-between; gap: 18px; }
.wordmark { display: inline-flex; align-items: center; gap: 12px; text-decoration: none; font-size: 1rem; font-weight: 650; }
.site-nav { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 20px; font-size: .9375rem; }
.site-nav a { padding-block: 3px; color: var(--muted); text-decoration: none; }
.site-nav a:hover { color: var(--green); text-decoration: underline; text-underline-offset: 5px; }
.support-links { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; }
.support-label { margin-right: 3px; font-size: .875rem; font-weight: 650; }
.support-button { display: inline-flex; align-items: center; justify-content: center; min-height: 36px; border-radius: 7px; padding: 4px 11px; color: #fff; font-size: .875rem; font-weight: 650; text-decoration: none; }
.support-max { background: #5236a8; }
.support-telegram { background: #16678f; }
.support-button:hover { text-decoration: underline; text-underline-offset: 3px; }
.mark { width: 21px; height: 21px; border: 1px solid var(--green); border-radius: 4px; position: relative; }
.mark::before { content: ''; position: absolute; inset: 5px 4px 6px; border-bottom: 1px solid var(--green); border-left: 1px solid var(--green); transform: rotate(-45deg); }
h1 { margin: 0; font-size: clamp(2rem, 4.5vw, 3.3rem); line-height: 1.04; letter-spacing: -.05em; font-weight: 730; }
.calculator-heading { margin: 0 0 24px; padding: clamp(24px, 4vw, 40px) 0 20px; border-bottom: 1px solid var(--line); }
.calculator-heading h1 { font-size: clamp(1.85rem, 4.5vw, 2.65rem); line-height: 1.15; letter-spacing: -.033em; }
.calculator-heading p { max-width: 65ch; margin: 10px 0 0; color: var(--muted); line-height: 1.55; }
.layout { display: grid; grid-template-columns: minmax(0, 1.85fr) minmax(260px, 1fr); gap: 22px; align-items: start; padding-bottom: 32px; }
.upload-card { border: 1px solid var(--line); border-radius: 7px; background: var(--paper); }
.article-page { max-width: 720px; padding-block: 28px 52px; border-top: 1px solid var(--line); }
.article-heading { margin-bottom: 21px; }
.article-heading h2 { font-size: clamp(1.45rem, 4vw, 1.9rem); line-height: 1.2; letter-spacing: -.026em; }
.article-content section + section { margin-top: 24px; }
.article-content h3 { margin: 0; font-size: 1.0625rem; line-height: 1.35; }
.article-content p { margin: 8px 0 0; line-height: 1.68; }
.article-link { display: inline-block; margin-top: 12px; color: var(--green); font-weight: 650; text-underline-offset: 4px; }
#calculator, .article-page { scroll-margin-top: 18px; }
fieldset { min-width: 0; border: 0; margin: 0; padding: 24px 26px 23px; }
.section-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; padding-bottom: 11px; }
h2 { margin: 0; font-size: 1.25rem; letter-spacing: -.02em; }
.field { display: grid; min-width: 0; gap: 5px; align-content: start; }
.field label { font-size: .9375rem; font-weight: 650; }
.field textarea { display: block; width: 100%; max-width: 100%; border: 1px solid #c0d2ca; background: #f8fbf9; color: var(--ink); border-radius: 9px; padding: 8px 10px; min-height: 41px; font: inherit; font-size: .9375rem; }
.field textarea { resize: vertical; }
.progress { color: var(--muted); font-size: .875rem; white-space: nowrap; }
.progress.complete { color: var(--green); font-weight: 650; }
.file-row { display: grid; grid-template-columns: max-content minmax(0, 1fr) max-content; align-items: start; gap: 5px 12px; padding: 13px 0 12px; border-block-start: 1px solid var(--line); }
.step-number { background: #e7f3eb; border-radius: 5px; color: var(--green); padding: 3px 6px; font-size: .8rem; font-weight: 650; white-space: nowrap; }
.file-row[data-step-state='locked'] { opacity: .72; filter: grayscale(1); }
.file-row[data-step-state='locked'] .file-button { pointer-events: none; }
.step-status { grid-column: 2 / -1; color: var(--muted); margin: 0; font-size: .9375rem; }
.step-ok { color: var(--green); }
.step-error { color: #a43139; }
.step-notice { color: #765314; }
.copy-controls { grid-column: 2 / -1; display: flex; gap: 5px 10px; flex-wrap: wrap; align-items: center; margin-top: 4px; }
.secondary { border: 1px solid #bad2c6; border-radius: 8px; background: #ecf6ef; color: var(--green); padding: 6px 10px; font-size: .875rem; font-weight: 650; }
.secondary:hover { background: #dcefe2; }
.copy-count, .copy-status { color: var(--muted); font-size: .875rem; }
.copy-status:empty { display: none; }
.copy-controls .field { flex-basis: 100%; }
.file-info { min-width: 0; }
.file-title { display: block; font-size: 1rem; font-weight: 650; line-height: 1.32; }
.source { margin-left: 5px; font-size: .875rem; font-weight: 400; color: var(--muted); }
.file-name { display: block; color: var(--green); font-size: .875rem; overflow-wrap: anywhere; margin-top: 4px; }
details { margin-top: 4px; }
summary { width: fit-content; color: var(--green); font-size: .9375rem; }
details p { margin: 6px 0 2px; max-width: 52ch; font-size: .9375rem; color: var(--muted); }
.guide-steps { margin: 8px 0 10px; padding-left: 1.4rem; max-width: 58ch; font-size: .9375rem; }
.guide-steps li + li { margin-top: 6px; }
.thumbs { display: flex; flex-wrap: wrap; gap: 7px; margin: 8px 0 4px; }
.thumb { width: 68px; height: 68px; display: grid; place-items: center; padding: 4px; border: 1px solid #c8d8d0; border-radius: 8px; background: #eff5f1; overflow: hidden; }
.thumb:hover { border-color: var(--green); background: #dcefe4; }
.shot-frame { position: relative; display: block; }
.shot-frame img { display: block; width: 100%; height: auto; }
.shot-outline { position: absolute; border: 2px solid #d62638; border-radius: 2px; pointer-events: none; }
.thumb .shot-outline { border-width: 1px; }
.gallery-dialog { width: min(96vw, 1590px); max-width: none; max-height: 92vh; padding: 12px; border: 1px solid #c8d8d0; border-radius: 14px; color: var(--ink); background: #fff; }
.gallery-dialog::backdrop { background: #0f201de0; }
.gallery-bar { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 10px; color: var(--ink); }
.gallery-main { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 8px; align-items: center; }
#gallery-count { text-align: center; min-width: 52px; font-variant-numeric: tabular-nums; }
#gallery-image { min-width: 0; display: grid; place-items: center; background: #eef3ef; }
.gallery-control { cursor: pointer; width: 44px; height: 44px; flex-shrink: 0; display: grid; place-items: center; padding: 0; border: 1px solid #c8d8d0; border-radius: 7px; background: #f8fbf9; color: var(--green); font-size: 1.5rem; line-height: 1; }
.gallery-control:hover { background: #e4f3e9; }
.gallery-control.gallery-arrow { color: #fff; background: #158047; border-color: #158047; font-weight: 700; }
.gallery-control.gallery-arrow:hover { background: #193c2e; }
.gallery-control:disabled { opacity: .6; cursor: default; }
#gallery-caption { margin: 8px 0 0; font-size: .9375rem; color: var(--ink); }
.file-action { display: flex; flex-direction: column; align-items: flex-end; gap: 3px; position: relative; }
.file-button { display: inline-flex; align-items: center; justify-content: center; border: 1px solid #c7d7ce; border-radius: 8px; padding: 6px 12px; min-height: 36px; font-size: .875rem; line-height: 1.25; font-weight: 640; white-space: nowrap; color: var(--green); }
.file-button:hover { background: #ebf5ee; }
.file-action:focus-within .file-button { outline: 3px solid #248369; outline-offset: 3px; }
.file-input { position: absolute; width: 1px; height: 1px; opacity: 0; inset: 50% 0 auto auto; }
.file-type { color: var(--muted); font-size: .75rem; }
.form-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; padding-top: 16px; border-top: 1px solid var(--line); }
.calculation-progress { display: grid; flex: 1 1 230px; gap: 3px; font-size: .875rem; color: var(--ink); }
.calculation-progress progress { width: 100%; height: 12px; accent-color: #158047; }
.primary, .download { display: inline-flex; justify-content: center; align-items: center; font-weight: 650; font-size: .95rem; border-radius: 9px; padding: 10px 17px; text-align: center; min-height: 43px; }
.primary { background: #17664c; border: 1px solid #17664c; color: #fff; }
.primary:hover { background: #104e39; }
.primary:disabled { opacity: .52; cursor: not-allowed; }
fieldset:disabled .primary, fieldset:disabled .file-button { opacity: .6; cursor: wait; }
.sidebar { display: grid; gap: 15px; position: sticky; top: calc(var(--topbar-height) + 18px); }
.sidebar:has(.diagnostics-card:not([hidden])) { position: static; }
.diagnostics-card { background: white; border: 1px solid var(--line); border-radius: 19px; padding: 19px; }
.diagnostics-overview { color: var(--muted); margin: 7px 0 12px; font-size: .9375rem; }
.diagnostic-item { border-top: 1px solid var(--line); padding: 10px 0 6px; }
.diagnostic-summary { width: 100%; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; align-items: start; font-weight: 650; color: var(--ink); }
.diagnostic-summary > span:first-child::before { content: '▸'; color: var(--green); margin-right: 5px; }
.diagnostic-item[open] > .diagnostic-summary > span:first-child::before { content: '▾'; }
.diagnostic-count { border-radius: 8px; background: #e5f2e9; color: var(--green); padding: 1px 8px; font-variant-numeric: tabular-nums; }
.diagnostic-item p { max-width: none; }
.diagnostic-item .diagnostic-offices { color: var(--ink); margin-top: 8px; overflow-wrap: anywhere; }
.diagnostic-examples { margin: 8px 0; }
.diagnostic-examples ul { list-style: none; margin: 6px 0; padding: 0; font-size: .875rem; }
.diagnostic-examples li { padding: 5px 7px; margin-bottom: 3px; background: #f1f5f3; border-radius: 5px; overflow-wrap: anywhere; }
.diagnostic-examples li span { display: block; color: var(--muted); }
.diagnostic-item .secondary { margin-top: 8px; }
.result-card { background: var(--paper); border: 1px solid var(--line); border-radius: 7px; padding: 23px; color: var(--ink); }
.result-card[data-state='ready'] .amount { color: var(--green); }
.result-card[data-state='error'], .result-card[data-state='pending'] { background: #f9eee0; color: var(--ink); border-color: #e5d2b8; }
.result-message { margin: 9px 0 0; color: inherit; }
.result-values { margin-top: 16px; display: grid; gap: 1px; }
.amount-label, .claim-count { color: inherit; font-size: .875rem; }
.amount { font-size: clamp(1.55rem, 3.6vw, 2.5rem); letter-spacing: -.035em; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.download { text-decoration: none; margin-top: 18px; background: var(--green); color: #fff; width: 100%; }
.download:hover { background: #183f2e; }
.result-guide { display: inline-block; margin-top: 12px; color: var(--green); font-weight: 600; }
.import-guide { margin: 24px 0; padding: 16px 0; border-block: 1px solid var(--line); scroll-margin-top: 16px; }
.import-guide summary { width: fit-content; font-size: 1.125rem; font-weight: 650; color: var(--green); }
.import-guide ol { max-width: 72ch; margin-bottom: 0; }
.site-footer { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 8px 18px; margin-top: 28px; padding-top: 16px; border-top: 1px solid var(--line); color: var(--muted); font-size: .875rem; }
.site-footer p { margin: 0; }
.no-script { margin: 0 26px 18px; }
@media (max-width: 780px) {
  .shell { width: min(620px, calc(100% - 36px)); }
  .layout { grid-template-columns: 1fr; gap: 16px; }
  .sidebar { position: static; }
}
@media (max-width: 930px) {
  :root { --topbar-height: 108px; }
  .topbar-content { flex-wrap: wrap; justify-content: flex-start; gap: 8px 20px; padding-block: 12px; }
}
@media (max-width: 450px) {
  :root { --topbar-height: 170px; }
  .shell { width: calc(100% - 24px); }
  fieldset, .result-card, .diagnostics-card { padding: 17px; }
  .file-row { grid-template-columns: max-content minmax(0, 1fr); column-gap: 8px; }
  .file-action { grid-column: 2; flex-direction: row; align-items: center; flex-wrap: wrap; gap: 4px 8px; }
  .file-button { padding-inline: 7px; }
  .primary { width: 100%; }
}
