:root {
  --bg: #f5f6f8;
  --card: #ffffff;
  --text: #1c2230;
  --muted: #6b7280;
  --line: #e5e7eb;
  --primary: #2563eb;
  --primary-d: #1d4ed8;
  --danger: #dc2626;
  --ok: #059669;
  --warn: #b45309;
  --off: #f1f2f5;
  --radius: 10px;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif; }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 24px; margin: 0; letter-spacing: -.01em; }
h2 { font-size: 16px; margin: 0 0 14px; }
hr { border: 0; border-top: 1px solid var(--line); margin: 6px 0; }
code { background: var(--off); padding: 1px 5px; border-radius: 4px; }
.wrap { max-width: 1240px; margin: 0 auto; padding: 0 16px; }
.main { padding-top: 24px; padding-bottom: 48px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.center { text-align: center; }
.danger { color: var(--danger) !important; }
.nowrap { white-space: nowrap; }
.inline { display: inline; }
.top-gap { margin-top: 18px; }
.pad { padding: 16px; }
.spacer { flex: 1; }

/* Top bar */
.topbar { background: #fff; border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 10; }
.topbar-in { display: flex; align-items: center; gap: 20px; min-height: 58px; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; color: var(--text); white-space: nowrap; }
.brand:hover { text-decoration: none; }
.logo { display: inline-grid; place-items: center; width: 30px; height: 30px; border-radius: 8px; background: var(--primary); color: #fff; font-weight: 800; }
.logo.big { width: 48px; height: 48px; font-size: 22px; border-radius: 12px; }
.nav { display: flex; align-items: center; gap: 4px; flex: 1; flex-wrap: wrap; }
.nav a, .linkbtn { color: var(--text); padding: 7px 10px; border-radius: 8px; font-size: 14px; }
.nav a:hover, .linkbtn:hover { background: var(--off); text-decoration: none; }
.nav a.on { background: #eef3ff; color: var(--primary); font-weight: 600; }
.nav-sep { width: 1px; height: 22px; background: var(--line); margin: 0 6px; }
.nav-spacer { flex: 1; }
.count { display: inline-block; min-width: 20px; padding: 0 6px; border-radius: 10px; background: var(--danger); color: #fff; font-size: 12px; text-align: center; font-weight: 700; }
.linkbtn { background: none; border: 0; cursor: pointer; font: inherit; }
.menu-btn { display: none; margin-left: auto; background: none; border: 1px solid var(--line); border-radius: 8px; font-size: 18px; padding: 4px 10px; cursor: pointer; }

/* Cards & layout */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; margin-bottom: 18px; }
.card.flush { padding: 0; overflow: hidden; }
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.grid-2 > .card { margin-bottom: 18px; }
.row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 12px; align-items: end; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.end { display: flex; align-items: flex-end; }
.toolbar-in { display: flex; align-items: center; gap: 8px; padding: 12px 16px; border-bottom: 1px solid var(--line); flex-wrap: wrap; background: #fafbfc; }
.form-foot { display: flex; gap: 10px; padding: 14px 16px; border-top: 1px solid var(--line); flex-wrap: wrap; background: #fafbfc; }
.filters { display: flex; gap: 10px; align-items: center; margin-bottom: 14px; flex-wrap: wrap; }
.filters label { display: flex; align-items: center; gap: 8px; }
.filters label > input { margin-top: 0; width: auto; }

/* Forms */
label { display: block; font-size: 13px; font-weight: 600; color: #374151; }
label > input, label > select, label > textarea { display: block; margin-top: 5px; }
label > .pw-row { margin-top: 5px; }
label .muted { font-weight: 400; }
label.check { display: flex; align-items: center; gap: 8px; font-weight: 500; }
label.check > input { margin: 0; width: auto; min-height: 0; }
input[type=text], input[type=email], input[type=password], input[type=date], input[type=month], input[type=number], select, textarea {
  font: inherit; font-weight: 400; color: var(--text); background: #fff; border: 1px solid #d1d5db; border-radius: 8px; padding: 8px 10px; width: 100%; min-height: 38px;
}
input:focus, select:focus, textarea:focus { outline: 2px solid #bfd3fe; border-color: var(--primary); }
textarea { resize: vertical; }
.pw-row { display: flex; gap: 6px; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; font: inherit; font-weight: 600; font-size: 14px; border-radius: 8px; padding: 8px 14px; border: 1px solid transparent; cursor: pointer; white-space: nowrap; min-height: 38px; }
.btn:hover { text-decoration: none; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-d); }
.btn-ghost { background: #fff; color: var(--text); border-color: #d1d5db; }
.btn-ghost:hover { background: var(--off); }
.btn.small { padding: 4px 10px; font-size: 13px; min-height: 30px; }
.btn-row { display: flex; gap: 8px; }

/* Alerts & badges */
.alert { padding: 11px 14px; border-radius: 8px; margin-bottom: 16px; border: 1px solid; }
.alert-success { background: #ecfdf5; border-color: #a7f3d0; color: #065f46; }
.alert-error { background: #fef2f2; border-color: #fecaca; color: #991b1b; }
.alert-info { background: #eff6ff; border-color: #bfdbfe; color: #1e3a8a; }
.badge { display: inline-block; padding: 2px 8px; border-radius: 20px; font-size: 12px; font-weight: 600; background: var(--off); color: #374151; white-space: nowrap; }
.st-pending { background: #fef3c7; color: #92400e; }
.st-approved { background: #d1fae5; color: #065f46; }
.st-rejected { background: #fee2e2; color: #991b1b; }
.st-cancelled { background: #f3f4f6; color: #6b7280; text-decoration: line-through; }
.chip { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; white-space: nowrap; }
.chip::before { content: ""; width: 9px; height: 9px; border-radius: 3px; background: var(--c); }
.dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: var(--c); }

/* Stats */
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 18px; }
.stats.compact { grid-template-columns: repeat(5, 1fr); }
.stat { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; display: flex; flex-direction: column; gap: 2px; }
.stat.wide { grid-column: 1 / -1; }
.stat.accent { border-color: #bfd3fe; background: #f5f8ff; }
.stat-label { font-size: 13px; color: var(--muted); }
.stat-value { font-size: 28px; font-weight: 700; letter-spacing: -.02em; }
.stats.compact .stat-value { font-size: 22px; }
.small-v { font-size: 18px; }
.bar { height: 6px; background: #e5e7eb; border-radius: 4px; overflow: hidden; margin: 6px 0 4px; }
.bar span { display: block; height: 100%; background: var(--primary); border-radius: 4px; }
.year-nav, .month-nav { display: flex; align-items: center; gap: 10px; }
.year-nav strong, .month-nav strong { min-width: 70px; text-align: center; font-size: 16px; }
.month-nav strong { min-width: 150px; }
.tabs { display: flex; gap: 4px; background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 4px; }
.tabs a { padding: 6px 12px; border-radius: 7px; color: var(--text); font-size: 14px; }
.tabs a.on { background: var(--primary); color: #fff; }
.tabs a:hover { text-decoration: none; }

/* Tables */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 600; padding: 10px 12px; border-bottom: 1px solid var(--line); background: #fafbfc; }
.table td { padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.card:not(.flush) .table th { background: none; }
.num { text-align: right; }
.actions { text-align: right; white-space: nowrap; }
.actions .btn + .btn, .actions .btn + form { margin-left: 4px; }
.num-in { width: 72px !important; text-align: right; }
tr.inactive td { opacity: .55; }
.att td { padding: 6px 12px; }
.att select { min-width: 150px; }
.att .att-hours { width: 80px; text-align: right; }
.att tr.off td { background: var(--off); color: var(--muted); }
.att tr.today td:first-child { box-shadow: inset 3px 0 var(--primary); }
.dl { display: grid; grid-template-columns: 140px 1fr; gap: 6px 12px; margin: 0 0 10px; }
.dl dt { color: var(--muted); }
.dl dd { margin: 0; }
.away { list-style: none; padding: 0; margin: 0 0 14px; }
.away li { display: flex; align-items: center; gap: 8px; padding: 7px 0; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.plain { list-style: none; padding: 0; margin: 0; }
.plain li { padding: 6px 0; border-bottom: 1px solid var(--line); }

/* Pending requests */
.req { display: grid; grid-template-columns: 1fr 320px; gap: 20px; align-items: center; }
.req-main { display: flex; flex-direction: column; gap: 5px; }
.req-name { font-size: 16px; margin-right: 8px; }
.req-dates { font-size: 16px; font-weight: 600; }
.req-actions { display: flex; flex-direction: column; gap: 8px; }
.req-actions .btn { flex: 1; }
.quote { border-left: 3px solid var(--line); padding-left: 10px; color: #374151; }
details summary { cursor: pointer; }

/* Calendar */
.cal-wrap { overflow-x: auto; }
.cal { border-collapse: separate; border-spacing: 0; width: 100%; font-size: 13px; }
.cal th, .cal td { border-bottom: 1px solid var(--line); border-right: 1px solid #f0f1f3; text-align: center; padding: 0; height: 38px; min-width: 32px; }
.cal thead th { padding: 6px 0; background: #fafbfc; font-weight: 600; }
.cal thead .d { display: block; font-size: 14px; }
.cal thead .w { display: block; font-size: 11px; color: var(--muted); font-weight: 400; }
.cal .cal-name { position: sticky; left: 0; background: #fff; text-align: left; padding: 0 12px; min-width: 170px; white-space: nowrap; font-weight: 600; z-index: 1; border-right: 1px solid var(--line); }
.cal thead .cal-name { background: #fafbfc; }
.cal .off { background: var(--off); }
.cal .today { box-shadow: inset 0 0 0 2px var(--primary); }
.cell { display: inline-grid; place-items: center; width: 100%; height: 26px; background: var(--c); color: #fff; font-size: 11px; font-weight: 700; border-radius: 4px; }
.cal td .cell { width: calc(100% - 4px); }
.cell.pending { background: repeating-linear-gradient(45deg, color-mix(in srgb, var(--c) 35%, #fff) 0 5px, color-mix(in srgb, var(--c) 18%, #fff) 5px 10px); color: var(--c); outline: 1px dashed var(--c); }
.cell.offcell { background: var(--off); border: 1px solid var(--line); }
.legend { display: flex; flex-wrap: wrap; gap: 8px 18px; margin: 0 0 12px; font-size: 13px; }
.legend > span { display: inline-flex; align-items: center; gap: 6px; }
.legend .cell { width: 30px; height: 20px; }

/* Login */
.login { min-height: 75vh; display: grid; place-items: center; }
.login-card { width: 100%; max-width: 400px; padding: 28px; }
.wide-card { max-width: 520px; }
.login-head { text-align: center; margin-bottom: 18px; }
.login-head h1 { margin-top: 10px; font-size: 22px; }
.login-head p { margin: 4px 0 0; }

@media (max-width: 1100px) {
  .menu-btn { display: block; }
  .topbar-in { flex-wrap: wrap; }
  .nav { display: none; flex-basis: 100%; flex-direction: column; align-items: stretch; padding-bottom: 10px; }
  body.nav-open .nav { display: flex; }
  .nav-sep { width: 100%; height: 1px; margin: 4px 0; }
  .nav-spacer { display: none; }
  .nav form { display: block; }
}
@media (max-width: 900px) {
  .grid-2, .req { grid-template-columns: 1fr; }
  .stats, .stats.compact { grid-template-columns: 1fr 1fr; }
  .row-3 { grid-template-columns: 1fr; }
  .page-head { align-items: flex-start; }
}
@media (max-width: 520px) {
  .row-2 { grid-template-columns: 1fr; }
  h1 { font-size: 20px; }
  .stat-value { font-size: 22px; }
}
