:root {
  color-scheme: light;
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --bg: #f6f8fa;
  --panel: #ffffff;
  --panel-2: #f9fafb;
  --text: #1f2937;
  --muted: #667085;
  --line: #e4e7ec;
  --line-strong: #d0d5dd;
  --accent: #287a57;
  --accent-strong: #1f6849;
  --accent-soft: #edf7f2;
  --danger: #b42318;
  --danger-soft: #fff3f2;
  --shadow: 0 1px 2px rgba(16, 24, 40, .04), 0 1px 3px rgba(16, 24, 40, .05);
}

* { box-sizing: border-box; }
body {
  margin: 0;
  min-height: 100vh;
  padding-left: env(safe-area-inset-left);
  padding-right: env(safe-area-inset-right);
  background: var(--bg);
  color: var(--text);
}
a { color: inherit; }
code { font-size: .94em; color: #344054; }

.shell { width: min(1120px, calc(100% - 32px)); margin: 42px auto 24px; }
.footer { width: min(1120px, calc(100% - 32px)); margin: 0 auto max(36px, env(safe-area-inset-bottom)); color: var(--muted); font-size: 12px; }
.language-switch { position: fixed; z-index: 20; top: max(16px, env(safe-area-inset-top)); right: max(20px, env(safe-area-inset-right)); display: flex; align-items: center; gap: 7px; color: var(--muted); font-size: 12px; font-weight: 750; }
.language-link { text-decoration: none; padding: 3px 2px; }
.language-link.current { color: var(--accent); }

.card { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 20px; box-shadow: var(--shadow); }
.hero { max-width: 720px; margin: 12vh auto 0; padding: 40px; }
h1, h2 { margin: 0 0 8px; letter-spacing: -.025em; }
h1 { font-size: clamp(30px, 5vw, 40px); }
h2 { font-size: 20px; }
.lead { font-size: 18px; line-height: 1.55; color: var(--muted); max-width: 58ch; }
.eyebrow { margin: 0 0 7px; color: var(--accent); font-size: 11px; font-weight: 800; letter-spacing: .12em; }
.muted, .hint, .empty { color: var(--muted); }
.hint { margin: 0; font-size: 12.5px; line-height: 1.5; }

.topbar, .section-head { display: flex; justify-content: space-between; gap: 20px; align-items: center; }
.topbar { margin-bottom: 20px; }
.grid.two { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; align-items: start; }
.stack { display: grid; gap: 14px; }
.stack.small { gap: 10px; }
label { display: grid; gap: 6px; font-size: 13.5px; font-weight: 650; }
input, select { width: 100%; border: 1px solid var(--line-strong); border-radius: 8px; background: #fff; color: var(--text); padding: 10px 11px; font: inherit; }
input:focus, select:focus { outline: 3px solid var(--accent-soft); border-color: var(--accent); }

.check-row { display: flex; align-items: center; gap: 8px; font-weight: 600; }
.check-row input { width: auto; margin: 0; accent-color: var(--accent); }
.compact-check { min-width: max-content; font-size: 12.5px; }

.button { display: inline-flex; align-items: center; justify-content: center; border: 1px solid var(--line-strong); border-radius: 8px; padding: 9px 13px; background: #fff; color: #344054; text-decoration: none; font: inherit; font-weight: 650; cursor: pointer; box-shadow: 0 1px 1px rgba(16, 24, 40, .02); }
.button:hover { border-color: #98a2b3; background: #fcfcfd; }
.button.primary { background: var(--accent); color: #fff; border-color: var(--accent); }
.button.primary:hover { background: var(--accent-strong); border-color: var(--accent-strong); }
.button.ghost { background: transparent; box-shadow: none; }
.button.danger { color: var(--danger); }
.button.danger:hover { background: var(--danger-soft); border-color: #fecdca; }
.button:disabled { opacity: .45; cursor: not-allowed; pointer-events: none; }
.button.compact { padding: 6px 9px; font-size: 12.5px; }
.button-row { display: flex; gap: 7px; flex-wrap: wrap; }
.top-gap { margin-top: 16px; }
.count { min-width: 34px; height: 34px; padding: 0 9px; border-radius: 999px; display: grid; place-items: center; background: var(--panel-2); color: #475467; font-size: 13px; font-weight: 750; }

.mode-picker { display: grid; gap: 8px; margin: 0; padding: 0; border: 0; }
.mode-picker legend { padding: 0; font-size: 13.5px; font-weight: 650; }
.mode-picker-hint { margin-top: -3px; margin-bottom: 2px; }
.mode-option { position: relative; display: block; cursor: pointer; }
.mode-option > input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.mode-option-body { display: grid; gap: 4px; padding: 11px 12px; border: 1px solid var(--line); border-radius: 9px; background: #fff; transition: border-color .15s ease, box-shadow .15s ease, background .15s ease; }
.mode-option:hover .mode-option-body { border-color: #b9c0ca; }
.mode-option > input:focus-visible + .mode-option-body { outline: 3px solid var(--accent-soft); border-color: var(--accent); }
.mode-option > input:checked + .mode-option-body { border-color: #74ad92; background: #fbfefc; box-shadow: 0 0 0 3px var(--accent-soft); }
.mode-option-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.mode-option code { overflow-wrap: anywhere; color: #475467; font-size: 12.5px; font-weight: 500; }
.mode-option small { color: var(--muted); font-size: 12px; line-height: 1.4; font-weight: 450; }
.recommended-badge { display: inline-flex; align-items: center; border-radius: 999px; padding: 2px 7px; background: var(--accent-soft); color: var(--accent-strong); font-size: 10.5px; font-weight: 750; }

.pool-list { display: grid; gap: 7px; margin-top: 14px; max-height: 360px; overflow-y: auto; overscroll-behavior: contain; padding-right: 4px; }
.pool-item { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 9px 10px; border: 1px solid var(--line); border-radius: 9px; background: var(--panel-2); }
.pool-item code { overflow-wrap: anywhere; }
.pool-actions { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; }
.pool-item-used .pool-actions::after {
  content: "Delete";
  display: inline-flex;
  box-sizing: border-box;
  align-items: center;
  justify-content: center;
  visibility: hidden;
  padding: 6px 9px;
  border: 1px solid transparent;
  font: inherit;
  font-size: 12.5px;
  font-weight: 650;
  white-space: nowrap;
}
html[lang="de"] .pool-item-used .pool-actions::after { content: "Löschen"; }

.alias-card { padding-bottom: 12px; }
.alias-toolbar { align-items: flex-end; }
.search-box { position: relative; width: min(360px, 70vw); }
.search { width: 100%; padding-right: 38px; }
.search::-webkit-search-cancel-button { display: none; }
.search.searching { background-image: linear-gradient(90deg, transparent, rgba(40, 122, 87, .08), transparent); background-size: 200% 100%; animation: search-pulse 1s linear infinite; }
.search-clear { position: absolute; top: 50%; right: 8px; width: 28px; height: 28px; transform: translateY(-50%); border: 0; border-radius: 999px; background: transparent; color: #667085; font-size: 20px; line-height: 1; cursor: pointer; }
.search-clear:hover { background: #f2f4f7; color: #344054; }
.search-clear[hidden] { display: none; }
@keyframes search-pulse { from { background-position: 100% 0; } to { background-position: -100% 0; } }

[data-alias-results-region] { display: flex; flex-direction: column; }
.status-filters { order: 1; display: flex; gap: 7px; flex-wrap: wrap; margin-top: 15px; }
.filter-pill { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); border-radius: 999px; padding: 6px 10px; background: #fff; color: var(--muted); text-decoration: none; font-size: 12.5px; font-weight: 650; }
.filter-pill span { min-width: 22px; padding: 1px 5px; border-radius: 999px; background: #f2f4f7; text-align: center; font-size: 10.5px; }
.filter-pill.current { color: var(--accent-strong); border-color: #b7ddca; background: var(--accent-soft); }
.filter-pill.current span { background: #dcefe5; }
.metadata-hint { margin-top: 10px; max-width: 90ch; }

.bulk-toolbar { display: contents; }
.bulk-selection, .bulk-actions { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; }
.bulk-selection { order: 2; margin-top: 12px; padding: 10px 0 2px; border-top: 1px solid var(--line); }
.bulk-actions { order: 4; justify-content: flex-start; margin-top: 12px; }
.bulk-actions select { width: auto !important; min-width: 0 !important; padding: 6px 9px; font-size: 12.5px; }
.bulk-count { color: var(--muted); font-size: 12.5px; font-weight: 650; white-space: nowrap; }

.alias-list { order: 3; display: grid; gap: 0; margin-top: 12px; border-top: 1px solid var(--line); }
.alias-row { display: grid; grid-template-columns: 24px minmax(0, 1fr) 366px; align-items: center; gap: 12px; padding: 13px 2px; border-bottom: 1px solid var(--line); transition: opacity .15s ease, background .15s ease; }
.alias-row:hover { background: #fcfcfd; }
.alias-row.disabled-row { opacity: .58; }
.alias-row.disabled-row:hover, .alias-row.disabled-row:focus-within { opacity: 1; }
.alias-select-control { display: flex; align-items: center; justify-content: center; }
.alias-select-control input { width: auto; margin: 0; accent-color: var(--accent); }
.alias-main { min-width: 0; display: grid; grid-template-columns: minmax(0, 1fr) 181px; align-items: center; gap: 18px; }
.alias-info { min-width: 0; display: grid; gap: 3px; }
.alias-info strong { font-size: 14px; }
.alias-main code { overflow-wrap: anywhere; color: #475467; }
.alias-actions { display: grid; grid-template-columns: 104px 112px 136px; align-items: center; gap: 7px; justify-content: end; }
.alias-copy-action, .alias-edit-action > summary, .alias-toggle-action > button { width: 100%; }
.alias-edit-action, .alias-toggle-action { width: 100%; }
.status-row { width: 181px; display: grid; grid-template-columns: repeat(2, 88px); align-items: center; gap: 5px; justify-content: end; }
.status { display: inline-flex; align-items: center; justify-content: center; min-height: 25px; font-size: 11px; border-radius: 999px; padding: 3px 7px; font-weight: 650; text-align: center; }
.status-fixed { width: 88px; min-width: 88px; }
.status.on, .status.sogo-on { color: var(--accent-strong); background: var(--accent-soft); }
.status.off, .status.sogo-off { color: #667085; background: #f2f4f7; }

.list-footer { order: 5; display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap; margin-top: 14px; padding-top: 14px; }
.range-summary { color: var(--muted); font-size: 12.5px; }
.page-size-form label { display: flex; align-items: center; gap: 7px; white-space: nowrap; }
.page-size-form select { width: auto; min-width: 72px; padding: 6px 9px; }
.pagination { display: flex; align-items: center; gap: 5px; flex-wrap: wrap; }
.page-link { min-width: 32px; min-height: 32px; display: inline-flex; align-items: center; justify-content: center; border: 1px solid var(--line); border-radius: 7px; padding: 5px 8px; background: #fff; text-decoration: none; font-size: 12px; font-weight: 650; }
.page-link.current { background: var(--accent); color: #fff; border-color: var(--accent); }
.page-ellipsis { color: var(--muted); padding: 0 2px; }

.hidden { display: none; }
.address-input { display: grid; grid-template-columns: 1fr auto; gap: 8px; align-items: center; }
.address-input span { color: var(--muted); }
details { position: relative; }
summary { list-style: none; }
summary::-webkit-details-marker { display: none; }
.edit-panel { position: absolute; z-index: 10; right: 0; top: calc(100% + 7px); width: min(340px, 82vw); padding: 14px; border: 1px solid var(--line); border-radius: 10px; background: #fff; box-shadow: 0 16px 40px rgba(16, 24, 40, .14); }

.assign-dialog { width: min(760px, calc(100% - 28px)); max-height: min(78vh, 720px); padding: 20px; border: 1px solid var(--line); border-radius: 14px; background: #fff; color: var(--text); box-shadow: 0 24px 70px rgba(16, 24, 40, .2); }
.assign-dialog-single { width: min(500px, calc(100% - 28px)); }
.assign-dialog::backdrop { background: rgba(16, 24, 40, .3); backdrop-filter: blur(2px); }
.dialog-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; margin-bottom: 14px; }
.dialog-head .muted { margin: 0; }
.dialog-close { width: 32px; height: 32px; flex: 0 0 auto; border: 0; border-radius: 999px; background: #f2f4f7; color: #475467; font-size: 22px; line-height: 1; cursor: pointer; }
.dialog-close:hover { background: #e4e7ec; color: var(--text); }
.assign-address { display: block; padding: 10px 11px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel-2); overflow-wrap: anywhere; }
.assign-dialog .mode-picker.top-gap { margin-top: 18px; }

@media (max-width: 900px) {
  .alias-row { grid-template-columns: 24px minmax(0, 1fr); gap: 10px 12px; }
  .alias-actions { grid-column: 2; justify-content: start; }
}

@media (max-width: 760px) {
  .shell { width: min(100% - 20px, 1120px); margin-top: max(48px, calc(env(safe-area-inset-top) + 38px)); }
  .language-switch { top: max(10px, env(safe-area-inset-top)); right: max(10px, env(safe-area-inset-right)); }
  .grid.two { grid-template-columns: 1fr; }
  .topbar, .section-head { align-items: stretch; flex-direction: column; }
  .bulk-selection, .bulk-actions { width: 100%; }
  .alias-main { grid-template-columns: 1fr; gap: 8px; }
  .status-row { width: auto; justify-content: start; }
  .alias-actions { display: flex; flex-wrap: wrap; justify-content: flex-start; }
  .alias-copy-action, .alias-edit-action, .alias-toggle-action { width: auto; }
  .alias-edit-action > summary, .alias-toggle-action > button { width: auto; }
  .search-box { width: 100%; }
  .status-filters { align-items: stretch; }
  .filter-pill { justify-content: space-between; flex: 1; }
  .list-footer { align-items: stretch; flex-direction: column; }
  .page-size-form label { justify-content: space-between; }
  .pagination { justify-content: center; }
  .compact-check { min-width: 0; }
  .hero { margin-top: 8vh; padding: 28px; }
  .assign-dialog { padding: 16px; }
  .pool-item { align-items: stretch; flex-direction: column; }
  .pool-actions { justify-content: flex-start; }
}
