* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --dark-blue: #0b3d91;
    --light-blue: #116dff;
    --white: #ffffff;
    --light-bg: #f0f5ff;
    --success: #28a745;
    --danger: #dc3545;
    --warning: #ffc107;
    --info: #17a2b8;
    --primary-hover: #0a2f6e;
    --border-radius: 10px;
    --shadow: 0 2px 8px rgba(0,0,0,0.08);
    --shadow-lg: 0 4px 16px rgba(0,0,0,0.12);
}

/* Accessibility: Skip to content link */
.skip-link {
    position: absolute;
    top: -40px;
    left: 0;
    background: var(--dark-blue);
    color: white;
    padding: 8px 16px;
    z-index: 10000;
    transition: top 0.2s;
    font-size: 0.9rem;
    text-decoration: none;
}
.skip-link:focus {
    top: 0;
}

/* Accessibility: Focus outlines */
*:focus-visible {
    outline: 2px solid var(--light-blue);
    outline-offset: 2px;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: var(--light-bg);
    color: #333;
    line-height: 1.6;
}

.navbar {
    background: var(--dark-blue);
    color: var(--white);
    padding: 1rem 0;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

.nav-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.nav-brand {
    font-size: 1.5rem;
    font-weight: bold;
    color: var(--white);
    text-decoration: none;
}

.nav-links {
    display: flex;
    gap: 0.25rem;
    align-items: center;
    flex-wrap: nowrap;
}

.nav-links a {
    color: var(--white);
    text-decoration: none;
    padding: 0.4rem 0.6rem;
    border-radius: 4px;
    transition: background 0.3s;
    font-size: 0.88rem;
    white-space: nowrap;
}

.nav-links a:hover {
    background: var(--light-blue);
}

.nav-toggle {
    display: none;
    background: none;
    border: none;
    color: var(--white);
    font-size: 1.6rem;
    cursor: pointer;
    padding: 0.25rem 0.5rem;
    line-height: 1;
}

/* ─── Nav Dropdowns ─── */
.nav-dropdown {
    position: relative;
}

.nav-dropdown > .nav-dropdown-toggle {
    color: var(--white);
    text-decoration: none;
    padding: 0.4rem 0.6rem;
    border-radius: 4px;
    transition: background 0.3s;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: none;
    border: none;
    font: inherit;
    font-size: 0.88rem;
    white-space: nowrap;
}

.nav-dropdown > .nav-dropdown-toggle::after {
    content: '\25BE';
    font-size: 0.7em;
    margin-left: 2px;
}

.nav-dropdown > .nav-dropdown-toggle:hover {
    background: var(--light-blue);
}

.nav-dropdown-menu {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    background: var(--dark-blue);
    min-width: 180px;
    border-radius: 0 0 6px 6px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
    z-index: 1000;
    padding: 4px 0;
}

.nav-dropdown:hover > .nav-dropdown-menu,
.nav-dropdown:focus-within > .nav-dropdown-menu {
    display: block;
}

.nav-dropdown-menu a {
    display: block;
    color: var(--white);
    text-decoration: none;
    padding: 0.5rem 1rem;
    white-space: nowrap;
    transition: background 0.2s;
}

.nav-dropdown-menu a:hover {
    background: var(--light-blue);
}

.nav-separator {
    color: rgba(255,255,255,0.5);
    padding: 0 0.2rem;
    user-select: none;
}

.flash-messages {
    max-width: 1200px;
    margin: 1rem auto;
    padding: 0 2rem;
}

.alert {
    padding: 1rem;
    margin-bottom: 1rem;
    border-radius: 5px;
    border-left: 4px solid;
}

.alert-success {
    background: #d4edda;
    border-color: var(--success);
    color: #155724;
}

.alert-danger {
    background: #f8d7da;
    border-color: var(--danger);
    color: #721c24;
}

.alert-warning {
    background: #fff3cd;
    border-color: var(--warning);
    color: #856404;
}

.alert-info {
    background: #d1ecf1;
    border-color: var(--info);
    color: #0c5460;
}

.main-content {
    max-width: 1200px;
    margin: 2rem auto;
    padding: 0 2rem;
    min-height: calc(100vh - 200px);
}

.container {
    max-width: 600px;
    margin: 40px auto;
    background: var(--white);
    padding: 2rem;
    border-radius: var(--border-radius);
    border-top: 4px solid var(--dark-blue);
    box-shadow: var(--shadow);
}

.dashboard-container {
    background: var(--white);
    padding: 2rem;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
}

h1 {
    color: var(--dark-blue);
    margin-bottom: 1rem;
}

h2 {
    color: var(--dark-blue);
    margin-top: 2rem;
    margin-bottom: 1rem;
}

h3 {
    color: var(--dark-blue);
    margin-top: 1.5rem;
    margin-bottom: 0.5rem;
    font-size: 1.2rem;
}

.welcome-text {
    color: #666;
    margin-bottom: 2rem;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: var(--light-bg);
    padding: 1.5rem;
    border-radius: 8px;
    border-left: 4px solid var(--light-blue);
    text-align: center;
}

.stat-card h3 {
    margin: 0;
    font-size: 1rem;
    color: #666;
}

.stat-number {
    font-size: 2.5rem;
    font-weight: bold;
    color: var(--dark-blue);
    margin: 0.5rem 0 0 0;
}

.employee-info-card {
    background: var(--white);
}

.info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1rem;
    margin: 1.5rem 0;
}

.info-item {
    padding: 1rem;
    background: var(--light-bg);
    border-radius: 6px;
    border-left: 3px solid var(--light-blue);
}

.info-item strong {
    display: block;
    color: var(--dark-blue);
    margin-bottom: 0.5rem;
}

.info-item span {
    color: #333;
}

label {
    display: block;
    margin-bottom: 0.5rem;
    color: var(--dark-blue);
    font-weight: 500;
}

input, select, textarea {
    width: 100%;
    padding: 0.75rem;
    margin-bottom: 1rem;
    font-size: 16px;
    border: 2px solid var(--light-blue);
    border-radius: 5px;
    transition: border-color 0.3s;
}

input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--dark-blue);
}

.btn {
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    text-decoration: none;
    display: inline-block;
    transition: all 0.3s;
    font-weight: 500;
}

.btn-primary {
    background: var(--dark-blue);
    color: var(--white);
}

.btn-primary:hover {
    background: var(--light-blue);
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
}

.btn-secondary {
    background: #6c757d;
    color: var(--white);
}

.btn-secondary:hover {
    background: #5a6268;
}

.btn-warning {
    background: var(--warning);
    color: #333;
}

.btn-warning:hover {
    background: #e0a800;
}

.btn-danger {
    background: var(--danger);
    color: var(--white);
}

.btn-danger:hover {
    background: #c82333;
}

.btn-small {
    padding: 0.4rem 0.8rem;
    font-size: 0.875rem;
}

button[type="submit"] {
    width: 100%;
    background: var(--dark-blue);
    color: var(--white);
    padding: 1rem;
    font-size: 1.1rem;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s;
    margin-top: 0.5rem;
}

button[type="submit"]:hover {
    background: var(--light-blue);
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
}

.action-section {
    margin: 2rem 0;
    text-align: center;
}

.action-buttons {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.form-footer {
    text-align: center;
    margin-top: 1.5rem;
    padding-top: 1rem;
    border-top: 1px solid #ddd;
}

.form-footer a {
    color: var(--light-blue);
    text-decoration: none;
}

.form-footer a:hover {
    color: var(--dark-blue);
    text-decoration: underline;
}

.table-container {
    overflow-x: auto;
    margin-top: 1rem;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--white);
}

.data-table thead {
    background: var(--dark-blue);
    color: var(--white);
}

.data-table th,
.data-table td {
    padding: 1rem;
    text-align: left;
    border-bottom: 1px solid #ddd;
}

.data-table tbody tr:hover {
    background: var(--light-bg);
}

.id-card-container {
    text-align: center;
    padding: 1rem;
    max-width: 1200px;
    margin: 0 auto;
}

.id-card-image {
    width: 100%;
    max-width: 1000px;
    height: auto;
    border: 3px solid var(--dark-blue);
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.2);
    margin-bottom: 2rem;
    cursor: zoom-in;
    transition: transform 0.3s ease;
}

.id-card-image:hover {
    transform: scale(1.02);
}

.id-card-image.zoomed {
    cursor: zoom-out;
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(1.5);
    max-width: 95vw;
    max-height: 95vh;
    z-index: 9999;
    background: white;
    padding: 10px;
}

.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.5);
}

.modal-content {
    background-color: var(--white);
    margin: 10% auto;
    padding: 2rem;
    border: 1px solid #888;
    width: 90%;
    max-width: 500px;
    border-radius: 12px;
    border-top: 10px solid var(--dark-blue);
}

.close {
    color: #aaa;
    float: right;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
}

.close:hover,
.close:focus {
    color: #000;
}

footer {
    background: var(--dark-blue);
    color: var(--white);
    text-align: center;
    padding: 1.5rem 0;
    margin-top: 3rem;
}

/* prevent any horizontal scroll on the whole app */
body { overflow-x: hidden; }

@media (max-width: 1100px) {
    .nav-container {
        flex-wrap: wrap;
        padding: 0.5rem 1rem;
    }

    .nav-brand {
        font-size: 1.2rem;
    }

    .nav-toggle {
        display: block;
    }

    .nav-links {
        display: none;
        flex-direction: column;
        gap: 0;
        width: 100%;
        order: 3;
        padding-top: 0.5rem;
    }

    .nav-links.open {
        display: flex;
    }

    .nav-links a {
        text-align: center;
        padding: 0.6rem;
        border-top: 1px solid rgba(255,255,255,0.1);
        font-size: 1rem;
    }

    .nav-dropdown {
        width: 100%;
    }

    .nav-dropdown > .nav-dropdown-toggle {
        width: 100%;
        text-align: center;
        padding: 0.6rem;
        border-top: 1px solid rgba(255,255,255,0.1);
        justify-content: center;
    }

    .nav-dropdown-menu {
        position: static;
        box-shadow: none;
        background: rgba(0,0,0,0.2);
        border-radius: 0;
    }

    .nav-dropdown-menu a {
        text-align: center;
        padding: 0.5rem;
        font-size: 0.9em;
    }
}

@media (max-width: 768px) {
    body {
        font-size: 14px;
    }

    .main-content {
        padding: 0 1rem;
    }

    .container {
        padding: 1.5rem;
        margin: 20px auto;
        width: 95%;
    }

    .dashboard-container {
        padding: 1.5rem;
    }

    h1 {
        font-size: 1.5rem;
    }

    h2 {
        font-size: 1.3rem;
    }

    .stats-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .info-grid {
        grid-template-columns: 1fr;
    }

    .action-section {
        display: flex;
        flex-direction: column;
        gap: 0.75rem;
    }

    .action-section .btn {
        width: 100%;
    }

    .action-buttons {
        flex-direction: column;
        gap: 0.5rem;
    }

    .action-buttons .btn-small,
    .action-buttons a {
        width: 100%;
        text-align: center;
    }

    .action-buttons form {
        width: 100%;
    }

    .action-buttons form button {
        width: 100%;
    }

    .table-container {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .data-table {
        font-size: 0.75rem;
        min-width: 600px;
    }

    .data-table th,
    .data-table td {
        padding: 0.4rem;
        white-space: nowrap;
    }

    .modal-content {
        width: 95%;
        margin: 5% auto;
        padding: 1.5rem;
    }

    .id-card-container {
        padding: 0;
        margin: 0;
    }

    .id-card-image {
        width: 100%;
        max-width: 100%;
        height: auto;
        object-fit: contain;
        border-radius: 0;
    }

    .id-card-image.zoomed {
        position: fixed !important;
        top: 50% !important;
        left: 50% !important;
        transform: translate(-50%, -50%) scale(1.8) !important;
        max-width: none !important;
        max-height: none !important;
        width: 95vw !important;
        height: auto !important;
        z-index: 99999 !important;
        background: white !important;
        padding: 5px !important;
        box-shadow: 0 0 50px rgba(0,0,0,0.8) !important;
    }

    input, select, textarea {
        font-size: 16px;
    }

    .btn {
        padding: 0.75rem 1rem;
        font-size: 1rem;
        width: 100%;
        margin-bottom: 0.5rem;
    }

    .chat-container .btn {
        width: auto;
        margin-bottom: 0;
    }

    .form-footer {
        margin-top: 1rem;
    }
}

@media (max-width: 480px) {
    .nav-brand {
        font-size: 1rem;
    }

    h1 {
        font-size: 1.3rem;
    }

    .stat-number {
        font-size: 2rem;
    }

    .data-table {
        font-size: 0.7rem;
    }
}

/* ==================== CHAT STYLES ==================== */

/* Override main-content constraints for chat page */
.main-content:has(.chat-container) {
    max-width: 100%;
    margin: 0;
    padding: 0;
    min-height: auto;
}

.chat-container {
    display: flex;
    height: calc(100vh - 60px);
    height: calc(100dvh - 60px);
    background: var(--white);
    border-radius: 0;
    overflow: hidden;
    box-shadow: none;
    margin: 0;
    max-width: 100%;
    width: 100%;
}

/* Sidebar */
.chat-sidebar {
    width: 320px;
    border-right: 1px solid #e0e0e0;
    display: flex;
    flex-direction: column;
    background: #fafbfc;
    flex-shrink: 0;
}

.chat-sidebar-header {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid #e0e0e0;
    background: var(--dark-blue);
    color: var(--white);
}

.chat-company-logo {
    width: 100%;
    text-align: center;
    margin-bottom: 0.5rem;
}

.chat-company-logo img {
    max-height: 40px;
    max-width: 100%;
    object-fit: contain;
    border-radius: 4px;
}

.chat-company-name {
    width: 100%;
    text-align: center;
    font-size: 0.75rem;
    opacity: 0.8;
    margin-bottom: 0.25rem;
}

.chat-sidebar-header h3 {
    margin: 0;
    font-size: 1.1rem;
}

.chat-actions {
    display: flex;
    gap: 0.5rem;
}

.chat-actions .btn-sm {
    font-size: 0.75rem;
    padding: 0.25rem 0.5rem;
    background: rgba(255,255,255,0.2);
    color: var(--white);
    border: 1px solid rgba(255,255,255,0.3);
    border-radius: 4px;
    cursor: pointer;
}

.chat-actions .btn-sm:hover {
    background: rgba(255,255,255,0.3);
}

.chat-search {
    padding: 0.5rem;
    border-bottom: 1px solid #e0e0e0;
}

.chat-search input {
    width: 100%;
    padding: 0.5rem;
    border: 1px solid #ddd;
    border-radius: 20px;
    font-size: 0.9rem;
    outline: none;
}

.chat-search input:focus {
    border-color: var(--light-blue);
}

.chat-room-list {
    flex: 1;
    overflow-y: auto;
}

.chat-room-item {
    display: flex;
    align-items: center;
    padding: 0.75rem 1rem;
    cursor: pointer;
    border-bottom: 1px solid #f0f0f0;
    transition: background 0.2s;
    gap: 0.75rem;
}

.chat-room-item:hover {
    background: var(--light-bg);
}

.chat-room-item.active {
    background: var(--light-bg);
    border-left: 3px solid var(--dark-blue);
}

.chat-room-item.has-unread .room-name {
    font-weight: bold;
}

.room-avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--dark-blue);
    color: var(--white);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 1.1rem;
    flex-shrink: 0;
    position: relative;
}

.room-avatar .avatar-img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
}

.online-dot {
    position: absolute;
    bottom: 0;
    right: 0;
    width: 12px;
    height: 12px;
    background: var(--success);
    border-radius: 50%;
    border: 2px solid var(--white);
}

.online-dot-small {
    position: absolute;
    bottom: 0;
    right: 0;
    width: 10px;
    height: 10px;
    background: var(--success);
    border-radius: 50%;
    border: 2px solid var(--white);
}

.room-info {
    flex: 1;
    min-width: 0;
}

.room-name {
    font-size: 0.95rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.lock-icon {
    font-size: 0.8rem;
}

.room-preview {
    font-size: 0.8rem;
    color: #888;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.unread-badge {
    background: var(--danger);
    color: var(--white);
    border-radius: 10px;
    padding: 2px 8px;
    font-size: 0.75rem;
    font-weight: bold;
    flex-shrink: 0;
}

.chat-empty-sidebar {
    padding: 2rem 1rem;
    text-align: center;
    color: #999;
}

/* Main Chat Area */
.chat-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    background: #f5f6fa;
}

.chat-placeholder {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: #999;
    text-align: center;
    padding: 2rem;
}

.chat-placeholder h3 {
    margin-bottom: 0.5rem;
    color: var(--dark-blue);
}

.chat-active-room {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.chat-room-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.6rem 1rem;
    border-bottom: 1px solid #e0e0e0;
    background: var(--white);
}

.chat-room-header-left {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.chat-room-header-left h3 {
    margin: 0;
    font-size: 1.05rem;
}

.chat-room-header-left small {
    color: #888;
    font-size: 0.8rem;
}

.chat-room-header-right {
    display: flex;
    gap: 0.25rem;
}

.chat-room-search {
    display: flex;
    align-items: center;
    padding: 0.5rem;
    gap: 0.5rem;
    border-bottom: 1px solid #e0e0e0;
    background: var(--white);
}

.chat-room-search input {
    flex: 1;
    padding: 0.4rem 0.75rem;
    border: 1px solid #ddd;
    border-radius: 20px;
    font-size: 0.9rem;
}

.typing-indicator {
    padding: 0.25rem 1rem;
    font-size: 0.8rem;
    color: var(--light-blue);
    font-style: italic;
    background: var(--white);
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.loading {
    text-align: center;
    color: #999;
    padding: 2rem;
}

/* Messages */
.chat-message {
    max-width: 75%;
    padding: 0.5rem 0.75rem;
    border-radius: 12px;
    word-wrap: break-word;
    position: relative;
    line-height: 1.4;
}

.chat-message.mine {
    align-self: flex-end;
    background: var(--dark-blue);
    color: var(--white);
    border-bottom-right-radius: 4px;
}

.chat-message.theirs {
    align-self: flex-start;
    background: var(--white);
    color: #333;
    border-bottom-left-radius: 4px;
    box-shadow: 0 1px 2px rgba(0,0,0,0.08);
}

.chat-message.system {
    align-self: center;
    background: transparent;
    color: #999;
    font-size: 0.8rem;
    font-style: italic;
    text-align: center;
    max-width: 90%;
}

.msg-sender {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    font-size: 0.75rem;
    font-weight: bold;
    color: var(--light-blue);
    margin-bottom: 2px;
}

.msg-avatar-small {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    object-fit: cover;
}

.msg-content {
    white-space: pre-wrap;
    word-break: break-word;
}

.msg-time {
    display: block;
    font-size: 0.65rem;
    opacity: 0.7;
    text-align: right;
    margin-top: 2px;
}

.mine .msg-time {
    color: rgba(255,255,255,0.7);
}

.read-ticks {
    font-size: 0.7rem;
}

.read-ticks.blue {
    color: #4fc3f7;
}

.mine .read-ticks.blue {
    color: #90caf9;
}

.hidden-badge {
    display: inline-block;
    background: var(--warning);
    color: #333;
    font-size: 0.65rem;
    padding: 1px 6px;
    border-radius: 4px;
    font-weight: bold;
    margin-bottom: 4px;
}

/* Reply quote */
.reply-quote {
    background: rgba(0,0,0,0.1);
    border-left: 3px solid var(--light-blue);
    padding: 0.25rem 0.5rem;
    margin-bottom: 0.25rem;
    border-radius: 4px;
    font-size: 0.8rem;
}

.reply-quote strong {
    display: block;
    font-size: 0.7rem;
    color: var(--light-blue);
}

.mine .reply-quote {
    background: rgba(255,255,255,0.15);
}

/* Attachments */
.msg-attachment {
    margin-top: 4px;
}

.chat-image {
    max-width: 250px;
    max-height: 200px;
    border-radius: 8px;
    cursor: pointer;
    object-fit: cover;
}

.file-link {
    color: var(--light-blue);
    text-decoration: none;
    font-size: 0.85rem;
}

.mine .file-link {
    color: rgba(255,255,255,0.9);
}

/* Reactions */
.msg-reactions {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-top: 4px;
}

.reaction-chip {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    background: rgba(0,0,0,0.06);
    border-radius: 12px;
    padding: 2px 8px;
    font-size: 0.75rem;
    cursor: pointer;
    border: 1px solid transparent;
}

.reaction-chip:hover {
    background: rgba(0,0,0,0.1);
}

.reaction-chip.reaction-mine {
    border-color: var(--light-blue);
    background: rgba(77,163,255,0.15);
}

.mine .reaction-chip {
    background: rgba(255,255,255,0.2);
}

/* Message actions (hover) */
.msg-actions {
    display: none;
    position: absolute;
    top: -8px;
    right: 8px;
    background: var(--white);
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
    padding: 2px;
    z-index: 10;
}

.chat-message:hover .msg-actions {
    display: flex;
}

.msg-actions button {
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px 6px;
    font-size: 0.85rem;
    border-radius: 4px;
}

.msg-actions button:hover {
    background: var(--light-bg);
}

/* Input area */
.reply-preview {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.5rem 1rem;
    background: var(--light-bg);
    border-top: 1px solid #e0e0e0;
    border-left: 3px solid var(--light-blue);
}

.reply-preview-content {
    flex: 1;
    min-width: 0;
}

.reply-preview-content strong {
    font-size: 0.8rem;
    color: var(--light-blue);
    display: block;
}

.reply-preview-content span {
    font-size: 0.85rem;
    color: #666;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: block;
}

.chat-attachment-preview {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: var(--light-bg);
    border-top: 1px solid #e0e0e0;
    font-size: 0.85rem;
}

.chat-input-area {
    border-top: 1px solid #e0e0e0;
    padding: 0.5rem 0.75rem;
    background: var(--white);
}

/* Reset global form styles inside chat area */
.chat-input-area input,
.chat-input-area textarea {
    width: auto;
    margin-bottom: 0;
}
.chat-room-search input {
    margin-bottom: 0;
}

.chat-input-row {
    display: flex;
    align-items: flex-end;
    gap: 0.5rem;
}

.chat-input-row textarea {
    flex: 1;
    width: auto;
    min-width: 0;
    resize: none;
    min-height: 38px;
    max-height: 120px;
    padding: 0.5rem 0.75rem;
    margin-bottom: 0;
    font-size: 0.95rem;
    border: 1px solid #ddd;
    border-radius: 20px;
    outline: none;
    font-family: inherit;
    line-height: 1.4;
}

.chat-input-row textarea:focus {
    border-color: var(--light-blue);
}

.btn-send {
    border-radius: 20px;
    padding: 0.5rem 1.25rem;
    height: 38px;
    background: var(--dark-blue);
    color: var(--white);
    border: none;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 500;
}

.btn-send:hover {
    background: var(--light-blue);
}

.btn-send:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-icon {
    background: none;
    border: none;
    font-size: 1.2rem;
    cursor: pointer;
    padding: 0.25rem 0.4rem;
    color: #666;
    border-radius: 4px;
}

.btn-icon:hover {
    background: var(--light-bg);
    color: var(--dark-blue);
}

/* ─── Voice Call ─── */
.call-btn { color: #22c55e !important; }
.call-btn:hover { background: #dcfce7 !important; }

.call-modal {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.7); z-index: 2000;
    display: flex; align-items: center; justify-content: center;
}
.call-modal-card {
    background: #1a1a2e; color: #fff; border-radius: 20px;
    padding: 2.5rem 2rem; text-align: center; width: 300px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.5);
}
.call-avatar {
    font-size: 4rem; width: 90px; height: 90px;
    background: #334155; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    margin: 0 auto 1rem;
}
.call-modal-card h3 { margin: 0 0 0.25rem; font-size: 1.3rem; }
.call-status { color: #94a3b8; margin: 0 0 2rem; font-size: 0.95rem; }
.call-actions { display: flex; justify-content: center; gap: 1.5rem; }
.call-btn-accept, .call-btn-end, .call-btn-mute {
    width: 56px; height: 56px; border-radius: 50%; border: none;
    font-size: 1.5rem; cursor: pointer; display: flex;
    align-items: center; justify-content: center;
}
.call-btn-accept { background: #22c55e; color: #fff; }
.call-btn-accept:hover { background: #16a34a; }
.call-btn-end { background: #ef4444; color: #fff; }
.call-btn-end:hover { background: #dc2626; }
.call-btn-mute { background: #334155; color: #fff; }
.call-btn-mute:hover { background: #475569; }

@keyframes call-pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(34,197,94,0.4); }
    50% { box-shadow: 0 0 0 15px rgba(34,197,94,0); }
}
.call-btn-accept { animation: call-pulse 2s infinite; }

/* Group Call Overlay (Twilio audio conference) */
.group-call-overlay {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0, 0, 0, 0.7); z-index: 2500;
    display: flex; align-items: center; justify-content: center;
}
.group-call-card {
    background: #fff; border-radius: 16px; padding: 2rem;
    text-align: center; min-width: 300px; max-width: 400px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
}
.group-call-card h3 { margin: 0 0 1.5rem; font-size: 1.2rem; color: #1e293b; }
.group-call-participants { margin-bottom: 1.5rem; }
.group-call-participant {
    display: flex; align-items: center; gap: 8px;
    padding: 8px 12px; border-radius: 8px; margin-bottom: 4px;
    background: #f1f5f9; font-size: 0.95rem; color: #334155;
}
.group-call-actions { display: flex; justify-content: center; gap: 12px; }

.call-join-banner {
    display: flex; align-items: center; justify-content: center;
    gap: 12px; padding: 14px 20px; margin: 0;
    background: linear-gradient(135deg, #dcfce7, #bbf7d0); border-bottom: 2px solid #86efac;
    font-size: 1rem; color: #166534; font-weight: 600;
    animation: call-pulse-banner 2s infinite;
    position: sticky; top: 0; z-index: 100;
}
@keyframes call-pulse-banner {
    0%, 100% { box-shadow: 0 0 0 0 rgba(34,197,94,0.3); }
    50% { box-shadow: 0 0 0 8px rgba(34,197,94,0); }
}
.call-indicator { margin-left: 6px; font-size: 0.75rem; }

.attach-btn {
    cursor: pointer;
    font-size: 1.3rem;
    color: #666;
}

.chat-locked-notice {
    text-align: center;
    font-size: 0.8rem;
    color: var(--danger);
    margin-top: 0.25rem;
    font-style: italic;
}

/* Emoji picker - styles moved to bottom of chat section */

/* User search results */
.user-search-results {
    max-height: 200px;
    overflow-y: auto;
    border: 1px solid #eee;
    border-radius: 8px;
    margin-top: 0.5rem;
}

.user-result {
    padding: 0.6rem 0.75rem;
    cursor: pointer;
    border-bottom: 1px solid #f0f0f0;
    transition: background 0.2s;
}

.user-result:hover {
    background: var(--light-bg);
}

.user-result:last-child {
    border-bottom: none;
}

.user-result strong {
    display: block;
    font-size: 0.9rem;
}

.user-result span {
    font-size: 0.8rem;
    color: #666;
}

.user-result small {
    font-size: 0.75rem;
    color: var(--success);
}

.user-result.user-online {
    border-left: 3px solid var(--success);
}

.selected-members {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.75rem;
}

.selected-member-tag {
    background: var(--light-bg);
    border: 1px solid var(--light-blue);
    border-radius: 16px;
    padding: 0.25rem 0.75rem;
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.selected-member-tag button {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 0.9rem;
    color: #999;
    padding: 0;
}

/* Room info modal members */
.member-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem 0;
    border-bottom: 1px solid #f0f0f0;
}

.member-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--dark-blue);
    color: var(--white);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 0.9rem;
    flex-shrink: 0;
    position: relative;
}

.avatar-img-sm {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
}

.member-info {
    flex: 1;
}

.member-info strong {
    font-size: 0.9rem;
}

.member-info small {
    color: #888;
}

.role-badge {
    display: inline-block;
    font-size: 0.65rem;
    padding: 1px 6px;
    border-radius: 4px;
    font-weight: 600;
}

.role-badge.admin {
    background: var(--dark-blue);
    color: var(--white);
}

.role-badge.manager {
    background: var(--info);
    color: var(--white);
}

/* Chat modals */
.chat-container .modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 300;
}

.chat-container .modal-content {
    background: var(--white);
    border-radius: 12px;
    width: 90%;
    max-width: 450px;
    max-height: 80vh;
    overflow-y: auto;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    border-bottom: 1px solid #eee;
}

.modal-header h3 {
    margin: 0;
}

.modal-body {
    padding: 1rem;
}

.modal-body label {
    display: block;
    font-weight: 600;
    margin-bottom: 0.25rem;
    margin-top: 0.75rem;
    font-size: 0.85rem;
}

.modal-body label:first-child {
    margin-top: 0;
}

.modal-body input[type="text"] {
    width: 100%;
    padding: 0.5rem 0.75rem;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 0.9rem;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
    padding: 1rem;
    border-top: 1px solid #eee;
}

/* Sidebar toggle (mobile) */
.chat-sidebar-toggle {
    display: none;
    position: fixed;
    bottom: 20px;
    left: 20px;
    z-index: 100;
    background: var(--dark-blue);
    color: var(--white);
    border: none;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    font-size: 1.5rem;
    cursor: pointer;
    box-shadow: 0 4px 8px rgba(0,0,0,0.3);
}

.sidebar-toggle-back {
    display: none;
}

/* Nav badge for chat */
.nav-badge {
    background: var(--danger);
    color: var(--white);
    border-radius: 10px;
    padding: 1px 6px;
    font-size: 0.65rem;
    margin-left: 4px;
    vertical-align: super;
}

/* Mobile responsive */
@media (max-width: 768px) {
    .chat-container {
        height: calc(100vh - 70px);
        height: calc(100dvh - 70px);
        border-radius: 0;
    }

    .chat-sidebar {
        position: fixed;
        left: -320px;
        top: 0;
        bottom: 0;
        z-index: 200;
        transition: left 0.3s ease;
        box-shadow: 2px 0 10px rgba(0,0,0,0.2);
        width: 300px;
    }

    .chat-sidebar.open {
        left: 0;
    }

    .chat-sidebar-toggle {
        display: block;
    }

    .sidebar-toggle-back {
        display: inline;
    }

    .chat-message {
        max-width: 85%;
    }

    .chat-image {
        max-width: 200px;
    }

    .chat-input-area {
        padding: 0.4rem;
    }

    .chat-input-row {
        gap: 0.3rem;
    }

    .chat-input-row textarea {
        min-height: 36px;
        padding: 0.4rem 0.6rem;
        font-size: 16px;
    }

    .btn-send {
        padding: 0.4rem 0.75rem;
        height: 36px;
        font-size: 0.85rem;
        white-space: nowrap;
    }

    .attach-btn {
        font-size: 1.2rem;
        padding: 0.25rem;
    }

    .modal-content {
        width: 95% !important;
        max-width: none !important;
    }

    /* Mobile: long-press context menu */
    .context-menu {
        top: auto !important;
        bottom: 0 !important;
        left: 0 !important;
        right: 0 !important;
        border-radius: 16px 16px 0 0 !important;
        max-width: 100% !important;
        padding: 0.5rem 0 !important;
    }

    .context-menu::before {
        content: '';
        display: block;
        width: 40px;
        height: 4px;
        background: #ccc;
        border-radius: 2px;
        margin: 0.25rem auto 0.5rem;
    }
}

/* Sidebar timestamps */
.room-time {
    font-size: 0.7rem;
    color: #999;
    white-space: nowrap;
    flex-shrink: 0;
    text-align: right;
    min-width: 45px;
}

.chat-room-item.has-unread .room-time {
    color: var(--dark-blue);
    font-weight: 600;
}

/* Linkified URLs in messages */
.msg-content a {
    color: #4fc3f7;
    text-decoration: underline;
    word-break: break-all;
}

.mine .msg-content a {
    color: #bbdefb;
}

/* Image lightbox */
.lightbox-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.9);
    z-index: 500;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.lightbox-overlay img {
    max-width: 95vw;
    max-height: 90vh;
    object-fit: contain;
    border-radius: 4px;
}

.lightbox-close {
    position: absolute;
    top: 15px;
    right: 20px;
    color: white;
    font-size: 2rem;
    cursor: pointer;
    background: none;
    border: none;
    z-index: 501;
    line-height: 1;
}

/* Date separators */
.date-separator {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin: 0.75rem 0;
    align-self: stretch;
}

.date-separator::before,
.date-separator::after {
    content: '';
    flex: 1;
    border-top: 1px solid #ddd;
}

.date-separator span {
    font-size: 0.75rem;
    color: #999;
    white-space: nowrap;
    background: #f5f6fa;
    padding: 0.15rem 0.75rem;
    border-radius: 10px;
}

/* Load more spinner */
.load-more-spinner {
    text-align: center;
    padding: 0.5rem;
    color: #999;
    font-size: 0.8rem;
}

/* Mute toggle */
.mute-toggle {
    font-size: 1.1rem;
    opacity: 0.7;
}

.mute-toggle.muted {
    opacity: 0.4;
}

/* Expanded emoji picker */
.emoji-picker {
    position: fixed;
    background: var(--white);
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
    padding: 0.5rem;
    z-index: 200;
    max-width: 260px;
}

.emoji-list {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 2px;
}

.emoji-list span {
    cursor: pointer;
    font-size: 1.3rem;
    padding: 0.25rem;
    border-radius: 4px;
    transition: background 0.2s;
    text-align: center;
}

.emoji-list span:hover {
    background: var(--light-bg);
}

/* Edited label */
.edited-label {
    font-size: 0.6rem;
    font-style: italic;
    opacity: 0.6;
    margin-left: 4px;
}

/* Forwarded label */
.forwarded-label {
    display: block;
    font-size: 0.7rem;
    font-style: italic;
    color: #999;
    margin-bottom: 2px;
}

.mine .forwarded-label {
    color: rgba(255,255,255,0.6);
}

/* Edit mode indicator */
.edit-indicator {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.4rem 1rem;
    background: #fff3e0;
    border-top: 1px solid #ffe0b2;
    border-left: 3px solid #ff9800;
    font-size: 0.85rem;
    color: #e65100;
}

/* Forward modal room list */
.forward-room-list {
    max-height: 300px;
    overflow-y: auto;
}

.forward-room-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.6rem 0.5rem;
    cursor: pointer;
    border-bottom: 1px solid #f0f0f0;
    border-radius: 8px;
    transition: background 0.2s;
}

.forward-room-item:hover {
    background: var(--light-bg);
}

.forward-room-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--dark-blue);
    color: var(--white);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 0.85rem;
    flex-shrink: 0;
}

/* Context menu (long-press on mobile) */
.context-menu {
    position: fixed;
    background: var(--white);
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.25);
    z-index: 400;
    min-width: 180px;
    padding: 0.25rem 0;
    overflow: hidden;
}

.context-menu-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.7rem 1rem;
    cursor: pointer;
    font-size: 0.9rem;
    border: none;
    background: none;
    width: 100%;
    text-align: left;
}

.context-menu-item:hover {
    background: var(--light-bg);
}

.context-menu-item .cm-icon {
    font-size: 1.1rem;
    width: 24px;
    text-align: center;
}

/* Swipe reply visual */
.chat-message.swiping {
    transition: none;
}

.swipe-reply-icon {
    position: absolute;
    left: -30px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 1.2rem;
    opacity: 0;
    transition: opacity 0.2s;
    color: var(--light-blue);
}

.chat-message.swiping .swipe-reply-icon {
    opacity: 1;
}

/* ─── CARE MODULE ──────────────────────────────────────────── */

.care-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.care-subtitle {
    color: #666;
    margin-bottom: 1rem;
}

.care-filters {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

.filter-btn {
    padding: 0.4rem 1rem;
    border: 2px solid var(--dark-blue);
    background: transparent;
    color: var(--dark-blue);
    border-radius: 20px;
    cursor: pointer;
    font-size: 0.85rem;
    transition: all 0.2s;
}

.filter-btn.active, .filter-btn:hover {
    background: var(--dark-blue);
    color: #fff;
}

/* ─── FILTER BAR ──────────────────────────────────────────── */
.filter-bar {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 1rem;
    margin-bottom: 1.5rem;
}

.filter-bar .filter-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    align-items: end;
}

.filter-bar .filter-group {
    flex: 1 1 180px;
    min-width: 150px;
    max-width: 250px;
    display: flex;
    flex-direction: column;
}

.filter-bar .filter-group label {
    font-weight: 600;
    margin-bottom: 0.3rem;
    font-size: 0.75rem;
    color: #555;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.filter-bar select,
.filter-bar input[type="date"],
.filter-bar input[type="text"] {
    padding: 0.45rem 0.5rem;
    border: 1px solid #ccc;
    border-radius: 6px;
    font-size: 0.9rem;
    width: 100%;
    background: #fff;
}

.filter-bar .filter-actions {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    flex: 0 0 auto;
}

.filter-bar .clear-filters {
    font-size: 0.85rem;
    color: var(--light-blue);
    text-decoration: none;
}

.filter-bar .clear-filters:hover {
    text-decoration: underline;
}

@media (max-width: 768px) {
    .filter-bar .filter-group {
        flex: 1 1 100%;
        max-width: 100%;
    }
}

/* Client grid */
.client-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1rem;
}

.client-card {
    background: #fff;
    border-radius: 10px;
    padding: 1rem;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    transition: transform 0.2s, box-shadow 0.2s;
}

.client-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(0,0,0,0.12);
}

.client-card.inactive {
    opacity: 0.6;
    border-left: 4px solid #999;
}

.client-card-header {
    display: flex;
    gap: 0.75rem;
    align-items: center;
    margin-bottom: 0.5rem;
}

.client-card-header h3 {
    margin: 0;
    font-size: 1rem;
}

.client-card-header h3 a {
    color: var(--dark-blue);
    text-decoration: none;
}

.client-card-header h3 a:hover {
    text-decoration: underline;
}

.client-avatar {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    object-fit: cover;
}

.client-avatar-placeholder {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: var(--dark-blue);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
    font-weight: bold;
    flex-shrink: 0;
}

.care-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 0.75rem;
    background: #e0f0ff;
    color: var(--dark-blue);
    font-weight: 500;
}

.care-badge.funding {
    background: #e8f5e9;
    color: #2e7d32;
}

.medical-alert {
    background: #fff3cd;
    color: #856404;
    padding: 0.4rem 0.6rem;
    border-radius: 6px;
    font-size: 0.8rem;
    margin: 0.5rem 0;
}

.client-card-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 0.5rem;
    font-size: 0.85rem;
    color: #666;
}

.status-inactive {
    color: #dc3545;
    font-weight: bold;
    font-size: 0.8rem;
}

/* Client profile */
.client-profile {
    display: grid;
    gap: 1.5rem;
}

.profile-section {
    background: #fff;
    border-radius: 10px;
    padding: 1.5rem;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.profile-main {
    display: flex;
    gap: 1.5rem;
    margin-bottom: 1rem;
}

.profile-photo {
    width: 120px;
    height: 120px;
    border-radius: 10px;
    object-fit: cover;
    flex-shrink: 0;
}

.profile-photo-placeholder {
    width: 120px;
    height: 120px;
    border-radius: 10px;
    background: var(--dark-blue);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 3rem;
    font-weight: bold;
    flex-shrink: 0;
}

.profile-info p {
    margin: 0.3rem 0;
}

.info-box {
    background: #f8f9fa;
    border-radius: 8px;
    padding: 1rem;
    margin: 0.75rem 0;
}

.info-box h3 {
    margin: 0 0 0.5rem 0;
    font-size: 0.9rem;
    color: var(--dark-blue);
}

.alert-box {
    background: #fff3cd;
    border-left: 4px solid #ffc107;
}

.warning-box {
    background: #f8d7da;
    border-left: 4px solid #dc3545;
}

/* Notes */
.notes-timeline {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin: 1rem 0;
}

.note-card {
    background: #fff;
    border-radius: 8px;
    padding: 1rem;
    border-left: 4px solid var(--dark-blue);
    box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}

.note-card.incident {
    border-left-color: #dc3545;
    background: #fff5f5;
}

.note-card.acknowledged {
    opacity: 0.7;
    border-left-color: #28a745;
}

.note-header {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    margin-bottom: 0.5rem;
    flex-wrap: wrap;
}

.note-shift {
    padding: 2px 10px;
    border-radius: 10px;
    font-size: 0.75rem;
    font-weight: bold;
    color: #fff;
}

.note-shift.am { background: #f59e0b; }
.note-shift.pm { background: #3b82f6; }
.note-shift.night { background: #8b5cf6; }

.note-date, .note-time {
    font-size: 0.85rem;
    color: #666;
}

.incident-badge {
    background: #dc3545;
    color: #fff;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 0.75rem;
    font-weight: bold;
}

.locked-badge {
    background: #6c757d;
    color: #fff;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 0.75rem;
}

.expired-badge {
    background: #ffc107;
    color: #333;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 0.75rem;
}

.ack-badge {
    background: #28a745;
    color: #fff;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 0.75rem;
}

.note-content {
    color: #444;
    font-size: 0.9rem;
    line-height: 1.5;
    margin: 0.5rem 0;
}

.note-client {
    margin: 0.25rem 0;
}

.note-meds {
    font-size: 0.85rem;
    color: #2e7d32;
    background: #e8f5e9;
    padding: 0.3rem 0.6rem;
    border-radius: 4px;
    margin: 0.5rem 0;
}

.note-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 0.5rem;
}

.note-author {
    font-size: 0.8rem;
    color: #888;
}

/* Note detail */
.note-detail {
    background: #fff;
    border-radius: 10px;
    padding: 1.5rem;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.note-detail-header {
    margin-bottom: 1rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid #eee;
}

.note-meta {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.5rem;
    flex-wrap: wrap;
}

.note-content-full {
    white-space: pre-wrap;
    line-height: 1.7;
    padding: 1rem 0;
}

.note-detail-footer {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-top: 1.5rem;
    padding-top: 1rem;
    border-top: 1px solid #eee;
    flex-wrap: wrap;
    gap: 1rem;
}

.author-info p {
    margin: 0.2rem 0;
    font-size: 0.85rem;
    color: #666;
}

.handover-section h3 {
    margin: 0 0 0.5rem 0;
    font-size: 0.95rem;
}

.ack-confirmed {
    color: #28a745;
    font-weight: bold;
    font-size: 0.9rem;
}

/* Care form */
.care-form {
    max-width: 800px;
}

.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.form-group {
    display: flex;
    flex-direction: column;
}

.form-group.full-width {
    grid-column: 1 / -1;
}

.form-group label {
    font-weight: 600;
    margin-bottom: 0.3rem;
    font-size: 0.9rem;
    color: #333;
}

.care-form input[type="text"],
.care-form input[type="tel"],
.care-form input[type="date"],
.care-form input[type="file"],
.care-form select,
.care-form textarea {
    padding: 0.5rem;
    border: 1px solid #ccc;
    border-radius: 6px;
    font-size: 0.9rem;
    width: 100%;
}

.care-form textarea {
    resize: vertical;
}

.care-form select {
    background: #fff;
}

.form-help {
    font-size: 0.8rem;
    color: #888;
    margin-top: 0.2rem;
}

.checkbox-label {
    flex-direction: row !important;
    gap: 0.5rem;
    align-items: center;
    cursor: pointer;
}

.checkbox-label input[type="checkbox"] {
    width: auto;
}

.form-actions {
    margin-top: 1.5rem;
    display: flex;
    gap: 0.75rem;
}

/* Handover alert on employee dashboard */
.handover-alert {
    background: #fff3cd;
    border: 1px solid #ffc107;
    border-radius: 8px;
    padding: 0.75rem 1rem;
    margin-bottom: 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem;
}

/* Care stat card link */
.stat-link {
    display: block;
    margin-top: 0.3rem;
    font-size: 0.8rem;
    color: var(--light-blue);
    text-decoration: none;
}

.stat-link:hover {
    text-decoration: underline;
}

.care-stat {
    border-top: 3px solid var(--info);
}

/* Care section headings */
.section-title {
    font-size: 1.1rem;
    margin-bottom: 1rem;
}

.section-title.pending {
    color: #dc3545;
}

/* Empty state */
.empty-state {
    text-align: center;
    padding: 2rem;
    color: #888;
    background: #f8f9fa;
    border-radius: 8px;
}

.empty-state.success {
    background: #d4edda;
    color: #155724;
}

/* Pagination */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 1rem;
    margin-top: 1.5rem;
}

.care-section {
    margin-bottom: 2rem;
}

@media (max-width: 768px) {
    .form-grid {
        grid-template-columns: 1fr;
    }
    .form-group.full-width {
        grid-column: 1;
    }
    .client-grid {
        grid-template-columns: 1fr;
    }
    .profile-main {
        flex-direction: column;
        align-items: center;
        text-align: center;
    }
    .note-detail-footer {
        flex-direction: column;
    }
}

/* ─── SHIFT & CALENDAR MODULE ──────────────────────────────── */

.calendar-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.calendar-nav h2 {
    margin: 0;
}

.calendar-legend {
    display: flex;
    gap: 1rem;
    margin-bottom: 0.75rem;
    font-size: 0.85rem;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 0.3rem;
}

.legend-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
}

.legend-dot.am { background: #f59e0b; }
.legend-dot.pm { background: #3b82f6; }
.legend-dot.night { background: #8b5cf6; }

.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 2px;
    background: #ddd;
    border-radius: 8px;
    overflow: hidden;
}

.cal-header {
    background: var(--dark-blue);
    color: #fff;
    text-align: center;
    padding: 0.5rem;
    font-weight: bold;
    font-size: 0.85rem;
}

.cal-cell {
    background: #fff;
    min-height: 80px;
    padding: 0.3rem;
    font-size: 0.8rem;
}

.cal-cell.empty {
    background: #f8f9fa;
}

.cal-cell.today {
    background: #e0f0ff;
}

.cal-day-num {
    font-weight: bold;
    color: #333;
    margin-bottom: 0.2rem;
}

.cal-shifts {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.cal-shift-dot {
    padding: 1px 4px;
    border-radius: 3px;
    font-size: 0.7rem;
    color: #fff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.cal-shift-dot.am { background: #f59e0b; }
.cal-shift-dot.pm { background: #3b82f6; }
.cal-shift-dot.night { background: #8b5cf6; }

/* Shift cards */
.shifts-today {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1rem;
    margin: 1rem 0;
}

.shift-card {
    background: #fff;
    border-radius: 10px;
    padding: 1rem;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    border-left: 4px solid var(--dark-blue);
}

.shift-card.completed {
    border-left-color: #28a745;
    opacity: 0.8;
}

.shift-card.confirmed {
    border-left-color: #f59e0b;
}

.shift-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}

.shift-card h3 {
    margin: 0.3rem 0;
}

.shift-time {
    font-size: 0.9rem;
    color: #555;
}

.shift-address {
    font-size: 0.85rem;
    color: #777;
}

.shift-notes {
    font-size: 0.85rem;
    color: #666;
    font-style: italic;
}

.shift-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.75rem;
    flex-wrap: wrap;
}

.completed-text {
    color: #28a745;
    font-weight: bold;
    font-size: 0.9rem;
}

.status-badge {
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 0.75rem;
    font-weight: bold;
}

.status-badge.assigned { background: #e0f0ff; color: var(--dark-blue); }
.status-badge.confirmed { background: #fff3cd; color: #856404; }
.status-badge.completed { background: #d4edda; color: #155724; }
.status-badge.cancelled { background: #f8d7da; color: #721c24; }

/* Clock-in page */
.clock-in-card {
    background: #fff;
    border-radius: 10px;
    padding: 1.5rem;
    max-width: 500px;
    margin: 0 auto;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.gps-status {
    padding: 0.5rem;
    border-radius: 6px;
    margin: 1rem 0;
    text-align: center;
    font-size: 0.9rem;
    background: #e0f0ff;
    color: var(--dark-blue);
}

.gps-status.success { background: #d4edda; color: #155724; }
.gps-status.warning { background: #fff3cd; color: #856404; }

/* GPS verification badges */
.gps-verified { color: #28a745; font-weight: bold; font-size: 0.8rem; }
.gps-unverified { color: #f59e0b; font-size: 0.8rem; }
.gps-none { color: #999; font-size: 0.8rem; }

/* Timesheet */
.timesheet-filter {
    display: flex;
    gap: 0.75rem;
    align-items: center;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

.timesheet-filter label {
    font-weight: 600;
}

.timesheet-filter input {
    padding: 0.4rem;
    border: 1px solid #ccc;
    border-radius: 6px;
}

.timesheet-section {
    margin-bottom: 2rem;
}

.timesheet-section h2 {
    margin-bottom: 0.5rem;
}

/* ─── INCIDENTS ────────────────────────────────────────────── */

.severity-badge {
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 0.75rem;
    font-weight: bold;
    color: #fff;
}

.severity-badge.low { background: #17a2b8; }
.severity-badge.medium { background: #f59e0b; }
.severity-badge.high { background: #dc3545; }
.severity-badge.critical { background: #721c24; }

.resolve-section {
    background: #f8f9fa;
    padding: 1rem;
    border-radius: 8px;
    margin-top: 1rem;
}

.resolve-section h3 {
    margin: 0 0 0.5rem;
}

.resolve-section textarea {
    width: 100%;
    padding: 0.5rem;
    border: 1px solid #ccc;
    border-radius: 6px;
    margin-bottom: 0.5rem;
    resize: vertical;
}

/* ─── MEDICATION (MAR) ─────────────────────────────────────── */

.mar-table td {
    vertical-align: top;
}

.mar-given {
    background: #d4edda;
    color: #155724;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.8rem;
    display: inline-block;
    margin: 1px 0;
}

.mar-refused {
    background: #f8d7da;
    color: #721c24;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.8rem;
    display: inline-block;
    margin: 1px 0;
}

.mar-pending {
    color: #888;
    font-size: 0.85rem;
    font-style: italic;
}

/* ─── TIMELINE ─────────────────────────────────────────────── */

.timeline-container {
    position: relative;
    padding-left: 40px;
}

.timeline-container::before {
    content: '';
    position: absolute;
    left: 18px;
    top: 0;
    bottom: 0;
    width: 2px;
    background: #ddd;
}

.timeline-event {
    display: flex;
    gap: 0.75rem;
    margin-bottom: 1rem;
    position: relative;
}

.timeline-icon {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-weight: bold;
    font-size: 0.7rem;
    flex-shrink: 0;
    position: relative;
    z-index: 1;
}

.timeline-content {
    background: #fff;
    border-radius: 8px;
    padding: 0.75rem;
    flex: 1;
    box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}

.timeline-content p {
    margin: 0.3rem 0;
    font-size: 0.9rem;
    color: #555;
}

.timeline-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.incident-event .timeline-content {
    border-left: 3px solid #dc3545;
}

/* Client actions bar */
.client-actions-bar {
    display: flex;
    gap: 0.5rem;
    margin-top: 1.5rem;
    flex-wrap: wrap;
}

@media (max-width: 768px) {
    .calendar-grid {
        font-size: 0.7rem;
    }
    .cal-cell {
        min-height: 60px;
    }
    .shifts-today {
        grid-template-columns: 1fr;
    }
}


/* ─── OPEN SHIFT MARKETPLACE ─────────────────────────────────────── */

.marketplace-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1rem;
    margin-top: 1rem;
}

.marketplace-card {
    background: white;
    border-radius: 10px;
    padding: 1.25rem;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    border-left: 4px solid #7c3aed;
    transition: transform 0.2s;
}

.marketplace-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
}

.marketplace-card.applied {
    border-left-color: #10b981;
    opacity: 0.8;
}

.marketplace-card.swap-own {
    border-left-color: #f59e0b;
}

.marketplace-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
}

.marketplace-date {
    font-size: 0.85rem;
    color: #666;
    font-weight: 600;
}

.marketplace-deadline {
    font-size: 0.8rem;
    color: #dc3545;
    font-weight: 600;
    margin-top: 0.5rem;
}

.marketplace-actions {
    margin-top: 1rem;
    padding-top: 0.75rem;
    border-top: 1px solid #eee;
}

.apply-note {
    width: 100%;
    padding: 0.4rem;
    border: 1px solid #ddd;
    border-radius: 5px;
    margin-bottom: 0.5rem;
    font-size: 0.85rem;
}

.profession-req {
    font-size: 0.85rem;
    color: #7c3aed;
    margin-top: 0.25rem;
}

/* Calendar open shift dot */
.cal-shift-dot.open,
.legend-dot.open {
    background: #7c3aed;
    color: white;
}

.legend-dot.open {
    display: inline-block;
    width: 12px;
    height: 12px;
    border-radius: 3px;
}

/* ─── SHIFT APPLICANTS / RANKING ─────────────────────────────────── */

.shift-detail-card {
    background: white;
    padding: 1.25rem;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    border-left: 4px solid var(--dark-blue);
    margin-bottom: 1rem;
}

.rank-badge {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 12px;
    font-weight: 700;
    font-size: 0.8em;
}

.rank-badge.gold {
    background: #ffd700;
    color: #333;
}

.rank-badge.silver {
    background: #c0c0c0;
    color: #333;
}

.rank-badge.bronze {
    background: #cd7f32;
    color: #fff;
}

.breakdown-cell {
    max-width: 200px;
}

.breakdown-cell small {
    display: block;
    color: #666;
    line-height: 1.4;
}

/* ─── SWAP REVIEW ────────────────────────────────────────────────── */

.swap-review-card {
    background: white;
    border-radius: 10px;
    padding: 2rem;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.swap-parties {
    display: flex;
    align-items: center;
    gap: 2rem;
    margin: 1.5rem 0;
}

.swap-party {
    flex: 1;
    background: #f8f9fa;
    padding: 1rem;
    border-radius: 8px;
    text-align: center;
}

.swap-arrow {
    font-size: 2rem;
    color: var(--dark-blue);
    font-weight: bold;
}

.section-title-small {
    font-size: 1.1rem;
    font-weight: 600;
    margin: 1.5rem 0 0.75rem;
    padding-bottom: 0.4rem;
    border-bottom: 2px solid var(--dark-blue);
}

/* ─── AVAILABILITY ───────────────────────────────────────────────── */

.availability-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 1rem;
}

.avail-day {
    background: white;
    border-radius: 8px;
    padding: 1rem;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.avail-day h3 {
    margin-bottom: 0.75rem;
    color: var(--dark-blue);
    font-size: 1rem;
}

.avail-slot {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

.avail-slot input[type="time"] {
    padding: 0.3rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 0.85rem;
}

.avail-slot span {
    color: #666;
    font-size: 0.85rem;
}

/* ─── INLINE EDIT (Professions) ──────────────────────────────────── */

.inline-input {
    padding: 0.3rem 0.5rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 0.85rem;
}

@media (max-width: 768px) {
    .marketplace-grid {
        grid-template-columns: 1fr;
    }
    .swap-parties {
        flex-direction: column;
    }
    .swap-arrow {
        transform: rotate(90deg);
    }
    .availability-grid {
        grid-template-columns: 1fr;
    }
}

/* ─── Client Report ─────────────────────────────── */
.report-toolbar { margin-bottom: 1rem; }
.period-bar {
    display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center;
    margin-top: 0.75rem; padding: 0.75rem; background: #fff; border-radius: 8px;
}
.period-btn {
    padding: 6px 14px; border-radius: 20px; text-decoration: none;
    font-size: 0.85rem; font-weight: 600; color: var(--dark-blue);
    background: var(--light-bg); border: 1px solid #ccc; transition: all 0.2s;
}
.period-btn:hover, .period-btn.active {
    background: var(--dark-blue); color: #fff; border-color: var(--dark-blue);
}
.custom-period {
    display: flex; gap: 0.4rem; align-items: center; margin-left: auto;
}
.custom-period input[type="date"] {
    padding: 4px 8px; border: 1px solid #ccc; border-radius: 6px; font-size: 0.85rem;
}
.report-content {
    background: #fff; border-radius: 10px; padding: 2rem;
    box-shadow: 0 2px 10px rgba(0,0,0,0.08);
}
.report-header {
    display: flex; align-items: center; gap: 1.5rem;
    border-bottom: 3px solid var(--dark-blue); padding-bottom: 1.5rem; margin-bottom: 2rem;
}
.report-logo { max-height: 70px; object-fit: contain; }
.report-title h1 { font-size: 1.6rem; color: var(--dark-blue); margin-bottom: 0.2rem; }
.report-title h2 { font-size: 1.1rem; color: #555; font-weight: 500; }
.report-org { font-size: 0.9rem; color: #777; margin-top: 0.3rem; }
.report-section { margin-bottom: 2rem; page-break-inside: avoid; }
.section-heading {
    font-size: 1.15rem; color: var(--dark-blue); border-bottom: 2px solid var(--light-bg);
    padding-bottom: 0.5rem; margin-bottom: 1rem;
}
.subsection-heading { font-size: 1rem; color: #444; margin: 1rem 0 0.5rem; }
.report-table {
    width: 100%; border-collapse: collapse; margin-bottom: 1rem; font-size: 0.9rem;
}
.report-table th, .report-table td {
    padding: 8px 12px; border: 1px solid #ddd; text-align: left; vertical-align: top;
}
.report-table thead th { background: var(--dark-blue); color: #fff; font-weight: 600; }
.report-table tbody tr:nth-child(even) { background: #f8f9fa; }
.details-table th { width: 160px; background: #f0f4f8; color: #333; font-weight: 600; }
.note-cell { white-space: pre-line; line-height: 1.5; }
.empty-note { color: #888; font-style: italic; padding: 1rem 0; }
.severity-badge {
    display: inline-block; padding: 2px 8px; border-radius: 10px;
    font-size: 0.8em; font-weight: 600; color: #fff;
}
.severity-badge.low { background: var(--info); }
.severity-badge.medium { background: var(--warning); color: #333; }
.severity-badge.high { background: #fd7e14; }
.severity-badge.critical { background: var(--danger); }
.report-alerts { margin-top: 1rem; }
.alert-item {
    padding: 0.6rem 1rem; border-radius: 6px; margin-bottom: 0.5rem; font-size: 0.9rem;
}
.alert-item.medical { background: #fff3cd; border-left: 4px solid var(--warning); }
.alert-item.allergy { background: #f8d7da; border-left: 4px solid var(--danger); }
.stats-row {
    display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 1rem; margin-bottom: 1rem;
}
.stat-card {
    background: var(--light-bg); border-radius: 8px; padding: 1rem;
    text-align: center; border: 1px solid #d0e3f7;
}
.stat-value { font-size: 1.8rem; font-weight: 700; color: var(--dark-blue); }
.stat-label { font-size: 0.8rem; color: #666; margin-top: 0.2rem; }
.med-compliance-bar {
    padding: 0.75rem 1rem; background: #f0f4f8; border-radius: 6px;
    font-size: 0.9rem; color: #333;
}
.summary-grid { display: grid; gap: 1.5rem; }
.summary-item { padding: 1rem; background: #f8f9fa; border-radius: 8px; border-left: 4px solid var(--dark-blue); }
.summary-item h4 { color: var(--dark-blue); margin-bottom: 0.5rem; }
.summary-item ul { padding-left: 1.2rem; }
.summary-item li { margin-bottom: 0.3rem; }
.report-footer {
    margin-top: 2rem; padding-top: 1rem; border-top: 1px solid #ddd;
    text-align: center; font-size: 0.8rem; color: #999;
}

/* ─── Print Styles ─────────────────────────────── */
@media print {
    body { background: #fff; font-size: 11pt; }
    .navbar, footer, .flash-messages, .no-print { display: none !important; }
    .main-content { padding: 0; }
    .dashboard-container { padding: 0; max-width: 100%; }
    .report-content { box-shadow: none; padding: 0; border-radius: 0; }
    .report-section { page-break-inside: avoid; }
    .report-table th, .report-table td { padding: 5px 8px; font-size: 9pt; }
    .report-header { border-bottom-color: #000; }
    .section-heading { border-bottom-color: #ccc; }
    .stat-card { border: 1px solid #ccc; }
    a { color: #333; text-decoration: none; }
    .severity-badge { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
    .note-shift { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}

/* ─── Note Templates ───────────────────────────── */
.template-builder {
    border: 2px dashed #ccc; border-radius: 8px; padding: 1rem;
    margin: 1rem 0; background: #fafafa; min-height: 80px;
}
.section-row {
    display: flex; gap: 0.75rem; align-items: flex-start;
    padding: 0.75rem; background: #fff; border: 1px solid #e2e8f0;
    border-radius: 6px; margin-bottom: 0.5rem;
}
.section-handle { display: flex; flex-direction: column; gap: 2px; padding-top: 0.25rem; }
.section-handle button { padding: 2px 6px; font-size: 0.8rem; min-width: 28px; }
.section-fields { flex: 1; }
.section-actions { padding-top: 0.25rem; }
.section-actions button { font-size: 1.1rem; padding: 2px 8px; }
.template-section {
    background: #f0f9ff; border-left: 4px solid var(--dark-blue);
    padding: 1rem; border-radius: 0 8px 8px 0; margin-bottom: 0.75rem;
}
.template-section label { font-weight: 600; color: var(--dark-blue); }
.note-section-item {
    margin-bottom: 1rem; padding-bottom: 0.75rem; border-bottom: 1px solid #eee;
}
.note-section-item:last-child { border-bottom: none; }
.note-section-label { font-size: 0.9rem; color: var(--dark-blue); margin-bottom: 0.25rem; font-weight: 600; }
.note-checklist { list-style: disc; padding-left: 1.5rem; margin: 0.25rem 0; }
.note-rating { font-weight: bold; color: #f59e0b; }
.note-yesno.yes { color: var(--success); font-weight: bold; }
.note-yesno.no { color: var(--danger); font-weight: bold; }
.note-template-badge {
    font-size: 0.8rem; color: #666; font-style: italic;
    margin-top: 1rem; padding-top: 0.5rem; border-top: 1px solid #eee;
}
.rating-group { display: flex; gap: 1rem; }
.rating-group label { font-weight: normal !important; }
.checklist-group { display: flex; flex-wrap: wrap; gap: 0.75rem; }
.checklist-group label { font-weight: normal !important; display: flex; align-items: center; gap: 4px; }
.form-help { font-size: 0.8rem; color: #888; margin: 2px 0 4px; }

/* ─── PAYROLL & BILLING ──────────────────────────────────────────── */

/* Status badges */
.status-badge {
    display: inline-block; padding: 2px 10px; border-radius: 12px;
    font-size: 0.8em; font-weight: 600; text-transform: capitalize;
}
.status-draft { background: #fef3c7; color: #92400e; }
.status-approved { background: #d1fae5; color: #065f46; }
.status-exported { background: #dbeafe; color: #1e40af; }
.status-submitted { background: #e0e7ff; color: #3730a3; }
.status-sent { background: #dbeafe; color: #1e40af; }
.status-paid { background: #d1fae5; color: #065f46; }
.status-void { background: #fee2e2; color: #991b1b; }

/* Rate type badges */
.rate-type-badge {
    display: inline-block; padding: 2px 8px; border-radius: 10px;
    font-size: 0.75em; font-weight: 600; margin: 1px;
}
.rate-ordinary { background: #e0e7ff; color: #3730a3; }
.rate-afternoon { background: #fef3c7; color: #92400e; }
.rate-night { background: #ede9fe; color: #5b21b6; }
.rate-saturday { background: #fce7f3; color: #9d174d; }
.rate-sunday { background: #fee2e2; color: #991b1b; }
.rate-public_holiday { background: #fecaca; color: #7f1d1d; }
.rate-overtime { background: #ffedd5; color: #9a3412; }
.rate-sleepover { background: #d1d5db; color: #374151; }

/* Invoice container */
.invoice-container {
    background: #fff; padding: 2rem; border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}
.invoice-header {
    display: flex; justify-content: space-between; align-items: flex-start;
    padding-bottom: 1rem; border-bottom: 2px solid var(--dark-blue); margin-bottom: 1rem;
}
.invoice-header h2 { color: var(--dark-blue); margin: 0; }

/* NDIS fields toggle */
#ndis-fields {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1rem; padding: 1rem; background: #f0f9ff; border-radius: 8px;
    border: 1px dashed #93c5fd; margin-top: 0.5rem;
}
#ndis-fields .form-group { margin-bottom: 0; }

/* Employee setup table inline forms */
.data-table select, .data-table input[type="text"], .data-table input[type="number"] {
    padding: 4px 6px; border: 1px solid #d1d5db; border-radius: 4px; font-size: 0.85em;
}

/* ─── Support Tickets ─────────────────────────────── */

.priority-badge {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 10px;
    font-size: 0.8em;
    font-weight: bold;
    color: #fff;
}

.priority-low { background: #6b7280; }
.priority-medium { background: #f59e0b; }
.priority-high { background: #ef4444; }
.priority-urgent { background: #dc2626; }

.status-badge.status-open { background: #3b82f6; color: #fff; }
.status-badge.status-in_progress { background: #f59e0b; color: #fff; }
.status-badge.status-resolved { background: #10b981; color: #fff; }
.status-badge.status-closed { background: #6b7280; color: #fff; }
.status-badge.status-escalated { background: #8b5cf6; color: #fff; }

.ticket-meta {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    flex-wrap: wrap;
    margin-top: 0.5rem;
}

.ticket-timeline {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.ticket-comment {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-left: 3px solid var(--dark-blue);
    border-radius: 8px;
    padding: 1rem;
}

.mapping-valid { color: #10b981; font-weight: bold; }
.mapping-invalid { color: #ef4444; font-weight: bold; }

/* AI Summary */
.ai-summary-result {
    background: linear-gradient(135deg, #f0f4ff 0%, #e8f0fe 100%);
    border: 1px solid #c3d9f7;
    border-left: 4px solid var(--light-blue);
    border-radius: 8px;
    padding: 1.25rem;
    margin: 0.75rem 0;
    line-height: 1.7;
    font-size: 0.95em;
}
.ai-summary-result strong { color: var(--dark-blue); }
#aiSummarySection .btn { margin-top: 0.75rem; }
.print-only { display: none; }
@media print {
    .no-print { display: none !important; }
    .print-only { display: block !important; }
    .ai-summary-result { border-color: #999; background: #f9f9f9; }
}

/* AI Chat Badge */
.ai-badge {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: #fff;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 0.75em;
    font-weight: bold;
    margin-left: 6px;
}

/* AI Rostering Reason */
.ai-reason {
    font-style: italic;
    color: #6366f1;
    font-size: 0.85em;
    margin-top: 2px;
}

/* ─── FLOATING AI CHAT WIDGET ──────────────────────────── */
.ai-widget {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 9999;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.ai-widget-toggle {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    border: none;
    background: linear-gradient(135deg, #003366 0%, #4da3ff 100%);
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 20px rgba(0, 51, 102, 0.4);
    transition: transform 0.2s, box-shadow 0.2s;
    position: relative;
}

.ai-widget-toggle:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 28px rgba(0, 51, 102, 0.5);
}

.ai-widget-label {
    position: absolute;
    bottom: -2px;
    right: -2px;
    background: #10b981;
    color: white;
    font-size: 0.6rem;
    font-weight: 700;
    padding: 2px 5px;
    border-radius: 8px;
    letter-spacing: 0.5px;
}

/* Chat Panel */
.ai-chat-panel {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 380px;
    max-width: calc(100vw - 32px);
    height: 520px;
    max-height: calc(100vh - 100px);
    background: white;
    border-radius: 16px;
    box-shadow: 0 8px 40px rgba(0, 0, 0, 0.2);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: aiSlideUp 0.3s ease;
}

@keyframes aiSlideUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Header */
.ai-chat-header {
    background: linear-gradient(135deg, #003366 0%, #1a5276 100%);
    color: white;
    padding: 14px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}

.ai-chat-header-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

.ai-chat-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, #4da3ff, #10b981);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.85rem;
    flex-shrink: 0;
}

.ai-chat-header-info strong {
    display: block;
    font-size: 0.95rem;
}

.ai-chat-header-info small {
    display: block;
    font-size: 0.75rem;
    opacity: 0.8;
}

.ai-chat-close {
    background: none;
    border: none;
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0 4px;
    opacity: 0.8;
    transition: opacity 0.2s;
}

.ai-chat-close:hover { opacity: 1; }

/* Messages Area */
.ai-chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    background: #f8fafc;
}

.ai-msg {
    display: flex;
    max-width: 85%;
}

.ai-msg-user {
    align-self: flex-end;
}

.ai-msg-bot {
    align-self: flex-start;
}

.ai-msg-content {
    padding: 10px 14px;
    border-radius: 16px;
    font-size: 0.9rem;
    line-height: 1.5;
    white-space: pre-wrap;
    word-wrap: break-word;
}

.ai-msg-user .ai-msg-content {
    background: #003366;
    color: white;
    border-bottom-right-radius: 4px;
}

.ai-msg-bot .ai-msg-content {
    background: white;
    color: #1e293b;
    border: 1px solid #e2e8f0;
    border-bottom-left-radius: 4px;
}

/* Typing Indicator */
.ai-typing {
    display: flex;
    gap: 4px;
    padding: 12px 16px !important;
}

.ai-typing span {
    width: 8px;
    height: 8px;
    background: #94a3b8;
    border-radius: 50%;
    animation: aiTypingBounce 1.4s ease-in-out infinite;
}

.ai-typing span:nth-child(2) { animation-delay: 0.2s; }
.ai-typing span:nth-child(3) { animation-delay: 0.4s; }

@keyframes aiTypingBounce {
    0%, 80%, 100% { transform: scale(0.6); opacity: 0.4; }
    40% { transform: scale(1); opacity: 1; }
}

/* Input Area */
.ai-chat-input-area {
    padding: 12px 14px;
    border-top: 1px solid #e2e8f0;
    display: flex;
    gap: 8px;
    align-items: flex-end;
    background: white;
    flex-shrink: 0;
}

.ai-chat-input {
    flex: 1;
    border: 1px solid #d1d5db;
    border-radius: 12px;
    padding: 10px 14px;
    font-size: 0.9rem;
    resize: none;
    outline: none;
    max-height: 100px;
    font-family: inherit;
    line-height: 1.4;
    transition: border-color 0.2s;
}

.ai-chat-input:focus {
    border-color: #4da3ff;
}

.ai-chat-send {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: none;
    background: #003366;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: background 0.2s;
}

.ai-chat-send:hover { background: #1a5276; }
.ai-chat-send:disabled { background: #94a3b8; cursor: not-allowed; }

/* Mobile responsive */
@media (max-width: 480px) {
    .ai-chat-panel {
        bottom: 0;
        right: 0;
        width: 100vw;
        height: 100vh;
        max-height: 100vh;
        border-radius: 0;
    }
    .ai-widget-toggle {
        bottom: 16px;
        right: 16px;
    }
}

/* Hide widget on print */
@media print {
    .ai-widget { display: none !important; }
}

/* ─── BRANDED LOGIN PAGE ──────────────────────────────────────── */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #0b3d91 0%, #116dff 100%);
    padding: 1rem;
}
.login-card {
    background: var(--white);
    padding: 2.5rem;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 420px;
}
.login-logo {
    text-align: center;
    margin-bottom: 2rem;
}
.login-logo h1 {
    font-size: 2.2rem;
    color: var(--dark-blue);
    font-weight: 800;
    letter-spacing: -0.5px;
    margin-bottom: 0.25rem;
}
.login-logo p {
    color: #666;
    font-size: 0.95rem;
}
.login-card label {
    display: block;
    font-weight: 600;
    color: #333;
    margin-bottom: 0.35rem;
    font-size: 0.9rem;
}
.login-card input[type="email"],
.login-card input[type="password"] {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 2px solid #e0e6ed;
    border-radius: 8px;
    font-size: 1rem;
    margin-bottom: 1rem;
    transition: border-color 0.2s;
}
.login-card input:focus {
    border-color: var(--light-blue);
    outline: none;
}
.login-card button[type="submit"] {
    width: 100%;
    padding: 0.85rem;
    background: var(--dark-blue);
    color: var(--white);
    border: none;
    border-radius: 8px;
    font-size: 1.05rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}
.login-card button[type="submit"]:hover {
    background: var(--primary-hover);
}
.login-footer {
    text-align: center;
    margin-top: 1.25rem;
}
.login-footer a {
    color: var(--light-blue);
    text-decoration: none;
    font-size: 0.9rem;
}
.login-footer a:hover {
    text-decoration: underline;
}

/* ─── GUIDED TOUR ─────────────────────────────────────────────── */
.tour-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: 9990;
    transition: opacity 0.3s;
}
.tour-highlight {
    position: relative;
    z-index: 9991;
    box-shadow: 0 0 0 4px var(--light-blue), 0 0 0 9999px rgba(0,0,0,0.5);
    border-radius: 6px;
    transition: box-shadow 0.3s;
}
.tour-tooltip {
    position: fixed;
    z-index: 9992;
    background: var(--white);
    padding: 1.25rem;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-lg);
    max-width: 340px;
    width: 90vw;
}
.tour-tooltip h3 {
    color: var(--dark-blue);
    margin: 0 0 0.5rem;
    font-size: 1.05rem;
}
.tour-tooltip p {
    color: #555;
    font-size: 0.9rem;
    line-height: 1.5;
    margin: 0 0 1rem;
}
.tour-tooltip-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.tour-tooltip-footer .tour-step-count {
    color: #999;
    font-size: 0.8rem;
}
.tour-tooltip-footer .tour-btns {
    display: flex;
    gap: 0.5rem;
}
.tour-btn {
    padding: 0.4rem 1rem;
    border: none;
    border-radius: 6px;
    font-size: 0.85rem;
    cursor: pointer;
    font-weight: 600;
}
.tour-btn-skip {
    background: #e9ecef;
    color: #555;
}
.tour-btn-next {
    background: var(--dark-blue);
    color: var(--white);
}
.tour-btn-next:hover {
    background: var(--primary-hover);
}
.btn-tour {
    background: transparent;
    border: 1px solid var(--light-blue);
    color: var(--light-blue);
    padding: 0.4rem 0.8rem;
    border-radius: 6px;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s;
}
.btn-tour:hover {
    background: var(--light-blue);
    color: var(--white);
}

/* Loading button state — used on form submits that take time */
.btn-loading {
    position: relative;
    pointer-events: none;
    opacity: 0.75;
    cursor: wait !important;
}
.btn-loading .btn-text {
    visibility: hidden;
}
.btn-loading .btn-spinner {
    display: inline-block;
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
}
.btn-spinner {
    display: none;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255,255,255,0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: btn-spin 0.7s linear infinite;
}
@keyframes btn-spin {
    to { transform: translate(-50%, -50%) rotate(360deg); }
}

/* Full-page loading overlay for long operations */
.loading-overlay {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.4);
    z-index: 9999;
    justify-content: center;
    align-items: center;
}
.loading-overlay.active {
    display: flex;
}
.loading-card {
    background: #fff;
    border-radius: 12px;
    padding: 2rem 3rem;
    text-align: center;
    box-shadow: var(--shadow-lg);
    max-width: 360px;
}
.loading-card .spinner-lg {
    width: 48px;
    height: 48px;
    border: 4px solid #e0e0e0;
    border-top-color: var(--light-blue);
    border-radius: 50%;
    animation: overlay-spin 0.8s linear infinite;
    margin: 0 auto 1rem;
}
@keyframes overlay-spin {
    to { transform: rotate(360deg); }
}
.loading-card p {
    margin: 0;
    font-size: 1.05rem;
    color: #333;
    font-weight: 500;
}
.loading-card .loading-sub {
    font-size: 0.85rem;
    color: #888;
    margin-top: 0.5rem;
    font-weight: 400;
}
