:root {
    --bg: #f4f6f9; --card: #fff; --text: #1f2937; --muted: #6b7280; --line: #e5e7eb;
    --primary: #1e4e8c; --primary-h: #173d6f; --ok: #15803d; --warn: #b45309; --bad: #b91c1c;
}
* { box-sizing: border-box; }
body { margin: 0; font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif; background: var(--bg); color: var(--text); }
a { color: var(--primary); }
h1 { font-size: 1.6rem; margin: 0 0 1rem; }
h2 { font-size: 1.15rem; margin: 0 0 .75rem; }
.container { max-width: 1150px; margin: 0 auto; padding: 1.25rem 16px 3rem; }

.topbar { background: var(--primary); color: #fff; }
.topbar-inner { max-width: 1150px; margin: 0 auto; padding: 0 16px; display: flex; flex-wrap: wrap; align-items: center; gap: 4px 20px; min-height: 52px; }
.brand { color: #fff; font-weight: 700; text-decoration: none; }
.nav { display: flex; flex-wrap: wrap; gap: 2px; flex: 1; }
.nav a { color: #dbe7f6; text-decoration: none; padding: 14px 10px; }
.nav a:hover, .nav a.active { color: #fff; background: rgba(255,255,255,.14); }
.userbox { display: flex; gap: 12px; font-size: .9rem; }
.userbox a { color: #dbe7f6; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 1.1rem 1.25rem; margin-bottom: 1.25rem; }
.grid { display: grid; gap: 1rem; }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.stat { text-align: center; }
.stat .num { font-size: 2.2rem; font-weight: 700; color: var(--primary); line-height: 1.1; }
.stat .lbl { color: var(--muted); font-size: .85rem; }

table { width: 100%; border-collapse: collapse; background: var(--card); }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: .78rem; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); background: #f9fafb; }
td.num, th.num { text-align: right; white-space: nowrap; }
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 10px; margin-bottom: 1.25rem; }
.table-wrap table { margin: 0; }
tr.total td { font-weight: 700; background: #f3f4f6; }
tr.group td { background: #eef2f7; font-weight: 700; }

label { display: block; font-size: .85rem; font-weight: 600; margin-bottom: 3px; }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=date], select, textarea {
    width: 100%; padding: 8px 10px; border: 1px solid #cbd5e1; border-radius: 7px; font: inherit; background: #fff;
}
input:focus, select:focus, textarea:focus { outline: 2px solid #93b4e0; border-color: var(--primary); }
.form-grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); }
.form-row { margin-bottom: 14px; }
.inline-form { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; }
.inline-form > div { min-width: 150px; }
.check { display: flex; align-items: center; gap: 8px; font-weight: 400; }
.check input { width: auto; }
.hint { color: var(--muted); font-size: .82rem; margin-top: 3px; }

.btn { display: inline-block; border: 0; border-radius: 7px; padding: 8px 14px; font: inherit; font-weight: 600; cursor: pointer; background: var(--primary); color: #fff; text-decoration: none; }
.btn:hover { background: var(--primary-h); }
.btn-ok { background: var(--ok); } .btn-ok:hover { background: #116530; }
.btn-bad { background: var(--bad); } .btn-bad:hover { background: #991b1b; }
.btn-light { background: #e5e7eb; color: var(--text); } .btn-light:hover { background: #d1d5db; }
.btn-sm { padding: 4px 10px; font-size: .85rem; }

.badge { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: .78rem; font-weight: 600; }
.badge-pending { background: #fef3c7; color: #92400e; }
.badge-approved { background: #dcfce7; color: #166534; }
.badge-rejected { background: #fee2e2; color: #991b1b; }
.badge-cancelled { background: #e5e7eb; color: #4b5563; }
.badge-off { background: #e5e7eb; color: #4b5563; }

.alert { padding: 10px 14px; border-radius: 8px; margin-bottom: 1rem; border: 1px solid; }
.alert-ok { background: #f0fdf4; border-color: #86efac; color: #166534; }
.alert-error { background: #fef2f2; border-color: #fca5a5; color: #991b1b; }
.alert-warn { background: #fffbeb; border-color: #fcd34d; color: #92400e; }
.warn { color: var(--warn); font-size: .85rem; }
.muted { color: var(--muted); }
.right { text-align: right; }
.mt { margin-top: 1rem; }
.actions { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.actions form { margin: 0; display: inline-flex; gap: 6px; align-items: center; }
.actions input[type=text] { width: 150px; padding: 4px 8px; }

.login-box { max-width: 380px; margin: 8vh auto 0; }
.login-box h1 { text-align: center; }

/* calendar */
.cal { table-layout: fixed; }
.cal th { text-align: center; }
.cal td { height: 92px; padding: 4px; border: 1px solid var(--line); font-size: .78rem; overflow: hidden; }
.cal td.other { background: #f9fafb; }
.cal td.weekend { background: #f3f4f6; }
.cal td.holiday { background: #fff1f2; }
.cal .d { font-weight: 700; margin-bottom: 2px; }
.cal .hol { color: var(--bad); font-size: .72rem; }
.ev { border-radius: 4px; padding: 0 4px; margin-bottom: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ev-approved { background: #dcfce7; color: #166534; }
.ev-pending { background: #fef3c7; color: #92400e; }
.cal-nav { display: flex; gap: 10px; align-items: center; margin-bottom: 1rem; flex-wrap: wrap; }

@media (max-width: 700px) {
    .topbar-inner { padding-top: 6px; }
    .nav a { padding: 8px; }
    .cal td { height: 64px; font-size: .68rem; }
}

.foot { text-align: center; color: var(--muted); font-size: .78rem; padding: 0 16px 24px; }
.imgprev { margin: 6px 0; padding: 8px; border: 1px dashed #cbd5e1; border-radius: 8px; background: #fff; text-align: center; }
.imgprev img { max-height: 70px; max-width: 100%; }
