:root {
    --auth-brand: #0d2366;
    --auth-accent: #2d6cdf;
    --auth-muted: #5a6b8c;
    --auth-surface: #ffffff;
    --auth-border: rgba(13, 35, 102, 0.08);
    --nav-height: 64px;
    --primary: #2d6cdf;
    --primary-dark: #1b4fcc;
    --text-main: #1e1e2f;
    --bg-body: #f5f7fa;
}

body {
    margin: 0;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--bg-body);
    color: var(--text-main);
    padding-top: var(--nav-height);
    /* Make room for fixed nav */
}

/* --- Navigation --- */
.main-nav {
    background: #ffffff;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    height: var(--nav-height);
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
}

.nav-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    height: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.nav-brand {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--auth-brand);
    text-decoration: none;
    letter-spacing: -0.5px;
}

.nav-menu {
    display: flex;
    gap: 8px;
    list-style: none;
    margin: 0;
    padding: 0;
    align-items: center;
}

.nav-link {
    text-decoration: none;
    color: #4b5563;
    font-weight: 500;
    font-size: 0.95rem;
    padding: 8px 16px;
    border-radius: 6px;
    transition: all 0.2s;
}

.nav-link:hover {
    background: #f3f4f6;
    color: var(--primary);
}

.btn-logout {
    color: #ef4444;
    border: 1px solid #fee2e2;
}

.btn-logout:hover {
    background: #fef2f2;
    color: #dc2626;
}

.nav-toggle {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    padding: 10px;
}

.hamburger {
    display: block;
    width: 24px;
    height: 2px;
    background: #374151;
    position: relative;
    transition: background 0.2s;
}

.hamburger::before,
.hamburger::after {
    content: '';
    position: absolute;
    width: 24px;
    height: 2px;
    background: #374151;
    left: 0;
    transition: transform 0.2s;
}

.hamburger::before {
    top: -6px;
}

.hamburger::after {
    top: 6px;
}

/* Mobile Menu */
@media (max-width: 768px) {
    .nav-toggle {
        display: block;
    }

    .nav-menu {
        position: absolute;
        top: var(--nav-height);
        left: 0;
        right: 0;
        background: white;
        flex-direction: column;
        align-items: stretch;
        padding: 16px;
        gap: 4px;
        border-bottom: 1px solid #e5e7eb;
        box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);

        /* Hidden by default */
        opacity: 0;
        transform: translateY(-10px);
        pointer-events: none;
        transition: all 0.2s ease-in-out;
    }

    .nav-menu.active {
        opacity: 1;
        transform: translateY(0);
        pointer-events: auto;
    }

    .nav-item-right {
        margin-top: 8px;
        padding-top: 8px;
        border-top: 1px solid #f3f4f6;
    }

    /* Animate Hamburger */
    .nav-toggle.active .hamburger {
        background: transparent;
    }

    .nav-toggle.active .hamburger::before {
        transform: rotate(45deg);
        top: 0;
    }

    .nav-toggle.active .hamburger::after {
        transform: rotate(-45deg);
        top: 0;
    }
}

.container {
    max-width: 1200px;
    margin: 24px auto;
    padding: 0 20px;
}

/* Adjust card to remove conflict with new layout if needed */
.card {
    background: #ffffff;
    border-radius: 12px;
    padding: 24px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    border: 1px solid #e5e7eb;
}

/* Original App CSS Components Preserved below */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 20px;
    border-radius: 6px;
    border: none;
    background: var(--primary);
    color: #fff;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s ease;
    text-decoration: none;
    font-size: 0.95rem;
}

.btn:hover {
    background: var(--primary-dark);
}

.btn-edit {
    padding: 6px 12px;
    font-size: 0.85rem;
    border-radius: 4px;
}

input,
textarea,
select {
    width: 100%;
    padding: 10px 12px;
    border-radius: 6px;
    border: 1px solid #d1d5db;
    font-size: 0.95rem;
    margin-bottom: 16px;
    background: #fff;
    outline: none;
    box-sizing: border-box;
    transition: border-color 0.2s;
}

input:focus,
select:focus,
textarea:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(45, 108, 223, 0.1);
}

/* Typography & Utils */
h1 {
    margin: 0 0 8px;
    font-size: 1.75rem;
    color: #111827;
    letter-spacing: -0.025em;
}

h2 {
    margin: 0 0 16px;
    font-size: 1.25rem;
    color: #374151;
}

p {
    color: #6b7280;
    line-height: 1.5;
}

table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    margin-top: 16px;
}

th {
    text-align: left;
    padding: 12px 16px;
    background: #f9fafb;
    color: #4b5563;
    font-weight: 600;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-bottom: 1px solid #e5e7eb;
}

td {
    padding: 12px 16px;
    border-bottom: 1px solid #f3f4f6;
    color: #1f2937;
    font-size: 0.95rem;
    vertical-align: middle;
}

tr:last-child td {
    border-bottom: none;
}

tr:hover td {
    background: #f9fafb;
}

.metric-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 20px;
    margin-bottom: 32px;
}

.metric {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 24px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.metric h3 {
    font-size: 0.9rem;
    color: #6b7280;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 600;
    margin-bottom: 8px;
}

.metric p {
    font-size: 2rem;
    font-weight: 700;
    color: #111827;
    margin: 0;
}

.metric-link {
    text-decoration: none;
    display: block;
    transition: transform 0.2s;
}

.metric-link:hover {
    transform: translateY(-2px);
}

/* Helpers */
.logout {
    color: #ef4444;
}

.status-badge {
    display: inline-flex;
    padding: 2px 8px;
    border-radius: 99px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
}

.status-active {
    background: #def7ec;
    color: #03543f;
}

.status-trial {
    background: #fef3c7;
    color: #92400e;
}

.status-expired {
    background: #fde8e8;
    color: #9b1c1c;
}

/* Dashboard Panel Overrides from original */
.panel {
    margin-top: 40px;
}

/* --- Auth / Login Page Styles --- */
.auth-body {
    background-color: #f0f4f9;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 20px;
    padding-top: 0;
    /* Override body padding */
}

.auth-wrapper {
    display: flex;
    width: 100%;
    max-width: 1000px;
    background: #ffffff;
    border-radius: 24px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.08);
    overflow: hidden;
    min-height: 600px;
}

/* Left Side: Brand/Info */
.auth-brand {
    flex: 1;
    background: linear-gradient(135deg, var(--auth-brand) 0%, var(--primary-dark) 100%);
    color: #ffffff;
    padding: 60px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    position: relative;
    overflow: hidden;
}

.auth-brand::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.1) 0%, transparent 60%);
    animation: pulse 15s infinite ease-in-out;
}

@keyframes pulse {
    0% {
        transform: scale(1);
        opacity: 0.5;
    }

    50% {
        transform: scale(1.1);
        opacity: 0.3;
    }

    100% {
        transform: scale(1);
        opacity: 0.5;
    }
}

.brand-icon {
    width: 64px;
    height: 64px;
    margin-bottom: 32px;
    color: #ffffff;
    position: relative;
    z-index: 1;
}

.auth-brand h1 {
    font-size: 2.5rem;
    font-weight: 800;
    margin-bottom: 16px;
    color: #ffffff;
    position: relative;
    z-index: 1;
    line-height: 1.1;
}

.auth-brand p {
    font-size: 1.1rem;
    color: #ffffff;
    opacity: 0.95;
    line-height: 1.6;
    margin-bottom: 40px;
    position: relative;
    z-index: 1;
    max-width: 90%;
}

.auth-highlights {
    list-style: none;
    padding: 0;
    margin: 0;
    position: relative;
    z-index: 1;
}

.auth-highlights li {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
    font-size: 1rem;
    color: #ffffff;
}

.highlight-icon {
    background: rgba(255, 255, 255, 0.2);
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    font-weight: bold;
}

/* Right Side: Login Form */
.auth-card {
    flex: 1;
    padding: 60px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    background: #ffffff;
}

.auth-card-header {
    margin-bottom: 40px;
}

.auth-card-icon {
    width: 48px;
    height: 48px;
    color: var(--primary);
    margin-bottom: 24px;
    background: rgba(45, 108, 223, 0.1);
    padding: 10px;
    border-radius: 12px;
}

.auth-card h2 {
    font-size: 1.75rem;
    font-weight: 700;
    color: #111827;
    margin-bottom: 8px;
}

.auth-card p {
    font-size: 1rem;
    color: #4b5563;
}

/* Form Styles */
.field-label {
    display: block;
    font-size: 0.9rem;
    font-weight: 600;
    color: #1e293b;
    margin-bottom: 8px;
}

.input-group {
    position: relative;
    margin-bottom: 24px;
}

.input-icon {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    color: #64748b;
    width: 20px;
    height: 20px;
    pointer-events: none;
    display: flex;
    /* Fix vertical alignment */
}

.input-group input {
    padding-left: 48px;
    height: 48px;
    font-size: 1rem;
    border: 1px solid #e2e8f0;
    background: #f8fafc;
    border-radius: 8px;
    transition: all 0.2s ease;
    margin-bottom: 0;
    /* Reset global input margin */
}

.input-group input:focus {
    background: #ffffff;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(45, 108, 223, 0.1);
}

.btn {
    /* removed width: 100% and margin-top to avoid breaking other pages */
    height: 48px;
    font-size: 1rem;
    font-weight: 600;
    border-radius: 8px;
    display: inline-flex;
    /* changed back to inline-flex for general use */
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 0 24px;
    /* added explicit padding */
    cursor: pointer;
    /* ensure pointer cursor */
}

/* Specific button style for auth/login page */
.auth-card .btn {
    width: 100%;
    margin-top: 8px;
    display: flex;
}

.btn-icon {
    width: 20px;
    height: 20px;
}

.flash {
    padding: 12px 16px;
    background-color: #fee2e2;
    border-left: 4px solid #ef4444;
    color: #991b1b;
    margin-bottom: 24px;
    border-radius: 4px;
    font-size: 0.9rem;
}

/* Mobile Responsiveness */
@media (max-width: 900px) {
    .auth-wrapper {
        flex-direction: column;
        max-width: 500px;
        min-height: auto;
    }

    .auth-brand {
        padding: 40px;
        text-align: center;
    }

    .auth-brand h1 {
        font-size: 2rem;
    }

    .auth-brand p,
    .auth-highlights {
        display: none;
    }

    /* Simplify on mobile */
    .brand-icon {
        margin: 0 auto 16px;
    }

    .auth-card {
        padding: 40px;
    }
}

@media (max-width: 480px) {
    .auth-body {
        padding: 10px;
    }

    .auth-wrapper {
        border-radius: 16px;
    }

    .auth-card {
        padding: 24px;
    }
}