:root {
    color-scheme: light;
    font-family: Cairo, "Segoe UI", Tahoma, sans-serif;
    --background: #f5f7fa;
    --white: #fff;
    --input: #f1f5f9;
    --ink: #0f172a;
    --muted: #526277;
    --border: #dfe6ee;
    --blue: #037eb5;
    --blue-dark: #075e89;
    --blue-light: #e0f2fe;
    color: var(--ink);
    background: var(--background);
}
* { box-sizing: border-box; }
body { margin: 0; min-height: 100dvh; }
.wrap { width: min(calc(100% - 2rem), 42rem); margin-inline: auto; }

.top { display: flex; align-items: center; justify-content: space-between; gap: .75rem; }
.scope-icon { display: grid; place-items: center; color: var(--blue-dark); background: var(--blue-light); font-weight: 850; }
main { padding: 1rem 0 calc(6rem + env(safe-area-inset-bottom)); }
h1, h2 { margin: 0; line-height: 1.35; }
h1 { font-size: clamp(1.45rem, 6vw, 2rem); font-weight: 850; }
.sub { color: var(--muted); font-size: .9rem; line-height: 1.65; margin: .55rem 0 .9rem; }
button, input, select { font: inherit; }
button { min-height: 2.8rem; border: 1px solid transparent; border-radius: .85rem; cursor: pointer; }
button:disabled { cursor: default; opacity: .55; }
button:focus-visible, input:focus-visible, select:focus-visible { outline: 3px solid var(--blue); outline-offset: 2px; }
.quiet { padding: .55rem .9rem; color: var(--blue-dark); background: var(--white); border-color: var(--border); font-weight: 730; }
.primary {
    padding: .7rem 1rem; width: 100%; min-height: 3.35rem;
    color: #fff; background: linear-gradient(110deg, #0287bd, #07628d); font-weight: 800;
}
.scope-page { max-width: 30rem; margin: clamp(2rem,8vh,5.25rem) auto 0; text-align: center; }
.scope-icon { width: 4.15rem; height: 4.15rem; margin: 0 auto 1.7rem; border-radius: 1.25rem; font-size: 1.85rem; }
.scope-page h1 { color: var(--blue-dark); }
.scope-page h2 { font-size: 1.2rem; margin-top: 1rem; font-weight: 830; }
.scope-page form { margin-top: 1.8rem; text-align: start; }
.scope-page label { margin-bottom: .7rem; }
.scope-page .primary { margin-top: .45rem; }
.work-heading { margin: .25rem 0 1rem; }
.scope-bar { background: var(--white); border: 1px solid var(--border); border-radius: 1rem; padding: .75rem .9rem; }
.scope-bar small { display: block; color: var(--muted); font-size: .83rem; margin-bottom: .15rem; }
.scope-bar strong { font-size: 1.13rem; font-weight: 850; }
.scope-bar .quiet { background: var(--input); }
.switch { display: grid; gap: .3rem; padding: .27rem; border-radius: .9rem; }
.switch button { color: var(--muted); background: transparent; font-size: .9rem; font-weight: 750; padding: .3rem .6rem; }
.period-title { margin: 1rem 0 .45rem; font-size: 1rem; }
.period-tabs { grid-template-columns: repeat(3,minmax(0,1fr)); background: #eaf0f6; }
.period-tabs [aria-pressed=true] { color: var(--blue-dark); background: var(--white); }
.filters { display: grid; gap: .75rem; margin-top: 1rem; }
label { display: grid; gap: .38rem; font-size: .93rem; font-weight: 750; }
input, select {
    width: 100%; min-height: 3.1rem; padding: .65rem .8rem;
    color: var(--ink); background: var(--white); border: 1px solid var(--border); border-radius: .85rem;
    font-size: 1rem;
}
input::placeholder { color: var(--muted); opacity: 1; }
.status-tabs { display: flex; gap: .45rem; overflow-x: auto; margin: .8rem 0 0; padding: .12rem 0 .25rem; scrollbar-width: thin; }
.status-tabs button { flex: 0 0 auto; background: var(--white); border: 1px solid var(--border); border-radius: 2rem; padding-inline: .75rem; }
.status-tabs [aria-pressed=true] { background: var(--blue-dark); color: #fff; border-color: var(--blue-dark); }
.status-tabs span { margin-inline-start: .18rem; }
.group { font-size: .96rem; margin: 1rem 0 .4rem; color: var(--muted); }
.card {
    width: 100%; display: grid; gap: .75rem; text-align: start; padding: .85rem .95rem; margin: .5rem 0;
    color: var(--ink); background: var(--white); border: 1px solid var(--border); border-radius: 1rem;
}
.card .top { flex-wrap: wrap; }
.card strong { font-size: 1.02rem; line-height: 1.6; font-weight: 850; }
.card-id { color: var(--blue-dark); font-size: 1.05rem; font-weight: 850; direction: ltr; }
.status { background: var(--input); color: var(--muted); border-radius: 1rem; padding: .22rem .55rem; font-size: .84rem; font-weight: 720; }
.card-meta { border-top: 1px solid var(--border); padding-top: .65rem; color: var(--muted); }
.timer { display: inline-block; border-radius: 1rem; padding: .22rem .55rem; font-weight: 800; font-size: .83rem; background: #dcfce7; color: #126032; }
.timer.alert-timer { background: #fee2e2; color: #a41a1a; }
.timer.urgent-timer { background: #ffedd5; color: #9a3412; }
.timer.unknown-timer { background: var(--input); color: var(--muted); }
.more { width: 100%; margin: .65rem 0; }
.views {
    position: fixed; inset: auto 0 0; z-index: 2;
    grid-template-columns: repeat(2,minmax(0,1fr)); gap: .4rem;
    padding: .45rem max(1rem,calc((100vw - 41rem)/2)) calc(.45rem + env(safe-area-inset-bottom));
    border-top: 1px solid var(--border); border-radius: 0; background: var(--white);
}
.views [aria-pressed=true] { background: var(--blue-light); color: var(--blue-dark); }
#map-panel { margin-top: .85rem; }
.login, dialog { max-width: 30rem; padding: 1.15rem; background: var(--white); color: var(--ink); border: 1px solid var(--border); border-radius: 1rem; }
.login { margin: 2rem auto; }
.login label { margin: .75rem 0; }
dialog { width: calc(100% - 1.25rem); }
dialog::backdrop { background: #0f172a88; }
dialog h2 { font-size: 1.15rem; }
dl { display: grid; grid-template-columns: minmax(0,1fr) minmax(0,1fr); gap: .5rem; }
dt { color: var(--muted); }
dd { margin: 0; overflow-wrap: anywhere; }
[hidden] { display: none !important; }
@font-face {
    font-family: "QMS Icons";
    src: url("fonts/fa-solid-900.woff2") format("woff2");
    font-weight: 900;
    font-display: block;
}
.icon, .timer::before {
    display: inline-block;
    font: 900 1em/1 "QMS Icons";
    text-align: center;
}
.icon { margin-inline-end: .24em; }
.scope-icon .icon { margin: 0; }
.icon-location::before { content: "\f3c5"; }
.icon-next::before { content: "\f060"; }
.icon-swap::before { content: "\f362"; }
.icon-refresh::before { content: "\f2f1"; }
.icon-list::before { content: "\f0ae"; }
.icon-map::before { content: "\f5a0"; }
.icon-today::before { content: "\f185"; }
.icon-week::before { content: "\f784"; }
.icon-month::before { content: "\f073"; }
.icon-block::before { content: "\f1ad"; }
.icon-search::before { content: "\f002"; }
.icon-layer::before { content: "\f5fd"; }
.icon-overdue::before { content: "\f06a"; }
.icon-urgent::before { content: "\f071"; }
.icon-clock::before, .timer::before { content: "\f017"; }
.icon-wait::before { content: "\f254"; }
.timer::before { margin-inline-end: .35em; }
.status-tabs .icon { margin-inline-start: 0; }
.status-tabs [aria-pressed=false] .icon-overdue { color: #a41a1a; }
.status-tabs [aria-pressed=false] .icon-urgent { color: #9a3412; }

.osm-map {
    height: clamp(19rem,55vh,29rem); margin-top: .65rem; z-index: 0;
    background: #eaf3f5; border: 1px solid var(--border); border-radius: .9rem;
}
.osm-map .map-marker { display: grid; place-items: center; background: transparent; border: 0; }
.osm-map .map-marker:focus-visible { outline: 3px solid var(--blue); border-radius: 50%; }
.map-marker::after, .map-legend li::before {
    content: ""; display: block; width: .8rem; height: .8rem; border-radius: 50%;
    background: var(--marker, #526277);
}
.map-marker::after { margin: auto; border: 2px solid #fff; box-shadow: 0 0 0 1px #0f172a35; }
.marker-overdue, .legend-overdue { --marker: #c62828; }
.marker-urgent, .legend-urgent { --marker: #b95108; }
.marker-running, .legend-running { --marker: #137d43; }
.map-legend { display: flex; flex-wrap: wrap; gap: .55rem .9rem; list-style: none; padding: 0; margin: .8rem 0 0; font-size: .86rem; }
.map-legend li { display: flex; align-items: center; gap: .35rem; }

/* Mobile surfaces and navigation */
:root {
    --background: #f4f6fb;
    --input: #edf1f8;
    --border: #e0e6f0;
    --ink: #15233a;
    --muted: #4b5d76;
    --blue: #1761b9;
    --blue-dark: #174c94;
    --blue-light: #dceaff;
    --surface-shadow: 0 2px 8px #203b6b0a;
}
.wrap { width: min(calc(100% - 2rem), 42rem); }

main { padding-top: .65rem; padding-bottom: calc(6.25rem + env(safe-area-inset-bottom)); }
h1 { letter-spacing: -.02em; }
.quiet { border-radius: 1rem; }
.primary {
    min-height: 3.5rem; background: #1b56a5; border-radius: 1rem;
    box-shadow: 0 5px 12px #184f9825;
}
.scope-page {
    max-width: 28rem; margin: clamp(.6rem,5vh,3.2rem) auto 0;
    padding: 1rem 0 0; text-align: start;
}
.scope-page h1 { color: var(--ink); font-size: clamp(1.65rem,7vw,2.25rem); }
.scope-page .sub { margin: .45rem 0 0; }
.scope-page form {
    margin-top: 1.3rem; padding: 1rem;
    background: var(--white); border: 1px solid var(--border);
    border-radius: 1.4rem; box-shadow: var(--surface-shadow);
}
.scope-art {
    margin-bottom: 1.15rem; height: clamp(7.5rem,25vw,10.5rem); display: grid; place-items: center;
    border-radius: 1.55rem;
    background: radial-gradient(circle at 78% 20%,#d3dfff 0 9%,transparent 9%),
        radial-gradient(circle at 18% 82%,#b8d6ff80 0 15%,transparent 15%),
        linear-gradient(135deg,#dceaff,#e8ecfc);
}
.scope-icon {
    margin: 0; width: 4.15rem; height: 4.15rem; color: #1a56a1;
    border-radius: 1.25rem; background: #ffffffeb; box-shadow: 0 6px 18px #22447b1a;
}
.field-caption .icon { color: var(--blue); }
#scope-status:empty { display:none; }
.workspace-head { padding: .75rem .05rem 1rem; }
.workspace-caption { margin: 0 0 .35rem; font-size: .87rem; color: var(--blue-dark); font-weight: 780; }
.workspace-head h1 { font-size: clamp(1.7rem,7vw,2.25rem); }
.icon-button {
    display: grid; place-items: center; width: 3rem; height: 3rem; min-height: 3rem;
    padding: 0; background: var(--blue-light); border: 0; color: var(--blue-dark);
}
.icon-button .icon { margin: 0; }
.workspace-meta { margin-top: .48rem; gap: .4rem; }
.workspace-meta .sub { margin: 0; font-size: .82rem; }
.text-button {
    flex: none; min-height: 2.75rem; padding: .35rem .45rem;
    border-color: transparent; background: transparent; font-size: .84rem;
}
.filter-card {
    padding: .9rem; background: var(--white); border: 1px solid var(--border);
    border-radius: 1.35rem; box-shadow: var(--surface-shadow);
}
.period-title { margin: 0 0 .55rem; font-weight: 820; }
.period-tabs { background: var(--input); border-radius: 2rem; }
.period-tabs button { border-radius: 2rem; min-height: 2.72rem; }
.period-tabs [aria-pressed=true] { background: var(--blue-light); color: #123f81; }
.filters { gap: .7rem; margin-top: .75rem; }
.filters label { font-size: .86rem; }
input, select { border-radius: .95rem; border-color: #d8e1ef; min-height: 3rem; }
#search { background: var(--input); border-color: transparent; }
.status-tabs { gap: .4rem; margin-top: .9rem; scrollbar-width: none; }
.status-tabs button { min-height: 2.8rem; border-radius: .85rem; padding-inline: .67rem; }
.status-tabs [aria-pressed=true] { background: #1a55a5; border-color: #1a55a5; }
.result-count { margin: .85rem 0 .35rem; color: var(--muted); font-weight: 750; font-size: .91rem; }
.group { margin: .8rem 0 .4rem; color: #385676; font-weight: 800; }
.card {
    position: relative; margin: .55rem 0; padding: .88rem .92rem;
    border-radius: 1.2rem; border: 1px solid var(--border); box-shadow: var(--surface-shadow);
    border-inline-start: 3px solid #5990d0;
}
.card-overdue { border-inline-start-color: #c83d3d; }
.card-urgent { border-inline-start-color: #d37a16; }
.card-unknown { border-inline-start-color: #95a4b7; }
.card strong { font-size: 1rem; font-weight: 790; }
.card-meta { font-size: .83rem; }
.timer { color: #285886; background: #e8f1fc; }
.timer.alert-timer { background: #fee2e2; color: #a41a1a; }
.timer.urgent-timer { background: #ffedd5; color: #9a3412; }
.timer.unknown-timer { background: var(--input); color: var(--muted); }
.views {
    gap: .4rem; min-height: 4.65rem;
    padding: .32rem max(1rem,calc((100vw - 40rem)/2)) calc(.4rem + env(safe-area-inset-bottom));
    box-shadow: 0 -6px 24px #1b386309; background: #fbfcff;
}
.views button {
    display: grid; justify-items: center; align-content: center; gap: .18rem;
    min-height: 3.7rem; padding: 0; border-radius: .95rem;
}
.nav-icon { display: grid; place-items: center; min-width: 3.8rem; height: 1.8rem; border-radius: 2rem; }
.nav-icon .icon { margin: 0; font-size: 1.04rem; }
.views [aria-pressed=true] { background: transparent; color: #174c94; }
.views [aria-pressed=true] .nav-icon { background: var(--blue-light); }
.views button[hidden]+button { grid-column: 1/-1; }
#map-panel { background: var(--white); border: 1px solid var(--border); border-radius: 1.35rem; padding: .8rem; }
.osm-map { border-radius: 1rem; }
dialog {
    max-height: min(78dvh,38rem); overflow: auto;
    border-radius: 1.35rem; padding: 1rem;
    box-shadow: 0 14px 50px #10244034;
}
.sheet-handle { display: none; }
@media (max-width: 520px) {
    dialog {
        width: 100%; max-width: none; margin: auto 0 0;
        border-radius: 1.45rem 1.45rem 0 0;
        padding: .55rem 1rem calc(1rem + env(safe-area-inset-bottom));
    }
    .sheet-handle { display: block; width: 2.3rem; height: .23rem; border-radius: 1rem; background: #aab8c8; margin: 0 auto .65rem; }
}

main { padding-top: calc(.85rem + env(safe-area-inset-top)); }
.workspace-head {
    margin: .2rem 0 .9rem;
    padding: .92rem;
    border-radius: 1.35rem;
    border: 1px solid #d8e4f5;
    background: linear-gradient(125deg,#edf4ff 0%,#fff 82%);
    box-shadow: var(--surface-shadow);
}
.district-header, .district-footer, .district-identity { display: flex; align-items: center; gap: .65rem; }
.district-header, .district-footer { justify-content: space-between; }
.district-identity { min-width: 0; }
.district-identity > div { min-width: 0; }
.district-icon {
    flex: 0 0 2.75rem;
    display: grid; place-items: center;
    width: 2.75rem; height: 2.75rem; border-radius: .9rem;
    color: #194b91; background: #dceaff;
}
.district-icon .icon { margin: 0; }
.district-label { display: block; color: var(--muted); font-size: .77rem; font-weight: 720; }
.workspace-head h1 { font-size: clamp(1.3rem,6vw,1.75rem); overflow-wrap: anywhere; }
.workspace-head .icon-button { flex: 0 0 3rem; background: #fff; border: 1px solid #d8e4f5; }
.district-footer { margin-top: .65rem; padding-top: .45rem; border-top: 1px solid #dbe6f5; }
.district-footer .sub { margin: 0; font-size: .8rem; }
.district-footer .text-button { padding-inline: .55rem; background: #dceaff; }
.account-actions { margin-top: 1rem; }

/* Softer layout and touch feedback */
:root {
    --background: #f7f9fd;
    --input: #eff3fa;
    --border: #e4eaf3;
    --blue-light: #e4eeff;
    --surface-shadow: 0 7px 22px #2248730a;
}
main { padding-top: calc(.95rem + env(safe-area-inset-top)); }
.workspace-head {
    margin-bottom: 1rem;
    padding: 1rem;
    border-color: #e3ebf7;
    border-radius: 1.65rem;
    background: linear-gradient(132deg,#edf4ff 0%,#fafcff 66%,#fff 100%);
}
.district-icon, .workspace-head .icon-button { border-radius: 1rem; }
.workspace-head .icon-button { border-color: #e7edf7; box-shadow: 0 2px 8px #2248730b; }
.district-footer { border-top-color: #e7edf8; padding-top: .5rem; }
.district-footer .text-button { background: #e8f0ff; }
.scope-page form, .filter-card, #map-panel { border-radius: 1.55rem; }
.scope-page form, .filter-card { padding: 1rem; }
input, select { border-color: #e2e9f3; border-radius: 1rem; }
.primary { border-radius: 1.12rem; box-shadow: 0 5px 12px #184f981c; }
.status-tabs { gap: .5rem; }
.status-tabs button { border-radius: 1rem; border-color: var(--border); }
.status-tabs [aria-pressed=true] { color: #17417a; background: #dfeaff; border-color: #d5e5ff; }
.card {
    margin-block: .65rem;
    padding: .96rem 1rem;
    border-inline-start-width: 2px;
    border-radius: 1.45rem;
}
.card-meta { border-top-color: #edf1f7; }
.status { background: #f0f3f9; }
.timer.alert-timer { background: #ffe9e9; color: #a41a1a; }
.timer.urgent-timer { background: #fff0df; color: #9a3412; }
.views { background: #fcfdff; border-top-color: #e8eef6; box-shadow: 0 -8px 26px #1b386307; }
dialog { border-color: #e7edf6; }
@media (prefers-reduced-motion: no-preference) {
    .quiet, .primary, .switch button, .card {
        transition: background-color .16s ease, border-color .16s ease, transform .16s ease, box-shadow .16s ease;
    }
    .card:active, .primary:active, .quiet:active { transform: scale(.985); }
    @media (hover: hover) {
        .card:hover { box-shadow: 0 7px 18px #22487315; }
        .quiet:hover { border-color: #c6d7ee; }
    }
}

.icon-share::before { content: "\f064"; }
#details > .top { margin-bottom: .9rem; }
.detail-hero { padding: .95rem; border-radius: 1.25rem; background: #edf4ff; border: 1px solid #e1ebfa; }
.detail-identity { display: flex; align-items: center; justify-content: space-between; gap: .6rem; }
.detail-kpi { font-size: 1.12rem; line-height: 1.65; margin: .55rem 0 .75rem; font-weight: 820; }
.detail-timer {
    display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: .35rem .65rem;
    border-top: 1px solid #dbe7f9; padding-top: .65rem; color: #224e83; font-size: .88rem;
}
.detail-timer-value { font-size: .97rem; }
.detail-fields { gap: .5rem; margin: .75rem 0; }
.detail-field { padding: .62rem .72rem; border-radius: .9rem; background: #f5f7fb; }
.detail-field dt { font-size: .79rem; }
.detail-field dd { margin-top: .23rem; font-size: .9rem; font-weight: 700; }
.detail-actions { display: flex; flex-wrap: wrap; gap: .55rem; margin-top: .8rem; }
.detail-link {
    display: flex; justify-content: center; align-items: center; flex: 1 1 8rem;
    min-height: 2.9rem; padding: .45rem .55rem; border-radius: .88rem;
    font-weight: 780; font-size: .88rem; text-decoration: none;
}
.location-link { color: #174c94; background: #e4eeff; }
.whatsapp-link { color: #146044; background: #e1f5e9; }
.detail-link:focus-visible { outline: 3px solid var(--blue); outline-offset: 2px; }

@font-face {
    font-family: "QMS Brands";
    src: url("fonts/fa-brands-400.woff2") format("woff2");
    font-weight: 400;
    font-display: swap;
}
.icon-whatsapp {
    font: 400 1.18em/1 "QMS Brands";
    color: #12724e;
}
.icon-whatsapp::before { content: "\f232"; }


.icon-back::before { content: "\f061"; }
.detail-page { padding: .2rem 0 1rem; }
.detail-page-nav { display: flex; align-items: center; gap: .75rem; margin-bottom: 1rem; }
.detail-page-nav h1 { font-size: clamp(1.25rem,5vw,1.65rem); }
.detail-page-nav .icon-button { flex: 0 0 2.85rem; }
.detail-page .detail-hero {
    --tone-bg: #f0f3f8;
    --tone-border: #dbe3ef;
    --tone-ink: #45566e;
    padding: 1.1rem; background: var(--tone-bg); border-color: var(--tone-border);
}
.detail-page .detail-hero[data-tone="overdue"] { --tone-bg:#fff0f0; --tone-border:#f3cdcd; --tone-ink:#a12626; }
.detail-page .detail-hero[data-tone="urgent"] { --tone-bg:#fff4e7; --tone-border:#f1d8b9; --tone-ink:#91380e; }
.detail-page .detail-hero[data-tone="running"] { --tone-bg:#eaf7ef; --tone-border:#cfe8da; --tone-ink:#1b6447; }
.detail-page .detail-hero .detail-timer { color: var(--tone-ink); border-top-color: var(--tone-border); }
.detail-page .detail-hero .card-id { color: var(--tone-ink); }
.detail-page .detail-field { background: #fff; border: 1px solid var(--border); }
.detail-page .detail-link { border: 1px solid transparent; }

.period-screen { max-width: 34rem; margin: 0 auto; }
.period-screen .workspace-head h1 { font-size: clamp(1.4rem,6vw,1.9rem); }
.period-screen .filter-card { display: grid; gap: .85rem; padding: 1.05rem; }
.period-screen .period-title { margin: 0; }
.period-screen .custom-period { justify-self: start; }
.period-screen .custom-period[aria-pressed=true] { background: var(--blue-light); border-color: #cfddf3; }
.date-range { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: .6rem; }
.date-range label { min-width: 0; }
.date-range input { min-width: 0; padding-inline: .45rem; }
#period-error:empty { display: none; }
.results-period { margin: -.35rem 0 .65rem; }
.results-period .sub { margin: 0; }

@font-face {
    font-family: Cairo;
    src: url("fonts/cairo-arabic.woff2") format("woff2");
    font-weight: 400 900;
    font-display: swap;
    unicode-range: U+0600-06FF,U+0750-077F,U+0870-089F,U+08A0-08FF,U+200C-200E,U+FB50-FDFF,U+FE70-FEFC;
}
@font-face {
    font-family: Cairo;
    src: url("fonts/cairo-latin.woff2") format("woff2");
    font-weight: 400 900;
    font-display: swap;
    unicode-range: U+0000-00FF,U+2000-206F,U+2212,U+FEFF,U+FFFD;
}
:root {
    --background: #f5f7fa;
    --input: #eef2f7;
    --border: #dfe5ec;
    --ink: #0f172a;
    --muted: #536477;
    --blue: #027caf;
    --blue-dark: #086b99;
    --blue-light: #e0f2fb;
    --surface-shadow: none;
}
.wrap { width: min(calc(100% - 1.5rem), 38rem); }
body { line-height: 1.55; }
main { padding-top: calc(.9rem + env(safe-area-inset-top)); }
.scope-page {
    text-align: center; max-width: 32rem;
    margin: clamp(2rem,12vh,6.5rem) auto 0; padding: 0;
}
.scope-art { height: auto; margin: 0 0 1.45rem; background: transparent; }
.scope-icon {
    background: #def0fb; width: 4.75rem; height: 4.75rem; border-radius: 1.35rem;
    color: #087caf; box-shadow: none; font-size: 1.9rem;
}
.scope-page h1 { color: var(--blue-dark); font-weight: 900; }
.scope-page h2 { margin-top: .8rem; font-size: 1.2rem; font-weight: 850; }
.scope-page .sub { margin-top: .3rem; }
.scope-page form {
    background: transparent; border: 0; box-shadow: none;
    padding: 0; margin-top: 2rem;
}
.scope-page form .primary { margin-top: .65rem; }
.primary {
    min-height: 3.8rem;
    border-radius: 1.05rem;
    font-size: 1.07rem;
    font-weight: 850;
    background: linear-gradient(110deg,#0284ba,#08668e);
    box-shadow: none;
}
input, select { min-height: 3.2rem; background: #fff; border-color: var(--border); border-radius: 1rem; }
.period-screen { max-width: 32rem; }
.period-intro { text-align: center; margin: clamp(1rem,6vh,3.1rem) 0 1.1rem; }
.period-intro h1 { font-size: clamp(1.35rem,6vw,1.85rem); font-weight: 900; }
.period-intro .sub { margin-bottom: 0; }
.reference-summary {
    padding: .83rem .95rem; border-radius: 1.16rem;
    border: 1px solid var(--border); background: var(--white);
}
.reference-summary small { display: block; color: var(--muted); font-size: .79rem; }
.reference-summary strong { display: block; font-size: 1.12rem; font-weight: 900; }
.reference-summary .district-icon { background: transparent; color: #087eae; width: 1.65rem; flex-basis: 1.65rem; }
.reference-summary .text-button { background: var(--input); }
.period-screen .filter-card { padding: 0; margin-top: 1rem; background: transparent; border: 0; gap: .8rem; }
.period-title { font-size: 1.04rem; }
.period-title .icon,.period-screen label .icon,.field-caption .icon { color: var(--blue); }
.period-tabs { border-radius: .85rem; }
.period-tabs button { border-radius: .7rem; }
.period-tabs [aria-pressed=true] { background: #fff; color: var(--blue-dark); }
.period-screen .custom-period { font-size: .87rem; min-height: 2.7rem; }
.period-screen #block-label { margin-top: .25rem; }
.period-screen #period-form .primary { margin-top: .3rem; }
.results-actions { margin-bottom: .9rem; }
.results-actions .icon-button {
    width: 2.8rem; height: 2.8rem; min-height: 2.8rem;
    background: #fff; color: var(--ink); border: 1px solid var(--border);
}
.results-summary h1 { font-size: clamp(1.22rem,5vw,1.56rem); font-weight: 900; }
.results-summary .sub { margin: .2rem 0 0; font-size: .82rem; }
.reference-count {
    flex: none; padding: .4rem .65rem; border-radius: .76rem;
    background: var(--blue-light); color: var(--blue-dark); font-size: .89rem; font-weight: 850;
}
.result-sync { gap: .45rem; margin: .35rem 0 .5rem; }
.result-sync .sub { margin: 0; font-size: .79rem; }
.result-sync .text-button { min-height: 2.55rem; padding: .2rem .45rem; }
.results-search .filters { margin: .4rem 0 0; }
.results-search .search { position: relative; }
.results-search .search > .icon { position: absolute; inset-inline-start: .9rem; top: 1.05rem; color: var(--muted); pointer-events: none; }
.results-search #search { padding-inline-start: 2.3rem; background: #fff; border-color: var(--border); }
.status-tabs button { border-radius: 2rem; min-height: 2.72rem; }
.status-tabs [aria-pressed=true] { background: #057baa; color: #fff; border-color: #057baa; }
.result-count { margin-top: .5rem; }
.card {
    border: 1px solid var(--border); border-radius: 1.2rem; box-shadow: none;
    padding: .87rem .95rem; margin: .62rem 0;
}
.card strong { font-size: 1rem; font-weight: 880; }
.card-id { font-weight: 900; }
.timer { border: 1px solid #d5e8fa; }
.timer.alert-timer { border-color: #f4c1c0; }
.timer.urgent-timer { border-color: #f3d4b4; }
.views { background: #fff; min-height: 4.55rem; box-shadow: none; }
.views [aria-pressed=true] .nav-icon { background: #e5f2fb; }

/* Keep the mobile hierarchy readable without heavy type. */
.scope-page h1 { font-size: clamp(1.45rem,5vw,1.85rem); font-weight: 750; }
.scope-page h2 { font-size: 1.02rem; font-weight: 650; }
.period-intro h1, .results-summary h1, .detail-page-nav h1 {
    font-size: clamp(1.2rem,4.5vw,1.5rem);
    font-weight: 720;
}
.reference-summary strong, .detail-kpi { font-size: 1rem; font-weight: 680; }
.period-title, .group, label, .result-count { font-weight: 600; }
.primary { font-size: .96rem; font-weight: 690; }
.quiet, .switch button, .status, .reference-count, .detail-link { font-weight: 630; }
.card strong { font-size: .95rem; font-weight: 650; line-height: 1.65; }
.card-id { font-size: 1rem; font-weight: 730; }
.timer, .detail-timer-value { font-weight: 690; }
.detail-field dd { font-weight: 600; }

.date-range { gap: .65rem; margin: .1rem 0 .3rem; }
.date-range label { color: var(--muted); font-size: .83rem; }
.date-range input { text-align: center; font-weight: 600; color: var(--ink); font-size: .91rem; }

/* Detail page follows the results cards and reference toolbar. */
.detail-page { padding-top: 0; }
.detail-page-nav { margin: 0 0 .9rem; gap: .65rem; }
.detail-page-nav .icon-button {
    color: var(--ink); background: var(--white); border: 1px solid var(--border);
    border-radius: .85rem; min-height: 2.8rem; height: 2.8rem; flex-basis: 2.8rem;
}
.detail-page-nav h1 { font-size: 1.26rem; font-weight: 720; }
.detail-page .detail-hero {
    border-radius: 1.18rem; padding: .9rem .95rem;
    background: var(--tone-bg);
}
.detail-identity .status { background: #ffffffbb; border: 1px solid var(--tone-border); }
.detail-page .detail-kpi {
    font-size: 1.02rem; font-weight: 700; line-height: 1.75;
    margin: .62rem 0 .7rem;
}
.detail-timer-label { display: inline-flex; align-items: center; }
.detail-page .detail-timer-value {
    padding: .15rem .55rem; border-radius: 1rem; font-size: .88rem;
    background: #ffffffb8; border: 1px solid var(--tone-border);
}
.detail-fields {
    margin: .75rem 0; gap: 0; padding: .25rem .85rem;
    background: #fff; border: 1px solid var(--border); border-radius: 1.18rem;
}
.detail-page .detail-field { padding: .63rem .42rem; border: 0; border-radius: 0; min-width: 0; }
.detail-field:nth-child(n+3) { border-top: 1px solid #eef2f7; }
.detail-field dd { line-height: 1.5; }
.detail-actions { margin-top: .85rem; }
.detail-page .detail-link { border-color: var(--border); min-height: 3rem; border-radius: 1rem; }

.scope-page .app-credit {
    margin: clamp(2rem,12vh,6rem) 0 .8rem;
    text-align: center; color: var(--muted); font-size: .85rem; font-weight: 500;
}
.app-credit strong { color: var(--ink); font-weight: 720; }

.priority-overview {
    display: grid; grid-template-columns: repeat(2,minmax(0,1fr));
    gap: .55rem; margin: .65rem 0 .75rem;
}
.priority-chip {
    --priority-ink: #8f272b; --priority-tint: #fff0f0; --priority-line: #f0d2d2;
    display: grid; grid-template-columns: 1.8rem minmax(0,1fr) auto; gap: .36rem;
    align-items: center; min-height: 3.15rem; padding: .35rem .55rem;
    border: 1px solid var(--priority-line); border-radius: .94rem;
    background: var(--priority-tint); color: var(--priority-ink); text-align: start;
}
.priority-urgent { --priority-ink: #884011; --priority-tint: #fff3e5; --priority-line: #eed8bc; }
.priority-chip[aria-pressed=true] { border-color: var(--priority-ink); }
.priority-glyph { display: grid; place-items: center; }
.priority-glyph .icon { margin: 0; font-size: .92rem; }
.priority-label { font-size: .82rem; font-weight: 650; }
.priority-count { min-width: 1rem; font-weight: 750; font-variant-numeric: tabular-nums; text-align: center; }
.card-location { color: var(--muted); }
.card-location .icon { color: var(--blue-dark); }

.icon-check::before { content: "\f00c"; }
.empty-results {
    padding: clamp(2rem,8vh,4.75rem) .8rem 2rem;
    text-align: center;
}
.empty-icon {
    display: grid; place-items: center;
    width: 3.45rem; height: 3.45rem; margin: 0 auto 1rem;
    border-radius: 50%; color: #42678d; background: #e5effc;
    font-size: 1.3rem;
}
.empty-icon .icon { margin: 0; }
.empty-success .empty-icon { color: #fff; background: #0b9063; }
.empty-error .empty-icon { color: #a12626; background: #ffe9e9; }
.empty-results h2 { font-size: clamp(1.08rem,4.4vw,1.25rem); font-weight: 720; }
.empty-results p { max-width: 23rem; margin: .45rem auto 0; color: var(--muted); font-size: .89rem; line-height: 1.7; }
.empty-action { margin-top: .7rem; }

.detail-hero[role="button"] { cursor: pointer; }
.detail-hero[role="button"]:focus-visible { outline: 3px solid var(--blue); outline-offset: 3px; }

.copy-toast {
    position: fixed; z-index: 5; inset-block-start: calc(1rem + env(safe-area-inset-top));
    inset-inline: 0; margin-inline: auto; width: max-content; max-width: calc(100% - 2rem);
    display: flex; align-items: center; gap: .6rem; padding: .62rem .95rem;
    border-radius: 1.5rem; color: #fff; background: #121b2d;
    box-shadow: 0 4px 14px #0f172a30; font-size: .88rem; font-weight: 650;
    pointer-events: none;
}
.copy-toast:empty { display: none; }
.copy-toast .icon { color: #65e5a8; margin: 0; }
.copy-toast[data-tone="error"] .icon { color: #ffb2a8; }
.detail-page .detail-hero.copy-flash { animation: copy-success .85s ease-out; }
@keyframes copy-success {
    0%, 28% { background: #e7faf0; border-color: #21a772; }
    100% { background: var(--tone-bg); border-color: var(--tone-border); }
}
@media (prefers-reduced-motion: reduce) {
    .detail-page .detail-hero.copy-flash { animation: none; background: #e7faf0; border-color: #21a772; }
}
