/* =========================================================
   Hamrah Shahr Farsh — app stylesheet
   ========================================================= */
@font-face {
    font-family: "Vazirmatn";
    src: url("../fonts/Vazirmatn.woff2") format("woff2");
    font-weight: 100 900;
    font-style: normal;
    font-display: swap;
}

:root {
    --brand: #E31E27;
    --brand-600: #C8141C;
    --brand-50: #FDECED;
    --brand-100: #FAD4D6;
    --on-brand: #ffffff;
    --bg: #F3F3F5;
    --surface: #FFFFFF;
    --surface-2: #F7F7F9;
    --line: #E9E9EE;
    --text: #16161A;
    --text-2: #5E5E68;
    --text-3: #9A9AA5;
    --ok: #12A150;
    --ok-50: #E6F6EC;
    --warn: #C77700;
    --warn-50: #FFF4E0;
    --info: #2563EB;
    --info-50: #E8EFFE;
    --danger: #D92D20;
    --danger-50: #FDECEA;
    --radius: 22px;
    --radius-sm: 14px;
    --shadow: 0 1px 2px rgba(20,20,30,.04),0 8px 24px rgba(20,20,30,.06);
    --shadow-lg: 0 12px 40px rgba(20,20,30,.16);
    --nav-h: 76px;
    --safe-b: env(safe-area-inset-bottom,0px);
    --safe-t: env(safe-area-inset-top,0px);
    --active-bg: #16161A;
    --active-fg: #F3F3F5;
    --backdrop: rgba(10,10,14,.45);
    color-scheme: light;
}
/* Dark theme: follows the OS by default; assets/js/theme.js sets data-theme="light|dark" on <html> when the user picks one */
@media (prefers-color-scheme:dark) {
    :root:not([data-theme="light"]) {
        --brand: #F0353D;
        --brand-600: #D9232B;
        --brand-50: #2A1416;
        --brand-100: #3B1A1D;
        --bg: #0E0E11;
        --surface: #18181C;
        --surface-2: #202026;
        --line: #2A2A31;
        --text: #F3F3F6;
        --text-2: #B1B1BC;
        --text-3: #7A7A86;
        --ok: #34C77B;
        --ok-50: #13261B;
        --warn: #F2A93B;
        --warn-50: #2A2112;
        --info: #6B9BFF;
        --info-50: #141D33;
        --danger: #FF6B61;
        --danger-50: #2E1513;
        --shadow: 0 1px 2px rgba(0,0,0,.3),0 8px 24px rgba(0,0,0,.25);
        --shadow-lg: 0 12px 40px rgba(0,0,0,.5);
        --active-bg: #F0353D;
        --active-fg: #fff;
        --backdrop: rgba(0,0,0,.6);
        color-scheme: dark;
    }
}

:root[data-theme="dark"] {
    --brand: #F0353D;
    --brand-600: #D9232B;
    --brand-50: #2A1416;
    --brand-100: #3B1A1D;
    --bg: #0E0E11;
    --surface: #18181C;
    --surface-2: #202026;
    --line: #2A2A31;
    --text: #F3F3F6;
    --text-2: #B1B1BC;
    --text-3: #7A7A86;
    --ok: #34C77B;
    --ok-50: #13261B;
    --warn: #F2A93B;
    --warn-50: #2A2112;
    --info: #6B9BFF;
    --info-50: #141D33;
    --danger: #FF6B61;
    --danger-50: #2E1513;
    --shadow: 0 1px 2px rgba(0,0,0,.3),0 8px 24px rgba(0,0,0,.25);
    --shadow-lg: 0 12px 40px rgba(0,0,0,.5);
    --active-bg: #F0353D;
    --active-fg: #fff;
    --backdrop: rgba(0,0,0,.6);
    color-scheme: dark;
}

@view-transition {
    navigation: auto
}

::view-transition-old(root), ::view-transition-new(root) {
    animation-duration: .22s
}

* {
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent
}

html, body {
    margin: 0;
    padding: 0;
    height: 100%
}

body {
    font-family: "Vazirmatn",system-ui,-apple-system,"Segoe UI",Tahoma,sans-serif;
    background: var(--bg);
    color: var(--text);
    font-size: 15px;
    line-height: 1.7;
    direction: rtl;
    -webkit-font-smoothing: antialiased;
    overscroll-behavior-y: none;
    font-feature-settings: "ss01";
}

button, input, select, textarea {
    font: inherit;
    color: inherit
}

a {
    color: inherit;
    text-decoration: none
}

img {
    max-width: 100%;
    display: block
}

.ico {
    width: 22px;
    height: 22px;
    flex: none;
    stroke: currentColor;
    fill: none;
    stroke-width: 1.9;
    stroke-linecap: round;
    stroke-linejoin: round
}

    .ico.sm {
        width: 18px;
        height: 18px
    }

    .ico.xs {
        width: 15px;
        height: 15px
    }

    .ico.lg {
        width: 28px;
        height: 28px
    }

[hidden] {
    display: none !important
}

/* ---------- App shell ---------- */
.app {
    max-width: 480px;
    margin: 0 auto;
    min-height: 100dvh;
    position: relative;
    background: var(--bg);
    display: flex;
    flex-direction: column;
}

@media (min-width:560px) {
    body {
        background: linear-gradient(180deg,var(--surface-2),var(--bg))
    }

    .app {
        box-shadow: 0 0 0 1px var(--line),var(--shadow-lg)
    }
}

.topbar {
    position: sticky;
    top: 0;
    z-index: 20;
    padding: calc(12px + var(--safe-t)) 16px 12px;
    display: flex;
    align-items: center;
    gap: 12px;
    background: color-mix(in srgb,var(--bg) 86%,transparent);
    backdrop-filter: saturate(1.4) blur(14px);
    -webkit-backdrop-filter: saturate(1.4) blur(14px);
}

    .topbar h1 {
        font-size: 17px;
        font-weight: 700;
        margin: 0;
        flex: 1;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis
    }

.icon-btn {
    width: 44px;
    height: 44px;
    border-radius: 14px;
    border: 0;
    background: var(--surface);
    display: inline-grid;
    place-items: center;
    cursor: pointer;
    position: relative;
    color: var(--text);
    box-shadow: var(--shadow);
    flex: none;
}

    .icon-btn:active {
        transform: scale(.95)
    }

    .icon-btn .dot {
        position: absolute;
        top: 9px;
        left: 10px;
        width: 9px;
        height: 9px;
        border-radius: 50%;
        background: var(--brand);
        box-shadow: 0 0 0 2px var(--surface)
    }

.content {
    flex: 1;
    padding: 4px 16px calc(var(--nav-h) + 28px + var(--safe-b))
}

    .content.no-nav {
        padding-bottom: calc(28px + var(--safe-b))
    }

    .content.has-cta {
        padding-bottom: calc(110px + var(--safe-b))
    }

/* ---------- Bottom nav (pill) ---------- */
.bottom-nav {
    position: fixed;
    z-index: 30;
    bottom: calc(12px + var(--safe-b));
    left: 50%;
    transform: translateX(-50%);
    width: min(448px,calc(100% - 24px));
    display: flex;
    gap: 6px;
    align-items: center;
    justify-content: space-between;
    padding: 8px;
    border-radius: 999px;
    background: var(--surface);
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--line);
}

    .bottom-nav a {
        height: 52px;
        min-width: 52px;
        border-radius: 999px;
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 8px;
        color: var(--text-2);
        background: var(--surface-2);
        font-weight: 600;
        font-size: 14px;
        padding: 0 14px;
        transition: all .2s;
    }

        .bottom-nav a span {
            display: none
        }

        .bottom-nav a.active {
            background: var(--active-bg);
            color: var(--active-fg);
            flex: 1;
            padding: 0 18px
        }

            .bottom-nav a.active span {
                display: inline
            }

    .bottom-nav .badge {
        position: absolute;
        margin: -20px -22px 0 0
    }

/* ---------- Typography helpers ---------- */
.h-title {
    font-size: 22px;
    font-weight: 800;
    margin: 6px 0 2px;
    letter-spacing: -.2px
}

.h-sub {
    color: var(--text-2);
    margin: 0 0 16px;
    font-size: 14px
}

.section-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin: 22px 4px 10px
}

    .section-title h2 {
        font-size: 16px;
        font-weight: 700;
        margin: 0
    }

    .section-title a, .link {
        color: var(--brand);
        font-weight: 600;
        font-size: 13px;
        cursor: pointer;
        background: none;
        border: 0;
        padding: 0
    }

.muted {
    color: var(--text-2)
}

.faint {
    color: var(--text-3)
}

.small {
    font-size: 13px
}

.tiny {
    font-size: 12px
}

.num {
    font-feature-settings: "tnum";
    direction: ltr;
    unicode-bidi: isolate;
    display: inline-block
}

.center {
    text-align: center
}

.mt-0 {
    margin-top: 0
}

.mt-8 {
    margin-top: 8px
}

.mt-12 {
    margin-top: 12px
}

.mt-16 {
    margin-top: 16px
}

.mt-24 {
    margin-top: 24px
}

.row {
    display: flex;
    align-items: center;
    gap: 10px
}

    .row.between {
        justify-content: space-between
    }

.stack > * + * {
    margin-top: 12px
}

.grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px
}

.divider {
    height: 1px;
    background: var(--line);
    margin: 14px 0;
    border: 0
}

/* ---------- Cards ---------- */
.card {
    background: var(--surface);
    border-radius: var(--radius);
    padding: 16px;
    box-shadow: var(--shadow);
    border: 1px solid var(--line)
}

    .card + .card {
        margin-top: 12px
    }

    .card.flat {
        box-shadow: none
    }

    .card.tap {
        cursor: pointer;
        transition: transform .15s
    }

        .card.tap:active {
            transform: scale(.985)
        }

.card-head {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px
}

    .card-head h3 {
        font-size: 15px;
        font-weight: 700;
        margin: 0;
        flex: 1
    }

.chip-ico {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    display: grid;
    place-items: center;
    background: var(--surface-2);
    border: 1px solid var(--line);
    color: var(--text);
    flex: none
}

    .chip-ico.brand {
        background: var(--brand-50);
        color: var(--brand);
        border-color: var(--brand-100)
    }

    .chip-ico.ok {
        background: var(--ok-50);
        color: var(--ok);
        border-color: transparent
    }

    .chip-ico.info {
        background: var(--info-50);
        color: var(--info);
        border-color: transparent
    }

    .chip-ico.warn {
        background: var(--warn-50);
        color: var(--warn);
        border-color: transparent
    }

/* hero */
.hero {
    position: relative;
    overflow: hidden;
    border-radius: 26px;
    padding: 20px;
    color: #fff;
    background: radial-gradient(120% 140% at 100% 0%,#FF4A51 0%,var(--brand) 42%,#A80F16 100%);
    box-shadow: 0 14px 34px rgba(227,30,39,.28);
}

    .hero::after {
        content: "";
        position: absolute;
        inset: auto -40px -60px auto;
        width: 200px;
        height: 200px;
        border-radius: 50%;
        background: repeating-radial-gradient(circle,rgba(255,255,255,.14) 0 2px,transparent 2px 14px);
        opacity: .7;
        pointer-events: none
    }

    .hero > * {
        position: relative;
        z-index: 1
    }

    .hero h2 {
        margin: 0 0 4px;
        font-size: 19px;
        font-weight: 800
    }

    .hero p {
        margin: 0;
        opacity: .9;
        font-size: 13.5px
    }

    .hero .btn {
        margin-top: 14px
    }

/* service tiles */
.services {
    display: grid;
    grid-template-columns: repeat(3,1fr);
    gap: 10px
}

.service {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 20px;
    padding: 14px 8px 12px;
    text-align: center;
    box-shadow: var(--shadow);
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    font-size: 13px;
    line-height: 1.5;
}

    .service:active {
        transform: scale(.97)
    }

    .service .chip-ico {
        width: 48px;
        height: 48px;
        border-radius: 16px
    }

/* quick links */
.quick {
    display: grid;
    grid-template-columns: repeat(4,1fr);
    gap: 8px
}

    .quick a {
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 6px;
        font-size: 12px;
        color: var(--text-2);
        font-weight: 500;
        text-align: center
    }

        .quick a .chip-ico {
            width: 52px;
            height: 52px;
            border-radius: 16px;
            background: var(--surface);
            box-shadow: var(--shadow)
        }

/* stats */
.stat {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 20px;
    padding: 14px;
    box-shadow: var(--shadow)
}

    .stat .lbl {
        display: flex;
        align-items: center;
        gap: 8px;
        color: var(--text-2);
        font-size: 13px
    }

    .stat .val {
        font-size: 26px;
        font-weight: 800;
        margin-top: 6px
    }

/* ---------- Lists ---------- */
.list {
    background: var(--surface);
    border-radius: var(--radius);
    border: 1px solid var(--line);
    box-shadow: var(--shadow);
    overflow: hidden
}

.list-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    cursor: pointer;
    width: 100%;
    background: none;
    border: 0;
    text-align: right
}

    .list-item + .list-item {
        border-top: 1px solid var(--line)
    }

    .list-item:active {
        background: var(--surface-2)
    }

    .list-item .t {
        font-weight: 600
    }

    .list-item .s {
        font-size: 12.5px;
        color: var(--text-2)
    }

    .list-item .chev {
        color: var(--text-3)
    }

/* request card */
.req {
    display: block
}

    .req .top {
        display: flex;
        align-items: flex-start;
        gap: 12px
    }

    .req .ttl {
        font-weight: 700;
        font-size: 15px
    }

    .req .meta {
        display: flex;
        flex-wrap: wrap;
        gap: 6px 14px;
        color: var(--text-2);
        font-size: 12.5px;
        margin-top: 4px
    }

        .req .meta span {
            display: inline-flex;
            align-items: center;
            gap: 4px
        }

.progress {
    height: 6px;
    border-radius: 9px;
    background: var(--surface-2);
    overflow: hidden;
    margin-top: 12px;
    border: 1px solid var(--line)
}

    .progress i {
        display: block;
        height: 100%;
        background: var(--brand);
        border-radius: 9px;
        transition: width .4s
    }

/* ---------- Badges / pills ---------- */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
    background: var(--surface-2);
    color: var(--text-2);
    border: 1px solid var(--line)
}

    .badge.brand {
        background: var(--brand-50);
        color: var(--brand);
        border-color: var(--brand-100)
    }

    .badge.ok {
        background: var(--ok-50);
        color: var(--ok);
        border-color: transparent
    }

    .badge.warn {
        background: var(--warn-50);
        color: var(--warn);
        border-color: transparent
    }

    .badge.info {
        background: var(--info-50);
        color: var(--info);
        border-color: transparent
    }

    .badge.danger {
        background: var(--danger-50);
        color: var(--danger);
        border-color: transparent
    }

.count {
    min-width: 20px;
    height: 20px;
    border-radius: 10px;
    background: var(--brand);
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    display: inline-grid;
    place-items: center;
    padding: 0 6px
}

/* tabs / segmented */
.segment {
    display: flex;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 16px;
    padding: 4px;
    gap: 4px;
    box-shadow: var(--shadow);
    overflow-x: auto;
    scrollbar-width: none
}

    .segment::-webkit-scrollbar {
        display: none
    }

    .segment > * {
        position: relative;
        flex: 1;
        border: 0;
        background: none;
        padding: 9px 12px;
        border-radius: 12px;
        font-weight: 600;
        font-size: 13.5px;
        color: var(--text-2);
        cursor: pointer;
        white-space: nowrap;
        display: inline-flex;
        gap: 6px;
        align-items: center;
        justify-content: center
    }

    .segment > .on, .segment > [aria-current="page"] {
        background: var(--active-bg);
        color: var(--active-fg)
    }

    .segment > [aria-pressed="true"] {
        background: var(--active-bg);
        color: var(--active-fg)
    }

    .segment > label:has(input:checked) {
        background: var(--active-bg);
        color: var(--active-fg)
    }

    .segment form {
        display: contents
    }

.chips {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding: 2px 0 6px;
    scrollbar-width: none
}

    .chips::-webkit-scrollbar {
        display: none
    }

.chip {
    position: relative;
    flex: none;
    border: 1px solid var(--line);
    background: var(--surface);
    border-radius: 999px;
    padding: 8px 14px;
    font-weight: 600;
    font-size: 13px;
    cursor: pointer;
    color: var(--text-2);
    display: inline-flex;
    align-items: center;
    gap: 6px
}

    .chip.on, .chip[aria-current="page"] {
        background: var(--brand);
        border-color: var(--brand);
        color: #fff
    }

    .chip:has(input:checked) {
        background: var(--brand);
        border-color: var(--brand);
        color: #fff
    }

    .chip:has(input:disabled) {
        opacity: .45;
        cursor: not-allowed
    }

.day-chip {
    position: relative;
    flex: none;
    width: 68px;
    border: 1px solid var(--line);
    background: var(--surface);
    border-radius: 16px;
    padding: 8px 4px;
    text-align: center;
    cursor: pointer;
    line-height: 1.4
}

    .day-chip b {
        display: block;
        font-size: 18px
    }

    .day-chip small {
        display: block;
        font-size: 11.5px;
        color: var(--text-2)
    }

    .day-chip:has(input:checked) {
        background: var(--brand);
        border-color: var(--brand);
        color: #fff
    }

        .day-chip:has(input:checked) small {
            color: rgba(255,255,255,.85)
        }

.slot-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px
}

    .slot-grid .chip {
        justify-content: center;
        border-radius: 14px;
        padding: 10px
    }

/* ---------- Buttons ---------- */
.btn {
    height: 52px;
    border-radius: 16px;
    border: 0;
    padding: 0 20px;
    font-weight: 700;
    font-size: 15px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background: var(--brand);
    color: #fff;
    transition: transform .12s,opacity .2s,background .2s;
    width: 100%;
}

    .btn:active {
        transform: scale(.98)
    }

    .btn[disabled] {
        opacity: .45;
        pointer-events: none
    }

    .btn.dark {
        background: var(--text);
        color: var(--bg)
    }

    .btn.ghost {
        background: var(--surface);
        color: var(--text);
        border: 1px solid var(--line)
    }

    .btn.soft {
        background: var(--brand-50);
        color: var(--brand)
    }

    .btn.white {
        background: #fff;
        color: var(--brand-600)
    }

    .btn.sm {
        height: 40px;
        border-radius: 12px;
        font-size: 13.5px;
        padding: 0 14px;
        width: auto
    }

    .btn.danger {
        background: var(--danger-50);
        color: var(--danger)
    }

.btn-row {
    display: flex;
    gap: 10px
}

    .btn-row .btn {
        flex: 1
    }

.cta-bar {
    position: fixed;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    max-width: 480px;
    z-index: 25;
    padding: 12px 16px calc(12px + var(--safe-b));
    background: color-mix(in srgb,var(--bg) 90%,transparent);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-top: 1px solid var(--line);
}

/* ---------- Forms ---------- */
.field {
    margin-bottom: 14px
}

    .field > label, .label {
        display: block;
        font-weight: 600;
        font-size: 13.5px;
        margin: 0 4px 6px;
        color: var(--text)
    }

        .label .opt {
            color: var(--text-3);
            font-weight: 400
        }

.input, .select, .textarea {
    width: 100%;
    height: 52px;
    border-radius: 16px;
    border: 1.5px solid var(--line);
    background: var(--surface);
    padding: 0 16px;
    font-size: 15px;
    outline: none;
    transition: border-color .15s,box-shadow .15s;
}

.textarea {
    height: auto;
    min-height: 104px;
    padding: 12px 16px;
    resize: vertical;
    line-height: 1.8
}

.select {
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' fill='none' stroke='%239A9AA5' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
    background-position: left 14px center;
    background-size: 20px;
    background-repeat: no-repeat;
    padding-left: 44px
}

    .input:focus, .select:focus, .textarea:focus {
        border-color: var(--brand);
        box-shadow: 0 0 0 4px var(--brand-50)
    }

.input.ltr {
    direction: ltr;
    text-align: left;
    letter-spacing: .5px
}

.field.err .input, .field.err .select, .field.err .textarea {
    border-color: var(--danger);
    box-shadow: 0 0 0 4px var(--danger-50)
}

.field .hint {
    font-size: 12px;
    color: var(--text-3);
    margin: 6px 6px 0
}

.field .error {
    font-size: 12.5px;
    color: var(--danger);
    margin: 6px 6px 0;
    display: none
}

.field.err .error {
    display: block
}

.input:user-invalid, .select:user-invalid, .textarea:user-invalid {
    border-color: var(--danger)
}

.check {
    width: 22px;
    height: 22px;
    accent-color: var(--brand);
    flex: none
}

.check-label {
    font-weight: 500;
    cursor: pointer
}

.input-wrap {
    position: relative
}

    .input-wrap .ico {
        position: absolute;
        right: 16px;
        top: 15px;
        color: var(--text-3)
    }

    .input-wrap .input {
        padding-right: 48px
    }

    .input-wrap .suffix {
        position: absolute;
        left: 16px;
        top: 14px;
        color: var(--text-3);
        font-size: 14px
    }

.input.otp-input {
    height: 62px;
    text-align: center;
    direction: ltr;
    font-size: 26px;
    font-weight: 700;
    letter-spacing: .6em;
    padding: 0 0 0 .6em
}


.type-pick {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px
}

    .type-pick label {
        cursor: pointer
    }

    .type-pick input {
        position: absolute;
        opacity: 0;
        pointer-events: none
    }

    .type-pick .opt-card small {
        font-weight: 500
    }

    .type-pick .opt-card {
        border: 1.5px solid var(--line);
        background: var(--surface);
        border-radius: 18px;
        padding: 14px;
        display: flex;
        align-items: center;
        gap: 10px;
        font-weight: 700;
        transition: all .15s
    }

    .type-pick input:checked + .opt-card {
        border-color: var(--brand);
        background: var(--brand-50);
        color: var(--brand)
    }

        .type-pick input:checked + .opt-card .chip-ico {
            background: var(--brand);
            color: #fff;
            border-color: var(--brand)
        }

/* photo uploader */
.photos {
    display: grid;
    grid-template-columns: repeat(3,1fr);
    gap: 8px
}

.photo {
    aspect-ratio: 1;
    border-radius: 14px;
    overflow: hidden;
    position: relative;
    background: var(--surface-2);
    border: 1px solid var(--line)
}

    .photo a {
        display: block;
        height: 100%
    }

    .photo img {
        width: 100%;
        height: 100%;
        object-fit: cover;
        cursor: zoom-in
    }

.photo-add {
    position: relative;
    aspect-ratio: 1;
    border-radius: 14px;
    border: 1.5px dashed var(--text-3);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    color: var(--text-2);
    font-size: 12px;
    cursor: pointer;
    background: var(--surface)
}

/* signature */
.sig-wrap {
    border: 1.5px dashed var(--text-3);
    border-radius: 18px;
    background: #fff;
    position: relative;
    touch-action: none;
    overflow: hidden
}

    .sig-wrap canvas {
        display: block;
        width: 100%;
        height: 220px
    }

    .sig-wrap .ph {
        position: absolute;
        inset: 0;
        display: grid;
        place-items: center;
        color: #9A9AA5;
        pointer-events: none;
        font-size: 14px
    }

.sig-img {
    background: #fff;
    border-radius: 14px;
    border: 1px solid var(--line);
    padding: 6px
}

/* steps (wizard) */
.steps {
    display: flex;
    gap: 6px;
    margin: 4px 0 16px
}

    .steps i {
        flex: 1;
        height: 5px;
        border-radius: 9px;
        background: var(--line)
    }

        .steps i.on {
            background: var(--brand)
        }

/* timeline */
.timeline {
    position: relative;
    padding-right: 6px
}

.tl {
    position: relative;
    padding: 0 30px 18px 0
}

    .tl:last-child {
        padding-bottom: 0
    }

    .tl::before {
        content: "";
        position: absolute;
        right: 9px;
        top: 22px;
        bottom: -2px;
        width: 2px;
        background: var(--line)
    }

    .tl:last-child::before {
        display: none
    }

    .tl .dot {
        position: absolute;
        right: 0;
        top: 3px;
        width: 20px;
        height: 20px;
        border-radius: 50%;
        background: var(--surface);
        border: 2px solid var(--line);
        display: grid;
        place-items: center
    }

    .tl.done .dot {
        background: var(--ok);
        border-color: var(--ok);
        color: #fff
    }

    .tl.done::before {
        background: var(--ok)
    }

    .tl.current .dot {
        border-color: var(--brand);
        background: var(--brand-50)
    }

        .tl.current .dot::after {
            content: "";
            width: 8px;
            height: 8px;
            border-radius: 50%;
            background: var(--brand);
            animation: pulse 1.4s infinite
        }

    .tl.stop .dot {
        background: var(--danger);
        border-color: var(--danger);
        color: #fff
    }

@keyframes pulse {
    50% {
        transform: scale(1.5);
        opacity: .5
    }
}

.tl .t {
    font-weight: 700;
    font-size: 14px
}

.tl.todo .t {
    color: var(--text-3);
    font-weight: 500
}

.tl .d {
    font-size: 12px;
    color: var(--text-2)
}

.tl .n {
    font-size: 13px;
    color: var(--text-2);
    margin-top: 4px;
    background: var(--surface-2);
    border-radius: 12px;
    padding: 8px 10px
}

/* key-value */
.kv {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 8px 16px;
    font-size: 14px
}

    .kv dt {
        color: var(--text-2)
    }

    .kv dd {
        margin: 0;
        font-weight: 600;
        text-align: left;
        word-break: break-word
    }

/* empty */
.empty {
    text-align: center;
    padding: 36px 20px;
    color: var(--text-2)
}

    .empty .chip-ico {
        width: 64px;
        height: 64px;
        border-radius: 22px;
        margin: 0 auto 12px
    }

    .empty h3 {
        color: var(--text);
        margin: 0 0 4px;
        font-size: 16px
    }

    .empty p {
        margin: 0 0 14px;
        font-size: 13.5px
    }

/* notice */
.notice {
    display: flex;
    gap: 10px;
    padding: 12px 14px;
    border-radius: 16px;
    background: var(--info-50);
    color: var(--info);
    font-size: 13px;
    line-height: 1.8
}

    .notice.warn {
        background: var(--warn-50);
        color: var(--warn)
    }

    .notice.brand {
        background: var(--brand-50);
        color: var(--brand)
    }

    .notice.ok {
        background: var(--ok-50);
        color: var(--ok)
    }

    .notice .ico {
        margin-top: 2px
    }

/* rating */
.stars {
    display: flex;
    gap: 6px;
    justify-content: center;
    direction: ltr
}

    .stars > * {
        position: relative;
        padding: 2px;
        color: var(--line)
    }

    .stars label {
        cursor: pointer
    }

        .stars .on, .stars label:has(input:checked), .stars label:has(~ label input:checked) {
            color: #F5B301
        }

            .stars .on .ico, .stars label:has(input:checked) .ico, .stars label:has(~ label input:checked) .ico {
                fill: #F5B301
            }

    .stars .ico {
        width: 36px;
        height: 36px
    }

    .stars.ro .ico {
        width: 16px;
        height: 16px
    }

/* accordion */
details.acc {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 18px;
    padding: 0 16px;
    box-shadow: var(--shadow)
}

    details.acc + details.acc {
        margin-top: 10px
    }

    details.acc summary {
        list-style: none;
        padding: 14px 0;
        font-weight: 600;
        cursor: pointer;
        display: flex;
        align-items: center;
        gap: 10px
    }

        details.acc summary::-webkit-details-marker {
            display: none
        }

        details.acc summary .ico {
            margin-right: auto;
            transition: transform .2s;
            color: var(--text-3)
        }

    details.acc[open] summary .ico {
        transform: rotate(-90deg)
    }

    details.acc .body {
        padding: 0 0 14px;
        color: var(--text-2);
        font-size: 14px;
        white-space: pre-line
    }

/* ---------- Overlays ---------- */
.toast-host {
    position: fixed;
    top: calc(12px + var(--safe-t));
    left: 50%;
    transform: translateX(-50%);
    z-index: 100;
    width: min(440px,calc(100% - 24px));
    display: flex;
    flex-direction: column;
    gap: 8px;
    pointer-events: none
}

.toast {
    pointer-events: auto;
    animation: tin .25s ease-out,tout .3s 4s forwards;
    background: var(--text);
    color: var(--bg);
    border-radius: 16px;
    padding: 12px 16px;
    box-shadow: var(--shadow-lg);
    font-size: 14px;
    display: flex;
    gap: 10px;
    align-items: center
}

    .toast.ok {
        background: var(--ok);
        color: #fff
    }

    .toast.err {
        background: var(--danger);
        color: #fff
    }

@keyframes tin {
    from {
        transform: translateY(-12px);
        opacity: 0
    }
}

@keyframes tout {
    to {
        opacity: 0;
        visibility: hidden
    }
}

@keyframes fade {
    from {
        opacity: 0
    }
}
/* Bottom sheet: <div class="sheet" popover> opens from a popovertarget button;
   <dialog class="sheet" open> is rendered open by the server (e.g. "submitted" message) and closes with <form method="dialog">. */
.sheet {
    position: fixed;
    z-index: 90;
    inset: auto auto 0 50%;
    transform: translateX(-50%);
    margin: 0;
    border: 0;
    width: 100%;
    max-width: 480px;
    background: var(--surface);
    color: var(--text);
    border-radius: 26px 26px 0 0;
    padding: 10px 16px calc(18px + var(--safe-b));
    box-shadow: var(--shadow-lg);
    max-height: 88dvh;
    overflow: auto;
}
    /* Closed sheets are hidden in every browser (also without the Popover API).
   :popover-open and .popover-open rules are kept separate on purpose: older browsers drop a rule with an unknown selector. */
    .sheet[popover] {
        display: none
    }

        .sheet[popover]:popover-open {
            display: block;
            animation: up .28s cubic-bezier(.2,.9,.3,1)
        }
        /* Fallback for browsers without the Popover API (assets/js/popover-fallback.js) */
        .sheet[popover].popover-open {
            display: block;
            animation: up .28s cubic-bezier(.2,.9,.3,1);
            box-shadow: 0 0 0 100vmax var(--backdrop),var(--shadow-lg)
        }

html.sheet-lock {
    overflow: hidden
}

.sheet::backdrop {
    background: var(--backdrop)
}

dialog.sheet[open] {
    animation: up .28s cubic-bezier(.2,.9,.3,1);
    box-shadow: 0 0 0 100vmax var(--backdrop),var(--shadow-lg)
}

html:has(dialog.sheet[open]) {
    overflow: hidden
}

html:has(.sheet:popover-open) {
    overflow: hidden
}

.sheet .grab {
    width: 44px;
    height: 5px;
    border-radius: 9px;
    background: var(--line);
    margin: 0 auto 12px
}

.sheet h3 {
    margin: 0 0 6px;
    font-size: 17px
}

@keyframes up {
    from {
        transform: translate(-50%,100%)
    }
}

/* ---------- Auth ---------- */
.auth {
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    padding: calc(24px + var(--safe-t)) 20px calc(24px + var(--safe-b))
}

    .auth .brandmark {
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 10px;
        margin: 28px 0 30px
    }

        .auth .brandmark .logo-box {
            display: grid;
            place-items: center;
            margin-bottom: 50px;
        }

            .auth .brandmark .logo-box img {
                width: 40%
            }

        .auth .brandmark h1 {
            margin: 6px 0 0;
            font-size: 22px;
            font-weight: 800
        }

        .auth .brandmark p {
            margin: 0;
            color: var(--text-2);
            font-size: 14px;
            text-align: justify;
        }

    .auth .foot {
        margin-top: auto;
        text-align: center;
        font-size: 12.5px;
        color: var(--text-3);
        padding-top: 20px
    }

/* splash */
.splash {
    min-height: 100dvh;
    display: grid;
    place-items: center;
    background: linear-gradient(160deg,#F2323A,#B3111A)
}

    .splash img {
        width: 180px;
        animation: fade .6s
    }

/* greeting */
.greet {
    display: flex;
    align-items: center;
    gap: 12px
}

.avatar {
    width: 44px;
    height: 44px;
    border-radius: 14px;
    background: var(--brand-50);
    color: var(--brand);
    display: grid;
    place-items: center;
    font-weight: 800;
    font-size: 17px;
    flex: none;
    border: 1px solid var(--brand-100)
}

    .avatar.logo {
        background: var(--surface);
        border-color: var(--line);
        box-shadow: var(--shadow)
    }

        .avatar.logo img {
            width: 30px;
            height: 30px;
            object-fit: contain
        }

.greet .hello {
    font-size: 12.5px;
    color: var(--text-2);
    line-height: 1.4
}

.greet .name {
    font-size: 17px;
    font-weight: 800;
    line-height: 1.4
}

.logo-inline {
    height: 22px
}

/* agent contact card */
.agent-card .name {
    font-weight: 700
}

.agent-card .addr {
    font-size: 13px;
    color: var(--text-2);
    margin-top: 2px
}

.agent-card .acts {
    display: flex;
    gap: 8px;
    margin-top: 12px
}

    .agent-card .acts .btn {
        flex: 1
    }

/* misc */
.price {
    font-size: 22px;
    font-weight: 800
}

/* ---------- Tickets ---------- */
.chip-ico.danger {
    background: var(--danger-50);
    color: var(--danger);
    border-color: transparent
}

.chips.wrap {
    flex-wrap: wrap;
    overflow: visible
}

.carpet-row {
    border: 1px solid var(--line);
    border-radius: 16px;
    padding: 12px;
    margin-top: 10px;
    background: var(--surface-2)
}

    .carpet-row .grid-2 {
        gap: 8px
    }

    .carpet-row .input {
        height: 44px;
        font-size: 14px
    }

.tbl-wrap {
    overflow-x: auto;
    margin-top: 6px;
    border: 1px solid var(--line);
    border-radius: 14px
}

.tbl {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
    min-width: 460px
}

    .tbl th, .tbl td {
        padding: 8px 10px;
        text-align: right;
        border-bottom: 1px solid var(--line);
        white-space: nowrap
    }

    .tbl th {
        background: var(--surface-2);
        color: var(--text-2);
        font-weight: 600
    }

    .tbl tr:last-child td {
        border-bottom: 0
    }

.subj-pick {
    position: relative;
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    text-align: right;
    border: 1.5px solid var(--line);
    background: var(--surface);
    border-radius: 18px;
    padding: 12px 14px;
    cursor: pointer;
    font: inherit;
    color: inherit
}

    .subj-pick + .subj-pick {
        margin-top: 8px
    }

    .subj-pick:has(input:checked) {
        border-color: var(--brand);
        background: var(--brand-50)
    }

    .subj-pick .pick-check {
        display: none;
        color: var(--brand)
    }

    .subj-pick:has(input:checked) .pick-check {
        display: block
    }

    .subj-pick .t {
        font-weight: 700;
        font-size: 14px
    }

    .subj-pick .s {
        font-size: 12px;
        color: var(--text-3);
        margin-top: 2px
    }

.auto-note {
    display: flex;
    gap: 6px;
    align-items: center;
    font-size: 12px;
    color: var(--text-3);
    margin-top: 10px
}

.chat {
    display: flex;
    flex-direction: column;
    gap: 8px
}

.msg {
    max-width: 85%;
    align-self: flex-start;
    background: var(--surface-2);
    border-radius: 16px 16px 16px 4px;
    padding: 8px 12px
}

    .msg.mine {
        align-self: flex-end;
        background: var(--brand-50);
        border-radius: 16px 16px 4px 16px
    }

    .msg .who {
        font-size: 12px;
        font-weight: 700
    }

    .msg .txt {
        font-size: 14px;
        line-height: 1.8;
        white-space: pre-wrap;
        word-break: break-word
    }

    .msg .at {
        font-size: 11px;
        color: var(--text-3)
    }

.chat-input {
    display: flex;
    gap: 8px;
    align-items: flex-end
}

    .chat-input .textarea {
        min-height: 46px;
        height: 46px;
        flex: 1;
        resize: none
    }

    .chat-input .btn {
        height: 46px;
        width: 46px;
        padding: 0;
        flex: none
    }

.noshow-list {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 8px
}

.print-head {
    display: none
}

@media print {
    @page {
        size: A4;
        margin: 12mm
    }

    html, body {
        background: #fff !important;
        color: #000 !important
    }

    .topbar, .bottom-nav, .cta-bar, .toast-host, .no-print, .chat-input, button, .btn {
        display: none !important
    }

    .app {
        max-width: none !important;
        box-shadow: none !important
    }

    .content {
        padding: 0 !important
    }

    .print-head {
        display: flex;
        justify-content: space-between;
        align-items: center;
        border: 1.5px solid #000;
        padding: 8px 12px;
        margin-bottom: 10px
    }

        .print-head img {
            height: 28px
        }

        .print-head h1 {
            font-size: 16px;
            margin: 0
        }

    .card {
        box-shadow: none !important;
        border: 1px solid #000 !important;
        break-inside: avoid;
        margin-top: 8px;
        padding: 10px;
        background: #fff !important
    }

    .section-title {
        margin: 10px 0 0
    }

        .section-title h2 {
            font-size: 14px
        }

    .kv {
        font-size: 12px
    }

    .photos .photo {
        width: 70px;
        height: 70px
    }

    .tbl {
        font-size: 11px;
        min-width: 0
    }

        .tbl th, .tbl td {
            border: 1px solid #000;
            color: #000;
            background: #fff
        }

    .badge, .chip-ico, .progress {
        display: none !important
    }

    .noshow-list .badge {
        display: inline-block !important;
        border: 1px solid #000;
        background: #fff;
        color: #000
    }

    .sig-img {
        max-height: 70px
    }
}

/* ---------- Visually hidden inputs inside custom pickers (radio / checkbox / file) ---------- */
.chip input, .day-chip input, .segment input, .subj-pick input, .stars input, .photo-add input {
    position: absolute;
    opacity: 0;
    width: 1px;
    height: 1px;
    pointer-events: none
}

.chip:has(input:focus-visible), .day-chip:has(input:focus-visible), .segment > label:has(input:focus-visible), .subj-pick:has(input:focus-visible), .stars label:has(input:focus-visible), .photo-add:has(input:focus-visible) {
    outline: 2px solid var(--brand);
    outline-offset: 2px
}

/* New ticket: show the target list that matches the chosen target type, without JavaScript */
.targets {
    display: none
}

form:has(input[name="targetType"][value="agent"]:checked) .targets-agent,
form:has(input[name="targetType"][value="visit"]:checked) .targets-visit,
form:has(input[name="targetType"][value="wash"]:checked) .targets-wash {
    display: block
}

/* Repeatable rows (carpet sizes, carpet table): the remove button is hidden while only one row exists */
[data-repeat] > [data-row]:only-of-type [data-repeat-remove] {
    display: none
}

/* ---------- Utilities (replace inline styles) ---------- */
.grow {
    flex: 1;
    min-width: 0
}

h3 small {
    font-weight: 500
}

.code {
    font-size: 15px;
    letter-spacing: 1px;
    color: var(--brand);
    font-weight: 600;
    user-select: all;
    font-feature-settings: "tnum";
    direction: ltr;
    unicode-bidi: isolate
}

.spaced {
    letter-spacing: 3px
}

.req .next {
    border-top: 1px solid var(--line);
    padding-top: 10px
}

    .req .next > span {
        font-weight: 700;
        color: var(--brand)
    }

.desc {
    white-space: pre-wrap;
    line-height: 1.9;
    margin: 12px 0 0
}

.chip-ico.sm {
    width: 32px;
    height: 32px;
    border-radius: 10px
}

.chip-ico.md {
    width: 36px;
    height: 36px
}

.chip-ico.xl {
    width: 64px;
    height: 64px;
    border-radius: 22px;
    margin: 4px auto 10px
}

.tags {
    flex-wrap: wrap;
    gap: 6px
}

.list-item.unread {
    background: var(--brand-50)
}

.card.brand {
    border-color: var(--brand-100);
    background: var(--brand-50)
}

.card.compact {
    padding: 12px
}

.m-0 {
    margin: 0
}

.flush-b {
    margin-bottom: 0
}

.p-8 {
    padding: 8px
}

.gap-12 {
    gap: 12px
}

.name-lg {
    font-weight: 800;
    font-size: 17px
}

.avatar.lg {
    width: 56px;
    height: 56px;
    font-size: 22px
}

.hero-logo {
    height: 26px;
    margin-bottom: 10px
}

.hero.lg {
    padding: 28px 20px
}

.about-logo {
    height: 40px;
    margin: 0 auto 12px
}

.brand-text {
    color: var(--brand)
}

.ellipsis {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis
}

.type-pick.one {
    display: block
}

.terms {
    margin: 0;
    padding-right: 20px;
    line-height: 2
}

.center-screen {
    display: grid;
    place-items: center;
    min-height: 100dvh
}

.input.compact {
    height: 46px
}

.icon-btn.flat {
    box-shadow: none;
    width: 40px;
    height: 40px
}

.map-addr {
    user-select: all
}

.pre-line {
    white-space: pre-line
}

@media (prefers-reduced-motion:reduce) {
    * {
        animation-duration: 0s !important;
        transition: none !important
    }
}
