/* WhatsMan Dashboard Design System */

* {
    box-sizing: border-box;
}

:root {
    --primary: #00b289;
    --navy: #1a4d4a;
    --bg-light: #f0f7f7;
    --white: #FFFFFF;
    --gray-text: #64748B;
    --dark-text: #0F172A;
    --border-color: #E2E8F0;
    --radius-lg: 15px;
    --radius-md: 10px;
    --shadow-sm: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-md: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --shadow-lg: 0 10px 30px rgba(0, 0, 0, 0.05);
}

html {
    scroll-behavior: smooth;
    scroll-padding-top: 100px;
}

body {
    font-family: 'DM Sans', sans-serif;
    margin: 0;
    padding: 0;
    background-color: var(--bg-light);
    color: var(--dark-text);
    -webkit-font-smoothing: antialiased;
    overflow-x: clip;
}

.account-container {
    width: 100%;
    max-width: 1000px;
    margin: 0 auto;
}

.support-page-wrap {
    max-width: 800px;
    margin: 0 auto;
    width: 100%;
    box-sizing: border-box;
}

.container {
    width: 100%;
    min-height: 100vh;
}

/* Generic Table Styles */
table {
    width: 100%;
    border-collapse: collapse;
}

.table-link {
    font-weight: 600;
    color: var(--navy);
    text-decoration: none;
    transition: opacity 0.2s;
}

.table-link:hover {
    opacity: 0.8;
}

th {
    text-align: left;
    font-size: 13px;
    font-weight: 600;
    color: var(--gray-text);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 16px 24px;
    border-bottom: 1px solid var(--border-color);
}

td {
    padding: 16px 24px;
    font-size: 15px;
    color: var(--dark-text);
    border-bottom: 1px solid var(--border-color);
}

/* Button Redesign */
.btn {
    background-color: var(--primary);
    color: var(--white);
    border: none;
    padding: 12px 24px;
    font-size: 15px;
    font-weight: 500;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    gap: 8px;
}

.btn:hover {
    opacity: 0.9;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 178, 137, 0.3);
}

.btn-secondary {
    background-color: var(--white);
    color: var(--dark-text);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    background-color: #F8FAFC;
}

/* Input Styles */
input,
select,
textarea {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    font-family: 'DM Sans', sans-serif;
    font-size: 15px;
    background: var(--white);
    transition: border-color 0.2s;
}

/* Enhanced Labels, Checkboxes and Progress Bars */
label {
    display: block;
    font-size: 14px;
    font-weight: 600;
    color: var(--navy);
    margin-bottom: 8px;
}

input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--primary);
    cursor: pointer;
    vertical-align: middle;
}

progress {
    width: 100%;
    height: 12px;
    appearance: none;
    border-radius: 99px;
    overflow: hidden;
    margin: 8px 0;
}

progress::-webkit-progress-bar {
    background-color: #E2E8F0;
}

progress::-webkit-progress-value {
    background-color: var(--primary);
}

progress::-moz-progress-bar {
    background-color: var(--primary);
}

input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(0, 178, 137, 0.1);
}

/* Badge Styles */
.badge {
    display: inline-flex;
    padding: 4px 12px;
    border-radius: 99px;
    font-size: 12px;
    font-weight: 600;
    text-transform: capitalize;
}

.badge.success {
    background: #DCFCE7;
    color: #166534;
}

.badge.warning {
    background: #FEF9C3;
    color: #854D0E;
}

.badge.error {
    background: #FEE2E2;
    color: #991B1B;
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: #CBD5E1;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #94A3B8;
}

/* Dashboard Internal Styles */
.dashboard-container {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    min-height: 100vh;
    background: var(--bg-light);
}

/* Sidebar + main content sit below optional full-width top banners (e.g. 2FA alert). */
.dashboard-main-row {
    display: flex;
    flex: 1 1 auto;
    min-width: 0;
    min-height: 0;
    align-items: stretch;
}

.sidebar {
    width: 260px;
    background: var(--navy);
    color: var(--white);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    position: sticky;
    top: 0;
    height: 100vh;
    z-index: 100;
    transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    overflow-x: hidden;
    overflow-y: auto;
}

.sidebar.collapsed {
    width: 80px;
}

.sidebar-header {
    padding: 24px;
    display: flex;
    align-items: center;
    gap: 12px;
    position: relative;
    min-height: 80px;
}

.sidebar-logo {
    width: 32px;
    height: 32px;
    background: var(--primary);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 18px;
    color: white;
    flex-shrink: 0;
}

.sidebar-brand {
    font-size: 20px;
    font-weight: 700;
    letter-spacing: -0.02em;
    white-space: nowrap;
    transition: opacity 0.2s;
    color: var(--primary);
}

.sidebar.collapsed .sidebar-brand {
    opacity: 0;
    pointer-events: none;
}

.collapse-toggle {
    position: absolute;
    right: -12px;
    top: 32px;
    width: 24px;
    height: 24px;
    background: var(--primary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: white;
    box-shadow: var(--shadow-sm);
    z-index: 101;
    border: 2px solid var(--navy);
    transition: transform 0.3s;
}

.sidebar.collapsed .collapse-toggle {
    transform: rotate(180deg);
    right: 28px;
    top: 70px;
}

.sidebar-menu {
    padding: 0 16px;
    flex-grow: 1;
}

.menu-label {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: rgba(255, 255, 255, 0.4);
    margin: 24px 0 12px 12px;
    white-space: nowrap;
    transition: opacity 0.2s;
}

.sidebar.collapsed .menu-label {
    opacity: 0;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    color: rgba(255, 255, 255, 0.7);
    text-decoration: none;
    border-radius: var(--radius-md);
    font-size: 15px;
    font-weight: 500;
    transition: all 0.2s ease;
    margin-bottom: 4px;
    white-space: nowrap;
}

.nav-item:hover {
    background: rgba(255, 255, 255, 0.05);
    color: var(--white);
}

.nav-item.active {
    background: var(--primary);
    color: var(--white);
    box-shadow: 0 4px 12px rgba(0, 178, 137, 0.3);
}

.nav-item svg {
    width: 22px;
    height: 22px;
    opacity: 0.7;
    flex-shrink: 0;
}

.nav-item.active svg {
    opacity: 1;
}

.nav-item span {
    transition: opacity 0.2s;
}

.sidebar.collapsed .nav-item span {
    opacity: 0;
    width: 0;
    overflow: hidden;
}

.sidebar.collapsed .nav-item {
    padding: 12px;
    justify-content: center;
    gap: 0;
}

.main-wrapper {
    flex: 1 1 0;
    min-width: 0;
    min-height: 0;
    display: flex;
    flex-direction: column;
}

/* Danger-style alert when no 2FA is enabled; full width row above .dashboard-main-row. */
.two-fa-activation-banner {
    width: 100%;
    box-sizing: border-box;
    flex-shrink: 0;
    background: linear-gradient(90deg, #fef2f2 0%, #fee2e2 100%);
    border-bottom: 1px solid #fecaca;
    border-left: 4px solid #dc2626;
    padding: 12px 40px;
}

.two-fa-activation-banner__inner {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 12px 20px;
    max-width: 100%;
}

.two-fa-activation-banner__lead {
    display: flex;
    align-items: center;
    gap: 16px;
    min-width: min(100%, 280px);
    flex: 1 1 280px;
}

.two-fa-activation-banner__icon {
    flex-shrink: 0;
    color: #b91c1c;
    display: inline-flex;
    line-height: 0;
}

.two-fa-activation-banner__text {
    font-size: 14px;
    color: #7f1d1d;
    line-height: 1.45;
}

.two-fa-activation-banner__cta {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 8px 18px;
    border-radius: 8px;
    background: #dc2626;
    color: #fff !important;
    font-weight: 700;
    font-size: 14px;
    text-decoration: none;
    white-space: nowrap;
    border: 1px solid #b91c1c;
    box-shadow: 0 1px 2px rgba(127, 29, 29, 0.12);
}

.two-fa-activation-banner__cta:hover {
    background: #b91c1c;
    border-color: #991b1b;
}

/* Low token balance warning (amber); dismiss hides until balance rises above threshold. */
.low-tokens-banner {
    width: 100%;
    box-sizing: border-box;
    flex-shrink: 0;
    background: linear-gradient(90deg, #fffbeb 0%, #fef3c7 100%);
    border-bottom: 1px solid #fde68a;
    border-left: 4px solid #d97706;
    padding: 12px 40px;
}

.low-tokens-banner__inner {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 12px 20px;
    max-width: 100%;
}

.low-tokens-banner__lead {
    display: flex;
    align-items: center;
    gap: 14px;
    min-width: min(100%, 280px);
    flex: 1 1 280px;
}

.low-tokens-banner__icon {
    flex-shrink: 0;
    color: #b45309;
    display: inline-flex;
    line-height: 0;
}

.low-tokens-banner__text {
    font-size: 14px;
    color: #78350f;
    line-height: 1.45;
}

.low-tokens-banner__actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}

.low-tokens-banner__cta {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 8px 18px;
    border-radius: 8px;
    background: #d97706;
    color: #fff !important;
    font-weight: 700;
    font-size: 14px;
    text-decoration: none;
    white-space: nowrap;
    border: 1px solid #b45309;
    box-shadow: 0 1px 2px rgba(120, 53, 15, 0.12);
}

.low-tokens-banner__cta:hover {
    background: #b45309;
    border-color: #92400e;
}

.low-tokens-banner__dismiss {
    flex-shrink: 0;
    width: 36px;
    height: 36px;
    border: 1px solid rgba(120, 53, 15, 0.2);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.65);
    color: #78350f;
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    box-shadow: 0 1px 2px rgba(120, 53, 15, 0.08);
}

.low-tokens-banner__dismiss:hover {
    background: rgba(255, 255, 255, 0.95);
    border-color: rgba(120, 53, 15, 0.35);
}

/* Admin-configurable site banners (above 2FA alert) — layout mirrors .two-fa-activation-banner */
.site-banner {
    width: 100%;
    box-sizing: border-box;
    flex-shrink: 0;
    padding: 12px 40px;
}

.site-banner__inner {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 12px 20px;
    max-width: 100%;
}

.site-banner__lead {
    display: flex;
    align-items: center;
    gap: 16px;
    min-width: min(100%, 280px);
    flex: 1 1 280px;
}

.site-banner__icon {
    flex-shrink: 0;
    display: inline-flex;
    line-height: 0;
    color: #2563eb;
}

.site-banner--warning .site-banner__icon {
    color: #d97706;
}

.site-banner--success .site-banner__icon {
    color: #059669;
}

.site-banner__text {
    display: block;
    margin: 0;
    font-size: 14px;
    line-height: 1.45;
    flex: 1 1 auto;
    min-width: 0;
    word-break: break-word;
}

.site-banner__actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    flex-shrink: 0;
}

.site-banner__text strong {
    font-weight: 700;
}

.site-banner__text em {
    font-style: italic;
}

.site-banner__text u {
    text-decoration: underline;
    text-underline-offset: 2px;
}

.site-banner__cta {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 8px 18px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 700;
    text-decoration: none;
    white-space: nowrap;
    flex-shrink: 0;
    box-sizing: border-box;
    color: #fff !important;
    border: 1px solid transparent;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.12);
}

.site-banner__cta--info {
    background: #2563eb;
    border-color: #1d4ed8;
    box-shadow: 0 1px 2px rgba(37, 99, 235, 0.22);
}

.site-banner__cta--info:hover {
    background: #1d4ed8;
    border-color: #1e40af;
}

.site-banner__cta--warning {
    background: #d97706;
    border-color: #b45309;
    box-shadow: 0 1px 2px rgba(180, 83, 9, 0.2);
}

.site-banner__cta--warning:hover {
    background: #b45309;
    border-color: #92400e;
}

.site-banner__cta--success {
    background: #059669;
    border-color: #047857;
    box-shadow: 0 1px 2px rgba(5, 150, 105, 0.22);
}

.site-banner__cta--success:hover {
    background: #047857;
    border-color: #065f46;
}

.site-banner__dismiss {
    flex-shrink: 0;
    width: 36px;
    height: 36px;
    border: 1px solid rgba(15, 23, 42, 0.12);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.55);
    color: var(--navy);
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.06);
}

.site-banner__dismiss:hover {
    background: rgba(255, 255, 255, 0.9);
    border-color: rgba(15, 23, 42, 0.2);
}

.site-banner--info {
    background: linear-gradient(90deg, #eff6ff 0%, #dbeafe 100%);
    border-bottom: 1px solid #bfdbfe;
    border-left: 4px solid #2563eb;
}

.site-banner--info .site-banner__text {
    color: #1e3a8a;
}

.site-banner--warning {
    background: linear-gradient(90deg, #fffbeb 0%, #fef3c7 100%);
    border-bottom: 1px solid #fcd34d;
    border-left: 4px solid #d97706;
}

.site-banner--warning .site-banner__text {
    color: #78350f;
}

.site-banner--success {
    background: linear-gradient(90deg, #ecfdf5 0%, #d1fae5 100%);
    border-bottom: 1px solid #6ee7b7;
    border-left: 4px solid #059669;
}

.site-banner--success .site-banner__text {
    color: #065f46;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}

.admin-banners-type-col {
    width: 44px;
    text-align: center;
    vertical-align: middle;
    color: #2563eb;
}

.admin-banners-type-col--warning {
    color: #d97706;
}

.admin-banners-type-col--success {
    color: #059669;
}

.header {
    height: 80px;
    background: var(--white);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 40px;
    position: sticky;
    top: 0;
    z-index: 90;
}

.header-search {
    position: relative;
    width: 100%;
    max-width: 400px;
}

.header-search input {
    padding-left: 44px;
    background: #F8FAFC;
    border-radius: 99px;
    border: 1px solid transparent;
}

.header-search svg {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    width: 18px;
    height: 18px;
    color: var(--gray-text);
}

.content-body {
    padding: 40px;
    min-width: 0;
    box-sizing: border-box;
}

.card {
    background: var(--white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    padding: 32px;
    margin-bottom: 32px;
    border: 1px solid var(--border-color);
    transition: transform 0.2s, box-shadow 0.2s;
}

.card:hover {
    box-shadow: var(--shadow-md);
}

.page-title {
    font-size: 28px;
    font-weight: 800;
    margin: 0 0 8px 0;
    letter-spacing: -0.02em;
}

.page-desc {
    color: var(--gray-text);
    font-size: 15px;
    margin-bottom: 32px;
}

/* Page layout helpers (dashboard views); defined before mobile queries so narrow breakpoints can override flex alignment. */
.page-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    flex-wrap: wrap;
    gap: 16px;
    margin-bottom: 32px;
}

.page-head .page-desc {
    margin-bottom: 0;
}

.page-head-actions {
    flex-shrink: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: center;
    justify-content: flex-end;
}

/* Admin dashboard (/admin): title + subtitle stay left-aligned (avoid flex-end cross-axis drift on narrow layouts). */
.page-head.page-head--admin {
    align-items: flex-start;
}

.page-head--admin__intro {
    width: 100%;
    max-width: 100%;
    text-align: left;
}

/* Table Styles */
.table-container {
    background: var(--white);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
    overflow: hidden;
}

.table-header {
    padding: 24px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.table-footer {
    padding: 16px 24px;
    background: #F8FAFC;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* Contacts / groups: pagination + per-page selector */
.table-footer.directory-table-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}

.table-footer.directory-table-footer .directory-table-footer-nav {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.table-footer.directory-table-footer .directory-table-footer-per-page {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--gray-text);
    white-space: nowrap;
}

.table-footer.directory-table-footer .directory-table-footer-per-page select {
    min-width: 120px;
    height: 36px;
    padding: 0 8px;
    border-radius: 6px;
    border: 1px solid var(--border-color);
    background: white;
}

/* Admin user detail (/admin/users/:id) and self-service record (/account/details) — matches other admin “Back” controls */
.admin-user-back-link.btn.btn-secondary {
    justify-content: flex-start;
    width: fit-content;
    max-width: 100%;
    margin-bottom: 12px;
    padding: 10px 16px;
    font-size: 14px;
    font-weight: 600;
    color: var(--navy);
    box-sizing: border-box;
}

.admin-user-back-link.btn.btn-secondary:hover {
    opacity: 1;
    transform: none;
    box-shadow: none;
    background-color: #f1f5f9;
    border-color: #cbd5e1;
    color: var(--navy);
}

.admin-user-back-link.btn.btn-secondary:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

@media (max-width: 768px) {
    .admin-user-back-link.btn.btn-secondary {
        width: 100%;
        min-height: 44px;
        justify-content: center;
    }
}

/* Account page → full user record */
.account-details-title-link {
    color: var(--navy);
    text-decoration: none;
    border-bottom: 2px solid var(--primary);
    transition: color 0.15s ease, border-color 0.15s ease;
}

.account-details-title-link:hover {
    color: var(--primary);
    border-bottom-color: var(--navy);
}

.admin-user-detail-stack {
    display: flex;
    flex-direction: column;
    gap: 24px;
    margin-bottom: 32px;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    box-sizing: border-box;
}

.admin-user-detail-card {
    background: var(--white);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
    overflow: hidden;
    max-width: 100%;
    min-width: 0;
    box-sizing: border-box;
}

/* Horizontal scroll for key–value tables when the two-column layout is still active. */
.admin-kv-table-wrap {
    max-width: 100%;
    min-width: 0;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    box-sizing: border-box;
}

/* Set balances (admin user detail): inputs fill width and stack on narrow viewports */
.admin-set-tokens-form {
    display: flex;
    flex-direction: column;
    gap: 12px;
    width: 100%;
    max-width: min(480px, 100%);
    min-width: 0;
    box-sizing: border-box;
}

.admin-set-tokens-field {
    display: grid;
    grid-template-columns: minmax(100px, 140px) minmax(0, 1fr);
    gap: 10px;
    align-items: center;
    min-width: 0;
    width: 100%;
}

.admin-set-tokens-label {
    display: block;
    font-size: 12px;
    font-weight: 700;
    color: var(--gray-text);
    min-width: 0;
}

.admin-set-tokens-input {
    width: 100%;
    min-width: 0;
    max-width: 100%;
    margin: 0;
    padding: 10px 12px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    font-size: 16px;
    font-weight: 600;
    font-family: inherit;
    background: var(--white);
    color: var(--navy);
    box-sizing: border-box;
    -webkit-appearance: none;
    appearance: textfield;
}

.admin-set-tokens-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(0, 178, 137, 0.15);
}

.admin-set-tokens-save {
    padding: 10px 18px;
    font-weight: 700;
    width: fit-content;
    max-width: 100%;
    align-self: flex-start;
    box-sizing: border-box;
}

.admin-set-tokens-hint {
    margin: 10px 0 0;
    font-size: 12px;
    color: var(--gray-text);
    line-height: 1.45;
    max-width: min(480px, 100%);
}

/* Stack label above input when the value column is tight (narrow window + 2-col KV, or small phones). */
@media (max-width: 720px) {
    .admin-set-tokens-field {
        grid-template-columns: 1fr;
        align-items: stretch;
    }

    .admin-set-tokens-label {
        margin-bottom: 2px;
    }

    .admin-set-tokens-save {
        width: 100%;
        align-self: stretch;
        justify-content: center;
    }
}

.admin-user-detail-card__head {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color);
    background: #f8fafc;
}

.admin-user-detail-card__head h2 {
    margin: 0;
    font-size: 15px;
    font-weight: 700;
    color: var(--navy);
}

table.admin-kv-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 0;
}

.admin-kv-table th {
    text-align: left;
    font-weight: 600;
    color: var(--gray-text);
    font-size: 13px;
    padding: 12px 20px;
    vertical-align: top;
    width: 34%;
    max-width: 300px;
    border-bottom: 1px solid var(--border-color);
}

.admin-kv-table td {
    text-align: left;
    padding: 12px 20px;
    font-size: 14px;
    color: var(--navy);
    border-bottom: 1px solid var(--border-color);
    word-break: break-word;
}

.admin-kv-table tbody tr:last-child th,
.admin-kv-table tbody tr:last-child td {
    border-bottom: none;
}

.admin-user-sessions-note {
    margin: 0;
    padding: 12px 20px 0;
    font-size: 13px;
    color: var(--gray-text);
}

.admin-user-sessions-empty {
    margin: 0;
    padding: 16px 20px 20px;
    color: var(--gray-text);
    font-size: 14px;
}

.admin-sessions-scroll {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    width: 100%;
}

.admin-sessions-scroll table {
    width: 100%;
    min-width: 720px;
    border-collapse: collapse;
}

.admin-sessions-scroll th,
.admin-sessions-scroll td {
    padding: 12px 16px;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
    font-size: 13px;
}

.admin-sessions-scroll thead th {
    background: #f8fafc;
    font-weight: 600;
    color: var(--gray-text);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.02em;
}

.admin-session-id {
    font-family: ui-monospace, monospace;
    font-size: 12px;
    word-break: break-all;
}

.admin-session-ip {
    word-break: break-all;
    font-size: 12px;
}

.admin-session-ua {
    font-size: 12px;
    word-break: break-word;
    max-width: 320px;
}

/* Pill System */
.pill-container {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    border: 1px solid var(--border-color);
    padding: 12px;
    border-radius: var(--radius-md);
    min-height: 48px;
    background: #F8FAFC;
    margin-bottom: 24px;
    align-items: center;
    position: relative;
    cursor: text;
    transition: all 0.2s;
}

.pill-container:focus-within {
    border-color: var(--primary);
    background: white;
    box-shadow: 0 0 0 3px rgba(0, 178, 137, 0.1);
}

.pill {
    background: var(--primary);
    color: white;
    padding: 6px 14px;
    border-radius: 99px;
    font-size: 13px;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 8px;
    box-shadow: 0 2px 4px rgba(0, 178, 137, 0.2);
}

.pill .remove {
    cursor: pointer;
    font-weight: 800;
    opacity: 0.8;
}

.pill .remove:hover {
    opacity: 1;
}

.pill-input {
    flex: 1;
    min-width: 150px;
    border: none !important;
    background: transparent !important;
    box-shadow: none !important;
    outline: none !important;
    font-size: 14px;
    padding: 0 !important;
    margin: 0 !important;
}

.lock-chat-weekdays {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 8px;
}

.lock-chat-day {
    border: 1px solid var(--border-color);
    background: #fff;
    color: var(--navy);
    border-radius: 999px;
    padding: 6px 12px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    user-select: none;
}

.lock-chat-day.active {
    background: #DCFCE7;
    border-color: #86EFAC;
    color: #166534;
}

/* Autocomplete Dropdown */
.autocomplete-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    margin-top: 8px;
    background: white;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
    z-index: 1000;
    display: none;
    max-height: 250px;
    overflow-y: auto;
    padding: 8px;
}

.autocomplete-item {
    padding: 10px 14px;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: background 0.2s;
}

.autocomplete-item:hover {
    background: #F1F5F9;
}

.autocomplete-item strong {
    color: var(--navy);
    font-size: 14px;
}

.autocomplete-item span {
    font-size: 11px;
    color: var(--gray-text);
    font-family: monospace;
}

/* @-mention picker on message compose textareas */
.at-mention-compose-wrap {
    position: relative;
    width: 100%;
}

.at-mention-dropdown {
    display: none;
    position: absolute;
    left: 0;
    right: 0;
    top: 100%;
    margin-top: 4px;
    background: white;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.12);
    z-index: 1200;
    max-height: 260px;
    overflow-y: auto;
    padding: 8px;
}

.at-mention-dropdown .at-mention-item.active {
    background: #e0f2fe;
}

.at-mention-empty {
    padding: 12px 14px;
    font-size: 13px;
    color: var(--gray-text);
    line-height: 1.4;
}

/* Modal Overlay */
.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(4px);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.modal {
    background: white;
    padding: 32px;
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 440px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    max-height: 90vh;
    overflow-y: auto;
}

/* Auth & Landing Layout */
.auth-container {
    width: 100%;
    min-height: 100vh;
    background: var(--bg-light);
}

.auth-container .content-body {
    padding: 0;
}

.auth-container .main-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: stretch;
}

/* Error page: single action, full-viewport center (views/error.html) */
.auth-container .content-body > .error-page-centered {
    box-sizing: border-box;
    min-height: 100vh;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

.profile-info {
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
}

.avatar {
    width: 40px;
    height: 40px;
    background: #E2E8F0;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    color: var(--primary);
}

/* Toast Notification System */
.toast-container {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 2000;
    display: flex;
    flex-direction: column;
    gap: 12px;
    pointer-events: none;
    width: auto;
    min-width: 320px;
}

.toast {
    position: relative;
    background: #1e293b;
    color: white;
    padding: 16px 24px;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 14px;
    font-weight: 500;
    animation: toastIn 0.3s ease-out forwards;
    pointer-events: auto;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.toast-progress {
    position: absolute;
    bottom: 0;
    left: 0;
    height: 4px;
    background: var(--primary);
    width: 100%;
    transform-origin: left;
    animation: toastProgress linear forwards;
}

.toast.toast--error {
    border-color: rgba(239, 68, 68, 0.45);
    box-shadow: 0 10px 25px rgba(185, 28, 28, 0.12), var(--shadow-lg);
}

.toast.toast--error .toast-progress {
    background: #EF4444;
}

.modal-overlay .modal.modal--alert-error {
    border: 1px solid rgba(239, 68, 68, 0.4);
    box-shadow: 0 4px 24px rgba(185, 28, 28, 0.08);
}

@keyframes toastIn {
    from {
        transform: translateY(20px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

@keyframes toastProgress {
    from {
        transform: scaleX(1);
    }

    to {
        transform: scaleX(0);
    }
}

/* Responsive Grid Utilities */
.grid-2-1 {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 32px;
    align-items: start;
}

.grid-1-1 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 32px;
    align-items: start;
}

.grid-3 {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 24px;
}

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

/* Tablet Media Query */
@media (max-width: 1024px) {

    .grid-2-1,
    .grid-1-1 {
        grid-template-columns: 1fr;
        gap: 24px;
    }

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

    .content-body {
        padding: 32px;
    }

    .header {
        padding: 0 32px;
    }

    .page-title {
        font-size: 26px;
    }

    /* Scheduled messages + groups (and similar): sidebar + ~900px main leaves tables/toolbars clipped */
    .table-container {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .table-container > table {
        min-width: 640px;
    }

    .card:has(.filter-toolbar) {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .filter-toolbar {
        flex-wrap: nowrap;
        width: max-content;
        min-width: 100%;
        box-sizing: border-box;
    }

    /* index.html: search + list/calendar toggles + Show all */
    .card.flex-responsive {
        flex-wrap: nowrap;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        align-items: center;
    }

    .card.flex-responsive .header-search {
        flex: 0 0 auto;
        min-width: min(320px, 85vw);
    }

    .card.flex-responsive > div:last-child {
        flex: 0 0 auto;
    }
}

/* Mobile Responsiveness */
@media (max-width: 768px) {

    /* Layout */
    .dashboard-container {
        flex-direction: column;
    }

    .dashboard-main-row {
        flex-direction: column;
    }

    /* Sidebar */
    .sidebar {
        width: 100%;
        height: auto;
        position: static;
    }

    .sidebar.collapsed {
        width: 100%;
        height: 80px;
        overflow: hidden;
    }

    .collapse-toggle {
        top: 20px;
        right: 20px;
    }

    .sidebar.collapsed .collapse-toggle {
        top: 20px;
        right: 20px;
        transform: rotate(180deg);
    }

    .sidebar-header {
        padding: 16px;
        min-height: 80px;
    }

    /* Header & Main */
    .header {
        padding: 0 16px;
        height: 60px;
        justify-content: flex-end;
    }

    .two-fa-activation-banner {
        padding: 12px 16px;
    }

    .low-tokens-banner {
        padding: 12px 16px;
    }

    .site-banner {
        padding: 12px 16px;
    }

    /* Stack like a card: copy first, full-width CTA row at bottom (matches 2FA mobile) */
    .two-fa-activation-banner__inner,
    .low-tokens-banner__inner,
    .site-banner__inner {
        flex-direction: column;
        align-items: stretch;
    }

    .two-fa-activation-banner__lead,
    .low-tokens-banner__lead,
    .site-banner__lead {
        flex: 1 1 auto;
        min-width: 0;
        width: 100%;
    }

    .low-tokens-banner__actions {
        width: 100%;
        flex-direction: row;
        justify-content: stretch;
        gap: 10px;
    }

    .low-tokens-banner__cta {
        flex: 1 1 auto;
        min-width: 0;
        box-sizing: border-box;
    }

    .two-fa-activation-banner__cta {
        width: 100%;
        box-sizing: border-box;
    }

    .site-banner__actions {
        width: 100%;
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
    }

    .site-banner__cta {
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
    }

    .site-banner__dismiss {
        align-self: flex-end;
    }

    .site-banner__actions:not(:has(.site-banner__cta)) {
        align-items: flex-end;
    }

    .content-body {
        padding: 16px;
        overflow-x: hidden;
        min-width: 0;
    }

    /* Admin user detail: stack KV rows on tablet/phone; avoid global table rules blowing up layout */
    .admin-kv-table tbody tr {
        display: block;
        padding: 14px 16px;
        border-bottom: 1px solid var(--border-color);
    }

    .admin-kv-table tbody tr:last-child {
        border-bottom: none;
    }

    .admin-kv-table th,
    .admin-kv-table td {
        display: block;
        width: 100% !important;
        max-width: none !important;
        padding: 0;
        border: none;
    }

    .admin-kv-table th {
        margin-bottom: 6px;
    }

    .admin-kv-table td {
        padding-bottom: 2px;
    }

    .admin-user-detail-card__head {
        padding: 14px 16px;
    }

    .admin-user-sessions-note {
        padding-left: 16px;
        padding-right: 16px;
    }

    .user-meta {
        display: none;
    }

    .profile-info {
        padding: 4px;
    }

    /* Search box on mobile */
    .header-search {
        display: none;
    }

    /* Page Typography */
    .page-title {
        font-size: 24px;
    }

    /* Page head: stack title + actions, left-align like contacts / directory pages */
    .page-head {
        flex-direction: column;
        align-items: stretch;
        align-content: flex-start;
        justify-content: flex-start;
        text-align: left;
    }

    .page-head > div:first-child {
        width: 100%;
        max-width: 100%;
        text-align: left;
    }

    .page-head.page-head--admin .page-title,
    .page-head.page-head--admin .page-desc {
        text-align: left;
    }

    .page-head-actions {
        width: 100%;
        max-width: 100%;
        justify-content: flex-start;
        flex-wrap: wrap;
    }

    .page-head-actions .btn,
    .page-head-actions a.btn {
        width: 100%;
        max-width: 100%;
        justify-content: center;
        box-sizing: border-box;
    }

    /* Tables */
    .table-container {
        overflow-x: auto;
        display: block;
        width: 100%;
        -webkit-overflow-scrolling: touch;
    }

    .table-container table {
        min-width: 600px;
    }

    /* Wide data tables only — do not apply to admin user KV / session tables */
    .table-container th,
    .table-container td {
        padding: 12px 16px;
        font-size: 13px;
        white-space: nowrap;
    }

    .user-meta-balance {
        text-align: center !important;
        margin-top: 16px;
    }

    /* Modals & Cards */
    .card {
        padding: 16px;
        margin-bottom: 20px;
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
    }

    .flex-responsive {
        flex-direction: column;
        align-items: stretch;
        text-align: center;
    }

    .card .header-search {
        display: block;
        max-width: 100%;
    }

    .modal {
        padding: 20px;
        margin: 16px;
        width: calc(100% - 32px);
        height: max-content;
    }

    /* Auth layout */
    .auth-container .main-wrapper {
        padding: 0px;
    }

    .auth-container .card {
        margin: 20px 0;
    }

    /* Utilities */
    .btn {
        font-size: 14px;
        padding: 10px 16px;
    }

    .table-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }

    .group-hero-flex {
        flex-direction: column;
        align-items: center !important;
        text-align: center;
        gap: 20px !important;
    }

    .group-detail-grid {
        gap: 20px;
    }

    .group-detail-main-card {
        padding: 20px !important;
    }

    .group-detail-side-card,
    .group-admin-setting-card {
        padding: 20px !important;
    }

    .group-detail-hero-title-row {
        flex-wrap: wrap;
        justify-content: center;
        text-align: center;
    }

    #hero-group-name {
        font-size: clamp(1.2rem, 6vw, 1.65rem);
        line-height: 1.25;
        word-break: break-word;
        overflow-wrap: anywhere;
        max-width: 100%;
    }

    .group-detail-description,
    #group-description {
        word-break: break-word;
        overflow-wrap: anywhere;
        hyphens: auto;
        max-width: 100%;
        box-sizing: border-box;
        text-align: left;
    }

    .group-detail-owner-jid {
        word-break: break-all;
        overflow-wrap: anywhere;
        font-size: 13px;
        line-height: 1.45;
        text-align: left;
    }

    #invite-link-container > div {
        max-width: 100%;
        box-sizing: border-box;
        word-break: break-word;
        overflow-wrap: anywhere;
    }

    .group-admin-toggle-label {
        align-items: flex-start;
        gap: 10px;
        text-align: left;
    }

    .group-admin-toggle-input {
        margin-top: 4px !important;
    }

    .group-admin-toggle-text {
        flex: 1 1 0;
        min-width: 0;
    }

    .group-admin-hint,
    .group-admin-hint--rich {
        margin-left: 0 !important;
        margin-right: 0;
        max-width: 100%;
        box-sizing: border-box;
        text-align: left;
    }

    .group-admin-setting-card .group-admin-hint,
    .group-admin-setting-card .group-admin-hint--rich {
        padding-inline-start: calc(20px + 12px);
        padding-inline-end: 0;
    }

    .group-admin-hint--rich code {
        word-break: break-word;
    }

    .group-stats-grid {
        justify-content: center;
        width: 100%;
    }

    .group-actions-flex {
        flex-direction: column;
        align-items: stretch !important;
    }

    /* Inline margin-left: auto breaks stretch; match other stacked action buttons */
    .group-actions-flex #schedule-btn {
        margin-left: 0;
        width: 100%;
        justify-content: center;
        box-sizing: border-box;
    }

    .group-top-bar {
        flex-wrap: wrap;
        align-items: flex-start;
    }

    .group-top-bar > div:last-child {
        min-width: 0;
        flex: 1 1 auto;
    }

    .group-top-bar #group-name {
        word-break: break-word;
        overflow-wrap: anywhere;
        max-width: 100%;
    }

    .table-footer {
        flex-wrap: wrap;
        justify-content: center;
        gap: 12px;
    }

    /* Full-width, stacked pagination on small screens */
    .table-container:has(.directory-table-footer) {
        width: 100%;
        max-width: 100%;
        min-width: 0;
        box-sizing: border-box;
    }

    .table-footer.directory-table-footer {
        flex-direction: column;
        align-items: stretch;
        justify-content: flex-start;
        width: 100%;
        max-width: 100%;
        margin-left: 0;
        margin-right: 0;
        padding-left: 16px;
        padding-right: 16px;
        box-sizing: border-box;
    }

    .table-footer.directory-table-footer .directory-table-footer-nav {
        display: flex;
        align-items: center;
        justify-content: space-between;
        width: 100%;
        max-width: 100%;
        gap: 8px;
        flex-wrap: wrap;
        box-sizing: border-box;
    }

    .table-footer.directory-table-footer .directory-table-footer-per-page {
        width: 100%;
        max-width: 100%;
        justify-content: space-between;
        white-space: normal;
        flex-wrap: wrap;
        box-sizing: border-box;
    }

    .table-footer.directory-table-footer .directory-table-footer-per-page select {
        flex: 1 1 auto;
        min-width: 0;
        max-width: 100%;
    }
}
/* Progress Bar Styles (contacts / groups directory fetch) */
.progress-container {
    width: 100%;
    margin: 16px 0 20px;
    display: none;
}

.progress-container.directory-fetch-progress-wrap {
    position: relative;
    height: 28px;
    background: transparent;
    overflow: visible;
}

.progress-container.directory-fetch-progress-wrap .directory-progress-track {
    position: absolute;
    left: 0;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    height: 6px;
    background: #E2E8F0;
    border-radius: 3px;
    overflow: hidden;
}

.progress-container .directory-progress-fill {
    display: block;
    height: 100%;
    width: 0%;
    border-radius: 3px;
    background: linear-gradient(90deg, var(--primary) 0%, #2dd4bf 50%, var(--primary) 100%);
}

.progress-container.directory-fetch-progress-wrap .directory-progress-pct {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 700;
    color: var(--navy);
    letter-spacing: 0.02em;
    pointer-events: none;
    z-index: 1;
    text-shadow: 0 0 4px #fff, 0 0 8px #fff, 0 1px 0 #fff;
}

.sidebar-brand-container {
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
    color: inherit;
    flex-grow: 1;
}

/* Sidebar Overlay Control */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    backdrop-filter: blur(8px);
    background: rgba(15, 23, 42, 0.4);
    z-index: 1500;
}

.sidebar-overlay.active {
    display: block;
}

.mobile-close {
    display: none;
    cursor: pointer;
    color: rgba(255, 255, 255, 0.6);
    transition: color 0.2s;
}

.mobile-close:hover {
    color: white;
}

/* Bankzai-style Mobile Sidebar */
@media (max-width: 1024px) {
    .header {
        padding: 0 20px;
        height: 70px;
    }

    .mobile-nav-toggle {
        display: flex !important;
    }

    .sidebar {
        position: fixed;
        left: -320px;
        top: 0;
        bottom: 0;
        width: 300px !important;
        height: 100vh;
        z-index: 2000;
        background: linear-gradient(180deg, #101c2c 0%, #1a4d4a 100%);
        transition: left 0.4s cubic-bezier(0.16, 1, 0.3, 1);
        box-shadow: 20px 0 50px rgba(0, 0, 0, 0.2);
    }

    .sidebar.mobile-active {
        left: 0;
    }

    .sidebar-header {
        padding: 24px;
        border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    }

    .mobile-close {
        display: flex !important;
    }

    .collapse-toggle {
        display: none !important;
    }

    .main-wrapper {
        margin-left: 0 !important;
        width: 100%;
    }

    .content-body {
        padding: 24px 20px;
    }

    .header-search {
        max-width: 250px;
    }
}

@media (max-width: 640px) {
    .page-title {
        font-size: 22px;
    }

    .page-desc {
        font-size: 14px;
        margin-bottom: 20px;
    }

    .card {
        padding: 20px;
    }

    .header-actions .profile-info .user-meta {
        display: none;
    }

    .filter-toolbar > input,
    .filter-toolbar > select {
        flex: 1 1 100% !important;
        min-width: 100% !important;
    }

    .filter-toolbar > .btn {
        width: 100%;
        justify-content: center;
    }

    .toast-container {
        left: 12px;
        right: 12px;
        transform: none;
        min-width: 0;
        width: auto;
        max-width: none;
    }

    .modal-overlay .modal {
        max-width: calc(100vw - 24px);
        margin: 12px;
    }
}

/* Segmented View Toggle Buttons */
.btn-group {
    display: flex;
    background: #F1F5F9;
    padding: 2px;
    border-radius: 8px;
    align-items: stretch;
}

.btn-toggle {
    background: transparent;
    border: none;
    padding: 6px 16px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
    color: var(--gray-text);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.btn-toggle:hover {
    color: var(--navy);
}

.btn-toggle.active {
    background: white;
    color: var(--primary);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.05);
}

.btn-toggle svg {
    width: 14px;
    height: 14px;
}

@media (max-width: 640px) {
    .btn-group {
        flex-wrap: wrap;
        width: 100%;
    }

    .btn-toggle {
        flex: 1 1 calc(50% - 4px);
        justify-content: center;
        min-height: 44px;
    }
}

.filter-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: center;
}

.header-inner {
    display: flex;
    align-items: center;
    gap: 16px;
    flex: 1;
    min-width: 0;
}

.help-fab {
    position: fixed;
    bottom: max(20px, env(safe-area-inset-bottom, 0px));
    right: max(20px, env(safe-area-inset-right, 0px));
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--primary);
    color: white;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 10px 25px rgba(0, 178, 137, 0.4);
    z-index: 999;
    transition: transform 0.2s;
}

.help-fab:active {
    transform: scale(0.96);
}

.profile-dropdown-panel {
    display: none;
    position: absolute;
    right: 0;
    top: 100%;
    margin-top: 12px;
    background: white;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    width: min(220px, calc(100vw - 32px));
    z-index: 100;
    flex-direction: column;
    overflow: hidden;
}

.schedule-form-card {
    max-width: 700px;
    margin: 0 auto;
    width: 100%;
}

.narrow-content-card {
    max-width: 600px;
    margin: 0 auto;
    width: 100%;
}

.admin-stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 24px;
    margin-bottom: 32px;
}

.modal-card-lg {
    width: min(800px, 100vw - 32px);
    max-width: 90vw;
    max-height: min(85vh, 100dvh - 32px);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
}

.modal-card-md {
    width: min(600px, 100vw - 32px);
    max-width: 90vw;
    max-height: min(80vh, 100dvh - 32px);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.content-body img:not([width]) {
    max-width: 100%;
    height: auto;
}

.content-body video {
    max-width: 100%;
    height: auto;
}

@media (max-width: 1024px) {
    .header {
        flex-wrap: wrap;
        row-gap: 8px;
        min-height: 64px;
        height: auto;
        padding-top: 10px;
        padding-bottom: 10px;
    }

    .header-actions {
        margin-left: auto;
    }
}

@media (max-width: 900px) {
    .grid-3 {
        grid-template-columns: 1fr;
    }

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

.live-chats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr));
    gap: 20px;
}

.group-top-bar,
.back-nav-row {
    flex-wrap: wrap;
}

.back-nav-row {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 32px;
}

.back-nav-row.spread {
    justify-content: space-between;
}

/* Group activity log: wrap long JID in header; timeline rows use min-width:0 inline on content column */
.group-activity-back-nav > div:last-child {
    flex: 1 1 auto;
    min-width: 0;
}

.group-activity-page-desc {
    word-break: break-word;
    overflow-wrap: anywhere;
    max-width: 100%;
}

#activity-timeline {
    min-width: 0;
    max-width: 100%;
}

.group-actions-flex {
    flex-wrap: wrap;
}

/* Group detail: admin toggles + description (mobile tweaks in max-width: 768px block) */
.group-admin-hint {
    margin: 12px 0 0 32px;
    font-size: 12px;
    color: var(--gray-text);
    line-height: 1.5;
}

.group-admin-hint--rich {
    line-height: 1.6;
}

.group-admin-toggle-text {
    min-width: 0;
}

.group-admin-setting-card .group-admin-toggle-text code {
    font-size: 12px;
    word-break: break-word;
}

/* Admin user list: pagination below table, mobile-friendly */
/* Admin user list: filters, bulk bar, footer (per page + pagination) */
.admin-filter-grid {
    display: grid;
    gap: 16px;
    grid-template-columns: minmax(280px, 3.5fr) minmax(128px, 1fr) minmax(128px, 1fr) auto;
    align-items: end;
}

.admin-filter-search-input,
.admin-filter-control {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    font-size: 14px;
    box-sizing: border-box;
    background: var(--white);
}

.admin-filter-actions {
    display: flex;
    align-items: flex-end;
}

.admin-filter-apply-btn {
    padding: 10px 20px;
    font-weight: 700;
    white-space: nowrap;
    min-height: 42px;
}

@media (max-width: 960px) {
    .admin-filter-grid {
        grid-template-columns: 1fr;
    }

    .admin-filter-actions .admin-filter-apply-btn {
        width: 100%;
    }
}

.admin-user-list-header {
    align-items: flex-start;
}

@media (min-width: 640px) {
    .admin-user-list-header {
        align-items: center;
    }
}

.admin-user-list-header__bulk {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    width: 100%;
}

@media (min-width: 640px) {
    .admin-user-list-header__bulk {
        width: auto;
        margin-left: auto;
        justify-content: flex-end;
    }
}

.admin-user-list-header__bulk-label {
    display: flex;
    align-items: center;
    min-height: 42px;
    font-size: 13px;
    font-weight: 600;
    color: var(--navy);
    margin: 0;
    flex-shrink: 0;
}

.admin-bulk-select {
    flex: 1 1 160px;
    min-width: 160px;
    max-width: 280px;
    height: 42px;
    padding: 0 12px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    font-size: 14px;
    background: var(--white);
    box-sizing: border-box;
}

.admin-bulk-apply-btn {
    height: 42px;
    padding: 0 18px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    flex-shrink: 0;
}

.admin-table-footer {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
    align-items: center;
    column-gap: 20px;
    row-gap: 14px;
    padding: 14px 20px 18px;
    border-top: 1px solid var(--border-color);
    background: var(--white);
}

.admin-table-footer__page-meta {
    justify-self: center;
    text-align: center;
    min-width: 0;
}

.admin-per-page-form {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    justify-self: start;
}

.admin-per-page-label {
    font-size: 13px;
    font-weight: 600;
    color: var(--navy);
    margin: 0;
}

.admin-per-page-select {
    min-width: 88px;
    height: 42px;
    padding: 0 12px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    font-size: 14px;
    background: var(--white);
    box-sizing: border-box;
}

.admin-table-footer .admin-pagination {
    border-top: none;
    padding: 0;
    margin: 0;
    justify-self: end;
    min-width: 0;
}

@media (max-width: 640px) {
    .admin-table-footer {
        display: flex;
        flex-direction: column;
        align-items: stretch;
    }

    .admin-table-footer__page-meta {
        order: 2;
    }

    .admin-table-footer .admin-pagination {
        order: 3;
        justify-content: center;
    }

    .admin-per-page-form {
        order: 1;
    }

    .admin-bulk-select {
        max-width: none;
    }
}

/* Admin site banner new/edit (responsive, especially “Who sees it”) */
.admin-banner-page-head {
    align-items: flex-start;
}

.admin-banner-page-head__actions {
    margin-left: auto;
    width: 100%;
}

@media (min-width: 520px) {
    .admin-banner-page-head__actions {
        width: auto;
    }
}

.admin-banner-form {
    padding: 24px;
    max-width: 720px;
    width: 100%;
    box-sizing: border-box;
}

@media (max-width: 480px) {
    .admin-banner-form {
        padding: 16px;
    }
}

.admin-banner-form__fields {
    display: flex;
    flex-direction: column;
    gap: 18px;
    min-width: 0;
}

.admin-banner-label {
    display: block;
    font-size: 12px;
    font-weight: 700;
    color: var(--gray-text);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: 6px;
}

.admin-banner-field {
    min-width: 0;
    width: 100%;
}

.admin-banner-textarea {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    padding: 12px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    font-size: 15px;
    font-family: inherit;
    box-sizing: border-box;
}

.admin-banner-meta {
    display: flex;
    flex-direction: column;
    gap: 16px;
    min-width: 0;
}

@media (min-width: 640px) {
    .admin-banner-meta {
        flex-direction: row;
        align-items: flex-end;
        gap: 20px;
    }

    .admin-banner-field--type {
        flex: 0 0 min(200px, 38%);
        max-width: 260px;
    }

    .admin-banner-field--audience {
        flex: 1 1 auto;
        min-width: 0;
    }
}

.admin-banner-select {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    padding: 10px 12px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    font-size: 16px;
    background: var(--white);
    box-sizing: border-box;
}

@media (min-width: 768px) {
    .admin-banner-select {
        font-size: 14px;
    }
}

.admin-banner-select--audience {
    line-height: 1.35;
}

.admin-banner-dates {
    display: grid;
    gap: 16px;
    grid-template-columns: 1fr;
    min-width: 0;
}

@media (min-width: 560px) {
    .admin-banner-dates {
        grid-template-columns: 1fr 1fr;
    }
}

.admin-banner-input-datetime {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    padding: 10px 12px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    font-size: 16px;
    box-sizing: border-box;
}

@media (min-width: 768px) {
    .admin-banner-input-datetime {
        font-size: 14px;
    }
}

.admin-banner-checkbox-row {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    font-size: 14px;
    font-weight: 600;
    color: var(--navy);
    cursor: pointer;
    line-height: 1.45;
}

.admin-banner-checkbox {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
    margin-top: 2px;
}

.admin-banner-hint {
    margin: 0 0 12px;
    font-size: 13px;
    color: var(--gray-text);
    line-height: 1.45;
}

.admin-banner-hint code {
    font-size: 12px;
    background: #f1f5f9;
    padding: 2px 6px;
    border-radius: 4px;
}

.admin-banner-cta {
    padding-top: 4px;
    border-top: 1px solid var(--border-color);
    margin-top: 4px;
}

.admin-banner-cta-grid {
    display: grid;
    grid-template-columns: 1fr;
    min-width: 0;
    row-gap: 24px;
    column-gap: 32px;
}

@media (min-width: 560px) {
    .admin-banner-cta-grid {
        grid-template-columns: minmax(160px, 1fr) minmax(220px, 2fr);
        row-gap: 20px;
    }
}

.admin-banner-input-text {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    padding: 10px 12px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    font-size: 16px;
    box-sizing: border-box;
}

@media (min-width: 768px) {
    .admin-banner-input-text {
        font-size: 14px;
    }
}

.admin-banner-form__actions {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 24px;
}

@media (max-width: 480px) {
    .admin-banner-form__actions .btn,
    .admin-banner-form__actions a.btn {
        width: 100%;
        justify-content: center;
        text-align: center;
        box-sizing: border-box;
    }
}

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

.admin-pagination__meta {
    font-size: 14px;
    font-weight: 600;
    color: var(--navy);
    padding: 0 4px;
}

.admin-pagination__link {
    flex: 0 1 auto;
    min-width: unset;
    text-align: center;
    text-decoration: none;
    justify-content: center;
}

@media (max-width: 480px) {
    .admin-table-footer .admin-pagination__link {
        flex: 1 1 calc(50% - 6px);
        min-width: min(140px, 100%);
    }
}
