/* ─── Admin: shared shell ─── */
.admin-topbar {
    background: var(--navy);
    color: #fff;
    padding: 0.9rem 0;
}
.admin-topbar .container { display: flex; justify-content: space-between; align-items: center; }
.admin-topbar .brand { display: flex; align-items: center; gap: 10px; font-weight: 700; text-decoration: none; color: inherit; }
.admin-topbar .brand:hover { opacity: 0.85; }
.admin-topbar .btn-logout {
    background: transparent;
    border: 1px solid rgba(255,255,255,0.4);
    color: #fff;
    padding: 0.45rem 1rem;
    border-radius: 6px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
}
.admin-topbar .btn-logout:hover { background: rgba(255,255,255,0.12); }

/* ─── Admin: tab bar ─── */
.admin-tabbar { background: var(--navy-mid); }
.admin-tabbar .container { display: flex; gap: 0.5rem; }
.admin-tabbar a {
    color: #c9d8f0;
    text-decoration: none;
    font-size: 0.85rem;
    font-weight: 600;
    padding: 0.8rem 1rem;
    border-bottom: 3px solid transparent;
}
.admin-tabbar a:hover { color: #fff; }
.admin-tabbar a.active { color: #fff; border-bottom-color: var(--accent); }

.admin-shell { min-height: 100vh; background: var(--light-color); }
.admin-main { padding: 2.5rem 0; }
.admin-main h2 { color: var(--dark-color); margin-bottom: 0.3rem; }
.admin-main .subtitle { color: var(--gray-color); font-size: 0.9rem; margin-bottom: 1.8rem; }

/* ─── Admin: login card ─── */
.admin-login-wrap {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--navy) 0%, var(--navy-mid) 55%, var(--navy-light) 100%);
    padding: 1.5rem;
}
.login-card {
    background: var(--white);
    border-radius: 10px;
    box-shadow: var(--shadow-hover);
    padding: 2.4rem;
    width: 100%;
    max-width: 380px;
}
.login-card .logo { justify-content: center; margin-bottom: 1.6rem; text-decoration: none; }
.login-card h2 { text-align: center; color: var(--dark-color); margin-bottom: 1.6rem; font-size: 1.3rem; }

/* ─── Admin: submissions table ─── */
.admin-table-wrap {
    background: var(--white);
    border-radius: 10px;
    box-shadow: var(--shadow);
    overflow-x: auto;
}
.admin-table { width: 100%; border-collapse: collapse; }
.admin-table th {
    background: var(--navy);
    color: var(--white);
    text-align: left;
    padding: 0.85rem 1.1rem;
    font-size: 0.8rem;
    white-space: nowrap;
}
.admin-table td {
    padding: 0.9rem 1.1rem;
    border-bottom: 1px solid #eef2f6;
    font-size: 0.88rem;
    color: var(--dark-color);
    vertical-align: top;
}
.admin-table tr:last-child td { border-bottom: none; }
.admin-table tr:nth-child(even) { background: #fbfdff; }
.admin-table td.message-cell { max-width: 320px; white-space: pre-wrap; }
.admin-table td.nowrap { white-space: nowrap; }
.admin-empty { text-align: center; color: var(--gray-color); padding: 3rem 0; }

.admin-table tr.unread-row { font-weight: 700; }
.admin-table tr.unread-row td { border-left: 3px solid var(--accent); }
.admin-table tr:not(.unread-row) td { border-left: 3px solid transparent; }

.read-toggle {
    width: 30px; height: 30px;
    border-radius: 50%;
    border: 1px solid #ccd3da;
    background: var(--white);
    color: var(--gray-color);
    font-size: 0.95rem;
    line-height: 1;
    cursor: pointer;
}
.read-toggle:hover { border-color: var(--primary-color); }
.read-toggle.is-read {
    background: #e6f4ea;
    border-color: #1e7e34;
    color: #1e7e34;
}
.read-toggle:disabled { opacity: 0.6; cursor: default; }

.admin-table td.notes-cell { min-width: 220px; }
.notes-input {
    width: 100%;
    min-width: 200px;
    padding: 0.45rem 0.6rem;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 0.85rem;
    font-family: inherit;
    resize: vertical;
}
.notes-input:focus { outline: none; border-color: var(--primary-color); }
.notes-status { display: block; font-size: 0.75rem; color: var(--gray-color); margin-top: 0.25rem; height: 1em; }

/* ─── Admin: appointments table ─── */
.admin-table td .muted { color: var(--gray-color); font-size: 0.8rem; }
.admin-table td.patients-cell { min-width: 220px; }
.admin-table td.patients-cell ul { list-style: none; }
.admin-table td.patients-cell li { margin-bottom: 0.4rem; font-size: 0.85rem; }
.admin-table td.patients-cell li:last-child { margin-bottom: 0; }

.status-select {
    padding: 0.4rem 0.6rem;
    border-radius: 6px;
    border: 1px solid #ccd3da;
    font-size: 0.82rem;
    font-weight: 700;
    font-family: inherit;
}
.status-select.status-pending { background: #fff3cd; color: #856404; border-color: #ffe69c; }
.status-select.status-confirmed { background: #d4edda; color: #155724; border-color: #c3e6cb; }
.status-select.status-cancelled { background: #f8d7da; color: #721c24; border-color: #f5c6cb; }

/* ─── Time clock: staff kiosk ─── */
.timeclock-card { max-width: 420px; }
.timeclock-now { text-align: center; margin-bottom: 1.6rem; }
.timeclock-time { font-size: 2.4rem; font-weight: 700; color: var(--dark-color); font-variant-numeric: tabular-nums; }
.timeclock-date { color: var(--gray-color); font-size: 0.9rem; }
.timeclock-card .form-group input { font-size: 1.1rem; padding: 0.8rem 0.9rem; }
.timeclock-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 0.8rem; }
/* Kiosk camera: photo taken at clock in/out. Mirrored like a mirror; the saved photo is not. */
.timeclock-camera { position: relative; margin-bottom: 1.2rem; border-radius: 10px; overflow: hidden; background: #1f2933; aspect-ratio: 4 / 3; }
.timeclock-camera video { width: 100%; height: 100%; object-fit: cover; transform: scaleX(-1); display: block; }
.timeclock-camera-status { position: absolute; left: 0; right: 0; bottom: 0; padding: 0.4rem 0.6rem; font-size: 0.8rem; color: #fff; background: rgba(0, 0, 0, 0.55); text-align: center; }
.timeclock-camera-status:empty { display: none; }
.timeclock-camera.flash::after { content: ""; position: absolute; inset: 0; background: #fff; animation: timeclock-flash 0.35s ease-out forwards; }
@keyframes timeclock-flash { from { opacity: 0.85; } to { opacity: 0; } }
.btn-clock-in { background: #1e7e34; color: var(--white); padding: 0.95rem 1rem; font-size: 1rem; }
.btn-clock-in:hover { background: #17692b; }
.btn-clock-out { background: var(--accent); color: var(--white); padding: 0.95rem 1rem; font-size: 1rem; }
.btn-clock-out:hover { background: #e65f00; }
.timeclock-actions .btn:disabled { opacity: 0.6; cursor: default; }

/* ─── Time clock: admin ─── */
.admin-section { margin-bottom: 1.5rem; }
.admin-section-title { color: var(--dark-color); font-size: 1.1rem; margin: 2rem 0 0.9rem; }
.admin-main .subtitle a { color: var(--primary-color); font-weight: 600; }

.timesheet-filters { display: flex; flex-wrap: wrap; align-items: center; gap: 0.8rem; margin-bottom: 1rem; }
.timesheet-filters label { font-size: 0.85rem; font-weight: 700; color: var(--dark-color); display: flex; align-items: center; gap: 0.4rem; }
.timesheet-filters input,
.datetime-input {
    padding: 0.4rem 0.6rem;
    border: 1px solid #ccd3da;
    border-radius: 6px;
    font-size: 0.85rem;
    font-family: inherit;
}

.btn-small {
    background: var(--primary-color);
    color: var(--white);
    border: 1px solid var(--primary-color);
    padding: 0.45rem 0.9rem;
    border-radius: 6px;
    font-size: 0.82rem;
    font-weight: 700;
    font-family: inherit;
    cursor: pointer;
    margin-right: 0.4rem;
}
.btn-small:hover { opacity: 0.9; }
.btn-small:disabled { opacity: 0.6; cursor: default; }
.btn-small-secondary { background: var(--white); color: var(--primary-color); }
.btn-small-secondary:hover { background: #f3f8fd; }

.staff-add-form { background: var(--white); border-radius: 10px; box-shadow: var(--shadow); padding: 1.2rem 1.2rem 0.2rem; }
.staff-add-fields { display: grid; grid-template-columns: 2fr 1fr 1fr auto; gap: 1rem; align-items: end; }
.staff-add-fields .btn-small { margin-bottom: 1.3rem; padding: 0.72rem 1rem; }
@media (max-width: 760px) { .staff-add-fields { grid-template-columns: 1fr; } }

.clock-badge { display: inline-block; padding: 0.25rem 0.6rem; border-radius: 999px; font-size: 0.78rem; font-weight: 700; }
.clock-badge-in { background: #d4edda; color: #155724; }
.clock-badge-out { background: #eef2f6; color: var(--gray-color); }
.clock-badge-inactive { background: #f8d7da; color: #721c24; }
.admin-table tr.inactive-row td { color: var(--gray-color); }

/* ─── Time clock: allowed networks ─── */
.section-help { color: var(--gray-color); font-size: 0.88rem; margin: -0.4rem 0 1rem; max-width: 760px; }
.network-status {
    border-radius: 10px;
    padding: 1rem 1.2rem;
    margin-bottom: 1rem;
    font-size: 0.88rem;
    border: 1px solid transparent;
}
.network-status-on { background: #e6f4ea; border-color: #c3e6cb; color: #155724; }
.network-status-off { background: #fff3cd; border-color: #ffe69c; color: #856404; }
.network-status-line { margin: 0.5rem 0 0.7rem; color: var(--dark-color); }
.network-status .btn-small { margin-top: 0.2rem; }
.network-status code,
.admin-table td code { font-family: Consolas, Menlo, monospace; font-size: 0.85rem; }
.network-add-fields { display: grid; grid-template-columns: 1fr 1fr auto; gap: 1rem; align-items: end; }
.network-add-fields .btn-small { margin-bottom: 1.3rem; padding: 0.72rem 1rem; }
@media (max-width: 760px) { .network-add-fields { grid-template-columns: 1fr; } }

/* ─── Admin: live search ─── */
.admin-search { display: flex; flex-wrap: wrap; align-items: center; gap: 0.8rem; margin-bottom: 1rem; }
.admin-search input {
    flex: 1 1 320px;
    max-width: 520px;
    padding: 0.65rem 0.9rem;
    border: 1px solid #ccd3da;
    border-radius: 6px;
    font-size: 0.92rem;
    font-family: inherit;
    background: var(--white);
}
.admin-search input:focus { outline: none; border-color: var(--primary-color); }
.admin-search-count { color: var(--gray-color); font-size: 0.85rem; }
.admin-load-more { text-align: center; margin-top: 1rem; }
.admin-load-more .btn-small { padding: 0.6rem 1.6rem; margin-right: 0; }
.admin-table td.running-hours { color: #1e7e34; font-weight: 700; }

/* ─── Admin: financial report ─── */
.fin-toolbar-spacer { flex: 1; }
.fin-report-heading { text-align: center; padding: 1rem 1rem 0.8rem; color: var(--dark-color); }
.fin-report-center { font-weight: 700; font-size: 0.95rem; }
.fin-report-title { font-weight: 700; font-size: 1.05rem; margin-top: 0.2rem; }
.fin-currency-note { font-size: 0.85rem; font-style: italic; color: var(--gray-color); margin-top: 0.25rem; }
.fin-week-note {
    margin: 0.6rem auto 0;
    max-width: 60rem;
    padding: 0.5rem 0.9rem;
    border: 1px solid #f1b5b5;
    border-left: 4px solid #c62828;
    border-radius: 6px;
    background: #fdecec;
    color: #c62828;
    font-weight: 600;
    font-size: 0.95rem;
    text-align: left;
}
.fin-week-note[hidden] { display: none; }
.fin-week-note-by { font-weight: 400; font-size: 0.8rem; color: #b04a4a; }
@media print {
    .fin-week-note { color: #c62828 !important; background: none !important; border: 1px solid #c62828 !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}
.fin-table th, .fin-table td { padding: 0.55rem 0.6rem; }
.fin-table th { text-align: right; }
.fin-table th:first-child { text-align: left; }
.fin-table td.fin-num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.fin-table td.fin-computed { background: #eef3fb; font-weight: 700; }
.fin-table th.fin-computed { background: var(--navy-mid); }
.fin-table .fin-negative { color: #b02a37; }
.fin-table tfoot th { background: #dfe8f5; color: var(--dark-color); text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.fin-table tfoot th:first-child { text-align: left; }
/* Footer totals of the computed columns (Total, Sub-total, Deposit): the header rule above also
   matches these cells, so set both colours here to keep them readable. */
.fin-table tfoot th.fin-computed { background: var(--navy-mid); color: var(--white); }
.fin-table td.fin-date { font-weight: 700; }

.fin-entry-table td { vertical-align: middle; }
.fin-input {
    width: 92px;
    padding: 0.4rem 0.45rem;
    border: 1px solid #d5dde6;
    border-radius: 5px;
    font-size: 0.85rem;
    font-family: inherit;
    text-align: right;
}
.fin-input:focus { outline: none; border-color: var(--primary-color); }
.fin-input-count { width: 64px; }
.fin-input-date { width: 140px; text-align: left; }
.fin-entry-table tr.fin-dirty td { background: #fffbea; }
.fin-entry-table tr.fin-dirty td.fin-computed { background: #f5efd2; }
.fin-row-status { display: block; font-size: 0.75rem; margin-top: 0.3rem; max-width: 190px; white-space: normal; }
.fin-row-status-ok { color: #1e7e34; }
.fin-row-status-pending { color: #856404; }
.fin-row-status-error { color: #b02a37; font-weight: 700; }
.fin-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 0.6rem; margin-top: 1rem; }
.fin-help { color: var(--gray-color); font-size: 0.82rem; }
.admin-tabbar .container { flex-wrap: wrap; }
/* Grouped tabs: Weekly [View Report | Submit Figures]   Monthly Credit [View Report | Submit Credits] */
.fin-subnav { display: flex; flex-wrap: wrap; gap: 0.75rem; margin-bottom: 1.4rem; }
.fin-subnav-group {
    display: inline-flex;
    align-items: stretch;
    background: var(--white);
    border: 1px solid #d5dde6;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}
.fin-subnav-label {
    display: flex;
    align-items: center;
    padding: 0.5rem 0.85rem;
    background: #eef2f6;
    border-right: 1px solid #d5dde6;
    color: var(--gray-color);
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    white-space: nowrap;
}
.fin-subnav a {
    display: flex;
    align-items: center;
    padding: 0.5rem 1rem;
    color: var(--dark-color);
    font-size: 0.85rem;
    font-weight: 700;
    text-decoration: none;
    white-space: nowrap;
    border-bottom: 3px solid transparent;
}
.fin-subnav a + a { border-left: 1px solid #d5dde6; }
/* Glossy finish: a light top-half sheen over each tab. */
.fin-subnav a {
    background: linear-gradient(to bottom, #ffffff 0%, #f6f8fb 49%, #e9eef4 51%, #f3f6f9 100%);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.9);
    text-shadow: 0 1px 0 rgba(255, 255, 255, 0.8);
    transition: background 0.15s ease;
}
.fin-subnav-label {
    background: linear-gradient(to bottom, #f4f7fa 0%, #e6ebf1 100%);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.8);
}
.fin-subnav a:hover {
    background: linear-gradient(to bottom, #ffffff 0%, #eef4fa 49%, #dde7f1 51%, #eaf1f8 100%);
    color: var(--navy);
}
.fin-subnav a:focus-visible { outline: 2px solid var(--primary-color); outline-offset: -2px; }
.fin-subnav a.active {
    background: linear-gradient(to bottom, #4a6a92 0%, #2c4a70 49%, #1b3557 51%, #23426a 100%);
    color: var(--white);
    text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.35);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.3), inset 0 -3px 0 #f28c28;
    border-bottom-color: transparent;
}
@media (max-width: 520px) {
    .fin-subnav-group { width: 100%; }
    .fin-subnav a { flex: 1; justify-content: center; padding: 0.5rem 0.6rem; }
}

/* ─── Admin: credit report ─── */
.fin-report-big { font-size: 1.3rem; }
.fin-table th.fin-text { text-align: left; }
.fin-table tfoot th.fin-total-label { text-align: center; }
.credit-table td.message-cell { min-width: 220px; }
.fin-input-text { width: 150px; text-align: left; }
.fin-input-comment { width: 230px; resize: vertical; }

@media print {
    .admin-topbar, .admin-tabbar, .fin-subnav, .admin-main h2, .admin-main .subtitle, .fin-toolbar { display: none !important; }
    .admin-shell { background: #fff; }
    .admin-main { padding: 0; }
    .admin-main .container { max-width: none; padding: 0; }
    .fin-report { box-shadow: none; overflow: visible; }
    .fin-table th, .fin-table td { padding: 0.25rem 0.3rem; font-size: 0.62rem; border: 1px solid #999; }
    .fin-table th { background: #e5e5e5 !important; color: #000 !important; }
    @page { size: landscape; margin: 1cm; }
}

/* ─── Admin: activity log ─── */
.admin-table tr.activity-failed td { background: #fff5f5; }
.activity-reason { display: block; margin-top: 0.3rem; max-width: 260px; }

/* ─── Admin: accounts ─── */
.admin-topbar-user { display: flex; align-items: center; gap: 0.9rem; }
.admin-signed-in { font-size: 0.82rem; opacity: 0.9; }
.admin-signed-in-link { font-size: 0.78rem; color: inherit; opacity: 0.75; }
.admin-signed-in-link:hover { opacity: 1; }
.account-add-fields { display: grid; grid-template-columns: 1.4fr 1fr 1fr 1fr 0.9fr auto; gap: 1rem; align-items: end; }
.account-password-fields { display: grid; grid-template-columns: 1fr 1fr 1fr auto; gap: 1rem; align-items: end; }
.account-add-fields .btn-small, .account-password-fields .btn-small { margin-bottom: 1.3rem; padding: 0.72rem 1rem; }
@media (max-width: 860px) {
    .account-add-fields, .account-password-fields { grid-template-columns: 1fr; }
    .admin-signed-in, .admin-signed-in-link { display: none; }
}
.clock-badge-super { background: var(--navy); color: var(--white); }
.field-hint { display: block; margin-top: 0.4rem; font-size: 0.8rem; color: var(--gray-color); }

/* ─── Admin: savings ledger (Super Admins only) ─── */
.savings-summary { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 0.9rem; margin-bottom: 1.2rem; }
.savings-card {
    background: var(--white);
    border: 1px solid #d5dde6;
    border-top: 4px solid var(--navy);
    border-radius: 8px;
    padding: 0.8rem 1rem;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}
.savings-card-label { font-size: 0.75rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; color: var(--gray-color); }
.savings-card-value { font-size: 1.35rem; font-weight: 700; color: var(--dark-color); font-variant-numeric: tabular-nums; margin-top: 0.2rem; }
.savings-card-sub { font-size: 0.85rem; color: var(--gray-color); font-variant-numeric: tabular-nums; }
.savings-card-out { border-top-color: #c62828; }
.savings-card-out .savings-card-value { color: #c62828; }
.savings-card-balance { border-top-color: #2e7d32; }
.savings-card-balance .savings-card-value { color: #2e7d32; }
.savings-card-negative { border-top-color: #c62828; background: #fdecec; }
.savings-card-negative .savings-card-value { color: #c62828; }
.savings-table td.message-cell { min-width: 260px; white-space: normal; }
.savings-table .fin-negative { color: #c62828; }
@media print {
    .savings-summary { display: none; }
    .savings-table .fin-negative { color: #c62828 !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}
.savings-history-note { margin-bottom: 0.6rem; }
.savings-history td.message-cell { max-width: 560px; white-space: normal; }
@media print {
    #history-title, .savings-history-note, .savings-history, #history-more { display: none !important; }
}
.savings-copies-filter { margin-bottom: 0.6rem; }
@media print {
    #copies-title, .savings-copies-filter, #copies-wrap { display: none !important; }
    .savings-table th:last-child, .savings-table td:last-child { display: none; }
}

/* ─── Locations page ─── */
.location-fields { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0 1rem; }
.location-fields .location-field-wide { grid-column: span 2; }
.location-form-actions { display: flex; gap: 0.6rem; padding-bottom: 1rem; }
.location-hidden-row td { color: var(--gray-color); background: #fafbfc; }
@media (max-width: 900px) {
    .location-fields { grid-template-columns: 1fr; }
    .location-fields .location-field-wide { grid-column: auto; }
}

/* ─── Physicians page ─── */
.physician-initials {
    display: inline-flex; align-items: center; justify-content: center;
    width: 36px; height: 36px; border-radius: 50%;
    background: var(--navy); color: var(--white); font-weight: 700; font-size: 0.8rem;
}
.location-hidden-row .physician-initials { background: #b8c2cc; }
.physician-loc-note { color: #c62828; font-size: 0.78rem; margin-top: 0.2rem; }

/* ─── Live Chat page ─── */
.chat-admin { display: grid; grid-template-columns: 340px minmax(0, 1fr); gap: 1.5rem; align-items: start; }
@media (max-width: 900px) { .chat-admin { grid-template-columns: 1fr; } }

.chat-availability { background: var(--white); border-radius: 10px; box-shadow: var(--shadow); padding: 1rem 1.1rem; }
.chat-switch { display: flex; align-items: center; gap: 0.7rem; cursor: pointer; font-weight: 700; }
.chat-switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.chat-switch-track { width: 46px; height: 26px; border-radius: 13px; background: #c9d1da; position: relative; flex-shrink: 0; transition: background 0.2s; }
.chat-switch-thumb { position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,0.25); transition: transform 0.2s; }
.chat-switch input:checked + .chat-switch-track { background: var(--secondary-color); }
.chat-switch input:checked + .chat-switch-track .chat-switch-thumb { transform: translateX(20px); }
.chat-switch input:focus-visible + .chat-switch-track { outline: 3px solid var(--primary-color); outline-offset: 2px; }
.chat-switch-label { color: var(--gray-color); font-size: 0.95rem; }
.chat-switch-label.on { color: #1e8449; }
.chat-staff-online { font-size: 0.82rem; color: var(--gray-color); margin: 0.6rem 0 0; }

.chat-list-group { margin-bottom: 1.2rem; }
.chat-list-title { font-size: 0.85rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--dark-color); margin: 0 0 0.5rem; display: flex; align-items: center; gap: 0.4rem; }
.chat-count { background: var(--primary-color); color: #fff; border-radius: 10px; font-size: 0.72rem; padding: 0 7px; line-height: 18px; }
.chat-count-warn { background: var(--warning-color); }
.chat-list { display: flex; flex-direction: column; gap: 0.45rem; max-height: 360px; overflow-y: auto; }
.chat-list-empty { font-size: 0.82rem; color: var(--gray-color); padding: 0.4rem 0.2rem; }
.chat-item {
    text-align: left; width: 100%; background: var(--white); border: 1px solid #e1e8ef; border-left: 4px solid transparent;
    border-radius: 8px; padding: 0.6rem 0.75rem; cursor: pointer; font: inherit; color: var(--dark-color);
}
.chat-item:hover { border-color: #c5d3e0; }
.chat-item.selected { border-color: var(--primary-color); border-left-color: var(--primary-color); background: #f2f8fd; }
.chat-item.has-unread { border-left-color: var(--accent); }
.chat-item-top { display: flex; justify-content: space-between; gap: 0.5rem; }
.chat-item-name { font-weight: 700; font-size: 0.92rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-item-time { font-size: 0.75rem; color: var(--gray-color); white-space: nowrap; }
.chat-item-tags { display: flex; flex-wrap: wrap; gap: 0.3rem; margin: 0.3rem 0; }
.chat-tag { font-size: 0.68rem; font-weight: 700; padding: 1px 7px; border-radius: 10px; background: #eef2f6; color: #5d6d7e; }
.chat-tag-live { background: #e3f7ea; color: #1e8449; }
.chat-tag-idle { background: #f1f1f1; color: #7f8c8d; }
.chat-tag-warn { background: #fff1d6; color: #a66300; }
.chat-tag-new { background: #ffe5d6; color: #c0392b; }
.chat-tag-done { background: #e3f7ea; color: #1e8449; }
.chat-item-last { font-size: 0.8rem; color: var(--gray-color); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.chat-main { background: var(--white); border-radius: 10px; box-shadow: var(--shadow); padding: 1.2rem 1.3rem; min-height: 420px; }
.chat-empty { color: var(--gray-color); text-align: center; padding: 5rem 1rem; }
.chat-detail-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; }
.chat-detail-head h3 { margin: 0; color: var(--dark-color); font-size: 1.15rem; }
.chat-detail-meta { font-size: 0.82rem; color: var(--gray-color); margin-top: 0.2rem; }
.chat-contact { display: flex; flex-wrap: wrap; gap: 0.5rem 1.2rem; margin: 0.7rem 0 0.9rem; }
.chat-contact-link { font-weight: 700; color: var(--primary-color); text-decoration: none; }
.chat-contact-link:hover { text-decoration: underline; }

.chat-thread { background: #f6f9fc; border: 1px solid #e6edf3; border-radius: 10px; padding: 0.9rem; height: 380px; overflow-y: auto; display: flex; flex-direction: column; gap: 0.55rem; }
.chat-bubble { max-width: 78%; padding: 0.5rem 0.8rem; border-radius: 12px; font-size: 0.9rem; line-height: 1.45; white-space: pre-wrap; word-wrap: break-word; }
.chat-bubble-visitor { align-self: flex-start; background: var(--white); border: 1px solid #e1e8ef; border-bottom-left-radius: 4px; }
.chat-bubble-staff { align-self: flex-end; background: var(--primary-color); color: #fff; border-bottom-right-radius: 4px; }
.chat-bubble-system { align-self: center; color: var(--gray-color); font-size: 0.78rem; padding: 0.1rem; }
.chat-bubble-who { display: block; font-size: 0.7rem; font-weight: 700; opacity: 0.75; margin-bottom: 0.15rem; }

.chat-reply { display: flex; gap: 0.6rem; align-items: flex-end; margin-top: 0.8rem; }
.chat-reply textarea { flex: 1; resize: vertical; min-height: 46px; padding: 0.6rem 0.7rem; border: 1px solid #d5dde6; border-radius: 8px; font: inherit; font-size: 0.9rem; }
.chat-reply textarea:focus, .chat-followup textarea:focus { outline: none; border-color: var(--primary-color); }
.chat-reply[hidden] { display: none; }
.chat-detail .form-alert { margin-top: 0.7rem; }

.chat-followup { border-top: 1px solid #e6edf3; margin-top: 1.1rem; padding-top: 0.9rem; }
.chat-followup h4 { margin: 0 0 0.5rem; color: var(--dark-color); font-size: 0.95rem; }
.chat-followup label { font-size: 0.8rem; font-weight: 700; color: var(--dark-color); }
.chat-followup textarea { width: 100%; box-sizing: border-box; margin-top: 0.25rem; padding: 0.6rem 0.7rem; border: 1px solid #d5dde6; border-radius: 8px; font: inherit; font-size: 0.88rem; resize: vertical; }
.chat-followup-row { display: flex; justify-content: space-between; align-items: center; gap: 1rem; margin-top: 0.5rem; flex-wrap: wrap; }
.chat-check { display: inline-flex; align-items: center; gap: 0.4rem; cursor: pointer; }
.chat-followup-by { font-size: 0.78rem; color: var(--gray-color); margin-top: 0.4rem; }

/* ─── Photo Gallery page ─── */
.gallery-drop {
    display: flex; flex-direction: column; align-items: center; gap: 0.3rem; text-align: center;
    border: 2px dashed #c5d3e0; border-radius: 12px; padding: 1.6rem 1rem; cursor: pointer;
    color: var(--dark-color); background: #f8fbfe; transition: border-color 0.2s, background 0.2s;
}
.gallery-drop:hover, .gallery-drop.dragging { border-color: var(--primary-color); background: #eef6fd; }
.gallery-drop input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.gallery-drop:focus-within { outline: 3px solid var(--primary-color); outline-offset: 2px; }
.gallery-drop-icon { font-size: 2rem; }
.gallery-drop-hint { font-size: 0.8rem; color: var(--gray-color); }
.gallery-pending { display: flex; flex-direction: column; gap: 0.8rem; margin-top: 1rem; }
.gallery-total { font-size: 0.85rem; font-weight: 400; color: var(--gray-color); }

.gallery-pending-row, .gallery-admin-row {
    display: grid; grid-template-columns: 150px minmax(0, 1fr) auto; gap: 1rem; align-items: start;
    background: var(--white); border: 1px solid #e1e8ef; border-radius: 10px; padding: 0.8rem;
}
.gallery-admin-list { display: flex; flex-direction: column; gap: 0.8rem; }
.gallery-admin-row.is-hidden { background: #f6f6f6; }
.gallery-admin-row.is-hidden .gallery-thumb { opacity: 0.45; }
.gallery-pending-row.is-uploading { opacity: 0.6; }
.gallery-pending-row.has-error { border-color: var(--danger-color); }
.gallery-pending-row.has-error .gallery-status { color: var(--danger-color); font-weight: 700; }
.gallery-thumb { width: 150px; height: 112px; object-fit: cover; border-radius: 8px; background: #e8eef5; display: block; }
.gallery-fields { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 0 0.8rem; }
.gallery-fields .form-group { margin-bottom: 0.5rem; }
.gallery-field-wide { grid-column: 1 / -1; }
.gallery-fields textarea { width: 100%; box-sizing: border-box; resize: vertical; font: inherit; }
.gallery-status { grid-column: 1 / -1; font-size: 0.78rem; color: var(--gray-color); }
.gallery-actions { display: flex; flex-direction: column; gap: 0.4rem; min-width: 90px; }
.btn-small-danger { color: var(--danger-color) !important; border-color: #f1b6ae !important; }
@media (max-width: 760px) {
    .gallery-pending-row, .gallery-admin-row { grid-template-columns: 1fr; }
    .gallery-thumb { width: 100%; height: 180px; }
    .gallery-fields { grid-template-columns: 1fr; }
    .gallery-actions { flex-direction: row; flex-wrap: wrap; }
}
.gallery-upload [hidden] { display: none !important; }

/* Time clock photos on the admin timesheet */
.timeclock-thumb { position: relative; display: inline-flex; align-items: center; justify-content: center; width: 56px; height: 42px; margin-right: 0.35rem; padding: 0; border: 1px solid #d5dbe1; border-radius: 6px; overflow: hidden; background: #eef2f6; vertical-align: middle; cursor: zoom-in; }
.timeclock-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.timeclock-thumb > span:last-child { position: absolute; left: 0; bottom: 0; padding: 0 4px; font-size: 0.65rem; font-weight: 700; color: #fff; background: rgba(0, 0, 0, 0.55); border-top-right-radius: 4px; }
.timeclock-thumb-none { cursor: default; border-style: dashed; color: var(--gray-color); font-size: 0.62rem; line-height: 1.1; text-align: center; }
.timeclock-thumb:focus-visible { outline: 3px solid var(--primary-color); outline-offset: 2px; }
.timeclock-photo-viewer { display: none; position: fixed; inset: 0; z-index: 1000; background: rgba(0, 0, 0, 0.75); align-items: center; justify-content: center; padding: 1rem; }
.timeclock-photo-viewer.open { display: flex; }
.timeclock-photo-viewer figure { margin: 0; background: #fff; border-radius: 10px; padding: 0.8rem; max-width: min(92vw, 680px); text-align: center; }
.timeclock-photo-viewer img { max-width: 100%; max-height: 70vh; border-radius: 6px; display: block; margin: 0 auto; }
.timeclock-photo-viewer figcaption { margin: 0.6rem 0; color: var(--dark-color); font-size: 0.9rem; }
