* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary: #163b8c;
    --primary-dark: #122f70;
    --primary-light: #e8f0ff;
    --accent: #f59e0b;
    --success: #16a34a;
    --info: #0891b2;
    --danger: #dc2626;
    --warning: #d97706;
    --bg: #eef2f7;
    --white: #ffffff;
    --text: #1f2937;
    --muted: #6b7280;
    --border: #dbe2ea;
    --shadow: 0 6px 18px rgba(15, 23, 42, 0.08);
    --radius: 14px;
    --sidebar-width: 290px;
}

html, body {
    height: 100%;
}

body {
    font-family: "Segoe UI", Tahoma, Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.5;
}

a {
    text-decoration: none;
    color: inherit;
}

img {
    max-width: 100%;
    display: block;
}

.layout {
    display: flex;
    min-height: 100vh;
}

/* SIDEBAR */
.sidebar {
    width: var(--sidebar-width);
    min-width: var(--sidebar-width);
    background: linear-gradient(180deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: #fff;
    display: flex;
    flex-direction: column;
    box-shadow: 3px 0 16px rgba(0, 0, 0, 0.10);
}

.sidebar-brand {
    padding: 26px 20px 22px;
    text-align: center;
    border-bottom: 1px solid rgba(255,255,255,0.12);
}

.sidebar-brand img {
    width: 78px;
    height: 78px;
    object-fit: contain;
    margin: 0 auto 14px;
    background: #fff;
    border-radius: 14px;
    padding: 8px;
}

.sidebar-brand h2 {
    font-size: 22px;
    font-weight: 700;
    line-height: 1.25;
    margin-bottom: 8px;
}

.sidebar-brand p {
    font-size: 13px;
    line-height: 1.6;
    opacity: 0.94;
}

.sidebar-menu {
    padding: 16px 0;
}

.sidebar-group-title {
    padding: 10px 22px 8px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.7px;
    opacity: 0.72;
}

.sidebar-menu a {
    display: block;
    padding: 14px 22px;
    color: #e5ecff;
    font-size: 15px;
    font-weight: 500;
    border-left: 4px solid transparent;
    transition: 0.2s ease;
}

.sidebar-menu a:hover {
    background: rgba(255,255,255,0.10);
    color: #fff;
    border-left-color: #60a5fa;
}

.sidebar-menu a.active {
    background: rgba(255,255,255,0.14);
    color: #fff;
    border-left-color: var(--accent);
    font-weight: 700;
}

.sidebar-footer {
    margin-top: auto;
    padding: 18px 22px 24px;
    font-size: 12px;
    opacity: 0.82;
}

/* MAIN CONTENT */
.main-content {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.topbar {
    background: var(--white);
    border-bottom: 1px solid var(--border);
    padding: 18px 28px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
}

.topbar-title {
    font-size: 21px;
    font-weight: 700;
    color: var(--primary);
}

.topbar-user {
    font-size: 14px;
    color: var(--muted);
    text-align: right;
}

.page-content {
    padding: 28px;
}

/* CARD */
.card {
    background: var(--white);
    border-radius: var(--radius);
    padding: 24px;
    box-shadow: var(--shadow);
    margin-bottom: 24px;
}

.card-title {
    font-size: 20px;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 14px;
}

.card-subtitle {
    font-size: 14px;
    color: var(--muted);
    margin-bottom: 14px;
}

/* GRID */
.grid-2 {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px;
}

.grid-3 {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 18px;
}

.grid-4 {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 18px;
}

/* STAT CARD */
.stat-card {
    background: linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
    border: 1px solid #e5eaf3;
    border-radius: 14px;
    padding: 18px;
    box-shadow: 0 3px 10px rgba(15, 23, 42, 0.04);
}

.stat-label {
    font-size: 13px;
    color: var(--muted);
    margin-bottom: 8px;
}

.stat-value {
    font-size: 28px;
    font-weight: 700;
    color: var(--primary);
}

.stat-note {
    margin-top: 8px;
    font-size: 12px;
    color: var(--muted);
}

/* QUICK ACTIONS */
.quick-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border: none;
    border-radius: 10px;
    padding: 11px 18px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: 0.2s ease;
    text-decoration: none;
}

.btn:hover {
    transform: translateY(-1px);
    opacity: 0.96;
}

.btn-primary {
    background: #2563eb;
    color: #fff;
}

.btn-success {
    background: var(--success);
    color: #fff;
}

.btn-info {
    background: var(--info);
    color: #fff;
}

.btn-warning {
    background: var(--warning);
    color: #fff;
}

.btn-danger {
    background: var(--danger);
    color: #fff;
}

.btn-outline {
    background: #fff;
    color: var(--primary);
    border: 1px solid #c9d5ea;
}

/* INFO BOX */
.info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 16px;
}

.info-box {
    background: #f8fafc;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    padding: 18px;
    min-height: 140px;
}

.info-box h4 {
    font-size: 16px;
    margin-bottom: 10px;
    color: var(--text);
}

.info-box p {
    font-size: 14px;
    line-height: 1.65;
    color: #4b5563;
}

/* ALERT */
.alert {
    padding: 14px 16px;
    border-radius: 10px;
    margin-bottom: 18px;
    font-size: 14px;
}

.alert-success {
    background: #dcfce7;
    color: #166534;
    border: 1px solid #bbf7d0;
}

.alert-danger {
    background: #fee2e2;
    color: #991b1b;
    border: 1px solid #fecaca;
}

.alert-warning {
    background: #fef3c7;
    color: #92400e;
    border: 1px solid #fde68a;
}

.alert-info {
    background: #dbeafe;
    color: #1d4ed8;
    border: 1px solid #bfdbfe;
}

/* BADGE */
.badge {
    display: inline-block;
    padding: 6px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 700;
}

.badge-warning { background: #fef3c7; color: #92400e; }
.badge-info    { background: #dbeafe; color: #1d4ed8; }
.badge-success { background: #dcfce7; color: #166534; }
.badge-danger  { background: #fee2e2; color: #b91c1c; }
.badge-secondary { background: #e5e7eb; color: #374151; }

/* TABLE */
.table-wrap {
    overflow-x: auto;
}

.table {
    width: 100%;
    border-collapse: collapse;
    background: #fff;
}

.table th,
.table td {
    padding: 13px 14px;
    border-bottom: 1px solid #e5e7eb;
    text-align: left;
    font-size: 14px;
    vertical-align: top;
}

.table th {
    background: #f8fafc;
    color: var(--primary);
    font-weight: 700;
}

.table tr:hover td {
    background: #fafcff;
}

/* FORM */
.form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px;
}

.form-group {
    margin-bottom: 18px;
}

.form-group.full {
    grid-column: 1 / -1;
}

.form-label {
    display: block;
    margin-bottom: 8px;
    font-size: 14px;
    font-weight: 600;
    color: #111827;
}

.form-control,
select,
textarea {
    width: 100%;
    padding: 11px 14px;
    border: 1px solid #cbd5e1;
    border-radius: 10px;
    font-size: 14px;
    font-family: inherit;
    background: #fff;
    color: var(--text);
}

.form-control:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

textarea {
    min-height: 110px;
    resize: vertical;
}

.form-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 6px;
}

/* SMALL HELPER */
.text-muted {
    color: var(--muted);
}

.text-primary {
    color: var(--primary);
}

.mb-0 { margin-bottom: 0; }
.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 12px; }
.mb-3 { margin-bottom: 16px; }
.mb-4 { margin-bottom: 24px; }

/* LOGIN */
.auth-page {
    min-height: 100vh;
    display: grid;
    place-items: center;
    background: linear-gradient(135deg, #dbeafe 0%, #eef2f7 45%, #dbeafe 100%);
    padding: 24px;
}

.auth-card {
    width: 100%;
    max-width: 460px;
    background: #fff;
    border-radius: 18px;
    box-shadow: 0 18px 45px rgba(30, 58, 138, 0.15);
    overflow: hidden;
}

.auth-header {
    background: linear-gradient(135deg, var(--primary), #2563eb);
    color: #fff;
    text-align: center;
    padding: 26px 22px 22px;
}

.auth-header img {
    width: 84px;
    height: 84px;
    object-fit: contain;
    background: #fff;
    border-radius: 14px;
    margin: 0 auto 14px;
    padding: 8px;
}

.auth-header h1 {
    font-size: 24px;
    line-height: 1.25;
    margin-bottom: 8px;
}

.auth-header p {
    font-size: 14px;
    opacity: 0.94;
}

.auth-body {
    padding: 24px;
}

.auth-footer {
    text-align: center;
    font-size: 12px;
    color: var(--muted);
    padding-top: 8px;
}

/* RESPONSIVE */
@media (max-width: 1200px) {
    .grid-4 {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 992px) {
    :root {
        --sidebar-width: 250px;
    }

    .grid-3,
    .grid-4,
    .grid-2,
    .form-grid {
        grid-template-columns: 1fr;
    }

    .page-content {
        padding: 20px;
    }
}

@media (max-width: 768px) {
    .layout {
        flex-direction: column;
    }

    .sidebar {
        width: 100%;
        min-width: 100%;
    }

    .topbar {
        padding: 16px 18px;
        flex-direction: column;
        align-items: flex-start;
    }

    .page-content {
        padding: 18px;
    }

    .quick-actions,
    .form-actions {
        flex-direction: column;
    }

    .btn {
        width: 100%;
    }
}