:root {
    --bg-main: #ffffff;
    --bg-panel: #ffffff;
    --bg-panel-soft: #f8fafc;
    --bg-app: #eef2f7;
    --line-soft: rgba(15, 23, 42, 0.08);
    --text-main: #0f172a;
    --text-soft: #64748b;
    --primary: #4f46e5;
    --primary-2: #4338ca;
    --primary-glow: rgba(79, 70, 229, 0.15);
    --radius-lg: 16px;
    --radius-xl: 20px;
    --shadow-card: 0 1px 2px rgba(15, 23, 42, 0.04), 0 8px 24px rgba(15, 23, 42, 0.06);
    --shadow-card-hover: 0 12px 40px rgba(15, 23, 42, 0.1);
}

* {
    box-sizing: border-box;
}

body {
    font-family: 'Inter', sans-serif;
    background: var(--bg-app);
    color: var(--text-main);
    min-height: 100vh;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

.dashboard-body {
    margin: 0;
}

.auth-shell,
.app-shell {
    min-height: 100vh;
}

.app-shell {
    display: block;
}

.content-panel {
    min-height: 100vh;
    background:
        radial-gradient(1200px 400px at 10% -10%, rgba(79, 70, 229, 0.07), transparent 55%),
        radial-gradient(900px 350px at 90% 0%, rgba(14, 165, 233, 0.06), transparent 50%),
        var(--bg-app);
}

.sidebar-panel {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    width: 268px;
    padding: 24px 20px;
    background: linear-gradient(165deg, #121a2e 0%, #0c1220 48%, #0a0f1a 100%);
    border-right: 1px solid rgba(255,255,255,0.06);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    z-index: 1030;
    box-shadow: 8px 0 30px rgba(3, 8, 18, 0.12);
}

.content-with-sidebar {
    margin-left: 268px;
    padding: 24px 28px 40px;
    max-width: 1600px;
}

/* Collapsed sidebar (compact icon-only) */
.sidebar-panel.sidebar-collapsed {
    width: 72px;
}
.content-with-sidebar.sidebar-collapsed {
    margin-left: 72px;
}

.sidebar-panel,
.content-with-sidebar {
    transition: width 0.18s ease, margin-left 0.18s ease, padding 0.18s ease;
}

.sidebar-panel.sidebar-collapsed .panel-link span,
.sidebar-panel.sidebar-collapsed .brand-label,
.sidebar-panel.sidebar-collapsed .brand-title,
.sidebar-panel.sidebar-collapsed .sidebar-user-block,
.sidebar-panel.sidebar-collapsed .sidebar-logout-form .logout-label {
    display: none;
}

.sidebar-panel.sidebar-collapsed .panel-link { justify-content: center; padding-left: 0; padding-right: 0; }
.sidebar-panel.sidebar-collapsed .brand-dot { margin: 0 auto; }

/* Mobile open state for sidebar */
.sidebar-panel.mobile-open { left: 0; }

.sidebar-panel .nav-link {
    color: rgba(255,255,255,0.8);
}

.sidebar-panel .nav-link .bi {
    font-size: 1.05rem;
    color: rgba(255,255,255,0.9);
}

.sidebar-panel .nav-link span { margin-left: 8px; }

.sidebar-panel .panel-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    border-radius: 10px;
    color: rgba(255,255,255,0.85);
    background: transparent;
    border: 1px solid transparent;
    font-weight: 500;
}

.sidebar-panel .panel-link:hover,
.sidebar-panel .panel-link.active {
    color: #ffffff;
    background: linear-gradient(90deg, rgba(79, 70, 229, 0.28), rgba(79, 70, 229, 0.12));
    border-color: rgba(129, 140, 248, 0.35);
    box-shadow: inset 0 0 0 1px rgba(129, 140, 248, 0.12);
}

.nav-section-label {
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.38);
    margin: 0 0 10px 12px;
}

.sidebar-panel .panel-link:hover .bi,
.sidebar-panel .panel-link.active .bi {
    color: #ffffff;
}

.sidebar-panel .sidebar-footer .small,
.sidebar-panel .sidebar-footer h6,
.sidebar-panel .sidebar-footer .badge {
    color: #edf4ff !important;
}

.sidebar-panel .sidebar-footer {
    padding-top: 16px;
    margin-top: 8px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    background: transparent;
}

.sidebar-user-block {
    margin-bottom: 14px;
}

.sidebar-muted {
    color: rgba(255, 255, 255, 0.55) !important;
}

.role-badge {
    background: rgba(255, 255, 255, 0.12) !important;
    color: #e8f0ff !important;
    font-weight: 500;
    margin-top: 6px;
}

.btn-sidebar-logout {
    color: #fff;
    background: rgba(239, 68, 68, 0.18);
    border: 1px solid rgba(248, 113, 113, 0.35);
    font-weight: 600;
    padding: 10px 14px;
    border-radius: 10px;
}

.btn-sidebar-logout:hover {
    background: rgba(239, 68, 68, 0.28);
    border-color: rgba(248, 113, 113, 0.5);
    color: #fff;
}

.btn-sidebar-icon {
    color: rgba(255, 255, 255, 0.85);
    border: 1px solid rgba(255, 255, 255, 0.15);
    background: transparent;
}

.content-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 24px;
    padding: 12px 16px;
    background: rgba(255, 255, 255, 0.72);
    backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.8);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-card);
}

.user-chip {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 4px 4px 4px 4px;
    border-radius: 999px;
    background: #fff;
    border: 1px solid var(--line-soft);
    padding-right: 14px;
}

.user-chip-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.95rem;
    color: #fff;
    background: linear-gradient(135deg, var(--primary), #6366f1);
    box-shadow: 0 4px 12px var(--primary-glow);
}

.user-chip-text {
    display: flex;
    flex-direction: column;
    line-height: 1.2;
}

.user-chip-text strong {
    font-size: 0.875rem;
    font-weight: 600;
}

.user-chip-text span {
    font-size: 0.75rem;
    color: var(--text-soft);
}

.btn-topbar-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    color: var(--text-main);
    border: 1px solid rgba(15, 23, 42, 0.1);
    background: #fff;
    border-radius: 10px;
    padding: 8px 14px;
    font-weight: 600;
    font-size: 0.875rem;
}

.btn-topbar-toggle .bi {
    font-size: 1.1rem;
}

.branch-flow-help strong {
    color: var(--text-main);
}

.bg-light-subtle {
    background: var(--bg-panel-soft) !important;
    border: 1px dashed rgba(15, 23, 42, 0.08);
}

@media (max-width: 991.98px) {
    .btn-topbar-toggle #sidebarToggleLabel {
        display: none;
    }

    .sidebar-panel {
        transform: translateX(-100%);
        transition: transform 0.2s ease;
    }

    .sidebar-panel.mobile-open {
        transform: translateX(0);
    }

    .content-with-sidebar {
        margin-left: 0 !important;
    }
}

.brand-dot {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: linear-gradient(135deg, #5f8cff, #7c6df7);
    box-shadow: 0 0 18px rgba(95, 140, 255, 0.45);
}

.brand-label {
    text-transform: uppercase;
    letter-spacing: 0.18em;
    font-size: 0.72rem;
    color: #9bb7ff;
}

.eyebrow {
    text-transform: uppercase;
    letter-spacing: 0.14em;
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--primary);
}

.eyebrow-on-dark {
    color: rgba(199, 210, 254, 0.95);
}

.content-panel .eyebrow {
    color: var(--primary);
}

.brand-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: #ffffff;
}

.panel-card {
    background: #ffffff;
    border: 1px solid rgba(15, 23, 42, 0.06);
    border-radius: var(--radius-lg);
    padding: 22px 24px;
    box-shadow: var(--shadow-card);
}

.panel-card-elevated {
    border-radius: var(--radius-xl);
    padding: 24px 26px;
}

.panel-title {
    font-size: 1.15rem;
    font-weight: 700;
    letter-spacing: -0.02em;
}

/* Polished form and card styles for admin pages */
.panel-card .form-control,
.panel-card .form-select {
    border-radius: 10px;
    padding: 10px 12px;
    background: #fff;
    border: 1px solid rgba(15, 23, 42, 0.08);
    color: var(--text-main);
}

.panel-card .btn {
    border-radius: 12px;
}

.panel-card .btn-primary {
    box-shadow: 0 6px 18px rgba(91,140,255,0.12);
    padding: 10px 18px;
}

.panel-card .card-actions {
    display: flex;
    gap: 10px;
    align-items: center;
}

.table thead th {
    text-transform: uppercase;
    letter-spacing: 0.06em;
    font-size: 0.85rem;
    color: var(--text-soft);
    border-bottom: 1px solid rgba(255,255,255,0.04);
}

.table tbody td {
    vertical-align: middle;
}

.permission-pill.active,
.permission-pill:hover {
    background: linear-gradient(90deg, rgba(91,140,255,0.16), rgba(122,92,255,0.12));
    color: #fff;
    border-color: rgba(91,140,255,0.28);
}

.form-label {
    color: var(--text-soft) !important;
    font-weight: 600;
}

.compact-card {
    padding: 18px;
}

.panel-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    border-radius: 10px;
    color: var(--text-main);
    background: transparent;
    border: 1px solid transparent;
}

.panel-link:hover,
.panel-link.active {
    color: #ffffff;
    background: rgba(91, 140, 255, 0.12);
    border-color: rgba(91, 140, 255, 0.25);
}

.top-banner h2,
.hero-copy h1 {
    font-weight: 800;
}

.metric-label {
    color: var(--text-soft);
    font-size: 0.88rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.auth-page {
    position: relative;
    min-height: 100vh;
    overflow: hidden;
}

.auth-page-bg {
    position: absolute;
    inset: 0;
    background:
        radial-gradient(ellipse 70% 60% at 20% 20%, rgba(79, 70, 229, 0.35), transparent 50%),
        radial-gradient(ellipse 60% 50% at 80% 80%, rgba(14, 165, 233, 0.2), transparent 45%),
        linear-gradient(145deg, #0f172a 0%, #1e1b4b 45%, #0f172a 100%);
}

.auth-headline {
    font-size: clamp(2rem, 4vw, 2.75rem);
    font-weight: 800;
    letter-spacing: -0.03em;
    line-height: 1.15;
}

.auth-lead {
    color: rgba(226, 232, 240, 0.82);
    font-size: 1.05rem;
    max-width: 420px;
}

.auth-feature-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.auth-feature-list li {
    display: flex;
    align-items: center;
    gap: 10px;
    color: rgba(226, 232, 240, 0.9);
    font-weight: 500;
}

.auth-feature-list .bi {
    color: #a5b4fc;
}

.login-card {
    max-width: 440px;
    margin-left: auto;
    padding: 32px 28px !important;
}

.login-card-icon {
    width: 52px;
    height: 52px;
    border-radius: 14px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    color: var(--primary);
    background: linear-gradient(135deg, rgba(79, 70, 229, 0.12), rgba(99, 102, 241, 0.08));
    margin-bottom: 16px;
}

.login-title {
    font-size: 1.65rem;
    font-weight: 800;
    letter-spacing: -0.03em;
}

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

.stats-grid,
.tile-grid,
.split-grid,
.dual-grid {
    display: grid;
    gap: 20px;
    align-items: start;
}

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

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

.split-grid {
    grid-template-columns: 1.15fr 0.85fr;
}

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

.metric-value {
    font-size: 2rem;
    font-weight: 800;
    line-height: 1.1;
    word-break: break-word;
}

.metric-icon {
    width: 48px;
    height: 48px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 16px;
    background: rgba(91, 140, 255, 0.16);
    color: #c9d8ff;
}

.layer-tile {
    min-height: 140px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.table-responsive {
    overflow-x: auto;
}

.sidebar-footer {
    margin-top: 24px;
}

.table-dark {
    --bs-table-bg: transparent;
    --bs-table-color: var(--text-main);
    --bs-table-border-color: rgba(11, 27, 43, 0.06);
}

.data-table {
    --bs-table-bg: transparent;
    --bs-table-color: var(--text-main);
    --bs-table-border-color: var(--line-soft);
    margin-bottom: 0;
}

.table-wrap {
    border: 1px solid var(--line-soft);
    border-radius: 12px;
    overflow: hidden;
    background: #fafbfc;
}

.data-table thead th {
    background: #f1f5f9;
    color: var(--text-soft);
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    padding: 12px 16px;
    border-bottom: 1px solid var(--line-soft);
}

.data-table tbody td {
    padding: 14px 16px;
    border-bottom: 1px solid rgba(15, 23, 42, 0.05);
    background: #fff;
    vertical-align: middle;
}

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

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

.page-hero {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 20px;
    padding: 8px 4px 4px;
}

.page-hero-title {
    font-size: clamp(1.75rem, 3vw, 2.25rem);
    font-weight: 800;
    letter-spacing: -0.03em;
    margin: 0 0 8px;
}

.page-hero-sub {
    font-size: 1rem;
    max-width: 520px;
}

.stat-card .metric-icon {
    background: linear-gradient(135deg, #eef2ff, #e0e7ff);
    color: var(--primary);
}

.metric-value-sm {
    font-size: 1.35rem !important;
}

.quick-tile {
    text-decoration: none;
    color: inherit;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
    display: block;
}

.quick-tile:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-card-hover);
    color: inherit;
}

.quick-tile-disabled {
    opacity: 0.55;
    pointer-events: none;
}

.quick-tile-icon {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    margin-bottom: 14px;
    color: var(--primary);
    background: linear-gradient(135deg, rgba(79, 70, 229, 0.12), rgba(99, 102, 241, 0.06));
}

.quick-tile h4 {
    font-size: 1.05rem;
    font-weight: 700;
    margin-bottom: 6px;
}

.btn-primary {
    box-shadow: 0 4px 14px var(--primary-glow);
    font-weight: 600;
    border-radius: 12px;
    padding: 10px 20px;
}

.modal-content {
    border-radius: var(--radius-xl) !important;
    border: none !important;
    box-shadow: 0 24px 60px rgba(15, 23, 42, 0.18) !important;
}

.flash-stack .alert {
    border-radius: 12px;
}

/* Gateways page — full width list, no cramped side column */
.gateways-page {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.gateways-page-header {
    align-items: flex-start;
    margin-bottom: 0;
}

.gateways-page-header h2 {
    margin: 0;
    font-size: clamp(1.5rem, 2.5vw, 2rem);
    font-weight: 800;
    letter-spacing: -0.03em;
}

.btn-add-gateway {
    flex-shrink: 0;
    white-space: nowrap;
    padding: 12px 22px;
}

.gateways-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding-bottom: 4px;
}

.gateways-table {
    min-width: 880px;
}

.gateways-table th {
    font-size: 0.72rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--text-muted, #64748b);
    font-weight: 600;
}

.gateway-type-pill {
    display: inline-flex;
    align-items: center;
    border-radius: 999px;
    padding: 4px 10px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.gateway-type-upi {
    background: #e0e7ff;
    color: #4338ca;
}

.gateway-type-bank {
    background: #dbeafe;
    color: #1d4ed8;
}

.gateway-type-crypto {
    background: #fef3c7;
    color: #b45309;
}

.layer-group-hint {
    color: #475569;
    font-size: 0.82rem;
}

.gateway-live-form {
    display: inline-block;
}

.gateway-live-switch {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding-left: 2.5em;
    min-height: 1.5rem;
}

.gateway-live-switch .form-check-input {
    width: 2.5em;
    height: 1.25em;
    cursor: pointer;
    margin-top: 0;
}

.gateway-live-switch .form-check-input:checked {
    background-color: #16a34a;
    border-color: #16a34a;
}

.gateway-live-switch .form-check-input:not(:checked) {
    background-color: #cbd5e1;
    border-color: #cbd5e1;
}

.gateway-live-label {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-main);
    cursor: pointer;
    user-select: none;
}

.gateway-edit-btn {
    border-radius: 999px;
    padding: 6px 14px;
    font-size: 0.82rem;
}

.gateway-location-banner {
    border-radius: 12px;
    padding: 12px 14px;
    background: #f8fafc;
    border: 1px solid rgba(15, 23, 42, 0.08);
}

.gateway-location-banner.gateway-location-ok {
    background: #ecfdf5;
    border-color: #bbf7d0;
}

.gateway-location-banner.gateway-location-ok .gateway-location-icon {
    color: #16a34a;
}

.gateway-location-banner.gateway-location-error {
    background: #fef2f2;
    border-color: #fecaca;
}

.gateway-location-banner.gateway-location-error .gateway-location-icon {
    color: #dc2626;
}

.gateway-location-icon {
    color: #6366f1;
    font-size: 1.25rem;
    margin-top: 2px;
}

.gateway-form-toggles .simple-toggle-item {
    flex: 1 1 220px;
    max-width: 100%;
}

.gateway-form-toggles .simple-checkbox {
    flex-shrink: 0;
    pointer-events: auto;
    position: relative;
    z-index: 1;
}

.gateway-audit-list {
    display: grid;
    grid-template-columns: 7rem 1fr;
    gap: 8px 16px;
    font-size: 0.9rem;
}

.gateway-audit-list dt {
    color: var(--text-muted, #64748b);
    font-weight: 600;
    margin: 0;
}

.gateway-audit-list dd {
    margin: 0;
}

.table-btn-muted {
    background: transparent;
    border-color: var(--line-soft);
}

.role-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}

.own-account-card {
    background: linear-gradient(180deg, #f8fafc 0%, #ffffff 100%);
    border: 1px solid rgba(79, 70, 229, 0.12);
}

.own-account-card .panel-head h3 {
    margin: 0;
    font-size: 1.15rem;
}

@media (max-width: 767px) {
    .gateways-page-header {
        flex-direction: column;
        gap: 16px;
    }

    .btn-add-gateway {
        width: 100%;
    }

    .gateways-toolbar {
        flex-direction: column;
        align-items: stretch;
    }
}

.form-control,
.form-select,
.form-check-input {
    background-color: #ffffff;
    border-color: rgba(11, 27, 43, 0.08);
    color: var(--text-main);
}

.form-control:focus,
.form-select:focus,
.form-check-input:focus {
    color: var(--text-main);
    background-color: #ffffff;
    border-color: rgba(37,99,235,0.55);
    box-shadow: 0 0 0 0.15rem rgba(37,99,235,0.12);
}

.form-control::placeholder {
    color: #7082a7;
}

.form-label,
.form-check-label,
.nav-tabs .nav-link,
.text-secondary {
    color: var(--text-soft) !important;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--primary-2));
    border: none;
}

/* Outline light used in several places; adapt to light theme so buttons remain visible */
.btn-outline-light {
    color: var(--text-main);
    background: transparent;
    border: 1px solid rgba(15,23,42,0.08);
}
.btn-outline-light:hover,
.btn-outline-light:focus {
    background: rgba(15,23,42,0.04);
    border-color: rgba(15,23,42,0.12);
    color: var(--text-main);
}

.status-pill,
.permission-pill {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    border-radius: 999px;
    padding: 8px 12px;
    font-size: 0.82rem;
    border: 1px solid transparent;
}

.status-pending {
    background: #fef9c3;
    color: #a16207;
    border-color: #fde047;
}

.status-duplicate,
.status-inactive {
    background: #fee2e2;
    color: #b91c1c;
    border-color: #fecaca;
}

.status-active,
.status-match {
    background: #dcfce7;
    color: #15803d;
    border-color: #bbf7d0;
}

.permission-pill {
    background: #eef2ff;
    color: var(--primary);
    border-color: #c7d2fe;
    margin: 4px 6px 0 0;
    font-weight: 600;
}

/* Role colors — Branch / Agent / Super Admin at a glance */
.role-pill.role-pill-super-admin {
    background: #ede9fe;
    color: #5b21b6;
    border-color: #c4b5fd;
}

.role-pill.role-pill-branch {
    background: #ccfbf1;
    color: #0f766e;
    border-color: #5eead4;
}

.role-pill.role-pill-agent {
    background: #ffedd5;
    color: #c2410c;
    border-color: #fdba74;
}

.role-pill.role-pill-sub-admin {
    background: #f1f5f9;
    color: #475569;
    border-color: #cbd5e1;
}

.role-pill.role-pill-default {
    background: #f3f4f6;
    color: #374151;
    border-color: #e5e7eb;
}

.sidebar-panel .role-badge.role-pill-super-admin {
    background: rgba(139, 92, 246, 0.25) !important;
    color: #e9d5ff !important;
}

.sidebar-panel .role-badge.role-pill-branch {
    background: rgba(20, 184, 166, 0.22) !important;
    color: #99f6e4 !important;
}

.sidebar-panel .role-badge.role-pill-agent {
    background: rgba(251, 146, 60, 0.22) !important;
    color: #fed7aa !important;
}

.sidebar-panel .role-badge.role-pill-sub-admin {
    background: rgba(148, 163, 184, 0.25) !important;
    color: #e2e8f0 !important;
}

.user-chip-text .role-pill-inline {
    font-size: 0.72rem;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 999px;
    display: inline-block;
    margin-top: 2px;
    border: 1px solid transparent;
}

.user-chip-text .role-pill-inline.role-pill-super-admin {
    background: #ede9fe;
    color: #5b21b6;
}

.user-chip-text .role-pill-inline.role-pill-branch {
    background: #ccfbf1;
    color: #0f766e;
}

.user-chip-text .role-pill-inline.role-pill-agent {
    background: #ffedd5;
    color: #c2410c;
}

.user-chip-text .role-pill-inline.role-pill-sub-admin {
    background: #f1f5f9;
    color: #475569;
}

.filter-tabs {
    gap: 10px;
    border-bottom: 0;
}

.filter-tabs .nav-link {
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 999px;
    color: var(--text-main) !important;
    padding-inline: 18px;
}

.filter-tabs .nav-link.active {
    color: var(--text-main) !important;
    background: rgba(37,99,235,0.08);
    border-color: rgba(37,99,235,0.16);
}

.gateway-type-card {
    border-radius: 12px;
    border: 1px solid rgba(11,27,43,0.06);
    padding: 16px;
    background: var(--bg-panel-soft);
}

.error-card {
    max-width: 700px;
    margin: 0 auto;
}

.sidebar-toggle {
    width: 40px;
    height: 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}

.top-navbar .brand-dot {
    width: 14px;
    height: 14px;
}

.sidebar-panel.sidebar-collapsed .sidebar-footer {
    padding: 14px 10px;
}

.sidebar-panel.sidebar-collapsed .sidebar-footer form {
    width: 100%;
    display: flex;
    justify-content: center;
}

.content-panel.content-expanded {
    margin-left: 92px;
    width: calc(100% - 92px);
}

.copy-btn {
    border: 1px solid rgba(11,27,43,0.08);
    background: #fff;
    color: var(--text-main);
    border-radius: 8px;
    width: 36px;
    height: 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    transition: all 0.12s ease;
}

.copy-btn:hover {
    background: rgba(37,99,235,0.08);
    border-color: rgba(37,99,235,0.16);
    color: var(--text-main);
}

.utr-cell {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    white-space: nowrap;
}

.access-page {
    display: flex;
    flex-direction: column;
    gap: 22px;
}

.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 8px;
}

.page-header h2 {
    margin: 8px 0 0;
    font-size: clamp(2rem, 3vw, 2.6rem);
    line-height: 1.15;
    letter-spacing: -0.04em;
    color: var(--text-main);
}

.page-header .btn-primary {
    min-width: 160px;
}

.access-metrics {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 18px;
}

.metric-card {
    background: linear-gradient(180deg, #ffffff 0%, #f7f9ff 100%);
    border: 1px solid rgba(15, 23, 42, 0.06);
    border-radius: 18px;
    padding: 18px 20px;
    box-shadow: 0 12px 30px rgba(15, 23, 42, 0.04);
}

.metric-card .metric-label {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 0.72rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--text-soft);
}

.metric-card .metric-icon {
    width: 42px;
    height: 42px;
    border-radius: 12px;
    background: linear-gradient(135deg, rgba(91,140,255,0.14), rgba(116,92,255,0.12));
    color: var(--primary);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.15rem;
    margin-bottom: 12px;
}

.metric-card .metric-value {
    margin: 0;
    font-size: 2rem;
    font-weight: 800;
    letter-spacing: -0.05em;
    color: var(--text-main);
}

.metric-card .metric-note {
    margin: 8px 0 0;
    color: var(--text-soft);
    font-size: 0.88rem;
}

.access-layout {
    display: grid;
    grid-template-columns: 1.35fr 0.85fr;
    gap: 22px;
}

.access-table-card {
    overflow: hidden;
}

.access-table-card .panel-head,
.access-form-card .panel-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 18px;
}

.access-table-card .panel-head h3,
.access-form-card .panel-head h3 {
    margin: 0;
    font-size: 1.35rem;
    letter-spacing: -0.04em;
    color: var(--text-main);
}

.access-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    background: transparent;
}

.access-table thead th {
    font-size: 0.74rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    padding: 10px 10px 12px;
    color: var(--text-soft);
    border-bottom: 1px solid rgba(15, 23, 42, 0.08);
    font-weight: 700;
    white-space: nowrap;
}

.access-table tbody td {
    padding: 12px 10px;
    border-bottom: 1px solid rgba(15, 23, 42, 0.06);
    color: var(--text-main);
    vertical-align: middle;
}

.access-table .access-col {
    width: 108px;
    max-width: 108px;
}

.access-table .actions-col {
    width: 1%;
    white-space: nowrap;
}

.access-icons {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.access-icon {
    width: 26px;
    height: 26px;
    border-radius: 7px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    border: 1px solid transparent;
}

.access-icon-on {
    background: #eef2ff;
    color: var(--primary);
    border-color: #c7d2fe;
}

.access-icon-off {
    background: #f8fafc;
    color: #cbd5e1;
    border-color: #e2e8f0;
}

.access-table .role-pill,
.access-table .status-pill {
    padding: 4px 10px;
    font-size: 0.75rem;
    margin: 0;
    white-space: nowrap;
}

.access-table-card .table-wrap {
    margin-top: 4px;
}

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

.user-cell {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.user-cell strong {
    font-size: 0.98rem;
    color: var(--text-main);
}

.user-cell span {
    color: var(--text-soft);
    font-size: 0.82rem;
}

.access-table .table-btn {
    border: 1px solid rgba(15, 23, 42, 0.08);
    background: rgba(15, 23, 42, 0.02);
    color: var(--text-main);
    border-radius: 10px;
    padding: 8px 12px;
    font-size: 0.8rem;
    font-weight: 600;
    text-decoration: none;
}

.access-table .table-btn:hover {
    background: rgba(37,99,235,0.06);
    border-color: rgba(37,99,235,0.14);
}

.access-form-card {
    background: linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
}

.access-form-card .form-wrap {
    display: grid;
    gap: 18px;
}

.access-form-card .field-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.access-form-card .inline-checks {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px 18px;
    padding: 12px 0 0;
}

.access-form-card .form-check {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    margin: 0;
    color: var(--text-main);
    background: rgba(15, 23, 42, 0.02);
    border: 1px solid rgba(15, 23, 42, 0.05);
    border-radius: 10px;
}

.access-form-card .form-check-input {
    margin: 0;
}

.access-form-card .form-check-label {
    color: var(--text-main) !important;
    font-weight: 600;
}

.access-form-card .submit-area {
    display: flex;
    justify-content: flex-end;
    margin-top: 8px;
}

.route-access-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    margin-top: 8px;
}

.route-option {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    min-height: 46px;
    padding: 10px 12px;
    margin: 0;
    border: 1px solid rgba(15, 23, 42, 0.06);
    border-radius: 10px;
    background: rgba(15, 23, 42, 0.02);
    cursor: pointer;
    user-select: none;
}

.route-option:hover {
    border-color: rgba(37, 99, 235, 0.18);
    background: rgba(37, 99, 235, 0.04);
}

.route-option .form-check-input {
    margin: 0;
    width: 18px;
    height: 18px;
    flex-shrink: 0;
    cursor: pointer;
    pointer-events: auto;
}

.route-option span {
    color: var(--text-main);
    font-weight: 600;
}

.simple-toggle-list {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    margin-top: 8px;
}

.simple-toggle-item {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 46px;
    padding: 10px 12px;
    border: 1px solid rgba(15, 23, 42, 0.08);
    border-radius: 10px;
    background: #fff;
    cursor: pointer;
    font-weight: 600;
    color: var(--text-main);
}

.simple-checkbox {
    width: 18px;
    height: 18px;
    margin: 0;
    accent-color: var(--primary);
    cursor: pointer;
}

@media (max-width: 1199px) {
    .stats-grid,
    .tile-grid,
    .split-grid,
    .dual-grid,
    .feature-grid {
        grid-template-columns: 1fr 1fr;
    }
}

@media (max-width: 991px) {
    .sidebar-panel {
        position: static;
        width: 100%;
        min-height: auto;
        overflow: visible;
        gap: 24px;
        border-right: 0;
        border-bottom: 1px solid var(--line-soft);
    }

    .content-panel {
        margin-left: 0;
        width: 100%;
    }

    .sidebar-panel.sidebar-collapsed {
        width: 100%;
        padding: 20px;
    }

    .content-panel.content-expanded {
        margin-left: 0;
        width: 100%;
    }
}

@media (max-width: 767px) {
    .stats-grid,
    .tile-grid,
    .split-grid,
    .dual-grid,
    .feature-grid {
        grid-template-columns: 1fr;
    }

    .content-panel,
    .sidebar-panel {
        padding: 20px;
    }

    .user-chip-text {
        display: none;
    }

    .page-hero {
        flex-direction: column;
    }

    .route-access-grid {
        grid-template-columns: 1fr;
    }

    .simple-toggle-list {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 1100px) {
    .access-layout {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 767px) {
    .page-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .access-metrics {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .access-form-card .field-grid,
    .access-form-card .inline-checks {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 520px) {
    .access-metrics {
        grid-template-columns: 1fr;
    }
}
