/* ── Reset & Base ─────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    --bg:          #e8eaf0;
    --panel-bg:    #367E7F;
    --topbar-bg:   #3a3f4e;
    --topbar-text: #f0f2f5;
    --grid-bg:     #ffffff;
    --grid-border: #c8ccd6;
    --time-col:    #f0f2f5;
    --header-bg:   #4a5068;
    --header-text: #ffffff;
    --block-bg:    #6b7280;
    --block-text:  #ffffff;
    --slot-hover:  #f5f7ff;
    --appt-pink:   #f472b6;
    --appt-yellow: #fbbf24;
    --appt-orange: #fb923c;
    --text-main:   #1e2130;
    --text-muted:  #9ca3af;
    --accent:      #4f6ef7;
    --danger:      #ef4444;
    --success:     #22c55e;
    --shadow:      0 2px 8px rgba(0,0,0,0.12);
    --radius:      6px;
    --slot-h:      34px;
    --time-w:      110px;
    --font:        'DM Sans', sans-serif;
    --mono:        'DM Mono', monospace;
}

body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--text-main);
    height: 100vh;
    overflow: hidden;
}

/* ── Login ────────────────────────────────────────────────────────── */
.login-screen {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100vh;
    background: linear-gradient(135deg, #2d3250 0%, #424769 100%);
}

.login-card {
    background: #fff;
    border-radius: 12px;
    padding: 40px 36px;
    width: 340px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}

.login-logo {
    font-size: 22px;
    font-weight: 600;
    text-align: center;
    margin-bottom: 28px;
    color: var(--text-main);
    letter-spacing: -0.3px;
}

.logo-e {
    color: var(--accent);
    font-weight: 700;
}
.topbar-shop-name {
    font-size: 18px;
    font-weight: 500;
    color: #c5c9d6;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 300px;
}

.login-error {
    background: #fef2f2;
    border: 1px solid #fca5a5;
    color: #b91c1c;
    padding: 8px 12px;
    border-radius: var(--radius);
    font-size: 13px;
    margin-bottom: 16px;
}

.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    font-size: 12px;
    font-weight: 500;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 6px;
}

.form-group input {
    width: 100%;
    padding: 9px 12px;
    border: 1px solid #e2e5ed;
    border-radius: var(--radius);
    font-family: var(--font);
    font-size: 14px;
    outline: none;
    transition: border-color 0.15s;
}

.form-group input:focus {
    border-color: var(--accent);
}

.btn-login {
    width: 100%;
    padding: 10px;
    background: var(--accent);
    color: #fff;
    border: none;
    border-radius: var(--radius);
    font-family: var(--font);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    margin-top: 8px;
    transition: background 0.15s;
}

.btn-login:hover { background: #3d5ce6; }

/* ── Login Tabs ───────────────────────────────────────────────────── */
.login-tabs {
    display: flex;
    gap: 6px;
    margin-bottom: 20px;
}

.login-tab {
    flex: 1;
    padding: 8px;
    border: 1px solid #e2e5ed;
    border-radius: var(--radius);
    background: #f8f9fc;
    font-family: var(--font);
    font-size: 13px;
    font-weight: 500;
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.15s;
}

    .login-tab.active {
        background: var(--accent);
        color: #fff;
        border-color: var(--accent);
    }

    .login-tab:hover:not(.active) {
        background: #eef0f8;
    }

.btn-login-secondary {
    width: 100%;
    padding: 8px;
    background: transparent;
    color: var(--text-muted);
    border: 1px solid #e2e5ed;
    border-radius: var(--radius);
    font-family: var(--font);
    font-size: 13px;
    cursor: pointer;
    margin-top: 8px;
    transition: all 0.15s;
}

    .btn-login-secondary:hover {
        background: #f0f2f8;
        color: var(--text-main);
    }

.code-input {
    width: 100%;
    padding: 12px;
    border: 1px solid #e2e5ed;
    border-radius: var(--radius);
    font-family: var(--mono);
    font-size: 24px;
    text-align: center;
    letter-spacing: 8px;
    outline: none;
    transition: border-color 0.15s;
}

    .code-input:focus {
        border-color: var(--accent);
    }

.login-verify-msg {
    font-size: 13px;
    color: var(--text-muted);
    text-align: center;
    margin-bottom: 16px;
    padding: 10px;
    background: #f0f4ff;
    border-radius: var(--radius);
}

/* ── App Layout ───────────────────────────────────────────────────── */
.app-screen {
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow: hidden;
}

/* ── Top Bar ──────────────────────────────────────────────────────── */
.topbar {
    display: flex;
    align-items: center;
    background: var(--topbar-bg);
    color: var(--topbar-text);
    padding: 0 16px;
    height: 44px;
    flex-shrink: 0;
    gap: 16px;
}

.topbar-left { display: flex; align-items: center; gap: 16px; min-width: 180px; }
.topbar-logo { font-size: 16px; font-weight: 600; letter-spacing: -0.3px; }
.topbar-title { font-size: 14px; font-weight: 500; color: #c5c9d6; }

.topbar-date-big {
    font-size: 22px;
    font-weight: 700;
    color: #ffffff;
    letter-spacing: -0.3px;
}

.topbar-center { display: flex; align-items: center; gap: 6px; flex: 1; justify-content: center; }
.topbar-right  { display: flex; align-items: center; gap: 10px; min-width: 180px; justify-content: flex-end; }

.nav-btn {
    background: rgba(255,255,255,0.1);
    border: 1px solid rgba(255,255,255,0.15);
    color: #fff;
    width: 28px; height: 28px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 18px;
    line-height: 1;
    display: flex; align-items: center; justify-content: center;
    transition: background 0.15s;
}
.nav-btn:hover { background: rgba(255,255,255,0.2); }

.today-btn { width: auto; padding: 0 12px; font-size: 12px; font-family: var(--font); font-weight: 500; }

.topbar-user { font-size: 12px; color: #9ca3af; }

.btn-save-appt {
    background: var(--accent);
    color: #fff;
    border: none;
    padding: 5px 12px;
    border-radius: 4px;
    font-family: var(--font);
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s;
}
.btn-save-appt:hover { background: #3d5ce6; }

.btn-signout {
    background: transparent;
    color: #9ca3af;
    border: 1px solid #555;
    padding: 4px 10px;
    border-radius: 4px;
    font-family: var(--font);
    font-size: 11px;
    cursor: pointer;
    transition: all 0.15s;
}
.btn-signout:hover { color: #fff; border-color: #888; }

.btn-gear {
    background: transparent;
    color: #9ca3af;
    border: 1px solid #555;
    width: 36px;
    height: 36px;
    border-radius: 4px;
    font-size: 36px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s;
}
.btn-gear:hover { color: #fff; border-color: #888; }

.btn-help {
    background: transparent;
    color: #9ca3af;
    border: 1px solid #555;
    width: 36px;
    height: 36px;
    border-radius: 4px;
    font-size: 20px;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s;
}

    .btn-help:hover {
        color: #fff;
        border-color: #888;
    }

/* ── Main Layout ──────────────────────────────────────────────────── */
.main-layout {
    display: flex;
    flex: 1;
    overflow: hidden;
    gap: 0;
    min-height: 0;
}

/* ── Left Panel ───────────────────────────────────────────────────── */
.left-panel {
    width: 300px;
    flex-shrink: 0;
    background: var(--panel-bg);
    border-right: 1px solid var(--grid-border);
    display: flex;
    flex-direction: column;
    overflow-y: hidden;
    padding: 10px 8px;
    gap: 12px;
}

/* ── Date Nav ─────────────────────────────────────────────────────── */
.date-nav {
    background: #fff;
    border-radius: var(--radius);
    padding: 10px 8px 8px;
    box-shadow: var(--shadow);
    text-align: center;
}

.date-nav-arrows {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 6px;
}

.date-nav-btn {
    background: #d4d8e2;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 22px;
    color: var(--text-main);
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s;
}
.date-nav-btn:hover { background: #c5c9d6; }

.date-nav-today {
    background: var(--accent);
    color: #fff;
    border: none;
    border-radius: 4px;
    font-family: var(--font);
    font-size: 12px;
    font-weight: 600;
    padding: 5px 14px;
    cursor: pointer;
    transition: background 0.15s;
}
.date-nav-today:hover { background: #3d5ce6; }

.date-nav-label {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-main);
    line-height: 1.25;
}

/* ── Mini Calendar ────────────────────────────────────────────────── */
.mini-cal {
    background: #fff;
    border-radius: var(--radius);
    padding: 10px;
    box-shadow: var(--shadow);
}

.mini-cal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
}

.mini-cal-header span {
    font-size: 13px;
    font-weight: 700;
    color: var(--text-main);
}

.mini-cal-header button {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 20px;
    color: var(--text-muted);
    line-height: 1;
    padding: 0 4px;
}
.mini-cal-header button:hover { color: var(--accent); }

.mini-cal-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 2px;
}

.cal-dow {
    font-size: 11px;
    font-weight: 700;
    color: var(--text-muted);
    text-align: center;
    padding: 4px 0;
}

.cal-day {
    font-size: 12px;
    text-align: center;
    padding: 5px 2px;
    border-radius: 50%;
    cursor: pointer;
    color: var(--text-main);
    transition: background 0.1s;
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}

.cal-day:hover { background: #e8ecff; }
.cal-day.today { background: var(--accent); color: #fff; font-weight: 700; }
.cal-day.selected { background: #c7d2fe; color: var(--accent); font-weight: 700; }
.cal-day.other-month { color: var(--text-muted); }
.cal-day.empty { cursor: default; }

/* ── Upcoming ─────────────────────────────────────────────────────── */
.draft-banner {
    background: #1e3a8a;
    color: #fff;
    border-radius: 6px;
    padding: 8px 10px;
    margin: 4px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}
.draft-banner-info {
    display: flex;
    align-items: center;
    gap: 6px;
    flex: 1;
    min-width: 0;
}
.draft-banner-icon { font-size: 14px; flex-shrink: 0; }
#draftBannerText {
    font-size: 11px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.draft-banner-actions { display: flex; gap: 4px; flex-shrink: 0; }
.draft-banner-actions button {
    padding: 3px 8px;
    border: 1px solid rgba(255,255,255,0.4);
    border-radius: 4px;
    background: none;
    color: #fff;
    font-size: 11px;
    cursor: pointer;
    white-space: nowrap;
}
.draft-banner-actions button:hover { background: rgba(255,255,255,0.15); }

.upcoming-section {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.section-label {
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    padding: 0 2px 6px;
}

.upcoming-sort-btn {
    padding: 3px 10px;
    font-size: 11px;
    border: 1px solid #d1d5db;
    border-radius: 4px;
    background: #fff;
    color: #6b7280;
    cursor: pointer;
}
.upcoming-sort-btn.active {
    background: #4f6ef7;
    color: #fff;
    border-color: #4f6ef7;
}
.upcoming-group-header {
    padding: 6px 12px 3px;
    font-size: 11px;
    font-weight: 600;
    color: #6b7280;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    background: #f3f4f6;
    border-top: 1px solid #e5e7eb;
}

.upcoming-hint {
    font-size: 10px;
    color: var(--text-muted);
    padding: 4px 2px;
    font-style: italic;
}

.upcoming-list {
    display: flex;
    flex-direction: column;
    gap: 2px;
    overflow-y: auto;
    flex: 1;
}

.upcoming-item {
    background: #fff;
    border-radius: 4px;
    padding: 5px 8px;
    cursor: pointer;
    font-size: 11px;
    transition: background 0.1s;
    border-left: 3px solid var(--accent);
}

.upcoming-item:hover { background: #f0f4ff; }

.upcoming-item .ui-name { font-weight: 600; color: var(--text-main); }
.upcoming-item .ui-detail { color: var(--text-muted); font-size: 10px; margin-top: 1px; }

/* ── Grid Area ────────────────────────────────────────────────────── */
.grid-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: var(--grid-bg);
}

.scheduler-grid {
    flex: 1;
    overflow: auto;
    position: relative;
    min-height: 0;
    display: flex;
    flex-direction: column;
}



/* ── Two-table grid layout ────────────────────────────────────────── */
.grid-wrapper {
    display: flex;
    height: 100%;
    align-items: stretch;
}

.time-col-wrap {
    display: flex;
    flex-direction: column;
}

.time-table {
    flex: 1;
}

.time-col-wrap {
    flex-shrink: 0;
    position: sticky;
    left: 0;
    z-index: 2;
    background: var(--time-col);
}

.appt-col-wrap {
    flex: 1;
    overflow-x: auto;
}

.time-table {
    border-collapse: collapse;
    width: var(--time-w);
    table-layout: fixed;
}

.time-header {
    background: var(--header-bg);
    color: var(--header-text);
    font-size: 13px;
    font-weight: 600;
    padding: 8px 6px;
    text-align: center;
    border-right: 2px solid rgba(255,255,255,0.1);
}

.appt-table {
    border-collapse: collapse;
    width: 100%;
    table-layout: fixed;
}

/* ── Grid Table ───────────────────────────────────────────────────── */
.grid-table {
    border-collapse: collapse;
    width: 100%;
    min-width: 600px;
    table-layout: fixed;
}

/* Time column */
.col-time {
    width: var(--time-w);
    background: var(--time-col);
    border-right: 1px solid var(--grid-border);
    position: sticky;
    left: 0;
    z-index: 2;
}

/* Header row */
.grid-header th {
    background: var(--header-bg);
    color: var(--header-text);
    font-size: 13px;
    font-weight: 600;
    padding: 8px 6px;
    border-right: 1px solid rgba(255,255,255,0.1);
    text-align: center;
    position: sticky;
    top: 0;
    z-index: 3;
    letter-spacing: 0.2px;
}

.grid-header th.col-time {
    background: var(--header-bg);
    z-index: 4;
}

/* Time label cells */
.time-label {
    font-family: 'DM Sans', sans-serif;
    font-size: 18px;
    font-weight: 700;
    color: #374151;
    text-align: right;
    padding: 0 8px;
    white-space: nowrap;
    vertical-align: middle;
    background: var(--time-col);
    border-right: 2px solid var(--grid-border);
    border-top: 1px solid var(--grid-border);
    border-bottom: 1px solid var(--grid-border);
    position: sticky;
    left: 0;
    z-index: 1;
}

.time-label span { display: inline; }

/* Slot cells */
.slot-cell {
    border-right: 1px solid var(--grid-border);
    border-bottom: 1px solid var(--grid-border);
    height: var(--slot-h);
    min-height: var(--slot-h);
    max-height: none;
    vertical-align: top;
    padding: 0;
    cursor: pointer;
    position: relative;
    transition: background 0.1s;
}

.slot-cell:hover { background: var(--slot-hover); }

.cell-new-appt-label {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: #ffffff;
    font-size: 14px;
    font-weight: 700;
    white-space: nowrap;
    pointer-events: none;
    font-family: var(--font);
}

.slot-time-hint {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 13px;
    color: #c8ccd6;
    pointer-events: none;
    white-space: nowrap;
    font-family: var(--font);
}
tr.first-appt-row .slot-cell { border-top: 1px solid var(--grid-border); }

/* Half-height spacer rows top and bottom */

.slot-cell.half-hour { border-bottom: 1px solid var(--grid-border); }
.slot-cell.hour-mark { border-bottom: 1px solid var(--grid-border); }

/* Appointment blocks */
.appt-block {
    position: absolute;
    left: 2px;
    right: 2px;
    top: 1px;
    bottom: 1px;
    border-radius: 8px;
    padding: 1px 8px 3px;
    font-size: 16px;
    font-weight: 400;
    font-family: 'DM Sans', sans-serif;
    cursor: pointer;
    z-index: 1;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    gap: 2px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.15);
    transition: filter 0.1s, transform 0.1s;
    white-space: normal;
}

.appt-block:hover { filter: brightness(0.95); transform: scale(1.01); }

.appt-block .appt-check {
    font-size: 12px;
    flex-shrink: 0;
}

.appt-inner {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    flex: 1;
    justify-content: center;
}

.appt-line1 {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.appt-line2 {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    opacity: 0.85;
}

/* Block (gray) cells */
.block-cell {
    position: absolute;
    left: 2px;
    right: 2px;
    top: 1px;
    bottom: 1px;
    background: var(--block-bg);
    color: var(--block-text);
    border-radius: 8px;
    padding: 2px 8px;
    font-size: 16px;
    font-weight: 400;
    cursor: pointer;
    z-index: 1;
    overflow: hidden;
    white-space: normal;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

/* Day Totals Bar */
.day-totals-bar {
    display: flex;
    background: var(--panel-bg);
    border-top: 2px solid var(--grid-border);
    height: 44px;
    flex-shrink: 0;
}

.total-cell {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    font-weight: 700;
    color: #ffffff;
    border-right: 1px solid var(--grid-border);
}

.total-cell.time-col { width: var(--time-w); flex-shrink: 0; font-size: 14px; color: #ffffff; }

/* ── Modal ────────────────────────────────────────────────────────── */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.45);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
}

.modal-box {
    background: #fff;
    border-radius: 10px;
    width: 540px;
    max-width: 95vw;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    overflow: hidden;
}

.modal-box-sm { width: 400px; }

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 18px;
    background: var(--header-bg);
    color: #fff;
    font-size: 14px;
    font-weight: 600;
    flex-shrink: 0;
}

.modal-close {
    background: none;
    border: none;
    color: rgba(255,255,255,0.7);
    font-size: 16px;
    cursor: pointer;
    padding: 0;
    line-height: 1;
}

.modal-close:hover { color: #fff; }

.modal-body {
    padding: 16px 18px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 12px;
    flex: 1;
    min-height: 0;
}

.modal-row {
    display: flex;
    gap: 12px;
    align-items: flex-start;
}

.modal-field {
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex: 1;
}

.modal-field.wide { flex: 2; }

.modal-field label {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.4px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.modal-field input,
.modal-field select,
.modal-field textarea {
    padding: 7px 10px;
    border: 1px solid #e2e5ed;
    border-radius: 5px;
    font-family: var(--font);
    font-size: 13px;
    outline: none;
    transition: border-color 0.15s;
    background: #fff;
}

.modal-field input:focus,
.modal-field select:focus,
.modal-field textarea:focus {
    border-color: var(--accent);
}

.modal-field textarea { resize: vertical; }

.modal-footer {
    display: flex;
    align-items: center;
    padding: 12px 18px;
    border-top: 1px solid #eee;
    gap: 8px;
    flex-shrink: 0;
}

.btn-save {
    background: var(--accent);
    color: #fff;
    border: none;
    padding: 8px 18px;
    border-radius: 5px;
    font-family: var(--font);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s;
}
.btn-save:hover { background: #3d5ce6; }

.btn-cancel {
    background: #f3f4f6;
    color: var(--text-main);
    border: 1px solid #e2e5ed;
    padding: 8px 16px;
    border-radius: 5px;
    font-family: var(--font);
    font-size: 13px;
    cursor: pointer;
    transition: background 0.15s;
}
.btn-cancel:hover { background: #e8eaf0; }

.btn-cancel-appt {
    background: #fef2f2;
    color: var(--danger);
    border: 1px solid #fca5a5;
    padding: 8px 14px;
    border-radius: 5px;
    font-family: var(--font);
    font-size: 13px;
    cursor: pointer;
    transition: background 0.15s;
}
.btn-cancel-appt:hover { background: #fee2e2; }

/* Search dropdown */
.search-wrap { position: relative; }

.search-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: #fff;
    border: 1px solid #e2e5ed;
    border-top: none;
    border-radius: 0 0 5px 5px;
    max-height: 160px;
    overflow-y: auto;
    z-index: 200;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.search-item {
    padding: 7px 10px;
    cursor: pointer;
    font-size: 13px;
    border-bottom: 1px solid #f3f4f6;
    transition: background 0.1s;
}

.search-item:hover { background: #f0f4ff; }
.search-item .si-name { font-weight: 500; }
.search-item .si-detail { font-size: 11px; color: var(--text-muted); }

/* Color variants for appointments */
.appt-pink   { background: var(--appt-pink);   color: #fff; }
.appt-yellow { background: var(--appt-yellow);  color: #1e2130; }
.appt-orange { background: var(--appt-orange);  color: #fff; }
.appt-default { background: #a78bfa;             color: #fff; }
.appt-cancelled { background: #e5e7eb; color: #9ca3af; text-decoration: line-through; }

/* ── Settings Panel ───────────────────────────────────────────────────── */
.settings-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.4);
    z-index: 200;
}

.settings-panel {
    position: fixed;
    top: 0;
    right: -700px;
    width: 700px;
    height: 100vh;
    background: #f8f9fb;
    z-index: 201;
    display: flex;
    flex-direction: column;
    transition: right 0.3s ease;
    box-shadow: -4px 0 24px rgba(0,0,0,0.2);
}

.settings-panel.open { right: 0; }
.settings-panel.open ~ #settingsOverlay,
.settings-overlay:has(~ .settings-panel.open) { display: block; }

/* Simpler overlay show */
.settings-panel.open { right: 0; }
#settingsOverlay { display: none; }
.settings-panel.open + #settingsToast { }

.settings-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    height: 50px;
    background: var(--header-bg);
    color: #fff;
    flex-shrink: 0;
}

.settings-title { font-size: 16px; font-weight: 600; }

.settings-close {
    background: none;
    border: none;
    color: rgba(255,255,255,0.7);
    font-size: 18px;
    cursor: pointer;
}
.settings-close:hover { color: #fff; }

.settings-body {
    display: flex;
    flex: 1;
    overflow: hidden;
}

.settings-nav {
    width: 200px;
    flex-shrink: 0;
    background: #fff;
    border-right: 1px solid #e5e7eb;
    overflow-y: auto;
    padding: 12px 0;
}

.settings-nav-group { margin-bottom: 8px; }

.settings-nav-label {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    color: var(--text-muted);
    padding: 8px 16px 4px;
}

.settings-nav-item {
    padding: 9px 16px;
    font-size: 13px;
    cursor: pointer;
    color: var(--text-main);
    transition: background 0.1s;
    border-left: 3px solid transparent;
}

.settings-nav-item:hover { background: #f0f4ff; }
.settings-nav-item.active {
    background: #eff2ff;
    color: var(--accent);
    font-weight: 600;
    border-left-color: var(--accent);
}

.settings-content {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
}

.settings-section-title {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-main);
    margin-bottom: 6px;
}

.settings-section-desc {
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 20px;
}

.settings-card {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 18px 20px;
    margin-bottom: 16px;
}

.settings-card h3 {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-main);
    margin-bottom: 14px;
    padding-bottom: 8px;
    border-bottom: 1px solid #f3f4f6;
}

.settings-row {
    display: flex;
    gap: 20px;
}

.settings-field {
    display: flex;
    flex-direction: column;
    gap: 5px;
    flex: 1;
}

.settings-field label {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.4px;
}

.settings-field select,
.settings-field input[type="text"] {
    padding: 8px 10px;
    border: 1px solid #e2e5ed;
    border-radius: 5px;
    font-family: var(--font);
    font-size: 13px;
    outline: none;
}
.settings-field select:focus,
.settings-field input:focus { border-color: var(--accent); }

.settings-checks-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

#uPermsGrid {
    display: flex !important;
    flex-direction: column !important;
    gap: 8px;
}

.settings-check {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--text-main);
    cursor: pointer;
}

.settings-check input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: var(--accent);
    cursor: pointer;
}

.settings-footer {
    display: flex;
    justify-content: flex-end;
    padding-top: 4px;
}

.btn-settings-save {
    background: var(--accent);
    color: #fff;
    border: none;
    padding: 9px 22px;
    border-radius: 6px;
    font-family: var(--font);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s;
}
.btn-settings-save:hover { background: #3d5ce6; }

/* Writers */
.writers-layout {
    display: flex;
    gap: 16px;
    align-items: flex-start;
}

.writers-col {
    flex: 1;
}

.writers-col h3 {
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 8px;
    padding-bottom: 6px;
    border-bottom: 1px solid #f3f4f6;
}

.writers-list {
    border: 1px solid #e2e5ed;
    border-radius: 6px;
    min-height: 200px;
    max-height: 320px;
    overflow-y: auto;
    background: #fafafa;
}

.writer-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    border-bottom: 1px solid #f3f4f6;
    cursor: pointer;
    font-size: 13px;
    transition: background 0.1s;
}

.writer-item:hover { background: #f0f4ff; }
.writer-item.selected { background: #eff2ff; }

.writer-drag {
    color: #9ca3af;
    cursor: grab;
    font-size: 16px;
    flex-shrink: 0;
}

.writer-name { flex: 1; }

.writer-display-name {
    width: 120px;
    padding: 3px 6px;
    border: 1px solid #e2e5ed;
    border-radius: 4px;
    font-size: 12px;
    font-family: var(--font);
}

.writers-arrows {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding-top: 40px;
    flex-shrink: 0;
}

.btn-move {
    background: #f3f4f6;
    border: 1px solid #e2e5ed;
    border-radius: 5px;
    padding: 7px 12px;
    font-size: 12px;
    font-family: var(--font);
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.1s;
}
.btn-move:hover { background: #e8ecff; color: var(--accent); }

.writers-hint {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 6px;
    font-style: italic;
}

/* Employees table */
.settings-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.settings-table th {
    text-align: left;
    padding: 8px 12px;
    background: #f9fafb;
    border-bottom: 2px solid #e5e7eb;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    color: var(--text-muted);
}

.settings-table td {
    padding: 9px 12px;
    border-bottom: 1px solid #f3f4f6;
    color: var(--text-main);
}

.settings-table tr:hover td { background: #f9fafb; }

/* Toast */
.settings-toast {
    position: fixed;
    bottom: 24px;
    right: 24px;
    padding: 12px 20px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 500;
    z-index: 300;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}
.settings-toast.success { background: #22c55e; color: #fff; }
.settings-toast.error   { background: var(--danger); color: #fff; }

.settings-loading { color: var(--text-muted); font-size: 13px; padding: 20px 0; }
.settings-error   { color: var(--danger); font-size: 13px; padding: 20px 0; }

/* ── Status Manager ───────────────────────────────────────────────────── */
.status-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
}

.status-table th {
    background: #f9fafb;
    border-bottom: 2px solid #e5e7eb;
    padding: 6px 8px;
    text-align: center;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    color: var(--text-muted);
    white-space: pre-line;
}

.status-table td {
    padding: 5px 6px;
    border-bottom: 1px solid #f3f4f6;
    vertical-align: middle;
}

.status-check-cell { text-align: center; }
.status-check-cell input { width: 15px; height: 15px; accent-color: var(--accent); }

.status-text-input {
    width: 100%;
    padding: 4px 6px;
    border: 1px solid #e2e5ed;
    border-radius: 4px;
    font-size: 12px;
    font-family: var(--font);
}
.status-text-input:focus { outline: none; border-color: var(--accent); }

.status-color-swatch {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 80px;
    height: 26px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 11px;
    font-weight: 600;
    border: 1px solid rgba(0,0,0,0.1);
    transition: opacity 0.1s;
}
.status-color-swatch:hover { opacity: 0.85; }

.color-picker-popup {
    position: fixed;
    background: #fff;
    border: 1px solid #e2e5ed;
    border-radius: 8px;
    padding: 14px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.15);
    z-index: 400;
    min-width: 180px;
}

.color-picker-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 10px;
    font-size: 13px;
}

.color-picker-row input[type="color"] {
    width: 50px;
    height: 28px;
    border: 1px solid #e2e5ed;
    border-radius: 4px;
    cursor: pointer;
    padding: 1px;
}

.color-picker-actions {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
}

.color-picker-actions button {
    padding: 5px 12px;
    border-radius: 5px;
    font-size: 12px;
    font-family: var(--font);
    cursor: pointer;
    border: 1px solid #e2e5ed;
    background: #f9fafb;
}
.color-picker-actions button:first-child {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
}

/* ── Color Swatch Picker ──────────────────────────────────────────── */
.cp-swatch-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    max-width: 224px;
}

.cp-swatch {
    width: 24px;
    height: 24px;
    border-radius: 4px;
    cursor: pointer;
    transition: transform 0.1s;
}

    .cp-swatch:hover {
        transform: scale(1.2);
    }

.cp-swatch-active {
    transform: scale(1.15);
}

/* ── Block Reasons ────────────────────────────────────────────────────── */
.block-reason-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 0;
    border-bottom: 1px solid #f3f4f6;
}

.settings-text-input {
    flex: 1;
    padding: 6px 10px;
    border: 1px solid #e2e5ed;
    border-radius: 5px;
    font-size: 13px;
    font-family: var(--font);
}
.settings-text-input:focus { outline: none; border-color: var(--accent); }

.btn-settings-secondary {
    background: #f3f4f6;
    border: 1px solid #e2e5ed;
    border-radius: 5px;
    padding: 7px 14px;
    font-family: var(--font);
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.1s;
    margin-right: 8px;
}
.btn-settings-secondary:hover { background: #e8ecff; color: var(--accent); }

.btn-icon-danger {
    background: none;
    border: none;
    color: #ef4444;
    cursor: pointer;
    font-size: 14px;
    padding: 2px 6px;
    border-radius: 4px;
    flex-shrink: 0;
}
.btn-icon-danger:hover { background: #fee2e2; }

/* ── Appointment Form (Left Panel) ───────────────────────────────────── */
.appt-form {
    background: #fff;
    border-radius: var(--radius);
    padding: 8px;
    box-shadow: var(--shadow);
    display: flex;
    flex-direction: column;
    gap: 5px;
    font-size: 13px;
}

.af-row {
    display: flex;
    align-items: flex-start;
    gap: 4px;
}

.af-label {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--text-muted);
    width: 52px;
    flex-shrink: 0;
    padding-top: 5px;
}

.af-input {
    flex: 1;
    padding: 4px 6px;
    border: 1px solid #e2e5ed;
    border-radius: 4px;
    font-size: 13px;
    font-family: var(--font);
    outline: none;
    width: 100%;
}
#afInsCo, #afClaim { font-weight: 700; }
.af-input:focus { border-color: var(--accent); }
.af-input.af-short { width: 70px; flex: none; }

.af-select {
    flex: 1;
    padding: 4px 4px;
    border: 1px solid #e2e5ed;
    border-radius: 4px;
    font-size: 13px;
    font-weight: 600;
    font-family: var(--font);
    outline: none;
    min-width: 0;
}
.af-select:focus { border-color: var(--accent); }

.af-icon-btn {
    background: #d4d8e2;
    border: 1px solid #ccc;
    border-radius: 3px;
    width: 22px;
    height: 22px;
    font-size: 14px;
    cursor: pointer;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    line-height: 1;
}
.af-icon-btn:hover { background: #c5c9d6; }

.af-ins-row, .af-cust-row, .af-veh-row {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 3px;
    flex: 1;
    position: relative;
    min-width: 0;
}

.af-cust-search { flex: 1; min-width: 0; font-weight: 700; }

.af-radios {
    gap: 8px;
    padding-left: 56px;
}

.af-radio {
    display: flex;
    align-items: center;
    gap: 3px;
    font-size: 12px;
    cursor: pointer;
    white-space: nowrap;
}

.af-cust-info {
    background: #f9fafb;
    border-radius: 4px;
    padding: 4px 6px;
    font-size: 12px;
    min-height: 20px;
}

.af-cust-name {
    font-weight: 700;
    color: var(--text-main);
    font-size: 14px;
}

.af-info-line {
    color: var(--text-muted);
    margin-top: 1px;
}

.af-dropdown {
    position: absolute;
    top: 100%;
    left: 22px;
    right: 0;
    background: #fff;
    border: 1px solid #e2e5ed;
    border-top: none;
    border-radius: 0 0 4px 4px;
    max-height: 120px;
    overflow-y: auto;
    z-index: 50;
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}

.af-drop-item {
    padding: 5px 8px;
    cursor: pointer;
    font-size: 12px;
    border-bottom: 1px solid #f3f4f6;
}
.af-drop-item:hover { background: #f0f4ff; }
.af-drop-item .af-di-name { font-weight: 600; }
.af-drop-item .af-di-detail { color: #4b5563; font-size: 12px; font-weight: 500; }

.af-section-label {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    padding: 4px 0 2px;
    border-top: 1px solid #e5e7eb;
    margin-top: 2px;
}

.af-notes-wrap {
    border: 1px solid #e2e5ed;
    border-radius: 4px;
    overflow: hidden;
}

.af-notes-btns {
    display: flex;
    flex-wrap: wrap;
    gap: 0;
    background: #eef0f5;
    border-bottom: 1px solid #e2e5ed;
}

.af-note-btn {
    background: #eef0f5;
    color: var(--text-main);
    border: none;
    border-right: 1px solid #d4d8e2;
    padding: 4px 8px;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    font-family: var(--font);
}
.af-note-btn:hover { background: var(--accent); color: #fff; }

.af-notes {
    width: 100%;
    padding: 5px 6px;
    border: none;
    border-radius: 0;
    font-size: 13px;
    font-family: var(--font);
    resize: vertical;
    outline: none;
    display: block;
}
.af-notes:focus { outline: none; }

.af-mates { margin-top: 4px; }
.af-mate-list { display: flex; flex-direction: column; gap: 2px; margin-top: 4px; }
.af-mate-item {
    padding: 3px 6px;
    border-radius: 3px;
    font-size: 11px;
    cursor: pointer;
    display: flex;
    gap: 6px;
}
.af-mate-item:hover { filter: brightness(0.9); }

.af-actions {
    display: flex;
    gap: 6px;
    margin-top: 2px;
}

.af-btn-save {
    flex: 1;
    background: var(--accent);
    color: #fff;
    border: none;
    border-radius: 4px;
    padding: 6px;
    font-family: var(--font);
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
}
.af-btn-save:hover { background: #3d5ce6; }

.af-btn-clear {
    flex: 1;
    background: #f3f4f6;
    color: var(--text-main);
    border: 1px solid #e2e5ed;
    border-radius: 4px;
    padding: 6px;
    font-family: var(--font);
    font-size: 12px;
    cursor: pointer;
}
.af-btn-clear:hover { background: #e8eaf0; }

/* ── Customer History ─────────────────────────────────────────────────── */
.af-history-link {
    text-align: center;
    padding: 4px 0 2px;
}

.af-history-link a {
    font-size: 11px;
    color: var(--accent);
    text-decoration: none;
}
.af-history-link a:hover { text-decoration: underline; }

.modal-history {
    width: 860px;
    max-width: 95vw;
}

.history-content {
    overflow-x: auto;
}

.history-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
}

.history-table thead th {
    background: var(--header-bg);
    color: #fff;
    padding: 8px 10px;
    text-align: left;
    font-weight: 600;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    white-space: nowrap;
    border-right: 1px solid rgba(255,255,255,0.1);
}

.history-table tbody tr {
    cursor: pointer;
    transition: filter 0.1s;
}
.history-table tbody tr:hover { filter: brightness(0.92); }

.history-table td {
    padding: 7px 10px;
    border-bottom: 1px solid rgba(0,0,0,0.08);
    white-space: nowrap;
    font-weight: 500;
}

.history-empty {
    padding: 30px;
    text-align: center;
    color: var(--text-muted);
    font-size: 13px;
}

/* ── Customer / Vehicle Forms ─────────────────────────────────────────── */
.cust-toggle-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
    padding-bottom: 8px;
    border-bottom: 1px solid #e2e5ed;
}

.btn-link-small {
    background: none;
    border: none;
    color: var(--accent);
    font-size: 11px;
    cursor: pointer;
    text-decoration: underline;
    font-family: var(--font);
}

.cust-field-row {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 6px;
}

.cust-field-row label {
    font-size: 11px;
    font-weight: 700;
    color: #374151;
    width: 68px;
    flex-shrink: 0;
    text-align: right;
}

.cust-input {
    flex: 1;
    padding: 4px 7px;
    border: 1px solid #9ca3af;
    border-radius: 4px;
    font-size: 12px;
    font-family: var(--font);
    outline: none;
    color: #111827;
    background: #ffffff;
}
.cust-input:focus { border-color: var(--accent); }
.cust-input-highlight { border-color: #e53e3e; }
.cust-input-highlight:focus { border-color: var(--accent); }

.cust-type-sel {
    width: 82px;
    flex-shrink: 0;
    padding: 4px 4px;
    border: 1px solid #d1d5db;
    border-radius: 4px;
    font-size: 12px;
    font-family: var(--font);
    outline: none;
}

.cust-phone { flex: 1; }
.cust-ext   { width: 50px; flex: none; }
.cust-zip   { width: 90px; flex: none; }
.cust-state { width: 36px; flex: none; text-transform: uppercase; }
.cust-city  { flex: 1; }

.cust-row-zip label:last-of-type { width: auto; }

/* Duplicate customer list */
.dup-cust-list {
    max-height: 280px;
    overflow-y: auto;
}

.dup-cust-item {
    padding: 10px 16px;
    border-bottom: 1px solid #e5e7eb;
    cursor: pointer;
    transition: background 0.1s;
}
.dup-cust-item:hover { background: #f0f4ff; }
.dup-cust-name   { font-weight: 700; font-size: 13px; color: var(--text-main); }
.dup-cust-detail { font-size: 11px; color: var(--text-muted); margin-top: 2px; }

/* Company contact fields in left panel */
.af-contact-row {
    display: flex;
    flex-direction: column;
    gap: 4px;
    background: #f9fafb;
    border-radius: 4px;
    padding: 6px;
    border: 1px solid #e5e7eb;
}
.af-contact-row label {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--text-muted);
}

/* Customer mode toggle */
.cust-mode-toggle {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 8px;
}

.cust-toggle-btn {
    background: var(--accent);
    color: #fff;
    border: none;
    border-radius: 50%;
    width: 26px;
    height: 26px;
    font-size: 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.3s;
}
.cust-toggle-btn:hover { transform: rotate(180deg); background: #3d5ce6; }

.cust-type-sel {
    color: #111827;
    background: #fff;
    border: 1px solid #9ca3af;
}
/* ── Upcoming Side Panel ──────────────────────────────────────────── */
.upcoming-link {
    display: block;
    color: #ffffff;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    padding: 6px 4px;
    border-radius: var(--radius);
    transition: background 0.15s;
}

    .upcoming-link:hover {
        background: rgba(79,110,247,0.08);
    }

.upcoming-panel {
    position: fixed;
    top: 0;
    left: -380px;
    width: 380px;
    height: 100vh;
    background: #fff;
    box-shadow: -4px 0 20px rgba(0,0,0,0.15);
    display: flex;
    flex-direction: column;
    z-index: 1000;
    transition: left 0.25s ease;
}

    .upcoming-panel.open {
        left: 0;
    }

.upcoming-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    background: var(--topbar-bg);
    color: #fff;
    font-size: 14px;
    font-weight: 600;
    flex-shrink: 0;
}

.upcoming-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.2);
    z-index: 999;
}

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

#upcomingList {
    flex: 1;
    overflow-y: auto;
    padding: 8px;
}

/* ── Context Menu ─────────────────────────────────────────────────────── */
.ctx-menu {
    position: fixed;
    background: #ffffff;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.15);
    z-index: 9999;
    min-width: 210px;
    padding: 4px 0;
    font-size: 13px;
    font-family: var(--font);
    user-select: none;
}

.ctx-item {
    padding: 7px 16px;
    cursor: pointer;
    color: #111827;
    display: flex;
    align-items: center;
    gap: 6px;
    position: relative;
    white-space: nowrap;
}
.ctx-item:hover { background: #eff6ff; color: #1d4ed8; }

.ctx-divider {
    height: 1px;
    background: #e5e7eb;
    margin: 3px 0;
}

.ctx-has-sub { padding-right: 28px; }
.ctx-has-sub::after {
    content: '▶';
    position: absolute;
    right: 10px;
    font-size: 9px;
    color: #9ca3af;
}

.ctx-submenu {
    display: none;
    position: absolute;
    left: 100%;
    top: -4px;
    background: #ffffff;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.15);
    min-width: 220px;
    padding: 4px 0;
    z-index: 10000;
}

.ctx-has-sub:hover > .ctx-submenu { display: block; }

.ctx-has-sub.flip-up > .ctx-submenu {
    top: auto;
    bottom: -4px;
}

.ctx-has-sub.flip-left > .ctx-submenu {
    left: auto;
    right: 100%;
}

.ctx-swatch {
    width: 12px;
    height: 12px;
    border-radius: 2px;
    flex-shrink: 0;
    display: inline-block;
}

/* ── Status Picker ────────────────────────────────────────────────────── */
.status-btn {
    width: 100%;
    padding: 8px 12px;
    border: none;
    border-radius: 4px;
    font-family: var(--font);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    text-align: center;
    transition: filter 0.1s;
}
.status-btn:hover { filter: brightness(0.88); }

/* ── Move Mode ────────────────────────────────────────────────────────── */
.topbar-move-banner {
    background: #f59e0b;
    color: #1c1917;
    font-size: 14px;
    font-weight: 700;
    padding: 6px 16px;
    border-radius: 6px;
    animation: pulse-banner 1.5s ease-in-out infinite;
}

.topbar-move-banner kbd {
    background: rgba(0,0,0,0.15);
    border-radius: 3px;
    padding: 1px 5px;
    font-family: var(--font);
    font-size: 12px;
}

@keyframes pulse-banner {
    0%, 100% { opacity: 1; }
    50%       { opacity: 0.75; }
}

.slot-cell.move-target {
    background: #dcfce7 !important;
    cursor: crosshair !important;
}
.slot-cell.move-target:hover {
    background: #86efac !important;
}

/* ── Block Create Modal ───────────────────────────────────────────────── */
.bc-col-header {
    font-weight: 700;
    font-size: 12px;
    text-align: center;
    padding: 6px;
    background: var(--panel-bg);
    border: 1px solid #d1d5db;
    border-radius: 4px 4px 0 0;
    margin-bottom: 0;
}

.bc-list {
    border: 1px solid #d1d5db;
    border-top: none;
    border-radius: 0 0 4px 4px;
    overflow-y: auto;
    /* Bound the height directly to the viewport (not just the flex chain) so the
       list always scrolls instead of overflowing the modal and getting clipped.
       min-height:0 also lets it shrink inside its flex column. */
    max-height: calc(100vh - 250px);
    min-height: 0;
}

.bc-item {
    padding: 8px 12px;
    font-size: 13px;
    cursor: pointer;
    border-bottom: 1px solid #e5e7eb;
    transition: background 0.1s;
}
.bc-item:last-child { border-bottom: none; }
.bc-item:hover { background: #eff6ff; }
.bc-item.selected {
    background: var(--accent);
    color: #fff;
}

/* ── Multiple Block Times Settings ───────────────────────────────────── */
.mb-sect { display: flex; flex-direction: column; gap: 14px; }

.mb-top-row {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
}

.mb-field {
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex: 1;
    min-width: 160px;
}

.mb-label {
    font-size: 11px;
    font-weight: 700;
    color: #374151;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.mb-mid-row {
    display: flex;
    gap: 16px;
}

.mb-box {
    flex: 1;
    border: 1px solid #e2e5ed;
    border-radius: 6px;
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.mb-box-title {
    font-size: 12px;
    font-weight: 700;
    color: #374151;
    border-bottom: 1px solid #e2e5ed;
    padding-bottom: 6px;
    margin-bottom: 4px;
}

.mb-radio-row {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    cursor: pointer;
    color: var(--text-main);
}

.mb-toggle-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 3px 0;
    font-size: 12px;
}

.mb-toggle-label { color: var(--text-main); font-size: 13px; }

/* Green toggle switch */
.mb-switch { position: relative; display: inline-block; width: 36px; height: 20px; }
.mb-switch input { opacity: 0; width: 0; height: 0; }
.mb-slider {
    position: absolute; cursor: pointer; inset: 0;
    background: #d1d5db; border-radius: 20px; transition: background 0.2s;
}
.mb-slider:before {
    content: ''; position: absolute;
    width: 14px; height: 14px; left: 3px; bottom: 3px;
    background: #fff; border-radius: 50%; transition: transform 0.2s;
}
.mb-switch input:checked + .mb-slider { background: #16a34a; }
.mb-switch input:checked + .mb-slider:before { transform: translateX(16px); }

.mb-time-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 8px;
}

.mb-reason-row {
    display: flex;
    align-items: center;
    gap: 12px;
}

.mb-results {
    border: 1px solid #e2e5ed;
    border-radius: 6px;
    padding: 12px;
    background: #f9fafb;
}

.mb-result-good { color: #16a34a; font-weight: 600; font-size: 13px; margin-bottom: 8px; }
.mb-result-warn { color: #b45309; font-weight: 600; font-size: 13px; margin-bottom: 8px; }
.mb-conflict-list { max-height: 150px; overflow-y: auto; margin-bottom: 8px; }
.mb-conflict-item { font-size: 12px; color: #dc2626; padding: 2px 0; }

/* ── Block Time modal: wider so END times (with duration labels) fit ──────────
   The DATE/START/END fields are equal flex:1 columns. Flex items default to
   min-width:auto, so the END column couldn't shrink below its longest option
   and pushed the row past the box edge. Widen this modal and let the fields
   shrink + fill their column. Scoped to #blockModal so other modals are
   unaffected. */
#blockModal .modal-box {
    width: 620px;
}
#blockModal .modal-field {
    min-width: 0;
}
#blockModal .modal-field input,
#blockModal .modal-field select,
#blockModal .modal-field textarea {
    width: 100%;
    box-sizing: border-box;
}

/* ── Permission Denied slide-out banner ─────────────────────────────────────
   Shown by denyPermission() when a user attempts a gated action. Slides in
   from the right; auto-hides after a few seconds. Sits above modals. */
.perm-denied-bar {
    position: fixed;
    top: 20px;
    right: -440px;
    max-width: 380px;
    background: #fee2e2;
    color: #991b1b;
    border: 1px solid #fca5a5;
    border-left: 4px solid #dc2626;
    border-radius: 8px;
    padding: 12px 16px;
    font-size: 14px;
    line-height: 1.35;
    display: flex;
    align-items: center;
    gap: 10px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.18);
    z-index: 4000;
    opacity: 0;
    transition: right .35s cubic-bezier(.2,.8,.2,1), opacity .35s;
}
.perm-denied-bar.show {
    right: 20px;
    opacity: 1;
}
.perm-denied-icon { font-size: 16px; flex-shrink: 0; }
