/* DataNet web — same visual language as prototype v0.2: navy rail + work surface, teal accent.
   Fonts: system stack (self-hosted IBM Plex / Noto Sans Armenian come with the design system in Sprint 2). */
:root {
  --bg: #f3f5f7; --surface: #fff; --surface-2: #eef1f4; --line: #d9e0e6; --fg: #132130; --muted: #5a6b7b;
  --accent: #0d7480; --accent-fg: #fff; --accent-soft: #dff0f1;
  --good: #1d7f47; --good-soft: #e1f2e8; --warn: #a46a10; --warn-soft: #f8ecd6; --crit: #b73a33; --crit-soft: #f8e1df; --info: #2a5f9e; --info-soft: #e2ebf6;
  --side-bg: #0f1d2c; --side-fg: #b9c8d6; --side-dim: #6f8396; --side-active: #1b3045; --side-hi: #3fb3bd;
  --font: "IBM Plex Sans", "Noto Sans Armenian", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;
  --r: 8px; --shadow: 0 1px 2px rgba(15,29,44,.06), 0 6px 20px rgba(15,29,44,.08);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) {
  --bg: #0b141e; --surface: #111d29; --surface-2: #172635; --line: #23364a; --fg: #e3ebf2; --muted: #8fa2b4;
  --accent: #3fb3bd; --accent-fg: #06222a; --accent-soft: #123540;
  --good: #45c07c; --good-soft: #123326; --warn: #e2a744; --warn-soft: #3a2c12; --crit: #f07068; --crit-soft: #3d1a18; --info: #6aa2e6; --info-soft: #15283f;
  --side-bg: #070f17; --side-active: #13283a; --shadow: 0 1px 2px rgba(0,0,0,.3), 0 8px 24px rgba(0,0,0,.35); color-scheme: dark; } }
:root[data-theme="dark"] {
  --bg: #0b141e; --surface: #111d29; --surface-2: #172635; --line: #23364a; --fg: #e3ebf2; --muted: #8fa2b4;
  --accent: #3fb3bd; --accent-fg: #06222a; --accent-soft: #123540;
  --good: #45c07c; --good-soft: #123326; --warn: #e2a744; --warn-soft: #3a2c12; --crit: #f07068; --crit-soft: #3d1a18; --info: #6aa2e6; --info-soft: #15283f;
  --side-bg: #070f17; --side-active: #13283a; color-scheme: dark; }

* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--fg); font: 14px/1.45 var(--font); }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--accent); }
.num { font-family: var(--mono); font-variant-numeric: tabular-nums; white-space: nowrap; }

/* shell */
.shell { display: grid; grid-template-columns: 232px 1fr; min-height: 100vh; }
.rail { background: var(--side-bg); color: var(--side-fg); padding: 16px 10px; display: flex; flex-direction: column; gap: 4px; }
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 14px; color: #fff; font-weight: 800; font-size: 18px; letter-spacing: -.01em; }
.rail-section { color: var(--side-dim); font-size: 11px; text-transform: uppercase; letter-spacing: .06em; padding: 12px 10px 4px; }
.nav-item { display: flex; align-items: center; justify-content: flex-start; gap: 10px; width: 100%; text-align: left; border: 0; background: none; color: var(--side-fg); padding: 8px 10px; border-radius: 6px; cursor: pointer; }
.nav-group { display: flex; flex-direction: column; gap: 2px; }
.nav-group-title { color: var(--side-dim); font-size: 11px; text-transform: uppercase; letter-spacing: .06em; padding: 12px 10px 2px; }
.nav-item:hover { background: var(--side-active); }
.nav-item svg { flex: none; opacity: .75; }
.nav-item[aria-current="page"] svg { opacity: 1; color: var(--side-hi); }
.nav-item[aria-current="page"] { background: var(--side-active); color: #fff; box-shadow: inset 3px 0 0 var(--side-hi); }
.nav-count { background: var(--side-hi); color: #06222a; border-radius: 10px; padding: 0 7px; font-size: 12px; font-weight: 600; }
.main { min-width: 0; display: flex; flex-direction: column; }
.topbar { display: flex; align-items: center; gap: 10px; padding: 10px 20px; background: var(--surface); border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.topbar .spacer { flex: 1; }
.badge-demo { background: var(--warn-soft); color: var(--warn); border-radius: 4px; padding: 2px 8px; font-size: 11px; font-weight: 700; letter-spacing: .05em; }
.badge-ro { background: var(--info-soft); color: var(--info); border-radius: 4px; padding: 2px 8px; font-size: 12px; font-weight: 600; }
.ctl { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: 12px; }
.ctl select { background: var(--surface-2); border: 1px solid var(--line); border-radius: 6px; padding: 5px 8px; max-width: 260px; }
.lang { display: inline-flex; border: 1px solid var(--line); border-radius: 6px; overflow: hidden; }
.lang button { border: 0; background: var(--surface); padding: 5px 10px; cursor: pointer; font-weight: 600; font-size: 12px; }
.lang button[aria-pressed="true"] { background: var(--accent); color: var(--accent-fg); }
.content { padding: 20px; max-width: 1280px; width: 100%; }

/* surfaces */
h1 { font-size: 22px; margin: 0 0 4px; }
h2 { font-size: 16px; margin: 0 0 10px; }
.sub { color: var(--muted); margin: 0 0 16px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 16px; margin-bottom: 16px; }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin-bottom: 16px; }
.kpi { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 12px 14px; min-width: 0; }
.kpi .label { color: var(--muted); font-size: 12px; overflow-wrap: anywhere; }
.kpi .value { font-size: 19px; font-weight: 600; margin-top: 2px; }
.note { background: var(--info-soft); color: var(--info); border-radius: 6px; padding: 10px 12px; margin-bottom: 14px; }
.alert { background: var(--crit-soft); color: var(--crit); border-radius: 6px; padding: 10px 12px; margin: 0 0 14px; }
.warn { background: var(--warn-soft); color: var(--warn); border-radius: 6px; padding: 8px 10px; font-size: 13px; }
.ok { background: var(--good-soft); color: var(--good); border-radius: 6px; padding: 8px 10px; }

/* tables */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th { text-align: left; font-size: 12px; color: var(--muted); font-weight: 600; padding: 8px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
td { padding: 9px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
td.r, th.r { text-align: right; }
tr.click { cursor: pointer; }
tr.click td:first-child { color: var(--accent); font-weight: 600; text-decoration: underline; text-underline-offset: 3px; }
.steps { list-style: none; display: flex; flex-wrap: wrap; gap: 8px; padding: 0; margin: 0 0 16px; }
.steps li { flex: 1 1 140px; border: 1px solid var(--line); border-radius: var(--r); padding: 8px 10px; background: var(--surface); font-size: 13px; }
.steps li b { display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: var(--surface-2); margin-right: 4px; }
.steps li.done { border-color: var(--good); }
.steps li.done b { background: var(--good-soft); color: var(--good); }
.steps li.next { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-soft); }
.steps li.next b { background: var(--accent); color: var(--accent-fg); }
tr.click:hover td { background: var(--surface-2); }
.bar { height: 6px; background: var(--surface-2); border-radius: 3px; overflow: hidden; min-width: 80px; }
.bar > span { display: block; height: 100%; background: var(--accent); }

/* status pills */
.pill { display: inline-block; border-radius: 10px; padding: 1px 9px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.pill.approved, .pill.signed, .pill.active, .pill.balanced { background: var(--good-soft); color: var(--good); }
.pill.submitted, .pill.sent, .pill.preview, .pill.trial { background: var(--info-soft); color: var(--info); }
.pill.draft, .pill.planned { background: var(--surface-2); color: var(--muted); }
.pill.warn { background: var(--warn-soft); color: var(--warn); }
.tickets { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 10px; }
.card.ticket { display: block; padding: 12px; color: inherit; text-decoration: none; }
.card.ticket:hover { border-color: var(--accent); }
.timeline { list-style: none; padding: 0; margin: 0 0 8px; }
.timeline li { padding: 6px 0; border-bottom: 1px solid var(--line); }
.pill.rejected, .pill.suspended, .pill.unbalanced { background: var(--crit-soft); color: var(--crit); }

/* buttons & forms */
.btn { border: 1px solid var(--line); background: var(--surface); border-radius: 6px; padding: 7px 12px; cursor: pointer; font-weight: 500; white-space: nowrap; }
.btn:hover:not(:disabled) { border-color: var(--accent); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-fg); }
.btn.danger { color: var(--crit); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.field { display: flex; flex-direction: column; gap: 4px; margin-bottom: 10px; }
.field label { font-size: 12px; color: var(--muted); }
.field input, .field select, .field textarea { border: 1px solid var(--line); background: var(--surface); border-radius: 6px; padding: 8px 10px; }
.report { border: 1px solid var(--line); border-radius: var(--r); padding: 12px; margin-bottom: 10px; background: var(--surface); }
.report-head { display: flex; justify-content: space-between; gap: 8px; flex-wrap: wrap; margin-bottom: 6px; }
.muted { color: var(--muted); }
.toast { position: fixed; right: 16px; bottom: 16px; max-width: 420px; background: var(--fg); color: var(--bg); padding: 10px 14px; border-radius: 8px; box-shadow: var(--shadow); z-index: 10; }
.toast.err { background: var(--crit); color: #fff; }

/* login */
.login { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.login-card { width: 100%; max-width: 520px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 24px; box-shadow: var(--shadow); }
.users { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 8px; }
.user-btn { text-align: left; border: 1px solid var(--line); background: var(--surface-2); border-radius: 8px; padding: 8px 10px; cursor: pointer; }
.user-btn:hover { border-color: var(--accent); }
/* passkeys (Face ID / Touch ID) */
.passkey-btn { width: 100%; margin-top: 12px; display: flex; align-items: center; justify-content: center; gap: 8px; padding: 10px 12px; }
.passkey-nudge { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.passkey-nudge > span { flex: 1 1 calc(100% - 40px); }
.linkish { background: none; border: 0; padding: 0; cursor: pointer; font: inherit; color: var(--muted); text-decoration: underline dotted; text-underline-offset: 3px; }
.linkish:hover { color: var(--fg); }
button.m-user { background: none; border: 0; padding: 0; text-align: left; font: inherit; color: inherit; cursor: pointer; }
.m-user .m-user-link { color: var(--accent); font-size: 13px; margin-top: 2px; }
.user-btn b { display: block; font-size: 13px; }
.user-btn span { font-size: 12px; color: var(--muted); overflow-wrap: anywhere; }

/* start here */
.start-steps { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.start-steps li { display: flex; align-items: center; gap: 14px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; }
.start-steps li.next { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-soft); }
.start-steps li.done { opacity: .75; }
.start-mark { flex: none; width: 30px; height: 30px; border-radius: 15px; display: grid; place-items: center; font-weight: 700; background: var(--surface-2); color: var(--muted); }
.start-steps li.done .start-mark { background: var(--good-soft); color: var(--good); }
.start-steps li.next .start-mark { background: var(--accent); color: var(--accent-fg); }
.start-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.start-body .muted { font-size: 13px; }

/* refresh */
.app-only { display: none; }
@media (display-mode: standalone), (display-mode: window-controls-overlay) { .app-only { display: grid; } }
.ptr { position: fixed; z-index: 60; top: calc(56px + env(safe-area-inset-top)); left: 50%; width: 40px; height: 40px; border-radius: 20px; background: var(--surface); box-shadow: var(--shadow); display: grid; place-items: center; pointer-events: none; }
.ptr-icon { font-size: 22px; color: var(--muted); }
.ptr-icon.ready { color: var(--accent); font-weight: 700; }
.update-bar { position: fixed; z-index: 55; left: 50%; transform: translateX(-50%); bottom: 20px; display: flex; align-items: center; gap: 12px; background: var(--side-bg); color: #fff; padding: 10px 12px 10px 16px; border-radius: 14px; box-shadow: var(--shadow); max-width: calc(100vw - 32px); }
@media (max-width: 860px) { .update-bar { bottom: calc(76px + env(safe-area-inset-bottom)); } }

/* equipment */
.qty-input { width: 80px; text-align: right; padding: 4px 6px; }
.eq-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 8px; }
.eq-cell { display: flex; align-items: center; justify-content: space-between; gap: 10px; border: 1px solid var(--line); border-radius: 10px; padding: 6px 6px 6px 12px; background: var(--surface); }
.eq-cell input { width: 84px; text-align: right; }
.eq-chip { margin: 2px 4px 2px 0; color: var(--fg); }

/* partners */
.plain-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }

/* tasks */
.board { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; align-items: start; }
.board-col { background: var(--surface-2); border: 1px solid var(--line); border-radius: 12px; padding: 10px; min-height: 160px; display: flex; flex-direction: column; gap: 8px; }
.board-col h2 { font-size: 13px; text-transform: uppercase; letter-spacing: .05em; margin: 2px 4px 4px; color: var(--muted); }
.board-empty { font-size: 13px; margin: 4px; }
/* CRM pipeline: columns side by side; on a phone one column at a time, swiped sideways */
.pipeline { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(250px, 1fr); gap: 12px; overflow-x: auto; padding-bottom: 8px; }
@media (max-width: 860px) {
  .pipeline { grid-auto-columns: 85%; scroll-snap-type: x mandatory; -webkit-overflow-scrolling: touch; }
  .pipeline > section { scroll-snap-align: start; min-width: 0; }
}
.task-card { display: block; background: var(--surface); border: 1px solid var(--line); border-left: 3px solid transparent; border-radius: 10px; padding: 10px 12px; cursor: pointer; color: inherit; text-decoration: none; }
.task-card:hover { border-color: var(--accent); }
.task-card.prio-urgent { border-left-color: var(--crit); }
.task-card.prio-high { border-left-color: var(--warn); }
.task-title { font-weight: 600; overflow-wrap: anywhere; }
.task-meta { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-top: 6px; font-size: 12px; }
.task-meta .spacer { flex: 1; }
.chip { display: inline-block; border: 1px solid var(--line); border-radius: 10px; padding: 0 8px; font-size: 12px; color: var(--muted); text-decoration: none; white-space: nowrap; }
.avatar { width: 26px; height: 26px; border-radius: 13px; background: var(--accent-soft); color: var(--accent); display: inline-grid; place-items: center; font-size: 11px; font-weight: 700; flex: none; }
.task-next { padding: 2px 10px; min-height: 0; }
.task-form { padding: 16px; margin-bottom: 16px; display: flex; flex-wrap: wrap; gap: 10px; }
.task-quick { flex-wrap: wrap; gap: 8px; margin: 10px 0; align-items: flex-end; }
.linked-list { display: flex; flex-direction: column; gap: 8px; margin-top: 10px; }
.col-pick { display: none; }
.kpi-link { display: flex; flex-direction: column; gap: 4px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 12px 16px; color: inherit; text-decoration: none; min-width: 120px; }
.kpi-link b { font-size: 24px; }
.today-sec { margin-top: 20px; }
.today-sec h2 { font-size: 15px; margin: 0; }

/* chat */
.chat { display: grid; grid-template-columns: 320px minmax(0, 1fr); gap: 0; height: calc(100vh - 104px); min-height: 480px; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; overflow: hidden; }
.chat-list { border-right: 1px solid var(--line); display: flex; flex-direction: column; min-height: 0; }
.chat-list-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 12px 12px 8px 16px; }
.chat-list-head h1 { margin: 0; font-size: 20px; }
.chat-search { margin: 0 12px 8px; }
.chat-rooms { overflow-y: auto; padding: 0 6px 8px; gap: 2px; }
.chat-room { display: flex; align-items: center; gap: 10px; padding: 10px; border-radius: 10px; color: inherit; text-decoration: none; }
.chat-room:hover { background: var(--surface-2); }
.chat-room.on { background: var(--accent-soft); }
.chat-room-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.chat-room-top { display: flex; justify-content: space-between; gap: 8px; }
.chat-room-top b { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-room-top .muted { font-size: 12px; flex: none; }
.chat-room-last { font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.avatar.group { background: var(--surface-2); color: var(--muted); }
.avatar { width: 34px; height: 34px; border-radius: 17px; }
.task-meta .avatar { width: 26px; height: 26px; }
.nav-count.muted-count { background: var(--line); color: var(--muted); }
.chat-new { padding: 0 12px 12px; display: flex; flex-direction: column; gap: 8px; min-height: 0; overflow-y: auto; }
.chat-people { gap: 2px; }
.chat-person { display: flex; align-items: center; gap: 10px; width: 100%; border: 0; background: none; color: inherit; padding: 8px; border-radius: 10px; cursor: pointer; text-align: left; }
.chat-person:hover { background: var(--surface-2); }
.chat-person .muted { margin-left: auto; font-size: 12px; }
.chat-placeholder { display: grid; place-items: center; padding: 24px; text-align: center; }
.chat-conv { display: flex; flex-direction: column; min-height: 0; min-width: 0; }
.chat-head { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-bottom: 1px solid var(--line); }
.chat-head-title { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.chat-head-title b { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-back { display: none; }
.link-btn { border: 0; background: none; padding: 0; color: var(--accent); cursor: pointer; font: inherit; text-align: left; }
.link-btn.muted { color: var(--muted); font-size: 12px; }
.link-btn.danger, .chat-menu .danger { color: var(--crit); }
.chat-members { padding: 10px 14px; border-bottom: 1px solid var(--line); background: var(--surface-2); display: flex; flex-direction: column; gap: 8px; }
.chat-msgs { flex: 1; overflow-y: auto; padding: 14px; display: flex; flex-direction: column; gap: 6px; background: var(--bg); }
.chat-earlier { align-self: center; }
.chat-empty { text-align: center; margin: auto; }
.chat-row { display: flex; }
.chat-row.mine { justify-content: flex-end; }
.bubble { position: relative; max-width: min(560px, 82%); background: var(--surface); border: 1px solid var(--line); border-radius: 14px 14px 14px 4px; padding: 8px 12px 6px; overflow-wrap: anywhere; }
.chat-row.mine .bubble { background: var(--accent-soft); border-color: transparent; border-radius: 14px 14px 4px 14px; }
.bubble.deleted { opacity: .7; }
.chat-author { font-size: 12px; font-weight: 700; color: var(--accent); margin-bottom: 2px; }
.chat-body { white-space: pre-wrap; }
.chat-meta { font-size: 11px; color: var(--muted); text-align: right; margin-top: 2px; }
.chat-quote { display: flex; flex-direction: column; border-left: 3px solid var(--accent); padding: 2px 8px; margin-bottom: 4px; font-size: 13px; background: rgba(13,116,128,.06); border-radius: 4px; }
.chat-quote span { color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-more { position: absolute; top: 2px; right: 4px; border: 0; background: none; color: var(--muted); cursor: pointer; opacity: 0; font-size: 16px; line-height: 1; padding: 2px 4px; }
.bubble:hover .chat-more, .chat-more:focus { opacity: 1; }
.chat-menu { position: absolute; z-index: 5; top: 24px; right: 4px; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow); display: flex; flex-direction: column; min-width: 170px; padding: 4px; }
.chat-menu button { border: 0; background: none; color: var(--fg); text-align: left; padding: 8px 10px; border-radius: 8px; cursor: pointer; }
.chat-menu button:hover { background: var(--surface-2); }
.chat-files { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.chat-img { border: 0; padding: 0; background: none; cursor: zoom-in; border-radius: 8px; overflow: hidden; }
.chat-img img, .chat-img-ph { display: block; width: 180px; height: 140px; object-fit: cover; background: var(--surface-2); }
.chat-file { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); background: var(--surface); color: var(--fg); border-radius: 8px; padding: 6px 10px; cursor: pointer; max-width: 100%; }
.chat-file span:nth-child(2) { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-file .muted { font-size: 12px; }
.chat-compose { border-top: 1px solid var(--line); padding: 8px 10px; display: flex; flex-direction: column; gap: 6px; background: var(--surface); }
.compose-quote { flex-direction: row; align-items: center; gap: 8px; }
.compose-quote span { flex: 1; }
.chat-pending { display: flex; flex-wrap: wrap; gap: 6px; }
.chat-input { display: flex; align-items: flex-end; gap: 6px; }
.chat-input textarea { flex: 1; resize: none; min-height: 40px; max-height: 160px; field-sizing: content; border-radius: 20px; padding: 9px 14px; }
.chat-attach { cursor: pointer; }
.tab-icon { position: relative; display: inline-block; }
.tab-dot { position: absolute; top: -4px; right: -6px; min-width: 16px; height: 16px; padding: 0 4px; border-radius: 8px; background: var(--crit); color: #fff; font-size: 10px; line-height: 16px; font-weight: 700; box-sizing: border-box; }
.tab-dot:empty { min-width: 10px; width: 10px; height: 10px; padding: 0; top: -2px; right: -2px; }

/* Excel import */
.imp-steps { margin: 12px 0 0; padding-left: 20px; display: flex; flex-direction: column; gap: 12px; }
.crit-text { color: var(--crit); font-size: 13px; }

/* notifications */
.bell { position: relative; width: 40px; height: 40px; display: grid; place-items: center; border-radius: 20px; border: 1px solid var(--line); background: var(--surface); color: var(--fg); cursor: pointer; }
.bell.light { border-color: rgba(255,255,255,.18); background: rgba(255,255,255,.06); color: #fff; width: 36px; height: 36px; flex: none; }
.bell-count { position: absolute; top: -4px; right: -4px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--crit); color: #fff; font-size: 11px; font-weight: 700; line-height: 18px; text-align: center; box-sizing: border-box; }
.ntf-backdrop { position: fixed; inset: 0; z-index: 40; background: rgba(15,29,44,.18); }
.ntf-panel { position: fixed; z-index: 41; top: 60px; right: 16px; width: min(400px, calc(100vw - 32px)); max-height: min(70vh, 640px); display: flex; flex-direction: column;
  background: var(--surface); color: var(--fg); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow); overflow: hidden; font-size: 14px; font-weight: 400; }
.ntf-head { display: flex; align-items: center; gap: 8px; padding: 10px 10px 10px 16px; border-bottom: 1px solid var(--line); }
.ntf-head b { flex: 1; min-width: 0; font-size: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ntf-head .btn { flex: none; font-size: 12px; padding: 5px 10px; }
.ntf-head .m-close { flex: none; }
.ntf-head .m-close { width: 36px; height: 36px; border-radius: 18px; border: 1px solid var(--line); background: var(--surface); color: var(--fg); display: grid; place-items: center; cursor: pointer; }
.ntf-tg { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; padding: 10px 16px; border-bottom: 1px solid var(--line); background: var(--surface-2); font-size: 13px; }
.help-steps { margin: 0; padding: 12px 16px 12px 36px; display: flex; flex-direction: column; gap: 10px; overflow-y: auto; line-height: 1.5; }
.help-card { padding: 12px 16px; margin-bottom: 8px; }
.help-card summary { cursor: pointer; }
.help-card .help-steps { padding: 10px 0 4px 22px; }
.ntf-list { list-style: none; margin: 0; padding: 4px; overflow-y: auto; }
.ntf-item { display: flex; gap: 10px; width: 100%; text-align: left; border: 0; background: none; color: var(--fg); padding: 10px 12px; border-radius: 10px; cursor: pointer; }
.ntf-item:hover { background: var(--surface-2); }
.ntf-dot { flex: none; width: 8px; height: 8px; margin-top: 7px; border-radius: 4px; background: transparent; }
.ntf-item.unread .ntf-dot { background: var(--accent); }
.ntf-item.unread .ntf-text > span:first-child { font-weight: 600; }
.ntf-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; overflow-wrap: anywhere; }
.ntf-text .muted { font-size: 12px; }

/* phones: app-style top bar + bottom tabs + "More" sheet (desktop keeps the side rail) */
.m-top, .tabbar, .m-sheet, .m-badges { display: none; }
@media (max-width: 860px) {
  .shell { display: block; min-height: 100vh; }
  .rail, .topbar { display: none; }
  .m-top { display: flex; align-items: center; gap: 8px; position: sticky; top: 0; z-index: 20; height: 56px; padding: 0 12px 0 16px; padding-top: env(safe-area-inset-top);
    box-sizing: content-box; background: var(--side-bg); color: #fff; }
  .m-title { flex: 1; min-width: 0; font-size: 17px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .m-ctx { display: flex; align-items: center; gap: 4px; max-width: 36%; min-height: 36px; padding: 0 8px 0 12px; border: 1px solid rgba(255,255,255,.18); border-radius: 18px;
    background: rgba(255,255,255,.06); color: var(--side-fg); font-size: 13px; cursor: pointer; }
  .m-ctx span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .ntf-panel { top: calc(56px + env(safe-area-inset-top)); right: 0; left: 0; width: auto; max-height: calc(100vh - 140px); border-radius: 0 0 14px 14px; }
  .board { display: block; }
  .board-col { display: none; background: none; border: 0; padding: 0; }
  .board-col.current { display: flex; }
  .board-col h2 { display: none; }
  .col-pick { display: flex; gap: 4px; overflow-x: auto; margin: 4px 0 10px; }
  .col-pick button { flex: 1 0 auto; min-height: 40px; border: 1px solid var(--line); background: var(--surface); color: var(--muted); border-radius: 20px; padding: 0 12px; font-size: 13px; cursor: pointer; }
  .col-pick button.on { background: var(--accent); border-color: var(--accent); color: var(--accent-fg); }
  .chat { display: block; position: fixed; z-index: 10; left: 0; right: 0; top: calc(56px + env(safe-area-inset-top)); bottom: calc(66px + env(safe-area-inset-bottom)); height: auto; min-height: 0; border: 0; border-radius: 0; }
  .chat .chat-list { height: 100%; border: 0; }
  .chat.has-room .chat-list { display: none; }
  .chat:not(.has-room) .chat-conv, .chat:not(.has-room) .chat-placeholder { display: none; }
  .chat.has-room .chat-conv { height: 100%; }
  .chat-back { display: inline-flex; }
  .chat-more { opacity: 1; }
  .bubble { max-width: 88%; }
  .chat-img img, .chat-img-ph { width: 150px; height: 120px; }
  .m-badges { display: flex; gap: 6px; padding: 10px 16px 0; }
  .content { padding: 16px 16px calc(84px + env(safe-area-inset-bottom)); }
  .tabbar { display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; background: var(--surface); border-top: 1px solid var(--line);
    padding: 6px 4px calc(6px + env(safe-area-inset-bottom)); box-shadow: 0 -4px 16px rgba(15,29,44,.06); }
  .tab { flex: 1 1 0; min-width: 0; display: flex; flex-direction: column; align-items: center; gap: 3px; min-height: 52px; padding: 4px 2px; border: 0; background: none;
    color: var(--muted); font-size: 11px; font-weight: 600; cursor: pointer; border-radius: 10px; }
  .tab span { max-width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .tab[aria-current="page"] { color: var(--accent); }
  .tab[aria-current="page"] svg { background: var(--accent-soft); border-radius: 12px; padding: 2px 12px; box-sizing: content-box; }
  .m-sheet { display: flex; flex-direction: column; gap: 6px; position: fixed; inset: 0; z-index: 30; overflow-y: auto; background: var(--bg);
    padding: calc(12px + env(safe-area-inset-top)) 16px calc(24px + env(safe-area-inset-bottom)); }
  .m-sheet-head { display: flex; align-items: center; gap: 12px; padding: 4px 0 8px; }
  .m-user { flex: 1; min-width: 0; display: flex; flex-direction: column; }
  .m-user b { font-size: 17px; }
  .m-user span { color: var(--muted); font-size: 13px; overflow-wrap: anywhere; }
  .m-close { width: 44px; height: 44px; border-radius: 22px; border: 1px solid var(--line); background: var(--surface); color: var(--fg); display: grid; place-items: center; cursor: pointer; }
  .m-field { display: flex; flex-direction: column; gap: 6px; color: var(--muted); font-size: 12px; padding-bottom: 6px; }
  .m-field select { width: 100%; min-height: 44px; padding: 0 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); font-size: 15px; }
  .m-group { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 4px; display: flex; flex-direction: column; }
  .m-group-title { color: var(--muted); font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; padding: 10px 12px 4px; }
  .m-item { display: flex; align-items: center; gap: 12px; min-height: 48px; padding: 0 12px; border: 0; border-radius: 10px; background: none; color: var(--fg); font-size: 15px; text-align: left; cursor: pointer; }
  .m-item svg { color: var(--muted); flex: none; }
  .m-item[aria-current="page"] { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
  .m-item[aria-current="page"] svg { color: var(--accent); }
  .m-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding-top: 10px; }
  .users { grid-template-columns: 1fr; }
  .hide-sm { display: none; }
  /* tables become cards: one card per row, "heading: value" lines; the first cell is the card title */
  .table-wrap:not(.no-cards) { overflow: visible; }
  .card.table-wrap:not(.no-cards) { background: none; border: 0; box-shadow: none; padding: 0; }
  .table-wrap:not(.no-cards) :is(table, tbody, tfoot, tr, td) { display: block; }
  .table-wrap:not(.no-cards) thead { display: none; }
  .table-wrap:not(.no-cards) tbody tr { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 10px 14px; margin-bottom: 10px; }
  .table-wrap:not(.no-cards) tbody tr.click:active { border-color: var(--accent); }
  .table-wrap:not(.no-cards) td { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; border: 0; padding: 3px 0; text-align: right; overflow-wrap: anywhere; }
  .table-wrap:not(.no-cards) td::before { content: attr(data-label); flex: none; max-width: 48%; color: var(--muted); font-size: 12px; text-align: left; }
  .table-wrap:not(.no-cards) td[data-label=""]::before { display: none; }
  .table-wrap:not(.no-cards) td[data-label=""] { justify-content: flex-start; flex-wrap: wrap; text-align: left; }
  .table-wrap:not(.no-cards) td:empty { display: none; }
  .table-wrap:not(.no-cards) tbody td:first-child { display: block; text-align: left; font-size: 15px; font-weight: 600; padding: 2px 0 6px; }
  .table-wrap:not(.no-cards) tbody td:first-child::before { display: none; }
  .table-wrap:not(.no-cards) tfoot tr { display: flex; justify-content: space-between; gap: 12px; padding: 6px 14px; }
  .table-wrap:not(.no-cards) tfoot td { border: 0; padding: 0; }
  .table-wrap:not(.no-cards) tfoot td::before { display: none; }
}

/* ---------- printable documents (acts) ---------- */
.act-print .sheet { background: #fff; color: #000; max-width: 210mm; margin: 0 auto; padding: 16mm 14mm; box-shadow: 0 1px 4px rgba(0,0,0,.12); font-size: 13px; line-height: 1.45; }
.act-print .sheet table { width: 100%; border-collapse: collapse; margin: 10px 0; }
.act-print .sheet .lines th, .act-print .sheet .lines td { border: 1px solid #555; padding: 4px 6px; vertical-align: top; }
.act-print .sheet .kv th { text-align: left; width: 28%; font-weight: 600; padding: 2px 0; }
.act-print .sheet .r { text-align: right; white-space: nowrap; }
.act-print .sheet .small { font-size: 11px; }
.act-print .signs { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; margin-top: 28px; }
.act-print .signs .line { border-bottom: 1px solid #000; height: 34px; margin-bottom: 2px; }
@media print {
  @page { size: A4; margin: 12mm; }
  body { background: #fff !important; }
  .rail, .topbar, .no-print, .toast { display: none !important; }
  .shell, .main, .content { display: block !important; margin: 0 !important; padding: 0 !important; }
  .act-print .sheet { box-shadow: none; padding: 0; max-width: none; }
}

/* form controls never push the page sideways on a phone (a select is as wide as its longest option otherwise) */
.field { min-width: 0; }
.field input, .field select, .field textarea { max-width: 100%; min-width: 0; }
select { max-width: 100%; }
/* every select looks like the other controls, also outside a .field (list filters) */
select:not(.ctl select):not(.m-field select) { border: 1px solid var(--line); background: var(--surface); border-radius: 6px; padding: 6px 8px; }
/* long labels wrap instead of pushing the page sideways */
.btn { max-width: 100%; }
@media (max-width: 860px) {
  .btn { white-space: normal; text-align: center; overflow-wrap: normal; word-break: normal; }
  /* in a row turned into a card a button keeps its natural width; the text next to it wraps instead */
  .table-wrap:not(.no-cards) td > .btn { flex: none; }
  .chip { white-space: normal; max-width: 100%; }
  .table-wrap:not(.no-cards) td:has(.chip) { flex-wrap: wrap; justify-content: flex-end; }
}
/* a long menu label (Armenian words are long) wraps inside the rail instead of being cut */
.nav-item span:not(.nav-count) { min-width: 0; overflow-wrap: anywhere; }
