/* ==========================================================
   СДО + CRM — превью по макетам Figma (голубая тема)
   Экраны: Рабочий стол v5, Календарь (день/неделя/месяц),
   Внутренняя документация
   ========================================================== */

:root {
  /* меню */
  --menu-bg: #2F6FB7;
  --menu-line: #285F9E;
  --menu-panel: #3E7FC5;
  --menu-panel-border: #5E95D3;
  --menu-crm: #4B8DD3;
  --menu-crm-border: #77A9E0;
  --menu-icon-plate: #3D7DC6;
  --menu-text: #FFFFFF;
  --menu-sub: #DCEAF8;
  --menu-caption: #CFE2F7;
  --menu-counter: #1E5C9F;

  /* контент */
  --accent: #2B7FD9;
  --accent-hover: #1F6BBF;
  --accent-soft: #E6F2FC;
  --accent-soft2: #CDE3F7;
  --bg: #F1F6FB;
  --surface: #FFFFFF;
  --border: #E4E7EC;
  --row-line: #EEF0F3;
  --text: #0F1B2A;
  --text-2: #5B6675;
  --text-3: #8A94A3;

  /* статусы */
  --amber: #B26B00;  --amber-soft: #FFF4DF;
  --red: #C73E3E;    --red-soft: #FDECEC;
  --violet: #6E56CF; --violet-soft: #F0EDFC;
  --green: #0E7C6B;  --green-soft: #E7F4F1;
  --pink: #C2417A;   --pink-soft: #FCEAF2;
  --grey: #5B6675;   --grey-soft: #F0F2F5;

  --r-8: 8px; --r-10: 10px; --r-14: 14px; --r-16: 16px; --r-20: 20px;
  --sidebar-w: 324px;
  --topbar-h: 64px;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  color: var(--text);
  background: var(--bg);
  font-size: 13px;
  line-height: normal;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; cursor: pointer; }
svg.ic { width: 16px; height: 16px; flex-shrink: 0; display: block; }
.muted { color: var(--text-3); }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- каркас ---------- */
.app {
  display: grid;
  grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
  min-height: 100vh;
}
.main { min-width: 0; display: flex; flex-direction: column; }
.content {
  padding: 20px 32px 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  flex: 1;
}

/* ---------- боковое меню ---------- */
.sidebar {
  position: sticky; top: 0;
  height: 100vh;
  background: var(--menu-bg);
  border-right: 1px solid var(--menu-line);
  color: var(--menu-text);
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,.25) transparent;
  padding: 20px 12px 48px;
}
.sidebar::after { /* затухание внизу, как в макете */
  content: ""; position: fixed; left: 0; bottom: 0;
  width: calc(var(--sidebar-w) - 1px); height: 72px;
  background: linear-gradient(to bottom, rgba(47,111,183,0), var(--menu-bg));
  pointer-events: none;
}
.logo { display: flex; align-items: center; gap: 10px; padding: 0 10px; margin-bottom: 24px; }
.logo-mark {
  width: 36px; height: 36px; border-radius: 10px; background: #fff;
  display: grid; place-items: center; color: var(--accent);
}
.logo-mark svg.ic { width: 20px; height: 20px; }
.logo-title { font-weight: 700; font-size: 16px; }
.logo-sub { font-size: 11.5px; color: var(--menu-caption); margin-top: 1px; }

.nav-panel {
  background: var(--menu-panel);
  border: 1px solid var(--menu-panel-border);
  border-radius: 14px;
  padding: 12px 8px 8px;
  margin-bottom: 14px;
}
.nav-panel.crm { background: var(--menu-crm); border-color: var(--menu-crm-border); }
.nav-panel .caption {
  display: flex; align-items: center; gap: 8px;
  padding: 0 4px 10px; margin: 0;
}
.nav-panel .caption::before {
  content: ""; width: 3px; height: 14px; border-radius: 2px; background: #fff;
}
.caption {
  font-size: 11.5px; font-weight: 700; letter-spacing: .3px;
  color: #fff; text-transform: uppercase;
  padding: 10px 18px 8px; margin-top: 4px;
}
.nav-group > .caption { color: var(--menu-caption); font-size: 11px; }

.nav-item {
  display: flex; align-items: center; gap: 12px;
  height: 42px; padding: 0 8px; border-radius: 10px;
  font-weight: 600; font-size: 14px; color: #fff;
  transition: background .15s;
}
.nav-item:hover { background: rgba(255,255,255,.1); }
.nav-item .plate {
  width: 30px; height: 30px; border-radius: 8px; color: #fff;
  background: var(--menu-icon-plate); border: 1px solid var(--menu-panel-border);
  display: grid; place-items: center;
}
.nav-item .label { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nav-item .chev { opacity: .85; transition: transform .2s; }
.nav-item.open .chev { transform: rotate(90deg); }
.nav-item.active {
  background: #fff; color: var(--accent);
  border: 1px solid var(--accent-soft2);
  box-shadow: 0 2px 6px rgba(15, 27, 42, .12);
}
.nav-item .plate svg.ic, .phonebook .plate svg.ic { width: 17px; height: 17px; }
.phonebook .plate { color: #fff; }
.nav-item.active .plate { background: var(--accent); border-color: var(--accent); color: #fff; }

.counter {
  min-width: 22px; height: 20px; padding: 0 6px; border-radius: 10px;
  background: var(--menu-counter); color: #fff;
  font-size: 11.5px; font-weight: 700; display: grid; place-items: center;
}
.counter.warn { background: #FFF4DF; color: var(--amber); }

/* простые пункты (без плашки) */
.nav-group { margin-top: 2px; }
.nav-group .nav-item { height: 32px; gap: 12px; padding: 0 6px 0 14px; font-size: 14px; }
.nav-group .nav-item svg.ic { width: 18px; height: 18px; }

.subnav { display: none; margin: 0 0 4px 30px; border-left: 2px solid rgba(255,255,255,.3); padding-left: 8px; }
.subnav.open { display: block; }
.nav-group .subnav { margin-left: 34px; border-left: 0; padding-left: 0; }
.subnav a {
  display: flex; align-items: center; justify-content: space-between;
  height: 28px; padding: 0 8px; border-radius: 6px;
  color: var(--menu-sub); font-size: 13px; font-weight: 500;
}
.subnav a:hover { background: rgba(255,255,255,.1); color: #fff; }
.subnav a.hl { background: #FFF4DF; color: var(--amber); font-weight: 700; }
.subnav a.hl small { font-size: 11px; font-weight: 700; }
.subnav a .sn-label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.subnav a small { flex: none; margin-left: 6px; }

.phonebook {
  display: flex; align-items: center; gap: 12px;
  margin: 10px 0 14px; padding: 12px 14px;
  background: var(--menu-panel); border: 1px solid var(--menu-panel-border); border-radius: 12px;
}
.phonebook .plate {
  width: 32px; height: 32px; border-radius: 8px; background: var(--menu-icon-plate);
  border: 1px solid var(--menu-panel-border); display: grid; place-items: center;
}
.phonebook b { display: block; font-size: 14px; }
.phonebook span { font-size: 12px; color: var(--menu-sub); }

/* ---------- верхняя панель ---------- */
.topbar {
  height: var(--topbar-h);
  background: #fff;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 12px;
  padding: 0 32px;
  position: sticky; top: 0; z-index: 5;
}
.search {
  display: flex; align-items: center; gap: 10px;
  width: 470px; max-width: 100%; height: 40px; padding: 0 12px 0 14px;
  border: 1px solid var(--border); border-radius: 10px; color: var(--text-3);
}
.search input {
  border: 0; outline: 0; flex: 1; min-width: 0; font: inherit; font-size: 14px; color: var(--text);
  background: transparent;
}
.search input::placeholder { color: var(--text-3); }
.kbd {
  font-size: 11px; font-weight: 600; color: var(--text-2);
  background: var(--grey-soft); border-radius: 6px; padding: 3px 6px;
}
.topbar .spacer { flex: 1; }
.view-pill {
  display: flex; align-items: center; gap: 6px; height: 32px; padding: 0 12px;
  border-radius: 16px; background: var(--violet-soft); color: var(--violet);
  font-weight: 600; font-size: 13px;
  white-space: nowrap; flex-shrink: 0;
}
.icon-btn {
  width: 40px; height: 40px; border-radius: 10px; background: #fff;
  border: 1px solid var(--border); display: grid; place-items: center;
  position: relative; color: var(--text);
}
.icon-btn:hover { background: var(--grey-soft); }
.icon-btn .dot {
  position: absolute; top: 7px; right: 8px; width: 7px; height: 7px;
  border-radius: 50%; background: #E5484D;
}
.user { display: flex; align-items: center; gap: 10px; margin-left: 4px; }
.avatar {
  width: 36px; height: 36px; border-radius: 50%; background: var(--accent-soft);
  color: var(--accent); display: grid; place-items: center; font-weight: 700; font-size: 13px;
}
.user-name { font-weight: 600; font-size: 14px; }
.user-role { font-size: 12px; color: var(--text-2); text-align: right; }
.user svg.ic { color: var(--text-3); }

/* ---------- общие элементы ---------- */
.page-head { display: flex; align-items: center; gap: 12px; }
.page-head .titles { flex: 1; min-width: 0; }
.page-head h1 { margin: 0; font-size: 22px; font-weight: 700; }
.page-head p { margin: 2px 0 0; color: var(--text-2); font-size: 13px; }

.btn {
  display: inline-flex; align-items: center; gap: 8px;
  height: 36px; padding: 0 16px 0 14px; border-radius: 10px;
  font-weight: 600; font-size: 13.5px; white-space: nowrap;
  border: 1px solid var(--border); background: #fff; color: var(--text);
  transition: background .15s;
}
.btn:hover { background: var(--grey-soft); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { background: var(--accent-hover); }
.btn.soft { background: var(--accent-soft); border-color: var(--accent-soft); color: var(--accent); }
.btn.square { width: 36px; padding: 0; justify-content: center; }
.btn.block { width: 100%; justify-content: center; height: 38px; }

.card {
  background: #fff; border: 1px solid var(--border); border-radius: var(--r-16);
}
.plate {
  width: 40px; height: 40px; border-radius: 10px;
  display: grid; place-items: center; flex-shrink: 0;
  background: var(--accent-soft); color: var(--accent);
}
.plate.sm { width: 32px; height: 32px; border-radius: 8px; }
.plate.xs { width: 28px; height: 28px; border-radius: 8px; }
.plate.violet { background: var(--violet-soft); color: var(--violet); }
.plate.red { background: var(--red-soft); color: var(--red); }
.plate.amber { background: var(--amber-soft); color: var(--amber); }
.plate.green { background: var(--green-soft); color: var(--green); }
.plate svg.ic { width: 20px; height: 20px; }
.plate.sm svg.ic { width: 18px; height: 18px; }
.plate.xs svg.ic { width: 16px; height: 16px; }

.widget { padding: 18px; display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.widget-head { display: flex; align-items: center; gap: 10px; }
.widget-head h3 { flex: 1; margin: 0; font-size: 15px; font-weight: 600; }
.link {
  display: inline-flex; align-items: center; gap: 5px;
  color: var(--accent); font-weight: 600; font-size: 12.5px;
}
.link svg.ic { width: 14px; height: 14px; }
.link:hover { color: var(--accent-hover); }

.badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 8px; border-radius: 10px; font-weight: 600; font-size: 11.5px; white-space: nowrap;
}
.badge.red { background: var(--red-soft); color: var(--red); }
.badge.amber { background: var(--amber-soft); color: var(--amber); }
.badge.green { background: var(--green-soft); color: var(--green); }
.badge.blue { background: var(--accent-soft); color: var(--accent); }
.badge.violet { background: var(--violet-soft); color: var(--violet); }
.badge .dt { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }

.th {
  font-weight: 600; font-size: 10.5px; letter-spacing: .4px; color: var(--text-3);
  text-transform: uppercase;
}
.t-main { font-weight: 600; font-size: 13px; }
.t-sub { font-size: 11.5px; color: var(--text-3); margin-top: 2px; }

/* ======================= РАБОЧИЙ СТОЛ ======================= */
.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
.kpi {
  display: flex; align-items: center; gap: 12px; padding: 12px 14px;
  background: #fff; border: 1px solid var(--border); border-radius: var(--r-14);
}
.kpi-label { color: var(--text-2); font-weight: 500; font-size: 12.5px; }
.kpi-value { display: flex; align-items: baseline; gap: 8px; margin-top: 2px; }
.kpi-value b { font-size: 22px; font-weight: 700; }
.kpi-value span { font-size: 12px; font-weight: 500; color: var(--text-3); }
.kpi-value span.blue { color: var(--accent); }
.kpi-value span.red { color: var(--red); }

.desk-row { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 16px; }
.side-stack { display: flex; flex-direction: column; gap: 16px; }

.tbl { width: 100%; overflow-x: auto; scrollbar-width: thin; }
.tbl::-webkit-scrollbar { height: 8px; }
.tbl::-webkit-scrollbar-thumb { background: #D5DCE5; border-radius: 4px; }
.tbl::-webkit-scrollbar-track { background: transparent; }
.tbl-head, .tbl-row { display: grid; align-items: center; }
.tbl-head { padding-bottom: 6px; }
.tbl-row { border-top: 1px solid var(--row-line); min-height: 48px; padding: 7px 0; }
.tbl-row > * { min-width: 0; padding-right: 10px; }
.tbl-row:hover { background: #FAFBFC; }
.cols-ochnoe { grid-template-columns: 96px 196px 168px 44px minmax(170px, 1fr); }
.cols-expire { grid-template-columns: 210px minmax(0, 1fr) 120px 90px; }
.cols-expire > :last-child { text-align: right; padding-right: 0; }
.phone { display: inline-flex; align-items: center; gap: 6px; color: var(--accent); font-size: 12.5px; margin-top: 2px; }
.phone svg.ic { width: 13px; height: 13px; }

.timeline { display: flex; flex-direction: column; }
.tl-item { display: flex; align-items: center; gap: 14px; padding: 5px 0; }
.tl-time { width: 36px; font-weight: 600; font-size: 13px; }
.tl-body { border-left: 3px solid var(--accent); padding: 2px 0 2px 10px; min-width: 0; }
.tl-body.violet { border-color: var(--violet); }
.tl-body.green { border-color: var(--green); }
.tl-body.amber { border-color: var(--amber); }
.tl-body.red { border-color: var(--red); }

.tabs { display: flex; align-items: center; gap: 20px; border-bottom: 0; }
.tab {
  display: flex; align-items: center; gap: 8px; padding: 0 0 8px;
  border: 0; background: none; font-size: 14px; color: var(--text-2);
  border-bottom: 3px solid transparent; font-weight: 500; white-space: nowrap; font-size: 13.5px;
}
.tab .n { font-size: 11px; font-weight: 600; background: var(--grey-soft); color: var(--text-2); padding: 2px 6px; border-radius: 8px; }
.tab.active { color: var(--text); font-weight: 600; border-bottom-color: var(--accent); }
.tab.active .n { background: var(--accent-soft); color: var(--accent); }
.tabs .link { margin-left: auto; font-size: 13px; }
.tab-panel { display: none; }
.tab-panel.active { display: block; }

.folders { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.folder {
  display: flex; align-items: center; gap: 8px; height: 34px; padding: 0 12px;
  border: 1px solid var(--border); border-radius: 10px; background: #F8FAFC;
  font-weight: 600; font-size: 13px; color: var(--text);
}
.folder svg.ic { color: var(--accent); }
.folder .cnt { margin-left: auto; font-weight: 500; color: var(--text-3); }
.folder.hl { background: var(--amber-soft); border-color: #F3D9A6; color: var(--amber); }
.folder.hl svg.ic { color: var(--amber); }
.folder:hover { border-color: var(--accent-soft2); }

.mini-search {
  display: flex; align-items: center; gap: 8px; height: 32px; padding: 0 12px;
  border: 1px solid var(--border); border-radius: 8px; color: var(--text-3);
}
.mini-search input { border: 0; outline: 0; font: inherit; font-size: 13px; flex: 1; min-width: 0; background: transparent; }
.contact { display: flex; align-items: center; gap: 10px; }
.contact .avatar { width: 26px; height: 26px; font-size: 10px; }
.contact b { flex: 1; font-size: 13px; font-weight: 600; }

/* ======================= КАЛЕНДАРЬ ======================= */
.cal-layout { display: grid; grid-template-columns: 248px minmax(0, 1fr); gap: 16px; flex: 1; min-height: 0; }
.cal-layout.with-details { grid-template-columns: 248px minmax(0, 1fr) 302px; }
.cal-left { display: flex; flex-direction: column; gap: 14px; }
.cal-left .card { padding: 14px; }
.cal-left .card.grow { flex: 1; }

.seg { display: flex; padding: 3px; gap: 2px; background: #E7EDF4; border-radius: 10px; }
.seg a {
  height: 30px; padding: 0 12px; border-radius: 8px; display: grid; place-items: center;
  color: var(--text-2); font-weight: 500; font-size: 13.5px;
}
.seg a.active { background: #fff; color: var(--text); font-weight: 600; box-shadow: 0 1px 2px rgba(15,27,42,.08); }

.mini-cal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.mini-cal-head b { font-size: 14.5px; font-weight: 600; }
.mini-cal-head .arrows { display: flex; gap: 8px; color: var(--text-2); }
.mini-cal { display: grid; grid-template-columns: repeat(7, 1fr); row-gap: 4px; text-align: center; }
.mini-cal .dow { font-size: 11px; color: var(--text-3); padding-bottom: 6px; }
.mini-cal .d { height: 28px; display: grid; place-items: center; font-size: 13px; border-radius: 6px; cursor: pointer; }
.mini-cal .d.we { color: var(--text-3); }
.mini-cal .d:hover { background: var(--grey-soft); }
.mini-cal .wk { background: var(--accent-soft); border-radius: 0; font-weight: 600; }
.mini-cal .wk.first { border-radius: 8px 0 0 8px; }
.mini-cal .wk.last { border-radius: 0 8px 8px 0; }
.mini-cal .today span {
  width: 26px; height: 26px; border-radius: 50%; background: var(--accent); color: #fff;
  display: grid; place-items: center; font-weight: 600;
}

.filters-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.filters-head b { font-size: 14.5px; font-weight: 600; }
.filter { display: flex; align-items: center; gap: 10px; height: 28px; cursor: pointer; user-select: none; font-size: 13.5px; }
.filter .cb {
  width: 18px; height: 18px; border-radius: 4px; border: 1.5px solid #C6CCD5;
  display: grid; place-items: center; color: #fff;
}
.filter .cb svg.ic { width: 12px; height: 12px; stroke-width: 3; visibility: hidden; }
.filter.on .cb { background: var(--c); border-color: var(--c); }
.filter.on .cb svg.ic { visibility: visible; }
.filter .lbl { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 13.5px; }
.filter .num { color: var(--text-3); font-size: 12px; }
.filter:not(.on) .lbl { color: var(--text-2); }

.issue-list { display: flex; flex-direction: column; gap: 14px; margin-top: 12px; }
.issue { border-left: 3px solid var(--amber); padding-left: 10px; }
.issue b { font-size: 13px; font-weight: 600; }

/* типы событий */
.t-ochnoe { --c: #2B7FD9; --s: #E6F2FC; }
.t-dist   { --c: #6E56CF; --s: #F0EDFC; }
.t-docs   { --c: #B26B00; --s: #FFF4DF; }
.t-exam   { --c: #0E7C6B; --s: #E7F4F1; }
.t-mgmt   { --c: #C2417A; --s: #FCEAF2; }
.t-mgr    { --c: #5B6675; --s: #F0F2F5; }

/* --- неделя --- */
.cal-board { padding: 0; overflow: hidden; display: flex; flex-direction: column; }
.week-cols { display: grid; grid-template-columns: 56px repeat(5, minmax(0, 1fr)) 64px 64px; }
.week-head { border-bottom: 1px solid var(--border); height: 56px; }
.week-head > div { border-left: 1px solid var(--row-line); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; }
.week-head > div:first-child { border-left: 0; }
.week-head .dw { font-size: 10.5px; color: var(--text-2); text-transform: uppercase; }
.week-head .dn { font-size: 16px; font-weight: 600; }
.week-head .we .dn, .week-head .we .dw { color: var(--text-3); }
.week-head .today .dw { color: var(--accent); font-weight: 600; }
.week-head .today .dn {
  width: 26px; height: 26px; border-radius: 50%; background: var(--accent); color: #fff;
  display: grid; place-items: center; font-size: 15px;
}
.allday { border-bottom: 1px solid var(--border); min-height: 70px; position: relative; grid-auto-rows: 21px; padding: 4px 0; row-gap: 0; }
.allday .lbl-col { grid-row: 1 / span 3; font-size: 10.5px; color: var(--text-2); padding: 4px 0 0 9px; line-height: 1.3; }
.ad-bar {
  margin: 1px 2px; border-radius: 4px; background: var(--s); color: var(--c);
  border-left: 3px solid var(--c); font-size: 11px; font-weight: 600; padding: 2px 8px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.week-body { position: relative; flex: 1; overflow-y: auto; }
.week-grid { position: relative; height: calc(9 * var(--hour) + 20px); --hour: 67px; }
.week-grid .col { position: relative; border-left: 1px solid var(--row-line); }
.week-grid .col.we { background: #F8FAFC; }
.hours { position: absolute; inset: 0; pointer-events: none; }
.hour-line { position: absolute; left: 56px; right: 0; border-top: 1px solid var(--row-line); }
.hour-lbl { position: absolute; left: 0; width: 56px; text-align: center; font-size: 11px; color: var(--text-2); transform: translateY(-1px); padding-top: 4px; }

.ev {
  position: absolute; left: 2px; right: 3px;
  background: var(--s); color: var(--c);
  border-left: 3px solid var(--c); border-radius: 4px;
  padding: 4px 8px; overflow: hidden; cursor: pointer;
  transition: box-shadow .15s;
}
.ev:hover { box-shadow: 0 2px 8px rgba(15,27,42,.12); z-index: 2; }
.ev .e-t { font-weight: 600; font-size: 12px; line-height: 1.2; }
.ev .e-time { font-size: 11px; color: var(--text); margin-top: 2px; opacity: .85; }
.ev .e-sub { font-size: 11px; color: var(--text-2); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ev.selected { outline: 2px solid var(--accent-soft2); background: var(--accent-soft); }
.now-line { position: absolute; left: 0; right: 0; height: 2px; margin-top: -1px; background: #D9403A; z-index: 3; }
.now-line::before { content: ""; position: absolute; left: -4px; top: -2.5px; width: 7px; height: 7px; border-radius: 50%; background: #D9403A; }
.now-lbl { position: absolute; font-size: 11px; font-weight: 600; color: #D9403A; left: 13px; transform: translateY(-50%); z-index: 3; background: #fff; }

.hide-ochnoe .t-ochnoe.ev, .hide-ochnoe .t-ochnoe.ad-bar, .hide-ochnoe .t-ochnoe.chip,
.hide-dist .t-dist.ev, .hide-dist .t-dist.ad-bar, .hide-dist .t-dist.chip,
.hide-docs .t-docs.ev, .hide-docs .t-docs.ad-bar, .hide-docs .t-docs.chip,
.hide-exam .t-exam.ev, .hide-exam .t-exam.ad-bar, .hide-exam .t-exam.chip,
.hide-mgmt .t-mgmt.ev, .hide-mgmt .t-mgmt.ad-bar, .hide-mgmt .t-mgmt.chip,
.hide-mgr .t-mgr.ev, .hide-mgr .t-mgr.ad-bar, .hide-mgr .t-mgr.chip { display: none; }

/* --- день --- */
.day-head { display: flex; align-items: center; gap: 12px; padding: 0 18px; height: 56px; border-bottom: 1px solid var(--border); }
.day-head .num { width: 32px; height: 32px; border-radius: 50%; background: var(--accent); color: #fff; display: grid; place-items: center; font-weight: 600; font-size: 15px; }
.day-head b { font-size: 14.5px; font-weight: 600; }
.day-cols { display: grid; grid-template-columns: 64px minmax(0, 1fr); }
.day-allday { border-bottom: 1px solid var(--border); padding: 5px 10px 5px 0; }
.day-allday .lbl-col { font-size: 10.5px; color: var(--text-2); padding: 6px 0 0 11px; line-height: 1.3; }
.day-allday .ad-bar { margin: 2px 0; font-size: 11.5px; padding: 3px 8px; }
.day-grid { position: relative; --hour: 69px; height: calc(9 * var(--hour) + 10px); }
.day-grid .col { position: relative; border-left: 1px solid var(--row-line); }
.day-grid .hour-line { left: 64px; }
.day-grid .half-line { position: absolute; left: 64px; right: 0; border-top: 1px dashed #F2F4F7; }
.day-grid .hour-lbl { width: 64px; }
.day-grid .ev { left: 4px; right: 10px; padding: 7px 10px; }
.day-grid .ev .e-t { font-size: 13px; }
.day-grid .ev .e-time { font-size: 11.5px; }
.day-grid .ev .e-sub { font-size: 11.5px; }

.details { padding: 18px; display: flex; flex-direction: column; gap: 12px; }
.details .top { display: flex; align-items: center; gap: 10px; color: var(--text-2); }
.details .top .badge { margin-right: auto; }
.details h2 { margin: 0; font-size: 18px; font-weight: 700; line-height: 1.2; }
.det-row { display: flex; gap: 10px; }
.det-row svg.ic { width: 18px; height: 18px; color: var(--text-2); margin-top: 1px; }
.det-row b { display: block; font-size: 13.5px; font-weight: 600; }
.det-row span { font-size: 11.5px; color: var(--text-3); }
.contact-box { background: #F6F8FA; border-radius: 10px; padding: 12px; }
.contact-box b { display: block; font-size: 13px; font-weight: 600; margin-top: 4px; }
.details .actions { margin-top: auto; display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.details .actions .primary { grid-column: 1 / -1; }

/* --- месяц --- */
.month-cols { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)) 64px 64px; }
.month-head { height: 36px; border-bottom: 1px solid var(--border); }
.month-head > div { padding: 12px 8px 0; font-size: 10.5px; color: var(--text-2); text-transform: uppercase; }
.month-head .today { color: var(--accent); font-weight: 600; }
.month-head .we { color: var(--text-3); }
.month-body { flex: 1; grid-auto-rows: minmax(110px, 1fr); }
.mc { border-left: 1px solid var(--row-line); border-top: 1px solid var(--row-line); padding: 6px 6px 4px; min-width: 0; display: flex; flex-direction: column; gap: 4px; cursor: pointer; }
.mc:nth-child(7n + 1) { border-left: 0; }
.month-body .mc:nth-child(-n + 7) { border-top: 0; }
.mc .n { font-size: 13px; font-weight: 600; margin-bottom: 2px; }
.mc.we { background: #F8FAFC; }
.mc.we .n, .mc.out .n { color: var(--text-3); font-weight: 500; }
.mc.today { background: #F3F8FD; }
.mc.today .n span { width: 24px; height: 24px; border-radius: 50%; background: var(--accent); color: #fff; display: grid; place-items: center; }
.mc:hover { background: #F6F9FC; }
.chip {
  display: flex; align-items: center; gap: 5px; height: 18px; padding: 0 5px; border-radius: 4px;
  background: var(--s); color: var(--c); font-size: 11px; font-weight: 500;
  white-space: nowrap; overflow: hidden;
}
.chip::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--c); flex-shrink: 0; }
.chip span { overflow: hidden; text-overflow: ellipsis; }
.more { font-size: 11px; font-weight: 600; color: var(--accent); padding-left: 4px; }

/* ======================= ДОКУМЕНТАЦИЯ ======================= */
.docs-layout { display: grid; grid-template-columns: 248px minmax(0, 1fr); gap: 16px; flex: 1; }
.cats { padding: 12px; display: flex; flex-direction: column; }
.cat {
  display: flex; align-items: center; gap: 10px; padding: 7px 8px; border-radius: 10px;
  font-size: 14px; cursor: pointer; min-height: 40px;
}
.cat:hover { background: #F6F8FA; }
.cat .name { flex: 1; line-height: 1.15; font-size: 13.5px; }
.cat .cnt { font-size: 12px; color: var(--text-3); }
.cat.active { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.cat.active .cnt { color: var(--accent); }
.cats .caption-sm { font-size: 10.5px; font-weight: 600; letter-spacing: .5px; color: var(--text-3); padding: 12px 8px 4px; text-transform: uppercase; }
.new-cat {
  margin-top: auto; height: 38px; border: 1.5px dashed #9CC3EC; border-radius: 10px;
  background: #fff; color: var(--accent); font-weight: 600; font-size: 14px;
  display: flex; align-items: center; justify-content: center; gap: 8px;
}
.new-cat:hover { background: var(--accent-soft); }
.cats .hint { font-size: 11.5px; color: var(--text-3); text-align: center; margin-top: 8px; line-height: 1.3; }

.docs-main { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.scans { padding: 14px 16px 16px; }
.scans-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.scans-head b { font-size: 15px; font-weight: 600; }
.scans-head span { font-size: 13px; color: var(--text-2); }
.scan-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.scan {
  border: 1px solid var(--border); border-radius: 12px; padding: 12px; background: #F8FAFC;
  display: flex; flex-direction: column; gap: 6px; align-items: flex-start; min-width: 0;
}
.scan .row1 { display: flex; justify-content: space-between; width: 100%; color: var(--text-2); margin-bottom: 6px; }
.scan .row1 .plate { background: #fff; }
.scan b { font-size: 14px; font-weight: 600; line-height: 1.2; }
.scan .meta { font-size: 11.5px; color: var(--text-3); max-width: 100%; }
.scan .badge { font-size: 11px; margin-top: 2px; }

.dropzone {
  display: flex; align-items: center; gap: 14px; padding: 12px 14px 12px 24px;
  border: 1.5px dashed #9CC3EC; border-radius: 14px; background: #F6FAFE;
  transition: background .15s, border-color .15s;
}
.dropzone.drag { background: var(--accent-soft); border-color: var(--accent); }
.dropzone > svg.ic { color: var(--accent); width: 20px; height: 20px; }
.dropzone .txt { flex: 1; }
.dropzone b { font-size: 14px; font-weight: 600; display: block; }
.dropzone span { font-size: 11.5px; color: var(--text-3); }
.select {
  height: 36px; border: 1px solid var(--border); border-radius: 8px; background: #fff;
  padding: 0 30px 0 10px; font: inherit; font-size: 13.5px; color: var(--text);
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%235B6675' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  background-size: 14px;
}

.files { padding: 16px; flex: 1; }
.files-bar { display: flex; align-items: center; gap: 6px; margin-bottom: 12px; flex-wrap: wrap; }
.fchip {
  display: inline-flex; align-items: center; gap: 6px; height: 26px; padding: 0 10px;
  border-radius: 13px; background: var(--grey-soft); border: 0; font-weight: 600; font-size: 13px; color: var(--text);
}
.fchip span { font-weight: 500; color: var(--text-3); font-size: 12px; }
.fchip.active { background: var(--accent); color: #fff; }
.fchip.active span { color: #D6E8FA; }
.files-bar .btn { margin-left: auto; }
.cols-files { grid-template-columns: 28px minmax(140px, 1fr) 118px 88px 64px 110px 56px; gap: 0 0; }
.files .tbl-head, .files .tbl-row { min-width: 604px; }
.files .tbl-head { border-bottom: 1px solid var(--row-line); padding: 8px 0 10px; }
.files .tbl-row { min-height: 50px; padding: 6px 0; }
.files .tbl-row:first-of-type { border-top: 0; }
.files .tbl-row.sel { background: #F7FAFE; }
.file-name { display: flex; align-items: center; gap: 10px; min-width: 0; }
.ftype {
  width: 34px; height: 34px; border-radius: 8px; display: grid; place-items: center; flex-shrink: 0;
  font-size: 10px; font-weight: 700; background: var(--red-soft); color: var(--red);
}
.ftype.docx { background: var(--accent-soft); color: var(--accent); }
.file-name .t-main { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cb-box {
  width: 18px; height: 18px; border-radius: 4px; border: 1.5px solid #C6CCD5;
  display: grid; place-items: center; cursor: pointer; background: #fff; color: #fff;
}
.cb-box svg.ic { width: 12px; height: 12px; stroke-width: 3; visibility: hidden; }
.cb-box.on { background: var(--accent); border-color: var(--accent); }
.cb-box.on svg.ic { visibility: visible; }
.row-actions { display: flex; gap: 10px; color: var(--text-2); justify-content: flex-end; }
.row-actions svg.ic { cursor: pointer; }
.row-actions svg.ic:hover { color: var(--accent); }

/* всплывающая подсказка для иконочных кнопок (см. layout.js) */
.ui-tip {
  position: fixed;
  z-index: 1000;
  pointer-events: none;
  background: rgba(91, 102, 117, .92);
  color: #fff;
  font-size: 12px;
  font-weight: 500;
  line-height: 1.25;
  padding: 5px 9px;
  border-radius: 6px;
  white-space: nowrap;
  box-shadow: 0 6px 18px rgba(15, 27, 42, .16);
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
  opacity: 0;
  transform: translateY(2px);
  transition: opacity .12s ease, transform .12s ease;
}
.ui-tip.is-visible { opacity: 1; transform: translateY(0); }

/* страницы «на один экран»: календарь и документы помещаются в окно */
@media (min-width: 1281px) and (min-height: 760px) {
  .content.fit { height: calc(100vh - var(--topbar-h)); min-height: 0; }
  .content.fit .cal-layout, .content.fit .docs-layout { min-height: 0; }
  .content.fit .cal-board, .content.fit .details, .content.fit .cats { min-height: 0; }
  .content.fit .files { overflow-y: auto; min-height: 0; }
  .content.fit .cal-left { min-height: 0; overflow: hidden; }
}

/* ---------- адаптив (минимум для превью) ---------- */
@media (max-width: 1360px) {
  .topbar .search { width: 380px; }
}
@media (max-width: 1200px) {
  .topbar .view-pill { display: none; }
}
@media (max-width: 1100px) {
  :root { --sidebar-w: 280px; }
  .topbar .search { width: 280px; }
  .topbar .kbd { display: none; }
  .subnav a { font-size: 12px; }
}
@media (max-width: 1280px) {
  .desk-row { grid-template-columns: minmax(0, 1fr); }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .scan-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .cal-layout.with-details { grid-template-columns: 248px minmax(0, 1fr); }
  .cal-layout.with-details .details { grid-column: 1 / -1; }
}
@media (max-width: 900px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { position: relative; height: auto; max-height: 50vh; }
  .sidebar::after { display: none; }
  .cal-layout, .docs-layout { grid-template-columns: 1fr; }
  .content { padding: 16px; }
  .topbar { padding: 0 16px; }
  .topbar .view-pill, .user > div { display: none; }
  .tbl { overflow-x: auto; }
}
