:root {
  --navy: #1f3864; --navy-2: #2d4f8a; --ink: #1d1d1f; --muted: #6b7280; --line: #d9dee7;
  --bg: #f4f6fa; --card: #fff; --ok: #1e7b34; --ok-bg: #e3f4e6; --warn: #8a5a00; --warn-bg: #fff3d6;
  --err: #a11a1a; --err-bg: #fbe3e3; --info: #1f3864; --info-bg: #e6edf8; --amber: #b8860b; --red: #c0392b;
  --s1: #eef3fb; --s2: #f7f7f7; --s3: #eef3fb; --s4: #f7f7f7;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink); font: 15px/1.45 -apple-system, "Segoe UI", Roboto, Arial, sans-serif; }
a { color: var(--navy-2); }
.wrap { max-width: 1400px; margin: 0 auto; padding: 0 18px; }
header.top { background: var(--navy); color: #fff; }
header.top .wrap { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 12px 18px; flex-wrap: wrap; }
.brand { display: flex; flex-direction: column; }
.brand .org { font-size: 12px; letter-spacing: .06em; text-transform: uppercase; opacity: .85; }
.brand .ttl { font-weight: 600; font-size: 17px; }
header nav a { color: #fff; text-decoration: none; margin-left: 16px; padding: 6px 2px; border-bottom: 2px solid transparent; }
header nav a.on { border-bottom-color: #fff; }
main { padding: 18px 0 30px; }
.foot { color: var(--muted); font-size: 13px; padding: 18px; text-align: center; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 20px 22px; margin-bottom: 18px; }
.card.narrow { max-width: 460px; margin: 40px auto; }
h1 { font-size: 24px; margin: 0 0 8px; color: var(--navy); }
h2 { font-size: 17px; margin: 0 0 10px; color: var(--navy); }
.muted { color: var(--muted); }
.help { color: #374151; }
.form label { display: block; margin: 10px 0; font-weight: 500; }
.form input[type=text], .form input[type=password], .form input[type=number], .form select { display: block; width: 100%; margin-top: 4px; padding: 9px 10px; border: 1px solid var(--line); border-radius: 6px; font: inherit; }
.form.inline { display: flex; gap: 14px; align-items: flex-end; flex-wrap: wrap; }
.form.inline label { margin: 0; }
.form.inline input { display: inline-block; width: auto; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.btn { background: var(--navy); color: #fff; border: 0; border-radius: 6px; padding: 10px 18px; font: inherit; font-weight: 600; cursor: pointer; text-decoration: none; display: inline-block; }
.btn:hover { background: var(--navy-2); }
.btn:disabled { opacity: .6; cursor: default; }
.btn-sm { padding: 7px 12px; font-size: 14px; }
.btn-ghost { background: #fff; color: var(--navy); border: 1px solid var(--navy); }
.chk { font-weight: 500; }
.alert { padding: 10px 14px; border-radius: 8px; margin: 10px 0; border: 1px solid transparent; }
.alert-ok { background: var(--ok-bg); color: var(--ok); border-color: #bfe3c6; }
.alert-warn { background: var(--warn-bg); color: var(--warn); border-color: #f3d58a; }
.alert-err { background: var(--err-bg); color: var(--err); border-color: #f1b3b3; }
.alert-info { background: var(--info-bg); color: var(--info); border-color: #c5d3ea; }
.inline-list { list-style: none; padding: 0; margin: 6px 0 0; display: flex; flex-wrap: wrap; gap: 6px 14px; }
.pill { display: inline-block; font-size: 11px; font-weight: 700; letter-spacing: .03em; padding: 1px 7px; border-radius: 999px; vertical-align: middle; }
.pill-red { background: #fde2e1; color: var(--red); }
.pill-amber { background: #fff0c2; color: #8a5a00; }
.pill-grey { background: #e5e7eb; color: #4b5563; }
.sal { color: var(--muted); font-weight: 400; }

/* search */
.search { position: relative; max-width: 560px; }
.search input { width: 100%; padding: 12px 14px; font-size: 17px; border: 2px solid var(--navy); border-radius: 8px; }
.results { position: absolute; z-index: 10; left: 0; right: 0; background: #fff; border: 1px solid var(--line); border-radius: 8px; margin: 4px 0 0; padding: 4px 0; list-style: none; box-shadow: 0 8px 24px rgba(0,0,0,.12); max-height: 360px; overflow: auto; }
.results li { padding: 9px 14px; cursor: pointer; }
.results li:hover, .results li.sel { background: var(--info-bg); }
.results li.inactive { opacity: .55; }

/* person page */
.person { display: flex; justify-content: space-between; align-items: flex-start; gap: 20px; flex-wrap: wrap; }
.person .meta { color: #374151; }
.quota { text-align: right; }
.quota .big { font-size: 34px; font-weight: 700; color: var(--navy); line-height: 1; }
.quota.over .big { color: var(--red); }
.grid-wrap { overflow-x: auto; }
table.grid { border-collapse: separate; border-spacing: 6px; width: 100%; min-width: 720px; }
table.grid th { font-weight: 600; color: var(--navy); font-size: 14px; }
table.grid th small { font-weight: 400; color: var(--muted); }
table.grid th.date { text-align: left; white-space: nowrap; color: var(--ink); font-weight: 400; }
td.slot { padding: 0; }
td.slot label { display: flex; align-items: center; gap: 8px; padding: 10px 12px; border: 1.5px solid var(--line); border-radius: 8px; background: #fff; cursor: pointer; min-height: 52px; }
td.slot input { display: none; }
td.slot .mark { width: 20px; height: 20px; border: 2px solid #9aa4b2; border-radius: 5px; flex: none; position: relative; }
td.slot.have label { border-color: var(--ok); background: var(--ok-bg); }
td.slot.have .mark { background: var(--ok); border-color: var(--ok); }
td.slot.have .mark::after { content: ""; position: absolute; left: 5px; top: 1px; width: 6px; height: 11px; border: solid #fff; border-width: 0 2.5px 2.5px 0; transform: rotate(45deg); }
td.slot.need label { border-color: #e6c46a; background: #fffaf0; }
td.slot.full label, td.slot.locked label, td.slot.dim label { background: #f3f4f6; color: var(--muted); cursor: not-allowed; }
td.slot .cnt { font-size: 13px; color: var(--muted); }
td.slot .cnt .c { font-weight: 700; color: var(--ink); }
.actions { margin-top: 10px; display: flex; gap: 14px; align-items: center; }
.mylist { padding-left: 20px; }

/* chart */
.chart-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; flex-wrap: wrap; margin-bottom: 10px; }
.toolbar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.toolbar input, .toolbar select { padding: 8px 10px; border: 1px solid var(--line); border-radius: 6px; font: inherit; }
.toolbar input { min-width: 220px; }
table.chart { border-collapse: collapse; font-size: 13px; white-space: nowrap; }
table.chart th, table.chart td { border: 1px solid var(--line); padding: 4px 6px; text-align: center; }
table.chart thead th { background: var(--navy); color: #fff; position: sticky; top: 0; z-index: 3; }
table.chart thead tr.sessrow th { top: 34px; background: var(--navy-2); font-weight: 500; }
table.chart th.day { border-left: 2px solid #fff; }
table.chart td.cell.s1, table.chart td.cell.s3 { background: var(--s1); }
table.chart td.cell.s2, table.chart td.cell.s4 { background: var(--s2); }
table.chart td.cell.s1 { border-left: 2px solid #b7c2d6; }
table.chart td.on { color: var(--ok); font-weight: 700; font-size: 15px; background: #d8f0dc !important; }
table.chart .sticky-col { position: sticky; left: 0; background: #fff; z-index: 2; }
table.chart .name-col { left: 40px; text-align: left; min-width: 220px; }
table.chart thead .sticky-col { z-index: 4; background: var(--navy); }
table.chart tfoot th { background: #eef1f6; position: sticky; bottom: 0; }
table.chart tfoot th.short { background: #fde2e1; color: var(--red); }
table.chart tfoot th.ok { background: #d8f0dc; color: var(--ok); }
table.chart td.tot { font-weight: 700; }
table.chart td.tot.below { color: var(--red); }
table.chart td.tot.met { color: var(--ok); }
table.chart td.cat { color: var(--muted); font-size: 12px; }
table.chart tbody tr:hover td { filter: brightness(.97); }
table.chart td.num { color: var(--muted); }

/* admin */
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
table.mini { border-collapse: collapse; font-size: 14px; margin-bottom: 10px; }
table.mini th, table.mini td { border: 1px solid var(--line); padding: 5px 9px; text-align: left; }
table.mini th { background: #eef1f6; }
table.mini td.short { background: #fde2e1; }
table.req td { white-space: nowrap; }
ul.plain { list-style: none; padding: 0; margin: 8px 0; }
ul.plain li { padding: 4px 0; border-bottom: 1px dashed var(--line); }
ul.scroll { max-height: 300px; overflow: auto; }

@media (max-width: 860px) { .two-col, .row2 { grid-template-columns: 1fr; } .card { padding: 16px; } h1 { font-size: 20px; } }

@media print {
  @page { size: A3 landscape; margin: 10mm; }
  body { background: #fff; font-size: 11px; }
  header.top, footer, .toolbar, .print-hide, .card > p.muted { display: none !important; }
  .card { border: 0; padding: 0; margin: 0; }
  .grid-wrap { overflow: visible; }
  table.chart { font-size: 10px; }
  table.chart th, table.chart td { padding: 2px 4px; }
  table.chart thead th, table.chart .sticky-col { position: static; }
  table.chart thead th { background: #1f3864 !important; color: #fff !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  table.chart td.on { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  a { color: inherit; text-decoration: none; }
}

.rules ul { margin: 6px 0 0 20px; padding: 0; }
.rules li { margin: 3px 0; }
