:root {
    --bg: #f4f6fa;
    --panel: #ffffff;
    --line: #dde3ec;
    --text: #1f2733;
    --muted: #6b7688;
    --brand: #2f6fed;
    --brand-dark: #2454bd;
    --ok: #1d8a4e;
    --err: #d13b3b;
    --warn: #d98411;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
    font-size: 15px;
    line-height: 1.45;
}

a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }

.topbar {
    display: flex;
    align-items: center;
    gap: 18px;
    padding: 10px 20px;
    background: #1b2433;
    color: #fff;
    flex-wrap: wrap;
    position: sticky;
    top: 0;
    z-index: 20;
}
.topbar .brand a { color: #fff; font-weight: 700; font-size: 17px; text-decoration: none; }
.mainnav { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; flex: 1; }
.mainnav a {
    color: #cdd6e4;
    padding: 6px 10px;
    border-radius: 6px;
    text-decoration: none;
    white-space: nowrap;
}
.mainnav a:hover { background: #2a3547; color: #fff; text-decoration: none; }
.mainnav a.active { background: var(--brand); color: #fff; }
.mainnav .sep { width: 1px; height: 22px; background: #3a465c; margin: 0 6px; }
.userbox { display: flex; align-items: center; gap: 10px; color: #cdd4e0; }
.userbox a { color: #fff; }
.userbox .link { background: none; border: 0; color: #9fb0c8; cursor: pointer; font-size: 14px; }
.userbox .link:hover { color: #fff; text-decoration: underline; }

.container { max-width: 1180px; margin: 0 auto; padding: 22px 20px 60px; }

h1 { font-size: 22px; margin: 0 0 14px; }
h2 { font-size: 18px; margin: 22px 0 10px; }
h3 { font-size: 15px; margin: 14px 0 6px; }

.alert { padding: 10px 14px; border-radius: 8px; margin-bottom: 14px; }
.alert.ok { background: #e6f6ec; color: var(--ok); border: 1px solid #b8e6c9; }
.alert.err { background: #fdeaea; color: var(--err); border: 1px solid #f3bcbc; }
.alert ul { margin: 0; padding-left: 18px; }

.card { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 18px; margin-bottom: 18px; }
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 14px; }
.stat { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 14px 16px; }
.stat .num { font-size: 26px; font-weight: 700; }
.stat .lbl { color: var(--muted); font-size: 13px; }

table.tbl { width: 100%; border-collapse: collapse; background: var(--panel); border: 1px solid var(--line); border-radius: 8px; overflow: hidden; margin-bottom: 12px; }
table.tbl th, table.tbl td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
table.tbl th { background: #eef2f8; font-size: 13px; color: #44506b; font-weight: 600; }
table.tbl tr:last-child td { border-bottom: none; }
table.tbl tr.cancelled td { color: #a0a7b5; text-decoration: line-through; }

.filters { display: flex; flex-wrap: wrap; gap: 14px; align-items: flex-end; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 14px; margin-bottom: 16px; }
.filters label { display: flex; flex-direction: column; font-size: 13px; color: var(--muted); gap: 4px; }

input[type=text], input[type=email], input[type=password], input[type=date], input[type=number], select, textarea {
    font: inherit; padding: 7px 9px; border: 1px solid #c6ceda; border-radius: 7px; background: #fff; color: var(--text); min-width: 130px;
}
textarea { min-width: 240px; min-height: 70px; }
input:focus, select:focus, textarea:focus { outline: 2px solid #bcd0f7; border-color: var(--brand); }

.btn { display: inline-block; padding: 8px 14px; border-radius: 8px; border: 1px solid #c6ceda; background: #fff; color: var(--text); cursor: pointer; font: inherit; }
.btn:hover { background: #f1f4f9; text-decoration: none; }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn.primary:hover { background: var(--brand-dark); }
.btn.small { padding: 3px 9px; font-size: 13px; }
.btn.danger { color: var(--err); border-color: #f0bcbc; }
.btn.danger:hover { background: #fdeaea; }

form.inline { display: inline; }
.link { background: none; border: none; color: var(--brand); cursor: pointer; font: inherit; padding: 0; }
.link:hover { text-decoration: underline; }

.muted { color: var(--muted); }
.row { display: flex; gap: 16px; flex-wrap: wrap; align-items: flex-end; margin-bottom: 10px; }
.field { display: flex; flex-direction: column; gap: 4px; margin-bottom: 12px; }
.field > span { font-size: 13px; color: var(--muted); }

.badge { display: inline-block; padding: 1px 8px; border-radius: 20px; font-size: 12px; }
.badge.red { background: #fdeaea; color: var(--err); }
.badge.orange { background: #fdf1e0; color: var(--warn); }
.badge.blue { background: #e7effe; color: var(--brand); }
.badge.green { background: #e6f6ec; color: var(--ok); }
.badge.gray { background: #eef1f6; color: var(--muted); }

.day-block { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; margin-bottom: 12px; }
.day-block h3 { margin: 0 0 8px; }

.att-grid { width: 100%; border-collapse: collapse; }
.att-grid th, .att-grid td { border-bottom: 1px solid var(--line); padding: 7px 8px; text-align: left; }
.att-grid th { background: #eef2f8; font-size: 13px; }
.att-grid .opt { display: inline-flex; align-items: center; gap: 4px; margin-right: 10px; font-size: 13px; }

.auth-wrap { max-width: 420px; margin: 60px auto; }
.auth-wrap .card { padding: 24px; }
.auth-wrap h1 { text-align: center; }

.footer { text-align: center; color: var(--muted); padding: 16px; font-size: 12px; }

.pagination { display: flex; gap: 6px; list-style: none; padding: 0; flex-wrap: wrap; margin: 0; }
.pagination li span, .pagination li a { display: inline-block; padding: 4px 10px; border: 1px solid var(--line); border-radius: 6px; background: #fff; line-height: 1.3; }
.pagination li a { text-decoration: none; }
.pagination li a:hover { background: #eef2f8; }
.pagination li.active span { background: var(--brand); color: #fff; border-color: var(--brand); }
.pagination li.disabled span { color: #b6bdca; background: #f7f9fc; cursor: default; }
.pagination svg { width: 1em; height: 1em; display: inline-block; vertical-align: -0.1em; }

.pager { display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: center; justify-content: space-between; margin: 14px 0 4px; }
.pager .pager-info { font-size: 13px; }

.pill { display: inline-block; padding: 2px 10px; border-radius: 20px; font-size: 12px; background: #eef1f6; color: var(--muted); }
.pill.pending { background: #fdf1e0; color: var(--warn); }
.pill.active { background: #e6f6ec; color: var(--ok); }
.pill.blocked { background: #fdeaea; color: var(--err); }
