/* =====================================================================
   Табель офісу — світла строга тема
   ===================================================================== */
:root {
  --bg: #f4f6f8;
  --surface: #ffffff;
  --surface-2: #f9fafb;
  --text: #0f1a22;
  --text-2: #36434d;
  --muted: #6b7882;
  --line: #e2e7eb;
  --line-strong: #ccd4da;
  --primary: #1e2b35;
  --primary-hover: #2b3b47;
  --primary-fg: #f7fafc;
  --accent: #2f6688;
  --accent-soft: #eaf3f8;
  --accent-line: #c6dce9;
  --danger: #dc2626;
  --danger-soft: #fef2f2;
  --warn-soft: #fffbeb;
  --warn-line: #fde68a;
  --weekend: #f4f6f8;
  --today: #f3f8fb;
  --m-green: #d9ead3;
  --m-yellow: #fff2cc;
  --m-red: #f4cccc;
  --m-blue: #cfe2f3;
  --admin-dot: #2563eb;
  --success: #15803d;
  --success-soft: #ecfdf3;
  --success-line: #bbf7d0;
  --brand-sky: #d5e7f1;

  --radius-sm: 6px;
  --radius: 10px;
  --radius-lg: 14px;
  --shadow-xs: 0 1px 2px rgba(15, 26, 34, .04);
  --shadow-sm: 0 1px 2px rgba(15, 26, 34, .05), 0 1px 3px rgba(15, 26, 34, .04);
  --shadow-lg: 0 24px 48px -12px rgba(15, 26, 34, .28);
  --ring: 0 0 0 3px rgba(47, 102, 136, .18);

  --ease: cubic-bezier(.2, .7, .2, 1);
  --fast: 140ms;
  --med: 240ms;
  color-scheme: light;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font: 15px/1.45 Roboto, Inter, "SF Pro Text", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
h1 { font-size: 17px; font-weight: 650; letter-spacing: -.01em; margin: 0; }
h2 { font-size: 24px; font-weight: 700; letter-spacing: -.02em; margin: 10px 0 6px; }
h3 { font-size: 15px; font-weight: 650; letter-spacing: -.01em; margin: 0 0 10px; }
button, input, select, textarea { font: inherit; color: inherit; }
code { font-family: ui-monospace, "SF Mono", Menlo, monospace; }
::selection { background: var(--brand-sky); }

.muted { color: var(--muted); }
.small { font-size: 13px; }
.strong { font-weight: 650; }
.right { text-align: right; }
.nowrap { white-space: nowrap; }
.pad { padding: 16px; }
.center { max-width: 420px; margin: 22vh auto; padding: 0 16px; text-align: center; animation: fade-up var(--med) var(--ease) backwards; }
.center-text { text-align: center; }
.hint { color: var(--muted); font-size: 13px; margin: 4px 0 12px; }
.error-box { margin: 12px 0; padding: 12px 14px; border-radius: var(--radius); background: var(--danger-soft); border: 1px solid #fecaca; color: #991b1b; font-size: 14px; animation: fade-up var(--med) var(--ease) backwards; }

/* ---------- шапка ---------- */
.top {
  display: flex; align-items: center; gap: 10px; padding: 12px 20px;
  background: rgba(255, 255, 255, .86);
  backdrop-filter: saturate(1.6) blur(10px); -webkit-backdrop-filter: saturate(1.6) blur(10px);
  border-bottom: 1px solid var(--line);
}
.top h1 { display: flex; align-items: center; gap: 10px; }
.top h1::before {
  content: ""; width: 28px; height: 28px; border-radius: 50%; flex: none;
  background: var(--brand-sky) url(/logo-small.svg) center / 74% no-repeat; box-shadow: 0 0 0 1px var(--accent-line);
}
.brand-name { font-weight: 700; letter-spacing: .02em; font-size: 18px; }
.brand-sub { font-weight: 500; font-size: 13px; color: var(--muted); padding-left: 10px; border-left: 1px solid var(--line-strong); }

/* привітальний блок на сторінці працівника */
.hero { text-align: center; padding: 26px 0 6px; }
.hero-logo {
  width: 84px; height: 84px; margin: 0 auto 12px; border-radius: 50%;
  background: var(--brand-sky) url(/logo.svg) center / 84% no-repeat;
  box-shadow: 0 0 0 1px var(--accent-line), 0 10px 24px -12px rgba(47, 102, 136, .55);
  animation: hero-in 520ms var(--ease) both;
}
.hero h2 { margin: 0; }
.hero p { margin: 4px 0 0; }
@keyframes hero-in { from { opacity: 0; transform: scale(.85) rotate(-8deg); } to { opacity: 1; transform: none; } }
.badge {
  font-size: 12px; font-weight: 550; padding: 2px 9px; border-radius: 99px;
  background: var(--surface-2); color: var(--text-2); border: 1px solid var(--line);
}

/* ---------- кнопки й поля ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 36px; padding: 0 14px; border-radius: var(--radius-sm);
  border: 1px solid var(--line); background: var(--surface); color: var(--text);
  font-size: 14px; font-weight: 550; cursor: pointer; white-space: nowrap;
  box-shadow: var(--shadow-xs);
  transition: background var(--fast), border-color var(--fast), box-shadow var(--fast), transform var(--fast) var(--ease), opacity var(--fast);
}
.btn:hover { background: var(--surface-2); border-color: var(--line-strong); }
.btn:active { transform: scale(.97); }
.btn:focus-visible, .chip:focus-visible, .tab:focus-visible, .pick:focus-visible, .step:focus-visible, .link:focus-visible { outline: none; box-shadow: var(--ring); }
.btn:disabled { opacity: .45; cursor: default; transform: none; }
.btn.primary { background: var(--primary); border-color: var(--primary); color: var(--primary-fg); }
.btn.primary:hover { background: var(--primary-hover); }
.btn.danger { color: var(--danger); }
.btn.danger:hover { background: var(--danger-soft); border-color: #fecaca; }
.btn.ghost { border-color: transparent; background: transparent; box-shadow: none; }
.btn.ghost:hover { background: rgba(0, 0, 0, .04); }
.btn.icon { width: 36px; padding: 0; }
.btn.big {
  width: 100%; height: 56px; font-size: 17px; font-weight: 650; border-radius: var(--radius);
  margin-top: 18px; letter-spacing: -.01em;
}
.btn.big.primary:not(:disabled) { box-shadow: 0 8px 20px -8px rgba(30, 43, 53, .5); }
.link {
  background: none; border: 0; padding: 0; color: var(--text-2); cursor: pointer;
  text-decoration: underline; text-decoration-color: var(--line-strong); text-underline-offset: 3px;
  border-radius: 3px; transition: color var(--fast), text-decoration-color var(--fast);
}
.link:hover { color: var(--text); text-decoration-color: currentColor; }
.link.danger { color: var(--danger); }

.input {
  height: 38px; border: 1px solid var(--line); background: var(--surface); border-radius: var(--radius-sm);
  padding: 0 12px; min-width: 0; font-size: 14px; box-shadow: var(--shadow-xs);
  transition: border-color var(--fast), box-shadow var(--fast), background var(--fast);
}
.input::placeholder, .task-input::placeholder { color: #9aa6af; }
.input:hover { border-color: var(--line-strong); }
.input:focus { outline: none; border-color: #9aa6af; box-shadow: var(--ring); }
.input.big { width: 100%; height: 48px; font-size: 16px; margin-bottom: 12px; border-radius: var(--radius); }
.input.inline { width: 100%; max-width: 280px; box-shadow: none; border-color: transparent; background: transparent; }
.input.inline:hover { border-color: var(--line); background: var(--surface); }
.input.inline:focus { border-color: #9aa6af; background: var(--surface); }
select.input { padding-right: 28px; }
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; font-size: 13px; font-weight: 550; color: var(--text-2); }
.field .input { font-weight: 400; color: var(--text); }
.check { display: inline-flex; align-items: center; gap: 6px; font-size: 14px; cursor: pointer; color: var(--text-2); }
input[type=checkbox] { accent-color: var(--primary); width: 16px; height: 16px; }

.row { display: flex; gap: 8px; align-items: center; margin-bottom: 10px; }
.row > .input { flex: 1; }
.row.wrap { flex-wrap: wrap; }
.row-between { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.row-end { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; }
.row-center { display: flex; justify-content: center; gap: 8px; flex-wrap: wrap; margin-top: 14px; }

.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg);
  padding: 18px; margin-bottom: 14px; box-shadow: var(--shadow-sm);
}
section.card:nth-of-type(2) { animation-delay: 40ms; }
section.card:nth-of-type(3) { animation-delay: 80ms; }

/* ---------- чіпи ---------- */
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  display: inline-flex; align-items: center; gap: 6px; height: 34px; padding: 0 14px;
  border: 1px solid var(--line); background: var(--surface); border-radius: 99px;
  font-size: 14px; font-weight: 500; color: var(--text-2); cursor: pointer; position: relative;
  transition: background var(--fast), border-color var(--fast), color var(--fast), transform var(--fast) var(--ease), box-shadow var(--fast);
}
.chip:hover { border-color: var(--line-strong); color: var(--text); }
.chip:active { transform: scale(.95); }
.chip.on { background: var(--primary); border-color: var(--primary); color: var(--primary-fg); box-shadow: 0 4px 10px -4px rgba(30, 43, 53, .45); }
.chip .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--success); }
.chip.on .dot { background: #86efac; }
.swatch::before, .swatch-box { content: ""; display: inline-block; width: 11px; height: 11px; border-radius: 3px; border: 1px solid rgba(0, 0, 0, .12); }
.swatch-box { width: 24px; height: 24px; border-radius: 6px; flex: none; }
.s-green::before, .swatch-box.s-green { background: var(--m-green); }
.s-yellow::before, .swatch-box.s-yellow { background: var(--m-yellow); }
.s-red::before, .swatch-box.s-red { background: var(--m-red); }
.s-blue::before, .swatch-box.s-blue { background: var(--m-blue); }

/* ---------- повідомлення ---------- */
.toast {
  position: fixed; left: 50%; bottom: max(24px, env(safe-area-inset-bottom)); transform: translateX(-50%);
  display: flex; align-items: center; gap: 8px;
  background: var(--primary); color: var(--primary-fg); padding: 11px 16px; border-radius: var(--radius);
  font-size: 14px; font-weight: 500; box-shadow: var(--shadow-lg); z-index: 60; max-width: calc(100% - 32px);
  animation: toast-in var(--med) var(--ease) backwards;
}
.toast[hidden] { display: none; }
.toast::before { content: "✓"; display: grid; place-items: center; width: 18px; height: 18px; border-radius: 50%; background: #22c55e; color: #fff; font-size: 11px; font-weight: 700; flex: none; }
.toast.error { background: #7f1d1d; }
.toast.error::before { content: "!"; background: #ef4444; }

/* ---------- діалоги ---------- */
.dialog {
  border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 22px; background: var(--surface); color: var(--text);
  width: min(560px, calc(100% - 32px)); box-shadow: var(--shadow-lg);
  animation: dialog-in var(--med) var(--ease) backwards;
}
.dialog::backdrop { background: rgba(15, 26, 34, .38); backdrop-filter: blur(2px); animation: fade-in var(--med) ease backwards; }
.dialog h3 { font-size: 17px; margin-bottom: 8px; }
.dialog p { margin: 6px 0; color: var(--text-2); }
.dialog select { width: 100%; }

/* =====================================================================
   ПРАЦІВНИК
   ===================================================================== */
.worker { max-width: 480px; margin: 0 auto; padding-bottom: 48px; }
.worker > *:not(.top) { margin-left: 16px; margin-right: 16px; }
.worker > .input.big, .worker > .btn.big { width: calc(100% - 32px); }
.worker .top { justify-content: center; margin-bottom: 8px; position: sticky; top: 0; z-index: 5; }
/* анімація появи — лише при зміні екрана, а не на кожне натискання */
.worker.enter > *:not(.top) { animation: fade-up var(--med) var(--ease) backwards; }
.worker.enter > *:nth-child(3) { animation-delay: 30ms; }
.worker.enter > *:nth-child(4) { animation-delay: 60ms; }
.worker.enter > *:nth-child(5) { animation-delay: 90ms; }
.worker.enter > *:nth-child(6) { animation-delay: 120ms; }
.worker.enter > *:nth-child(n+7) { animation-delay: 150ms; }

.pick-list { display: grid; gap: 8px; }
.pick {
  display: flex; justify-content: space-between; align-items: center; gap: 8px;
  text-align: left; padding: 15px 16px; font-size: 16px; font-weight: 550; border-radius: var(--radius);
  border: 1px solid var(--line); background: var(--surface); cursor: pointer; box-shadow: var(--shadow-xs);
  transition: border-color var(--fast), box-shadow var(--fast), transform var(--fast) var(--ease);
}
.pick::after { content: "›"; color: #9aa6af; font-size: 20px; line-height: 1; transition: transform var(--fast) var(--ease); }
.pick:hover { border-color: var(--line-strong); box-shadow: var(--shadow-sm); }
.pick:hover::after { transform: translateX(3px); }
.pick:active { transform: scale(.985); }
.pick.bound { color: var(--muted); background: var(--surface-2); }
.pick.bound::after { content: none; }
.worker.enter .pick { animation: fade-up var(--med) var(--ease) backwards; }
.worker.enter .pick:nth-child(2) { animation-delay: 25ms; }
.worker.enter .pick:nth-child(3) { animation-delay: 50ms; }
.worker.enter .pick:nth-child(4) { animation-delay: 75ms; }
.worker.enter .pick:nth-child(5) { animation-delay: 100ms; }
.worker.enter .pick:nth-child(6) { animation-delay: 125ms; }
.worker.enter .pick:nth-child(n+7) { animation-delay: 150ms; }

.who {
  display: flex; justify-content: space-between; align-items: center;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg);
  padding: 14px 16px; margin-top: 10px; box-shadow: var(--shadow-sm);
}
.who-name { font-size: 19px; font-weight: 700; letter-spacing: -.015em; margin-top: 2px; }
.label { font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; margin: 22px 0 10px; }

.stepper {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 10px;
  box-shadow: var(--shadow-sm);
}
.step {
  width: 60px; height: 60px; border-radius: var(--radius); border: 1px solid var(--line);
  background: var(--surface-2); font-size: 28px; font-weight: 400; color: var(--text-2); cursor: pointer;
  transition: background var(--fast), transform var(--fast) var(--ease), border-color var(--fast);
}
.step:hover { background: #eef1f4; border-color: var(--line-strong); }
.step:active { transform: scale(.92); }
.hours-big { font-size: 46px; font-weight: 750; letter-spacing: -.03em; font-variant-numeric: tabular-nums; }
.hours-big.bump { animation: bump 260ms var(--ease); }
.hours-big .unit { font-size: 15px; font-weight: 500; letter-spacing: 0; color: var(--muted); margin-left: 6px; }
.quick { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin-top: 10px; }
.quick .chip { justify-content: center; height: 46px; padding: 0; font-size: 16px; border-radius: var(--radius); font-variant-numeric: tabular-nums; }

.month { margin-top: 26px; }
.my-list { margin-top: 10px; }
.my-row { display: flex; justify-content: space-between; padding: 9px 0; border-top: 1px solid var(--line); font-size: 14px; font-variant-numeric: tabular-nums; }
.my-row span:last-child { font-weight: 600; }

.pending { padding: 28px 18px; margin-top: 18px; }
.big-emoji { font-size: 44px; animation: float 2.4s ease-in-out infinite; }
.install { margin-top: 14px; background: linear-gradient(180deg, var(--surface), var(--surface-2)); }
.install .btn { margin-top: 10px; width: 100%; }

/* =====================================================================
   АДМІН
   ===================================================================== */
.admin-top { position: sticky; top: 0; z-index: 6; }
.tabs {
  display: flex; gap: 4px; overflow-x: auto; background: var(--surface); border-bottom: 1px solid var(--line);
  padding: 0 16px; position: sticky; top: 53px; z-index: 5; scrollbar-width: none;
}
.tabs::-webkit-scrollbar { display: none; }
.tab {
  position: relative; border: 0; background: none; padding: 12px 10px; cursor: pointer; white-space: nowrap;
  color: var(--muted); font-size: 14px; font-weight: 550; border-radius: 6px 6px 0 0; transition: color var(--fast);
}
.tab::after {
  content: ""; position: absolute; left: 8px; right: 8px; bottom: -1px; height: 2px; border-radius: 2px;
  background: var(--accent); transform: scaleX(0); transition: transform var(--med) var(--ease);
}
.tab:hover { color: var(--text); }
.tab.on { color: var(--text); }
.tab.on::after { transform: scaleX(1); }

.admin-body { padding: 18px 20px 48px; max-width: 1600px; margin: 0 auto; }
.admin-body.enter > * { animation: fade-up var(--med) var(--ease) backwards; }
.toolbar { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 12px; }
.month-nav { display: flex; align-items: center; gap: 6px; }
.month-nav .btn:not(.ghost) { width: 36px; padding: 0; font-size: 18px; }
.month-title { min-width: 150px; text-align: center; font-size: 16px; font-weight: 650; letter-spacing: -.01em; }

.alerts:empty { display: none; }
.alerts { padding: 14px 20px 0; display: grid; gap: 8px; max-width: 1600px; margin: 0 auto; }
.alert {
  display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap;
  padding: 12px 16px; border-radius: var(--radius); background: var(--warn-soft); border: 1px solid var(--warn-line);
  box-shadow: var(--shadow-xs); animation: slide-down var(--med) var(--ease) backwards;
}
.alert .row { margin: 0; }

.lock-bar {
  display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 10px 14px; border-radius: var(--radius); background: var(--accent-soft); border: 1px solid var(--accent-line);
  margin-bottom: 12px; font-size: 14px; color: #1d4560;
}
.lock-bar.open { background: transparent; border: 1px dashed var(--line-strong); color: var(--text-2); }

/* ---------- таблиці ---------- */
.table-wrap {
  overflow-x: auto; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}
table { border-collapse: separate; border-spacing: 0; width: 100%; }
th, td { border-bottom: 1px solid var(--line); padding: 8px 10px; text-align: left; vertical-align: middle; }
tbody tr:last-child td, tbody tr:last-child th { border-bottom: 0; }
thead th {
  font-weight: 600; font-size: 12px; color: var(--muted); background: var(--surface-2);
  text-transform: uppercase; letter-spacing: .03em; white-space: nowrap;
}
.list tbody tr { transition: background var(--fast); }
.list tbody tr:hover { background: var(--surface-2); }
tr.inactive td, th.inactive { color: #9aa6af; }
td.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
td.actions { white-space: nowrap; text-align: right; }
td.actions .btn { margin-left: 4px; height: 32px; padding: 0 10px; font-size: 13px; }
td.actions .btn.icon { width: 32px; padding: 0; }
.list.small td, .list.small th { font-size: 13px; }
code.details { font-size: 12px; word-break: break-all; color: var(--muted); }

.grid th.name {
  position: sticky; left: 0; z-index: 2; background: var(--surface); min-width: 180px; max-width: 230px;
  border-right: 1px solid var(--line); font-weight: 550; font-size: 14px; color: var(--text);
  text-transform: none; letter-spacing: 0; transition: background var(--fast);
}
.grid thead th.name { z-index: 3; background: var(--surface-2); color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .03em; }
.grid tbody tr:hover th.name { background: #f1f4f6; }
.grid tbody .work-mode-heading th.name,
.grid tbody .work-mode-heading td {
  background: var(--surface-2);
  border-top: 1px solid var(--line);
  color: var(--text-2);
}

.tabel th.day { text-align: center; padding: 6px 0; min-width: 42px; font-size: 12px; color: var(--text-2); }
.tabel th.day .wd { font-weight: 450; font-size: 10.5px; color: var(--muted); text-transform: none; }
.tabel td.cell { padding: 0; border-left: 1px solid var(--line); min-width: 42px; position: relative; transition: background-color var(--med); }
.cell-input {
  width: 100%; min-width: 42px; height: 36px; border: 0; background: transparent; text-align: center;
  font-variant-numeric: tabular-nums; font-size: 14px; padding: 0; border-radius: 0;
}
.cell-input:focus { outline: none; box-shadow: inset 0 0 0 2px var(--primary); background: var(--surface); position: relative; z-index: 1; }
.cell-input[readonly] { cursor: pointer; }
.weekend { background: var(--weekend); }
thead th.weekend { background: #eef1f4; }
th.today { color: var(--accent) !important; box-shadow: inset 0 -2px 0 var(--accent); }
td.today:not([class*="m-"]) { background-color: var(--today); }
td.m-green { background: var(--m-green); }
td.m-yellow { background: var(--m-yellow); }
td.m-red { background: var(--m-red); }
td.m-blue { background: var(--m-blue); }
.tabel td.cell[title]:not([title=""]) { background-image: linear-gradient(225deg, #d4d4d8 5px, transparent 5px); }
.tabel td.cell.by-admin::before { content: ""; position: absolute; left: 4px; bottom: 4px; width: 5px; height: 5px; border-radius: 50%; background: var(--admin-dot); pointer-events: none; }
.tabel td.cell.saved, .task-cell.saved { animation: saved 900ms var(--ease); }
.tabel tfoot td { border-bottom: 0; border-top: 1px solid var(--line); font-weight: 650; background: var(--surface-2); }
td.total { white-space: nowrap; text-align: right; font-size: 15px; }

.objects th, .objects td.task-cell { min-width: 240px; }
.objects th .link { font-weight: 450; display: block; margin-top: 3px; font-size: 12px; text-transform: none; letter-spacing: 0; }
.task-cell { padding: 3px; border-left: 1px solid var(--line); position: relative; }
.task-cell.missing { background: var(--danger-soft); }
.task-input {
  width: 100%; border: 1px solid transparent; border-radius: var(--radius-sm); background: transparent;
  padding: 7px 50px 7px 8px; min-height: 36px; font-size: 14px; transition: border-color var(--fast), background var(--fast), box-shadow var(--fast);
}
.task-input:hover { border-color: var(--line); background: var(--surface); }
.task-input:focus { outline: none; border-color: #9aa6af; background: var(--surface); box-shadow: var(--ring); }
.hrs {
  position: absolute; right: 9px; top: 50%; transform: translateY(-50%); font-size: 11px; font-weight: 550;
  color: var(--muted); background: var(--surface-2); border: 1px solid var(--line); border-radius: 99px; padding: 1px 6px;
  pointer-events: none; font-variant-numeric: tabular-nums;
}

.sync-status { padding: 9px 12px; border-radius: var(--radius-sm); background: var(--surface-2); border: 1px solid var(--line); font-size: 13px; margin: 6px 0 14px; }
.sync-status.ok { background: var(--accent-soft); border-color: var(--accent-line); color: #1d4560; }
.sync-status.bad { background: var(--danger-soft); border-color: #fecaca; color: #991b1b; }
.history { max-height: 60vh; overflow: auto; }
.history table { margin-top: 8px; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
label.btn input[type=file] { display: none; }

/* ---------- завантаження ---------- */
.skeleton { display: grid; gap: 10px; padding: 4px 0; }
.skeleton div {
  height: 34px; border-radius: var(--radius);
  background: linear-gradient(90deg, #edf0f3 0%, #f7f9fa 40%, #edf0f3 80%); background-size: 300% 100%;
  animation: shimmer 1.3s linear infinite;
}
.skeleton div:first-child { width: 38%; height: 30px; }
.skeleton div:nth-child(2) { height: 220px; border-radius: var(--radius-lg); }

/* ---------- анімації ---------- */
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes fade-up { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@keyframes slide-down { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }
@keyframes dialog-in { from { opacity: 0; transform: translateY(8px) scale(.97); } to { opacity: 1; transform: none; } }
@keyframes toast-in { from { opacity: 0; transform: translate(-50%, 12px) scale(.96); } to { opacity: 1; transform: translate(-50%, 0); } }
@keyframes bump { 0% { transform: scale(.94); opacity: .6; } 60% { transform: scale(1.03); opacity: 1; } 100% { transform: none; } }
@keyframes saved { 0% { box-shadow: inset 0 0 0 2px #22c55e; background-color: #dcfce7; } 100% { box-shadow: inset 0 0 0 2px transparent; } }
@keyframes shimmer { from { background-position: 100% 0; } to { background-position: -200% 0; } }
@keyframes float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-4px); } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 1ms !important; animation-iteration-count: 1 !important; transition-duration: 1ms !important; }
}

@media (max-width: 600px) {
  .top { padding: 11px 14px; }
  .admin-body { padding: 12px 10px 48px; }
  .alerts { padding: 10px 10px 0; }
  .tabs { padding: 0 8px; }
  .grid th.name { min-width: 120px; max-width: 140px; font-size: 13px; }
  .month-title { min-width: 120px; }
  .card { padding: 16px; }
}
.btn.big.done, .btn.big.done:disabled { opacity: 1; background: var(--success-soft); border-color: var(--success-line); color: var(--success); box-shadow: none; animation: fade-in var(--med) ease; }

/* ---------- плашка «Встановити застосунок» ---------- */
#install:empty { display: none; }
.install-bar {
  position: relative; z-index: 7; display: flex; align-items: center; gap: 12px;
  padding: 10px 12px 10px 14px; padding-top: max(10px, env(safe-area-inset-top));
  background: var(--primary); color: var(--primary-fg);
  animation: slide-down var(--med) var(--ease) backwards;
}
.install-icon { width: 40px; height: 40px; border-radius: 10px; flex: none; background: url(/icon.svg) center / cover no-repeat; box-shadow: 0 0 0 1px rgba(255, 255, 255, .15); }
.install-text { display: flex; flex-direction: column; min-width: 0; flex: 1; line-height: 1.25; }
.install-text b { font-size: 15px; letter-spacing: .02em; }
.install-text span { font-size: 12.5px; color: #b8c4cd; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.install-btn.btn.primary { background: var(--primary-fg); color: var(--primary); border-color: var(--primary-fg); height: 36px; padding: 0 16px; font-weight: 650; flex: none; }
.install-btn.btn.primary:hover { background: #fff; }
.install-close {
  flex: none; width: 30px; height: 30px; border: 0; border-radius: 50%; background: transparent; color: #b8c4cd;
  font-size: 22px; line-height: 1; cursor: pointer; transition: background var(--fast), color var(--fast);
}
.install-close:hover { background: rgba(255, 255, 255, .1); color: #fff; }
.has-install .admin-top, .has-install .worker .top { position: relative; }
.has-install .tabs { top: 0; }
.install-hero { width: 64px; height: 64px; margin: 2px 0 10px; border-radius: 16px; background: url(/icon.svg) center / cover no-repeat; box-shadow: var(--shadow-sm); }
.install-steps { list-style: none; padding: 0; margin: 8px 0 4px; display: grid; gap: 12px; }
.install-step { display: flex; gap: 12px; align-items: flex-start; animation: fade-up var(--med) var(--ease) backwards; }
.install-step:nth-child(2) { animation-delay: 60ms; }
.install-step:nth-child(3) { animation-delay: 120ms; }
.install-num { flex: none; width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; background: var(--brand-sky); color: var(--primary); font-weight: 700; font-size: 13px; box-shadow: 0 0 0 1px var(--accent-line); }
.install-tip { background: var(--warn-soft); border: 1px solid var(--warn-line); border-radius: var(--radius); padding: 10px 12px; margin-top: 12px; }

/* ---------- кілька об'єктів за день (працівник) ---------- */
.segs { display: grid; gap: 10px; }
.seg { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 10px; box-shadow: var(--shadow-sm); animation: fade-up var(--med) var(--ease) backwards; }
.seg .stepper { border: 0; box-shadow: none; padding: 6px 0 0; background: transparent; }
.seg .stepper.compact .step { width: 52px; height: 52px; }
.seg .stepper.compact .hours-big { font-size: 38px; }
.seg-head { display: flex; gap: 8px; align-items: center; }
.obj-btn {
  flex: 1; display: flex; align-items: center; gap: 8px; min-height: 48px; padding: 0 14px; text-align: left;
  border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface-2); cursor: pointer;
  font-size: 16px; font-weight: 600; color: var(--text); transition: border-color var(--fast), background var(--fast), transform var(--fast) var(--ease);
}
.obj-btn:hover { border-color: var(--line-strong); }
.obj-btn:active { transform: scale(.985); }
.obj-btn.empty { color: var(--accent); border-style: dashed; border-color: var(--accent-line); background: var(--accent-soft); }
.obj-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.obj-chev { color: var(--muted); font-size: 12px; }
.seg-remove { width: 40px; height: 40px; flex: none; border: 1px solid var(--line); border-radius: 50%; background: var(--surface); color: var(--muted); font-size: 20px; cursor: pointer; transition: background var(--fast), color var(--fast); }
.seg-remove:hover { background: var(--danger-soft); color: var(--danger); }
.quick.six { grid-template-columns: repeat(6, 1fr); }
.quick.six .chip { height: 40px; font-size: 15px; }
.add-seg {
  width: 100%; margin-top: 10px; height: 48px; border: 1px dashed var(--line-strong); border-radius: var(--radius);
  background: transparent; color: var(--text-2); font-size: 15px; font-weight: 600; cursor: pointer;
  transition: background var(--fast), border-color var(--fast), color var(--fast);
}
.add-seg:hover { background: var(--surface); border-color: var(--accent); color: var(--accent); }
.day-total { display: flex; justify-content: space-between; align-items: baseline; margin-top: 12px; padding: 12px 14px; border-radius: var(--radius); background: var(--accent-soft); border: 1px solid var(--accent-line); color: #1d4560; }
.day-total b { font-size: 20px; font-variant-numeric: tabular-nums; }
.day-total.bad { background: var(--danger-soft); border-color: #fecaca; color: #991b1b; }
.hint.warn { color: #92400e; background: var(--warn-soft); border: 1px solid var(--warn-line); border-radius: var(--radius); padding: 8px 12px; margin-top: 10px; }
.my-row > div { min-width: 0; }
.my-row .small { margin-top: 2px; }

/* вибір об'єкта */
.dialog.sheet { padding-bottom: 14px; }
.obj-list { display: grid; gap: 6px; max-height: 58vh; overflow: auto; margin: 10px -4px 0; padding: 0 4px; }
.obj-group { font-size: 11.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin: 8px 2px 2px; }
.obj-item { text-align: left; padding: 13px 14px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); font-size: 15px; font-weight: 550; cursor: pointer; transition: border-color var(--fast), background var(--fast); }
.obj-item:hover { border-color: var(--line-strong); background: var(--surface-2); }
.obj-item.on { border-color: var(--accent); background: var(--accent-soft); color: #1d4560; }
.obj-item.other { border-style: dashed; color: var(--text-2); }

/* ---------- розбивка у вікні адміна ---------- */
.segs-admin { display: grid; gap: 8px; margin: 10px 0; }
.seg-row { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.seg-row select { flex: 1 1 180px; }
.seg-row .input:not(select):not(.hrs-input) { flex: 1 1 140px; }
.hrs-input { width: 76px; text-align: center; }
.tabel td.cell.split::after { content: ""; position: absolute; left: 8px; right: 8px; bottom: 4px; height: 3px; border-top: 1px solid var(--accent); border-bottom: 1px solid var(--accent); pointer-events: none; }
.tabel td.cell.split .cell-input { cursor: pointer; }
.task-input.split { cursor: pointer; color: #1d4560; background: var(--accent-soft); }

/* ---------- звіт по об'єктах ---------- */
.table-wrap.flat { box-shadow: none; }
.report .obj-row { cursor: pointer; }
.report .obj-row.none b { font-weight: 500; color: var(--muted); }
.report .chev { display: inline-block; color: var(--muted); transition: transform var(--fast) var(--ease); }
.report .chev.open { transform: rotate(90deg); }
.report .obj-sub td { background: var(--surface-2); font-size: 13.5px; padding-top: 6px; padding-bottom: 6px; }
.report .obj-sub td:first-child { padding-left: 34px; }
.report tfoot td { font-weight: 700; border-top: 1px solid var(--line); background: var(--surface-2); }
.bar-cell { width: 40%; }
.bar { height: 8px; border-radius: 99px; background: #eef2f5; overflow: hidden; }
.bar span { display: block; height: 100%; width: 0; border-radius: 99px; background: linear-gradient(90deg, #5b8fb0, var(--accent)); }
@media (max-width: 600px) { .bar-cell { display: none; } }
.worker > .add-seg { width: calc(100% - 32px); }

/* ---------- «Що робили» ---------- */
.work { margin-top: 10px; display: grid; gap: 8px; }
.kinds { display: flex; flex-wrap: wrap; gap: 6px; }
.kinds::-webkit-scrollbar { display: none; }
.kind {
  flex: none; height: 32px; padding: 0 12px; border-radius: 99px; border: 1px solid var(--line); background: var(--surface);
  font-size: 13.5px; font-weight: 550; color: var(--text-2); cursor: pointer;
  transition: background var(--fast), border-color var(--fast), color var(--fast), transform var(--fast) var(--ease);
}
.kind:active { transform: scale(.95); }
.kind.on { background: var(--accent); border-color: var(--accent); color: #fff; }
.work-input { width: 100%; height: 46px; font-size: 16px; border-radius: var(--radius); }
.work-input.need { border-color: #e9c46a; background: #fffdf5; }
.work-input.need::placeholder { color: #9a7b2f; }
.sugg { display: flex; flex-wrap: wrap; gap: 6px; }
.sugg-chip {
  height: 30px; padding: 0 10px; border-radius: 8px; border: 1px dashed var(--line-strong); background: transparent;
  font-size: 13px; color: var(--text-2); cursor: pointer; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  transition: background var(--fast), border-color var(--fast), color var(--fast);
}
.sugg-chip:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }
.seg-row .kind-select { flex: 0 1 150px; }
.seg-row .work-admin { flex: 1 1 140px; }
