:root {
  --bg: #f1f4f9;
  --surface: #ffffff;
  --surface-2: #f5f7fb;
  --ink: #0f1b2e;
  --ink-2: #55627a;
  --ink-3: #8a95a8;
  --line: #e7ecf3;
  --accent: #1c8cff;
  --accent-2: #0a6cf0;
  --accent-ink: #0a6cf0;
  --accent-soft: #e9f3ff;
  --nav-active-bg: #0e1a30;
  --nav-active-ink: #ffffff;
  --danger: #dc2f47;
  --danger-soft: #fdecef;
  --ok: #0e8f47;
  --ok-soft: #e4f7ec;
  --warn: #b65f06;
  --warn-soft: #fef3e2;
  --shadow: 0 1px 2px rgba(16, 30, 54, .04), 0 8px 24px rgba(16, 30, 54, .05);
  --shadow-lg: 0 24px 64px rgba(10, 22, 44, .25);
  --r-lg: 20px;
  --r-md: 14px;
  --r-sm: 10px;
  color-scheme: light;
}
:root[data-theme='dark'] {
  --bg: #0b1220;
  --surface: #131c2e;
  --surface-2: #1a2539;
  --ink: #eef2f8;
  --ink-2: #a9b4c7;
  --ink-3: #76829a;
  --line: #233049;
  --accent-ink: #66b3ff;
  --accent-soft: rgba(28, 140, 255, .15);
  --nav-active-bg: #1c8cff;
  --nav-active-ink: #ffffff;
  --danger: #ff6b80;
  --danger-soft: rgba(255, 90, 115, .14);
  --ok: #4ad58a;
  --ok-soft: rgba(50, 200, 120, .14);
  --warn: #f5b25c;
  --warn-soft: rgba(245, 170, 80, .14);
  --shadow: 0 1px 2px rgba(0, 0, 0, .25), 0 8px 24px rgba(0, 0, 0, .2);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 500 14px/1.45 'Onest', system-ui, -apple-system, 'Segoe UI', sans-serif;
  font-variant-numeric: tabular-nums;
  -webkit-font-smoothing: antialiased;
}
body.modal-open { overflow: hidden; }
h1, h2, h3, p, ul, ol, dl, dd { margin: 0; padding: 0; }
ul, ol { list-style: none; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; }
button:disabled { cursor: default; opacity: .45; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.ico { flex: none; display: block; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.muted { color: var(--ink-3); }
.neg { color: var(--danger); }

/* ---------- Каркас ---------- */
.layout { display: grid; grid-template-columns: 204px minmax(0, 1fr); gap: 16px; padding: 8px 16px 32px 8px; min-height: 100vh; }
.side {
  position: sticky; top: 8px; align-self: start;
  height: calc(100vh - 16px);
  background: var(--surface);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow);
  padding: 22px 10px;
  overflow-y: auto;
}
.logo { display: block; padding: 0 12px 18px; font-size: 27px; font-weight: 800; letter-spacing: -.04em; color: var(--ink); }
.logo span { background: linear-gradient(120deg, #2aa0ff, #0a62e8); -webkit-background-clip: text; background-clip: text; color: transparent; }
.nav-group { margin-top: 14px; }
.nav-label { padding: 0 12px 6px; font-size: 10.5px; font-weight: 700; letter-spacing: .09em; text-transform: uppercase; color: var(--ink-3); }
.nav-item {
  position: relative; display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; margin-bottom: 2px; border-radius: 12px;
  font-weight: 600; font-size: 13.5px; color: var(--ink-2);
  transition: background .15s, color .15s;
}
.nav-item:hover { background: var(--surface-2); color: var(--ink); }
.nav-item.is-active { background: var(--nav-active-bg); color: var(--nav-active-ink); box-shadow: 0 6px 16px rgba(14, 26, 48, .22); }
.nav-item.is-active::before { content: ''; position: absolute; left: -10px; top: 8px; bottom: 8px; width: 3px; border-radius: 0 3px 3px 0; background: var(--accent); }
.content { min-width: 0; padding-top: 8px; }
.tabs { display: none; }

.topbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 22px; }
.top-right { display: flex; align-items: center; gap: 8px; }
.month, .pill, .round-btn, .user-chip { background: var(--surface); box-shadow: var(--shadow); }
.month { display: flex; align-items: center; height: 40px; border-radius: 13px; padding: 0 4px; }
.month-label { min-width: 118px; text-align: center; font-weight: 700; font-size: 13.5px; }
.month-btn { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 10px; color: var(--ink-2); }
.month-btn:hover:not(:disabled) { background: var(--surface-2); color: var(--ink); }
.pill { display: flex; align-items: center; gap: 8px; height: 40px; padding: 0 14px; border-radius: 13px; color: var(--ink-2); white-space: nowrap; }
.pill b { color: var(--ink); font-weight: 800; }
.pill-link { color: var(--accent-ink); font-weight: 600; font-size: 13px; }
.round-btn { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 13px; color: var(--ink-2); }
.round-btn:hover { color: var(--ink); }
.user-chip { display: flex; align-items: center; gap: 8px; height: 40px; padding: 0 12px 0 6px; border-radius: 13px; font-weight: 600; font-size: 13.5px; }
.banner { display: flex; align-items: center; gap: 8px; margin-bottom: 18px; padding: 11px 14px; border-radius: var(--r-md); background: var(--warn-soft); color: var(--warn); font-weight: 600; font-size: 13px; }

.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 18px; }
.eyebrow { font-size: 11.5px; font-weight: 600; color: var(--ink-3); margin-bottom: 3px; }
h1 { font-size: 26px; font-weight: 800; letter-spacing: -.01em; text-transform: uppercase; line-height: 1.15; }
.sub { color: var(--ink-2); margin-top: 3px; font-size: 13.5px; }
.section-title { font-size: 16px; font-weight: 800; margin: 26px 0 12px; }

/* ---------- Кнопки и поля ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  min-height: 40px; padding: 0 16px; border-radius: 12px;
  font-weight: 700; font-size: 13.5px; white-space: nowrap;
  transition: transform .1s, filter .15s, background .15s;
}
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn-primary { background: linear-gradient(180deg, #33a5ff, #0f7bf5); color: #fff; box-shadow: 0 6px 16px rgba(20, 125, 245, .3); }
.btn-primary:hover:not(:disabled) { filter: brightness(1.06); }
.btn-soft { background: var(--accent-soft); color: var(--accent-ink); }
.btn-soft:hover { filter: brightness(.97); }
.btn-ghost { background: var(--surface-2); color: var(--ink-2); }
.btn-ghost:hover { color: var(--ink); }
.btn-sm { min-height: 32px; padding: 0 12px; font-size: 12.5px; border-radius: 10px; }
.btn-wide { width: 100%; }
.icon-btn { display: inline-grid; place-items: center; width: 30px; height: 30px; border-radius: 9px; color: var(--ink-3); }
.icon-btn:hover { background: var(--surface-2); color: var(--ink); }
.link { color: var(--accent-ink); font-weight: 600; font-size: 13px; }

.form { display: grid; gap: 14px; }
.form-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; margin-top: 14px; }
.field { display: grid; gap: 6px; font-size: 12.5px; font-weight: 600; color: var(--ink-2); }
.modal-body > .field { margin-top: 12px; }
input:not([type='checkbox']), textarea, .select select {
  width: 100%; border: 1px solid var(--line); background: var(--surface-2);
  border-radius: var(--r-sm); padding: 10px 12px; font-size: 14px; font-weight: 500; color: var(--ink);
}
input:focus, textarea:focus, select:focus { outline: 2px solid var(--accent); outline-offset: -1px; background: var(--surface); }
textarea { resize: vertical; min-height: 60px; }
input::placeholder, textarea::placeholder { color: var(--ink-3); }
.hint { display: flex; gap: 6px; align-items: center; color: var(--ink-3); font-size: 12.5px; margin-top: 10px; }

.alert { display: flex; gap: 8px; align-items: flex-start; padding: 10px 12px; border-radius: var(--r-sm); font-size: 13px; font-weight: 600; margin-bottom: 12px; }
.alert .ico { margin-top: 2px; }
.alert-err { background: var(--danger-soft); color: var(--danger); }
.alert-warn { background: var(--warn-soft); color: var(--warn); margin: 12px 0 0; }
.alert-info { background: var(--accent-soft); color: var(--accent-ink); margin: 10px 0 0; }

/* ---------- Цвета ---------- */
.c-blue { --c1: #2aa0ff; --c2: #0a62e8; }
.c-violet { --c1: #9a6bff; --c2: #5a2be0; }
.c-green { --c1: #1fb45f; --c2: #0a7a3c; }
.c-orange { --c1: #ff9a2e; --c2: #e4560a; }
.c-navy { --c1: #2b3a55; --c2: #070d1a; }
:root[data-theme='dark'] .c-navy { --c1: #4a5f88; --c2: #1e2c49; }
.ava {
  display: inline-grid; place-items: center; flex: none;
  width: 38px; height: 38px; border-radius: 12px;
  background: linear-gradient(145deg, var(--c1), var(--c2)); color: #fff;
  font-weight: 800; font-size: 15px;
}
.ava-sm { width: 28px; height: 28px; border-radius: 9px; font-size: 12px; }
.ava-xs { width: 22px; height: 22px; border-radius: 7px; font-size: 11px; }
.tone-1 { background: #e6f2ff; color: #0a6cf0; }
.tone-2 { background: #fdeaee; color: #d62a44; }
.tone-3 { background: #e3f7eb; color: #0e8f47; }
.tone-4 { background: #efe9ff; color: #6a3cf0; }
.tone-5 { background: #fff1df; color: #cf6a07; }
.tone-6 { background: #e3f6f8; color: #0b8796; }
:root[data-theme='dark'] .tone-1 { background: rgba(40, 140, 255, .18); color: #79bcff; }
:root[data-theme='dark'] .tone-2 { background: rgba(255, 80, 110, .16); color: #ff8a9c; }
:root[data-theme='dark'] .tone-3 { background: rgba(40, 200, 120, .15); color: #66dea0; }
:root[data-theme='dark'] .tone-4 { background: rgba(140, 100, 255, .2); color: #b79dff; }
:root[data-theme='dark'] .tone-5 { background: rgba(255, 160, 60, .16); color: #ffbd73; }
:root[data-theme='dark'] .tone-6 { background: rgba(40, 190, 210, .15); color: #6adcea; }
.type-num { display: inline-grid; place-items: center; flex: none; width: 30px; height: 30px; border-radius: 9px; font-weight: 800; font-size: 12.5px; }

/* ---------- Смены ---------- */
.shift { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-width: 76px; padding: 6px 10px; border-radius: 9px; font-weight: 700; font-size: 12.5px; }
.s-10-00 { background: #e6f2ff; color: #0a6cf0; }
.s-11-01 { background: #efe9ff; color: #6a3cf0; }
.s-12-02 { background: #fff1df; color: #cf6a07; }
.s-off { background: var(--surface-2); color: var(--ink-3); font-weight: 600; }
:root[data-theme='dark'] .s-10-00 { background: rgba(40, 140, 255, .18); color: #79bcff; }
:root[data-theme='dark'] .s-11-01 { background: rgba(140, 100, 255, .2); color: #b79dff; }
:root[data-theme='dark'] .s-12-02 { background: rgba(255, 160, 60, .16); color: #ffbd73; }
.shift-btn { width: 100%; transition: box-shadow .15s, transform .1s; }
.shift-btn:hover { box-shadow: 0 0 0 2px currentColor inset; }
.dot { width: 7px; height: 7px; border-radius: 50%; background: #18c964; flex: none; box-shadow: 0 0 0 3px rgba(24, 201, 100, .22); }
.live-dot { width: 8px; height: 8px; border-radius: 50%; background: #18c964; box-shadow: 0 0 0 3px rgba(24, 201, 100, .2); }

/* ---------- Панели, показатели ---------- */
.panel { background: var(--surface); border-radius: var(--r-lg); box-shadow: var(--shadow); padding: 18px; min-width: 0; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.panel-head h2 { font-size: 15px; font-weight: 800; }
.panel-head-gap { margin-top: 20px; }
.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 16px; }
.stats > .stat { background: var(--surface); border-radius: var(--r-lg); box-shadow: var(--shadow); padding: 16px; }
.stat { display: flex; gap: 12px; min-width: 0; }
.stat > div { min-width: 0; }
.stat-ico { display: grid; place-items: center; flex: none; width: 40px; height: 40px; border-radius: 12px; }
.stat-label { font-size: 12px; font-weight: 600; color: var(--ink-3); }
.stat-value { font-size: 20px; font-weight: 800; letter-spacing: -.01em; line-height: 1.25; white-space: nowrap; }
.stat-sub { font-size: 12px; color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.empty { display: grid; justify-items: center; gap: 4px; padding: 32px 12px; text-align: center; color: var(--ink-3); font-size: 13px; }
.empty strong { color: var(--ink); font-size: 14.5px; }
.empty-ico { display: grid; place-items: center; width: 52px; height: 52px; border-radius: 16px; background: var(--ok-soft); color: var(--ok); margin-bottom: 6px; }

/* ---------- Карточки сотрудников ---------- */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(232px, 1fr)); gap: 14px; margin-bottom: 16px; }
.pcard { background: var(--surface); border-radius: var(--r-lg); box-shadow: var(--shadow); overflow: hidden; display: flex; flex-direction: column; transition: transform .18s, box-shadow .18s; }
.pcard:hover { transform: translateY(-2px); box-shadow: 0 2px 4px rgba(16, 30, 54, .05), 0 14px 32px rgba(16, 30, 54, .1); }
.pcard-top {
  position: relative; height: 148px; padding: 12px; overflow: hidden; color: #fff;
  background:
    radial-gradient(150px 150px at 92% 110%, rgba(255, 255, 255, .24), transparent 70%),
    radial-gradient(120px 120px at 2% -10%, rgba(255, 255, 255, .2), transparent 70%),
    linear-gradient(140deg, var(--c1), var(--c2));
}
.pcard-top::after { content: ''; position: absolute; right: -36px; top: -36px; width: 130px; height: 130px; border-radius: 50%; border: 22px solid rgba(255, 255, 255, .09); }
.badge { position: relative; z-index: 1; display: inline-flex; align-items: center; gap: 6px; padding: 4px 9px; border-radius: 8px; background: rgba(5, 12, 26, .32); backdrop-filter: blur(6px); font-size: 11.5px; font-weight: 700; color: #fff; }
.round { position: absolute; z-index: 1; right: 10px; top: 10px; display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; background: rgba(5, 12, 26, .32); color: #fff; }
.round:hover { background: rgba(5, 12, 26, .55); }
.pcard-name { position: absolute; left: 14px; right: 14px; top: 58px; font-size: 32px; line-height: 1; font-weight: 800; letter-spacing: -.02em; text-transform: uppercase; }
.pcard-count { position: absolute; right: 10px; bottom: 10px; padding: 4px 9px; border-radius: 8px; background: rgba(5, 12, 26, .62); font-size: 11.5px; font-weight: 700; }
.pcard-body { padding: 12px 14px 14px; display: flex; flex-direction: column; flex: 1; }
.pcard-meta { display: flex; align-items: center; gap: 5px; font-size: 11.5px; color: var(--ink-3); margin-bottom: 5px; }
.pcard-title { font-weight: 700; font-size: 13.5px; }
.pcard-foot { display: flex; align-items: flex-end; justify-content: space-between; gap: 8px; margin-top: 8px; flex: 1; }
.pcard-sum { font-size: 19px; font-weight: 800; letter-spacing: -.01em; line-height: 1.2; white-space: nowrap; }
.pcard-small { font-size: 11.5px; color: var(--ink-3); }
.pcard-foot .btn { padding: 0 11px; min-height: 38px; font-size: 12.5px; }

.two-col { display: grid; grid-template-columns: minmax(0, 1.7fr) minmax(280px, 1fr); gap: 14px; align-items: start; }
.two-col-even { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.today { display: grid; gap: 4px; }
.today-row { display: flex; align-items: center; gap: 10px; padding: 7px 0; }
.today-name { font-weight: 700; }
.today-row .shift { margin-left: auto; }

/* ---------- Штрафы ---------- */
.fine-list { display: grid; }
.fine { display: flex; gap: 12px; padding: 13px 0; border-top: 1px solid var(--line); }
.fine:first-child { border-top: 0; padding-top: 2px; }
.fine:last-child { padding-bottom: 2px; }
.fine-main { flex: 1; min-width: 0; }
.fine-title { font-weight: 700; }
.fine-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 6px; font-size: 12.5px; color: var(--ink-3); margin-top: 1px; }
.fine-meta b { color: var(--ink-2); font-weight: 600; }
.fine-meta i { font-style: normal; }
.fine-note { font-size: 13px; color: var(--ink-2); margin-top: 5px; overflow-wrap: anywhere; }
.fine-off-note { display: flex; gap: 5px; font-size: 12.5px; font-weight: 600; color: var(--ok); margin-top: 5px; overflow-wrap: anywhere; }
.fine-off-note .ico { margin-top: 2px; }
.fine-side { display: flex; flex-direction: column; align-items: flex-end; gap: 7px; }
.fine-amount { font-weight: 800; font-size: 15px; color: var(--danger); white-space: nowrap; }
.fine.is-off .fine-amount { color: var(--ink-3); text-decoration: line-through; font-weight: 600; }
.fine.is-off .fine-title { color: var(--ink-2); }
.tag { padding: 3px 8px; border-radius: 7px; font-size: 11.5px; font-weight: 700; }
.tag-ok { background: var(--ok-soft); color: var(--ok); }

.catalog { display: grid; grid-template-columns: 270px minmax(0, 1fr); gap: 14px; align-items: start; }
.cat-panel { padding: 12px 8px; position: sticky; top: 16px; }
.cat-label { padding: 2px 10px 8px; font-size: 10.5px; font-weight: 700; letter-spacing: .09em; text-transform: uppercase; color: var(--ink-3); }
.cat { display: flex; align-items: center; gap: 10px; width: 100%; padding: 6px 8px; border-radius: 11px; text-align: left; font-size: 12.5px; font-weight: 600; color: var(--ink-2); transition: background .15s; }
.cat:hover { background: var(--surface-2); }
.cat.is-active { background: var(--accent-soft); color: var(--accent-ink); }
.cat-name { flex: 1; min-width: 0; line-height: 1.25; }
.cat-count { flex: none; min-width: 24px; padding: 2px 6px; border-radius: 8px; background: var(--surface-2); text-align: center; font-size: 11.5px; font-weight: 700; color: var(--ink-2); }
.cat.is-active .cat-count { background: var(--accent); color: #fff; }
.catalog-main { min-width: 0; display: grid; gap: 12px; }
.toolbar { display: flex; flex-wrap: wrap; gap: 8px; }
.search { flex: 1 1 240px; display: flex; align-items: center; gap: 8px; height: 42px; padding: 0 12px; border-radius: 13px; background: var(--surface); box-shadow: var(--shadow); color: var(--ink-3); }
.search:focus-within { outline: 2px solid var(--accent); }
.search input { border: 0; background: none; padding: 0; outline: none; height: 100%; }
.select { position: relative; display: flex; align-items: center; height: 42px; padding-left: 12px; border-radius: 13px; background: var(--surface); box-shadow: var(--shadow); color: var(--ink-2); }
.select select { appearance: none; border: 0; background: none; padding: 0 30px 0 8px; height: 100%; font-weight: 600; font-size: 13px; cursor: pointer; }
.select select:focus { background: none; outline-offset: 2px; }
.select::after { content: ''; position: absolute; right: 13px; top: 17px; width: 6px; height: 6px; border-right: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor; transform: rotate(45deg); pointer-events: none; }
.select option { color: #0f1b2e; background: #fff; }
.list-summary { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 6px 16px; font-size: 12.5px; color: var(--ink-3); padding-bottom: 10px; margin-bottom: 4px; border-bottom: 1px solid var(--line); }
.list-summary b { color: var(--ink); }
.list-summary + .fine-list .fine:first-child { padding-top: 12px; }

/* ---------- График ---------- */
.legend { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; margin-bottom: 12px; font-size: 12.5px; color: var(--ink-2); }
.legend-item { display: inline-flex; align-items: center; gap: 8px; }
.legend-hint { display: inline-flex; align-items: center; gap: 5px; margin-left: auto; color: var(--ink-3); }
.table-panel { padding: 6px; }
.table-scroll { overflow-x: auto; border-radius: 14px; }
.sched { width: 100%; min-width: 660px; border-collapse: separate; border-spacing: 0; }
.sched th, .sched td { padding: 7px 8px; text-align: center; border-bottom: 1px solid var(--line); }
.sched thead th { padding: 11px 8px; font-size: 13px; font-weight: 700; }
.sched tbody tr:last-child > * { border-bottom: 0; }
.sched-person { display: inline-flex; align-items: center; gap: 7px; }
.sched th:first-child { position: sticky; left: 0; z-index: 1; background: var(--surface); text-align: left; padding-left: 14px; width: 92px; color: var(--ink-2); font-size: 13px; font-weight: 700; }
.sched small { display: block; color: var(--accent-ink); font-size: 10.5px; font-weight: 700; line-height: 1.1; }
.sched .is-today th, .sched .is-today td { background: var(--accent-soft); }
.sched .is-today th:first-child { color: var(--ink); background: var(--accent-soft); border-radius: 12px 0 0 12px; }
.sched .is-today td:last-child { border-radius: 0 12px 12px 0; }
.sched thead .is-me { color: var(--accent-ink); }
.hours { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 12px; }
.hours-card { background: var(--surface); border-radius: var(--r-lg); box-shadow: var(--shadow); padding: 14px 16px; }
.hours-card.is-me { outline: 2px solid var(--accent); outline-offset: -2px; }
.hours-who { display: flex; align-items: center; gap: 9px; margin-bottom: 10px; }
.hours-big { font-size: 26px; font-weight: 800; line-height: 1.1; letter-spacing: -.01em; }
.hours-big small { font-size: 14px; color: var(--ink-3); font-weight: 700; }
.hours-sub { font-size: 12px; color: var(--ink-2); margin-top: 2px; }

/* ---------- Кабинет сотрудника ---------- */
.emp-top { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); gap: 14px; margin-bottom: 14px; }
.hero {
  position: relative; overflow: hidden; color: #fff; border-radius: var(--r-lg); padding: 22px; box-shadow: var(--shadow);
  background: radial-gradient(260px 260px at 96% 110%, rgba(255, 255, 255, .22), transparent 70%), linear-gradient(135deg, var(--c1), var(--c2));
}
.hero-label { font-weight: 600; font-size: 13.5px; opacity: .88; }
.hero-sum { font-size: 40px; font-weight: 800; letter-spacing: -.02em; line-height: 1.15; margin-top: 2px; white-space: nowrap; }
.hero-bar { height: 7px; border-radius: 7px; background: rgba(255, 255, 255, .25); margin: 16px 0 16px; overflow: hidden; }
.hero-bar i { display: block; height: 100%; border-radius: 7px; background: #fff; }
.hero-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.hero-grid dt { font-size: 12px; opacity: .8; }
.hero-grid dd { font-weight: 800; font-size: 15px; white-space: nowrap; }
.next-card { display: flex; flex-direction: column; justify-content: space-between; gap: 16px; }
.week-strip { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 5px; }
.week-day { text-align: center; font-size: 11.5px; color: var(--ink-3); font-weight: 600; }
.week-day b { display: block; margin-top: 4px; padding: 7px 0; border-radius: 9px; font-size: 11.5px; font-weight: 700; }
.week-day.is-today { color: var(--accent-ink); }
.week-day.is-today b { box-shadow: 0 0 0 2px var(--accent) inset; }
.pay-self { display: grid; gap: 14px; }

/* ---------- Зарплаты ---------- */
.pay { width: 100%; border-collapse: collapse; }
.pay th, .pay td { padding: 13px 14px; text-align: right; border-bottom: 1px solid var(--line); font-weight: 600; white-space: nowrap; }
.pay thead th { font-size: 12px; color: var(--ink-3); font-weight: 600; padding: 10px 14px; }
.pay thead th:first-child, .pay tfoot th { text-align: left; }
.pay tbody tr:hover > * { background: var(--surface-2); }
.pay-who { display: flex; align-items: center; gap: 11px; text-align: left !important; }
.pay-who b { display: block; font-weight: 700; }
.pay-who small { display: block; font-size: 12px; color: var(--ink-3); font-weight: 500; }
.pay-salary { display: inline-flex; align-items: center; gap: 2px; }
.pay td.neg { color: var(--danger); }
.pay td.muted { color: var(--ink-3); }
.pay-net { font-weight: 800 !important; font-size: 15px; width: 190px; }
.bar { display: block; height: 5px; border-radius: 5px; background: var(--danger-soft); margin-top: 6px; overflow: hidden; }
.bar i { display: block; height: 100%; border-radius: 5px; background: linear-gradient(90deg, #33a5ff, #0f7bf5); }
.pay tfoot > tr > * { border-bottom: 0; font-weight: 800; background: var(--surface-2); }
.pay tfoot th { border-radius: 12px 0 0 12px; }
.pay tfoot td:last-child { border-radius: 0 12px 12px 0; }

/* ---------- Регламент ---------- */
.principle { display: flex; gap: 14px; padding: 20px; border-radius: var(--r-lg); color: #fff; background: radial-gradient(300px 200px at 92% 120%, rgba(60, 150, 255, .5), transparent 70%), linear-gradient(135deg, #15233f, #070d1a); box-shadow: var(--shadow); }
.principle-ico { display: grid; place-items: center; flex: none; width: 44px; height: 44px; border-radius: 13px; background: rgba(255, 255, 255, .12); }
.principle strong { font-size: 16px; font-weight: 800; line-height: 1.3; display: block; }
.principle p { margin-top: 4px; font-size: 13.5px; opacity: .78; }
.rule-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); gap: 12px; margin-bottom: 14px; }
.rule { background: var(--surface); border-radius: var(--r-lg); box-shadow: var(--shadow); padding: 14px 16px 16px; }
.rule.is-important { outline: 2px solid var(--danger); outline-offset: -2px; }
.rule-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 10px; }
.rule-amount { font-weight: 800; color: var(--danger); font-size: 14px; }
.rule h3 { font-size: 14px; font-weight: 700; line-height: 1.3; }
.rule p { font-size: 12.5px; color: var(--ink-2); margin-top: 4px; }
.rule .rule-note { display: flex; gap: 5px; color: var(--accent-ink); font-weight: 600; margin-top: 8px; }
.rule .rule-note-warn { color: var(--danger); }
.rule-note .ico { margin-top: 2px; }
.core-rules { display: grid; gap: 8px; counter-reset: r; font-size: 13px; color: var(--ink-2); }
.core-rules li, .steps li { position: relative; padding-left: 28px; counter-increment: r; }
.core-rules li::before, .steps li::before { content: counter(r); position: absolute; left: 0; top: 0; width: 20px; height: 20px; border-radius: 6px; display: grid; place-items: center; font-size: 11px; font-weight: 800; background: var(--accent-soft); color: var(--accent-ink); }
.core-rules b { color: var(--ink); font-weight: 700; }
.steps { display: grid; gap: 8px; counter-reset: r; font-size: 13px; color: var(--ink-2); }
.quote { margin-top: 14px; padding: 12px 14px; border-radius: var(--r-md); background: var(--surface-2); font-size: 13px; color: var(--ink-2); }
.quote-label { font-size: 11.5px; font-weight: 700; color: var(--ink-3); margin-bottom: 4px; }

/* ---------- Журнал и доступы ---------- */
.audit li { display: flex; gap: 11px; padding: 11px 0; border-top: 1px solid var(--line); }
.audit li:first-child { border-top: 0; padding-top: 2px; }
.audit-main { min-width: 0; font-size: 13.5px; overflow-wrap: anywhere; }
.audit small { color: var(--ink-3); font-size: 12px; }
.access { display: grid; }
.access-row { display: flex; align-items: center; gap: 11px; padding: 10px 0; border-top: 1px solid var(--line); }
.access-row:first-child { border-top: 0; padding-top: 0; }
.access-row:last-child { padding-bottom: 0; }
.access-main { flex: 1; min-width: 0; }
.access-main b { display: block; }
.access-main small { color: var(--ink-3); font-size: 12px; }

/* ---------- Окна ---------- */
.modal-back { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; padding: 16px; background: rgba(8, 15, 30, .5); backdrop-filter: blur(3px); }
.modal-back.is-opening { animation: fade .14s ease-out; }
.modal-back.is-opening .modal { animation: pop .16s ease-out; }
.modal { display: flex; flex-direction: column; width: min(520px, 100%); max-height: calc(100dvh - 32px); background: var(--surface); border-radius: 22px; box-shadow: var(--shadow-lg); }
.modal-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 18px 20px 12px; }
.modal-head h2 { font-size: 18px; font-weight: 800; }
.modal-head p { color: var(--ink-2); font-size: 13px; }
.modal-body { padding: 2px 20px 16px; overflow-y: auto; }
.modal-foot { display: flex; align-items: center; justify-content: flex-end; gap: 8px; padding: 12px 20px 16px; border-top: 1px solid var(--line); }
.field-label { font-size: 12.5px; font-weight: 600; color: var(--ink-2); margin: 12px 0 6px; }
.field-label:first-child { margin-top: 0; }
.type-pick { display: grid; gap: 3px; max-height: 232px; overflow-y: auto; padding: 4px; border-radius: var(--r-md); background: var(--surface-2); }
.type-opt { display: flex; align-items: center; gap: 9px; padding: 5px 9px 5px 5px; border-radius: 10px; text-align: left; font-size: 13px; font-weight: 600; }
.type-opt:hover { background: var(--surface); }
.type-opt.is-on { background: var(--surface); box-shadow: 0 0 0 2px var(--accent) inset; }
.type-title { flex: 1; min-width: 0; }
.type-amt { flex: none; font-size: 12px; font-weight: 700; color: var(--danger); text-align: right; }
.type-hint { font-size: 12.5px; color: var(--ink-2); margin-top: 7px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { display: inline-flex; align-items: center; gap: 6px; min-height: 36px; padding: 5px 11px 5px 6px; border-radius: 11px; background: var(--surface-2); font-weight: 600; font-size: 13px; color: var(--ink-2); }
.chip small { font-size: 10.5px; color: var(--ink-3); font-weight: 600; }
.chip.is-on { background: var(--accent-soft); color: var(--accent-ink); box-shadow: 0 0 0 2px var(--accent) inset; }
.chips-sm .chip { padding-left: 11px; min-height: 32px; font-size: 12.5px; }
.chips-sm { margin-bottom: 8px; }
.sum-line { flex: 1; display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 8px; font-size: 13px; color: var(--ink-2); min-width: 0; }
.sum-line b { font-size: 17px; font-weight: 800; color: var(--danger); }
.wo-card { display: flex; align-items: center; gap: 11px; padding: 11px; border-radius: var(--r-md); background: var(--surface-2); }
.wo-card > div { flex: 1; min-width: 0; }
.wo-card b { display: block; }
.wo-card small { color: var(--ink-2); font-size: 12px; }
.shift-pick { display: grid; gap: 6px; }
.shift-opt { display: flex; align-items: center; gap: 12px; padding: 9px; border-radius: 12px; background: var(--surface-2); font-size: 13px; text-align: left; }
.shift-opt:hover { box-shadow: 0 0 0 2px var(--line) inset; }
.shift-opt.is-on { box-shadow: 0 0 0 2px var(--accent) inset; }
.shift-opt .ico { margin-left: auto; color: var(--accent-ink); }
.cred { display: grid; gap: 10px; margin-top: 12px; }
.cred small { display: block; color: var(--ink-3); font-size: 12px; margin-bottom: 3px; }
.cred code { display: block; padding: 10px 12px; border-radius: var(--r-sm); background: var(--surface-2); font: 700 15px/1.3 ui-monospace, 'Cascadia Mono', Consolas, monospace; user-select: all; overflow-wrap: anywhere; }

#toasts { position: fixed; z-index: 70; right: 16px; bottom: 16px; display: grid; gap: 8px; }
.toast { padding: 11px 15px; border-radius: 12px; background: #0e1a30; color: #fff; font-weight: 600; font-size: 13.5px; box-shadow: var(--shadow-lg); animation: pop .16s ease-out; transition: opacity .3s; }
.toast-err { background: #c9233b; }
.toast.out { opacity: 0; }
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { opacity: 0; transform: translateY(8px) scale(.985); } }

/* ---------- Вход ---------- */
.login { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr); gap: 8px; padding: 8px; }
.login-card { display: flex; flex-direction: column; justify-content: center; width: min(380px, 100%); margin: 0 auto; padding: 32px 16px; }
.login-card .logo { padding: 0 0 26px; font-size: 32px; }
.login-card h1 { margin-bottom: 2px; }
.login-card .sub { margin-bottom: 20px; }
.login-art {
  position: relative; overflow: hidden; display: flex; align-items: flex-end; padding: 40px; border-radius: 26px;
  background: radial-gradient(500px 400px at 85% 15%, rgba(255, 255, 255, .22), transparent 70%), linear-gradient(140deg, #2aa0ff, #0a4fd0);
}
.art-title { position: relative; z-index: 1; font-size: 46px; line-height: 1.04; font-weight: 800; letter-spacing: -.025em; color: #fff; text-transform: uppercase; max-width: 9em; }
.art-card { position: absolute; display: flex; align-items: flex-end; width: 190px; height: 120px; padding: 13px 15px; border-radius: 20px; background: linear-gradient(140deg, var(--c1), var(--c2)); box-shadow: 0 22px 44px rgba(4, 22, 66, .32); color: #fff; font-size: 24px; font-weight: 800; border: 1px solid rgba(255, 255, 255, .22); }
.art-card:nth-child(1) { top: 9%; left: 12%; transform: rotate(-7deg); }
.art-card:nth-child(2) { top: 22%; right: 12%; transform: rotate(6deg); }
.art-card:nth-child(3) { top: 42%; left: 26%; transform: rotate(-2deg); }

/* ---------- Адаптив ---------- */
@media (max-width: 1240px) {
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .catalog { grid-template-columns: minmax(0, 1fr); }
  .cat-panel { position: static; display: flex; gap: 6px; overflow-x: auto; padding: 8px; scrollbar-width: none; }
  .cat-panel .cat-label { display: none; }
  .cat { width: auto; flex: none; max-width: 300px; }
  .cat-name { white-space: nowrap; }
}
@media (max-width: 980px) {
  .two-col, .two-col-even, .emp-top { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 860px) {
  .layout { display: block; padding: 8px 16px calc(84px + env(safe-area-inset-bottom)); }
  .side { display: none; }
  .tabs {
    position: fixed; z-index: 30; left: 0; right: 0; bottom: 0;
    display: grid; grid-template-columns: repeat(5, 1fr);
    padding: 6px 6px calc(6px + env(safe-area-inset-bottom));
    background: var(--surface); border-top: 1px solid var(--line);
  }
  .tab { display: grid; justify-items: center; gap: 3px; padding: 6px 0; border-radius: 12px; color: var(--ink-3); font-size: 10.5px; font-weight: 600; }
  .tab.is-active { color: var(--accent-ink); background: var(--accent-soft); }
  .topbar { flex-wrap: wrap; margin-bottom: 16px; }
  .top-right { flex: 1 1 100%; order: -1; }
  .top-right .pill { flex: 1; min-width: 0; justify-content: center; padding: 0 10px; }
  .user-chip > span:not(.ava) { display: none; }
  .user-chip { padding: 0; width: 40px; justify-content: center; }
  .month { width: 100%; justify-content: space-between; }
  h1 { font-size: 23px; }
  .page-head { align-items: flex-start; flex-direction: column; gap: 10px; }
  .page-actions, .page-actions .btn { width: 100%; }
  .legend-hint { margin-left: 0; }
  .login { grid-template-columns: minmax(0, 1fr); }
  .login-art { display: none; }

  .pay thead { display: none; }
  .pay, .pay tbody, .pay tfoot { display: block; }
  .pay tr { display: block; padding: 10px 8px; border-bottom: 1px solid var(--line); }
  .pay tbody tr:hover > * { background: none; }
  .pay th, .pay td, .pay tfoot > tr > * { border: 0; padding: 3px 0; background: none; border-radius: 0; }
  .pay-who { margin-bottom: 6px; }
  .pay td { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
  .pay td::before { content: attr(data-label); color: var(--ink-3); font-weight: 500; font-size: 12.5px; }
  .pay tfoot tr { background: var(--surface-2); border-radius: 12px; border: 0; margin-top: 8px; padding: 10px 12px; }
  .pay-net { width: auto; flex-wrap: wrap; }
  .bar { flex: 1 1 100%; }
  .search { flex-basis: 100%; }
  .select { flex: 1; min-width: 0; }
  .select select { width: 100%; }
  .toolbar > .btn { width: 100%; }
  .hero-sum { font-size: 33px; }
  .modal-back { place-items: end center; padding: 0; }
  .modal { width: 100%; border-radius: 22px 22px 0 0; max-height: 92dvh; }
  .modal-foot { padding-bottom: calc(16px + env(safe-area-inset-bottom)); }
  #toasts { left: 16px; bottom: calc(76px + env(safe-area-inset-bottom)); }
}
.off-short { display: none; }
@media (max-width: 640px) {
  .table-panel:has(.sched) { padding: 4px; }
  .sched { min-width: 0; table-layout: fixed; }
  .sched th, .sched td { padding: 5px 2px; }
  .sched thead th { padding: 8px 2px; font-size: 10px; font-weight: 600; }
  .sched th:first-child { position: static; width: 34px; padding-left: 6px; font-size: 12px; }
  .sched-person { flex-direction: column; gap: 3px; }
  .sched small { display: none; }
  .sched .shift { min-width: 0; width: 100%; padding: 7px 0; font-size: 10.5px; border-radius: 7px; }
  .sched .dot { display: none; }
  .off-long { display: none; }
  .off-short { display: inline; }
}
@media (max-width: 520px) {
  .stats { gap: 8px; }
  .stats > .stat { padding: 12px; flex-direction: column; gap: 8px; }
  .stat-value { font-size: 17px; }
  .fine { flex-wrap: wrap; }
  .fine-main { flex-basis: calc(100% - 50px); }
  .fine-side { flex-direction: row; align-items: center; justify-content: flex-end; gap: 12px; width: 100%; }
  .hero-grid dd { font-size: 13.5px; }
  .week-day b { font-size: 10px; }
  .access-row { flex-wrap: wrap; }
  .access-row .btn { width: 100%; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ---------- Время смен и шкала дня ---------- */
.tm { display: inline-flex; align-items: baseline; gap: 4px; }
.tm b { font-weight: 800; }
.tm i { font-style: normal; opacity: .55; }
.tm span { font-weight: 600; }
.panel-sub { font-size: 12.5px; color: var(--ink-3); margin-top: 1px; }
.panel-head > div { min-width: 0; }
.week-day b small { display: block; font-size: 10px; font-weight: 600; opacity: .75; margin-top: 1px; }

.tl { position: relative; display: grid; gap: 12px; padding-top: 20px; }
.tl-row { display: grid; gap: 7px; }
.tl-info { display: flex; align-items: center; gap: 10px; min-width: 0; }
.tl-who { flex: 1; min-width: 0; line-height: 1.25; }
.tl-who > b { display: block; font-weight: 700; }
.tl-who small { display: block; font-size: 12px; color: var(--ink-3); }
.tl-who small .ok { color: var(--ok); font-weight: 700; }
.tl-time { flex: none; font-weight: 800; font-size: 13.5px; white-space: nowrap; }
.tl-track { position: relative; height: 10px; border-radius: 10px; background: var(--surface-2); }
.tl-bar { position: absolute; top: 0; bottom: 0; border-radius: 10px; }
.b-10-00 { background: linear-gradient(90deg, #4db0ff, #0f7bf5); }
.b-11-01 { background: linear-gradient(90deg, #b08cff, #6a3cf0); }
.b-12-02 { background: linear-gradient(90deg, #ffb35c, #e86a0c); }
.tl-row.is-done .tl-bar, .tl-row.is-before .tl-bar { opacity: .35; }
.tl-row.is-done .tl-time, .tl-row.is-off .tl-time { color: var(--ink-3); }
.tl-row.is-off .tl-who b { color: var(--ink-2); }
.tl-row.is-live .tl-track { box-shadow: 0 0 0 2px rgba(24, 201, 100, .25); }
.tl-now { position: absolute; z-index: 1; top: 16px; bottom: 18px; width: 2px; margin-left: -1px; background: var(--danger); border-radius: 2px; pointer-events: none; }
.tl-now span { position: absolute; top: -17px; left: 50%; transform: translateX(-50%); padding: 1px 5px; border-radius: 5px; background: var(--danger); color: #fff; font-size: 10.5px; font-weight: 700; white-space: nowrap; }
.tl-axis { display: flex; justify-content: space-between; font-size: 11px; font-weight: 600; color: var(--ink-3); padding-top: 2px; }
.tl-now ~ .tl-row .tl-info { position: relative; z-index: 2; background: var(--surface); }
#view > .panel + .section-title { margin-top: 22px; }

@media (max-width: 640px) {
  .sched .tm { flex-direction: column; align-items: center; gap: 0; line-height: 1.15; }
  .sched .tm i { display: none; }
  .sched .tm span { font-size: 9.5px; opacity: .8; }
  .tl-time { font-size: 12.5px; }
}
.tl-axis { position: relative; display: block; height: 15px; }
.tl-axis span { position: absolute; top: 2px; transform: translateX(-50%); }
.tl-axis span:nth-child(1) { left: 0; transform: none; }
.tl-axis span:nth-child(2) { left: 25%; }
.tl-axis span:nth-child(3) { left: 50%; }
.tl-axis span:nth-child(4) { left: 75%; }
.tl-axis span:nth-child(5) { left: 100%; transform: translateX(-100%); }
