/* Палитра и кнопки — как в интерфейсе Битрикс24 (общие с остальными приложениями FRBS Labs) */
:root {
  --ground: #eef2f4;
  --surface: #fff;
  --ink: #333;
  --ink-2: #525c69;
  --muted: #6f7882;
  --line: #e4e8eb;
  --line-soft: #f0f2f4;
  --line-strong: #cfd5da;
  --chip-bg: #f5f7f8;
  --accent: #2fc6f6;
  --accent-dark: #11a9d9;
  --accent-soft: #e5f9ff;
  --link: #2067b0;
  --cta: #bbed21;
  --cta-hover: #d2f95f;
  --danger: #ff5752;
  --ok-bg: #f1fbd0; --ok-ink: #4f7d00;
  --err-bg: #ffe8e8; --err-ink: #d0312b;
  --info-bg: #e5f9ff; --info-ink: #0b8eb6;
  --warn-bg: #fff4d6; --warn-ink: #8a5a00; --warn-mark: #f5b400;
  --weekend: #f6f8f9;
  --holiday: #fff1f0;
  --shadow: 0 1px 2px rgba(20, 24, 30, .06), 0 4px 14px rgba(20, 24, 30, .05);
  --shadow-up: 0 2px 4px rgba(20, 24, 30, .06), 0 10px 28px rgba(20, 24, 30, .12);
  --radius: 12px;
  --name-w: 230px;
  /* типы отсутствий: фон полосы, текст, насыщенный цвет */
  --t-vacation: #c8f1e2; --t-vacation-ink: #0b6b52; --t-vacation-mark: #1fbf8f;
  --t-unpaid: #ffe6ad; --t-unpaid-ink: #835400; --t-unpaid-mark: #f5a800;
  --t-sick: #ffd9d6; --t-sick-ink: #b02a22; --t-sick-mark: #ff6b61;
  --t-trip: #e1dcff; --t-trip-ink: #4a3db0; --t-trip-mark: #7f6ff0;
  --t-dayoff: #d5ecff; --t-dayoff-ink: #17599f; --t-dayoff-mark: #3d9bef;
  --t-other: #e4e8eb; --t-other-ink: #525c69; --t-other-mark: #a3acb5;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; background: var(--ground); color: var(--ink); font: 14px/1.45 "Golos Text", "Open Sans", "Helvetica Neue", Arial, sans-serif; }
button { font: inherit; color: inherit; cursor: pointer; }
a { color: var(--link); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.muted { color: var(--muted); }
.error { color: var(--err-ink); }
.hint { font-size: 13px; color: var(--muted); margin: 0; }
.pad { padding: 24px; }
.row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.grow { flex: 1; min-width: 0; }
.ico { display: inline-flex; flex: none; }
.ico svg { width: 1em; height: 1em; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
h1 { margin: 0; font-size: 22px; line-height: 1.2; font-weight: 600; }
h2 { margin: 0; font-size: 17px; font-weight: 600; }
h3 { margin: 0; font-size: 14px; font-weight: 600; }

/* ---------- каркас ---------- */
.app { max-width: 1600px; margin: 0 auto; padding: 14px clamp(10px, 2vw, 24px) 32px; display: flex; flex-direction: column; gap: 14px; }
.topbar { display: flex; align-items: center; gap: 10px 14px; flex-wrap: wrap; }
.topbar .right { margin-left: auto; display: flex; gap: 8px; align-items: center; }
.seg { display: inline-flex; background: var(--surface); border-radius: 10px; padding: 3px; box-shadow: var(--shadow); max-width: 100%; overflow-x: auto; scrollbar-width: none; }
.seg::-webkit-scrollbar { display: none; }
.seg button { border: 0; background: transparent; color: var(--ink-2); padding: 6px 13px; border-radius: 8px; white-space: nowrap; font-size: 13px; display: inline-flex; gap: 6px; align-items: center; }
.seg button:hover { color: var(--ink); }
.seg button[aria-pressed="true"] { background: var(--accent); color: #fff; }
.seg.light button[aria-pressed="true"] { background: var(--accent-soft); color: var(--info-ink); }
.card { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px 18px; }
.section { display: flex; flex-direction: column; gap: 12px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 36px; padding: 0 18px; border-radius: 18px; border: 1px solid var(--line-strong);
  background: #fff; color: var(--ink-2); font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .02em; white-space: nowrap;
}
.btn:hover { border-color: #a8adb4; }
.btn:disabled { opacity: .45; cursor: default; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-dark); border-color: var(--accent-dark); }
.btn-cta { background: var(--cta); border-color: var(--cta); color: var(--ink-2); }
.btn-cta:hover:not(:disabled) { background: var(--cta-hover); border-color: var(--cta-hover); }
.btn-danger { color: var(--err-ink); border-color: #f3b7b5; }
.btn-s { height: 30px; padding: 0 12px; border-radius: 15px; font-size: 11px; }
.btn-ghost { border-color: transparent; background: transparent; }
.btn-ghost:hover { background: var(--chip-bg); border-color: transparent; }
.btn .ico { font-size: 15px; }
.icon-btn { border: 0; background: transparent; color: var(--muted); width: 32px; height: 32px; border-radius: 8px; display: inline-flex; align-items: center; justify-content: center; font-size: 18px; flex: none; }
.icon-btn:hover { background: var(--chip-bg); color: var(--ink); }
.x { border: 0; background: var(--chip-bg); color: var(--ink-2); border-radius: 50%; width: 30px; height: 30px; font-size: 17px; line-height: 1; flex: none; }
.x:hover { background: var(--ink-2); color: #fff; }
.input { width: 100%; min-height: 38px; padding: 7px 10px; font: inherit; font-size: 14px; color: inherit; border: 1px solid var(--line-strong); border-radius: 8px; background: #fff; }
.input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(47, 198, 246, .15); }
select.input { width: auto; max-width: 100%; }
.input-s { min-height: 32px; padding: 4px 8px; font-size: 13px; }
.check { display: inline-flex; gap: 6px; align-items: center; font-size: 13px; color: var(--ink-2); cursor: pointer; user-select: none; }
.pill { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 500; padding: 2px 9px; border-radius: 6px; white-space: nowrap; background: var(--chip-bg); color: var(--ink-2); }
.pill.warn { background: var(--warn-bg); color: var(--warn-ink); }
.pill.err { background: var(--err-bg); color: var(--err-ink); }
.note { border-radius: 10px; padding: 10px 14px; font-size: 13px; display: flex; flex-direction: column; gap: 6px; }
.note.warn { background: var(--warn-bg); color: var(--warn-ink); }
.note.ok { background: var(--ok-bg); color: var(--ok-ink); }
.note.err { background: var(--err-bg); color: var(--err-ink); }
.note.info { background: var(--info-bg); color: var(--info-ink); }
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: #2f3640; color: #fff; padding: 10px 14px 10px 18px; border-radius: 10px; font-size: 14px; box-shadow: var(--shadow-up); z-index: 300; max-width: calc(100vw - 32px); display: flex; gap: 14px; align-items: center; }
.toast button { border: 0; background: transparent; color: var(--accent); font-weight: 600; padding: 2px 4px; }

/* ---------- верхняя полоса: сводка ---------- */
.summary { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 12px; }
.stat { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); padding: 12px 16px; display: flex; flex-direction: column; gap: 6px; min-height: 84px; }
.stat-label { font-size: 12px; color: var(--muted); }
.stat-value { font-size: 20px; font-weight: 600; line-height: 1.2; }
.stat-value small { font-size: 13px; color: var(--muted); font-weight: 400; }
.meter { height: 6px; border-radius: 3px; background: var(--line-soft); overflow: hidden; display: flex; }
.meter i { display: block; height: 100%; }
.faces { display: flex; align-items: center; gap: 0; flex-wrap: wrap; }
.faces .av { margin-right: -6px; border: 2px solid #fff; }
.faces .more { margin-left: 12px; font-size: 13px; color: var(--muted); }

/* ---------- аватар ---------- */
.av { width: 26px; height: 26px; border-radius: 50%; flex: none; display: inline-flex; align-items: center; justify-content: center; font-size: 10px; font-weight: 600; color: #fff; background: #9aa5b1 center/cover no-repeat; letter-spacing: .02em; }
.av-l { width: 34px; height: 34px; font-size: 12px; }

/* ---------- панель управления календарём ---------- */
.toolbar { display: flex; flex-wrap: wrap; gap: 10px 12px; align-items: center; }
.period { display: flex; align-items: center; gap: 4px; }
.period-title { font-size: 17px; font-weight: 600; min-width: 170px; text-align: center; white-space: nowrap; }
.filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-left: auto; }
.search { position: relative; }
.search .input { padding-left: 30px; width: 200px; }
.search .ico { position: absolute; left: 9px; top: 50%; transform: translateY(-50%); color: var(--muted); font-size: 15px; }

/* ---------- шкала ---------- */
.tl { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; position: relative; user-select: none; }
.tl-head { display: grid; grid-template-columns: var(--name-w) 1fr; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: var(--surface); z-index: 5; }
.tl-corner { padding: 8px 12px; font-size: 12px; color: var(--muted); display: flex; align-items: flex-end; border-right: 1px solid var(--line); }
.tl-scale { position: relative; height: 46px; }
.tl-cell { position: absolute; top: 0; bottom: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; font-size: 12px; color: var(--ink-2); line-height: 1.15; border-left: 1px solid var(--line-soft); overflow: hidden; }
.tl-cell small { font-size: 10px; color: var(--muted); text-transform: lowercase; }
.tl-cell.we { color: var(--err-ink); }
.tl-cell.we small { color: #e48b87; }
.tl-cell.today { background: var(--accent); color: #fff; border-radius: 6px; margin: 4px 1px; top: 0; bottom: 0; }
.tl-cell.today small { color: #e6f8ff; }
.tl-cell.month { align-items: flex-start; padding-left: 8px; font-weight: 600; color: var(--ink); border-left-color: var(--line); }
.tl-cell.month small { font-weight: 400; }
.tl-cell.week { font-size: 10px; color: var(--muted); justify-content: flex-end; padding-bottom: 4px; }
.tl-body { position: relative; }
.tl-bg { position: absolute; top: 0; bottom: 0; left: var(--name-w); right: 0; pointer-events: none; z-index: 0; }
.tl-bg i { position: absolute; top: 0; bottom: 0; }
.tl-bg .we { background: var(--weekend); }
.tl-bg .hol { background: var(--holiday); }
.tl-bg .sep { border-left: 1px solid var(--line); }
.tl-bg .now { width: 2px; background: var(--accent); z-index: 3; }
.tl-group { display: grid; grid-template-columns: var(--name-w) 1fr; position: relative; z-index: 1; border-top: 1px solid var(--line); }
.tl-group:first-child { border-top: 0; }
.tl-ghead { grid-column: 1 / -1; display: grid; grid-template-columns: var(--name-w) 1fr; background: rgba(245, 247, 248, .92); border-bottom: 1px solid var(--line-soft); }
.tl-gname { display: flex; align-items: center; gap: 6px; padding: 6px 12px; font-size: 13px; font-weight: 600; color: var(--ink-2); border: 0; background: transparent; text-align: left; border-right: 1px solid var(--line); min-width: 0; }
.tl-gname .chev { transition: transform .15s; color: var(--muted); font-size: 13px; }
.tl-group.closed .chev { transform: rotate(-90deg); }
.tl-gname .cnt { color: var(--muted); font-weight: 400; }
.tl-gname span.nm { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tl-load { position: relative; height: 30px; }
.tl-load i { position: absolute; top: 5px; bottom: 5px; display: flex; align-items: center; justify-content: center; font-size: 11px; font-style: normal; font-weight: 600; border-radius: 4px; }
.tl-row { display: contents; }
.tl-name { display: flex; align-items: center; gap: 8px; padding: 0 12px; height: 38px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line-soft); min-width: 0; background: var(--surface); }
.tl-name .who { min-width: 0; display: flex; flex-direction: column; line-height: 1.2; }
.tl-name .who b { font-weight: 500; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tl-name .who span { font-size: 11px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tl-name .used { margin-left: auto; font-size: 11px; color: var(--muted); white-space: nowrap; font-variant-numeric: tabular-nums; }
.tl-name .used.over { color: var(--err-ink); font-weight: 600; }
.tl-name.me { box-shadow: inset 3px 0 0 var(--accent); }
.tl-track { position: relative; height: 38px; border-bottom: 1px solid var(--line-soft); }
.tl-track.can { cursor: crosshair; }
.tl-track.can:hover { background: rgba(47, 198, 246, .04); }
.tl-group.closed .tl-row { display: none; }
.bar { position: absolute; top: 6px; height: 26px; border-radius: 7px; display: flex; align-items: center; gap: 5px; padding: 0 8px; font-size: 12px; font-weight: 500; white-space: nowrap; overflow: hidden; z-index: 2; box-shadow: inset 3px 0 0 var(--mark); background: var(--bg); color: var(--ink-c); }
.bar.edit { cursor: grab; }
.bar.edit:hover { filter: brightness(.97); box-shadow: inset 3px 0 0 var(--mark), 0 2px 8px rgba(20, 24, 30, .14); }
.bar.drag { cursor: grabbing; opacity: .85; box-shadow: 0 4px 14px rgba(20, 24, 30, .2); z-index: 4; }
.bar.narrow { padding: 0; justify-content: center; }
.bar.hr { background-image: repeating-linear-gradient(135deg, transparent 0 6px, rgba(255, 255, 255, .55) 6px 9px); }
.bar.pending { opacity: .7; }
.bar.err { outline: 2px solid var(--danger); outline-offset: -2px; }
.bar .grip { position: absolute; top: 0; bottom: 0; width: 8px; cursor: ew-resize; }
.bar .grip.l { left: 0; }
.bar .grip.r { right: 0; }
.bar .t { overflow: hidden; text-overflow: ellipsis; }
.bar .d { opacity: .75; font-weight: 400; }
.ghost { position: absolute; top: 6px; height: 26px; border-radius: 7px; background: rgba(47, 198, 246, .25); border: 1.5px dashed var(--accent); z-index: 3; pointer-events: none; font-size: 11px; color: var(--info-ink); display: flex; align-items: center; padding: 0 6px; white-space: nowrap; }
.tl-empty { padding: 40px 20px; text-align: center; color: var(--muted); }
.tl-foot { display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: center; font-size: 12px; color: var(--muted); }
.legend { display: flex; flex-wrap: wrap; gap: 6px 14px; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 12px; height: 12px; border-radius: 3px; background: var(--bg); box-shadow: inset 3px 0 0 var(--mark); }
.legend i.hr { background-image: repeating-linear-gradient(135deg, var(--t-other) 0 3px, #fff 3px 5px); box-shadow: none; }
.syncline { margin-left: auto; display: inline-flex; gap: 6px; align-items: center; }
.syncline.err { color: var(--err-ink); }
.spin { animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* подсказка над полосой */
.tip { position: fixed; z-index: 250; background: #2f3640; color: #fff; border-radius: 10px; padding: 10px 12px; font-size: 12px; line-height: 1.45; max-width: 300px; pointer-events: none; box-shadow: var(--shadow-up); }
.tip b { font-size: 13px; display: block; }
.tip .warn { color: #ffcf6b; }

/* ---------- список ---------- */
.list { display: flex; flex-direction: column; gap: 14px; }
.list-month h3 { margin: 0 0 6px; color: var(--ink-2); font-size: 13px; text-transform: uppercase; letter-spacing: .05em; }
.list-table { width: 100%; table-layout: fixed; border-collapse: collapse; background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.list-table td { padding: 9px 12px; border-top: 1px solid var(--line-soft); font-size: 13px; vertical-align: middle; }
.list-table tr:first-child td { border-top: 0; }
.list-table tr.click { cursor: pointer; }
.list-table tr.click:hover td { background: #fafbfc; }
.list-table .person { display: flex; align-items: center; gap: 10px; min-width: 200px; }
.list-table .person span { display: block; font-size: 11px; color: var(--muted); }
.tag { display: inline-flex; align-items: center; gap: 6px; padding: 2px 9px; border-radius: 6px; font-size: 12px; font-weight: 500; background: var(--bg); color: var(--ink-c); white-space: nowrap; }
.tag::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--mark); }
.list-table .dates { white-space: nowrap; font-variant-numeric: tabular-nums; }
.list-table .days { color: var(--muted); white-space: nowrap; text-align: right; }
.now-pill { background: var(--accent-soft); color: var(--info-ink); }

/* ---------- окно отпуска ---------- */
.overlay { position: fixed; inset: 0; background: rgba(20, 24, 30, .45); display: flex; justify-content: center; align-items: flex-start; padding: 24px 12px; overflow-y: auto; z-index: 100; }
.modal { position: relative; background: var(--surface); border-radius: 16px; box-shadow: 0 12px 40px rgba(20, 24, 30, .25); width: 100%; max-width: 720px; display: flex; flex-direction: column; }
.modal-head { display: flex; align-items: center; gap: 12px; padding: 18px 20px 6px; }
.modal-head h2 { flex: 1; }
.modal-body { padding: 10px 20px 4px; display: flex; flex-direction: column; gap: 16px; }
.modal-foot { display: flex; gap: 8px; align-items: center; padding: 16px 20px 18px; flex-wrap: wrap; }
.modal-foot .right { margin-left: auto; display: flex; gap: 8px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field > label, .field > .label { font-size: 12px; color: var(--muted); }
.types { display: flex; flex-wrap: wrap; gap: 6px; }
.types button { border: 1px solid var(--line-strong); background: #fff; border-radius: 16px; padding: 5px 12px 5px 10px; font-size: 13px; display: inline-flex; gap: 7px; align-items: center; color: var(--ink-2); }
.types button::before { content: ""; width: 9px; height: 9px; border-radius: 50%; background: var(--mark); }
.types button[aria-pressed="true"] { background: var(--bg); border-color: var(--mark); color: var(--ink-c); font-weight: 500; }
.picker { position: relative; }
.picker-list { position: absolute; z-index: 20; top: calc(100% + 4px); left: 0; right: 0; background: #fff; border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 8px 28px rgba(20, 24, 30, .14); max-height: 260px; overflow-y: auto; padding: 4px; }
.picker-list button { display: flex; width: 100%; align-items: center; gap: 10px; border: 0; background: transparent; padding: 6px 8px; border-radius: 8px; text-align: left; }
.picker-list button:hover, .picker-list button.on { background: var(--accent-soft); }
.picker-list small { display: block; color: var(--muted); font-size: 11px; }
.person-chip { display: flex; align-items: center; gap: 10px; padding: 6px 10px; border: 1px solid var(--line); border-radius: 10px; }
.person-chip small { display: block; color: var(--muted); font-size: 12px; }
.person-chip.btnlike { cursor: pointer; }
.person-chip.btnlike:hover { border-color: var(--accent); }

.range { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; position: relative; }
.range-nav { position: absolute; top: -2px; left: 0; right: 0; display: flex; justify-content: space-between; pointer-events: none; }
.range-nav button { pointer-events: auto; }
.mon h4 { margin: 0 0 6px; text-align: center; font-size: 14px; font-weight: 600; line-height: 30px; }
.mon-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px 0; }
.mon-grid .wd { font-size: 11px; color: var(--muted); text-align: center; padding-bottom: 2px; }
.mon-grid .wd.we { color: #e48b87; }
.day { height: 34px; border: 0; background: transparent; font-size: 13px; position: relative; display: flex; align-items: center; justify-content: center; font-variant-numeric: tabular-nums; }
.day.we { color: var(--err-ink); }
.day.hol::after { content: ""; position: absolute; bottom: 4px; width: 4px; height: 4px; border-radius: 50%; background: var(--danger); }
.day.today { font-weight: 700; text-decoration: underline; text-underline-offset: 3px; }
.day.in { background: var(--accent-soft); }
.day.edge { background: var(--accent); color: #fff; border-radius: 8px; z-index: 1; }
.day.edge.s { border-radius: 8px 0 0 8px; }
.day.edge.e { border-radius: 0 8px 8px 0; }
.day.edge.s.e { border-radius: 8px; }
.day.busy::before { content: ""; position: absolute; top: 4px; right: 6px; width: 5px; height: 5px; border-radius: 50%; background: var(--warn-mark); }
.day.own { box-shadow: inset 0 -3px 0 var(--t-vacation-mark); }
.day:hover:not(.edge) { background: var(--chip-bg); border-radius: 8px; }
.day.in:hover { background: #cdf1fd; border-radius: 0; }
.dates-row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.dates-row .input { width: 160px; }
.count { display: flex; flex-wrap: wrap; gap: 6px 14px; align-items: baseline; font-size: 13px; color: var(--ink-2); }
.count b { font-size: 18px; color: var(--ink); }
.ro { display: flex; flex-direction: column; gap: 4px; font-size: 14px; }

@media (max-width: 760px) {
  :root { --name-w: 132px; }
  .tl-name .who span, .tl-name .used { display: none; }
  .tl-name .av { display: none; }
  .range { grid-template-columns: 1fr; }
  .range .mon:nth-child(3) { display: none; }
  .filters { margin-left: 0; }
  .search .input { width: 150px; }
}
