/* The White Orchid — Mobile-First Styles */

:root {
    --color-primary: #6B4C8A;
    --color-primary-light: #8B6AAF;
    --color-primary-dark: #4A3360;
    --color-accent: #D4A843;
    --color-bg: #FAF8FC;
    --color-card: #FFFFFF;
    --color-text: #2D2D2D;
    --color-text-light: #6B6B6B;
    --color-success: #1E6B3D;
    --color-error: #C0392B;
    --color-border: #E8E0F0;
    --color-shadow: 0 2px 8px rgba(107, 76, 138, 0.1);
    --color-danger: #C0392B;
    --color-warning: #f59e0b;
    --color-warning-bg: #fff8e1;
    --font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, sans-serif;
    --color-title-color: var(--color-primary);
    --color-title-font: inherit;

    /* Font size tokens — 5 categories, desktop defaults */
    --font-size-heading: 1.25rem;
    --font-size-subheading: 0.75rem;
    --font-size-body: 0.88rem;
    --font-size-label: 0.82rem;
    --font-size-small: 0.72rem;
}

/* Font size tokens — mobile defaults */
@media (max-width: 767px) {
    :root {
        --font-size-heading: 1.1rem;
        --font-size-subheading: 0.7rem;
        --font-size-body: 0.85rem;
        --font-size-label: 0.78rem;
        --font-size-small: 0.68rem;
    }
}

/* Typography utility classes */
.text-heading    { font-size: var(--font-size-heading) !important; }
.text-subheading { font-size: var(--font-size-subheading) !important; }
.text-body       { font-size: var(--font-size-body) !important; }
.text-label      { font-size: var(--font-size-label) !important; }
.text-small      { font-size: var(--font-size-small) !important; }

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: var(--font-family);
    background-color: var(--color-bg);
    color: var(--color-text);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* App Shell */
.app-container {
    margin: 0 auto;
    padding: 16px;
    width: 100%;
    min-width: 0; /* flex item: prevent expanding past viewport width */
    flex: 1;
    display: flex;
    flex-direction: column;
    position: relative;
}

/* Header */
.app-header {
    text-align: left;
    padding: 24px 0 16px;
    border: none;
}

.app-header .logo {
    font-size: var(--font-size-heading);
    font-weight: 700;
    color: var(--color-primary);
    letter-spacing: -0.5px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.org-logo-img {
    height: 36px;
    width: auto;
    max-width: 140px;
    object-fit: contain;
    flex-shrink: 0;
}

#orgLogoName {
    color: var(--color-title-color);
    font-family: var(--color-title-font);
}

.app-header .logo small {
    display: block;
    font-size: var(--font-size-subheading);
    font-weight: 400;
    color: var(--color-text-light);
    letter-spacing: 1px;
    text-transform: uppercase;
    margin-top: 4px;
}

/* Navigation bar */
.nav-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    margin-bottom: 16px;
    border: none;
}

.nav-bar .user-info {
    font-size: var(--font-size-body);
    color: var(--color-text-light);
}

.nav-bar .nav-links {
    display: flex;
    align-items: center;
    gap: 12px;
}

.nav-bar .nav-links a {
    font-size: var(--font-size-body);
    color: var(--color-primary);
    text-decoration: none;
}



.nav-bar .nav-links a:hover {
    text-decoration: underline;
}

/* Hide desktop inline links — hamburger menu used at all sizes */
.nav-bar .nav-links > a {
    display: none;
}

.nav-bar .nav-links > .view-toggle {
    display: none;
}

/* View Toggle */
.view-toggle {
    display: flex;
    background: rgba(107, 76, 138, 0.1);
    border-radius: 20px;
    padding: 3px;
    gap: 2px;
    font-size: var(--font-size-label);
}

.view-toggle a,
.view-toggle span {
    font-size: inherit;
}

.view-toggle-btn {
    padding: 5px 12px;
    border: none;
    border-radius: 18px;
    background: transparent;
    color: var(--color-text-light);
    font-size: inherit;
    font-weight: 500;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 1.4;
    text-align: center;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.view-toggle-btn:hover {
    background: rgba(107, 76, 138, 0.12);
    color: var(--color-primary);
    text-decoration: none;
}

.view-toggle-btn.active {
    background: var(--color-primary);
    color: white;
    cursor: default;
}

.view-toggle-btn.active:hover {
    background: var(--color-primary);
    color: white;
}

/* Cards */
.card {
    background: var(--color-card);
    border-radius: 12px;
    padding: 24px;
    margin-bottom: 16px;
    box-shadow: var(--color-shadow);
    border: 1px solid var(--color-border);
}

.card h2 {
    font-size: var(--font-size-heading);
    margin-bottom: 16px;
    color: var(--color-primary-dark);
}

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

.form-group label {
    display: block;
    font-size: var(--font-size-label);
    font-weight: 600;
    color: var(--color-text);
    margin-bottom: 6px;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 12px 14px;
    border: 1px solid var(--color-border);
    border-radius: 8px;
    font-size: var(--font-size-body);
    background: var(--color-card);
    color: var(--color-text);
    transition: border-color 0.2s;
}

.form-group textarea {
    resize: none;
    overflow-y: auto;
}

/* Date/time inputs: force them to respect width:100% on iOS.
   WebKit's native date/time picker chrome sets an intrinsic min-width
   that overrides width:100%, causing overflow on narrow screens. */
input[type="date"],
input[type="time"] {
    min-width: 0;
    max-width: 100%;
}

/* Hide native number input spinners */
input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
}
input[type="number"] {
    -moz-appearance: textfield;
}

.form-group select {
    padding-right: 36px;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%236B6B6B' d='M2 4l4 4 4-4'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    cursor: pointer;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(107, 76, 138, 0.15);
}

.form-group input:disabled,
.form-group select:disabled,
.form-group textarea:disabled {
    opacity: 0.45;
    cursor: not-allowed;
    pointer-events: none;
}

.radio-group {
    display: flex;
    gap: 16px;
    padding: 8px 0;
}

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

/* Global: constrain all checkboxes/radios — Safari iOS ignores flex sizing without this */
input[type="checkbox"],
input[type="radio"] {
    width: 16px;
    height: 16px;
    min-width: 16px;
    min-height: 16px;
    flex-shrink: 0;
    accent-color: var(--color-primary);
    margin: 0;
    vertical-align: middle;
    cursor: pointer;
}

.radio-label input[type="radio"] {
    accent-color: var(--color-primary);
    width: 16px;
    height: 16px;
    margin: 0;
    vertical-align: middle;
    cursor: pointer;
}

.checkbox-group {
    display: flex;
    gap: 16px;
    padding: 8px 0;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: var(--font-size-body);
    cursor: pointer;
    color: var(--color-text);
}

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

.form-group input::placeholder {
    color: #B0A0C0;
}

.form-group .hint {
    font-size: var(--font-size-small);
    color: var(--color-text-light);
    margin-top: 4px;
}

/* Password field with show/hide toggle */
.password-field-wrap {
    position: relative;
    display: flex;
    align-items: stretch;
}

.password-field-wrap input {
    flex: 1;
    padding-right: 44px !important;
}

.pw-toggle {
    position: absolute;
    right: 0;
    top: 0;
    bottom: 0;
    width: 42px;
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
    color: var(--color-text-light);
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 0 8px 8px 0;
    transition: color 0.15s;
}

.pw-toggle:hover {
    color: var(--color-text);
}

.pw-toggle svg {
    width: 18px;
    height: 18px;
    pointer-events: none;
}

/* Info Icon — small filled circle with italic i, click to open info modal */
.info-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 15px;
    height: 15px;
    border-radius: 50%;
    background: #9baabf;
    color: #fff;
    font-size: 9px; /* fixed — pixel-precise 15px circle, must not scale with font preset */
    font-weight: 800;
    font-style: italic;
    font-family: Georgia, 'Times New Roman', serif;
    cursor: pointer;
    margin-left: 4px;
    flex-shrink: 0;
    user-select: none;
    vertical-align: middle;
    position: relative;
    top: -1px;
    transition: background 0.15s;
    line-height: 1;
}
.info-icon:hover {
    background: var(--color-primary);
}

/* Student Profile Photos */
.student-photo-thumb {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    object-fit: cover;
    display: block;
}

.student-photo-placeholder {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--color-border);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--color-primary);
}

.student-photo-section {
    text-align: center;
    margin-bottom: 16px;
}

img.student-photo-large,
.student-photo-large img {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    object-fit: cover;
    display: block;
    margin: 0 auto 8px;
}

.student-photo-placeholder-lg {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: var(--color-border);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--color-primary);
    margin: 0 auto;
}

/* Profile photo in detail/edit modals — 128px, no border */
.modal-profile-photo img {
    width: 128px;
    height: 128px;
    border-radius: 50%;
    object-fit: cover;
    display: block;
    margin: 0 auto 8px;
}

.modal-profile-photo .student-photo-placeholder-lg {
    width: 128px;
    height: 128px;
    font-size: 2.4rem;
    margin-bottom: 8px;
}

.student-photo-upload-btn {
    cursor: pointer;
    font-size: 0.8rem !important;
}

/* Settings School List */
.settings-school-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px solid var(--color-border);
}

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

.school-item-actions {
    display: flex;
    gap: 6px;
    align-items: center;
    flex-shrink: 0;
}

.school-item .school-name {
    font-size: var(--font-size-body);
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
}

.school-item .btn {
    font-size: var(--font-size-label);
    padding: 5px 12px;
}

/* Settings tab — compact sizing */
#tab-settings .card h2 {
    font-size: var(--font-size-body);
    margin-bottom: 10px;
}

#tab-settings .card > p.text-muted {
    font-size: var(--font-size-label);
}

#tab-settings .form-group label {
    font-size: var(--font-size-label);
}

#tab-settings .form-group select,
#tab-settings .form-group input {
    font-size: var(--font-size-body);
    padding: 9px 12px;
}

#tab-settings .btn {
    font-size: var(--font-size-label);
    padding: 9px 18px;
}

#tab-settings .btn.btn-small {
    font-size: var(--font-size-label);
    padding: 5px 12px;
}

/* History tab — compact Load More */
#tab-history .btn {
    font-size: var(--font-size-label);
    padding: 9px 18px;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: var(--font-size-body);
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.2s cubic-bezier(0.22, 1, 0.36, 1), transform 0.15s cubic-bezier(0.22, 1, 0.36, 1);
    text-decoration: none;
    width: 100%;
}

.btn:active {
    transform: scale(0.98);
}

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

.btn-primary:hover {
    background-color: var(--color-primary-dark);
    transform: translateY(-1px);
}

.btn-primary:disabled {
    background-color: var(--color-primary-light);
    opacity: 0.6;
    cursor: not-allowed;
}

.btn-secondary {
    background-color: transparent;
    color: var(--color-primary);
    border: 1px solid var(--color-primary);
}

.btn-secondary:hover {
    background-color: rgba(107, 76, 138, 0.05);
}

.btn-secondary:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

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

.btn-danger:hover {
    background-color: #A93226;
}

.btn-success {
    background-color: #27AE60;
    color: white;
}

.btn-success:hover {
    background-color: #1E8449;
}

.btn-small {
    padding: 8px 16px;
    font-size: var(--font-size-body);
    width: auto;
}

.btn-group {
    display: flex;
    gap: 8px;
    margin-top: 16px;
}

.btn-group .btn {
    flex: 1;
}

/* Links */
.text-link {
    color: var(--color-primary);
    text-decoration: none;
    font-size: var(--font-size-body);
    text-align: center;
    display: block;
    margin-top: 12px;
}

.text-link:hover {
    text-decoration: underline;
}

/* Alerts */
.alert {
    padding: 12px 16px;
    border-radius: 8px;
    margin-bottom: 16px;
    font-size: var(--font-size-body);
    display: none;
}

.alert.show {
    display: block;
}

.alert-error {
    background-color: #FDEDEC;
    color: var(--color-error);
    border: 1px solid #F5C6CB;
}

.alert-success {
    background-color: #E8F5E9;
    color: var(--color-success);
    border: 1px solid #C3E6CB;
}

.alert-info {
    background-color: #F0E8F7;
    color: var(--color-primary-dark);
    border: 1px solid var(--color-border);
}

/* QR Code Display */
.qr-container {
    text-align: center;
    padding: 24px;
}

.qr-container canvas,
.qr-container img {
    max-width: 280px;
    width: 100%;
    height: auto;
    border-radius: 12px;
}

.qr-timer {
    margin-top: 12px;
    font-size: var(--font-size-body);
    color: var(--color-text-light);
}

.qr-timer .countdown {
    font-weight: 700;
    color: var(--color-primary);
    font-size: var(--font-size-heading);
}

/* Scanner result */
.scan-result {
    text-align: center;
    padding: 24px;
    border-radius: 12px;
    margin-top: 16px;
    display: none;
}

.scan-result.show {
    display: block;
}

.scan-result.valid {
    background-color: #E8F5E9;
    border: 2px solid var(--color-success);
}

.scan-result.invalid {
    background-color: #FDEDEC;
    border: 2px solid var(--color-error);
}

.scan-result .result-icon {
    font-size: 3rem;
    margin-bottom: 12px;
}

.scan-result .parent-name {
    font-size: var(--font-size-heading);
    font-weight: 700;
    margin-bottom: 8px;
}

.scan-result .student-list {
    font-size: var(--font-size-body);
    color: var(--color-text-light);
}

/* Student cards */
.student-card {
    display: flex;
    align-items: center;
    padding: 12px;
    background: var(--color-bg);
    border-radius: 8px;
    margin-bottom: 8px;
}

.student-card .student-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--color-primary-light);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: var(--font-size-body);
    margin-right: 12px;
    flex-shrink: 0;
}

.student-card .student-info h3 {
    font-size: var(--font-size-body);
    margin-bottom: 2px;
}

.student-card .student-info p {
    font-size: var(--font-size-label);
    color: var(--color-text-light);
}

/* Admin tables */
.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: var(--font-size-body);
}

.data-table-fixed {
    table-layout: fixed;
}

.data-table th,
.data-table td {
    padding: 10px 8px;
    text-align: left;
    border-bottom: 1px solid var(--color-border);
}
.data-table th:last-child,
.data-table td:last-child {
    padding-right: 16px;
}

.data-table .btn.btn-small {
    padding: 3px 10px;
    font-size: var(--font-size-label);
}

.data-table th {
    font-weight: 600;
    color: var(--color-primary-dark);
    background: var(--color-bg);
    position: sticky;
    top: 0;
}

.data-table tr:hover td {
    background-color: rgba(107, 76, 138, 0.03);
}

/* Telegram Log — two-row entries (meta + message) */
.data-table tr.tg-log-meta td {
    border-bottom: none;
    padding-bottom: 2px;
}
.data-table tr.tg-log-msg td {
    padding-top: 4px;
    padding-bottom: 4px;
    font-size: var(--font-size-label);
    background: var(--color-bg);
    border-bottom: 2px solid var(--color-border);
}

/* Telegram Log — broadcast group rows */
.data-table tr.tg-log-broadcast-meta td:nth-child(3) {
    font-weight: 600;
    color: var(--color-primary);
}
.data-table tr.tg-log-broadcast-msg td {
    border-bottom: 2px solid var(--color-border);
}
.data-table tr.tg-log-broadcast-msg.tg-broadcast-expanded td {
    border-bottom: none;
}
.data-table tr.tg-log-broadcast-recipients td {
    padding: 8px 8px 12px;
    background: var(--color-bg);
    border-bottom: 2px solid var(--color-border);
}
.tg-broadcast-toggle {
    float: right;
    cursor: pointer;
    color: var(--color-primary);
    font-size: var(--font-size-small);
    user-select: none;
}
.tg-broadcast-toggle:hover {
    text-decoration: underline;
}
.tg-broadcast-chip {
    display: inline-flex;
    align-items: center;
    padding: 3px 10px;
    border-radius: 999px;
    border: 1px solid var(--color-border);
    background: white;
    font-size: var(--font-size-small);
    color: var(--color-text);
    margin: 2px 4px 2px 0;
}

/* Sortable / filterable table headers */
.th-sortable {
    cursor: pointer;
    user-select: none;
    white-space: nowrap;
}
.th-sortable:hover { color: var(--color-primary); }

.th-sort-arrow {
    font-size: var(--font-size-label);
    margin-left: 3px;
    color: var(--color-text-light);
    vertical-align: middle;
}
.th-sort-arrow.active { color: var(--color-primary); }

.th-filterable {
    cursor: pointer;
    user-select: none;
    font-size: var(--font-size-body);
    margin-left: 4px;
    color: var(--color-text-light);
    padding: 1px 3px;
    border-radius: 3px;
    vertical-align: middle;
}
.th-filterable:hover { color: var(--color-primary); }
.th-filterable.active {
    color: var(--color-primary);
    font-weight: 700;
    background: rgba(107, 76, 138, 0.1);
}

/* Filter dropdown */
.table-filter-dropdown {
    position: fixed;
    background: var(--color-card, #fff);
    border: 1px solid var(--color-border);
    border-radius: 8px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.12);
    z-index: 2000;
    min-width: 130px;
    padding: 4px 0;
}
.table-filter-option {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    cursor: pointer;
    font-size: var(--font-size-body);
    color: var(--color-text);
}
.table-filter-option:hover { background: var(--color-bg); }
.table-filter-option.selected { color: var(--color-primary); font-weight: 600; }
.filter-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    border: 2px solid var(--color-text-light);
    flex-shrink: 0;
}
.table-filter-option.selected .filter-dot {
    border-color: var(--color-primary);
    background: var(--color-primary);
}

.table-container {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}
@media (min-width: 769px) {
    .table-container {
        overflow-x: hidden;
    }
}

/* Search bar */
.search-bar {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
}

.search-bar input {
    flex: 1;
    padding: 10px 14px;
    border: 1px solid var(--color-border);
    border-radius: 8px;
    font-size: var(--font-size-body);
}

/* Tabs */
.tabs {
    display: none;
    flex-wrap: wrap;
    border-bottom: 2px solid var(--color-border);
    margin-bottom: 16px;
    gap: 0;
}

.tabs .tab {
    padding: 8px 14px;
    font-size: var(--font-size-body);
    font-weight: 600;
    color: var(--color-text-light);
    cursor: pointer;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    white-space: nowrap;
    background: none;
    border-top: none;
    border-left: none;
    border-right: none;
}

.tabs .tab.active {
    color: var(--color-primary);
    border-bottom-color: var(--color-primary);
}

.tab-content {
    display: none;
}

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

/* Badge */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 8px 2px; /* asymmetric: +1px top compensates for cap-height sitting high in em square */
    border-radius: 12px;
    font-size: var(--font-size-small);
    font-weight: 600;
    line-height: 1;
    text-transform: uppercase;
}

.badge-success {
    background: #E8F5E9;
    color: var(--color-success);
}

.badge-warning {
    background: #FFF3CD;
    color: #856404;
}

.badge-error {
    background: #FDEDEC;
    color: var(--color-error);
}

.badge-muted {
    background: #EBEBEB;
    color: #6B7280;
}

/* Modal */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 16px;
}

.modal-overlay.show {
    display: flex;
}

/* Feedback modals must float above all other modals */
#genericSuccessModal,
#customErrorModal,
#customConfirmModal {
    z-index: 1100;
}

.modal {
    background: var(--color-card);
    border-radius: 12px;
    padding: 24px;
    width: 100%;
    max-width: 700px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
}

.modal-wide {
    max-width: none;
    margin: 0 34px;
}

/* Hero-image modal — image bleeds edge-to-edge at top */
.modal-hero {
    padding: 0;
    position: relative;
}

.modal-hero .modal-close {
    position: absolute;
    top: 10px;
    right: 10px;
    background: rgba(255,255,255,0.88);
    border-radius: 50%;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 20;
    font-size: 18px; /* fixed — circle is fixed-size, must not scale with font preset */
    line-height: 1;
    float: none;
}

.modal-hero-content {
    padding: 20px 24px 24px;
}

/* Clip image at modal top corners; remove side rounding & bottom margin */
.modal-hero .enrich-carousel {
    border-radius: 12px 12px 0 0;
    margin-bottom: 0;
    overflow: hidden;
}

.modal-hero .enrich-carousel-single {
    border-radius: 12px 12px 0 0;
    margin-bottom: 0;
}

.modal h2 {
    margin-bottom: 16px;
    color: var(--color-primary-dark);
}

.modal-close {
    float: right;
    background: none;
    border: none;
    font-size: var(--font-size-heading);
    cursor: pointer;
    color: var(--color-text-light);
    line-height: 1;
}

/* Loading spinner */
.spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: white;
    animation: spin 0.8s ease-in-out infinite;
}

.spinner-dark {
    border-color: rgba(107, 76, 138, 0.2);
    border-top-color: var(--color-primary);
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* View As banner — sticky, in normal document flow, full page width.
   Sits above .app-container so it pushes the entire page down naturally.
   Sticks to top of viewport when scrolling so it always stays visible. */

/* Sticky thead inside a scrollable modal */
.sticky-thead th {
    position: sticky;
    top: 0;
    background: var(--color-card);
    z-index: 1;
}

.view-as-bar {
    position: sticky;
    top: 0;
    z-index: 975; /* above nav menu (950) but below modals (1000+) */
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 20px;
    background: #fff3cd;
    border-bottom: 2px solid #ffc107;
    gap: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.12);
}
.view-as-label {
    font-size: var(--font-size-body);
    color: #856404;
}
[data-theme="dark"] .view-as-bar {
    background: #3a2e00;
    border-bottom-color: #ffc107;
}
[data-theme="dark"] .view-as-label { color: #ffd966; }

/* Greeting emoji spin animation */
.greeting-emoji {
    display: inline-block;
    margin-left: 2px;
}

@keyframes greetingEmojiSpin {
    0%   { transform: rotate(0deg); }
    100% { transform: rotate(720deg); }
}

.greeting-emoji--spin {
    animation: greetingEmojiSpin 1.1s cubic-bezier(0.34, 1.3, 0.64, 1);
}

/* Event banner — Announcements tab */
.event-banner {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-radius: 8px;
    margin-bottom: 10px;
    background: var(--color-bg);
    border: 1px solid var(--color-border);
    border-left-width: 3px;
    cursor: pointer;
    transition: background 0.15s;
}
.event-banner:hover        { background: var(--color-border); }
.event-banner-live         { border-left-color: var(--color-error); }
.event-banner-upcoming     { border-left-color: var(--color-primary); }
.event-banner-badge {
    font-size: var(--font-size-small);
    font-weight: 700;
    letter-spacing: 0.07em;
    padding: 3px 9px;
    border-radius: 20px;
    flex-shrink: 0;
    white-space: nowrap;
}
.event-banner-live .event-banner-badge {
    background: #fdecea;
    color: var(--color-error);
}
.event-banner-upcoming .event-banner-badge {
    background: #ede6f5;
    color: var(--color-primary);
}
.event-banner-badge-live { animation: livePulse 1.5s ease-in-out infinite; }
.event-banner-name {
    font-weight: 600;
    font-size: var(--font-size-body);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: var(--color-text);
}
.event-banner-sub {
    font-size: var(--font-size-label);
    color: var(--color-text-light);
    margin-top: 2px;
}
@keyframes livePulse {
    0%, 100% { opacity: 1; }
    50%       { opacity: 0.45; }
}

.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(250, 248, 252, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
}

/* Announcements */
.announcement-card {
    padding: 16px;
    background: var(--color-bg);
    border-radius: 8px;
    margin-bottom: 12px;
    border-left: 3px solid var(--color-primary);
}

.announcement-card.unread {
    border-left-color: var(--color-accent);
    background: #FFFBF0;
}

.announcement-card .announcement-title {
    font-weight: 600;
    margin-bottom: 4px;
}

.announcement-card .announcement-date {
    font-size: var(--font-size-small);
    color: var(--color-text-light);
    margin-bottom: 8px;
}

.announcement-card .announcement-body {
    font-size: var(--font-size-body);
    line-height: 1.5;
}

.announcement-card .announcement-preview {
    font-size: var(--font-size-body);
    color: var(--color-text-light);
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    margin-top: 4px;
    line-height: 1.4;
}

.announcement-card .announcement-thumbs {
    display: flex;
    gap: 6px;
    margin-top: 8px;
    flex-wrap: wrap;
}

.announcement-card .announcement-thumbs img {
    width: 60px;
    height: 60px;
    object-fit: cover;
    border-radius: 6px;
}

.announcement-card.clickable {
    cursor: pointer;
    transition: background 0.15s;
}

.announcement-card.clickable:hover {
    background: rgba(107, 76, 138, 0.04);
}

/* Announcement detail modal */
.ann-detail-body {
    font-size: var(--font-size-body);
    line-height: 1.7;
    white-space: pre-wrap;
    margin: 16px 0;
}

.ann-detail-images {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: 12px;
}

.ann-detail-images img {
    width: 100px;
    height: 100px;
    object-fit: cover;
    border-radius: 8px;
    cursor: pointer;
    transition: opacity 0.15s;
}

.ann-detail-images img:hover {
    opacity: 0.8;
}

.ann-detail-image-wrap {
    position: relative;
    display: inline-block;
}

.ann-detail-image-wrap img {
    display: block;
}

.ann-detail-image-delete {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.6);
    color: #fff;
    border: none;
    font-size: 30px;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}

.ann-detail-title {
    font-size: var(--font-size-heading);
    font-weight: 700;
    margin-bottom: 4px;
}

.ann-detail-byline {
    font-size: var(--font-size-label);
    color: var(--color-text-light);
    margin-bottom: 16px;
}

.ann-detail-meta {
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid var(--color-border);
}

.ann-detail-meta-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
    padding: 6px 0;
    font-size: var(--font-size-body);
}

.ann-detail-meta-label {
    font-weight: 600;
    color: var(--color-text-light);
    flex-shrink: 0;
}

.ann-detail-delete {
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid var(--color-border);
    text-align: center;
}

.ann-reads-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    border-radius: 999px;
    border: 1px solid var(--color-border);
    background: var(--color-bg-subtle, #f5f5f5);
    font-size: var(--font-size-label);
    color: var(--color-text);
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
    user-select: none;
}
.ann-reads-chip:hover {
    background: rgba(107, 76, 138, 0.1);
    border-color: var(--color-primary);
    color: var(--color-primary);
}
[data-theme="dark"] .ann-reads-chip {
    background: #2a2a2a;
    border-color: var(--color-border);
    color: var(--color-text);
}

/* Announcement image upload previews */
.ann-image-preview {
    display: inline-block;
    position: relative;
    margin: 4px;
}

.ann-image-thumb {
    width: 60px;
    height: 60px;
    object-fit: cover;
    border-radius: 6px;
}

.ann-image-remove {
    position: absolute;
    top: -8px;
    right: -8px;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--color-error);
    color: #fff;
    border: none;
    font-size: 18px;
    line-height: 28px;
    text-align: center;
    cursor: pointer;
    padding: 0;
}

.enr-image-thumb {
    width: 80px;
    height: 80px;
    cursor: pointer;
}

/* Image lightbox */
.image-lightbox {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.9);
    z-index: 2000;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.image-lightbox.show {
    display: flex;
}

.image-lightbox img {
    max-width: 90vw;
    max-height: 90vh;
    object-fit: contain;
    border-radius: 8px;
}

.image-lightbox-close {
    position: absolute;
    top: 16px;
    right: 20px;
    color: white;
    font-size: 2rem;
    cursor: pointer;
    background: rgba(255,255,255,0.15);
    border: none;
    border-radius: 6px;
    padding: 4px 10px;
    line-height: 1;
    z-index: 2001;
}

/* Lightbox carousel — prev/next arrows */
.image-lightbox-prev,
.image-lightbox-next {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255,255,255,0.18);
    border: none;
    color: #fff;
    font-size: 2.8rem;
    padding: 6px 14px;
    cursor: pointer;
    border-radius: 6px;
    z-index: 2001;
    line-height: 1;
    transition: background 0.15s;
}
.image-lightbox-prev { left: 16px; }
.image-lightbox-next { right: 16px; }
.image-lightbox-prev:hover,
.image-lightbox-next:hover { background: rgba(255,255,255,0.32); }

/* Lightbox carousel — counter */
.image-lightbox-counter {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    color: rgba(255,255,255,0.85);
    font-size: var(--font-size-body);
    pointer-events: none;
}

/* Cropper modal z-index (above other modals) */
#imageCropperModal { z-index: 1050; }
@media (max-width: 480px) { #cropperContainer { height: 220px !important; } }

/* Scan history */
.scan-history-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
    border-bottom: 1px solid var(--color-border);
    font-size: var(--font-size-body);
}

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

/* Utilities */
.text-center { text-align: center; }
.text-muted { color: var(--color-text-light); }
.mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mb-8 { margin-bottom: 8px; }
.mb-16 { margin-bottom: 16px; }
.hidden { display: none !important; }

/* =====================================================
   Hamburger Menu (base styles — must be BEFORE media queries)
   ===================================================== */

.hamburger-btn {
    display: block;
    position: absolute;
    top: 38px;
    right: 16px;
    z-index: 100;
    background: none;
    border: none;
    cursor: pointer;
    padding: 6px;
    border-radius: 6px;
    transition: background 0.2s;
}

.hamburger-btn:hover {
    background: rgba(107, 76, 138, 0.08);
}

.hamburger-icon {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    width: 20px;
    height: 16px;
    line-height: 0;
    font-size: 0;
}

.hamburger-icon span {
    display: block;
    flex: 0 0 2px;
    width: 100%;
    height: 2px !important;
    min-height: 2px;
    max-height: 2px;
    background: var(--color-primary);
    transition: transform 0.3s, opacity 0.3s;
    transform: translateZ(0);
    will-change: transform;
}

.hamburger-btn.open .hamburger-icon {
    justify-content: center;
}

.hamburger-btn.open .hamburger-icon span:nth-child(1) {
    transform: rotate(45deg) translate(1px, 0);
}

.hamburger-btn.open .hamburger-icon span:nth-child(2) {
    opacity: 0;
}

.hamburger-btn.open .hamburger-icon span:nth-child(3) {
    transform: rotate(-45deg) translate(1px, 0);
}

/* Mobile menu backdrop */
.nav-menu-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.3);
    z-index: 900;
}

.nav-menu-overlay.open {
    display: block;
}

/* Mobile menu panel */
.nav-menu {
    display: block;
    background: var(--color-bg);
    border: none;
    border-radius: 8px;
    box-shadow: none;
    overflow: hidden;
    transform: scaleY(0);
    transform-origin: top center;
    visibility: hidden;
    transition: transform 0.25s cubic-bezier(0.22, 1, 0.36, 1), visibility 0s linear 0.25s;
    z-index: 950;
    position: absolute;
    right: 16px;
    margin-top: 16px;
    width: 60%;
    max-width: 280px;
}

.nav-menu-profile {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 20px 16px 12px;
    border-bottom: 1px solid var(--color-border);
}

.nav-menu-profile-img {
    width: 128px;
    height: 128px;
    border-radius: 50%;
    object-fit: cover;
}

.nav-menu-profile-placeholder {
    width: 128px;
    height: 128px;
    border-radius: 50%;
    background: var(--color-border);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--color-primary);
}

.nav-menu-profile-name {
    margin-top: 8px;
    font-size: var(--font-size-body);
    font-weight: 600;
    color: var(--color-text);
}

.nav-menu.open {
    transform: scaleY(1);
    visibility: visible;
    transition: transform 0.25s cubic-bezier(0.22, 1, 0.36, 1), visibility 0s;
    max-height: 85vh;
    overflow-y: auto;
    border: 1px solid var(--color-border);
    box-shadow: 0 4px 16px rgba(107, 76, 138, 0.15);
}

.nav-menu-section {
    padding: 8px 16px;
    border-bottom: 1px solid var(--color-border);
}

.nav-menu-section:last-child {
    border-bottom: none;
}

.nav-menu-section a {
    display: block;
    padding: 10px 12px;
    color: var(--color-text);
    text-decoration: none;
    font-family: inherit;
    font-size: var(--font-size-body);
    font-weight: 500;
    border-radius: 8px;
    transition: background 0.15s;
}

.nav-menu-section a:hover {
    background: rgba(107, 76, 138, 0.06);
}

.nav-menu-tab {
    display: flex;
    align-items: center;
    width: 100%;
    padding: 10px 12px;
    background: none;
    border: none;
    border-radius: 8px;
    text-align: left;
    font-family: inherit;
    font-size: var(--font-size-body);
    font-weight: 500;
    color: var(--color-text);
    text-decoration: none;
    cursor: pointer;
    transition: background 0.15s;
    box-sizing: border-box;
}

.nav-menu-tab:hover {
    background: rgba(107, 76, 138, 0.06);
}

.nav-menu-tab.active {
    color: var(--color-primary);
    background: rgba(107, 76, 138, 0.08);
    font-weight: 600;
}

.nav-menu-section .view-toggle {
    justify-content: center;
}

/* Hide empty mobile menu sections */
.nav-menu-section:empty {
    display: none;
    padding: 0;
    border-bottom: none;
}

.nav-menu-section-label {
    font-size: var(--font-size-subheading);
    font-weight: 700;
    letter-spacing: 0.09em;
    text-transform: uppercase;
    color: var(--color-text-light);
    padding: 4px 12px 2px;
    display: block;
}

.nav-menu-signout a {
    display: block;
    padding: 10px 12px;
    color: var(--color-error);
    text-decoration: none;
    font-size: var(--font-size-body);
    font-weight: 500;
    border-radius: 8px;
    transition: background 0.15s;
}

.nav-menu-signout a:hover {
    background: rgba(192, 57, 43, 0.06);
}

/* Responsive - desktop enhancements */
@media (min-width: 1025px) {
    .app-container {
        padding: 24px 40px;
        max-width: 1000px;
    }

    .card {
        padding: 32px;
    }
}

/* Phone-only compact styling */
@media (max-width: 767px) {
    body {
        font-size: var(--font-size-body);
    }

    .app-container {
        padding: 0;
    }

    .hamburger-btn {
        top: 22px;
        right: 12px;
    }

    .app-header {
        padding: 12px 12px 8px;
    }

    .app-header .logo {
        font-size: var(--font-size-heading);
    }

    .app-header .logo small {
        font-size: var(--font-size-subheading);
    }

    .nav-bar {
        padding: 0 12px 6px;
        margin-bottom: 8px;
    }

    .nav-bar .user-info {
        font-size: var(--font-size-small);
    }

    .view-toggle {
        font-size: var(--font-size-subheading);
    }

    .view-toggle-btn {
        padding: 4px 10px;
    }

    .card {
        border-radius: 0;
        border-left: none;
        border-right: none;
        border-top: none;
        box-shadow: none;
        margin-bottom: 0;
        border-bottom: 1px solid var(--color-border);
        padding: 16px 12px;
    }

    .data-table {
        font-size: var(--font-size-small);
    }
    .data-table th,
    .data-table td {
        padding: 8px 6px;
    }

    /* Users tab: collapse Role and Parent columns into name cell on mobile */
    .user-col-role, .user-col-parent { display: none; }
    .user-mobile-badges { display: flex; gap: 4px; flex-wrap: wrap; margin-top: 4px; }
    #tab-users .data-table td:last-child,
    #tab-users .data-table th:last-child { padding-right: 8px; }

    /* History tab: allow Details column to wrap rather than squish */
    #tab-history .data-table td:last-child {
        white-space: normal;
        word-break: break-word;
        min-width: 80px;
    }


    /* Detail rows: stack label + value on mobile when editing */
    .detail-row {
        flex-wrap: wrap;
    }

    .detail-edit-form {
        width: 100%;
    }

    .modal {
        padding: 20px 16px;
    }

    .modal-hero {
        padding: 0;
    }

    .modal-hero-content {
        padding: 20px 16px 24px;
    }

    .modal-hero .enrich-carousel {
        border-radius: 12px 12px 0 0;
    }

    .settings-school-item {
        gap: 8px;
    }

    .settings-school-item .school-item-name {
        font-size: var(--font-size-small);
        min-width: 0;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .school-item .school-name {
        font-size: var(--font-size-small);
    }

    .school-item .btn,
    .school-item-actions .btn {
        font-size: var(--font-size-small);
        padding: 4px 8px;
    }

    #newSchoolName {
        font-size: 0.75rem !important;
        padding: 5px 8px !important;
    }

    /* Settings tab — mobile compact */
    #tab-settings .card h2 {
        font-size: var(--font-size-body);
        margin-bottom: 8px;
    }

    #tab-settings .card > p.text-muted {
        font-size: var(--font-size-subheading);
    }

    #tab-settings .form-group {
        margin-bottom: 10px;
    }

    #tab-settings .form-group label {
        font-size: var(--font-size-subheading);
        margin-bottom: 4px;
    }

    #tab-settings .form-group select,
    #tab-settings .form-group input {
        font-size: var(--font-size-small);
        padding: 7px 10px;
    }

    #tab-settings .btn {
        font-size: var(--font-size-subheading);
        padding: 7px 14px;
    }

    #tab-settings .btn.btn-small {
        font-size: var(--font-size-small);
        padding: 4px 8px;
    }

    /* History tab — mobile compact */
    #tab-history .btn {
        font-size: var(--font-size-small);
        padding: 7px 14px;
    }
}

/* Phone input group (country code + phone field) */
.phone-input-group {
    display: flex;
    gap: 8px;
    align-items: stretch;
}

.phone-input-group .country-code-select {
    width: 88px !important;
    min-width: 88px;
    max-width: 88px;
    flex: 0 0 88px;
    padding: 12px 28px 12px 14px;
    border: 1px solid var(--color-border);
    border-radius: 8px;
    font-size: var(--font-size-body);
    background: var(--color-card);
    color: var(--color-text);
    text-align: left;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%236B6B6B' d='M2 4l4 4 4-4'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
}

.phone-input-group .country-code-select:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(107, 76, 138, 0.15);
}

.phone-input-group input[type="tel"] {
    flex: 1 1 auto;
    width: auto !important;
    min-width: 0;
    padding: 12px 14px;
    border: 1px solid var(--color-border);
    border-radius: 8px;
    font-size: var(--font-size-body);
    background: var(--color-card);
    color: var(--color-text);
}

.phone-input-group input[type="tel"]:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(107, 76, 138, 0.15);
}

/* Form row (side-by-side fields) */
.form-row {
    display: flex;
    gap: 12px;
}

.form-row .form-group {
    flex: 1;
}

/* Badge info variant */
.badge-info {
    background: #F0E8F7;
    color: var(--color-primary-dark);
}

/* Welcome card preview */
.welcome-card-preview {
    text-align: center;
    padding: 16px;
    background: var(--color-bg);
    border-radius: 8px;
    min-height: 100px;
}

.welcome-card-preview img {
    max-width: 100%;
    border-radius: 8px;
    box-shadow: var(--color-shadow);
}

/* Parent detail modal */
.parent-detail-info {
    background: var(--color-bg);
    border-radius: 8px;
    padding: 16px;
    margin-bottom: 16px;
}

.detail-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    gap: 16px;
    border-bottom: 1px solid var(--color-border);
}

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

.detail-label {
    font-weight: 600;
    font-size: var(--font-size-label);
    color: var(--color-text-light);
    flex-shrink: 0;
}

.detail-value {
    font-size: var(--font-size-body);
    color: var(--color-text);
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
    overflow: hidden;
    flex: 1;
}

.detail-value > span:first-child {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    min-width: 0;
}

.detail-edit-btn {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--color-text-light);
    font-size: var(--font-size-label);
    padding: 2px 4px;
    border-radius: 4px;
    transition: color 0.2s, background 0.2s;
}

.detail-edit-btn:hover {
    color: var(--color-primary);
    background: rgba(107, 76, 138, 0.08);
}

.detail-row.editing .detail-edit-btn {
    display: none;
}

.detail-row.editing {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 6px 8px;
    align-items: center;
}

.detail-row.editing .detail-label {
    grid-row: 1;
    grid-column: 1;
}

.detail-row.editing .detail-edit-form {
    grid-row: 1;
    grid-column: 2;
    justify-self: end;
}

.detail-row.editing .detail-value {
    grid-row: 2;
    grid-column: 1 / -1;
    overflow: visible;
}

.detail-edit-form {
    display: flex;
    gap: 6px;
    align-items: center;
    flex-shrink: 0;
}


.detail-edit-input {
    flex: 1;
    min-width: 0;
    max-width: 100%;
    padding: 6px 10px;
    border: 1px solid var(--color-primary);
    border-radius: 6px;
    font-size: var(--font-size-body);
    outline: none;
    box-shadow: 0 0 0 2px rgba(107, 76, 138, 0.15);
    box-sizing: border-box;
}

select.detail-edit-input {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    padding-right: 28px;
    background-color: var(--color-card);
    color: var(--color-text);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%236B6B6B' d='M2 4l4 4 4-4'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 8px center;
    cursor: pointer;
    text-overflow: ellipsis;
}

/* Compact phone input inside detail edit modals */
.detail-value .country-code-select {
    width: 64px !important;
    min-width: 64px;
    max-width: 64px;
    flex: 0 0 64px;
    padding: 6px 22px 6px 8px;
    font-size: var(--font-size-body);
    border: 1px solid var(--color-primary);
    border-radius: 6px;
    box-shadow: 0 0 0 2px rgba(107, 76, 138, 0.15);
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    background-color: var(--color-card);
    color: var(--color-text);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%236B6B6B' d='M2 4l4 4 4-4'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 6px center;
    cursor: pointer;
}

.detail-edit-save,
.detail-edit-cancel {
    background: none;
    border: none;
    cursor: pointer;
    font-size: var(--font-size-body);
    padding: 2px 4px;
    border-radius: 4px;
    line-height: 1;
}

.detail-edit-save {
    color: var(--color-success);
}

.detail-edit-save:hover {
    background: rgba(46, 139, 87, 0.1);
}

.detail-edit-cancel {
    color: var(--color-error);
}

.detail-edit-cancel:hover {
    background: rgba(192, 57, 43, 0.1);
}

/* Clickable table rows */
/* Users tab — filter bar always visible; badges only on mobile */
.users-filter-bar { display: flex; gap: 8px; margin-bottom: 8px; flex-wrap: wrap; }
@media (min-width: 768px) {
    .user-mobile-badges { display: none; }
}

.data-table tr.clickable-row {
    cursor: pointer;
}

.data-table tr.clickable-row:hover td {
    background-color: rgba(107, 76, 138, 0.06);
}

/* Delete confirmation input */
.delete-confirm-input {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--color-border);
    border-radius: 8px;
    font-size: var(--font-size-body);
    margin-top: 8px;
}

.delete-confirm-input:focus {
    outline: none;
    border-color: var(--color-error);
    box-shadow: 0 0 0 3px rgba(192, 57, 43, 0.15);
}

/* Child list in detail modal */
.detail-child-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
    border-bottom: 1px solid var(--color-border);
}

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

/* Modal success state */
.modal-success {
    text-align: center;
    padding: 32px 16px;
}

.modal-success .success-icon {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: #E8F5E9;
    color: var(--color-success);
    font-size: 2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 16px;
    animation: successPop 0.4s ease-out;
}

.modal-success .success-message {
    font-size: var(--font-size-heading);
    font-weight: 600;
    color: var(--color-success);
    margin-bottom: 8px;
}

.modal-success .success-sub {
    font-size: var(--font-size-body);
    color: var(--color-text-light);
    margin-bottom: 24px;
}

/* Powered by footer */
.powered-by {
    text-align: center;
    font-size: var(--font-size-small);
    color: var(--color-text-light);
    padding: 16px 0;
    margin-top: auto;
}

/* Ticket Cards */
.ticket-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 0;
    border-bottom: 1px solid var(--color-border);
}

.ticket-card:last-child {
    border-bottom: none;
}

.ticket-card-info {
    flex: 1;
    min-width: 0;
}

.ticket-card-date {
    font-weight: 600;
    font-size: var(--font-size-body);
    color: var(--color-text);
}

.ticket-card-count {
    font-size: var(--font-size-label);
    color: var(--color-text-light);
    margin-top: 2px;
}

/* ============================================================
   Enrichment Cards (parent browse)
   ============================================================ */

.enrichment-card {
    background: var(--color-bg);
    border-radius: 10px;
    border: 1px solid var(--color-border);
    margin-bottom: 12px;
    overflow: hidden;
    cursor: pointer;
    transition: box-shadow 0.15s, border-color 0.15s;
}
.enrichment-card:hover {
    box-shadow: 0 2px 8px rgba(107, 76, 138, 0.1);
    border-color: var(--color-primary-light);
}
.enrichment-card-registered {
}

.enrichment-card-full {
    opacity: 0.65;
}
.enrichment-card-img {
    width: 100%;
    height: 120px;
    object-fit: cover;
}
.enrichment-card-body {
    padding: 12px 14px;
}
.enrichment-card-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 4px;
}
.enrichment-card-header h3 {
    font-size: var(--font-size-body);
    font-weight: 600;
    margin: 0;
    flex: 1;
    min-width: 0;
}
.enrichment-card-price {
    font-size: var(--font-size-label);
    color: var(--color-text-light);
    white-space: nowrap;
    flex-shrink: 0;
}
.enrichment-card-layout {
    display: flex;
    align-items: stretch;
    gap: 12px;
}
.enrichment-card-left {
    flex: 1;
    min-width: 0;
}
.enrichment-card-price-stack {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    flex-shrink: 0;
    gap: 2px;
    white-space: nowrap;
}
.enrichment-card-public-price {
    text-decoration: line-through;
    color: var(--color-text-light);
    font-size: var(--font-size-small);
    white-space: nowrap;
}
.price-calc-hint {
    font-size: var(--font-size-label);
    color: var(--color-text-light);
    margin-top: 4px;
}
.enrichment-card-provider {
    font-size: var(--font-size-label);
    color: var(--color-text-light);
    margin: 0 0 8px;
}
.enrichment-card-meta {
    display: flex;
    gap: 12px;
    font-size: var(--font-size-label);
    color: var(--color-text-light);
    flex-wrap: wrap;
}
.enrichment-card-spots {
    font-size: var(--font-size-small);
    color: var(--color-text-light);
    margin-top: 6px;
}

.badge-registered {
    display: inline-flex;
    align-items: center;
    padding: 3px 8px;
    border-radius: 12px;
    font-size: var(--font-size-small);
    font-weight: 600;
    line-height: 1;
    background: var(--color-primary);
    color: #fff;
    white-space: nowrap;
}
.badge-full {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: var(--font-size-small);
    font-weight: 600;
    background: var(--color-text-light);
    color: #fff;
    white-space: nowrap;
}
.badge-subsidy {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    padding: 3px 8px;
    border-radius: 12px;
    font-size: var(--font-size-small);
    font-weight: 600;
    line-height: 1;
    background: var(--color-primary);
    color: #fff;
    white-space: nowrap;
}
.subsidy-callout {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    background: color-mix(in srgb, var(--color-accent) 10%, transparent);
    border: 1px solid color-mix(in srgb, var(--color-accent) 30%, transparent);
    border-radius: 8px;
    padding: 10px 14px;
    margin-top: 12px;
    margin-bottom: 14px;
    font-size: var(--font-size-body);
    color: var(--color-text);
    line-height: 1.4;
}

/* ============================================================
   Enrichment Image Carousel
   ============================================================ */

.enrich-carousel {
    position: relative;
    border-radius: 10px;
    overflow: hidden;
    margin-bottom: 16px;
    background: var(--color-border);
}

.enrich-carousel-inner {
    position: relative;
    overflow: hidden;
    touch-action: pan-y;
}

.enrich-carousel-track {
    display: flex;
    transition: transform 0.3s ease;
    will-change: transform;
}

.enrich-carousel-slide {
    flex: 0 0 100%;
}

.enrich-carousel-slide img {
    width: 100%;
    height: 220px;
    object-fit: cover;
    display: block;
    cursor: pointer;
}

.enrich-carousel-arrow {
    position: absolute;
    top: 92px; /* centred in 220px image: (220-36)/2 */
    z-index: 10;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: none;
    background: rgba(0, 0, 0, 0.35);
    color: #fff;
    font-size: var(--font-size-body);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.15s;
    line-height: 1;
}
.enrich-carousel-arrow:hover { background: rgba(0, 0, 0, 0.6); }
.enrich-carousel-prev { left: 10px; }
.enrich-carousel-next { right: 10px; }

@media (max-width: 768px) {
    .enrich-carousel-arrow { display: none; }
}

.enrich-carousel-dots {
    display: flex;
    justify-content: center;
    gap: 6px;
    padding: 8px 0 6px;
    background: var(--color-card);
}

.enrich-carousel-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--color-border);
    border: none;
    cursor: pointer;
    padding: 0;
    transition: background 0.15s, transform 0.15s;
}

.enrich-carousel-dot.active {
    background: var(--color-primary);
    transform: scale(1.3);
}


.enrich-carousel-single {
    width: 100%;
    max-height: 220px;
    object-fit: cover;
    border-radius: 10px;
    margin-bottom: 16px;
    cursor: pointer;
    display: block;
}

/* ============================================================
   Planner Grid (Mon-Fri weekly view)
   ============================================================ */

.planner-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 16px;
    margin-top: 12px;
}
.planner-day-column {
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.planner-time-grid {
    position: relative;
    overflow: visible;
}
.planner-day-header {
    font-weight: 700;
    font-size: var(--font-size-body);
    text-align: center;
    padding: 6px 0;
    background: var(--color-primary);
    color: #fff;
    border-radius: 6px;
}
.planner-empty {
    font-size: var(--font-size-small);
    color: var(--color-text-light);
    text-align: center;
    padding: 16px 4px;
}
.planner-slot {
    border-radius: 6px;
    padding: 8px;
    font-size: var(--font-size-label);
    border: 1px dashed var(--color-border);
    background: var(--color-bg);
    cursor: pointer;
    overflow: hidden;
    transition: box-shadow 0.2s cubic-bezier(0.22, 1, 0.36, 1), transform 0.15s cubic-bezier(0.22, 1, 0.36, 1);
}
.planner-slot:hover {
    box-shadow: 0 2px 8px rgba(107, 76, 138, 0.15);
    transform: translateY(-1px);
}
.planner-slot:active {
    transform: translateY(0);
}
.planner-slot-registered {
    border: 1px solid var(--color-primary);
    background: rgba(107, 76, 138, 0.06);
}
.planner-slot-available {
    border: 1px solid rgba(107, 76, 138, 0.25);
    background: rgba(107, 76, 138, 0.02);
}
.planner-slot-available:hover {
    border-color: rgba(107, 76, 138, 0.5);
    background: rgba(107, 76, 138, 0.06);
}
.planner-slot-clash {
    border: 2px solid var(--color-danger);
    background: rgba(220, 53, 69, 0.06);
}
.planner-slot-cta {
    font-size: var(--font-size-small);
    color: var(--color-primary);
    font-weight: 600;
    margin-top: 4px;
    text-align: right;
}
.planner-slot-name {
    font-weight: 600;
    font-size: var(--font-size-label);
    margin-bottom: 2px;
    word-break: break-word;
}
.planner-slot-time {
    font-size: var(--font-size-small);
    color: var(--color-text-light);
}
.planner-slot-badge {
    font-size: var(--font-size-small);
    color: var(--color-primary);
    font-weight: 700;
    margin-top: 4px;
}
.planner-slot-clash-warn {
    font-size: var(--font-size-small);
    color: var(--color-danger);
    font-weight: 600;
    margin-top: 2px;
}

/* Planner mobile: column dividers */
@media (max-width: 768px) {
    .planner-day-column {
        border-bottom: 1px solid var(--color-border);
        padding-bottom: 12px;
    }
    .planner-day-column:last-child {
        border-bottom: none;
    }
}

/* Safe area for notched phones */
@supports (padding-top: env(safe-area-inset-top)) {
    body {
        padding-top: env(safe-area-inset-top);
        padding-bottom: env(safe-area-inset-bottom);
    }
}

/* ============================================================
   Contextual Alert Cards (Announcements page)
   ============================================================ */

.ctx-alert {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 10px 14px;
    border-radius: 8px;
    margin-bottom: 8px;
    font-size: var(--font-size-body);
    line-height: 1.4;
    border-left-width: 3px;
    border-left-style: solid;
}
.ctx-alert-link {
    cursor: pointer;
}
.ctx-alert-link:hover {
    filter: brightness(0.96);
}
.ctx-alert-link:active {
    filter: brightness(0.92);
}
.ctx-alert-chevron {
    font-size: var(--font-size-heading);
    flex-shrink: 0;
    margin-left: auto;
    align-self: center;
    opacity: 0.5;
}
.ctx-alert-icon {
    font-size: var(--font-size-body);
    flex-shrink: 0;
    margin-top: 1px;
}
.ctx-alert-title {
    display: block;
    font-weight: 600;
    margin-bottom: 1px;
}
.ctx-alert-urgent {
    background: #FFF4F4;
    border-left-color: var(--color-error);
    color: #8B1A1A;
}
.ctx-alert-warn {
    background: #FFFBF0;
    border-left-color: #D4A843;
    color: #7A5500;
}
.ctx-alert-info {
    background: #F4F0FA;
    border-left-color: var(--color-primary);
    color: var(--color-primary-dark);
}
.ctx-alert-success {
    background: #F0FBF4;
    border-left-color: var(--color-success);
    color: #1A5C34;
}
[data-theme="dark"] .ctx-alert-urgent { background: rgba(192,57,43,0.12); color: #F9BABA; }
[data-theme="dark"] .ctx-alert-warn   { background: rgba(212,168,67,0.12); color: #F5D78A; }
[data-theme="dark"] .ctx-alert-info   { background: rgba(107,76,138,0.15); color: var(--color-primary-light); }
[data-theme="dark"] .ctx-alert-success{ background: rgba(46,158,94,0.12); color: #90DEB0; }
[data-theme="dark"] .event-banner-upcoming .event-banner-badge { background: var(--color-primary); color: #fff; }
[data-theme="dark"] .event-banner-live .event-banner-badge     { background: rgba(192,57,43,0.2);   color: #F9BABA; }

/* ============================================================
   Micro-animations
   ============================================================ */

/* Auth page card lift-in — login, first-login, forgot-password */
@keyframes cardLiftIn {
    from { opacity: 0; transform: translateY(12px) scale(0.99); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}
.app-container > .card {
    animation: cardLiftIn 0.35s cubic-bezier(0.22, 1, 0.36, 1) both;
    animation-delay: 0.1s;
}

/* Modal overlay fade-in */
@keyframes overlayFade {
    from { opacity: 0; }
    to   { opacity: 1; }
}
.modal-overlay.show {
    animation: overlayFade 0.2s ease both;
}

/* Modal box scale-in */
@keyframes modalEnter {
    from { opacity: 0; transform: scale(0.95) translateY(8px); }
    to   { opacity: 1; transform: scale(1) translateY(0); }
}
.modal-overlay.show .modal {
    animation: modalEnter 0.22s cubic-bezier(0.22, 1, 0.36, 1) both;
}

/* Alert slide-in from top */
@keyframes alertSlideIn {
    from { opacity: 0; transform: translateY(-6px); }
    to   { opacity: 1; transform: translateY(0); }
}
.alert.show {
    animation: alertSlideIn 0.2s cubic-bezier(0.22, 1, 0.36, 1) both;
}

/* Card enter animation — list items fade in and slide up */
@keyframes cardEnter {
    from { opacity: 0; transform: translateY(10px); }
    to   { opacity: 1; transform: translateY(0); }
}
.enrichment-card,
.announcement-card {
    animation: cardEnter 0.2s cubic-bezier(0.22, 1, 0.36, 1) both;
}
/* Stagger siblings up to 6 */
.enrichment-card:nth-child(1), .announcement-card:nth-child(1) { animation-delay: 0ms; }
.enrichment-card:nth-child(2), .announcement-card:nth-child(2) { animation-delay: 30ms; }
.enrichment-card:nth-child(3), .announcement-card:nth-child(3) { animation-delay: 60ms; }
.enrichment-card:nth-child(4), .announcement-card:nth-child(4) { animation-delay: 90ms; }
.enrichment-card:nth-child(5), .announcement-card:nth-child(5) { animation-delay: 120ms; }
.enrichment-card:nth-child(n+6), .announcement-card:nth-child(n+6) { animation-delay: 150ms; }

/* Success modal scale-in (upgrade existing successPop) */
@keyframes successPop {
    0%   { transform: scale(0.6); opacity: 0; }
    60%  { transform: scale(1.12); }
    100% { transform: scale(1); opacity: 1; }
}

/* Tab content crossfade */
.tab-content.active {
    animation: tabFade 0.18s ease-out;
}
@keyframes tabFade {
    from { opacity: 0; }
    to   { opacity: 1; }
}

/* Messages module — recipient row reveal */
@keyframes rowFadeIn {
    from { opacity: 0; transform: translateY(-4px); }
    to   { opacity: 1; transform: translateY(0); }
}
.row-reveal {
    animation: rowFadeIn 0.2s cubic-bezier(0.22, 1, 0.36, 1) both;
}

/* Messages module — card entrances */
#tab-messages.active .card,
#tab-messages-settings.active .card {
    animation: cardEnter 0.2s cubic-bezier(0.22, 1, 0.36, 1) both;
}
#tab-messages-settings.active .card:nth-child(2) { animation-delay: 60ms; }

/* Messages module — recipient preview crossfade */
@keyframes previewFade {
    from { opacity: 0.3; }
    to   { opacity: 1; }
}
.preview-updated {
    animation: previewFade 0.18s ease-out both;
}

/* Messages module — recipient chips */
.msg-recipient-summary {
    font-size: var(--font-size-body);
    color: var(--color-text);
    margin-bottom: 8px;
    font-weight: 500;
}
.msg-recipient-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 12px;
}
.msg-recipient-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: 99px;
    padding: 3px 8px 3px 10px;
    font-size: var(--font-size-label);
    color: var(--color-text);
    transition: opacity 0.15s;
}
.msg-recipient-chip.excluded {
    opacity: 0.4;
    text-decoration: line-through;
}
.msg-chip-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0 2px;
    font-size: var(--font-size-body);
    line-height: 1;
    color: var(--color-muted);
    display: flex;
    align-items: center;
    transition: color 0.15s;
}
.msg-chip-btn:hover { color: var(--color-error); }
.msg-recipient-chip.excluded .msg-chip-btn:hover { color: var(--color-primary); }

/* Ticket issuance — mode toggle */
.issue-mode-toggle {
    display: inline-flex;
    background: var(--color-bg);
    border-radius: 20px;
    padding: 3px;
    gap: 2px;
    margin-bottom: 12px;
}
.issue-mode-btn {
    padding: 5px 14px;
    border: none;
    background: transparent;
    border-radius: 18px;
    font-size: var(--font-size-label);
    font-weight: 500;
    cursor: pointer;
    color: var(--color-text-muted);
    transition: background 0.15s, color 0.15s;
}
.issue-mode-btn.active {
    background: var(--color-primary);
    color: white;
}
.issue-mode-btn:hover:not(.active) {
    background: rgba(107, 76, 138, 0.12);
    color: var(--color-primary);
}

/* Ticket issuance — search results */
.issue-search-results {
    max-height: 200px;
    overflow-y: auto;
    border: 1px solid var(--color-border);
    border-radius: 8px;
    margin-top: 4px;
}
.issue-search-results:empty { display: none; }
.issue-search-result {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    cursor: pointer;
    font-size: var(--font-size-body);
    transition: background 0.1s;
}
.issue-search-result:hover { background: var(--color-bg); }
.issue-search-result + .issue-search-result {
    border-top: 1px solid var(--color-border);
}
.issue-search-result-add {
    color: var(--color-primary);
    font-size: var(--font-size-label);
    font-weight: 500;
    white-space: nowrap;
}

/* Ticket issuance — selected user chips */
.issue-user-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 8px;
}
.issue-user-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 8px 4px 10px;
    border-radius: 99px;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    font-size: var(--font-size-label);
    color: var(--color-text);
}
.issue-chip-remove {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--color-text-muted);
    font-size: var(--font-size-body);
    line-height: 1;
    padding: 0 2px;
    display: flex;
    align-items: center;
    transition: color 0.15s;
}
.issue-chip-remove:hover { color: var(--color-error); }
.issue-selected-label {
    font-size: var(--font-size-label);
    font-weight: 600;
    color: var(--color-text-muted);
    margin-top: 12px;
    margin-bottom: 2px;
}

/* Messages module — media attachment */
.msg-media-preview {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 12px;
}
.msg-media-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: 10px;
}
.msg-media-thumb {
    width: 56px;
    height: 56px;
    border-radius: 6px;
    object-fit: cover;
    flex-shrink: 0;
    background: var(--color-bg);
}
.msg-media-icon {
    width: 56px;
    height: 56px;
    border-radius: 6px;
    background: var(--color-bg);
    border: 1px solid var(--color-border);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: var(--font-size-heading);
}
.msg-media-info {
    flex: 1;
    min-width: 0;
}
.msg-media-name {
    font-size: var(--font-size-label);
    font-weight: 500;
    color: var(--color-text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.msg-media-type {
    font-size: var(--font-size-small);
    color: var(--color-muted);
    margin-top: 2px;
}
.msg-attach-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: var(--font-size-label);
    cursor: pointer;
    color: var(--color-muted);
    background: none;
    border: 1px dashed var(--color-border);
    border-radius: 8px;
    padding: 7px 12px;
    transition: color 0.15s, border-color 0.15s;
    margin-bottom: 12px;
    width: 100%;
    justify-content: center;
}
.msg-attach-btn:hover,
.msg-attach-btn.drag-over {
    color: var(--color-primary);
    border-color: var(--color-primary);
    background: color-mix(in srgb, var(--color-primary) 6%, transparent);
}

/* ============================================================
   Purple Badges
   ============================================================ */

/* Free! badge — purple pill */
.badge-free {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: var(--font-size-small);
    font-weight: 700;
    line-height: 1.4;
    background: var(--color-primary);
    color: #fff;
    white-space: nowrap;
}

/* TWO Parent badge — purple pill */
.badge-two-parent {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: var(--font-size-small);
    font-weight: 700;
    line-height: 1.4;
    background: var(--color-primary);
    color: #fff;
    white-space: nowrap;
    cursor: default;
}

/* ============================================================
   Empty States
   ============================================================ */

.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 48px 24px;
    text-align: center;
    color: var(--color-text-light);
    gap: 12px;
}
.empty-state-icon {
    font-size: 2.4rem;
    line-height: 1;
    opacity: 0.5;
}
.empty-state-title {
    font-size: var(--font-size-body);
    font-weight: 600;
    color: var(--color-text);
    margin: 0;
}
.empty-state-body {
    font-size: var(--font-size-body);
    color: var(--color-text-light);
    max-width: 280px;
    margin: 0;
    line-height: 1.5;
}

/* ============================================================
   Keyboard Focus Visible (accessible focus ring)
   ============================================================ */

:focus-visible {
    outline: 2px solid var(--color-primary);
    outline-offset: 2px;
}

/* ============================================================
   Brand Mark — SVG wordmark footer
   ============================================================ */

.brand-mark {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 16px 0;
    margin-top: auto;
    text-decoration: none;
    position: relative;
}
.brand-mark-version {
    position: absolute;
    right: 12px;
    font-size: 0.62rem;
    color: var(--color-text-light);
    opacity: 0.55;
    letter-spacing: 0.04em;
}
.brand-mark-text {
    display: flex;
    flex-direction: column;
    line-height: 1.2;
}
.brand-mark-powered-by {
    font-size: 0.58rem;
    font-weight: 400;
    letter-spacing: 0.06em;
    color: var(--color-text-light);
    opacity: 0.65;
    margin-bottom: 1px;
}
.brand-mark-petals {
    font-size: var(--font-size-label);
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: #6B4C8A; /* Petals brand purple — never inherits org primary */
}
.brand-mark-intelligence {
    font-size: var(--font-size-small);
    font-weight: 300;
    letter-spacing: 0.06em;
    color: var(--color-text-light);
}

/* ============================================================
   Dark Mode Transition
   ============================================================ */

.theme-transitioning,
.theme-transitioning *,
.theme-transitioning *::before,
.theme-transitioning *::after {
    transition: background-color 0.5s ease, color 0.5s ease, border-color 0.5s ease, box-shadow 0.5s ease !important;
}

/* ============================================================
   Dark Mode — deep purple theme
   ============================================================ */

[data-theme="dark"] select {
    color-scheme: dark;
}

[data-theme="dark"] {
    --color-bg: #111313;
    --color-card: #1d2020;
    --color-text: #F0ECF7;
    --color-text-light: #9A9A9A;
    --color-border: #2f3736;
    --color-shadow: 0 2px 8px rgba(141, 205, 196, 0.15);
    --color-primary: #8dcdc4;
    --color-primary-light: #b0f0e7;
    --color-primary-dark: #6aaaa1;
    --color-success: #2E9E5E;
    --color-error: #E05555;
    --color-danger: #E05555;
}

[data-theme="dark"] body {
    background-color: var(--color-bg);
    color: var(--color-text);
}

[data-theme="dark"] .card {
    background: var(--color-card);
    border-color: var(--color-border);
}

[data-theme="dark"] .modal {
    background: var(--color-card);
    border: 1px solid var(--color-border);
}

[data-theme="dark"] .data-table th {
    background: var(--color-bg);
    color: var(--color-primary-light);
}

[data-theme="dark"] .form-group input,
[data-theme="dark"] .form-group select,
[data-theme="dark"] .form-group textarea,
[data-theme="dark"] .detail-edit-input,
[data-theme="dark"] select.detail-edit-input {
    background-color: var(--color-bg);
    color: var(--color-text);
    border-color: var(--color-border);
}
[data-theme="dark"] .form-group select,
[data-theme="dark"] select.detail-edit-input,
[data-theme="dark"] .phone-input-group .country-code-select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23AAAAAA' d='M2 4l4 4 4-4'/%3E%3C/svg%3E");
}

[data-theme="dark"] .enrichment-card {
    background: var(--color-card);
    border-color: var(--color-border);
}

[data-theme="dark"] .enrichment-card:hover {
    border-color: var(--color-primary);
}

[data-theme="dark"] .planner-slot {
    background: var(--color-card);
    border-color: var(--color-border);
}

[data-theme="dark"] .planner-slot-registered {
    background: color-mix(in srgb, var(--color-primary) 15%, transparent);
    border-color: var(--color-primary);
}

[data-theme="dark"] .planner-day-header {
    background: var(--color-primary-dark);
}

[data-theme="dark"] .nav-menu {
    background: var(--color-card);
    border-color: var(--color-border);
}

[data-theme="dark"] .nav-menu-profile {
    border-color: var(--color-border);
}

[data-theme="dark"] .nav-menu-section {
    border-color: var(--color-border);
}

[data-theme="dark"] .announcement-card {
    background: var(--color-card);
}

[data-theme="dark"] .student-card {
    background: var(--color-card);
}

[data-theme="dark"] .detail-row {
    border-color: var(--color-border);
}

[data-theme="dark"] .alert-success {
    background: rgba(46, 158, 94, 0.15);
    color: var(--color-success);
    border-color: rgba(46, 158, 94, 0.3);
}

[data-theme="dark"] .alert-error {
    background: rgba(224, 85, 85, 0.15);
    color: var(--color-error);
    border-color: rgba(224, 85, 85, 0.3);
}

[data-theme="dark"] .tabs {
    border-color: var(--color-border);
}

[data-theme="dark"] .search-bar input {
    background: var(--color-bg);
    color: var(--color-text);
    border-color: var(--color-border);
}

[data-theme="dark"] .badge-success {
    background: rgba(46, 158, 94, 0.2);
    color: var(--color-success);
}

[data-theme="dark"] .badge-purple {
    background: rgba(139, 92, 246, 0.2);
    color: #A78BFA;
}

/* Dark mode toggle button in hamburger menu */
.dark-mode-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 10px 12px;
    background: none;
    border: none;
    border-radius: 8px;
    font-family: inherit;
    font-size: var(--font-size-body);
    font-weight: 500;
    color: var(--color-text);
    cursor: pointer;
    transition: background 0.15s;
    text-align: left;
}
.dark-mode-toggle:hover {
    background: rgba(107, 76, 138, 0.06);
}
.dark-mode-track {
    width: 36px;
    height: 20px;
    border-radius: 10px;
    background: var(--color-border);
    position: relative;
    transition: background 0.2s;
    flex-shrink: 0;
}
.dark-mode-track.on {
    background: var(--color-primary);
}
.dark-mode-thumb {
    position: absolute;
    top: 3px;
    left: 3px;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: #fff;
    transition: transform 0.2s;
}
.dark-mode-track.on .dark-mode-thumb {
    transform: translateX(16px);
}

[data-theme="dark"] input[type="date"]::-webkit-calendar-picker-indicator {
    filter: invert(1) brightness(1.5);
}

/* ============================================================
   Org Switcher
   ============================================================ */
.org-switcher { position: relative; }
.org-switcher-btn { background: none; border: 1px solid rgba(255,255,255,0.35); border-radius: 6px; color: white; padding: 4px 10px; font-size: var(--font-size-label); cursor: pointer; display: flex; align-items: center; gap: 6px; white-space: nowrap; }
.org-switcher-btn:hover { background: rgba(255,255,255,0.12); }
.org-panel { position: absolute; top: calc(100% + 8px); right: 0; background: var(--color-card); border-radius: 8px; box-shadow: 0 4px 20px rgba(0,0,0,0.15); min-width: 180px; z-index: 200; padding: 8px 0; border: 1px solid var(--color-border); }
.org-panel-label { font-size: var(--font-size-subheading); font-weight: 700; text-transform: uppercase; color: var(--color-text-light); padding: 4px 14px 8px; letter-spacing: 0.04em; }
.org-panel ul { list-style: none; margin: 0; padding: 0; }
.org-panel li button { width: 100%; text-align: left; padding: 9px 14px; background: none; border: none; cursor: pointer; font-size: var(--font-size-body); color: var(--color-text); }
.org-panel li button:hover { background: var(--color-bg); }
.org-panel li button.active { color: var(--color-primary); font-weight: 600; }

/* ============================================================
   Branding Settings
   ============================================================ */
.section-divider-label {
    font-size: var(--font-size-small);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--color-text-light);
    margin: 20px 0 4px;
    padding-bottom: 6px;
    border-bottom: 1px solid var(--color-border);
}
.branding-color-row { display: flex; align-items: center; gap: 8px; }
.branding-color-swatch { width: 36px; height: 36px; border: 1px solid var(--color-border); border-radius: 6px; padding: 2px; cursor: pointer; background: none; flex-shrink: 0; }
.branding-color-swatch::-webkit-color-swatch-wrapper { padding: 0; }
.branding-color-swatch::-webkit-color-swatch { border-radius: 4px; border: none; }
.branding-color-row .detail-edit-input { flex: 1; font-family: monospace; text-transform: uppercase; }

/* ── Theme Colour Tab Toggle (Light / Dark) ── */
.theme-colour-tabs { display: flex; gap: 4px; }
.theme-colour-tab { padding: 5px 14px; font-size: var(--font-size-label); border: 1px solid var(--color-border); border-radius: 20px; background: none; color: var(--color-text-light); cursor: pointer; transition: background 0.15s, color 0.15s; }
.theme-colour-tab.active { background: var(--color-primary); color: #fff; border-color: var(--color-primary); }
.theme-colour-tab:hover:not(.active) { background: var(--color-primary-light); color: #fff; border-color: var(--color-primary-light); }

/* ── Generic toggle switch (used in Theme Management) ── */
.toggle-label { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; user-select: none; }
.toggle-label input[type="checkbox"] { display: none; }
.toggle-track { position: relative; width: 40px; height: 22px; background: var(--color-border); border-radius: 11px; transition: background 0.2s; flex-shrink: 0; }
.toggle-thumb { position: absolute; top: 2px; left: 2px; width: 18px; height: 18px; background: #fff; border-radius: 50%; transition: transform 0.2s; box-shadow: 0 1px 3px rgba(0,0,0,0.25); }
.toggle-label input:checked + .toggle-track { background: var(--color-primary); }
.toggle-label input:checked + .toggle-track .toggle-thumb { transform: translateX(18px); }
.toggle-text { font-size: var(--font-size-body); color: var(--color-text); }

/* Module Management toggles */
.module-toggle-row { padding: 10px 0; border-bottom: 1px solid var(--color-border); transition: opacity 0.2s; }
.module-toggle-row:last-child { border-bottom: none; }
.module-toggle-row .toggle-label { align-items: flex-start; }
.module-toggle-row .toggle-text { line-height: 1.4; }
.module-toggle-row .module-desc { font-size: 0.85em; color: var(--color-muted); }
.module-toggle-row .dep-note { font-size: 0.8em; color: var(--color-muted); }
.module-toggle-row .dep-requires { display: block; font-style: italic; margin-top: 2px; color: var(--color-accent, #e67e22); }
.module-toggle-row.dep-disabled { opacity: 0.45; }
.module-toggle-row.dep-disabled .toggle-label { cursor: not-allowed; }

/* ============================================================
   HR Pending Dot Indicators
   ============================================================ */

/* Inline pulsing dot — used in nav menu and application status rows */
.hr-pending-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #ef4444;
    animation: livePulse 1.5s ease-in-out infinite;
    vertical-align: middle;
    flex-shrink: 0;
    margin-left: 5px;
}

/* Dot positioned on the hamburger button (top-right corner) */
#hamburgerPendingDot {
    position: absolute;
    top: 0px;
    right: 0px;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: #ef4444;
    animation: livePulse 1.5s ease-in-out infinite;
    display: none;
    pointer-events: none;
    border: 2px solid var(--color-bg);
}
#hamburgerPendingDot.visible { display: block; }

/* ── Flatpickr date range picker overrides ──────────────────── */
/* !important needed — Flatpickr ships hardcoded rgba colours that */
/* otherwise win on specificity against var() declarations.        */
.flatpickr-calendar {
    background: var(--color-card) !important;
    border-color: var(--color-border) !important;
    box-shadow: 0 4px 16px rgba(0,0,0,0.25) !important;
}
.flatpickr-months,
.flatpickr-months .flatpickr-month,
.flatpickr-weekdays,
span.flatpickr-weekday {
    background: var(--color-primary) !important;
    color: #fff !important;
    fill: #fff !important;
}
.flatpickr-current-month,
.flatpickr-current-month .flatpickr-monthDropdown-months,
.flatpickr-current-month input.cur-year {
    color: #fff !important;
    fill: #fff !important;
    background: transparent !important;
}
.flatpickr-prev-month svg, .flatpickr-next-month svg { fill: #fff !important; }
.flatpickr-prev-month:hover svg, .flatpickr-next-month:hover svg { fill: rgba(255,255,255,0.7) !important; }
.flatpickr-days, .dayContainer { background: var(--color-card) !important; }
.flatpickr-day {
    color: var(--color-text) !important;
    border-color: transparent !important;
}
.flatpickr-day:hover {
    background: var(--color-primary) !important;
    border-color: var(--color-primary) !important;
    color: #fff !important;
}
.flatpickr-day.selected,
.flatpickr-day.startRange,
.flatpickr-day.endRange,
.flatpickr-day.selected:hover,
.flatpickr-day.startRange:hover,
.flatpickr-day.endRange:hover {
    background: var(--color-primary) !important;
    border-color: var(--color-primary) !important;
    color: #fff !important;
}
/* inRange: use rgba so only the background gets transparency, not the text */
.flatpickr-day.inRange {
    background: rgba(141, 205, 196, 0.2) !important;
    border-color: transparent !important;
    box-shadow: -5px 0 0 rgba(141,205,196,0.2), 5px 0 0 rgba(141,205,196,0.2) !important;
    color: var(--color-text) !important;
}
.flatpickr-day.flatpickr-disabled,
.flatpickr-day.flatpickr-disabled:hover {
    color: var(--color-text-light) !important;
    background: transparent !important;
    cursor: not-allowed !important;
}
.flatpickr-day.prevMonthDay,
.flatpickr-day.nextMonthDay {
    color: var(--color-text-light) !important;
    opacity: 0.5;
}
.flatpickr-day.today:not(.selected) { border-color: var(--color-primary) !important; }
.numInputWrapper:hover { background: transparent !important; }
.flatpickr-monthDropdown-months,
.flatpickr-monthDropdown-month { background: var(--color-primary) !important; color: #fff !important; }

/* ── Apply Leave picker — group leave chip overlay ─────────── */
.flatpickr-day {
    position: relative;
}
/* Shift day number up so chips fit below it within the 39px cell */
.flatpickr-day.fp-has-chips {
    line-height: 1 !important;
    padding-top: 5px !important;
}
.fp-group-chips {
    display: flex;
    gap: 1px;
    flex-wrap: wrap;
    justify-content: center;
    margin-top: 2px;
}
.fp-group-chip {
    flex-shrink: 0;
    width: 10px;
    height: 10px;
    border-radius: 2px;
    font-size: 0.48rem;
    font-weight: 700;
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.fp-group-chip-more {
    font-size: 0.45rem;
    color: var(--color-text-light);
    line-height: 10px;
    align-self: center;
}
/* Capacity-full days get a subtle red tint */
.flatpickr-day.fp-day-at-capacity {
    background: rgba(239, 68, 68, 0.12) !important;
}
/* Restore primary bg on hover/selection so tint doesn't bleed through */
.flatpickr-day.fp-day-at-capacity:hover,
.flatpickr-day.fp-day-at-capacity.selected,
.flatpickr-day.fp-day-at-capacity.startRange,
.flatpickr-day.fp-day-at-capacity.endRange,
.flatpickr-day.fp-day-at-capacity.inRange {
    background: var(--color-primary) !important;
}

/* Non-working days (weekends, off-days per workweek, public holidays) — quiet grey wash */
.flatpickr-day.fp-non-working:not(.selected):not(.startRange):not(.endRange):not(.inRange):not(:hover) {
    background: rgba(128, 128, 128, 0.08) !important;
    color: var(--color-text-light) !important;
}

/* ============================================================
   HR Leave Calendar
   ============================================================ */

.hr-cal-wrap { max-width: 540px; margin: 0 auto; }

/* Header row: prev / month label / next / today */
.hr-cal-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
}
.hr-cal-header .hr-cal-month-label {
    flex: 1;
    text-align: center;
    font-weight: 600;
    font-size: var(--font-size-body);
}
.hr-cal-nav-btn {
    background: none;
    border: 1px solid var(--color-border);
    border-radius: 6px;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: var(--font-size-body);
    color: var(--color-text);
    flex-shrink: 0;
    transition: background 0.15s;
}
.hr-cal-nav-btn:hover { background: var(--color-bg); }

/* Day-of-week label row */
.hr-cal-dow-row {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    margin-bottom: 4px;
    gap: 2px;
}
.hr-cal-dow-label {
    text-align: center;
    font-size: var(--font-size-small);
    font-weight: 600;
    color: var(--color-text-light);
    padding: 2px 0;
}

/* Calendar grid */
.hr-cal-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 2px;
}
.hr-cal-loading {
    grid-column: 1 / -1;
    text-align: center;
    padding: 32px;
    color: var(--color-text-light);
    font-size: var(--font-size-body);
}
.hr-cal-cell--empty { visibility: hidden; }

/* Individual day cell */
.hr-cal-cell {
    background: var(--color-card);
    border: 1.5px solid transparent;
    border-radius: 8px;
    padding: 6px 4px 5px;
    min-height: 58px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    cursor: pointer;
    transition: background 0.12s, border-color 0.12s;
    position: relative;
    -webkit-tap-highlight-color: transparent;
    color: inherit;
}
.hr-cal-cell:hover { background: var(--color-bg); }
.hr-cal-cell--weekend { opacity: 0.45; }
.hr-cal-ph-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: var(--font-size-label);
    font-weight: 600;
    color: var(--color-text-light);
    background: rgba(128,128,128,0.1);
    border-radius: 6px;
    padding: 4px 10px;
    margin-bottom: 8px;
}
.hr-cal-ph-icon { font-size: var(--font-size-body); }
.hr-cal-cell--today .hr-cal-day-num {
    background: var(--color-primary);
    color: #fff;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.hr-cal-cell--selected {
    border-color: var(--color-primary);
    background: color-mix(in srgb, var(--color-primary) 8%, transparent);
}
.hr-cal-cell--has-leaves { }

.hr-cal-day-num {
    font-size: var(--font-size-label);
    font-weight: 500;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

/* Dot indicators */
.hr-cal-dots {
    display: flex;
    align-items: center;
    gap: 2px;
    flex-wrap: wrap;
    justify-content: center;
    min-height: 10px;
}
.hr-cal-initial-chip {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 15px;
    height: 15px;
    border-radius: 3px;
    font-size: 0.62rem;
    font-weight: 700;
    color: #fff;
    line-height: 1;
    flex-shrink: 0;
}
.hr-cal-dot-more {
    font-size: 0.6rem;
    font-weight: 700;
    color: var(--color-text-light);
    line-height: 1;
}

/* Detail panel below grid */
.hr-cal-detail {
    margin-top: 10px;
    background: var(--color-bg);
    border-radius: 10px;
    padding: 12px 14px;
    transform: scaleY(0);
    transform-origin: top center;
    visibility: hidden;
    transition: transform 0.25s cubic-bezier(0.22, 1, 0.36, 1),
                visibility 0s linear 0.25s;
}
.hr-cal-detail.show {
    transform: scaleY(1);
    visibility: visible;
    transition: transform 0.25s cubic-bezier(0.22, 1, 0.36, 1),
                visibility 0s;
}
.hr-cal-detail-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
}
.hr-cal-detail-date {
    font-weight: 600;
    font-size: var(--font-size-body);
}
.hr-cal-detail-close {
    background: none;
    border: none;
    font-size: var(--font-size-heading);
    cursor: pointer;
    color: var(--color-text-light);
    line-height: 1;
    padding: 2px 4px;
}
.hr-cal-detail-list { display: flex; flex-direction: column; gap: 6px; }
.hr-cal-detail-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: var(--font-size-body);
}
.hr-cal-detail-dot {
    width: 20px;
    height: 20px;
    border-radius: 4px;
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: var(--font-size-small);
    font-weight: 700;
    color: #fff;
}
.hr-cal-detail-name { flex: 1; font-weight: 500; }
.hr-cal-detail-badge {
    font-size: var(--font-size-small);
    font-weight: 600;
    padding: 2px 6px;
    border-radius: 4px;
    flex-shrink: 0;
}

/* Legend */
.hr-cal-legend { margin-top: 14px; }
.hr-cal-legend-row {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}
.hr-cal-legend-item {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: var(--font-size-label);
    color: var(--color-text-light);
}
.hr-cal-legend-dot {
    width: 18px;
    height: 18px;
    border-radius: 3px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: var(--font-size-small);
    font-weight: 700;
    color: #fff;
    flex-shrink: 0;
}
.hr-cal-legend-label { font-weight: 500; }

/* Dark mode overrides */
[data-theme="dark"] .hr-cal-nav-btn {
    border-color: var(--color-border);
    color: var(--color-text);
}
[data-theme="dark"] .hr-cal-cell {
    background: #28322f;
    border-color: #3a4a47;
}
[data-theme="dark"] .hr-cal-cell:hover {
    background: #2f3d39;
}
[data-theme="dark"] .hr-cal-cell--weekend {
    opacity: 0.6;
}
[data-theme="dark"] .hr-cal-cell--selected {
    background: rgba(141, 205, 196, 0.15);
    border-color: var(--color-primary);
}
[data-theme="dark"] .hr-cal-detail {
    background: var(--color-bg);
    border: 1px solid var(--color-border);
}
[data-theme="dark"] .hr-cal-dot-more {
    color: var(--color-text-light);
}

/* Mobile tweaks */
@media (max-width: 360px) {
    .hr-cal-cell { min-height: 50px; padding: 4px 2px; }
    .hr-cal-day-num { font-size: 0.73rem; width: 20px; height: 20px; }
    .hr-cal-cell--today .hr-cal-day-num { width: 20px; height: 20px; }
    .hr-cal-initial-chip { width: 13px; height: 13px; font-size: 0.58rem; }
}

/* ============================================================ */
/* Teaching Assistants Module                                    */
/* ============================================================ */

/* TA pending pulse dot — mirrors .hr-pending-dot */
.ta-pending-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #ef4444;
    animation: livePulse 1.5s ease-in-out infinite;
    vertical-align: middle;
    flex-shrink: 0;
    margin-left: 5px;
}

/* Teaching Assistant role badge */
.badge-purple {
    background: #EDE9FE;
    color: #5B21B6;
}

/* TA slot card */
.ta-slot-card {
    background: var(--color-card);
    border: 1px solid var(--color-border);
    border-radius: 10px;
    padding: 14px 16px;
    margin-bottom: 12px;
    transition: box-shadow 0.15s;
}
.ta-slot-card:hover {
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}
.ta-slot-card.ta-slot-confirmed {
    border-left: 3px solid var(--color-success, #16a34a);
}
.ta-slot-card.ta-slot-filled {
    border-left: 3px solid #9CA3AF;
    opacity: 0.85;
}
.ta-slot-card.ta-slot-cancelled {
    opacity: 0.6;
}
.ta-slot-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
    flex-wrap: wrap;
}
.ta-slot-title {
    font-weight: 600;
    font-size: var(--font-size-body);
    color: var(--color-text, #111827);
}
.ta-slot-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    font-size: var(--font-size-body);
    color: var(--color-text-light, #6B7280);
    margin-bottom: 6px;
}
.ta-slot-desc {
    font-size: var(--font-size-body);
    color: var(--color-text-light, #6B7280);
    margin: 6px 0;
}
.ta-slot-actions {
    margin-top: 10px;
    display: flex;
    align-items: center;
    gap: 8px;
}
/* TA manager search result items */
#notifTaManagerResults > div {
    transition: background-color 0.15s ease-out;
}
#notifTaManagerResults > div:hover {
    background: var(--color-bg);
}
#notifTaManagerResults > div:last-child {
    border-bottom: none;
}

.ta-section-heading {
    font-size: var(--font-size-body);
    font-weight: 600;
    margin-bottom: 12px;
    color: var(--color-text, #111827);
}
.hr-settings-section-heading {
    margin: 24px 0 12px;
}
.ta-stats-row {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    margin-top: 12px;
}
.ta-stat-box {
    flex: 1;
    min-width: 100px;
    background: var(--color-bg, #F9FAFB);
    border: 1px solid var(--color-border, #E5E7EB);
    border-radius: 8px;
    padding: 14px 16px;
    text-align: center;
}
.ta-stat-value {
    font-size: var(--font-size-heading);
    font-weight: 700;
    color: var(--color-primary, #0f766e);
    margin-bottom: 4px;
}
.ta-stat-label {
    font-size: var(--font-size-label);
    color: var(--color-text-light, #6B7280);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.ta-applicant-row {
    padding: 6px 0;
    border-bottom: 1px solid var(--color-border, #F3F4F6);
    font-size: var(--font-size-body);
}
.ta-applicant-row:last-child {
    border-bottom: none;
}

/* TA location chips */
.ta-location-add-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
}
.ta-location-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 4px;
}
.ta-location-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: var(--color-primary);
    color: #fff;
    border-radius: 999px;
    padding: 4px 12px 4px 14px;
    font-size: var(--font-size-body);
    font-weight: 500;
}
.ta-location-chip-remove {
    background: none;
    border: none;
    cursor: pointer;
    color: inherit;
    font-size: var(--font-size-body);
    line-height: 1;
    padding: 0;
    opacity: 0.6;
}
.ta-location-chip-remove:hover {
    opacity: 1;
}

/* ============================================================
   Accessibility — Reduced Motion
   ============================================================ */
/* ============================================================
   My Family — Redesigned
   ============================================================ */

.constellation-root {
    position: relative;
}

.family-canvas {
    background: var(--color-bg);
    border-radius: 10px;
    border: 1px solid var(--color-border);
    overflow: hidden;
}


.constellation-wrap {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 55vh;
    padding: 40px 0;
    gap: 36px;
}

.constellation-empty {
    text-align: center;
    padding: 32px 0;
}

.constellation-node.no-anim {
    animation: none;
    opacity: 1;
}

.constellation-row {
    display: flex;
    gap: 44px;
    justify-content: center;
    align-items: flex-start;
}

.constellation-node {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
    opacity: 0;
    animation: nodeIn 0.4s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.node-circle {
    width: 132px;
    height: 132px;
    border-radius: 50%;
    overflow: hidden;
    transition: transform 0.18s cubic-bezier(0.22, 1, 0.36, 1),
                box-shadow 0.18s ease;
    box-shadow: 0 4px 18px rgba(107, 76, 138, 0.12);
}

[data-theme="dark"] .node-circle {
    box-shadow: 0 4px 18px rgba(0, 0, 0, 0.35);
}


.constellation-node:not(.constellation-node--self):active .node-circle {
    transform: scale(0.91);
}

@media (hover: hover) {
    .constellation-node:not(.constellation-node--self):hover .node-circle {
        transform: translateY(-3px) scale(1.04);
        box-shadow: 0 10px 28px rgba(107, 76, 138, 0.18);
    }
}

.node-circle img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.node-circle-initials {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(145deg, var(--color-primary-light) 0%, var(--color-primary-dark) 100%);
    color: #fff;
    font-size: 2.4rem;
    font-weight: 700;
    letter-spacing: 0.02em;
}

.node-name {
    font-size: var(--font-size-label);
    font-weight: 600;
    color: var(--color-text);
    text-align: center;
    max-width: 96px;
    line-height: 1.35;
    letter-spacing: 0.01em;
}

.node-sub {
    font-size: var(--font-size-small);
    color: var(--color-text-light);
    text-align: center;
    margin-top: -5px;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.constellation-empty p {
    font-size: var(--font-size-body);
    margin: 4px 0 0;
    color: var(--color-text-light);
}


@keyframes nodeIn {
    from { opacity: 0; transform: scale(0.72); }
    to   { opacity: 1; transform: scale(1); }
}

@keyframes nodeHop {
    0%   { transform: translate(var(--hop-dx), var(--hop-dy)) scale(1); }
    45%  { transform: translate(calc(var(--hop-dx) * 0.5), calc(var(--hop-dy) * 0.5)) scale(1.18); }
    100% { transform: translate(0px, 0px) scale(1); }
}


@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* ============================================================
   Vendor Chat
   ============================================================ */

.vendor-chat-root {
    display: flex;
    height: calc(100vh - 120px);
    min-height: 400px;
    background: var(--color-bg);
    border-radius: 16px;
    border: 1px solid var(--color-border);
    overflow: hidden;
}

/* Sidebar — family list */
.vendor-chat-sidebar {
    width: 280px;
    min-width: 220px;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    border-right: 1px solid var(--color-border);
    background: var(--color-surface);
}

.vendor-chat-sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    border-bottom: 1px solid var(--color-border);
    gap: 10px;
}

.vendor-chat-sidebar-header h2 {
    font-size: var(--font-size-body);
    font-weight: 700;
    margin: 0;
    white-space: nowrap;
}

.vendor-family-list {
    flex: 1;
    overflow-y: auto;
}

.vendor-family-item {
    padding: 12px 16px;
    cursor: pointer;
    border-bottom: 1px solid var(--color-border);
    transition: background 0.15s;
}

.vendor-family-item:hover { background: var(--color-hover); }
.vendor-family-item.active { background: var(--color-primary-light, rgba(100,200,180,0.12)); }

.vendor-family-item-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 3px;
}

.vendor-family-name {
    font-weight: 600;
    font-size: var(--font-size-body);
    color: var(--color-text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 140px;
}

.vendor-family-time {
    font-size: var(--font-size-small);
    color: var(--color-text-light);
    white-space: nowrap;
}

.vendor-family-preview {
    font-size: var(--font-size-label);
    color: var(--color-text-light);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.vendor-window-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    background: var(--color-primary);
    color: #fff;
    border-radius: 9px;
    font-size: var(--font-size-small);
    font-weight: 700;
}

/* Thread panel */
.vendor-chat-thread {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    background: var(--color-bg);
}

.vendor-chat-thread-empty {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}

.vendor-chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.vendor-chat-no-messages {
    text-align: center;
    padding: 32px;
    font-size: var(--font-size-body);
}

/* Message bubbles */
.vendor-msg { display: flex; flex-direction: column; max-width: 72%; }
.vendor-msg-out { align-self: flex-end; align-items: flex-end; }
.vendor-msg-in  { align-self: flex-start; align-items: flex-start; }

.vendor-msg-bubble {
    padding: 9px 13px;
    border-radius: 14px;
    font-size: var(--font-size-body);
    line-height: 1.45;
    word-break: break-word;
    white-space: pre-wrap;
}

.vendor-msg-out .vendor-msg-bubble {
    background: var(--color-primary);
    color: #fff;
    border-bottom-right-radius: 4px;
}

.vendor-msg-in .vendor-msg-bubble {
    background: var(--color-surface);
    color: var(--color-text);
    border: 1px solid var(--color-border);
    border-bottom-left-radius: 4px;
}

.vendor-msg-meta {
    font-size: var(--font-size-small);
    color: var(--color-text-light);
    margin-top: 3px;
    padding: 0 2px;
}

.vendor-msg-sender { font-weight: 600; }

/* Compose bar */
.vendor-chat-compose {
    border-top: 1px solid var(--color-border);
    padding: 10px 14px;
    background: var(--color-surface);
}

.vendor-chat-compose-row {
    display: flex;
    gap: 8px;
    align-items: flex-end;
}

.vendor-chat-input {
    flex: 1;
    padding: 9px 12px;
    border: 1px solid var(--color-border);
    border-radius: 10px;
    background: var(--color-bg);
    color: var(--color-text);
    font-size: var(--font-size-body);
    resize: none;
    min-height: 38px;
    max-height: 120px;
    line-height: 1.4;
    font-family: inherit;
}

.vendor-chat-input:focus { outline: none; border-color: var(--color-primary); }

/* Window info banner */
.vendor-window-info {
    font-size: var(--font-size-small);
    text-align: center;
    padding: 5px 10px;
    border-radius: 6px;
    margin-bottom: 8px;
}

.vendor-window-open   { background: rgba(46,158,94,0.12); color: var(--color-success); }
.vendor-window-closed { background: rgba(255,165,0,0.12); color: #b36b00; }

/* Mobile */
@media (max-width: 600px) {
    .vendor-chat-root { flex-direction: column; height: auto; min-height: 0; }
    .vendor-chat-sidebar { width: 100%; border-right: none; border-bottom: 1px solid var(--color-border); max-height: 220px; }
    .vendor-chat-thread { min-height: 300px; }
}
