:root {
    --content-max: 1360px;
    --page-gutter: clamp(16px, 2.4vw, 28px);
    --ink: #12201a;
    --muted: #687871;
    --line: #dfe6ee;
    --paper: #f7fafb;
    --panel: #ffffff;
    --green: #006030;
    --green-dark: #004225;
    --blue: #6090f0;
    --blue-dark: #285fc7;
    --cream: #f6dec6;
    --peach: #f0c090;
    --blush: #f4d6c0;
    --gold: #c58b35;
    --rose: #a94455;
    --shadow: 0 18px 50px rgba(22, 55, 87, .10);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    background:
        linear-gradient(135deg, rgba(0, 96, 48, .16), transparent 28%),
        linear-gradient(315deg, rgba(96, 144, 240, .20), transparent 34%),
        #eef2ed;
    color: var(--ink);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    line-height: 1.5;
}

a {
    color: inherit;
    text-decoration: none;
}

input,
select,
textarea,
button {
    font: inherit;
}

.app-shell {
    display: grid;
    grid-template-columns: 260px minmax(0, 1fr);
    align-items: stretch;
    width: min(calc(100% - 24px), 1480px);
    min-height: calc(100vh - 24px);
    margin: 12px auto;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, .72);
    border-radius: 28px;
    background: rgba(255, 255, 255, .88);
    box-shadow: 0 28px 80px rgba(19, 33, 28, .18);
    -webkit-backdrop-filter: blur(16px);
    backdrop-filter: blur(16px);
}

.sidebar {
    position: sticky;
    top: 0;
    align-self: stretch;
    min-height: calc(100vh - 24px);
    height: auto;
    padding: 24px;
    background:
        linear-gradient(180deg, #123327 0%, #0b241a 100%);
    color: #eef8f2;
    display: flex;
    flex-direction: column;
    gap: 26px;
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
    padding: 6px 4px 16px;
}

.sidebar-head {
    display: grid;
}

.menu-toggle {
    display: none;
}

.mobile-history-nav {
    display: none;
}

.mobile-account-section {
    display: none;
}

.brand span {
    min-width: 0;
}

.brand-logo {
    width: 46px;
    height: 46px;
    flex: 0 0 auto;
    border-radius: 50%;
    background: white;
    object-fit: contain;
    box-shadow: 0 12px 28px rgba(0, 0, 0, .2);
}

.brand strong {
    display: block;
    font-size: 16px;
}

.brand small {
    color: #bdd5c7;
}

.sidebar nav {
    display: grid;
    gap: 10px;
}

.sidebar nav a {
    padding: 11px 14px;
    border: 1px solid rgba(255, 255, 255, .10);
    border-radius: 999px;
    color: #e7f2ec;
    font-weight: 750;
    line-height: 1.2;
    min-width: 0;
    overflow-wrap: anywhere;
    white-space: normal;
}

.sidebar nav a.active,
.sidebar nav a:hover {
    background: rgba(255, 255, 255, .12);
    color: #ffffff;
    border-color: rgba(246, 222, 198, .28);
    box-shadow: inset 3px 0 0 var(--cream), 0 10px 26px rgba(0, 0, 0, .14);
}

.main {
    width: min(100%, var(--content-max));
    margin: 0 auto;
    padding: 30px var(--page-gutter) 56px;
    display: grid;
    gap: 22px;
    align-content: start;
}

.topbar,
.hero-panel,
.split-panel,
.incoming-card,
.table-head,
.modal-head {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    align-items: center;
}

.topbar {
    min-height: 76px;
    padding: 0 2px 4px;
}

.topbar-controls {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 12px;
}

.account-menu {
    position: relative;
}

.account-menu summary {
    list-style: none;
}

.account-menu summary::-webkit-details-marker {
    display: none;
}

.account-trigger {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    min-height: 46px;
    padding: 6px 10px 6px 6px;
    border: 1px solid rgba(0, 96, 48, .18);
    border-radius: 999px;
    background:
        linear-gradient(135deg, rgba(228, 243, 234, .95), rgba(255, 255, 255, .96));
    box-shadow: 0 12px 26px rgba(18, 51, 39, .08);
    cursor: pointer;
}

.account-avatar {
    width: 34px;
    height: 34px;
    display: inline-grid;
    place-items: center;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--green-dark), var(--green));
    color: #ffffff;
    font-weight: 900;
}

.account-trigger-text {
    display: grid;
    gap: 1px;
    min-width: 0;
    text-align: left;
}

.account-trigger-text strong {
    max-width: 150px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--ink);
    font-size: 13px;
}

.account-trigger-text small {
    color: var(--muted);
    font-size: 11px;
    font-weight: 800;
}

.account-chevron {
    color: var(--green-dark);
    font-weight: 900;
}

.account-dropdown {
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    z-index: 20;
    width: 240px;
    padding: 8px;
    border: 1px solid rgba(0, 96, 48, .16);
    border-radius: 14px;
    background: #ffffff;
    box-shadow: 0 22px 60px rgba(18, 51, 39, .18);
    display: grid;
    gap: 6px;
}

.account-dropdown button,
.account-dropdown a {
    width: 100%;
    min-height: 40px;
    padding: 10px 12px;
    border: 0;
    border-radius: 10px;
    background: transparent;
    color: var(--ink);
    text-align: left;
    text-decoration: none;
    font-weight: 850;
    cursor: pointer;
}

.account-dropdown button:hover,
.account-dropdown a:hover {
    background: var(--mint);
    color: var(--green-dark);
}

.page-title-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
}

.title-cell-name {
    max-width: min(56vw, 520px);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.eyebrow {
    margin: 0 0 4px;
    color: var(--green);
    font-size: 12px;
    font-weight: 850;
    letter-spacing: .08em;
    text-transform: uppercase;
}

h1,
h2,
h3,
p {
    margin-top: 0;
}

h1 {
    margin-bottom: 0;
    font-size: 30px;
    line-height: 1.1;
}

h2 {
    margin-bottom: 14px;
    font-size: 20px;
}

h3 {
    margin-bottom: 6px;
}

.muted {
    color: var(--muted);
}

.panel,
.stat-card,
.cell-card,
.auth-card,
.info-card {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 18px;
    box-shadow: var(--shadow);
}

.panel {
    padding: 24px;
}

.hero-panel {
    border-color: rgba(96, 144, 240, .22);
    background:
        linear-gradient(135deg, rgba(96, 144, 240, .12), transparent 42%),
        linear-gradient(145deg, rgba(246, 222, 198, .34), transparent 70%),
        #ffffff;
}

.stats-grid,
.suggestion-grid,
.stage-card-grid,
.member-info-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 16px;
}

.suggestion-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.member-info-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.dashboard-visuals {
    display: grid;
    grid-template-columns: minmax(0, 1.35fr) minmax(320px, .65fr);
    gap: 16px;
}

.analytics-card {
    min-height: 250px;
    padding: 24px;
    border: 1px solid rgba(96, 144, 240, .20);
    border-radius: 22px;
    background: rgba(255, 255, 255, .94);
    box-shadow: var(--shadow);
}

.card-head {
    display: flex;
    justify-content: space-between;
    gap: 14px;
    align-items: start;
    margin-bottom: 18px;
}

.timeline-card {
    background:
        linear-gradient(135deg, rgba(96, 144, 240, .12), transparent 42%),
        linear-gradient(315deg, rgba(0, 96, 48, .10), transparent 38%),
        #ffffff;
}

.timeline-bars {
    min-height: 150px;
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 16px;
    align-items: end;
    padding-top: 20px;
    border-top: 1px solid rgba(96, 144, 240, .16);
}

.timeline-bars span {
    min-height: var(--bar-height);
    display: grid;
    align-content: end;
    gap: 5px;
    padding: 14px 12px;
    border-radius: 16px;
    background: linear-gradient(180deg, rgba(96, 144, 240, .88), rgba(96, 144, 240, .26));
    color: white;
}

.timeline-bars span:nth-child(2) {
    background: linear-gradient(180deg, rgba(0, 96, 48, .88), rgba(0, 96, 48, .26));
}

.timeline-bars span:nth-child(3) {
    background: linear-gradient(180deg, rgba(197, 139, 53, .88), rgba(197, 139, 53, .26));
}

.timeline-bars span:nth-child(4) {
    background: linear-gradient(180deg, rgba(240, 192, 144, .96), rgba(240, 192, 144, .34));
    color: #5c3416;
}

.timeline-bars strong {
    font-size: 22px;
    line-height: 1;
}

.timeline-bars small {
    font-weight: 800;
}

.focus-card {
    display: grid;
    gap: 16px;
    background:
        linear-gradient(145deg, rgba(0, 96, 48, .88), rgba(0, 66, 37, .96)),
        var(--green);
    color: white;
}

.focus-card .eyebrow,
.focus-card .muted {
    color: rgba(255, 255, 255, .76);
}

.focus-card h2 {
    color: white;
}

.focus-ring {
    width: 156px;
    height: 156px;
    display: grid;
    place-items: center;
    justify-self: center;
    border-radius: 50%;
    background:
        radial-gradient(circle at center, #006030 0 48%, transparent 49%),
        conic-gradient(var(--cream), var(--blue), var(--peach), var(--cream));
    box-shadow: inset 0 0 0 12px rgba(255, 255, 255, .12);
}

.focus-ring span,
.focus-ring small {
    grid-area: 1 / 1;
}

.focus-ring span {
    margin-top: -12px;
    font-size: 34px;
    font-weight: 900;
}

.focus-ring small {
    margin-top: 40px;
    max-width: 90px;
    color: rgba(255, 255, 255, .76);
    font-size: 12px;
    font-weight: 800;
    text-align: center;
}

.stat-card,
.cell-card,
.info-card {
    padding: 18px;
}

.stat-card {
    position: relative;
    min-height: 156px;
    overflow: hidden;
    display: grid;
    align-content: space-between;
    gap: 12px;
    border-color: rgba(96, 144, 240, .24);
    background: linear-gradient(145deg, #edf4ff 0%, #ffffff 72%);
}

.stat-card::after {
    content: "";
    position: absolute;
    right: -42px;
    top: -46px;
    width: 118px;
    height: 118px;
    border-radius: 50%;
    background: rgba(96, 144, 240, .12);
    pointer-events: none;
}

.stats-grid .stat-card:nth-child(2) {
    border-color: rgba(0, 96, 48, .22);
    background: linear-gradient(145deg, #eaf7ef 0%, #ffffff 72%);
}

.stats-grid .stat-card:nth-child(2)::after {
    background: rgba(0, 96, 48, .10);
}

.stats-grid .stat-card:nth-child(3) {
    border-color: rgba(197, 139, 53, .26);
    background: linear-gradient(145deg, #fff4df 0%, #ffffff 72%);
}

.stats-grid .stat-card:nth-child(3)::after {
    background: rgba(197, 139, 53, .12);
}

.stats-grid .stat-card:nth-child(4) {
    border-color: rgba(240, 192, 144, .46);
    background: linear-gradient(145deg, #fff0e3 0%, #ffffff 72%);
}

.stats-grid .stat-card:nth-child(4)::after {
    background: rgba(240, 192, 144, .18);
}

.stats-grid .stat-card:nth-child(5) {
    border-color: rgba(0, 96, 48, .20);
    background: linear-gradient(145deg, #eefaf2 0%, #ffffff 72%);
}

.stats-grid .stat-card:nth-child(6) {
    border-color: rgba(96, 144, 240, .28);
    background: linear-gradient(145deg, #edf4ff 0%, #fff8ed 100%);
}

.stat-card-head {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    gap: 10px;
}

.stat-icon {
    display: inline-grid;
    place-items: center;
    width: 42px;
    height: 42px;
    flex: 0 0 auto;
    border-radius: 14px;
    background: #eaf1ff;
    color: var(--blue-dark);
    box-shadow: inset 0 0 0 1px rgba(96, 144, 240, .24);
}

.stats-grid .stat-card:nth-child(2) .stat-icon,
.stats-grid .stat-card:nth-child(5) .stat-icon {
    background: #e4f3ea;
    color: var(--green-dark);
    box-shadow: inset 0 0 0 1px rgba(0, 96, 48, .18);
}

.stats-grid .stat-card:nth-child(3) .stat-icon {
    background: #fff0d1;
    color: #8c5b18;
    box-shadow: inset 0 0 0 1px rgba(197, 139, 53, .20);
}

.stats-grid .stat-card:nth-child(4) .stat-icon {
    background: #ffe8d7;
    color: #a45822;
    box-shadow: inset 0 0 0 1px rgba(240, 192, 144, .32);
}

.stat-icon svg {
    width: 22px;
    height: 22px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.stat-label {
    font-weight: 900;
}

.cell-card {
    display: grid;
    gap: 10px;
}

.cell-card p,
.cell-card small,
.stat-card span,
.stat-card small,
.info-card span,
.info-card small {
    display: block;
    color: var(--muted);
}

.stat-card strong {
    position: relative;
    z-index: 1;
    display: block;
    margin: 2px 0 0;
    color: var(--ink);
    font-size: 38px;
    line-height: 1;
}

.stat-card small {
    position: relative;
    z-index: 1;
    line-height: 1.35;
}

.stage-link-card {
    display: block;
}

.stage-link-card:hover,
.report-summary-card:hover,
.dashboard-summary-card:hover {
    border-color: var(--green);
    background: #fbfdff;
}

.report-summary-card,
.dashboard-summary-card {
    color: inherit;
}

.report-filter-panel {
    display: grid;
    gap: 18px;
}

.report-filter-form {
    display: grid;
    grid-template-columns: repeat(4, minmax(150px, 1fr));
    gap: 12px;
    align-items: end;
}

.compact-filter-form {
    display: grid;
    grid-template-columns: repeat(2, minmax(180px, 1fr)) max-content;
    gap: 12px;
    align-items: end;
}

.report-dashboard-grid {
    display: grid;
    grid-template-columns: minmax(260px, .8fr) minmax(280px, 1fr) minmax(280px, 1fr);
    gap: 16px;
}

.role-dashboard-panel {
    padding: 18px;
    border-color: rgba(0, 96, 48, .16);
    background:
        linear-gradient(135deg, rgba(228, 243, 234, .72), transparent 42%),
        linear-gradient(315deg, rgba(237, 244, 255, .78), transparent 46%),
        #ffffff;
}

.role-dashboard-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 14px;
}

.role-dashboard-head h2 {
    margin: 0;
    font-size: 19px;
    line-height: 1.2;
}

.role-dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
    gap: 12px;
}

.role-mini-card {
    --role-accent: var(--blue);
    --role-soft: rgba(96, 144, 240, .10);
    position: relative;
    min-height: 94px;
    padding: 14px 14px 13px;
    overflow: hidden;
    border: 1px solid rgba(96, 144, 240, .16);
    border-radius: 8px;
    background:
        linear-gradient(145deg, var(--role-soft), rgba(255, 255, 255, .96) 68%),
        #ffffff;
    box-shadow: 0 12px 28px rgba(22, 55, 87, .07);
}

.role-mini-card::before {
    content: "";
    position: absolute;
    inset: 0 auto 0 0;
    width: 4px;
    background: var(--role-accent);
}

.role-mini-card::after {
    content: "";
    position: absolute;
    right: -18px;
    top: -22px;
    width: 76px;
    height: 76px;
    border-radius: 50%;
    background: var(--role-soft);
}

.role-mini-card span {
    position: relative;
    z-index: 1;
    display: block;
    color: var(--muted);
    font-size: 12.5px;
    font-weight: 900;
    line-height: 1.25;
}

.role-mini-card strong {
    position: relative;
    z-index: 1;
    display: block;
    margin-top: 12px;
    color: var(--ink);
    font-size: 34px;
    line-height: 1;
}

.role-mini-card-super-admin {
    --role-accent: var(--green);
    --role-soft: rgba(0, 96, 48, .11);
}

.role-mini-card-admin {
    --role-accent: var(--blue-dark);
    --role-soft: rgba(96, 144, 240, .13);
}

.role-mini-card-district-leader {
    --role-accent: var(--gold);
    --role-soft: rgba(197, 139, 53, .14);
}

.role-mini-card-zone-leader {
    --role-accent: #a45822;
    --role-soft: rgba(240, 192, 144, .18);
}

.role-mini-card-cell-leader {
    --role-accent: #2f7d5a;
    --role-soft: rgba(47, 125, 90, .12);
}

.role-mini-card-cell-co-leader {
    --role-accent: #7b61d1;
    --role-soft: rgba(123, 97, 209, .12);
}

.role-mini-card-registration-agent {
    --role-accent: var(--rose);
    --role-soft: rgba(169, 68, 85, .10);
}

.presence-hero,
.presence-list-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.presence-switcher {
    display: flex;
    align-items: end;
    gap: 10px;
    flex-wrap: wrap;
}

.presence-metrics {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 16px;
}

.presence-form {
    display: grid;
    gap: 18px;
}

.presence-success-panel {
    min-height: 420px;
    display: grid;
    place-items: center;
    align-content: center;
    gap: 14px;
    text-align: center;
    background:
        linear-gradient(135deg, rgba(228, 243, 234, .86), transparent 48%),
        linear-gradient(315deg, rgba(237, 244, 255, .78), transparent 52%),
        #ffffff;
}

.presence-success-icon {
    width: 112px;
    height: 112px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--green), var(--green-dark));
    color: #ffffff;
    box-shadow: 0 22px 46px rgba(0, 96, 48, .22);
}

.presence-success-icon svg {
    width: 58px;
    height: 58px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.presence-success-panel h2 {
    margin: 0;
    font-size: clamp(28px, 4vw, 42px);
    line-height: 1.05;
}

.presence-success-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px;
    margin-top: 8px;
}

.presence-member-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
    gap: 10px;
}

.presence-member {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    align-items: center;
    gap: 12px;
    min-height: 68px;
    padding: 12px;
    border: 1px solid rgba(96, 144, 240, .16);
    border-radius: 8px;
    background: #fbfdff;
}

.presence-member input {
    width: 22px;
    height: 22px;
    accent-color: var(--green);
}

.presence-member strong,
.presence-member small {
    display: block;
}

.presence-member small {
    color: var(--muted);
    font-size: 12px;
}

.presence-notes {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
}

.presence-convertis-field {
    width: min(100%, 180px);
}

.presence-convertis-field input {
    text-align: center;
}

input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button {
    margin: 0;
    -webkit-appearance: none;
}

input[type="number"] {
    appearance: textfield;
    -moz-appearance: textfield;
}

.success-pill {
    background: #e4f3ea;
    color: var(--green-dark);
}

.danger-pill {
    background: #fff0f2;
    color: var(--rose);
}

.report-chart-card {
    min-height: 230px;
}

.report-chart-card:nth-child(4) {
    grid-column: 1 / -1;
}

.report-donut {
    width: 158px;
    height: 158px;
    display: grid;
    place-items: center;
    justify-self: center;
    border-radius: 50%;
    background:
        radial-gradient(circle at center, #fff 0 54%, transparent 55%),
        conic-gradient(var(--green) var(--report-angle), rgba(96, 144, 240, .16) 0);
}

.report-donut strong,
.report-donut small {
    grid-area: 1 / 1;
}

.report-donut strong {
    margin-top: -12px;
    font-size: 34px;
    line-height: 1;
}

.report-donut small {
    margin-top: 38px;
    color: var(--muted);
    font-weight: 850;
}

.report-bars {
    display: grid;
    gap: 12px;
}

.report-bar-row {
    display: grid;
    grid-template-columns: minmax(90px, .7fr) minmax(120px, 1fr) auto;
    gap: 10px;
    align-items: center;
}

.report-bar-row span {
    min-width: 0;
    overflow: hidden;
    color: var(--muted);
    font-size: 13px;
    font-weight: 850;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.report-bar-row div {
    height: 10px;
    overflow: hidden;
    border-radius: 999px;
    background: rgba(96, 144, 240, .14);
}

.report-bar-row i {
    display: block;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, var(--green), var(--blue));
}

.report-bar-row strong {
    font-size: 13px;
}

.match,
.pill {
    display: inline-flex;
    width: max-content;
    max-width: 100%;
    align-items: center;
    border-radius: 999px;
    background: #e4f3ea;
    color: var(--green-dark);
    padding: 5px 10px;
    font-size: 12px;
    font-weight: 850;
}

.btn {
    display: inline-flex;
    min-height: 40px;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(96, 144, 240, .22);
    border-radius: 999px;
    background:
        linear-gradient(180deg, rgba(255, 255, 255, .96), rgba(245, 248, 255, .94));
    color: var(--ink);
    padding: 9px 16px;
    font-weight: 850;
    cursor: pointer;
    text-align: center;
    box-shadow: 0 8px 18px rgba(22, 55, 87, .07);
    transition: transform .16s ease, box-shadow .16s ease, border-color .16s ease, background .16s ease, color .16s ease;
}

.btn:hover {
    transform: translateY(-1px);
    border-color: rgba(96, 144, 240, .40);
    box-shadow: 0 12px 24px rgba(22, 55, 87, .11);
}

.btn.is-loading {
    cursor: wait;
    opacity: .78;
    transform: none;
}

.btn.primary {
    border-color: #123327;
    background: linear-gradient(135deg, #123327, #0b241a);
    color: white;
    box-shadow: 0 10px 22px rgba(18, 51, 39, .18);
}

.btn.primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 14px 28px rgba(18, 51, 39, .24);
}

.btn.ghost {
    background: linear-gradient(180deg, #fffaf2, #fff3df);
    border-color: rgba(197, 139, 53, .28);
    color: #7a5016;
}

.btn.ghost:hover {
    border-color: rgba(197, 139, 53, .42);
    box-shadow: 0 12px 24px rgba(197, 139, 53, .14);
}

.btn.danger {
    border-color: rgba(169, 68, 85, .30);
    background: linear-gradient(180deg, #fff7f8, #fff0f3);
    color: var(--rose);
}

.btn.danger:hover {
    border-color: rgba(169, 68, 85, .48);
    box-shadow: 0 12px 24px rgba(169, 68, 85, .14);
}

.count-pill {
    background: #fff0d1;
    color: #7a5016;
}

.btn.small {
    min-height: 36px;
    padding: 7px 12px;
    font-size: 13px;
}

.user-action-tab.modify-action {
    border-color: rgba(96, 144, 240, .38);
    background: linear-gradient(135deg, #e8f0ff, #ffffff);
    color: var(--blue-dark);
}

.user-action-tab.activate-action {
    border-color: rgba(0, 96, 48, .28);
    background: linear-gradient(135deg, #e4f3ea, #ffffff);
    color: var(--green-dark);
}

.user-action-tab.deactivate-action {
    border-color: rgba(170, 58, 58, .30);
    background: linear-gradient(135deg, #ffe8e8, #ffffff);
    color: #8a2424;
}

.user-action-tab.password-action {
    border-color: rgba(197, 139, 53, .32);
    background: linear-gradient(135deg, #fff0d1, #ffffff);
    color: #7a5016;
}

.user-action-tab.primary {
    color: white;
}

.user-action-tab.modify-action.primary {
    border-color: #1f4f9e;
    background: linear-gradient(135deg, #2f6fd6, #17488f);
    color: #ffffff;
    box-shadow: 0 12px 24px rgba(47, 111, 214, .24);
}

.user-action-tab.activate-action.primary {
    border-color: #006030;
    background: linear-gradient(135deg, #008f49, #006030);
    color: #ffffff;
    box-shadow: 0 12px 24px rgba(0, 96, 48, .24);
}

.user-action-tab.deactivate-action.primary {
    border-color: #9f2d2d;
    background: linear-gradient(135deg, #c84949, #8a2424);
    color: #ffffff;
    box-shadow: 0 12px 24px rgba(170, 58, 58, .24);
}

.user-action-tab.password-action.primary,
.btn.password-confirm {
    border-color: #8a5a14;
    background: linear-gradient(135deg, #c58b35, #7a5016);
    color: #ffffff;
    box-shadow: 0 12px 24px rgba(197, 139, 53, .24);
}

.btn.password-confirm:hover {
    border-color: #7a5016;
    box-shadow: 0 14px 28px rgba(197, 139, 53, .30);
}

.followup-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    align-items: center;
    gap: 10px;
}

.contact-action {
    gap: 8px;
}

.call-action {
    border-color: rgba(96, 144, 240, .34);
    color: var(--blue-dark);
}

.whatsapp-action {
    border-color: rgba(0, 96, 48, .24);
    background: linear-gradient(135deg, #e7f7ec, #ffffff);
    color: var(--green-dark);
}

.btn.full {
    width: 100%;
}

.btn:disabled {
    cursor: not-allowed;
    opacity: .55;
    transform: none;
    box-shadow: none;
}

.is-hidden {
    display: none !important;
}

.alert {
    padding: 14px 16px;
    border-radius: 8px;
    border: 1px solid var(--line);
    background: #fff;
}

.app-flash {
    position: sticky;
    top: 14px;
    z-index: 40;
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 18px;
    border-width: 2px;
    box-shadow: 0 18px 44px rgba(22, 55, 87, .16);
    font-weight: 850;
}

.flash-icon {
    flex: 0 0 auto;
    display: grid;
    width: 28px;
    height: 28px;
    place-items: center;
    border-radius: 999px;
    background: var(--green);
    color: #ffffff;
    font-weight: 950;
}

.alert.success {
    border-color: #5fbd7b;
    background: linear-gradient(135deg, #e8f8ed, #f7fbff);
    color: var(--green-dark);
}

.alert.danger {
    border-color: #d87586;
    background: #fff0f3;
    color: var(--rose);
}

.incoming-alert {
    display: block;
    padding: 18px;
    border: 2px solid var(--gold);
    border-radius: 8px;
    background: linear-gradient(135deg, #fff8e8, #eef4ff);
    box-shadow: 0 18px 50px rgba(197, 139, 53, .18);
    color: var(--ink);
    text-decoration: none;
    transition: transform .18s ease, border-color .18s ease, box-shadow .18s ease;
}

@keyframes notice-fade-in {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes notice-fade-out {
    from { opacity: 1; }
    to { opacity: 0; }
}

@keyframes notice-rise-in {
    from {
        opacity: 0;
        transform: translateY(14px) scale(.98);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.incoming-alert:hover {
    border-color: var(--green);
    box-shadow: 0 20px 54px rgba(0, 96, 48, .16);
    transform: translateY(-1px);
}

.incoming-alert-content {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    align-items: center;
}

.incoming-list,
.stack {
    display: grid;
    gap: 12px;
}

.incoming-card {
    padding: 14px;
    border: 1px solid rgba(197, 139, 53, .38);
    border-radius: 8px;
    background: #ffffff;
}

.incoming-alert-pill {
    text-decoration: none;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
}

.form-section {
    border: 1px solid var(--line);
    border-radius: 8px;
    margin: 4px 0 0;
    padding: 16px;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

.form-section legend {
    padding: 0 8px;
    color: var(--green-dark);
    font-size: 13px;
    font-weight: 850;
}

label {
    display: grid;
    gap: 7px;
    color: var(--muted);
    font-size: 13px;
    font-weight: 800;
}

.compact-field {
    align-self: start;
}

input,
select,
textarea {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fbfdff;
    color: var(--ink);
    padding: 11px 12px;
    outline: none;
}

.fr-date-input[data-wednesday-only],
.fr-date-input[data-current-wednesday-only] {
    padding-right: 44px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24' fill='none' stroke='%23687871' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M8 2v4'/%3E%3Cpath d='M16 2v4'/%3E%3Crect width='18' height='18' x='3' y='4' rx='2'/%3E%3Cpath d='M3 10h18'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    background-size: 18px 18px;
}

.password-control {
    position: relative;
    display: block;
}

.password-control input {
    padding-right: 46px;
}

.password-toggle {
    position: absolute;
    right: 6px;
    top: 50%;
    width: 34px;
    height: 34px;
    display: inline-grid;
    place-items: center;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: var(--muted);
    cursor: pointer;
    transform: translateY(-50%);
}

.password-toggle:hover,
.password-toggle.is-active {
    background: #eef4ff;
    color: var(--green-dark);
}

.password-toggle svg {
    width: 19px;
    height: 19px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

input:focus,
select:focus,
textarea:focus {
    border-color: var(--green);
    box-shadow: 0 0 0 4px rgba(96, 144, 240, .18);
}

.account-combobox {
    position: relative;
    gap: 8px;
}

.btn-icon {
    display: inline-grid;
    place-items: center;
    width: 18px;
    height: 18px;
    flex: 0 0 auto;
}

.btn-icon svg {
    width: 18px;
    height: 18px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.account-combobox input[type="search"] {
    padding-left: 36px;
    background-image:
        url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' viewBox='0 0 24 24' fill='none' stroke='%236090f0' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='8'/%3E%3Cpath d='m21 21-4.3-4.3'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: 12px center;
}

.account-results {
    position: absolute;
    z-index: 20;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    max-height: 220px;
    overflow-y: auto;
    padding: 6px;
    border: 1px solid #d8e5ff;
    border-radius: 8px;
    background: #ffffff;
    box-shadow: 0 18px 44px rgba(40, 95, 199, .16);
}

.account-option {
    width: 100%;
    min-height: 42px;
    display: grid;
    gap: 2px;
    justify-items: start;
    border: 0;
    border-radius: 7px;
    background: transparent;
    padding: 8px 10px;
    color: var(--ink);
    text-align: left;
    cursor: pointer;
}

.account-option:hover,
.account-option:focus {
    background: #eef4ff;
    outline: none;
}

.account-option:disabled {
    cursor: not-allowed;
    opacity: .55;
}

.account-option:disabled:hover,
.account-option:disabled:focus {
    background: transparent;
}

.account-option strong,
.account-option small {
    display: block;
}

.account-option small {
    color: var(--muted);
}

.module-check {
    grid-template-columns: auto minmax(0, 1fr);
    align-items: start;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fbfdff;
}

.module-check input {
    width: 18px;
    height: 18px;
    margin-top: 2px;
}

.module-check strong,
.module-check small {
    display: block;
}

.span-2 {
    grid-column: span 2;
}

.data-panel {
    padding: 14px;
    overflow: hidden;
    border-color: rgba(96, 144, 240, .18);
    background:
        linear-gradient(135deg, rgba(96, 144, 240, .08), transparent 34%),
        #ffffff;
}

.data-panel .table-head {
    padding: 4px 6px 12px;
}

.data-panel .table-head h2 {
    margin-bottom: 0;
    font-size: 19px;
}

.deleted-report-panel,
.expandable-report-panel {
    margin-top: 16px;
}

.deleted-report-panel summary,
.expandable-report-panel summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 16px 18px;
    border: 1px solid rgba(169, 68, 85, .20);
    border-radius: 8px;
    background: linear-gradient(135deg, #fff7f8, #ffffff);
    box-shadow: 0 12px 30px rgba(169, 68, 85, .08);
    cursor: pointer;
    list-style: none;
}

.deleted-report-panel summary::-webkit-details-marker,
.expandable-report-panel summary::-webkit-details-marker {
    display: none;
}

.deleted-report-panel summary span:first-child,
.expandable-report-panel summary span:first-child {
    display: grid;
    gap: 2px;
}

.deleted-report-panel summary strong,
.expandable-report-panel summary strong {
    color: var(--ink);
    font-size: 18px;
}

.deleted-report-panel summary small,
.expandable-report-panel summary small {
    color: var(--muted);
    font-weight: 800;
}

.deleted-report-panel[open] summary,
.expandable-report-panel[open] summary {
    margin-bottom: 10px;
}

.deleted-report-panel[open] .count-pill,
.expandable-report-panel[open] .count-pill {
    background: #fff0f2;
    color: var(--rose);
}

.table-tools {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    align-items: center;
    gap: 10px;
}

.table-search {
    min-width: min(360px, 60vw);
}

.table-search span {
    color: var(--muted);
    font-size: 12px;
    font-weight: 850;
}

.table-search input,
.table-search select {
    min-height: 38px;
    padding: 8px 12px;
}

.compact-location-filter {
    display: grid;
    grid-template-columns: repeat(4, minmax(140px, 1fr)) auto auto;
    align-items: end;
    gap: 8px;
    width: min(100%, 980px);
}

.compact-location-filter label {
    display: grid;
    gap: 4px;
    color: var(--muted);
    font-size: 12px;
    font-weight: 850;
}

.compact-location-filter select {
    min-height: 38px;
    padding: 8px 12px;
}

.mobile-location-select {
    display: none;
}

.table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-inline: contain;
    border: 0;
    border-radius: 18px;
    background: var(--panel);
    box-shadow: inset 0 0 0 1px rgba(96, 144, 240, .16);
}

table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    min-width: 760px;
}

th,
td {
    padding: 17px 18px;
    border-bottom: 0;
    text-align: center;
    vertical-align: middle;
}

th {
    background: #123327;
    color: #ffffff;
    font-size: 13px;
    font-weight: 900;
    text-transform: none;
}

th:first-child {
    border-top-left-radius: 16px;
}

th:last-child {
    border-top-right-radius: 16px;
}

tbody tr:nth-child(even) {
    background: #edf4ff;
}

tbody tr:nth-child(odd) {
    background: #eaf7ef;
}

tbody tr:hover {
    position: relative;
    z-index: 1;
    background: #fff8ed;
    box-shadow: 0 10px 24px rgba(18, 32, 26, .18);
    transform: translateY(-1px);
}

tbody tr:last-child td {
    border-bottom: 0;
}

td:first-child {
    font-weight: 850;
    color: var(--ink);
}

tbody tr {
    transition: transform .16s ease, box-shadow .16s ease, background .16s ease;
}

td:last-child {
    white-space: nowrap;
}

td:last-child .btn {
    border-color: #123327;
    background: linear-gradient(135deg, #123327, #0b241a);
    color: #ffffff;
    box-shadow: 0 10px 22px rgba(18, 51, 39, .18);
}

td:last-child .btn:hover {
    border-color: #123327;
    box-shadow: 0 14px 28px rgba(18, 51, 39, .24);
}

.btn.dark-action {
    border-color: #123327;
    background: linear-gradient(135deg, #123327, #0b241a);
    color: #ffffff;
    box-shadow: 0 10px 22px rgba(18, 51, 39, .18);
}

.btn.dark-action:hover {
    border-color: #123327;
    box-shadow: 0 14px 28px rgba(18, 51, 39, .24);
}

.empty {
    color: var(--muted);
    text-align: center;
}

.member-filter {
    display: grid;
    grid-template-columns: minmax(220px, 280px) max-content max-content;
    gap: 12px;
    align-items: end;
}

.list-tools {
    display: flex;
    justify-content: space-between;
    gap: 18px;
    align-items: end;
}

.search-actions {
    display: grid;
    grid-template-columns: minmax(260px, 360px) max-content max-content max-content max-content;
    gap: 10px;
    align-items: end;
}

.row-actions {
    display: inline-flex;
    flex-wrap: nowrap;
    gap: 8px;
    align-items: center;
    white-space: nowrap;
}

.row-actions .btn {
    flex: 0 0 auto;
}

.follow-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
}

.check-card {
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 14px;
    color: var(--ink);
    background: #fbfdff;
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) minmax(140px, .6fr);
    align-items: center;
    gap: 10px;
}

.check-card input {
    width: 18px;
    height: 18px;
}

.presence-count-card {
    grid-template-columns: minmax(0, 1fr) auto;
    border-color: rgba(0, 96, 48, .18);
    background: linear-gradient(145deg, #eaf7ef 0%, #ffffff 76%);
}

.presence-count-card strong {
    font-size: 28px;
    line-height: 1;
}

.presence-count-card small {
    grid-column: 1 / -1;
    color: var(--muted);
    font-size: 12px;
}

.check-card input[type="date"],
.fr-date-input {
    width: 100%;
    height: auto;
    padding: 8px 10px;
}

.section-head {
    display: flex;
    justify-content: space-between;
    gap: 14px;
    align-items: flex-start;
}

.member-actions-panel {
    display: grid;
    gap: 18px;
}

.member-action-form {
    display: grid;
    gap: 12px;
}

.member-action-rows {
    display: grid;
    gap: 10px;
}

.member-action-row {
    display: grid;
    grid-template-columns: minmax(180px, 1fr) minmax(140px, 180px) minmax(110px, 140px) 42px;
    gap: 10px;
    align-items: end;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fbfdff;
}

.member-action-row label {
    margin: 0;
}

.member-action-row input {
    width: 100%;
}

.member-action-remove {
    width: 42px;
    min-height: 42px;
    padding: 0;
    font-size: 20px;
}

.member-action-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: flex-end;
}

.member-action-history {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 10px;
}

.member-action-card {
    display: grid;
    gap: 5px;
    padding: 13px;
    border: 1px solid rgba(0, 96, 48, .14);
    border-radius: 8px;
    background: linear-gradient(145deg, #ffffff 0%, #f3faf6 100%);
}

.member-action-card span,
.member-action-card small {
    color: var(--muted);
}

.modal {
    width: min(900px, calc(100vw - 32px));
    border: 0;
    border-radius: 8px;
    padding: 0;
    color: var(--ink);
    box-shadow: 0 24px 80px rgba(19, 33, 28, .24);
}

.modal::backdrop {
    background: rgba(40, 95, 199, .48);
}

.modal-card {
    padding: 22px;
    background: var(--panel);
}

.modal-head {
    align-items: start;
    margin-bottom: 18px;
}

.profile-summary {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
    padding: 14px;
    margin-bottom: 16px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fbfdff;
}

.modal-action-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 16px;
}

.user-action-panel {
    display: grid;
    gap: 14px;
}

.action-confirm-card {
    display: grid;
    gap: 14px;
    padding: 16px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fbfdff;
}

.action-confirm-card h3,
.action-confirm-card p {
    margin-bottom: 4px;
}

.audit-list {
    display: grid;
    gap: 10px;
}

.audit-item {
    display: grid;
    gap: 8px;
    padding: 12px 14px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fbfdff;
}

.audit-item div {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 12px;
    align-items: baseline;
    justify-content: space-between;
}

.audit-item small,
.audit-item p {
    color: var(--muted);
}

.audit-item p {
    margin: 0;
}

.archive-detail-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}

.archive-detail-grid span {
    display: grid;
    gap: 3px;
    min-width: 0;
    padding: 10px 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fbfdff;
    color: var(--muted);
    overflow-wrap: anywhere;
}

.archive-detail-grid strong {
    color: var(--ink);
    font-size: 12px;
}

.archive-snapshot {
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fbfdff;
}

.archive-snapshot summary {
    cursor: pointer;
    padding: 12px 14px;
    font-weight: 850;
}

.archive-snapshot pre {
    max-height: 320px;
    margin: 0;
    overflow: auto;
    padding: 0 14px 14px;
    font-size: 12px;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

.auth-page {
    min-height: 100vh;
    overflow-x: hidden;
    background:
        radial-gradient(circle at 50% 42%, rgba(255, 255, 255, .08) 0 32%, transparent 33%),
        #083d2c;
}

.auth-shell {
    position: relative;
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 24px;
}

/* Follow Safari's visible viewport as its browser chrome expands/collapses. */
@supports (min-height: 100dvh) {
    .app-shell {
        min-height: calc(100dvh - 24px);
    }

    .sidebar {
        min-height: calc(100dvh - 24px);
    }

    .auth-page,
    .auth-shell {
        min-height: 100dvh;
    }
}

.auth-card {
    position: relative;
    width: min(430px, 100%);
    overflow: hidden;
    padding: 0 34px 34px;
    text-align: center;
    border-color: rgba(255, 255, 255, .58);
    border-radius: 30px;
    background: #ffffff;
    box-shadow: 0 34px 90px rgba(0, 0, 0, .28);
}

.auth-card form,
.auth-card .demo-box,
.auth-card .alert {
    text-align: left;
}

.auth-card h1 {
    margin: 8px 0 0;
    color: #ffffff;
    font-size: clamp(32px, 5vw, 44px);
    line-height: 1;
}

.auth-hero {
    margin: 0 -34px 28px;
    padding: 34px 30px 38px;
    border-radius: 0 0 32px 32px;
    background: #083d2c;
    color: white;
}

.auth-presenter {
    display: grid;
    gap: 2px;
    margin: 0;
}

.auth-presenter span {
    color: #ffffff;
    font-family: Georgia, "Times New Roman", serif;
    font-size: 17px;
    font-weight: 800;
    line-height: 1.1;
}

.auth-presenter small {
    color: var(--cream);
    font-size: 12px;
    font-weight: 900;
    letter-spacing: 0;
    text-transform: uppercase;
}

.auth-logo {
    width: 86px;
    height: 86px;
    object-fit: contain;
    display: block;
    margin: 0 auto 20px;
    border-radius: 50%;
    background: white;
    box-shadow:
        0 18px 42px rgba(0, 0, 0, .22),
        0 0 0 8px rgba(255, 255, 255, .10);
}

.auth-link {
    display: inline-flex;
    justify-content: center;
    color: var(--green-dark);
    font-size: 13px;
    font-weight: 850;
}

.auth-link:hover {
    color: var(--gold);
}

.demo-box {
    margin-top: 18px;
    padding: 14px;
    border-radius: 8px;
    background: #f5f8ff;
    display: grid;
    gap: 4px;
    color: var(--muted);
    font-size: 13px;
}

@media (max-width: 980px) {
    .app-shell {
        grid-template-columns: 1fr;
    }

    .sidebar {
        position: static;
        height: auto;
        padding:
            max(16px, env(safe-area-inset-top))
            max(var(--page-gutter), env(safe-area-inset-right))
            16px
            max(var(--page-gutter), env(safe-area-inset-left));
        min-height: auto;
    }

    .app-shell {
        min-height: auto;
        border-radius: 0;
        margin: 0;
        width: 100%;
    }

    .sidebar nav {
        display: flex;
        flex-wrap: wrap;
        gap: 8px;
    }

    .sidebar-head {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 14px;
    }

    .menu-toggle {
        display: inline-flex;
        flex: 0 0 auto;
        align-items: center;
        justify-content: center;
        gap: 9px;
        min-height: 44px;
        padding: 9px 14px;
        border: 1px solid rgba(255, 255, 255, .28);
        border-radius: 12px;
        background: rgba(255, 255, 255, .10);
        color: #ffffff;
        font-weight: 850;
        cursor: pointer;
    }

    .menu-toggle:hover,
    .menu-toggle:focus-visible,
    .menu-toggle.is-open {
        border-color: rgba(246, 222, 198, .6);
        background: rgba(255, 255, 255, .17);
        outline: none;
    }

    .menu-toggle-icon {
        display: grid;
        gap: 4px;
        width: 19px;
    }

    .menu-toggle-icon i {
        display: block;
        height: 2px;
        border-radius: 2px;
        background: currentColor;
        transition: transform .18s ease, opacity .18s ease;
    }

    .menu-toggle.is-open .menu-toggle-icon i:first-child {
        transform: translateY(6px) rotate(45deg);
    }

    .menu-toggle.is-open .menu-toggle-icon i:nth-child(2) {
        opacity: 0;
    }

    .menu-toggle.is-open .menu-toggle-icon i:last-child {
        transform: translateY(-6px) rotate(-45deg);
    }

    .sidebar nav:not(.is-open) {
        display: none;
    }

    .sidebar nav a {
        flex: 1 1 148px;
        text-align: center;
        border-radius: 8px;
        padding: 10px 12px;
    }

    .topbar .account-menu {
        display: none;
    }

    .mobile-account-section {
        display: grid;
        flex: 1 1 100%;
        gap: 10px;
        width: 100%;
        margin-top: 4px;
        padding: 14px;
        border-top: 1px solid rgba(255, 255, 255, .16);
        border-radius: 12px;
        background: rgba(255, 255, 255, .07);
    }

    .mobile-account-identity {
        display: flex;
        align-items: center;
        gap: 10px;
        min-width: 0;
    }

    .mobile-account-identity > span:last-child {
        display: grid;
        min-width: 0;
    }

    .mobile-account-identity strong {
        overflow: hidden;
        color: #ffffff;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .mobile-account-identity small {
        color: #bdd5c7;
    }

    .mobile-account-actions {
        display: grid;
        grid-template-columns: 1fr 1.6fr 1fr;
        gap: 6px;
    }

    .sidebar nav .mobile-account-actions a,
    .mobile-account-actions button {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        min-width: 0;
        min-height: 38px;
        padding: 7px 8px;
        border: 1px solid rgba(255, 255, 255, .14);
        border-radius: 9px;
        background: rgba(255, 255, 255, .08);
        color: #ffffff;
        font-size: 11px;
        font-weight: 800;
        line-height: 1.2;
        text-align: center;
        white-space: normal;
        cursor: pointer;
    }

    .stats-grid,
    .presence-metrics,
    .suggestion-grid,
    .stage-card-grid,
    .member-info-grid,
    .dashboard-visuals,
    .report-dashboard-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .report-filter-form {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 760px) {
    .mobile-history-nav {
        position: fixed;
        right: 50%;
        bottom: max(10px, env(safe-area-inset-bottom));
        left: auto;
        z-index: 50;
        display: grid;
        grid-template-columns: 1fr auto 1fr;
        gap: 3px;
        width: min(310px, calc(100% - 24px));
        padding: 4px;
        border: 1px solid rgba(255, 255, 255, .22);
        border-radius: 13px;
        background: rgba(11, 36, 26, .96);
        color: #ffffff;
        box-shadow: 0 16px 40px rgba(0, 0, 0, .28);
        transform: translateX(50%);
        -webkit-backdrop-filter: blur(12px);
        backdrop-filter: blur(12px);
    }

    .role-dashboard-panel {
        padding: 14px;
    }

    .role-dashboard-head {
        align-items: flex-start;
        margin-bottom: 10px;
    }

    .role-dashboard-head h2 {
        font-size: 17px;
    }

    .role-dashboard-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 8px;
    }

    .role-mini-card {
        min-height: 70px;
        padding: 10px 10px 9px;
    }

    .role-mini-card span {
        font-size: 10.5px;
    }

    .role-mini-card strong {
        margin-top: 7px;
        font-size: 25px;
    }

    .role-mini-card::after {
        width: 56px;
        height: 56px;
    }

    .mobile-history-nav button,
    .mobile-history-nav a {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        gap: 4px;
        min-height: 34px;
        padding: 5px 7px;
        border: 0;
        border-radius: 11px;
        background: transparent;
        color: inherit;
        font-size: 11px;
        font-weight: 850;
        cursor: pointer;
    }

    .mobile-history-nav a {
        background: rgba(255, 255, 255, .12);
    }

    .mobile-history-nav button:hover,
    .mobile-history-nav button:focus-visible,
    .mobile-history-nav a:hover,
    .mobile-history-nav a:focus-visible {
        background: rgba(255, 255, 255, .18);
        outline: none;
    }

    .sidebar {
        gap: 14px;
        padding:
            max(12px, env(safe-area-inset-top))
            max(14px, env(safe-area-inset-right))
            12px
            max(14px, env(safe-area-inset-left));
    }

    .brand {
        gap: 10px;
        padding: 4px 2px 6px;
    }

    .sidebar-head .brand {
        min-width: 0;
        margin: 0;
    }

    .brand-logo {
        width: 42px;
        height: 42px;
    }

    .brand strong {
        font-size: 15px;
    }

    .brand small {
        font-size: 12px;
    }

    .main {
        padding:
            18px
            max(var(--page-gutter), env(safe-area-inset-right))
            max(78px, calc(env(safe-area-inset-bottom) + 68px))
            max(var(--page-gutter), env(safe-area-inset-left));
    }

    /* iOS Safari zooms the page when a focused control is smaller than 16px. */
    input,
    select,
    textarea {
        font-size: 16px;
    }

    .auth-shell {
        padding:
            max(24px, env(safe-area-inset-top))
            max(16px, env(safe-area-inset-right))
            max(24px, env(safe-area-inset-bottom))
            max(16px, env(safe-area-inset-left));
    }

    .topbar,
    .hero-panel,
    .presence-hero,
    .section-head,
    .presence-list-head,
    .split-panel,
    .incoming-alert-content,
    .incoming-card,
    .modal-head,
    .table-head {
        align-items: stretch;
        flex-direction: column;
    }

    .topbar-controls {
        width: 100%;
        justify-content: space-between;
    }

    .account-menu,
    .account-trigger {
        width: 100%;
    }

    .account-dropdown {
        left: 0;
        right: auto;
        width: 100%;
    }

    .responsive-table {
        display: block;
        min-width: 0;
    }

    .responsive-table thead {
        position: absolute;
        width: 1px;
        height: 1px;
        overflow: hidden;
        clip: rect(0 0 0 0);
        white-space: nowrap;
        clip-path: inset(50%);
    }

    .responsive-table tbody {
        display: grid;
        gap: 14px;
        padding: 1px;
    }

    .responsive-table tbody tr {
        display: block;
        overflow: hidden;
        border: 1px solid rgba(0, 96, 48, .14);
        border-radius: 16px;
        background: #ffffff;
        box-shadow: 0 8px 22px rgba(18, 51, 39, .08);
    }

    .responsive-table tbody tr:hover {
        transform: none;
    }

    .responsive-table td {
        display: grid;
        grid-template-columns: minmax(82px, 30%) minmax(0, 1fr);
        gap: 12px;
        align-items: start;
        width: 100%;
        padding: 11px 14px;
        border-bottom: 1px solid rgba(18, 51, 39, .08);
        text-align: left;
        white-space: normal;
        overflow-wrap: anywhere;
    }

    .responsive-table td::before {
        content: attr(data-label);
        color: var(--muted);
        font-size: 12px;
        font-weight: 850;
    }

    .responsive-table td:first-child {
        padding-top: 14px;
        background: #eaf7ef;
        color: var(--green-dark);
    }

    .responsive-table td:last-child {
        border-bottom: 0;
    }

    .responsive-table td:last-child .btn {
        width: 100%;
    }

    .stats-grid,
    .presence-metrics,
    .presence-notes,
    .suggestion-grid,
    .stage-card-grid,
    .member-info-grid,
    .dashboard-visuals,
    .report-dashboard-grid,
    .member-filter,
    .search-actions,
    .form-grid,
    .form-section,
    .follow-grid,
    .member-action-row,
    .compact-filter-form,
    .report-filter-form,
    .archive-detail-grid {
        grid-template-columns: 1fr;
    }

    .sidebar nav {
        display: flex;
        flex-wrap: wrap;
        gap: 8px;
        margin: 0;
        padding: 0;
        overflow: visible;
    }

    .sidebar nav a {
        flex: 1 1 calc(50% - 8px);
        min-width: 132px;
        max-width: none;
        padding: 10px 12px;
        border-radius: 10px;
        text-align: center;
        white-space: nowrap;
    }

    .stats-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 12px;
    }

    .stat-card {
        min-height: 132px;
        padding: 14px;
        gap: 10px;
        border-radius: 16px;
    }

    .stat-card-head {
        gap: 8px;
    }

    .stat-icon {
        width: 36px;
        height: 36px;
        border-radius: 12px;
    }

    .stat-icon svg {
        width: 19px;
        height: 19px;
    }

    .stat-label {
        font-size: 14px;
        line-height: 1.15;
    }

    .stat-card strong {
        font-size: 30px;
    }

    .stat-card small {
        font-size: 12px;
    }

    .report-chart-card:nth-child(4) {
        grid-column: auto;
    }

    .list-tools {
        align-items: stretch;
        flex-direction: column;
    }

    .table-tools,
    .table-search,
    .compact-location-filter {
        width: 100%;
    }

    .compact-location-filter {
        grid-template-columns: 1fr;
    }

    .mobile-select-label {
        position: relative;
        min-width: 0;
    }

    .mobile-native-select {
        position: absolute;
        width: 1px;
        height: 1px;
        overflow: hidden;
        opacity: 0;
        pointer-events: none;
    }

    .mobile-location-select {
        display: block;
        position: relative;
        width: 100%;
        min-width: 0;
    }

    .mobile-location-trigger {
        width: 100%;
        min-height: 42px;
        padding: 8px 38px 8px 12px;
        overflow: hidden;
        border: 1px solid var(--line);
        border-radius: 8px;
        background: #fbfdff;
        color: var(--ink);
        font-size: 16px;
        font-weight: 750;
        text-align: left;
        text-overflow: ellipsis;
        white-space: nowrap;
        cursor: pointer;
    }

    .mobile-location-trigger::after {
        content: "⌄";
        position: absolute;
        right: 13px;
        color: var(--muted);
        font-size: 20px;
        line-height: 1;
    }

    .mobile-location-select.is-open .mobile-location-trigger {
        border-color: var(--green);
        box-shadow: 0 0 0 3px rgba(0, 96, 48, .10);
    }

    .mobile-location-options {
        position: absolute;
        top: calc(100% + 5px);
        left: 0;
        z-index: 40;
        width: 100%;
        max-height: min(260px, 45vh);
        overflow-y: auto;
        padding: 6px;
        border: 1px solid rgba(0, 96, 48, .22);
        border-radius: 10px;
        background: #ffffff;
        box-shadow: 0 18px 42px rgba(18, 51, 39, .22);
    }

    .mobile-location-option {
        display: block;
        width: 100%;
        padding: 10px;
        border: 0;
        border-radius: 7px;
        background: transparent;
        color: var(--ink);
        text-align: left;
        cursor: pointer;
    }

    .mobile-location-option:hover,
    .mobile-location-option:focus-visible,
    .mobile-location-option.is-selected {
        background: #eaf7ef;
        color: var(--green-dark);
        outline: none;
    }

    .followup-actions {
        justify-content: stretch;
    }

    .followup-actions .pill,
    .followup-actions .btn {
        width: 100%;
    }

    .check-card {
        grid-template-columns: auto minmax(0, 1fr);
    }

    .member-action-remove,
    .member-action-controls .btn {
        width: 100%;
    }

    .check-card input[type="date"] {
        grid-column: 1 / -1;
    }

    .span-2 {
        grid-column: span 1;
    }

    h1 {
        font-size: 25px;
    }
}

@media (max-width: 380px) {
    .sidebar nav a {
        flex-basis: 100%;
    }

    .stats-grid {
        grid-template-columns: 1fr;
    }
}

@media (min-width: 600px) and (max-width: 760px) {
    .role-dashboard-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

@media (max-width: 340px) {
    .role-dashboard-grid {
        grid-template-columns: 1fr;
    }

    .mobile-account-actions {
        grid-template-columns: 1fr;
    }
}
