:root {
  color-scheme: light;
  --bg: #f7f8fa; --panel: #fff; --text: #1c2833;
  --muted: #606d7a; --border: #dce2e8; --field: #fff;
  --accent: #245cac; --accent-text: #fff; --hover: #eef3fa;
  --danger: #b42318; --danger-bg: #fff0ef;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #10151d; --panel: #19212b; --text: #edf1f6;
    --muted: #afbbca; --border: #34404f; --field: #202b37;
    --accent: #74a8f5; --accent-text: #07162a; --hover: #253346;
    --danger: #ff8e88; --danger-bg: #3d2227;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #10151d; --panel: #19212b; --text: #edf1f6;
  --muted: #afbbca; --border: #34404f; --field: #202b37;
  --accent: #74a8f5; --accent-text: #07162a; --hover: #253346;
  --danger: #ff8e88; --danger-bg: #3d2227;
}
* { box-sizing: border-box; }
body { background: var(--bg); color: var(--text); margin: 0; font: 16px/1.5 system-ui, -apple-system, Segoe UI, sans-serif; }
.shell { max-width: 1100px; margin: 0 auto; padding: 0 24px 64px; }
.topbar { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 25px 0 28px; border-bottom: 1px solid var(--border); }
.brand { color: var(--text); text-decoration: none; font-size: 1.15rem; font-weight: 750; white-space: nowrap; }
.brand small { display: block; font-size: .76rem; font-weight: 400; color: var(--muted); }
.header-tools { display: flex; align-items: center; gap: 12px; }
.theme-label { color: var(--muted); font-size: .83rem; }
h1 { font-size: clamp(1.45rem, 3vw, 2rem); margin: 0; }
p { margin: 12px 0 20px; }
main { padding-top: 28px; }
.page-heading { display: flex; gap: 15px; align-items: baseline; margin-bottom: 22px; }
.muted { color: var(--muted); }
input, select, button, .button { font: inherit; }
input[type="search"], input:not([type]), input[type="password"], select {
  background: var(--field); color: var(--text); border: 1px solid var(--border);
  border-radius: 10px; min-height: 48px; padding: 10px 12px; max-width: 100%;
}
input:focus-visible, select:focus-visible, button:focus-visible, a:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
button, .button { display: inline-flex; gap: 8px; justify-content: center; align-items: center; min-height: 44px; border: 1px solid transparent; border-radius: 10px; padding: 9px 17px; cursor: pointer; text-decoration: none; font-weight: 650; }
.primary { background: var(--accent); color: var(--accent-text); }
.subtle { color: var(--text); background: var(--panel); border-color: var(--border); }
.danger { color: #fff; background: #b42318; }
.link-button { background: none; color: var(--muted); font-weight: 500; padding: 8px; }
.toolbar { display: flex; gap: 12px; margin-bottom: 14px; }
.search-wrap { flex: 1; }
.search-wrap input { width: 100%; }
.alias-list { background: var(--panel); border: 1px solid var(--border); border-radius: 14px; overflow: hidden; }
.alias-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 91px; padding: 13px 17px; border-bottom: 1px solid var(--border); }
.alias-row:last-child { border-bottom: none; }
.alias-row[hidden], #no-results[hidden] { display: none; }
.alias-text { min-width: 0; overflow-wrap: anywhere; }
.alias-address { font-weight: 650; }
.delivery { font-size: .91rem; margin-top: 3px; }
.row-actions { flex: none; display: flex; flex-direction: column; align-items: center; gap: 3px; }
.icon-button { width: 44px; height: 44px; display: inline-grid; place-items: center; color: var(--muted); border-radius: 9px; }
.icon-button:hover { background: var(--hover); color: var(--text); }
.icon-button.delete-icon:hover { background: var(--danger-bg); color: var(--danger); }
.icon-button svg { width: 19px; height: 19px; }
.form-panel { background: var(--panel); border: 1px solid var(--border); border-radius: 14px; padding: 26px; max-width: 660px; }
.form-panel.narrow { max-width: 480px; }
/* Login page */
.login-main {
  max-width: 480px;
  margin: 0 auto;
  padding-top: 36px;
}

.login-main .form-panel.narrow {
  max-width: none;
}

.login-form {
  display: flex;
  flex-direction: column;
}

.login-form input {
  display: block;
}

.login-form .primary {
  width: 100%;
  margin-top: 24px;
}
.form-panel h1 { margin-bottom: 18px; }
.form-panel label:not(.recipient) { display: block; font-weight: 600; margin: 18px 0 7px; }
.form-panel input:not([type=checkbox]) { width: 100%; }
.address-entry { display: flex; flex-wrap: wrap; align-items: center; gap: 7px; }
.address-entry input { flex: 1; min-width: 140px; }
.address-entry span { color: var(--muted); }
.fixed-address { font-size: 1.1rem; font-weight: 650; overflow-wrap: anywhere; }
fieldset { border: 0; padding: 0; margin: 27px 0 22px; }
legend { font-weight: 650; margin-bottom: 10px; }
.recipient { display: flex; gap: 12px; align-items: center; padding: 10px 12px; min-height: 48px; border: 1px solid var(--border); border-radius: 9px; margin-bottom: 8px; cursor: pointer; }
.recipient input { width: 20px; height: 20px; accent-color: var(--accent); }
.form-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 22px; }
.notice { padding: 13px 16px; background: var(--hover); border: 1px solid var(--border); border-radius: 10px; margin-bottom: 20px; display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.notice.error { background: var(--danger-bg); }
.notice.success { justify-content: space-between; }
.copy-button { border-color: var(--border); color: var(--text); background: var(--panel); }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
@media (max-width: 620px) {
  .shell { padding: 0 14px 38px; }
  .topbar { padding: 15px 0 20px; }
  .theme-label { display: none; }
  .header-tools { gap: 4px; }
  .header-tools select { min-height: 42px; padding: 6px 8px; max-width: 91px; font-size: .86rem; }
  .link-button { font-size: .88rem; }
  .toolbar { flex-direction: column; }
  .new-button { width: 100%; }
  .alias-row { padding: 12px; }
  .alias-address { font-size: .91rem; }
  .delivery { font-size: .82rem; }
  .form-panel { padding: 18px; }
  .form-actions > * { flex: 1; }
}
