/* --- Core Variables (Matched to Mockup Aesthetics) --- */
:root {
    --bg-page: #f8f9fc;
    --bg-surface: #ffffff;
    --text-main: #1e293b;
    --text-muted: #64748b;
    --accent-blue: #0d6efd;
    --danger-red: #ef4444;
    --warning-orange: #f59e0b;
    --success-green: #10b981;
    --border-light: #e2e8f0;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.05);
    --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.05), 0 2px 4px -1px rgba(0,0,0,0.03);
    --radius-lg: 12px;
    --radius-md: 8px;
}

/* --- Resets & Base --- */
* { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background-color: var(--bg-page);
    color: var(--text-main);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

/* --- Header Styling (Exact match to screenshot) --- */
.app-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 2rem;
    background: var(--bg-surface);
    border-bottom: 1px solid var(--border-light);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-left { display: flex; align-items: center; gap: 0.75rem; }
.logo-icon { color: var(--accent-blue); }
.logo-text { font-size: 1.25rem; font-weight: 700; color: var(--accent-blue); letter-spacing: -0.02em; }

.header-right { display: flex; align-items: center; gap: 1rem; }
.user-badge { 
    background: #e0e7ff; color: var(--accent-blue); font-weight: 600; 
    font-size: 0.85rem; padding: 0.4rem 0.5rem; border-radius: 50%; letter-spacing: 1px;
}
.user-name { font-weight: 500; font-size: 0.9rem; }
.outline-btn { 
    border: 1px solid var(--border-light); background: transparent; 
    padding: 0.4rem 0.8rem; border-radius: var(--radius-md); 
    font-size: 0.85rem; color: var(--text-main); text-decoration: none; transition: all 0.2s;
}
.outline-btn:hover { border-color: var(--accent-blue); color: var(--accent-blue); }

/* --- Admin Dashboard Grid Layout --- */
.admin-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 1.5rem;
    padding: 2rem;
    max-width: 1400px;
    margin: 0 auto;
}

.welcome-card { grid-column: 1 / 2; display: flex; justify-content: space-between; align-items: center; }
.risk-card { grid-column: 2 / 3; }
.wide-card { grid-column: 1 / 2; }
.quick-actions-card { grid-column: 2 / 3; }

@media (max-width: 1024px) {
    .admin-grid { grid-template-columns: 1fr; }
    .welcome-card, .risk-card, .wide-card, .quick-actions-card { grid-column: 1 / -1; }
    .welcome-card { flex-direction: column; align-items: flex-start; gap: 2rem; }
}

/* --- Card Aesthetics --- */
.card {
    background: var(--bg-surface);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    box-shadow: var(--shadow-sm);
}

.card-header h2 { 
    font-size: 1rem; font-weight: 600; color: var(--text-main); 
    margin-bottom: 1.5rem; padding-bottom: 0; border: none;
}

/* --- Component: Welcome Row --- */
.welcome-text h1 { font-size: 2rem; font-weight: 700; line-height: 1.2; margin-bottom: 0.5rem; }
.text-primary { color: var(--accent-blue); }
.welcome-text p { color: var(--text-muted); font-size: 0.95rem; }

.trust-score { display: flex; justify-content: center; align-items: center; }
.score-circle {
    width: 140px; height: 140px; border-radius: 50%;
    border: 8px solid var(--accent-blue);
    display: flex; flex-direction: column; justify-content: center; align-items: center;
}
.score-number { font-size: 2.5rem; font-weight: 700; line-height: 1; }
.score-label { font-size: 0.9rem; font-weight: 500; }

.metrics-list { display: flex; flex-direction: column; gap: 1.5rem; }
.metric-item { display: flex; align-items: center; gap: 1rem; }
.metric-icon { 
    width: 48px; height: 48px; border-radius: var(--radius-md); 
    display: flex; align-items: center; justify-content: center; font-size: 1.5rem; 
}
.metric-data { display: flex; flex-direction: column; }
.metric-val { font-size: 1.25rem; font-weight: 700; line-height: 1; }
.metric-label { font-size: 0.8rem; color: var(--text-muted); margin-top: 0.2rem; }

/* --- Component: Risk Feed --- */
.event-list { list-style: none; }
.risk-item { display: flex; align-items: flex-start; gap: 1rem; margin-bottom: 1.25rem; }
.risk-icon { 
    width: 24px; height: 24px; border-radius: 50%; display: flex; 
    align-items: center; justify-content: center; color: white; font-weight: bold; font-size: 0.8rem;
}
.danger-icon { background: var(--danger-red); }
.warning-icon { background: var(--warning-orange); }
.risk-details { display: flex; flex-direction: column; }
.risk-details strong { font-size: 0.9rem; color: var(--text-main); }
.risk-details span { font-size: 0.8rem; color: var(--text-muted); }

/* --- Component: Split Lists (Bottom Left) --- */
.split-lists { display: grid; grid-template-columns: 1fr 1fr; gap: 2rem; }
.list-container h3 { font-size: 0.9rem; color: var(--text-muted); font-weight: 600; margin-bottom: 1rem; text-transform: uppercase; letter-spacing: 0.05em; }
#audit-log-feed li, #user-list-feed li {
    padding: 1rem 0; border-bottom: 1px solid var(--border-light); font-size: 0.9rem;
}
#audit-log-feed li:last-child, #user-list-feed li:last-child { border-bottom: none; }

@media (max-width: 768px) {
    .split-lists { grid-template-columns: 1fr; }
}

/* --- Component: Quick Actions Grid --- */
.grid-actions { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1rem; }
.action-btn { 
    padding: 1.5rem 1rem; background: var(--bg-surface); border: 1px solid var(--border-light); 
    border-radius: var(--radius-md); cursor: pointer; display: flex; flex-direction: column; 
    align-items: center; gap: 0.5rem; transition: all 0.2s ease; font-weight: 500; color: var(--text-main);
}
.btn-icon { font-size: 1.5rem; }
.action-btn:hover { border-color: var(--accent-blue); box-shadow: var(--shadow-sm); transform: translateY(-2px); color: var(--accent-blue); }

/* --- Animations & Utilities --- */
@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
@keyframes slideDown { from { transform: translateY(-100%); } to { transform: translateY(0); } }
.fade-in { animation: fadeIn 0.4s ease-out forwards; }
.slide-down { animation: slideDown 0.3s ease-out forwards; }
.text-danger { color: var(--danger-red); }
.text-btn { background: none; border: none; cursor: pointer; }

/* --- Modal System & Forms --- */
.modal-overlay {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(15, 23, 42, 0.6); backdrop-filter: blur(4px);
    display: flex; align-items: center; justify-content: center;
    z-index: 1000; opacity: 1; transition: opacity 0.2s ease;
}
.modal-overlay.hidden { display: none; opacity: 0; }

.modal-content {
    background: var(--bg-surface); width: 100%; max-width: 450px;
    border-radius: var(--radius-lg); box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
    overflow: hidden;
}

.modal-header {
    display: flex; justify-content: space-between; align-items: center;
    padding: 1.25rem 1.5rem; border-bottom: 1px solid var(--border-light);
}
.modal-header h3 { font-size: 1.1rem; margin: 0; font-weight: 600; }
.close-btn { font-size: 1.5rem; color: var(--text-muted); cursor: pointer; border: none; background: none; }
.close-btn:hover { color: var(--danger-red); }

.modal-body { padding: 1.5rem; }
.form-group { margin-bottom: 1.25rem; }
.form-group label { display: block; margin-bottom: 0.5rem; font-size: 0.9rem; font-weight: 500; color: var(--text-main); }
.form-control {
    width: 100%; padding: 0.75rem; border: 1px solid var(--border-light);
    border-radius: var(--radius-md); font-family: inherit; font-size: 0.95rem; transition: border-color 0.2s;
}
.form-control:focus { outline: none; border-color: var(--accent-blue); box-shadow: 0 0 0 3px rgba(13, 110, 253, 0.1); }

.btn-primary {
    background: var(--accent-blue); color: white; border: none;
    padding: 0.75rem 1.5rem; border-radius: var(--radius-md); cursor: pointer;
    font-weight: 600; width: 100%; transition: background 0.2s; font-size: 1rem;
}
.btn-primary:hover { background: #0b5ed7; }

/* ==========================================================================
   LAUNCHPAD GRID LAYOUT (Restored)
   ========================================================================== */
.launchpad-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.5rem;
    padding: 3rem 2rem;
    max-width: 1200px;
    margin: 0 auto;
}

.app-tile {
    background: var(--bg-surface);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    padding: 2.5rem 2rem;
    text-align: center;
    text-decoration: none;
    color: inherit;
    transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.2s ease;
    display: block;
}
.app-tile p { color: var(--text-muted); font-size: 0.9rem; margin-top: 0.5rem; }
.tile-icon { font-size: 2.5rem; margin-bottom: 1rem; }
.hover-lift:hover { transform: translateY(-4px); box-shadow: var(--shadow-md); border-color: var(--accent-blue); }