@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

@layer base {
    :root {
        --bg: #111217;
        --surface: #191b22;
        --surface-2: #20232c;
        --line: #2c303b;
        --text: #f7f8fb;
        --muted: #9399a9;
        --accent: #ff1835;
        --accent-soft: rgba(255, 24, 53, 0.14);
        --accent-glow: rgba(255, 24, 53, 0.25);
    }

    * {
        box-sizing: border-box;
    }

    body {
        margin: 0;
        font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
        color: var(--text);
        background: radial-gradient(circle at 5% 5%, rgba(255, 24, 53, 0.04) 0%, transparent 30%),
            radial-gradient(circle at 95% 95%, rgba(99, 102, 241, 0.04) 0%, transparent 30%),
            var(--bg);
        background-attachment: fixed;
        min-height: 100vh;
        -webkit-font-smoothing: antialiased;
    }

    button,
    input,
    select {
        font: inherit;
    }

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

    input,
    select {
        outline: none;
    }
}

/* --- Theme Design Tokens (Dark & Light Mode) --- */
html.light-mode, body.light-mode {
    --bg: #f8fafc;
    --surface: #ffffff;
    --surface-2: #f1f5f9;
    --line: #cbd5e1;
    --text: #0f172a;
    --muted: #475569;
    --accent: #ff1835;
    --accent-soft: rgba(255, 24, 53, 0.1);
    --accent-glow: rgba(255, 24, 53, 0.2);
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="url"],
select,
textarea {
    background: var(--surface-2);
    border: 1px solid var(--line);
    color: var(--text);
    border-radius: 8px;
    padding: 0 14px;
    font-size: 13px;
    font-weight: 500;
    transition: border-color .2s ease, box-shadow .2s ease;
}

input[type="text"]:focus,
input[type="email"]:focus,
input[type="password"]:focus,
input[type="number"]:focus,
input[type="url"]:focus,
select:focus,
textarea:focus {
    border-color: var(--accent) !important;
    box-shadow: 0 0 0 3px var(--accent-soft) !important;
}

/* Light Mode Specific Overrides */
html.light-mode .sidebar {
    background: #ffffff !important;
    border-right: 1px solid #e2e8f0 !important;
}

html.light-mode .sidebar-dropdown-toggle {
    color: #334155 !important;
}

html.light-mode .sidebar-dropdown-toggle:hover {
    color: #0f172a !important;
    background: #f1f5f9 !important;
}

html.light-mode .topbar {
    background: #ffffff !important;
    border-bottom: 1px solid #e2e8f0 !important;
}

html.light-mode .button-secondary {
    background: #f1f5f9 !important;
    border: 1px solid #cbd5e1 !important;
    color: #0f172a !important;
    font-weight: 700 !important;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04) !important;
}

html.light-mode .button-secondary:hover {
    background: #e2e8f0 !important;
    border-color: #94a3b8 !important;
    color: #000000 !important;
}

html.light-mode input[type="text"],
html.light-mode input[type="email"],
html.light-mode input[type="password"],
html.light-mode input[type="number"],
html.light-mode input[type="url"],
html.light-mode select,
html.light-mode textarea {
    background: #ffffff !important;
    border: 1px solid #cbd5e1 !important;
    color: #0f172a !important;
}

html.light-mode input::placeholder {
    color: #64748b !important;
}

html.light-mode .panel,
html.light-mode .metric-card,
html.light-mode .settings-panel {
    background: #ffffff !important;
    border: 1px solid #e2e8f0 !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04) !important;
}

html.light-mode .recipient-card {
    background: #f8fafc !important;
    border: 1px solid #e2e8f0 !important;
}

html.light-mode .toggle-slider {
    background-color: #cbd5e1 !important;
    border: 1px solid #94a3b8 !important;
}

html.light-mode .toggle-switch input:checked + .toggle-slider {
    background-color: #ff1835 !important;
    border-color: #ff1835 !important;
}

html.light-mode .user-table th {
    background: #f1f5f9 !important;
    color: #334155 !important;
    border-bottom: 1px solid #cbd5e1 !important;
}

html.light-mode .user-table td {
    border-bottom: 1px solid #f1f5f9 !important;
    color: #0f172a !important;
}

/* Event Alerts Box & Text Badges (High Contrast Dark/Light Mode) */
.event-pill-box {
    display: flex;
    gap: 10px;
    align-items: center;
    background: var(--surface);
    padding: 6px 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    flex-wrap: wrap;
}

.pill-text-success { color: #34d399; font-weight: 700; }
.pill-text-failure { color: #ff6377; font-weight: 700; }
.pill-text-security { color: #facc15; font-weight: 700; }
.pill-text-digest { color: #65b5fa; font-weight: 700; }

.role-badge {
    background: #2a2d35;
    color: #a9afba;
    font-size: 10px;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 6px;
}

.btn-remove-custom {
    background: #4b2029;
    border: 1px solid #722330;
    color: #ff6377;
    height: 40px;
    padding: 0 14px;
    border-radius: 8px;
    cursor: pointer;
    transition: all .2s ease;
}

html.light-mode .event-pill-box {
    background: #ffffff !important;
    border: 1px solid #cbd5e1 !important;
}

html.light-mode .pill-text-success { color: #047857 !important; }
html.light-mode .pill-text-failure { color: #dc2626 !important; }
html.light-mode .pill-text-security { color: #b45309 !important; }
html.light-mode .pill-text-digest { color: #1d4ed8 !important; }

html.light-mode .role-badge {
    background: #e2e8f0 !important;
    color: #334155 !important;
}

html.light-mode .btn-remove-custom {
    background: #fef2f2 !important;
    border: 1px solid #fca5a5 !important;
    color: #dc2626 !important;
}

html.light-mode .btn-remove-custom:hover {
    background: #fee2e2 !important;
    border-color: #f87171 !important;
}

/* --- Layout Shell --- */
.admin-body {
    min-height: 100vh;
    background: var(--bg);
}

.admin-shell {
    min-height: 100vh;
    display: flex;
}

/* --- Sidebar (Compact Width: 220px) --- */
.sidebar {
    position: fixed;
    z-index: 30;
    inset: 0 auto 0 0;
    width: 220px;
    display: flex;
    flex-direction: column;
    padding: 18px 12px 14px;
    background: #131419;
    border-right: 1px solid var(--line);
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: var(--line) transparent;
    transition: transform .25s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Hide Sidebar Close Icon on Desktop by Default */
.sidebar-close {
    display: none !important;
}

.sidebar::-webkit-scrollbar {
    width: 4px;
}

.sidebar::-webkit-scrollbar-thumb {
    background: var(--line);
    border-radius: 4px;
}

.brand {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 10px;
    font-size: 18px;
    font-weight: 800;
    letter-spacing: -.6px;
    width: 100%;
    margin-bottom: 4px;
}

.brand img {
    max-width: 100%;
    height: auto;
    max-height: 40px;
    object-fit: contain;
}

.brand>span:last-child>span {
    color: var(--accent);
}

.brand-mark {
    width: 32px;
    height: 32px;
    border-radius: 9px;
    display: grid;
    place-items: center;
    background: linear-gradient(135deg, #ff2a4b, #e60021);
    color: white;
    font-weight: 900;
    font-size: 14px;
    box-shadow: 0 6px 18px rgba(255, 24, 53, 0.35);
    flex-shrink: 0;
}

.sidebar-label {
    margin: 16px 10px 8px;
    color: #666d7c;
    font-size: 9px;
    font-weight: 800;
    letter-spacing: 1.2px;
}

.sidebar-label-bottom {
    margin-top: 20px;
}

.sidebar-nav {
    display: grid;
    gap: 3px;
}

.sidebar-nav a {
    position: relative;
    min-height: 38px;
    padding: 0 12px;
    display: flex;
    align-items: center;
    gap: 10px;
    border-radius: 8px;
    color: #aeb4c2;
    font-size: 13px;
    font-weight: 600;
    transition: all .2s cubic-bezier(0.4, 0, 0.2, 1);
}

.sidebar-nav a:hover {
    color: white;
    background: rgba(255, 255, 255, 0.05);
    transform: translateX(2px);
}

.sidebar-nav a.active {
    color: #ff1835 !important;
    background: #000000 !important;
    border-radius: 0 22px 22px 0 !important;
    font-weight: 700 !important;
    box-shadow: none !important;
    border: none !important;
}

.sidebar-nav a.active svg {
    stroke: #ff1835 !important;
}

.sidebar-nav a.active:before {
    content: "";
    position: absolute;
    left: -12px;
    top: 0;
    bottom: 0;
    width: 4px;
    background: #ff1835;
    border-radius: 0 4px 4px 0;
    box-shadow: none !important;
}

.sidebar-nav svg {
    width: 17px;
    height: 17px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
    transition: transform .2s ease;
}

.sidebar-nav a:hover svg {
    transform: scale(1.08);
}

.menu-count {
    margin-left: auto;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    display: grid;
    place-items: center;
    border-radius: 9px;
    background: #2b2e37;
    color: #aeb4c2;
    font-size: 10px;
    font-weight: 700;
}

/* Sidebar Dropdown & Submenu Reset */
.sidebar-dropdown {
    display: flex;
    flex-direction: column;
    width: 100%;
}

.sidebar-dropdown-toggle {
    background: transparent !important;
    border: none !important;
    outline: none !important;
    box-shadow: none !important;
    -webkit-appearance: none !important;
    appearance: none !important;
    position: relative;
    min-height: 38px;
    padding: 0 12px;
    display: flex;
    align-items: center;
    gap: 10px;
    border-radius: 8px;
    color: #aeb4c2 !important;
    font-family: inherit;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    width: 100%;
    text-align: left;
    transition: all .2s cubic-bezier(0.4, 0, 0.2, 1);
    box-sizing: border-box;
}

.sidebar-dropdown-toggle:hover {
    color: #ffffff !important;
    background: rgba(255, 255, 255, 0.05) !important;
    transform: translateX(2px);
}

.sidebar-dropdown.active .sidebar-dropdown-toggle {
    color: #ff1835 !important;
    font-weight: 700 !important;
    background: rgba(255, 24, 53, 0.12) !important;
    border-radius: 8px !important;
}

.sidebar-dropdown.active .sidebar-dropdown-toggle svg {
    stroke: #ff1835 !important;
}

.sidebar-dropdown-chevron {
    margin-left: auto;
    width: 14px;
    height: 14px;
    transition: transform .2s ease;
    flex-shrink: 0;
}

.sidebar-dropdown.open .sidebar-dropdown-chevron {
    transform: rotate(180deg);
}

.sidebar-submenu {
    display: none;
    flex-direction: column;
    gap: 3px;
    padding-left: 0;
    margin-top: 3px;
    margin-bottom: 5px;
}

.sidebar-dropdown.open .sidebar-submenu {
    display: flex;
}

.sidebar-submenu a {
    min-height: 32px;
    padding: 0 12px 0 39px !important;
    font-size: 12px;
    font-weight: 500;
    color: #8a90a0 !important;
    border-radius: 6px !important;
    display: flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
    transition: all .2s ease;
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
}

.sidebar-submenu a:before {
    display: none !important;
}

.sidebar-submenu a:hover {
    color: #ffffff !important;
    background: rgba(255, 255, 255, 0.05) !important;
}

.sidebar-submenu a.active {
    color: #ff1835 !important;
    background: rgba(255, 24, 53, 0.12) !important;
    font-weight: 700 !important;
    border-radius: 6px !important;
}

/* Sidebar User Profile Card */
.sidebar-user {
    margin-top: auto;
    padding: 10px 12px;
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 10px;
    transition: all .2s ease;
    text-decoration: none;
}

.sidebar-user:hover {
    background: var(--surface-2);
    border-color: #505665;
}

.sidebar-user strong {
    display: block;
    font-size: 12px;
    font-weight: 700;
    color: #ffffff;
}

.sidebar-user span {
    display: flex;
    align-items: center;
    gap: 5px;
    color: var(--muted);
    font-size: 10px;
    margin-top: 1px;
}

/* --- Topbar (Compact Height: 60px) --- */
.admin-main {
    width: calc(100% - 220px);
    min-height: 100vh;
    margin-left: 220px;
    display: flex;
    flex-direction: column;
    transition: margin-left .25s ease, width .25s ease;
}

.topbar {
    min-height: 60px;
    padding: 0 28px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--line);
    background: rgba(17, 18, 23, 0.85);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    position: sticky;
    top: 0;
    z-index: 25;
}

.eyebrow {
    margin: 0 0 2px;
    color: var(--accent);
    font-size: 9px;
    font-weight: 800;
    letter-spacing: 1.3px;
    display: flex;
    align-items: center;
    gap: 5px;
}

.topbar h1 {
    font-size: 17px;
    margin: 0;
    letter-spacing: -.5px;
    font-weight: 800;
}

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

.icon-button {
    height: 34px;
    width: 34px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface);
    color: var(--muted);
    cursor: pointer;
    font-size: 15px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all .2s ease;
}

.icon-button svg {
    width: 16px;
    height: 16px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
    flex-shrink: 0;
}

.icon-button:hover {
    color: white;
    border-color: #505665;
    background: var(--surface-2);
}

.header-profile {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 3px 12px 3px 3px;
    border-radius: 24px;
    background: var(--surface);
    border: 1px solid var(--line);
    transition: all .2s ease;
    text-decoration: none;
}

.header-profile:hover {
    border-color: #505665;
    background: var(--surface-2);
}

.avatar {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    background: linear-gradient(135deg, #fe4960, #b80b23);
    color: white;
    font-size: 12px;
    font-weight: 800;
    overflow: hidden;
    position: relative;
    flex-shrink: 0;
}

.avatar-sm {
    width: 28px;
    height: 28px;
    font-size: 11px;
}

/* Status Dot */
.status-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #10b981;
    box-shadow: 0 0 6px #10b981;
    display: inline-block;
    flex-shrink: 0;
}

/* --- Content Area --- */
.content-area {
    padding: 24px 28px 30px;
    max-width: 1480px;
    margin: 0 auto;
    width: 100%;
    flex: 1;
}

.welcome-row,
.panel-heading {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

.welcome-row {
    margin-bottom: 22px;
}

.welcome-row h2 {
    font-size: 21px;
    letter-spacing: -.6px;
    margin: 0 0 4px;
    font-weight: 800;
}

.welcome-row p,
.page-intro p,
.panel-heading p {
    margin: 0;
    color: var(--muted);
    font-size: 12px;
}

.button {
    min-height: 36px;
    padding: 0 15px;
    border-radius: 8px;
    border: 1px solid transparent;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-size: 12px;
    font-weight: 750;
    cursor: pointer;
    transition: all .2s ease;
    text-decoration: none;
}

.button-primary {
    background: var(--accent);
    color: white;
    box-shadow: 0 6px 16px rgba(255, 24, 53, 0.25);
}

.button-primary:hover {
    background: #e60d28;
    transform: translateY(-1px);
    box-shadow: 0 8px 18px rgba(255, 24, 53, 0.35);
}

.button-secondary {
    background: var(--surface-2);
    border-color: #363a46;
    color: #eef0f5;
}

.button-secondary:hover {
    background: #2c303b;
    color: white;
}

/* Metric Grid & Cards */
.metric-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 20px;
}

.metric-card,
.panel {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 12px;
    transition: transform .2s ease, border-color .2s ease;
}

.metric-card:hover,
.panel:hover {
    border-color: #3c4252;
}

.metric-card {
    padding: 16px;
    display: flex;
    align-items: flex-start;
    gap: 12px;
}

.metric-icon {
    width: 44px;
    height: 44px;
    display: grid;
    place-items: center;
    border-radius: 10px;
    flex-shrink: 0;
    transition: transform .2s cubic-bezier(0.4, 0, 0.2, 1);
}

.metric-card:hover .metric-icon {
    transform: scale(1.08) rotate(3deg);
}

.metric-icon.violet {
    background: rgba(179, 140, 255, 0.14);
    color: #b38cff;
}

.metric-icon.blue {
    background: rgba(101, 181, 250, 0.14);
    color: #65b5fa;
}

.metric-icon.green {
    background: rgba(52, 211, 153, 0.14);
    color: #34d399;
}

.metric-icon.red {
    background: rgba(255, 99, 119, 0.14);
    color: #ff6377;
}

.metric-icon.amber {
    background: rgba(255, 196, 83, 0.14);
    color: #ffc453;
}

.metric-card span {
    display: block;
    color: var(--muted);
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.5px;
}

.metric-card strong {
    display: block;
    margin: 3px 0 1px;
    font-size: 22px;
    letter-spacing: -.8px;
    font-weight: 800;
}

.metric-card small {
    display: block;
    color: var(--muted);
    font-size: 10px;
}

.dashboard-grid {
    display: grid;
    grid-template-columns: 1.45fr 1fr;
    gap: 16px;
}

.panel {
    padding: 20px;
}

.panel-heading h3 {
    font-size: 15px;
    font-weight: 700;
    margin: 0 0 3px;
}

.panel-heading a {
    color: var(--accent);
    font-size: 11px;
    font-weight: 700;
}

/* Table Wrappers */
.user-table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.user-table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
}

.user-table th {
    padding: 10px 12px;
    color: var(--muted);
    font-size: 10px;
    font-weight: 700;
    letter-spacing: .8px;
    text-transform: uppercase;
    border-bottom: 1px solid var(--line);
}

.user-table td {
    padding: 11px 12px;
    border-bottom: 1px solid var(--line);
    color: var(--text);
    font-size: 12px;
    vertical-align: middle;
}

.user-table tbody tr:hover {
    background: rgba(255, 255, 255, 0.02);
}

.status-pill {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 10px;
    background: #2a2d35;
    color: #a9afba;
    font-size: 10px;
    font-weight: 700;
}

.status-good {
    background: #173b2b;
    color: #88daa7;
}

/* Settings Layout Grid & Navigation Card (Matching License-Pro Design) */
.settings-layout {
    display: grid;
    grid-template-columns: 260px 1fr;
    gap: 24px;
    align-items: start;
}

.settings-nav-card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: 16px;
    display: grid;
    gap: 8px;
}

.settings-nav-item {
    height: 44px;
    padding: 0 16px;
    display: flex;
    align-items: center;
    border-radius: 10px;
    border: 1px solid #2c303b;
    background: #191b22;
    color: #f7f8fb;
    font-size: 13px;
    font-weight: 700;
    transition: all .2s ease;
    text-decoration: none;
}

.settings-nav-item:hover {
    background: #20232c;
    border-color: #3c4252;
    color: white;
}

.settings-nav-item.active {
    background: linear-gradient(135deg, #ff1835, #e60021) !important;
    color: #ffffff !important;
    border-color: transparent !important;
    box-shadow: 0 8px 22px rgba(255, 24, 53, 0.35) !important;
    font-weight: 800 !important;
}

.settings-content-card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: 28px;
}

.settings-content-header {
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--line);
}

.settings-content-header h3 {
    font-size: 18px;
    font-weight: 700;
    margin: 0;
    letter-spacing: -.4px;
}

@media (max-width: 900px) {
    .settings-layout {
        grid-template-columns: 1fr !important;
    }
}

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

.field {
    display: grid;
    gap: 6px;
    color: #d6d9e0;
    font-size: 12px;
    font-weight: 650;
}

.field input,
.field select,
.auth-input {
    width: 100%;
    height: 40px;
    padding: 0 12px;
    border: 1px solid #363a45;
    border-radius: 8px;
    background: #13151b;
    color: #f6f7fb;
    font-size: 13px;
    transition: border-color .2s ease, box-shadow .2s ease;
}

.field input:focus,
.field select:focus,
.auth-input:focus {
    border-color: #e21b34;
    box-shadow: 0 0 0 3px rgba(255, 24, 53, 0.15);
}

.full-width {
    grid-column: 1 / -1;
}

.form-actions {
    margin-top: 20px;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

.alert-success {
    max-width: 1000px;
    margin: 0 0 16px;
    padding: 12px 16px;
    border: 1px solid #287450;
    border-radius: 8px;
    background: #163526;
    color: #a6e8bf;
    font-size: 13px;
    margin-left: auto;
    margin-right: auto;
}

.profile-grid {
    display: grid;
    grid-template-columns: 1.35fr 1fr;
    gap: 16px;
    max-width: 1100px;
    margin-left: auto;
    margin-right: auto;
}

/* --- App Footer (Ultra Compact: 32px height) --- */
.app-footer {
    width: 100%;
    padding: 6px 28px;
    min-height: 32px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-top: 1px solid var(--line);
    background: var(--surface);
    color: var(--muted);
    font-size: 11px;
    font-weight: 500;
    margin-top: auto;
}

.app-footer a {
    color: var(--accent);
    font-weight: 700;
}

.app-footer a:hover {
    text-decoration: underline;
}

/* --- Auth Forms & Pages --- */
.auth-body {
    min-height: 100vh;
    background: #090a0f;
    margin: 0;
}

.auth-card {
    background: #191b22;
    border: 1px solid var(--line);
    border-radius: 17px;
    padding: 38px 36px;
    box-shadow: 0 20px 70px rgba(0, 0, 0, 0.5);
    width: min(100%, 440px);
    position: relative;
    z-index: 10;
}

.auth-card-heading {
    margin-bottom: 24px;
}

.auth-card-heading h2 {
    font-size: 22px;
    font-weight: 800;
    margin: 0 0 6px;
    letter-spacing: -.5px;
}

.auth-card-heading p {
    margin: 0;
    color: var(--muted);
    font-size: 13px;
}

.auth-form {
    display: grid;
    gap: 16px;
}

.auth-input {
    width: 100%;
    height: 44px;
    padding: 0 14px;
    border: 1px solid #363a45;
    border-radius: 10px;
    background: #13151b;
    color: #f6f7fb;
    font-size: 14px;
    transition: border-color .2s ease, box-shadow .2s ease;
}

.auth-input:focus {
    border-color: #e21b34;
    box-shadow: 0 0 0 3px rgba(255, 24, 53, 0.15);
}

.auth-submit {
    width: 100%;
    min-height: 44px;
    font-size: 14px;
    border-radius: 10px;
    margin-top: 6px;
}

/* --- Smooth Eye-Friendly Light Mode Overrides --- */
.light-mode {
    --bg: #f4f6f9;
    --surface: #ffffff;
    --surface-2: #f1f5f9;
    --line: #e2e8f0;
    --text: #1e293b;
    --muted: #64748b;
    --accent: #ff1835;
    --accent-soft: rgba(255, 24, 53, 0.08);
}

.light-mode body {
    background: #f4f6f9 !important;
    color: #1e293b !important;
}

.light-mode .sidebar {
    background: #ffffff !important;
    border-right: 1px solid #e2e8f0 !important;
    box-shadow: none !important;
}

.light-mode .brand-logo-dark {
    display: none !important;
}

.light-mode .brand-logo-light {
    display: inline-block !important;
}

.light-mode .sidebar-label {
    color: #94a3b8 !important;
}

.light-mode .sidebar-nav a {
    color: #475569 !important;
}

.light-mode .sidebar-nav a:hover {
    color: #0f172a !important;
    background: #f1f5f9 !important;
}

.light-mode .sidebar-nav a.active {
    color: #ff1835 !important;
    background: rgba(255, 24, 53, 0.08) !important;
    border-radius: 0 22px 22px 0 !important;
    box-shadow: none !important;
    border: none !important;
}

.light-mode .sidebar-nav a.active svg {
    stroke: var(--accent) !important;
}

.light-mode .sidebar-dropdown-toggle {
    color: #475569 !important;
}

.light-mode .sidebar-dropdown-toggle:hover {
    color: #0f172a !important;
    background: #f1f5f9 !important;
}

.light-mode .sidebar-dropdown.active .sidebar-dropdown-toggle {
    color: #ff1835 !important;
    font-weight: 700 !important;
    background: rgba(255, 24, 53, 0.08) !important;
    border-radius: 8px !important;
}

.light-mode .sidebar-dropdown.active .sidebar-dropdown-toggle svg {
    stroke: #ff1835 !important;
}

.light-mode .sidebar-submenu a {
    color: #64748b !important;
}

.light-mode .sidebar-submenu a:hover {
    color: #0f172a !important;
    background: #f1f5f9 !important;
}

.light-mode .sidebar-submenu a.active {
    color: #ff1835 !important;
    background: rgba(255, 24, 53, 0.12) !important;
    font-weight: 700 !important;
}

.light-mode .sidebar-user {
    background: #ffffff !important;
    border-color: #e2e8f0 !important;
}

.light-mode .sidebar-user strong {
    color: #0f172a !important;
}

.light-mode .topbar {
    background: rgba(255, 255, 255, 0.95) !important;
    border-bottom: 1px solid #e2e8f0 !important;
    box-shadow: none !important;
}

.light-mode .icon-button {
    background: #ffffff !important;
    border-color: #cbd5e1 !important;
    color: #475569 !important;
    box-shadow: none !important;
}

.light-mode .icon-button:hover {
    background: #f1f5f9 !important;
    color: #0f172a !important;
    border-color: #94a3b8 !important;
}

.light-mode .header-profile {
    background: #ffffff !important;
    border-color: #e2e8f0 !important;
    box-shadow: none !important;
}

.light-mode .field label {
    color: #334155 !important;
}

.light-mode .field input,
.light-mode .field select,
.light-mode .auth-input {
    background: #ffffff !important;
    color: #0f172a !important;
    border: 1px solid #cbd5e1 !important;
    box-shadow: none !important;
}

.light-mode .field input:focus,
.light-mode .field select:focus,
.light-mode .auth-input:focus {
    border-color: var(--accent) !important;
    box-shadow: none !important;
}

.light-mode .metric-card,
.light-mode .panel {
    background: #ffffff !important;
    border-color: #e2e8f0 !important;
    box-shadow: none !important;
}

.light-mode .metric-icon.blue {
    background: #e0f2fe !important;
    color: #0284c7 !important;
}

.light-mode .metric-icon.violet {
    background: #f3e8ff !important;
    color: #9333ea !important;
}

.light-mode .metric-icon.green {
    background: #d1fae5 !important;
    color: #059669 !important;
}

.light-mode .metric-icon.amber {
    background: #fef3c7 !important;
    color: #d97706 !important;
}

.light-mode .metric-card:hover,
.light-mode .panel:hover {
    border-color: #cbd5e1 !important;
}

.light-mode .user-table th {
    color: #64748b !important;
    border-bottom: 1px solid #e2e8f0 !important;
    background: #f8fafc !important;
}

.light-mode .user-table td {
    color: #0f172a !important;
    border-bottom: 1px solid #f1f5f9 !important;
}

.light-mode .user-table tbody tr:hover {
    background: #f8fafc !important;
}

.light-mode .status-pill {
    background: #f1f5f9 !important;
    color: #475569 !important;
}

.light-mode .status-good {
    background: #d1fae5 !important;
    color: #065f46 !important;
}

.light-mode .button-secondary {
    color: #0f172a !important;
    border-color: #cbd5e1 !important;
    background: #ffffff !important;
    box-shadow: none !important;
}

.light-mode .button-secondary:hover {
    background: #f1f5f9 !important;
    border-color: #94a3b8 !important;
}

.light-mode .app-footer {
    background: #ffffff !important;
    border-top: 1px solid #e2e8f0 !important;
    color: #64748b !important;
}

.light-mode .settings-nav-card {
    background: #ffffff !important;
    border-color: #e2e8f0 !important;
    box-shadow: none !important;
}

.light-mode .settings-nav-item {
    background: #f8fafc !important;
    border-color: #e2e8f0 !important;
    color: #334155 !important;
}

.light-mode .settings-nav-item:hover {
    background: #f1f5f9 !important;
    border-color: #cbd5e1 !important;
    color: #0f172a !important;
}

.light-mode .settings-nav-item.active {
    background: #ff1835 !important;
    color: #ffffff !important;
    border-color: transparent !important;
    box-shadow: none !important;
}

.light-mode .settings-content-card {
    background: #ffffff !important;
    border-color: #e2e8f0 !important;
    box-shadow: none !important;
}

.light-mode .settings-content-header {
    border-bottom-color: #e2e8f0 !important;
}

.light-mode .settings-content-header h3 {
    color: #0f172a !important;
}

.light-mode .alert-success {
    background: #ecfdf5 !important;
    border-color: #a7f3d0 !important;
    color: #065f46 !important;
    box-shadow: none !important;
}

/* Global Shadow Removal Override */
*, *:before, *:after {
    box-shadow: none !important;
}

.user-table-wrap {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

/* --- Responsive Layout Enhancements --- */
@media (max-width: 1050px) {
    .metric-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .dashboard-grid,
    .profile-grid {
        grid-template-columns: 1fr !important;
    }

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

@media (max-width: 720px) {
    .sidebar {
        transform: translateX(-100%);
        transition: transform .25s ease;
        width: 250px !important;
    }

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

    .sidebar-close {
        display: inline-flex !important;
        position: absolute;
        right: 16px;
        top: 18px;
        z-index: 40;
    }

    .page-overlay {
        display: none;
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, 0.6);
        backdrop-filter: blur(2px);
        z-index: 20;
    }

    .sidebar.is-open~.page-overlay {
        display: block;
    }

    .admin-main {
        width: 100%;
        margin-left: 0;
    }

    .topbar {
        padding: 0 16px;
        min-height: 56px;
    }

    .content-area {
        padding: 18px 16px;
    }

    .app-footer {
        padding: 8px 16px;
        flex-direction: column;
        gap: 4px;
        text-align: center;
    }

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

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

@media (min-width: 721px) {
    .sidebar-collapsed .sidebar {
        width: 70px !important;
        padding: 18px 8px 14px !important;
    }

    .sidebar-collapsed .admin-main {
        margin-left: 70px !important;
        width: calc(100% - 70px) !important;
    }

    .sidebar-collapsed .sidebar-label,
    .sidebar-collapsed .sidebar-user strong,
    .sidebar-collapsed .sidebar-user span,
    .sidebar-collapsed .brand span,
    .sidebar-collapsed .sidebar-nav a span,
    .sidebar-collapsed .menu-count {
        display: none !important;
    }

    .sidebar-collapsed .sidebar-nav a {
        justify-content: center !important;
        padding: 0 !important;
    }
}

/* Sidebar Brand Logo Theme Toggling */
.brand-logo-dark {
    display: block !important;
    max-height: 38px;
    object-fit: contain;
}
.brand-logo-light {
    display: none !important;
    max-height: 38px;
    object-fit: contain;
}

html.light-mode .brand-logo-dark,
body.light-mode .brand-logo-dark {
    display: none !important;
}
html.light-mode .brand-logo-light,
body.light-mode .brand-logo-light {
    display: block !important;
}

/* Button Ghost Style */
.button-ghost {
    background: transparent;
    border-color: transparent;
    color: var(--muted);
}
.button-ghost:hover {
    background: rgba(255, 255, 255, 0.06);
    color: var(--text);
}

/* Action Buttons Group & Component Styles */
.action-buttons-group {
    display: inline-flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
}

.btn-action {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    height: 32px;
    padding: 0 13px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.2px;
    border-radius: 7px;
    border: 1px solid transparent;
    cursor: pointer;
    transition: all 0.22s cubic-bezier(0.4, 0, 0.2, 1);
    text-decoration: none;
    line-height: 1;
    white-space: nowrap;
}

.btn-action svg {
    flex-shrink: 0;
    transition: transform 0.2s ease;
}

.btn-action:hover svg {
    transform: scale(1.15);
}

/* Unified Global Action Button System */
.btn-conn-action {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    height: 32px;
    padding: 0 13px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.2px;
    border-radius: 6px;
    border: 1px solid transparent;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.22s cubic-bezier(0.4, 0, 0.2, 1);
    line-height: 1;
    white-space: nowrap;
}

.btn-conn-action svg {
    flex-shrink: 0;
    transition: transform 0.2s ease;
}

.btn-conn-action:hover svg {
    transform: scale(1.14);
}

/* === DARK MODE DEFAULT STYLES === */
.btn-conn-backup, .btn-conn-primary {
    background: rgba(255, 24, 53, 0.16);
    color: #ff475d;
    border: 1px solid rgba(255, 24, 53, 0.35);
}
.btn-conn-backup:hover, .btn-conn-primary:hover {
    background: linear-gradient(135deg, #ff1835 0%, #d90429 100%) !important;
    color: #ffffff !important;
    border-color: #ff1835 !important;
    box-shadow: 0 4px 14px rgba(255, 24, 53, 0.45) !important;
    transform: translateY(-2px);
}

.btn-conn-test, .btn-conn-download, .btn-conn-info {
    background: rgba(14, 165, 233, 0.16);
    color: #38bdf8;
    border: 1px solid rgba(14, 165, 233, 0.35);
}
.btn-conn-test:hover, .btn-conn-download:hover, .btn-conn-info:hover {
    background: linear-gradient(135deg, #0ea5e9 0%, #0284c7 100%) !important;
    color: #ffffff !important;
    border-color: #0ea5e9 !important;
    box-shadow: 0 4px 14px rgba(14, 165, 233, 0.45) !important;
    transform: translateY(-2px);
}

.btn-conn-edit, .btn-conn-activate, .btn-conn-success {
    background: rgba(16, 185, 129, 0.16);
    color: #34d399;
    border: 1px solid rgba(16, 185, 129, 0.35);
}
.btn-conn-edit:hover, .btn-conn-activate:hover, .btn-conn-success:hover {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%) !important;
    color: #ffffff !important;
    border-color: #10b981 !important;
    box-shadow: 0 4px 14px rgba(16, 185, 129, 0.45) !important;
    transform: translateY(-2px);
}

.btn-conn-warning, .btn-conn-pause, .btn-conn-suspend {
    background: rgba(245, 158, 11, 0.16);
    color: #fbbf24;
    border: 1px solid rgba(245, 158, 11, 0.35);
}
.btn-conn-warning:hover, .btn-conn-pause:hover, .btn-conn-suspend:hover {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%) !important;
    color: #ffffff !important;
    border-color: #f59e0b !important;
    box-shadow: 0 4px 14px rgba(245, 158, 11, 0.45) !important;
    transform: translateY(-2px);
}

.btn-conn-delete, .btn-conn-danger {
    background: rgba(244, 63, 94, 0.16);
    color: #fb7185;
    border: 1px solid rgba(244, 63, 94, 0.35);
}
.btn-conn-delete:hover, .btn-conn-danger:hover {
    background: linear-gradient(135deg, #f43f5e 0%, #be123c 100%) !important;
    color: #ffffff !important;
    border-color: #f43f5e !important;
    box-shadow: 0 4px 14px rgba(244, 63, 94, 0.45) !important;
    transform: translateY(-2px);
}

.btn-conn-secondary {
    background: rgba(255, 255, 255, 0.06);
    color: #94a3b8;
    border: 1px solid var(--line);
}
.btn-conn-secondary:hover {
    background: rgba(255, 255, 255, 0.14) !important;
    color: #ffffff !important;
    border-color: #475569 !important;
    transform: translateY(-2px);
}

/* === LIGHT MODE ADAPTIVE STYLES === */
html.light-mode .btn-conn-backup, html.light-mode .btn-conn-primary,
body.light-mode .btn-conn-backup, body.light-mode .btn-conn-primary {
    background: #ffeef0 !important;
    color: #d90429 !important;
    border: 1px solid #fecdd3 !important;
}
html.light-mode .btn-conn-backup:hover, html.light-mode .btn-conn-primary:hover,
body.light-mode .btn-conn-backup:hover, body.light-mode .btn-conn-primary:hover {
    background: #e60021 !important;
    color: #ffffff !important;
    border-color: #e60021 !important;
}

html.light-mode .btn-conn-test, html.light-mode .btn-conn-download, html.light-mode .btn-conn-info,
body.light-mode .btn-conn-test, body.light-mode .btn-conn-download, body.light-mode .btn-conn-info {
    background: #f0f9ff !important;
    color: #0284c7 !important;
    border: 1px solid #bae6fd !important;
}
html.light-mode .btn-conn-test:hover, html.light-mode .btn-conn-download:hover, html.light-mode .btn-conn-info:hover,
body.light-mode .btn-conn-test:hover, body.light-mode .btn-conn-download:hover, body.light-mode .btn-conn-info:hover {
    background: #0284c7 !important;
    color: #ffffff !important;
    border-color: #0284c7 !important;
}

html.light-mode .btn-conn-edit, html.light-mode .btn-conn-activate, html.light-mode .btn-conn-success,
body.light-mode .btn-conn-edit, body.light-mode .btn-conn-activate, body.light-mode .btn-conn-success {
    background: #ecfdf5 !important;
    color: #059669 !important;
    border: 1px solid #a7f3d0 !important;
}
html.light-mode .btn-conn-edit:hover, html.light-mode .btn-conn-activate:hover, html.light-mode .btn-conn-success:hover,
body.light-mode .btn-conn-edit:hover, body.light-mode .btn-conn-activate:hover, body.light-mode .btn-conn-success:hover {
    background: #059669 !important;
    color: #ffffff !important;
    border-color: #059669 !important;
}

html.light-mode .btn-conn-warning, html.light-mode .btn-conn-pause, html.light-mode .btn-conn-suspend,
body.light-mode .btn-conn-warning, body.light-mode .btn-conn-pause, body.light-mode .btn-conn-suspend {
    background: #fffbe6 !important;
    color: #d97706 !important;
    border: 1px solid #fde68a !important;
}
html.light-mode .btn-conn-warning:hover, html.light-mode .btn-conn-pause:hover, html.light-mode .btn-conn-suspend:hover,
body.light-mode .btn-conn-warning:hover, body.light-mode .btn-conn-pause:hover, body.light-mode .btn-conn-suspend:hover {
    background: #d97706 !important;
    color: #ffffff !important;
    border-color: #d97706 !important;
}

html.light-mode .btn-conn-delete, html.light-mode .btn-conn-danger,
body.light-mode .btn-conn-delete, body.light-mode .btn-conn-danger {
    background: #fff1f2 !important;
    color: #e11d48 !important;
    border: 1px solid #fecdd3 !important;
}
html.light-mode .btn-conn-delete:hover, html.light-mode .btn-conn-danger:hover,
body.light-mode .btn-conn-delete:hover, body.light-mode .btn-conn-danger:hover {
    background: #e11d48 !important;
    color: #ffffff !important;
    border-color: #e11d48 !important;
}

html.light-mode .btn-conn-secondary,
body.light-mode .btn-conn-secondary {
    background: #f8fafc !important;
    color: #475569 !important;
    border: 1px solid #cbd5e1 !important;
}
html.light-mode .btn-conn-secondary:hover,
body.light-mode .btn-conn-secondary:hover {
    background: #e2e8f0 !important;
    color: #0f172a !important;
    border-color: #94a3b8 !important;
}

/* Backups Filter Panel Bar Styles */
.backup-filter-card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 14px 18px;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
}

.backup-filter-form {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    flex: 1;
}

.filter-input-wrap {
    position: relative;
    min-width: 200px;
    flex: 1;
    max-width: 300px;
}

.filter-input-wrap input {
    height: 36px;
    padding: 0 12px 0 34px;
    font-size: 12px;
    border-radius: 8px;
    border: 1px solid var(--line);
    background: var(--surface-2);
    color: var(--text);
    width: 100%;
}

.filter-input-wrap svg {
    position: absolute;
    left: 11px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--muted);
    pointer-events: none;
}

.filter-select {
    height: 36px;
    padding: 0 12px;
    font-size: 12px;
    border-radius: 8px;
    border: 1px solid var(--line);
    background: var(--surface-2);
    color: var(--text);
    outline: none;
    cursor: pointer;
}

.backup-trigger-box {
    display: flex;
    align-items: center;
    gap: 10px;
    padding-left: 16px;
    border-left: 1px dashed var(--line);
    flex-wrap: wrap;
}

.light-mode .backup-filter-card {
    background: #ffffff !important;
    border-color: #e2e8f0 !important;
}

.light-mode .filter-input-wrap input,
.light-mode .filter-select {
    background: #f8fafc !important;
    border-color: #cbd5e1 !important;
    color: #0f172a !important;
}

/* --- Pagination & Next/Previous Page Styling --- */
.pagination-row,
.pagination-wrapper {
    margin-top: 16px;
    padding: 14px 16px;
    border-top: 1px solid var(--line);
    background: var(--surface);
    border-bottom-left-radius: 12px;
    border-bottom-right-radius: 12px;
}

.pagination-container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
    width: 100%;
}

.pagination-info {
    font-size: 13px;
    color: var(--muted);
}

.pagination-summary {
    margin: 0;
    font-weight: 500;
}

.pagination-num {
    font-weight: 700;
    color: var(--text);
}

.pagination-nav {
    display: flex;
    align-items: center;
    gap: 6px;
    list-style: none;
    margin: 0;
    padding: 0;
}

.pagination-item {
    display: inline-flex;
}

.pagination-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-width: 36px;
    height: 36px;
    padding: 0 12px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
    background: var(--surface-2);
    border: 1px solid var(--line);
    border-radius: 8px;
    text-decoration: none;
    transition: all 0.2s ease;
    user-select: none;
}

.pagination-link svg {
    width: 16px !important;
    height: 16px !important;
    max-width: 16px !important;
    max-height: 16px !important;
    flex-shrink: 0;
    stroke: currentColor;
    display: inline-block;
    vertical-align: middle;
}

.pagination-item:not(.active):not(.disabled) .pagination-link:hover {
    background: var(--accent-soft);
    border-color: var(--accent);
    color: var(--accent);
    transform: translateY(-1px);
}

.pagination-item.active .pagination-link {
    background: var(--accent);
    border-color: var(--accent);
    color: #ffffff;
    box-shadow: 0 4px 12px var(--accent-glow);
}

.pagination-item.disabled .pagination-link {
    opacity: 0.45;
    cursor: not-allowed;
    background: var(--surface-2);
    border-color: var(--line);
    color: var(--muted);
    pointer-events: none;
}

.pagination-link.ellipsis {
    border: none;
    background: transparent;
    min-width: 24px;
    padding: 0 4px;
    color: var(--muted);
}

/* Generic Fallback for nav[role="navigation"] SVG sizing */
nav[role="navigation"] svg {
    width: 16px !important;
    height: 16px !important;
    max-width: 16px !important;
    max-height: 16px !important;
}

/* Light Mode Overrides for Pagination */
html.light-mode .pagination-row,
html.light-mode .pagination-wrapper {
    background: #ffffff;
    border-color: #cbd5e1;
}

html.light-mode .pagination-info {
    color: #475569;
}

html.light-mode .pagination-num {
    color: #0f172a;
}

html.light-mode .pagination-link {
    background: #f8fafc;
    border-color: #cbd5e1;
    color: #1e293b;
}

html.light-mode .pagination-item:not(.active):not(.disabled) .pagination-link:hover {
    background: #fef2f2;
    border-color: #ff1835;
    color: #ff1835;
}

html.light-mode .pagination-item.active .pagination-link {
    background: #ff1835;
    border-color: #ff1835;
    color: #ffffff;
}

html.light-mode .pagination-item.disabled .pagination-link {
    background: #f1f5f9;
    border-color: #e2e8f0;
    color: #94a3b8;
}

/* Mobile Responsiveness for Pagination */
@media (max-width: 640px) {
    .pagination-container {
        flex-direction: column;
        align-items: center;
        text-align: center;
        gap: 12px;
    }
    .pagination-nav {
        flex-wrap: wrap;
        justify-content: center;
    }
    .pagination-link {
        height: 32px;
        min-width: 32px;
        padding: 0 8px;
        font-size: 12px;
    }
}