[hidden] { display: none !important; }
:root {
  /* ГК «Нива»: темно-синій фон, сланцеві лінії, бірюзовий акцент (з фонового візерунка) */
  color-scheme: dark;
  --bg: #0f1923;
  --card: rgba(31, 49, 65, 0.92);
  --card-solid: #1f3141;
  --text: #e6edf2;
  --muted: #8fa3b1;
  --slate: #465d6d;
  --accent: #4fb3a9;
  --accent-text: #0f1c26;
  --accent-soft: rgba(79, 179, 169, 0.14);
  --line: rgba(143, 163, 177, 0.18);
  --ok: #5cc28f;
  --bad: #e5736b;
  --warn: #e0b45a;
  --radius: 12px;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  min-height: 100vh;
  /* the garage pattern, dimmed so it stays in the background */
  background:
    linear-gradient(rgba(12, 20, 28, 0.72), rgba(12, 20, 28, 0.72)) fixed,
    var(--bg) url("bg.webp") repeat fixed;
  background-size: auto, 600px 600px;
  color: var(--text);
  font: 15px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  padding-bottom: env(safe-area-inset-bottom);
}
.top {
  background: rgba(15, 25, 35, 0.92); backdrop-filter: blur(6px);
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 16px; border-bottom: 1px solid var(--line);
}
.brand { font-weight: 700; letter-spacing: 0.01em; color: var(--accent); }
.who { color: var(--muted); font-size: 13px; text-align: right; }
main { max-width: 900px; margin: 0 auto; padding: 0 16px 40px; }
.tabs {
  display: flex; gap: 4px; overflow-x: auto; padding: 12px 0; position: sticky; top: 0;
  background: linear-gradient(var(--bg) 75%, rgba(15, 25, 35, 0)); z-index: 2; scrollbar-width: none;
}
.tabs button, .seg button {
  border: 0; background: transparent; color: var(--muted); padding: 8px 12px;
  border-radius: 999px; font: inherit; white-space: nowrap; cursor: pointer;
}
.tabs button.active, .seg button.active { background: var(--accent-soft); color: var(--accent); font-weight: 600; box-shadow: 0 0 0 1px var(--line); }
.badge:empty { display: none; }
.badge { background: var(--bad); color: #fff; border-radius: 999px; padding: 0 7px; font-size: 12px; margin-left: 4px; }
.seg { display: flex; gap: 4px; margin: 8px 0 12px; }
.bar { display: flex; gap: 8px; margin-bottom: 12px; flex-wrap: wrap; }
.bar input { flex: 1 1 220px; }
input, select, textarea {
  font: inherit; color: var(--text); background: rgba(15, 28, 38, 0.7); border: 1px solid var(--line);
  border-radius: 10px; padding: 9px 11px; width: 100%;
}
textarea { min-height: 140px; font-family: ui-monospace, monospace; font-size: 13px; }
button { font: inherit; cursor: pointer; }
.bar > button, .actions button, form button[type=submit], #role-new {
  border: 0; border-radius: 10px; padding: 9px 14px; background: var(--accent); color: var(--accent-text); font-weight: 600;
}
a { color: var(--accent); }
.card h3 a { color: inherit; text-decoration: none; }
button.ghost { border: 0; border-radius: 10px; padding: 9px 14px; font-weight: 600; }
button.ghost { background: transparent !important; color: var(--accent) !important; box-shadow: inset 0 0 0 1px var(--line); }
button.danger { background: var(--bad) !important; color: #fff !important; }
button.small { padding: 5px 10px !important; font-size: 13px; }
button:disabled { opacity: 0.5; cursor: default; }
.list { display: grid; gap: 8px; }
.card {
  background: var(--card); border-radius: var(--radius); padding: 12px 14px; box-shadow: 0 0 0 1px var(--line);
}
.card.click { cursor: pointer; }
.card h3 { margin: 0 0 4px; font-size: 15px; }
.row { display: flex; justify-content: space-between; gap: 12px; align-items: baseline; }
.muted { color: var(--muted); font-size: 13px; }
.mono { font-family: ui-monospace, monospace; }
.tag { display: inline-block; font-size: 12px; border-radius: 6px; padding: 1px 7px; background: var(--line); margin-right: 4px; }
.tag.ok { background: rgba(92, 194, 143, 0.15); color: var(--ok); }
.tag.bad { background: rgba(229, 115, 107, 0.15); color: var(--bad); }
.tag.warn { background: rgba(224, 180, 90, 0.15); color: var(--warn); }
.warnbox { margin-top: 8px; padding: 8px 10px; border-radius: 10px; background: rgba(224, 180, 90, 0.1); color: var(--warn); font-size: 13px; }
.actions { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-bottom: 4px; }
.stat { background: var(--card); border-radius: var(--radius); padding: 10px 12px; box-shadow: 0 0 0 1px var(--line); }
.stat b { display: block; font-size: 20px; }
.stat span { color: var(--muted); font-size: 12px; }
@media (max-width: 520px) { .stats { grid-template-columns: repeat(2, 1fr); } }
.empty { color: var(--muted); text-align: center; padding: 30px 0; }
.login { max-width: 420px; margin: 12vh auto; padding: 28px 22px; text-align: center; background: var(--card); border-radius: 18px; box-shadow: 0 0 0 1px var(--line), 0 20px 50px rgba(0, 0, 0, 0.35); }
@media (max-width: 460px) { .login { margin: 8vh 16px; } }
dialog {
  border: 1px solid var(--line); border-radius: 16px; padding: 0; width: min(560px, calc(100vw - 24px)); max-height: 88vh;
  background: var(--card-solid); color: var(--text); box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
}
dialog::backdrop { background: rgba(8, 14, 20, 0.65); }
.modal-head { display: flex; justify-content: space-between; align-items: center; padding: 14px 16px 6px; position: sticky; top: 0; background: var(--card-solid); }
.modal-head h2 { margin: 0; font-size: 17px; }
.x { border: 0; background: transparent; color: var(--muted); font-size: 24px; line-height: 1; }
#modal-body { padding: 4px 16px 18px; }
form { display: grid; gap: 10px; }
label { display: grid; gap: 4px; font-size: 13px; color: var(--muted); }
label.check { display: flex; align-items: center; gap: 8px; color: var(--text); font-size: 14px; }
label.check input { width: auto; }
.section-title { margin: 16px 0 6px; font-size: 13px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); }
.doc { max-width: 100%; border-radius: 10px; margin-top: 8px; }
.toast {
  position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); background: var(--accent); color: var(--accent-text);
  padding: 10px 16px; border-radius: 10px; font-size: 14px; z-index: 10; max-width: calc(100vw - 32px);
}

.login .big { border: 0; border-radius: 12px; padding: 13px 22px; background: var(--accent); color: var(--accent-text); font-weight: 600; font-size: 16px; }
.login .wait { margin-top: 18px; }
.login .code { font: 700 34px/1 ui-monospace, monospace; letter-spacing: 0.25em; margin: 6px 0 12px; }
.login .qr { display: inline-block; padding: 10px; background: #fff; border-radius: 12px; margin-top: 8px; }
.login .qr svg { display: block; width: 160px; height: 160px; }
.login .alt { margin-top: 28px; color: var(--muted); font-size: 14px; }
.login .alt summary { cursor: pointer; }
.login .alt #widget { margin-top: 10px; }
.emoji-pick { display: flex; flex-wrap: wrap; gap: 6px; }
.emoji-pick button { border: 1px solid var(--line); background: transparent; border-radius: 10px; font-size: 20px; width: 42px; height: 42px; }
.emoji-pick button.on { border-color: var(--accent); background: var(--accent-soft); }

.tablewrap { overflow-x: auto; background: var(--card); border-radius: var(--radius); box-shadow: 0 0 0 1px var(--line); margin-top: 10px; }
table.grid { width: 100%; border-collapse: collapse; font-size: 14px; }
table.grid th, table.grid td { padding: 7px 10px; border-bottom: 1px solid var(--line); text-align: left; white-space: nowrap; }
table.grid th { color: var(--muted); font-weight: 500; font-size: 12px; position: sticky; top: 0; background: var(--card-solid); }
table.grid td.num, table.grid th.num { text-align: right; font-variant-numeric: tabular-nums; }
table.grid input { width: 110px; padding: 5px 8px; text-align: right; }
table.grid tr.warn td { background: rgba(224, 180, 90, 0.08); }
table.grid tr.total td { font-weight: 600; }
.bars { display: grid; gap: 6px; }
.bar-row { display: grid; grid-template-columns: 120px 1fr 56px; gap: 8px; align-items: center; font-size: 13px; }
.bar-track { height: 10px; background: var(--line); border-radius: 6px; overflow: hidden; }
.bar-fill { height: 100%; background: var(--accent); border-radius: 6px; }
.bar-fill.warn { background: var(--warn); }
.formrow { display: flex; gap: 8px; flex-wrap: wrap; align-items: end; }
.formrow label { flex: 1 1 140px; }
.report { margin-top: 10px; }
.report li { margin: 3px 0; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 10px; }
.chips button { border: 1px solid var(--line); background: transparent; color: var(--text); border-radius: 999px; padding: 6px 12px; font-size: 14px; }
.chips button.on { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); }
.chips button .n { color: var(--muted); margin-left: 4px; }
.bar.filters select { flex: 0 1 230px; }
.bar.filters .check { flex: 0 0 auto; }
.kindline { font-size: 13px; color: var(--muted); margin-bottom: 4px; }
.bar.filters select { flex: 1 1 200px; }
.bar.filters .check { white-space: nowrap; font-size: 13px; }
.bar.filters .check input { flex: 0 0 auto; width: auto; }
@media (max-width: 520px) { .bar.filters select { flex: 1 1 45%; } }
.brand-sub { color: var(--muted); font-weight: 500; font-size: 13px; margin-left: 6px; }
.foot { text-align: center; padding: 18px 0 26px; font-size: 12px; }
.foot a { color: var(--muted); text-decoration: none; }
.update-bar { position: fixed; top: 0; left: 0; right: 0; z-index: 20; background: var(--accent); color: var(--accent-text); text-align: center; padding: 8px 12px; font-size: 14px; }
.update-bar a { color: inherit; font-weight: 700; }
.version h3 { margin: 0 0 6px; }
.version ul { margin: 0; padding-left: 18px; }
.version li { margin: 4px 0; }
.checklist { margin-bottom: 10px; }
.check-item { display: flex; justify-content: space-between; gap: 10px; padding: 5px 0; border-bottom: 1px dashed var(--line); flex-wrap: wrap; }
.check-item:last-of-type { border-bottom: 0; }
.check-item.done > span:first-child { color: var(--muted); }
.btnlink { display: inline-block; border-radius: 10px; padding: 9px 14px; background: var(--accent); color: var(--accent-text); font-weight: 600; text-decoration: none; }
#sh-link { flex: 1 1 260px; }
.vt.off { opacity: 0.55; }
button.primary { border: 0; border-radius: 10px; padding: 9px 14px; background: var(--accent); color: var(--accent-text); font-weight: 600; }
button.primary.small { padding: 7px 12px !important; }
.thread { margin-top: 8px; display: flex; flex-direction: column; gap: 6px; }
.thread .msg { padding: 8px 10px; border-radius: 10px; background: rgba(255,255,255,.05); border-left: 3px solid var(--accent, #e3b341); }
.thread .msg.person { border-left-color: #3fb950; }
.doclist .muted { margin: 4px 0; }
.thread .msg.staff { border-left-color: #58a6ff; }
.thread .msg.bot { border-left-color: #8fa3b1; opacity: .85; }
.card.overdue { box-shadow: inset 3px 0 0 #f85149; }
textarea.plain, #news-form textarea, [data-apanswer] textarea { min-height: 70px; font-family: inherit; font-size: 15px; width: 100%; box-sizing: border-box; }
button.hold { position: relative; overflow: hidden; user-select: none; -webkit-user-select: none; touch-action: none;
  background-image: linear-gradient(90deg, rgba(255,255,255,.5) var(--hold, 0%), transparent var(--hold, 0%)); }
button.hold.holding { transform: scale(.98); }
.danger-text { color: #f85149 !important; }

/* ---- 1.18 UX: sections, sub-screens, no sideways scrolling on phones ---- */
.tabs { justify-content: flex-start; }
.seg { overflow-x: auto; flex-wrap: nowrap; scrollbar-width: none; -webkit-overflow-scrolling: touch; max-width: 100%; }
.seg::-webkit-scrollbar, .tabs::-webkit-scrollbar { display: none; }
.subtabs { margin: 0 0 10px; padding-bottom: 2px; border-bottom: 1px solid var(--line); border-radius: 0; }
.subtabs button { font-size: 14px; padding: 6px 11px; }
main, .tab { min-width: 0; }
.tablewrap { overflow-x: auto; max-width: 100%; }
body.loading::before { content: ""; position: fixed; top: 0; left: 0; height: 3px; width: 40%; background: var(--accent);
  z-index: 50; animation: load 1s ease-in-out infinite; }
@keyframes load { 0% { left: -40%; } 100% { left: 100%; } }
input[type=file] { padding: 6px; }
input[type=file]::file-selector-button { font: inherit; border: 0; border-radius: 8px; padding: 6px 12px; margin-right: 10px;
  background: var(--accent-soft); color: var(--accent); font-weight: 600; cursor: pointer; }
.toast.error { background: #5b2421; border-color: var(--bad); }
.danger-zone { margin-top: 18px; padding-top: 12px; border-top: 1px dashed rgba(229, 115, 107, .45); }
.cards-m { display: none; }
@media (max-width: 600px) {
  .cards-m { display: block; }
  .table-d { display: none; }
  .tabs button { padding: 8px 10px; }
}
.mcard { display: grid; grid-template-columns: 1fr auto; gap: 2px 10px; padding: 10px 12px; border-bottom: 1px solid var(--line); }
.mcard .big { font-weight: 700; text-align: right; }
.pager { display: flex; gap: 8px; align-items: center; justify-content: center; margin: 10px 0; }
dialog.prompt { padding: 16px; width: min(460px, calc(100vw - 32px)); }
dialog.prompt textarea { min-height: 80px; }
.period-bar { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; margin: 0 0 12px; }
.period-bar input { flex: 0 1 170px; width: auto; }
.period-bar button.active { background: var(--accent-soft); color: var(--accent); }
.lock-banner { position: fixed; inset: 0; z-index: 100; background: rgba(8, 14, 20, .78); display: flex; align-items: center;
  justify-content: center; padding: 16px; backdrop-filter: blur(2px); }
.lock-box { background: var(--card-solid); border: 1px solid var(--warn); border-radius: 14px; padding: 22px; max-width: 420px;
  text-align: center; font-size: 16px; display: grid; gap: 10px; }
.lock-icon { font-size: 40px; }
.work-month { font-size: 12px; color: var(--accent); margin-top: 2px; }
.ok-note { margin-top: 8px; color: var(--ok); }

/* readable for everyone (many of our people are 60+): bigger text, bigger touch targets */
body { font-size: 17px; line-height: 1.5; }
.muted, .who, .warnbox { font-size: 15px; }
.tag { font-size: 14px; }
.badge { font-size: 13px; }
button.small { font-size: 15px; padding: 7px 12px !important; }
.card h3 { font-size: 17px; }
input, select, button { font-size: 16px; min-height: 40px; }
textarea { font-size: 15px; }
td, th { font-size: 15px; }
/* filters: one look everywhere; on a phone they wrap instead of hiding off-screen */
.seg:not(.subtabs) { flex-wrap: wrap; overflow: visible; gap: 6px; }
.seg:not(.subtabs) button { border: 1px solid var(--line); }
.fund-bar { height: 10px; border-radius: 999px; background: var(--line); overflow: hidden; margin: 6px 0; }
.fund-bar span { display: block; height: 100%; background: var(--accent); border-radius: 999px; }
/* phones: the sections and the screens wrap into rows instead of running off the screen */
.tabs { flex-wrap: wrap; overflow: visible; row-gap: 6px; }
.subtabs { flex-wrap: wrap !important; overflow: visible !important; row-gap: 4px; }
@media (max-width: 600px) {
  .tabs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
  .tabs button { padding: 9px 6px; text-align: center; white-space: normal; line-height: 1.2; box-shadow: 0 0 0 1px var(--line); }
  .tabs button[hidden] { display: none !important; }
}
.legend { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 14px; color: var(--muted); margin-bottom: 6px; }
.legend i { display: inline-block; width: 12px; height: 12px; border-radius: 3px; margin-right: 6px; vertical-align: middle; }
.nv { height: 1.15em; width: 1.15em; vertical-align: -0.22em; display: inline-block; }
@media (max-width: 600px) { .tabs { position: static; background: none; } }
