:root {
  color-scheme: light;
  --page: #f4f6fb;
  --card: #fff;
  --text: #17243c;
  --muted: #647189;
  --accent: #355de5;
  --solid: #355de5;
  --header: #182b52;
  --header-muted: #bac9e6;
  --badge: #b8e0ff;
  --badge-text: #134f73;
  --border: #dde3ef;
  --icon: #5c6c86;
  --focus: #355de5;
  --shadow: rgba(23, 36, 60, .05);
}
* { box-sizing: border-box; }
html { min-height: 100%; scroll-behavior: smooth; scroll-padding-top: 90px; }
body { margin: 0; background: var(--page); color: var(--text); font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; font-size: 16px; line-height: 1.35; -webkit-font-smoothing: antialiased; }
button, input, select { font: inherit; }
button { cursor: pointer; color: inherit; -webkit-tap-highlight-color: transparent; }
button, a, input, select { touch-action: manipulation; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; }
button svg { pointer-events: none; }
svg { display: block; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
[hidden] { display: none !important; }
.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; }
.topbar { position: sticky; top: 0; z-index: 10; background: var(--header); color: #fff; padding-top: env(safe-area-inset-top, 0px); }
.topbar-inner { max-width: 720px; height: 76px; margin: 0 auto; padding: 0 16px; display: flex; align-items: center; justify-content: space-between; }
.brand { display: flex; align-items: center; gap: 12px; min-width: 0; }
.brand-logo { width: 44px; height: 44px; flex-shrink: 0; object-fit: contain; }
.brand-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.topbar h1 { margin: 0; font-size: 22px; line-height: 1.2; font-weight: 650; letter-spacing: -.45px; }
#directory-title { color: var(--header-muted); font-size: 14px; line-height: 1.2; }
.header-settings { border: 0; background: transparent; padding: 10px; margin-right: -7px; color: white; border-radius: 10px; }
.header-settings svg { width: 25px; height: 25px; stroke-width: 1.8; }
.header-settings:hover { background: rgba(255,255,255,.12); }
.directory-main { max-width: 720px; margin: 0 auto; padding: 16px 16px 30px; }
.search-section { margin-bottom: 14px; }
#search-form { margin: 0; }
.search-box { display: flex; align-items: center; gap: 11px; min-height: 46px; padding: 0 12px; border: 1px solid var(--border); border-radius: 11px; background: var(--card); }
.search-box:focus-within { border-color: var(--accent); }
.search-icon { flex: 0 0 21px; width: 21px; height: 21px; color: var(--muted); stroke-width: 1.8; }
#search { width: 100%; min-width: 0; height: 44px; border: 0; outline: none; padding: 0; background: transparent; color: var(--text); font-size: 16px; }
#search:focus-visible { outline: none; }
#search::placeholder { color: var(--muted); opacity: 1; }
#search::-webkit-search-cancel-button, #search::-webkit-search-decoration { display: none; }
.clear-search { border: 0; background: transparent; color: var(--muted); padding: 5px; margin-right: -4px; }
.clear-search svg { width: 22px; height: 22px; }
.filters { display: flex; align-items: center; gap: 5px; margin-top: 9px; padding: 0 1px; overflow-x: auto; scrollbar-width: none; }
.filters::-webkit-scrollbar { display: none; }
.filter { border: 0; border-radius: 8px; padding: 7px 9px; background: transparent; color: var(--muted); white-space: nowrap; font-size: 13px; }
.filter.active, .filter[aria-pressed="true"] { background: var(--solid); color: #fff; font-weight: 600; }
.filter:not([aria-pressed="true"]):hover { color: var(--accent); }
.results { display: flex; flex-direction: column; gap: 12px; }
.contact { display: flex; align-items: center; gap: 12px; min-height: 80px; padding: 12px 15px 12px 16px; background: var(--card); border: 1px solid var(--border); border-radius: 12px; box-shadow: 0 2px 8px var(--shadow); }
.contact-content { flex: 1; min-width: 0; }
.contact-name { margin: 0 0 6px; font-size: 16px; line-height: 1.3; font-weight: 400; letter-spacing: 0; overflow-wrap: anywhere; }
.numbers { display: flex; flex-direction: column; gap: 7px; }
.number-line { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; }
.number { border: 0; background: transparent; padding: 0; color: var(--text); font-size: 24px; font-weight: 700; line-height: 1.12; letter-spacing: .1px; text-align: left; overflow-wrap: anywhere; }
.number.long { font-size: 20px; letter-spacing: 0; }
.number:hover { color: var(--accent); }
.number-kind { display: inline-block; flex-shrink: 0; background: var(--badge); color: var(--badge-text); border-radius: 4px; padding: 3px 8px; font-size: 15px; line-height: 1.4; font-weight: 400; }
.number-kind.extension { background: #ffe0ec; color: #8d2c57; }
.number-kind.phone { background: #e7eaf1; color: #465269; }
html[data-theme="dark"] .number-kind.extension { background: #4c2942; color: #ffc0dd; }
html[data-theme="dark"] .number-kind.phone { background: #2e394d; color: #d4dded; }
.station-label { font-size: 12px; color: var(--muted); }
.contact-actions { display: flex; align-items: center; gap: 10px; align-self: center; flex-shrink: 0; }
.more-button { width: 21px; height: 41px; padding: 0; display: grid; place-items: center; border: 0; background: transparent; border-radius: 5px; }
.more-button svg { width: 21px; height: 24px; stroke-width: 0; fill: currentColor; }
.more-button:hover { background: var(--page); }
.empty-state { text-align: center; padding: 45px 12px; color: var(--muted); }
.empty-state p { margin: 0 0 14px; }
.empty-state button { padding: 9px 16px; color: var(--accent); background: var(--card); border: 0; border-radius: 8px; }
.app-dialog { width: min(420px, calc(100vw - 32px)); max-height: calc(100dvh - 40px); margin: auto; padding: 22px; border: 0; border-radius: 16px; background: var(--card); color: var(--text); box-shadow: 0 15px 70px rgba(0,0,0,.18); overflow: auto; }
.app-dialog::backdrop { background: rgba(17,22,35,.35); backdrop-filter: blur(3px); }
.dialog-heading { display: flex; align-items: center; justify-content: space-between; gap: 15px; margin-bottom: 24px; }
.dialog-heading h2 { margin: 0; font-size: 20px; line-height: 1.3; font-weight: 650; }
.close-dialog { display: grid; place-items: center; width: 30px; height: 30px; padding: 0; border: 0; border-radius: 50%; background: var(--page); color: var(--muted); font-size: 24px; line-height: 1; }
.setting-row { display: flex; align-items: center; justify-content: space-between; gap: 20px; min-height: 50px; font-size: 16px; }
.switch { position: relative; display: inline-block; width: 46px; height: 28px; flex-shrink: 0; }
.switch input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; z-index: 1; }
.switch-track { display: block; height: 28px; border-radius: 20px; background: var(--border); transition: background .16s ease; }
.switch-track::before { content: ""; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.15); transition: transform .16s ease; }
.switch input:checked + .switch-track { background: var(--solid); }
.switch input:checked + .switch-track::before { transform: translateX(18px); }
.switch input:focus-visible + .switch-track { outline: 3px solid var(--focus); outline-offset: 3px; }
.primary-button, .secondary-button { padding: 10px 18px; border-radius: 7px; border: 1px solid transparent; font-size: 15px; }
.primary-button { background: var(--solid); color: #fff; text-decoration: none; }
.secondary-button { background: var(--page); border-color: var(--border); color: var(--text); }
.full-width { width: 100%; }
.toast { position: fixed; bottom: calc(24px + env(safe-area-inset-bottom, 0px)); left: 50%; transform: translate(-50%, 6px); z-index: 30; padding: 10px 18px; background: var(--text); color: var(--card); border-radius: 22px; font-size: 14px; pointer-events: none; opacity: 0; transition: opacity .15s ease, transform .15s ease; max-width: calc(100vw - 40px); text-align: center; }
.toast.show, .toast.visible { opacity: 1; transform: translate(-50%, 0); }
html[data-theme="dark"] .empty-state button { color: var(--accent); }
@media (min-width: 760px) {
  .directory-main { padding-top: 22px; }
  .contact { padding: 16px 20px; min-height: 91px; }
  .contact-name { font-size: 17px; }
  .contact-actions { gap: 17px; }
}
@media (max-width: 360px) {
  .directory-main { padding-right: 12px; padding-left: 12px; }
  .contact { padding-left: 13px; padding-right: 11px; gap: 7px; }
  .contact-name { font-size: 15px; }
  .contact-actions { gap: 4px; }
  .number { font-size: 22px; }
  .number.long { font-size: 17px; }
  .number-kind { font-size: 13px; padding: 3px 6px; }
  .number-line { gap: 7px; }
  .filter { padding-right: 7px; padding-left: 7px; font-size: 12px; }
}
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } *, *::before, *::after { transition: none !important; } }


.filter { font-size: 14px; }
.directory-main { padding-bottom: calc(30px + env(safe-area-inset-bottom, 0px)); }
.more-button { width: 24px; }
@media (max-width: 360px) { .filter, .number-kind { font-size: 14px; } }
html[data-theme="dark"] { color-scheme: dark; --page: #0e1626; --card: #182338; --text: #eef3ff; --muted: #afbdd6; --accent: #90a9ff; --solid: #355de5; --header: #15233d; --header-muted: #b7c6e0; --badge: #214c69; --badge-text: #c6e9ff; --border: #2e3c56; --icon: #c8d7ef; --focus: #99b1ff; --shadow: rgba(0,0,0,.14); }

.directory-setting { width: 100%; padding: 0; margin-bottom: 4px; background: transparent; border: 0; border-bottom: 1px solid var(--border); text-align: left; min-height: 57px; }
.directory-setting-value { display: inline-flex; align-items: center; gap: 7px; color: var(--muted); font-size: 15px; }
.directory-setting-value svg { width: 17px; height: 17px; stroke-width: 1.7; }
.directory-search-input { display: block; width: 100%; height: 44px; padding: 10px 12px; margin-bottom: 13px; border: 1px solid transparent; border-radius: 9px; background: var(--page); color: var(--text); font-size: 16px; }
.directory-search-input::placeholder { color: var(--muted); opacity: 1; }
.directory-search-input:focus { border-color: var(--accent); }
.directory-results { display: flex; flex-direction: column; gap: 5px; }
.directory-choice { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 13px 12px; width: 100%; border: 1px solid transparent; border-radius: 9px; background: transparent; text-align: left; }
.directory-choice:hover { background: var(--page); }
.directory-choice.selected { background: var(--page); border-color: var(--accent); }
.directory-choice-text { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.directory-choice-text strong { font-size: 17px; font-weight: 650; }
.directory-choice-text span { color: var(--muted); font-size: 14px; line-height: 1.4; }
.selection-mark { display: inline-grid; place-items: center; width: 23px; height: 23px; flex-shrink: 0; color: var(--accent); font-size: 20px; }
.selection-mark svg { width: 20px; height: 20px; }
.directory-empty { margin: 22px 0 10px; color: var(--muted); font-size: 14px; text-align: center; }
html[data-theme="dark"] .selection-mark { color: var(--accent); }
