:root {
    --bg: #f4f7fb;
    --card: #ffffff;
    --line: #d7dfec;
    --text: #22304a;
    --muted: #61708a;
    --primary: #92cf45;
    --primary-dark: #5e9826;
    --secondary: #eef4ff;
    --danger: #da4c4c;
    --success-bg: #e9f8ee;
    --success-text: #18673a;
    --error-bg: #fff1f1;
    --error-text: #a52a2a;
    --shadow: 0 18px 40px rgba(34, 48, 74, 0.08);
    --radius: 20px;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    background: linear-gradient(180deg, #eef8dd, #f4f7fb 280px);
    color: var(--text);
    font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
}

.page { width: min(1400px, calc(100% - 32px)); margin: 24px auto 36px; }
.narrow-page { max-width: 720px; }

.topbar, .card, .login-card, .login-hero, .print-sheet {
    background: var(--card);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.topbar {
    display: flex;
    justify-content: space-between;
    gap: 20px;
    align-items: center;
    padding: 24px 28px;
    margin-bottom: 18px;
    background: linear-gradient(135deg, #e5f7a9, #badf60);
}

.topbar-actions, .action-inline, .form-actions, .filter-action {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
}

.eyebrow {
    margin: 0 0 8px;
    text-transform: uppercase;
    letter-spacing: .12em;
    font-size: 12px;
    font-weight: 700;
    color: #425619;
}

h1, h2 { margin: 0; }
.subtitle, .section-title p, .muted { color: var(--muted); }

.card { padding: 24px; margin-bottom: 18px; }

.section-title {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    align-items: flex-start;
    margin-bottom: 18px;
}

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

.alert-success { background: var(--success-bg); color: var(--success-text); }
.alert-error { background: var(--error-bg); color: var(--error-text); }
.alert ul { margin: 0 0 0 18px; padding: 0; }

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    border: none;
    border-radius: 12px;
    padding: 12px 18px;
    font: inherit;
    font-weight: 700;
    text-decoration: none;
    cursor: pointer;
    transition: 0.2s ease;
}

.btn:hover { transform: translateY(-1px); }
.btn-primary { background: var(--primary); color: #213200; }
.btn-primary:hover { background: var(--primary-dark); color: #ffffff; }
.btn-secondary, .btn-outline { background: var(--secondary); color: var(--text); border: 1px solid #cfdbf6; }
.btn-danger { background: #ffe7e7; color: var(--danger); }
.btn-small { padding: 8px 12px; font-size: 13px; }

.link-reset { color: var(--primary-dark); text-decoration: none; font-weight: 700; }

.filter-grid, .form-grid { display: grid; gap: 16px; }
.filter-grid { grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); align-items: end; }
.form-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.user-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.stats-grid { display: grid; gap: 16px; grid-template-columns: repeat(6, minmax(0, 1fr)); }
.compact-stats { grid-template-columns: repeat(3, minmax(0, 1fr)); margin-top: 8px; }

.stat-card {
    padding: 18px;
    border: 1px solid var(--line);
    border-radius: 18px;
    background: linear-gradient(180deg, #fbfff3, #ffffff);
}

.stat-label {
    display: block;
    margin-bottom: 10px;
    color: var(--muted);
    font-size: 13px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .04em;
}

.stat-card strong {
    display: block;
    font-size: 30px;
    line-height: 1.1;
    margin-bottom: 6px;
}

.stat-card small,
.field small {
    color: var(--muted);
    font-size: 13px;
}

.field { display: flex; flex-direction: column; gap: 8px; }
.field-full { grid-column: 1 / -1; }
.field label { font-weight: 600; }

.field input, .field select, .field textarea {
    width: 100%;
    padding: 12px 14px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: #fbfdff;
    color: var(--text);
    font: inherit;
}

.field textarea { min-height: 96px; resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus {
    outline: 2px solid rgba(146, 207, 69, .25);
    border-color: var(--primary);
}

.checkbox-field { justify-content: end; }
.checkbox-label { display: inline-flex; align-items: center; gap: 10px; font-weight: 600; }
.checkbox-label input { width: auto; }

table { width: 100%; min-width: 1180px; border-collapse: collapse; }
.table-wrapper { overflow-x: auto; }

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

thead th { background: #96d34d; color: #203003; }
tbody tr:nth-child(even) { background: #fcfef7; }

.thumb, .current-photo img {
    width: 88px;
    height: 88px;
    object-fit: cover;
    border-radius: 14px;
    border: 1px solid var(--line);
}

.current-photo { margin-top: 12px; display: flex; flex-direction: column; gap: 8px; }
.empty-state { text-align: center; color: var(--muted); padding: 26px 18px; }

.role-badge {
    display: inline-flex;
    padding: 6px 10px;
    border-radius: 999px;
    background: #edf6db;
    color: #48631a;
    font-size: 12px;
    font-weight: 700;
}

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

.login-shell {
    width: min(1020px, 100%);
    display: grid;
    grid-template-columns: 1.15fr .85fr;
    gap: 20px;
}

.login-hero, .login-card { padding: 32px; }
.feature-list { margin: 20px 0 0; padding: 0 0 0 18px; }
.login-form { display: grid; gap: 16px; }

.demo-box {
    margin-top: 18px;
    padding: 16px;
    border-radius: 14px;
    background: #f6f9ff;
    border: 1px solid #d8e3f7;
}

.print-page { background: #f2f2f2; }
.print-toolbar {
    width: min(1100px, calc(100% - 32px));
    margin: 20px auto 0;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

.print-sheet {
    width: min(1100px, calc(100% - 32px));
    margin: 20px auto 40px;
    padding: 24px;
}

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

.print-meta { display: grid; gap: 6px; font-size: 14px; }
.print-table { min-width: 100%; }

@media (max-width: 1024px) {
    .topbar, .section-title, .print-header { flex-direction: column; align-items: flex-start; }
    .form-grid, .user-grid, .filter-grid, .stats-grid, .compact-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .login-shell { grid-template-columns: 1fr; }
}

@media (max-width: 700px) {
    .page { width: min(100% - 20px, 100%); margin: 12px auto 20px; }
    .topbar, .card, .login-card, .login-hero, .print-sheet { padding: 18px; border-radius: 18px; }
    .form-grid, .user-grid, .filter-grid, .stats-grid, .compact-stats { grid-template-columns: 1fr; }
}

@media print {
    body { background: #ffffff; }
    .no-print { display: none !important; }
    .print-sheet { width: 100%; margin: 0; padding: 0; box-shadow: none; border-radius: 0; }
    .print-table th, .print-table td { font-size: 11px; padding: 8px; }
}
