:root {
    --primary: #6366f1;
    --primary-hover: #4f46e5;
    --bg-body: #f1f5f9;
    --bg-card: #ffffff;
    --bg-sidebar: #0f172a;
    --text-heading: #0f172a;
    --text-main: #334155;
    --text-muted: #64748b;
    --text-on-dark: #f8fafc;
    --border: #e2e8f0;
    --success: #10b981;
    --danger: #ef4444;
}

* {
    box-sizing: border-box;
}

body {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    background-color: var(--bg-body);
    color: var(--text-main);
    margin: 0;
    padding: 0;
    line-height: 1.4;
    -webkit-font-smoothing: antialiased;
    font-size: 14px;
}

a {
    color: var(--primary);
    text-decoration: none;
    transition: all 0.2s;
}

a:hover {
    text-decoration: underline;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 1.5rem;
}

.container-fluid {
    width: 100%;
    padding: 0 1rem;
}

.auth-wrapper {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    background: #f1f5f9;
    padding: 1rem;
}

.auth-card {
    background: var(--bg-card);
    padding: 2rem;
    border-radius: 0.75rem;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    width: 100%;
    max-width: 380px;
    border: 1px solid var(--border);
}

.auth-header {
    text-align: center;
    margin-bottom: 1.5rem;
}

.auth-header h1 {
    font-size: 1.75rem;
    font-weight: 800;
    margin-bottom: 0.25rem;
    background: linear-gradient(to right, #818cf8, #c084fc);
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    color: #818cf8;
}

.form-group {
    margin-bottom: 1rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.25rem;
    color: #475569;
    font-size: 0.8rem;
    font-weight: 600;
}

.form-control {
    width: 100%;
    padding: 0.5rem 0.75rem;
    background: #ffffff;
    border: 1px solid var(--border);
    border-radius: 0.375rem;
    color: var(--text-heading);
    font-size: 0.9rem;
    box-sizing: border-box;
    transition: all 0.2s;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.2);
}

.btn {
    display: inline-flex;
    justify-content: center;
    align-items: center;
    padding: 0.5rem 1rem;
    border-radius: 0.375rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    border: none;
    font-size: 0.9rem;
    text-decoration: none !important;
}

.btn-primary {
    background: var(--primary);
    color: white;
    width: 100%;
}

.btn-primary:hover {
    background: var(--primary-hover);
    transform: translateY(-1px);
}

.dashboard-grid {
    display: grid;
    grid-template-columns: 220px 1fr;
    min-height: 100vh;
}

.sidebar {
    background: var(--bg-sidebar);
    border-right: 1px solid var(--bg-sidebar);
    padding: 1.25rem;
    display: flex;
    flex-direction: column;
    color: var(--text-on-dark);
}

.sidebar h2 {
    color: white !important;
    font-size: 1.1rem;
    margin-top: 0;
}

.sidebar nav {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.sidebar nav a {
    color: #94a3b8;
    font-weight: 500;
    padding: 0.5rem 0.75rem;
    border-radius: 0.375rem;
    font-size: 0.9rem;
    display: block;
}

.sidebar nav a:hover,
.sidebar nav a.active {
    color: white;
    background: rgba(255, 255, 255, 0.1);
    text-decoration: none;
}

.main-content {
    padding: 1.5rem;
    overflow-x: hidden;
}

.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 0.5rem;
    padding: 1rem;
    margin-bottom: 1rem;
    box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
}

.card-title {
    font-size: 1.1rem;
    font-weight: 600;
    margin: 0;
    color: var(--text-main);
}

.table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 0.875rem;
}

.table th {
    padding: 0.75rem;
    text-align: left;
    border-bottom: 1px solid var(--border);
    color: var(--text-muted);
    font-weight: 600;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    white-space: nowrap;
}

.table td {
    padding: 0.75rem;
    text-align: left;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}

.table tr:last-child td {
    border-bottom: none;
}

.badge {
    padding: 0.2rem 0.6rem;
    border-radius: 9999px;
    font-size: 0.7rem;
    font-weight: 600;
    display: inline-block;
    white-space: nowrap;
}

.badge-active {
    background: #dcfce7;
    color: #166534;
}

.badge-pending {
    background: #fef9c3;
    color: #854d0e;
}

.badge-failed,
.badge-inactive {
    background: #fee2e2;
    color: #991b1b;
}

.badge-verified {
    background: #dcfce7;
    color: #166534;
}

.mobile-menu-toggle {
    display: none;
    position: fixed;
    top: 1rem;
    left: 1rem;
    z-index: 1001;
    background: var(--bg-sidebar);
    color: white;
    border: none;
    padding: 0.75rem;
    border-radius: 0.5rem;
    cursor: pointer;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.3);
}

.mobile-menu-toggle svg {
    width: 24px;
    height: 24px;
    stroke: currentColor;
}

.mobile-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 999;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.mobile-overlay.active {
    display: block;
    opacity: 1;
}

/* MOBILE RESPONSIVE - AGGRESSIVE OVERRIDES */
@media (max-width: 768px) {
    .dashboard-grid {
        grid-template-columns: 1fr !important;
    }

    .mobile-menu-toggle {
        display: block !important;
    }

    .sidebar {
        position: fixed !important;
        top: 0 !important;
        left: -100% !important;
        width: 280px !important;
        max-width: 85vw !important;
        height: 100vh !important;
        z-index: 1000 !important;
        transition: left 0.3s ease !important;
        border-right: 1px solid rgba(255, 255, 255, 0.1) !important;
        overflow-y: auto !important;
        padding: 1rem !important;
    }

    .sidebar.mobile-open {
        left: 0 !important;
    }

    .main-content {
        padding: 1rem !important;
        padding-top: 4.5rem !important;
        max-width: 100vw !important;
        overflow-x: hidden !important;
    }

    /* FORCE ALL GRIDS TO SINGLE COLUMN */
    [style*="display: grid"],
    [style*="display:grid"],
    [style*="grid-template-columns"] {
        grid-template-columns: 1fr !important;
        gap: 1rem !important;
    }

    /* FORCE ALL BUTTONS FULL WIDTH */
    .btn,
    button[class*="btn"],
    a[class*="btn"] {
        width: 100% !important;
        padding: 0.75rem 1rem !important;
        margin-bottom: 0.5rem !important;
    }

    /* EXCEPT TABLE BUTTONS */
    .table .btn,
    .table-responsive .btn,
    td .btn,
    .domain-table .btn,
    table .btn {
        width: auto !important;
        display: inline-flex !important;
        padding: 0.4rem 0.8rem !important;
        font-size: 0.75rem !important;
        margin: 0.25rem 0.25rem 0.25rem 0 !important;
    }

    /* FORCE HEADERS TO STACK */
    header,
    header[style],
    .card-header {
        flex-direction: column !important;
        align-items: stretch !important;
        gap: 1rem !important;
        padding: 1rem !important;
    }

    header>div,
    header>* {
        width: 100% !important;
    }

    header h1 {
        font-size: 1.25rem !important;
    }

    header select,
    header .btn,
    header button {
        width: 100% !important;
        max-width: 100% !important;
    }

    /* FORCE INPUTS FULL WIDTH */
    select,
    input[type="text"],
    input[type="email"],
    input[type="password"],
    input[type="url"],
    textarea,
    .form-control {
        width: 100% !important;
        max-width: 100% !important;
        font-size: 16px !important;
    }

    /* TABLE RESPONSIVE */
    .table-responsive {
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch !important;
        margin: 0 -1rem !important;
        padding: 0 1rem !important;
    }

    .table,
    table {
        display: block !important;
        overflow-x: auto !important;
        white-space: nowrap !important;
    }

    .table th,
    .table td,
    table th,
    table td {
        padding: 0.5rem !important;
        font-size: 0.75rem !important;
    }

    .domain-table th,
    .domain-table td {
        padding: 0.75rem !important;
        font-size: 0.75rem !important;
    }

    /* TYPOGRAPHY */
    h1,
    [style*="font-size: 1.875rem"] {
        font-size: 1.25rem !important;
    }

    h2 {
        font-size: 1.1rem !important;
    }

    h3 {
        font-size: 1rem !important;
    }

    [style*="font-size: 2rem"] {
        font-size: 1.5rem !important;
    }

    /* ICONS */
    [style*="width: 64px"][style*="height: 64px"] {
        width: 48px !important;
        height: 48px !important;
        font-size: 1.5rem !important;
    }

    /* GAPS AND SPACING */
    [style*="gap: 1.5rem"],
    [style*="gap:1.5rem"] {
        gap: 1rem !important;
    }

    [style*="padding: 2rem"],
    [style*="padding:2rem"] {
        padding: 1rem !important;
    }

    [style*="margin-bottom: 2rem"],
    [style*="margin-bottom:2rem"] {
        margin-bottom: 1rem !important;
    }

    /* CONTAINERS */
    .container,
    .container-fluid {
        padding: 0 1rem !important;
        max-width: 100vw !important;
    }

    .card {
        padding: 1rem !important;
        margin-bottom: 1rem !important;
    }

    /* MODALS */
    [style*="max-width: 500px"],
    [style*="max-width: 600px"],
    [style*="max-width:500px"],
    [style*="max-width:600px"] {
        max-width: calc(100vw - 2rem) !important;
        width: 100% !important;
    }

    /* FLEXBOX WRAPPING */
    [style*="display: flex"] {
        flex-wrap: wrap !important;
    }

    /* PREVENT OVERFLOW */
    * {
        word-wrap: break-word !important;
        overflow-wrap: break-word !important;
    }

    img {
        max-width: 100% !important;
        height: auto !important;
    }

    pre,
    code {
        overflow-x: auto !important;
        max-width: 100% !important;
    }

    /* SPECIFIC COMPONENTS */
    .detail-grid,
    .stats-grid,
    .variant-detail-card {
        grid-template-columns: 1fr !important;
        gap: 1rem !important;
    }

    .compact-header {
        flex-direction: column !important;
        align-items: flex-start !important;
    }

    .preview-mockup {
        max-width: 100% !important;
    }

    .badge {
        font-size: 0.65rem !important;
        padding: 0.2rem 0.5rem !important;
    }
}

/* Tablet */
@media (min-width: 769px) and (max-width: 1024px) {
    .dashboard-grid {
        grid-template-columns: 200px 1fr;
    }
}

/* Utils */
pre {
    background: #020617 !important;
    padding: 1rem !important;
    border: 1px solid var(--border);
    border-radius: 0.375rem;
    overflow-x: auto;
    font-family: 'Fira Code', 'Courier New', monospace;
    font-size: 0.8rem;
    color: #e2e8f0 !important;
    margin: 0;
}