:root {
    --primary: #4a56e2;
    --primary-hover: #3a46d2;
    --success: #28a745;
    --danger: #dc3545;
    --warning: #ffc107;
    --info: #17a2b8;
    --dark: #1e2130;
    --sidebar-bg: #1e2130;
    --sidebar-text: #a8afc7;
    --sidebar-active: #4a56e2;
    --body-bg: #f5f6fa;
    --card-bg: #ffffff;
    --text: #333;
    --text-muted: #6c757d;
    --border: #e0e0e0;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background: var(--body-bg);
    color: var(--text);
    line-height: 1.6;
}

/* Layout */
.layout { display: flex; min-height: 100vh; }

.sidebar {
    width: 250px;
    background: var(--sidebar-bg);
    color: var(--sidebar-text);
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    display: flex;
    flex-direction: column;
}

.sidebar-header { padding: 1.5rem; border-bottom: 1px solid rgba(255,255,255,0.08); }
.sidebar-title { color: #fff; font-size: 1.2rem; font-weight: 600; }

.sidebar-nav { flex: 1; padding: 1rem 0; }
.nav-link {
    display: block;
    padding: 0.6rem 1.5rem;
    color: var(--sidebar-text);
    text-decoration: none;
    transition: background 0.15s, color 0.15s;
}
.nav-link:hover { background: rgba(255,255,255,0.05); color: #fff; }
.nav-link.active { background: var(--sidebar-active); color: #fff; }

.sidebar-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid rgba(255,255,255,0.08);
    font-size: 0.85rem;
}
.sidebar-user { display: block; margin-bottom: 0.4rem; color: #fff; }
.logout-link { padding: 0.3rem 0; display: inline-block; }

.main-content {
    margin-left: 250px;
    padding: 2rem;
    flex: 1;
    max-width: 1100px;
}

/* Auth layout (no sidebar) */
.auth-layout {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 2rem;
}

.auth-card {
    background: var(--card-bg);
    padding: 2.5rem;
    border-radius: 8px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.08);
    width: 100%;
    max-width: 420px;
}
.auth-card h2 { margin-bottom: 0.5rem; }
.auth-card .text-muted { margin-bottom: 1.5rem; }

/* Flash messages */
.flash {
    padding: 0.75rem 1rem;
    border-radius: 6px;
    margin-bottom: 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.flash-success { background: #d4edda; color: #155724; }
.flash-error, .flash-danger { background: #f8d7da; color: #721c24; }
.flash-info { background: #d1ecf1; color: #0c5460; }
.flash-warning { background: #fff3cd; color: #856404; }
.flash-dismiss {
    background: none;
    border: none;
    font-size: 1.2rem;
    cursor: pointer;
    color: inherit;
    opacity: 0.6;
}
.flash-dismiss:hover { opacity: 1; }

/* Page header */
.page-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1.5rem; }
.page-header h2 { margin: 0; }

/* Breadcrumb */
.breadcrumb { font-size: 0.85rem; color: var(--text-muted); margin-bottom: 1rem; }
.breadcrumb a { color: var(--primary); text-decoration: none; }
.breadcrumb a:hover { text-decoration: underline; }
.breadcrumb span { margin: 0 0.3rem; }

/* Cards */
.stat-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 1rem; margin-bottom: 2rem; }
.stat-card {
    background: var(--card-bg);
    padding: 1.5rem;
    border-radius: 8px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.06);
    text-align: center;
}
.stat-value { font-size: 2rem; font-weight: 700; color: var(--primary); }
.stat-label { font-size: 0.85rem; color: var(--text-muted); margin-top: 0.25rem; }

.form-card {
    background: var(--card-bg);
    padding: 2rem;
    border-radius: 8px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.06);
    max-width: 600px;
}

/* Tables */
.table-wrap { overflow-x: auto; }
table {
    width: 100%;
    border-collapse: collapse;
    background: var(--card-bg);
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}
thead th {
    background: var(--body-bg);
    padding: 0.75rem 1rem;
    text-align: left;
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--text-muted);
    border-bottom: 2px solid var(--border);
}
tbody td {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border);
    font-size: 0.9rem;
}
tbody tr:hover { background: #f8f9ff; }
tbody tr:nth-child(even) { background: #fafbfc; }
tbody tr:nth-child(even):hover { background: #f8f9ff; }

/* Forms */
.form-group { margin-bottom: 1rem; }
.form-group label { display: block; margin-bottom: 0.35rem; font-weight: 500; font-size: 0.9rem; }
.form-group input, .form-group select, .form-group textarea {
    width: 100%;
    padding: 0.55rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 0.95rem;
    transition: border-color 0.15s;
}
.form-group input:focus, .form-group select:focus, .form-group textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(74, 86, 226, 0.12);
}
.form-static { padding: 0.55rem 0; font-size: 0.95rem; }
.form-actions { margin-top: 1.5rem; display: flex; gap: 0.75rem; }
.help-text { font-size: 0.82rem; color: var(--text-muted); margin-top: 0.35rem; }
.help-text a { color: var(--primary); }

/* Buttons */
.btn {
    display: inline-block;
    padding: 0.55rem 1.2rem;
    border: none;
    border-radius: 6px;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
    transition: background 0.15s;
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-hover); }
.btn-secondary { background: #e9ecef; color: var(--text); }
.btn-secondary:hover { background: #dee2e6; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #c82333; }
.btn-block { width: 100%; text-align: center; }
.btn-sm { padding: 0.3rem 0.65rem; font-size: 0.8rem; }

/* Badges */
.badge {
    display: inline-block;
    padding: 0.2rem 0.55rem;
    border-radius: 10px;
    font-size: 0.75rem;
    font-weight: 600;
}
.badge-success { background: #d4edda; color: #155724; }
.badge-danger { background: #f8d7da; color: #721c24; }
.badge-warning { background: #fff3cd; color: #856404; }
.badge-info { background: #d1ecf1; color: #0c5460; }

/* Utilities */
.text-muted { color: var(--text-muted); }
code { background: #f0f1f5; padding: 0.15rem 0.4rem; border-radius: 4px; font-size: 0.85rem; }
.url-display { word-break: break-all; }
.inline-form { display: inline; }
.actions { white-space: nowrap; }
.actions form, .actions a { margin-right: 0.3rem; }
.secret-masked, .secret-value { font-family: monospace; font-size: 0.85rem; }

.empty-state {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--text-muted);
    background: var(--card-bg);
    border-radius: 8px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}
.empty-state .btn { margin-top: 1rem; }

h2 { margin-bottom: 1.5rem; }
h3 { margin-bottom: 1rem; color: var(--text); }

/* Responsive */
@media (max-width: 768px) {
    .sidebar { transform: translateX(-100%); z-index: 100; transition: transform 0.2s; }
    .sidebar.open { transform: translateX(0); }
    .main-content { margin-left: 0; padding: 1rem; }
    .stat-cards { grid-template-columns: repeat(2, 1fr); }
    .actions { display: flex; flex-wrap: wrap; gap: 0.3rem; }
}
