@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=JetBrains+Mono:wght@500&display=swap');

:root {
    --bg: #ffffff;
    --bg-soft: #f7f7f9;
    --bg-inset: #eeeef2;
    --border: #e4e4ea;
    --border-strong: #d3d3db;
    --text: #17181c;
    --text-muted: #6c6e79;
    --text-faint: #a2a3ad;
    --accent: #564fee;
    --accent-hover: #423bd9;
    --accent-soft: #edecfe;
    --accent-mid: #c9c6fb;
    --danger: #e0434d;
    --danger-soft: #fbe9ea;
    --success: #12946f;
    --success-soft: #e4f5ef;
    --warning: #b98a00;
    --warning-soft: #fbf1dc;
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
    --shadow-sm: 0 1px 2px rgba(20, 20, 30, 0.06);
    --shadow-md: 0 8px 24px rgba(20, 20, 30, 0.10), 0 2px 6px rgba(20, 20, 30, 0.06);
    --shadow-lg: 0 20px 60px rgba(20, 20, 30, 0.18);
    --sidebar-w: 60px;
    --cal-side-w: 236px;
    --tg-gutter-w: 58px;
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--bg-soft);
    color: var(--text);
    font-size: 14.5px;
    line-height: 1.45;
    -webkit-font-smoothing: antialiased;
}
#app-root { height: 100%; }
button { font-family: inherit; cursor: pointer; }
input, textarea, select { font-family: inherit; font-size: inherit; color: inherit; }
a { color: var(--accent); }

/* ---------- boot screen ---------- */
.boot-screen {
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-soft);
}
.boot-mark {
    width: 56px; height: 56px;
    border-radius: var(--radius-md);
    background: var(--accent);
    color: #fff;
    display: flex; align-items: center; justify-content: center;
    font-weight: 700; letter-spacing: 0.02em;
    animation: pulse 1.1s ease-in-out infinite;
}
@keyframes pulse {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(0.92); opacity: 0.75; }
}

/* ---------- buttons ---------- */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    padding: 8px 14px;
    font-size: 13.5px;
    font-weight: 600;
    background: var(--bg-inset);
    color: var(--text);
    transition: background .12s ease, border-color .12s ease, color .12s ease, opacity .12s ease;
    white-space: nowrap;
}
.btn:hover { background: var(--border-strong); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-hover); }
.btn-ghost { background: transparent; border-color: var(--border); }
.btn-ghost:hover { background: var(--bg-inset); }
.btn-danger { background: var(--danger-soft); color: var(--danger); }
.btn-danger:hover { background: #f6d3d5; }
.btn-icon {
    padding: 7px;
    border: none;
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--text-muted);
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.btn-icon:hover { background: var(--bg-inset); color: var(--text); }
.btn-icon:disabled { opacity: .4; cursor: not-allowed; }
.btn-icon:disabled:hover { background: transparent; color: var(--text-muted); }
.btn-sm { padding: 5px 10px; font-size: 12.5px; }

/* ---------- inputs ---------- */
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.field label { font-size: 12.5px; font-weight: 600; color: var(--text-muted); }
.field-row { display: flex; align-items: center; gap: 8px; }
.input, .textarea, .select {
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 9px 11px;
    background: var(--bg);
    font-size: 13.5px;
    outline: none;
    transition: border-color .12s ease, box-shadow .12s ease;
    width: 100%;
}
.input:focus, .textarea:focus, .select:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-soft);
}
.input:disabled, .textarea:disabled, .select:disabled {
    background: var(--bg-soft);
    color: var(--text-muted);
    cursor: not-allowed;
}
.input::placeholder { color: var(--text-faint); }
.textarea { resize: vertical; min-height: 72px; }
.field-hint { font-size: 12px; color: var(--text-faint); }
.field-error { font-size: 12px; color: var(--danger); }
.select { appearance: none; background-image: none; padding-right: 11px; }

/* ---------- app shell ---------- */
.shell { display: flex; height: 100vh; }

.sidebar {
    width: var(--sidebar-w);
    flex-shrink: 0;
    background: var(--bg);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 14px 0;
    gap: 4px;
}

.brand {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 0 14px;
}

.brand-mark {
    width: 30px; height: 30px;
    border-radius: 8px;
    background: var(--accent);
    color: #fff;
    display: flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: 13px;
}

.nav {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    width: 100%;
}

.nav-item {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    padding: 0;
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    border: none;
    background: transparent;
    position: relative;
}
.nav-item:hover { background: var(--bg-inset); color: var(--text); }
.nav-item.active { background: var(--accent-soft); color: var(--accent); }

.nav-item[data-tooltip]::after {
    content: attr(data-tooltip);
    position: absolute;
    left: calc(100% + 10px);
    top: 50%;
    transform: translateY(-50%);
    background: var(--text);
    color: #fff;
    padding: 5px 10px;
    border-radius: var(--radius-sm);
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity .12s ease;
    z-index: 50;
}
.nav-item[data-tooltip]:hover::after { opacity: 1; }

.nav-item .badge {
    position: absolute;
    top: 3px;
    right: 3px;
    margin: 0;
    background: var(--danger);
    color: #fff;
    font-size: 9px;
    font-weight: 700;
    border-radius: 999px;
    padding: 1px 4px;
    min-width: 14px;
    text-align: center;
}

.sidebar-footer { display: none; }

.main {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.topbar {
    height: 58px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    border-bottom: 1px solid var(--border);
    background: var(--bg);
}
.topbar-title { font-weight: 700; font-size: 16px; }
.topbar-left { display: flex; align-items: center; gap: 10px; min-width: 0; }

.view { flex: 1; min-height: 0; }
.view-padded { overflow-y: auto; padding: 28px 32px 60px; }
.view-inner { max-width: 820px; margin: 0 auto; }
.view-flush { overflow: hidden; display: flex; }

.content-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
    gap: 12px;
}
.content-header h1 { font-size: 20px; margin: 0; letter-spacing: -0.01em; }
.content-header p { margin: 4px 0 0; color: var(--text-muted); font-size: 13px; }

.back-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    border: none;
    background: transparent;
    color: var(--text-muted);
    font-size: 13px;
    font-weight: 600;
    padding: 4px 0;
    margin-bottom: 12px;
}
.back-link:hover { color: var(--text); }

/* ---------- avatar / identity ---------- */
.avatar {
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    color: #fff;
    flex-shrink: 0;
    user-select: none;
}
.avatar-sm { width: 30px; height: 30px; font-size: 12px; }
.avatar-md { width: 38px; height: 38px; font-size: 14px; }
.avatar-lg { width: 64px; height: 64px; font-size: 22px; }

.account-trigger {
    display: flex;
    align-items: center;
    gap: 6px;
    border: none;
    background: transparent;
    padding: 4px;
    border-radius: 999px;
    color: var(--text-muted);
}
.account-trigger:hover { background: var(--bg-inset); }

/* ---------- search bar ---------- */
.search-bar {
    display: flex;
    gap: 8px;
    margin-bottom: 18px;
    flex-wrap: wrap;
}
.search-bar .input { max-width: 200px; }

/* ---------- list rows / cards ---------- */
.list { display: flex; flex-direction: column; gap: 8px; }

.row {
    display: flex;
    align-items: center;
    gap: 12px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 12px 14px;
    transition: border-color .12s ease, box-shadow .12s ease;
}
.row.clickable { cursor: pointer; }
.row.clickable:hover { border-color: var(--border-strong); box-shadow: var(--shadow-sm); }

.row-open {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
    min-width: 0;
    border: none;
    background: transparent;
    padding: 0;
    text-align: left;
    border-radius: var(--radius-sm);
}
.row-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.row-title { font-weight: 600; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-sub { font-size: 12.5px; color: var(--text-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-actions { display: flex; align-items: center; gap: 6px; flex-shrink: 0; }

.token-chip {
    display: flex;
    align-items: center;
    gap: 6px;
    background: var(--bg-inset);
    border-radius: var(--radius-sm);
    padding: 4px 4px 4px 10px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 12px;
    max-width: 240px;
}
.token-chip > span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.pill {
    display: inline-flex;
    align-items: center;
    padding: 3px 9px;
    border-radius: 999px;
    font-size: 11.5px;
    font-weight: 700;
    letter-spacing: 0.01em;
}
.pill-pending { background: var(--warning-soft); color: var(--warning); }
.pill-accepted { background: var(--success-soft); color: var(--success); }
.pill-rejected { background: var(--danger-soft); color: var(--danger); }
.pill-muted { background: var(--bg-inset); color: var(--text-muted); }

.empty-state {
    text-align: center;
    padding: 56px 20px;
    color: var(--text-muted);
}
.empty-state .empty-icon { color: var(--text-faint); margin-bottom: 10px; }
.empty-state h3 { margin: 0 0 4px; font-size: 14.5px; color: var(--text); }
.empty-state p { margin: 0; font-size: 13px; }

.section-label {
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-faint);
    margin: 26px 0 10px;
}
.section-label:first-child { margin-top: 0; }

.loading-text { color: var(--text-muted); font-size: 13px; }

/* ---------- modal ---------- */
.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(23, 24, 28, 0.42);
    backdrop-filter: blur(2px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    padding: 20px;
    animation: fade-in .12s ease;
}
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }

.modal {
    background: var(--bg);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 440px;
    max-height: 86vh;
    display: flex;
    flex-direction: column;
    animation: pop-in .14s cubic-bezier(.2,.9,.3,1);
}
.modal.modal-wide { max-width: 620px; }
@keyframes pop-in {
    from { opacity: 0; transform: translateY(6px) scale(.98); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}
.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 20px;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
    gap: 12px;
}
.modal-header h2 { font-size: 16px; margin: 0; }
.modal-body { padding: 20px; overflow-y: auto; }
.modal-footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    padding: 16px 20px;
    border-top: 1px solid var(--border);
    flex-shrink: 0;
}
.modal-actions { display: flex; gap: 8px; width: 100%; justify-content: flex-end; }
.modal-actions.spread { justify-content: space-between; }

/* ---------- dropdown menu ---------- */
.dropdown-menu {
    position: fixed;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-md);
    padding: 6px;
    min-width: 178px;
    max-height: 320px;
    overflow-y: auto;
    z-index: 200;
    animation: pop-in .1s ease;
}
.dropdown-item {
    display: flex;
    align-items: center;
    gap: 9px;
    width: 100%;
    padding: 8px 10px;
    border: none;
    background: transparent;
    border-radius: var(--radius-sm);
    font-size: 13.5px;
    font-weight: 500;
    color: var(--text);
    text-align: left;
}
.dropdown-item:hover { background: var(--bg-inset); }
.dropdown-item.danger { color: var(--danger); }
.dropdown-item.active { color: var(--accent); font-weight: 600; }
.dropdown-item:disabled { opacity: .5; cursor: not-allowed; }
.dropdown-item:disabled:hover { background: transparent; }
.dropdown-divider { height: 1px; background: var(--border); margin: 6px 4px; }
.dropdown-label {
    padding: 6px 10px 4px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: var(--text-faint);
}

/* ---------- toast ---------- */
.toast-stack {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    flex-direction: column;
    gap: 8px;
    z-index: 300;
    align-items: center;
}
.toast {
    background: var(--text);
    color: #fff;
    padding: 10px 16px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 500;
    box-shadow: var(--shadow-md);
    animation: toast-in .15s ease;
    max-width: 520px;
}
.toast.error { background: var(--danger); }
.toast.success { background: var(--success); }
@keyframes toast-in {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ---------- profile / user card ---------- */
.profile-head {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 20px;
}
.profile-head h2 { margin: 0; font-size: 17px; }
.profile-head p { margin: 2px 0 0; color: var(--text-muted); font-size: 13px; }

.card {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 22px;
}

.dob-phone-row { display: flex; align-items: flex-end; gap: 8px; }
.dob-phone-row .field { flex: 1; margin-bottom: 0; }
.dob-phone-row + .dob-phone-row { margin-top: 14px; }
.dob-phone-row .btn-icon { margin-bottom: 5px; }

.divider { height: 1px; background: var(--border); margin: 18px 0; }

/* ---------- auth screen ---------- */
.auth-screen {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background:
            radial-gradient(circle at 15% 20%, #edecff 0%, transparent 45%),
            radial-gradient(circle at 85% 80%, #eef8f4 0%, transparent 45%),
            var(--bg-soft);
    padding: 20px;
}
.auth-card {
    width: 100%;
    max-width: 380px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    padding: 32px 30px 28px;
}
.auth-mark {
    width: 40px; height: 40px;
    border-radius: 10px;
    background: var(--accent);
    color: #fff;
    display: flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: 15px;
    margin-bottom: 18px;
}
.auth-card h1 { font-size: 19px; margin: 0 0 4px; letter-spacing: -0.01em; }
.auth-card .sub { color: var(--text-muted); font-size: 13.5px; margin: 0 0 22px; }
.auth-submit { width: 100%; justify-content: center; padding: 10px; font-size: 14px; }
.auth-error {
    background: var(--danger-soft);
    color: var(--danger);
    border-radius: var(--radius-sm);
    padding: 9px 11px;
    font-size: 12.5px;
    margin-bottom: 14px;
}
.auth-note {
    margin-top: 18px;
    font-size: 12px;
    color: var(--text-faint);
    text-align: center;
}

/* ================= CALENDARS ================= */
.cal-layout { display: flex; flex: 1; min-width: 0; min-height: 0; }

.cal-side {
    width: var(--cal-side-w);
    flex-shrink: 0;
    border-right: 1px solid var(--border);
    background: var(--bg);
    display: flex;
    flex-direction: column;
    padding: 14px 10px;
    gap: 10px;
    overflow-y: auto;
    transition: width .16s ease;
}
.cal-side.hidden { display: none; }

.cal-side-title {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: var(--text-faint);
    padding: 0 6px;
}
.cal-side-list { display: flex; flex-direction: column; gap: 3px; }

.cal-strip {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 6px 8px 10px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    border: 1px solid transparent;
}
.cal-strip:hover { background: var(--bg-soft); }
.cal-strip.active { background: var(--accent-soft); border-color: var(--accent-mid); }
.cal-strip-dot {
    width: 9px; height: 9px;
    border-radius: 3px;
    flex-shrink: 0;
}
.cal-strip-name {
    flex: 1;
    min-width: 0;
    font-size: 13px;
    font-weight: 600;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.cal-strip.active .cal-strip-name { color: var(--accent); }
.cal-strip-menu { opacity: 0; }
.cal-strip:hover .cal-strip-menu, .cal-strip.active .cal-strip-menu { opacity: 1; }

.cal-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.cal-toolbar {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    border-bottom: 1px solid var(--border);
    background: var(--bg);
    flex-wrap: wrap;
}
.cal-nav { display: flex; align-items: center; gap: 2px; }
.cal-nav .btn { padding: 7px 12px; }
.cal-nav .btn-icon { padding: 8px 6px; }

.cal-range-title {
    font-weight: 700;
    font-size: 15px;
    margin-left: 6px;
    white-space: nowrap;
}
.cal-toolbar-spacer { flex: 1; }

.mode-switch {
    display: inline-flex;
    background: var(--bg-inset);
    border-radius: var(--radius-sm);
    padding: 2px;
}
.mode-switch button {
    border: none;
    background: transparent;
    padding: 6px 13px;
    border-radius: 4px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-muted);
}
.mode-switch button.active { background: var(--bg); color: var(--text); box-shadow: var(--shadow-sm); }

.cal-client-select {
    display: flex;
    align-items: center;
    gap: 6px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 5px 10px;
    background: var(--bg);
    font-size: 13px;
    font-weight: 600;
    max-width: 260px;
}
.cal-client-select .who {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--text);
}
.cal-client-select.empty .who { color: var(--danger); }

.cal-body { flex: 1; min-height: 0; display: flex; flex-direction: column; position: relative; }

.cal-hint {
    position: absolute;
    bottom: 10px;
    right: 14px;
    font-size: 11.5px;
    color: var(--text-faint);
    background: rgba(255,255,255,.86);
    padding: 3px 8px;
    border-radius: 999px;
    pointer-events: none;
}

/* ---------- day / week grid ---------- */
.tg { flex: 1; min-height: 0; display: flex; flex-direction: column; background: var(--bg); }

.tg-head {
    display: flex;
    flex-shrink: 0;
    border-bottom: 1px solid var(--border);
}
.tg-head-gutter { width: var(--tg-gutter-w); flex-shrink: 0; }
.tg-head-cols { flex: 1; display: flex; min-width: 0; }
.tg-head-cell {
    flex: 1;
    min-width: 0;
    text-align: center;
    padding: 8px 4px;
    border-left: 1px solid var(--border);
}
.tg-head-dow {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: var(--text-faint);
}
.tg-head-date { font-size: 15px; font-weight: 700; }
.tg-head-cell.today .tg-head-dow { color: var(--accent); }
.tg-head-cell.today .tg-head-date {
    color: #fff;
    background: var(--accent);
    border-radius: 999px;
    display: inline-block;
    min-width: 26px;
    padding: 0 6px;
}

.tg-scroll {
    flex: 1;
    min-height: 0;
    display: flex;
    overflow: hidden;
    position: relative;
    cursor: default;
}
.tg-gutter {
    width: var(--tg-gutter-w);
    flex-shrink: 0;
    position: relative;
    border-right: 1px solid var(--border);
}
.tg-hour-label {
    position: absolute;
    right: 8px;
    transform: translateY(-50%);
    font-size: 11.5px;
    font-weight: 600;
    color: var(--text-faint);
    font-variant-numeric: tabular-nums;
}
.tg-cols { flex: 1; display: flex; min-width: 0; position: relative; }
.tg-col {
    flex: 1;
    min-width: 0;
    position: relative;
    border-left: 1px solid var(--border);
}
.tg-col.weekend { background: #fcfcfd; }

.tg-line {
    position: absolute;
    left: 0;
    right: 0;
    pointer-events: none;
}
.tg-line.hour { border-top: 1px solid var(--border); }
.tg-line.half { border-top: 1px dashed var(--border); }

.tg-now {
    position: absolute;
    left: 0;
    right: 0;
    height: 0;
    border-top: 2px solid var(--danger);
    pointer-events: none;
    z-index: 4;
}
.tg-now::before {
    content: '';
    position: absolute;
    left: -4px;
    top: -4px;
    width: 7px; height: 7px;
    border-radius: 50%;
    background: var(--danger);
}

.tg-sel {
    position: absolute;
    left: 2px;
    right: 2px;
    background: var(--accent-soft);
    border: 1px solid var(--accent);
    border-radius: 5px;
    z-index: 3;
    pointer-events: none;
    font-size: 11.5px;
    font-weight: 700;
    color: var(--accent);
    padding: 2px 5px;
    overflow: hidden;
}

.appt {
    position: absolute;
    border-radius: 6px;
    padding: 3px 7px;
    font-size: 12px;
    overflow: hidden;
    cursor: pointer;
    z-index: 2;
    background: var(--accent);
    color: #fff;
    border: 1px solid rgba(255,255,255,.55);
    box-shadow: var(--shadow-sm);
    transition: filter .12s ease;
    text-align: left;
    line-height: 1.3;
    user-select: none;
}
.appt:hover { filter: brightness(1.08); }
.appt-time { font-weight: 700; font-size: 11px; opacity: .92; font-variant-numeric: tabular-nums; }
.appt-name {
    font-weight: 600;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.appt-notes {
    font-size: 11px;
    opacity: .85;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.appt.mine { background: var(--success); }
.appt.busy { background: #8b8d99; }
.appt-badge {
    display: inline-block;
    font-size: 9.5px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .03em;
    background: rgba(255,255,255,.25);
    border-radius: 3px;
    padding: 0 4px;
    margin-left: 4px;
}

/* ---------- appointment drag & resize ---------- */
.appt-resize-top,
.appt-resize-bottom {
    position: absolute;
    left: 0; right: 0;
    height: 7px;
    cursor: ns-resize;
    z-index: 3;
}
.appt-resize-top    { top: -1px; }
.appt-resize-bottom { bottom: -1px; }
.appt-resize-top::after,
.appt-resize-bottom::after {
    content: '';
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    width: 20px;
    height: 3px;
    border-radius: 2px;
    background: rgba(255,255,255,.45);
}
.appt-resize-top::after    { top: 2px; }
.appt-resize-bottom::after { bottom: 2px; }

.appt.dragging {
    opacity: .85;
    z-index: 10;
    box-shadow: var(--shadow-md);
    cursor: grabbing;
    pointer-events: none;
}

.mg-day.drag-over {
    background: var(--accent-soft);
    outline: 2px solid var(--accent);
    outline-offset: -2px;
}
.mg-chip.dragging { opacity: .4; }

/* ---------- month grid ---------- */
.mg { flex: 1; min-height: 0; display: flex; flex-direction: column; background: var(--bg); }
.mg-head { display: flex; flex-shrink: 0; border-bottom: 1px solid var(--border); }
.mg-head div {
    flex: 1;
    text-align: center;
    padding: 8px 4px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: var(--text-faint);
}
.mg-weeks { flex: 1; min-height: 0; display: flex; flex-direction: column; overflow: hidden; }
.mg-week { flex: 1; display: flex; min-height: 0; border-bottom: 1px solid var(--border); }
.mg-day {
    flex: 1;
    min-width: 0;
    border-left: 1px solid var(--border);
    padding: 5px 6px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    overflow: hidden;
    cursor: pointer;
}
.mg-day:hover { background: var(--bg-soft); }
.mg-day.other-month { background: #fbfbfc; }
.mg-day.other-month .mg-daynum { color: var(--text-faint); }
.mg-daynum {
    font-size: 12.5px;
    font-weight: 700;
    color: var(--text-muted);
    align-self: flex-start;
    min-width: 22px;
    text-align: center;
    border-radius: 999px;
    padding: 1px 4px;
}
.mg-day.today .mg-daynum { background: var(--accent); color: #fff; }
.mg-chip {
    display: flex;
    align-items: center;
    gap: 4px;
    background: var(--accent-soft);
    color: var(--accent);
    border: none;
    border-radius: 4px;
    padding: 5px 7px;
    font-size: 11.5px;
    font-weight: 600;
    overflow: hidden;
    white-space: nowrap;
    text-align: left;
    flex-shrink: 0;
    user-select: none;
}
.mg-chip:hover { background: var(--accent-mid); }
.mg-chip.mine { background: var(--success); color: #fff; }
.mg-chip.mine:hover { filter: brightness(1.08); }
.mg-chip.busy { background: #8b8d99; color: #fff; }
.mg-chip.busy:hover { filter: brightness(1.08); }
.mg-chip-time { font-variant-numeric: tabular-nums; opacity: .9; }
.mg-chip-name { overflow: hidden; text-overflow: ellipsis; }
.mg-more { font-size: 10.5px; font-weight: 700; color: var(--text-faint); padding-left: 5px; }

/* ---------- invited-clients block in calendar settings ---------- */
.invited-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 4px 8px 10px;
    border-radius: var(--radius-sm);
    background: var(--bg-soft);
}
.invited-row .row-main { gap: 0; }
.notice {
    background: var(--warning-soft);
    color: #8a6800;
    border-radius: var(--radius-sm);
    padding: 9px 11px;
    font-size: 12.5px;
    margin-bottom: 14px;
}
.notice.info { background: var(--accent-soft); color: var(--accent-hover); }

/* ---------- scrollbar ---------- */
::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 8px; }
::-webkit-scrollbar-track { background: transparent; }

/* ---------- client color palette ---------- */
.color-palette {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    margin-bottom: 14px;
}
.color-swatch {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: 2px solid transparent;
    cursor: pointer;
    padding: 0;
    transition: transform .1s ease, border-color .1s ease;
}
.color-swatch:hover { transform: scale(1.15); }
.color-swatch.active {
    border-color: var(--text);
    box-shadow: 0 0 0 2px var(--bg), 0 0 0 4px var(--text);
}

@media (max-width: 860px) {
    .sidebar { display: none; }
    .view-padded { padding: 20px; }
    .cal-side { position: absolute; z-index: 10; height: 100%; box-shadow: var(--shadow-md); }
}