:root {
    --brand-1: #1565c0;
    --brand-2: #00acc1;
    --brand-3: #0d47a1;
    --bg: #f4f7fb;
    --surface: #ffffff;
    --text: #1f2d3d;
    --muted: #6b7a90;
    --border: #e3e9f2;
    --danger: #d32f2f;
    --danger-bg: #ffebee;
    --success: #2e7d32;
    --success-bg: #e8f5e9;
    --shadow: 0 4px 16px rgba(15, 40, 80, 0.06);
    --shadow-lg: 0 18px 50px rgba(15, 40, 80, 0.12);
    --radius: 10px;
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    color: var(--text);
    background: var(--bg);
    font-size: 15px;
    line-height: 1.5;
}

a { color: var(--brand-1); text-decoration: none; }
a:hover { text-decoration: underline; }
code { background: #eef2f7; padding: 2px 6px; border-radius: 4px; font-size: 13px; }

/* ===== Top Bar ===== */
.topbar {
    background: linear-gradient(90deg, var(--brand-3), var(--brand-1) 55%, var(--brand-2));
    color: #fff;
    box-shadow: var(--shadow);
}
.topbar-inner {
    max-width: 1200px;
    margin: 0 auto;
    padding: 12px 24px;
    display: flex;
    align-items: center;
    gap: 24px;
}
.brand {
    display: flex;
    align-items: center;
    gap: 10px;
    color: #fff;
    font-weight: 600;
    font-size: 17px;
}
.brand:hover { text-decoration: none; }
.brand img { width: 28px; height: 28px; }
.topnav {
    display: flex;
    gap: 18px;
    flex: 1;
    margin-left: 12px;
}
.topnav a {
    color: rgba(255,255,255,0.92);
    padding: 6px 10px;
    border-radius: 6px;
    font-weight: 500;
}
.topnav a:hover { background: rgba(255,255,255,0.12); text-decoration: none; }
.user-area { display: flex; align-items: center; gap: 12px; }
.user-name { color: rgba(255,255,255,0.92); font-weight: 500; }

/* ===== Main / Footer ===== */
.main-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 28px 24px 56px;
}
.footer {
    max-width: 1200px;
    margin: 0 auto;
    padding: 16px 24px 32px;
    color: var(--muted);
}

/* ===== Buttons ===== */
.btn {
    display: inline-block;
    padding: 9px 18px;
    border-radius: var(--radius);
    border: 1px solid transparent;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.15s ease;
    background: #fff;
    color: var(--brand-1);
    border-color: var(--border);
}
.btn:hover { text-decoration: none; transform: translateY(-1px); box-shadow: var(--shadow); }
.btn-primary {
    background: var(--brand-1);
    color: #fff;
    border-color: var(--brand-1);
}
.btn-primary:hover { background: var(--brand-3); border-color: var(--brand-3); color: #fff; }
.btn-ghost {
    background: transparent;
    color: #fff;
    border-color: rgba(255,255,255,0.4);
}
.btn-ghost:hover { background: rgba(255,255,255,0.12); color: #fff; }
.main-content .btn-ghost,
.card .btn-ghost,
form .btn-ghost {
    color: var(--brand-1);
    border-color: var(--border);
    background: #fff;
}
.main-content .btn-ghost:hover { background: var(--bg); }
.btn-block { display: block; width: 100%; padding: 12px; }
.btn-sm { padding: 5px 10px; font-size: 13px; }
.btn-danger { background: var(--danger); color: #fff; border-color: var(--danger); }
.btn-danger:hover { background: #b71c1c; border-color: #b71c1c; color: #fff; }
.inline-form { display: inline; margin-left: 4px; }

/* ===== Forms ===== */
.form-group { margin-bottom: 16px; }
.form-group label {
    display: block;
    font-weight: 600;
    margin-bottom: 6px;
    color: var(--text);
}
.form-group input[type="text"],
.form-group input[type="password"],
.form-group input[type="email"],
.form-group input:not([type]) {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: #fff;
    font-size: 14px;
    transition: border-color 0.15s;
}
.form-group input:focus {
    outline: none;
    border-color: var(--brand-1);
    box-shadow: 0 0 0 3px rgba(21, 101, 192, 0.12);
}
.field-error { color: var(--danger); font-size: 13px; display: block; margin-top: 4px; }
.hint { color: var(--muted); font-size: 12px; }
.form-row { margin: 14px 0; }
.checkbox { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; }
.checkbox input { width: 16px; height: 16px; }
.form-actions { margin-top: 22px; display: flex; gap: 10px; }

/* ===== Alerts ===== */
.alert {
    padding: 12px 16px;
    border-radius: var(--radius);
    margin-bottom: 16px;
    font-size: 14px;
}
.alert-error { background: var(--danger-bg); color: var(--danger); border: 1px solid #ffcdd2; }
.alert-success { background: var(--success-bg); color: var(--success); border: 1px solid #c8e6c9; }

/* ===== Login Page ===== */
.login-page {
    min-height: 100vh;
    display: grid;
    grid-template-columns: 1fr 1fr;
    background: linear-gradient(135deg, #e3f2fd 0%, #f4f7fb 60%, #e0f7fa 100%);
}
.login-card {
    background: var(--surface);
    margin: auto;
    padding: 44px 40px;
    border-radius: 14px;
    box-shadow: var(--shadow-lg);
    width: min(420px, 90%);
}
.login-brand { text-align: center; margin-bottom: 24px; }
.login-logo { width: 64px; height: 64px; }
.login-brand h1 {
    margin: 12px 0 4px;
    font-size: 24px;
    color: var(--brand-3);
}
.brand-tag {
    color: var(--muted);
    font-size: 13px;
    margin: 0;
    letter-spacing: 0.3px;
}
.login-form { margin-top: 8px; }
.login-features {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    margin-top: 28px;
    padding-top: 20px;
    border-top: 1px solid var(--border);
}
.login-features .feature {
    text-align: center;
    color: var(--muted);
    font-size: 12px;
}
.login-features img { width: 22px; height: 22px; display: block; margin: 0 auto 6px; }
.login-side {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 48px;
    color: var(--brand-3);
    text-align: center;
}
.login-side img { max-width: 420px; width: 100%; height: auto; margin-bottom: 24px; }
.login-side h2 {
    font-size: 22px;
    font-weight: 600;
    max-width: 460px;
    line-height: 1.4;
    color: var(--brand-3);
}
@media (max-width: 900px) {
    .login-page { grid-template-columns: 1fr; }
    .login-side { display: none; }
}

/* ===== Hero ===== */
.hero {
    display: grid;
    grid-template-columns: 1.4fr 1fr;
    gap: 24px;
    padding: 28px;
    background: linear-gradient(120deg, #1565c0, #00acc1);
    color: #fff;
    border-radius: 14px;
    margin-bottom: 24px;
    box-shadow: var(--shadow);
}
.hero h1 { margin: 0 0 8px; font-size: 26px; }
.hero p { margin: 0 0 16px; opacity: 0.92; }
.hero .btn-primary { background: #fff; color: var(--brand-1); border-color: #fff; }
.hero .btn-primary:hover { background: #e3f2fd; color: var(--brand-3); }
.hero-image img { max-width: 100%; height: auto; }
@media (max-width: 800px) {
    .hero { grid-template-columns: 1fr; }
    .hero-image { display: none; }
}

/* ===== Stats ===== */
.stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    margin-bottom: 24px;
}
.stat-card {
    background: var(--surface);
    border-radius: 12px;
    padding: 18px;
    display: flex;
    align-items: center;
    gap: 16px;
    box-shadow: var(--shadow);
}
.stat-icon {
    width: 48px; height: 48px;
    border-radius: 10px;
    background: linear-gradient(135deg, #e3f2fd, #e0f7fa);
    display: flex; align-items: center; justify-content: center;
}
.stat-icon img { width: 26px; height: 26px; }
.stat-value { font-size: 22px; font-weight: 700; color: var(--brand-3); }
.stat-label { color: var(--muted); font-size: 13px; }
@media (max-width: 700px) { .stats { grid-template-columns: 1fr; } }

/* ===== Cards / Tables ===== */
.card {
    background: var(--surface);
    border-radius: 12px;
    padding: 22px;
    box-shadow: var(--shadow);
    margin-bottom: 20px;
}
.card-header { margin-bottom: 14px; }
.card-header h2 { margin: 0; font-size: 18px; color: var(--brand-3); }
.page-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 20px;
}
.page-head h1 { margin: 0 0 4px; font-size: 22px; color: var(--brand-3); }
.page-head p { margin: 0; color: var(--muted); }

.table-wrap { overflow-x: auto; }
.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}
.data-table th, .data-table td {
    padding: 10px 12px;
    text-align: left;
    border-bottom: 1px solid var(--border);
}
.data-table th {
    background: #f8fafd;
    color: var(--muted);
    font-weight: 600;
    text-transform: uppercase;
    font-size: 12px;
    letter-spacing: 0.4px;
}
.data-table tr:last-child td { border-bottom: none; }
.text-right { text-align: right; }
.empty-state { color: var(--muted); padding: 12px 0; }

.badge {
    display: inline-block;
    padding: 3px 9px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
}
.badge-success { background: var(--success-bg); color: var(--success); }
.badge-muted { background: #eceff1; color: var(--muted); }

/* ===== Error Page ===== */
.error-page {
    max-width: 520px;
    margin: 120px auto;
    text-align: center;
    background: var(--surface);
    padding: 40px;
    border-radius: 12px;
    box-shadow: var(--shadow);
}
.error-page h1 { color: var(--danger); margin-top: 0; }
