/* Veblot Calendar — Modern SaaS UI */

:root,
[data-theme="light"] {
    --bg-page: #f9fafb;
    --bg-card: #ffffff;
    --bg-sidebar: #ffffff;
    --bg-muted: #f2f4f7;
    --text-primary: #101828;
    --text-secondary: #667085;
    --text-tertiary: #98a2b3;
    --border: #eaecf0;
    --border-strong: #d0d5dd;
    --accent: #101828;
    --accent-hover: #1d2939;
    --accent-soft: #f4f3ff;
    --danger: #d92d20;
    --danger-hover: #b42318;
    --shadow-xs: 0 1px 2px rgba(16, 24, 40, 0.05);
    --shadow-sm: 0 1px 3px rgba(16, 24, 40, 0.1), 0 1px 2px rgba(16, 24, 40, 0.06);
    --shadow-md: 0 4px 8px -2px rgba(16, 24, 40, 0.1), 0 2px 4px -2px rgba(16, 24, 40, 0.06);
    --radius-sm: 6px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --radius-xl: 16px;
    --sidebar-width: 260px;
    --fc-border: #eaecf0;
    --fc-today: #f9fafb;
    --fc-now: #7f56d9;
}

[data-theme="dark"] {
    --bg-page: #0c111d;
    --bg-card: #161b26;
    --bg-sidebar: #161b26;
    --bg-muted: #1f242f;
    --text-primary: #f5f5f6;
    --text-secondary: #94969c;
    --text-tertiary: #61646c;
    --border: #2a2f3a;
    --border-strong: #333741;
    --accent: #f5f5f6;
    --accent-hover: #e4e4e7;
    --accent-soft: #1f242f;
    --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.3);
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.4);
    --shadow-md: 0 4px 8px rgba(0, 0, 0, 0.4);
    --fc-border: #2a2f3a;
    --fc-today: #1f242f;
    --fc-now: #9e77ed;
}

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

body {
    margin: 0;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background: var(--bg-page);
    color: var(--text-primary);
    line-height: 1.5;
    min-height: 100vh;
    font-size: 14px;
    -webkit-font-smoothing: antialiased;
}

/* ─── App shell layout ─── */
.app-shell { overflow-x: hidden; }

.app-layout {
    display: flex;
    min-height: 100vh;
}

.app-sidebar {
    width: var(--sidebar-width);
    background: var(--bg-sidebar);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 300;
    transition: transform 0.25s ease;
}

.sidebar-header {
    padding: 1.25rem 1rem 1rem;
}

.sidebar-logo {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    text-decoration: none;
    color: var(--text-primary);
}

.logo-mark {
    width: 32px;
    height: 32px;
    border-radius: var(--radius-md);
    flex-shrink: 0;
    object-fit: contain;
    display: block;
}

.logo-text {
    font-weight: 600;
    font-size: 1rem;
    letter-spacing: -0.02em;
}

.sidebar-nav {
    flex: 1;
    padding: 0.5rem 0.75rem;
    overflow-y: auto;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.55rem 0.75rem;
    margin-bottom: 2px;
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.875rem;
    font-weight: 500;
    border: none;
    background: none;
    width: 100%;
    cursor: pointer;
    text-align: left;
    transition: background 0.15s, color 0.15s;
}

.nav-item:hover {
    background: var(--bg-muted);
    color: var(--text-primary);
    border: none;
}

.nav-item.active {
    background: var(--bg-muted);
    color: var(--text-primary);
    border: none;
}

.app-sidebar .sidebar-nav .nav-item,
.app-sidebar .sidebar-nav .nav-item:hover,
.app-sidebar .sidebar-nav .nav-item.active,
.app-sidebar .sidebar-footer .nav-item,
.app-sidebar .sidebar-footer .nav-item:hover,
.app-sidebar .sidebar-footer .nav-item.active {
    border: none;
    border-left: none;
    box-shadow: none;
}

.nav-icon {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
    opacity: 0.7;
}

.nav-item.active .nav-icon { opacity: 1; }

.sidebar-footer {
    padding: 0.75rem;
    border-top: 1px solid var(--border);
}

.sidebar-profile {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem;
    margin-top: 0.5rem;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    background: var(--bg-page);
    text-decoration: none;
    color: inherit;
    transition: background 0.15s, border-color 0.15s;
}

.sidebar-profile:hover {
    background: var(--bg-muted);
    border-color: var(--border-strong);
}

.profile-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, #7f56d9, #9e77ed);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 600;
    flex-shrink: 0;
}

.profile-info {
    min-width: 0;
    display: flex;
    flex-direction: column;
}

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

.profile-email {
    font-size: 0.75rem;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Main area */
.app-main {
    flex: 1;
    margin-left: var(--sidebar-width);
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.app-topbar {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.875rem 1.5rem;
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 100;
}

.sidebar-toggle {
    display: none;
    background: none;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 0.4rem;
    cursor: pointer;
    color: var(--text-secondary);
}

.sidebar-toggle svg { width: 20px; height: 20px; display: block; }

.breadcrumbs {
    display: flex;
    align-items: center;
    font-size: 0.875rem;
    flex: 1;
    min-width: 0;
}

.bc-current { color: var(--text-primary); font-weight: 500; }

.topbar-search {
    position: relative;
    width: 280px;
    flex-shrink: 0;
}

.topbar-search input {
    width: 100%;
    padding: 0.5rem 2.5rem 0.5rem 2.25rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--bg-page);
    color: var(--text-primary);
    font-size: 0.875rem;
    box-shadow: var(--shadow-xs);
    transition: border-color 0.15s, box-shadow 0.15s;
}

.topbar-search input:focus {
    outline: none;
    border-color: var(--border-strong);
    box-shadow: var(--shadow-sm);
}

.topbar-search .search-icon {
    position: absolute;
    left: 0.65rem;
    top: 50%;
    transform: translateY(-50%);
    width: 16px;
    height: 16px;
    color: var(--text-tertiary);
    pointer-events: none;
}

.search-kbd {
    position: absolute;
    right: 0.5rem;
    top: 50%;
    transform: translateY(-50%);
    font-size: 0.7rem;
    padding: 0.15rem 0.35rem;
    border: 1px solid var(--border);
    border-radius: 4px;
    color: var(--text-tertiary);
    background: var(--bg-card);
    font-family: inherit;
}

.search-results {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-md);
    max-height: 320px;
    overflow-y: auto;
    z-index: 200;
}

.search-results a {
    display: block;
    padding: 0.65rem 0.875rem;
    color: var(--text-primary);
    text-decoration: none;
    border-bottom: 1px solid var(--border);
    font-size: 0.875rem;
}

.search-results a:hover { background: var(--bg-muted); }
.search-results .search-date { color: var(--text-secondary); font-size: 0.75rem; }

/* Page content */
.page-content {
    padding: 1.5rem;
    flex: 1;
}

.page-header {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1.25rem;
}

.page-title {
    margin: 0;
    font-size: 1.5rem;
    font-weight: 600;
    letter-spacing: -0.02em;
}

.filter-pills {
    display: flex;
    gap: 0.35rem;
    flex-wrap: wrap;
}

.pill {
    padding: 0.4rem 0.875rem;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: var(--bg-card);
    color: var(--text-secondary);
    font-size: 0.8125rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s;
    font-family: inherit;
}

.pill:hover {
    background: var(--bg-muted);
    color: var(--text-primary);
}

.pill.active {
    background: var(--bg-muted);
    color: var(--text-primary);
    border-color: var(--border-strong);
}

/* Calendar card */
.calendar-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-xs);
    overflow: hidden;
}

.calendar-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.875rem 1.25rem;
    border-bottom: 1px solid var(--border);
}

.toolbar-left,
.toolbar-center,
.toolbar-right {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.toolbar-center { margin: 0 auto; }

.date-range-box {
    padding: 0.45rem 0.875rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-primary);
    background: var(--bg-card);
    white-space: nowrap;
}

.icon-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--bg-card);
    color: var(--text-secondary);
    cursor: pointer;
    transition: background 0.15s;
}

.icon-btn:hover { background: var(--bg-muted); color: var(--text-primary); }
.icon-btn svg { width: 18px; height: 18px; }

.text-btn {
    padding: 0.45rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--bg-card);
    color: var(--text-secondary);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    font-family: inherit;
    transition: background 0.15s;
}

.text-btn:hover { background: var(--bg-muted); color: var(--text-primary); }

.view-select {
    padding: 0.45rem 2rem 0.45rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--bg-card);
    color: var(--text-primary);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23667085' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.5rem center;
    font-family: inherit;
}

.btn-add-event {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.5rem 0.875rem;
    background: var(--accent);
    color: #fff;
    border: none;
    border-radius: var(--radius-md);
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
    transition: background 0.15s;
    box-shadow: var(--shadow-xs);
}

[data-theme="dark"] .btn-add-event {
    background: #f5f5f6;
    color: #101828;
}

.btn-add-event:hover { background: var(--accent-hover); }
.btn-add-event svg { width: 16px; height: 16px; }

#calendar {
    padding: 0 0.5rem 0.5rem;
}

/* ─── FullCalendar overrides ─── */
.fc {
    --fc-border-color: var(--fc-border);
    --fc-today-bg-color: var(--fc-today);
    --fc-now-indicator-color: var(--fc-now);
    --fc-page-bg-color: var(--bg-card);
    --fc-neutral-bg-color: var(--bg-muted);
    font-family: 'Inter', sans-serif;
}

.fc .fc-toolbar { display: none !important; }

.fc .fc-col-header-cell {
    padding: 0.75rem 0;
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--text-secondary);
    border-color: var(--border);
}

.fc .fc-col-header-cell-cushion {
    padding: 0.35rem 0.5rem;
    text-decoration: none;
    color: inherit;
    display: block;
}

/* Custom day column headers (week/day views) */
.day-header-inner {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.35rem;
}

.day-header-weekday {
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--text-secondary);
    line-height: 1;
}

.day-header-num {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-primary);
    width: 32px;
    height: 32px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    line-height: 1;
}

.day-header-num--today {
    background: var(--accent);
    color: #fff;
}

[data-theme="dark"] .day-header-num--today {
    background: #f5f5f6;
    color: #101828;
}

.fc .fc-daygrid-day-number,
.fc .fc-timegrid-axis-cushion {
    font-size: 0.8125rem;
    color: var(--text-secondary);
    text-decoration: none;
}

.fc .fc-day-today .fc-daygrid-day-number {
    width: 28px;
    height: 28px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: var(--accent);
    color: #fff !important;
    font-weight: 600;
    line-height: 1;
    margin: 4px;
}

[data-theme="dark"] .fc .fc-day-today .fc-daygrid-day-number {
    background: #f5f5f6;
    color: #101828 !important;
}

.fc-theme-standard td,
.fc-theme-standard th {
    border-color: var(--border);
}

.fc .fc-timegrid-slot-label {
    font-size: 0.75rem;
    color: var(--text-tertiary);
}

.fc .fc-timegrid-slot {
    height: 3rem;
}

.fc .fc-timegrid-now-indicator-line {
    border-color: var(--fc-now);
    border-width: 2px;
}

.fc .fc-timegrid-now-indicator-arrow {
    border-color: var(--fc-now);
}

/* Custom event blocks */
.fc-event {
    border: none !important;
    background: transparent !important;
    box-shadow: none !important;
    margin: 1px 2px !important;
}

.fc-custom-event {
    display: flex;
    align-items: flex-start;
    gap: 0.4rem;
    padding: 0.35rem 0.5rem;
    border-radius: var(--radius-md);
    background: var(--ev-bg, #f4f3ff);
    border-left: 3px solid var(--ev-color, #7f56d9);
    height: 100%;
    overflow: hidden;
    box-shadow: var(--shadow-xs);
}

.ev-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--ev-color, #7f56d9);
    margin-top: 0.35rem;
    flex-shrink: 0;
    display: none;
}

.ev-body { min-width: 0; flex: 1; }

.ev-title {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-primary);
    line-height: 1.3;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.ev-time {
    font-size: 0.6875rem;
    color: var(--text-secondary);
    margin-top: 1px;
}

.fc-daygrid-event .fc-custom-event {
    padding: 0.2rem 0.4rem;
}

.fc-daygrid-event .ev-time { display: none; }

.fc .fc-scrollgrid {
    border: none !important;
}

.fc .fc-scrollgrid-section > * {
    border-color: var(--border) !important;
}

/* ─── Impersonation & announcements ─── */
.impersonation-bar {
    background: #ff9800;
    color: #1a1a2e;
    padding: 0.5rem 1rem;
    text-align: center;
    font-size: 0.875rem;
}

.announcement-banner {
    background: #7f56d9;
    color: #fff;
    padding: 0.6rem 1rem;
    text-align: center;
    font-size: 0.875rem;
    position: relative;
}

.announcement-banner.important { background: #ff9800; color: #1a1a2e; }

.announcement-banner .ann-dismiss {
    position: absolute;
    right: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    background: transparent;
    border: none;
    color: inherit;
    font-size: 1.25rem;
    cursor: pointer;
}

/* ─── Auth pages ─── */
.auth-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 1rem;
    background: var(--bg-page);
}

.auth-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-md);
    padding: 2rem;
    width: 100%;
    max-width: 420px;
}

.auth-card h1 { margin: 0 0 0.25rem; font-size: 1.5rem; font-weight: 600; }
.auth-subtitle { color: var(--text-secondary); margin: 0 0 1.5rem; }
.auth-form label { display: block; margin-bottom: 0.35rem; font-size: 0.875rem; font-weight: 500; }
.auth-form input {
    width: 100%;
    padding: 0.65rem 0.75rem;
    margin-bottom: 1rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--bg-page);
    color: var(--text-primary);
    font-size: 0.9375rem;
    font-family: inherit;
}
.auth-links { text-align: center; margin-top: 1.25rem; font-size: 0.875rem; }
.auth-links a { color: #7f56d9; text-decoration: none; }
.auth-links a:hover { text-decoration: underline; }

.alert {
    padding: 0.75rem 1rem;
    border-radius: var(--radius-md);
    margin-bottom: 1rem;
    font-size: 0.875rem;
}

.alert-error { background: #fef3f2; color: #b42318; border: 1px solid #fecdca; }
.alert-success { background: #ecfdf3; color: #027a48; border: 1px solid #abefc6; }

/* ─── Buttons ─── */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.55rem 1rem;
    border: none;
    border-radius: var(--radius-md);
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    transition: background 0.15s;
    font-family: inherit;
}

.btn-primary { background: var(--accent); color: #fff; }
[data-theme="dark"] .btn-primary { background: #f5f5f6; color: #101828; }
.btn-primary:hover { background: var(--accent-hover); }
.btn-secondary { background: var(--bg-card); color: var(--text-primary); border: 1px solid var(--border); }
.btn-secondary:hover { background: var(--bg-muted); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: var(--danger-hover); }
.btn-block { width: 100%; }

/* ─── Modal ─── */
.modal {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.modal.hidden { display: none; }

.modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(16, 24, 40, 0.5);
    backdrop-filter: blur(4px);
}

.modal-content {
    position: relative;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    padding: 1.5rem;
    width: 100%;
    max-width: 520px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-md);
}

.modal-content h2 { margin: 0 0 1rem; font-size: 1.125rem; font-weight: 600; }
.modal-content label { display: block; margin-bottom: 0.35rem; font-size: 0.875rem; font-weight: 500; }

.modal-content input[type="text"],
.modal-content input[type="datetime-local"],
.modal-content input[type="date"],
.modal-content textarea,
.modal-content select {
    width: 100%;
    padding: 0.55rem 0.65rem;
    margin-bottom: 0.85rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--bg-page);
    color: var(--text-primary);
    font-size: 0.9375rem;
    font-family: inherit;
}

.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 0.75rem; }
.form-group { min-width: 0; }

.reminder-fieldset {
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 0.75rem 1rem;
    margin-bottom: 1rem;
}

.reminder-fieldset legend { padding: 0 0.35rem; font-size: 0.875rem; font-weight: 500; }

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.35rem;
    font-weight: normal;
    cursor: pointer;
    font-size: 0.875rem;
}

.modal-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.modal-actions-right { display: flex; gap: 0.5rem; margin-left: auto; }

.hidden { display: none !important; }

/* Sidebar backdrop (mobile) */
.sidebar-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(16, 24, 40, 0.45);
    z-index: 250;
    opacity: 0;
    transition: opacity 0.25s ease;
}

.sidebar-backdrop.visible {
    display: block;
    opacity: 1;
}

body.sidebar-open { overflow: hidden; }

/* Calendar scroll wrapper (tablet week view) */
.calendar-scroll-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

/* Mobile FAB */
.fab-add-event {
    display: none;
    position: fixed;
    right: 1rem;
    bottom: calc(1rem + env(safe-area-inset-bottom, 0px));
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--accent);
    color: #fff;
    border: none;
    box-shadow: 0 4px 14px rgba(16, 24, 40, 0.25);
    cursor: pointer;
    z-index: 150;
    align-items: center;
    justify-content: center;
    transition: transform 0.15s;
}

[data-theme="dark"] .fab-add-event {
    background: #f5f5f6;
    color: #101828;
}

.fab-add-event:active { transform: scale(0.95); }
.fab-add-event svg { width: 24px; height: 24px; }

/* ─── User Settings page ─── */
.settings-layout {
    display: grid;
    grid-template-columns: 200px 1fr;
    gap: 1.5rem;
    align-items: start;
}

.settings-nav {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    position: sticky;
    top: 4.5rem;
}

.settings-nav a {
    padding: 0.55rem 0.875rem;
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.875rem;
    font-weight: 500;
    transition: background 0.15s, color 0.15s;
    border: none;
    border-left: none;
}

.settings-nav a:hover {
    background: var(--bg-muted);
    color: var(--text-primary);
    border: none;
    border-left: none;
}

.settings-nav a.active {
    background: var(--bg-muted);
    color: var(--text-primary);
    font-weight: 600;
    border: none;
    border-left: none;
}

.settings-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    padding: 1.5rem;
    box-shadow: var(--shadow-xs);
    max-width: 560px;
}

.settings-card h2 {
    margin: 0 0 0.35rem;
    font-size: 1.125rem;
    font-weight: 600;
}

.settings-desc {
    color: var(--text-secondary);
    font-size: 0.875rem;
    margin: 0 0 1.25rem;
}

.settings-form label {
    display: block;
    margin: 0.85rem 0 0.35rem;
    font-size: 0.875rem;
    font-weight: 500;
}

.settings-form label:first-of-type { margin-top: 0; }

.settings-form input[type="text"],
.settings-form input[type="email"],
.settings-form input[type="password"],
.settings-form select {
    width: 100%;
    padding: 0.55rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--bg-page);
    color: var(--text-primary);
    font-size: 0.9375rem;
    font-family: inherit;
}

.settings-form input:focus,
.settings-form select:focus {
    outline: none;
    border-color: var(--border-strong);
    box-shadow: var(--shadow-xs);
}

.settings-form .btn { margin-top: 1.25rem; }

.btn-icon {
    width: 16px;
    height: 16px;
    margin-right: 0.35rem;
    vertical-align: -2px;
}

.label-hint {
    font-weight: 400;
    color: var(--text-tertiary);
    font-size: 0.8125rem;
}

.settings-checkboxes {
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 0.75rem 1rem;
    margin-top: 1rem;
}

.settings-checkboxes legend {
    font-size: 0.875rem;
    font-weight: 500;
    padding: 0 0.25rem;
}

.account-info {
    display: grid;
    grid-template-columns: 140px 1fr;
    gap: 0.75rem 1rem;
    margin: 0;
}

.account-info dt {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-secondary);
}

.account-info dd {
    margin: 0;
    font-size: 0.875rem;
}

.account-info.export-info {
    margin-bottom: 1.5rem;
}

.text-success { color: #027a48; }
.text-muted { color: var(--text-secondary); }

.badge {
    display: inline-block;
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
}

.badge-admin { background: #101828; color: #fff; }
.badge-user { background: #ecfdf3; color: #027a48; }
.badge-viewer { background: #fff7ed; color: #c4320a; }

.toast {
    padding: 0.75rem 1rem;
    border-radius: var(--radius-md);
    margin-bottom: 1rem;
    font-size: 0.875rem;
    transition: opacity 0.3s;
}

.toast-success { background: #ecfdf3; color: #027a48; border: 1px solid #abefc6; }
.toast-error { background: #fef3f2; color: #b42318; border: 1px solid #fecdca; }

.hint {
    font-size: 0.8125rem;
    color: var(--text-secondary);
    margin: 0.5rem 0 0;
}

@media (max-width: 768px) {
    .settings-layout {
        grid-template-columns: 1fr;
    }
    .settings-nav {
        flex-direction: row;
        overflow-x: auto;
        position: static;
        -webkit-overflow-scrolling: touch;
    }
    .settings-nav a {
        flex-shrink: 0;
        white-space: nowrap;
    }
    .settings-card {
        max-width: none;
    }
    .account-info {
        grid-template-columns: 1fr;
        gap: 0.25rem;
    }
    .account-info dt { margin-top: 0.5rem; }
}

/* ─── To-Do List & Notes ─── */
.content-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    padding: 1.25rem;
    box-shadow: var(--shadow-xs);
}

.todo-add-form {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.todo-add-form input[type="text"] {
    flex: 1;
    min-width: 180px;
    padding: 0.55rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--bg-page);
    color: var(--text-primary);
    font-size: 0.9375rem;
    font-family: inherit;
}

.todo-add-form input[type="date"] {
    padding: 0.5rem 0.65rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--bg-page);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 0.875rem;
}

.todo-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.todo-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--border);
}

.todo-item:last-child { border-bottom: none; }

.todo-check {
    width: 22px;
    height: 22px;
    flex-shrink: 0;
    border: 2px solid var(--border-strong);
    border-radius: 50%;
    background: var(--bg-page);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    transition: background 0.15s, border-color 0.15s;
}

.todo-check svg {
    width: 14px;
    height: 14px;
    color: #fff;
}

.todo-item.is-done .todo-check {
    background: var(--accent);
    border-color: var(--accent);
}

.todo-body {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}

.todo-title {
    font-size: 0.9375rem;
    color: var(--text-primary);
}

.todo-item.is-done .todo-title {
    text-decoration: line-through;
    color: var(--text-secondary);
}

.todo-due {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.todo-due.is-overdue {
    color: #b42318;
    font-weight: 500;
}

.todo-delete {
    flex-shrink: 0;
    width: 32px;
    height: 32px;
    border: none;
    background: transparent;
    border-radius: var(--radius-md);
    color: var(--text-tertiary);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.15s, background 0.15s, color 0.15s;
}

.todo-item:hover .todo-delete,
.todo-delete:focus {
    opacity: 1;
}

.todo-delete:hover {
    background: #fef3f2;
    color: #b42318;
}

.todo-delete svg { width: 16px; height: 16px; }

.empty-state {
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.875rem;
    padding: 2rem 1rem;
    margin: 0;
}

.notes-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 1rem;
}

.note-card {
    text-align: left;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1rem;
    background: var(--note-color, #fef9c3);
    cursor: pointer;
    transition: transform 0.15s, box-shadow 0.15s;
    min-height: 140px;
    display: flex;
    flex-direction: column;
    position: relative;
}

.note-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-sm);
}

.note-pin-badge {
    position: absolute;
    top: 0.65rem;
    right: 0.65rem;
    font-size: 0.625rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: var(--text-secondary);
}

.note-card-title {
    margin: 0 0 0.5rem;
    font-size: 0.9375rem;
    font-weight: 600;
    color: var(--text-primary);
    padding-right: 3rem;
}

.note-card-preview {
    margin: 0;
    flex: 1;
    font-size: 0.8125rem;
    color: var(--text-secondary);
    line-height: 1.45;
}

.note-card-meta {
    margin-top: 0.75rem;
    font-size: 0.6875rem;
    color: var(--text-tertiary);
}

.note-modal-content {
    max-width: 560px;
}

.note-title-input {
    width: 100%;
    border: none;
    background: transparent;
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
    font-family: inherit;
    margin-bottom: 0.75rem;
    padding: 0;
}

.note-title-input:focus { outline: none; }

.note-content-input {
    width: 100%;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 0.75rem;
    font-size: 0.9375rem;
    font-family: inherit;
    color: var(--text-primary);
    background: var(--bg-page);
    resize: vertical;
    min-height: 180px;
}

.note-editor-footer {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    margin-top: 1rem;
}

.note-colors {
    display: flex;
    gap: 0.35rem;
}

.note-color-swatch {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    border: 2px solid transparent;
    cursor: pointer;
    padding: 0;
}

.note-color-swatch.active {
    border-color: var(--text-primary);
    box-shadow: 0 0 0 2px var(--bg-card);
}

.note-editor-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

@media (max-width: 768px) {
    .todo-add-form {
        flex-direction: column;
    }
    .todo-add-form .btn { width: 100%; }
    .todo-delete { opacity: 1; }
    .note-editor-footer {
        flex-direction: column;
        align-items: stretch;
    }
    .note-editor-actions {
        flex-direction: column;
    }
    .note-editor-actions .btn { width: 100%; }
}

/* ─── Responsive ─── */
@media (max-width: 1024px) {
    .topbar-search { width: 220px; }
    .search-kbd { display: none; }
}

@media (max-width: 900px) {
    .app-main { margin-left: 0; }

    .app-sidebar {
        transform: translateX(-100%);
        box-shadow: none;
    }

    .app-sidebar.open {
        transform: translateX(0);
        box-shadow: var(--shadow-md);
    }

    .sidebar-toggle { display: flex; }

    .breadcrumbs { display: none; }

    .topbar-search {
        flex: 1;
        width: auto;
        min-width: 0;
    }

    /* Week view needs min width on tablet — horizontal scroll */
    body.is-tablet .calendar-scroll-wrap .fc {
        min-width: 720px;
    }
}

@media (max-width: 768px) {
    .page-content {
        padding: 0.75rem;
        padding-bottom: calc(0.75rem + env(safe-area-inset-bottom, 0px));
    }

    .page-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.75rem;
        margin-bottom: 0.875rem;
    }

    .page-title {
        font-size: 1.25rem;
    }

    .filter-pills {
        width: 100%;
        overflow-x: auto;
        flex-wrap: nowrap;
        -webkit-overflow-scrolling: touch;
        scroll-snap-type: x proximity;
        padding-bottom: 2px;
        mask-image: linear-gradient(to right, #000 90%, transparent);
    }

    .filter-pills .pill {
        flex-shrink: 0;
        scroll-snap-align: start;
    }

    .calendar-card {
        border-radius: var(--radius-lg);
    }

    .calendar-toolbar {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 0.5rem;
        padding: 0.75rem;
    }

    .toolbar-left {
        grid-column: 1 / -1;
    }

    .date-range-box {
        width: 100%;
        text-align: center;
        font-size: 0.8125rem;
    }

    .toolbar-center {
        justify-content: center;
        grid-column: 1 / 2;
    }

    .toolbar-right {
        justify-content: flex-end;
        grid-column: 2 / 3;
        flex-wrap: wrap;
        gap: 0.35rem;
    }

    .view-select {
        max-width: 110px;
        font-size: 0.8125rem;
        padding-right: 1.75rem;
    }

    .btn-add-event {
        display: none;
    }

    .fab-add-event {
        display: inline-flex;
    }

    .app-topbar {
        padding: 0.65rem 0.75rem;
        gap: 0.5rem;
    }

    .topbar-search input {
        font-size: 16px; /* prevent iOS zoom on focus */
    }

    #calendar {
        padding: 0;
    }

    .calendar-scroll-wrap {
        overflow-x: visible;
    }

    .calendar-scroll-wrap .fc {
        min-width: 0;
    }

    /* Compact column headers */
    .day-header-weekday {
        font-size: 0.6875rem;
    }

    .day-header-num {
        width: 28px;
        height: 28px;
        font-size: 0.8125rem;
    }

    .fc .fc-col-header-cell {
        padding: 0.5rem 0;
    }

    .fc .fc-timegrid-slot {
        height: 2.5rem;
    }

    .fc .fc-timegrid-slot-label {
        font-size: 0.6875rem;
    }

    .ev-title {
        font-size: 0.6875rem;
    }

    .ev-time {
        font-size: 0.625rem;
    }

    /* Modal as bottom sheet */
    .modal {
        align-items: flex-end;
        padding: 0;
    }

    .modal-content {
        border-radius: var(--radius-xl) var(--radius-xl) 0 0;
        max-height: 92vh;
        max-width: none;
        padding: 1.25rem;
        padding-bottom: calc(1.25rem + env(safe-area-inset-bottom, 0px));
    }

    .modal-actions {
        flex-direction: column-reverse;
        align-items: stretch;
    }

    .modal-actions-right {
        flex-direction: column;
        margin-left: 0;
        width: 100%;
    }

    .modal-actions .btn,
    .modal-actions-right .btn {
        width: 100%;
    }

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

    .impersonation-bar {
        font-size: 0.8125rem;
        padding: 0.4rem 0.5rem;
    }
}

@media (max-width: 480px) {
    .logo-text {
        font-size: 0.9rem;
    }

    .profile-email {
        display: none;
    }

    .toolbar-center .text-btn {
        padding: 0.4rem 0.5rem;
        font-size: 0.8125rem;
    }

    .icon-btn {
        width: 32px;
        height: 32px;
    }

    .filter-pills .pill {
        font-size: 0.75rem;
        padding: 0.35rem 0.65rem;
    }
}
