:root {
  --bg: #f3f5f8;
  --panel: #ffffff;
  --text: #1c2430;
  --muted: #5f6b7a;
  --line: #dde3ea;
  --line-strong: #c5cdd8;
  --brand: #1f3a5f;
  --brand-2: #2c5282;
  --accent: #2563eb;
  --accent-soft: #e8f0fe;
  --danger: #c62828;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 1px 3px rgba(16, 24, 40, .08);
  --side: 232px;

  /* статусы: фон / текст */
  --c-red-bg: #fde8e8;   --c-red: #b42318;
  --c-orange-bg: #fff1e0; --c-orange: #b54708;
  --c-yellow-bg: #fef7d6; --c-yellow: #8a6100;
  --c-green-bg: #e3f6e9; --c-green: #1d7a3e;
  --c-blue-bg: #e6effd;  --c-blue: #1d4ed8;
  --c-violet-bg: #f0e9fd; --c-violet: #6d28d9;
  --c-gray-bg: #eef1f4;  --c-gray: #4b5563;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 15px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { margin: 0 0 .5em; line-height: 1.25; }
h1 { font-size: 1.45rem; }
h2 { font-size: 1.15rem; }
h3 { font-size: 1rem; }
p { margin: .4em 0; }
small, .muted { color: var(--muted); }
.nowrap { white-space: nowrap; }
.hidden { display: none !important; }
hr { border: 0; border-top: 1px solid var(--line); margin: 16px 0; }

/* ---------- Каркас ---------- */
.layout { display: flex; min-height: 100vh; }
.sidebar {
  width: var(--side); background: var(--brand); color: #fff; flex: 0 0 var(--side);
  position: sticky; top: 0; height: 100vh; overflow-y: auto; display: flex; flex-direction: column;
}
.sidebar .logo { padding: 18px 18px 12px; font-weight: 700; font-size: 1.05rem; display: flex; gap: 10px; align-items: center; }
.sidebar .logo svg { flex: none; }
.sidebar nav a {
  display: flex; align-items: center; gap: 10px; color: #dbe5f2; padding: 10px 18px; font-size: .95rem; text-decoration: none;
  border-left: 3px solid transparent;
}
.sidebar nav a:hover { background: rgba(255, 255, 255, .07); color: #fff; }
.sidebar nav a.active { background: rgba(255, 255, 255, .12); color: #fff; border-left-color: #8ab4f8; font-weight: 600; }
.sidebar nav a .count { margin-left: auto; background: #e53935; color: #fff; border-radius: 10px; font-size: .75rem; padding: 0 7px; font-weight: 700; }
.sidebar .user { margin-top: auto; padding: 14px 18px; border-top: 1px solid rgba(255, 255, 255, .12); font-size: .88rem; }
.sidebar .user b { display: block; color: #fff; }
.sidebar .user span { color: #aac0dc; }
.sidebar .user .links { margin-top: 8px; display: flex; gap: 14px; }
.sidebar .user .links a { color: #cfe0f5; font-size: .85rem; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  display: none; position: sticky; top: 0; z-index: 30; background: var(--brand); color: #fff;
  padding: 10px 14px; align-items: center; gap: 10px; padding-top: calc(10px + env(safe-area-inset-top));
}
.topbar .title { font-weight: 600; flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar button { background: none; border: 0; color: #fff; padding: 6px; cursor: pointer; position: relative; }
.topbar .dot { position: absolute; top: 2px; right: 0; background: #e53935; color: #fff; border-radius: 9px; font-size: .7rem; padding: 0 5px; font-weight: 700; }
.searchbar { padding: 14px 24px 0; display: flex; gap: 10px; align-items: center; }
.searchbar .search { position: relative; flex: 1; max-width: 520px; }
.search input { width: 100%; padding-left: 36px; }
.search svg { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: var(--muted); }
.search-results {
  position: absolute; left: 0; right: 0; top: calc(100% + 4px); background: #fff; border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: 0 8px 24px rgba(0, 0, 0, .12); z-index: 40; max-height: 70vh; overflow-y: auto;
}
.search-results .grp { padding: 6px 12px; font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); background: #f8fafc; }
.search-results a { display: block; padding: 8px 12px; color: var(--text); border-top: 1px solid #f0f2f5; }
.search-results a:hover { background: var(--accent-soft); text-decoration: none; }
.content { padding: 18px 24px 60px; max-width: 1280px; width: 100%; }
.backdrop { display: none; }

@media (max-width: 900px) {
  .sidebar { position: fixed; left: 0; top: 0; bottom: 0; z-index: 50; transform: translateX(-100%); transition: transform .2s; height: 100%; }
  .layout.menu-open .sidebar { transform: none; }
  .layout.menu-open .backdrop { display: block; position: fixed; inset: 0; background: rgba(0, 0, 0, .35); z-index: 45; }
  .topbar { display: flex; }
  .content { padding: 14px 16px 80px; }
  .searchbar { padding: 12px 16px 0; }
}

/* ---------- Элементы ---------- */
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.page-head h1 { margin: 0; }
.page-head .sub { color: var(--muted); margin-top: 4px; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }

.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px; margin-bottom: 16px; }
.card > h2:first-child, .card > h3:first-child, .card > .card-head:first-child { margin-top: 0; }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; }
.card-head h2, .card-head h3 { margin: 0; }
.card.attention { border-left: 4px solid #f59e0b; }
.card.danger { border-left: 4px solid var(--danger); }
.card.ok { border-left: 4px solid #22a05a; }

.grid { display: grid; gap: 16px; }
.grid.two { grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); }
.grid.three { grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
@media (max-width: 420px) { .grid.two, .grid.three { grid-template-columns: 1fr; } }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; border: 1px solid var(--line-strong); background: #fff; color: var(--text);
  padding: 8px 14px; border-radius: 8px; font: inherit; font-weight: 500; cursor: pointer; text-decoration: none; min-height: 38px; line-height: 1.2;
}
.btn:hover { background: #f5f7fa; text-decoration: none; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { background: #1d4ed8; }
.btn.success { background: #1d7a3e; border-color: #1d7a3e; color: #fff; }
.btn.success:hover { background: #17642f; }
.btn.danger { background: #fff; border-color: #f1b4b4; color: var(--danger); }
.btn.danger:hover { background: #fdf0f0; }
.btn.warn { background: #fff; border-color: #f3c98b; color: #9a5b00; }
.btn.small { padding: 4px 10px; min-height: 30px; font-size: .88rem; }
.btn.big { padding: 12px 20px; font-size: 1.02rem; min-height: 46px; }
.btn.link { border: 0; background: none; color: var(--accent); padding: 4px; min-height: 0; }

input, select, textarea {
  font: inherit; color: var(--text); background: #fff; border: 1px solid var(--line-strong); border-radius: 8px; padding: 8px 10px; min-height: 38px; max-width: 100%;
}
textarea { width: 100%; min-height: 70px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid #93b4f5; outline-offset: 0; border-color: var(--accent); }
@media (max-width: 900px) { input, select, textarea { font-size: 16px; } }
label.field { display: block; margin-bottom: 12px; }
label.field > span { display: block; font-size: .86rem; color: var(--muted); margin-bottom: 4px; font-weight: 500; }
label.field input:not([type=checkbox]):not([type=radio]), label.field select, label.field textarea { width: 100%; }
.req::after { content: " *"; color: var(--danger); }
.check { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; margin: 4px 14px 4px 0; }
.check input { width: 18px; height: 18px; min-height: 0; }
.form-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 0 12px; }

.filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: flex-end; margin-bottom: 14px; }
.filters label { display: flex; flex-direction: column; font-size: .8rem; color: var(--muted); gap: 3px; }
.filters select, .filters input { min-width: 130px; }
@media (max-width: 600px) {
  .filters label { flex: 1 1 calc(50% - 8px); }
  .filters select, .filters input { min-width: 0; width: 100%; }
}

/* ---------- Бейджи (текст + цвет) ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 4px; padding: 2px 9px; border-radius: 999px; font-size: .8rem; font-weight: 600; white-space: nowrap;
  background: var(--c-gray-bg); color: var(--c-gray); border: 1px solid transparent; line-height: 1.5;
}
.badge::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; opacity: .85; }
.badge.nodot::before { display: none; }
.b-red { background: var(--c-red-bg); color: var(--c-red); }
.b-orange { background: var(--c-orange-bg); color: var(--c-orange); }
.b-yellow { background: var(--c-yellow-bg); color: var(--c-yellow); }
.b-green { background: var(--c-green-bg); color: var(--c-green); }
.b-blue { background: var(--c-blue-bg); color: var(--c-blue); }
.b-violet { background: var(--c-violet-bg); color: var(--c-violet); }
.b-gray { background: var(--c-gray-bg); color: var(--c-gray); }
.b-solid-red { background: #c62828; color: #fff; }
.b-solid-red::before { background: #fff; }
.badges { display: inline-flex; flex-wrap: wrap; gap: 5px; align-items: center; }

/* ---------- Показатели ---------- */
.kpis { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px; margin-bottom: 16px; }
.kpi {
  display: block; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; color: var(--text); box-shadow: var(--shadow);
  border-top: 4px solid var(--line-strong); transition: transform .08s, box-shadow .08s;
}
.kpi:hover { text-decoration: none; transform: translateY(-1px); box-shadow: 0 4px 12px rgba(0, 0, 0, .08); }
.kpi .v { font-size: 1.8rem; font-weight: 700; line-height: 1.1; }
.kpi .l { color: var(--muted); font-size: .86rem; margin-top: 2px; }
.kpi.red { border-top-color: #d92d20; } .kpi.red .v { color: #b42318; }
.kpi.orange { border-top-color: #f79009; } .kpi.orange .v { color: #b54708; }
.kpi.violet { border-top-color: #7c3aed; } .kpi.violet .v { color: #6d28d9; }
.kpi.blue { border-top-color: #2563eb; } .kpi.blue .v { color: #1d4ed8; }
.kpi.green { border-top-color: #22a05a; } .kpi.green .v { color: #1d7a3e; }
.kpi.zero .v { color: var(--muted); }

/* ---------- Таблицы (на телефоне превращаются в карточки) ---------- */
.table-wrap { overflow-x: auto; }
table.t { width: 100%; border-collapse: collapse; font-size: .93rem; }
table.t th { text-align: left; font-weight: 600; color: var(--muted); font-size: .8rem; text-transform: uppercase; letter-spacing: .03em; padding: 8px 10px; border-bottom: 2px solid var(--line); white-space: nowrap; }
table.t td { padding: 9px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
table.t tr.clickable { cursor: pointer; }
table.t tr.clickable:hover td { background: #f7f9fc; }
table.t td.num, table.t th.num { text-align: right; }
table.t a.n { font-weight: 700; display: inline-block; min-width: 24px; text-align: right; }
table.t .zero { color: #b8c0cc; }
@media (max-width: 700px) {
  table.t.stack thead { display: none; }
  table.t.stack tr { display: block; border: 1px solid var(--line); border-radius: 8px; margin-bottom: 10px; padding: 6px 10px; background: #fff; }
  table.t.stack td { display: flex; justify-content: space-between; gap: 12px; border: 0; padding: 5px 0; text-align: right; }
  table.t.stack td::before { content: attr(data-label); color: var(--muted); font-size: .82rem; text-align: left; flex: none; }
  table.t.stack td.title-cell { display: block; text-align: left; font-weight: 600; }
  table.t.stack td.title-cell::before { display: none; }
}

/* ---------- Списки замечаний ---------- */
.flist { display: flex; flex-direction: column; gap: 8px; }
.fitem {
  display: block; border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; color: var(--text); background: #fff;
  border-left: 4px solid var(--line-strong);
}
a.fitem:hover { text-decoration: none; background: #f9fbfe; }
.fitem.sev-critical { border-left-color: #d92d20; }
.fitem.sev-high { border-left-color: #f79009; }
.fitem.sev-medium { border-left-color: #eab308; }
.fitem.sev-low { border-left-color: #94a3b8; }
.fitem .top { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.fitem .num { font-weight: 700; }
.fitem .desc { margin: 4px 0; }
.fitem .meta { color: var(--muted); font-size: .85rem; display: flex; flex-wrap: wrap; gap: 4px 14px; }
.fitem .meta b { color: var(--text); font-weight: 600; }
.empty { color: var(--muted); padding: 14px; text-align: center; border: 1px dashed var(--line-strong); border-radius: 8px; }

/* ---------- Карточка замечания / сведения ---------- */
.info { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 10px 20px; }
.info > div > span { display: block; font-size: .8rem; color: var(--muted); }
.info > div > b { font-weight: 600; }
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { position: relative; padding: 0 0 14px 22px; }
.timeline li::before { content: ""; position: absolute; left: 6px; top: 7px; width: 9px; height: 9px; border-radius: 50%; background: var(--line-strong); }
.timeline li::after { content: ""; position: absolute; left: 10px; top: 18px; bottom: 0; width: 1px; background: var(--line); }
.timeline li:last-child::after { display: none; }
.timeline li.k-submit::before { background: #7c3aed; }
.timeline li.k-approve::before { background: #22a05a; }
.timeline li.k-reject::before, .timeline li.k-reopen::before { background: #d92d20; }
.timeline li.k-check::before { background: #2563eb; }
.timeline .when { font-size: .8rem; color: var(--muted); }
.discrepancy { display: grid; grid-template-columns: auto repeat(3, minmax(70px, 1fr)); gap: 4px 12px; background: #fafbfc; border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; font-size: .92rem; }
.discrepancy .h { font-size: .78rem; color: var(--muted); }
.discrepancy .neg { color: var(--c-red); font-weight: 700; }
.discrepancy .pos { color: var(--c-orange); font-weight: 700; }

/* ---------- Ревизия ---------- */
.steps { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 14px; }
.steps a { padding: 6px 12px; border-radius: 999px; background: #fff; border: 1px solid var(--line); color: var(--text); font-size: .88rem; }
.steps a.done { background: var(--c-green-bg); border-color: #b7e4c7; color: var(--c-green); }
.steps a.todo { background: var(--c-orange-bg); border-color: #fad7a8; color: var(--c-orange); }
.progress { height: 8px; background: #e6eaf0; border-radius: 4px; overflow: hidden; }
.progress > div { height: 100%; background: #22a05a; }
.section-title { font-weight: 700; margin: 18px 0 8px; font-size: 1rem; color: var(--brand-2); display: flex; justify-content: space-between; }
.item { border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; margin-bottom: 8px; background: #fff; }
.item.r-issue { border-left: 4px solid #d92d20; }
.item.r-ok { border-left: 4px solid #22a05a; }
.item.r-not_checked { border-left: 4px solid #eab308; }
.item.r-na { border-left: 4px solid #94a3b8; }
.item.r-none { border-left: 4px solid #e2e8f0; background: #fffdf7; }
.item .text { font-weight: 500; margin-bottom: 8px; }
.seg { display: flex; flex-wrap: wrap; gap: 6px; }
.seg button {
  border: 1px solid var(--line-strong); background: #fff; border-radius: 8px; padding: 7px 12px; font: inherit; font-size: .9rem; cursor: pointer; min-height: 38px;
}
.seg button:hover { background: #f5f7fa; }
.seg button.on.v-ok, .seg button.on.v-fixed { background: var(--c-green-bg); border-color: #22a05a; color: var(--c-green); font-weight: 700; }
.seg button.on.v-issue, .seg button.on.v-not_fixed { background: var(--c-red-bg); border-color: #d92d20; color: var(--c-red); font-weight: 700; }
.seg button.on.v-not_checked, .seg button.on.v-partial { background: var(--c-yellow-bg); border-color: #eab308; color: var(--c-yellow); font-weight: 700; }
.seg button.on.v-na { background: var(--c-gray-bg); border-color: #94a3b8; color: var(--c-gray); font-weight: 700; }
.seg button:disabled { cursor: default; }
@media (max-width: 600px) { .seg button { flex: 1 1 calc(50% - 6px); } }
.item .extra { margin-top: 8px; display: grid; gap: 8px; }
.itemfields { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 8px; background: #f8fafc; padding: 10px; border-radius: 8px; border: 1px dashed var(--line-strong); }
.itemfields label { font-size: .8rem; color: var(--muted); display: flex; flex-direction: column; gap: 3px; }
.itemfields input { width: 100%; }
.itemfields .diff { font-weight: 700; padding-top: 18px; }
.carry { border: 1px solid var(--line); border-radius: 8px; padding: 12px; margin-bottom: 10px; background: #fff; }
.carry.checked { background: #fbfdfb; }
.carry .row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.note-box { background: #f8fafc; border-radius: 8px; padding: 8px 10px; margin: 8px 0; font-size: .9rem; }
.sticky-bar {
  position: sticky; bottom: 0; background: rgba(255, 255, 255, .96); border-top: 1px solid var(--line); padding: 10px 16px; margin: 0 -24px -60px;
  display: flex; gap: 10px; align-items: center; justify-content: space-between; flex-wrap: wrap; z-index: 20; backdrop-filter: blur(4px);
  padding-bottom: calc(10px + env(safe-area-inset-bottom));
}
@media (max-width: 900px) { .sticky-bar { margin: 0 -16px -80px; } }

/* ---------- Фото и файлы ---------- */
.gallery { display: flex; flex-wrap: wrap; gap: 8px; }
.thumb { width: 96px; height: 96px; border-radius: 8px; border: 1px solid var(--line); overflow: hidden; background: #f1f4f8; position: relative; cursor: pointer; display: flex; align-items: center; justify-content: center; text-align: center; font-size: .75rem; color: var(--muted); padding: 0; }
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.thumb .rm { position: absolute; top: 3px; right: 3px; background: rgba(0, 0, 0, .55); color: #fff; border: 0; border-radius: 50%; width: 24px; height: 24px; cursor: pointer; font-size: 14px; line-height: 24px; padding: 0; }
.thumb.file { flex-direction: column; gap: 4px; padding: 6px; word-break: break-all; }
.uploader { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.uploader input[type=file] { display: none; }
.drop { border: 2px dashed var(--line-strong); border-radius: 8px; padding: 10px; color: var(--muted); font-size: .88rem; }
.drop.over { border-color: var(--accent); background: var(--accent-soft); }
.lightbox { position: fixed; inset: 0; background: rgba(0, 0, 0, .88); z-index: 100; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 16px; }
.lightbox img { max-width: 100%; max-height: calc(100% - 60px); object-fit: contain; border-radius: 4px; background: #fff; }
.lightbox .bar { color: #fff; display: flex; gap: 16px; align-items: center; margin-top: 10px; flex-wrap: wrap; justify-content: center; }
.lightbox .bar a { color: #9cc3ff; }
.lightbox .close { position: absolute; top: 12px; right: 14px; background: none; border: 0; color: #fff; font-size: 32px; cursor: pointer; }

/* ---------- Модальные окна ---------- */
.modal-bg { position: fixed; inset: 0; background: rgba(15, 23, 42, .45); z-index: 80; display: flex; align-items: flex-start; justify-content: center; padding: 40px 16px; overflow-y: auto; }
.modal { background: #fff; border-radius: 12px; width: 100%; max-width: 620px; box-shadow: 0 20px 50px rgba(0, 0, 0, .25); }
.modal.wide { max-width: 860px; }
.modal header { padding: 16px 18px 6px; display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.modal header h2 { margin: 0; }
.modal header button { background: none; border: 0; font-size: 26px; line-height: 1; cursor: pointer; color: var(--muted); }
.modal .body { padding: 8px 18px; }
.modal footer { padding: 12px 18px 16px; display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; }
@media (max-width: 600px) {
  .modal-bg { padding: 0; align-items: stretch; }
  .modal { border-radius: 0; min-height: 100%; display: flex; flex-direction: column; }
  .modal .body { flex: 1; }
  .modal footer { position: sticky; bottom: 0; background: #fff; border-top: 1px solid var(--line); padding-bottom: calc(12px + env(safe-area-inset-bottom)); }
  .modal footer .btn { flex: 1; }
}
.errors { background: var(--c-red-bg); color: var(--c-red); border-radius: 8px; padding: 10px 14px; margin-bottom: 12px; }
.errors ul { margin: 6px 0 0; padding-left: 20px; }
.hint { background: #f0f6ff; border: 1px solid #cfe0fb; border-radius: 8px; padding: 10px 12px; font-size: .9rem; color: #1e3a6a; margin-bottom: 12px; }
.warnbox { background: #fff7e6; border: 1px solid #f6d58e; border-radius: 8px; padding: 10px 12px; font-size: .92rem; color: #7a4b00; margin-bottom: 12px; }

/* ---------- Toast ---------- */
#toasts { position: fixed; right: 16px; bottom: 76px; z-index: 120; display: flex; flex-direction: column; gap: 8px; max-width: calc(100% - 32px); pointer-events: none; }
@media (max-width: 900px) { #toasts { top: calc(64px + env(safe-area-inset-top)); bottom: auto; left: 16px; right: 16px; } }
.toast { background: #1f2937; color: #fff; padding: 10px 16px; border-radius: 8px; box-shadow: 0 6px 20px rgba(0, 0, 0, .2); animation: tin .2s; max-width: 420px; }
.toast.error { background: #b42318; }
.toast.ok { background: #1d7a3e; }
@keyframes tin { from { opacity: 0; transform: translateY(8px); } }

/* ---------- Вкладки ---------- */
.tabs { display: flex; gap: 2px; border-bottom: 2px solid var(--line); margin-bottom: 14px; overflow-x: auto; scrollbar-width: none; }
.tabs a { padding: 9px 14px; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -2px; white-space: nowrap; font-weight: 500; }
.tabs a:hover { color: var(--text); text-decoration: none; }
.tabs a.on { color: var(--accent); border-bottom-color: var(--accent); }
.tabs a .c { background: var(--c-gray-bg); border-radius: 9px; padding: 0 7px; font-size: .78rem; margin-left: 4px; }

/* ---------- Календарь ---------- */
.cal { display: grid; grid-template-columns: repeat(7, 1fr); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; background: #fff; }
.cal .dow { background: #f6f8fb; padding: 6px; font-size: .78rem; color: var(--muted); text-align: center; font-weight: 600; border-bottom: 1px solid var(--line); }
.cal .day { min-height: 104px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); padding: 4px; font-size: .8rem; }
.cal .day:nth-child(7n) { border-right: 0; }
.cal .day.other { background: #fafbfc; color: #a0a8b4; }
.cal .day.today { background: #f2f7ff; }
.cal .day .d { font-weight: 600; margin-bottom: 3px; }
.cal .day.today .d { color: #fff; background: var(--accent); display: inline-block; border-radius: 10px; padding: 0 7px; }
.cal .ev { display: block; border-radius: 5px; padding: 2px 5px; margin-bottom: 3px; font-size: .76rem; line-height: 1.3; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cal .ev:hover { text-decoration: none; filter: brightness(.95); }
@media (max-width: 700px) {
  .cal .day { min-height: 64px; padding: 2px; }
  .cal .ev { font-size: 0; height: 8px; padding: 0; margin-bottom: 2px; }
}
.legend { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0; }

/* ---------- Вход ---------- */
.login { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px; background: linear-gradient(160deg, #1f3a5f, #2c5282 60%, #3b6aa8); }
.login .box { background: #fff; border-radius: 14px; padding: 26px; width: 100%; max-width: 420px; box-shadow: 0 20px 60px rgba(0, 0, 0, .3); }
.login h1 { margin-bottom: 4px; }
.demo-users { margin-top: 18px; border-top: 1px solid var(--line); padding-top: 14px; }
.demo-users button { display: flex; width: 100%; justify-content: space-between; align-items: center; border: 1px solid var(--line); background: #fafbfc; border-radius: 8px; padding: 8px 12px; margin-bottom: 6px; cursor: pointer; font: inherit; text-align: left; }
.demo-users button:hover { background: var(--accent-soft); border-color: #b9cff7; }
.demo-users small { color: var(--muted); }

/* ---------- Точка ---------- */
.point-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 14px; }
.pcard { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; box-shadow: var(--shadow); color: var(--text); display: block; }
.pcard:hover { text-decoration: none; border-color: #b9cff7; }
.pcard .dates { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 10px 0; font-size: .9rem; }
.pcard .dates span { display: block; font-size: .78rem; color: var(--muted); }
.mini-counts { display: flex; flex-wrap: wrap; gap: 6px; }
.next-check { background: #fffaf0; border: 1px solid #f6d58e; }

@media print {
  .sidebar, .topbar, .searchbar, .no-print, .sticky-bar, #toasts { display: none !important; }
  .content { padding: 0; max-width: none; }
  .card { box-shadow: none; break-inside: avoid; }
  body { background: #fff; }
}
