/* MoveIQ — dark-first "control room" look. Light theme follows the system setting. */

:root {
    /* surfaces */
    --bg: #070B14;
    --bg-glow-a: rgba(76, 141, 255, .16);
    --bg-glow-b: rgba(34, 211, 238, .08);
    --grid-line: rgba(148, 170, 210, .05);
    --surface: rgba(16, 25, 43, .72);
    --surface-solid: #0E1728;
    --raised: rgba(255, 255, 255, .035);
    --hover: rgba(148, 170, 210, .09);
    --head: rgba(148, 170, 210, .05);
    --border: rgba(148, 170, 210, .15);
    --border-strong: rgba(148, 170, 210, .3);
    --field: rgba(7, 11, 20, .55);
    /* text */
    --text: #E8EEF9;
    --muted: #8494B2;
    --faint: #5A6A88;
    /* accent */
    --accent: #4C8DFF;
    --accent-2: #22D3EE;
    --accent-grad: linear-gradient(135deg, #4C8DFF 0%, #22D3EE 100%);
    --glow: rgba(76, 141, 255, .38);
    --on-accent: #06101F;
    /* state */
    --good: #34D399;
    --warn: #FBBF24;
    --bad: #F87171;
    --info: #60A5FA;
    --violet: #A5B4FC;
    /* nav */
    --nav: rgba(7, 11, 20, .72);
    --shadow: 0 1px 0 rgba(255, 255, 255, .04) inset, 0 12px 32px -12px rgba(0, 0, 0, .6);
    --radius: 14px;
    --font-display: "Sora", "Segoe UI", system-ui, sans-serif;
    --font-body: "Manrope", "Segoe UI", system-ui, -apple-system, sans-serif;
    --font-mono: "JetBrains Mono", ui-monospace, "Cascadia Mono", Consolas, monospace;
    color-scheme: dark;
}

@media (prefers-color-scheme: light) {
    :root:not([data-theme="dark"]) {
        --bg: #EDF1F8;
        --bg-glow-a: rgba(47, 107, 255, .12);
        --bg-glow-b: rgba(14, 165, 200, .07);
        --grid-line: rgba(15, 23, 42, .045);
        --surface: rgba(255, 255, 255, .82);
        --surface-solid: #FFFFFF;
        --raised: rgba(15, 23, 42, .03);
        --hover: rgba(47, 107, 255, .07);
        --head: rgba(15, 23, 42, .035);
        --border: rgba(15, 23, 42, .1);
        --border-strong: rgba(15, 23, 42, .22);
        --field: #FFFFFF;
        --text: #0B1324;
        --muted: #56657F;
        --faint: #8592AA;
        --accent: #2F6BFF;
        --accent-2: #0EA5C8;
        --accent-grad: linear-gradient(135deg, #2F6BFF 0%, #0EA5C8 100%);
        --glow: rgba(47, 107, 255, .28);
        --on-accent: #FFFFFF;
        --good: #059669;
        --warn: #B45309;
        --bad: #DC2626;
        --info: #2563EB;
        --violet: #4F46E5;
        --nav: rgba(237, 241, 248, .8);
        --shadow: 0 1px 2px rgba(15, 23, 42, .06), 0 10px 28px -14px rgba(15, 23, 42, .18);
        color-scheme: light;
    }
}

/* Explicit per-user choice (saved via the cog menu) always wins over the OS setting above. */
:root[data-theme="light"] {
    --bg: #EDF1F8;
    --bg-glow-a: rgba(47, 107, 255, .12);
    --bg-glow-b: rgba(14, 165, 200, .07);
    --grid-line: rgba(15, 23, 42, .045);
    --surface: rgba(255, 255, 255, .82);
    --surface-solid: #FFFFFF;
    --raised: rgba(15, 23, 42, .03);
    --hover: rgba(47, 107, 255, .07);
    --head: rgba(15, 23, 42, .035);
    --border: rgba(15, 23, 42, .1);
    --border-strong: rgba(15, 23, 42, .22);
    --field: #FFFFFF;
    --text: #0B1324;
    --muted: #56657F;
    --faint: #8592AA;
    --accent: #2F6BFF;
    --accent-2: #0EA5C8;
    --accent-grad: linear-gradient(135deg, #2F6BFF 0%, #0EA5C8 100%);
    --glow: rgba(47, 107, 255, .28);
    --on-accent: #FFFFFF;
    --good: #059669;
    --warn: #B45309;
    --bad: #DC2626;
    --info: #2563EB;
    --violet: #4F46E5;
    --nav: rgba(237, 241, 248, .8);
    --shadow: 0 1px 2px rgba(15, 23, 42, .06), 0 10px 28px -14px rgba(15, 23, 42, .18);
    color-scheme: light;
}

* { box-sizing: border-box; }

html { background: var(--bg); }
body {
    margin: 0;
    min-height: 100vh;
    color: var(--text);
    font-family: var(--font-body);
    font-size: 15px;
    line-height: 1.5;
    -webkit-text-size-adjust: 100%;
    background:
        radial-gradient(900px 520px at 12% -8%, var(--bg-glow-a), transparent 70%),
        radial-gradient(760px 480px at 100% 0%, var(--bg-glow-b), transparent 70%),
        linear-gradient(var(--grid-line) 1px, transparent 1px) 0 0 / 44px 44px,
        linear-gradient(90deg, var(--grid-line) 1px, transparent 1px) 0 0 / 44px 44px,
        var(--bg);
    background-attachment: fixed;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
h1, h2, h3 { font-family: var(--font-display); }
h1 { font-size: 1.7rem; margin: 0 0 1rem; font-weight: 600; letter-spacing: -.02em; text-wrap: balance; }
h1:focus { outline: none; }
h2 { font-size: .74rem; margin: 0 0 .8rem; color: var(--muted); font-weight: 600; letter-spacing: .12em; text-transform: uppercase; font-family: var(--font-mono); }
small, .muted { color: var(--muted); }
dl { display: grid; grid-template-columns: 110px 1fr; gap: .4rem .75rem; margin: 0; }
dt { color: var(--muted); font-size: .88rem; }
dd { margin: 0; }
::selection { background: var(--glow); }

/* ── Layout pieces ─────────────────────────────────────────────── */
.page-head { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: .75rem; margin-bottom: 1.1rem; }
.page-head h1 { margin: 0; }
.filters { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; }
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr)); gap: 1rem; }
.card {
    position: relative;
    background: var(--surface);
    -webkit-backdrop-filter: blur(14px);
    backdrop-filter: blur(14px);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.1rem 1.3rem;
    box-shadow: var(--shadow);
}
.card.wide { grid-column: 1 / -1; }
/* Fixed 2-up sub-grid: guarantees pairs instead of auto-fit sometimes leaving one card
   alone on the last row, stretched to the full row width. */
.grid.cols-2 { grid-column: 1 / -1; grid-template-columns: repeat(2, minmax(260px, 1fr)); }

/* ── Loading skeleton ──────────────────────────────────────────── */
@keyframes skel-pulse { 0%, 100% { opacity: .5; } 50% { opacity: 1; } }
.skel { background: var(--raised); border-radius: 6px; height: .85rem; animation: skel-pulse 1.3s ease-in-out infinite; }
.skel-line + .skel-line { margin-top: .65rem; }
.skel-row { display: flex; gap: 1.5rem; align-items: center; padding: .75rem 0; border-bottom: 1px solid var(--border); }
.skel-row:last-child { border-bottom: none; }
.skel-row .skel { height: .8rem; }
fieldset.contents { display: contents; border: 0; padding: 0; margin: 0; }
.actions { display: flex; gap: .5rem; flex-wrap: wrap; }
.month { min-width: 9.5rem; text-align: center; align-self: center; font-family: var(--font-display); font-weight: 600; text-transform: capitalize; }

/* Shared praise/report markers. The triangle shape stays crisp at every size and does not depend on emoji fonts. */
.feedback-stat { display: inline-flex; align-items: center; gap: .3rem; }
.feedback-separator { color: var(--muted); margin: 0 .1rem; }
.feedback-triangle { display: inline-block; width: 0; height: 0; vertical-align: middle; }
.feedback-triangle-up { border-left: .4rem solid transparent; border-right: .4rem solid transparent; border-bottom: .68rem solid #22c55e; }
.feedback-triangle-down { border-left: .4rem solid transparent; border-right: .4rem solid transparent; border-top: .68rem solid #ef4444; }

/* ── Inputs and buttons ────────────────────────────────────────── */
input:not([type=checkbox]):not([type=radio]), select, textarea {
    background: var(--field);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: .55rem .75rem;
    font: inherit;
    min-width: 0;
    transition: border-color .15s, box-shadow .15s;
}
input:not([type=checkbox]):not([type=radio]):hover, select:hover, textarea:hover { border-color: var(--border-strong); }
input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--glow);
}
select option { background: var(--surface-solid); color: var(--text); }
textarea { width: 100%; }
input[type=checkbox], input[type=radio] { accent-color: var(--accent); width: 1.05rem; height: 1.05rem; }
input::placeholder, textarea::placeholder { color: var(--faint); }
input[type=date], input[type=number] { font-variant-numeric: tabular-nums; }

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .4rem;
    padding: .5rem 1rem;
    border: 1px solid var(--border);
    background: var(--raised);
    color: var(--text);
    border-radius: 10px;
    cursor: pointer;
    font: inherit;
    font-weight: 600;
    font-size: .9rem;
    text-decoration: none;
    transition: background .15s, border-color .15s, box-shadow .15s, transform .1s;
}
.btn:hover { background: var(--hover); border-color: var(--border-strong); text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--glow); }
.btn:disabled { opacity: .45; cursor: not-allowed; transform: none; }
.btn.primary, .btn.active {
    background: var(--accent-grad);
    border-color: transparent;
    color: var(--on-accent);
    box-shadow: 0 6px 20px -6px var(--glow);
}
.btn.primary:hover, .btn.active:hover { filter: brightness(1.08); box-shadow: 0 8px 26px -6px var(--glow); }
.btn.danger { color: var(--bad); border-color: color-mix(in srgb, var(--bad) 35%, transparent); background: transparent; }
.btn.danger:hover { background: color-mix(in srgb, var(--bad) 12%, transparent); }

.alert, .ok {
    padding: .75rem 1rem;
    border-radius: 10px;
    margin-bottom: .85rem;
    border: 1px solid;
    font-size: .92rem;
}
.alert { background: color-mix(in srgb, var(--bad) 12%, transparent); color: var(--bad); border-color: color-mix(in srgb, var(--bad) 35%, transparent); }
.ok { background: color-mix(in srgb, var(--good) 12%, transparent); color: var(--good); border-color: color-mix(in srgb, var(--good) 35%, transparent); }

/* ── Tables ────────────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; background: var(--surface); -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
table.data { width: 100%; border-collapse: collapse; }
table.data td { overflow-wrap: anywhere; }
table.data th, table.data td { padding: .7rem .9rem; text-align: left; border-bottom: 1px solid var(--border); vertical-align: middle; }
table.data tr:last-child td { border-bottom: 0; }
table.data th { background: var(--head); font: 500 .68rem/1 var(--font-mono); text-transform: uppercase; letter-spacing: .12em; color: var(--muted); padding-block: .85rem; white-space: nowrap; }
table.data td { font-variant-numeric: tabular-nums; }
table.data tbody tr { transition: background .12s; }
table.data tbody tr:hover { background: var(--hover); box-shadow: inset 2px 0 0 var(--accent); }
table.data tbody tr.row-link { cursor: pointer; }
table.data tbody tr.row-selected { background: color-mix(in srgb, var(--accent) 14%, var(--surface)); box-shadow: inset 3px 0 0 var(--accent); }
table.data tbody tr.row-selected:hover { background: color-mix(in srgb, var(--accent) 18%, var(--surface)); }
table.data tbody tr.row-selected td:first-child { color: var(--accent); font-weight: 700; }
table.data td.num { text-align: right; font-family: var(--font-mono); font-size: .9rem; white-space: nowrap; }
table.data th.num { text-align: right; }
/* Row actions (edit/delete/…) only appear while hovering (or keyboard-focusing) that row,
   so a list of vehicles/offers/users reads cleanly instead of a wall of buttons. */
table.data td.actions { opacity: 0; transition: opacity .12s; white-space: nowrap; }
table.data tbody tr:hover td.actions,
table.data tbody tr:focus-within td.actions { opacity: 1; }

.badge {
    --c: var(--muted);
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    padding: .18rem .65rem .18rem .55rem;
    border-radius: 999px;
    font-size: .74rem;
    font-weight: 700;
    letter-spacing: .02em;
    color: var(--c);
    background: color-mix(in srgb, var(--c) 14%, transparent);
    border: 1px solid color-mix(in srgb, var(--c) 32%, transparent);
    white-space: nowrap;
}
.badge::before { content: ""; width: .42rem; height: .42rem; border-radius: 50%; background: var(--c); box-shadow: 0 0 8px var(--c); }
.badge.pending { --c: var(--warn); }
.badge.assigned { --c: var(--info); }
.badge.inprogress { --c: var(--violet); }
.badge.completed { --c: var(--good); }
.badge.cancelled { --c: var(--bad); }

/* ── Dashboard and statistics ──────────────────────────────────── */
/* Fill the available width, including when tiles wrap onto a single column. */
.grid.stats { grid-template-columns: repeat(auto-fit, minmax(min(100%, 200px), 1fr)); }
.stat { display: flex; flex-direction: column; gap: .35rem; overflow: hidden; }
.stat::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 2px; background: var(--accent-grad); opacity: .8; }
.stat span { color: var(--muted); font: 500 .68rem/1.2 var(--font-mono); letter-spacing: .12em; text-transform: uppercase; }
.stat strong { font: 600 2.1rem/1.1 var(--font-display); letter-spacing: -.03em; font-variant-numeric: tabular-nums; }
.stat strong small { font: 600 1.05rem var(--font-body); color: var(--muted); letter-spacing: 0; margin-left: .2rem; }
.stat small { font-size: .8rem; }
.bars { display: flex; flex-direction: column; gap: .7rem; }
.bar-row { display: flex; flex-direction: column; gap: .35rem; font-size: .88rem; }
.bar-head { display: flex; justify-content: space-between; align-items: baseline; gap: .75rem; }
.bar-label { color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }
.bar-track { background: var(--head); border-radius: 6px; height: .55rem; overflow: hidden; }
.bar-fill { display: block; height: 100%; border-radius: 6px; background-image: linear-gradient(90deg, rgba(255, 255, 255, 0), rgba(255, 255, 255, .28)); box-shadow: 0 0 14px -2px currentColor; transition: width .5s cubic-bezier(.2, .8, .2, 1); }
.bar-value { flex: none; text-align: right; font-family: var(--font-mono); font-size: .82rem; color: var(--muted); }

/* ── Line/area chart ──────────────────────────────────────────── */
.linechart-svg { width: 100%; height: 190px; display: block; overflow: visible; }
.linechart .grid-line { stroke: var(--border); stroke-width: 1; vector-effect: non-scaling-stroke; }
.linechart-labels { display: flex; justify-content: space-between; margin-top: .5rem; font: 500 .68rem/1 var(--font-mono); color: var(--muted); letter-spacing: .03em; }

/* ── Donut chart ──────────────────────────────────────────────── */
.donut-wrap { display: flex; align-items: center; gap: 1.6rem; flex-wrap: wrap; }
.donut-ring { position: relative; width: 132px; height: 132px; flex: none; }
.donut { width: 100%; height: 100%; display: block; }
.donut circle { transition: stroke-dasharray .5s cubic-bezier(.2, .8, .2, 1); }
.donut-center { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; pointer-events: none; text-align: center; }
.donut-center strong { font: 700 1.3rem/1 var(--font-display); color: var(--text); }
.donut-center span { font: 600 .58rem/1.25 var(--font-mono); color: var(--muted); text-transform: uppercase; letter-spacing: .06em; margin-top: .3rem; max-width: 70px; white-space: normal; text-align: center; }
.donut-legend { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: .55rem; font-size: .85rem; flex: 1; min-width: 140px; }
.donut-legend li { display: flex; align-items: center; gap: .5rem; }
.donut-legend b { font-variant-numeric: tabular-nums; margin-left: auto; }
.donut-legend small { color: var(--muted); min-width: 3.4rem; text-align: right; }
.donut-legend .dot { width: .62rem; height: .62rem; border-radius: 50%; flex: none; box-shadow: 0 0 8px -1px currentColor; }

/* ── Vertical bar chart (weekday activity) ───────────────────────── */
.vbars { display: flex; align-items: stretch; gap: .7rem; height: 170px; }
.vbar-col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: .4rem; }
.vbar-value { font: 600 .72rem/1 var(--font-mono); color: var(--text); }
.vbar-track { flex: 1; width: 100%; max-width: 2.4rem; display: flex; align-items: flex-end; background: var(--head); border-radius: 8px 8px 4px 4px; overflow: hidden; }
.vbar-fill { width: 100%; border-radius: 8px 8px 0 0; background-image: linear-gradient(180deg, rgba(255, 255, 255, .3), rgba(255, 255, 255, 0)); box-shadow: 0 0 14px -3px currentColor; transition: height .5s cubic-bezier(.2, .8, .2, 1); min-height: 2px; }
.vbar-label { font: 500 .68rem/1 var(--font-mono); color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }

/* ── Revenue-share mini bar inside a table cell (top customers) ──── */
.mini-bar-row { display: flex; align-items: center; gap: .55rem; }
.mini-bar { background: var(--head); border-radius: 5px; height: .45rem; overflow: hidden; flex: 1; min-width: 60px; }
.mini-bar > span { display: block; height: 100%; border-radius: 5px; background: var(--accent-grad); }
.mini-bar-value { flex: none; font: 500 .78rem/1 var(--font-mono); color: var(--muted); min-width: 2.6rem; text-align: right; }

/* ── Forms ─────────────────────────────────────────────────────── */
.form .card { display: flex; flex-direction: column; gap: .7rem; }
.form label { display: flex; flex-direction: column; gap: .25rem; font-size: .8rem; color: var(--muted); font-weight: 600; }
.form label.check { flex-direction: row; align-items: center; gap: .55rem; color: var(--text); font-size: .93rem; font-weight: 500; }
.form label small.hint { text-transform: none; letter-spacing: 0; font: 400 .78rem var(--font-body); color: var(--muted); }
.form .row { display: flex; gap: .75rem; }
.form .row > * { flex: 1; }
.form h3 { font: 500 .68rem/1 var(--font-mono); letter-spacing: .12em; text-transform: uppercase; margin: .5rem 0 0; color: var(--muted); }
.form-actions { display: flex; gap: .6rem; margin-top: 1.1rem; }

/* ── Continuous booking/offer editors ─────────────────────────── */
.editor-form { width: 100%; }
.editor-form > .alert { margin-bottom: 1rem; }
.editor-shell { display: grid; grid-template-columns: minmax(0, 1fr) minmax(270px, 320px); align-items: start; gap: 1rem; }
.form .editor-main-card { display: block; padding: 0; overflow: hidden; }
.editor-section { padding: 1.25rem 1.35rem; border-bottom: 1px solid var(--border); }
.editor-section:last-of-type { border-bottom: 0; }
.editor-section > h2 { margin-bottom: 1rem; color: var(--accent); }
.editor-fields { display: grid; gap: .8rem 1rem; }
.editor-fields.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.schedule-fields { grid-template-columns: minmax(170px, 1.5fr) minmax(80px, .55fr) minmax(80px, .55fr) minmax(150px, 1fr); }
.move-fields { grid-template-columns: minmax(180px, 1.4fr) repeat(3, minmax(120px, 1fr)); align-items: end; }
.pricing-fields { grid-template-columns: repeat(3, minmax(120px, 1fr)); margin: .9rem 0; }
.editor-route-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; }
.editor-subsection { display: flex; min-width: 0; flex-direction: column; gap: .7rem; padding: 1rem; border: 1px solid var(--border); border-radius: 14px; background: var(--raised); }
.editor-subsection h3 { display: flex; align-items: center; gap: .55rem; margin: 0 0 .1rem; color: var(--text); font: 700 .82rem var(--font-display); }
.editor-subsection h3 > span { display: grid; width: 1.65rem; height: 1.65rem; place-items: center; border-radius: 50%; background: var(--accent-grad); color: var(--on-accent); font: 700 .65rem var(--font-mono); }
.editor-subsection input:not([type=checkbox]):not([type=radio]) { width: 100%; }
.compact-fields { align-items: end; }
.editor-services { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .6rem 1rem; }
.editor-service-option { display: flex; min-width: 0; flex-direction: column; gap: .5rem; }
.editor-services > .editor-service-option, .editor-check-card { min-height: 44px; padding: .65rem .75rem; border: 1px solid var(--border); border-radius: 10px; background: var(--raised); }
.editor-service-option > input { width: 100%; }
.pricing-mode { display: flex; flex-wrap: wrap; gap: .6rem 1.25rem; }
.editor-total { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; margin-top: 1rem; padding: 1rem; border-radius: 12px; background: color-mix(in srgb, var(--accent) 9%, var(--raised)); border: 1px solid color-mix(in srgb, var(--accent) 25%, var(--border)); }
.editor-total strong { color: var(--accent); font: 700 1.3rem var(--font-display); }
.editor-actions { margin: 0; padding: 1rem 1.35rem 1.25rem; border-top: 1px solid var(--border); background: color-mix(in srgb, var(--raised) 70%, transparent); }
.assignment-card { position: sticky; top: 5.25rem; max-height: calc(100vh - 6.25rem); overflow-y: auto; padding: 1rem; }
.assignment-heading { display: flex; align-items: center; justify-content: space-between; gap: .75rem; }
.assignment-heading h2 { margin: 0; }
.assignment-heading > span { display: grid; min-width: 1.8rem; height: 1.8rem; place-items: center; border-radius: 9px; background: var(--raised); color: var(--accent); font: 700 .7rem var(--font-mono); }
.assignment-group { margin-top: 1rem; }
.assignment-group + .assignment-group { padding-top: .9rem; border-top: 1px solid var(--border); }
.assignment-group h3 { margin: 0 0 .55rem; }
.form label.assignment-option { min-height: 42px; flex-direction: row; align-items: center; padding: .55rem .65rem; border-radius: 9px; color: var(--text); font-weight: 500; }
.assignment-option:hover { background: var(--hover); }
.assignment-option > span { min-width: 0; flex: 1; overflow-wrap: anywhere; }
.assignment-option small { display: inline; font-size: .68rem; }
.assignment-option .load { display: block; margin-top: .2rem; }
.form .offer-editor-main { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0; padding: 0; overflow: hidden; }
.offer-editor-main > .card { display: flex; border: 0; border-radius: 0; background: transparent; box-shadow: none; -webkit-backdrop-filter: none; backdrop-filter: none; padding: 1.25rem 1.35rem; border-bottom: 1px solid var(--border); }
.offer-editor-main > .card:nth-of-type(odd) { border-right: 1px solid var(--border); }
.offer-editor-main > .card.wide, .offer-editor-main > .editor-actions { grid-column: 1 / -1; border-right: 0; }
.offer-editor-main > .card > h2 { color: var(--accent); }
.offer-editor-main > .editor-actions { width: 100%; }

/* Settings uses the same continuous surface as the booking and offer editors. */
.settings-editor { width: 100%; }
.form .settings-continuous { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0; padding: 0; overflow: hidden; }
.settings-continuous > .card,
.settings-continuous > fieldset > .card {
    border: 0; border-bottom: 1px solid var(--border); border-radius: 0;
    background: transparent; box-shadow: none; -webkit-backdrop-filter: none; backdrop-filter: none;
    padding: 1.25rem 1.35rem;
}
.settings-continuous > .card:nth-of-type(odd),
.settings-continuous > fieldset > .card:not(.wide):nth-of-type(odd) { border-right: 1px solid var(--border); }
.settings-continuous > .card > h2,
.settings-continuous > fieldset > .card > h2 { color: var(--accent); }
.settings-continuous > .card.wide,
.settings-continuous > fieldset > .card.wide { grid-column: 1 / -1; border-right: 0; }
.settings-continuous .fields-2col { padding-top: 1.35rem; padding-bottom: 1.5rem; }
.settings-continuous .fields-2col > h2 { margin-bottom: 0; }
.settings-continuous .fields-2col > small { margin-bottom: .35rem; }
.settings-continuous .check { min-height: 36px; }
.settings-continuous .file-row { padding: .35rem 0; }

@media (max-width: 1000px) {
    .editor-shell { grid-template-columns: minmax(0, 1fr); }
    .assignment-card { position: static; max-height: none; }
}
/* Cards with many short fields (Settings): wrap into columns instead of one tall narrow stack. */
.form .card.fields-2col { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: .7rem 1rem; align-content: start; }
.form .card.fields-2col h2, .form .card.fields-2col > small { grid-column: 1 / -1; }
.estimate { background: color-mix(in srgb, var(--accent) 10%, transparent); border: 1px solid color-mix(in srgb, var(--accent) 30%, transparent); border-radius: 10px; padding: .8rem 1rem; }
.estimate strong { font-family: var(--font-mono); font-size: 1.05rem; }
.load { font-size: .72rem; color: var(--warn); margin-left: .4rem; font-family: var(--font-mono); }

/* ── Chat ──────────────────────────────────────────────────────── */
.chat { display: grid; grid-template-columns: 250px 1fr; gap: 1rem; }
.chat-users { display: flex; flex-direction: column; gap: .15rem; padding: .9rem .7rem; }
.chat-users h2 { padding: 0 .5rem; }
.chat-users .chat-user {
    padding: .5rem .6rem; display: flex; align-items: center; gap: .55rem; font-size: .92rem;
    border-radius: 10px; cursor: pointer; transition: background .12s;
}
.chat-users .chat-user:hover { background: var(--hover); }
.chat-users .chat-user.active { background: color-mix(in srgb, var(--accent) 16%, var(--surface)); box-shadow: inset 2px 0 0 var(--accent); }
.chat-users .chat-user.pinned { font-weight: 600; margin-bottom: .5rem; padding-bottom: .6rem; border-bottom: 1px solid var(--border); border-radius: 10px 10px 0 0; }
.pin-icon { font-size: .85rem; flex: none; }
.chat-user-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-badge {
    flex: none; min-width: 1.35rem; height: 1.35rem; padding: 0 .35rem; border-radius: 999px;
    background: var(--accent-grad); color: var(--on-accent); font: 700 .72rem/1.35rem var(--font-mono);
    text-align: center;
}
.dot { width: .55rem; height: .55rem; border-radius: 50%; background: var(--faint); flex: none; }
.dot.on { background: var(--good); box-shadow: 0 0 10px var(--good); }
.profile-presence { display: flex; align-items: center; justify-content: center; gap: .4rem; }
.registration-invite-actions { display: flex; gap: .6rem; flex-wrap: wrap; }
.chat-main { display: flex; flex-direction: column; height: 65vh; }
.chat-main-head { padding-bottom: .7rem; margin-bottom: .7rem; border-bottom: 1px solid var(--border); font-family: var(--font-display); }
.chat-messages { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: .7rem; padding: .25rem .25rem .6rem 0; }
.msg { max-width: 75%; align-self: flex-start; }
.msg.mine { align-self: flex-end; }
.msg-meta { font: 400 .68rem/1.4 var(--font-mono); color: var(--muted); margin-bottom: .15rem; }
.msg-body { background: var(--raised); border: 1px solid var(--border); padding: .55rem .85rem; border-radius: 14px 14px 14px 4px; white-space: pre-wrap; word-break: break-word; }
.msg.mine .msg-body { background: var(--accent-grad); color: var(--on-accent); border-color: transparent; border-radius: 14px 14px 4px 14px; }
.chat-form { display: flex; gap: .5rem; margin-top: .5rem; }
.chat-form input { flex: 1; }

/* ── Nav-bar bell / chat dropdowns (notification bell + chat icon) ─── */
.notif-wrap { position: relative; flex: none; }
.notif-bell {
    position: relative; display: inline-flex; align-items: center; justify-content: center;
    width: 2.2rem; height: 2.2rem; border-radius: 10px; border: 1px solid transparent;
    background: transparent; color: var(--text); font-size: 1.15rem; cursor: pointer;
    transition: background .15s, border-color .15s, transform .1s;
}
.notif-bell:hover { background: var(--hover); border-color: var(--border); }
.notif-bell:active { transform: scale(.94); }
.nav-icon-btn {
    display: inline-flex; align-items: center; justify-content: center;
    width: 2.2rem; height: 2.2rem; border-radius: 10px; border: 1px solid transparent;
    background: transparent; color: var(--muted); cursor: pointer; flex: none;
    transition: background .15s, border-color .15s, color .15s, transform .1s;
}
.nav-icon-btn:hover { background: var(--hover); border-color: var(--border); color: var(--text); text-decoration: none; }
.nav-icon-btn:active { transform: scale(.94); }
.nav-icon-btn.signout { margin-left: .2rem; }
.nav-icon-btn.signout:hover { color: var(--bad); background: color-mix(in srgb, var(--bad) 12%, transparent); border-color: color-mix(in srgb, var(--bad) 30%, transparent); }
.notif-badge {
    position: absolute; top: -.25rem; right: -.25rem; min-width: 1.2rem; height: 1.2rem; padding: 0 .32rem;
    border-radius: 999px; background: var(--accent-grad); color: var(--on-accent);
    font: 700 .68rem/1.2rem var(--font-mono); text-align: center;
    box-shadow: 0 0 0 2px var(--nav), 0 0 10px -2px var(--glow);
}
.notif-backdrop { position: fixed; inset: 0; z-index: 39; background: transparent; }
.notif-head { font: 600 .68rem/1 var(--font-mono); text-transform: uppercase; letter-spacing: .12em; color: var(--muted); padding: .9rem .9rem .6rem; }
.notif-empty { padding: .3rem .3rem 1.1rem; font-size: .85rem; }

@keyframes navDropdownIn { from { opacity: 0; transform: translateY(-8px) scale(.98); } to { opacity: 1; transform: none; } }

.chat-flyout {
    position: absolute; right: 0; top: calc(100% + .6rem); z-index: 40; width: 350px; max-height: 70vh; height: 460px;
    background: var(--surface-solid);
    -webkit-backdrop-filter: blur(20px) saturate(160%); backdrop-filter: blur(20px) saturate(160%);
    border: 1px solid var(--border-strong); border-radius: 16px;
    box-shadow: 0 24px 60px -12px rgba(0, 0, 0, .6), 0 0 0 1px rgba(255, 255, 255, .03) inset;
    display: flex; flex-direction: column; overflow: hidden;
    animation: navDropdownIn .18s cubic-bezier(.2, .8, .2, 1) both;
}
.chat-flyout::before {
    content: ""; position: absolute; top: 0; left: 0; right: 0; height: 2px;
    background: var(--accent-grad); opacity: .8;
}
.chat-flyout-list { flex: 1; overflow-y: auto; padding: 0 .6rem .6rem; display: flex; flex-direction: column; gap: .2rem; }
.chat-flyout .chat-user {
    padding: .6rem .65rem; display: flex; align-items: center; gap: .6rem; font-size: .88rem;
    border-radius: 10px; cursor: pointer; transition: background .12s;
}
.chat-flyout .chat-user:hover { background: var(--hover); }
.chat-flyout .chat-user.pinned { font-weight: 600; margin: 0 0 .4rem; padding-bottom: .7rem; border-bottom: 1px solid var(--border); border-radius: 10px 10px 0 0; }
.chat-flyout-head {
    display: flex; align-items: center; gap: .65rem; padding: .8rem .9rem; border-bottom: 1px solid var(--border);
    font-family: var(--font-display); flex: none;
}
.chat-back {
    flex: none; width: 1.9rem; height: 1.9rem; border-radius: 8px; border: 1px solid var(--border);
    background: var(--raised); color: var(--text); cursor: pointer; font-size: 1.05rem; line-height: 1;
    transition: background .12s;
}
.chat-back:hover { background: var(--hover); }
.chat-flyout-messages { flex: 1; padding: .8rem .9rem; }
.chat-flyout .chat-form { padding: 0 .9rem .9rem; }

.grid, .grid > *, .form .row > *, .form label { min-width: 0; }
.card { overflow-wrap: anywhere; }
.form-actions { flex-wrap: wrap; }
.chat-flyout-list, .chat-flyout-messages { min-height: 0; overscroll-behavior: contain; }
.chat-flyout .chat-user { width: 100%; min-height: 44px; border: 0; background: transparent; color: inherit; font-family: inherit; text-align: left; }
.chat-flyout-head strong { min-width: 0; flex: 1; overflow-wrap: anywhere; }
.notif-head { display: flex; align-items: center; justify-content: space-between; gap: .5rem; flex-shrink: 0; }
.flyout-close, .chat-back { min-width: 44px; min-height: 44px; }
.flyout-close { margin-left: auto; border: 1px solid var(--border); border-radius: 8px; color: var(--text); background: var(--raised); font: inherit; font-size: 1.2rem; cursor: pointer; }
.notification-flyout { height: auto; }
.chat-form { flex-shrink: 0; }
.chat-form input { width: 0; min-width: 0; }
.chat-user:focus-visible, .notif-bell:focus-visible, .flyout-close:focus-visible, .chat-back:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }

@media (max-width: 1100px) {
    .chat-flyout { width: min(350px, 92vw); }
}

/* ── Map ───────────────────────────────────────────────────────── */
.map { height: 65vh; border-radius: var(--radius); box-shadow: var(--shadow); border: 1px solid var(--border); overflow: hidden; }
.legend { display: flex; gap: 1.1rem; font-size: .85rem; flex-wrap: wrap; color: var(--muted); }
.legend i { display: inline-block; width: .65rem; height: .65rem; border-radius: 50%; margin-right: .4rem; box-shadow: 0 0 8px currentColor; }

/* ── Calendar ──────────────────────────────────────────────────── */
.cal { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 1px; background: var(--border); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
.cal-head { background: var(--surface-solid); padding: .55rem; text-align: center; font: 500 .68rem/1 var(--font-mono); color: var(--muted); text-transform: uppercase; letter-spacing: .12em; }
.cal-day { background: var(--surface-solid); color: var(--text); border: 0; min-height: 6.5rem; padding: .4rem; text-align: left; display: flex; flex-direction: column; gap: 3px; cursor: pointer; font: inherit; overflow: hidden; transition: background .12s; }
.cal-day:hover { background: color-mix(in srgb, var(--accent) 8%, var(--surface-solid)); }
.cal-day.other { color: var(--faint); background: color-mix(in srgb, var(--surface-solid) 60%, var(--bg)); }
.cal-num { font: 500 .8rem/1.5rem var(--font-mono); }
.cal-day.today .cal-num { background: var(--accent-grad); color: var(--on-accent); border-radius: 50%; width: 1.5rem; height: 1.5rem; display: inline-grid; place-items: center; font-weight: 700; }
.cal-day.sel { box-shadow: inset 0 0 0 2px var(--accent); }
.cal-item { --c: var(--muted); font-size: .68rem; padding: 2px 6px; border-radius: 5px; color: var(--c); background: color-mix(in srgb, var(--c) 15%, transparent); border-left: 2px solid var(--c); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cal-item.pending { --c: var(--warn); }
.cal-item.assigned { --c: var(--info); }
.cal-item.inprogress { --c: var(--violet); }
.cal-item.completed { --c: var(--good); }
.cal-item.cancelled { --c: var(--bad); }
.cal-more { font: 400 .68rem var(--font-mono); color: var(--muted); }
.cal-mobile-count { display: none; }

/* ── Sign-in and license pages ─────────────────────────────────── */
.login-wrap { position: relative; min-height: 100vh; display: grid; place-items: center; padding: 1rem; overflow: hidden; isolation: isolate; }
.login-wrap::before, .login-wrap::after { content: ""; position: absolute; z-index: -1; border-radius: 50%; filter: blur(70px); opacity: .55; }
.login-wrap::before { width: 46rem; height: 46rem; left: -14rem; top: -18rem; background: radial-gradient(circle, rgba(76, 141, 255, .55), transparent 65%); animation: drift 18s ease-in-out infinite alternate; }
.login-wrap::after { width: 38rem; height: 38rem; right: -12rem; bottom: -16rem; background: radial-gradient(circle, rgba(34, 211, 238, .4), transparent 65%); animation: drift 22s ease-in-out infinite alternate-reverse; }
.login-card {
    width: 100%; max-width: 400px;
    background: var(--surface);
    -webkit-backdrop-filter: blur(22px) saturate(140%);
    backdrop-filter: blur(22px) saturate(140%);
    color: var(--text);
    border: 1px solid var(--border-strong);
    border-radius: 20px;
    padding: 2.2rem 2rem 1.8rem;
    display: flex; flex-direction: column; gap: 1.05rem;
    box-shadow: 0 30px 80px -20px rgba(0, 0, 0, .65), 0 0 0 1px rgba(255, 255, 255, .03) inset;
    animation: rise .6s cubic-bezier(.2, .8, .2, 1) both;
}
.login-brand { display: flex; align-items: center; justify-content: center; gap: .7rem; margin-bottom: .6rem; }
.login-card h1 { margin: 0 0 .2rem; text-align: center; font-size: 1.15rem; }
.login-card label { display: flex; flex-direction: column; gap: .3rem; font: 500 .7rem/1 var(--font-mono); letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.login-card input:not([type=checkbox]):not([type=radio]) { font: 500 1rem var(--font-body); letter-spacing: 0; text-transform: none; padding: .75rem .85rem; }
.login-card button { padding: .85rem; border: 0; border-radius: 12px; background: var(--accent-grad); color: var(--on-accent); font: 700 1rem var(--font-body); cursor: pointer; box-shadow: 0 10px 28px -8px var(--glow); transition: filter .15s, transform .1s; }
.login-card button:hover { filter: brightness(1.1); }
.login-card button:active { transform: translateY(1px); }
.login-error { background: color-mix(in srgb, var(--bad) 13%, transparent); color: var(--bad); border: 1px solid color-mix(in srgb, var(--bad) 35%, transparent); padding: .65rem .85rem; border-radius: 10px; font-size: .9rem; }
.lang-switch { text-align: center; font-size: .82rem; color: var(--muted); }
.lang-switch a { color: var(--muted); }
.lang-switch a:hover { color: var(--accent); }
.eula-card { max-width: 740px; }
.eula-text { white-space: pre-wrap; max-height: 48vh; overflow-y: auto; border: 1px solid var(--border); background: var(--field); border-radius: 12px; padding: 1.1rem 1.2rem; font-size: .9rem; line-height: 1.6; color: var(--text); }

/* ── Brand ─────────────────────────────────────────────────────── */
.logo-mark { flex: none; filter: drop-shadow(0 0 10px var(--glow)); }
.wordmark { font: 600 1.15rem/1 var(--font-display); letter-spacing: -.02em; color: var(--text); }
.wordmark b { font-weight: 700; background: var(--accent-grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.wordmark.big { font-size: 1.7rem; }

/* ── Motion ────────────────────────────────────────────────────── */
@keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes drift { from { transform: translate3d(0, 0, 0) scale(1); } to { transform: translate3d(3rem, 2rem, 0) scale(1.12); } }
main.content > * { animation: rise .45s cubic-bezier(.2, .8, .2, 1) both; }
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ── Scrollbars ────────────────────────────────────────────────── */
* { scrollbar-width: thin; scrollbar-color: var(--border-strong) transparent; }

/* ── Blazor error UI ───────────────────────────────────────────── */
.blazor-error-boundary { background: #B32121; padding: 1rem; color: #fff; border-radius: 10px; }
.blazor-error-boundary::after { content: "An error has occurred."; }
.valid.modified:not([type=checkbox]) { outline: 1px solid #26B050; }
.invalid { outline: 1px solid #E50000; }

/* ── Small screens ─────────────────────────────────────────────── */
@media (max-width: 700px) {
    body { font-size: 16px; }
    h1 { font-size: 1.45rem; }
    .form .row { flex-direction: column; gap: .7rem; }
    .editor-fields.cols-2, .schedule-fields, .move-fields, .pricing-fields, .editor-route-grid, .editor-services { grid-template-columns: minmax(0, 1fr); }
    .editor-section { padding: 1rem; }
    .editor-actions { padding: 1rem; }
    .form .offer-editor-main { grid-template-columns: minmax(0, 1fr); }
    .offer-editor-main > .card, .offer-editor-main > .card:nth-of-type(odd) { grid-column: 1; padding: 1rem; border-right: 0; }
    .form .settings-continuous { grid-template-columns: minmax(0, 1fr); }
    .settings-continuous > .card,
    .settings-continuous > .card:nth-of-type(odd),
    .settings-continuous > fieldset > .card,
    .settings-continuous > fieldset > .card:not(.wide):nth-of-type(odd) { grid-column: 1; padding: 1rem; border-right: 0; }
    .grid.cols-2 { grid-template-columns: 1fr; }
    .chat { grid-template-columns: 1fr; }
    .chat-main { height: 60vh; }
    .msg { max-width: 92%; }
    .cal-day { min-height: 3.6rem; }
    .cal-item, .cal-more { display: none; }
    .cal-mobile-count { display: inline-block; align-self: flex-start; padding: 0 .35rem; border-radius: 6px; background: var(--accent-grad); color: var(--on-accent); font-size: .7rem; font-weight: 700; }
    .page-head .filters { width: 100%; }
    .grid, .grid.stats, .grid.cols-2, .form .card.fields-2col { grid-template-columns: minmax(0, 1fr); width: 100%; }
    .grid > .card { width: 100%; max-width: none; }
    .card { padding: 1rem; }
    .profile-top-row { flex-direction: column; }
    .profile-top-row .profile-hero, .profile-top-row .card.profile-stats-wide { flex: 1 1 auto; width: 100%; max-width: none; }
    .profile-top-row .star-chart { max-width: 320px; }
    .achievements-grid { grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); }
    .form .row { align-items: stretch !important; }
    .form .row > * { width: 100%; }
    .filters > input, .filters > select, .filters > label { flex: 1 1 100%; width: 100%; max-width: 100%; }
    input:not([type=checkbox]):not([type=radio]), select, textarea { max-width: 100%; font-size: 16px; min-height: 44px; }
    .btn { min-height: 44px; white-space: normal; text-align: center; }
    .actions > .btn, .form-actions > .btn { flex: 1 1 auto; }
    .file-row { flex-wrap: wrap; overflow-wrap: anywhere; }
    .file-row > span { min-width: 0; }
    .notif-bell, .nav-icon-btn { width: 44px; height: 44px; }
    .nav-icon-btn.signout { margin-left: 0; }
    .notif-backdrop { background: rgba(0, 0, 0, .35); }
    .chat-flyout {
        position: fixed; top: calc(4.25rem + env(safe-area-inset-top));
        left: max(.5rem, env(safe-area-inset-left)); right: max(.5rem, env(safe-area-inset-right));
        width: auto; height: 540px;
        max-height: calc(100dvh - 5rem - env(safe-area-inset-top) - env(safe-area-inset-bottom));
        animation: none;
    }
    .notification-flyout { height: auto; }
    .chat-flyout .chat-form { padding: .5rem .75rem .75rem; margin-top: 0; }
    .chat-flyout-head { padding: .5rem .75rem; }
    .chat-flyout-messages { padding: .75rem; }
    .chat-user-name { white-space: normal; overflow-wrap: anywhere; min-width: 0; }
    .donut-wrap { justify-content: center; gap: 1rem; }
    .donut-legend { min-width: 0; flex-basis: 100%; }
    .linechart-labels { gap: .25rem; font-size: .55rem; }
    .vbars { gap: .3rem; }
    .cal-head { padding: .5rem .1rem; font-size: .6rem; letter-spacing: 0; }
    .login-card { padding: 1.8rem 1.4rem 1.5rem; }

    .table-wrap { background: transparent; border: 0; box-shadow: none; backdrop-filter: none; -webkit-backdrop-filter: none; overflow: visible; }
    table.data thead { display: none; }
    table.data, table.data tbody { display: block; }
    table.data tr { display: block; margin-bottom: .8rem; padding: .45rem 0; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
    table.data tr:last-child { margin-bottom: 0; }
    table.data td { display: flex; justify-content: space-between; gap: .75rem; border: 0; padding: .45rem .75rem; text-align: right; min-width: 0; overflow-wrap: anywhere; white-space: normal; }
    table.data td > * { min-width: 0; max-width: 100%; }
    table.data td .badge { white-space: normal; text-align: left; }
    table.data td .badge::before { flex-shrink: 0; }
    table.data td[colspan] { display: block; text-align: center; }
    table.data td[colspan]::before { content: none; }
    table.data td::before { content: attr(data-label); color: var(--muted); text-align: left; flex: 0 0 35%; overflow-wrap: anywhere; font: 500 .68rem/1.6 var(--font-mono); letter-spacing: .1em; text-transform: uppercase; }
    table.data td.actions { justify-content: flex-end; opacity: 1; }
    table.data td.actions::before { content: none; }
    table.data tbody tr:hover { background: var(--surface); box-shadow: var(--shadow); }
}
@media (hover: none), (pointer: coarse) {
    table.data td.actions { opacity: 1; }
}
.file-row { display:flex; align-items:center; justify-content:space-between; gap:.5rem; } label.upload { display:flex; flex-direction:column; gap:.3rem; } input[type=file] { color:var(--muted); font-size:.85rem; } input[type=file]::file-selector-button { background:var(--raised); color:var(--text); border:1px solid var(--border); border-radius:8px; padding:.35rem .8rem; margin-right:.7rem; cursor:pointer; font:inherit; }
.reg-card { max-width:460px; } .reg-card small.hint { margin-top:-.6rem; text-transform:none; letter-spacing:0; font: 400 .78rem var(--font-body); color:var(--muted); } .hp { position:absolute; left:-9999px; width:1px; height:1px; opacity:0; } label.terms { flex-direction:row; align-items:flex-start; gap:.6rem; text-transform:none; letter-spacing:0; font:400 .85rem var(--font-body); color:var(--text); } details summary { cursor:pointer; color:var(--muted); font-size:.85rem; margin-bottom:.5rem; } .details-body { display:flex; flex-direction:column; gap:.8rem; } .status-text { text-align:center; line-height:1.6; margin:.5rem 0 1rem; } .login-card .btn.primary { text-align:center; text-decoration:none; }

/* Conversation centre and arrival alerts */
.chat-flyout { width: 390px; height: 540px; border-radius: 20px; box-shadow: 0 24px 80px -20px rgba(0,0,0,.65); }
.chat-flyout .notif-head { font-family: var(--font-display); font-size: 1rem; text-transform: none; letter-spacing: -.02em; color: var(--text); padding: .8rem 1rem; }
.chat-avatar { position: relative; display: grid; place-items: center; flex: 0 0 40px; height: 40px; border-radius: 14px; background: color-mix(in srgb,var(--accent) 16%,var(--surface-solid)); color: var(--accent); font-weight: 700; }
.chat-avatar.online::after { content: ''; position: absolute; bottom: -1px; right: -1px; width: 10px; height: 10px; border-radius: 50%; background: var(--good); border: 2px solid var(--surface-solid); }
.chat-user-name small { display: block; color: var(--muted); font-size: .72rem; font-weight: 400; margin-top: .15rem; }
.chat-flyout .chat-user { padding: .75rem; }
.chat-flyout-messages { background: radial-gradient(ellipse at top right, color-mix(in srgb,var(--accent) 7%,transparent),transparent 65%); }
.chat-flyout .chat-form { padding-top: .75rem; border-top: 1px solid var(--border); }
.chat-flyout .chat-form input { border-radius: 14px; min-height: 44px; }
.chat-welcome { margin: auto; padding: 1.5rem; text-align: center; color: var(--muted); }
.chat-error { margin: .5rem .9rem; color: var(--bad); font-size: .85rem; }
.notification-flyout { height: auto; }
.notification-tools { display: flex; justify-content: space-between; align-items: center; gap: .75rem; padding: .5rem 1rem .9rem; color: var(--muted); font-size: .8rem; border-bottom: 1px solid var(--border); }
.notification-tools .btn { min-height: 36px; }
.arrival-toast { position: fixed; z-index: 100; top: max(1rem,env(safe-area-inset-top)); left: 50%; transform: translateX(-50%); width: min(440px,calc(100% - 1rem)); display: flex; align-items: center; gap: .5rem; padding: .65rem; border: 1px solid var(--border-strong); border-radius: 18px; background: var(--surface-solid); box-shadow: 0 16px 60px rgba(0,0,0,.35); animation: arrival-in .25s ease-out; }
.arrival-open { display: flex; align-items: center; gap: .75rem; flex: 1; min-width: 0; text-align: left; border: 0; background: transparent; color: var(--text); cursor: pointer; font: inherit; padding: .25rem; }
.arrival-open strong, .arrival-open small { display: block; overflow-wrap: anywhere; }
.arrival-open small { color: var(--muted); font-size: .8rem; margin-top: .2rem; }
.arrival-icon { display: grid; place-items: center; flex: 0 0 44px; height: 44px; border-radius: 14px; background: var(--accent-grad); color: var(--on-accent); font-size: 1.3rem; }
@keyframes arrival-in { from { opacity: 0; margin-top: -20px; } to { opacity: 1; margin-top: 0; } }
@media (max-width:700px) {
    html.panel-open { overflow: hidden; overscroll-behavior: none; }
    html.panel-open body { position: fixed; top: var(--panel-scroll); left: 0; right: 0; width: 100%; overflow: hidden; }
    .chat-flyout { width: auto; }
    .notification-tools .btn { min-height: 44px; }
}
@media (prefers-reduced-motion:reduce) { .arrival-toast { animation: none; } }
.chat-settings-note { margin: .9rem 1rem; color: var(--muted); font-size: .78rem; }
.chat-account-link { display: block; margin: .2rem 1rem 1rem; color: var(--muted); font-size: .75rem; text-decoration: underline; text-underline-offset: .15rem; }
.chat-account-link:hover, .chat-account-link:focus-visible { color: var(--text); }
.language-options { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: .35rem; }

/* ── Toggle switch (notification permission) ─────────────────────────────────── */
.pwa-switch { position: relative; flex: none; display: inline-block; width: 42px; height: 24px; }
.pwa-switch input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; z-index: 1; }
.pwa-switch-track { position: absolute; inset: 0; border-radius: 999px; background: var(--head); border: 1px solid var(--border); transition: background .15s, border-color .15s; }
.pwa-switch-track::after { content: ""; position: absolute; top: 2px; left: 2px; width: 18px; height: 18px; border-radius: 50%; background: var(--muted); transition: transform .18s cubic-bezier(.2,.8,.2,1), background .15s; }
.pwa-switch input:checked + .pwa-switch-track { background: color-mix(in srgb, var(--accent) 30%, var(--head)); border-color: color-mix(in srgb, var(--accent) 50%, var(--border)); }
.pwa-switch input:checked + .pwa-switch-track::after { transform: translateX(18px); background: var(--accent-grad); box-shadow: 0 0 8px -1px var(--glow); }
.pwa-switch input:disabled + .pwa-switch-track { opacity: .5; }
.pwa-switch input:focus-visible + .pwa-switch-track { box-shadow: 0 0 0 3px var(--glow); }
.notif-status { font-size: .72rem; color: var(--muted); margin: .25rem 1rem .5rem; }

/* ── Expandable multiline help (notification/install instructions) ──────────── */
.pwa-details { margin: 0 1rem .5rem; }
.pwa-details summary { cursor: pointer; font-size: .82rem; color: var(--accent); font-weight: 600; padding: .3rem 0; list-style: none; display: flex; align-items: center; gap: .4rem; }
.pwa-details summary::-webkit-details-marker { display: none; }
.pwa-details summary::before { content: "▸"; display: inline-block; transition: transform .15s; font-size: .7rem; }
.pwa-details[open] summary::before { transform: rotate(90deg); }
.pwa-instructions { white-space: pre-line; font-size: .8rem; line-height: 1.6; color: var(--muted); background: var(--raised); border: 1px solid var(--border); border-radius: 10px; padding: .7rem .8rem; margin: .4rem 0 0; }
.pwa-install-row { display: flex; align-items: center; justify-content: space-between; gap: .75rem; }
.pwa-install-row .btn { min-height: 36px; }

/* ── My Jobs ──────────────────────────────────────────────────────────────────── */
.myjobs-grid { grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }
.myjob-card { display: flex; flex-direction: column; gap: .55rem; }
.myjob-head { display: flex; align-items: center; justify-content: space-between; gap: .5rem; }
.myjob-date { font: 600 .78rem var(--font-mono); color: var(--muted); }
.myjob-customer { margin: 0; font-size: 1.05rem; }
.myjob-route { display: grid; grid-template-columns: auto 1fr; gap: .3rem .75rem; margin: 0; font-size: .85rem; }
.myjob-route dt { color: var(--muted); font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; font-family: var(--font-mono); padding-top: .1rem; }
.myjob-route dd { margin: 0; }
.myjob-tags { display: flex; flex-wrap: wrap; gap: .35rem; }
.myjob-price { margin: 0; font-size: .88rem; }
.myjob-team { margin: 0; font-size: .8rem; }
.myjob-notes { margin: 0; padding: .55rem .7rem; border-radius: 10px; background: var(--raised); border: 1px solid var(--border); font-size: .85rem; white-space: pre-wrap; }
.myjob-card .btn { align-self: flex-start; margin-top: .2rem; }

/* ── Rank badge (nav bar): own rank icon + name/email + XP bar, links to /profile ──── */
.rank-badge {
    display: flex; align-items: center; gap: .55rem; flex: none;
    padding: .3rem .6rem .3rem .3rem; margin: 0 .2rem; border-radius: 12px; border: 1px solid transparent;
    text-decoration: none; color: inherit; transition: background .15s, border-color .15s;
    max-width: 220px;
}
.rank-badge:hover { background: var(--hover); border-color: var(--border); text-decoration: none; }
/* Nav-bar and profile rank art: no circular frame — the rank PNG itself is the badge shape. */
.rank-icon-wrap, .profile-rank-icon-wrap {
    position: relative; flex: none; display: grid; place-items: center; overflow: visible;
}
.rank-icon-wrap { width: 2.15rem; height: 2.15rem; }
.rank-icon, .profile-rank-icon { width: 100%; height: 100%; object-fit: contain; display: block; filter: drop-shadow(0 2px 6px var(--glow)); }
.rank-icon-fallback, .profile-rank-fallback {
    display: none; position: absolute; inset: 0; align-items: center; justify-content: center;
    font: 700 .8rem var(--font-mono); color: var(--accent); background: var(--raised); border-radius: 10px; border: 1px solid var(--border-strong);
}
/* Chat dropdown rank icon keeps a small circular chip, like an avatar. */
.chat-rank-icon {
    position: relative; flex: none; display: grid; place-items: center; overflow: hidden;
    border-radius: 50%; background: var(--raised); border: 1px solid var(--border-strong);
}
.chat-rank-fallback {
    display: none; position: absolute; inset: 0; align-items: center; justify-content: center;
    font: 700 .8rem var(--font-mono); color: var(--accent); background: var(--raised);
}
.rank-info { display: flex; flex-direction: column; gap: .15rem; min-width: 0; line-height: 1.2; }
.rank-name { font-size: .82rem; font-weight: 700; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rank-email, .rank-role { font-size: .68rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rank-xpbar { position: relative; width: 100%; min-width: 90px; height: .3rem; border-radius: 999px; background: var(--head); overflow: hidden; margin-top: .1rem; }
.rank-xpbar.big { height: .55rem; min-width: 200px; }
.rank-xpfill { display: block; height: 100%; border-radius: 999px; background: var(--accent-grad); box-shadow: 0 0 8px -1px var(--glow); transition: width .6s cubic-bezier(.2,.8,.2,1); }
.rank-xpbar-static .rank-xpfill { background: var(--muted); box-shadow: none; opacity: .65; }

/* Local, small level-up burst — confined to the rank icon itself, never full-screen. */
@keyframes rank-levelup-glow {
    0% { filter: drop-shadow(0 2px 6px var(--glow)) drop-shadow(0 0 0 var(--accent-2)); }
    50% { filter: drop-shadow(0 2px 6px var(--glow)) drop-shadow(0 0 14px var(--accent-2)); }
    100% { filter: drop-shadow(0 2px 6px var(--glow)) drop-shadow(0 0 0 var(--accent-2)); }
}
@keyframes rank-levelup-pop { 0% { transform: scale(1); } 35% { transform: scale(1.22); } 100% { transform: scale(1); } }
@keyframes rank-levelup-spark { 0% { opacity: 1; transform: scale(.3) rotate(0deg); } 100% { opacity: 0; transform: scale(1.6) rotate(50deg); } }
.rank-levelup .rank-icon, .rank-badge.rank-levelup .rank-icon { animation: rank-levelup-glow 1.1s ease-out, rank-levelup-pop .5s ease-out; }
.rank-levelup .rank-xpbar { animation: rank-levelup-bar 1.1s ease-out; }
@keyframes rank-levelup-bar { 0%, 100% { box-shadow: 0 0 0 var(--glow); } 35% { box-shadow: 0 0 14px 2px var(--accent-2); } }
.rank-levelup::after {
    content: '✦'; position: absolute; left: .3rem; top: -.3rem; font-size: .9rem; color: var(--accent-2);
    animation: rank-levelup-spark 1.1s ease-out; pointer-events: none;
}
@media (prefers-reduced-motion: reduce) { .rank-levelup .rank-icon, .rank-levelup::after { animation: none; } }

@media (max-width: 1250px) { .rank-info { display: none; } .rank-badge { padding: .3rem; max-width: none; } }

/* ── Chat dropdown rank icon (small, clickable, opens /profile) ─────────────────── */
.chat-rank-icon { position: relative; z-index: 1; width: 1.6rem; height: 1.6rem; flex: none; box-shadow: 0 0 0 2px var(--surface-solid); cursor: pointer; }
.chat-rank-icon .chat-rank-fallback { font-size: .62rem; }

/* Chat conversation list: the rank fills the whole avatar slot (same size/shape as the old
   name-initial circle), replacing the initial entirely instead of just badging its corner. */
.chat-rank-fill {
    position: absolute; inset: 0; z-index: 2; display: grid; place-items: center; overflow: hidden;
    border-radius: inherit; cursor: pointer;
}
.chat-rank-fill img { width: 100%; height: 100%; object-fit: cover; display: block; }
.chat-rank-fill .chat-rank-fallback {
    display: none; position: absolute; inset: 0; align-items: center; justify-content: center;
    font: 700 1rem var(--font-mono); color: var(--accent); background: var(--raised); border-radius: inherit;
}

/* ── System alerts (new booking / stuck job) inside the notification dropdown ───── */
.chat-user.system-alert { background: color-mix(in srgb, var(--warn) 8%, transparent); }
.chat-user.system-alert:hover { background: color-mix(in srgb, var(--warn) 16%, transparent); }
.alert-icon { display: grid; place-items: center; flex: 0 0 2.1rem; height: 2.1rem; border-radius: 10px; background: color-mix(in srgb, var(--warn) 20%, var(--surface-solid)); font-size: 1.05rem; }

/* ── Profile page ─────────────────────────────────────────────────────────────── */
.profile-hero { display: flex; align-items: center; gap: 1.4rem; flex-wrap: wrap; }
.profile-hero-rank { display: flex; flex-direction: column; align-items: center; gap: .5rem; flex: none; }
.profile-rank-icon-wrap { width: 6.5rem; height: 6.5rem; }
.profile-rank-icon { filter: drop-shadow(0 8px 20px var(--glow)); }
.profile-rank-fallback { font-size: 2rem; }
.profile-rank-experience { width: min(100%, 15rem); margin-top: .15rem; }
.profile-experience-heading { display: flex; align-items: center; justify-content: space-between; gap: .6rem; color: var(--muted); font: 600 .68rem var(--font-mono); }
.profile-experience-heading strong { color: var(--text); font: inherit; }
.profile-experience-bar { height: .45rem; margin: .35rem 0 .55rem; overflow: hidden; border-radius: 999px; background: var(--head); }
.profile-experience-bar span { display: block; height: 100%; border-radius: inherit; background: var(--accent-grad); box-shadow: 0 0 10px -1px var(--glow); transition: width .6s cubic-bezier(.2,.8,.2,1); }
.profile-level-progress { margin-bottom: .28rem; font-size: .62rem; }
.profile-feedback-summary { display: inline-flex; align-items: center; gap: .35rem; margin-top: .1rem; padding: .35rem .7rem; border: 1px solid var(--border); border-radius: 999px; background: color-mix(in srgb, var(--raised) 75%, transparent); }
.profile-hero-info { flex: 1; min-width: 220px; }
.profile-hero-name { margin: 0 0 .15rem; }
.profile-since { margin-top: .1rem; }
.profile-xp-row { display: flex; align-items: center; gap: .75rem; margin: .75rem 0 .4rem; flex-wrap: wrap; }
.profile-xp-label { font: 600 .78rem var(--font-mono); color: var(--muted); white-space: nowrap; }

.star-chart { width: 100%; max-width: 320px; display: block; margin: 0 auto; }
.star-grid-ring { fill: none; stroke: var(--border); stroke-width: 1; }
.star-grid-line { stroke: var(--border); stroke-width: 1; }
.star-data { fill: color-mix(in srgb, var(--accent) 22%, transparent); stroke: var(--accent); stroke-width: 2; stroke-linejoin: round; }
.star-data-dot { fill: var(--accent-2); }
.star-label { font: 600 .5rem var(--font-mono); fill: var(--muted); text-transform: uppercase; letter-spacing: .05em; }

.achievements-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: .7rem; margin-top: .8rem; }
.achievement {
    position: relative; display: flex; flex-direction: column; align-items: center; text-align: center; gap: .4rem;
    padding: .9rem .6rem 1rem; border-radius: 14px; border: 1px solid var(--border); background: var(--raised);
    transition: transform .15s, box-shadow .15s, border-color .15s;
}
.achievement.earned { border-color: color-mix(in srgb, var(--accent) 40%, var(--border)); background: color-mix(in srgb, var(--accent) 8%, var(--raised)); box-shadow: 0 10px 26px -14px var(--glow); }
.achievement.earned:hover { transform: translateY(-2px); }
.achievement.locked { opacity: .5; filter: grayscale(.6); }
.achievement-icon { font-size: 1.7rem; line-height: 1; }
.achievement-name { font-size: .74rem; font-weight: 600; line-height: 1.25; }
.achievement-progress { display: block; width: 100%; height: .25rem; border-radius: 999px; background: var(--head); overflow: hidden; margin-top: .1rem; }
.achievement-progress span { display: block; height: 100%; background: var(--accent-grad); }

/* Profile: a compact rank card on the left, a large star graph filling the rest. */
.profile-top-row { display: flex; align-items: stretch; gap: 1rem; flex-wrap: wrap; }
.profile-top-row .profile-hero { flex: 0 1 320px; flex-direction: column; align-items: center; text-align: center; gap: 1rem; }
.profile-top-row .profile-hero-info { min-width: 0; width: 100%; }
.profile-top-row .card.profile-stats-wide { flex: 1 1 420px; min-width: 300px; display: flex; flex-direction: column; }
.profile-top-row .star-chart { max-width: 460px; flex: 1; }
.profile-difficulty { width: 100%; margin-top: 1rem; overflow: hidden; }
.profile-difficulty-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; margin-bottom: .75rem; }
.profile-difficulty-heading h2 { margin: 0 0 .3rem; }
.profile-difficulty-heading p { margin: 0; color: var(--muted); font-size: .82rem; }
.profile-difficulty-heading > span { flex: none; color: var(--muted); font: 600 .7rem var(--font-mono); }

@media (max-width: 700px) {
    .profile-difficulty { padding: 1rem; }
    .profile-difficulty-heading { flex-direction: column; gap: .35rem; }
}

/* ── Notification dismiss ("mark as done") ───────────────────────────────────── */
.notif-dismiss {
    flex: none; margin-left: auto; width: 1.7rem; height: 1.7rem; display: grid; place-items: center;
    border-radius: 8px; border: 1px solid transparent; background: transparent; color: var(--muted); cursor: pointer;
    opacity: 0; transition: opacity .12s, background .12s, color .12s;
}
.chat-user:hover .notif-dismiss, .notif-dismiss:focus-visible { opacity: 1; }
.notif-dismiss:hover { background: color-mix(in srgb, var(--good) 18%, transparent); color: var(--good); border-color: color-mix(in srgb, var(--good) 35%, transparent); }

/* ── Chat message actions (delete/react), reactions, attachments ────────────────── */
.msg-row { display: flex; align-items: flex-end; gap: .35rem; }
.msg.mine .msg-row { flex-direction: row-reverse; }
.msg-actions { display: flex; gap: .15rem; opacity: 0; transition: opacity .12s; flex: none; }
.msg:hover .msg-actions { opacity: 1; }
.msg-action-btn {
    width: 1.6rem; height: 1.6rem; display: grid; place-items: center; border-radius: 7px; border: 1px solid transparent;
    background: transparent; color: var(--muted); cursor: pointer; font-size: .82rem; line-height: 1;
}
.msg-action-btn:hover { background: var(--hover); border-color: var(--border); }
.msg-action-btn.danger:hover { background: color-mix(in srgb, var(--bad) 14%, transparent); color: var(--bad); }
.msg-body.deleted { color: var(--muted); font-style: italic; }
.reaction-picker { display: flex; gap: .2rem; margin-top: .3rem; padding: .3rem; border-radius: 10px; background: var(--raised); border: 1px solid var(--border); width: fit-content; }
.msg.mine .reaction-picker { margin-left: auto; }
.reaction-picker button { border: 0; background: transparent; cursor: pointer; font-size: 1rem; padding: .15rem .3rem; border-radius: 6px; }
.reaction-picker button:hover { background: var(--hover); }
.reaction-row { display: flex; flex-wrap: wrap; gap: .25rem; margin-top: .3rem; }
.msg.mine .reaction-row { justify-content: flex-end; }
.reaction-pill {
    display: inline-flex; align-items: center; gap: .25rem; padding: .1rem .45rem; border-radius: 999px;
    border: 1px solid var(--border); background: var(--raised); color: var(--text); font-size: .74rem; cursor: pointer;
}
.reaction-pill span { font: 600 .68rem var(--font-mono); color: var(--muted); }
.reaction-pill.mine { border-color: color-mix(in srgb, var(--accent) 45%, var(--border)); background: color-mix(in srgb, var(--accent) 14%, var(--raised)); }
.reaction-pill.mine span { color: var(--accent); }

.chat-attach-btn {
    position: relative; flex: none; width: 2.3rem; height: 2.3rem; min-height: 0; display: grid; place-items: center;
    border-radius: 10px; border: 1px solid var(--border); background: var(--raised); color: var(--text); cursor: pointer; font-size: 1rem;
}
.chat-attach-btn:hover { background: var(--hover); }
.chat-attach-btn input[type=file] { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; height: 100%; }
.pending-attachment {
    display: flex; align-items: center; gap: .4rem; margin: -.3rem .9rem .7rem; padding: .35rem .6rem; border-radius: 8px;
    background: var(--raised); border: 1px solid var(--border); font-size: .78rem; color: var(--muted);
}
.pending-attachment button { margin-left: auto; border: 0; background: transparent; color: var(--muted); cursor: pointer; font-size: 1rem; line-height: 1; }
.msg-attachment-image { display: block; margin-top: .35rem; max-width: 220px; border-radius: 10px; overflow: hidden; border: 1px solid var(--border); }
.msg-attachment-image img { display: block; width: 100%; height: auto; }
.msg-attachment-file {
    display: flex; align-items: center; gap: .5rem; margin-top: .35rem; padding: .5rem .7rem; border-radius: 10px;
    background: var(--raised); border: 1px solid var(--border); color: var(--text); text-decoration: none; max-width: 220px;
}
.msg-attachment-file:hover { background: var(--hover); text-decoration: none; }
.msg-attachment-icon { font-size: 1.2rem; flex: none; }
.msg-attachment-name { display: flex; flex-direction: column; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .82rem; }
.msg-attachment-name small { color: var(--muted); font-size: .68rem; }
