*,
*::before,
*::after {
    box-sizing: border-box;
}

:root {
    --bg: #f7f6fb;
    --card: rgba(255,255,255,0.88);
    --card-solid: #ffffff;
    --text: #24163f;
    --muted: #6e6388;
    --line: rgba(103, 53, 194, 0.09);
    --orange: #ff8a33;
    --orange-deep: #ff6a00;
    --purple: #7c3aed;
    --purple-deep: #5925dc;
    --success: #14b87a;
    --danger: #ef4444;
    --warning: #f59e0b;
    --shadow: 0 18px 50px rgba(76, 29, 149, 0.12);
    --radius: 24px;
    --radius-sm: 18px;
    --safe-bottom: calc(92px + env(safe-area-inset-bottom));
}

html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    background:
        radial-gradient(circle at top right, rgba(124, 58, 237, 0.08), transparent 28%),
        radial-gradient(circle at top left, rgba(255, 138, 51, 0.12), transparent 25%),
        var(--bg);
    color: var(--text);
    overflow-x: hidden;
}

body.dark-mode {
    --bg: #120d1f;
    --card: rgba(30, 22, 50, 0.86);
    --card-solid: #1d1630;
    --text: #f4eeff;
    --muted: #b8a9d5;
    --line: rgba(255, 255, 255, 0.06);
    --shadow: 0 18px 50px rgba(0, 0, 0, 0.35);
}

img,
canvas,
svg {
    max-width: 100%;
    display: block;
}

a {
    color: inherit;
    text-decoration: none;
}

button,
input,
select,
textarea {
    font: inherit;
}

button,
.btn,
.icon-btn,
summary,
.nav-item {
    -webkit-tap-highlight-color: transparent;
}

.auth-body,
.app-body {
    min-height: 100vh;
}

.auth-shell,
.app-shell {
    width: 100%;
    max-width: 560px;
    margin: 0 auto;
    padding: 18px 16px var(--safe-bottom);
}

.auth-shell {
    display: flex;
    align-items: center;
    min-height: 100vh;
}

.auth-card,
.mobile-header,
.hero-card,
.stat-card,
.summary-card,
.form-card,
.service-card,
.booking-card,
.chart-card,
.popular-card,
.audit-item,
.reminder-card,
.showcase-box,
.soft-note {
    background: var(--card);
    backdrop-filter: blur(14px);
    border: 1px solid var(--line);
    box-shadow: var(--shadow);
}

.auth-card {
    width: 100%;
    border-radius: 32px;
    padding: 24px;
    position: relative;
    overflow: hidden;
}

.glass::before {
    content: "";
    position: absolute;
    inset: -20% auto auto -10%;
    width: 180px;
    height: 180px;
    border-radius: 999px;
    background: radial-gradient(circle, rgba(255, 138, 51, 0.24), transparent 70%);
    pointer-events: none;
}

.auth-hero h1,
.mobile-header h1,
.section-head h2,
.hero-copy h2 {
    margin: 0;
    line-height: 1.15;
}

.auth-hero h1 {
    font-size: clamp(1.9rem, 4vw, 2.7rem);
    margin-top: 12px;
}

.auth-hero p,
.section-head p,
.hero-copy p,
.service-card p,
.booking-note,
.audit-content p,
.showcase-box p,
.soft-note,
.reminder-card p,
.stat-card small,
.summary-card .summary-label,
.popular-card span {
    color: var(--muted);
    line-height: 1.55;
}

.mini-pill,
.chip,
.price-badge,
.rating-pill,
.meta-pill,
.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    border-radius: 999px;
    font-weight: 700;
    white-space: nowrap;
}

.mini-pill {
    background: rgba(124, 58, 237, 0.12);
    color: var(--purple);
    padding: 9px 12px;
    font-size: 0.8rem;
}

.showcase-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
    margin: 22px 0;
}

.showcase-box {
    border-radius: 22px;
    padding: 16px;
}

.showcase-icon {
    width: 48px;
    height: 48px;
    border-radius: 16px;
    display: grid;
    place-items: center;
    font-size: 1.3rem;
    background: linear-gradient(135deg, rgba(255,138,51,.16), rgba(124,58,237,.18));
    margin-bottom: 12px;
}

.demo-login-stack {
    display: grid;
    gap: 12px;
    margin: 18px 0 16px;
}

.btn {
    border: 0;
    border-radius: 18px;
    padding: 15px 18px;
    font-weight: 800;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    cursor: pointer;
    transition: transform .18s ease, box-shadow .18s ease, opacity .18s ease, filter .18s ease;
}

.btn:active,
.icon-btn:active,
.tap-target:active,
.nav-item:active {
    transform: scale(.98);
    filter: brightness(.98);
}

.btn:hover,
.icon-btn:hover {
    transform: translateY(-1px);
}

.btn-primary {
    color: #fff;
    background: linear-gradient(135deg, var(--orange), var(--purple));
    box-shadow: 0 16px 28px rgba(124, 58, 237, 0.24);
}

.btn-secondary {
    color: #fff;
    background: linear-gradient(135deg, var(--purple), var(--purple-deep));
    box-shadow: 0 16px 28px rgba(89, 37, 220, 0.24);
}

.btn-outline,
.btn-soft {
    background: rgba(124, 58, 237, 0.08);
    color: var(--purple);
    border: 1px solid rgba(124, 58, 237, 0.12);
}

.btn-danger {
    color: #fff;
    background: linear-gradient(135deg, #ff6767, #ef4444);
}

.btn-xl,
.btn-block {
    width: 100%;
}

.soft-note {
    padding: 16px;
    border-radius: 24px;
}

.note-title {
    font-weight: 800;
    margin-bottom: 12px;
}

.chip-row,
.booking-meta-stack,
.service-meta,
.popular-list,
.report-cards {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.chip {
    padding: 8px 12px;
    background: rgba(255, 138, 51, 0.1);
    color: var(--orange-deep);
    font-size: 0.82rem;
}

.mobile-header {
    position: sticky;
    top: 12px;
    z-index: 20;
    border-radius: 26px;
    padding: 16px 18px;
    margin-bottom: 18px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
}

.mobile-header h1 {
    font-size: clamp(1.4rem, 4vw, 1.9rem);
    margin-top: 4px;
}

.eyebrow {
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--muted);
}

.header-actions {
    display: flex;
    gap: 10px;
    flex-shrink: 0;
}

.icon-btn {
    width: 46px;
    height: 46px;
    border-radius: 16px;
    border: 1px solid var(--line);
    display: grid;
    place-items: center;
    background: var(--card-solid);
    box-shadow: var(--shadow);
    color: var(--text);
}

.app-container {
    display: grid;
    gap: 18px;
}

.section-block {
    display: grid;
    gap: 14px;
}

.hero-card {
    border-radius: 28px;
    padding: 22px;
    position: relative;
    overflow: hidden;
    min-height: 180px;
}

.gradient-card {
    background:
        linear-gradient(135deg, rgba(255,255,255,.80), rgba(255,255,255,.56)),
        linear-gradient(135deg, rgba(255,138,51,.18), rgba(124,58,237,.2));
}

body.dark-mode .gradient-card {
    background:
        linear-gradient(135deg, rgba(29,22,48,.92), rgba(29,22,48,.86)),
        linear-gradient(135deg, rgba(255,138,51,.18), rgba(124,58,237,.22));
}

.hero-copy {
    position: relative;
    z-index: 2;
    max-width: 92%;
}

.hero-copy h2 {
    font-size: clamp(1.4rem, 4vw, 2rem);
    margin: 12px 0 10px;
}

.orb-stack {
    position: absolute;
    inset: auto 10px 0 auto;
    width: 140px;
    height: 140px;
    pointer-events: none;
}

.orb {
    position: absolute;
    border-radius: 999px;
    filter: blur(1px);
    opacity: .8;
}

.orb-orange {
    width: 86px;
    height: 86px;
    background: radial-gradient(circle, rgba(255,138,51,.88), rgba(255,138,51,.16));
    right: 18px;
    bottom: 12px;
}

.orb-purple {
    width: 110px;
    height: 110px;
    background: radial-gradient(circle, rgba(124,58,237,.72), rgba(124,58,237,.1));
    right: 42px;
    bottom: 42px;
}

.section-head {
    display: flex;
    align-items: end;
    justify-content: space-between;
    gap: 14px;
}

.section-head h2 {
    font-size: 1.2rem;
    margin-bottom: 4px;
}

.stats-grid,
.icon-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.stat-card,
.summary-card,
.chart-card,
.form-card,
.service-card,
.booking-card,
.audit-item,
.reminder-card {
    border-radius: 24px;
    padding: 16px;
}

.stat-card {
    min-height: 124px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.stat-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    color: var(--muted);
    font-weight: 700;
    gap: 10px;
}

.stat-number {
    font-size: clamp(1.7rem, 5vw, 2.15rem);
    font-weight: 900;
    line-height: 1;
}

.stat-text {
    font-size: 1.05rem;
    font-weight: 800;
    line-height: 1.3;
}

.summary-card {
    flex: 1 1 calc(50% - 10px);
    min-width: 110px;
}

.summary-card strong {
    display: block;
    margin-top: 8px;
    font-size: 1.45rem;
}

.chart-card canvas {
    width: 100%;
    border-radius: 18px;
    margin-top: 12px;
}

.chart-head h3,
.popular-services h3,
.service-card h3,
.booking-card h3,
.audit-content strong {
    margin: 0;
}

.popular-list {
    display: grid;
    gap: 12px;
}

.popular-card {
    border-radius: 20px;
    padding: 14px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.popular-main {
    display: grid;
    gap: 4px;
}

.rating-pill {
    padding: 8px 12px;
    background: rgba(255, 138, 51, 0.12);
    color: var(--orange-deep);
    font-size: 0.82rem;
}

.form-card {
    display: grid;
    gap: 14px;
}

.field-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
}

.field {
    display: grid;
    gap: 8px;
    min-width: 0;
}

.field span {
    font-size: 0.9rem;
    font-weight: 700;
}

input,
select,
textarea {
    width: 100%;
    min-width: 0;
    border: 1px solid rgba(124, 58, 237, 0.12);
    background: var(--card-solid);
    color: var(--text);
    border-radius: 16px;
    padding: 14px 14px;
    outline: none;
    transition: border-color .18s ease, box-shadow .18s ease, transform .18s ease;
}

input:focus,
select:focus,
textarea:focus {
    border-color: rgba(124, 58, 237, 0.42);
    box-shadow: 0 0 0 4px rgba(124, 58, 237, 0.08);
}

textarea {
    resize: vertical;
}

.service-card-list,
.booking-card-list,
.audit-list {
    display: grid;
    gap: 12px;
}

.service-card {
    display: grid;
    grid-template-columns: 62px 1fr;
    gap: 14px;
}

.service-card.compact {
    grid-template-columns: 54px 1fr;
}

.service-icon {
    width: 54px;
    height: 54px;
    border-radius: 18px;
    display: grid;
    place-items: center;
    font-size: 1.55rem;
    background: linear-gradient(135deg, rgba(255,138,51,.18), rgba(124,58,237,.14));
    box-shadow: inset 0 1px 0 rgba(255,255,255,.24);
}

.service-title-row,
.service-footer,
.booking-top {
    display: flex;
    align-items: start;
    justify-content: space-between;
    gap: 10px;
}

.service-body {
    min-width: 0;
    display: grid;
    gap: 10px;
}

.service-meta {
    color: var(--muted);
    font-size: 0.86rem;
}

.price-badge {
    padding: 8px 11px;
    background: rgba(124, 58, 237, 0.1);
    color: var(--purple);
    font-size: 0.8rem;
}

.meta-pill {
    padding: 9px 12px;
    background: rgba(124, 58, 237, 0.08);
    color: var(--purple);
    font-size: 0.82rem;
}

.status-badge {
    padding: 10px 12px;
    font-size: 0.78rem;
    justify-content: center;
}

.badge-waiting {
    background: rgba(245,158,11,.14);
    color: #b45309;
}

.badge-confirmed {
    background: rgba(99,102,241,.14);
    color: #4338ca;
}

.badge-done {
    background: rgba(20,184,122,.14);
    color: #047857;
}

.badge-cancelled {
    background: rgba(239,68,68,.14);
    color: #b91c1c;
}

.booking-card {
    display: grid;
    gap: 14px;
}

.booking-top small {
    color: var(--muted);
    display: block;
    margin-bottom: 4px;
}

.booking-note {
    margin: 0;
    padding: 12px 14px;
    border-radius: 16px;
    background: rgba(255, 138, 51, 0.08);
}

.status-form,
.mini-form {
    display: grid;
    gap: 12px;
}

.inline-editor {
    border-radius: 18px;
    background: rgba(124, 58, 237, 0.04);
    border: 1px dashed rgba(124, 58, 237, 0.16);
    padding: 10px 12px;
}

summary {
    cursor: pointer;
    font-weight: 800;
    list-style: none;
    padding: 2px 0 6px;
}

summary::-webkit-details-marker {
    display: none;
}

.button-row {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.reminder-head {
    display: flex;
    gap: 12px;
    align-items: center;
}

.reminder-icon {
    width: 48px;
    height: 48px;
    border-radius: 16px;
    display: grid;
    place-items: center;
    background: linear-gradient(135deg, rgba(255,138,51,.18), rgba(124,58,237,.14));
}

.reminder-list {
    display: grid;
    gap: 10px;
    margin-top: 14px;
}

.reminder-item {
    border-radius: 16px;
    padding: 12px 14px;
    background: rgba(255,255,255,0.48);
    display: grid;
    gap: 4px;
}

body.dark-mode .reminder-item {
    background: rgba(255,255,255,0.04);
}

.audit-list {
    gap: 10px;
}

.audit-item {
    display: flex;
    gap: 12px;
    align-items: start;
}

.audit-bullet {
    width: 12px;
    height: 12px;
    border-radius: 999px;
    margin-top: 6px;
    flex-shrink: 0;
    background: linear-gradient(135deg, var(--orange), var(--purple));
    box-shadow: 0 0 0 6px rgba(124, 58, 237, 0.08);
}

.audit-content {
    min-width: 0;
}

.audit-content small {
    color: var(--muted);
}

.bottom-nav {
    position: fixed;
    left: 50%;
    bottom: 10px;
    transform: translateX(-50%);
    width: calc(100% - 24px);
    max-width: 528px;
    padding: 10px;
    border-radius: 24px;
    background: rgba(255,255,255,.84);
    backdrop-filter: blur(18px);
    border: 1px solid rgba(124, 58, 237, 0.08);
    box-shadow: 0 18px 38px rgba(24, 18, 43, 0.14);
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 8px;
    z-index: 30;
}

.customer-app + .bottom-nav,
body .bottom-nav {
    padding-bottom: calc(10px + env(safe-area-inset-bottom));
}

body.dark-mode .bottom-nav {
    background: rgba(29,22,48,.9);
}

.nav-item {
    min-width: 0;
    border-radius: 18px;
    padding: 10px 8px;
    display: grid;
    place-items: center;
    gap: 4px;
    color: var(--muted);
    font-weight: 700;
    transition: background .18s ease, color .18s ease, transform .18s ease;
}

.nav-item.active,
.nav-item:hover {
    background: linear-gradient(135deg, rgba(255,138,51,.15), rgba(124,58,237,.14));
    color: var(--text);
}

.nav-item small {
    font-size: 0.69rem;
    line-height: 1;
    white-space: nowrap;
}

.toast {
    position: fixed;
    left: 50%;
    bottom: calc(96px + env(safe-area-inset-bottom));
    transform: translate(-50%, 16px);
    width: calc(100% - 32px);
    max-width: 520px;
    padding: 14px 16px;
    border-radius: 18px;
    color: #fff;
    opacity: 0;
    pointer-events: none;
    box-shadow: 0 14px 32px rgba(0,0,0,0.22);
    z-index: 60;
    transition: opacity .26s ease, transform .26s ease;
}

.toast.show {
    opacity: 1;
    transform: translate(-50%, 0);
}

.toast.success {
    background: linear-gradient(135deg, #14b87a, #0f9f69);
}

.toast.error {
    background: linear-gradient(135deg, #ef4444, #d61f69);
}

.fade-up {
    opacity: 0;
    transform: translateY(14px);
    animation: fadeUp .52s ease forwards;
}

.fade-up:nth-child(2) { animation-delay: .06s; }
.fade-up:nth-child(3) { animation-delay: .12s; }
.fade-up:nth-child(4) { animation-delay: .18s; }

@keyframes fadeUp {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.splash-loader {
    position: fixed;
    inset: 0;
    background:
        radial-gradient(circle at top right, rgba(124,58,237,.12), transparent 25%),
        radial-gradient(circle at top left, rgba(255,138,51,.14), transparent 20%),
        var(--bg);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    z-index: 80;
    transition: opacity .32s ease, visibility .32s ease;
}

.splash-loader.hidden {
    opacity: 0;
    visibility: hidden;
}

.splash-card {
    width: min(100%, 360px);
    border-radius: 30px;
    background: var(--card);
    border: 1px solid var(--line);
    box-shadow: var(--shadow);
    padding: 22px;
    text-align: center;
    display: grid;
    gap: 14px;
}

.logo-badge {
    width: 64px;
    height: 64px;
    margin: 0 auto;
    display: grid;
    place-items: center;
    border-radius: 22px;
    font-size: 1.6rem;
    background: linear-gradient(135deg, rgba(255,138,51,.16), rgba(124,58,237,.18));
}

.loader-text {
    font-weight: 800;
}

.loader-bar {
    height: 10px;
    border-radius: 999px;
    overflow: hidden;
    background: rgba(124, 58, 237, 0.08);
}

.loader-bar span,
.skeleton-line,
.skeleton-chip {
    display: block;
    background: linear-gradient(90deg, rgba(255,255,255,0), rgba(255,255,255,.48), rgba(255,255,255,0));
    background-size: 200px 100%;
    animation: shimmer 1.25s linear infinite;
}

.loader-bar span {
    width: 44%;
    height: 100%;
    background-color: rgba(124, 58, 237, 0.42);
}

.skeleton-line {
    height: 12px;
    border-radius: 999px;
    background-color: rgba(124, 58, 237, 0.12);
}

.skeleton-chip {
    width: 120px;
    height: 16px;
    border-radius: 999px;
    margin: 0 auto;
    background-color: rgba(255, 138, 51, 0.12);
}

@keyframes shimmer {
    from { background-position: -200px 0; }
    to { background-position: 200px 0; }
}

.no-scroll-x {
    overflow-x: clip;
}

@media (min-width: 420px) {
    .field-grid {
        grid-template-columns: 1fr 1fr;
    }

    .field-full {
        grid-column: 1 / -1;
    }

    .popular-list {
        grid-template-columns: 1fr 1fr;
    }
}

@media (max-width: 399px) {
    .stats-grid,
    .icon-grid {
        grid-template-columns: 1fr;
    }

    .service-card {
        grid-template-columns: 1fr;
    }

    .service-icon {
        width: 58px;
        height: 58px;
    }
}

@media (min-width: 560px) {
    .auth-shell,
    .app-shell {
        padding-left: 20px;
        padding-right: 20px;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: .01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: .01ms !important;
        scroll-behavior: auto !important;
    }
}


/* Patch mobile layout refinement */
.app-shell {
    padding-top: 12px;
}

.mobile-header {
    top: 8px;
    background: rgba(255,255,255,.94);
}

body.dark-mode .mobile-header {
    background: rgba(29,22,48,.94);
}

.service-card-list.icon-grid {
    grid-template-columns: 1fr;
}

.service-card-list .service-card {
    align-items: start;
}

.service-card-list .service-body form,
.service-card-list .service-body details,
.service-card-list .service-body .btn,
.button-row .btn {
    width: 100%;
}

.service-card-list .service-title-row {
    align-items: flex-start;
}

@media (max-width: 520px) {
    .stats-grid,
    .icon-grid,
    .popular-list {
        grid-template-columns: 1fr;
    }

    .service-card,
    .service-card.compact {
        grid-template-columns: 1fr;
    }

    .service-title-row,
    .section-head,
    .booking-top {
        flex-direction: column;
        align-items: stretch;
    }

    .header-actions {
        gap: 8px;
    }

    .price-badge,
    .rating-pill,
    .status-badge,
    .meta-pill {
        align-self: flex-start;
    }

    .bottom-nav {
        gap: 6px;
        padding-left: 8px;
        padding-right: 8px;
    }

    .nav-item {
        padding: 10px 6px;
    }

    .nav-item small {
        font-size: 0.64rem;
    }
}

@media (min-width: 521px) {
    .service-card-list.icon-grid {
        grid-template-columns: 1fr 1fr;
    }
}


/* Patch v3: tighter mobile action buttons and overflow-safe badges */
.service-title-row,
.service-footer {
    flex-wrap: wrap;
}

.service-title-row h3,
.service-body h3 {
    margin: 0;
    min-width: 0;
    overflow-wrap: anywhere;
}

.price-badge {
    max-width: 100%;
    padding: 7px 10px;
    font-size: 0.76rem;
    line-height: 1.1;
}

.service-meta span {
    display: inline-flex;
    align-items: center;
}

.action-row {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.icon-action,
.icon-choice {
    width: 48px;
    height: 48px;
    min-width: 48px;
    border-radius: 16px;
    border: 1px solid rgba(124, 58, 237, 0.12);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    font-weight: 800;
    cursor: pointer;
    transition: transform .18s ease, box-shadow .18s ease, opacity .18s ease, filter .18s ease;
    box-shadow: 0 10px 22px rgba(76, 29, 149, 0.10);
}

.icon-action:active,
.icon-choice:active {
    transform: scale(.97);
}

.icon-edit {
    background: rgba(124, 58, 237, 0.08);
    color: var(--purple);
}

.icon-delete {
    background: rgba(239, 68, 68, 0.10);
    color: #dc2626;
}

.icon-choice {
    border-radius: 999px;
    background: linear-gradient(135deg, rgba(255,138,51,.14), rgba(124,58,237,.12));
    color: var(--purple);
}

.action-label {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0,0,0,0);
    border: 0;
}

.service-actions {
    display: flex;
    align-items: flex-start;
    justify-content: flex-start;
    gap: 12px;
    flex-wrap: nowrap;
    margin-top: 12px;
    width: 100%;
}

.service-actions > * {
    flex: 0 0 auto;
}

.inline-delete-form {
    margin: 0;
}

.inline-editor.compact-editor {
    position: relative;
    margin: 0;
}

.inline-editor summary.icon-summary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    padding: 0;
    border-radius: 16px;
    background: rgba(124, 58, 237, 0.08);
    color: var(--purple);
    border: 1px solid rgba(124, 58, 237, 0.12);
}

.inline-editor.compact-editor[open] {
    width: 100%;
}

.inline-editor.compact-editor[open] summary.icon-summary {
    margin-bottom: 10px;
}

.inline-editor.compact-editor[open] .mini-form {
    margin-top: 0;
}

@media (max-width: 520px) {
    .service-title-row {
        gap: 8px;
    }

    .price-badge {
        font-size: 0.72rem;
        padding: 6px 9px;
    }

    .service-footer {
        align-items: center;
    }
}

@media (max-width: 520px) {
    .service-actions {
        gap: 10px;
    }

    .service-actions .icon-action,
    .service-actions .icon-summary {
        width: 46px;
        height: 46px;
        border-radius: 14px;
    }
}


/* Patch v5: keep edit and delete safely inside card on mobile */
.service-card-list .service-body details.compact-editor,
.service-card-list .service-body .inline-delete-form {
    width: auto;
}

.service-actions {
    display: grid;
    grid-template-columns: 48px 48px;
    gap: 10px;
    justify-content: start;
    align-items: start;
    width: 100%;
    overflow: hidden;
}

.service-actions > * {
    min-width: 0;
}

.inline-editor.compact-editor {
    width: auto !important;
    margin: 0;
    padding: 0;
    border: 0;
    background: transparent;
    box-shadow: none;
    overflow: visible;
}

.inline-editor summary.icon-summary,
.inline-delete-form .icon-action {
    width: 48px;
    height: 48px;
    min-width: 48px;
    padding: 0;
    margin: 0;
}

.inline-delete-form {
    margin: 0;
    display: flex;
    align-items: flex-start;
    justify-content: flex-start;
}

.inline-editor.compact-editor[open] {
    grid-column: 1 / -1;
    width: 100% !important;
    display: grid;
    grid-template-columns: 48px 1fr;
    gap: 10px;
    align-items: start;
}

.inline-editor.compact-editor[open] summary.icon-summary {
    margin: 0;
}

.inline-editor.compact-editor[open] .mini-form {
    min-width: 0;
    width: 100%;
    margin: 0;
}

@media (max-width: 520px) {
    .service-actions {
        grid-template-columns: 44px 44px;
        gap: 8px;
    }

    .inline-editor summary.icon-summary,
    .inline-delete-form .icon-action {
        width: 44px;
        height: 44px;
        min-width: 44px;
        border-radius: 14px;
    }

    .inline-editor.compact-editor[open] {
        grid-template-columns: 44px 1fr;
        gap: 8px;
    }
}


/* Patch v6: modal editor mobile and stable service actions */
body.modal-open {
    overflow: hidden;
}

.service-card-list.icon-grid {
    grid-template-columns: 1fr 1fr;
    align-items: start;
}

.service-card {
    overflow: hidden;
}

.service-title-row {
    align-items: flex-start;
    flex-wrap: wrap;
}

.service-title-row h3 {
    flex: 1 1 140px;
    min-width: 0;
    word-break: break-word;
}

.price-badge {
    flex: 0 0 auto;
    max-width: 100%;
    white-space: nowrap;
}

.service-actions.service-actions-inline {
    display: flex;
    align-items: center;
    gap: 10px;
    justify-content: flex-start;
    margin-top: 10px;
    width: 100%;
}

.service-actions.service-actions-inline .inline-delete-form {
    margin: 0;
}

.service-actions.service-actions-inline .icon-action {
    width: 44px;
    height: 44px;
    min-width: 44px;
    border-radius: 14px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(124, 58, 237, 0.12);
    box-shadow: none;
}

.icon-edit {
    background: rgba(124, 58, 237, 0.10);
    color: var(--purple);
}

.icon-delete {
    background: rgba(239, 68, 68, 0.10);
    color: #ef4444;
}

.action-label {
    display: none;
}

.mobile-modal {
    position: fixed;
    inset: 0;
    z-index: 1300;
    display: none;
}

.mobile-modal.show {
    display: block;
}

.mobile-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(33, 22, 62, 0.45);
    backdrop-filter: blur(4px);
}

.mobile-modal-sheet {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    max-height: 92vh;
    overflow: auto;
    background: var(--card-solid);
    border-radius: 28px 28px 0 0;
    padding: 14px 16px calc(24px + env(safe-area-inset-bottom));
    box-shadow: 0 -18px 40px rgba(34, 20, 63, 0.18);
    animation: modalSheetUp .22s ease-out;
}

.mobile-modal-handle {
    width: 54px;
    height: 6px;
    border-radius: 999px;
    background: rgba(124, 58, 237, 0.18);
    margin: 0 auto 14px;
}

.mobile-modal-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 14px;
}

.mobile-modal-head h3 {
    margin: 4px 0 0;
    font-size: 1.1rem;
    line-height: 1.3;
}

.modal-close-btn {
    flex: 0 0 auto;
}

.modal-form {
    gap: 12px;
}

.modal-form .field {
    gap: 6px;
}

.modal-form .field span {
    font-size: 0.88rem;
}

.modal-form input,
.modal-form textarea {
    border-radius: 14px;
    padding: 13px 14px;
}

.modal-button-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-top: 4px;
}

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

@media (max-width: 520px) {
    .service-card-list.icon-grid {
        grid-template-columns: 1fr 1fr;
        gap: 12px;
    }

    .service-card {
        grid-template-columns: 48px 1fr;
        gap: 10px;
    }

    .service-icon {
        width: 44px;
        height: 44px;
        border-radius: 14px;
        font-size: 1.2rem;
    }

    .price-badge {
        font-size: 0.74rem;
        padding: 7px 10px;
    }
}

@media (max-width: 390px) {
    .service-card-list.icon-grid {
        grid-template-columns: 1fr;
    }

    .modal-button-row {
        grid-template-columns: 1fr;
    }
}
