/* --- 1. Variables & Reset --- */
:root {
    /* "Established Authority" Palette */
    --bg-body: #f8fafc;       /* Light Slate - Reduces eye strain */
    --bg-sidebar: #0f172a;    /* Deep Navy - Anchors the navigation */
    --bg-card: #ffffff;       /* Pure White - Data separation */
    --bg-input: #ffffff;      
    
    /* Branding & Actions */
    --primary: #2563eb;       /* Royal Blue - Active links/buttons */
    --primary-hover: #1d4ed8; /* Darker Blue for hover */
    --accent: #0f172a;        /* Navy for headers/emphasis */
    
    /* Text Colors */
    --text-main: #334155;     /* Charcoal - Softer than black */
    --text-muted: #64748b;    /* Slate Gray - Secondary text */
    --text-sidebar: #f1f5f9;  /* Off-white for sidebar readability */
    
    /* Status Colors (Muted/Professional) */
    --success: #10b981;       /* Emerald */
    --danger: #ef4444;        /* Red */
    --warning: #f59e0b;       /* Amber */
    
    /* Borders & Spacing */
    --border-color: #e2e8f0;  /* Light gray for subtle definition */
    --radius: 6px;            /* Tighter radius for a "banking" feel */
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

* { box-sizing: border-box; }

body { 
    margin: 0; 
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif; 
    background-color: var(--bg-body);
    color: var(--text-main);
    display: flex;
    min-height: 100vh;
    overflow-x: hidden;
    line-height: 1.5;
}

/* Links */
a { 
    color: var(--primary); 
    text-decoration: none; 
    font-weight: 500; 
    transition: color 0.2s;
}
a:hover { 
    color: var(--primary-hover); 
    text-decoration: underline; 
}

/* --- 2. Layout & Sidebar --- */
.container { 
    display: flex; 
    width: 100%; 
}

aside { 
    width: 250px; 
    background: var(--bg-sidebar); 
    color: var(--text-sidebar);
    padding: 24px 16px; 
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
}

aside h3 {
    color: #94a3b8; /* Light Slate for Sidebar Headers */
    text-transform: uppercase;
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    margin-bottom: 16px;
    padding-left: 12px;
}

aside ul { list-style: none; padding: 0; margin: 0; }
aside li { margin-bottom: 4px; }

aside li a {
    display: flex;
    align-items: center;
    padding: 10px 12px;
    color: #cbd5e1; /* Off-white/Gray */
    border-radius: var(--radius);
    font-weight: 500;
    font-size: 0.9rem;
    transition: all 0.2s ease;
    text-decoration: none;
}

/* Sidebar Hover/Active */
aside li a:hover,
aside li.active a {
    background: rgba(255, 255, 255, 0.1);
    color: #ffffff;
}

/* Specific Active State Styling */
aside li.active a {
    border-left: 3px solid var(--primary);
    padding-left: 9px; /* Compensate for the 3px border to keep alignment */
    background: rgba(255, 255, 255, 0.15);
}

aside hr {
    border: 0;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    margin: 20px 0;
}

/* --- 3. Main Content --- */
main { 
    flex: 1; 
    padding: 40px; 
    max-width: 1100px; 
    margin: 0 auto;
}

h1, h2, h3 { 
    color: var(--accent); 
    font-weight: 700; 
    margin-top: 0; 
}
h2 { 
    margin-bottom: 24px; 
    font-size: 1.75rem; 
    letter-spacing: -0.025em; 
}

/* --- 4. Cards (Surfaces) --- */
.card {
    background: var(--bg-card);
    padding: 24px;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    margin-bottom: 24px;
    border: 1px solid var(--border-color);
}

.card-danger { 
    border-left: 4px solid var(--danger); 
}

/* --- 5. Forms & Inputs --- */
label { 
    color: var(--text-main); 
    font-weight: 600;
    font-size: 0.9rem; 
    margin-bottom: 6px; 
    display: block; 
}

input[type="text"], 
input[type="email"], 
input[type="password"], 
input[type="date"], 
input[type="url"], 
textarea,
select {
    width: 100%;
    padding: 10px 12px;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    color: var(--text-main);
    margin-bottom: 16px;
    font-family: inherit;
    font-size: 0.95rem;
    transition: border-color 0.2s, box-shadow 0.2s;
}

input:focus, textarea:focus, select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1); /* Subtle blue glow ring */
}

input[type="file"] {
    padding: 6px;
    border: 1px dashed var(--border-color);
    background: #f8fafc;
}

/* --- 6. Buttons --- */
.btn { 
    display: inline-flex; 
    align-items: center;
    justify-content: center;
    padding: 10px 20px; 
    background: var(--primary); 
    color: white; 
    font-weight: 600;
    border: 1px solid transparent; 
    border-radius: var(--radius); 
    cursor: pointer; 
    font-size: 0.95rem; 
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
    transition: background-color 0.2s, transform 0.1s;
}

.btn:hover { 
    background-color: var(--primary-hover); 
    text-decoration: none;
    color: white;
}

.btn:active {
    transform: translateY(1px);
}

.btn-red { 
    background-color: var(--danger); 
    color: white;
}
.btn-red:hover { background-color: #dc2626; }

.btn-green { 
    background-color: var(--success); 
    color: white;
}
.btn-green:hover { background-color: #059669; }

.btn-gray { 
    background-color: white; 
    color: var(--text-main); 
    border: 1px solid var(--border-color);
}
.btn-gray:hover { 
    background-color: #f1f5f9; 
    color: var(--text-main);
}

.btn-icon {
    width: 36px; height: 36px;
    border-radius: 4px;
    padding: 0;
    font-size: 1.2rem;
}

/* --- 7. Tables --- */
table { 
    width: 100%; 
    border-collapse: collapse; 
    margin-top: 12px; 
    font-size: 0.95rem;
}

th { 
    text-align: left; 
    color: var(--text-muted); 
    font-weight: 600; 
    padding: 12px 16px; 
    text-transform: uppercase; 
    font-size: 0.75rem; 
    letter-spacing: 0.05em;
    border-bottom: 2px solid var(--border-color);
    background-color: #f8fafc;
}

td { 
    background: white; 
    padding: 14px 16px; 
    color: var(--text-main);
    border-bottom: 1px solid var(--border-color);
    vertical-align: middle;
}

tr:last-child td { border-bottom: none; }
tr:hover td { background-color: #f8fafc; }

/* --- 8. Alerts & Utilities --- */
.alert { 
    padding: 14px 16px 14px 46px; /* Increased left padding to make room for the icon */
    margin-bottom: 20px; 
    border-radius: var(--radius); 
    font-weight: 500;
    display: block; /* Changed from flex to block so h4 and p stack naturally */
    position: relative; /* Allows us to position the icon inside */
    border: 1px solid transparent;
    font-size: 0.95rem;
}

/* Target the icons (✔, ✖, ⚠) and pin them to the left */
.alert::before {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%); /* Keeps the icon perfectly centered vertically */
    margin-right: 0; 
}

.alert-success { 
    background-color: #ecfdf5; 
    color: #065f46; 
    border-color: #a7f3d0; 
}
.alert-success::before { content: "✔"; font-weight: bold; }

.alert-error { 
    background-color: #fef2f2; 
    color: #991b1b; 
    border-color: #fecaca; 
}
.alert-error::before { content: "✖"; font-weight: bold; }

.alert-warning { 
    background-color: #fffbeb; 
    color: #92400e; 
    border-color: #fde68a; 
}
.alert-warning::before { content: "⚠"; font-weight: bold; }

.iframe-container { 
    width: 100%; height: 500px; 
    border: 1px solid var(--border-color); 
    background: #f1f5f9; 
    border-radius: var(--radius); 
}

/* Helper Classes */
.flex-row { display: flex; gap: 24px; flex-wrap: wrap; }
.flex-col { flex: 1; min-width: 300px; }
.mt-20 { margin-top: 24px; }
.input-group { display: flex; gap: 8px; margin-bottom: 12px; align-items: center; }
.input-group input { margin-bottom: 0; }
.text-right { text-align: right; }
.text-small { font-size: 0.875rem; color: var(--text-muted); }
