/* Base */
:root {
    --blue: #2f80ed;
    --blue-soft: #eaf2ff;
    --border: #e5e7eb;
    --text: #0f172a;
    --muted: #6b7280;
    --bg: #f5f6fb;
    --card: #fff;
    --green: #16a34a;
    --red: #dc2626;
    --yellow: #f59e0b;
    --pill: #f1f5f9;
}

* { box-sizing: border-box; }
body {
    margin: 0;
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    background: var(--bg);
    color: var(--text);
}

a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }

/* Topbar */
.topbar {
    height: 64px;
    background: #fff;
    border-bottom: 1px solid var(--border);
    padding: 0 20px;
    display: flex;
    align-items: center;
    gap: 16px;
}
.brand { display: flex; align-items: center; gap: 10px; min-width: 170px; }
.brand-logo {
    width: 32px; height: 32px; border-radius: 10px;
    background: var(--blue);
}
.brand-text { font-weight: 700; }
.nav { display: flex; align-items: center; gap: 12px; }
.nav-link {
    padding: 10px 10px;
    border-bottom: 2px solid transparent;
    color: var(--text);
    font-weight: 600;
}
.nav-link.is-active { border-color: var(--blue); color: var(--blue); }

.search-bar { flex: 1; display: flex; justify-content: center; }
.search-bar input {
    width: 260px;
    padding: 10px 14px;
    border-radius: 18px;
    border: 1px solid var(--border);
    background: var(--pill);
}

.user-area {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 280px;
    justify-content: flex-end;
}
.user-area.minimal { justify-content: flex-end; }
.greeting { font-size: 12px; color: var(--muted); }
.status-dots { display: flex; gap: 6px; }
.dot {
    width: 12px; height: 12px; border-radius: 50%;
    border: 2px solid #fff;
    box-shadow: 0 0 0 1px var(--border);
}
.dot-red { background: var(--red); }
.dot-green { background: var(--green); }
.user-info { text-align: right; line-height: 1.1; }
.username { font-weight: 700; font-size: 12px; color: var(--muted); }
.name { font-weight: 700; }
.avatar {
    width: 28px; height: 28px; border-radius: 50%;
    background: var(--blue);
}
.link { font-weight: 700; }

/* Layout */
.page {
    padding: 18px 20px 80px;
    min-height: calc(100vh - 64px);
}
.section { margin-bottom: 18px; }
.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
}
.page-title { margin: 0 0 4px; }
.subtitle { margin: 0 0 12px; color: var(--muted); }

/* Cards & grids */
.card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 14px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.03);
}
.card-grid.four {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 12px;
}
.stat-card { min-height: 120px; }
.stat-label { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .03em; }
.stat-value { font-size: 28px; font-weight: 700; margin-top: 6px; }
.stat-sub { color: var(--muted); margin-top: 6px; font-size: 13px; }
.accent-blue { background: var(--blue-soft); border-color: #d7e6ff; }
.accent-yellow { background: #fff7ed; border-color: #ffedd5; }
.accent-green { background: #ecfdf3; border-color: #bbf7d0; }
.accent-purple { background: #f3f0ff; border-color: #e0d7ff; }

.two-col { display: grid; grid-template-columns: 2fr 1fr; gap: 12px; }
.two-wide { display: grid; grid-template-columns: 3fr 2fr; gap: 12px; }
.grid-two { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 12px; }
.panel-header { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.between { justify-content: space-between; }
.panel-title { font-weight: 700; }
.chart-placeholder {
    background: repeating-linear-gradient(45deg, #f8fafc, #f8fafc 10px, #eef2ff 10px, #eef2ff 20px);
    border: 1px dashed var(--border);
    border-radius: 8px;
    min-height: 150px;
    display: grid;
    place-items: center;
    color: var(--muted);
}
.chart-placeholder.tall { min-height: 220px; }

/* Progress */
.progress-row {
    display: grid;
    grid-template-columns: 160px 1fr 80px;
    align-items: center;
    gap: 10px;
    margin: 8px 0;
}
.progress {
    background: #e5e7eb;
    border-radius: 8px;
    height: 12px;
    overflow: hidden;
}
.bar { height: 100%; border-radius: 8px; }
.bar.green { background: var(--green); }
.bar.red { background: var(--red); }
.bar.neutral { background: #94a3b8; }

/* Tables */
.table-wrapper { overflow-x: auto; }
.table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}
.table th, .table td {
    padding: 10px;
    border-bottom: 1px solid var(--border);
    text-align: left;
}
.table th { color: var(--muted); font-weight: 700; font-size: 12px; }
.table tr:last-child td { border-bottom: none; }
.empty { text-align: center; color: var(--muted); padding: 18px; }
.actions { display: flex; gap: 6px; }

/* Badges */
.badge { display: inline-flex; align-items: center; padding: 4px 8px; border-radius: 999px; font-size: 12px; font-weight: 700; }
.badge-pill { background: var(--pill); }
.status-approved { background: #d1fae5; color: #065f46; }
.status-rejected { background: #fee2e2; color: #991b1b; }
.status-pending { background: #fef3c7; color: #92400e; }

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 16px;
    border-radius: 8px;
    border: 1px solid transparent;
    cursor: pointer;
    font-weight: 700;
    color: #fff;
    text-decoration: none;
}
.btn-primary { background: var(--blue); border-color: var(--blue); }
.btn-primary:hover { background: #1d6ed9; }
.btn-light { background: #fff; color: var(--text); border-color: var(--border); }
.btn-danger { background: var(--red); border-color: var(--red); }
.btn-small { padding: 6px 10px; font-size: 12px; }

/* Forms */
.form { display: grid; gap: 12px; }
.form.two-col { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.form label { font-weight: 600; color: var(--text); display: flex; flex-direction: column; gap: 6px; }
.form input, .form select {
    padding: 10px 12px;
    border-radius: 8px;
    border: 1px solid var(--border);
    font-size: 14px;
}
.form input[type="file"] { padding: 6px; }
.form-actions {
    grid-column: 1 / -1;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}
.checkbox { align-items: center; flex-direction: row; font-weight: 500; }
.checkbox input { width: 16px; height: 16px; }
.form-card { margin-top: 10px; }

/* Login */
.login-body { background: var(--bg); min-height: 100vh; }
.login-page { display: flex; justify-content: center; align-items: flex-start; padding-top: 60px; }
.login-card { width: 360px; margin: 0 auto; }
.text-center { text-align: center; }
.alert { padding: 10px; border-radius: 8px; }
.alert-error { background: #fee2e2; color: #991b1b; border: 1px solid #fecdd3; }

/* Footer */
.footer {
    text-align: center;
    padding: 18px;
    color: var(--muted);
    background: #fff;
    border-top: 1px solid var(--border);
}

@media (max-width: 900px) {
    .nav { display: none; }
    .search-bar { display: none; }
    .user-area { min-width: auto; }
}
