/* ==========================================================================
   GeoAttend — design system
   Lives in the shared RCL's wwwroot/css folder (per the MAUI Blazor Hybrid +
   Web App tutorial layout) so both the MAUI app and the Blazor Web App load
   the exact same stylesheet from:  _content/GeofenceAttendance.Shared/css/app.css
   No external fonts or stylesheets, so it works offline inside the app.
   ========================================================================== */

:root {
    --brand: #0d6e6e;
    --brand-strong: #0a5555;
    --brand-soft: #e3f4f4;
    --accent: #f2a33c;
    --accent-soft: #fdf0dd;
    --ink: #10222b;
    --ink-soft: #54707c;
    --line: #e2ebee;
    --surface: #ffffff;
    --canvas: #f3f7f8;
    --ok: #1e9e6a;
    --ok-soft: #e2f6ec;
    --warn: #c9791a;
    --warn-soft: #fdf0dd;
    --danger: #cf4636;
    --danger-soft: #fdeaea;
    --radius: 18px;
    --radius-sm: 12px;
    --shadow: 0 10px 30px rgba(16, 34, 43, .08);
    --shadow-sm: 0 2px 10px rgba(16, 34, 43, .06);
    --tab-height: 68px;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
    margin: 0;
    padding: 0;
    height: 100%;
    background: var(--canvas);
    color: var(--ink);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    font-size: 15px;
    line-height: 1.45;
    -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 { margin: 0; font-weight: 700; letter-spacing: -.01em; }
p { margin: 0; }
button { font-family: inherit; }
a { color: inherit; text-decoration: none; }

/* Blazor's FocusOnNavigate puts a focus ring on the page heading; hide it. */
h1:focus, h2:focus, h3:focus { outline: none; }

/* ---------- shell ------------------------------------------------------- */

.app-shell {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    min-height: 100dvh;
    max-width: 640px;
    margin: 0 auto;
    background: var(--canvas);
    position: relative;
}

.app-main {
    flex: 1;
    padding: 18px 16px calc(var(--tab-height) + 26px);
    animation: rise .22s ease-out;
}

.app-main.no-tabs { padding-bottom: 28px; }

@keyframes rise {
    from { opacity: 0; transform: translateY(6px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ---------- page header ------------------------------------------------- */

.page-header { margin-bottom: 16px; }

.page-header .eyebrow {
    font-size: 12px;
    font-weight: 700;
    letter-spacing: .09em;
    text-transform: uppercase;
    color: var(--brand);
    margin-bottom: 4px;
}

.page-header h1 { font-size: 24px; }
.page-header .subtitle { color: var(--ink-soft); font-size: 13.5px; margin-top: 4px; }

.header-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.avatar {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    font-weight: 700;
    font-size: 15px;
    color: #fff;
    background: linear-gradient(140deg, var(--brand), #16968f);
    box-shadow: var(--shadow-sm);
    flex: none;
}

/* ---------- cards ------------------------------------------------------- */

.card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 16px;
    box-shadow: var(--shadow-sm);
}

.card + .card { margin-top: 12px; }

.card-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 12px;
}

.card-head h2, .card-head h3 { font-size: 15.5px; }
.card-head .muted { font-size: 12.5px; color: var(--ink-soft); }

.muted { color: var(--ink-soft); }
.tiny { font-size: 12px; }
.section-title {
    font-size: 12px;
    font-weight: 700;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: var(--ink-soft);
    margin: 22px 2px 10px;
}

/* ---------- status hero ------------------------------------------------- */

.hero {
    border-radius: 24px;
    padding: 18px;
    color: #fff;
    position: relative;
    overflow: hidden;
    background: linear-gradient(150deg, #0d6e6e 0%, #12807a 55%, #1a9e8f 100%);
    box-shadow: 0 14px 34px rgba(13, 110, 110, .28);
}

.hero.outside { background: linear-gradient(150deg, #37535f 0%, #46646f 60%, #587a84 100%); box-shadow: 0 14px 34px rgba(55, 83, 95, .26); }

.hero::after {
    content: "";
    position: absolute;
    width: 240px;
    height: 240px;
    right: -90px;
    top: -110px;
    border-radius: 50%;
    background: rgba(255, 255, 255, .1);
}

.hero-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; position: relative; }

.hero-label { font-size: 11.5px; letter-spacing: .1em; text-transform: uppercase; opacity: .82; font-weight: 700; }
.hero-site { font-size: 22px; font-weight: 700; margin-top: 4px; }
.hero-meta { font-size: 13px; opacity: .9; margin-top: 4px; }

.pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 700;
    background: var(--brand-soft);
    color: var(--brand-strong);
    white-space: nowrap;
}

.pill.ok { background: var(--ok-soft); color: var(--ok); }
.pill.warn { background: var(--warn-soft); color: var(--warn); }
.pill.danger { background: var(--danger-soft); color: var(--danger); }
.pill.neutral { background: #eef3f5; color: var(--ink-soft); }
.pill.on-dark { background: rgba(255, 255, 255, .18); color: #fff; }
.pill.on-dark.alert { background: rgba(255, 214, 170, .24); color: #ffe3bd; }

.dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; flex: none; }

/* ---------- radar widget ------------------------------------------------ */

.radar-wrap {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-top: 16px;
    position: relative;
}

.radar {
    width: 132px;
    height: 132px;
    flex: none;
    position: relative;
    display: grid;
    place-items: center;
}

.radar svg { width: 100%; height: 100%; }

.radar-ring {
    animation: pulse 3.2s ease-out infinite;
    transform-origin: 66px 66px;
}

@keyframes pulse {
    0% { opacity: .5; transform: scale(.72); }
    70% { opacity: 0; transform: scale(1.06); }
    100% { opacity: 0; transform: scale(1.06); }
}

.radar-caption {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 2px;
    text-align: center;
    font-size: 10.5px;
    font-weight: 600;
    color: rgba(255, 255, 255, .82);
    pointer-events: none;
}

.radar-stats { flex: 1; min-width: 0; }

.big-number { font-size: 30px; font-weight: 700; line-height: 1.1; }
.big-number small { font-size: 14px; font-weight: 600; opacity: .8; margin-left: 3px; }

.radar-stats .caption { font-size: 12.5px; opacity: .85; margin-top: 2px; }

.accuracy-bar {
    height: 5px;
    border-radius: 99px;
    background: rgba(255, 255, 255, .22);
    margin-top: 12px;
    overflow: hidden;
}

.accuracy-bar span {
    display: block;
    height: 100%;
    border-radius: 99px;
    background: #9df0cf;
    transition: width .3s ease;
}

.accuracy-bar.poor span { background: #ffcf8a; }

/* ---------- buttons ----------------------------------------------------- */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border: 1px solid transparent;
    border-radius: 14px;
    padding: 12px 18px;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    background: var(--surface);
    color: var(--ink);
    transition: transform .12s ease, box-shadow .12s ease, background .12s ease;
    text-align: center;
}

.btn:active { transform: scale(.985); }
.btn:disabled { opacity: .55; cursor: not-allowed; transform: none; }

.btn-primary { background: var(--brand); color: #fff; box-shadow: 0 8px 20px rgba(13, 110, 110, .25); }
.btn-primary:hover:not(:disabled) { background: var(--brand-strong); }

.btn-danger { background: var(--danger); color: #fff; box-shadow: 0 8px 20px rgba(207, 70, 54, .22); }

.btn-ghost { background: transparent; border-color: var(--line); color: var(--ink); }
.btn-ghost:hover:not(:disabled) { background: #f7fafb; }

.btn-block { width: 100%; }
.btn-lg { padding: 16px 20px; font-size: 16.5px; border-radius: 16px; }
.btn-sm { padding: 8px 12px; font-size: 13px; border-radius: 11px; }

.btn-white { background: #fff; color: var(--brand-strong); }

/* ---------- forms ------------------------------------------------------- */

.field { margin-bottom: 14px; }

.field label {
    display: block;
    font-size: 12.5px;
    font-weight: 700;
    color: var(--ink-soft);
    margin-bottom: 6px;
}

.input {
    width: 100%;
    padding: 13px 14px;
    border: 1px solid var(--line);
    border-radius: 13px;
    font-size: 15px;
    background: #fbfdfd;
    color: var(--ink);
    outline: none;
    transition: border-color .15s ease, box-shadow .15s ease;
}

.input:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(13, 110, 110, .13); background: #fff; }

select.input { appearance: none; background-image: none; }

/* ---------- toggle ------------------------------------------------------ */

.switch { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 10px 0; }
.switch + .switch { border-top: 1px solid var(--line); }
.switch-text { min-width: 0; }
.switch-text strong { display: block; font-size: 14px; }
.switch-text span { font-size: 12.5px; color: var(--ink-soft); }

.switch input { display: none; }

.switch-track {
    width: 46px;
    height: 27px;
    border-radius: 99px;
    background: #d5e1e5;
    position: relative;
    flex: none;
    cursor: pointer;
    transition: background .18s ease;
}

.switch-track::after {
    content: "";
    position: absolute;
    top: 3px;
    left: 3px;
    width: 21px;
    height: 21px;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 1px 3px rgba(0, 0, 0, .18);
    transition: transform .18s ease;
}

.switch input:checked + .switch-track { background: var(--brand); }
.switch input:checked + .switch-track::after { transform: translateX(19px); }

/* ---------- list rows --------------------------------------------------- */

.row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 0;
}

.row + .row { border-top: 1px solid var(--line); }

.row-icon {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    display: grid;
    place-items: center;
    background: var(--brand-soft);
    color: var(--brand-strong);
    flex: none;
    font-weight: 700;
    font-size: 13px;
}

.row-icon.warn { background: var(--warn-soft); color: var(--warn); }
.row-icon.danger { background: var(--danger-soft); color: var(--danger); }
.row-icon.ok { background: var(--ok-soft); color: var(--ok); }

.row-body { flex: 1; min-width: 0; }
.row-body strong { display: block; font-size: 14.5px; }
.row-body span { font-size: 12.5px; color: var(--ink-soft); display: block; }
.row-end { text-align: right; flex: none; }
.row-end strong { font-size: 14px; display: block; }
.row-end span { font-size: 11.5px; color: var(--ink-soft); }

/* ---------- stat tiles -------------------------------------------------- */

.stat-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }

.stat {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    padding: 12px;
    box-shadow: var(--shadow-sm);
}

.stat .value { font-size: clamp(17px, 5vw, 22px); font-weight: 700; line-height: 1.15; letter-spacing: -.02em; }
.stat .label { font-size: 11.5px; color: var(--ink-soft); margin-top: 2px; }
.stat.ok .value { color: var(--ok); }
.stat.warn .value { color: var(--warn); }

/* ---------- chips ------------------------------------------------------- */

.chip-row { display: flex; gap: 8px; overflow-x: auto; padding: 2px 0 4px; scrollbar-width: none; }
.chip-row::-webkit-scrollbar { display: none; }

.chip {
    flex: none;
    border: 1px solid var(--line);
    background: var(--surface);
    border-radius: 999px;
    padding: 8px 14px;
    font-size: 13px;
    font-weight: 600;
    color: var(--ink-soft);
    cursor: pointer;
    white-space: nowrap;
}

.chip.active { background: var(--brand); border-color: var(--brand); color: #fff; }

/* ---------- bottom tabs ------------------------------------------------- */

.tabbar {
    position: fixed;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    max-width: 640px;
    height: var(--tab-height);
    background: rgba(255, 255, 255, .96);
    backdrop-filter: blur(10px);
    border-top: 1px solid var(--line);
    display: flex;
    padding-bottom: env(safe-area-inset-bottom, 0);
    z-index: 30;
}

.tab {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    font-size: 11px;
    font-weight: 600;
    color: #90a4ad;
}

.tab svg { width: 22px; height: 22px; stroke: currentColor; fill: none; stroke-width: 1.8; }
.tab.active { color: var(--brand); }

/* ---------- toast ------------------------------------------------------- */

.toast {
    position: fixed;
    left: 50%;
    bottom: calc(var(--tab-height) + 16px);
    transform: translateX(-50%);
    max-width: min(600px, calc(100% - 24px));
    background: #123c3c;
    color: #fff;
    padding: 12px 16px;
    border-radius: 14px;
    font-size: 13.5px;
    box-shadow: 0 12px 28px rgba(16, 34, 43, .28);
    display: flex;
    align-items: flex-start;
    gap: 10px;
    z-index: 60;
    animation: toast-in .2s ease-out;
}

.toast.error { background: #7d2b22; }
.toast button { background: none; border: 0; color: #fff; opacity: .7; cursor: pointer; font-size: 16px; line-height: 1; padding: 0; }

@keyframes toast-in {
    from { opacity: 0; transform: translate(-50%, 10px); }
    to { opacity: 1; transform: translate(-50%, 0); }
}

/* ---------- login ------------------------------------------------------- */

.login-screen {
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 28px 20px;
    background: radial-gradient(1200px 600px at 50% -10%, #d9efef 0%, var(--canvas) 55%);
}

.login-card {
    width: 100%;
    max-width: 420px;
    margin: 0 auto;
    background: var(--surface);
    border-radius: 26px;
    border: 1px solid var(--line);
    box-shadow: var(--shadow);
    padding: 26px 22px;
}

.brand-mark {
    width: 56px;
    height: 56px;
    border-radius: 16px;
    display: grid;
    place-items: center;
    background: linear-gradient(150deg, var(--brand), #17a396);
    box-shadow: 0 10px 22px rgba(13, 110, 110, .3);
    margin-bottom: 16px;
}

.brand-mark svg { width: 30px; height: 30px; stroke: #fff; fill: none; stroke-width: 2; }

.demo-hint {
    background: var(--brand-soft);
    border-radius: 13px;
    padding: 11px 13px;
    font-size: 12.5px;
    color: var(--brand-strong);
    margin-top: 16px;
    line-height: 1.5;
}

.alert {
    border-radius: 13px;
    padding: 11px 13px;
    font-size: 13px;
    margin-bottom: 14px;
}

.alert.error { background: var(--danger-soft); color: var(--danger); }
.alert.info { background: var(--brand-soft); color: var(--brand-strong); }
.alert.warn { background: var(--warn-soft); color: var(--warn); }

/* ---------- misc -------------------------------------------------------- */

.empty {
    text-align: center;
    padding: 26px 16px;
    color: var(--ink-soft);
    font-size: 13.5px;
}

.empty svg { width: 40px; height: 40px; stroke: #b7c9cf; fill: none; stroke-width: 1.6; margin-bottom: 8px; }

.seg {
    display: flex;
    background: #e9f0f2;
    border-radius: 12px;
    padding: 3px;
    gap: 3px;
}

.seg button {
    flex: 1;
    border: 0;
    background: transparent;
    padding: 8px 10px;
    border-radius: 9px;
    font-size: 13px;
    font-weight: 600;
    color: var(--ink-soft);
    cursor: pointer;
}

.seg button.active { background: #fff; color: var(--ink); box-shadow: var(--shadow-sm); }

.slider {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 5px;
    border-radius: 99px;
    background: linear-gradient(90deg, var(--brand) var(--fill, 50%), #dde7ea var(--fill, 50%));
    outline: none;
    margin: 12px 0 4px;
}

.slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: #fff;
    border: 3px solid var(--brand);
    box-shadow: 0 2px 6px rgba(16, 34, 43, .2);
    cursor: pointer;
}

.slider::-moz-range-thumb {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #fff;
    border: 3px solid var(--brand);
    cursor: pointer;
}

.slider-scale { display: flex; justify-content: space-between; font-size: 11px; color: var(--ink-soft); }

.mini-map {
    width: 100%;
    border-radius: var(--radius-sm);
    background: linear-gradient(160deg, #eaf3f4, #dcebed);
    border: 1px solid var(--line);
    overflow: hidden;
}

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.spacer { height: 12px; }

.timeline { position: relative; padding-left: 22px; }

.timeline::before {
    content: "";
    position: absolute;
    left: 6px;
    top: 6px;
    bottom: 6px;
    width: 2px;
    background: var(--line);
}

.timeline-item { position: relative; padding-bottom: 16px; }
.timeline-item:last-child { padding-bottom: 0; }

.timeline-item::before {
    content: "";
    position: absolute;
    left: -22px;
    top: 4px;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #fff;
    border: 2.5px solid var(--brand);
}

.timeline-item.late::before { border-color: var(--warn); }
.timeline-item.open::before { border-color: var(--ok); }

.day-group { margin-bottom: 14px; }
.day-label { font-size: 12px; font-weight: 700; color: var(--ink-soft); letter-spacing: .06em; text-transform: uppercase; margin-bottom: 8px; }

/* ==========================================================================
   Admin panel + free map (Leaflet / OpenStreetMap)
   ========================================================================== */

.admin-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 10px 14px;
    border-radius: 14px;
    background: #12222b;
    color: #fff;
    margin-bottom: 16px;
}

.admin-bar strong { font-size: 13.5px; letter-spacing: .02em; }
.admin-bar .admin-tag {
    font-size: 10.5px;
    font-weight: 800;
    letter-spacing: .12em;
    text-transform: uppercase;
    background: var(--accent);
    color: #4a2c00;
    border-radius: 6px;
    padding: 3px 7px;
}

.admin-bar .btn { background: rgba(255, 255, 255, .12); color: #fff; border-color: rgba(255, 255, 255, .28); }

.admin-tabs { display: flex; gap: 8px; margin-bottom: 16px; flex-wrap: wrap; }

.admin-tabs a {
    padding: 9px 15px;
    border-radius: 999px;
    border: 1px solid var(--line);
    background: var(--surface);
    font-size: 13.5px;
    font-weight: 600;
    color: var(--ink-soft);
}

.admin-tabs a.active { background: var(--brand); border-color: var(--brand); color: #fff; }

.map-picker { margin: 12px 0; }

.map-canvas {
    width: 100%;
    border-radius: var(--radius-sm);
    border: 1px solid var(--line);
    overflow: hidden;
    background: #e8f0f1;
    z-index: 0;
}

.map-canvas[hidden] { display: none; }

.map-fallback {
    position: relative;
    width: 100%;
    border-radius: var(--radius-sm);
    border: 1px dashed #b9d3d6;
    background: linear-gradient(160deg, #eef6f7, #dfeff0);
    overflow: hidden;
    display: grid;
    place-items: center;
}

.map-fallback svg { position: absolute; inset: 0; opacity: .9; }

.map-fallback-note {
    position: relative;
    z-index: 2;
    margin: 0 16px;
    text-align: center;
    font-size: 12px;
    color: var(--brand-strong);
    background: rgba(255, 255, 255, .86);
    border-radius: 10px;
    padding: 8px 11px;
    line-height: 1.45;
}

.map-fallback-slider {
    position: absolute;
    left: 14px;
    right: 14px;
    bottom: 8px;
    width: auto;
    z-index: 3;
}

.map-hint {
    font-size: 11.5px;
    color: var(--ink-soft);
    margin-top: 6px;
    display: flex;
    gap: 6px;
    align-items: flex-start;
}

.switch-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 4px; }

.site-check {
    display: flex;
    align-items: center;
    gap: 8px;
    border: 1px solid var(--line);
    border-radius: 11px;
    padding: 9px 11px;
    font-size: 13px;
    background: #fbfdfd;
    cursor: pointer;
}

.site-check input { accent-color: var(--brand); width: 16px; height: 16px; }
.site-check.on { border-color: var(--brand); background: var(--brand-soft); }

.admin-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 13px 0;
}

.admin-row + .admin-row { border-top: 1px solid var(--line); }
.admin-row .row-body strong { font-size: 14.5px; }
.admin-row .row-end { display: flex; gap: 6px; align-items: center; }

.admin-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.admin-table th {
    text-align: left;
    font-size: 11px;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: var(--ink-soft);
    padding: 0 8px 8px 0;
    font-weight: 700;
}
.admin-table td { padding: 9px 8px 9px 0; border-top: 1px solid var(--line); vertical-align: middle; }
.admin-table tr:last-child td { padding-bottom: 0; }

.editor-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.editor-grid .full { grid-column: 1 / -1; }

.leaflet-container { font-family: inherit; }
.leaflet-control-attribution { font-size: 9.5px !important; }
