@font-face {
  font-family: "Figtree";
  src: url("/fonts/figtree/Figtree-VariableFont_wght.ttf") format("truetype");
  font-style: normal;
  font-weight: 300 900;
  font-display: swap;
}

@font-face {
  font-family: "Figtree";
  src: url("/fonts/figtree/Figtree-Italic-VariableFont_wght.ttf") format("truetype");
  font-style: italic;
  font-weight: 300 900;
  font-display: swap;
}

:root {
  --bg: #f5f2ff;
  --bg-soft: #ece7ff;
  --bg-accent: #e7e0ff;
  --panel: #ffffff;
  --panel-soft: #faf8ff;
  --text: #1f1833;
  --muted: #665b84;
  --line: #d8d0ee;
  --line-strong: #c7b9e8;
  --table-line: #e6def7;
  --primary: #8b5cf6;
  --primary-strong: #7c3aed;
  --primary-soft-bg: #ede9fe;
  --primary-soft-text: #4c1d95;
  --primary-soft-border: #d4c4ff;
  --danger: #be123c;
  --success: #15803d;
  --success-bg: #ecfdf5;
  --success-border: #86efac;
  --error-bg: #fff1f6;
  --error-border: #f9a8d4;
  --topbar-bg: rgba(255, 255, 255, 0.88);
  --input-bg: #ffffff;
  --code-bg: #f0eafe;
  --shadow-soft: 0 10px 30px -20px rgba(29, 10, 70, 0.32);
  --shadow-panel: 0 18px 40px -28px rgba(23, 8, 57, 0.36);
  --focus-ring: rgba(124, 58, 237, 0.34);
  --row-hover: rgba(124, 58, 237, 0.08);
  --row-alt: #fcfaff;
  --table-head-bg: #f7f3ff;
  --selection-bg: #c4b5fd;
  --selection-text: #1f1240;
}

html[data-theme="light"] {
  color-scheme: light;
}

html[data-theme="dark"] {
  color-scheme: dark;
  --bg: #120f1e;
  --bg-soft: #1d1630;
  --bg-accent: #2a1c46;
  --panel: #1c162d;
  --panel-soft: #221a35;
  --text: #f3eeff;
  --muted: #beb2da;
  --line: #3b3154;
  --line-strong: #4f426f;
  --table-line: #352c4e;
  --primary: #c084fc;
  --primary-strong: #a855f7;
  --primary-soft-bg: #34264b;
  --primary-soft-text: #e8d7ff;
  --primary-soft-border: #4e3c70;
  --danger: #fb7185;
  --success: #4ade80;
  --success-bg: #102619;
  --success-border: #166534;
  --error-bg: #3a1728;
  --error-border: #9d174d;
  --topbar-bg: rgba(20, 16, 34, 0.86);
  --input-bg: #251d39;
  --code-bg: #2d2444;
  --shadow-soft: 0 10px 30px -20px rgba(4, 1, 9, 0.92);
  --shadow-panel: 0 18px 40px -28px rgba(0, 0, 0, 0.95);
  --focus-ring: rgba(196, 132, 252, 0.33);
  --row-hover: rgba(196, 132, 252, 0.11);
  --row-alt: #221b34;
  --table-head-bg: #261e3b;
  --selection-bg: #6d28d9;
  --selection-text: #f5efff;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

*::selection {
  background: var(--selection-bg);
  color: var(--selection-text);
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  font-family: "Figtree", "Segoe UI", sans-serif;
  color: var(--text);
  line-height: 1.45;
  background:
    radial-gradient(circle at 8% -12%, var(--bg-accent), transparent 45%),
    radial-gradient(circle at 95% 0%, var(--bg-soft), transparent 42%),
    var(--bg);
}

a {
  color: var(--primary-strong);
  text-decoration: none;
  transition: color 0.18s ease, opacity 0.18s ease;
}

a:hover {
  opacity: 0.9;
}

a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 3px solid var(--focus-ring);
  outline-offset: 2px;
}

.page-shell {
  min-height: 100vh;
}

.topbar {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 14px 24px;
  border-bottom: 1px solid var(--line);
  background: var(--topbar-bg);
  backdrop-filter: blur(8px);
  position: sticky;
  top: 0;
  z-index: 30;
}

.brand a {
  font-weight: 800;
  font-size: 22px;
  color: var(--text);
  letter-spacing: 0.2px;
}

.nav {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}

.nav-link {
  font-weight: 700;
  color: var(--muted);
  font-size: 14px;
  border-radius: 10px;
  padding: 8px 10px;
  border: 1px solid transparent;
  transition: color 0.2s ease, background-color 0.2s ease, border-color 0.2s ease, transform 0.2s ease;
}

.nav-link:hover {
  color: var(--primary-strong);
  background: var(--primary-soft-bg);
  border-color: var(--primary-soft-border);
  transform: translateY(-1px);
}

.nav-link.active {
  color: var(--primary-soft-text);
  background: var(--primary-soft-bg);
  border-color: var(--primary-soft-border);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.15);
}

.topbar-actions {
  margin-left: auto;
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.logout-form {
  margin: 0;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.locale-switch {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: linear-gradient(180deg, var(--panel), var(--panel-soft));
  box-shadow: var(--shadow-soft);
}

.locale-flag {
  width: 32px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  border: 1px solid transparent;
  background: transparent;
  font-size: 16px;
  line-height: 1;
  transition: transform 0.2s ease, border-color 0.2s ease, background-color 0.2s ease, box-shadow 0.2s ease;
}

.locale-flag:hover {
  border-color: var(--primary-soft-border);
  background: var(--primary-soft-bg);
  transform: translateY(-1px);
}

.locale-flag.active {
  border-color: var(--primary-soft-border);
  background: var(--primary-soft-bg);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.16);
}

.theme-toggle {
  width: 40px;
  min-width: 40px;
  height: 40px;
  padding: 0;
  border-radius: 999px;
  border: 1px solid var(--primary-soft-border);
  background: linear-gradient(155deg, var(--panel), var(--primary-soft-bg));
  color: var(--primary-soft-text);
  box-shadow: var(--shadow-soft);
}

.theme-toggle-icon {
  font-size: 18px;
  line-height: 1;
}

.theme-toggle[data-theme-current="dark"] {
  border-color: rgba(192, 132, 252, 0.38);
  background: linear-gradient(155deg, rgba(168, 85, 247, 0.2), var(--panel));
}

.container {
  padding: 24px;
  max-width: 1220px;
  margin: 0 auto;
}

.auth-login-shell {
  min-height: calc(100vh - 180px);
  display: grid;
  align-items: center;
}

.auth-login-panel {
  width: min(100%, 520px);
  margin: 0 auto;
}

.password-field {
  position: relative;
  width: 100%;
}

.password-field input {
  width: 100%;
  display: block;
  padding-right: 44px;
}

.password-toggle {
  position: absolute;
  top: 50%;
  right: 9px;
  transform: translateY(-50%);
  width: 32px;
  height: 32px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.password-toggle:hover {
  background: var(--panel-soft);
  color: var(--text);
}

.password-toggle:focus-visible {
  outline: 2px solid var(--primary-soft-border);
  outline-offset: 1px;
}

.password-icon {
  width: 18px;
  height: 18px;
  display: none;
}

.password-icon.is-visible {
  display: block;
}

.flash {
  padding: 12px 14px;
  border-radius: 12px;
  margin-bottom: 16px;
  border: 1px solid transparent;
  box-shadow: var(--shadow-soft);
}

.flash.success {
  background: var(--success-bg);
  border-color: var(--success-border);
}

.flash.error {
  background: var(--error-bg);
  border-color: var(--error-border);
}

.panel {
  background: linear-gradient(180deg, var(--panel), var(--panel-soft));
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 18px;
  margin-bottom: 16px;
  overflow: auto;
  box-shadow: var(--shadow-panel);
  animation: reveal-up 340ms ease both;
}

.panel.narrow {
  max-width: 760px;
}

.panel h1,
.panel h2,
.panel h3 {
  margin-top: 0;
}

.panel h1 {
  font-size: 24px;
  margin-bottom: 12px;
}

.panel h2 {
  font-size: 20px;
  margin-bottom: 12px;
}

.panel h3 {
  font-size: 17px;
  margin-bottom: 10px;
}

.section-heading-spaced {
  margin-top: 24px !important;
}

.panel p {
  color: var(--text);
}

.panel p strong {
  color: var(--text);
}

.muted-block {
  color: var(--muted);
  margin: 8px 0 12px;
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.tax-year-hero {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 14px;
}

.tax-year-hero-main {
  position: relative;
  min-height: 0;
  width: 100%;
}

.tax-year-hero-main h1 {
  position: relative;
  z-index: 1;
  margin-bottom: 4px;
}

.panel p.tax-year-subtitle {
  margin: 0;
  color: var(--primary-strong);
  font-size: 17px;
  font-weight: 700;
}

.panel p.tax-year-subtitle strong {
  color: var(--primary-strong);
  font-size: inherit;
}

.tax-year-hero-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

.tax-year-hero-actions .inline-form {
  margin: 0;
  gap: 0;
}

.tax-year-hero-actions .button,
.tax-year-hero-actions .button-light {
  width: auto;
  min-width: 0;
  border-radius: 9px;
  padding: 7px 11px;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.1px;
}

.tax-year-nav {
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr) 40px;
  align-items: center;
  gap: 10px;
  min-width: 0;
  overflow: hidden;
}

.year-arrow {
  width: 36px;
  height: 64px;
  border-radius: 14px;
  border: 1px solid var(--primary-soft-border);
  background: linear-gradient(165deg, var(--panel), var(--primary-soft-bg));
  color: var(--primary-strong);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-soft);
  transition: transform 0.2s ease, border-color 0.2s ease, background-color 0.2s ease, box-shadow 0.2s ease;
}

.year-arrow-icon {
  width: 22px;
  height: 22px;
}

.year-arrow:hover {
  transform: translateY(-1px);
  border-color: var(--primary);
  background: linear-gradient(165deg, var(--primary-soft-bg), var(--panel-soft));
  box-shadow: 0 10px 18px -16px rgba(107, 33, 168, 0.85);
}

.year-arrow:active {
  transform: translateY(0) scale(0.98);
}

.year-arrow.disabled {
  opacity: 0.45;
  color: var(--muted);
  border-color: var(--line);
  background: linear-gradient(165deg, var(--panel-soft), var(--panel));
  pointer-events: none;
}

.year-cards {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
  overflow: hidden;
  padding: 4px 0 8px;
  min-width: 0;
}

.year-card {
  min-width: 0;
  height: 64px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: linear-gradient(175deg, var(--panel), var(--panel-soft));
  padding: 8px 12px;
  box-shadow: var(--shadow-soft);
  transition: border-color 0.2s ease, background-color 0.2s ease, box-shadow 0.2s ease;
  display: flex;
  flex-direction: column;
  justify-content: center;
  overflow: hidden;
}

.year-card:hover {
  border-color: var(--primary-soft-border);
}

.year-card.active {
  border-color: var(--primary-soft-border);
  background: linear-gradient(175deg, var(--primary-soft-bg), var(--panel-soft));
  box-shadow: 0 10px 22px -18px rgba(124, 58, 237, 0.65);
}

.year-card.disabled {
  border-color: var(--line);
  background: linear-gradient(175deg, var(--panel-soft), var(--panel));
  color: var(--muted);
  opacity: 0.55;
  box-shadow: none;
  pointer-events: none;
}

.year-card-year {
  display: block;
  font-size: 34px;
  font-weight: 900;
  line-height: 0.95;
  color: var(--text);
  white-space: nowrap;
  text-overflow: ellipsis;
  overflow: hidden;
}

.year-card-foot {
  display: block;
  margin-top: 1px;
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
  white-space: nowrap;
  text-overflow: ellipsis;
  overflow: hidden;
}

.calc-help-trigger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  margin-left: 6px;
  border-radius: 999px;
  border: 1px solid var(--primary-soft-border);
  background: var(--primary-soft-bg);
  color: var(--primary-soft-text);
  font-size: 12px;
  font-weight: 800;
  line-height: 1;
  cursor: pointer;
  vertical-align: middle;
}

.calc-help-modal {
  position: fixed;
  inset: 0;
  z-index: 140;
}

.calc-help-modal[hidden] {
  display: none;
}

.calc-help-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(14, 10, 26, 0.62);
  backdrop-filter: blur(2px);
}

.calc-help-panel {
  position: relative;
  width: min(740px, calc(100% - 28px));
  margin: min(10vh, 86px) auto 0;
  border-radius: 14px;
  border: 1px solid var(--line-strong);
  background: linear-gradient(180deg, var(--panel), var(--panel-soft));
  box-shadow: var(--shadow-panel);
  padding: 16px;
}

.calc-help-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 8px;
}

.calc-help-head h3 {
  margin: 0;
}

.calc-help-close {
  width: 34px;
  height: 34px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel-soft);
  color: var(--text);
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
}

.calc-help-list {
  margin: 10px 0 10px 18px;
  padding: 0;
}

.calc-help-list li {
  margin-bottom: 10px;
}

.calc-help-actions {
  display: flex;
  justify-content: flex-end;
}

.future-details {
  margin-top: 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 12px;
  background: var(--panel-soft);
}

.future-details summary {
  cursor: pointer;
  font-weight: 800;
  color: var(--text);
}

.future-details[open] summary {
  margin-bottom: 8px;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.stat-card {
  background: linear-gradient(165deg, var(--panel), var(--panel-soft));
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 14px;
  box-shadow: var(--shadow-soft);
  animation: reveal-up 360ms ease both;
}

.stats-grid .stat-card:nth-child(1) {
  animation-delay: 35ms;
}

.stats-grid .stat-card:nth-child(2) {
  animation-delay: 65ms;
}

.stats-grid .stat-card:nth-child(3) {
  animation-delay: 95ms;
}

.stats-grid .stat-card:nth-child(4) {
  animation-delay: 125ms;
}

.stat-card h3 {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  letter-spacing: 0.2px;
  text-transform: uppercase;
}

.stat-card strong {
  display: block;
  margin-top: 6px;
  font-size: 26px;
  line-height: 1.2;
}

.form-grid {
  display: grid;
  gap: 12px;
}

.form-grid.two-cols {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.form-grid.three-cols {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

label {
  display: grid;
  gap: 5px;
  font-size: 13px;
  color: var(--muted);
  font-weight: 700;
  letter-spacing: 0.2px;
}

.signing-profile-form {
  margin-top: 10px;
}

.signing-profile-form .form-grid {
  margin-top: 6px;
  row-gap: 14px;
}

.signing-profile-form > label,
.signing-profile-form fieldset > label {
  margin-top: 10px;
}

.signing-profile-fieldset {
  margin: 0;
  padding: 0;
  border: 0;
  min-width: 0;
}

.signing-profile-fieldset[disabled] {
  opacity: 0.88;
}

.signing-profile-actions {
  margin-top: 18px;
  margin-bottom: 2px;
  align-items: center;
}

.signed-upload-form {
  margin-top: 8px;
}

.upload-dropzone {
  position: relative;
  border: 1px dashed var(--line-strong);
  background: linear-gradient(180deg, var(--panel), var(--panel-soft));
  border-radius: 12px;
  padding: 22px 16px;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.16s ease, box-shadow 0.16s ease, transform 0.16s ease;
  margin-bottom: 12px;
}

.upload-dropzone.is-dragover {
  border-color: var(--primary-strong);
  box-shadow: 0 0 0 4px var(--focus-ring);
  transform: translateY(-1px);
}

.upload-dropzone.is-selected {
  border-style: solid;
  border-color: #16a34a;
  box-shadow: 0 0 0 2px rgba(22, 163, 74, 0.15);
}

.upload-dropzone.is-selected .upload-dropzone-title {
  color: #166534;
}

.upload-dropzone.is-uploading {
  opacity: 0.8;
  pointer-events: none;
}

.upload-dropzone:focus-visible {
  border-color: var(--primary-strong);
  box-shadow: 0 0 0 4px var(--focus-ring);
}

.upload-dropzone input[type="file"] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.upload-dropzone-title {
  margin: 0;
  font-size: 17px;
  font-weight: 800;
  color: var(--text);
}

.upload-dropzone-subtitle {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.upload-dropzone-file {
  margin: 10px 0 0;
  color: var(--primary-strong);
  font-weight: 700;
  word-break: break-word;
}

html[data-theme="dark"] .upload-dropzone.is-selected {
  border-color: #4ade80;
  box-shadow: 0 0 0 2px rgba(74, 222, 128, 0.2);
}

html[data-theme="dark"] .upload-dropzone.is-selected .upload-dropzone-title {
  color: #86efac;
}

input,
select,
textarea,
button {
  font: inherit;
}

input,
select,
textarea {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 9px 11px;
  background: var(--input-bg);
  color: var(--text);
  transition: border-color 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease;
}

input::placeholder,
textarea::placeholder {
  color: var(--muted);
}

input:hover,
select:hover,
textarea:hover {
  border-color: var(--line-strong);
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--primary-strong);
  box-shadow: 0 0 0 4px var(--focus-ring);
}

select {
  cursor: pointer;
}

select[multiple] {
  min-height: 150px;
  padding: 8px;
}

textarea {
  min-height: 96px;
  resize: vertical;
}

small {
  color: var(--muted);
}

.button {
  border: 0;
  border-radius: 10px;
  padding: 9px 13px;
  background: linear-gradient(160deg, var(--primary), var(--primary-strong));
  color: #ffffff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
  line-height: 1.15;
  cursor: pointer;
  font-weight: 800;
  letter-spacing: 0.2px;
  transition: transform 0.2s ease, box-shadow 0.2s ease, filter 0.2s ease;
}

.button:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 24px -16px rgba(107, 33, 168, 0.8);
  filter: brightness(1.04);
}

.button:active {
  transform: translateY(0);
}

.button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.button-light {
  background: var(--primary-soft-bg);
  color: var(--primary-soft-text);
  border: 1px solid var(--primary-soft-border);
}

.button.is-disabled {
  opacity: 0.55;
  pointer-events: none;
  filter: none;
  transform: none;
}

.pagination-nav {
  margin-top: 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.pagination-nav__button {
  min-width: 104px;
}

.pagination-nav__pages {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.pagination-nav__page,
.pagination-nav__ellipsis {
  min-width: 34px;
  height: 34px;
  border-radius: 9px;
  border: 1px solid var(--line);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
}

.pagination-nav__page {
  background: var(--panel-soft);
  color: var(--text);
  text-decoration: none;
}

.pagination-nav__page.is-current {
  border-color: var(--primary-strong);
  background: var(--primary-soft-bg);
  color: var(--primary-soft-text);
}

.pagination-nav__ellipsis {
  border-color: transparent;
  color: var(--muted);
}

.button-danger {
  background: linear-gradient(135deg, #dc2626, #b91c1c);
  border: 1px solid #991b1b;
  color: #ffffff;
  box-shadow: 0 10px 24px rgba(185, 28, 28, 0.26);
}

.button-danger:hover {
  box-shadow: 0 14px 30px rgba(185, 28, 28, 0.34);
  filter: brightness(1.03);
}

.filter-grid,
.inline-form {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: flex-end;
  margin-bottom: 12px;
}

.compact-form {
  margin-bottom: 0;
}

.inline-select {
  display: inline-flex;
  flex-direction: column;
  gap: 4px;
  font-size: 11px;
  color: var(--muted);
  font-weight: 700;
}

.inline-select select {
  min-width: 156px;
  padding: 7px 9px;
}

.mono-block {
  border: 1px solid var(--line);
  background: var(--code-bg);
  border-radius: 10px;
  padding: 10px;
  margin: 12px 0;
}

.copy-row {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-top: 6px;
}

.copy-row input[type="text"] {
  flex: 1;
  min-width: 240px;
  border: 1px solid var(--line-strong);
  border-radius: 9px;
  background: var(--input-bg);
  color: var(--text);
  padding: 9px 10px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
}

.sign-canvas {
  width: 100%;
  max-width: 420px;
  border: 1px dashed var(--line-strong);
  border-radius: 10px;
  background: var(--panel);
  touch-action: none;
}

.sign-preview {
  max-width: 100%;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel);
  padding: 4px;
}

.preview-loading-panel {
  text-align: center;
  max-width: 680px;
  margin-left: auto;
  margin-right: auto;
}

.preview-loading-spinner {
  width: 42px;
  height: 42px;
  border: 4px solid var(--line);
  border-top-color: var(--primary-strong);
  border-radius: 50%;
  margin: 12px auto 8px;
  animation: preview-spin 0.9s linear infinite;
}

@keyframes preview-spin {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

.tax-override-form {
  margin-top: 8px;
  margin-bottom: 0;
  gap: 6px;
  align-items: center;
}

.tax-override-form[hidden] {
  display: none !important;
}

.tax-amount-line {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.tax-amount-value {
  display: inline-block;
  min-width: 122px;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.tax-edit-toggle {
  width: 24px;
  min-width: 24px;
  height: 24px;
  padding: 0;
  font-size: 12px;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.tax-override-form input[type="number"] {
  width: 140px;
}

.tax-override-form .button {
  padding: 7px 10px;
  font-size: 12px;
  width: auto;
}

.tax-override-form .button-light {
  width: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
}

thead th {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.32px;
  color: var(--muted);
  background: var(--table-head-bg);
}

th,
td {
  border-bottom: 1px solid var(--table-line);
  text-align: left;
  padding: 10px;
  vertical-align: top;
  font-size: 14px;
}

tbody tr {
  transition: background-color 0.16s ease;
}

tbody tr:nth-child(even) {
  background: var(--row-alt);
}

tbody tr:hover,
tbody tr:focus-within {
  background: var(--row-hover);
}

.actions {
  display: flex;
  gap: 10px;
  align-items: center;
}

.archive-actions {
  flex-wrap: wrap;
  align-items: flex-start;
}

.archive-actions form {
  margin: 0;
}

.orphan-detail summary {
  cursor: pointer;
  font-weight: 700;
}

.orphan-detail__body {
  margin-top: 8px;
}

.orphan-detail__list {
  margin: 0;
  padding-left: 18px;
  display: grid;
  gap: 6px;
}

.actions form {
  margin: 0;
}

.signing-head-actions {
  align-items: flex-end;
  gap: 8px;
}

.signing-head-form {
  flex-wrap: nowrap;
  align-items: flex-end;
}

.upload-actions-cell {
  min-width: 300px;
}

.upload-action-form {
  margin: 0 0 8px;
  align-items: center;
}

.upload-action-form:last-child {
  margin-bottom: 0;
}

.upload-action-form .button {
  min-width: 118px;
}

.upload-action-form-note {
  align-items: flex-end;
}

.upload-action-form-note .inline-select {
  min-width: 200px;
}

.upload-action-form-note .inline-select input {
  min-width: 180px;
}

.link-danger {
  border: 0;
  background: transparent;
  color: var(--danger);
  cursor: pointer;
  padding: 0;
  font-weight: 700;
}

.tag {
  display: inline-block;
  border-radius: 999px;
  padding: 3px 9px;
  border: 1px solid var(--line);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.2px;
}

.tag-dot::before {
  content: "";
  display: inline-block;
  width: 7px;
  height: 7px;
  margin-right: 6px;
  border-radius: 999px;
  vertical-align: middle;
  background: currentColor;
}

.tag-danger {
  border-color: #fecaca;
  color: #991b1b;
  background: #fff3f3;
}

.tag-success {
  border-color: #86efac;
  color: #166534;
  background: #ecfdf5;
}

.tag-warning {
  border-color: #fed7aa;
  color: #9a3412;
  background: #fff7ed;
}

.tag-info {
  border-color: #bfdbfe;
  color: #1d4ed8;
  background: #eff6ff;
}

.credit-highlight {
  color: #1d4ed8;
}

.sort-link {
  color: var(--muted);
  font-weight: 800;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.sort-link:hover {
  color: var(--primary-strong);
}

.sort-link.active {
  color: var(--text);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.tag-basis-blue {
  border-color: #bfdbfe;
  color: #1d4ed8;
  background: #eff6ff;
}

.tag-basis-pink {
  border-color: #fbcfe8;
  color: #9d174d;
  background: #fdf2f8;
}

.tag-basis-green {
  border-color: #bbf7d0;
  color: #166534;
  background: #f0fdf4;
}

body.modal-open {
  overflow: hidden;
}

.confirm-modal {
  position: fixed;
  inset: 0;
  z-index: 120;
}

.confirm-modal[hidden] {
  display: none;
}

.confirm-modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 10, 28, 0.58);
  backdrop-filter: blur(2px);
}

.confirm-modal__panel {
  position: relative;
  width: min(540px, calc(100% - 28px));
  margin: min(14vh, 92px) auto 0;
  border-radius: 14px;
  border: 1px solid var(--line-strong);
  background: linear-gradient(180deg, var(--panel), var(--panel-soft));
  box-shadow: var(--shadow-panel);
  padding: 16px;
  animation: reveal-up 220ms ease both;
}

.confirm-modal__panel.is-danger {
  border-color: #fca5a5;
  box-shadow: 0 24px 56px rgba(127, 29, 29, 0.28);
}

.confirm-modal__panel h2 {
  margin: 0 0 8px;
  font-size: 20px;
}

.confirm-modal__panel p {
  margin: 0;
  color: var(--muted);
}

.confirm-modal__actions {
  margin-top: 16px;
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

html[data-theme="dark"] .tag-danger {
  border-color: #7f1d1d;
  color: #fecaca;
  background: #3e1a1a;
}

html[data-theme="dark"] .tag-success {
  border-color: #166534;
  color: #bbf7d0;
  background: #102a1b;
}

html[data-theme="dark"] .tag-warning {
  border-color: #7c2d12;
  color: #fdba74;
  background: #3c1e12;
}

html[data-theme="dark"] .tag-info {
  border-color: #1e3a8a;
  color: #bfdbfe;
  background: #16233f;
}

html[data-theme="dark"] .credit-highlight {
  color: #bfdbfe;
}

html[data-theme="dark"] .tag-basis-blue {
  border-color: #1e3a8a;
  color: #bfdbfe;
  background: #16233f;
}

html[data-theme="dark"] .tag-basis-pink {
  border-color: #831843;
  color: #fbcfe8;
  background: #3b1028;
}

html[data-theme="dark"] .tag-basis-green {
  border-color: #14532d;
  color: #bbf7d0;
  background: #10291b;
}

code {
  background: var(--code-bg);
  padding: 2px 7px;
  border-radius: 7px;
  border: 1px solid var(--line);
}

@keyframes reveal-up {
  from {
    opacity: 0;
    transform: translateY(9px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

@media (max-width: 1100px) {
  .stats-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .year-cards {
    display: flex;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    scroll-behavior: smooth;
    -ms-overflow-style: none;
    scrollbar-width: none;
  }

  .year-cards::-webkit-scrollbar {
    display: none;
  }

  .year-card {
    flex: 0 0 auto;
    min-width: 164px;
    scroll-snap-align: start;
  }
}

@media (max-width: 960px) {
  .form-grid.two-cols {
    grid-template-columns: 1fr;
  }

  .form-grid.three-cols {
    grid-template-columns: 1fr;
  }

  .topbar {
    flex-wrap: wrap;
    gap: 12px;
    padding: 12px 16px;
  }

  .container {
    padding: 16px;
  }

  .topbar-actions {
    margin-left: 0;
    width: 100%;
    justify-content: flex-end;
  }

  .nav {
    width: 100%;
  }

  .nav-link {
    flex: 1 0 auto;
    text-align: center;
  }

  .tax-year-hero {
    flex-direction: column;
    align-items: stretch;
  }

  .tax-year-hero-actions {
    justify-content: flex-start;
  }
}

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

  .panel {
    padding: 14px;
  }

  th,
  td {
    padding: 8px;
    font-size: 13px;
  }

  .button,
  .button-light {
    width: 100%;
  }

  .theme-toggle,
  .locale-switch {
    width: auto;
  }

  .tax-year-hero-actions .button,
  .tax-year-hero-actions .button-light {
    width: auto;
  }

  .upload-action-form .button {
    width: auto;
    min-width: 0;
  }

  .inline-form {
    flex-direction: column;
    align-items: stretch;
  }

  .upload-action-form,
  .signing-head-form {
    flex-direction: column;
    align-items: stretch;
  }

  .upload-action-form-note .inline-select,
  .upload-action-form-note .inline-select input {
    min-width: 0;
    width: 100%;
  }
}

/* Email notification settings */
.checkbox-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 0;
  flex-wrap: wrap;
}

.checkbox-label {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-weight: 500;
  font-size: 14px;
  color: var(--text);
  min-width: 240px;
}

.checkbox-label input[type="checkbox"] {
  width: auto;
  margin: 0;
  accent-color: var(--primary);
}

.inline-field {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--muted);
}

.inline-field select {
  width: auto;
  min-width: 60px;
  padding: 4px 8px;
  font-size: 13px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--input-bg);
  color: var(--text);
}

.inline-field select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--focus-ring);
}

.button-secondary {
  border: 0;
  border-radius: 10px;
  padding: 9px 13px;
  background: var(--bg-accent);
  color: var(--primary-strong);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.button-secondary:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-soft);
}
