:root {
    --bg: #f5f8ff;
    --panel: #ffffff;
    --line: #dbe7ff;
    --text: #101828;
    --muted: #5d6b82;
    --primary: #155eef;
    --primary-dark: #0b45c7;
    --sky: #45b6ff;
    --accent: #ff7a1a;
    --good: #0f9f6e;
    --warn: #d97706;
    --bad: #d92d20;
    --radius: 18px;
    --shadow: 0 18px 48px rgba(20, 51, 105, 0.1);
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: "Manrope", Arial, sans-serif;
    color: var(--text);
    background:
        radial-gradient(circle at 10% 0%, rgba(69, 182, 255, .16), transparent 28%),
        radial-gradient(circle at 92% 12%, rgba(255, 122, 26, .09), transparent 24%),
        linear-gradient(180deg, #fbfdff 0%, var(--bg) 45%, #fff 100%);
    min-height: 100vh;
}

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

.login-shell {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 28px;
}

.login-card {
    width: min(100%, 440px);
    padding: 34px;
    border-radius: 28px;
    background: rgba(255,255,255,.92);
    border: 1px solid var(--line);
    box-shadow: var(--shadow);
}

.brand {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 800;
    color: var(--primary-dark);
    margin-bottom: 22px;
}

.brand-mark {
    display: grid;
    place-items: center;
    width: 42px;
    height: 42px;
    border-radius: 14px;
    color: #fff;
    background: linear-gradient(135deg, var(--primary), var(--sky) 76%, var(--accent) 145%);
}

.app-shell {
    display: grid;
    grid-template-columns: 286px minmax(0, 1fr);
    min-height: 100vh;
}

.sidebar {
    position: sticky;
    top: 0;
    height: 100vh;
    padding: 22px;
    border-right: 1px solid var(--line);
    background: rgba(255,255,255,.82);
    backdrop-filter: blur(16px);
    overflow-y: auto;
}

.sidebar-nav {
    display: grid;
    gap: 6px;
    margin-top: 22px;
}

.sidebar-nav a {
    display: flex;
    align-items: center;
    min-height: 38px;
    padding: 0 12px;
    border-radius: 12px;
    color: var(--muted);
    font-size: 14px;
    font-weight: 700;
}

.sidebar-nav a:hover,
.sidebar-nav a.active {
    color: var(--primary-dark);
    background: #edf4ff;
}

.main {
    padding: 22px;
}

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

.topbar h1,
.login-card h1 {
    margin: 0;
    font-size: 26px;
    line-height: 1.2;
    letter-spacing: 0;
}

.muted {
    color: var(--muted);
}

.grid {
    display: grid;
    gap: 16px;
}

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

.card {
    padding: 20px;
    border-radius: var(--radius);
    background: rgba(255,255,255,.9);
    border: 1px solid var(--line);
    box-shadow: var(--shadow);
}

.stat-value {
    display: block;
    margin-top: 8px;
    color: var(--primary-dark);
    font-size: 28px;
    font-weight: 800;
}

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

.button,
button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 42px;
    padding: 0 16px;
    border: 0;
    border-radius: 999px;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: #fff;
    font-weight: 800;
    cursor: pointer;
}

.button.secondary {
    background: #fff;
    color: var(--primary-dark);
    border: 1px solid var(--line);
}

label {
    display: grid;
    gap: 7px;
    color: var(--text);
    font-size: 13px;
    font-weight: 800;
}

input,
select,
textarea {
    width: 100%;
    min-height: 42px;
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 10px 12px;
    color: var(--text);
    background: #fff;
    font: inherit;
}

textarea { min-height: 110px; resize: vertical; }

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

.form-grid .wide { grid-column: 1 / -1; }

.table-wrap {
    overflow: auto;
}

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

th,
td {
    padding: 12px 14px;
    border-bottom: 1px solid #edf2ff;
    text-align: left;
    vertical-align: top;
    font-size: 14px;
}

th {
    color: #334155;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: .06em;
}

.badge {
    display: inline-flex;
    align-items: center;
    min-height: 26px;
    padding: 0 10px;
    border-radius: 999px;
    background: #edf4ff;
    color: var(--primary-dark);
    font-size: 12px;
    font-weight: 800;
}

.notice {
    margin-bottom: 16px;
    padding: 12px 14px;
    border-radius: 14px;
    color: #05603a;
    background: #ecfdf3;
    font-weight: 700;
}

.errors {
    margin-bottom: 16px;
    padding: 12px 14px;
    border-radius: 14px;
    color: #b42318;
    background: #fef3f2;
    font-weight: 700;
}

.split {
    display: grid;
    grid-template-columns: 1.3fr .7fr;
    gap: 16px;
}

@media (max-width: 980px) {
    .app-shell { grid-template-columns: 1fr; }
    .sidebar { position: static; height: auto; }
    .stats,
    .split,
    .form-grid { grid-template-columns: 1fr; }
}
