:root {
    --primary: #5a2d82;
    --primary-dark: #432060;
    --primary-soft: #f2ecf8;
    --border: #dfd3ea;
    --text: #2d2433;
    --muted: #7c7084;
    --surface: #ffffff;
    --danger: #b42318;
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    min-height: 100%;
    font-family: Tahoma, Arial, sans-serif;
    background: #faf8fc;
    color: var(--text);
}

body { padding-bottom: 82px; }

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

.topbar {
    position: sticky;
    top: 0;
    z-index: 30;
    height: 64px;
    padding: 8px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--primary);
    color: white;
}

.brand {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 700;
}

.brand img {
    width: 42px;
    height: 42px;
    object-fit: contain;
    border-radius: 10px;
}

.user-name { font-size: 13px; }

.app-shell {
    width: min(100%, 1200px);
    margin: auto;
    padding: 16px;
}

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

h1 { font-size: 23px; margin: 0; }
h2 { font-size: 20px; }

.muted { color: var(--muted); font-size: 13px; margin-top: 4px; }

.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 18px;
    padding: 14px;
    box-shadow: 0 8px 24px rgba(67,32,96,.06);
}

.btn {
    border: 0;
    border-radius: 13px;
    min-height: 44px;
    padding: 10px 18px;
    font-weight: 700;
    cursor: pointer;
    text-align: center;
}

.btn-primary { background: var(--primary); color: white; }

.stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 9px;
    margin-bottom: 14px;
}

.stat {
    background: white;
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 13px 8px;
    text-align: center;
}

.stat strong { display: block; color: var(--primary); font-size: 23px; }
.stat span { color: var(--muted); font-size: 12px; }

.appointment-row,
.list-row {
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 62px;
    border-bottom: 1px solid #eee7f3;
}

.appointment-row:last-child,
.list-row:last-child { border-bottom: 0; }

.appointment-row .time {
    min-width: 58px;
    color: var(--primary);
    font-weight: 700;
}

.appointment-row strong,
.list-row strong { display: block; }

.appointment-row span,
.list-row span {
    display: block;
    color: var(--muted);
    font-size: 13px;
    margin-top: 3px;
}

.list-row { justify-content: space-between; }

.badge {
    background: var(--primary-soft);
    color: var(--primary);
    border-radius: 999px;
    padding: 6px 10px;
    font-size: 12px;
}

.quick-links {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 9px;
    margin-top: 14px;
}

.quick-links a {
    background: var(--primary-soft);
    color: var(--primary);
    border-radius: 14px;
    padding: 14px 6px;
    text-align: center;
    font-weight: 700;
    font-size: 13px;
}

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

label { font-weight: 700; font-size: 14px; }

input, select, textarea {
    width: 100%;
    min-height: 46px;
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 10px 12px;
    background: white;
    color: var(--text);
    font: inherit;
}

textarea { resize: vertical; }

.check {
    display: flex;
    gap: 8px;
    align-items: center;
}

.check input { width: auto; min-height: auto; }

.validation { color: var(--danger); font-size: 13px; }

.search-form { margin-bottom: 12px; }

.empty {
    text-align: center;
    color: var(--muted);
    padding: 30px 10px;
}

.bottom-nav {
    position: fixed;
    bottom: 0;
    right: 0;
    left: 0;
    z-index: 40;
    min-height: 68px;
    padding: 8px max(12px, env(safe-area-inset-right)) calc(8px + env(safe-area-inset-bottom)) max(12px, env(safe-area-inset-left));
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    align-items: center;
    background: white;
    border-top: 1px solid var(--border);
}

.bottom-nav a {
    text-align: center;
    font-size: 12px;
    color: var(--muted);
}

.bottom-nav .nav-main {
    width: 50px;
    height: 50px;
    line-height: 48px;
    justify-self: center;
    border-radius: 50%;
    background: var(--primary);
    color: white;
    font-size: 28px;
}

.login-page {
    min-height: 100vh;
    padding: 24px;
    display: grid;
    place-items: center;
    background: linear-gradient(145deg, var(--primary), var(--primary-dark));
}

.login-card {
    width: min(100%, 390px);
    background: white;
    border-radius: 24px;
    padding: 26px;
    text-align: center;
    box-shadow: 0 18px 50px rgba(0,0,0,.22);
}

.login-logo {
    width: 110px;
    height: 110px;
    object-fit: contain;
    border-radius: 18px;
}

.login-card h1 { margin-top: 10px; color: var(--primary); }
.login-card p { color: var(--muted); }
.login-card form { display: grid; gap: 10px; text-align: right; }
.login-card small { display: block; margin-top: 14px; color: var(--muted); }

.date-switch {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    margin-bottom: 12px;
}

.date-switch a {
    padding: 9px 4px;
    background: var(--primary-soft);
    color: var(--primary);
    border-radius: 10px;
    text-align: center;
    font-size: 12px;
    font-weight: 700;
}

.schedule-wrap {
    overflow: auto;
    border: 1px solid var(--border);
    border-radius: 16px;
    background: white;
    max-height: calc(100vh - 210px);
}

.schedule-grid {
    display: grid;
    grid-template-columns: 64px repeat(var(--staff-count), minmax(125px, 1fr));
    min-width: calc(64px + (var(--staff-count) * 125px));
}

.corner-cell,
.staff-head,
.time-cell,
.slot {
    border-left: 1px solid #eee7f3;
    border-bottom: 1px solid #eee7f3;
}

.corner-cell,
.staff-head {
    position: sticky;
    top: 0;
    z-index: 12;
    min-height: 48px;
    background: var(--primary);
    color: white;
}

.corner-cell { right: 0; z-index: 14; }

.staff-head {
    display: grid;
    place-items: center;
    font-weight: 700;
}

.time-cell {
    position: sticky;
    right: 0;
    z-index: 8;
    min-height: 46px;
    padding: 8px 5px;
    background: #faf8fc;
    color: var(--muted);
    font-size: 11px;
    text-align: center;
}

.slot {
    min-height: 46px;
    padding: 3px;
    background: white;
}

.slot.drag-over { background: #efe5f8; }

.appointment-card {
    border-right: 4px solid var(--primary);
    background: var(--primary-soft);
    border-radius: 9px;
    padding: 6px;
    cursor: grab;
    font-size: 11px;
}

.appointment-card strong,
.appointment-card span,
.appointment-card small {
    display: block;
}

.appointment-card span,
.appointment-card small {
    color: var(--muted);
    margin-top: 2px;
}

.suggestions {
    position: relative;
    z-index: 20;
}

.suggestion-item {
    background: white;
    border: 1px solid var(--border);
    border-top: 0;
    padding: 10px;
    cursor: pointer;
}

.hidden { display: none !important; }

@media (min-width: 768px) {
    .app-shell { padding: 24px; }
    .bottom-nav { max-width: 700px; margin: auto; border: 1px solid var(--border); border-bottom: 0; border-radius: 18px 18px 0 0; }
}

.btn-soft{background:var(--primary-soft);color:var(--primary)}.btn-danger{background:#b42318;color:#fff}.wide{width:100%;margin-top:12px}.view-tabs{display:grid;grid-template-columns:repeat(3,1fr);gap:6px;margin-bottom:10px}.view-tabs a{padding:9px;text-align:center;border-radius:10px;background:#fff;border:1px solid var(--border)}.view-tabs .active{background:var(--primary);color:#fff}.status-cancelled{opacity:.55}.status-completed{filter:saturate(.65)}.detail-card{border-right:6px solid var(--service-color)}.detail-title{display:flex;justify-content:space-between;align-items:center;font-size:20px}.detail-card dl{display:grid;grid-template-columns:90px 1fr;gap:10px}.detail-card dt{color:var(--muted)}.detail-card dd{margin:0}.status{padding:5px 9px;border-radius:999px;background:var(--primary-soft);font-size:12px}.action-grid{display:grid;grid-template-columns:repeat(2,1fr);gap:8px;margin-top:12px}.action-grid form,.action-grid button{width:100%}.week-grid{display:grid;gap:10px}.day-column{background:#fff;border:1px solid var(--border);border-radius:14px;padding:10px}.day-title{display:flex;justify-content:space-between;margin-bottom:7px;color:var(--primary)}.mini-appt{display:block;border-right:4px solid var(--primary);background:var(--primary-soft);padding:8px;border-radius:8px;margin:5px 0}.mini-appt span{display:block;color:var(--muted);font-size:12px}.mini{padding:10px}.month-grid{display:grid;grid-template-columns:repeat(7,1fr);gap:4px}.month-day{min-height:68px;background:#fff;border:1px solid var(--border);padding:5px;border-radius:8px;overflow:hidden}.month-day.outside{opacity:.35}.month-day span{display:block;font-size:9px;color:var(--muted)}.month-day i{display:inline-block;width:7px;height:7px;border-radius:50%;margin:2px}.section-title{margin:18px 0 8px}.color-dot{display:inline-block;width:10px;height:10px;border-radius:50%;margin-left:7px}.success{padding:10px;background:#e8f6ec;color:#16753a;border-radius:10px;margin-bottom:10px}.two-cols,.filter-row{display:grid;grid-template-columns:1fr 1fr;gap:10px}.attendance-row{display:flex;justify-content:space-between;align-items:center;padding:10px 0;border-bottom:1px solid var(--border)}.attendance-row span{display:block;color:var(--muted);font-size:12px}.geo-form{margin:0}.report-stats{grid-template-columns:repeat(2,1fr);margin-top:12px}.report-grid{display:grid;gap:12px}.metric-row{display:flex;justify-content:space-between;padding:9px 0;border-bottom:1px solid var(--border)}.more-menu{position:fixed;left:12px;right:12px;bottom:78px;z-index:50;display:none;background:#fff;border:1px solid var(--border);border-radius:16px;padding:10px;box-shadow:0 12px 35px rgba(0,0,0,.18);grid-template-columns:repeat(2,1fr);gap:6px}.more-menu.open{display:grid}.more-menu a{padding:11px;background:var(--primary-soft);border-radius:10px;text-align:center;color:var(--primary);font-weight:700}@media(min-width:800px){.week-grid{grid-template-columns:repeat(7,1fr)}.report-grid{grid-template-columns:1fr 1fr}.report-stats{grid-template-columns:repeat(4,1fr)}}

/* ===== Tima mobile interface refinement ===== */
html, body {
    font-family: "Tajawal", "Segoe UI", Tahoma, Arial, sans-serif;
    overflow-x: hidden;
}

body { padding-bottom: 78px; }
body.menu-open { overflow: hidden; }

.topbar {
    height: 60px;
    padding: 7px 12px;
    display: grid;
    grid-template-columns: 44px 1fr 80px;
    gap: 8px;
}

.menu-toggle,
.menu-close,
.bottom-nav button {
    border: 0;
    background: transparent;
    font: inherit;
    cursor: pointer;
}

.menu-toggle {
    width: 42px;
    height: 42px;
    padding: 9px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    border-radius: 12px;
    background: rgba(255,255,255,.13);
}
.menu-toggle span { display: block; height: 2px; border-radius: 3px; background: #fff; }
.brand { justify-self: center; }
.brand img { width: 38px; height: 38px; }
.user-name { justify-self: end; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 80px; }

.menu-backdrop {
    position: fixed;
    inset: 0;
    z-index: 79;
    background: rgba(22, 11, 31, .46);
    opacity: 0;
    pointer-events: none;
    transition: opacity .2s ease;
}
.menu-backdrop.open { opacity: 1; pointer-events: auto; }

.app-menu {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    z-index: 80;
    width: min(88vw, 360px);
    padding: 14px;
    overflow-y: auto;
    background: #fff;
    box-shadow: -18px 0 45px rgba(39, 20, 52, .22);
    transform: translateX(105%);
    transition: transform .24s ease;
}
.app-menu.open { transform: translateX(0); }
.menu-head { display: flex; justify-content: space-between; align-items: center; padding-bottom: 14px; border-bottom: 1px solid var(--border); }
.menu-brand { display: flex; align-items: center; gap: 10px; }
.menu-brand img { width: 48px; height: 48px; border-radius: 13px; }
.menu-brand strong, .menu-brand span { display: block; }
.menu-brand strong { color: var(--primary); font-size: 18px; }
.menu-brand span { color: var(--muted); font-size: 12px; margin-top: 2px; }
.menu-close { width: 40px; height: 40px; border-radius: 50%; color: var(--primary); background: var(--primary-soft); font-size: 27px; }
.menu-section { padding: 15px 0; border-bottom: 1px solid var(--border); display: grid; gap: 6px; }
.menu-title { margin-bottom: 4px; color: var(--muted); font-size: 12px; font-weight: 800; }
.menu-section a { min-height: 45px; display: flex; align-items: center; padding: 10px 13px; border-radius: 12px; background: #faf8fc; font-weight: 600; }
.menu-section a:active { background: var(--primary-soft); color: var(--primary); }
.admin-section { margin-top: 4px; }
.admin-section .menu-title { color: var(--primary); }
.menu-logout { width: 100%; min-height: 46px; margin-top: 15px; border: 0; border-radius: 12px; background: #fff0f0; color: #a61b1b; font: inherit; font-weight: 700; }

.app-shell { width: 100%; max-width: 100%; padding: 12px; }
.day-page { width: 100%; min-width: 0; }
.day-head { margin-bottom: 10px; }
.day-head h1 { font-size: 22px; }
.add-round { width: 45px; min-width: 45px; padding: 0; border-radius: 50%; font-size: 26px; display: grid; place-items: center; }

.bottom-nav {
    min-height: 66px;
    grid-template-columns: repeat(5, 1fr);
    padding-top: 6px;
}
.bottom-nav a,
.bottom-nav button {
    color: var(--muted);
    text-align: center;
    display: grid;
    place-items: center;
    gap: 1px;
    padding: 0;
}
.bottom-nav span { font-size: 20px; line-height: 1; }
.bottom-nav small { font-size: 10px; }
.bottom-nav .nav-main { display: grid; width: 48px; height: 48px; line-height: normal; }

.view-tabs { margin-bottom: 8px; }
.view-tabs a { min-height: 40px; display: grid; place-items: center; padding: 7px; font-weight: 700; }
.compact-switch { margin-bottom: 8px; }
.compact-switch a { min-height: 38px; display: grid; place-items: center; }

.status-legend { display: flex; gap: 6px; overflow-x: auto; padding: 2px 0 8px; }
.legend { white-space: nowrap; padding: 5px 9px; border-radius: 999px; font-size: 11px; font-weight: 700; }
.legend.confirmed { background: #eee7f7; color: #5a2d82; }
.legend.arrived { background: #e7f3ff; color: #1769aa; }
.legend.inservice { background: #fff1d6; color: #9b5b00; }
.schedule-note { color: var(--muted); font-size: 11px; margin: 0 2px 7px; }

.schedule-wrap {
    width: calc(100vw - 24px);
    max-width: 100%;
    max-height: calc(100dvh - 295px);
    border-radius: 14px;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
}
.schedule-grid {
    direction: rtl;
    grid-template-columns: 52px repeat(var(--staff-count), minmax(108px, 108px));
    min-width: calc(52px + (var(--staff-count) * 108px));
}
.corner-cell,
.staff-head { min-height: 58px; }
.corner-cell { display: grid; place-items: center; font-size: 10px; right: 0; }
.staff-head {
    padding: 4px 2px;
    border-top: 0 !important;
    border-bottom: 4px solid var(--employee-color);
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 3px;
    font-size: 11px;
}
.staff-avatar {
    width: 27px;
    height: 27px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    background: rgba(255,255,255,.18);
    font-size: 12px;
}
.time-cell { min-height: 48px; right: 0; padding: 14px 2px 3px; font-size: 10px; }
.slot { min-height: 48px; padding: 3px; transition: background .15s ease; }
.slot.drag-over { background: #e9ddf5; box-shadow: inset 0 0 0 2px var(--primary); }

.appointment-card {
    min-height: 42px;
    padding: 6px 7px;
    border: 1px solid color-mix(in srgb, var(--service-color) 34%, white);
    border-right: 5px solid var(--service-color) !important;
    border-radius: 10px;
    background: linear-gradient(135deg, color-mix(in srgb, var(--service-color) 10%, white), #fff);
    box-shadow: 0 3px 10px rgba(57, 29, 76, .08);
    color: var(--text);
    overflow: hidden;
    cursor: grab;
    touch-action: pan-x pan-y;
}
.appointment-card.dragging { opacity: .42; transform: scale(.97); }
.appt-topline { display: flex; align-items: flex-start; justify-content: space-between; gap: 3px; }
.appointment-card strong { font-size: 12px; line-height: 1.2; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.appt-status { flex: 0 0 auto; padding: 2px 4px; border-radius: 999px; font-size: 8px; font-weight: 800; }
.appt-service { font-size: 10px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.appointment-card .appt-time { font-size: 9px; font-weight: 700; color: var(--muted); }
.status-confirmed .appt-status { background: #eee7f7; color: #5a2d82; }
.status-arrived .appt-status { background: #e7f3ff; color: #1769aa; }
.status-inservice .appt-status { background: #fff1d6; color: #9b5b00; }

.detail-card { padding: 16px; border-right-width: 5px; }
.detail-title { gap: 10px; align-items: flex-start; }
.detail-title > div { min-width: 0; }
.detail-title strong { display: block; font-size: 21px; }
.detail-title > div span { color: var(--muted); font-size: 12px; }
.detail-list { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; margin-top: 16px; }
.detail-list > div { background: #faf8fc; border-radius: 12px; padding: 10px; min-width: 0; }
.detail-list .full { grid-column: 1 / -1; }
.detail-list span, .detail-list strong { display: block; }
.detail-list span { color: var(--muted); font-size: 11px; }
.detail-list strong { margin-top: 3px; font-size: 14px; overflow-wrap: anywhere; }
.edit-main { margin: 10px 0 14px; }
.status-panel { margin-top: 6px; }
.status-panel h2 { font-size: 17px; margin: 0 0 9px; }
.status-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.status-action {
    min-height: 48px;
    border: 1px solid transparent;
    border-radius: 13px;
    font: inherit;
    font-weight: 700;
    cursor: pointer;
}
.status-action.confirmed { background: #eee7f7; color: #5a2d82; }
.status-action.arrived { background: #e7f3ff; color: #1769aa; }
.status-action.inservice { background: #fff1d6; color: #9b5b00; }
.status-action.completed { background: #e3f6e9; color: #18723a; }
.status-action.cancelled { background: #fde9e9; color: #a61b1b; }
.status-action.selected { box-shadow: inset 0 0 0 2px currentColor; }
.status-action:disabled { opacity: .55; }
.inline-message { margin-top: 9px; padding: 10px; border-radius: 10px; background: var(--primary-soft); color: var(--primary); font-size: 12px; }
.status.status-confirmed { background: #eee7f7; color: #5a2d82; }
.status.status-arrived { background: #e7f3ff; color: #1769aa; }
.status.status-inservice { background: #fff1d6; color: #9b5b00; }
.status.status-completed { background: #e3f6e9; color: #18723a; }
.status.status-cancelled { background: #fde9e9; color: #a61b1b; }

.app-toast {
    position: fixed;
    z-index: 120;
    left: 50%;
    bottom: 88px;
    max-width: calc(100vw - 32px);
    padding: 10px 16px;
    border-radius: 999px;
    background: #212121;
    color: #fff;
    font-size: 13px;
    opacity: 0;
    transform: translate(-50%, 12px);
    pointer-events: none;
    transition: .2s ease;
}
.app-toast.show { opacity: 1; transform: translate(-50%, 0); }
.app-toast.error { background: #a61b1b; }

@media (max-width: 380px) {
    .app-shell { padding: 9px; }
    .schedule-wrap { width: calc(100vw - 18px); }
    .schedule-grid { grid-template-columns: 48px repeat(var(--staff-count), minmax(102px, 102px)); min-width: calc(48px + (var(--staff-count) * 102px)); }
    .detail-list { grid-template-columns: 1fr; }
    .detail-list .full { grid-column: auto; }
}

@media (min-width: 768px) {
    .app-shell { max-width: 1200px; padding: 20px; }
    .schedule-wrap { width: 100%; max-height: calc(100vh - 275px); }
    .schedule-grid { grid-template-columns: 62px repeat(var(--staff-count), minmax(130px, 1fr)); min-width: calc(62px + (var(--staff-count) * 130px)); }
    .app-menu { width: 370px; }
}


/* Appointment period, attendance-aware day view and unified outline icons */
svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.bottom-nav svg { width: 21px; height: 21px; }
.bottom-nav a, .bottom-nav button { color: #776b80; }
.bottom-nav .nav-main svg { width: 25px; height: 25px; color: #fff; }
.add-round { width: 46px; height: 46px; padding: 0; display: grid; place-items: center; border-radius: 50%; }
.add-round svg { width: 25px; height: 25px; }
.icon-button { width: 42px; height: 42px; display: grid; place-items: center; border-radius: 50%; background: #fff; border: 1px solid var(--border); color: var(--primary); }
.simple-mobile-head { display: grid; grid-template-columns: 42px 1fr 42px; text-align: center; }
.simple-mobile-head h1 { align-self: center; }
.time-range-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.time-range-grid > div { display: grid; gap: 7px; }
.field-help { margin-top: -2px; color: var(--muted); font-size: 12px; }
.input-icon-wrap { position: relative; }
.input-icon-wrap > svg { position: absolute; right: 13px; top: 50%; transform: translateY(-50%); width: 19px; height: 19px; color: #9b8ea5; pointer-events: none; }
.input-icon-wrap > input { padding-right: 44px; }
.empty-attendance { display: grid; gap: 6px; margin-bottom: 12px; text-align: center; }
.empty-attendance span { color: var(--muted); font-size: 12px; }
.staff-head { padding: 6px 3px; gap: 2px; align-content: center; }
.staff-head small { font-size: 9px; color: rgba(255,255,255,.85); font-weight: 600; }
.staff-head .attendance-badge { display: inline-flex; align-items: center; justify-content: center; min-height: 17px; padding: 2px 6px; border-radius: 999px; font-size: 8px; font-weight: 800; background: rgba(255,255,255,.18); }
.staff-head.absent { background: #fff0f1 !important; color: #b42318 !important; border-top: 3px solid #d92d20; }
.staff-head.absent .staff-avatar { background: #d92d20; color: #fff; }
.staff-head.absent small { color: #b42318; }
.staff-head.absent .attendance-badge { background: #fee4e2; color: #b42318; }
.appointment-card { display: flex !important; align-items: flex-start; gap: 6px; min-height: 42px; border-right-width: 4px; overflow: hidden; }
.appointment-card .service-icon { flex: 0 0 22px; width: 22px; height: 22px; display: grid; place-items: center; border-radius: 8px; color: var(--service-color); background: color-mix(in srgb, var(--service-color) 12%, white); }
.appointment-card .service-icon svg { width: 15px; height: 15px; }
.appointment-card .appt-content { min-width: 0; flex: 1; }
.appointment-card .appt-time { direction: ltr; text-align: right; }
@media (max-width: 520px) {
    .appointment-form { border: 0; box-shadow: none; padding: 10px 2px 22px; background: transparent; }
    .appointment-form input, .appointment-form select, .appointment-form textarea { background: #fff; }
    .time-range-grid { gap: 8px; }
    .staff-head { min-height: 82px !important; }
    .schedule-grid { grid-template-columns: 48px repeat(var(--staff-count), minmax(112px, 112px)) !important; min-width: calc(48px + (var(--staff-count) * 112px)) !important; }
}

/* ===== Appointment mobile layout correction ===== */
.time-select {
    appearance: none;
    -webkit-appearance: none;
    min-height: 52px;
    padding: 10px 14px;
    background-color: #fff;
    background-image: linear-gradient(45deg, transparent 50%, #7b6b86 50%), linear-gradient(135deg, #7b6b86 50%, transparent 50%);
    background-position: 16px calc(50% - 3px), 10px calc(50% - 3px);
    background-size: 6px 6px, 6px 6px;
    background-repeat: no-repeat;
    direction: rtl;
}

.appointment-form {
    max-width: 520px;
    margin-inline: auto;
}

.appointment-card {
    position: relative;
    padding-left: 28px !important;
}

.drag-handle {
    position: absolute;
    left: 3px;
    top: 50%;
    transform: translateY(-50%);
    width: 24px;
    height: 32px;
    display: grid !important;
    place-items: center;
    color: #8b7b96 !important;
    border-radius: 8px;
    cursor: grab;
    touch-action: none;
    z-index: 3;
}
.drag-handle:active { cursor: grabbing; background: rgba(90,45,130,.10); }
.drag-handle svg { width: 18px !important; height: 18px !important; }

.touch-drag-ghost {
    position: fixed !important;
    z-index: 9999 !important;
    width: 150px !important;
    min-height: 48px !important;
    pointer-events: none !important;
    opacity: .92 !important;
    transform: rotate(-2deg) scale(1.03) !important;
    box-shadow: 0 16px 35px rgba(35, 18, 48, .28) !important;
}

@media (max-width: 520px) {
    body { background: #fff; }
    .app-shell { padding: 10px 10px 92px; }
    .topbar { height: 58px; padding: 7px 12px; }
    .brand img { width: 38px; height: 38px; }
    .page-head { margin-bottom: 10px; }
    .page-head h1 { font-size: 21px; }
    .day-head { align-items: center; }
    .view-tabs, .compact-switch { gap: 6px; }
    .view-tabs a, .compact-switch a { min-height: 42px; display: grid; place-items: center; }
    .status-legend { overflow-x: auto; flex-wrap: nowrap; padding-bottom: 3px; }
    .schedule-note { font-size: 10px; }
    .schedule-wrap {
        width: calc(100vw - 20px) !important;
        max-height: calc(100dvh - 300px) !important;
        border-radius: 16px;
        margin-inline: auto;
    }
    .schedule-grid {
        grid-template-columns: 50px repeat(var(--staff-count), 118px) !important;
        min-width: calc(50px + (var(--staff-count) * 118px)) !important;
    }
    .staff-head { min-height: 76px !important; }
    .slot, .time-cell { min-height: 50px; }
    .appointment-card { min-height: 44px; }
    .time-range-grid { grid-template-columns: 1fr 1fr; }
    .appointment-form { width: 100%; padding-inline: 0; }
    .appointment-form label { font-size: 13px; }
    .appointment-form input,
    .appointment-form select,
    .appointment-form textarea { min-height: 52px; border-radius: 14px; }
}

/* ===== Full appointment duration blocks + polished mobile day view ===== */
:root { --schedule-slot-height: 48px; }

.day-page {
    width: 100%;
    max-width: 100%;
}

.day-head {
    position: sticky;
    top: 58px;
    z-index: 18;
    margin: -10px -2px 12px;
    padding: 12px 4px 10px;
    background: rgba(250,248,252,.96);
    backdrop-filter: blur(10px);
}

.day-head h1 { font-size: 22px; font-weight: 800; }
.view-tabs,
.compact-switch {
    border-radius: 14px;
    overflow: hidden;
}

.schedule-wrap {
    background: #fff;
    box-shadow: 0 10px 30px rgba(77,42,104,.08);
}

.time-cell,
.slot {
    height: var(--schedule-slot-height);
    min-height: var(--schedule-slot-height) !important;
}

.slot {
    position: relative;
    overflow: visible;
    padding: 0 3px;
}

.appointment-card {
    position: absolute !important;
    z-index: 9;
    top: 3px;
    right: 4px;
    left: 4px;
    height: calc((var(--duration-slots) * var(--schedule-slot-height)) - 6px);
    min-height: calc((var(--duration-slots) * var(--schedule-slot-height)) - 6px) !important;
    max-height: none;
    padding: 9px 9px 9px 32px !important;
    align-items: flex-start !important;
    border-radius: 13px;
    box-shadow: 0 7px 18px rgba(62,35,81,.14);
    background: linear-gradient(145deg, color-mix(in srgb, var(--service-color) 13%, white), #fff 72%);
}

.appointment-card:hover { z-index: 20; }
.appointment-card .appt-content { overflow: hidden; }
.appointment-card .appt-topline { align-items: center; }
.appointment-card .appt-service { margin-top: 4px; }
.appointment-card .appt-time { margin-top: 5px; font-size: 10px; }
.appointment-card .drag-handle {
    left: 4px;
    top: 12px;
    transform: none;
}

/* Long appointments remain readable while visually blocking every 15-minute slot. */
.appointment-card[data-duration-slots="1"] .appt-service,
.appointment-card[data-duration-slots="1"] .service-icon { display: none; }
.appointment-card[data-duration-slots="1"] { padding-top: 5px !important; }

.staff-head {
    min-height: 76px !important;
    box-shadow: inset 0 -1px rgba(255,255,255,.18);
}
.staff-head strong { font-size: 12px; }

.menu-section a {
    display: flex;
    align-items: center;
    gap: 11px;
}
.menu-section a svg {
    width: 19px;
    height: 19px;
    flex: 0 0 19px;
    color: var(--primary);
}

@media (max-width: 520px) {
    :root { --schedule-slot-height: 52px; }
    .app-shell { padding: 10px 8px 92px; }
    .day-head { top: 58px; }
    .page-head.day-head .muted { font-size: 11px; }
    .view-tabs a { min-height: 44px; display: grid; place-items: center; }
    .compact-switch a { min-height: 40px; display: grid; place-items: center; }
    .status-legend { overflow-x: auto; flex-wrap: nowrap; padding-bottom: 2px; }
    .schedule-wrap {
        width: calc(100vw - 16px) !important;
        border-radius: 16px;
        max-height: calc(100dvh - 278px) !important;
    }
    .schedule-grid {
        grid-template-columns: 50px repeat(var(--staff-count), 118px) !important;
        min-width: calc(50px + (var(--staff-count) * 118px)) !important;
    }
    .appointment-card { right: 3px; left: 3px; }
}

/* ===== Compact employee header and tighter 15-minute rows ===== */
:root { --schedule-slot-height: 38px; }

.staff-head {
    min-height: 54px !important;
    height: 54px;
    padding: 5px 6px !important;
    display: flex !important;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px !important;
}

.staff-main-line,
.staff-meta-line {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    width: 100%;
    white-space: nowrap;
}

.staff-main-line .staff-avatar {
    width: 24px;
    height: 24px;
    flex: 0 0 24px;
    font-size: 10px;
}

.staff-main-line strong {
    font-size: 12px;
    line-height: 1;
    overflow: hidden;
    text-overflow: ellipsis;
}

.staff-meta-line small {
    font-size: 9px !important;
    line-height: 1;
}

.staff-meta-line .attendance-badge {
    min-height: 16px !important;
    padding: 2px 6px !important;
    font-size: 8px !important;
    line-height: 1;
}

.time-cell,
.slot {
    height: var(--schedule-slot-height) !important;
    min-height: var(--schedule-slot-height) !important;
}

.time-cell {
    padding: 4px 2px !important;
    font-size: 9px !important;
    display: grid;
    place-items: center;
}

.appointment-card {
    height: calc((var(--duration-slots) * var(--schedule-slot-height)) - 4px) !important;
    min-height: calc((var(--duration-slots) * var(--schedule-slot-height)) - 4px) !important;
    top: 2px !important;
}

@media (max-width: 520px) {
    :root { --schedule-slot-height: 38px; }
    .staff-head { min-height: 52px !important; height: 52px; }
    .schedule-wrap { max-height: calc(100dvh - 245px) !important; }
}


/* ===== Calendar tabs, geofence messages and mobile pointer dragging ===== */
.calendar-page .view-tabs {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    margin-bottom: 10px;
}
.calendar-page .view-tabs a {
    min-height: 46px;
    display: grid;
    place-items: center;
    border: 1px solid var(--border);
    border-radius: 13px;
    background: #fff;
    color: var(--text);
    font-weight: 800;
}
.calendar-page .view-tabs a.active {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
}
.geofence-summary,
.geofence-warning,
.attendance-error {
    display: grid;
    gap: 5px;
    margin-bottom: 12px;
}
.geofence-summary span,
.geofence-warning span {
    color: var(--muted);
    font-size: 12px;
}
.geofence-warning {
    background: #fff8e8;
    border-color: #f4cf76;
}
.location-button {
    background: var(--primary-soft);
    color: var(--primary);
    border: 1px solid var(--border);
}
.drag-handle {
    -webkit-user-select: none;
    user-select: none;
    touch-action: none !important;
    overscroll-behavior: contain;
}
.schedule-wrap {
    touch-action: pan-x pan-y;
    -webkit-overflow-scrolling: touch;
}
.touch-drag-ghost {
    direction: rtl;
}

@media (max-width: 520px) {
    .calendar-page .page-head {
        margin-bottom: 10px;
    }
    .calendar-page .view-tabs {
        gap: 6px;
    }
    .calendar-page .view-tabs a {
        min-height: 42px;
        font-size: 14px;
    }
    .week-grid {
        display: grid;
        grid-template-columns: 1fr;
        gap: 10px;
    }
    .day-column {
        min-width: 0;
    }
    .month-grid {
        gap: 4px;
    }
    .month-day {
        min-height: 68px;
        padding: 6px 4px;
        font-size: 11px;
    }
}

/* ===== Interactive weekly timeline: drag between days and 15-minute times ===== */
:root { --week-slot-height: 42px; }

.week-drag-help {
    display: flex;
    align-items: center;
    gap: 7px;
    margin: 2px 2px 8px;
    color: var(--muted);
    font-size: 11px;
}
.week-drag-help svg { width: 17px; height: 17px; color: var(--primary); }

.week-schedule-wrap {
    width: 100%;
    max-height: calc(100dvh - 285px);
    overflow: auto;
    border: 1px solid var(--border);
    border-radius: 16px;
    background: #fff;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
}

.week-timeline-grid {
    direction: rtl;
    display: grid;
    grid-template-columns: 58px repeat(7, minmax(138px, 1fr));
    grid-template-rows: 58px repeat(var(--week-slot-count), var(--week-slot-height));
    min-width: 1024px;
    position: relative;
}

.week-corner,
.week-day-head {
    position: sticky;
    top: 0;
    z-index: 30;
    background: var(--primary);
    color: #fff;
    border-left: 1px solid rgba(255,255,255,.22);
    border-bottom: 3px solid #7c49a3;
}
.week-corner {
    right: 0;
    z-index: 40;
    display: grid;
    place-items: center;
    font-size: 10px;
    font-weight: 700;
}
.week-day-head {
    display: grid;
    place-items: center;
    align-content: center;
    gap: 2px;
    padding: 5px 3px;
    text-align: center;
}
.week-day-head strong { font-size: 12px; }
.week-day-head span { font-size: 10px; color: rgba(255,255,255,.82); }
.week-day-head.today { background: #70409a; box-shadow: inset 0 -4px 0 #f3c5dc; }

.week-time-cell {
    position: sticky;
    right: 0;
    z-index: 18;
    display: grid;
    place-items: start center;
    padding-top: 5px;
    background: #fbf9fd;
    color: var(--muted);
    border-left: 1px solid #eee7f3;
    border-bottom: 1px solid #eee7f3;
    font-size: 9px;
}

.week-drop-slot {
    min-height: var(--week-slot-height);
    border-left: 1px solid #eee7f3;
    border-bottom: 1px solid #eee7f3;
    background: #fff;
    transition: background .12s ease, box-shadow .12s ease;
}
.week-drop-slot:nth-child(8n) { background: #fcfaff; }
.week-drop-slot.drag-over {
    background: #eadff5;
    box-shadow: inset 0 0 0 2px var(--primary);
}

.week-appointment-card {
    grid-column: var(--week-day);
    grid-row: var(--week-row) / span var(--week-span);
    z-index: 12;
    align-self: stretch;
    min-height: calc((var(--week-span) * var(--week-slot-height)) - 5px);
    margin: 2px 3px;
    padding: 6px 7px 6px 29px;
    border: 1px solid color-mix(in srgb, var(--service-color) 35%, white);
    border-right: 4px solid var(--service-color);
    border-radius: 10px;
    background: linear-gradient(135deg, color-mix(in srgb, var(--service-color) 12%, white), #fff);
    box-shadow: 0 3px 10px rgba(57,29,76,.09);
    color: var(--text);
    overflow: hidden;
    position: relative;
    cursor: grab;
}
.week-appointment-card.dragging { opacity: .38; }
.week-appt-content { min-width: 0; display: grid; gap: 2px; }
.week-appt-top { display: flex; justify-content: space-between; align-items: center; gap: 4px; }
.week-appt-top strong { font-size: 11px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.week-status { flex: 0 0 auto; padding: 2px 4px; border-radius: 999px; font-size: 7px; font-weight: 800; }
.week-appointment-card.status-confirmed .week-status { background: #eee7f7; color: #5a2d82; }
.week-appointment-card.status-arrived .week-status { background: #e7f3ff; color: #1769aa; }
.week-appointment-card.status-inservice .week-status { background: #fff1d6; color: #9b5b00; }
.week-appt-time { direction: ltr; text-align: right; font-size: 9px; font-weight: 800; color: var(--primary); }
.week-appt-content small { font-size: 8px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.week-drag-handle {
    position: absolute;
    left: 3px;
    top: 50%;
    transform: translateY(-50%);
    width: 23px;
    height: 34px;
    display: grid;
    place-items: center;
    border-radius: 8px;
    color: #8b7b96;
    cursor: grab;
    touch-action: none;
    user-select: none;
    -webkit-user-select: none;
}
.week-drag-handle:active { background: rgba(90,45,130,.12); cursor: grabbing; }
.week-drag-handle svg { width: 17px; height: 17px; }
.week-touch-ghost {
    position: fixed !important;
    z-index: 9999 !important;
    width: 160px !important;
    min-height: 50px !important;
    pointer-events: none !important;
    opacity: .94 !important;
    transform: rotate(-2deg) scale(1.03) !important;
    box-shadow: 0 16px 36px rgba(35,18,48,.28) !important;
}

@media (max-width: 520px) {
    :root { --week-slot-height: 38px; }
    .week-schedule-wrap {
        width: calc(100vw - 20px);
        max-height: calc(100dvh - 300px);
        margin-inline: auto;
    }
    .week-timeline-grid {
        grid-template-columns: 48px repeat(7, 118px);
        grid-template-rows: 54px repeat(var(--week-slot-count), var(--week-slot-height));
        min-width: 874px;
    }
    .week-day-head strong { font-size: 11px; }
    .week-day-head span { font-size: 9px; }
    .week-appointment-card { margin: 2px; padding: 5px 6px 5px 27px; }
    .week-appt-top strong { font-size: 10px; }
    .week-appt-content small { font-size: 7px; }
    .week-drag-help { font-size: 10px; }
}


/* 2026-06-30: delete actions, Sunday closure, and week drag handle */
.btn-danger {
    background: #c62828;
    color: #fff;
}
.delete-form {
    margin-top: 12px;
}
.delete-form .btn {
    width: 100%;
}
.alert {
    border-radius: 12px;
    padding: 11px 13px;
    margin-bottom: 12px;
    font-weight: 700;
}
.alert-error {
    background: #fff0f0;
    border: 1px solid #efb3b3;
    color: #a71919;
}
.week-day-head.closed-day,
.week-drop-slot.closed-slot,
.month-day.sunday-disabled {
    background: repeating-linear-gradient(
        135deg,
        #f5f2f7,
        #f5f2f7 10px,
        #eee8f2 10px,
        #eee8f2 20px
    );
    color: #9b8da4;
}
.week-day-head.closed-day {
    border-bottom-color: #cfc4d6;
}
.week-drop-slot.closed-slot {
    cursor: not-allowed;
    position: relative;
}
.week-drop-slot.closed-slot::after {
    content: "";
    position: absolute;
    inset: 0;
    background: rgba(255,255,255,.25);
    pointer-events: none;
}
.closed-label {
    position: sticky;
    top: 62px;
    display: inline-block;
    margin: 8px;
    padding: 3px 8px;
    border-radius: 999px;
    background: #ded4e4;
    color: #6f6178;
    font-size: 10px;
    font-weight: 800;
}
.month-day.sunday-disabled {
    cursor: not-allowed;
    opacity: .8;
}
.sunday-closed-card {
    display: grid;
    gap: 6px;
    text-align: center;
    margin-top: 14px;
    background: #f4eff7;
}
.sunday-closed-card strong {
    color: #6b5875;
}
.sunday-closed-card span {
    color: var(--muted);
    font-size: 13px;
}

/* Keep the handle at the top-left, never in the middle. */
.week-appointment-card {
    padding-left: 31px;
}
.week-drag-handle {
    left: 4px;
    top: 4px;
    transform: none;
    width: 24px;
    height: 24px;
    z-index: 4;
}
.week-drag-handle svg {
    width: 16px;
    height: 16px;
}


/* Week grid correction: fixed slot coordinates and reliable drag targets */
.week-timeline-grid > .week-corner,
.week-timeline-grid > .week-day-head,
.week-timeline-grid > .week-time-cell,
.week-timeline-grid > .week-drop-slot {
    min-width: 0;
}

.week-appointment-card.dragging {
    pointer-events: none;
}

.week-drop-slot.closed-slot {
    z-index: 1;
}

.week-appointment-card {
    z-index: 12;
}


/* Mobile schedule scrolling correction:
   vertical scrolling belongs to the full page; schedule keeps horizontal swipe only. */
@media (max-width: 768px) {
    html, body {
        overflow-x: hidden;
        overflow-y: auto;
    }

    .schedule-wrap,
    .week-schedule-wrap {
        width: calc(100vw - 16px) !important;
        max-height: none !important;
        height: auto !important;
        margin-inline: auto !important;
        overflow-x: auto !important;
        overflow-y: visible !important;
        overscroll-behavior-x: contain;
        overscroll-behavior-y: auto;
        -webkit-overflow-scrolling: touch;
    }

    .schedule-grid,
    .week-timeline-grid {
        height: auto !important;
    }

    .week-schedule-wrap {
        padding-bottom: 8px;
    }
}

/* Keep desktop/tablet framed scrolling unchanged. */
@media (min-width: 769px) {
    .week-schedule-wrap {
        max-height: calc(100dvh - 285px);
        overflow: auto;
    }
}


/* Quick appointment creation from Day / Week / Month calendars */
.slot,
.week-drop-slot {
    position: relative;
}

.quick-add-slot {
    position: absolute;
    inset: 3px;
    z-index: 3;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    border: 1px dashed transparent;
    border-radius: 9px;
    color: var(--primary);
    background: transparent;
    opacity: 0;
    transition: opacity .15s ease, background .15s ease, border-color .15s ease;
}

.quick-add-slot svg {
    width: 17px;
    height: 17px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
}

.quick-add-slot span {
    font-size: 10px;
    font-weight: 800;
}

.available-slot:hover > .quick-add-slot,
.quick-add-slot:focus-visible {
    opacity: 1;
    background: rgba(90, 45, 130, .07);
    border-color: rgba(90, 45, 130, .28);
}

.week-quick-add {
    inset: 2px;
    border-radius: 5px;
}

.month-day-empty {
    position: relative;
}

.month-add-action {
    margin-top: auto;
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 5px 7px;
    border-radius: 999px;
    color: var(--primary) !important;
    background: var(--primary-soft);
    font-size: 10px !important;
    font-weight: 800;
    opacity: 0;
    transition: opacity .15s ease;
}

.month-add-action svg {
    width: 14px;
    height: 14px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
}

.month-day-empty:hover .month-add-action,
.month-day-empty:focus-visible .month-add-action {
    opacity: 1;
}

@media (max-width: 768px) {
    .available-slot > .quick-add-slot {
        opacity: .32;
    }

    .available-slot > .quick-add-slot:active,
    .available-slot > .quick-add-slot:focus {
        opacity: 1;
        background: rgba(90, 45, 130, .1);
        border-color: rgba(90, 45, 130, .35);
    }

    .quick-add-slot span {
        display: none;
    }

    .quick-add-slot svg {
        width: 19px;
        height: 19px;
    }

    .month-add-action {
        opacity: 1;
    }
}


/* Single / multiple service appointment editor */
.booking-mode-switch {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    padding: 4px;
    border-radius: 14px;
    background: var(--primary-soft);
}

.booking-mode-switch button {
    min-height: 44px;
    border: 0;
    border-radius: 11px;
    background: transparent;
    color: var(--primary);
    font: inherit;
    font-weight: 800;
    cursor: pointer;
}

.booking-mode-switch button.active {
    background: var(--primary);
    color: #fff;
    box-shadow: 0 5px 14px rgba(90,45,130,.22);
}

.service-rows {
    display: grid;
    gap: 12px;
}

.service-row {
    position: relative;
    display: grid;
    gap: 8px;
    padding: 14px;
    border: 1px solid var(--border);
    border-radius: 16px;
    background: #fff;
    box-shadow: 0 6px 18px rgba(67,32,96,.05);
}

.service-row-head {
    display: flex;
    align-items: center;
    gap: 8px;
}

.service-row-head strong {
    flex: 1;
}

.service-number {
    display: grid;
    place-items: center;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--primary);
    color: #fff;
    font-weight: 800;
}

.remove-service-row {
    border: 0;
    background: transparent;
    color: #c62828;
    font: inherit;
    font-weight: 800;
    cursor: pointer;
}

.add-service-button {
    width: 100%;
    border: 1px dashed var(--primary);
}

.availability-note {
    min-height: 18px;
    color: #247a43;
    font-size: 12px;
    font-weight: 700;
}

.availability-note.unavailable {
    color: #b42318;
}

.booking-summary {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    padding: 12px;
    border-radius: 14px;
    background: #f7f2fb;
    color: var(--muted);
    font-size: 13px;
}

.booking-summary strong {
    color: var(--primary);
}

@media (max-width: 520px) {
    .booking-summary {
        display: grid;
    }
}

.appointment-service-detail {
    padding: 10px 0;
    border-bottom: 1px solid #eee7f3;
}
.appointment-service-detail:last-of-type {
    border-bottom: 0;
}

.login-back-link {
    display: block;
    margin-top: 12px;
    color: var(--primary);
    font-weight: 700;
}


/* User management and employee permissions */
.users-list-card {
    display: grid;
    gap: 0;
}

.user-list-row {
    align-items: flex-start;
    gap: 14px;
}

.user-list-main {
    display: grid;
    gap: 4px;
    flex: 1;
}

.user-list-main strong,
.user-list-main span,
.user-list-main small {
    display: block;
}

.user-permission-summary {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    margin-top: 5px;
}

.user-permission-summary span:empty {
    display: none;
}

.user-permission-summary span {
    padding: 3px 7px;
    border-radius: 999px;
    background: #f2ebf7;
    color: var(--primary);
    font-size: 10px;
    font-weight: 700;
}

.user-list-actions {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 7px;
}

.user-list-actions form {
    margin: 0;
}

.user-edit-form {
    max-width: 700px;
}

.linked-employee-note,
.employee-access-note,
.admin-account-note {
    padding: 11px;
    border-radius: 12px;
    background: #f5eff9;
    color: var(--primary);
    font-size: 12px;
}

.permissions-box {
    display: grid;
    gap: 8px;
    margin: 8px 0;
    padding: 13px;
    border: 1px solid var(--border);
    border-radius: 14px;
}

.permissions-box legend {
    padding: 0 7px;
    color: var(--primary);
    font-weight: 800;
}

.switch-row {
    display: flex !important;
    align-items: center;
    gap: 9px;
    min-height: 38px;
    margin: 0 !important;
}

.switch-row input {
    width: 20px !important;
    min-height: 20px !important;
    accent-color: var(--primary);
}

.alert-success {
    margin-bottom: 12px;
    padding: 11px;
    border: 1px solid #b9dfc6;
    border-radius: 12px;
    background: #eef9f1;
    color: #236b3d;
}

.nav-main-disabled {
    opacity: .35;
    pointer-events: none;
}

@media (max-width: 620px) {
    .user-list-row {
        display: grid;
    }

    .user-list-actions {
        justify-content: flex-start;
    }
}


/* Prevent Android/Samsung long-press menu while dragging appointments */
.appointment-card,
.week-appointment-card,
.drag-handle,
.week-drag-handle {
    -webkit-touch-callout: none !important;
    -webkit-user-select: none !important;
    user-select: none !important;
}

.drag-handle,
.week-drag-handle {
    touch-action: none !important;
    -ms-touch-action: none !important;
    cursor: grab;
}

.drag-handle:active,
.week-drag-handle:active {
    cursor: grabbing;
}

.drag-handle svg,
.week-drag-handle svg,
.appointment-card svg,
.week-appointment-card svg {
    pointer-events: none;
    -webkit-user-drag: none;
}


/* Appointment interaction rules:
   - details open only from the scissors/details icon
   - movement starts only from the dotted drag handle */
.appointment-card,
.week-appointment-card {
    cursor: default !important;
}

.appointment-open-icon {
    position: relative;
    z-index: 8;
    display: inline-grid;
    place-items: center;
    text-decoration: none;
    cursor: pointer;
    touch-action: manipulation;
}

.appointment-open-icon svg {
    pointer-events: none;
}

.drag-handle,
.week-drag-handle {
    position: relative;
    z-index: 9;
    cursor: grab !important;
}

.drag-handle:active,
.week-drag-handle:active {
    cursor: grabbing !important;
}

.week-open-icon {
    width: 30px;
    height: 30px;
    flex: 0 0 30px;
    border-radius: 50%;
    background: rgba(217, 108, 164, .14);
    color: var(--service-color, var(--primary));
}

.week-open-icon svg {
    width: 18px;
    height: 18px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}


/* Fix appointment text on narrow mobile employee columns.
   The open icon and drag dots are positioned outside the content flow,
   leaving the centre area for customer, service and time. */
.appointment-card {
    display: block !important;
    position: absolute !important;
    padding: 8px 32px 8px 30px !important;
}

.appointment-card .appointment-open-icon.service-icon {
    position: absolute !important;
    top: 7px !important;
    right: 7px !important;
    width: 24px !important;
    height: 24px !important;
    margin: 0 !important;
    z-index: 12 !important;
}

.appointment-card .drag-handle {
    position: absolute !important;
    top: 9px !important;
    left: 5px !important;
    width: 22px !important;
    height: 30px !important;
    transform: none !important;
    margin: 0 !important;
    z-index: 12 !important;
}

.appointment-card .appt-content {
    position: relative !important;
    z-index: 10 !important;
    display: block !important;
    width: 100% !important;
    min-width: 0 !important;
    overflow: visible !important;
    color: var(--text) !important;
    text-align: right !important;
}

.appointment-card .appt-topline {
    display: block !important;
    min-width: 0 !important;
}

.appointment-card .appt-topline strong,
.appointment-card .appt-service,
.appointment-card .appt-time {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
    max-width: 100% !important;
    color: var(--text) !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    white-space: nowrap !important;
}

.appointment-card .appt-topline strong {
    padding-left: 2px;
    font-size: 11px !important;
    line-height: 1.25 !important;
}

.appointment-card .appt-status {
    display: inline-block !important;
    margin-top: 3px !important;
    font-size: 7px !important;
}

.appointment-card .appt-service {
    margin-top: 4px !important;
    color: var(--muted) !important;
    font-size: 9px !important;
}

.appointment-card .appt-time {
    margin-top: 4px !important;
    color: var(--text) !important;
    font-size: 9px !important;
    font-weight: 800 !important;
    direction: ltr;
    text-align: right !important;
}

/* Keep quick-add controls behind an existing appointment. */
.slot:has(.appointment-card) > .quick-add-slot {
    display: none !important;
}

@media (max-width: 520px) {
    .appointment-card {
        padding: 7px 29px 7px 27px !important;
    }

    .appointment-card .appointment-open-icon.service-icon {
        top: 6px !important;
        right: 5px !important;
        width: 23px !important;
        height: 23px !important;
    }

    .appointment-card .drag-handle {
        top: 8px !important;
        left: 3px !important;
        width: 21px !important;
    }

    .appointment-card .appt-topline strong {
        font-size: 10px !important;
    }

    .appointment-card .appt-service,
    .appointment-card .appt-time {
        font-size: 8px !important;
    }
}


/* Delete all appointments */
.menu-danger-link {
    color: #c62828 !important;
}
.menu-danger-link svg {
    color: #c62828 !important;
}
.delete-all-appointments-card {
    max-width: 720px;
    margin-inline: auto;
    text-align: center;
}
.delete-warning-icon {
    width: 58px;
    height: 58px;
    margin: 0 auto 12px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    background: #fff0f0;
    color: #c62828;
    font-size: 34px;
    font-weight: 900;
}
.delete-all-kept-data {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 7px;
    margin: 16px 0;
    padding: 12px;
    border-radius: 13px;
    background: #f7f3fa;
}
.delete-all-kept-data strong {
    width: 100%;
}
.delete-all-kept-data span {
    padding: 4px 8px;
    border-radius: 999px;
    background: #fff;
    color: var(--primary);
    font-size: 12px;
}
.delete-all-appointments-card form {
    display: grid;
    gap: 10px;
    margin-top: 16px;
}


/* Temporary default employee availability */
.default-availability-note,
.attendance-postponed-note {
    display: grid;
    gap: 4px;
    margin-bottom: 12px;
    padding: 12px 14px;
    border: 1px solid #d8c5e8;
    border-radius: 14px;
    background: #f7f1fb;
    color: var(--primary);
}
.default-availability-note span,
.attendance-postponed-note span {
    color: var(--muted);
    font-size: 12px;
}
.staff-head .attendance-badge {
    background: #e8f7ed !important;
    color: #237a45 !important;
}


/* Attendance postponed mode - show everybody as available */
.geofence-summary.postponed {
    border-color: #d8c5e8 !important;
    background: #f7f1fb !important;
    color: var(--primary) !important;
}

.attendance-available-row {
    background: #fff !important;
}

.available-default-badge {
    background: #e8f7ed !important;
    color: #237a45 !important;
    font-weight: 800;
}
