/* Setec App Manager — Dark Theme */
:root {
    --primary: #6366f1;
    --primary-hover: #818cf8;
    --surface: #222536;
    --bg: #1a1b2e;
    --text: #e2e8f0;
    --text-muted: #94a3b8;
    --border: #2e3148;
    --ok: #22c55e;
    --err: #ef4444;
    --warn: #f59e0b;
    --radius: 6px;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg);
    color: var(--text);
    display: flex;
    min-height: 100vh;
    line-height: 1.5;
}

/* ── Sidebar ── */
.sidebar {
    width: 220px;
    background: var(--surface);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 10;
}

.sidebar-header {
    padding: 1.25rem 1rem;
    border-bottom: 1px solid var(--border);
}

.sidebar-header h1 {
    font-size: 1.25rem;
    color: var(--primary);
    letter-spacing: 0.1em;
}

.sidebar-header .subtitle {
    font-size: .75rem;
    color: var(--text-muted);
}

.nav-menu {
    list-style: none;
    flex: 1;
    padding: .5rem 0;
    overflow-y: auto;
}

.sidebar-logo {
    width: 160px;
    height: auto;
}

.nav-icon {
    width: 18px;
    height: 18px;
    vertical-align: middle;
    margin-right: 8px;
    flex-shrink: 0;
}

.nav-link {
    display: flex;
    align-items: center;
    padding: .55rem 1rem;
    color: var(--text-muted);
    text-decoration: none;
    font-size: .9rem;
    transition: background .15s, color .15s;
}

.nav-link:hover,
.nav-link.active {
    background: rgba(99, 102, 241, .1);
    color: var(--primary);
}

.sidebar-footer {
    padding: .75rem 1rem;
    border-top: 1px solid var(--border);
    font-size: .8rem;
}

.sidebar-footer .user-badge {
    color: var(--text-muted);
    display: block;
    margin-bottom: .25rem;
}

.sidebar-footer .logout {
    color: var(--err);
    font-size: .8rem;
}

/* ── Content ── */
.content {
    margin-left: 220px;
    flex: 1;
    padding: 1.5rem 2rem;
    min-height: 100vh;
}

.content h2 {
    margin-bottom: 1rem;
    font-size: 1.4rem;
}

.content h3 {
    margin: 1.25rem 0 .75rem;
    font-size: 1.1rem;
    color: var(--text-muted);
}

/* ── Stat Cards / Grid ── */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 1rem;
    margin-bottom: 1rem;
}

.stat-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1rem 1.25rem;
}

.stat-card h3 {
    margin: 0 0 .5rem;
    font-size: .95rem;
    color: var(--text-muted);
}

.stat-card .big-number {
    font-size: 2rem;
    font-weight: 700;
    color: var(--primary);
}

/* ── Data Table ── */
.data-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    margin-bottom: 1rem;
}

.data-table th,
.data-table td {
    padding: .6rem .85rem;
    text-align: left;
    border-bottom: 1px solid var(--border);
    font-size: .9rem;
}

.data-table th {
    background: rgba(99, 102, 241, .08);
    color: var(--text-muted);
    font-weight: 600;
    font-size: .8rem;
    text-transform: uppercase;
    letter-spacing: .04em;
}

.data-table tbody tr:hover {
    background: rgba(99, 102, 241, .04);
}

.data-table a {
    color: var(--primary);
    text-decoration: none;
}

.data-table a:hover {
    text-decoration: underline;
}

/* ── Buttons ── */
.btn {
    display: inline-block;
    padding: .5rem 1rem;
    font-size: .875rem;
    font-weight: 500;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
    color: var(--text);
    cursor: pointer;
    text-decoration: none;
    transition: background .15s, border-color .15s;
    line-height: 1.4;
}

.btn:hover {
    background: var(--border);
}

.btn-primary {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
}

.btn-primary:hover {
    background: var(--primary-hover);
    border-color: var(--primary-hover);
}

.btn-sm {
    padding: .3rem .6rem;
    font-size: .8rem;
}

/* ── Badges ── */
.badge {
    display: inline-block;
    padding: .15rem .5rem;
    font-size: .75rem;
    font-weight: 600;
    border-radius: 999px;
    background: var(--border);
    color: var(--text-muted);
}

.badge-ok {
    background: rgba(34, 197, 94, .15);
    color: var(--ok);
}

.badge-err {
    background: rgba(239, 68, 68, .15);
    color: var(--err);
}

/* ── Forms ── */
.form-group {
    margin-bottom: 1rem;
}

.form-group label {
    display: block;
    margin-bottom: .3rem;
    font-size: .85rem;
    color: var(--text-muted);
}

.form-group input[type="text"],
.form-group input[type="password"],
.form-group input[type="email"],
.form-group select,
.form-group textarea {
    width: 100%;
    padding: .5rem .75rem;
    font-size: .9rem;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text);
    outline: none;
    transition: border-color .15s;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    border-color: var(--primary);
}

/* ── Progress Bar ── */
.progress-bar {
    width: 100%;
    height: 8px;
    background: var(--border);
    border-radius: 4px;
    overflow: hidden;
    margin: .4rem 0;
}

.progress-fill {
    height: 100%;
    background: var(--primary);
    border-radius: 4px;
    transition: width .3s ease;
}

/* ── Login Page ── */
.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: var(--bg);
}

.login-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 2rem;
    width: 100%;
    max-width: 380px;
}

.login-card h1 {
    color: var(--primary);
    letter-spacing: 0.1em;
    margin-bottom: .25rem;
}

.login-card .subtitle {
    color: var(--text-muted);
    margin-bottom: 1.5rem;
    font-size: .85rem;
}

.login-card .btn {
    width: 100%;
    margin-top: .5rem;
}

/* ── Error Message ── */
.error-msg {
    margin-top: .75rem;
    padding: .5rem .75rem;
    background: rgba(239, 68, 68, .1);
    border: 1px solid rgba(239, 68, 68, .3);
    border-radius: var(--radius);
    color: var(--err);
    font-size: .85rem;
}

/* ── Utility ── */
code {
    background: var(--bg);
    padding: .1rem .35rem;
    border-radius: 3px;
    font-size: .85em;
}

p { margin-bottom: .35rem; }

/* ── Responsive ── */
@media (max-width: 768px) {
    .sidebar { width: 60px; }
    .sidebar-header h1 { font-size: .9rem; }
    .sidebar-header .subtitle,
    .sidebar-footer .user-badge { display: none; }
    .nav-link { padding: .5rem; font-size: .75rem; text-align: center; }
    .content { margin-left: 60px; padding: 1rem; }
    .stats-grid { grid-template-columns: 1fr; }
}
