:root {
  color-scheme: light;
  --ink: #152d37;
  --ink-soft: #52656d;
  --navy: #102f3d;
  --teal: #087f72;
  --teal-dark: #05675e;
  --teal-pale: #e8f5f2;
  --gold: #b98524;
  --gold-pale: #fff5dc;
  --red: #b73a36;
  --red-pale: #fceceb;
  --line: #d9e2e5;
  --line-strong: #bbcacf;
  --surface: #ffffff;
  --canvas: #f3f6f7;
  --table-stripe: #f2f7f6;
  --table-hover: #e7f2f0;
  --shadow: 0 12px 32px rgba(18, 47, 60, .10);
  --radius: 10px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 16px;
}

html[data-theme="dark"] {
  color-scheme: dark;
  --ink: #e3edf0;
  --ink-soft: #a9bbc1;
  --navy: #071b24;
  --teal: #43bbaa;
  --teal-dark: #6bd3c4;
  --teal-pale: #123a37;
  --gold: #dcaa48;
  --gold-pale: #3b3016;
  --red: #d96864;
  --red-pale: #3c211f;
  --line: #29434d;
  --line-strong: #49616a;
  --surface: #10262f;
  --canvas: #08181f;
  --table-stripe: #142e37;
  --table-hover: #193a43;
  --shadow: 0 12px 32px rgba(0, 0, 0, .34);
}

* { box-sizing: border-box; }
html { min-width: 0; }
body { margin: 0; min-width: 0; background: var(--canvas); color: var(--ink); line-height: 1.45; }
a { color: inherit; }
button, input, select, textarea { min-width: 0; font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
:focus-visible { outline: 3px solid #2c91ff; outline-offset: 2px; }

.topbar { height: 72px; display: flex; align-items: center; gap: 42px; padding: 0 32px; color: white; background: var(--navy); box-shadow: 0 3px 18px rgba(8, 29, 37, .18); }
.brand { display: flex; align-items: center; gap: 12px; min-width: 220px; text-decoration: none; }
.brand-mark { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 8px; color: var(--navy); background: #bce8df; font-family: Georgia, serif; font-size: 23px; font-weight: 700; }
.brand strong, .brand small { display: block; }
.brand strong { font-size: 1rem; letter-spacing: .01em; }
.brand small { color: #afc4cc; font-size: .75rem; }
.topnav { align-self: stretch; display: flex; align-items: stretch; gap: 4px; }
.topnav a { display: flex; align-items: center; padding: 0 16px; color: #cfe0e6; text-decoration: none; border-bottom: 3px solid transparent; }
.topnav a:hover { color: white; border-bottom-color: #73cabc; }
.topnav a[aria-current="page"] { color: white; border-bottom-color: #73cabc; font-weight: 700; }
.nav-label-compact { display: none; }
.account { margin-left: auto; display: flex; align-items: center; gap: 18px; color: #dce9ed; font-size: .875rem; }
.account form { margin: 0; }
.link-button { padding: 0; border: 0; color: #bce8df; background: none; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }
.theme-toggle { display: inline-flex; align-items: center; gap: 6px; min-height: 34px; padding: 0 10px; border: 1px solid #58717a; border-radius: 7px; color: #e4eff2; background: rgba(255, 255, 255, .06); font-size: .78rem; font-weight: 700; cursor: pointer; }
.theme-toggle:hover { border-color: #91aaaF; background: rgba(255, 255, 255, .11); }
.theme-action-light { display: none; }
html[data-theme="dark"] .theme-action-dark { display: none; }
html[data-theme="dark"] .theme-action-light { display: inline; }

.page-shell { width: min(1700px, calc(100% - 48px)); margin: 0 auto; padding: 30px 0 48px; }
.workspace-heading { display: flex; align-items: flex-end; justify-content: space-between; min-height: 58px; margin-bottom: 20px; }
.workspace-heading h1 { margin: 1px 0 0; font-family: Georgia, "Times New Roman", serif; font-size: 2rem; font-weight: 600; letter-spacing: -.025em; }
.address-workspace-heading { min-height: 34px; margin-top: -12px; margin-bottom: 10px; }
.address-heading-copy { display: flex; align-items: baseline; gap: 12px; }
.address-workspace-heading h1 { margin: 0; font-size: 1.55rem; }
.address-heading-copy span { color: var(--ink-soft); font-size: .78rem; font-weight: 750; letter-spacing: .06em; text-transform: uppercase; }
.eyebrow { margin: 0; color: var(--teal-dark); font-size: .72rem; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; }
.page-count { display: flex; align-items: baseline; gap: 6px; color: var(--ink-soft); }
.page-count strong { color: var(--ink); font-size: 1.05rem; }
.page-count span { font-size: .875rem; }
.muted { color: var(--ink-soft); }

.messages { position: fixed; z-index: 30; top: 86px; right: 24px; display: grid; gap: 8px; width: 390px; }
.message { padding: 13px 16px; border: 1px solid var(--line); border-left-width: 4px; border-radius: 7px; background: var(--surface); box-shadow: var(--shadow); }
.message-success { border-left-color: var(--teal); }
.message-error { border-left-color: var(--red); }

.toolbar { display: flex; align-items: center; justify-content: space-between; gap: 18px; margin-bottom: 14px; }
.toolbar-actions { display: flex; align-items: center; gap: 10px; }
.search-field { display: flex; align-items: center; gap: 9px; width: min(560px, 45vw); height: 44px; padding: 0 13px; border: 1px solid var(--line-strong); border-radius: 8px; background: var(--surface); }
.search-field span { color: var(--teal); font-size: 1.4rem; line-height: 1; }
.search-field input { width: 100%; border: 0; outline: 0; color: var(--ink); background: transparent; }
.filter-tabs { display: flex; gap: 2px; padding: 3px; border: 1px solid var(--line); border-radius: 8px; background: #e8edef; }
.filter-tabs button { min-height: 34px; padding: 0 14px; border: 0; border-radius: 6px; color: var(--ink-soft); background: transparent; cursor: pointer; }
.filter-tabs button.active { color: var(--ink); background: white; box-shadow: 0 1px 4px rgba(25, 55, 65, .12); font-weight: 700; }

.table-card { overflow: auto; max-height: calc(100vh - 260px); border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); box-shadow: 0 5px 20px rgba(22, 52, 63, .06); }
.address-table { width: 100%; border-collapse: separate; border-spacing: 0; table-layout: fixed; font-size: .875rem; }
.address-table th { position: sticky; z-index: 3; top: 0; padding: 11px 13px; border-bottom: 1px solid var(--line-strong); color: #63767d; background: #edf2f3; font-size: .72rem; font-weight: 800; letter-spacing: .055em; text-align: left; text-transform: uppercase; }
.address-table th:nth-child(1) { width: 245px; }
.address-table th:nth-child(2) { width: 285px; }
.address-table th:nth-child(3) { width: 210px; }
.address-table th:nth-child(4) { width: 215px; }
.address-table th:nth-child(5) { width: 205px; }
.address-table th:last-child { width: 292px; }
.address-table td { height: 62px; padding: 9px 13px; border-bottom: 1px solid #e7edef; background: var(--surface); vertical-align: middle; }
.address-table tbody tr:nth-child(even) td { background: var(--table-stripe); }
.address-table tbody tr:focus-within td { background: var(--table-hover); }
.address-table tbody tr:last-child td { border-bottom: 0; }
.address-table tr.row-checked td:first-child { box-shadow: inset 4px 0 0 var(--teal); }
.address-table tr.row-pending td:first-child { box-shadow: inset 4px 0 0 var(--gold); }
.address-table td small { display: block; margin-top: 3px; color: #6b7b81; line-height: 1.25; }
.person-name { display: block; font-size: .95rem; }
.note-preview { color: var(--ink-soft); font-size: .82rem; }
.email-link { overflow: hidden; text-overflow: ellipsis; color: var(--teal-dark); text-decoration: none; }
.email-link:hover { text-decoration: underline; }
.review-details { display: flex; align-items: baseline; gap: 5px; min-width: 0; margin-top: 4px; white-space: nowrap; }
.address-table td .review-details .review-count { display: inline; margin: 0 !important; font-size: .72rem; }
.undo-form { display: inline; flex: 0 0 auto; margin: 0; }
.undo-button { padding: 0; border: 0; color: var(--ink-soft); background: transparent; font-size: .7rem; text-decoration: underline; text-underline-offset: 2px; cursor: pointer; }
.status { display: inline-flex; align-items: center; min-height: 23px; padding: 2px 8px; border-radius: 999px; white-space: nowrap; font-size: .72rem; font-weight: 750; }
.status::before { width: 6px; height: 6px; margin-right: 6px; border-radius: 50%; background: currentColor; content: ""; }
.status-open { color: #5f7076; background: #edf1f2; }
.status-ok { color: #06655c; background: var(--teal-pale); }
.status-pending { color: #8a6119; background: var(--gold-pale); }
.status-delete { color: #9d302c; background: var(--red-pale); }
.status-master { color: #6e4b08; background: #f8e6b4; }
.row-actions { display: flex; align-items: center; justify-content: flex-end; gap: 7px; }
.row-actions form { margin: 0; }

.button { display: inline-flex; align-items: center; justify-content: center; min-height: 36px; padding: 0 13px; border: 1px solid transparent; border-radius: 7px; font-size: .82rem; font-weight: 750; line-height: 1; text-decoration: none; cursor: pointer; }
.button:disabled { cursor: wait; opacity: .65; }
.button-primary { border-color: var(--teal); color: white; background: var(--teal); }
.button-primary:hover { background: var(--teal-dark); }
.button-secondary { border-color: var(--line-strong); color: var(--ink); background: white; }
.button-secondary:hover { border-color: #8ca3aa; background: #f8fafb; }
.button-confirm { border-color: #9ccfc5; color: #06655c; background: var(--teal-pale); }
.button-confirm:hover { border-color: var(--teal); }
.button-danger { border-color: var(--red); color: white; background: var(--red); }
.button-danger-outline { border-color: #dda6a3; color: #9d302c; background: var(--red-pale); }
.button-danger-outline:hover { border-color: var(--red); }
.button-wide { width: 100%; min-height: 45px; margin-top: 9px; }
.icon-button { width: 36px; height: 36px; padding-bottom: 7px; border: 1px solid transparent; border-radius: 7px; color: var(--ink-soft); background: transparent; font-weight: 800; cursor: pointer; }
.icon-button:hover { border-color: var(--line); background: #f2f5f6; }
.confirm-action-icon { display: none; }
.action-delete-text { display: none; }

.list-navigation { margin-top: 16px; }
.address-navigation-row { display: grid; grid-template-columns: 110px minmax(0, 1fr) 110px; align-items: center; gap: 12px; }
.alphabet-nav { display: flex; align-items: center; justify-content: center; gap: 3px; }
.alphabet-nav a, .alphabet-nav span { display: grid; place-items: center; min-width: 29px; height: 30px; padding: 0 5px; border-radius: 5px; font-size: .76rem; font-weight: 750; text-decoration: none; }
.alphabet-nav a { border: 1px solid var(--line-strong); color: var(--ink); background: white; }
.alphabet-nav a:hover { border-color: var(--teal); color: var(--teal-dark); }
.alphabet-nav a.active { border-color: var(--teal); color: white; background: var(--teal); }
.alphabet-nav span.disabled { color: #aab5b9; background: #e9edef; }
.alphabet-nav .alphabet-all { min-width: 45px; margin-right: 5px; }
.page-step { width: max-content; padding: 8px 12px; border: 1px solid var(--line-strong); border-radius: 7px; background: white; font-size: .875rem; font-weight: 700; text-decoration: none; }
.page-step-forward { justify-self: end; }
.address-page-index { margin-top: 8px; color: var(--ink-soft); font-size: .875rem; text-align: center; }
.pagination { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; color: var(--ink-soft); font-size: .875rem; }
.pagination a { width: max-content; padding: 8px 12px; border: 1px solid var(--line-strong); border-radius: 7px; background: white; font-weight: 700; text-decoration: none; }
.pagination a:last-child { justify-self: end; }
.empty-state, .empty-panel { display: grid; justify-items: center; gap: 4px; padding: 50px; color: var(--ink-soft); text-align: center; }
.empty-state strong, .empty-panel strong { color: var(--ink); font-size: 1rem; }

dialog { color: var(--ink); }
dialog::backdrop { background: rgba(7, 28, 36, .48); backdrop-filter: blur(2px); }
.drawer { width: 680px; max-width: 95vw; height: 100vh; max-height: 100vh; margin: 0 0 0 auto; padding: 0; border: 0; box-shadow: -18px 0 50px rgba(8, 34, 44, .22); }
.drawer[open] { animation: enter-drawer .18s ease-out; }
@keyframes enter-drawer { from { transform: translateX(40px); opacity: .6; } }
.drawer > form { display: flex; flex-direction: column; min-height: 100%; }
.drawer-header { display: flex; align-items: flex-start; justify-content: space-between; padding: 27px 30px 18px; border-bottom: 1px solid var(--line); }
.drawer-header h2 { margin: 3px 0 0; font-family: Georgia, serif; font-size: 1.6rem; }
.dialog-close { width: 38px; height: 38px; border: 0; border-radius: 50%; color: var(--ink-soft); background: #eef2f3; font-size: 1.6rem; cursor: pointer; }
.drawer-hint { margin: 20px 30px 6px; padding: 12px 14px; border-left: 3px solid var(--teal); color: var(--ink-soft); background: var(--teal-pale); font-size: .875rem; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 15px; padding: 20px 30px 28px; }
.form-grid label, .confirm-dialog label, .decision-form label, .login-card label { display: grid; gap: 6px; color: #465b63; font-size: .8rem; font-weight: 750; }
.form-grid input, .form-grid select, .form-grid textarea, .confirm-dialog textarea, .decision-form input, .login-card input { width: 100%; padding: 10px 11px; border: 1px solid var(--line-strong); border-radius: 7px; color: var(--ink); background: white; }
.form-grid input, .form-grid select { height: 41px; }
.form-grid textarea { resize: vertical; }
.span-2 { grid-column: span 2; }
.note-field { padding-top: 16px; border-top: 1px solid var(--line); }
.duplicate-results { padding: 10px 12px; border: 1px solid var(--line); border-radius: 7px; color: var(--ink-soft); background: #f5f8f8; font-size: .8rem; }
.duplicate-results ul, .duplicate-admin-warning ul { margin: 7px 0 0; padding-left: 19px; }
.duplicate-clear { border-color: #a9d8cf; color: var(--teal-dark); background: var(--teal-pale); }
.duplicate-warning { border-color: #e3c477; color: #725016; background: var(--gold-pale); }
.drawer-footer { position: sticky; bottom: 0; display: flex; justify-content: flex-end; gap: 10px; margin-top: auto; padding: 15px 30px; border-top: 1px solid var(--line); background: white; }
.confirm-dialog { width: min(520px, 90vw); padding: 28px; border: 0; border-radius: 12px; box-shadow: var(--shadow); }
.confirm-dialog h2 { margin: 4px 0 8px; font-family: Georgia, serif; }
.confirm-dialog p:not(.eyebrow) { color: var(--ink-soft); }
.dialog-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 20px; }

.status-nav { display: flex; gap: 4px; margin-bottom: 18px; border-bottom: 1px solid var(--line); }
.status-nav a { padding: 9px 14px; border-bottom: 3px solid transparent; color: var(--ink-soft); text-decoration: none; }
.status-nav a.active { border-color: var(--teal); color: var(--ink); font-weight: 750; }
.proposal-list { display: grid; gap: 16px; }
.proposal-card { overflow: hidden; border: 1px solid var(--line); border-radius: var(--radius); background: white; box-shadow: 0 4px 16px rgba(22, 52, 63, .05); }
.proposal-card > header { display: flex; justify-content: space-between; gap: 30px; padding: 20px 22px; border-bottom: 1px solid var(--line); }
.proposal-card h2 { display: inline; margin: 0 0 0 10px; font-family: Georgia, serif; font-size: 1.25rem; }
.proposal-card header p { margin: 6px 0 0; color: var(--ink-soft); font-size: .875rem; }
.proposal-meta { color: var(--ink-soft); font-size: .8rem; text-align: right; }
.diff-header, .diff-row { display: grid; grid-template-columns: 180px minmax(220px, 1fr) minmax(220px, 1fr); }
.diff-header > div, .diff-row > div { min-width: 0; padding: 10px 14px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); overflow-wrap: anywhere; font-size: .875rem; }
.diff-header > div:last-child, .diff-row > div:last-child { border-right: 0; }
.diff-head { color: #62747a; background: #edf2f3; font-size: .72rem !important; font-weight: 800; letter-spacing: .055em; text-transform: uppercase; }
.diff-new { color: #075f57; background: #eef9f6; font-weight: 700; }
.proposal-note, .delete-notice { margin: 16px 22px; padding: 12px 14px; border-radius: 7px; background: #f3f6f7; }
.duplicate-admin-warning { margin: 16px 22px; padding: 12px 14px; border: 1px solid #e3c477; border-radius: 7px; color: #725016; background: var(--gold-pale); font-size: .82rem; }
.proposal-note { font-size: .82rem; }
.proposal-note p { margin: 3px 0 0; }
.delete-notice { color: var(--red); background: var(--red-pale); }
.decision-form { display: flex; align-items: end; justify-content: flex-end; gap: 9px; padding: 15px 22px; border-top: 1px solid var(--line); background: #fafcfc; }
.decision-form label { width: min(460px, 50%); margin-right: auto; }
.decision-fields { display: grid; flex: 1 1 520px; grid-template-columns: 1fr 1fr; gap: 9px; margin-right: auto; }
.decision-fields label { width: auto; margin: 0; }
.decision-form .duplicate-approval { display: grid; gap: 7px; width: min(360px, 42%); margin-right: auto; }
.decision-form .duplicate-approval label { width: 100%; }
.duplicate-approval label span { display: flex; align-items: center; gap: 7px; }
.duplicate-approval input[type=checkbox] { width: auto; }
.decision-result { margin: 0; padding: 15px 22px; border-top: 1px solid var(--line); background: #fafcfc; font-weight: 700; }
.decision-note { display: block; margin-top: 5px; color: var(--ink-soft); font-size: .82rem; font-weight: 400; }
.member-response { margin: 16px 22px; padding: 12px 14px; border-left: 3px solid var(--teal); color: var(--ink-soft); background: var(--teal-pale); }
.member-response p { margin: 3px 0 0; }

.member-summary { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin-bottom: 18px; }
.member-summary article { display: flex; align-items: baseline; gap: 8px; padding: 15px 17px; border: 1px solid var(--line); border-radius: 9px; background: var(--surface); }
.member-summary strong { font-family: Georgia, serif; font-size: 1.65rem; font-weight: 600; }
.member-summary span { color: var(--ink-soft); font-size: .84rem; font-weight: 700; }
.member-toolbar { justify-content: flex-start; }
.member-table-card { max-height: calc(100vh - 330px); }
.member-table { width: 100%; border-collapse: separate; border-spacing: 0; table-layout: fixed; font-size: .875rem; }
.member-table th { position: sticky; z-index: 3; top: 0; padding: 11px 13px; border-bottom: 1px solid var(--line-strong); color: #63767d; background: #edf2f3; font-size: .72rem; font-weight: 800; letter-spacing: .055em; text-align: left; text-transform: uppercase; }
.member-table th:nth-child(1) { width: 220px; }
.member-table th:nth-child(2) { width: 260px; }
.member-table th:nth-child(3) { width: 115px; }
.member-table th:nth-child(4) { width: 150px; }
.member-table th:nth-child(5) { width: 175px; }
.member-table th:last-child { width: 250px; }
.member-table td { height: 62px; padding: 9px 13px; border-bottom: 1px solid #e7edef; background: var(--surface); vertical-align: middle; }
.member-table tbody tr:nth-child(even) td { background: var(--table-stripe); }
.member-table tbody tr:last-child td { border-bottom: 0; }
.member-table tbody tr.member-inactive td { color: var(--ink-soft); }
.member-table td small { display: block; margin-top: 3px; color: var(--ink-soft); font-size: .75rem; }
.member-name { display: block; color: var(--ink); font-size: .95rem; }
.member-actions { display: flex; align-items: center; justify-content: flex-end; gap: 7px; }
.member-actions form { margin: 0; }
.master-protection { display: inline-flex; align-items: center; min-height: 36px; padding: 0 10px; border: 1px solid #d8bf78; border-radius: 7px; color: #6e4b08; background: #fff6dc; font-size: .78rem; font-weight: 750; }
.member-editor-card { max-width: 720px; overflow: hidden; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); box-shadow: 0 5px 20px rgba(22, 52, 63, .06); }
.member-editor-card .form-error { margin: 20px 30px 0; }
.member-form-grid { padding-bottom: 20px; }
.member-form-grid label small { color: var(--ink-soft); font-size: .75rem; font-weight: 500; }
.checkbox-field { display: flex !important; align-items: center; align-self: end; grid-template-columns: auto 1fr; min-height: 41px; }
.checkbox-field input { width: 20px !important; height: 20px !important; }
.protection-notice { display: grid; gap: 2px; margin: 20px 30px 0; padding: 12px 14px; border-left: 3px solid var(--gold); color: var(--ink-soft); background: var(--gold-pale); font-size: .875rem; }
.protection-notice strong { color: var(--ink); }
.member-form-actions { display: flex; justify-content: flex-end; gap: 10px; padding: 15px 30px; border-top: 1px solid var(--line); }

.import-layout { display: grid; grid-template-columns: minmax(480px, 1.4fr) 1fr; gap: 20px; }
.import-card, .info-card { padding: 26px; border: 1px solid var(--line); border-radius: var(--radius); background: white; }
.import-card h2, .info-card h2 { margin-top: 0; font-family: Georgia, serif; }
.import-card input[type=file] { display: block; width: 100%; margin: 20px 0; padding: 24px; border: 1px dashed #8aa5ad; border-radius: 8px; background: #f7fafb; }
.info-card { color: var(--ink-soft); background: #eaf3f4; }

.login-layout { display: grid; grid-template-columns: 1.15fr 440px; align-items: center; gap: 8vw; min-height: calc(100vh - 150px); max-width: 1180px; margin: 0 auto; }
.login-intro h1 { max-width: 640px; margin: 8px 0 18px; font-family: Georgia, serif; font-size: clamp(3rem, 5vw, 5.3rem); font-weight: 500; letter-spacing: -.055em; line-height: .98; }
.login-intro > p:last-child { max-width: 580px; color: var(--ink-soft); font-size: 1.12rem; }
.login-card { padding: 34px; border: 1px solid var(--line); border-top: 5px solid var(--teal); border-radius: 12px; background: white; box-shadow: var(--shadow); }
.login-card h2 { margin: 0; font-family: Georgia, serif; font-size: 1.75rem; }
.login-card form { display: grid; gap: 13px; margin-top: 25px; }
.login-card input { height: 45px; }
.login-help { margin: 18px 0 0; color: var(--ink-soft); font-size: .84rem; text-align: center; }
.login-help a { color: var(--teal-dark); text-underline-offset: 3px; }
.password-help { color: var(--ink-soft); font-size: .75rem; }
.password-help ul { margin: 0; padding-left: 18px; }
.field-error { margin-top: -7px; color: #8e2e2b; font-size: .78rem; }
.form-error { padding: 10px 12px; border-radius: 7px; color: #8e2e2b; background: var(--red-pale); font-size: .85rem; }
.sr-only { position: absolute !important; overflow: hidden; width: 1px; height: 1px; padding: 0; margin: -1px; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

html[data-theme="dark"] .button-secondary,
html[data-theme="dark"] .filter-tabs button.active,
html[data-theme="dark"] .alphabet-nav a,
html[data-theme="dark"] .page-step,
html[data-theme="dark"] .pagination a,
html[data-theme="dark"] .drawer,
html[data-theme="dark"] .drawer-footer,
html[data-theme="dark"] .form-grid input,
html[data-theme="dark"] .form-grid select,
html[data-theme="dark"] .form-grid textarea,
html[data-theme="dark"] .confirm-dialog textarea,
html[data-theme="dark"] .decision-form input,
html[data-theme="dark"] .login-card input,
html[data-theme="dark"] .confirm-dialog,
html[data-theme="dark"] .proposal-card,
html[data-theme="dark"] .import-card,
html[data-theme="dark"] .member-summary article,
html[data-theme="dark"] .member-table-card,
html[data-theme="dark"] .member-editor-card,
html[data-theme="dark"] .login-card { color: var(--ink); background: var(--surface); }
html[data-theme="dark"] .filter-tabs { background: #0c2028; }
html[data-theme="dark"] .button-secondary:hover,
html[data-theme="dark"] .icon-button:hover { background: #17333c; }
html[data-theme="dark"] .address-table th,
html[data-theme="dark"] .member-table th,
html[data-theme="dark"] .diff-head { background: #18313a; }
html[data-theme="dark"] .address-table td { border-bottom-color: #263e47; }
html[data-theme="dark"] .member-table td { border-bottom-color: #263e47; }
html[data-theme="dark"] .status-master,
html[data-theme="dark"] .master-protection { color: #efc96a; background: #3b3016; }
html[data-theme="dark"] .diff-new { color: var(--teal-dark); }
html[data-theme="dark"] .dialog-close,
html[data-theme="dark"] .status-open,
html[data-theme="dark"] .proposal-note,
html[data-theme="dark"] .duplicate-results { color: var(--ink-soft); background: #1a3038; }
html[data-theme="dark"] .diff-new { background: var(--teal-pale); }
html[data-theme="dark"] .decision-form,
html[data-theme="dark"] .decision-result { background: #0d2027; }
html[data-theme="dark"] .info-card { color: var(--ink-soft); background: #123039; }
html[data-theme="dark"] .form-error { color: #ffb3af; }

@media (hover: hover) {
  .address-table tbody tr:hover td { background: var(--table-hover); }
  .member-table tbody tr:hover td { background: var(--table-hover); }
}

@media (max-width: 1100px) {
  .topbar {
    height: auto;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas: "brand account" "nav nav";
    gap: 12px 16px;
    padding: 12px 16px;
  }
  .brand { grid-area: brand; min-width: 0; }
  .topnav {
    grid-area: nav;
    display: flex;
    align-items: center;
    gap: 3px;
    width: calc(100% + 32px);
    margin: 0 -16px -12px;
    border-top: 1px solid rgba(255, 255, 255, .12);
  }
  .topnav a { flex: 1 1 0; min-width: 0; min-height: 48px; justify-content: center; padding: 0 10px; text-align: center; }
  .account { grid-area: account; min-width: 0; margin-left: 0; gap: 12px; }
  .account > span { overflow: hidden; max-width: 180px; text-overflow: ellipsis; white-space: nowrap; }
  .theme-toggle { min-height: 44px; }
}

@media (min-width: 901px) and (max-width: 1200px) {
  .page-shell { width: calc(100% - 28px); }
  .address-table th:nth-child(4), .address-table td:nth-child(4) { display: none; }
  .login-layout { gap: 5vw; }
}

@media (max-width: 900px) {
  .review-details { flex-wrap: wrap; row-gap: 2px; white-space: normal; }
  .review-details .review-count { white-space: nowrap; }
  .page-shell { width: calc(100% - 32px); padding: 22px 0 36px; }
  .workspace-heading { align-items: flex-start; flex-wrap: wrap; gap: 12px; min-height: 0; }
  .workspace-heading h1 { font-size: 1.75rem; }
  .address-workspace-heading { margin-top: 0; }
  .address-heading-copy { align-items: flex-start; flex-direction: column; gap: 2px; }
  .address-workspace-heading h1 { font-size: 1.55rem; }
  .messages { position: static; width: 100%; margin-bottom: 16px; }

  .toolbar { align-items: stretch; flex-direction: column; gap: 12px; }
  .search-field { width: 100%; height: 48px; }
  .toolbar-actions { align-items: stretch; justify-content: space-between; flex-wrap: wrap; }
  .filter-tabs button { min-height: 42px; }

  .table-card { overflow: visible; max-height: none; border: 0; border-radius: 0; background: transparent; box-shadow: none; }
  .address-table, .address-table tbody { display: block; width: 100%; }
  .address-table { table-layout: auto; font-size: .9375rem; }
  .address-table thead {
    position: absolute;
    overflow: hidden;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
  }
  .address-table tbody { display: grid; gap: 12px; }
  .address-table tbody tr {
    display: block;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface);
    box-shadow: 0 4px 14px rgba(22, 52, 63, .06);
  }
  .address-table tbody tr.row-checked { border-left: 4px solid var(--teal); }
  .address-table tbody tr.row-pending { border-left: 4px solid var(--gold); }
  .address-table tr.row-checked td:first-child,
  .address-table tr.row-pending td:first-child { box-shadow: none; }
  .address-table td,
  .address-table tbody tr:last-child td {
    display: grid;
    grid-template-columns: 7.25rem minmax(0, 1fr);
    align-items: start;
    gap: 12px;
    width: 100%;
    height: auto;
    min-height: 48px;
    padding: 11px 13px;
    border-bottom: 1px solid var(--line);
    overflow-wrap: anywhere;
  }
  .address-table td::before {
    content: attr(data-label);
    color: var(--ink-soft);
    font-size: .75rem;
    font-weight: 800;
    letter-spacing: .045em;
    text-transform: uppercase;
  }
  .address-table tbody tr td:last-child,
  .address-table tbody tr:last-child td:last-child { border-bottom: 0; }
  .address-table .cell-value { min-width: 0; overflow-wrap: anywhere; }
  .address-table .email-link { display: block; overflow: visible; text-overflow: clip; overflow-wrap: anywhere; }
  .address-table td.row-actions {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.35fr);
    align-items: stretch;
    gap: 8px;
  }
  .address-table td.row-actions.row-actions-with-confirm { grid-template-columns: minmax(48px, 20%) minmax(0, 1fr) minmax(0, 1.35fr); }
  .address-table td.row-actions::before { display: none; }
  .row-actions form { min-width: 0; }
  .row-actions form .button, .row-actions > .button {
    width: 100%;
    height: 100%;
    min-height: 48px;
    padding: 6px 8px;
    line-height: 1.15;
    white-space: normal;
  }
  .button, .icon-button, .dialog-close { min-height: 44px; font-size: .875rem; }
  .icon-button { width: 44px; height: 44px; padding: 0; }
  .confirm-action-button { padding: 0; font-size: 1.2rem; }
  .confirm-action-button .confirm-action-icon { display: inline; }
  .confirm-action-button .confirm-action-label { display: none; }
  .delete-action-button { width: 100%; padding: 6px 8px; border-color: var(--line-strong); border-radius: 7px; }
  .delete-action-button .action-more { display: none; }
  .delete-action-button .action-delete-text { display: inline; }
  .empty-table-row td,
  .address-table tbody tr:last-child.empty-table-row td { display: block; padding: 0; border-bottom: 0; }
  .empty-table-row td::before { content: none; }

  .address-navigation-row { grid-template-columns: 1fr 1fr; gap: 10px; }
  .alphabet-nav {
    grid-column: 1 / -1;
    grid-row: 1;
    justify-content: flex-start;
    overflow-x: auto;
    padding: 2px 0 8px;
    scrollbar-width: thin;
  }
  .alphabet-nav a, .alphabet-nav span { flex: 0 0 auto; min-width: 40px; height: 40px; }
  .alphabet-nav .alphabet-all { min-width: 52px; }
  .page-step { min-height: 44px; display: inline-flex; align-items: center; }
  .page-step-back { grid-column: 1; grid-row: 2; justify-self: start; }
  .page-step-forward { grid-column: 2; grid-row: 2; justify-self: end; }

  .drawer { width: 100vw; max-width: 100vw; height: 100dvh; max-height: 100dvh; }
  .drawer > form { height: 100%; min-height: 0; }
  .drawer-header { padding: 20px 16px 14px; }
  .drawer-header h2 { overflow-wrap: anywhere; font-size: 1.4rem; }
  .drawer-hint { margin: 14px 16px 4px; }
  .form-grid { flex: 1 1 auto; grid-template-columns: 1fr; gap: 13px; min-height: 0; padding: 16px; overflow-y: auto; }
  .span-2 { grid-column: auto; }
  .form-grid label, .confirm-dialog label, .decision-form label, .login-card label { font-size: .875rem; }
  .form-grid input, .form-grid select, .form-grid textarea, .confirm-dialog textarea, .decision-form input, .login-card input { font-size: 1rem; }
  .drawer-footer { padding: 12px 16px max(12px, env(safe-area-inset-bottom)); }
  .confirm-dialog { width: calc(100% - 24px); max-width: 520px; max-height: calc(100dvh - 24px); padding: 22px 18px; overflow-y: auto; }

  .status-nav { overflow-x: auto; white-space: nowrap; scrollbar-width: thin; }
  .status-nav a { display: inline-flex; align-items: center; min-height: 44px; }
  .proposal-card > header { align-items: flex-start; flex-direction: column; gap: 12px; padding: 18px 16px; }
  .proposal-card h2 { display: block; margin: 9px 0 0; overflow-wrap: anywhere; }
  .proposal-card header p, .proposal-note, .delete-notice, .member-response, .duplicate-admin-warning, .decision-result { overflow-wrap: anywhere; }
  .proposal-meta { text-align: left; }
  .diff-header { display: none; }
  .diff-row { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .diff-row > div { border-right: 1px solid var(--line); }
  .diff-row > div:last-child { border-right: 0; }
  .diff-row .diff-field { grid-column: 1 / -1; border-right: 0; background: var(--table-stripe); font-weight: 750; }
  .diff-old::before, .diff-new::before { display: block; margin-bottom: 4px; color: var(--ink-soft); font-size: .7rem; font-weight: 800; letter-spacing: .045em; text-transform: uppercase; }
  .diff-old::before { content: "Bisher"; }
  .diff-new::before { content: "Vorgeschlagen"; }
  .decision-form { align-items: stretch; flex-direction: column; padding: 15px 16px; }
  .decision-fields { flex-basis: auto; grid-template-columns: 1fr; width: 100%; margin: 0; }
  .decision-form .duplicate-approval { width: 100%; margin: 0; }
  .decision-form > .button { width: 100%; }

  .import-layout { grid-template-columns: 1fr; }
  .import-card, .info-card { padding: 22px 18px; }
  .import-card input[type=file] { padding: 16px; }

  .login-layout { grid-template-columns: 1fr; gap: 28px; min-height: 0; max-width: 600px; padding: 12px 0 28px; }
  .login-card { order: -1; width: 100%; padding: 28px 24px; }
  .login-intro h1 { margin-bottom: 12px; font-size: clamp(2.25rem, 10vw, 3.7rem); }
  .login-intro > p:last-child { font-size: 1rem; }

  .empty-state, .empty-panel { padding: 36px 20px; }

  .member-summary { gap: 8px; }
  .member-summary article { align-items: center; flex-direction: column; gap: 0; padding: 11px 6px; text-align: center; }
  .member-table-card { overflow: visible; max-height: none; border: 0; border-radius: 0; background: transparent; box-shadow: none; }
  .member-table, .member-table tbody { display: block; width: 100%; }
  .member-table { table-layout: auto; font-size: .9375rem; }
  .member-table thead {
    position: absolute;
    overflow: hidden;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
  }
  .member-table tbody { display: grid; gap: 12px; }
  .member-table tbody tr { display: block; overflow: hidden; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); box-shadow: 0 4px 14px rgba(22, 52, 63, .06); }
  .member-table td,
  .member-table tbody tr:last-child td { display: grid; grid-template-columns: 7.5rem minmax(0, 1fr); align-items: center; gap: 12px; width: 100%; height: auto; min-height: 48px; padding: 11px 13px; border-bottom: 1px solid var(--line); overflow-wrap: anywhere; }
  .member-table td::before { content: attr(data-label); color: var(--ink-soft); font-size: .75rem; font-weight: 800; letter-spacing: .045em; text-transform: uppercase; }
  .member-table tbody tr td:last-child,
  .member-table tbody tr:last-child td:last-child { border-bottom: 0; }
  .member-table td.member-actions { display: flex; align-items: stretch; justify-content: flex-start; flex-wrap: wrap; gap: 8px; }
  .member-table td.member-actions::before { flex: 0 0 100%; }
  .member-actions .button, .master-protection { min-height: 44px; }
  .member-editor-card { max-width: none; }
  .member-form-actions { padding: 14px 16px; }
  .protection-notice { margin: 16px 16px 0; }
}

@media (max-width: 540px) {
  .topbar { gap: 10px; padding-right: 12px; padding-left: 12px; }
  .topnav {
    gap: 0;
    width: calc(100% + 24px);
    margin-right: -12px;
    margin-left: -12px;
    padding: 5px 0;
    overflow-x: auto;
    background: rgba(0, 0, 0, .08);
    scrollbar-width: thin;
  }
  .topnav a {
    flex: 1 0 auto;
    min-width: max-content;
    min-height: 44px;
    padding: 0;
    border: 1px solid transparent;
    border-radius: 7px;
    font-size: clamp(.75rem, 3.4vw, .875rem);
    line-height: 1.1;
    white-space: nowrap;
  }
  .topnav a:focus-visible { outline-offset: -3px; }
  .topnav a:hover { border-color: rgba(115, 202, 188, .55); }
  .topnav a[aria-current="page"] { border-color: rgba(115, 202, 188, .7); background: rgba(115, 202, 188, .16); }
  .nav-label-full { display: none; }
  .nav-label-compact { display: inline; }
  .brand { gap: 9px; }
  .brand-mark { width: 34px; height: 34px; }
  .account > span { display: none; }
  .theme-toggle { padding: 0 9px; }
  .page-shell { width: calc(100% - 24px); padding-top: 18px; }
  .workspace-heading { flex-direction: column; gap: 8px; }
  .page-count { align-self: flex-end; }
  .toolbar-actions { flex-direction: column; }
  .toolbar-actions > .button, .filter-tabs { width: 100%; }
  .filter-tabs { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .filter-tabs button { padding: 0 7px; white-space: normal; }
  .address-table td,
  .address-table tbody tr:last-child td { grid-template-columns: 1fr; gap: 4px; padding: 11px 12px; }
  .alphabet-nav a, .alphabet-nav span { min-width: 44px; height: 44px; }
  .drawer-footer, .dialog-actions { align-items: stretch; flex-direction: column-reverse; }
  .drawer-footer .button, .dialog-actions .button { width: 100%; }
  .proposal-note, .delete-notice, .duplicate-admin-warning, .member-response { margin-right: 16px; margin-left: 16px; }
  .diff-row { grid-template-columns: 1fr; }
  .diff-row .diff-field { grid-column: auto; }
  .diff-row > div { border-right: 0; }
  .pagination { grid-template-columns: 1fr 1fr; gap: 10px; }
  .pagination .pagination-summary { grid-column: 1 / -1; grid-row: 1; text-align: center; }
  .pagination > :first-child { grid-column: 1; grid-row: 2; }
  .pagination > :last-child { grid-column: 2; grid-row: 2; }
  .login-card { padding: 24px 18px; }
  .member-table td,
  .member-table tbody tr:last-child td { grid-template-columns: 1fr; gap: 4px; padding: 11px 12px; }
  .member-table td.member-actions { display: flex; }
  .member-table td.member-actions::before { flex: 0 0 100%; }
  .member-actions > .button, .member-actions form, .member-actions form .button { flex: 1 1 140px; }
  .member-form-actions { align-items: stretch; flex-direction: column-reverse; }
  .member-form-actions .button { width: 100%; }
}
@media (max-width: 680px) {
  .account > span { display: none; }
}
@media (max-width: 380px) {
  .theme-toggle .theme-label { display: none !important; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .001ms !important; }
}
