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

:root {
    /* Modern SaaS Colors */
    --primary: #4f46e5;
    --primary-hover: #4338ca;
    --secondary: #6b7280;
    --secondary-hover: #4b5563;
    --success: #10b981;
    --danger: #ef4444;
    --danger-hover: #dc2626;
    --info: #0ea5e9;

    --bg-body: #f3f4f6;
    --bg-card: #ffffff;
    --text-main: #111827;
    --text-muted: #6b7280;
    --border: #e5e7eb;

    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --radius: 12px;
    --font-family: 'Inter', system-ui, -apple-system, sans-serif;

    /* Legacy fallbacks for inline styles */
    --light: var(--bg-body);
    --dark: var(--text-main);
}

body.dark-mode {
    --bg-body: #111827;
    --bg-card: #1f2937;
    --text-main: #f9fafb;
    --text-muted: #9ca3af;
    --border: #374151;
    --shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.5);
    --shadow-sm: 0 1px 2px 0 rgba(0,0,0,0.3);
    --light: var(--bg-body);
}

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

body { 
    font-family: var(--font-family); 
    background-color: var(--bg-body); 
    color: var(--text-main); 
    line-height: 1.5; 
    padding: 30px 20px; 
    transition: background-color 0.3s, color 0.3s; 
}

/* Layout */
.container { 
    max-width: 1200px; 
    margin: 0 auto; 
    background: var(--bg-card); 
    border-radius: var(--radius); 
    padding: 30px; 
    box-shadow: var(--shadow); 
    transition: background-color 0.3s; 
}

body.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 20px;
}

/* Typography & Headers */
header { 
    display: flex; justify-content: space-between; align-items: center; 
    margin-bottom: 24px; padding-bottom: 20px; border-bottom: 1px solid var(--border); 
    flex-wrap: wrap; gap: 15px;
}
h1, h2, h3 { color: var(--text-main); font-weight: 600; letter-spacing: -0.02em; }
h1 { font-size: 24px; }
h2 { font-size: 20px; }

/* Buttons */
.btn { 
    display: inline-flex; align-items: center; justify-content: center; 
    gap: 8px; padding: 8px 16px; border: none; border-radius: 8px; 
    cursor: pointer; font-weight: 500; font-size: 14px; 
    transition: all 0.2s ease-in-out; text-decoration: none; 
    box-shadow: var(--shadow-sm);
}
.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { background: var(--primary-hover); transform: translateY(-1px); }
.btn-danger { background: var(--danger); color: white; }
.btn-danger:hover { background: var(--danger-hover); transform: translateY(-1px); }
.btn-secondary { background: var(--secondary); color: white; }
.btn-secondary:hover { background: var(--secondary-hover); transform: translateY(-1px); }

/* Forms */
.form-group { margin-bottom: 20px; }
.form-group label { display: block; margin-bottom: 8px; font-size: 14px; font-weight: 500; color: var(--text-main); }
.form-control { 
    width: 100%; padding: 10px 14px; border: 1px solid var(--border); 
    border-radius: 8px; background: var(--bg-card); color: var(--text-main); 
    font-family: inherit; font-size: 14px; transition: all 0.2s; 
}
.form-control:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.2); }

/* Tables */
.table-responsive { overflow-x: auto; border-radius: 8px; border: 1px solid var(--border); background: var(--bg-card); }
table { width: 100%; border-collapse: collapse; white-space: nowrap; }
th, td { padding: 14px 16px; text-align: left; border-bottom: 1px solid var(--border); font-size: 14px; }
th { background-color: var(--bg-body); color: var(--text-muted); font-size: 12px; text-transform: uppercase; letter-spacing: 0.05em; font-weight: 600; cursor: pointer; user-select: none; }
th:hover { background-color: rgba(0,0,0,0.05); }
body.dark-mode th:hover { background-color: rgba(255,255,255,0.05); }
tbody tr { transition: background-color 0.2s; }
tbody tr:hover { background-color: rgba(0,0,0,0.02); }
body.dark-mode tbody tr:hover { background-color: rgba(255,255,255,0.02); }
tbody tr:last-child td { border-bottom: none; }

/* Badges */
.badge { padding: 4px 10px; border-radius: 20px; font-size: 12px; font-weight: 600; }
.badge-open { background: rgba(239, 68, 68, 0.1); color: var(--danger); }
.badge-mitigated { background: rgba(16, 185, 129, 0.1); color: var(--success); }
.score-high { color: var(--danger); font-weight: 600; }
.score-medium { color: #f59e0b; font-weight: 600; }
.score-low { color: var(--success); font-weight: 600; }

/* Modals */
.modal { display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.5); backdrop-filter: blur(4px); align-items: center; justify-content: center; z-index: 1000; opacity: 0; transition: opacity 0.2s; }
.modal.active { display: flex; opacity: 1; }
.modal-content { background: var(--bg-card); padding: 30px; border-radius: var(--radius); width: 100%; max-width: 600px; box-shadow: var(--shadow-lg); transform: scale(0.95); transition: transform 0.2s; max-height: 90vh; overflow-y: auto; }
.modal.active .modal-content { transform: scale(1); }
.modal-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 24px; border-bottom: 1px solid var(--border); padding-bottom: 15px; }
.close { font-size: 24px; cursor: pointer; color: var(--text-muted); transition: color 0.2s; line-height: 1; }
.close:hover { color: var(--danger); }

/* Utilities */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.login-card { max-width: 400px; width: 100%; background: var(--bg-card); padding: 40px 30px; border-radius: var(--radius); box-shadow: var(--shadow-lg); }
.login-card h2 { text-align: center; margin-bottom: 24px; }
.login-card .form-group { text-align: left; }
.error { color: var(--danger); font-size: 14px; margin-bottom: 20px; background: rgba(239, 68, 68, 0.1); padding: 12px; border-radius: 8px; text-align: center; }

/* Dashboard adjustments */
#notesPreview { background: var(--bg-body); border-color: var(--border); color: var(--text-main); padding: 15px; border-radius: 8px; }