:root {
    --bg: #f5f6f8;
    --surface: #ffffff;
    --text: #1d2330;
    --muted: #6b7280;
    --border: #e2e5ea;
    --accent: #1f5fbf;
    --accent-soft: #e8f0fb;
    --danger: #b42318;
    --danger-soft: #fdecea;
    --radius: 8px;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

a { color: var(--accent); }
h1 { font-size: 1.6rem; margin: 0; }
h2 { font-size: 1.15rem; margin: 2rem 0 .75rem; }
.muted { color: var(--muted); }

.topbar {
    display: flex; justify-content: space-between; align-items: center;
    padding: .9rem 1.5rem; background: var(--surface); border-bottom: 1px solid var(--border);
}
.brand { font-weight: 600; color: var(--text); text-decoration: none; }
.brand span { color: var(--muted); font-weight: 400; margin-left: .35rem; }
.logout { color: var(--muted); font-size: .9rem; }

.container { max-width: 1200px; margin: 0 auto; padding: 1.75rem 1.5rem 3rem; }
.page-head { margin-bottom: 1.25rem; }
.page-head p { margin: .25rem 0 0; }
.back { display: inline-block; margin-bottom: 1rem; font-size: .9rem; text-decoration: none; }

.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.25rem; }

.btn {
    display: inline-block; padding: .5rem .9rem; border: 1px solid var(--border); border-radius: 6px;
    background: var(--surface); color: var(--text); font: inherit; text-decoration: none; cursor: pointer; white-space: nowrap;
}
.btn:hover { border-color: #c7ccd4; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover { background: #194f9f; border-color: #194f9f; }
.btn-sm { padding: .3rem .65rem; font-size: .88rem; }

input, select {
    width: 100%; padding: .5rem .65rem; border: 1px solid var(--border); border-radius: 6px;
    background: var(--surface); color: var(--text); font: inherit;
}
input:focus, select:focus { outline: 2px solid var(--accent-soft); border-color: var(--accent); }
label { display: block; font-size: .85rem; color: var(--muted); margin-bottom: .3rem; }

.filters { display: flex; flex-wrap: wrap; gap: .9rem; align-items: flex-end; margin-bottom: 1.25rem; }
.filters .field { min-width: 180px; }
.filters .grow { flex: 1 1 280px; }
.filters .actions { display: flex; gap: .5rem; min-width: 0; }

.table-wrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }
.table { width: 100%; border-collapse: collapse; }
.table th, .table td { padding: .7rem .9rem; text-align: left; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table th { font-size: .8rem; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .03em; background: #fafbfc; }
.table tbody tr:last-child td { border-bottom: 0; }
.table .num { text-align: right; }
.table .nowrap { white-space: nowrap; }
.table .break { word-break: break-all; }
.table .comment { max-width: 280px; color: var(--muted); }
.table.clickable tbody tr { position: relative; }
.table.clickable tbody tr:hover { background: #f7f9fc; }
.row-link { font-weight: 600; text-decoration: none; }
.row-link::after { content: ""; position: absolute; inset: 0; }

.badge { display: inline-block; margin-left: .4rem; padding: .1rem .5rem; border-radius: 999px; font-size: .75rem; background: #eef0f3; color: var(--muted); }
.badge-accent { background: var(--accent-soft); color: var(--accent); }

.meta { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 1rem; margin: 0; }
.meta dt { font-size: .8rem; color: var(--muted); }
.meta dd { margin: .15rem 0 0; }

.pagination { display: flex; align-items: center; justify-content: center; gap: 1rem; margin-top: 1.25rem; }
.empty { padding: 2rem; text-align: center; color: var(--muted); background: var(--surface); border: 1px dashed var(--border); border-radius: var(--radius); }

.alert { padding: .7rem .9rem; border-radius: 6px; background: var(--accent-soft); color: var(--accent); }
.alert-error { background: var(--danger-soft); color: var(--danger); }

.login { min-height: 100vh; display: grid; place-items: center; padding: 1.5rem; }
.login .alert { max-width: 380px; width: 100%; }
.login-card { width: 100%; max-width: 380px; display: grid; gap: .5rem; }
.login-card h1 { font-size: 1.35rem; }
.login-card p { margin: 0 0 .75rem; }
.login-card label { margin-top: .5rem; margin-bottom: 0; }
.login-card .btn { margin-top: 1rem; padding: .65rem; }
