* {
    box-sizing: border-box;
}

:root {
    --bg: #f5f7fb;
    --card: #ffffff;
    --sidebar: #121826;
    --sidebar-soft: #1b2436;
    --text: #1c2434;
    --muted: #6c768a;
    --border: #e6ebf2;
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --danger: #dc2626;
    --success-bg: #ecfdf5;
    --success-text: #047857;
    --error-bg: #fef2f2;
    --error-text: #b91c1c;
    --shadow: 0 12px 40px rgba(18, 24, 38, 0.08);
    --radius: 18px;
}

html {
    scroll-behavior: smooth;
}

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

.login-body {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 24px;
    background: linear-gradient(135deg, #eff6ff, #f8fafc);
}

.login-card {
    width: 100%;
    max-width: 420px;
    background: var(--card);
    border-radius: 24px;
    padding: 32px;
    box-shadow: var(--shadow);
}

.brand-dot {
    width: 14px;
    height: 14px;
    border-radius: 999px;
    background: var(--primary);
    margin-bottom: 16px;
}

.login-card h1,
.page-header h1 {
    margin: 0 0 8px;
}

.login-card p,
.page-header p,
.card-header p,
.empty-state {
    color: var(--muted);
    margin-top: 0;
}

.layout {
    display: grid;
    grid-template-columns: 280px 1fr;
    min-height: 100vh;
}

.sidebar {
    background: var(--sidebar);
    color: #fff;
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 24px;
    position: sticky;
    top: 0;
    height: 100vh;
}

.sidebar-top h2 {
    margin: 0;
    font-size: 22px;
}

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

.nav a {
    color: #dbe7ff;
    text-decoration: none;
    padding: 12px 14px;
    border-radius: 12px;
    background: transparent;
}

.nav a:hover {
    background: var(--sidebar-soft);
}

.sidebar-bottom {
    margin-top: auto;
    display: grid;
    gap: 10px;
}

.content {
    padding: 28px;
    display: grid;
    gap: 24px;
}

.card {
    background: var(--card);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 22px;
}

.card-header {
    display: flex;
    align-items: start;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 18px;
}

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

.summary-box {
    padding: 18px;
    border: 1px solid var(--border);
    border-radius: 16px;
    background: #fbfdff;
}

.summary-box span {
    display: block;
    color: var(--muted);
    margin-bottom: 8px;
}

.summary-box strong {
    font-size: 22px;
}

.filters-grid,
.inline-form,
.password-grid,
.modal-form {
    display: grid;
    gap: 16px;
}

.filters-grid {
    grid-template-columns: repeat(3, minmax(160px, 1fr));
    width: 100%;
    max-width: 700px;
}

.inline-form {
    grid-template-columns: minmax(220px, 320px) auto;
    align-items: end;
}

.password-grid {
    grid-template-columns: repeat(4, minmax(180px, 1fr));
    align-items: end;
}

.table-wrap {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
}

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

th {
    color: var(--muted);
    font-weight: 600;
    font-size: 14px;
}

.actions-cell {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

label {
    display: block;
    margin-bottom: 6px;
    font-size: 14px;
    color: var(--muted);
}

input, select, textarea, button {
    font: inherit;
}

input[type="text"],
input[type="password"],
input[type="date"],
input[type="month"],
input[type="number"],
select,
textarea {
    width: 100%;
    padding: 12px 14px;
    border-radius: 12px;
    border: 1px solid #d7deea;
    background: #fff;
    color: var(--text);
}

textarea {
    resize: vertical;
}

.btn {
    border: 0;
    border-radius: 12px;
    padding: 12px 16px;
    cursor: pointer;
    text-decoration: none;
    display: inline-flex;
    justify-content: center;
    align-items: center;
}

.btn-small {
    padding: 8px 12px;
    font-size: 14px;
}

.btn-full {
    width: 100%;
}

.btn-primary {
    background: var(--primary);
    color: #fff;
}

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

.btn-secondary {
    background: #eef2ff;
    color: #243b7d;
}

.btn-danger {
    background: #fee2e2;
    color: #991b1b;
}

.alert {
    padding: 14px 16px;
    border-radius: 14px;
    margin-bottom: 4px;
}

.alert.success {
    background: var(--success-bg);
    color: var(--success-text);
}

.alert.error {
    background: var(--error-bg);
    color: var(--error-text);
}

.positive {
    color: #047857;
    font-weight: 700;
}

.negative {
    color: #b91c1c;
    font-weight: 700;
}

.check-wrap {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin: 0;
}

.switch-line {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-top: 10px;
}

.modal {
    position: fixed;
    inset: 0;
    display: none;
    z-index: 1000;
}

.modal.is-visible {
    display: block;
}

.modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.55);
}

.modal-content {
    position: relative;
    z-index: 2;
    width: min(720px, calc(100% - 24px));
    margin: 60px auto;
    background: var(--card);
    border-radius: 22px;
    box-shadow: 0 30px 80px rgba(0,0,0,.2);
    padding: 22px;
}

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

.modal-header h3 {
    margin: 0;
}

.modal-close {
    background: transparent;
    font-size: 28px;
    line-height: 1;
    color: #64748b;
}

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

.full-width {
    grid-column: 1 / -1;
}

.modal-actions {
    display: flex;
    justify-content: end;
    gap: 10px;
}

.login-note {
    margin-top: 18px;
    color: var(--muted);
    font-size: 14px;
}

.stack-form {
    display: grid;
    gap: 14px;
}

@media (max-width: 1100px) {
    .summary-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
    .password-grid {
        grid-template-columns: 1fr 1fr;
    }
}

@media (max-width: 860px) {
    .layout {
        grid-template-columns: 1fr;
    }
    .sidebar {
        position: relative;
        height: auto;
    }
    .filters-grid,
    .inline-form,
    .password-grid,
    .modal-form {
        grid-template-columns: 1fr;
    }
    .summary-grid {
        grid-template-columns: 1fr;
    }
}
