/* ─── منصة غصون — Admin Panel Styles ─── */
:root {
    --black: #222222;
    --black-light: #2d2d2d;
    --black-soft: #333333;
    --black-hover: #3a3a3a;
    --yellow: #ffb606;
    --yellow-dark: #e6a405;
    --yellow-glow: rgba(255, 182, 6, 0.12);
    --white: #ffffff;
    --gray: #999999;
    --gray-light: #f0f0f0;
    --success: #22c55e;
    --danger: #ef4444;
    --warning: #f59e0b;
    --sidebar-w: 280px;
    --header-h: 64px;
    --font: 'Tajawal', 'Segoe UI', sans-serif;
    --radius: 10px;
    --transition: 0.25s ease;
    --bp-admin: 991px;
    --touch-min: 44px;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: var(--font);
    background: #f4f4f5;
    color: var(--black);
    direction: rtl;
    line-height: 1.6;
}

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

/* ─── Layout ─── */
.admin-layout {
    display: flex;
    min-height: 100vh;
}

/* ─── Sidebar ─── */
.sidebar {
    width: var(--sidebar-w);
    background: var(--black);
    color: var(--white);
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    z-index: 100;
    display: flex;
    flex-direction: column;
    transition: transform 0.28s cubic-bezier(0.4, 0, 0.2, 1),
                box-shadow 0.28s ease,
                visibility 0.28s;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.sidebar-header {
    padding: 1.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.sidebar-logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.sidebar-logo-icon {
    width: 40px;
    height: 40px;
    background: var(--yellow);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 900;
    color: var(--black);
    font-size: 1.1rem;
}

.site-logo {
    display: block;
    object-fit: contain;
    flex-shrink: 0;
    border-radius: 10px;
}

.site-logo--sidebar {
    width: 40px;
    height: 40px;
}

.site-logo--header {
    width: 40px;
    height: 40px;
}

.site-logo--hero {
    display: block;
    width: 64px;
    height: 64px;
    margin: 0 auto 1.5rem;
    border-radius: 16px;
}

.sidebar-logo-text {
    font-size: 1.2rem;
    font-weight: 800;
}

.sidebar-logo-text span { color: var(--yellow); }

.sidebar-badge {
    display: inline-block;
    background: var(--yellow-glow);
    color: var(--yellow);
    font-size: 0.7rem;
    font-weight: 600;
    padding: 0.15rem 0.5rem;
    border-radius: 4px;
    margin-top: 0.5rem;
}

.sidebar-nav {
    flex: 1;
    padding: 1rem 0;
}

.nav-section {
    padding: 0.5rem 1.5rem;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--gray);
    margin-top: 0.5rem;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1.5rem;
    color: rgba(255, 255, 255, 0.65);
    font-weight: 500;
    font-size: 0.92rem;
    transition: var(--transition);
    border-right: 3px solid transparent;
    margin: 2px 0;
}

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

.nav-item.active {
    background: var(--yellow-glow);
    color: var(--yellow);
    border-right-color: var(--yellow);
}

.nav-item svg, .nav-item .nav-icon {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
    opacity: 0.8;
    display: flex;
    align-items: center;
    justify-content: center;
}

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

.sidebar-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.admin-user {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.admin-avatar {
    width: 38px;
    height: 38px;
    background: var(--yellow);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    color: var(--black);
    font-size: 0.9rem;
}

.admin-user-info { flex: 1; min-width: 0; }

.admin-user-name {
    font-size: 0.85rem;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.admin-user-role {
    font-size: 0.72rem;
    color: var(--gray);
}

.logout-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    color: rgba(255, 255, 255, 0.55);
    transition: var(--transition);
    padding: 0.25rem;
}

.logout-btn:hover { color: var(--yellow); }

/* ─── Main Content ─── */
.main-content {
    margin-right: var(--sidebar-w);
    flex: 1;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.topbar {
    height: var(--header-h);
    background: var(--white);
    border-bottom: 1px solid #e5e5e5;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 2rem;
    position: sticky;
    top: 0;
    z-index: 50;
}

.topbar-title {
    font-size: 1.15rem;
    font-weight: 700;
}

.topbar-start {
    display: flex;
    align-items: center;
    gap: 1rem;
    min-width: 0;
    flex: 1;
}

.topbar-actions { display: flex; align-items: center; gap: 1rem; }

.sidebar-toggle {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.5rem;
    color: var(--black);
    align-items: center;
    justify-content: center;
}

.page-content { padding: 2rem; flex: 1; }

/* ─── Cards & Stats ─── */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1.25rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: var(--white);
    border-radius: var(--radius);
    padding: 1.5rem;
    border: 1px solid #e5e5e5;
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    transition: var(--transition);
}

.stat-card:hover {
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.06);
    transform: translateY(-2px);
}

.stat-card-icon {
    width: 48px;
    height: 48px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.stat-card-icon.yellow { background: var(--yellow-glow); color: var(--yellow-dark); }
.stat-card-icon.green  { background: rgba(34, 197, 94, 0.12); color: #16a34a; }
.stat-card-icon.red    { background: rgba(239, 68, 68, 0.12); color: #dc2626; }
.stat-card-icon.orange { background: rgba(245, 158, 11, 0.12); color: #d97706; }
.stat-card-icon.gray   { background: rgba(100, 116, 139, 0.12); color: #64748b; }

.stat-card-value {
    font-size: 1.8rem;
    font-weight: 800;
    line-height: 1;
}

.stat-card-label {
    font-size: 0.85rem;
    color: var(--gray);
    margin-top: 0.25rem;
}

/* ─── Panel Card ─── */
.panel {
    background: var(--white);
    border-radius: var(--radius);
    border: 1px solid #e5e5e5;
    overflow: hidden;
}

.panel-header {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid #e5e5e5;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.panel-title {
    font-size: 1rem;
    font-weight: 700;
}

.panel-body { padding: 0; }
.panel-body.padded { padding: 1.5rem; }

/* ─── Table ─── */
.table-wrap { overflow-x: auto; }

table.data-table {
    width: 100%;
    border-collapse: collapse;
}

table.data-table th,
table.data-table td {
    padding: 0.85rem 1.25rem;
    text-align: right;
    font-size: 0.88rem;
}

table.data-table th {
    background: #fafafa;
    font-weight: 600;
    color: var(--gray);
    border-bottom: 1px solid #e5e5e5;
    white-space: nowrap;
}

table.data-table td { border-bottom: 1px solid #f0f0f0; }

table.data-table tbody tr:hover { background: #fafafa; }

table.data-table tbody tr:last-child td { border-bottom: none; }

/* ─── Badges ─── */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.2rem 0.65rem;
    border-radius: 50px;
    font-size: 0.75rem;
    font-weight: 600;
}

.badge-success { background: rgba(34, 197, 94, 0.12); color: #16a34a; }
.badge-danger  { background: rgba(239, 68, 68, 0.12); color: #dc2626; }
.badge-warning { background: rgba(245, 158, 11, 0.12); color: #d97706; }
.badge-muted   { background: #f0f0f0; color: #666; }
.badge-primary { background: rgba(37, 99, 235, 0.12); color: #1d4ed8; }
.badge svg { flex-shrink: 0; }

/* ─── Buttons ─── */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    padding: 0.55rem 1.15rem;
    border-radius: 8px;
    font-family: var(--font);
    font-size: 0.88rem;
    font-weight: 600;
    border: none;
    cursor: pointer;
    transition: var(--transition);
    white-space: nowrap;
}

.btn-primary {
    background: var(--yellow);
    color: var(--black);
}

.btn-primary:hover {
    background: var(--yellow-dark);
}

.btn-dark {
    background: var(--black);
    color: var(--white);
}

.btn-dark:hover { background: var(--black-light); }

.btn-outline {
    background: transparent;
    border: 1.5px solid #ddd;
    color: var(--black);
}

.btn-outline:hover { border-color: var(--yellow); color: var(--yellow-dark); }

.btn-sm { padding: 0.35rem 0.75rem; font-size: 0.8rem; }

.btn-danger { background: var(--danger); color: white; }
.btn-danger:hover { background: #dc2626; }

/* ─── Forms ─── */
.form-group { margin-bottom: 1.25rem; }

.form-label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    margin-bottom: 0.4rem;
    color: var(--black);
}

.form-control {
    width: 100%;
    padding: 0.7rem 1rem;
    border: 1.5px solid #ddd;
    border-radius: 8px;
    font-family: var(--font);
    font-size: 0.9rem;
    transition: var(--transition);
    background: var(--white);
    color: var(--black);
}

.form-control:focus {
    outline: none;
    border-color: var(--yellow);
    box-shadow: 0 0 0 3px var(--yellow-glow);
}

.form-check {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.88rem;
}

.form-check input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: var(--yellow);
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

/* ─── Alerts ─── */
.alert {
    padding: 0.85rem 1.15rem;
    border-radius: 8px;
    font-size: 0.88rem;
    margin-bottom: 1.25rem;
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

.alert-icon { flex-shrink: 0; }

.alert-success { background: rgba(34, 197, 94, 0.1); color: #16a34a; border: 1px solid rgba(34, 197, 94, 0.2); }
.alert-error   { background: rgba(239, 68, 68, 0.1); color: #dc2626; border: 1px solid rgba(239, 68, 68, 0.2); }
.alert-warning { background: rgba(245, 158, 11, 0.1); color: #d97706; border: 1px solid rgba(245, 158, 11, 0.2); }

/* ─── Login Page ─── */
.login-page {
    min-height: 100vh;
    display: flex;
    background: var(--black);
}

.login-visual {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem;
    background:
        radial-gradient(ellipse at 30% 50%, var(--yellow-glow) 0%, transparent 60%),
        var(--black);
    position: relative;
    overflow: hidden;
}

.login-visual::before {
    content: '';
    position: absolute;
    inset: 0;
    background-image:
        linear-gradient(rgba(255, 182, 6, 0.03) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 182, 6, 0.03) 1px, transparent 1px);
    background-size: 50px 50px;
}

.login-visual-content {
    position: relative;
    text-align: center;
    color: var(--white);
}

.login-visual-content h1 {
    font-size: 2.5rem;
    font-weight: 900;
    margin-bottom: 1rem;
}

.login-visual-content h1 span { color: var(--yellow); }

.login-visual-content p {
    color: var(--gray);
    font-size: 1.05rem;
    max-width: 400px;
}

.login-feature-list {
    list-style: none;
    margin-top: 2rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    text-align: right;
}

.login-feature-list li {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 0.92rem;
    color: rgba(255, 255, 255, 0.72);
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 10px;
    padding: 0.65rem 1rem;
    transition: var(--transition);
}

.login-feature-list li:hover {
    background: rgba(255, 182, 6, 0.07);
    border-color: rgba(255, 182, 6, 0.2);
    color: rgba(255, 255, 255, 0.9);
}

.login-feature-list li svg {
    color: var(--yellow);
    flex-shrink: 0;
    opacity: 0.9;
}

.login-form-side {
    width: 480px;
    max-width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    background: var(--white);
}

.login-box {
    width: 100%;
    max-width: 380px;
}

.login-box h2 {
    font-size: 1.5rem;
    font-weight: 800;
    margin-bottom: 0.5rem;
}

.login-box .subtitle {
    color: var(--gray);
    font-size: 0.9rem;
    margin-bottom: 2rem;
}

.login-box .btn-primary {
    width: 100%;
    padding: 0.8rem;
    font-size: 1rem;
    margin-top: 0.5rem;
}

.login-label-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 0.4rem;
}

.login-label-row .form-label {
    margin-bottom: 0;
}

.login-forgot-link {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--yellow-dark);
    text-decoration: none;
    white-space: nowrap;
}

.login-forgot-link:hover {
    color: var(--black);
    text-decoration: underline;
}

.login-alt-link {
    margin-top: 1.5rem;
    text-align: center;
    font-size: 0.85rem;
}

.login-alt-link a {
    color: var(--yellow-dark);
    font-weight: 600;
    text-decoration: none;
}

.login-alt-link a:hover {
    color: var(--black);
}

/* ─── Empty State ─── */
.empty-state {
    text-align: center;
    padding: 3rem;
    color: var(--gray);
}

.empty-state-icon {
    margin-bottom: 1rem;
    opacity: 0.35;
    color: var(--gray);
    display: flex;
    justify-content: center;
}

/* ─── Responsive shell (matches --bp-admin) ─── */
@media (max-width: 991px) {
    .sidebar {
        transform: translateX(110%); /* extra 10% hides any shadow/border edge */
        visibility: hidden;
    }
    .sidebar.open {
        transform: translateX(0);
        visibility: visible;
    }
    .main-content { margin-right: 0; }
    .sidebar-toggle { display: flex; }
    .login-visual { display: none; }
    .login-form-side { width: 100%; }
}

@media (max-width: 576px) {
    .form-row { grid-template-columns: 1fr; }
    .page-content { padding: 1rem; }
    .stats-grid { grid-template-columns: 1fr 1fr; }
}

/* ─── Overlay ─── */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0);
    z-index: 99;
    transition: background 0.28s ease;
}

.sidebar-overlay.show {
    display: block;
    background: rgba(0, 0, 0, 0.72);
}

/* ─── Form sections ─── */
.form-section {
    margin-bottom: 1.75rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid #eee;
}

.form-section:last-of-type { border-bottom: none; }

.form-section-title {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--black);
    margin-bottom: 1rem;
    padding-right: 0.75rem;
    border-right: 3px solid var(--yellow);
}

/* ─── Pagination ─── */
.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    padding: 1.25rem;
    border-top: 1px solid #eee;
}

.pagination-info {
    font-size: 0.85rem;
    color: var(--gray);
}

/* ─── Info list ─── */
.info-list { font-size: 0.88rem; }
.info-list dt {
    color: var(--gray);
    font-weight: 600;
    margin-top: 0.75rem;
}
.info-list dt:first-child { margin-top: 0; }
.info-list dd {
    margin: 0.15rem 0 0;
    font-weight: 600;
}

/* ─── User search ─── */
.selected-user {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
    padding: 0.75rem 1rem;
    background: #fafafa;
    border: 1.5px solid #e5e5e5;
    border-radius: 8px;
}

.selected-user span { color: var(--gray); font-size: 0.85rem; }

.search-results {
    border: 1.5px solid #e5e5e5;
    border-radius: 8px;
    margin-top: 0.35rem;
    max-height: 240px;
    overflow-y: auto;
    background: white;
    display: none;
}

.search-results:not(:empty) { display: block; }

.search-result-item {
    padding: 0.65rem 1rem;
    cursor: pointer;
    font-size: 0.88rem;
    border-bottom: 1px solid #f0f0f0;
}

.search-result-item:hover { background: var(--yellow-glow); }
.search-result-item:last-child { border-bottom: none; }

/* ─── Users list: filters & columns ─── */
.users-panel {
    overflow: hidden;
}

.users-panel .panel-toolbar {
    border-bottom: 1px solid #e5e5e5;
}

.panel-toolbar-top {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 1rem;
    padding: 1.25rem 1.5rem;
    flex-wrap: wrap;
}

.panel-toolbar-top .panel-title {
    flex: 0 0 auto;
    min-width: 0;
}

.quick-search {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    flex: 1 1 260px;
    max-width: 420px;
    min-width: 0;
}

.quick-search .form-control {
    flex: 1;
    min-width: 0;
}

.users-panel.filters-open .quick-search {
    display: none;
}

.filter-q-field {
    grid-column: 1 / -1;
}

@media (min-width: 769px) {
    .panel-toolbar-top {
        flex-wrap: nowrap;
    }

    .toolbar-actions {
        margin-inline-start: auto;
        flex-shrink: 0;
    }
}

.btn-active {
    border-color: var(--yellow);
    color: var(--yellow-dark);
    background: var(--yellow-glow);
}

.count-badge {
    display: inline-block;
    background: var(--yellow-glow);
    color: var(--yellow-dark);
    font-size: 0.75rem;
    font-weight: 700;
    padding: 0.15rem 0.55rem;
    border-radius: 50px;
    margin-right: 0.35rem;
    vertical-align: middle;
}

.toolbar-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.filters-panel {
    display: none;
    padding: 0 1.5rem 1.25rem;
    border-top: 1px solid #f0f0f0;
    background: #fafafa;
}

.filters-panel.open { display: block; }

.filters-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 0.85rem 1rem;
    padding-top: 1.25rem;
}

.filters-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid #eee;
}

.stats-grid-compact {
    margin-bottom: 1.25rem;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
}

.column-picker-wrap { position: relative; }

.column-picker {
    display: none;
    position: absolute;
    left: 0;
    top: calc(100% + 6px);
    width: 260px;
    background: white;
    border: 1px solid #e5e5e5;
    border-radius: 10px;
    box-shadow: 0 12px 40px rgba(0,0,0,0.12);
    z-index: 200;
    overflow: hidden;
}

.column-picker.show { display: block; }

.column-picker-head {
    padding: 0.75rem 1rem;
    font-size: 0.82rem;
    font-weight: 700;
    background: #fafafa;
    border-bottom: 1px solid #eee;
}

.column-picker-list {
    max-height: 320px;
    overflow-y: auto;
    padding: 0.5rem;
}

.column-picker-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.45rem 0.5rem;
    font-size: 0.85rem;
    cursor: pointer;
    border-radius: 6px;
}

.column-picker-item:hover { background: #f5f5f5; }

.column-picker-item input { accent-color: var(--yellow); }

.column-picker-foot {
    padding: 0.65rem 0.75rem;
    border-top: 1px solid #eee;
    background: #fafafa;
    display: flex;
    gap: 0.5rem;
    justify-content: space-between;
}

.cell-ltr { text-align: right !important; font-size: 0.82rem; }
.table-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.35rem;
}

.table-actions .inline-form {
    display: inline-flex;
    margin: 0;
}

.btn-icon {
    width: 34px;
    height: 34px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    flex-shrink: 0;
}

.btn-icon svg {
    display: block;
}

.btn-danger-outline {
    background: transparent;
    border: 1.5px solid rgba(239, 68, 68, 0.35);
    color: #dc2626;
}

.btn-danger-outline:hover {
    background: rgba(239, 68, 68, 0.08);
    border-color: #dc2626;
    color: #b91c1c;
}

/* User list actions always stay in one horizontal row. */
#usersTable th[data-col="actions"],
#usersTable td[data-col="actions"] {
    width: 124px;
    min-width: 124px;
}

#usersTable td.cell-actions .table-actions {
    flex-wrap: nowrap;
    justify-content: center;
}

#usersTable td.cell-actions .btn-icon {
    width: 32px;
    height: 32px;
    min-height: 32px;
    padding: 0;
}

.user-detail-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 320px;
    gap: 1.5rem;
    align-items: start;
}

.user-edit-header-actions,
.user-edit-form-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.user-edit-form-actions {
    margin-top: 1rem;
}

.user-edit-panel {
    max-width: 900px;
}

.user-profile-hero {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1.5rem;
    padding: 1.4rem 1.5rem;
    margin-bottom: 1rem;
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
}

.user-profile-identity,
.user-profile-name-row,
.user-profile-contact,
.user-profile-actions {
    display: flex;
    align-items: center;
}

.user-profile-identity {
    gap: 1rem;
    min-width: 0;
}

.user-profile-avatar {
    width: 64px;
    height: 64px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    border-radius: 50%;
    background: var(--black);
    color: var(--yellow);
    font-size: 1.5rem;
    font-weight: 900;
    box-shadow: 0 0 0 5px rgba(255, 182, 6, 0.12);
}

.user-profile-heading {
    min-width: 0;
}

.user-profile-name-row {
    flex-wrap: wrap;
    gap: 0.65rem;
}

.user-profile-name-row h2 {
    margin: 0;
    font-size: 1.35rem;
    line-height: 1.4;
}

.user-profile-contact {
    flex-wrap: wrap;
    gap: 0.35rem 1rem;
    margin-top: 0.3rem;
    color: var(--gray);
    font-size: 0.82rem;
}

.user-profile-contact span:not(:last-child)::after {
    content: '•';
    margin-right: 1rem;
    color: #d1d5db;
}

.user-profile-actions {
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 0.5rem;
}

.user-profile-stats {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.user-profile-stat {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    min-width: 0;
    padding: 1rem;
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

.user-profile-stat-icon {
    width: 42px;
    height: 42px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    border-radius: 10px;
    color: #b77900;
    background: var(--yellow-glow);
}

.user-profile-stat-icon.is-success {
    color: #15803d;
    background: rgba(34, 197, 94, 0.1);
}

.user-profile-stat-icon.is-muted {
    color: #64748b;
    background: #f1f5f9;
}

.user-profile-stat strong,
.user-profile-stat span {
    display: block;
}

.user-profile-stat strong {
    color: var(--black);
    font-size: 1rem;
    line-height: 1.35;
}

.user-profile-stat div > span {
    color: var(--gray);
    font-size: 0.76rem;
    margin-top: 0.12rem;
}

.user-profile-tabs {
    display: flex;
    gap: 0.35rem;
    padding: 0.35rem;
    margin-bottom: 1rem;
    overflow-x: auto;
    background: #e9e9eb;
    border-radius: 11px;
}

.user-profile-tab {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.45rem;
    min-height: 40px;
    padding: 0.55rem 1rem;
    border: 0;
    border-radius: 8px;
    color: #666;
    background: transparent;
    font-family: var(--font);
    font-size: 0.85rem;
    font-weight: 700;
    white-space: nowrap;
    cursor: pointer;
    transition: var(--transition);
}

.user-profile-tab:hover {
    color: var(--black);
}

.user-profile-tab.is-active {
    color: var(--black);
    background: var(--white);
    box-shadow: var(--shadow-sm);
}

.user-profile-tab > span {
    min-width: 20px;
    padding: 0.05rem 0.35rem;
    border-radius: 999px;
    color: #666;
    background: #ddd;
    font-size: 0.7rem;
}

.user-profile-tab.is-active > span {
    color: #7a5800;
    background: var(--yellow-glow-md);
}

.user-profile-tab-panel[hidden] {
    display: none;
}

.user-profile-overview-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem;
}

.user-profile-info {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem 1.25rem;
    margin: 0;
}

.user-profile-info div {
    min-width: 0;
    padding-bottom: 0.7rem;
    border-bottom: 1px solid #f0f0f0;
}

.user-profile-info dt {
    margin-bottom: 0.2rem;
    color: var(--gray);
    font-size: 0.75rem;
    font-weight: 600;
}

.user-profile-info dd {
    margin: 0;
    overflow-wrap: anywhere;
    color: var(--black-soft);
    font-size: 0.88rem;
    font-weight: 700;
}

.current-sub-summary,
.current-sub-dates {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.current-sub-summary strong,
.current-sub-summary span {
    display: block;
}

.current-sub-summary strong {
    font-size: 1.05rem;
}

.current-sub-summary div > span {
    margin-top: 0.15rem;
    color: var(--gray);
    font-size: 0.8rem;
}

.current-sub-dates {
    margin: 1rem 0;
    padding: 0.75rem;
    border-radius: 8px;
    color: #64748b;
    background: #f8fafc;
    font-size: 0.78rem;
}

.plan-billing-box {
    margin-top: 1.1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border);
}

.plan-billing-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 0.55rem;
    font-size: 0.9rem;
}

.plan-billing-row span {
    color: var(--gray);
}

.plan-change-scheduled {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.4rem;
    margin: 0.65rem 0 0.25rem;
    padding: 0.7rem 0.8rem;
    border-radius: 8px;
    background: rgba(245, 158, 11, 0.08);
    border: 1px solid rgba(245, 158, 11, 0.2);
    font-size: 0.86rem;
}

.plan-change-history {
    margin-top: 1rem;
    padding-top: 0.85rem;
    border-top: 1px dashed var(--border);
}

.plan-change-history > strong {
    display: block;
    margin-bottom: 0.5rem;
    font-size: 0.88rem;
}

.plan-change-history ul {
    margin: 0;
    padding: 0;
    list-style: none;
}

.plan-change-history li {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.45rem 0.7rem;
    padding: 0.35rem 0;
    font-size: 0.82rem;
    border-bottom: 1px solid #f3f4f6;
}

.plan-change-history li > span:first-child {
    font-weight: 700;
    color: var(--black-soft);
}

.plan-change-summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 0.85rem;
    padding: 0.9rem 1rem;
    border-radius: 10px;
    background: #f8fafc;
    border: 1px solid var(--border);
}

.plan-change-summary > div {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.plan-change-summary .cell-muted {
    font-size: 0.75rem;
}

.plan-change-note-row td {
    padding-top: 0 !important;
    border-top: none !important;
    font-size: 0.8rem;
}

.user-profile-empty-compact {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem;
    color: var(--gray);
    text-align: center;
}

@media (max-width: 1100px) {
    .user-detail-grid {
        grid-template-columns: minmax(0, 1fr);
    }

    .user-profile-hero {
        align-items: flex-start;
        flex-direction: column;
    }

    .user-profile-actions {
        justify-content: flex-start;
        width: 100%;
    }

    .user-profile-stats {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}


.panel-header {
    flex-wrap: wrap;
    gap: 1rem;
}

@media (max-width: 768px) {
    .filters-grid { grid-template-columns: 1fr 1fr; }
    .column-picker { left: auto; right: 0; width: 240px; }
}

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

/* ─── Settings Hub ─── */
.settings-hub-header {
    margin-bottom: 1.75rem;
}

.settings-hub-title {
    font-size: 1.35rem;
    font-weight: 800;
    color: var(--black);
    margin-bottom: 0.35rem;
}

.settings-hub-subtitle {
    color: var(--gray);
    font-size: 0.92rem;
}

.settings-cards-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
    background: var(--white);
    border: 1px solid #e8e8e8;
    border-radius: 14px;
    padding: 1.25rem;
}

.settings-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 1.75rem 1rem 1.25rem;
    background: var(--white);
    border: 1px solid #ececec;
    border-radius: 12px;
    transition: border-color var(--transition), box-shadow var(--transition), transform var(--transition);
    min-height: 180px;
    cursor: pointer;
}

.settings-card:hover {
    border-color: rgba(255, 182, 6, 0.45);
    box-shadow: 0 8px 24px rgba(34, 34, 34, 0.08);
    transform: translateY(-2px);
}

.settings-card-icon {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--yellow-glow);
    color: var(--yellow-dark);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1rem;
    flex-shrink: 0;
}

.settings-card-title {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--black);
    margin-bottom: 0.35rem;
    line-height: 1.4;
}

.settings-card-desc {
    font-size: 0.78rem;
    color: var(--gray);
    line-height: 1.55;
    margin-bottom: 0.65rem;
    flex: 1;
}

.settings-card-badge {
    font-size: 0.7rem;
}

.settings-breadcrumb {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.88rem;
    color: var(--gray);
    flex-wrap: wrap;
}

.settings-breadcrumb a {
    color: var(--yellow-dark);
    font-weight: 600;
    transition: color var(--transition);
}

.settings-breadcrumb a:hover {
    color: var(--black);
}

.settings-breadcrumb-sep {
    display: flex;
    color: #ccc;
}

.settings-breadcrumb-current {
    color: var(--black);
    font-weight: 600;
}

@media (max-width: 1100px) {
    .settings-cards-grid { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 768px) {
    .settings-cards-grid { grid-template-columns: repeat(2, 1fr); padding: 1rem; }
}

@media (max-width: 480px) {
    .settings-cards-grid { grid-template-columns: 1fr; }
    .settings-card { min-height: auto; padding: 1.25rem 1rem; }
}

/* ─── Mobile Cards (shown only on mobile, replaces tables) ─── */
.mobile-cards {
    display: none;
}

.mobile-card {
    padding: 1rem;
    border-bottom: 1px solid #f0f0f0;
}

.mobile-card:last-child {
    border-bottom: none;
}

/* ─── Desktop-only / Mobile-only visibility ─── */
.d-mobile-hide { display: block; }
.d-desktop-hide { display: none; }

/* ─── Dashboard Welcome ─── */
.dashboard-welcome {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    background: var(--white);
    border: 1px solid #e5e5e5;
    border-radius: var(--radius);
    padding: 1.25rem 1.5rem;
    margin-bottom: 1.5rem;
    border-right: 4px solid var(--yellow);
}

.dashboard-welcome-title {
    font-size: 1.05rem;
    font-weight: 800;
    color: var(--black);
    margin-bottom: 0.2rem;
}

.dashboard-welcome-sub {
    font-size: 0.82rem;
    color: var(--gray);
}

.dashboard-quick-actions {
    display: flex;
    gap: 0.5rem;
    flex-shrink: 0;
    flex-wrap: wrap;
}

@media (max-width: 576px) {
    .dashboard-welcome {
        flex-direction: column;
        align-items: stretch;
    }
    .dashboard-quick-actions { flex-direction: column; }
    .dashboard-quick-actions .btn { width: 100%; justify-content: center; }
}

/* ─── Subscriptions toolbar & chips — base styles ─── */
.subs-toolbar {
    display: flex;
    gap: 0.75rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
    align-items: center;
}

.subs-search-form {
    display: flex;
    gap: 0.5rem;
    flex: 1;
    min-width: 220px;
    max-width: 360px;
}

.filter-chips {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.25rem;
    flex-wrap: wrap;
}

.subs-total-count {
    font-size: 0.85rem;
    color: var(--gray);
}

/* ─── Period picker (subscriptions) ─── */
.period-picker {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 1rem 1.25rem;
    margin-bottom: 1.25rem;
    overflow: hidden; /* prevent picker from causing page overflow */
}

.period-picker-head {
    direction: ltr;
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
}

.period-picker-title {
    margin-left: auto;
    direction: rtl;
    text-align: right;
    font-weight: 700;
    font-size: 0.95rem;
    color: var(--black);
    flex-shrink: 0;
}

.period-picker-years-wrap {
    flex-shrink: 0;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
}

.period-picker-years {
    display: flex;
    direction: rtl;
    gap: 0.35rem;
    flex-wrap: nowrap;
    width: max-content;
    padding: 0.15rem 0;
}

.period-picker-years .btn {
    min-width: 4rem;
    flex-shrink: 0;
}

.period-picker-months {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 0.4rem;
}

.period-picker-months .btn {
    padding: 0.45rem 0.35rem;
    font-size: 0.82rem;
    justify-content: center;
}

.period-picker-months .btn.is-current:not(.btn-primary) {
    border-color: var(--yellow);
    color: var(--black);
}

@media (max-width: 900px) {
    .period-picker-months { grid-template-columns: repeat(4, 1fr); }
}

@media (max-width: 560px) {
    .period-picker-months { grid-template-columns: repeat(3, 1fr); }
}

/* ─── Mobile/tablet admin (max-width: 991px) — aligns with sidebar drawer ─── */
@media (max-width: 991px) {
    :root {
        --touch-min: 44px;
    }

    /* Prevent horizontal overflow */
    .main-content {
        width: 100%;
        min-width: 0;
        overflow-x: hidden;
    }

    /* Show/hide helpers */
    .d-mobile-hide  { display: none !important; }
    .d-desktop-hide { display: block !important; }

    /* ─── Mobile card list ─── */
    .mobile-cards {
        display: block;
    }

    .mobile-card {
        padding: 0.9rem 1rem;
        border-bottom: 1px solid #f3f3f3;
    }

    .mobile-card:last-child {
        border-bottom: none;
    }

    .mobile-card-head {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 0.75rem;
        margin-bottom: 0.35rem;
    }

    .mobile-card-name {
        font-size: 0.95rem;
        font-weight: 700;
        color: var(--black);
        min-width: 0;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .mobile-card-meta {
        display: flex;
        flex-direction: column;
        gap: 0.1rem;
        margin-bottom: 0.6rem;
    }

    .mobile-card-meta span {
        font-size: 0.78rem;
        color: var(--gray);
        direction: ltr;
        text-align: right;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .mobile-card-details {
        display: flex;
        flex-wrap: wrap;
        gap: 0.35rem 1rem;
        margin-bottom: 0.75rem;
    }

    .mobile-card-detail {
        display: flex;
        align-items: center;
        gap: 0.35rem;
        font-size: 0.8rem;
    }

    .mobile-card-detail-label {
        color: var(--gray);
        font-weight: 600;
        font-size: 0.75rem;
    }

    .mobile-card-detail-label::after {
        content: ':';
    }

    .mobile-card-actions {
        display: flex;
        gap: 0.5rem;
    }

    .mobile-card-actions .btn {
        flex: 1;
        justify-content: center;
        min-height: 38px;
    }

    /* Lock body scroll when sidebar open (works on iOS too) */
    body.admin-nav-open {
        overflow: hidden;
        position: fixed;
        width: 100%;
    }

    /* Sidebar: cap width to 85vw on small phones */
    .sidebar {
        width: min(var(--sidebar-w), 85vw);
        box-shadow: none;
    }

    .sidebar.open {
        box-shadow: -4px 0 40px rgba(0, 0, 0, 0.45);
    }

    .topbar {
        height: auto;
        min-height: var(--header-h);
        padding: 0.5rem 0.75rem;
        padding-top: max(0.5rem, env(safe-area-inset-top));
        gap: 0.5rem;
    }

    .topbar-title {
        font-size: 0.95rem;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        min-width: 0;
    }

    .topbar-actions {
        flex-shrink: 0;
        gap: 0.4rem;
        min-width: 0;
    }

    .topbar-start {
        min-width: 0;
        flex: 1;
    }

    .topbar-invite-link,
    .topbar-site-link {
        padding: 0.4rem 0.65rem;
        font-size: 0.75rem;
        min-height: var(--touch-min);
        gap: 0.35rem;
    }

    .topbar-site-link {
        padding: 0.4rem 0.65rem;
        font-size: 0.75rem;
    }

    .page-content {
        padding: 0.75rem;
        padding-bottom: max(0.75rem, env(safe-area-inset-bottom));
    }

    .stats-grid,
    .stats-grid-compact {
        grid-template-columns: 1fr;
        gap: 0.75rem;
        margin-bottom: 1rem;
    }

    .stat-card {
        padding: 1rem;
        min-width: 0; /* prevent grid item from overflowing */
    }

    .stat-card:hover {
        transform: none;
        box-shadow: none;
    }

    .stat-card-value {
        font-size: 1.45rem;
    }

    .panel,
    .stats-grid > *,
    .stats-grid-compact > * {
        min-width: 0;
    }

    .panel-header {
        flex-direction: column;
        align-items: stretch;
        padding: 1rem;
        gap: 0.75rem;
    }

    .panel-body.padded {
        padding: 1rem;
    }

    .btn,
    .btn-sm {
        min-height: var(--touch-min);
    }

    .pagination {
        flex-wrap: wrap;
        gap: 0.5rem;
        padding: 1rem;
        padding-bottom: max(1rem, env(safe-area-inset-bottom));
    }

    .pagination .btn {
        flex: 0 0 auto;
        min-width: 0;
        justify-content: center;
        min-height: 36px;
        padding: 0.35rem 0.55rem;
    }

    .form-row {
        grid-template-columns: 1fr;
    }

    .panel--narrow {
        max-width: none !important;
    }

    .panel[style*="max-width"] {
        max-width: none !important;
    }

    .form-actions,
    .form-actions-row {
        display: flex;
        flex-direction: column;
        gap: 0.5rem;
    }

    .form-actions .btn,
    .form-actions-row .btn {
        width: 100%;
    }

    /* Toolbars */
    .panel-toolbar-top {
        flex-direction: column;
        align-items: stretch;
        padding: 1rem;
        gap: 0.75rem;
    }

    .panel-toolbar-top .panel-title {
        width: 100%;
    }

    .quick-search {
        flex: 1 1 100%;
        max-width: none;
        width: 100%;
    }

    .users-panel.filters-open .quick-search {
        display: flex;
    }

    .toolbar-actions {
        width: 100%;
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 0.5rem;
    }

    .toolbar-actions > .btn,
    .toolbar-actions > a.btn {
        width: 100%;
        justify-content: center;
    }

    .toolbar-actions .column-picker-wrap {
        grid-column: 1 / -1;
    }

    .filters-panel {
        padding: 0 1rem 1rem;
    }

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

    .filters-actions {
        flex-direction: column;
    }

    .filters-actions .btn {
        width: 100%;
    }

    .subs-toolbar {
        flex-direction: column !important;
        align-items: stretch !important;
        gap: 0.75rem;
    }

    .subs-search-form {
        flex: 1 1 100% !important;
        max-width: none !important;
        width: 100%;
        min-width: 0;
    }

    .subs-search-form .form-control {
        min-width: 0;
    }

    .subs-search-form .btn {
        flex-shrink: 0;
    }

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

    .filter-chips {
        flex-wrap: nowrap !important;
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch;
        gap: 0.5rem;
        padding-bottom: 0.35rem;
        margin-bottom: 1rem;
        scrollbar-width: none;
    }

    .filter-chips::-webkit-scrollbar {
        display: none;
    }

    .filter-chips .btn {
        flex-shrink: 0;
        white-space: nowrap;
    }

    .payments-toolbar {
        display: flex;
        flex-wrap: nowrap;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        gap: 0.5rem;
        padding-bottom: 0.25rem;
        margin-bottom: 1rem;
        scrollbar-width: none;
    }

    .payments-toolbar::-webkit-scrollbar {
        display: none;
    }

    .payments-toolbar .btn,
    .payments-toolbar .form-control {
        flex-shrink: 0;
    }

    .payments-toolbar {
        flex-direction: column;
        align-items: stretch;
        overflow: visible;
        flex-wrap: wrap;
    }

    .payments-toolbar > select.form-control {
        width: 100%;
        min-width: 0;
    }

    .payments-toolbar-chips {
        display: flex;
        flex-wrap: nowrap;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        gap: 0.5rem;
        padding-bottom: 0.25rem;
    }

    .period-picker {
        padding: 0.75rem;
        border-radius: 10px;
    }

    .period-picker-head {
        flex-direction: column;
        align-items: flex-end;
        gap: 0.6rem;
        margin-bottom: 0.75rem;
    }

    .period-picker-title {
        font-size: 0.85rem;
        margin-left: 0;
        align-self: flex-end;
    }

    .period-picker-years-wrap {
        width: 100%;
    }

    .period-picker-years {
        direction: rtl;
        width: 100%;
        justify-content: flex-start;
    }

    .period-picker-years .btn {
        min-height: 38px;
        min-width: 3.5rem;
    }

    .period-picker-months {
        grid-template-columns: repeat(4, 1fr);
        gap: 0.35rem;
    }

    .period-picker-months .btn {
        min-height: 40px;
        font-size: 0.78rem;
        padding: 0.45rem 0.25rem;
    }

    /* Column picker → bottom sheet */
    .column-picker-wrap {
        position: static;
    }

    .column-picker {
        position: fixed;
        left: 0;
        right: 0;
        bottom: 0;
        top: auto;
        width: auto;
        max-height: 70vh;
        border-radius: 16px 16px 0 0;
        z-index: 300;
        box-shadow: 0 -8px 40px rgba(0, 0, 0, 0.2);
    }

    .column-picker.show {
        display: flex;
        flex-direction: column;
    }

    .column-picker-list {
        flex: 1;
        max-height: 45vh;
    }

    body.column-picker-open::before {
        content: '';
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, 0.45);
        z-index: 299;
    }

    /* Stacked tables → cards */
    .table-wrap--stack {
        overflow: visible;
    }

    table.data-table--stack {
        border-collapse: separate;
        border-spacing: 0 0.65rem;
    }

    table.data-table--stack thead {
        display: none;
    }

    table.data-table--stack tbody tr {
        display: block;
        background: var(--white);
        border: 1px solid #e8e8e8;
        border-radius: 12px;
        padding: 0.35rem 0;
        box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
    }

    table.data-table--stack tbody tr:hover {
        background: var(--white);
    }

    table.data-table--stack tbody td {
        display: flex;
        align-items: flex-start;
        justify-content: space-between;
        gap: 1rem;
        padding: 0.55rem 1rem;
        border-bottom: 1px solid #f3f3f3;
        font-size: 0.88rem;
        text-align: left;
    }

    table.data-table--stack tbody td:last-child {
        border-bottom: none;
    }

    table.data-table--stack tbody td::before {
        content: attr(data-label);
        font-weight: 600;
        color: var(--gray);
        font-size: 0.78rem;
        flex-shrink: 0;
        text-align: right;
        min-width: 5.5rem;
    }

    table.data-table--stack tbody td[data-label=""]::before {
        display: none;
    }

    table.data-table--stack tbody td[data-label=""] {
        justify-content: center;
        padding-top: 0.75rem;
    }

    table.data-table--stack tbody td.cell-actions {
        flex-direction: column;
        align-items: stretch;
    }

    table.data-table--stack tbody td.cell-actions .table-actions {
        width: 100%;
        justify-content: center;
        flex-wrap: nowrap;
    }

    table.data-table--stack tbody td.cell-actions .btn:not(.btn-icon) {
        width: 100%;
    }

    /* Users table: hide non-essential columns on mobile */
    table.data-table--stack#usersTable tbody td[data-col]:not([data-col="name"]):not([data-col="email"]):not([data-col="phone"]):not([data-col="sub_status"]):not([data-col="actions"]) {
        display: none;
    }

    table.data-table--stack#usersTable thead th[data-col]:not([data-col="name"]):not([data-col="email"]):not([data-col="phone"]):not([data-col="sub_status"]):not([data-col="actions"]) {
        display: none;
    }

    /* Subscriptions table: hide # column on mobile */
    table.data-table--stack tbody td[data-label="#"] {
        display: none;
    }

    /* Table card: name cell bold + secondary info smaller */
    table.data-table--stack tbody td[data-label="المستفيد"] strong {
        font-size: 0.92rem;
    }

    table.data-table--stack tbody td[data-label="المستفيد"] small {
        font-size: 0.75rem;
    }

    /* Make action buttons in stacked cards full-width and spaced */
    table.data-table--stack tbody td.cell-actions {
        padding-top: 0.65rem;
        padding-bottom: 0.75rem;
        gap: 0.45rem;
    }

    table.data-table--stack tbody td.cell-actions .btn {
        padding: 0.55rem 1rem;
        font-size: 0.85rem;
    }

    table.data-table--stack#usersTable tbody td.cell-actions {
        width: 100%;
        min-width: 0;
        flex-direction: row;
        align-items: center;
        justify-content: center;
    }

    table.data-table--stack#usersTable tbody td.cell-actions .btn-icon {
        width: 36px;
        height: 36px;
        min-height: 36px;
        padding: 0;
    }

    /* Period picker: bigger month buttons on mobile */
    .period-picker-months .btn {
        padding: 0.6rem 0.35rem;
        font-size: 0.8rem;
        min-height: 40px;
    }

    /* Stats grid in subscriptions: compact horizontal row */
    .subs-stats-grid {
        display: flex !important;
        flex-direction: row !important;
        gap: 0.5rem !important;
        overflow-x: auto;
        padding-bottom: 0.25rem;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        margin-bottom: 0.85rem !important;
    }

    .subs-stats-grid::-webkit-scrollbar { display: none; }

    .subs-stats-grid .stat-card {
        flex: 0 0 auto;
        min-width: 120px;
        max-width: 140px;
        padding: 0.75rem;
        flex-direction: column;
        align-items: flex-start;
        gap: 0.35rem;
    }

    .subs-stats-grid .stat-card-icon {
        width: 32px;
        height: 32px;
        border-radius: 8px;
    }

    .subs-stats-grid .stat-card-icon svg {
        width: 16px;
        height: 16px;
    }

    .subs-stats-grid .stat-card-value {
        font-size: 1.2rem;
    }

    .subs-stats-grid .stat-card-label {
        font-size: 0.72rem;
        line-height: 1.4;
    }

    /* Subs total count badge */
    .subs-total-count {
        font-size: 0.8rem;
    }

    .settings-cards-grid {
        grid-template-columns: 1fr;
        padding: 0.85rem;
    }

    .settings-card {
        min-height: auto;
    }

    .settings-card:hover {
        transform: none;
    }

    .info-list--stack dt,
    .info-list--stack dd {
        text-align: right;
    }

    .detail-grid {
        grid-template-columns: 1fr !important;
    }

    .selected-user {
        flex-direction: column;
        align-items: stretch;
    }

    .selected-user .btn {
        width: 100%;
    }

    .form-control:focus,
    .btn:focus-visible {
        outline: 2px solid var(--yellow);
        outline-offset: 2px;
    }
}

@media (max-width: 991px) and (hover: none) {
    .stat-card:hover,
    .settings-card:hover,
    .nav-item:hover {
        transform: none;
    }
}

@media (max-width: 991px) {
    .user-profile-hero {
        padding: 1.1rem;
    }

    .user-profile-identity {
        align-items: flex-start;
    }

    .user-profile-avatar {
        width: 52px;
        height: 52px;
        font-size: 1.2rem;
    }

    .user-profile-name-row h2 {
        font-size: 1.1rem;
    }

    .user-profile-contact {
        align-items: flex-start;
        flex-direction: column;
        gap: 0.15rem;
    }

    .user-profile-contact span::after {
        display: none;
    }

    .user-profile-actions {
        display: grid;
        grid-template-columns: 1fr 1fr;
    }

    .user-profile-actions .btn:last-child {
        grid-column: 1 / -1;
    }

    .user-profile-stats {
        grid-template-columns: 1fr 1fr;
        gap: 0.5rem;
    }

    .user-profile-stat {
        padding: 0.75rem;
    }

    .user-profile-stat-icon {
        width: 36px;
        height: 36px;
    }

    .user-profile-stat strong {
        font-size: 0.85rem;
    }

    .user-profile-overview-grid,
    .user-profile-info {
        grid-template-columns: minmax(0, 1fr);
    }

    .user-profile-tabs {
        scrollbar-width: none;
    }

    .user-profile-tabs::-webkit-scrollbar {
        display: none;
    }

    .user-profile-tab {
        flex: 1 0 auto;
    }

    .current-sub-dates {
        align-items: flex-start;
        flex-direction: column;
        gap: 0.3rem;
    }
}

/* ─── Excel Export Modal ─── */
body.export-modal-open {
    overflow: hidden;
}

.export-modal[hidden] {
    display: none !important;
}

.export-modal {
    position: fixed;
    inset: 0;
    z-index: 1200;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.export-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(17, 17, 17, 0.48);
}

.export-modal-dialog {
    position: relative;
    z-index: 1;
    width: min(640px, 100%);
    max-height: min(88vh, 760px);
    display: flex;
    flex-direction: column;
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    overflow: hidden;
}

.export-modal-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    padding: 1.15rem 1.25rem;
    border-bottom: 1px solid var(--border);
}

.export-modal-header h3 {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 800;
}

.export-modal-subtitle {
    margin: 0.25rem 0 0;
    color: var(--gray);
    font-size: 0.82rem;
}

.export-modal-body {
    display: flex;
    flex-direction: column;
    min-height: 0;
    flex: 1;
}

.export-modal-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    padding: 0.85rem 1.25rem 0;
}

.export-columns {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.45rem;
    padding: 0.85rem 1.25rem;
    overflow: auto;
    flex: 1;
}

.export-col-item {
    display: flex;
    align-items: flex-start;
    gap: 0.55rem;
    padding: 0.65rem 0.7rem;
    border: 1px solid #ececec;
    border-radius: 10px;
    background: #fafafa;
    cursor: pointer;
    transition: var(--transition);
}

.export-col-item:hover {
    border-color: rgba(255, 182, 6, 0.55);
    background: #fffdf6;
}

.export-col-item.is-default {
    border-color: rgba(255, 182, 6, 0.35);
    background: rgba(255, 182, 6, 0.06);
}

.export-col-item input {
    margin-top: 0.15rem;
    accent-color: #e6a405;
}

.export-col-label {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.86rem;
    font-weight: 600;
    color: var(--black-soft);
    line-height: 1.45;
}

.export-col-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.05rem 0.4rem;
    border-radius: 999px;
    background: rgba(255, 182, 6, 0.18);
    color: #7a5800;
    font-size: 0.68rem;
    font-weight: 800;
}

.export-modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 0.55rem;
    padding: 0.95rem 1.25rem 1.15rem;
    border-top: 1px solid var(--border);
    background: #fafafa;
}

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

    .export-modal-footer {
        flex-direction: column-reverse;
    }

    .export-modal-footer .btn {
        width: 100%;
    }
}

/* ─── Payment Links ─── */
.payment-links-stats {
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 1rem;
    margin-bottom: 1.15rem;
}

.payment-links-stats .stat-card {
    min-width: 0;
    padding: 1.15rem 1.1rem;
    border: 1px solid var(--border);
    box-shadow: none;
    align-items: center;
}

.payment-links-stats .stat-card-body {
    min-width: 0;
    flex: 1;
}

.payment-links-stats .stat-card-value {
    font-size: 1.35rem;
    font-weight: 800;
    line-height: 1.15;
    letter-spacing: -0.02em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.payment-links-stats .stat-card-label {
    margin-top: 0.3rem;
    font-size: 0.8rem;
    color: var(--gray);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.payment-links-stats .stat-card-icon {
    width: 42px;
    height: 42px;
    border-radius: 12px;
}

.payment-links-filters {
    margin-bottom: 1rem;
}

.payment-links-result-count {
    font-size: 0.85rem;
    color: var(--gray);
    margin-bottom: 0.85rem;
}

@media (max-width: 1200px) {
    .payment-links-stats {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

@media (max-width: 780px) {
    .payment-links-stats {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 0.75rem;
    }

    .payment-links-stats .stat-card {
        padding: 1rem 0.9rem;
    }

    .payment-links-stats .stat-card-value {
        font-size: 1.2rem;
    }
}

@media (max-width: 480px) {
    .payment-links-stats {
        grid-template-columns: 1fr;
    }
}

.payment-link-token {
    font-size: 0.75rem;
    color: var(--gray);
    margin-top: 0.2rem;
    font-family: ui-monospace, monospace;
}

.payment-link-create-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.4fr) minmax(280px, 0.8fr);
    gap: 1.25rem;
    align-items: start;
}

.payment-link-amount-input {
    font-size: 1.35rem !important;
    font-weight: 800;
    letter-spacing: 0.02em;
}

.payment-link-usage-options {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.65rem;
}

.payment-link-usage-card {
    display: flex;
    gap: 0.65rem;
    align-items: flex-start;
    border: 1.5px solid var(--border);
    border-radius: var(--radius);
    padding: 0.85rem 0.95rem;
    cursor: pointer;
    background: #fff;
    transition: border-color .15s, box-shadow .15s;
}

.payment-link-usage-card:has(input:checked) {
    border-color: var(--yellow);
    box-shadow: 0 0 0 3px var(--yellow-glow);
}

.payment-link-usage-card strong {
    display: block;
    font-size: 0.92rem;
    margin-bottom: 0.15rem;
}

.payment-link-usage-card small {
    color: var(--gray);
    font-size: 0.78rem;
    line-height: 1.45;
}

.payment-link-preview {
    background: linear-gradient(160deg, #111 0%, #2a2a2a 100%);
    color: #fff;
    border-radius: 18px;
    padding: 1.5rem 1.35rem;
    min-height: 220px;
}

.payment-link-preview-brand {
    font-size: 0.78rem;
    opacity: 0.7;
    margin-bottom: 1.1rem;
    font-weight: 700;
}

.payment-link-preview-title {
    font-size: 1.15rem;
    font-weight: 800;
    line-height: 1.45;
    margin-bottom: 0.85rem;
}

.payment-link-preview-amount {
    font-size: 2rem;
    font-weight: 900;
    color: var(--yellow);
    margin-bottom: 0.75rem;
}

.payment-link-preview-amount span {
    font-size: 0.95rem;
    font-weight: 700;
    opacity: 0.85;
}

.payment-link-preview-desc {
    font-size: 0.86rem;
    line-height: 1.6;
    opacity: 0.78;
}

.payment-link-created-banner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
    background: rgba(34, 197, 94, 0.08);
    border: 1px solid rgba(34, 197, 94, 0.22);
    border-radius: var(--radius-lg);
    padding: 1rem 1.15rem;
    margin-bottom: 1.25rem;
}

.payment-link-created-banner p {
    margin: 0.25rem 0 0;
    color: #166534;
    font-size: 0.88rem;
}

.payment-link-created-url,
.payment-link-share-url {
    display: flex;
    gap: 0.5rem;
    flex: 1;
    min-width: 260px;
}

.payment-link-detail-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.3fr) minmax(280px, 0.9fr);
    gap: 1.25rem;
    align-items: start;
}

.payment-link-amount-hero {
    background: #111;
    color: #fff;
    border-radius: 16px;
    padding: 1.15rem 1.25rem;
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 1rem;
}

.payment-link-amount-hero span {
    opacity: 0.7;
    font-size: 0.85rem;
}

.payment-link-amount-hero strong {
    font-size: 1.75rem;
    font-weight: 900;
    color: var(--yellow);
}

.payment-link-desc-box {
    margin-top: 1rem;
    background: var(--gray-light);
    border-radius: var(--radius);
    padding: 0.9rem 1rem;
    font-size: 0.9rem;
    line-height: 1.65;
    color: var(--black-soft);
}

.payment-link-share {
    text-align: center;
}

.payment-link-qr {
    margin: 1.15rem auto 0.85rem;
}

.payment-link-qr img {
    border-radius: 12px;
    border: 1px solid var(--border);
    background: #fff;
    padding: 0.5rem;
}

.payment-link-qr p {
    margin: 0.45rem 0 0;
    font-size: 0.8rem;
    color: var(--gray);
}

.js-copy-link.is-copied {
    border-color: #16a34a;
    color: #16a34a;
}

.stat-card-icon.is-success { background: rgba(34,197,94,0.12); color: #16a34a; }
.stat-card-icon.is-warning { background: rgba(245,158,11,0.12); color: #d97706; }

.payment-link-title-link {
    color: inherit;
    text-decoration: none;
}
.payment-link-title-link:hover strong {
    color: var(--yellow-dark);
}

.payment-link-amount-cell {
    font-variant-numeric: tabular-nums;
    letter-spacing: -0.01em;
}

.payment-link-delete-hint {
    margin: 1rem 0 0;
    font-size: 0.8rem;
    color: var(--gray);
    background: #fafafa;
    border: 1px dashed var(--border);
    border-radius: var(--radius);
    padding: 0.7rem 0.85rem;
}

.payment-link-share .btn-outline {
    margin-top: 0.35rem;
}

@media (max-width: 980px) {
    .payment-link-create-grid,
    .payment-link-detail-grid { grid-template-columns: 1fr; }
    .payment-link-usage-options { grid-template-columns: 1fr; }
}

/* ─── System admins (settings) ─── */
.settings-breadcrumb { margin-bottom: 1.25rem; }

.form-hint {
    font-size: 0.8rem;
    color: var(--gray);
    margin-top: 0.35rem;
}

.required { color: #dc2626; }

.text-muted { color: var(--gray); }
.text-sm { font-size: 0.82rem; }

.admins-stats {
    margin-top: 0.25rem;
    margin-bottom: 1.25rem;
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

.admins-stats .stat-card-body { min-width: 0; }

.admins-stats .stat-card-value {
    font-size: 1.55rem;
}

.admins-panel-sub {
    margin: 0.3rem 0 0;
    font-size: 0.85rem;
    color: var(--gray);
    line-height: 1.45;
}

.admins-panel .panel-header {
    flex-wrap: wrap;
    gap: 0.75rem;
}

.admins-user-cell {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    min-width: 0;
}

.admins-avatar {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.95rem;
    flex-shrink: 0;
    background: #f3f4f6;
    color: #374151;
}

.admins-avatar--super {
    background: rgba(37, 99, 235, 0.12);
    color: #1d4ed8;
}

.admins-avatar--support {
    background: var(--yellow-glow);
    color: var(--yellow-dark);
}

.admins-user-meta { min-width: 0; }

.admins-user-name {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    flex-wrap: wrap;
    font-weight: 600;
    line-height: 1.3;
}

.admins-user-email {
    margin-top: 0.15rem;
    font-size: 0.8rem;
    color: var(--gray);
    direction: ltr;
    text-align: right;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.admins-row--self {
    background: rgba(250, 204, 21, 0.06);
}

.admins-table .th-actions,
.admins-table td.cell-actions {
    width: 72px;
    text-align: center;
}

.admins-table td.cell-actions .table-actions {
    justify-content: center;
}

.admins-form-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 280px;
    gap: 1.25rem;
    align-items: start;
}

.admins-side-panel { position: sticky; top: 1rem; }

.admins-side-list {
    margin: 0;
    padding-right: 1.1rem;
    color: var(--gray);
    font-size: 0.88rem;
    line-height: 1.7;
}

.admins-meta-list {
    margin: 0;
    display: grid;
    gap: 1rem;
}

.admins-meta-list dt {
    font-size: 0.75rem;
    color: var(--gray);
    margin-bottom: 0.25rem;
}

.admins-meta-list dd {
    margin: 0;
    font-size: 0.9rem;
    font-weight: 600;
}

.admins-edit-head {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    min-width: 0;
}

.admins-form-section {
    margin-bottom: 1.5rem;
    padding-bottom: 1.35rem;
    border-bottom: 1px solid #f0f0f0;
}

.admins-form-section:last-of-type {
    border-bottom: none;
    padding-bottom: 0;
    margin-bottom: 1rem;
}

.admins-form-section-title {
    margin: 0 0 0.9rem;
    font-size: 0.92rem;
    font-weight: 700;
}

.admins-role-options {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
}

.admins-role-card {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 0.95rem 1rem;
    border: 1.5px solid #e5e5e5;
    border-radius: var(--radius);
    cursor: pointer;
    transition: var(--transition);
    background: #fafafa;
}

.admins-role-card input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.admins-role-card:hover {
    border-color: #ccc;
    background: #fff;
}

.admins-role-card.is-selected {
    border-color: var(--yellow-dark);
    background: rgba(250, 204, 21, 0.08);
    box-shadow: 0 0 0 1px rgba(250, 204, 21, 0.35);
}

.admins-role-card-icon {
    width: 38px;
    height: 38px;
    border-radius: 9px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--yellow-glow);
    color: var(--yellow-dark);
    flex-shrink: 0;
}

.admins-role-card-icon--super {
    background: rgba(37, 99, 235, 0.12);
    color: #1d4ed8;
}

.admins-role-card-body {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    min-width: 0;
}

.admins-role-card-body strong {
    font-size: 0.9rem;
}

.admins-role-card-body span {
    font-size: 0.78rem;
    color: var(--gray);
    line-height: 1.45;
}

.admins-role-locked {
    padding: 0.85rem 1rem;
    background: #fafafa;
    border: 1px solid #eee;
    border-radius: var(--radius);
}

.admins-active-toggle {
    display: flex;
    align-items: flex-start;
    gap: 0.65rem;
    margin-top: 1rem;
    padding: 0.85rem 1rem;
    border: 1px solid #eee;
    border-radius: var(--radius);
    cursor: pointer;
    background: #fafafa;
}

.admins-active-toggle input {
    margin-top: 0.2rem;
    accent-color: var(--yellow-dark);
}

.admins-edit-actions {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
    align-items: center;
}

@media (max-width: 980px) {
    .admins-stats {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .admins-form-layout {
        grid-template-columns: 1fr;
    }

    .admins-side-panel { position: static; }

    .admins-role-options {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 560px) {
    .admins-stats {
        grid-template-columns: 1fr;
    }
}

/* Auto-renew admin tracking */
.auto-renew-admin-stats {
    margin-bottom: 1.25rem;
    grid-template-columns: repeat(5, minmax(0, 1fr));
}

.auto-renew-admin-stats .stat-card-body { min-width: 0; }

.auto-renew-admin-stats .stat-card-value {
    font-size: 1.45rem;
}

@media (max-width: 1100px) {
    .auto-renew-admin-stats {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

@media (max-width: 640px) {
    .auto-renew-admin-stats {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

/* روابط تسجيل المستفيدين */
.invite-plan-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
    gap: 0.85rem;
}

.invite-plan-card {
    position: relative;
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 1rem 1rem 1.05rem;
    border-radius: 14px;
    border: 2px solid #d1d5db;
    background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
    box-shadow: 0 2px 8px rgba(15, 23, 42, 0.06);
    cursor: pointer;
    transition: border-color 0.18s ease, box-shadow 0.18s ease, transform 0.18s ease, background 0.18s ease;
    user-select: none;
}

.invite-plan-card:hover {
    border-color: #f59e0b;
    box-shadow: 0 6px 18px rgba(245, 158, 11, 0.18);
    transform: translateY(-2px);
}

.invite-plan-card:has(input:checked),
.invite-plan-card.is-selected {
    border-color: var(--yellow, #ffb606);
    background: linear-gradient(180deg, #fffbeb 0%, #fff7ed 100%);
    box-shadow: 0 0 0 3px rgba(255, 182, 6, 0.22), 0 8px 20px rgba(245, 158, 11, 0.16);
}

.invite-plan-card input[type="radio"] {
    position: absolute;
    opacity: 0;
    width: 1px;
    height: 1px;
    margin: 0;
    pointer-events: none;
}

.invite-plan-card-check {
    flex-shrink: 0;
    width: 22px;
    height: 22px;
    margin-top: 0.15rem;
    border-radius: 50%;
    border: 2px solid #9ca3af;
    background: #fff;
    box-shadow: inset 0 0 0 3px #fff;
    transition: border-color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
}

.invite-plan-card:hover .invite-plan-card-check {
    border-color: #f59e0b;
}

.invite-plan-card:has(input:checked) .invite-plan-card-check,
.invite-plan-card.is-selected .invite-plan-card-check {
    border-color: var(--yellow, #ffb606);
    background: var(--yellow, #ffb606);
    box-shadow: inset 0 0 0 3px #fff;
}

.invite-plan-card-body {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    min-width: 0;
}

.invite-plan-card-body strong {
    font-size: 0.98rem;
    color: var(--black-soft, #1f2937);
    line-height: 1.35;
}

.invite-plan-card-price {
    color: var(--yellow-dark, #d97706);
    font-weight: 800;
    font-size: 1.05rem;
}

.invite-plan-card-body small {
    color: var(--gray, #6b7280);
    font-size: 0.78rem;
}

.invite-advanced {
    margin-top: 0.5rem;
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 0.75rem 1rem;
    background: #fafafa;
}

.invite-advanced summary {
    cursor: pointer;
    font-weight: 700;
    font-size: 0.9rem;
    list-style: none;
}

.invite-advanced summary::-webkit-details-marker { display: none; }

.invite-advanced-body {
    margin-top: 0.85rem;
    padding-top: 0.85rem;
    border-top: 1px solid var(--border);
}

/* ─── Responsive polish (unified ≤991 / ≤560 / ≤480) ─── */
.panel-toolbar-search {
    display: flex;
    gap: 0.45rem;
    align-items: center;
    flex-wrap: wrap;
    min-width: 0;
    width: 100%;
    max-width: 100%;
}

.panel-toolbar-input,
.panel-toolbar-select {
    min-width: 0;
    flex: 1 1 160px;
    max-width: 100%;
}

.topbar-invite-link,
.topbar-site-link {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
}

@media (max-width: 991px) {
    .payment-link-create-grid,
    .payment-link-detail-grid {
        grid-template-columns: 1fr;
    }

    .payment-link-created-url,
    .payment-link-share-url {
        min-width: 0;
        width: 100%;
        flex-wrap: wrap;
    }

    .payment-link-created-url .form-control,
    .payment-link-share-url .form-control {
        min-width: 0;
        flex: 1 1 100%;
    }

    .auto-renew-admin-stats {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .panel-toolbar-search {
        width: 100%;
    }

    .panel-toolbar-search .btn {
        flex: 1 1 auto;
        justify-content: center;
    }

    .user-profile-tabs {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        flex-wrap: nowrap;
        scrollbar-width: thin;
    }

    .user-profile-tab {
        flex-shrink: 0;
    }

    .login-form-side {
        padding: 1.5rem 1.15rem;
    }
}

@media (max-width: 560px) {
    .invite-plan-grid {
        grid-template-columns: 1fr;
    }

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

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

@media (max-width: 480px) {
    .topbar-btn-label {
        display: none;
    }

    .topbar-invite-link,
    .topbar-site-link {
        padding: 0.45rem 0.65rem;
        min-width: var(--touch-min);
        justify-content: center;
    }

    .login-form-side {
        padding: 1.15rem 0.9rem;
    }
}

/* ─── Admin bottom nav (app-like) ─── */
.admin-bottom-nav {
    display: none;
}

@media (max-width: 991px) {
    .admin-bottom-nav {
        display: grid;
        grid-template-columns: repeat(5, minmax(0, 1fr));
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        z-index: 90;
        height: calc(58px + env(safe-area-inset-bottom, 0px));
        padding: 0.25rem 0.2rem calc(0.25rem + env(safe-area-inset-bottom, 0px));
        background: #111;
        border-top: 1px solid rgba(255, 255, 255, 0.08);
        box-shadow: 0 -6px 24px rgba(0, 0, 0, 0.25);
    }

    .admin-layout {
        padding-bottom: calc(58px + env(safe-area-inset-bottom, 0px));
    }

    .page-content {
        padding-bottom: max(1rem, env(safe-area-inset-bottom, 0px));
    }

    .admin-bottom-nav-item {
        appearance: none;
        border: 0;
        background: transparent;
        color: rgba(255, 255, 255, 0.55);
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 0.12rem;
        min-width: 0;
        min-height: 48px;
        padding: 0.2rem 0.15rem;
        font: inherit;
        font-size: 0.62rem;
        font-weight: 700;
        text-decoration: none;
        cursor: pointer;
        border-radius: 10px;
    }

    .admin-bottom-nav-icon {
        display: flex;
        color: inherit;
    }

    .admin-bottom-nav-label {
        max-width: 100%;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        line-height: 1.2;
    }

    .admin-bottom-nav-item.is-active {
        color: var(--yellow);
    }

    /* Dense stats for subscriptions */
    .subs-stats-grid {
        display: grid !important;
        grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
        gap: 0.45rem !important;
        overflow: visible !important;
        margin-bottom: 0.75rem !important;
    }

    .subs-stats-grid .stat-card {
        min-width: 0 !important;
        max-width: none !important;
        padding: 0.55rem 0.45rem !important;
        flex-direction: column;
        align-items: flex-start;
        gap: 0.35rem;
    }

    .subs-stats-grid .stat-card-icon {
        width: 28px;
        height: 28px;
        font-size: 0;
    }

    .subs-stats-grid .stat-card-icon svg {
        width: 14px;
        height: 14px;
    }

    .subs-stats-grid .stat-card-value {
        font-size: 0.95rem !important;
        line-height: 1.2;
    }

    .subs-stats-grid .stat-card-label {
        font-size: 0.65rem !important;
        line-height: 1.3;
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
        overflow: hidden;
    }

    .panel-header {
        padding: 0.65rem 0.85rem !important;
        gap: 0.4rem !important;
    }

    .panel-header .panel-title {
        font-size: 0.95rem;
    }

    .subs-total-count {
        font-size: 0.78rem;
        white-space: nowrap;
    }

    /* Dense list rows instead of fat cards */
    .mobile-list {
        display: block;
    }

    .mobile-list-row {
        display: grid;
        grid-template-columns: minmax(0, 1fr) auto;
        gap: 0.35rem 0.5rem;
        align-items: center;
        padding: 0.55rem 0.75rem;
        border-bottom: 1px solid #eee;
        background: #fff;
    }

    .mobile-list-row:last-child {
        border-bottom: none;
    }

    .mobile-list-main {
        min-width: 0;
    }

    .mobile-list-top {
        display: flex;
        align-items: center;
        gap: 0.4rem;
        min-width: 0;
    }

    .mobile-list-name {
        font-size: 0.88rem;
        font-weight: 700;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        min-width: 0;
    }

    .mobile-list-meta {
        margin-top: 0.12rem;
        font-size: 0.72rem;
        color: var(--gray);
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        direction: ltr;
        text-align: right;
    }

    .mobile-list-sub {
        margin-top: 0.15rem;
        font-size: 0.72rem;
        color: #64748b;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .mobile-list-actions {
        display: flex;
        gap: 0.25rem;
        flex-shrink: 0;
        align-items: center;
        justify-content: flex-end;
    }

    .mobile-list-side {
        display: flex;
        flex-direction: row;
        align-items: center;
        justify-content: flex-end;
        gap: 0.35rem;
        flex-shrink: 0;
    }

    .mobile-list-side .badge {
        font-size: 0.68rem;
        padding: 0.15rem 0.45rem;
        white-space: nowrap;
    }

    .mobile-list-actions .btn-icon {
        width: 36px;
        height: 36px;
        min-height: 36px;
        padding: 0;
    }

    /* Compact pagination */
    .pagination {
        gap: 0.4rem !important;
        padding: 0.75rem !important;
        flex-wrap: wrap;
        justify-content: center;
    }

    .pagination .btn {
        flex: 0 0 auto !important;
        min-width: 0 !important;
        min-height: 36px !important;
        padding: 0.35rem 0.55rem !important;
    }

    .pagination--compact {
        display: flex;
        flex-wrap: wrap;
        align-items: center;
        justify-content: center;
        gap: 0.4rem;
    }

    .pagination-pages {
        display: flex;
        flex-wrap: wrap;
        gap: 0.3rem;
        justify-content: center;
        width: 100%;
        order: 3;
    }

    .pagination-nav {
        order: 1;
    }

    .pagination-info {
        order: 2;
        font-size: 0.78rem;
        flex: 1 1 auto;
        text-align: center;
        min-width: 7rem;
    }

    .pagination-ellipsis {
        color: var(--gray);
        padding: 0 0.15rem;
        font-size: 0.85rem;
    }

    .pagination .is-disabled {
        opacity: 0.35;
        pointer-events: none;
    }

    /* Denser stack tables */
    table.data-table--stack {
        border-spacing: 0 0.35rem !important;
    }

    table.data-table--stack tbody tr {
        border-radius: 8px !important;
        padding: 0 !important;
        box-shadow: none !important;
    }

    table.data-table--stack tbody td {
        padding: 0.4rem 0.7rem !important;
        font-size: 0.82rem !important;
    }

    .mobile-cards .mobile-card {
        padding: 0.55rem 0.75rem;
    }
}

@media (max-width: 480px) {
    .subs-stats-grid .stat-card-icon {
        display: none;
    }
}

/* Subscriptions roster bulk selection */
.subs-bulk-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 0.85rem;
    padding: 0.7rem 0.9rem;
    background: #111;
    color: #fff;
    border-radius: 10px;
}

.subs-bulk-bar[hidden] {
    display: none !important;
}

.subs-bulk-bar-info {
    font-size: 0.88rem;
}

.subs-bulk-bar-info .cell-muted {
    color: rgba(255, 255, 255, 0.55);
}

.subs-bulk-bar-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    align-items: center;
}

.subs-bulk-bar-actions .btn-outline {
    background: #fff;
    color: var(--black);
    border-color: #fff;
}

.subs-bulk-bar-actions .btn-outline:hover {
    background: #f3f3f3;
    border-color: #f3f3f3;
    color: var(--black);
}

.subs-bulk-form {
    display: inline;
    margin: 0;
}

.th-check,
.td-check {
    width: 2.2rem;
    text-align: center;
    vertical-align: middle;
}

.th-check input,
.td-check input,
.mobile-list-check input {
    width: 1.05rem;
    height: 1.05rem;
    accent-color: var(--yellow);
    cursor: pointer;
}

.mobile-list-check {
    display: flex;
    align-items: center;
    justify-content: center;
    padding-inline-end: 0.15rem;
}

.mobile-list-row:has(.mobile-list-check) {
    grid-template-columns: auto minmax(0, 1fr) auto;
}
