:root {
    --primary: #8a2be2;
    --primary-hover: #7b24cc;
    --bg-color: #f4f6fb;
    --text-main: #333;
    --text-muted: #6c757d;
    --glass-bg: rgba(255, 255, 255, 0.7);
    --glass-border: rgba(255, 255, 255, 0.5);
    --glass-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.05);
    --border-radius: 16px;
    --transition: all 0.3s ease;
}

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

body {
    font-family: 'Inter', sans-serif;
    background: var(--bg-color);
    background-image: radial-gradient(circle at 10% 20%, rgba(138, 43, 226, 0.05) 0%, transparent 20%),
                      radial-gradient(circle at 90% 80%, rgba(138, 43, 226, 0.05) 0%, transparent 20%);
    color: var(--text-main);
    line-height: 1.6;
    min-height: 100vh;
    overflow-x: hidden;
}

/* Glassmorphism utility */
.glass-panel {
    background: var(--glass-bg);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid var(--glass-border);
    border-radius: var(--border-radius);
    box-shadow: var(--glass-shadow);
}

/* Typography */
h1, h2, h3 { font-weight: 600; color: #1a1a1a; }
p { color: var(--text-muted); }
a { text-decoration: none; color: inherit; }

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    font-family: inherit;
    cursor: pointer;
    transition: var(--transition);
}
.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { background: var(--primary-hover); transform: translateY(-1px); }
.btn-outline { background: transparent; border: 1px solid var(--primary); color: var(--primary); }
.btn-outline:hover { background: rgba(138, 43, 226, 0.05); }
.btn-ghost { background: transparent; color: var(--text-muted); }
.btn-ghost:hover { color: var(--primary); background: rgba(138, 43, 226, 0.05); }
.btn-block { width: 100%; }
.btn-sm { padding: 6px 12px; font-size: 13px; }

/* Screens */
.screen { display: none; opacity: 0; transition: opacity 0.4s ease; min-height: 100vh; }
.screen.active { display: flex; opacity: 1; }

/* Login Screen */
#login-screen { align-items: center; justify-content: center; padding: 20px; }
.login-card { width: 100%; max-width: 400px; padding: 40px 30px; text-align: center; }
.login-header h2 { margin-bottom: 5px; font-size: 24px; }
.login-header p { margin-bottom: 30px; font-size: 14px; }

/* Forms */
.form-group { margin-bottom: 20px; text-align: left; }
.form-group label { display: block; margin-bottom: 8px; font-size: 13px; font-weight: 500; color: #555; }
.form-group input, .form-group select {
    width: 100%; padding: 12px 15px; border-radius: 8px;
    border: 1px solid #e1e4e8; background: #fff;
    font-family: inherit; font-size: 14px;
    transition: var(--transition);
}
.form-group input:focus, .form-group select:focus {
    outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(138, 43, 226, 0.1);
}
.error-msg { color: #dc3545; font-size: 13px; margin-top: 10px; display: none; }

/* Dashboard Layout */
#dashboard-screen { flex-direction: row; }

/* Sidebar */
.sidebar { width: 260px; height: 100vh; position: fixed; left: 0; top: 0; display: flex; flex-direction: column; padding: 20px 0; border-radius: 0; border-right: 1px solid var(--glass-border); border-top: none; border-bottom: none; border-left: none; }
.sidebar-brand { padding: 0 24px 30px; font-size: 18px; font-weight: 700; color: var(--primary); display: flex; align-items: center; gap: 10px; }
.nav-links { list-style: none; flex-grow: 1; }
.nav-links li { padding: 5px 15px; }
.nav-links a { display: flex; align-items: center; gap: 12px; padding: 12px 20px; border-radius: 10px; color: var(--text-muted); font-size: 15px; font-weight: 500; transition: var(--transition); }
.nav-links a:hover, .nav-links a.active { background: rgba(138, 43, 226, 0.08); color: var(--primary); }
.sidebar-footer { padding: 20px 24px 0; border-top: 1px solid rgba(0,0,0,0.05); }

/* Main Content */
.main-content { margin-left: 260px; flex-grow: 1; padding: 30px 40px; display: flex; flex-direction: column; min-height: 100vh; }
.topbar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 30px; }
.tenant-badge { background: #fff; padding: 6px 14px; border-radius: 20px; font-size: 13px; font-weight: 500; color: #555; border: 1px solid #e1e4e8; box-shadow: 0 2px 4px rgba(0,0,0,0.02); }

/* Tabs */
.tab-content { display: none; animation: fadeIn 0.4s ease; }
.tab-content.active { display: block; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

/* Stats Grid */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 20px; }
.stat-card { padding: 24px; display: flex; align-items: flex-start; gap: 16px; }
.stat-icon { width: 48px; height: 48px; border-radius: 12px; background: rgba(138, 43, 226, 0.1); color: var(--primary); display: flex; align-items: center; justify-content: center; font-size: 20px; flex-shrink: 0; }
.stat-details h3 { font-size: 13px; color: var(--text-muted); font-weight: 500; text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 4px; }
.stat-details p { font-size: 28px; font-weight: 700; color: #1a1a1a; line-height: 1; }

.mt-4 { margin-top: 24px; }
.quick-actions { padding: 24px; }
.quick-actions h2 { font-size: 16px; margin-bottom: 16px; }
.action-buttons { display: flex; gap: 12px; }

/* Config Form */
.config-form { padding: 30px; }
.config-sections { display: flex; flex-direction: column; gap: 40px; }
.config-section h2 { font-size: 16px; margin-bottom: 20px; padding-bottom: 10px; border-bottom: 1px solid rgba(0,0,0,0.05); display: flex; align-items: center; gap: 10px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 20px; }
.full-width { grid-column: 1 / -1; }
.form-actions { margin-top: 40px; padding-top: 20px; border-top: 1px solid rgba(0,0,0,0.05); display: flex; justify-content: flex-end; align-items: center; gap: 15px; }
.save-msg { font-size: 14px; font-weight: 500; opacity: 0; transition: opacity 0.3s; }
.save-msg.success { color: #28a745; opacity: 1; }
.save-msg.error { color: #dc3545; opacity: 1; }

/* Table */
.table-header { padding: 20px 24px; border-bottom: 1px solid rgba(0,0,0,0.05); display: flex; justify-content: space-between; align-items: center; }
.table-responsive { overflow-x: auto; padding: 0 24px 24px; }
.modern-table { width: 100%; border-collapse: collapse; margin-top: 15px; }
.modern-table th { text-align: left; padding: 12px 15px; font-size: 12px; text-transform: uppercase; color: var(--text-muted); font-weight: 600; border-bottom: 2px solid rgba(0,0,0,0.05); }
.modern-table td { padding: 15px; font-size: 14px; border-bottom: 1px solid rgba(0,0,0,0.03); vertical-align: top; }
.modern-table tr:last-child td { border-bottom: none; }
.badge { display: inline-block; padding: 4px 10px; border-radius: 20px; font-size: 11px; font-weight: 600; text-transform: uppercase; }
.badge-yes { background: rgba(40, 167, 69, 0.1); color: #28a745; }
.badge-no { background: rgba(220, 53, 69, 0.1); color: #dc3545; }
.text-center { text-align: center; }

/* Responsive */
@media (max-width: 768px) {
    #dashboard-screen { flex-direction: column; }
    .sidebar { width: 100%; height: auto; position: static; border-right: none; border-bottom: 1px solid var(--glass-border); padding: 15px; }
    .nav-links { display: flex; overflow-x: auto; padding-bottom: 10px; }
    .nav-links a { padding: 8px 12px; white-space: nowrap; }
    .main-content { margin-left: 0; padding: 20px; }
    .form-grid { grid-template-columns: 1fr; }
}
