@font-face { font-family: 'Unbounded'; src: url('/fonts/Unbounded.woff2') format('woff2'); font-weight: 200 900; font-display: swap; }
@font-face { font-family: 'Nunito'; src: url('/fonts/Nunito.woff2') format('woff2'); font-weight: 200 1000; font-display: swap; }

:root {
  --ice: #eceef2;
  --ice-2: #e3e6ec;
  --surface: #ffffff;
  --surface-2: #f6f7f9;
  --line: #dcdfe6;
  --line-2: #c9cdd6;
  --text: #191c25;
  --muted: #636670;
  --faint: #8b8e98;
  --blue: #233e9f;
  --blue-2: #3d50c0;
  --blue-soft: #e8ebf8;
  --orange: #de532a;
  --orange-soft: #fcebe5;
  --green: #1d8f62;
  --green-soft: #e3f4ec;
  --amber: #b97c0e;
  --amber-soft: #fbf1dc;
  --grey: #d3d3d3;
  --radius: 14px;
  --radius-sm: 9px;
  --shadow: 0 1px 2px rgba(25, 28, 37, .05), 0 6px 20px rgba(25, 28, 37, .06);
  --shadow-lg: 0 20px 60px rgba(17, 25, 70, .22);
  --head: 'Unbounded', system-ui, sans-serif;
  --body: 'Nunito', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --sidebar: 248px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font-family: var(--body); font-size: 15px; line-height: 1.45; color: var(--text);
  background: var(--ice); -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent;
}
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--blue-2); text-decoration: none; }
h1, h2, h3 { font-family: var(--head); font-weight: 600; letter-spacing: -.01em; margin: 0; }
h1 { font-size: 22px; line-height: 1.2; }
h2 { font-size: 15px; text-transform: uppercase; letter-spacing: .02em; }
h3 { font-size: 15px; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.small { font-size: 13px; }
.hidden { display: none !important; }
.nowrap { white-space: nowrap; }
.grow { flex: 1; min-width: 0; }
.row { display: flex; align-items: center; gap: 10px; }
.wrap { flex-wrap: wrap; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
svg.i { width: 18px; height: 18px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- кнопки и поля */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 40px; padding: 0 16px; border-radius: 999px; border: 1px solid var(--line-2);
  background: var(--surface); cursor: pointer; font-weight: 700; font-size: 14px; white-space: nowrap;
  transition: background .15s, border-color .15s, transform .05s;
}
.btn:hover { border-color: var(--blue-2); }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--blue); border-color: var(--blue); color: #fff; }
.btn.primary:hover { background: var(--blue-2); border-color: var(--blue-2); }
.btn.accent { background: var(--orange); border-color: var(--orange); color: #fff; }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: var(--ice-2); }
.btn.danger { color: var(--orange); border-color: #f0c3b4; }
.btn.danger:hover { background: var(--orange-soft); }
.btn.sm { height: 32px; padding: 0 12px; font-size: 13px; }
.btn.icon { width: 40px; padding: 0; }
.btn.sm.icon { width: 32px; }
.btn[disabled] { opacity: .5; pointer-events: none; }

.field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.field > span { font-size: 12px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.input, select.input, textarea.input {
  width: 100%; height: 42px; padding: 0 12px; border: 1px solid var(--line); border-radius: var(--radius-sm);
  background: var(--surface); outline: none; transition: border-color .15s, box-shadow .15s;
}
textarea.input { height: auto; min-height: 90px; padding: 10px 12px; resize: vertical; line-height: 1.5; }
.input:focus { border-color: var(--blue-2); box-shadow: 0 0 0 3px rgba(61, 80, 192, .14); }
.input[readonly], .input:disabled { background: var(--surface-2); color: var(--muted); }
select.input { appearance: none; padding-right: 32px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23636670' stroke-width='2.5'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; }
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.grid3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }

/* ---------- каркас */
.app { display: flex; min-height: 100vh; }
.sidebar {
  position: fixed; inset: 0 auto 0 0; width: var(--sidebar); padding: 22px 16px;
  background: linear-gradient(175deg, #1c2f80 0%, var(--blue) 45%, #2b47b4 100%); color: #fff;
  display: flex; flex-direction: column; gap: 6px; z-index: 20;
}
.brand { display: flex; align-items: baseline; gap: 8px; padding: 4px 10px 22px; }
.brand b { font-family: var(--head); font-weight: 500; font-size: 26px; letter-spacing: .06em; }
.brand small { font-family: var(--head); font-size: 10px; letter-spacing: .22em; opacity: .7; }
.nav a {
  display: flex; align-items: center; gap: 12px; padding: 11px 12px; border-radius: 12px;
  color: rgba(255, 255, 255, .78); font-weight: 700;
}
.nav a:hover { background: rgba(255, 255, 255, .08); color: #fff; }
.nav a.active { background: rgba(255, 255, 255, .16); color: #fff; }
.nav a .badge { margin-left: auto; }
.sidebar .me { margin-top: auto; display: flex; align-items: center; gap: 10px; padding: 12px 10px; border-top: 1px solid rgba(255, 255, 255, .15); cursor: pointer; }
.sidebar .me .avatar { background: rgba(255, 255, 255, .2); color: #fff; }
.main { flex: 1; margin-left: var(--sidebar); min-width: 0; }
.topbar {
  position: sticky; top: 0; z-index: 15; display: flex; align-items: center; gap: 12px;
  padding: 14px 28px; padding-top: calc(14px + var(--safe-t)); background: rgba(236, 238, 242, .86);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); border-bottom: 1px solid transparent;
}
.topbar.scrolled { border-bottom-color: var(--line); }
.topbar h1 { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.topbar .back { margin-left: -8px; }
.content { padding: 8px 28px 48px; max-width: 1280px; }
.bell { position: relative; }
.bell .dot { position: absolute; top: 4px; right: 4px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--orange); color: #fff; font-size: 11px; font-weight: 800; display: grid; place-items: center; border: 2px solid var(--ice); }
.tabbar { display: none; }
.fab { display: none; }

/* ---------- карточки */
.card { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); }
.card.pad { padding: 18px; }
.section { margin-top: 26px; }
.section-head { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.section-head h2 { flex: 1; }
.empty { padding: 28px 18px; text-align: center; color: var(--muted); }
.empty svg.i { width: 34px; height: 34px; stroke-width: 1.4; color: var(--line-2); display: block; margin: 0 auto 8px; }

.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.stat { padding: 16px 18px; border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); cursor: pointer; transition: transform .12s; }
.stat:hover { transform: translateY(-2px); }
.stat b { display: block; font-family: var(--head); font-size: 30px; font-weight: 500; line-height: 1.1; }
.stat span { font-size: 13px; color: var(--muted); font-weight: 700; }
.stat.hero { background: linear-gradient(135deg, var(--blue) 0%, var(--blue-2) 100%); color: #fff; }
.stat.hero span { color: rgba(255, 255, 255, .78); }
.stat.warn b { color: var(--orange); }

.dash-grid { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr); gap: 24px; align-items: start; }

/* ---------- пилюли статусов */
.pill { display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 10px; border-radius: 999px; font-size: 12px; font-weight: 800; white-space: nowrap; background: var(--ice-2); color: var(--muted); }
.pill::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.pill.nodot::before { display: none; }
.st-new, .st-planned { background: var(--ice-2); color: var(--muted); }
.st-in_progress { background: var(--blue-soft); color: var(--blue-2); }
.st-review { background: var(--amber-soft); color: var(--amber); }
.st-blocked, .st-paused { background: var(--orange-soft); color: var(--orange); }
.st-done { background: var(--green-soft); color: var(--green); }
.pr { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 800; white-space: nowrap; }
.pr i { width: 10px; height: 10px; border-radius: 3px; }
.pr-urgent { color: var(--orange); } .pr-urgent i { background: var(--orange); }
.pr-high { color: #c4672b; } .pr-high i { background: #f0a37a; }
.pr-medium { color: var(--blue-2); } .pr-medium i { background: #9aa6e3; }
.pr-low { color: var(--faint); } .pr-low i { background: var(--grey); }
.badge { min-width: 22px; height: 22px; padding: 0 7px; border-radius: 11px; background: var(--orange); color: #fff; font-size: 12px; font-weight: 800; display: inline-grid; place-items: center; }
.tag { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: 6px; background: var(--ice-2); color: var(--muted); font-size: 12px; font-weight: 700; }
.overdue { color: var(--orange) !important; font-weight: 800; }
.soon { color: var(--amber) !important; font-weight: 800; }

.avatar { width: 30px; height: 30px; border-radius: 50%; flex: none; display: grid; place-items: center; font-size: 12px; font-weight: 800; background: var(--blue-soft); color: var(--blue); }
.avatar.lg { width: 44px; height: 44px; font-size: 15px; }
.avatar.none { background: var(--ice-2); color: var(--faint); }

/* ---------- список задач */
.tlist { display: flex; flex-direction: column; }
.trow {
  position: relative; display: grid; grid-template-columns: minmax(0, 1fr) 150px 96px 128px; align-items: center; gap: 14px;
  padding: 13px 16px 13px 20px; border-bottom: 1px solid var(--line); cursor: pointer; background: var(--surface);
}
.tlist > .trow:first-child { border-top-left-radius: var(--radius); border-top-right-radius: var(--radius); }
.tlist > .trow:last-child { border-bottom: 0; border-bottom-left-radius: var(--radius); border-bottom-right-radius: var(--radius); }
.trow:hover { background: #fafbfd; }
.trow::before { content: ''; position: absolute; left: 0; top: 10px; bottom: 10px; width: 4px; border-radius: 0 4px 4px 0; background: var(--grey); }
.trow.p-urgent::before { background: var(--orange); }
.trow.p-high::before { background: #f0a37a; }
.trow.p-medium::before { background: #9aa6e3; }
.trow.is-done { opacity: .62; }
.trow.is-done .t-title { text-decoration: line-through; text-decoration-color: var(--faint); }
.t-title { font-weight: 800; }
.t-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; font-size: 13px; color: var(--muted); margin-top: 3px; }
.t-meta .i { width: 14px; height: 14px; }
.t-meta span { display: inline-flex; align-items: center; gap: 4px; }
.t-person { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 700; min-width: 0; }
.t-date { font-size: 13px; font-weight: 700; color: var(--muted); white-space: nowrap; }
.t-last { font-size: 13px; color: var(--muted); margin-top: 5px; padding-left: 10px; border-left: 2px solid var(--line); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.filters { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 14px; }
.filters .input { height: 38px; width: auto; min-width: 150px; }
.filters .search { flex: 1; min-width: 200px; position: relative; }
.filters .search .input { width: 100%; padding-left: 38px; }
.filters .search svg { position: absolute; left: 12px; top: 10px; color: var(--faint); }
.chips { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 14px; }
.chip { height: 34px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); font-weight: 700; font-size: 13px; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; }
.chip.on { background: var(--blue); border-color: var(--blue); color: #fff; }
.chip .n { opacity: .7; font-weight: 800; }

/* ---------- помещения */
.rooms { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 16px; }
.room { padding: 18px; border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); cursor: pointer; display: flex; flex-direction: column; gap: 12px; transition: transform .12s, box-shadow .12s; position: relative; overflow: hidden; }
.room:hover { transform: translateY(-2px); box-shadow: 0 2px 4px rgba(25, 28, 37, .05), 0 14px 32px rgba(25, 28, 37, .1); }
.room h3 { font-size: 16px; line-height: 1.3; }
.room .code { font-family: var(--head); font-size: 11px; letter-spacing: .1em; color: var(--blue-2); }
.room .now { font-size: 13px; color: var(--muted); }
.room .now b { color: var(--text); }
.room.archived { opacity: .55; }
.progress { height: 8px; border-radius: 4px; background: var(--ice-2); overflow: hidden; display: flex; }
.progress i { display: block; height: 100%; background: linear-gradient(90deg, var(--blue), var(--blue-2)); border-radius: 4px; transition: width .4s; }
.progress-row { display: flex; align-items: center; gap: 10px; font-size: 13px; font-weight: 800; color: var(--muted); }
.progress-row .progress { flex: 1; }
.order-btns { display: flex; gap: 4px; }

.room-head { padding: 22px; border-radius: var(--radius); color: #fff; background: radial-gradient(120% 140% at 100% 0%, #4a60d6 0%, var(--blue) 50%, #1a2c78 100%); box-shadow: var(--shadow); position: relative; overflow: hidden; }
.room-head::after { content: ''; position: absolute; right: -60px; top: -80px; width: 280px; height: 280px; border-radius: 50%; border: 36px solid rgba(255, 255, 255, .06); }
.room-head .code { font-family: var(--head); font-size: 12px; letter-spacing: .14em; opacity: .75; }
.room-head h1 { font-size: 26px; margin: 6px 0 10px; }
.room-head .meta { display: flex; flex-wrap: wrap; gap: 8px 18px; font-size: 14px; opacity: .9; }
.room-head .meta span { display: inline-flex; gap: 6px; align-items: center; }
.room-head .progress { background: rgba(255, 255, 255, .2); margin-top: 16px; }
.room-head .progress i { background: #fff; }
.room-head .btn { background: rgba(255, 255, 255, .14); border-color: rgba(255, 255, 255, .25); color: #fff; }
.room-head .btn:hover { background: rgba(255, 255, 255, .24); }
.room-head .desc { margin-top: 10px; opacity: .85; white-space: pre-wrap; max-width: 760px; }
.room-head > * { position: relative; z-index: 1; }

/* стадии — вертикальная шкала */
.stages { position: relative; display: flex; flex-direction: column; gap: 12px; }
.stage { display: grid; grid-template-columns: 44px minmax(0, 1fr); gap: 12px; }
.stage .num { position: relative; display: flex; justify-content: center; }
.stage .num b { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; font-family: var(--head); font-size: 13px; font-weight: 600; background: var(--surface); border: 2px solid var(--line-2); color: var(--muted); z-index: 1; margin-top: 12px; }
.stage .num::after { content: ''; position: absolute; top: 48px; bottom: -24px; width: 2px; background: var(--line); }
.stage:last-child .num::after { display: none; }
.stage.s-in_progress .num b { border-color: var(--blue-2); color: var(--blue-2); box-shadow: 0 0 0 4px var(--blue-soft); }
.stage.s-done .num b { background: var(--green); border-color: var(--green); color: #fff; }
.stage.s-paused .num b { border-color: var(--orange); color: var(--orange); }
.stage.s-done .num::after { background: #9fd6bf; }
.stage-card { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.stage-top { display: flex; align-items: flex-start; gap: 12px; padding: 14px 16px; cursor: pointer; }
.stage-top .t { font-weight: 800; font-size: 15px; }
.stage-top .t-meta { margin-top: 4px; }
.stage-body { border-top: 1px solid var(--line); padding: 10px 12px 12px; background: var(--surface-2); }
.stage-task { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 10px; background: var(--surface); margin-bottom: 6px; cursor: pointer; border: 1px solid var(--line); }
.stage-task:hover { border-color: var(--blue-2); }
.stage-task .check { width: 20px; height: 20px; border-radius: 6px; border: 2px solid var(--line-2); flex: none; display: grid; place-items: center; }
.stage-task.done .check { background: var(--green); border-color: var(--green); color: #fff; }
.stage-task.done .check svg { width: 13px; height: 13px; stroke-width: 3; }
.stage-task.done .ttl { text-decoration: line-through; color: var(--muted); }
.stage-task .ttl { flex: 1; min-width: 0; font-weight: 700; font-size: 14px; }
.chev { transition: transform .2s; color: var(--faint); }
.open > .stage-top .chev { transform: rotate(180deg); }

/* ---------- выезжающая панель */
.scrim { position: fixed; inset: 0; background: rgba(15, 20, 45, .38); z-index: 40; opacity: 0; transition: opacity .2s; }
.scrim.show { opacity: 1; }
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; width: min(620px, 100%); background: var(--ice); z-index: 41;
  display: flex; flex-direction: column; box-shadow: var(--shadow-lg); transform: translateX(100%); transition: transform .26s cubic-bezier(.2, .8, .2, 1);
}
.drawer.show { transform: none; }
.drawer-head { display: flex; align-items: center; gap: 10px; padding: 14px 18px; padding-top: calc(14px + var(--safe-t)); background: var(--surface); border-bottom: 1px solid var(--line); }
.drawer-head .crumbs { flex: 1; min-width: 0; font-size: 13px; color: var(--muted); font-weight: 700; }
.drawer-body > * { flex-shrink: 0; }
.drawer-body { flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch; padding: 18px; display: flex; flex-direction: column; gap: 16px; }
.title-edit { width: 100%; border: 0; background: transparent; font-family: var(--head); font-size: 20px; font-weight: 600; line-height: 1.3; resize: none; outline: none; padding: 4px 0; border-radius: 6px; }
.title-edit:focus { background: var(--surface); box-shadow: 0 0 0 2px var(--blue-soft); padding: 4px 8px; }
.props { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px; display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.props .full { grid-column: 1 / -1; }
.link-box { display: flex; gap: 8px; }
.link-box .input { flex: 1; }
.doc-link { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: var(--radius-sm); background: var(--blue-soft); color: var(--blue); font-weight: 800; font-size: 14px; word-break: break-all; }
.doc-link svg { flex: none; }

.tabs { display: flex; gap: 4px; padding: 4px; background: var(--ice-2); border-radius: 999px; align-self: flex-start; }
.tabs button { border: 0; background: transparent; height: 32px; padding: 0 14px; border-radius: 999px; font-weight: 800; font-size: 13px; color: var(--muted); cursor: pointer; }
.tabs button.on { background: var(--surface); color: var(--text); box-shadow: 0 1px 3px rgba(0, 0, 0, .08); }

.feed { display: flex; flex-direction: column; gap: 10px; }
.cmt { display: flex; gap: 10px; align-items: flex-start; }
.cmt .bubble { flex: 1; min-width: 0; background: var(--surface); border-radius: 4px 14px 14px 14px; padding: 10px 14px; box-shadow: 0 1px 2px rgba(0, 0, 0, .05); }
.cmt.mine { flex-direction: row-reverse; }
.cmt.mine .bubble { background: var(--blue-soft); border-radius: 14px 4px 14px 14px; }
.cmt .who { display: flex; align-items: baseline; gap: 8px; font-size: 13px; margin-bottom: 3px; }
.cmt .who b { font-weight: 800; }
.cmt .who time { color: var(--faint); font-size: 12px; margin-left: auto; }
.cmt .txt { white-space: pre-wrap; word-wrap: break-word; }
.cmt .txt a { word-break: break-all; }
.hist { display: flex; gap: 10px; font-size: 13px; color: var(--muted); padding: 2px 4px 2px 10px; align-items: baseline; }
.hist::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: var(--line-2); flex: none; transform: translateY(-1px); }
.hist b { color: var(--text); font-weight: 800; }
.hist time { margin-left: auto; color: var(--faint); font-size: 12px; white-space: nowrap; padding-left: 8px; }
.composer { background: var(--surface); border-top: 1px solid var(--line); padding: 12px 18px; padding-bottom: calc(12px + var(--safe-b)); display: flex; gap: 10px; align-items: flex-end; }
.composer textarea { flex: 1; min-height: 42px; max-height: 160px; height: 42px; resize: none; padding: 10px 12px; }

/* ---------- модальные окна */
.modal-wrap { position: fixed; inset: 0; z-index: 60; display: grid; place-items: center; padding: 16px; background: rgba(15, 20, 45, .42); }
.modal { width: min(560px, 100%); max-height: calc(100vh - 32px); overflow-y: auto; background: var(--ice); border-radius: 20px; box-shadow: var(--shadow-lg); }
.modal-head { display: flex; align-items: center; gap: 10px; padding: 18px 20px 6px; }
.modal-head h3 { flex: 1; font-size: 17px; }
.modal-body { padding: 12px 20px; display: flex; flex-direction: column; gap: 14px; }
.modal-foot { padding: 12px 20px 20px; display: flex; gap: 10px; justify-content: flex-end; }
.check-row { display: flex; align-items: center; gap: 10px; font-weight: 700; cursor: pointer; }
.check-row input { width: 18px; height: 18px; accent-color: var(--blue); }

/* ---------- уведомления */
.notif-panel { position: fixed; top: 64px; right: 20px; width: min(420px, calc(100vw - 24px)); max-height: min(620px, calc(100vh - 90px)); z-index: 50; background: var(--surface); border-radius: 18px; box-shadow: var(--shadow-lg); display: flex; flex-direction: column; overflow: hidden; }
.notif-panel .head { display: flex; align-items: center; padding: 14px 16px; border-bottom: 1px solid var(--line); gap: 8px; }
.notif-panel .head h3 { flex: 1; }
.notif-panel .list { overflow-y: auto; }
.notif { display: flex; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--line); cursor: pointer; }
.notif:hover { background: var(--surface-2); }
.notif.unread { background: #f4f6fd; }
.notif .ico { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; background: var(--blue-soft); color: var(--blue); flex: none; }
.notif .ico.k-overdue, .notif .ico.k-deadline { background: var(--orange-soft); color: var(--orange); }
.notif .ico.k-comment { background: var(--green-soft); color: var(--green); }
.notif b { display: block; font-size: 14px; }
.notif p { margin: 2px 0 0; font-size: 13px; color: var(--muted); overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.notif time { font-size: 12px; color: var(--faint); }

.toast { position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%) translateY(20px); z-index: 80; background: #161a2a; color: #fff; padding: 11px 18px; border-radius: 12px; font-weight: 700; font-size: 14px; opacity: 0; transition: .2s; pointer-events: none; max-width: calc(100vw - 32px); }
.toast.show { opacity: 1; transform: translateX(-50%); }
.toast.err { background: var(--orange); }

/* ---------- вход */
.login {
  min-height: 100vh; display: grid; place-items: center; padding: 24px;
  background: radial-gradient(90% 70% at 85% 10%, rgba(61, 80, 192, .35) 0%, transparent 60%),
    radial-gradient(70% 60% at 10% 90%, rgba(35, 62, 159, .28) 0%, transparent 60%),
    linear-gradient(160deg, #f4f5f8 0%, #dfe2e9 100%);
}
.login-card { width: min(400px, 100%); background: rgba(255, 255, 255, .78); backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px); border-radius: 24px; padding: 32px 28px; box-shadow: var(--shadow-lg); border: 1px solid rgba(255, 255, 255, .8); }
.login-card .wm { font-family: var(--head); font-weight: 500; font-size: 44px; letter-spacing: .08em; color: var(--blue); line-height: 1; }
.login-card .sub { font-family: var(--head); font-size: 10px; letter-spacing: .26em; color: var(--muted); margin: 8px 0 26px; }
.login-card .err { color: var(--orange); font-weight: 700; font-size: 14px; min-height: 20px; }

.kv { display: grid; grid-template-columns: 140px 1fr; gap: 8px 14px; font-size: 14px; }
.kv dt { color: var(--muted); font-weight: 700; }
.kv dd { margin: 0; }
.ulist .urow { display: grid; grid-template-columns: minmax(0, 1fr) 130px 110px 90px; align-items: center; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--line); cursor: pointer; }
.ulist .urow:last-child { border-bottom: 0; }
.ulist .urow:hover { background: var(--surface-2); }
.ulist .urow.off { opacity: .5; }
.act { display: flex; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--line); font-size: 14px; cursor: pointer; }
.act:last-child { border-bottom: 0; }
.act .grow p { margin: 2px 0 0; color: var(--muted); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.act time { font-size: 12px; color: var(--faint); white-space: nowrap; }
.mini-room { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); cursor: pointer; }
.mini-room:last-child { border-bottom: 0; }
.install-hint { background: var(--blue-soft); color: var(--blue); padding: 12px 14px; border-radius: var(--radius-sm); font-size: 14px; font-weight: 600; }

/* ---------- мобильная версия */
@media (max-width: 900px) {
  .sidebar { display: none; }
  .main { margin-left: 0; }
  .topbar { padding: 12px 16px; padding-top: calc(12px + var(--safe-t)); }
  .topbar h1 { font-size: 18px; }
  .content { padding: 4px 14px calc(96px + var(--safe-b)); }
  .tabbar {
    display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; background: rgba(255, 255, 255, .94);
    backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); border-top: 1px solid var(--line); padding-bottom: var(--safe-b);
  }
  .tabbar a { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 9px 0 8px; font-size: 11px; font-weight: 800; color: var(--faint); position: relative; }
  .tabbar a.active { color: var(--blue); }
  .tabbar a svg.i { width: 22px; height: 22px; }
  .tabbar a .badge { position: absolute; top: 4px; left: 54%; min-width: 18px; height: 18px; font-size: 10px; }
  .fab { display: grid; place-items: center; position: fixed; right: 16px; bottom: calc(76px + var(--safe-b)); z-index: 29; width: 56px; height: 56px; border-radius: 18px; background: var(--blue); color: #fff; border: 0; box-shadow: 0 10px 24px rgba(35, 62, 159, .4); }
  .fab svg.i { width: 26px; height: 26px; }
  .hide-m { display: none !important; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .stat b { font-size: 26px; }
  .dash-grid { grid-template-columns: minmax(0, 1fr); gap: 0; }
  .trow { grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: 'main status' 'main date'; padding: 12px 14px 12px 18px; gap: 6px 10px; }
  .trow .c-main { grid-area: main; }
  .trow .c-person { display: none; }
  .trow .c-date { grid-area: date; text-align: right; }
  .trow .c-status { grid-area: status; justify-self: end; }
  .trow .m-person { display: inline-flex !important; }
  .filters .input { min-width: 0; flex: 1 1 45%; }
  .filters .search { flex-basis: 100%; }
  .drawer { width: 100%; }
  .props, .grid2, .grid3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .rooms { grid-template-columns: 1fr; }
  .room-head h1 { font-size: 21px; }
  .stage { grid-template-columns: 34px minmax(0, 1fr); gap: 8px; }
  .stage .num b { width: 30px; height: 30px; font-size: 12px; }
  .stage .num::after { top: 42px; }
  .ulist .urow { grid-template-columns: minmax(0, 1fr) auto; }
  .ulist .urow .hide-m { display: none; }
  .modal-wrap { align-items: end; padding: 0; }
  .modal { border-radius: 20px 20px 0 0; max-height: 92vh; padding-bottom: var(--safe-b); }
  .notif-panel { top: auto; bottom: 0; right: 0; left: 0; width: 100%; max-height: 80vh; border-radius: 20px 20px 0 0; padding-bottom: var(--safe-b); }
  .kv { grid-template-columns: 110px 1fr; }
}
@media (max-width: 420px) {
  .props, .grid2, .grid3 { grid-template-columns: minmax(0, 1fr); }
  .props .field.full { grid-column: auto; }
}
@media (max-width: 360px) {
  .stat b { font-size: 22px; }
  .stat { padding: 12px 14px; }
  .chip { padding: 0 11px; }
}
/* страховка: страница никогда не скроллится вбок */
.app { overflow-x: clip; }
.main, .content, .section, .card, .stage-card { min-width: 0; }
.m-person { display: none !important; }

/* задачи на несколько помещений */
.room-checks { max-height: 260px; overflow-y: auto; border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 6px 10px; background: var(--surface); display: flex; flex-direction: column; gap: 2px; }
.room-checks .check-row { padding: 6px 2px; font-weight: 600; }
.troom-box { gap: 8px !important; }
.troom-list { display: flex; flex-direction: column; gap: 6px; }
.troom { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); font-weight: 700; font-size: 14px; min-width: 0; }
.troom a { color: var(--text); }
.troom.all-done { color: var(--green); border-color: #bfe5d3; background: var(--green-soft); }
.troom.is-done { background: var(--surface-2); color: var(--muted); font-weight: 600; }
.troom-done summary { cursor: pointer; font-size: 13px; font-weight: 800; color: var(--muted); padding: 4px 0; }
.troom-done .troom { margin-top: 6px; }
.rooms-mini { display: inline-flex; align-items: center; gap: 6px; }
.rooms-mini i { display: inline-block; width: 46px; height: 5px; border-radius: 3px; background: var(--ice-2); overflow: hidden; }
.rooms-mini i b { display: block; height: 100%; background: var(--green); }
.t-rooms-left { font-size: 13px; color: var(--muted); margin-top: 4px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: flex; align-items: center; gap: 4px; }
.t-rooms-left .i { width: 14px; height: 14px; }
button.check { padding: 0; background: var(--surface); cursor: pointer; }
button.check:hover:not([disabled]) { border-color: var(--green); }
button.check[disabled] { cursor: default; opacity: .6; }
.stage-task.done button.check { background: var(--green); border-color: var(--green); color: #fff; }
.stage-task.done button.check svg { width: 13px; height: 13px; stroke-width: 3; }
.shared-list { padding: 10px 12px; }
.stage-task.done .shared-ttl { text-decoration: none; }
.stage-task.done .shared-ttl .tt { text-decoration: line-through; }
.shared-list .stage-task:last-child { margin-bottom: 0; }

/* компактный список (обзор) */
@media (min-width: 901px) {
  .tlist.compact .trow { grid-template-columns: minmax(0, 1fr) 30px auto 118px; }
  .tlist.compact .t-person span { display: none; }
  .tlist.compact .c-status { justify-self: end; }
}
