* { box-sizing: border-box; }
:root {
    --bg: #f4f5f7;
    --surface: #ffffff;
    --text: #17191d;
    --muted: #626873;
    --border: #dfe3e8;
    --primary: #20242a;
    --primary-hover: #0f1114;
    --success: #137a3c;
    --danger: #b42318;
    --warning: #a45d00;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
html { background: var(--bg); }
body { margin: 0; color: var(--text); background: var(--bg); }
a { color: inherit; }
.topbar {
    background: #fff;
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 20;
}
.topbar-inner {
    max-width: 1180px;
    min-height: 68px;
    margin: 0 auto;
    padding: 0 20px;
    display: flex;
    align-items: center;
    gap: 28px;
}
.brand {
    font-size: 1.25rem;
    font-weight: 800;
    text-decoration: none;
    white-space: nowrap;
}
.main-nav {
    display: flex;
    gap: 8px;
    flex: 1;
}
.main-nav a, .user-menu a {
    text-decoration: none;
    padding: 10px 12px;
    border-radius: 10px;
}
.main-nav a:hover, .user-menu a:hover { background: #f0f2f4; }
.user-menu {
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--muted);
    font-size: .92rem;
}
.page {
    max-width: 1180px;
    margin: 0 auto;
    padding: 32px 20px 60px;
}
.page-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 24px;
}
h1 { font-size: clamp(1.8rem, 4vw, 2.5rem); margin: 0; }
h2 { margin-top: 0; }
.muted { color: var(--muted); }
.grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 16px;
}
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 20px;
    box-shadow: 0 8px 24px rgba(0,0,0,.04);
}
.stat-number { font-size: 2rem; font-weight: 800; margin-top: 8px; }
.stat-label { color: var(--muted); }
.actions { display: flex; flex-wrap: wrap; gap: 10px; }
.btn {
    appearance: none;
    border: 0;
    border-radius: 12px;
    background: var(--primary);
    color: #fff;
    padding: 12px 16px;
    font: inherit;
    font-weight: 700;
    cursor: pointer;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 46px;
}
.btn:hover { background: var(--primary-hover); }
.btn-secondary {
    background: #eef0f3;
    color: var(--text);
}
.btn-secondary:hover { background: #e3e6ea; }
.btn-danger { background: var(--danger); }
.btn-small { min-height: 38px; padding: 8px 12px; font-size: .9rem; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 14px 12px; border-bottom: 1px solid var(--border); vertical-align: top; }
th { color: var(--muted); font-size: .85rem; text-transform: uppercase; letter-spacing: .03em; }
tr:last-child td { border-bottom: 0; }
.form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0,1fr));
    gap: 18px;
}
.field { display: flex; flex-direction: column; gap: 7px; }
.field.full { grid-column: 1 / -1; }
label { font-weight: 700; }
input, textarea, select {
    width: 100%;
    border: 1px solid #cfd5dc;
    background: #fff;
    color: var(--text);
    border-radius: 11px;
    min-height: 46px;
    padding: 10px 12px;
    font: inherit;
}
textarea { min-height: 110px; resize: vertical; }
input:focus, textarea:focus, select:focus {
    outline: 3px solid rgba(32,36,42,.12);
    border-color: #777f89;
}
.help { color: var(--muted); font-size: .88rem; }
.alert {
    padding: 14px 16px;
    border-radius: 12px;
    margin-bottom: 18px;
    border: 1px solid transparent;
}
.alert-success { background: #eaf7ef; color: #0f6c35; border-color: #bfe5cc; }
.alert-error { background: #fff0ef; color: #9f1d13; border-color: #f0c6c2; }
.alert-warning { background: #fff6e8; color: #8c5200; border-color: #efd4a8; }
.login-shell {
    max-width: 460px;
    margin: 6vh auto 0;
}
.login-card { padding: 28px; }
.login-card h1 { margin-bottom: 8px; }
.stack { display: flex; flex-direction: column; gap: 16px; }
.searchbar {
    display: flex;
    gap: 10px;
    margin-bottom: 18px;
}
.searchbar input { flex: 1; }
.empty {
    text-align: center;
    padding: 48px 20px;
    color: var(--muted);
}
.footer {
    max-width: 1180px;
    margin: 0 auto;
    padding: 0 20px 40px;
    color: var(--muted);
    font-size: .85rem;
}
.badge {
    display: inline-flex;
    padding: 5px 9px;
    border-radius: 999px;
    font-size: .8rem;
    font-weight: 700;
    background: #eef0f3;
}
@media (max-width: 850px) {
    .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .main-nav { display: none; }
    .user-menu span { display: none; }
}
@media (max-width: 620px) {
    .page { padding: 22px 14px 48px; }
    .topbar-inner { padding: 0 14px; min-height: 62px; }
    .grid { grid-template-columns: 1fr; }
    .form-grid { grid-template-columns: 1fr; }
    .field.full { grid-column: auto; }
    .page-head { align-items: flex-start; flex-direction: column; }
    .page-head .btn { width: 100%; }
    .searchbar { flex-direction: column; }
    .searchbar .btn { width: 100%; }
}

.check-row { display:flex; flex-wrap:wrap; gap:14px; }
.check-row label { display:flex; align-items:center; gap:7px; font-weight:600; }
.check-row input[type="checkbox"] { width:20px; min-height:20px; height:20px; }
.detail-grid { display:grid; grid-template-columns:repeat(4,minmax(0,1fr)); gap:16px; }
.detail-grid > div { display:flex; flex-direction:column; gap:5px; }
@media (max-width:850px) { .detail-grid { grid-template-columns:repeat(2,minmax(0,1fr)); } }
@media (max-width:620px) { .detail-grid { grid-template-columns:1fr; } }
