/* ============================================================
   Xenda SMTP Server - Hacker Style Dashboard
   Sage Bloom Palette + Dark Gradient Aesthetic
   ============================================================ */

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

:root {
    /* Sage Bloom Palette */
    --sage-darkest: #607648;
    --sage-medium: #8FAB81;
    --sage-light: #a8c49a;
    --blush-light: #F0E8E8;
    --blush-pink: #F6CFCC;
    --coral: #F5A19B;

    /* Derived dark shades for hacker aesthetic */
    --bg-deepest: #1a2412;
    --bg-dark: #1f2b17;
    --bg-sidebar: #1a2412;
    --bg-main: #222f19;
    --bg-card: #283a1c;
    --bg-card-hover: #2e4220;
    --bg-elevated: #314824;
    --bg-input: #1f2b17;
    --bg-input-focus: #253318;

    /* Text colors */
    --text-primary: #F0E8E8;
    --text-secondary: #a8c49a;
    --text-muted: #6d8a5e;
    --text-white: #F0E8E8;
    --text-accent: #8FAB81;

    /* Semantic colors */
    --primary: #8FAB81;
    --primary-dark: #607648;
    --primary-light: #a8c49a;
    --success: #8FAB81;
    --warning: #F5A19B;
    --danger: #F5A19B;
    --info: #8FAB81;

    /* Borders */
    --border: rgba(143, 171, 129, 0.15);
    --border-light: rgba(143, 171, 129, 0.08);
    --border-focus: rgba(143, 171, 129, 0.4);

    /* Shadows with green tint */
    --shadow-sm: 0 1px 3px rgba(26, 36, 18, 0.4);
    --shadow: 0 2px 8px rgba(26, 36, 18, 0.5);
    --shadow-md: 0 4px 16px rgba(26, 36, 18, 0.5);
    --shadow-lg: 0 8px 32px rgba(26, 36, 18, 0.6);
    --shadow-glow: 0 0 20px rgba(143, 171, 129, 0.1);

    /* Radius */
    --radius: 8px;
    --radius-lg: 12px;
    --radius-xl: 16px;

    /* Layout */
    --sidebar-width: 260px;
    --topbar-height: 64px;
}

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

html {
    height: 100%;
    overflow-x: hidden;
    scrollbar-width: thin;
    scrollbar-color: var(--sage-darkest) var(--bg-deepest);
}

/* Custom scrollbar */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg-deepest); }
::-webkit-scrollbar-thumb { background: var(--sage-darkest); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--sage-medium); }

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-main);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    overflow-x: hidden;
}

/* ============================================================
   AUTH SCREEN (Login + Register)
   ============================================================ */

.auth-screen {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: linear-gradient(145deg, var(--bg-deepest) 0%, #1a2412 40%, #253318 100%);
    position: relative;
    overflow: hidden;
    padding: 16px;
}

.auth-screen::before {
    content: '';
    position: absolute;
    width: 600px;
    height: 600px;
    background: radial-gradient(circle, rgba(143, 171, 129, 0.08) 0%, transparent 70%);
    top: -200px;
    right: -200px;
    border-radius: 50%;
    animation: pulse-glow 4s ease-in-out infinite;
}

.auth-screen::after {
    content: '';
    position: absolute;
    width: 400px;
    height: 400px;
    background: radial-gradient(circle, rgba(245, 161, 155, 0.05) 0%, transparent 70%);
    bottom: -100px;
    left: -100px;
    border-radius: 50%;
    animation: pulse-glow 6s ease-in-out infinite reverse;
}

@keyframes pulse-glow {
    0%, 100% { opacity: 0.5; transform: scale(1); }
    50% { opacity: 1; transform: scale(1.05); }
}

.auth-card {
    background: linear-gradient(145deg, var(--bg-card) 0%, var(--bg-elevated) 100%);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    padding: 48px 40px;
    width: 100%;
    max-width: 440px;
    box-shadow: var(--shadow-lg), var(--shadow-glow);
    position: relative;
    z-index: 1;
    backdrop-filter: blur(10px);
}

.auth-logo {
    text-align: center;
    margin-bottom: 32px;
}

.auth-logo i {
    font-size: 48px;
    color: var(--sage-medium);
    margin-bottom: 12px;
    display: block;
    filter: drop-shadow(0 0 8px rgba(143, 171, 129, 0.3));
}

.auth-logo h1 {
    font-size: 28px;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.5px;
}

.auth-logo p {
    color: var(--text-muted);
    font-size: 14px;
    margin-top: 4px;
}

.auth-form h2 {
    font-size: 20px;
    font-weight: 600;
    margin-bottom: 24px;
    text-align: center;
    color: var(--text-primary);
}

.auth-switch {
    text-align: center;
    margin-top: 16px;
    font-size: 13px;
    color: var(--text-muted);
}

.auth-switch a {
    color: var(--sage-medium);
    text-decoration: none;
    font-weight: 600;
    transition: color 0.2s;
}

.auth-switch a:hover {
    color: var(--sage-light);
    text-decoration: underline;
}

/* ============================================================
   FORM ELEMENTS
   ============================================================ */

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    font-size: 11px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-family: 'JetBrains Mono', monospace;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 14px;
    font-family: inherit;
    background: var(--bg-input);
    color: var(--text-primary);
    transition: all 0.3s ease;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--border-focus);
    box-shadow: 0 0 0 3px rgba(143, 171, 129, 0.1), 0 0 16px rgba(143, 171, 129, 0.05);
    background: var(--bg-input-focus);
}

.form-group input::placeholder,
.form-group textarea::placeholder {
    color: var(--text-muted);
}

.form-group input:disabled {
    background: var(--bg-deepest);
    color: var(--text-muted);
    cursor: not-allowed;
    opacity: 0.6;
}

.form-group select option {
    background: var(--bg-card);
    color: var(--text-primary);
}

.input-group {
    display: flex;
    gap: 8px;
}

.input-group input {
    flex: 1;
    min-width: 0;
}

.error-text {
    color: var(--coral);
    font-size: 13px;
    margin-top: 12px;
    text-align: center;
}

hr {
    border: none;
    border-top: 1px solid var(--border);
    margin: 24px 0;
}

/* ============================================================
   BUTTONS
   ============================================================ */

.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 9px 18px;
    border: 1px solid transparent;
    border-radius: var(--radius);
    font-size: 13px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    white-space: nowrap;
    letter-spacing: 0.3px;
    position: relative;
    overflow: hidden;
}

.btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.05), transparent);
    transition: left 0.5s ease;
}

.btn:hover::before {
    left: 100%;
}

.btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.btn-primary {
    background: linear-gradient(135deg, var(--sage-darkest) 0%, var(--sage-medium) 100%);
    color: var(--blush-light);
    border-color: var(--sage-medium);
    box-shadow: 0 2px 8px rgba(96, 118, 72, 0.3);
}
.btn-primary:hover:not(:disabled) {
    box-shadow: 0 4px 16px rgba(143, 171, 129, 0.3), 0 0 20px rgba(143, 171, 129, 0.1);
    transform: translateY(-1px);
}

.btn-success {
    background: linear-gradient(135deg, #3d5c2e, #607648);
    color: var(--blush-light);
    border-color: var(--sage-darkest);
    box-shadow: 0 2px 8px rgba(96, 118, 72, 0.2);
}
.btn-success:hover { box-shadow: 0 4px 12px rgba(96, 118, 72, 0.3); transform: translateY(-1px); }

.btn-danger {
    background: linear-gradient(135deg, #8b3a36, #a84e4a);
    color: var(--blush-light);
    border-color: rgba(245, 161, 155, 0.3);
    box-shadow: 0 2px 8px rgba(245, 161, 155, 0.15);
}
.btn-danger:hover { box-shadow: 0 4px 12px rgba(245, 161, 155, 0.25); transform: translateY(-1px); }

.btn-warning {
    background: linear-gradient(135deg, #8b5e36, #a87a4a);
    color: var(--blush-light);
    border-color: rgba(246, 207, 204, 0.3);
}
.btn-warning:hover { box-shadow: 0 4px 12px rgba(246, 207, 204, 0.2); transform: translateY(-1px); }

.btn-outline {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-secondary);
}
.btn-outline:hover {
    background: rgba(143, 171, 129, 0.08);
    border-color: var(--sage-medium);
    color: var(--text-primary);
}

.btn-sm { padding: 5px 10px; font-size: 11px; }
.btn-full { width: 100%; justify-content: center; }

.action-btns { display: flex; gap: 6px; flex-wrap: wrap; }

/* ============================================================
   APP LAYOUT - Full viewport fit
   ============================================================ */

.app-container {
    display: flex;
    min-height: 100vh;
    width: 100%;
    overflow-x: hidden;
}

/* SIDEBAR */
.sidebar {
    width: var(--sidebar-width);
    min-width: var(--sidebar-width);
    background: linear-gradient(180deg, var(--bg-deepest) 0%, #1c2814 50%, var(--bg-dark) 100%);
    color: var(--text-white);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 100;
    transition: transform 0.3s ease;
    overflow-y: auto;
    overflow-x: hidden;
    border-right: 1px solid var(--border);
}

.sidebar-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 20px 24px;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}

.sidebar-header i {
    font-size: 24px;
    color: var(--sage-medium);
    filter: drop-shadow(0 0 6px rgba(143, 171, 129, 0.4));
}

.sidebar-header span {
    font-size: 22px;
    font-weight: 700;
    letter-spacing: -0.5px;
    background: linear-gradient(135deg, var(--sage-medium), var(--blush-light));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Sidebar User Info */
.sidebar-user {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 24px;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
    background: rgba(143, 171, 129, 0.03);
}

.user-avatar i {
    font-size: 32px;
    color: var(--sage-medium);
}

.user-info {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.user-name {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-white);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.user-role {
    font-size: 10px;
    padding: 2px 8px;
    border-radius: 10px;
    display: inline-block;
    width: fit-content;
    margin-top: 2px;
    font-family: 'JetBrains Mono', monospace;
    letter-spacing: 0.5px;
}

.badge-admin { background: rgba(245, 161, 155, 0.15); color: var(--coral); border: 1px solid rgba(245, 161, 155, 0.2); }
.badge-reseller { background: rgba(246, 207, 204, 0.15); color: var(--blush-pink); border: 1px solid rgba(246, 207, 204, 0.2); }
.badge-client { background: rgba(143, 171, 129, 0.15); color: var(--sage-medium); border: 1px solid rgba(143, 171, 129, 0.2); }

.sidebar-nav {
    flex: 1;
    padding: 8px 0;
    overflow-y: auto;
    overflow-x: hidden;
}

.nav-section {
    font-size: 9px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: var(--text-muted);
    padding: 16px 24px 6px;
    font-family: 'JetBrains Mono', monospace;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 9px 24px;
    color: var(--text-muted);
    text-decoration: none;
    font-size: 13px;
    font-weight: 500;
    transition: all 0.25s ease;
    border-left: 3px solid transparent;
    white-space: nowrap;
    position: relative;
}

.nav-item:hover {
    color: var(--text-primary);
    background: rgba(143, 171, 129, 0.06);
}

.nav-item.active {
    color: var(--sage-medium);
    background: rgba(143, 171, 129, 0.1);
    border-left-color: var(--sage-medium);
}

.nav-item.active::after {
    content: '';
    position: absolute;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 60%;
    background: var(--sage-medium);
    border-radius: 3px 0 0 3px;
    box-shadow: 0 0 8px rgba(143, 171, 129, 0.4);
}

.nav-item i { width: 20px; text-align: center; font-size: 14px; flex-shrink: 0; }

.sidebar-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--border);
    flex-shrink: 0;
}

.plan-badge {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: rgba(143, 171, 129, 0.1);
    border: 1px solid rgba(143, 171, 129, 0.15);
    border-radius: var(--radius);
    margin-bottom: 12px;
    font-size: 12px;
    font-weight: 600;
    color: var(--sage-medium);
    font-family: 'JetBrains Mono', monospace;
}

.plan-badge i { font-size: 14px; }

.btn-logout {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 10px 12px;
    background: rgba(245, 161, 155, 0.08);
    border: 1px solid rgba(245, 161, 155, 0.12);
    border-radius: var(--radius);
    color: var(--coral);
    font-size: 14px;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-logout:hover {
    background: rgba(245, 161, 155, 0.15);
    box-shadow: 0 0 12px rgba(245, 161, 155, 0.1);
}

/* MAIN CONTENT */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    width: calc(100% - var(--sidebar-width));
    max-width: calc(100vw - var(--sidebar-width));
    overflow-x: hidden;
    background: linear-gradient(180deg, var(--bg-main) 0%, #1f2b17 100%);
}

.top-bar {
    display: flex;
    align-items: center;
    gap: 16px;
    height: var(--topbar-height);
    padding: 0 clamp(16px, 2vw, 32px);
    background: linear-gradient(90deg, var(--bg-card) 0%, rgba(40, 58, 28, 0.95) 100%);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 50;
    flex-shrink: 0;
    backdrop-filter: blur(12px);
}

.sidebar-toggle {
    display: none;
    background: none;
    border: none;
    font-size: 20px;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 4px;
}

.top-bar h2 {
    font-size: 16px;
    font-weight: 600;
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--text-primary);
    font-family: 'JetBrains Mono', monospace;
    letter-spacing: -0.3px;
}

.top-bar-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
}

.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    white-space: nowrap;
    font-family: 'JetBrains Mono', monospace;
    letter-spacing: 0.3px;
}

.status-healthy {
    background: rgba(143, 171, 129, 0.1);
    color: var(--sage-medium);
    border: 1px solid rgba(143, 171, 129, 0.2);
}
.status-healthy i { font-size: 8px; filter: drop-shadow(0 0 4px rgba(143, 171, 129, 0.6)); }
.status-degraded { background: rgba(246, 207, 204, 0.1); color: var(--blush-pink); border: 1px solid rgba(246, 207, 204, 0.2); }
.status-down { background: rgba(245, 161, 155, 0.1); color: var(--coral); border: 1px solid rgba(245, 161, 155, 0.2); }

.quota-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    background: rgba(143, 171, 129, 0.1);
    color: var(--sage-medium);
    white-space: nowrap;
    border: 1px solid rgba(143, 171, 129, 0.15);
    font-family: 'JetBrains Mono', monospace;
}

/* Page content */
.page-content {
    padding: clamp(16px, 2vw, 32px);
    flex: 1;
    min-width: 0;
    overflow-x: hidden;
}

/* ============================================================
   CARDS & STATS
   ============================================================ */

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: clamp(12px, 1.5vw, 20px);
    margin-bottom: 28px;
}

.stat-card {
    background: linear-gradient(145deg, var(--bg-card) 0%, var(--bg-elevated) 100%);
    border-radius: var(--radius-lg);
    padding: clamp(16px, 1.5vw, 24px);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border);
    min-width: 0;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, transparent, var(--sage-medium), transparent);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.stat-card:hover {
    border-color: rgba(143, 171, 129, 0.25);
    box-shadow: var(--shadow), var(--shadow-glow);
    transform: translateY(-2px);
}

.stat-card:hover::before {
    opacity: 1;
}

.stat-card .stat-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.stat-card .stat-label {
    font-size: 10px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
    font-family: 'JetBrains Mono', monospace;
}

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

.stat-card .stat-value {
    font-size: clamp(22px, 2vw, 28px);
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1;
    font-family: 'JetBrains Mono', monospace;
}

.stat-card .stat-sub {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 6px;
    font-family: 'JetBrains Mono', monospace;
}

.icon-purple { background: rgba(143, 171, 129, 0.12); color: var(--sage-medium); }
.icon-green { background: rgba(143, 171, 129, 0.12); color: var(--sage-medium); }
.icon-yellow { background: rgba(246, 207, 204, 0.12); color: var(--blush-pink); }
.icon-red { background: rgba(245, 161, 155, 0.12); color: var(--coral); }
.icon-blue { background: rgba(143, 171, 129, 0.12); color: var(--sage-light); }

/* Grid layouts */
.grid-2 {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 400px), 1fr));
    gap: 24px;
    margin-bottom: 24px;
}

/* ============================================================
   DATA TABLES
   ============================================================ */

.card {
    background: linear-gradient(145deg, var(--bg-card) 0%, rgba(40, 58, 28, 0.8) 100%);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border);
    margin-bottom: 24px;
    max-width: 100%;
    overflow: hidden;
    backdrop-filter: blur(4px);
}

.highlight-card {
    border-color: var(--sage-medium);
    border-width: 2px;
    box-shadow: var(--shadow), 0 0 20px rgba(143, 171, 129, 0.08);
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: clamp(14px, 1.5vw, 20px) clamp(16px, 1.5vw, 24px);
    border-bottom: 1px solid var(--border);
    gap: 12px;
    flex-wrap: wrap;
    background: rgba(143, 171, 129, 0.03);
}

.card-header h3 {
    font-size: 14px;
    font-weight: 600;
    min-width: 0;
    color: var(--text-primary);
    font-family: 'JetBrains Mono', monospace;
    letter-spacing: -0.2px;
}

.card-body { padding: clamp(16px, 1.5vw, 24px); }
.card-body.no-pad { padding: 0; overflow-x: auto; }

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

.data-table th {
    text-align: left;
    padding: 12px 16px;
    font-size: 10px;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
    background: rgba(143, 171, 129, 0.05);
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
    font-family: 'JetBrains Mono', monospace;
}

.data-table td {
    padding: 10px 16px;
    font-size: 13px;
    border-bottom: 1px solid var(--border-light);
    vertical-align: middle;
    color: var(--text-primary);
}

.data-table tr {
    transition: background 0.2s ease;
}

.data-table tr:hover {
    background: rgba(143, 171, 129, 0.04);
}

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

/* Action buttons in table cells */
.data-table td:last-child {
    white-space: nowrap;
}

.data-table td .btn-sm {
    padding: 4px 8px;
    font-size: 11px;
}

.empty-row {
    text-align: center;
    padding: 40px 20px !important;
    color: var(--text-muted);
}

/* Status badges */
.badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    white-space: nowrap;
    font-family: 'JetBrains Mono', monospace;
}

.badge-active, .badge-confirmed, .badge-delivered {
    background: rgba(143, 171, 129, 0.12);
    color: var(--sage-medium);
    border: 1px solid rgba(143, 171, 129, 0.2);
}
.badge-warming, .badge-pending, .badge-waiting {
    background: rgba(246, 207, 204, 0.12);
    color: var(--blush-pink);
    border: 1px solid rgba(246, 207, 204, 0.2);
}
.badge-paused, .badge-inactive {
    background: rgba(109, 138, 94, 0.12);
    color: var(--text-muted);
    border: 1px solid rgba(109, 138, 94, 0.2);
}
.badge-blacklisted, .badge-danger, .badge-failed, .badge-expired {
    background: rgba(245, 161, 155, 0.12);
    color: var(--coral);
    border: 1px solid rgba(245, 161, 155, 0.2);
}
.badge-online {
    background: rgba(143, 171, 129, 0.12);
    color: var(--sage-medium);
    border: 1px solid rgba(143, 171, 129, 0.2);
}
.badge-offline, .badge-suspended {
    background: rgba(245, 161, 155, 0.12);
    color: var(--coral);
    border: 1px solid rgba(245, 161, 155, 0.2);
}
.badge-warning {
    background: rgba(246, 207, 204, 0.12);
    color: var(--blush-pink);
    border: 1px solid rgba(246, 207, 204, 0.2);
}

/* DNS check */
.dns-check { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.dns-item { display: inline-flex; align-items: center; gap: 4px; font-size: 11px; font-weight: 600; font-family: 'JetBrains Mono', monospace; }
.dns-pass { color: var(--sage-medium); }
.dns-fail { color: var(--coral); }

/* Truncate */
.truncate { max-width: 200px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
code.truncate { max-width: 120px; display: inline-block; vertical-align: middle; }

/* ============================================================
   MODALS
   ============================================================ */

.modal-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(26, 36, 18, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 200;
    backdrop-filter: blur(8px);
    padding: 16px;
}

.modal-content {
    background: linear-gradient(145deg, var(--bg-card) 0%, var(--bg-elevated) 100%);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    width: 100%;
    max-width: 560px;
    max-height: 85vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg), 0 0 40px rgba(143, 171, 129, 0.08);
    animation: modalIn 0.3s ease;
}

@keyframes modalIn {
    from { transform: translateY(20px) scale(0.98); opacity: 0; }
    to { transform: translateY(0) scale(1); opacity: 1; }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    border-bottom: 1px solid var(--border);
    background: rgba(143, 171, 129, 0.03);
}

.modal-header h3 {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    font-family: 'JetBrains Mono', monospace;
}

.modal-close {
    background: none;
    border: none;
    font-size: 24px;
    color: var(--text-muted);
    cursor: pointer;
    line-height: 1;
    transition: color 0.2s;
}

.modal-close:hover { color: var(--coral); }

.modal-body { padding: 24px; }

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    padding: 16px 24px;
    border-top: 1px solid var(--border);
    flex-wrap: wrap;
}

/* ============================================================
   TOASTS
   ============================================================ */

.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 300;
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-width: calc(100vw - 40px);
}

.toast {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 20px;
    border-radius: var(--radius);
    color: var(--text-primary);
    font-size: 13px;
    font-weight: 500;
    box-shadow: var(--shadow-md);
    animation: slideInRight 0.3s ease;
    max-width: 380px;
    border: 1px solid var(--border);
    backdrop-filter: blur(12px);
}

.toast-close {
    background: none;
    border: none;
    color: var(--text-primary);
    font-size: 18px;
    cursor: pointer;
    opacity: 0.7;
    flex-shrink: 0;
}

.toast-close:hover { opacity: 1; }

.toast-success { background: rgba(40, 58, 28, 0.95); border-color: rgba(143, 171, 129, 0.3); }
.toast-error { background: rgba(58, 28, 28, 0.95); border-color: rgba(245, 161, 155, 0.3); }
.toast-warning { background: rgba(58, 48, 28, 0.95); border-color: rgba(246, 207, 204, 0.3); }
.toast-info { background: rgba(28, 40, 20, 0.95); border-color: rgba(143, 171, 129, 0.3); }

@keyframes slideInRight {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

/* ============================================================
   PROGRESS BARS
   ============================================================ */

.progress-bar-container {
    height: 10px;
    background: var(--bg-deepest);
    border-radius: 5px;
    overflow: hidden;
    margin-bottom: 8px;
    border: 1px solid var(--border-light);
}

.progress-bar {
    height: 100%;
    border-radius: 5px;
    background: linear-gradient(90deg, var(--sage-darkest), var(--sage-medium));
    transition: width 0.5s ease;
    box-shadow: 0 0 8px rgba(143, 171, 129, 0.3);
}

.usage-text {
    font-size: 13px;
    color: var(--text-secondary);
    font-weight: 500;
    font-family: 'JetBrains Mono', monospace;
}

/* ============================================================
   PLAN CARDS
   ============================================================ */

.plans-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr));
    gap: 24px;
    margin-bottom: 32px;
}

.plan-card {
    background: linear-gradient(145deg, var(--bg-card) 0%, var(--bg-elevated) 100%);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    padding: clamp(20px, 2vw, 32px) clamp(16px, 1.5vw, 24px);
    text-align: center;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.plan-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--sage-darkest), var(--sage-medium), var(--blush-pink));
    opacity: 0;
    transition: opacity 0.3s ease;
}

.plan-card:hover {
    border-color: rgba(143, 171, 129, 0.3);
    box-shadow: var(--shadow-md), var(--shadow-glow);
    transform: translateY(-3px);
}

.plan-card:hover::before {
    opacity: 1;
}

.plan-card.plan-current {
    border-color: var(--sage-medium);
    background: linear-gradient(145deg, rgba(40, 58, 28, 0.9), rgba(49, 72, 36, 0.9));
}

.plan-card.plan-current::before {
    opacity: 1;
}

.plan-card-header h3 {
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 8px;
    color: var(--text-primary);
}

.plan-price {
    font-size: clamp(28px, 3vw, 36px);
    font-weight: 800;
    color: var(--sage-medium);
    margin-bottom: 24px;
    font-family: 'JetBrains Mono', monospace;
}

.plan-price span {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-muted);
}

.plan-features {
    list-style: none;
    text-align: left;
    margin-bottom: 24px;
}

.plan-features li {
    padding: 8px 0;
    font-size: 13px;
    color: var(--text-secondary);
    border-bottom: 1px solid var(--border-light);
}

.plan-features li:last-child { border-bottom: none; }

.plan-features li i {
    color: var(--sage-medium);
    margin-right: 8px;
    width: 16px;
}

.current-plan {
    display: flex;
    align-items: center;
    gap: 24px;
    flex-wrap: wrap;
}

.plan-icon {
    width: 64px;
    height: 64px;
    background: linear-gradient(135deg, var(--sage-darkest), var(--sage-medium));
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    color: var(--blush-light);
    flex-shrink: 0;
    box-shadow: 0 4px 16px rgba(96, 118, 72, 0.3);
}

.plan-details h2 {
    font-size: 22px;
    font-weight: 700;
    margin-bottom: 4px;
    color: var(--text-primary);
}

.plan-details p {
    font-size: 14px;
    color: var(--text-secondary);
}

.plan-expires {
    color: var(--coral) !important;
    font-weight: 600;
}

/* ============================================================
   BILLING & CRYPTO
   ============================================================ */

.invoice-summary {
    display: flex;
    align-items: center;
    gap: 24px;
    flex-wrap: wrap;
}

.invoice-amount .amount {
    font-size: clamp(24px, 2.5vw, 32px);
    font-weight: 800;
    color: var(--text-primary);
    font-family: 'JetBrains Mono', monospace;
}

.invoice-amount .period {
    display: block;
    font-size: 13px;
    color: var(--text-muted);
}

.invoice-status { flex: 1; min-width: 0; }
.invoice-actions { margin-left: auto; }

.crypto-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.crypto-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 20px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    transition: all 0.2s;
}

.crypto-badge:hover {
    border-color: var(--sage-medium);
    background: rgba(143, 171, 129, 0.08);
}

.crypto-badge i {
    font-size: 16px;
    color: var(--blush-pink);
}

/* ============================================================
   QUICK START GUIDE
   ============================================================ */

.quick-steps {
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin-bottom: 24px;
}

.step {
    display: flex;
    align-items: flex-start;
    gap: 16px;
    padding: 16px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    transition: all 0.3s ease;
    background: rgba(143, 171, 129, 0.02);
}

.step.step-done {
    border-color: rgba(143, 171, 129, 0.3);
    background: rgba(143, 171, 129, 0.05);
}

.step-num {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--bg-deepest);
    border: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 13px;
    color: var(--text-muted);
    flex-shrink: 0;
    font-family: 'JetBrains Mono', monospace;
}

.step.step-done .step-num {
    background: linear-gradient(135deg, var(--sage-darkest), var(--sage-medium));
    color: var(--blush-light);
    border-color: var(--sage-medium);
    box-shadow: 0 0 8px rgba(143, 171, 129, 0.3);
}

.step-text { min-width: 0; flex: 1; }
.step-text strong { display: block; font-size: 14px; margin-bottom: 4px; color: var(--text-primary); }
.step-text p { font-size: 13px; color: var(--text-muted); margin: 0; }

.smtp-config-box {
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    overflow-x: auto;
}

.smtp-config-box h4 {
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 12px;
    color: var(--text-primary);
    font-family: 'JetBrains Mono', monospace;
}

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

.config-table td {
    padding: 8px 12px;
    font-size: 13px;
    border-bottom: 1px solid var(--border-light);
    color: var(--text-primary);
}

.config-table td:first-child {
    font-weight: 600;
    color: var(--text-muted);
    width: 120px;
    white-space: nowrap;
    font-family: 'JetBrains Mono', monospace;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

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

/* ============================================================
   VALIDATION RESULTS
   ============================================================ */

.validation-result {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-radius: var(--radius);
    font-size: 14px;
    margin-top: 12px;
    border: 1px solid;
}

.validation-result.valid {
    background: rgba(143, 171, 129, 0.08);
    color: var(--sage-medium);
    border-color: rgba(143, 171, 129, 0.2);
}

.validation-result.invalid {
    background: rgba(245, 161, 155, 0.08);
    color: var(--coral);
    border-color: rgba(245, 161, 155, 0.2);
}

.validation-result i { font-size: 18px; }

/* ============================================================
   SPAM TEST RESULTS
   ============================================================ */

.spam-result {
    padding: 16px;
    border-radius: var(--radius);
}

.spam-good { background: rgba(143, 171, 129, 0.08); border: 1px solid rgba(143, 171, 129, 0.3); }
.spam-warn { background: rgba(246, 207, 204, 0.08); border: 1px solid rgba(246, 207, 204, 0.3); }
.spam-bad { background: rgba(245, 161, 155, 0.08); border: 1px solid rgba(245, 161, 155, 0.3); }

.spam-result h4 { margin-bottom: 4px; color: var(--text-primary); }
.spam-result pre { margin-top: 12px; font-size: 12px; white-space: pre-wrap; color: var(--text-secondary); }

/* ============================================================
   CODE BLOCKS
   ============================================================ */

code {
    background: rgba(143, 171, 129, 0.08);
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-family: 'JetBrains Mono', 'Fira Code', monospace;
    color: var(--sage-medium);
    word-break: break-word;
    overflow-wrap: break-word;
    border: 1px solid rgba(143, 171, 129, 0.12);
}

/* Code inside table cells should not break aggressively */
.data-table code {
    word-break: normal;
    white-space: nowrap;
}

pre.code-block {
    background: var(--bg-deepest);
    color: var(--sage-light);
    padding: 20px;
    border-radius: var(--radius);
    font-size: 13px;
    font-family: 'JetBrains Mono', 'Fira Code', monospace;
    overflow-x: auto;
    line-height: 1.6;
    border: 1px solid var(--border);
}

.warning-text {
    color: var(--coral);
    font-weight: 600;
    font-size: 13px;
    margin-top: 8px;
}

/* ============================================================
   LOADING
   ============================================================ */

.loading {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted);
    font-size: 16px;
}

.loading i {
    margin-right: 8px;
    color: var(--sage-medium);
}

/* ============================================================
   EMPTY STATE
   ============================================================ */

.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted);
}

.empty-state i { font-size: 48px; margin-bottom: 16px; display: block; color: var(--sage-darkest); }
.empty-state h4 { font-size: 18px; color: var(--text-secondary); margin-bottom: 8px; }
.empty-state p { font-size: 14px; margin-bottom: 20px; }

/* ============================================================
   INLINE STYLE OVERRIDES
   Override hardcoded colors from pages.js inline styles
   ============================================================ */

/* Override dark blue backgrounds (#1e293b) used in SMTP config boxes and modals */
[style*="background:#1e293b"],
[style*="background: #1e293b"] {
    background: var(--bg-deepest) !important;
    border: 1px solid var(--border) !important;
}

/* Override cyan text (#22d3ee) used for SMTP values */
[style*="color:#22d3ee"],
[style*="color: #22d3ee"] {
    color: var(--sage-medium) !important;
}

/* Override slate text (#64748b) */
[style*="color:#64748b"],
[style*="color: #64748b"] {
    color: var(--text-muted) !important;
}

/* Override muted text (#94a3b8) */
[style*="color:#94a3b8"],
[style*="color: #94a3b8"] {
    color: var(--text-muted) !important;
}

/* Override purple accents */
[style*="color:#a78bfa"] {
    color: var(--sage-medium) !important;
    border-color: var(--sage-medium) !important;
}

[style*="color:#c4b5fd"] {
    color: var(--sage-light) !important;
}

/* Override purple border box */
[style*="background:#7c3aed22"] {
    background: rgba(143, 171, 129, 0.08) !important;
    border-color: var(--sage-medium) !important;
}

/* Override warning color in buttons */
[style*="color:#f59e0b"] {
    color: var(--blush-pink) !important;
    border-color: var(--blush-pink) !important;
}

/* Override info box with blue left border */
[style*="background:#1a1f2e"] {
    background: var(--bg-deepest) !important;
    border-color: var(--sage-medium) !important;
    border-left-color: var(--sage-medium) !important;
}

/* Override border color in flex dividers (#334155) */
[style*="border-bottom:1px solid #334155"] {
    border-bottom-color: var(--border) !important;
}

/* Override dark code display backgrounds */
[style*="background:#1e293b;padding:6px"] {
    background: var(--bg-deepest) !important;
    color: var(--sage-light) !important;
    border: 1px solid var(--border) !important;
}

/* Override font-weight:600;color:#22d3ee */
[style*="font-weight:600;color:#22d3ee"] {
    color: var(--sage-medium) !important;
}

/* ============================================================
   RESPONSIVE - Tablet (1200px and below)
   ============================================================ */

@media (max-width: 1200px) {
    :root {
        --sidebar-width: 220px;
    }

    .nav-item {
        padding: 8px 18px;
        font-size: 12px;
    }

    .sidebar-header { padding: 16px 18px; }
    .sidebar-user { padding: 12px 18px; }
    .nav-section { padding: 14px 18px 4px; }
    .sidebar-footer { padding: 12px 18px; }

    .data-table td .btn-sm {
        padding: 3px 6px;
        font-size: 10px;
    }
}

@media (max-width: 1024px) {
    .grid-2 { grid-template-columns: 1fr; }
    .plans-grid { grid-template-columns: 1fr 1fr; }
    .stats-grid { grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }
}

/* ============================================================
   RESPONSIVE - Mobile / Sidebar collapse (768px and below)
   ============================================================ */

@media (max-width: 768px) {
    :root {
        --sidebar-width: 260px;
    }

    .sidebar {
        transform: translateX(-100%);
    }
    .sidebar.open {
        transform: translateX(0);
        box-shadow: 4px 0 24px rgba(26, 36, 18, 0.6);
    }
    .sidebar-toggle { display: block; }

    .main-content {
        margin-left: 0;
        width: 100%;
        max-width: 100vw;
    }

    .page-content { padding: 16px; }
    .stats-grid { grid-template-columns: 1fr 1fr; }
    .top-bar { padding: 0 16px; }
    .plans-grid { grid-template-columns: 1fr; }
    .invoice-summary { flex-direction: column; align-items: flex-start; }
    .current-plan { flex-direction: column; }

    .card-header { padding: 14px 16px; }
    .card-body { padding: 16px; }

    .modal-content {
        max-width: calc(100vw - 32px);
        margin: 16px;
    }

    .top-bar-actions .status-badge span,
    .top-bar-actions .quota-badge span {
        display: none;
    }

    .sidebar-backdrop {
        position: fixed;
        top: 0; left: 0; right: 0; bottom: 0;
        background: rgba(26, 36, 18, 0.6);
        z-index: 99;
        backdrop-filter: blur(4px);
    }
}

/* ============================================================
   RESPONSIVE - Small mobile (480px and below)
   ============================================================ */

@media (max-width: 480px) {
    .stats-grid { grid-template-columns: 1fr; }
    .auth-card { padding: 32px 24px; margin: 16px; }
    .page-content { padding: 12px; }
    .stat-card { padding: 14px; }
    .data-table { font-size: 12px; }
    .data-table th, .data-table td { padding: 8px 10px; }
    .btn-sm { padding: 3px 6px; font-size: 10px; }
    .modal-content { max-height: 90vh; }
}

/* ============================================================
   UTILITY: Ensure all containers respect viewport
   ============================================================ */

.page-content > * {
    max-width: 100%;
}

[style*="overflow-x"] {
    -webkit-overflow-scrolling: touch;
}

.page-content div[style*="grid-template-columns"] {
    max-width: 100%;
}

/* ============================================================
   SUBTLE ANIMATIONS & EFFECTS
   ============================================================ */

/* Subtle scan line effect on the main background */
.main-content::before {
    content: '';
    position: fixed;
    top: 0;
    left: var(--sidebar-width);
    right: 0;
    bottom: 0;
    background: repeating-linear-gradient(
        0deg,
        transparent,
        transparent 2px,
        rgba(143, 171, 129, 0.008) 2px,
        rgba(143, 171, 129, 0.008) 4px
    );
    pointer-events: none;
    z-index: 0;
}

.page-content {
    position: relative;
    z-index: 1;
}

/* Ensure main-content can have both ::before and ::after */
.main-content {
    position: relative;
}

/* Glow effect on focused inputs */
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    box-shadow: 0 0 0 3px rgba(143, 171, 129, 0.1), 0 0 20px rgba(143, 171, 129, 0.05);
}

/* Selection color */
::selection {
    background: rgba(143, 171, 129, 0.3);
    color: var(--text-primary);
}

/* ============================================================
   WATERMARK - Alien icon centered on every page
   Uses ::after pseudo-element so it survives JS page renders
   ============================================================ */

.main-content::after {
    content: '';
    position: fixed;
    top: 50%;
    left: calc(var(--sidebar-width) + (100vw - var(--sidebar-width)) / 2);
    transform: translate(-50%, -50%);
    width: 300px;
    height: 300px;
    background-image: url('/assets/img/aliens.png');
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    opacity: 0.25;
    pointer-events: none;
    z-index: 0;
}

/* Watermark adjusts on mobile when sidebar is hidden */
@media (max-width: 768px) {
    .main-content::after {
        left: 50%;
    }
}

/* ============================================================
   SIDEBAR LOGO IMAGE
   ============================================================ */

.sidebar-header img {
    width: 32px;
    height: 32px;
    filter: drop-shadow(0 0 8px rgba(143, 171, 129, 0.4));
}

/* Auth screen logo image */
.auth-logo img {
    width: 64px;
    height: 64px;
    margin-bottom: 12px;
    filter: drop-shadow(0 0 12px rgba(143, 171, 129, 0.3));
}
