/* ===== Графік офісу — стиль у дусі Google Calendar (Material 3) ===== */

:root {
  --bg: #f8fafd;
  --surface: #ffffff;
  --surface-2: #f0f4f9;
  --text: #1f1f1f;
  --text-2: #444746;
  --text-3: #747775;
  --line: #dde3ea;
  --outline: #c4c7c5;
  --primary: #0b57d0;
  --on-primary: #ffffff;
  --primary-cont: #c2e7ff;
  --on-primary-cont: #001d35;
  --hover: rgba(68, 71, 70, .08);
  --press: rgba(68, 71, 70, .12);
  --pending-bg: #e9eef6;
  --pending-text: #5f6368;
  --danger: #b3261e;
  --ok: #146c2e;
  --warn: #8a5300;
  --hatch: rgba(68, 71, 70, .07);
  --shadow-1: 0 1px 2px rgba(60, 64, 67, .3), 0 1px 3px 1px rgba(60, 64, 67, .15);
  --shadow-2: 0 1px 3px rgba(60, 64, 67, .3), 0 4px 8px 3px rgba(60, 64, 67, .15);
  --radius-l: 16px;
  --font: "Google Sans", "Google Sans Text", Roboto, "Segoe UI", Arial, sans-serif;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #131314;
    --surface: #1e1f20;
    --surface-2: #28292a;
    --text: #e3e3e3;
    --text-2: #c4c7c5;
    --text-3: #8e918f;
    --line: #3c4043;
    --outline: #5f6368;
    --primary: #a8c7fa;
    --on-primary: #062e6f;
    --primary-cont: #004a77;
    --on-primary-cont: #c2e7ff;
    --hover: rgba(227, 227, 227, .08);
    --press: rgba(227, 227, 227, .12);
    --pending-bg: #2d3033;
    --pending-text: #bdc1c6;
    --danger: #f2b8b5;
    --ok: #6dd58c;
    --warn: #ffb95c;
    --hatch: rgba(227, 227, 227, .06);
    --shadow-1: 0 1px 2px rgba(0, 0, 0, .5), 0 1px 3px 1px rgba(0, 0, 0, .3);
    --shadow-2: 0 1px 3px rgba(0, 0, 0, .5), 0 4px 8px 3px rgba(0, 0, 0, .3);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 400 14px/20px var(--font);
  -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--primary); }
:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.muted { color: var(--text-2); }
.small { font-size: 12px; line-height: 16px; }
.hidden { display: none !important; }

.ms {
  font-family: "Material Symbols Outlined";
  font-weight: normal;
  font-style: normal;
  font-size: 22px;
  line-height: 1;
  letter-spacing: normal;
  text-transform: none;
  display: inline-block;
  white-space: nowrap;
  direction: ltr;
  -webkit-font-feature-settings: "liga";
  font-feature-settings: "liga";
  -webkit-font-smoothing: antialiased;
  font-variation-settings: "FILL" 0, "wght" 400, "GRAD" 0, "opsz" 24;
  user-select: none;
}
.ms.fill { font-variation-settings: "FILL" 1, "wght" 400, "GRAD" 0, "opsz" 24; }

/* ---------- Кнопки ---------- */

.icon-btn {
  width: 40px; height: 40px;
  border: 0; border-radius: 50%;
  background: transparent;
  color: var(--text-2);
  display: inline-grid; place-items: center;
  cursor: pointer;
  flex: none;
}
.icon-btn:hover { background: var(--hover); }
.icon-btn:active { background: var(--press); }
.icon-btn.sm { width: 32px; height: 32px; }
.icon-btn.sm .ms { font-size: 20px; }

.btn {
  height: 36px;
  padding: 0 16px;
  border-radius: 18px;
  border: 1px solid var(--outline);
  background: transparent;
  color: var(--text);
  font-weight: 500;
  cursor: pointer;
  display: inline-flex; align-items: center; gap: 8px;
  white-space: nowrap;
}
.btn:hover { background: var(--hover); }
.btn:disabled { opacity: .45; cursor: default; background: transparent; }
.btn.filled { background: var(--primary); color: var(--on-primary); border-color: transparent; }
.btn.filled:hover { box-shadow: var(--shadow-1); background: var(--primary); }
.btn.tonal { background: var(--primary-cont); color: var(--on-primary-cont); border-color: transparent; }
.btn.text { border-color: transparent; color: var(--primary); padding: 0 12px; }
.btn.danger { color: var(--danger); }
.btn.text.danger:hover { background: color-mix(in srgb, var(--danger) 8%, transparent); }
.btn .ms { font-size: 18px; }
a.btn { text-decoration: none; }

/* ---------- Верхня панель ---------- */

.topbar {
  height: 64px;
  display: flex; align-items: center; gap: 4px;
  padding: 8px 12px 8px 8px;
  position: sticky; top: 0; z-index: 20;
  background: var(--bg);
}
.brand { display: flex; align-items: center; gap: 10px; padding: 0 16px 0 4px; min-width: 200px; text-decoration: none; color: var(--text); }
.dept-switch { display: inline-flex; align-items: center; gap: 6px; height: 36px; padding: 0 6px 0 10px; margin-right: 12px;
  border: 1px solid var(--line); border-radius: 18px; color: var(--text-2); font-size: 14px; background: var(--surface); }
.tbl tr.no-dept td { background: color-mix(in srgb, var(--warn) 7%, transparent); }
.dept-switch.static { padding-right: 14px; }
.dept-switch .ms { font-size: 18px; }
.dept-switch select { border: 0; background: transparent; color: var(--text); font: inherit; font-weight: 500; cursor: pointer; padding-right: 4px; max-width: 200px; }
.brand-name { font-size: 22px; line-height: 28px; color: var(--text-2); white-space: nowrap; }
.logo-tile {
  width: 40px; height: 40px; flex: none;
  border-radius: 8px;
  background: #fff;
  border: 1px solid #dadce0;
  position: relative;
  overflow: hidden;
  display: grid; place-items: center;
  box-shadow: 0 1px 1px rgba(0,0,0,.08);
}
.logo-tile::before { content: ""; position: absolute; inset: 0 0 auto; height: 9px; background: #1a73e8; }
.logo-tile span { position: relative; top: 4px; font-weight: 500; font-size: 18px; color: #1a73e8; }
.topbar .today-btn { margin: 0 8px 0 8px; height: 40px; border-radius: 20px; padding: 0 24px; }
.period-title { min-width: 0; font-size: 22px; line-height: 28px; font-weight: 400; margin: 0 0 0 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.spacer { flex: 1; }

.seg { flex: none; display: inline-flex; border: 1px solid var(--outline); border-radius: 20px; overflow: hidden; height: 40px; margin-right: 8px; }
.seg button { border: 0; background: transparent; padding: 0 16px; cursor: pointer; font-weight: 500; color: var(--text); display: flex; align-items: center; gap: 6px; }
.seg button + button { border-left: 1px solid var(--outline); }
.seg button.on { background: var(--primary-cont); color: var(--on-primary-cont); }
.seg .ms { display: none; font-size: 20px; }
.seg button.on::before { content: "check"; font-family: "Material Symbols Outlined"; font-size: 18px; }

.avatar-btn { border: 0; background: transparent; padding: 4px; border-radius: 50%; cursor: pointer; }
.avatar-btn:hover { background: var(--hover); }

/* ---------- Аватари ---------- */

.av {
  width: 20px; height: 20px; flex: none;
  border-radius: 50%;
  display: inline-grid; place-items: center;
  font-size: 11px; font-weight: 500;
  color: #fff;
  background: var(--c, #616161);
  overflow: hidden;
}
.av img { width: 100%; height: 100%; object-fit: cover; }
.av.lg { width: 32px; height: 32px; font-size: 14px; }
.av.xl { width: 64px; height: 64px; font-size: 26px; }

/* ---------- Розкладка ---------- */

.layout { display: flex; height: calc(100vh - 64px); }
.sidebar {
  width: 256px; flex: none;
  padding: 8px 12px 24px 12px;
  overflow-y: auto;
  transition: margin-left .2s ease;
}
.layout.collapsed .sidebar { margin-left: -256px; }
.main-panel {
  flex: 1; min-width: 0;
  display: flex; flex-direction: column;
  background: var(--surface);
  border-radius: var(--radius-l) var(--radius-l) 0 0;
  margin-right: 12px;
  overflow: auto;
  position: relative;
}

.fab {
  height: 56px;
  padding: 0 20px 0 16px;
  border: 0;
  border-radius: 16px;
  background: var(--surface);
  color: var(--text);
  font-weight: 500;
  display: inline-flex; align-items: center; gap: 12px;
  box-shadow: var(--shadow-1);
  cursor: pointer;
  margin: 0 0 20px 4px;
}
.fab:hover { box-shadow: var(--shadow-2); background: color-mix(in srgb, var(--primary) 6%, var(--surface)); }
.fab .ms { font-size: 26px; color: var(--primary); }

.side-section { margin: 0 4px 20px; }
.side-title { font-size: 14px; font-weight: 500; margin: 0 0 8px 4px; display: flex; align-items: center; justify-content: space-between; }

/* Мій тиждень */
/* Не бере участі в графіку: блоку «Мій тиждень» немає; кнопки «Відсутність» — лише в адміна */
body.observer #myWeek { display: none; }
body.observer:not(.observer-admin) #absenceBtn { display: none; }
.myweek {
  background: var(--surface-2);
  border-radius: 16px;
  padding: 14px 12px 12px;
}
.myweek-head { display: flex; justify-content: space-between; align-items: baseline; margin: 0 2px 10px; }
.myweek-head strong { font-weight: 500; }
.myweek.cur { background: color-mix(in srgb, var(--ok) 9%, var(--surface, transparent)); }
.myweek.other { background: color-mix(in srgb, var(--primary) 8%, var(--surface, transparent)); }
/* Поточний тиждень — зелений, інші — сині */
.wk-tag { font-size: 12px; font-weight: 500; padding: 2px 8px; border-radius: 10px; }
.wk-tag.cur { background: color-mix(in srgb, var(--ok) 14%, transparent); color: var(--ok); }
.wk-tag.other { background: var(--primary-cont); color: var(--on-primary-cont); }
.pills { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }
.pill {
  height: 52px;
  border-radius: 12px;
  border: 1px solid var(--outline);
  background: var(--surface);
  cursor: pointer;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 0;
  position: relative;
  padding: 0;
}
.pill b { font-weight: 500; font-size: 16px; line-height: 20px; }
.pill small { font-size: 11px; line-height: 14px; color: var(--text-2); }
.pill:hover:not(:disabled) { background: color-mix(in srgb, var(--primary) 8%, var(--surface)); }
.pill.pending { border: 2px dashed var(--primary); }
.pill.approved { background: var(--primary); border-color: var(--primary); color: var(--on-primary); }
.pill.approved small { color: inherit; opacity: .85; }
.pill.pinned::after { content: "push_pin"; font-family: "Material Symbols Outlined"; position: absolute; bottom: 1px; font-size: 11px; line-height: 1; font-variation-settings: "FILL" 1; }
.pill:disabled { cursor: not-allowed; }
.pill.blocked { background: repeating-linear-gradient(135deg, var(--hatch) 0 5px, transparent 5px 10px), var(--surface); color: var(--text-3); border-style: dashed; }
.pill.absent, .pill.holiday { background: var(--surface-2); color: var(--text-3); border-color: transparent; }
.pill.past { opacity: .5; }
.pill .tag { position: absolute; bottom: -1px; font-size: 11px; }
.myweek-status { margin: 10px 2px 0; font-size: 13px; line-height: 18px; color: var(--text-2); }
.myweek-status b { color: var(--text); font-weight: 500; }
.norm-bar { height: 4px; border-radius: 2px; background: var(--line); margin: 8px 2px 0; overflow: hidden; display: flex; }
.norm-bar i { display: block; height: 100%; background: var(--primary); }
.norm-bar i.pend { background: color-mix(in srgb, var(--primary) 40%, transparent); }

/* Міні-календар */
.mini-head { display: flex; align-items: center; justify-content: space-between; padding: 0 0 4px 8px; font-weight: 500; }
.mini-grid { display: grid; grid-template-columns: repeat(7, 1fr); text-align: center; font-size: 11px; }
.mini-grid .dow { color: var(--text-2); height: 24px; line-height: 24px; font-weight: 500; }
.mini-grid button {
  width: 28px; height: 28px; margin: 1px auto;
  border: 0; border-radius: 50%;
  background: transparent; cursor: pointer;
  font-size: 11px; font-weight: 500;
}
.mini-grid button:hover { background: var(--hover); }
.mini-grid button.out { color: var(--text-3); font-weight: 400; }
.mini-grid button.wkend { color: var(--text-3); }
.mini-grid button.inweek { background: var(--primary-cont); color: var(--on-primary-cont); border-radius: 0; font-weight: 700;
  box-shadow: inset 0 2px 0 var(--primary), inset 0 -2px 0 var(--primary); }
/* Поточний тиждень — легка заливка */
.mini-grid button.inweek.cur { background: color-mix(in srgb, var(--ok) 16%, transparent); color: var(--ok);
  box-shadow: inset 0 2px 0 var(--ok), inset 0 -2px 0 var(--ok); }
.mini-grid button.thisweek { background: color-mix(in srgb, var(--ok) 10%, transparent); border-radius: 0; }
.mini-grid button.today { background: var(--primary); color: var(--on-primary); border-radius: 50%; box-shadow: none; }
/* Мої віддалені дні: зелене коло (погоджено) або зелений контур (очікує) */
.mini-grid button.mine { border-radius: 50%; }
.mini-grid button.mine.approved { background: var(--ok); color: var(--on-primary); }
.mini-grid button.mine.pending { box-shadow: inset 0 0 0 2px var(--ok); color: var(--ok); }
.mini-grid button.today.mine { background: var(--primary); color: var(--on-primary); box-shadow: 0 0 0 2px var(--ok); }

/* Команда */
.team-list { list-style: none; margin: 0; padding: 0; }
.team-list label {
  display: flex; align-items: center; gap: 12px;
  padding: 4px 8px; border-radius: 4px; cursor: pointer;
  min-height: 32px;
}
.team-list label:hover { background: var(--hover); }
.team-list input { appearance: none; width: 18px; height: 18px; margin: 0; border: 2px solid var(--c); border-radius: 2px; display: grid; place-items: center; flex: none; cursor: pointer; }
.team-list input:checked { background: var(--c); }
.team-list input:checked::after { content: "check"; font-family: "Material Symbols Outlined"; color: #fff; font-size: 15px; font-weight: 700; }
.team-list .nm { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.team-list .left-n { margin-left: auto; padding-left: 6px; }

.legend { display: grid; gap: 8px; font-size: 12px; color: var(--text-2); }
.legend div { display: flex; align-items: center; gap: 10px; }
.legend .sw { width: 28px; height: 14px; border-radius: 4px; flex: none; }
.sw.approved { background: #039be5; }
.sw.pending { border: 1.5px solid #039be5; background: var(--surface); }
.sw.pinned { background: #039be5; position: relative; }
.sw.pinned::after { content: "push_pin"; font-family: "Material Symbols Outlined"; font-variation-settings: "FILL" 1; color: #fff; font-size: 11px; position: absolute; right: 2px; top: 1px; }
.sw.blocked { background: repeating-linear-gradient(135deg, var(--outline) 0 2px, transparent 2px 5px); border: 1px solid var(--outline); }
.sw.abs { background: #33b679; }
.sw.abs-pending { background: var(--pending-bg); border: 1px dashed var(--outline); }

/* ---------- Тиждень ---------- */

#cal { flex: 1; display: flex; flex-direction: column; min-height: 0; }
.wk { min-width: 560px; display: flex; flex-direction: column; flex: 1; }
.wk-row { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); }
.wk-head { position: sticky; top: 0; z-index: 3; background: var(--surface); border-bottom: 1px solid var(--line); }
.wk-hd { text-align: center; padding: 14px 4px 10px; border-left: 1px solid transparent; }
.wk-hd .dow { font-size: 11px; font-weight: 500; letter-spacing: .8px; color: var(--text-2); }
.wk-hd .num {
  width: 46px; height: 46px; margin: 4px auto 2px;
  border-radius: 50%; border: 0; background: transparent; cursor: pointer;
  font-size: 26px; line-height: 46px; color: var(--text-2);
  display: block;
}
.wk-hd .num:hover { background: var(--hover); }
.wk-hd.today .dow { color: var(--primary); }
.wk-hd.today .num { background: var(--primary); color: var(--on-primary); }
.wk-hd .meta { font-size: 12px; color: var(--text-2); min-height: 16px; }
.wk-hd .meta.hol { color: var(--danger); font-weight: 500; }
.wk-hd .meta.warn { color: var(--danger); font-weight: 500; }

.wk-allday {
  display: grid; grid-template-columns: repeat(5, minmax(0, 1fr));
  grid-auto-rows: 24px;
  row-gap: 2px;
  padding: 4px 0;
  border-bottom: 1px solid var(--line);
  min-height: 12px;
}
.bar {
  margin: 0 6px;
  border: 0;
  border-radius: 4px;
  padding: 0 8px;
  font-size: 12px; line-height: 24px; font-weight: 500;
  text-align: left;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  cursor: pointer;
  background: var(--c);
  color: var(--fg, #fff);
}
.bar.pending {
  background: var(--pending-bg);
  color: var(--pending-text);
  outline: 1px dashed var(--outline);
  outline-offset: -1px;
  font-weight: 400;
}
.bar.pending em { font-style: normal; opacity: .9; }
.bar.cont-l { border-top-left-radius: 0; border-bottom-left-radius: 0; margin-left: 0; }
.bar.cont-r { border-top-right-radius: 0; border-bottom-right-radius: 0; margin-right: 0; }

.wk-body { flex: 1; grid-auto-rows: 1fr; }
.wk-col {
  border-left: 1px solid var(--line);
  padding: 8px 6px 40px;
  min-height: 420px;
  display: flex; flex-direction: column; gap: 3px;
  cursor: pointer;
  position: relative;
}
.wk-col:first-child { border-left: 0; }
.wk-col:hover { background: color-mix(in srgb, var(--hover) 50%, transparent); }
.wk-col.today { background: color-mix(in srgb, var(--primary) 3%, transparent); }
.wk-col.blocked { background: repeating-linear-gradient(135deg, var(--hatch) 0 8px, transparent 8px 16px); }
.wk-col.holiday { background: var(--surface-2); cursor: default; }
.wk-col .col-note { font-size: 12px; color: var(--text-2); display: flex; align-items: center; gap: 6px; padding: 4px 6px; }
.wk-col .col-note .ms { font-size: 16px; }
.wk-col .add-hint {
  position: absolute; left: 6px; right: 6px; bottom: 8px;
  height: 28px; border-radius: 14px;
  border: 1px dashed var(--outline);
  display: none; align-items: center; justify-content: center; gap: 4px;
  font-size: 12px; color: var(--text-2);
}
.wk-col:hover .add-hint { display: flex; }

.chip {
  display: flex; align-items: center; gap: 8px;
  width: 100%;
  min-height: 30px;
  padding: 3px 8px 3px 4px;
  border: 0;
  border-radius: 6px;
  background: var(--c);
  color: var(--fg, #fff);
  font-size: 13px; font-weight: 500;
  text-align: left;
  cursor: pointer;
}
.chip .av { background: rgba(255,255,255,.28); color: inherit; }
.chip .nm { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chip .ms { font-size: 16px; }
.chip:hover { filter: brightness(.96); box-shadow: var(--shadow-1); }
.chip.pending {
  background: var(--surface);
  color: var(--text);
  box-shadow: inset 0 0 0 1.5px var(--c);
  font-weight: 400;
}
.chip.pending .av { background: var(--c); color: #fff; }
.chip.pending .st { font-size: 11px; color: var(--text-2); }
.chip.rejected { background: var(--surface); color: var(--text-3); box-shadow: inset 0 0 0 1px var(--outline); text-decoration: line-through; font-weight: 400; }
.chip.rejected .av { background: var(--outline); }
.chip.me { outline: 2px solid color-mix(in srgb, var(--c) 35%, transparent); outline-offset: 1px; }

/* ---------- Місяць ---------- */

.mo { display: flex; flex-direction: column; flex: 1; min-width: 560px; }
.mo-head { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); position: sticky; top: 0; background: var(--surface); z-index: 2; }
.mo-head div { text-align: center; font-size: 11px; font-weight: 500; letter-spacing: .8px; color: var(--text-2); padding: 10px 0 6px; }
.mo-grid { flex: 1; display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); grid-auto-rows: minmax(120px, 1fr); }
.mo-cell { border-left: 1px solid var(--line); border-top: 1px solid var(--line); padding: 4px 4px 6px; cursor: pointer; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.mo-cell:nth-child(5n+1) { border-left: 0; }
.mo-cell:hover { background: color-mix(in srgb, var(--hover) 50%, transparent); }
.mo-cell.out .mo-num { color: var(--text-3); }
.mo-cell.holiday { background: var(--surface-2); }
.mo-cell.blocked { background: repeating-linear-gradient(135deg, var(--hatch) 0 8px, transparent 8px 16px); }
.mo-num { text-align: center; font-size: 12px; font-weight: 500; }
.mo-num span { display: inline-block; min-width: 24px; height: 24px; line-height: 24px; border-radius: 12px; }
.mo-cell.today .mo-num span { background: var(--primary); color: var(--on-primary); }
.mo-hol { font-size: 11px; color: var(--danger); text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mo-item {
  font-size: 12px; line-height: 20px;
  border-radius: 4px; padding: 0 6px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  display: flex; align-items: center; gap: 6px;
}
.mo-item .ms { font-size: 14px; }
.mo-item .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--c); flex: none; }
.mo-item.approved { background: var(--c); color: var(--fg, #fff); }
.mo-item.approved .dot { display: none; }
.mo-item.pending { color: var(--text); }
.mo-item.pending .dot { background: transparent; box-shadow: inset 0 0 0 1.5px var(--c); }
.mo-item.abs { background: var(--c); color: var(--fg, #fff); }
.mo-item.abs.pend { background: var(--pending-bg); color: var(--pending-text); }
.mo-more { font-size: 12px; font-weight: 500; color: var(--text-2); padding: 0 6px; border: 0; background: transparent; text-align: left; cursor: pointer; border-radius: 4px; }
.mo-more:hover { background: var(--hover); }

/* ---------- Діалоги ---------- */

dialog.dlg {
  border: 0; padding: 0;
  border-radius: 28px;
  background: var(--surface);
  color: var(--text);
  width: min(480px, calc(100vw - 32px));
  max-height: calc(100vh - 48px);
  box-shadow: var(--shadow-2);
}
dialog.dlg::backdrop { background: rgba(0, 0, 0, .32); }
dialog.dlg[open] { animation: dlg-in .16s ease-out; }
@keyframes dlg-in { from { opacity: 0; transform: scale(.96); } to { opacity: 1; transform: none; } }
.dlg-in { padding: 24px; display: flex; flex-direction: column; gap: 16px; }
.dlg-head { display: flex; align-items: flex-start; gap: 12px; }
.dlg-head h2 { font-size: 22px; line-height: 28px; font-weight: 400; margin: 0; flex: 1; }
.dlg-head .sub { display: block; font-size: 14px; color: var(--text-2); margin-top: 4px; }
.dlg-actions { display: flex; justify-content: flex-end; gap: 8px; flex-wrap: wrap; }
.dlg-scroll { overflow-y: auto; max-height: 50vh; margin: 0 -24px; padding: 0 24px; }

.plist { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.plist li { display: flex; align-items: center; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.plist li:last-child { border-bottom: 0; }
.plist .who { flex: 1; min-width: 0; }
.plist.compact li { padding: 4px 0; gap: 8px; border-bottom: 0; }
.plist-title .ms { font-size: 16px; vertical-align: -3px; }
.chip > .ms { font-size: 14px; opacity: .8; }
.chip .note-ic { font-size: 14px; margin-left: auto; opacity: .8; }
.plist .note-line { display: block; white-space: normal; }
.plist .who b { font-weight: 500; display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.plist .acts { display: flex; gap: 2px; }
.plist-title { font-size: 12px; font-weight: 500; color: var(--text-2); margin: 4px 0 0; }

.badge { display: inline-flex; align-items: center; gap: 4px; height: 22px; padding: 0 8px; border-radius: 11px; font-size: 12px; font-weight: 500; white-space: nowrap; }
.badge .ms { font-size: 14px; }
.badge.approved { background: color-mix(in srgb, var(--ok) 14%, transparent); color: var(--ok); }
.badge.pending { background: color-mix(in srgb, var(--warn) 14%, transparent); color: var(--warn); }
.badge.rejected { background: color-mix(in srgb, var(--danger) 12%, transparent); color: var(--danger); }
.badge.neutral { background: var(--surface-2); color: var(--text-2); }
.badge.super { background: color-mix(in srgb, #f4511e 16%, transparent); color: #c43d12; }
.badge.newbie { background: color-mix(in srgb, var(--primary) 14%, transparent); color: var(--primary); }
.left-n { font-size: 12px; font-weight: 500; color: var(--warn); white-space: nowrap; }
.left-n.done { color: var(--ok); }
.cell-left { display: block; font-size: 12px; margin-top: 2px; }

.note-box { border-radius: 12px; padding: 12px 14px; background: var(--surface-2); color: var(--text-2); display: flex; gap: 10px; align-items: flex-start; }
.note-box .ms { font-size: 20px; }
.note-box.warn { background: color-mix(in srgb, var(--warn) 12%, var(--surface)); color: var(--text); }
.note-box.err { background: color-mix(in srgb, var(--danger) 10%, var(--surface)); color: var(--text); }

/* ---------- Форми ---------- */

.field { display: flex; flex-direction: column; gap: 6px; }
.field > span { font-size: 12px; font-weight: 500; color: var(--text-2); }
.input, select.input, textarea.input {
  height: 44px;
  border: 1px solid var(--outline);
  border-radius: 8px;
  padding: 0 12px;
  background: var(--surface);
  width: 100%;
}
textarea.input { height: auto; min-height: 76px; padding: 10px 12px; resize: vertical; }
.input:focus { outline: 2px solid var(--primary); outline-offset: -1px; border-color: transparent; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.choice { display: flex; gap: 8px; flex-wrap: wrap; }
.choice label { cursor: pointer; }
.choice input { position: absolute; opacity: 0; pointer-events: none; }
.choice span {
  display: inline-flex; align-items: center; gap: 6px;
  height: 36px; padding: 0 14px;
  border: 1px solid var(--outline); border-radius: 8px;
  font-weight: 500;
}
.choice input:checked + span { background: var(--primary-cont); color: var(--on-primary-cont); border-color: transparent; }
.choice input:focus-visible + span { outline: 2px solid var(--primary); outline-offset: 2px; }
.switch { display: flex; align-items: center; justify-content: space-between; gap: 16px; cursor: pointer; }
.switch input { appearance: none; width: 52px; height: 32px; border-radius: 16px; background: var(--surface-2); border: 2px solid var(--outline); position: relative; flex: none; cursor: pointer; margin: 0; transition: background .15s; }
.switch input::after { content: ""; position: absolute; width: 16px; height: 16px; border-radius: 50%; background: var(--outline); top: 6px; left: 6px; transition: all .15s; }
.switch input:checked { background: var(--primary); border-color: var(--primary); }
.switch input:checked::after { background: var(--on-primary); width: 24px; height: 24px; top: 2px; left: 22px; }

/* ---------- Меню профілю ---------- */

.menu {
  position: fixed; z-index: 50;
  top: 60px; right: 12px;
  width: 320px;
  background: var(--surface-2);
  border-radius: 24px;
  box-shadow: var(--shadow-2);
  padding: 16px 8px 8px;
}
.menu-user { text-align: center; padding: 8px 16px 16px; }
.menu-user .av { margin: 0 auto 8px; }
.menu-user b { display: block; font-size: 18px; font-weight: 400; }
.menu-item {
  width: 100%;
  display: flex; align-items: center; gap: 14px;
  border: 0; background: var(--surface);
  padding: 12px 16px;
  cursor: pointer; text-decoration: none; color: var(--text);
  text-align: left;
}
.menu-item:first-of-type { border-radius: 16px 16px 4px 4px; }
.menu-item:last-of-type { border-radius: 4px 4px 16px 16px; }
.menu-item + .menu-item { margin-top: 2px; }
.menu-item:hover { background: color-mix(in srgb, var(--hover) 100%, var(--surface)); }
.menu-item .ms { color: var(--text-2); }
.menu-item small { display: block; color: var(--text-2); }

/* ---------- Сповіщення внизу ---------- */

#snackbar {
  position: fixed; left: 24px; bottom: 24px; z-index: 100;
  max-width: min(560px, calc(100vw - 48px));
  background: #303030; color: #f2f2f2;
  border-radius: 4px;
  padding: 14px 16px;
  box-shadow: var(--shadow-2);
  transform: translateY(150%);
  transition: transform .2s ease;
}
#snackbar.show { transform: none; }
#snackbar.err { background: #8c1d18; }

.loading-line { position: absolute; top: 0; left: 0; right: 0; height: 3px; overflow: hidden; z-index: 5; }
.loading-line::after { content: ""; position: absolute; height: 100%; width: 30%; background: var(--primary); animation: load 1s infinite ease-in-out; }
@keyframes load { from { left: -30%; } to { left: 100%; } }

/* ---------- Вхід ---------- */

.login-page { display: grid; place-items: center; min-height: 100vh; padding: 24px; }
.login-card {
  background: var(--surface);
  border-radius: 28px;
  padding: 40px 36px 32px;
  width: min(420px, 100%);
  text-align: center;
  display: flex; flex-direction: column; align-items: center; gap: 12px;
}
.login-card .logo-tile { width: 56px; height: 56px; border-radius: 12px; }
.login-card .logo-tile::before { height: 13px; }
.login-card .logo-tile span { font-size: 24px; top: 6px; }
.login-card h1 { font-size: 28px; font-weight: 400; margin: 8px 0 0; }
.login-card p { margin: 0 0 12px; }
.g-btn {
  display: inline-flex; align-items: center; gap: 12px;
  height: 44px; padding: 0 24px;
  border: 1px solid var(--outline); border-radius: 22px;
  background: var(--surface); color: var(--text);
  font-weight: 500; text-decoration: none;
}
.g-btn:hover { background: var(--hover); }
.login-error { background: color-mix(in srgb, var(--danger) 10%, var(--surface)); color: var(--danger); border-radius: 12px; padding: 10px 14px; width: 100%; }
.dev-login { margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--line); display: flex; flex-direction: column; gap: 8px; width: 100%; }
.dev-login input { height: 40px; border: 1px solid var(--outline); border-radius: 8px; padding: 0 12px; background: var(--surface); }

/* ---------- Адмінка ---------- */

.admin-nav { list-style: none; padding: 0; margin: 0; }
.admin-nav a {
  display: flex; align-items: center; gap: 12px;
  height: 48px; padding: 0 16px 0 18px;
  border-radius: 24px;
  color: var(--text-2); text-decoration: none; font-weight: 500;
}
.admin-nav a:hover { background: var(--hover); }
.admin-nav a.on { background: var(--primary-cont); color: var(--on-primary-cont); }
.admin-nav a.on .ms { font-variation-settings: "FILL" 1; }
.admin-nav .count { margin-left: auto; font-size: 12px; font-weight: 500; }

.adm { padding: 24px 32px 64px; max-width: 1100px; }
.adm h1 { font-size: 28px; line-height: 36px; font-weight: 400; margin: 0 0 4px; }
.adm .lead { color: var(--text-2); margin: 0 0 24px; max-width: 70ch; }
.adm h2 { font-size: 16px; font-weight: 500; margin: 28px 0 12px; display: flex; align-items: center; gap: 12px; }
.card { border: 1px solid var(--line); border-radius: 16px; padding: 20px; background: var(--surface); }
.card + .card { margin-top: 12px; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px; align-items: end; }
.form-actions { display: flex; gap: 8px; margin-top: 16px; flex-wrap: wrap; }
.setting-row { display: grid; grid-template-columns: 1fr 260px; gap: 24px; align-items: center; padding: 14px 0; border-bottom: 1px solid var(--line); }
.setting-row:last-child { border-bottom: 0; }
.setting-row b { font-weight: 500; display: block; }
.setting-row p { margin: 2px 0 0; color: var(--text-2); font-size: 13px; }
.setting-row .ctl { display: flex; gap: 8px; align-items: center; justify-content: flex-end; }

.tbl-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 16px; }
table.tbl { border-collapse: collapse; width: 100%; font-size: 14px; }
.tbl th { text-align: left; font-weight: 500; font-size: 12px; color: var(--text-2); padding: 12px 14px; border-bottom: 1px solid var(--line); white-space: nowrap; background: var(--surface); position: sticky; top: 0; }
.tbl td { padding: 10px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl tr:hover td { background: color-mix(in srgb, var(--hover) 40%, transparent); }
.tbl .person { display: flex; align-items: center; gap: 10px; white-space: nowrap; }
.tbl .num { text-align: center; }
.tbl select.input, .tbl input.input { height: 36px; }
.tbl .acts { white-space: nowrap; text-align: right; }

.req-group { border: 1px solid var(--line); border-radius: 16px; padding: 14px 16px; display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.req-group + .req-group { margin-top: 8px; }
.req-group .who { min-width: 180px; display: flex; align-items: center; gap: 10px; }
.req-group .who b { font-weight: 500; }
.req-group .days { flex: 1; display: flex; gap: 6px; flex-wrap: wrap; }
.day-tag { height: 28px; padding: 0 10px; border-radius: 8px; background: var(--surface-2); display: inline-flex; align-items: center; font-size: 13px; font-weight: 500; }
.empty { color: var(--text-2); padding: 24px; text-align: center; border: 1px dashed var(--line); border-radius: 16px; }

.cell-st { display: inline-flex; align-items: center; gap: 4px; height: 26px; padding: 0 10px; border-radius: 13px; font-size: 13px; font-weight: 500; }
.cell-st.ok { background: color-mix(in srgb, var(--ok) 14%, transparent); color: var(--ok); }
.cell-st.pending { background: color-mix(in srgb, var(--warn) 14%, transparent); color: var(--warn); }
.cell-st.miss { background: color-mix(in srgb, var(--danger) 12%, transparent); color: var(--danger); }
.cell-st.na { background: var(--surface-2); color: var(--text-3); }

.load-chart { display: flex; align-items: flex-end; gap: 4px; height: 160px; padding: 8px 0 0; overflow-x: auto; }
.load-col { flex: 1; min-width: 22px; display: flex; flex-direction: column; align-items: center; gap: 4px; height: 100%; justify-content: flex-end; }
.load-bar { width: 100%; max-width: 32px; border-radius: 6px 6px 2px 2px; background: var(--primary); position: relative; min-height: 2px; }
.load-bar.pend { background: color-mix(in srgb, var(--primary) 35%, transparent); border-radius: 6px 6px 0 0; }
.load-col small { font-size: 10px; color: var(--text-2); }
.load-col .v { font-size: 11px; font-weight: 500; }
.load-col.hol .load-bar { background: var(--line); }

.tpl-card { border: 1px solid var(--line); border-radius: 16px; padding: 16px 18px; }
.tpl-card + .tpl-card { margin-top: 10px; }
.tpl-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.tpl-head b { font-weight: 500; flex: 1; min-width: 200px; }
.tpl-body { display: none; margin-top: 14px; gap: 12px; flex-direction: column; }
.tpl-card.open .tpl-body { display: flex; }
.tpl-vars { display: flex; gap: 6px; flex-wrap: wrap; }
.tpl-vars button { height: 26px; padding: 0 8px; border-radius: 6px; border: 1px solid var(--line); background: var(--surface-2); font-size: 12px; cursor: pointer; font-family: ui-monospace, Menlo, Consolas, monospace; }
.tpl-preview { white-space: pre-wrap; background: var(--surface-2); border-radius: 12px; padding: 12px 14px; font-size: 14px; }
.chan { display: flex; gap: 6px; flex-wrap: wrap; }
.chan label { display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 10px; border-radius: 8px; border: 1px solid var(--outline); font-size: 13px; cursor: pointer; }
.chan input { margin: 0; accent-color: var(--primary); }
.chan label:has(input:checked) { background: var(--primary-cont); color: var(--on-primary-cont); border-color: transparent; }
.swatches { display: grid; grid-template-columns: repeat(6, 18px); gap: 5px; min-width: 133px; }
.swatches button { width: 18px; height: 18px; border-radius: 50%; border: 0; cursor: pointer; background: var(--c); }
.swatches button.on { box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--c); }

.user-pick { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 4px; max-height: 220px; overflow-y: auto; border: 1px solid var(--line); border-radius: 12px; padding: 6px; }
.user-pick label { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border-radius: 8px; cursor: pointer; }
.user-pick label:hover { background: var(--hover); }
.user-pick input { accent-color: var(--primary); margin: 0; }

/* ---------- Мобільна версія ---------- */

@media (max-width: 860px) {
  .brand, .topbar .today-btn { display: none; }
  .seg .ms { display: inline-block; }
  .seg .lbl { display: none; }
  .chip .st { display: none; }
  .wk-hd .meta { font-size: 11px; line-height: 14px; }
  .period-title { font-size: 18px; margin-left: 4px; }
  .sidebar {
    position: fixed; top: 64px; bottom: 0; left: 0; z-index: 30;
    background: var(--bg);
    box-shadow: var(--shadow-2);
    margin-left: -280px;
  }
  .layout:not(.collapsed) .sidebar { margin-left: 0; }
  .layout.collapsed .sidebar { margin-left: -280px; }
  .main-panel { margin: 0; border-radius: 16px 16px 0 0; }
  .wk, .mo { min-width: 0; }
  .wk-hd .num { width: 36px; height: 36px; line-height: 36px; font-size: 20px; }
  .wk-col { padding: 6px 3px 40px; }
  .chip { padding: 3px 4px; gap: 4px; font-size: 12px; }
  .chip .av { display: none; }
  .seg button { padding: 0 10px; }
  .seg button.on::before { display: none; }
  .adm { padding: 20px 16px 48px; }
  .setting-row { grid-template-columns: 1fr; gap: 8px; }
  .setting-row .ctl { justify-content: flex-start; }
  .row2 { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
