:root {
    --color-primary: #0f172a;
    /* Slate 900 */
    --color-primary-light: #1e293b;
    /* Slate 800 */
    --color-accent: #2563eb;
    /* Blue 600 */
    --color-accent-hover: #1d4ed8;
    /* Blue 700 */
    --color-success: #10b981;
    /* Emerald 500 */
    --color-warning: #f59e0b;
    /* Amber 500 */
    --color-danger: #ef4444;
    /* Red 500 */
    --color-bg: #f8f9fa;
    /* Gray 50 */
    --color-surface: #ffffff;
    --color-border: #e2e8f0;
    /* Slate 200 */
    --color-text-main: #1e293b;
    /* Slate 800 */
    --color-text-muted: #64748b;
    /* Slate 500 */

    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);

    --radius-md: 0.375rem;
    --radius-lg: 0.5rem;

    --font-sans: 'Inter', sans-serif;
}

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

body {
    font-family: var(--font-sans);
    background-color: var(--color-bg);
    color: var(--color-text-main);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

/* Utilities */
.hidden {
    display: none !important;
}

.truncate {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 200px;
}

.text-success {
    color: var(--color-success) !important;
}

.text-warning {
    color: var(--color-warning) !important;
}

.text-danger {
    color: var(--color-danger) !important;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    font-weight: 500;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 0.2s;
    border: 1px solid transparent;
}

.btn-primary {
    background-color: var(--color-accent);
    color: white;
}

.btn-primary:hover {
    background-color: var(--color-accent-hover);
}

.btn-secondary {
    background-color: white;
    border-color: var(--color-border);
    color: var(--color-text-main);
}

.btn-secondary:hover {
    background-color: var(--color-bg);
}

.btn-text {
    background: none;
    color: var(--color-text-muted);
}

.btn-text:hover {
    color: var(--color-text-main);
}

.btn-full {
    width: 100%;
}

/* Cards */
.card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    padding: 1.5rem;
}

/* Screen Layouts */
.screen {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.screen.active {
    animation: fadeIn 0.3s ease-in-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(5px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Login - Split Layout */
#login-screen {
    background: #f8fafc;
    flex-direction: row;
}

.login-split-container {
    display: flex;
    width: 100%;
    height: 100vh;
}

/* Left Side: Visual */
.login-visual-side {
    flex: 1;
    background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    padding: 3rem;
}

.login-visual-side::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url('data:image/svg+xml,<svg width="100" height="100" viewBox="0 0 100 100" xmlns="http://www.w3.org/2000/svg"><circle cx="50" cy="50" r="40" stroke="rgba(255,255,255,0.05)" stroke-width="2" fill="none"/></svg>') 0 0/50px 50px;
    opacity: 0.2;
}

.visual-content {
    position: relative;
    z-index: 10;
    max-width: 480px;
}

.logo-large {
    font-size: 2.5rem;
    font-weight: 800;
    margin-bottom: 1.5rem;
    letter-spacing: -0.02em;
}

.visual-content h2 {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 1rem;
    line-height: 1.2;
}

.visual-content p {
    font-size: 1.125rem;
    color: #94a3b8;
    margin-bottom: 2rem;
    line-height: 1.6;
}

.feature-pills {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.feature-pills span {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    padding: 0.5rem 1rem;
    border-radius: 9999px;
    font-size: 0.875rem;
    font-weight: 500;
    backdrop-filter: blur(4px);
}

/* Right Side: Form */
.login-form-side {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    background: #ffffff;
    position: relative;
}

.glass-panel {
    width: 100%;
    max-width: 420px;
    padding: 2.5rem;
    background: rgba(255, 255, 255, 0.9);
    border: none;
    box-shadow: none;
    /* Reset card shadow if replacing */
}

/* Input Animation */
.animated-input {
    position: relative;
    margin-bottom: 1.5rem;
}

.animated-input label {
    position: absolute;
    left: 0.75rem;
    top: 0.75rem;
    color: var(--color-text-muted);
    font-size: 1rem;
    transition: all 0.2s;
    pointer-events: none;
    background: transparent;
    padding: 0 0.25rem;
    font-weight: 400;
}

.animated-input input {
    height: 3rem;
    padding: 0.75rem;
    font-size: 1rem;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    background: #f8fafc;
    transition: all 0.2s;
}

.animated-input input:focus,
.animated-input input:not(:placeholder-shown) {
    background: white;
    border-color: var(--color-accent);
}

.animated-input input:focus+label,
.animated-input input:not(:placeholder-shown)+label {
    top: -0.5rem;
    left: 0.5rem;
    font-size: 0.75rem;
    color: var(--color-accent);
    background: white;
    font-weight: 600;
}

/* Checkbox & Options */
.form-options {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    font-size: 0.875rem;
}

.checkbox-container {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    user-select: none;
    color: var(--color-text-muted);
}

.forgot-password {
    color: var(--color-accent);
    text-decoration: none;
    font-weight: 500;
}

.btn-lg {
    height: 3rem;
    font-size: 1rem;
    font-weight: 600;
}

/* Dashboard */
.app-header {
    background: var(--color-surface);
    border-bottom: 1px solid var(--color-border);
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 1rem;
    font-size: 0.875rem;
}

.role-badge {
    background: #f1f5f9;
    padding: 0.25rem 0.5rem;
    border-radius: var(--radius-md);
    font-size: 0.75rem;
    color: var(--color-text-muted);
}

.dashboard-content {
    padding: 2rem;
    max-width: 1200px;
    margin: 0 auto;
    width: 100%;
}

.dashboard-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stat-card h3 {
    font-size: 0.875rem;
    color: var(--color-text-muted);
    font-weight: 500;
}

.stat-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--color-primary);
    margin: 0.5rem 0;
}

.stat-value.warning {
    color: var(--color-warning);
}

.stat-value.success {
    color: var(--color-success);
}

.stat-trend {
    font-size: 0.75rem;
    font-weight: 500;
}

.stat-trend.neutral {
    color: var(--color-text-muted);
}

.stat-trend.negative {
    color: var(--color-warning);
}

.stat-trend.positive {
    color: var(--color-success);
}

.stat-indicator.online {
    display: inline-block;
    width: 8px;
    height: 8px;
    background: var(--color-success);
    border-radius: 50%;
    margin-left: 0.5rem;
}

/* Table */
.table-container {
    padding: 0;
    overflow: hidden;
}

.table-header {
    padding: 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--color-border);
}

.table-actions {
    display: flex;
    gap: 0.5rem;
}

.search-input,
.filter-select {
    padding: 0.5rem;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    font-size: 0.875rem;
}

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

.data-table th {
    background: #f8fafc;
    padding: 0.75rem 1.5rem;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--color-text-muted);
    font-weight: 600;
    border-bottom: 1px solid var(--color-border);
}

.data-table td {
    padding: 1rem 1.5rem;
    font-size: 0.875rem;
    border-bottom: 1px solid var(--color-border);
    color: var(--color-text-main);
}

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

/* Status Badges */
.status-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
}

.status-cleared {
    background: #dcfce7;
    color: #166534;
}

.status-flagged {
    background: #fee2e2;
    color: #991b1b;
}

.status-review {
    background: #fef3c7;
    color: #92400e;
}

/* Upload Screen */
.upload-content {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
}

.upload-card {
    max-width: 600px;
    width: 100%;
    text-align: center;
}

.drop-zone {
    border: 2px dashed var(--color-border);
    border-radius: var(--radius-lg);
    padding: 3rem 1.5rem;
    margin: 2rem 0;
    cursor: pointer;
    transition: all 0.2s;
    background: #f8fafc;
}

.drop-zone:hover,
.drop-zone.dragover {
    border-color: var(--color-accent);
    background: #eff6ff;
}

.drop-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

.upload-requirements {
    text-align: left;
    background: #f1f5f9;
    padding: 1rem;
    border-radius: var(--radius-md);
    font-size: 0.8rem;
    color: var(--color-text-muted);
}

.upload-requirements ul {
    padding-left: 1.5rem;
    margin-top: 0.5rem;
}

.link-text {
    color: var(--color-accent);
    text-decoration: underline;
    cursor: pointer;
}

/* Processing Screen */
.processing-content {
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 1;
    min-height: 100vh;
    background: var(--color-bg);
}

.processing-card {
    width: 100%;
    max-width: 500px;
    text-align: center;
}

.spinner-large {
    width: 50px;
    height: 50px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid var(--color-accent);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 1.5rem;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

.progress-container {
    margin: 2rem 0;
}

.progress-bar-bg {
    background: #e2e8f0;
    height: 8px;
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 0.5rem;
}

.progress-bar-fill {
    background: var(--color-accent);
    height: 100%;
    border-radius: 4px;
    transition: width 0.3s ease;
}

.processing-log {
    text-align: left;
    height: 150px;
    overflow-y: auto;
    background: #1e293b;
    color: #00ff00;
    font-family: monospace;
    padding: 1rem;
    border-radius: var(--radius-md);
    font-size: 0.75rem;
}

.log-item {
    margin-bottom: 0.25rem;
    opacity: 0.8;
}

/* Modal */
.modal {
    position: fixed;
    inset: 0;
    z-index: 50;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(2px);
}

.modal-content {
    position: relative;
    width: 100%;
    max-width: 600px;
    z-index: 100;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--color-border);
}

.modal-header h2 {
    font-size: 1.25rem;
    margin-bottom: 0.5rem;
}

.btn-icon {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--color-text-muted);
}

.detail-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    margin: 1.5rem 0;
}

.detail-item label {
    display: block;
    font-size: 0.75rem;
    color: var(--color-text-muted);
    margin-bottom: 0.25rem;
    text-transform: uppercase;
    font-weight: 600;
}

.score-display {
    display: flex;
    align-items: baseline;
    gap: 0.25rem;
}

.score-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--color-primary);
}

.score-max {
    font-size: 0.875rem;
    color: var(--color-text-muted);
}

.ai-text {
    font-size: 0.95rem;
    color: var(--color-text-main);
    background: #f0f9ff;
    padding: 1rem;
    border-left: 4px solid var(--color-accent);
    border-radius: 0 var(--radius-md) var(--radius-md) 0;
}

.detail-actions {
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--color-border);
}

.disclaimer {
    margin-top: 1rem;
    font-size: 0.75rem;
    color: var(--color-text-muted);
    text-align: center;
    font-style: italic;
}

/* --- Mobile Responsiveness --- */
@media (max-width: 768px) {

    /* Login Screen */
    .login-split-container {
        flex-direction: column;
        height: auto;
        min-height: 100vh;
    }

    .login-visual-side {
        padding: 2rem;
        flex: 0 0 auto;
    }

    .visual-content h2 {
        font-size: 1.5rem;
    }

    .visual-content p {
        font-size: 1rem;
        margin-bottom: 1rem;
    }

    .logo-large {
        font-size: 2rem;
        margin-bottom: 1rem;
    }

    .feature-pills {
        display: none;
    }

    /* Hide pills on mobile to save space */

    .login-form-side {
        padding: 1.5rem;
        align-items: flex-start;
        /* Align to top on mobile */
    }

    .glass-panel {
        padding: 1.5rem;
        max-width: 100%;
        box-shadow: none;
        background: transparent;
    }

    /* Dashboard */
    .app-header {
        padding: 1rem;
        flex-direction: column;
        gap: 1rem;
        align-items: flex-start;
    }

    .user-profile {
        width: 100%;
        justify-content: space-between;
    }

    .dashboard-content {
        padding: 1rem;
    }

    .dashboard-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }

    .dashboard-header button {
        width: 100%;
    }

    /* Stats */
    .stats-grid {
        grid-template-columns: 1fr;
        /* Stack cards */
        gap: 1rem;
    }

    /* Table - Horizontal Scroll */
    .table-container {
        overflow-x: auto;
    }

    .table-header {
        flex-direction: column;
        gap: 1rem;
        align-items: flex-start;
    }

    .table-actions {
        width: 100%;
        flex-direction: column;
    }

    .search-input,
    .filter-select {
        width: 100%;
    }

    /* Modal */
    .modal-content {
        height: 100%;
        max-height: 100%;
        border-radius: 0;
        max-width: 100%;
        padding: 1rem;
    }

    .detail-grid {
        grid-template-columns: 1fr;
        /* Stack details */
        gap: 1rem;
    }

    .detail-actions {
        flex-direction: column-reverse;
        /* Primary button on top/first */
    }

    .detail-actions button {
        width: 100%;
    }
}