:root {
    --bg: #f4f7fb;
    --surface: #ffffff;
    --surface-soft: #edf6f7;
    --text: #172033;
    --muted: #657084;
    --line: #dde5ef;
    --primary: #127c8a;
    --primary-dark: #0d5e68;
    --danger: #c43737;
    --success: #16875d;
    --warning: #a86e00;
    --shadow: 0 12px 30px rgba(23, 32, 51, 0.08);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    background: var(--bg);
    color: var(--text);
    font-family: Arial, Helvetica, sans-serif;
}

a {
    color: inherit;
    text-decoration: none;
}

.auth-page {
    display: grid;
    place-items: center;
    padding: 24px;
    background:
        linear-gradient(135deg, rgba(18, 124, 138, 0.12), rgba(22, 135, 93, 0.08)),
        var(--bg);
}

.auth-wrapper {
    width: min(100%, 440px);
}

.auth-card,
.panel,
.stat-card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: var(--shadow);
}

.auth-card {
    padding: 28px;
}

.auth-brand,
.brand {
    display: flex;
    align-items: center;
    gap: 12px;
}

.auth-brand {
    margin-bottom: 24px;
}

.auth-brand h1,
.topbar h1 {
    margin: 0;
}

.auth-brand p,
.page-kicker,
.muted {
    margin: 4px 0 0;
    color: var(--muted);
}

.brand-mark {
    display: inline-grid;
    place-items: center;
    width: 42px;
    height: 42px;
    flex: 0 0 42px;
    border-radius: 8px;
    background: var(--primary);
    color: #fff;
    font-weight: 700;
}

.app-shell {
    display: grid;
    grid-template-columns: 250px 1fr;
    min-height: 100vh;
}

.sidebar {
    background: #102a33;
    color: #fff;
    padding: 22px;
}

.sidebar .brand {
    margin-bottom: 30px;
    font-size: 20px;
    font-weight: 700;
}

.nav-menu {
    display: grid;
    gap: 8px;
}

.nav-menu a {
    padding: 12px 14px;
    border-radius: 8px;
    color: rgba(255, 255, 255, 0.82);
}

.nav-menu a:hover,
.nav-menu a.active {
    background: rgba(255, 255, 255, 0.13);
    color: #fff;
}

.main-content {
    padding: 28px;
    min-width: 0;
}

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    margin-bottom: 22px;
}

.page-kicker {
    text-transform: uppercase;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0;
}

.user-chip {
    display: grid;
    gap: 2px;
    min-width: 130px;
    padding: 10px 14px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface);
}

.user-chip span {
    font-weight: 700;
}

.user-chip small {
    color: var(--muted);
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 16px;
    margin-bottom: 20px;
}

.stat-card {
    padding: 18px;
}

.stat-card p {
    margin: 0 0 8px;
    color: var(--muted);
}

.stat-card strong {
    font-size: 28px;
}

.panel {
    padding: 20px;
    margin-bottom: 20px;
}

.panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    margin-bottom: 16px;
}

.panel-header h2 {
    margin: 0;
    font-size: 20px;
}

.grid-2 {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
}

.form-group {
    display: grid;
    gap: 7px;
    margin-bottom: 14px;
}

.form-group label {
    font-weight: 700;
}

.form-control {
    width: 100%;
    min-height: 42px;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 10px 12px;
    background: #fff;
    color: var(--text);
    font: inherit;
}

textarea.form-control {
    min-height: 90px;
    resize: vertical;
}

.form-actions,
.filters {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 40px;
    padding: 10px 14px;
    border: 1px solid transparent;
    border-radius: 8px;
    background: var(--primary);
    color: #fff;
    font-weight: 700;
    cursor: pointer;
}

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

.btn-secondary {
    background: #fff;
    color: var(--text);
    border-color: var(--line);
}

.btn-secondary:hover {
    background: var(--surface-soft);
}

.btn-danger {
    background: var(--danger);
}

.btn-danger:hover {
    background: #992a2a;
}

.btn-sm {
    min-height: 34px;
    padding: 7px 10px;
    font-size: 13px;
}

.table-responsive {
    width: 100%;
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    min-width: 780px;
}

th,
td {
    padding: 12px;
    border-bottom: 1px solid var(--line);
    text-align: left;
    vertical-align: top;
}

th {
    background: #f8fafc;
    color: var(--muted);
    font-size: 13px;
}

.action-row {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.badge {
    display: inline-flex;
    align-items: center;
    min-height: 26px;
    padding: 4px 9px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 700;
}

.badge-blue {
    background: #e4f3ff;
    color: #12608a;
}

.badge-yellow {
    background: #fff2d7;
    color: var(--warning);
}

.badge-green {
    background: #def7eb;
    color: var(--success);
}

.badge-gray {
    background: #e9edf3;
    color: #4b5563;
}

.alert {
    padding: 12px 14px;
    margin-bottom: 16px;
    border-radius: 8px;
    border: 1px solid var(--line);
}

.alert-success {
    background: #e7f8ef;
    border-color: #bfead3;
    color: #135f42;
}

.alert-danger {
    background: #fdebea;
    border-color: #f4c7c3;
    color: #932525;
}

.alert-info {
    background: #e8f5ff;
    border-color: #c9e7ff;
    color: #155d84;
}

.detail-list {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

.detail-item {
    padding: 12px;
    background: #f8fafc;
    border: 1px solid var(--line);
    border-radius: 8px;
}

.detail-item small {
    display: block;
    color: var(--muted);
    margin-bottom: 4px;
}

.empty-state {
    padding: 28px;
    text-align: center;
    color: var(--muted);
}

@media (max-width: 980px) {
    .app-shell {
        grid-template-columns: 1fr;
    }

    .sidebar {
        position: static;
    }

    .nav-menu {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }

    .stats-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 680px) {
    .main-content,
    .auth-card {
        padding: 18px;
    }

    .topbar,
    .panel-header {
        align-items: stretch;
        flex-direction: column;
    }

    .nav-menu,
    .stats-grid,
    .grid-2,
    .detail-list {
        grid-template-columns: 1fr;
    }

    .filters .form-control,
    .filters .btn {
        width: 100%;
    }
}
