/* ============================================================
   SP-MOBILE.CSS — MOBILE PWA STYLES (social-prescribing-mobile.html)
   + RESPONSIVE OVERRIDES FOR DESKTOP SP AT NARROW VIEWPORTS
   ============================================================ */

/* ============================================================
   DESKTOP REDIRECT BANNER (shown on mobile HTML at ≥768px)
   ============================================================ */

.desktop-banner {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    padding: 12px 16px;
    text-align: center;
    font-size: 14px;
    color: var(--muted);
    z-index: 9999;
}

.desktop-banner a {
    color: var(--purple);
    text-decoration: none;
    font-weight: 500;
}

@media (min-width: 768px) {
    .desktop-banner { display: block; }
}

/* ============================================================
   APP SHELL (PWA full-screen container)
   ============================================================ */

#app {
    position: fixed;
    inset: 0;
    display: flex;
    flex-direction: column;
    background: var(--bg);
}

body {
    width: 100%;
    height: 100%;
    overflow: hidden;
}

/* ============================================================
   SCREEN MANAGEMENT
   ============================================================ */

.screens {
    flex: 1;
    position: relative;
    overflow: hidden;
}

.screen {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    background: var(--bg);
    transform: translateX(100%);
    transition: transform 0.32s cubic-bezier(0.4, 0, 0.2, 1);
    visibility: hidden;
}

.screen.active {
    transform: translateX(0);
    visibility: visible;
}

.screen.slide-left {
    transform: translateX(-30%);
    visibility: visible;
}

/* ============================================================
   SCREEN HEADER
   ============================================================ */

.screen-header {
    background: var(--surface);
    padding-top: calc(var(--safe-top, 0px) + 12px);
    padding-bottom: 0;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}

.screen-header-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 16px 12px;
}

.screen-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--purple);
    font-family: 'Space Grotesk', sans-serif;
}

.screen-title-sm {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text);
}

.header-action-btn {
    background: none;
    border: none;
    color: var(--muted);
    cursor: pointer;
    padding: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    min-height: 36px;
    min-width: 36px;
}

.header-action-btn:hover {
    background: var(--border);
    color: var(--text);
}

/* ============================================================
   SCREEN SCROLL AREA
   ============================================================ */

.screen-scroll {
    flex: 1;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    background: var(--bg);        /* opaque — prevents KPI strip bleed-through on iOS compositing */
    isolation: isolate;           /* new stacking context — prevents header paint-through during scroll */
}

/* ============================================================
   BOTTOM TAB BAR
   ============================================================ */

.tab-bar {
    display: flex;
    position: relative;
    z-index: 150;
    background: rgba(10, 15, 26, 0.97);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-top: 1px solid var(--border);
    height: 60px;
    padding-bottom: env(safe-area-inset-bottom, 0px);
    flex-shrink: 0;
}

.tab-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    cursor: pointer;
    background: none;
    border: none;
    color: var(--muted);
    font-size: 9px;
    line-height: 1.2;
    padding: 8px 4px;
    transition: color 0.18s;
    -webkit-tap-highlight-color: transparent;
}

.tab-item.active {
    color: var(--purple);
}

.tab-item:not(.active):hover {
    color: var(--text);
}

.tab-icon {
    width: 22px;
    height: 22px;
    flex-shrink: 0;
}

.tab-label {
    font-size: 9px;
    line-height: 1.1;
    text-align: center;
    letter-spacing: 0.01em;
}

/* ============================================================
   KPI STRIP (tap-to-filter row)
   ============================================================ */

.kpi-strip {
    display: flex;
    gap: 0;
    padding: 0 12px 10px;
    overflow-x: auto;
    scrollbar-width: none;
}

.kpi-strip::-webkit-scrollbar {
    display: none;
}

.kpi-item {
    flex: 1;
    min-width: 52px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    padding: 6px 4px;
    border-radius: 10px;
    cursor: pointer;
    transition: background 0.15s, opacity 0.15s;
    -webkit-tap-highlight-color: transparent;
}

.kpi-item.kpi-active {
    background: rgba(139, 92, 246, 0.12);
}

.kpi-item.kpi-inactive {
    opacity: 0.4;
}

.kpi-num {
    font-size: 1.25rem;
    font-weight: 700;
    line-height: 1;
    font-family: 'Space Grotesk', sans-serif;
}

.kpi-lbl {
    font-size: 9px;
    color: var(--muted);
    text-align: center;
    line-height: 1.2;
}

/* ============================================================
   SEARCH BAR
   ============================================================ */

.search-bar-wrap {
    padding: 0 12px 10px;
}

.search-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 8px 12px;
}

.search-bar svg {
    color: var(--muted);
    flex-shrink: 0;
}

.search-bar input {
    flex: 1;
    background: none;
    border: none;
    outline: none;
    color: var(--text);
    font-size: 0.875rem;
    padding: 0;
    min-width: 0;
    min-height: 44px;
}

.search-bar input::placeholder {
    color: var(--muted);
}

.search-clear {
    background: none;
    border: none;
    color: var(--muted);
    cursor: pointer;
    font-size: 14px;
    padding: 0 0 0 4px;
    display: none;
    line-height: 1;
    min-height: auto;
    min-width: auto;
}

.search-clear.visible {
    display: block;
}

/* ============================================================
   CASES LIST
   ============================================================ */

.cases-list {
    padding: 8px 12px 80px;
    display: flex;
    flex-direction: column;
    gap: 1px;
}

.case-row {
    display: flex;
    align-items: stretch;
    background: var(--surface);
    border-radius: 12px;
    overflow: hidden;
    margin-bottom: 8px;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    transition: opacity 0.15s;
}

.case-row:active {
    opacity: 0.75;
}

.urgency-bar {
    width: 4px;
    flex-shrink: 0;
    background: var(--border);
}

.urgency-bar.routine,
.urgency-bar.low {
    background: var(--green);
}

.urgency-bar.dringend,
.urgency-bar.medium,
.urgency-bar.high {
    background: var(--amber, #f59e0b);
}

.urgency-bar.notfall,
.urgency-bar.urgent {
    background: var(--red);
}

.case-main {
    flex: 1;
    padding: 10px 10px 10px 12px;
    min-width: 0;
}

.case-top-row {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 3px;
}

.case-name {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.case-date {
    font-size: 11px;
    color: var(--muted);
    flex-shrink: 0;
    white-space: nowrap;
}

.case-sub {
    font-size: 0.75rem;
    color: var(--muted);
    margin-bottom: 6px;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.case-bottom {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

.chevron {
    align-self: center;
    color: var(--muted);
    flex-shrink: 0;
    margin-right: 12px;
}

/* ============================================================
   STATUS & URGENCY PILLS
   ============================================================ */

.status-pill {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    border-radius: 100px;
    font-size: 11px;
    font-weight: 500;
    line-height: 1.6;
}

/* Inherits color variants from sp-base.css: .status-pending, .status-accepted, etc. */

.urgency-pill {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    border-radius: 100px;
    font-size: 11px;
    font-weight: 500;
    line-height: 1.6;
}

.urgency-pill.urgency-routine,
.urgency-pill.urgency-low {
    background: var(--green-dim);
    color: var(--green);
}

.urgency-pill.urgency-dringend,
.urgency-pill.urgency-medium,
.urgency-pill.urgency-high {
    background: rgba(245, 158, 11, 0.12);
    color: var(--amber, #f59e0b);
}

.urgency-pill.urgency-notfall,
.urgency-pill.urgency-urgent {
    background: var(--red-dim);
    color: var(--red);
}

/* ============================================================
   SERVICE LIST
   ============================================================ */

.services-list {
    padding: 8px 12px 80px;
}

.service-row {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    background: var(--surface);
    border-radius: 12px;
    padding: 12px 14px;
    margin-bottom: 8px;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    transition: opacity 0.15s;
}

.service-row:active {
    opacity: 0.75;
}

.service-name {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 2px;
}

.service-meta {
    font-size: 0.75rem;
    color: var(--muted);
    margin-bottom: 6px;
}

.service-main {
    flex: 1;
    min-width: 0;
    font-size: 0.75rem;
    color: var(--muted);
    line-height: 1.4;
    margin-bottom: 6px;
}

.service-tags {
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
}

.service-category-dot {
    display: block;
    flex-shrink: 0;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--purple);
    margin-top: 4px;
}

.service-cat {
    font-size: 11px;
    color: var(--muted);
}

/* ============================================================
   SERVICE FILTER BAR
   ============================================================ */

.svc-filter-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding: 10px 12px;
    overflow-x: auto;
    scrollbar-width: none;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}

.svc-filter-bar::-webkit-scrollbar {
    display: none;
}

.svc-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 5px 12px;
    border-radius: 100px;
    font-size: 12px;
    font-weight: 500;
    white-space: nowrap;
    cursor: pointer;
    background: var(--surface);
    border: 1px solid var(--border);
    color: var(--muted);
    transition: all 0.15s;
    -webkit-tap-highlight-color: transparent;
    flex-shrink: 0;  /* Prevent compression — chips must render at natural width for overflow-x scroll to work */
    min-height: 44px;
    box-sizing: border-box;
}

.svc-chip.active {
    background: var(--purple-dim);
    border-color: rgba(139, 92, 246, 0.4);
    color: var(--purple);
}

.svc-reset-btn {
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    padding: 5px 12px;
    border-radius: 100px;
    font-size: 12px;
    font-weight: 500;
    white-space: nowrap;
    cursor: pointer;
    background: rgba(239, 68, 68, 0.12);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: #ef4444;
    transition: all 0.15s;
    -webkit-tap-highlight-color: transparent;
}

/* ============================================================
   FILTER CHIPS (case filter bar)
   ============================================================ */

.chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    border-radius: 100px;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    background: var(--surface);
    border: 1px solid var(--border);
    color: var(--muted);
    transition: all 0.15s;
    white-space: nowrap;
    -webkit-tap-highlight-color: transparent;
    min-height: 44px;
    box-sizing: border-box;
}

.chip.active {
    background: var(--purple-dim);
    border-color: rgba(139, 92, 246, 0.4);
    color: var(--purple);
}

.chip-x {
    opacity: 0.6;
    font-size: 10px;
}

/* ============================================================
   SERVICE / ATTRIBUTE TAGS
   ============================================================ */

.stag {
    display: inline-flex;
    align-items: center;
    padding: 2px 7px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 500;
    background: var(--surface-2);
    color: var(--muted);
    border: 1px solid var(--border);
}

.stag-cost   { background: rgba(16,185,129,0.1);  color: var(--green); }
.stag-age    { background: rgba(59,130,246,0.1);   color: #3b82f6; }
.stag-gender { background: rgba(168,85,247,0.1);   color: #a855f7; }
.stag-focus  { background: rgba(245,158,11,0.1);   color: var(--amber, #f59e0b); }

/* ============================================================
   LOADING & EMPTY STATES
   ============================================================ */

.list-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 40px 16px;
    color: var(--muted);
    font-size: 0.875rem;
}

.empty-msg {
    text-align: center;
    padding: 48px 24px;
}

.empty-msg h3 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 6px;
}

.empty-msg p {
    font-size: 0.8rem;
    color: var(--muted);
    line-height: 1.5;
}

/* ============================================================
   DETAIL OVERLAY (Case Detail Bottom Sheet)
   ============================================================ */

.detail-overlay {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 400;
}

.detail-overlay.open {
    display: block;
}

.detail-overlay-bg {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
}

.detail-sheet {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--surface);
    border-radius: 20px 20px 0 0;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    transform: translateY(100%);
    transition: transform 0.3s cubic-bezier(0.32, 0.72, 0, 1);
}

.detail-overlay.open .detail-sheet {
    transform: translateY(0);
}

.detail-handle {
    width: 36px;
    height: 4px;
    background: var(--border-light);
    border-radius: 2px;
    margin: 12px auto 0;
    flex-shrink: 0;
}

.detail-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px 10px;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}

.detail-patient-name {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text);
}

.detail-close {
    background: var(--border);
    border: none;
    color: var(--muted);
    width: 28px;
    height: 28px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: auto;
    min-width: auto;
}

.detail-scroll {
    flex: 1;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 12px 16px 24px;
}

.detail-section {
    margin-bottom: 16px;
}

.detail-section-title {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--muted);
    margin-bottom: 6px;
}

.detail-block {
    background: var(--bg);
    border-radius: 10px;
    overflow: hidden;
}

.detail-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 9px 12px;
    border-bottom: 1px solid var(--border);
}

.detail-row:last-child {
    border-bottom: none;
}

.detail-row-label {
    font-size: 12px;
    color: var(--muted);
    flex-shrink: 0;
    margin-right: 12px;
}

.detail-row-value {
    font-size: 13px;
    color: var(--text);
    text-align: right;
    word-break: break-word;
}

.detail-reason-text {
    font-size: 13px;
    color: var(--text);
    line-height: 1.5;
}

/* ============================================================
   NOTES (in detail sheet)
   ============================================================ */

.note-item {
    background: var(--bg);
    border-radius: 8px;
    padding: 10px 12px;
    margin-bottom: 6px;
}

.note-author {
    font-size: 11px;
    font-weight: 600;
    color: var(--purple);
    margin-bottom: 3px;
}

.note-text {
    font-size: 13px;
    color: var(--text);
    line-height: 1.4;
}

.note-input {
    width: 100%;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 8px 10px;
    font-size: 13px;
    color: var(--text);
    resize: none;
    outline: none;
    font-family: inherit;
    margin-bottom: 6px;
    box-sizing: border-box;
}

.note-submit-btn {
    background: var(--purple);
    color: #fff;
    border: none;
    border-radius: 8px;
    padding: 8px 16px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    min-height: auto;
}

.note-add {
    margin-top: 8px;
}

/* Status selector (case detail) */
.status-selector {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding: 8px 14px 14px;
}

.status-btn {
    padding: 6px 12px;
    border: 1px solid var(--border);
    border-radius: 20px;
    background: var(--bg);
    color: var(--text);
    font-size: 0.78rem;
    font-weight: 500;
    font-family: inherit;
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s;
    -webkit-tap-highlight-color: transparent;
    min-height: auto;
    min-width: auto;
}

.status-btn.selected-pending {
    border-color: #f59e0b;
    color: #f59e0b;
    background: rgba(245, 158, 11, 0.1);
}

.status-btn.selected-accepted {
    border-color: #3b82f6;
    color: #3b82f6;
    background: rgba(59, 130, 246, 0.1);
}

.status-btn.selected-in_progress {
    border-color: var(--purple);
    color: var(--purple);
    background: var(--purple-dim);
}

.status-btn.selected-completed {
    border-color: #22c55e;
    color: #22c55e;
    background: rgba(34, 197, 94, 0.1);
}

.status-btn.selected-dropped_off {
    border-color: var(--muted);
    color: var(--muted);
    background: rgba(128, 128, 128, 0.1);
}

/* ============================================================
   FILTER OVERLAY (Services filter)
   ============================================================ */

.filter-overlay {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 400;
}

.filter-overlay.open {
    display: block;
}

.filter-sheet {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--surface);
    border-radius: 20px 20px 0 0;
    max-height: 85vh;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    transform: translateY(100%);
    transition: transform 0.3s cubic-bezier(0.32, 0.72, 0, 1);
}

.filter-overlay.open .filter-sheet {
    transform: translateY(0);
}

.filter-sheet-handle {
    width: 36px;
    height: 4px;
    background: var(--border-light);
    border-radius: 2px;
    margin: 12px auto 0;
}

.filter-sheet-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text);
}

.filter-sheet-title {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text);
}

.filter-close-btn {
    background: var(--border);
    border: none;
    color: var(--muted);
    width: 28px;
    height: 28px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: auto;
    min-width: auto;
}

.filter-group {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
}

.filter-option-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 0;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}

.filter-option-label {
    font-size: 0.875rem;
    color: var(--text);
}

.filter-checkmark {
    color: var(--purple);
    font-size: 1rem;
    font-weight: 700;
    opacity: 0;
}

.filter-option-row.selected .filter-checkmark {
    opacity: 1;
}

.filter-apply-btn {
    display: block;
    width: calc(100% - 32px);
    margin: 12px 16px 20px;
    padding: 14px 16px;
    background: var(--purple);
    color: #fff;
    border: none;
    border-radius: 10px;
    font-size: 0.9375rem;
    font-weight: 600;
    font-family: inherit;
    text-align: center;
    cursor: pointer;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

/* ============================================================
   SETTINGS OVERLAY
   ============================================================ */

.settings-overlay {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 500;
    background: rgba(0, 0, 0, 0.6);
}

.settings-overlay.open {
    display: block;
}

.settings-sheet {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--surface);
    border-radius: 20px 20px 0 0;
    max-height: 80vh;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    transform: translateY(100%);
    transition: transform 0.3s cubic-bezier(0.32, 0.72, 0, 1);
}

.settings-overlay.open .settings-sheet {
    transform: translateY(0);
}

.settings-sheet-handle {
    width: 36px;
    height: 4px;
    background: var(--border-light);
    border-radius: 2px;
    margin: 12px auto 0;
}

.settings-sheet-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text);
}

.settings-sheet-title {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text);
}

.settings-section-title {
    padding: 10px 16px 4px;
    font-size: 0.7rem;
    font-weight: 700;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.settings-close-btn {
    background: var(--border);
    border: none;
    color: var(--muted);
    width: 28px;
    height: 28px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: auto;
    min-width: auto;
}

.settings-theme-block,
.settings-lang-block {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
}

/* Theme / language options */
.theme-option,
.lang-option {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 0;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}

.theme-option-left,
.lang-option-left {
    display: flex;
    align-items: center;
    gap: 10px;
}

.theme-option-icon {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
}

.lang-option-flag {
    font-size: 20px;
}

.theme-option-label,
.lang-option-label {
    font-size: 0.875rem;
    color: var(--text);
}

.theme-option-sub {
    font-size: 0.75rem;
    color: var(--muted);
    margin-top: 1px;
}

.theme-checkmark,
.lang-checkmark {
    color: var(--purple);
    font-size: 1rem;
    font-weight: 700;
    opacity: 0;
}

.theme-option.selected .theme-checkmark,
.lang-option.selected .lang-checkmark {
    opacity: 1;
}

/* ============================================================
   WIZARD (Neue Zuweisung stepper)
   ============================================================ */

.wizard-header {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    padding-top: calc(var(--safe-top, 0px) + 10px);
    flex-shrink: 0;
}

.wizard-header-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 16px 10px;
}

.wizard-cancel-btn {
    background: none;
    border: none;
    color: var(--muted);
    font-size: 0.875rem;
    cursor: pointer;
    padding: 4px;
    min-height: auto;
}

.wizard-progress-bar {
    height: 3px;
    background: var(--border);
    margin: 0 0 0;
}

.wizard-progress-fill {
    height: 100%;
    background: var(--purple);
    transition: width 0.3s ease;
}

.wizard-step-label {
    font-size: 11px;
    color: var(--muted);
    padding: 4px 16px 8px;
    text-align: center;
}

.wizard-body {
    flex: 1;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 24px 16px;
}

.wizard-step {
    display: none;
}

.wizard-step.active {
    display: block;
}

.wizard-question {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 6px;
    font-family: 'Space Grotesk', sans-serif;
}

.wizard-hint {
    font-size: 0.8rem;
    color: var(--muted);
    margin-bottom: 20px;
}

.wizard-field {
    width: 100%;
    background: var(--surface);
    border: 1.5px solid var(--border);
    border-radius: 10px;
    padding: 12px 14px;
    font-size: 1rem;
    color: var(--text);
    outline: none;
    font-family: inherit;
    margin-bottom: 12px;
    box-sizing: border-box;
    transition: border-color 0.15s;
}

.wizard-field:focus {
    border-color: var(--purple);
}

.wizard-footer {
    display: flex;
    gap: 10px;
    padding: 12px 16px;
    border-top: 1px solid var(--border);
    flex-shrink: 0;
    background: var(--surface);
}

.btn-back {
    padding: 12px 18px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: transparent;
    color: var(--muted);
    font-size: 0.875rem;
    font-weight: 500;
    font-family: inherit;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    min-height: 44px;
    min-width: auto;
}

.btn-next {
    flex: 1;
    padding: 12px 18px;
    border: none;
    border-radius: 10px;
    background: var(--purple);
    color: #fff;
    font-size: 0.875rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    min-height: 44px;
    min-width: auto;
}

.btn-next:disabled {
    background: var(--border);
    color: var(--muted);
    cursor: not-allowed;
}

/* Urgency grid */
.urgency-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-top: 8px;
}

.urgency-option {
    background: var(--surface);
    border: 2px solid var(--border);
    border-radius: 12px;
    padding: 14px 10px;
    text-align: center;
    cursor: pointer;
    transition: all 0.15s;
    -webkit-tap-highlight-color: transparent;
}

.urgency-option.selected,
.urgency-option.urg-medium {
    border-color: rgba(139, 92, 246, 0.5);
    background: var(--purple-dim);
}

/* Urgency-specific selected colors */
.urgency-option.selected.urg-low {
    border-color: rgba(34, 197, 94, 0.5);
    background: rgba(34, 197, 94, 0.1);
}

.urgency-option.selected.urg-high {
    border-color: rgba(251, 146, 60, 0.5);
    background: rgba(251, 146, 60, 0.1);
}

.urgency-option.selected.urg-urgent {
    border-color: rgba(239, 68, 68, 0.5);
    background: rgba(239, 68, 68, 0.1);
}

.urgency-icon { font-size: 1.5rem; margin-bottom: 4px; }
.urgency-label { font-size: 0.8rem; font-weight: 600; color: var(--text); }
.urgency-sub   { font-size: 0.7rem; color: var(--muted); margin-top: 2px; }

/* Wizard summary */
.wizard-summary {
    background: var(--bg);
    border-radius: 12px;
    overflow: hidden;
    margin-top: 12px;
}

.wizard-summary-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    border-bottom: 1px solid var(--border);
}

.wizard-summary-row:last-child {
    border-bottom: none;
}

.wsrow-label {
    font-size: 12px;
    color: var(--muted);
}

.wsrow-value {
    font-size: 13px;
    color: var(--text);
    font-weight: 500;
}

/* Wizard success */
.wizard-success {
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 48px 24px;
    text-align: center;
}

.wizard-success.show {
    display: flex;
}

.success-icon {
    font-size: 3rem;
    margin-bottom: 16px;
}

.success-title {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 8px;
}

.success-sub {
    font-size: 0.875rem;
    color: var(--muted);
    line-height: 1.5;
    margin-bottom: 24px;
    max-width: 280px;
}

.btn-primary-outline {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 12px 24px;
    border: 2px solid var(--purple);
    border-radius: 10px;
    background: transparent;
    color: var(--purple);
    font-size: 0.875rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    min-height: auto;
    min-width: auto;
    transition: background 0.15s;
}

.btn-primary-outline:active {
    background: var(--purple-dim);
}

/* ============================================================
   TOAST NOTIFICATIONS
   ============================================================ */

.toast {
    position: fixed;
    top: calc(var(--safe-top, 0px) + 16px);
    left: 50%;
    transform: translateX(-50%) translateY(-20px);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 10px 16px;
    font-size: 0.875rem;
    color: var(--text);
    z-index: 9999;
    opacity: 0;
    transition: opacity 0.2s, transform 0.2s;
    white-space: nowrap;
    box-shadow: 0 4px 20px rgba(0,0,0,0.3);
}

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

.toast.success {
    border-color: var(--green);
    color: var(--green);
}

.toast.error {
    border-color: var(--red);
    color: var(--red);
}

/* ============================================================
   THEME ICONS (sun/moon toggle)
   ============================================================ */

.light-icon { display: none; }
.dark-icon  { display: block; }
.auto-icon  { display: none; }

[data-theme="light"] .light-icon { display: block; }
[data-theme="light"] .dark-icon  { display: none; }
[data-theme="dark"]  .dark-icon  { display: block; }
[data-theme="dark"]  .light-icon { display: none; }

/* ============================================================
   LIGHT THEME OVERRIDES FOR MOBILE PWA
   ============================================================ */

[data-theme="light"] .tab-bar {
    background: rgba(255, 255, 255, 0.97);
    border-top-color: #e2e8f0;
}

[data-theme="light"] .case-row,
[data-theme="light"] .service-row {
    background: #fff;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}

[data-theme="light"] .search-bar {
    background: #fff;
    border-color: #e2e8f0;
}

[data-theme="light"] .screen-header {
    background: #fff;
    border-bottom-color: #e2e8f0;
}

/* ============================================================
   DESKTOP SP RESPONSIVE OVERRIDES (≤767px on social-prescribing.html)
   ============================================================ */

@media (max-width: 767px) {
    /* Hide desktop top nav tabs */
    .tab-nav { display: none !important; }

    .top-nav { padding: 0.75rem 1rem; }

    .nav-divider, .nav-title, .sp-badge { display: none; }
    .nav-left  { gap: 0.75rem; }
    .nav-link  { font-size: 0.75rem; padding: 0.3rem 0.6rem; }

    /* Cards & layout */
    .card           { border-radius: 12px; margin-bottom: 1rem; }
    .card-header    { padding: 1rem; }
    .card-title     { font-size: 0.9rem; }
    .card-body      { padding: 1rem; }
    .dash-grid      { grid-template-columns: 1fr; gap: 1rem; }

    /* KPI cards (desktop SP) */
    .kpi-row    { grid-template-columns: repeat(2, 1fr); gap: 0.75rem; margin-bottom: 1rem; }
    .kpi-card   { padding: 0.9rem 1rem; }
    .kpi-label  { font-size: 0.65rem; }
    .kpi-value  { font-size: 1.4rem; }
    .kpi-sub    { font-size: 0.7rem; }

    /* Service grid */
    .service-grid { grid-template-columns: 1fr; gap: 0.75rem; }
    .service-card { border-radius: 12px; padding: 1rem; }

    /* Filter sheet (desktop SP) */
    .filter-sheet-overlay {
        display: none;
        position: fixed;
        inset: 0;
        background: rgba(0,0,0,0.65);
        z-index: 300;
    }
    .filter-sheet-overlay.open { display: block; }
    .filter-sheet-overlay .filter-sheet {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        z-index: 301;
        background: var(--surface);
        border-top: 1px solid var(--border);
        border-radius: 20px 20px 0 0;
        padding: 0 1.25rem 1.5rem;
        max-height: 85vh;
        overflow-y: auto;
        transform: translateY(100%);
        transition: transform 0.28s cubic-bezier(.32,.72,0,1);
    }
    .filter-sheet-overlay.open .filter-sheet { transform: translateY(0); }

    /* Forms */
    .form-grid   { grid-template-columns: 1fr; }
    .form-control, .filter-select, .filter-input {
        font-size: 1rem; padding: 0.75rem; min-height: 44px;
    }
    .form-label { font-size: 0.7rem; }

    .btn    { min-height: 44px; font-size: 0.82rem; padding: 0.75rem 1rem; }
    .btn-sm { min-height: 36px; padding: 0.5rem 0.75rem; }

    .main { padding: 0 1rem 70px 1rem; }

    .tab-content        { display: none; }
    .tab-content.active { display: block; }

    /* Tables */
    .sp-table    { min-width: 100%; font-size: 0.75rem; }
    .sp-table th { padding: 0.5rem; font-size: 0.65rem; }
    .sp-table td { padding: 0.5rem; font-size: 0.75rem; }

    /* Well-being */
    .wellbeing-chart { gap: 0.5rem; }
    .wb-row          { gap: 0.5rem; }
    .wb-label        { font-size: 0.75rem; min-width: 100px; }
    .wb-bar-bg       { height: 24px; }
    .wb-bar-text     { font-size: 0.65rem; }

    /* Typography */
    h1, h2, h3, h4 { font-family: 'Space Grotesk', sans-serif; }
    .loading     { padding: 2rem; }
    .empty-state { padding: 2rem 1rem; }

    /* Touch targets */
    button, a, [role="button"] { min-height: 44px; min-width: 44px; }
}

/* ============================================================
   LANDSCAPE MOBILE
   ============================================================ */

@media (max-width: 767px) and (orientation: landscape) {
    .tab-bar { height: 50px; }
    .main    { padding: 0 1rem 60px 1rem; }
    .kpi-row { grid-template-columns: repeat(3, 1fr); }
}

/* ============================================================
   SERVICE CATEGORY COLOR CLASSES (desktop + mobile)
   ============================================================ */

/* Default purple already in sp-desktop.css .service-category-tag */
.service-category-tag.scat-green   { background: rgba(16,185,129,0.12); color: #10b981; }
.service-category-tag.scat-purple  { background: rgba(139,92,246,0.12);  color: #8b5cf6; }
.service-category-tag.scat-blue    { background: rgba(59,130,246,0.12);  color: #3b82f6; }
.service-category-tag.scat-amber   { background: rgba(245,158,11,0.12);  color: #f59e0b; }
.service-category-tag.scat-cyan    { background: rgba(34,211,238,0.12);  color: #22d3ee; }
.service-category-tag.scat-warm    { background: rgba(251,146,60,0.12);  color: #fb923c; }
.service-category-tag.scat-teal    { background: rgba(20,184,166,0.12);  color: #14b8a6; }
.service-category-tag.scat-red     { background: rgba(239,68,68,0.12);   color: #ef4444; }
.service-category-tag.scat-pink    { background: rgba(236,72,153,0.12);  color: #ec4899; }
.service-category-tag.scat-indigo  { background: rgba(99,102,241,0.12);  color: #6366f1; }

/* ============================================================
   PHASE 1: BOTTOM NAVIGATION BAR (mobile only, ≤767px)
   ============================================================ */

@media (max-width: 767px) {

    /* ---- Bottom nav: show & style ---- */
    .bottom-nav {
        display: flex !important;
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        z-index: 200;
        background: rgba(10, 15, 26, 0.97);
        backdrop-filter: blur(16px);
        -webkit-backdrop-filter: blur(16px);
        border-top: 1px solid var(--border);
        height: 60px;
        padding-bottom: env(safe-area-inset-bottom, 0px);
    }

    .bottom-nav-item {
        flex: 1;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 3px;
        background: none;
        border: none;
        color: var(--muted);
        cursor: pointer;
        padding: 8px 4px;
        -webkit-tap-highlight-color: transparent;
        min-height: 44px;
        min-width: 0;
        font-family: inherit;
        transition: color 0.18s;
    }

    .bottom-nav-item.active { color: var(--purple); }
    .bottom-nav-item:not(.active):active { color: var(--text); }

    .bottom-nav-icon {
        display: flex;
        align-items: center;
        justify-content: center;
        width: 22px;
        height: 22px;
        flex-shrink: 0;
    }

    .bottom-nav-icon svg { width: 22px; height: 22px; stroke: currentColor; }

    .bottom-nav-label {
        font-size: 9px;
        line-height: 1.1;
        text-align: center;
        letter-spacing: 0.01em;
    }

    /* Ensure .main has bottom padding so content isn't hidden behind the nav bar */
    .main { padding-bottom: 76px !important; }

    /* ---- Table → Card layout for referral list ---- */
    .sp-table-cards { min-width: 0 !important; font-size: 0.82rem !important; }
    .sp-table-cards thead { display: none !important; }
    .sp-table-cards,
    .sp-table-cards tbody { display: block !important; width: 100%; }

    .sp-table-cards tr {
        display: block !important;
        background: var(--surface);
        border-radius: 12px;
        margin-bottom: 8px;
        padding: 12px 14px;
        border: 1px solid var(--border);
        position: relative;
        cursor: pointer;
        transition: border-color 0.15s;
        -webkit-tap-highlight-color: transparent;
    }

    .sp-table-cards tr:active { opacity: 0.8; }
    .sp-table-cards tr:hover td { background: transparent !important; }

    /* Patient name cell: full-width card header */
    .sp-table-cards td.td-top {
        display: block !important;
        padding: 0 90px 8px 0 !important; /* Right padding reserves space for status badge */
        margin-bottom: 6px;
        border-bottom: 1px solid var(--border) !important;
        font-size: 0.875rem;
    }

    .sp-table-cards td.td-top strong {
        display: block;
        font-size: 0.9rem;
        margin-bottom: 2px;
    }

    /* Status badge: absolute top-right of card */
    .sp-table-cards td.td-status {
        position: absolute !important;
        top: 12px;
        right: 14px;
        padding: 0 !important;
        border: none !important;
        background: transparent !important;
        display: block !important;
    }

    /* All other cells: label + value inline */
    .sp-table-cards td:not(.td-top):not(.td-status) {
        display: flex !important;
        padding: 3px 0 !important;
        font-size: 0.78rem !important;
        border: none !important;
        border-bottom: none !important;
        align-items: baseline;
        gap: 6px;
        min-height: 0;
    }

    /* Auto-label from data-label attribute */
    .sp-table-cards td[data-label]::before {
        content: attr(data-label) ":";
        font-size: 0.62rem;
        color: var(--muted);
        text-transform: uppercase;
        letter-spacing: 0.04em;
        flex-shrink: 0;
        font-weight: 600;
        min-width: 68px;
    }

    /* ---- Show mobile-only UI ---- */
    .mobile-filter-bar   { display: flex !important; }
    .mobile-filter-chips { display: flex !important; flex-wrap: wrap; gap: 6px; }
    .mobile-dir-search-bar { display: flex !important; gap: 8px; padding: 8px 0 12px; }

    /* ---- Hide desktop-only UI in mobile ---- */
    .caseload-filter-desktop { display: none !important; }
    /* Hide the primary desktop filter row in the directory tab */
    #tab-directory > .filter-bar { display: none !important; }
}

/* ============================================================
   BOTTOM NAV — LIGHT THEME
   ============================================================ */

[data-theme="light"] .bottom-nav {
    background: rgba(255, 255, 255, 0.97);
    border-top-color: #e2e8f0;
}

/* ============================================================
   SERVICE CARD LAYOUT — mobile single-column with touch sizing
   ============================================================ */

@media (max-width: 767px) {
    .service-grid { grid-template-columns: 1fr; gap: 10px; }

    .service-card {
        border-radius: 14px;
        padding: 14px;
        cursor: pointer;
        -webkit-tap-highlight-color: transparent;
        transition: opacity 0.15s;
    }

    .service-card:active { opacity: 0.8; }

    .service-category-tag {
        font-size: 0.65rem;
        padding: 0.22rem 0.55rem;
        margin-bottom: 0.55rem;
    }

    .service-name  { font-size: 0.9rem; }
    .service-desc  { font-size: 0.78rem; -webkit-line-clamp: 2; }
}

/* ============================================================
   MOBILE REFINEMENTS: filter bars, scroll, toast, attr-tags
   ============================================================ */

@media (max-width: 767px) {

    /* Referral table container: remove height cap so cards flow naturally */
    #referralTableBody {
        max-height: none !important;
        overflow-y: visible !important;
    }

    /* Toast: push above the bottom nav bar */
    .toast {
        bottom: 76px !important;
        right: 1rem;
        left: 1rem;
        text-align: center;
    }

    /* Hide overflow attr-tags on mobile (shown via toggleMoreTags JS) */
    .attr-tag-extra {
        display: none !important;
    }

    /* More-tags button */
    .attr-tag-more-btn {
        display: inline-flex;
        align-items: center;
        padding: 2px 8px;
        border-radius: 100px;
        font-size: 11px;
        font-weight: 500;
        background: var(--surface-2);
        color: var(--muted);
        border: 1px solid var(--border);
        cursor: pointer;
        -webkit-tap-highlight-color: transparent;
        font-family: inherit;
        min-height: auto;
        min-width: auto;
    }

    /* ---- Mobile filter bar (caseload search + filter trigger) ---- */
    .mobile-filter-bar {
        display: flex !important;
        gap: 8px;
        align-items: center;
        padding-top: 0.75rem;
    }

    .filter-search-mobile {
        flex: 1;
        background: var(--surface-2);
        border: 1px solid var(--border);
        color: var(--text);
        font-size: 0.88rem;
        padding: 0.6rem 0.9rem;
        border-radius: 10px;
        font-family: 'DM Sans', sans-serif;
        outline: none;
        min-height: 44px;
        transition: border-color 0.2s;
        box-sizing: border-box;
    }

    .filter-search-mobile::placeholder { color: var(--muted); }
    .filter-search-mobile:focus { border-color: var(--purple); }

    .mobile-filter-trigger {
        display: flex;
        align-items: center;
        gap: 6px;
        padding: 0.6rem 0.9rem;
        border: 1px solid var(--border);
        border-radius: 10px;
        background: var(--surface-2);
        color: var(--muted);
        font-size: 0.8rem;
        font-weight: 500;
        font-family: inherit;
        cursor: pointer;
        white-space: nowrap;
        min-height: 44px;
        -webkit-tap-highlight-color: transparent;
        transition: border-color 0.15s, color 0.15s;
        flex-shrink: 0;
    }

    .mobile-filter-trigger.has-filters {
        border-color: var(--purple);
        color: var(--purple);
        background: var(--purple-dim);
    }

    /* Mobile sort select (inside mobile-filter-bar) */
    .filter-sort-mobile {
        background: var(--surface-2);
        border: 1px solid var(--border);
        color: var(--text);
        font-size: 0.78rem;
        padding: 0.5rem 0.55rem;
        border-radius: 10px;
        font-family: 'DM Sans', sans-serif;
        outline: none;
        min-height: 44px;
        cursor: pointer;
        flex-shrink: 0;
        -webkit-appearance: none;
        appearance: none;
        min-width: 96px;
    }

    /* Sort select at very narrow screens: adjust bar layout */
    @media (max-width: 375px) {
        .mobile-filter-bar {
            flex-wrap: wrap;
            gap: 6px;
        }
        .filter-sort-mobile {
            font-size: 0.72rem;
            padding: 0.5rem 0.4rem;
            min-width: 80px;
        }
    }

    /* Active filter chips row */
    .mobile-filter-chips {
        display: flex !important;
        flex-wrap: wrap;
        gap: 6px;
        padding: 4px 0 2px;
    }

    .mobile-filter-chip {
        display: inline-flex;
        align-items: center;
        gap: 4px;
        padding: 3px 8px;
        border-radius: 100px;
        font-size: 0.75rem;
        background: var(--purple-dim);
        color: var(--purple);
        border: 1px solid rgba(139, 92, 246, 0.3);
    }

    .chip-remove {
        background: none;
        border: none;
        color: var(--purple);
        cursor: pointer;
        font-size: 0.85rem;
        line-height: 1;
        padding: 0 2px;
        min-height: auto;
        min-width: auto;
    }

    /* ---- Mobile dir search bar (service directory) ---- */
    .mobile-dir-search-bar {
        display: flex !important;
        gap: 8px;
        align-items: center;
        padding: 8px 0 12px;
    }

    .mobile-dir-search {
        flex: 1;
        background: var(--surface-2);
        border: 1px solid var(--border);
        color: var(--text);
        font-size: 0.88rem;
        padding: 0.6rem 0.9rem;
        border-radius: 10px;
        font-family: 'DM Sans', sans-serif;
        outline: none;
        min-height: 44px;
        transition: border-color 0.2s;
        box-sizing: border-box;
    }

    .mobile-dir-search::placeholder { color: var(--muted); }
    .mobile-dir-search:focus { border-color: var(--purple); }

    .mobile-dir-filter-btn {
        display: flex;
        align-items: center;
        gap: 6px;
        padding: 0.6rem 0.9rem;
        border: 1px solid var(--border);
        border-radius: 10px;
        background: var(--surface-2);
        color: var(--muted);
        font-size: 0.8rem;
        font-weight: 500;
        font-family: inherit;
        cursor: pointer;
        white-space: nowrap;
        min-height: 44px;
        -webkit-tap-highlight-color: transparent;
        transition: border-color 0.15s, color 0.15s;
        flex-shrink: 0;
    }

    .mobile-dir-filter-btn.has-filters {
        border-color: var(--purple);
        color: var(--purple);
        background: var(--purple-dim);
    }

    /* ---- Neue Zuweisung: hide desktop form, show mobile stepper ---- */
    #tab-new-referral > .card { display: none !important; }
    .mobile-referral-stepper  { display: flex !important; flex-direction: column; }
}

/* ============================================================
   MOBILE STEPPER COMPONENT STYLES
   (social-prescribing.html Neue Zuweisung — ≤767px)
   ============================================================ */

@media (max-width: 767px) {
    .stepper-header {
        background: var(--surface);
        border-bottom: 1px solid var(--border);
        padding: 1rem 1rem 0.75rem;
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 0.4rem;
        margin-bottom: 1rem;
        border-radius: 12px;
    }

    .stepper-dots {
        display: flex;
        gap: 8px;
    }

    .stepper-dot {
        width: 8px;
        height: 8px;
        border-radius: 50%;
        background: var(--border);
        transition: background 0.2s;
    }

    .stepper-dot.active { background: var(--purple); }
    .stepper-dot.done   { background: var(--green); }

    .stepper-progress-text {
        font-size: 0.72rem;
        color: var(--muted);
    }

    .stepper-step { display: none; }
    .stepper-step.active { display: block; }

    .stepper-question {
        font-size: 1.1rem;
        font-weight: 700;
        color: var(--text);
        margin-bottom: 0.35rem;
        font-family: 'Space Grotesk', sans-serif;
    }

    .stepper-hint {
        font-size: 0.8rem;
        color: var(--muted);
        margin-bottom: 1.25rem;
    }

    .stepper-field {
        width: 100%;
        background: var(--surface);
        border: 1.5px solid var(--border);
        border-radius: 10px;
        padding: 0.75rem 0.9rem;
        font-size: 1rem;
        color: var(--text);
        outline: none;
        font-family: inherit;
        margin-bottom: 0.75rem;
        box-sizing: border-box;
        transition: border-color 0.15s;
        min-height: 44px;
    }

    .stepper-field:focus { border-color: var(--purple); }

    .stepper-urgency-options {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 10px;
        margin-top: 4px;
    }

    .urgency-option {
        background: var(--surface);
        border: 2px solid var(--border);
        border-radius: 12px;
        padding: 12px 8px;
        text-align: center;
        cursor: pointer;
        transition: all 0.15s;
        -webkit-tap-highlight-color: transparent;
        min-height: 44px;
    }

    .urgency-option.selected {
        border-color: var(--purple);
        background: var(--purple-dim);
    }

    .urgency-option-icon  { font-size: 1.4rem; margin-bottom: 3px; }
    .urgency-option-label { font-size: 0.8rem; font-weight: 600; color: var(--text); }
    .urgency-option-sub   { font-size: 0.68rem; color: var(--muted); margin-top: 1px; }

    .stepper-summary {
        background: var(--surface);
        border-radius: 10px;
        overflow: hidden;
        margin-top: 8px;
    }

    .stepper-summary-row {
        display: flex;
        justify-content: space-between;
        align-items: flex-start;
        gap: 12px;
        padding: 9px 12px;
        border-bottom: 1px solid var(--border);
        font-size: 0.83rem;
    }

    .stepper-summary-row:last-child { border-bottom: none; }
    .stepper-summary-label { color: var(--muted); font-size: 0.75rem; flex-shrink: 0; }
    .stepper-summary-val   { color: var(--text); text-align: right; }

    .stepper-nav {
        display: flex;
        gap: 10px;
        padding: 1rem 0 0;
        margin-top: auto;
    }

    .stepper-btn-back {
        padding: 12px 16px;
        border: 1px solid var(--border);
        border-radius: 10px;
        background: transparent;
        color: var(--muted);
        font-size: 0.875rem;
        font-weight: 500;
        font-family: inherit;
        cursor: pointer;
        -webkit-tap-highlight-color: transparent;
        min-height: 44px;
    }

    .stepper-btn-next {
        flex: 1;
        padding: 12px 16px;
        border: none;
        border-radius: 10px;
        background: var(--purple);
        color: #fff;
        font-size: 0.875rem;
        font-weight: 600;
        font-family: inherit;
        cursor: pointer;
        -webkit-tap-highlight-color: transparent;
        min-height: 44px;
    }

    .stepper-btn-next:disabled {
        background: var(--border);
        color: var(--muted);
        cursor: not-allowed;
    }
}

/* ============================================================
   PHASE 2: FILTER SHEET UTILITY CLASSES (mobile ≤767px)
   ============================================================ */

@media (max-width: 767px) {

    /* ---- Filter sheet inner structure ---- */
    .filter-sheet-group {
        padding: 12px 16px;
        border-bottom: 1px solid var(--border);
    }

    .filter-sheet-group-label {
        font-size: 0.72rem;
        font-weight: 600;
        text-transform: uppercase;
        letter-spacing: 0.06em;
        color: var(--muted);
        margin-bottom: 8px;
    }

    .filter-sheet-select {
        width: 100%;
        background: var(--bg);
        border: 1px solid var(--border);
        border-radius: 8px;
        padding: 10px 12px;
        font-size: 0.9rem;
        color: var(--text);
        outline: none;
        font-family: inherit;
        min-height: 44px;
        box-sizing: border-box;
        -webkit-appearance: none;
        appearance: none;
    }

    .filter-sheet-actions {
        display: flex;
        gap: 10px;
        padding: 14px 16px 28px;
    }

    .filter-sheet-actions .btn {
        flex: 1;
        min-height: 44px;
    }

    /* ---- Category chip grid inside drawer ---- */
    .filter-sheet-cat-grid {
        display: flex;
        flex-wrap: wrap;
        gap: 8px;
        padding: 14px 16px;
    }

    .filter-cat-chip {
        display: inline-flex;
        align-items: center;
        padding: 8px 14px;
        border-radius: 100px;
        font-size: 0.8rem;
        font-weight: 500;
        cursor: pointer;
        border: 1.5px solid var(--border);
        background: var(--surface);
        color: var(--muted);
        transition: all 0.15s;
        -webkit-tap-highlight-color: transparent;
        min-height: 44px;
        box-sizing: border-box;
        line-height: 1.2;
        font-family: inherit;
    }

    .filter-cat-chip.active                  { font-weight: 600; border-width: 2px; }
    .filter-cat-chip.active.scat-green       { background: rgba(16,185,129,0.12);  color: #10b981; border-color: rgba(16,185,129,0.45); }
    .filter-cat-chip.active.scat-purple      { background: rgba(139,92,246,0.12);  color: #8b5cf6; border-color: rgba(139,92,246,0.45); }
    .filter-cat-chip.active.scat-blue        { background: rgba(59,130,246,0.12);  color: #3b82f6; border-color: rgba(59,130,246,0.45); }
    .filter-cat-chip.active.scat-amber       { background: rgba(245,158,11,0.12);  color: #f59e0b; border-color: rgba(245,158,11,0.45); }
    .filter-cat-chip.active.scat-cyan        { background: rgba(34,211,238,0.12);  color: #22d3ee; border-color: rgba(34,211,238,0.45); }
    .filter-cat-chip.active.scat-warm        { background: rgba(251,146,60,0.12);  color: #fb923c; border-color: rgba(251,146,60,0.45); }
    .filter-cat-chip.active.scat-teal        { background: rgba(20,184,166,0.12);  color: #14b8a6; border-color: rgba(20,184,166,0.45); }
    .filter-cat-chip.active.scat-red         { background: rgba(239,68,68,0.12);   color: #ef4444; border-color: rgba(239,68,68,0.45); }
    .filter-cat-chip.active.scat-pink        { background: rgba(236,72,153,0.12);  color: #ec4899; border-color: rgba(236,72,153,0.45); }
    .filter-cat-chip.active.scat-indigo      { background: rgba(99,102,241,0.12);  color: #6366f1; border-color: rgba(99,102,241,0.45); }

    /* ---- Directory active filter chips row ---- */
    .mobile-dir-filter-chips {
        display: flex;
        flex-wrap: wrap;
        gap: 6px;
        padding: 0 0 8px;
        min-height: 0;
    }

    .mobile-dir-filter-chip {
        display: inline-flex;
        align-items: center;
        gap: 4px;
        padding: 3px 8px;
        border-radius: 100px;
        font-size: 0.75rem;
        background: var(--purple-dim);
        color: var(--purple);
        border: 1px solid rgba(139, 92, 246, 0.3);
    }
}
