:root {
    --bg-dark: #0f172a;
    --bg-panel: #1e293b;
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --accent: #3b82f6;
    --accent-hover: #2563eb;
    --danger: #ef4444;
    --border: #334155;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: var(--bg-dark);
    color: var(--text-main);
    margin: 0;
    height: 100vh;
    overflow: hidden;
}

/* Authentication Screen */
.view-container { height: 100%; width: 100%; }
#auth-view { display: flex; justify-content: center; align-items: center; }
.auth-box { background: var(--bg-panel); padding: 40px; border-radius: 12px; border: 1px solid var(--border); width: 350px; text-align: center; }
.auth-box input { width: 90%; padding: 10px; margin-bottom: 15px; border-radius: 6px; border: 1px solid var(--border); background: var(--bg-dark); color: white; }
.auth-box button { width: 100%; padding: 12px; background: var(--accent); color: white; border: none; border-radius: 6px; cursor: pointer; font-weight: bold; }
.error-msg { color: var(--danger); margin-top: 10px; font-size: 0.9rem; }
a { color: var(--accent); text-decoration: none; }

/* Dashboard Layout */
#dashboard-view { display: flex; }

/* Sidebar Notifications */
.sidebar { width: 300px; background: var(--bg-panel); border-right: 1px solid var(--border); display: flex; flex-direction: column; }
.sidebar-header { padding: 20px; border-bottom: 1px solid var(--border); }
.notification-list { flex-grow: 1; overflow-y: auto; padding: 10px; }
.sidebar-footer { padding: 20px; border-top: 1px solid var(--border); text-align: center;}
.btn-secondary { background: transparent; border: 1px solid var(--border); color: var(--text-muted); width: 100%; padding: 10px; border-radius: 6px; cursor: pointer;}

/* Main Content & App Grid */
.main-content { flex-grow: 1; padding: 40px; overflow-y: auto; }
header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 40px; border-bottom: 1px solid var(--border); padding-bottom: 20px;}
.btn-admin { background: #8b5cf6; color: white; border: none; padding: 10px 15px; border-radius: 6px; cursor: pointer; }

.app-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 25px; }

/* --- PHASE 3: Cleaner App Tiles --- */
.app-tile { background: var(--bg-panel); border: 1px solid var(--border); border-radius: 12px; padding: 40px 20px; text-align: center; cursor: pointer; position: relative; transition: all 0.2s; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.app-tile:hover { border-color: var(--accent); transform: translateY(-3px); }
.app-icon { font-size: 3rem; margin-bottom: 15px; }
.app-tile h3 { margin: 0; font-size: 1.2rem; font-weight: 600; }
.app-tile p { margin: 0; color: var(--text-muted); font-size: 0.9rem; }

/* The Badge */
.badge { position: absolute; top: -10px; right: -10px; background: var(--danger); color: white; border-radius: 50%; width: 28px; height: 28px; display: flex; justify-content: center; align-items: center; font-weight: bold; font-size: 0.9rem; box-shadow: 0 2px 4px rgba(0,0,0,0.5); }

/* --- PHASE 3: Clearable Notifications --- */
.notif-card { background: var(--bg-dark); padding: 12px; border-radius: 8px; margin-bottom: 10px; border-left: 4px solid var(--accent); position: relative; padding-right: 30px; transition: transform 0.2s; }
.notif-card:hover { transform: translateX(5px); }
.notif-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 5px; }
.notif-title { font-size: 0.95rem; font-weight: bold; color: var(--text-main); margin: 0; }
.btn-clear-notif { position: absolute; top: 10px; right: 10px; background: transparent; border: none; color: var(--text-muted); font-size: 1.2rem; cursor: pointer; line-height: 1; }
.btn-clear-notif:hover { color: var(--danger); }
.notif-body { font-size: 0.85rem; color: var(--text-muted); cursor: pointer; }

/* --- PHASE 3: Admin Modal --- */
.modal { position: fixed; z-index: 1000; left: 0; top: 0; width: 100%; height: 100%; background-color: rgba(0,0,0,0.6); display: flex; align-items: center; justify-content: center; }
.modal-content { background-color: var(--bg-panel); border: 1px solid var(--border); border-radius: 12px; width: 90%; max-width: 600px; max-height: 80vh; display: flex; flex-direction: column; }
.modal-header { padding: 20px; border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; align-items: center; }
.modal-header h2 { margin: 0; }
.close-btn { font-size: 1.5rem; cursor: pointer; color: var(--text-muted); }
.close-btn:hover { color: white; }
.admin-users-list { padding: 20px; overflow-y: auto; }
.user-row { background: var(--bg-dark); padding: 15px; border-radius: 8px; margin-bottom: 15px; border: 1px solid var(--border); }
.user-row h4 { margin: 0 0 10px 0; color: var(--accent); }
.user-settings { display: flex; gap: 10px; align-items: center; margin-bottom: 10px;}
.user-settings input { padding: 8px; border-radius: 4px; border: 1px solid var(--border); background: var(--bg-panel); color: white; width: 100%;}
.btn-save-user { background: var(--accent); color: white; border: none; padding: 8px 15px; border-radius: 4px; cursor: pointer; }
.btn-save-user:hover { background: var(--accent-hover); }

/* --- PHASE 4: LIGHT MODE VARIABLES --- */
body.light-mode {
    --bg-dark: #f0f4f8;
    --bg-panel: #ffffff;
    --text-main: #0f172a;
    --text-muted: #64748b;
    --border: #cbd5e1;
}

/* Header & Logo */
.brand { display: flex; align-items: center; gap: 15px; }
.logo { 
    height: 40px; 
    width: auto; 
    max-width: 180px; 
    object-fit: contain; 
}
.header-controls { display: flex; align-items: center; gap: 15px; }
.btn-icon { background: var(--bg-panel); border: 1px solid var(--border); color: var(--text-main); font-size: 1.2rem; padding: 8px 12px; border-radius: 6px; cursor: pointer; transition: 0.2s; }
.btn-icon:hover { background: var(--bg-dark); }

/* --- PHASE 4: TABBED SETTINGS MODAL --- */
.settings-container {
    background-color: var(--bg-panel); border: 1px solid var(--border);
    border-radius: 12px; width: 90%; max-width: 900px; height: 80vh;
    display: flex; overflow: hidden;
}
.settings-sidebar {
    width: 250px; background-color: var(--bg-dark); border-right: 1px solid var(--border);
    padding: 20px; display: flex; flex-direction: column; gap: 10px;
}
.settings-sidebar h3 { margin-top: 0; margin-bottom: 20px; color: var(--text-muted); text-transform: uppercase; font-size: 0.85rem; letter-spacing: 1px;}
.tab-btn {
    background: transparent; border: none; color: var(--text-main); text-align: left;
    padding: 12px 15px; border-radius: 6px; cursor: pointer; font-size: 1rem; transition: 0.2s;
}
.tab-btn:hover { background: var(--bg-panel); }
.tab-btn.active { background: var(--accent); color: white; font-weight: bold; }

.settings-content { flex-grow: 1; display: flex; flex-direction: column; background: var(--bg-panel);}
.settings-body { padding: 30px; overflow-y: auto; flex-grow: 1; }
.tab-pane { animation: fadeIn 0.3s ease-in-out; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: translateY(0); } }