/* ==========================================================================
   AMS - Attendance Management System
   Common stylesheet (loaded on every page, after Bootstrap)
   Laravel target: public/css/style.css
   ========================================================================== */

/* ---------- 1. Design tokens ---------- */
:root {
    --ams-primary: #8B0101;
    --ams-primary-dark: #6A0101;
    --ams-primary-soft: #FBEAEA;
    --ams-secondary: #C0392B;
    --ams-success: #16a34a;
    --ams-danger: #dc2626;
    --ams-warning: #f59e0b;

    --ams-body-bg: #f4f6fb;
    --ams-surface: #ffffff;
    --ams-border: #e5e7eb;
    --ams-text: #1f2937;
    --ams-muted: #6b7280;

    --ams-header-height: 64px;
    --ams-sidebar-width: 250px;
    --ams-radius: 0.75rem;
    --ams-shadow: 0 1px 3px rgba(16, 24, 40, 0.06), 0 1px 2px rgba(16, 24, 40, 0.04);
    --ams-shadow-lg: 0 20px 40px -12px rgba(16, 24, 40, 0.18);

    /* Map our palette onto Bootstrap's variables */
    --bs-primary: var(--ams-primary);
    --bs-primary-rgb: 139, 1, 1;
    --bs-link-color: var(--ams-primary);
    --bs-link-color-rgb: 139, 1, 1;
    --bs-link-hover-color: var(--ams-primary-dark);
    --bs-body-font-family: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    --bs-body-color: var(--ams-text);
    --bs-border-radius: 0.5rem;
}

/* ---------- 2. Base ---------- */
html, body { height: 100%; }

body {
    background-color: var(--ams-body-bg);
    font-size: 0.9375rem;
    -webkit-font-smoothing: antialiased;
}

a { text-decoration: none; }
a:hover { text-decoration: underline; }

.text-muted-ams { color: var(--ams-muted) !important; }

/* ---------- 3. Bootstrap component overrides ---------- */
.btn-primary {
    --bs-btn-bg: var(--ams-primary);
    --bs-btn-border-color: var(--ams-primary);
    --bs-btn-hover-bg: var(--ams-primary-dark);
    --bs-btn-hover-border-color: var(--ams-primary-dark);
    --bs-btn-active-bg: var(--ams-primary-dark);
    --bs-btn-active-border-color: var(--ams-primary-dark);
    --bs-btn-disabled-bg: var(--ams-primary);
    --bs-btn-disabled-border-color: var(--ams-primary);
}

.btn-outline-primary {
    --bs-btn-color: var(--ams-primary);
    --bs-btn-border-color: var(--ams-primary);
    --bs-btn-hover-bg: var(--ams-primary);
    --bs-btn-hover-border-color: var(--ams-primary);
    --bs-btn-active-bg: var(--ams-primary-dark);
}

.form-control,
.form-select {
    padding: 0.625rem 0.875rem;
    border-color: var(--ams-border);
    background-color: var(--ams-surface);
}

/* Optional checkboxes shouldn't turn green after validation */
.was-validated .form-check-input:not([required]):valid { border-color: var(--bs-border-color); }
.was-validated .form-check-input:not([required]):valid:checked { background-color: var(--ams-primary); border-color: var(--ams-primary); }
.was-validated .form-check-input:not([required]):valid ~ .form-check-label { color: inherit; }

.form-control:focus,
.form-select:focus,
.form-check-input:focus {
    border-color: var(--ams-primary);
    box-shadow: 0 0 0 0.2rem rgba(139, 1, 1, 0.15);
}

.form-check-input:checked {
    background-color: var(--ams-primary);
    border-color: var(--ams-primary);
}

.form-label {
    font-weight: 500;
    font-size: 0.875rem;
    margin-bottom: 0.375rem;
}

.input-group-text {
    background-color: #f9fafb;
    border-color: var(--ams-border);
    color: var(--ams-muted);
}

.card {
    border: 1px solid var(--ams-border);
    border-radius: var(--ams-radius);
    box-shadow: var(--ams-shadow);
}

/* ---------- 4. App layout: header ---------- */
.ams-header {
    height: var(--ams-header-height);
    background: var(--ams-surface);
    border-bottom: 1px solid var(--ams-border);
    position: sticky;
    top: 0;
    z-index: 1030;
}

.ams-brand {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    font-weight: 700;
    font-size: 1.125rem;
    color: var(--ams-text);
}
.ams-brand:hover { text-decoration: none; color: var(--ams-text); }

.ams-brand-logo {
    width: 36px;
    height: 36px;
    border-radius: 0.625rem;
    display: grid;
    place-items: center;
    background: linear-gradient(135deg, var(--ams-primary), var(--ams-secondary));
    color: #fff;
    font-size: 1.125rem;
}

.ams-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    background: var(--ams-primary-soft);
    color: var(--ams-primary);
    font-weight: 600;
    font-size: 0.875rem;
}

.ams-icon-btn {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    color: var(--ams-muted);
    background: transparent;
    border: 0;
    position: relative;
}
.ams-icon-btn:hover { background: #f3f4f6; color: var(--ams-text); }

.ams-badge-dot {
    position: absolute;
    top: 8px;
    right: 9px;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--ams-danger);
    border: 2px solid var(--ams-surface);
}

/* ---------- 5. App layout: sidebar navigation ---------- */
.ams-wrapper {
    display: flex;
    min-height: calc(100vh - var(--ams-header-height));
}

.ams-sidebar {
    width: var(--ams-sidebar-width);
    flex-shrink: 0;
    background: var(--ams-surface);
    border-right: 1px solid var(--ams-border);
}

.ams-sidebar .nav-section {
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--ams-muted);
    padding: 1.25rem 1.25rem 0.5rem;
}

.ams-sidebar .nav-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin: 0.125rem 0.75rem;
    padding: 0.625rem 0.75rem;
    border-radius: 0.5rem;
    color: #4b5563;
    font-weight: 500;
}
.ams-sidebar .nav-link i { font-size: 1.1rem; }
.ams-sidebar .nav-link:hover { background: #f3f4f6; color: var(--ams-text); text-decoration: none; }
.ams-sidebar .nav-link.active { background: var(--ams-primary-soft); color: var(--ams-primary); }

/* Expandable groups */
.ams-sidebar .nav-chevron {
    margin-left: auto;
    font-size: 0.75rem !important;
    transition: transform 0.2s ease;
}
.ams-sidebar .nav-group-toggle:not(.collapsed) .nav-chevron { transform: rotate(180deg); }
.ams-sidebar .nav-group-toggle.has-active { color: var(--ams-primary); }

.ams-sidebar .nav-sub .nav-link {
    position: relative;
    padding: 0.5rem 0.75rem 0.5rem 2.6rem;
    font-size: 0.875rem;
    font-weight: 400;
}
.ams-sidebar .nav-sub .nav-link::before {
    content: "";
    position: absolute;
    left: 1.35rem;
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: #cbd5e1;
}
.ams-sidebar .nav-sub .nav-link.active { font-weight: 500; }
.ams-sidebar .nav-sub .nav-link.active::before { background: var(--ams-primary); }

/* Desktop: static sidebar. Mobile (<992px): Bootstrap offcanvas-lg handles it. */
@media (min-width: 992px) {
    /* Bootstrap makes .offcanvas-lg transparent on desktop; keep our surface */
    .ams-sidebar.offcanvas-lg { background-color: var(--ams-surface) !important; }
    .ams-sidebar {
        position: sticky;
        top: var(--ams-header-height);
        height: calc(100vh - var(--ams-header-height));
        overflow-y: auto;
    }
}

/* ---------- 6. App layout: main content & footer ---------- */
.ams-main {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.ams-content {
    flex: 1;
    padding: 1.5rem;
}

.ams-page-title {
    font-size: 1.375rem;
    font-weight: 700;
    margin-bottom: 0.25rem;
}

.ams-footer {
    padding: 1rem 1.5rem;
    font-size: 0.8125rem;
    color: var(--ams-muted);
    border-top: 1px solid var(--ams-border);
    background: var(--ams-surface);
}
.ams-footer a { color: var(--ams-muted); }

/* ---------- 7. Auth pages (login, forgot password, ...) ---------- */
.auth-page {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background: var(--ams-body-bg);
}

.auth-main {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem 1rem;
}

.auth-card {
    width: 100%;
    max-width: 960px;
    background: var(--ams-surface);
    border-radius: 1rem;
    box-shadow: var(--ams-shadow-lg);
    overflow: hidden;
}

.auth-card-sm { max-width: 440px; }

.auth-aside {
    position: relative;
    height: 100%;
    padding: 3rem 2.5rem;
    color: #fff;
    background:
        radial-gradient(circle at 15% 20%, rgba(255, 255, 255, 0.18), transparent 40%),
        radial-gradient(circle at 85% 85%, rgba(192, 57, 43, 0.45), transparent 45%),
        linear-gradient(145deg, var(--ams-primary) 0%, #5A0000 100%);
    display: flex;
    flex-direction: column;
}

.auth-aside .ams-brand,
.auth-aside .ams-brand:hover { color: #fff; }
.auth-aside .ams-brand-logo { background: rgba(255, 255, 255, 0.18); }

.auth-aside h2 {
    font-weight: 700;
    font-size: 1.75rem;
    line-height: 1.3;
}

.auth-feature {
    display: flex;
    gap: 0.875rem;
    align-items: flex-start;
    margin-bottom: 1.125rem;
}
.auth-feature-icon {
    flex-shrink: 0;
    width: 40px;
    height: 40px;
    border-radius: 0.625rem;
    display: grid;
    place-items: center;
    background: rgba(255, 255, 255, 0.15);
    font-size: 1.125rem;
}
.auth-feature p { margin: 0; font-size: 0.875rem; opacity: 0.85; }

.auth-form-wrap { padding: 3rem 2.5rem; }

.auth-form-wrap h1 {
    font-size: 1.5rem;
    font-weight: 700;
}

.auth-page .ams-footer {
    background: transparent;
    border-top: 0;
    text-align: center;
}

/* Password show/hide button sits inside the input group */
.btn-toggle-password {
    border-color: var(--ams-border);
    color: var(--ams-muted);
    background: #f9fafb;
}
.btn-toggle-password:hover { background: #f3f4f6; color: var(--ams-text); }

@media (max-width: 575.98px) {
    .auth-form-wrap { padding: 2rem 1.5rem; }
}

/* ---------- 8. Page header ---------- */
.ams-page-header .breadcrumb { --bs-breadcrumb-divider-color: var(--ams-muted); }
.ams-page-header .breadcrumb-item,
.ams-page-header .breadcrumb-item a { color: var(--ams-muted); }
.ams-page-header .breadcrumb-item.active { color: var(--ams-text); }

/* ---------- 9. List card, toolbar & tables ---------- */
.ams-toolbar {
    background: var(--ams-surface);
    border-bottom: 1px solid var(--ams-border);
    padding: 1rem 1.25rem;
    border-radius: var(--ams-radius) var(--ams-radius) 0 0 !important;
}
.ams-toolbar .form-control,
.ams-toolbar .form-select { padding-top: 0.45rem; padding-bottom: 0.45rem; font-size: 0.875rem; }
.ams-search { min-width: 220px; max-width: 280px; }
.ams-filter { width: auto; min-width: 150px; }

.ams-table { margin-bottom: 0; font-size: 0.875rem; }
.ams-table > thead th {
    background: #f9fafb;
    color: var(--ams-muted);
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    white-space: nowrap;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--ams-border);
}
.ams-table > tbody td { padding: 0.75rem 1rem; vertical-align: middle; border-color: #f1f2f4; }
.ams-table > tbody tr:hover > td { background: #fcfcfd; }
.ams-table .col-actions { width: 1%; white-space: nowrap; text-align: right; }
.ams-table .col-check { width: 1%; }
.ams-mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 0.8125rem; }

.btn-action {
    width: 32px;
    height: 32px;
    padding: 0;
    display: inline-grid;
    place-items: center;
    border-radius: 0.5rem;
    color: var(--ams-muted);
    border: 1px solid transparent;
}
.btn-action:hover { background: #f3f4f6; color: var(--ams-text); }
.btn-action.text-danger:hover { background: #fef2f2; }

.ams-list-footer {
    background: var(--ams-surface);
    border-top: 1px solid var(--ams-border);
    padding: 0.75rem 1.25rem;
    font-size: 0.8125rem;
    color: var(--ams-muted);
    border-radius: 0 0 var(--ams-radius) var(--ams-radius) !important;
}
.ams-list-footer .form-select { width: auto; font-size: 0.8125rem; padding: 0.3rem 2rem 0.3rem 0.6rem; }
.pagination { --bs-pagination-active-bg: var(--ams-primary); --bs-pagination-active-border-color: var(--ams-primary); --bs-pagination-color: var(--ams-text); --bs-pagination-hover-color: var(--ams-primary); --bs-pagination-focus-box-shadow: 0 0 0 0.2rem rgba(139, 1, 1, 0.15); }

/* Soft status badges */
.badge-soft { font-weight: 500; padding: 0.35em 0.65em; border-radius: 999px; }
.badge-soft-primary { background: var(--ams-primary-soft); color: var(--ams-primary); }
.badge-soft-success { background: #ecfdf3; color: #067647; }
.badge-soft-warning { background: #fffaeb; color: #b54708; }
.badge-soft-info { background: #eff8ff; color: #175cd3; }
.badge-soft-secondary { background: #f2f4f7; color: #475467; }

/* ---------- 10. Forms & modals ---------- */
.ams-form-section { padding: 1.5rem; border-bottom: 1px solid var(--ams-border); }
.ams-form-section:last-child { border-bottom: 0; }
.ams-form-section-title { font-size: 1rem; font-weight: 600; margin-bottom: 0.25rem; }
.ams-form-section-desc { font-size: 0.8125rem; color: var(--ams-muted); margin-bottom: 1.25rem; }
.form-control[readonly] { background-color: #f9fafb; }
.form-text { font-size: 0.8rem; }

.modal-content { border: 0; border-radius: var(--ams-radius); box-shadow: var(--ams-shadow-lg); }
.modal-header, .modal-footer { border-color: var(--ams-border); }
.modal-title { font-size: 1.0625rem; font-weight: 600; }

.ams-step { display: flex; gap: 0.875rem; margin-bottom: 1.25rem; }
.ams-step:last-child { margin-bottom: 0; }
.ams-step-no {
    flex-shrink: 0;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    font-size: 0.8125rem;
    font-weight: 600;
    background: var(--ams-primary-soft);
    color: var(--ams-primary);
}
.ams-icon-circle {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    display: inline-grid;
    place-items: center;
    font-size: 1.375rem;
}

/* Photo upload */
.ams-photo-box {
    width: 140px;
    height: 170px;
    border: 2px dashed var(--ams-border);
    border-radius: var(--ams-radius);
    display: grid;
    place-items: center;
    text-align: center;
    color: var(--ams-muted);
    font-size: 0.8125rem;
    overflow: hidden;
    background: #fafafa;
}
.ams-photo-box img { width: 100%; height: 100%; object-fit: cover; }

/* Badge number preview / format builder */
.ams-badge-preview {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 1.25rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    color: var(--ams-primary);
}
.ams-format { display: flex; flex-wrap: wrap; align-items: stretch; gap: 0.5rem; }
.ams-format-part {
    border: 1px solid var(--ams-border);
    border-radius: 0.625rem;
    padding: 0.625rem 0.875rem;
    min-width: 110px;
    background: #fff;
}
.ams-format-part .val { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 1.125rem; font-weight: 600; color: var(--ams-primary); }
.ams-format-part .lbl { font-size: 0.75rem; color: var(--ams-muted); }
.ams-format-plus { display: grid; place-items: center; color: var(--ams-muted); }

.ams-stat { padding: 1.25rem; }
.ams-stat .num { font-size: 1.5rem; font-weight: 700; line-height: 1.2; }
.ams-stat .lbl { font-size: 0.8125rem; color: var(--ams-muted); }

/* ---------- 11. Fixes ---------- */
/* Keep the white sidebar column full height on long pages */
@media (min-width: 992px) {
    .ams-wrapper {
        background: linear-gradient(to right,
            var(--ams-surface) 0, var(--ams-surface) calc(var(--ams-sidebar-width) - 1px),
            var(--ams-border) calc(var(--ams-sidebar-width) - 1px), var(--ams-border) var(--ams-sidebar-width),
            transparent var(--ams-sidebar-width));
    }
}
.ams-table > tbody td { white-space: nowrap; }
[data-bulk-bar][hidden] { display: none !important; }
.form-control.ams-mono { font-size: 0.9375rem; }
/* Keep row actions visible when a wide table scrolls sideways */
.ams-table .col-actions { position: sticky; right: 0; background: var(--ams-surface); box-shadow: -8px 0 8px -8px rgba(16, 24, 40, 0.12); }
.ams-table > thead th.col-actions { background: #f9fafb; }
.ams-table > tbody tr:hover > td.col-actions { background: #fcfcfd; }

/* ---------- 12. Detail view ---------- */
.ams-dl-label { font-size: 0.75rem; color: var(--ams-muted); margin-bottom: 0.125rem; }
.ams-dl-value { font-weight: 500; }
.ams-photo-initials { font-size: 2.5rem; font-weight: 700; color: var(--ams-primary); }

/* ---------- 13. Attendance: gate ---------- */
.ams-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.4rem 0.75rem;
    border: 1px solid var(--ams-border);
    border-radius: 999px;
    background: var(--ams-surface);
    font-size: 0.8125rem;
    font-weight: 500;
    white-space: nowrap;
}
.ams-chip i { color: var(--ams-primary); }

.ams-gate-empty {
    border: 2px dashed var(--ams-border);
    border-radius: var(--ams-radius);
    padding: 2.5rem 1rem;
    text-align: center;
    font-size: 0.875rem;
}
.ams-gate-card {
    display: flex;
    gap: 1.5rem;
    align-items: center;
    padding: 1.25rem;
    border-radius: var(--ams-radius);
    border: 2px solid;
    animation: ams-pop 0.25s ease;
}
.ams-gate-card.is-in { border-color: #75e0a7; background: #f6fef9; }
.ams-gate-card.is-out { border-color: #d0d5dd; background: #f9fafb; }
.ams-gate-photo { width: 120px; height: 145px; border-style: solid; flex-shrink: 0; }
.ams-gate-type { font-weight: 700; font-size: 1.125rem; }
.is-in .ams-gate-type { color: #067647; }
.is-out .ams-gate-type { color: #475467; }
.ams-gate-name { font-size: 1.5rem; font-weight: 700; line-height: 1.2; margin-top: 0.25rem; }
@keyframes ams-pop { from { transform: scale(0.98); opacity: 0.4; } to { transform: none; opacity: 1; } }

.ams-stat-row { display: flex; align-items: center; gap: 1rem; }
.ams-stat-row .num { font-size: 1.75rem; font-weight: 700; line-height: 1.1; }
.ams-stat-row .lbl { font-size: 0.8125rem; color: var(--ams-muted); }
.ams-stat-icon { width: 48px; height: 48px; border-radius: 0.75rem; display: grid; place-items: center; font-size: 1.375rem; }

.ams-table tr.ams-row-new > td { animation: ams-flash 1.5s ease; }
@keyframes ams-flash { from { background: #fef3c7; } to { background: transparent; } }
.ams-mono.text-uppercase::placeholder { text-transform: none; font-family: var(--bs-body-font-family); }

/* ---------- 14. Attendance: Sunday clock ---------- */
.ams-clock-wrap {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    padding: 1.25rem 1.5rem;
    border-radius: var(--ams-radius);
    background: linear-gradient(135deg, var(--ams-primary), #5A0000);
    color: #fff;
}
.ams-clock-wrap .text-muted-ams { color: rgba(255, 255, 255, 0.75) !important; }
.ams-clock {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 2.75rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    line-height: 1.1;
    font-variant-numeric: tabular-nums;
}
.ams-clock-status {
    padding: 0.5rem 0.9rem;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.16);
    font-weight: 600;
    font-size: 0.875rem;
}
.ams-clock-wrap.is-closed { background: linear-gradient(135deg, #475467, #1d2939); }
.ams-clock-wrap.is-closed .ams-clock-status { background: #fef0c7; color: #93370d; }

.ams-preview-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem 0.75rem;
    border: 1px dashed #d0d5dd;
    border-radius: 0.5rem;
    background: #fcfcfd;
    color: var(--ams-muted);
}
@media (max-width: 575.98px) { .ams-clock { font-size: 2rem; } }

/* ---------- 15. Beas sewa: filtered sewadar list ---------- */
.ams-pick-list { max-height: 520px; overflow-y: auto; }
.ams-pick-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.55rem 1rem;
    border-bottom: 1px solid #f1f2f4;
    cursor: pointer;
    margin: 0;
}
.ams-pick-row:hover { background: #fcfcfd; }
.ams-pick-row:has(input:checked) { background: var(--ams-primary-soft); }
.ams-pick-row.is-busy { opacity: 0.7; cursor: not-allowed; }

.ams-selected-list { max-height: 440px; overflow-y: auto; flex: 1; }
.ams-sel-item { display: flex; align-items: center; gap: 0.75rem; padding: 0.5rem 1rem; border-bottom: 1px solid #f1f2f4; }
.ams-selected-card { display: flex; flex-direction: column; }
.form-check-input:indeterminate, .form-check-input[type=checkbox]:indeterminate { background-color: var(--ams-primary); border-color: var(--ams-primary); }
/* Beas list filters are not form fields to validate */
.was-validated #fSearch, .was-validated #fDept, .was-validated #fGender { border-color: var(--ams-border); }
.was-validated #fSearch { background-image: none; padding-right: 0.875rem; }
.was-validated #fDept, .was-validated #fGender { padding-right: 2.25rem; background-image: var(--bs-form-select-bg-img); }

/* ---------- 16. Sewadar attendance trail ---------- */
.tt-gate    { --tt: #175cd3; --tt-bg: #eff8ff; }
.tt-sunday  { --tt: #b54708; --tt-bg: #fffaeb; }
.tt-midweek { --tt: #6941c6; --tt-bg: #f4f3ff; }
.tt-night   { --tt: #344054; --tt-bg: #f2f4f7; }
.tt-beas    { --tt: var(--ams-primary); --tt-bg: var(--ams-primary-soft); }
.tt-other   { --tt: #067647; --tt-bg: #ecfdf3; }

.ams-type-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.5rem; }
@media (max-width: 575.98px) { .ams-type-grid { grid-template-columns: repeat(2, 1fr); } }
.ams-type-box {
    display: grid;
    grid-template-columns: auto 1fr;
    grid-template-areas: "i n" "l l" "c c";
    align-items: center;
    column-gap: 0.4rem;
    text-align: left;
    padding: 0.5rem 0.65rem;
    border-radius: 0.625rem;
    border: 1px solid transparent;
    background: var(--tt-bg);
    color: var(--tt);
}
.ams-type-box i { grid-area: i; }
.ams-type-box .n { grid-area: n; font-weight: 700; font-size: 1.05rem; }
.ams-type-box .l { grid-area: l; font-size: 0.72rem; font-weight: 600; line-height: 1.2; }
.ams-type-box .c { grid-area: c; font-size: 0.7rem; opacity: 0.8; }
.ams-type-box:hover { border-color: var(--tt); }
.ams-type-box.is-active { border-color: var(--tt); box-shadow: 0 0 0 2px var(--tt-bg); }

.ams-trail-month {
    padding: 0.5rem 1.25rem;
    background: #f9fafb;
    border-bottom: 1px solid var(--ams-border);
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--ams-muted);
}
.ams-trail-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.75rem 1.25rem;
    border-bottom: 1px solid #f1f2f4;
    position: relative;
}
.ams-trail-date { width: 40px; text-align: center; flex-shrink: 0; line-height: 1.1; }
.ams-trail-date .d { display: block; font-size: 1.15rem; font-weight: 700; }
.ams-trail-date .w { display: block; font-size: 0.7rem; color: var(--ams-muted); text-transform: uppercase; }
.ams-trail-dot {
    width: 36px;
    height: 36px;
    flex-shrink: 0;
    border-radius: 50%;
    display: grid;
    place-items: center;
    background: var(--tt-bg);
    color: var(--tt);
    position: relative;
    z-index: 1;
}
/* vertical line joining the dots */
.ams-trail-item::before {
    content: "";
    position: absolute;
    left: calc(1.25rem + 40px + 1rem + 17px);
    top: 0;
    bottom: 0;
    width: 2px;
    background: #eef0f3;
}
.min-w-0 { min-width: 0; }

/* ---------- 17. Reports ---------- */
.ams-report-table > thead th { vertical-align: middle; }
.ams-report-table > thead th.ams-group-th { border-bottom: 1px solid var(--ams-border); background: #f2f4f7; }
.ams-report-table > thead tr:first-child th[rowspan] { border-bottom: 1px solid var(--ams-border); }
.ams-report-table > thead th + th, .ams-report-table > tbody td + td { border-left: 1px solid #f1f2f4; }
.ams-total-row td { font-weight: 700; background: #f9fafb; border-top: 2px solid var(--ams-border); white-space: nowrap; padding: 0.75rem 1rem; }
@media print {
    .ams-header, .ams-sidebar, .ams-footer, .ams-toolbar, .ams-list-footer, .ams-page-header .d-flex.gap-2, form.card .btn { display: none !important; }
    .ams-wrapper { background: none !important; }
    .ams-content { padding: 0; }
    .card { box-shadow: none; border: 0; }
    .ams-table > tbody tr[hidden] { display: table-row !important; }
}
.ams-report-table > thead th { white-space: normal; padding: 0.6rem 0.65rem; line-height: 1.25; }
.ams-report-table > tbody td, .ams-report-table .ams-total-row td { padding: 0.6rem 0.65rem; }
.ams-report-table > thead tr:last-child th { min-width: 64px; }

/* ---------- 18. User management ---------- */
.ams-perm-table > tbody td { padding: 0.5rem 1rem; }
.ams-perm-table .ams-perm-group > td { background: #f9fafb; border-top: 1px solid var(--ams-border); }
.ams-perm-table th:not(:first-child), .ams-perm-table td:not(:first-child) { width: 76px; }
.ams-sticky-card { position: sticky; top: calc(var(--ams-header-height) + 1rem); }
.ams-preview-group { margin-bottom: 0.5rem; }
.ams-preview-title { font-size: 0.7rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; color: var(--ams-muted); padding: 0.5rem 0.75rem 0.25rem; }
.ams-preview-item { display: flex; justify-content: space-between; gap: 0.5rem; padding: 0.4rem 0.75rem; border-radius: 0.5rem; font-size: 0.875rem; }
.ams-preview-item:hover { background: #f9fafb; }
.ams-preview-acts { font-size: 0.72rem; color: var(--ams-muted); white-space: nowrap; }
.ams-user-pick { max-height: 280px; overflow-y: auto; }
.ams-user-chosen { border: 1px solid var(--ams-border); border-radius: var(--ams-radius); padding: 1rem; background: #fcfcfd; }
.ams-user-photo { width: 72px; height: 88px; }
.ams-user-photo .ams-photo-initials { font-size: 1.5rem; }
#pickSewadar .is-invalid ~ .invalid-feedback, #pickSewadar:has(.is-invalid) .invalid-feedback { display: block; }
.was-validated #sewadarSearch:not(.is-invalid) { border-color: var(--ams-border); background-image: none; }

/* ---------- 19. Dashboard KPI cards ---------- */
.ams-section-title { font-size: 0.75rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; color: var(--ams-muted); margin-bottom: 0.75rem; }
.ams-kpi { color: var(--ams-text); transition: border-color 0.15s ease, box-shadow 0.15s ease; }
.ams-kpi:hover { text-decoration: none; color: var(--ams-text); border-color: #d0d5dd; box-shadow: 0 4px 12px -4px rgba(16, 24, 40, 0.12); }
.ams-kpi .card-body { padding: 1.25rem; }
.ams-kpi .ams-stat-icon { width: 40px; height: 40px; font-size: 1.15rem; }
.ams-kpi-label { font-size: 0.8125rem; font-weight: 500; color: var(--ams-muted); padding-right: 0.5rem; }
.ams-kpi-value { font-size: 2rem; font-weight: 700; line-height: 1.1; margin-top: 0.25rem; font-variant-numeric: tabular-nums; }
.ams-kpi-note { font-size: 0.8125rem; color: var(--ams-muted); margin-top: 0.35rem; }

/* ---------- 20. Collapsible sidebar (desktop) ---------- */
@media (min-width: 992px) {
    .ams-sidebar { transition: width 0.2s ease; }
    .ams-wrapper { transition: background 0.2s ease; }
    body.ams-sidebar-collapsed { --ams-sidebar-width: 72px; }
    body.ams-sidebar-collapsed .ams-sidebar { overflow-x: hidden; }
    body.ams-sidebar-collapsed .ams-sidebar .nav-link {
        font-size: 0;                /* hides the label text, keeps the icon */
        justify-content: center;
        gap: 0;
        margin: 0.125rem 0.625rem;
        padding: 0.625rem 0;
    }
    body.ams-sidebar-collapsed .ams-sidebar .nav-link > i:first-child { font-size: 1.2rem; }
    body.ams-sidebar-collapsed .ams-sidebar .nav-chevron,
    body.ams-sidebar-collapsed .ams-sidebar .nav-sub { display: none !important; }
    body.ams-sidebar-collapsed .ams-sidebar .nav-group-toggle.has-active { background: var(--ams-primary-soft); }
}

/* ---------- 21. Access level: viewing / marking-for bars, preview menu ---------- */
.ams-scope-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.75rem 1rem;
    padding: 0.75rem 1rem;
    background: var(--ams-surface);
    border: 1px solid var(--ams-border);
    border-radius: var(--ams-radius);
}
.ams-scope-title { font-size: 0.8125rem; font-weight: 600; white-space: nowrap; }
.ams-scope-selects { display: flex; flex-wrap: wrap; align-items: center; gap: 0.4rem; }
.ams-scope-selects .form-select { width: auto; min-width: 180px; max-width: 240px; }
.ams-scope-sep { color: var(--ams-muted); font-size: 0.75rem; }
.ams-scope-summary { margin-left: auto; }
.ams-scope-mark { border-color: #fec84b; background: #fffcf5; }
.ams-scope-mark.is-set { border-color: #75e0a7; background: #f6fef9; }
.ams-preview-btn { border: 1px dashed #d0d5dd; background: #fcfcfd; color: var(--ams-muted); font-size: 0.8125rem; }
.ams-preview-btn strong { color: var(--ams-text); }
.ams-preview-btn:hover { border-color: var(--ams-primary); color: var(--ams-text); }
.form-select.ams-locked:disabled { background-color: #f2f4f7; color: var(--ams-text); opacity: 1; }
/* Sidebar separators */
.ams-sidebar .ams-nav-sep { margin: 0.625rem 1.25rem; border-color: var(--ams-border); opacity: 1; }
body.ams-sidebar-collapsed .ams-sidebar .ams-nav-sep { margin: 0.625rem 0.875rem; }

/* ---- All Transactions ---- */
.badge-soft-danger { background: #fef3f2; color: #b42318; }
.ams-table > tbody td.ams-wrap { white-space: normal; min-width: 220px; }
.ams-table > tbody td.ams-wrap-wide { white-space: normal; min-width: 320px; word-break: break-word; }
.ams-table > tbody td.ams-wrap-sm { white-space: normal; min-width: 150px; }

/* Sortable list columns (th[data-sort]) */
th.ams-sortable { cursor: pointer; user-select: none; white-space: nowrap; }
th.ams-sortable::after { content: "\2195"; margin-left: 0.3rem; opacity: 0.35; font-size: 0.8em; }
th.ams-sortable[aria-sort="ascending"]::after { content: "\2191"; opacity: 0.9; }
th.ams-sortable[aria-sort="descending"]::after { content: "\2193"; opacity: 0.9; }
th.ams-sortable:focus-visible { outline: 2px solid var(--ams-primary); outline-offset: -2px; }

/* Manage Incharges: compact department cards */
.ams-dept-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 0.5rem; }
.ams-dept-card { background: var(--ams-surface); border: 1px solid var(--ams-border); border-radius: 0.5rem; padding: 0.4rem 0.6rem; min-width: 0; }
.ams-dept-card.is-empty { opacity: 0.7; }
.ams-dept-card .dn { font-size: 0.8125rem; font-weight: 600; line-height: 1.25; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ams-dept-card .dc { display: flex; gap: 0.75rem; font-size: 0.75rem; color: var(--ams-muted); margin-top: 0.1rem; }
.ams-dept-card .dc b { color: var(--ams-text); font-weight: 700; }
.ams-dept-card .dc .t { margin-left: auto; }

.ams-incharge-tag { font-size: 0.6875rem; font-weight: 600; vertical-align: middle; margin-left: 0.25rem; }

/* Manual Time switch on the marking screens */
.ams-manual-box { border: 1px dashed var(--ams-border); border-radius: 0.5rem; padding: 0.6rem 0.8rem; background: #fcfcfd; }
.ams-manual-box.is-on { border-color: #7cd4fd; background: #f0f9ff; }
.ams-manual-tag { font-size: 0.6875rem; font-weight: 600; vertical-align: middle; margin-left: 0.25rem; }

/* Meeting Attendance marking on phones: each incharge is a card with big buttons */
@media (max-width: 767.98px) {
    .ams-mt-head { width: 100%; }
    .ams-mt-head .btn { width: 100%; }
    .ams-mt-stats { --bs-gutter-x: 0.5rem; --bs-gutter-y: 0.5rem; margin-bottom: 1rem !important; }
    .ams-mt-stats > div { flex: 0 0 25%; max-width: 25%; }
    .ams-mt-stats .ams-stat { padding: 0.5rem 0.4rem; text-align: center; }
    .ams-mt-stats .ams-stat .num { font-size: 1.25rem; }
    .ams-mt-stats .ams-stat .lbl { font-size: 0.6875rem; line-height: 1.2; }
    .ams-mt-toolbar .ams-search { min-width: 0; max-width: none; flex: 1 1 100%; }
    .ams-mt-toolbar .ams-filter { min-width: 0; flex: 1 1 40%; }
    .ams-mt-toolbar .ams-mt-dept { flex-basis: 100%; }
    .ams-mt-toolbar .ms-auto { margin-left: 0 !important; width: 100%; }
    .ams-mt-toolbar .ms-auto .btn { flex: 1 1 0; }
    .ams-mt-table thead { display: none; }
    .ams-mt-table, .ams-mt-table tbody { display: block; width: 100%; }
    .ams-mt-table tbody tr { display: flex; flex-wrap: wrap; align-items: center; column-gap: 0.5rem; row-gap: 0.25rem; padding: 0.75rem 1rem; border-bottom: 1px solid var(--ams-border); }
    .ams-mt-table tbody tr[hidden] { display: none; }
    .ams-mt-table tbody td { display: block; border: 0 !important; padding: 0 !important; background: transparent !important; box-shadow: none !important; position: static !important; width: auto; }
    .ams-mt-table tbody td:nth-child(2) { order: 1; flex: 1 1 0; min-width: 0; font-size: 1rem; }
    .ams-mt-table tbody td:nth-child(5) { order: 2; }
    .ams-mt-table tbody td:nth-child(1) { order: 3; flex: 1 1 100%; font-size: 0.8125rem; color: var(--ams-muted); }
    .ams-mt-table tbody td:nth-child(1) .ams-mono { font-weight: 600; }
    .ams-mt-table tbody td:nth-child(3), .ams-mt-table tbody td:nth-child(4) { order: 4; font-size: 0.8125rem; color: var(--ams-muted); margin-top: -0.25rem; }
    .ams-mt-table tbody td:nth-child(3)::after { content: " \00B7"; }
    .ams-mt-table tbody td.ams-mt-remarks { order: 5; flex: 1 1 100%; color: var(--ams-text); }
    .ams-mt-table tbody td.ams-mt-remarks:empty { display: none; }
    .ams-mt-table tbody td.col-actions { order: 6; flex: 1 1 100%; display: flex; gap: 0.5rem; margin-top: 0.4rem; text-align: left; }
    .ams-mt-table tbody td.col-actions .btn { flex: 1 1 0; padding: 0.6rem 0.5rem; font-size: 0.9375rem; }
    .ams-mt-table tbody td.col-actions .btn[data-mark="sewa"]:only-of-type, .ams-mt-table tbody td.col-actions .btn:has(.bi-pencil) { flex: 0 0 auto; padding-left: 0.9rem; padding-right: 0.9rem; }
    .ams-mt-table tbody .badge { font-size: 0.75rem; padding: 0.35em 0.6em; }
    .ams-mt-table .ams-empty-row td { flex: 1 1 100%; text-align: center; }
}

/* Checkbox multi-select (select[data-multi]) */
.ams-multi { display: inline-block; }
.ams-multi-btn { min-width: 170px; max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ams-multi-btn.is-set { border-color: var(--ams-primary, #8B0101); color: var(--ams-primary, #8B0101); font-weight: 500; }
.ams-multi-menu { min-width: 280px; }
.ams-multi-list { max-height: 280px; overflow-y: auto; }
.ams-multi-item { display: flex; align-items: center; gap: .5rem; padding: .3rem .4rem; border-radius: .375rem; cursor: pointer; font-size: .9rem; margin: 0; }
.ams-multi-item:hover { background: var(--bs-tertiary-bg, #f4f5f7); }
.ams-multi-item .form-check-input { margin: 0; flex: 0 0 auto; }
.col-sm-6 > .ams-multi, .ams-multi.d-block { display: block; }
.col-sm-6 > .ams-multi .ams-multi-btn { max-width: none; width: 100%; }

/* Sewa Schedule: wizard steps, place search, planning */
.ss-steps { display: flex; gap: .5rem; list-style: none; margin: 0; padding: .25rem 0; flex-wrap: wrap; }
.ss-steps li { flex: 1 1 0; min-width: 120px; }
.ss-steps button { display: flex; align-items: center; gap: .5rem; width: 100%; background: none; border: 0; padding: .35rem .25rem; color: var(--bs-secondary-color, #6c757d); text-align: left; }
.ss-steps .num { width: 28px; height: 28px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; border: 2px solid currentColor; font-weight: 600; font-size: .85rem; flex: 0 0 auto; }
.ss-steps li.is-current button { color: var(--ams-primary); font-weight: 600; }
.ss-steps li.is-current .num { background: var(--ams-primary); border-color: var(--ams-primary); color: #fff; }
.ss-steps li.is-done button { color: #198754; cursor: pointer; }
.ss-steps li.is-done .num { background: #d1e7dd; border-color: #198754; }
.ss-place-results { z-index: 20; max-height: 260px; overflow-y: auto; }
.ss-tray { position: sticky; top: 64px; z-index: 15; }
.ss-chip { display: inline-flex; align-items: center; gap: .35rem; padding: .3rem .65rem; border-radius: 999px; border: 1px solid var(--bs-border-color, #dee2e6); background: #fff; font-size: .85rem; cursor: grab; user-select: none; }
.ss-chip:hover { border-color: var(--ams-primary); color: var(--ams-primary); }
.ss-chip.is-used { opacity: .45; }
.ss-chip:active { cursor: grabbing; }
.ss-chip-other { border-style: dashed; border-color: var(--ams-primary); color: var(--ams-primary); font-weight: 600; }
.ss-card.is-over { outline: 2px dashed var(--ams-primary); outline-offset: 2px; background: var(--ams-primary-soft); }
.ss-card.is-open { border-color: var(--ams-primary); }
.ss-alloc-row input { max-width: 110px; }
.ss-alloc-row input.ss-other-input { max-width: 320px; min-width: 180px; }
.ss-sheet { border-collapse: collapse; width: 100%; min-width: 760px; }
.ss-sheet th, .ss-sheet td { border: 1.5px solid #000; padding: .3rem .5rem; text-align: center; vertical-align: middle; font-weight: 700; text-transform: uppercase; font-size: .9rem; color: #000; }
.ss-sheet .ss-lh { color: #e00000; background: #fff; padding: .25rem; }
.ss-sheet .ss-lh-1, .ss-sheet .ss-lh-2 { font-size: 1.35rem; }
.ss-sheet .ss-lh-3 { font-size: 1.2rem; }
.ss-sheet .ss-lh-period { font-size: .75rem; color: #444; font-weight: 600; }
.ss-sheet .ss-head th { background: #bfbfbf; font-size: .9rem; }
.ss-sheet .ss-date { border-bottom-width: 1px; padding-bottom: .15rem; }
.ss-sheet .ss-day { border-top-width: 1px; padding-top: .15rem; }
.ss-sheet .ss-shade td { background: #ededed; }
.ss-sheet .ss-count { font-size: .78rem; font-weight: 600; color: #333; }
@media (max-width: 575.98px) { .ss-steps .lbl { display: none; } .ss-steps li { min-width: 0; } }
.ss-err { display: block; }
.ss-err[hidden] { display: none; }
@media (max-width: 767.98px) {
    .ss-tray-hint { display: none; }
    .ss-tray-chips { flex-wrap: nowrap !important; overflow-x: auto; padding-bottom: .25rem; }
    .ss-tray-chips .ss-chip { flex: 0 0 auto; }
}

/* Nominal Roll: selected people table (compact) */
.nr-sel th, .nr-sel td { padding: .4rem .35rem; font-size: .85rem; white-space: normal !important; }
.nr-sel td:nth-last-child(-n+1) { white-space: nowrap !important; }
.nr-sel th { font-size: .7rem; }
.nr-sel { table-layout: fixed; width: 100%; }
.nr-sel .form-control-sm, .nr-sel .form-select-sm { font-size: .8rem; padding: .2rem .35rem; min-width: 0; }
.nr-sel td { overflow-wrap: anywhere; }
.nr-sel td.ams-mono { font-size: .78rem; overflow-wrap: normal; }
.nr-sel td:last-child .btn-action { padding: .15rem .3rem; }
.nr-sel th.text-nowrap { white-space: nowrap !important; overflow: visible; }
.nr-sel .form-select-sm { padding-right: 1.4rem; background-position: right .3rem center; }

.nr-star { color: #adb5bd; font-size: 1.05rem; }
.nr-star:hover { color: #f0ad00; }
.nr-star.is-on { color: #f0ad00; }

/* Columns chooser next to Export CSV */
.ams-col-chooser { display: inline-flex; }
.ams-col-chooser .ams-multi-btn { min-width: 130px; max-width: 170px; font-size: .875rem; padding-top: .25rem; padding-bottom: .25rem; }

#nrPlanned .list-group-item.active { background: var(--ams-primary-soft); color: inherit; border-color: var(--bs-border-color); }
#nrPlanned .list-group-item.active [data-plan-btn] { background: var(--ams-primary); color: #fff; }
#nrForm .col-md-6 > div > .ams-multi { display: block; }
#nrForm .col-md-6 > div > .ams-multi .ams-multi-btn { max-width: none; width: 100%; }

/* Import Photos */
.ph-drop { border: 2px dashed var(--bs-border-color, #ced4da); cursor: pointer; }
.ph-drop:hover, .ph-drop.is-over { border-color: var(--ams-primary); background: var(--ams-primary-soft); }
.ph-thumb { width: 52px; height: 64px; object-fit: cover; border-radius: .35rem; border: 1px solid var(--bs-border-color, #dee2e6); background: #f4f5f7; }
.ph-old { opacity: .75; }
.ph-table { table-layout: fixed; min-width: 900px; }
.ams-table.ph-table > tbody td { white-space: normal; word-break: break-word; }

/* Functionaries */
.fn-thumb { width: 40px; height: 50px; object-fit: cover; border-radius: .35rem; border: 1px solid var(--bs-border-color, #dee2e6); display: inline-flex; align-items: center; justify-content: center; background: #f4f5f7; color: #adb5bd; }
.ams-table > tbody td.fn-wrap { white-space: normal; min-width: 120px; max-width: 220px; }
.fn-pick { border: 1px solid var(--bs-border-color, #dee2e6); border-radius: .5rem; }
.fn-results .list-group-item[aria-disabled="true"] { opacity: .6; cursor: not-allowed; }
.fn-dept-list { max-height: 360px; overflow-y: auto; column-width: 200px; }
.fn-dept-list .form-check { break-inside: avoid; }
.fn-table { table-layout: fixed; min-width: 980px; }
.ams-table.fn-table > tbody td { white-space: normal; word-break: break-word; }
.ams-table.fn-table > tbody td.text-nowrap { white-space: nowrap; }
.ams-table.fn-table > thead th { white-space: normal; }
.ams-table.fn-table > thead th:first-child { white-space: nowrap; }

/* Emails */
.em-row { padding-top: .7rem; padding-bottom: .7rem; }
.em-who { width: 220px; flex: 0 0 220px; }
@media (max-width: 767.98px) { .em-row > div { flex-wrap: wrap; } .em-who { width: 100%; flex-basis: 100%; } }
.em-file { display: flex; align-items: center; gap: .6rem; border: 1px solid var(--bs-border-color, #dee2e6); border-radius: .5rem; padding: .4rem .6rem; max-width: 320px; }
.em-frame { width: 100%; height: 70vh; min-height: 420px; border: 0; border-radius: inherit; background: #fff; display: block; }
.em-text { white-space: pre-wrap; word-break: break-word; font-size: .95rem; }
.min-w-0 { min-width: 0; }
/* Emails: reply needed */
.em-row.em-wait, .em-row.em-wait:hover, .em-row.em-wait:focus { background: #c62828; color: #fff; border-color: #b71c1c; }
.em-row.em-wait .em-prev, .em-row.em-wait .em-date, .em-row.em-wait .bi { color: #fff !important; opacity: .95; }
.em-row:not(.em-wait) .em-prev, .em-row:not(.em-wait) .em-date { color: var(--ams-muted, #6c757d); }
.em-row.em-wait:hover { background: #b71c1c; }
.em-badge-wait { background: #c62828; color: #fff; }
.em-replybar { border-radius: .6rem; padding: .7rem 1rem; }
.em-replybar-needed { background: #c62828; color: #fff; }
.em-replybar-replied { background: #e8f5e9; color: #1b5e20; border: 1px solid #c8e6c9; }
.em-replybar-none { background: #f4f5f7; color: #495057; border: 1px solid var(--bs-border-color, #dee2e6); }
.em-replybar-none .em-auto-btn, .em-replybar-replied .em-auto-btn { color: #495057; border-color: #adb5bd; }
/* Emails: tags */
.em-row.em-tagged, .em-row.em-tagged:hover, .em-row.em-tagged:focus { background: var(--em-tag); color: var(--em-tag-text); }
.em-row.em-tagged .em-prev, .em-row.em-tagged .em-date, .em-row.em-tagged .bi { color: var(--em-tag-text) !important; opacity: .95; }
.em-row.em-tagged:hover { filter: brightness(.95); }
.em-tag { display: inline-block; font-size: .7rem; font-weight: 700; letter-spacing: .03em; padding: .1rem .45rem; border-radius: .3rem; vertical-align: .1em; box-shadow: 0 0 0 1px rgba(255,255,255,.55); }
.em-tagbox { display: flex; align-items: center; flex-wrap: wrap; gap: .35rem; padding: .45rem .75rem; border-radius: .6rem; border: 1px solid var(--em-tag); color: var(--em-tag); background: #fff; }
.em-tagbox.is-on { background: var(--em-tag); color: var(--em-tag-text); }
.em-tag-btn { padding: .05rem .5rem; font-size: .78rem; border: 1px solid currentColor; color: inherit; background: transparent; }
.em-tag-btn:hover { background: rgba(255,255,255,.2); color: inherit; }
.ams-table td.em-wrap { white-space: normal; max-width: 360px; }
