:root {
  --radius-s: 6px;
  --radius-m: 10px;
  --row-h: 52px;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html, body { margin: 0; height: 100%; }
body {
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", sans-serif;
  -webkit-text-size-adjust: 100%;
}

button, input { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }

.muted { color: var(--steel); }
.error { color: var(--danger); min-height: 1.2em; margin: 6px 0 0; font-size: 14px; }
.num { text-align: right; font-variant-numeric: tabular-nums; }

/* ---------- кнопки ---------- */
button {
  border: 1px solid transparent;
  border-radius: var(--radius-s);
  padding: 8px 14px;
  cursor: pointer;
  background: none;
  white-space: nowrap;
}
button:disabled { opacity: .5; cursor: default; }
.primary { background: var(--accent); color: var(--accent-ink); font-weight: 600; }
.primary:hover:not(:disabled) { filter: brightness(1.07); }
.ghost { border-color: var(--line); background: var(--surface); }
.ghost:hover:not(:disabled) { border-color: var(--steel); }
.danger { color: var(--danger); border-color: var(--line); background: var(--surface); }
.danger.solid { background: var(--danger); color: var(--on-danger); border-color: transparent; }
.small { padding: 4px 10px; font-size: 14px; }
.link { padding: 2px 4px; color: var(--accent); text-decoration: underline; text-underline-offset: 3px; }

input[type=text], input[type=password], input[type=search] {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-s);
  background: var(--surface);
}
input[type=search] { width: 240px; }

/* ---------- вход ---------- */
.login { min-height: 100%; display: grid; place-items: center; padding: 24px 16px; }
.login-box {
  width: min(380px, 100%);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-m);
  padding: 32px 28px 28px;
}
.login-icon { display: block; border-radius: 14px; margin-bottom: 16px; }
.login-box h1 { font-size: 24px; margin: 0 0 6px; letter-spacing: -0.01em; }
.login-box p.muted { margin: 0 0 22px; }
.login-box label { display: block; font-weight: 600; margin-bottom: 6px; font-size: 14px; }
.login-box button { width: 100%; margin-top: 14px; padding: 11px; }

/* ---------- каркас ---------- */
.app { display: flex; flex-direction: column; height: 100%; }

.topbar {
  display: flex; align-items: center; gap: 16px;
  padding: 10px 20px;
  background: var(--top-bg);
  color: var(--top-ink);
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 650; font-size: 16px; }
.brand img { border-radius: 7px; }
.status { display: flex; align-items: center; gap: 7px; font-size: 13px; color: var(--top-muted); margin-left: 8px; }
.status-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--top-muted); }
.status.online .status-dot { background: #7FCB95; }
.status.offline .status-dot { background: #F08A7E; }
.me-wrap { margin-left: auto; display: flex; align-items: center; gap: 10px; font-size: 14px; }
.me { display: flex; align-items: center; gap: 8px; padding: 4px 8px; color: var(--top-ink); }
.me:hover { background: var(--top-hover); }
.me-wrap .ghost { background: transparent; border-color: var(--top-line); color: var(--top-ink); }

.toolbar {
  display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
  padding: 14px 20px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}
.tools { display: flex; gap: 8px; margin-left: auto; align-items: center; }

.crumbs { display: flex; flex-wrap: wrap; align-items: center; gap: 2px; font-size: 17px; min-width: 0; }
.crumbs button { padding: 3px 6px; border-radius: var(--radius-s); color: var(--steel); }
.crumbs button:hover { background: var(--surface-2); color: var(--ink); }
.crumbs .current { padding: 3px 6px; font-weight: 650; }
.crumbs .sep { color: var(--line); padding: 0 2px; }

.files-view, .chat-view { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.workspace { flex: 1; display: flex; min-height: 0; }

/* ---------- список ---------- */
.listing { flex: 1; overflow: auto; position: relative; padding: 0 0 96px; }
.list-head, .row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 150px 150px 90px;
  gap: 16px;
  align-items: center;
  padding: 0 20px;
}
.list-head {
  position: sticky; top: 0; z-index: 1;
  height: 36px; font-size: 13px; color: var(--steel);
  background: var(--bg); border-bottom: 1px solid var(--line);
}
.rows { list-style: none; margin: 0; padding: 0; }
.row {
  height: var(--row-h);
  border-bottom: 1px solid var(--line);
  cursor: pointer;
  background: var(--surface);
  width: 100%; text-align: left; border-radius: 0; border-width: 0 0 1px;
}
.row:hover { background: var(--surface-2); }
.row.selected { background: var(--surface-2); box-shadow: inset 3px 0 0 var(--accent); }
.row.flash { animation: flash 1.6s ease-out; }
@keyframes flash {
  0%, 25% { background: var(--accent-glow); }
  100% { background: var(--surface); }
}
.name { display: flex; align-items: center; gap: 12px; min-width: 0; }
.name-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row.folder .name-text { font-weight: 600; }
.path-hint { color: var(--steel); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.who { display: flex; align-items: center; gap: 8px; color: var(--steel); font-size: 14px; min-width: 0; }
.who span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.when { color: var(--steel); font-size: 14px; font-variant-numeric: tabular-nums; }
.size { color: var(--steel); font-size: 14px; }

.ficon {
  flex: none; width: 30px; height: 34px; border-radius: 4px;
  display: grid; place-items: end center; padding-bottom: 4px;
  font-size: 9px; font-weight: 700; letter-spacing: .02em;
  background: var(--surface-2); border: 1px solid var(--line); color: var(--steel);
}
.ficon.folder {
  height: 26px; width: 32px; border: none; border-radius: 3px 5px 5px 5px;
  background: var(--accent); position: relative; opacity: .85;
}
.ficon.folder::before {
  content: ""; position: absolute; top: -4px; left: 0; width: 13px; height: 6px;
  background: var(--accent); border-radius: 3px 3px 0 0;
}

.avatar {
  flex: none; width: 24px; height: 24px; border-radius: 50%;
  display: grid; place-items: center;
  font-size: 12px; font-weight: 700; color: #fff;
}

.empty { padding: 64px 20px; text-align: center; color: var(--steel); }
.empty strong { display: block; color: var(--ink); font-size: 17px; margin-bottom: 6px; }

.drop-hint {
  position: absolute; inset: 0; z-index: 3;
  display: grid; place-items: center;
  background: var(--accent-glow);
  border: 2px dashed var(--accent);
  font-size: 18px; font-weight: 600;
}

/* ---------- подробности ---------- */
.details {
  width: 400px; flex: none;
  border-left: 1px solid var(--line);
  background: var(--surface);
  overflow: auto;
  padding: 20px;
}
.details-head { display: flex; align-items: flex-start; gap: 12px; }
.details-head h2 { font-size: 18px; margin: 0; word-break: break-word; flex: 1; }
.close { margin: -4px -8px 0 0; font-size: 22px; line-height: 1; padding: 4px 10px; color: var(--steel); }
.facts { display: grid; grid-template-columns: auto 1fr; gap: 6px 16px; margin: 16px 0 18px; font-size: 14px; }
.facts dt { color: var(--steel); }
.facts dd { margin: 0; font-variant-numeric: tabular-nums; word-break: break-word; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; }
.preview { margin: 16px 0 0; border-radius: var(--radius-s); overflow: hidden; border: 1px solid var(--line); background: var(--surface-2); }
.preview img { display: block; max-width: 100%; max-height: 260px; margin: 0 auto; }
.details h3 { font-size: 15px; margin: 26px 0 8px; }
.history { list-style: none; margin: 0; padding: 0; font-size: 14px; }
.history li {
  display: grid; grid-template-columns: 34px 1fr auto; gap: 4px 10px; align-items: center;
  padding: 9px 0; border-bottom: 1px solid var(--line);
}
.history .v { color: var(--steel); font-variant-numeric: tabular-nums; }
.history .meta { color: var(--steel); font-size: 13px; }
.history .gone { color: var(--danger); }
.history .hist-actions { display: flex; gap: 2px; }

/* ---------- загрузки, уведомления ---------- */
.uploads {
  position: fixed; right: 20px; bottom: 20px; z-index: 5;
  width: min(360px, calc(100% - 32px));
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-m);
  box-shadow: 0 8px 28px rgba(16, 24, 32, .18);
  padding: 12px 14px; max-height: 50vh; overflow: auto;
}
.upload { font-size: 14px; padding: 6px 0; }
.upload .uname { display: flex; justify-content: space-between; gap: 10px; }
.upload .uname span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar { height: 4px; background: var(--surface-2); border-radius: 2px; margin-top: 6px; overflow: hidden; }
.bar > div { height: 100%; background: var(--accent); width: 0; transition: width .15s linear; }
.upload.failed .bar > div { background: var(--danger); }
.upload.done .bar > div { background: var(--ok); }

.toasts {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%);
  z-index: 6; display: flex; flex-direction: column; gap: 8px; align-items: center;
  width: min(480px, calc(100% - 32px)); pointer-events: none;
}
.toast {
  pointer-events: auto;
  background: var(--ink); color: var(--bg);
  padding: 10px 16px; border-radius: var(--radius-s);
  font-size: 14px; display: flex; align-items: center; gap: 10px;
  box-shadow: 0 6px 20px rgba(16, 24, 32, .25);
  animation: toast-in .2s ease-out;
}
.toast.err { background: var(--danger); color: var(--on-danger); }
@keyframes toast-in { from { transform: translateY(8px); opacity: 0; } }

.fab { display: none; }

/* ---------- диалог ---------- */
.dialog {
  border: 1px solid var(--line); border-radius: var(--radius-m);
  background: var(--surface); color: var(--ink);
  padding: 22px; width: min(420px, calc(100% - 32px));
}
.dialog::backdrop { background: rgba(14, 19, 24, .45); }
.dialog h2 { margin: 0 0 8px; font-size: 18px; }
.dialog p { margin: 0 0 12px; color: var(--steel); }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 14px; flex-wrap: wrap; }

/* ---------- телефон ---------- */
@media (max-width: 760px) {
  .topbar { padding: 10px 16px; gap: 10px; }
  .brand span, .me-name { display: none; }
  .status { margin-left: 0; }
  .toolbar { padding: 10px 16px; gap: 10px; }
  .tools { margin-left: 0; width: 100%; }
  .tools input[type=search] { flex: 1; width: auto; min-width: 0; }
  #upload-btn { display: none; }
  .list-head { display: none; }
  .row {
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas: "name when" "name who";
    height: 62px; gap: 0 12px; padding: 0 16px;
  }
  .row .name { grid-area: name; }
  .row .when { grid-area: when; align-self: end; font-size: 13px; text-align: right; }
  .row .who { grid-area: who; align-self: start; justify-content: flex-end; font-size: 13px; }
  .row .who span:last-child, .row .size { display: none; }
  .row .avatar { width: 20px; height: 20px; font-size: 11px; }
  .row.folder { grid-template-areas: "name name"; }
  .row.folder .when, .row.folder .who { display: none; }

  .details {
    position: fixed; inset: auto 0 0 0; z-index: 4;
    width: auto; max-height: 85vh;
    border-left: none; border-top: 1px solid var(--line);
    border-radius: 14px 14px 0 0;
    box-shadow: 0 -10px 40px rgba(16, 24, 32, .25);
    padding: 18px 16px calc(24px + env(safe-area-inset-bottom));
    animation: sheet-in .2s ease-out;
  }
  @keyframes sheet-in { from { transform: translateY(40px); opacity: 0; } }
  .actions > * { flex: 1; }
  .folder-actions { flex-basis: 100%; margin: 6px 0 0; }
  .sheet-open .fab { display: none; }

  .fab {
    display: grid; place-items: center;
    position: fixed; right: 18px; bottom: calc(18px + env(safe-area-inset-bottom)); z-index: 3;
    width: 58px; height: 58px; border-radius: 50%;
    font-size: 30px; font-weight: 400; line-height: 1; padding: 0;
    box-shadow: 0 6px 18px rgba(16, 24, 32, .3);
  }
  .uploads { right: 16px; bottom: 90px; }
  .toasts { bottom: 92px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ---------- вспомогательные классы (встроенные стили запрещены CSP) ---------- */
.folder-actions { display: inline-flex; gap: 6px; margin-left: 10px; }
.name-stack { display: grid; min-width: 0; }
.button-link {
  display: inline-block; text-align: center; text-decoration: none;
  padding: 8px 14px; border-radius: var(--radius-s);
}

/* ======================================================================
   Вкладки, значки непрочитанного, имена-ссылки
   ====================================================================== */
.tabs { display: flex; gap: 2px; margin-left: 12px; }
.tab {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 12px; border-radius: var(--radius-s);
  color: var(--top-muted); text-decoration: none; font-size: 15px;
}
.tab:hover { color: var(--top-ink); background: var(--top-hover); }
.tab[aria-current="page"] { color: var(--top-ink); background: var(--top-hover); box-shadow: inset 0 -2px 0 var(--top-accent); }
.tab .badge { background: var(--top-accent); color: var(--top-accent-ink); }

.badge {
  display: inline-grid; place-items: center;
  min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px;
  background: var(--accent); color: var(--accent-ink);
  font-size: 12px; font-weight: 700; font-variant-numeric: tabular-nums;
}
.badge.mention, .tab .badge.mention { background: var(--danger); color: var(--on-danger); }

.person {
  padding: 0; border: 0; color: inherit; font: inherit;
  text-decoration: underline; text-decoration-color: var(--line);
  text-underline-offset: 3px; cursor: pointer;
}
.person:hover { text-decoration-color: var(--accent); color: var(--accent); }
.person.subtle { color: var(--steel); }

.toast.clickable { cursor: pointer; border: 0; text-align: left; max-width: 100%; white-space: normal; }
.toast { overflow-wrap: anywhere; }
.toast.clickable:hover { filter: brightness(1.15); }

/* ======================================================================
   Сообщения: каркас
   ====================================================================== */
.chat-view { flex-direction: row; }
.chat-list-pane {
  width: 340px; flex: none; display: flex; flex-direction: column; min-height: 0;
  border-right: 1px solid var(--line); background: var(--surface);
}
.chat-list-head { display: flex; gap: 8px; padding: 14px 14px 10px; }
.chat-list-head input { flex: 1; width: auto; min-width: 0; }
.chat-list { list-style: none; margin: 0; padding: 0 0 16px; overflow: auto; flex: 1; }
.chat-list-pane .empty { padding: 40px 20px; }

.chat-item {
  display: flex; align-items: center; gap: 12px; width: 100%;
  padding: 10px 14px; border-radius: 0; text-align: left;
}
.chat-item:hover { background: var(--surface-2); }
.chat-item.current { background: var(--surface-2); box-shadow: inset 3px 0 0 var(--accent); }
.chat-item .avatar { width: 44px; height: 44px; font-size: 16px; }
.chat-item-body { flex: 1; min-width: 0; display: grid; gap: 2px; }
.chat-item-top, .chat-item-bottom { display: flex; align-items: center; gap: 8px; min-width: 0; }
.chat-item-title { flex: 1; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-item-time { color: var(--steel); font-size: 12px; font-variant-numeric: tabular-nums; }
.chat-item-preview { flex: 1; color: var(--steel); font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-item.unread .chat-item-preview { color: var(--ink); }
.avatar.group { border-radius: 12px; }

.conversation { flex: 1; min-width: 0; display: flex; flex-direction: column; position: relative; background: var(--bg); }
.conv-empty { margin: auto; text-align: center; color: var(--steel); max-width: 320px; padding: 20px; }
.conv-empty strong { display: block; color: var(--ink); font-size: 17px; margin-bottom: 6px; }

.conv-head {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 16px; background: var(--surface); border-bottom: 1px solid var(--line);
}
.conv-head .back { display: none; font-size: 28px; line-height: 1; padding: 2px 10px 6px; color: var(--steel); }
.conv-title { display: flex; align-items: center; gap: 12px; padding: 4px 6px; flex: 1; min-width: 0; text-align: left; }
.conv-title:hover { background: var(--surface-2); }
.conv-title.static { cursor: default; }
.conv-title.static:hover { background: none; }
.contact .logout-here { display: none; }
.conv-title .avatar { width: 38px; height: 38px; font-size: 14px; }
.conv-name { font-weight: 650; font-size: 16px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.conv-sub { color: var(--steel); font-size: 13px; }

.messages { flex: 1; overflow-y: auto; overflow-x: hidden; padding: 8px 0 12px; overscroll-behavior: contain; }
.msg-list { list-style: none; margin: 0 auto; padding: 0 20px; max-width: 860px; }

.chat-start, .older { text-align: center; color: var(--steel); font-size: 13px; padding: 14px 0 6px; }
.day { display: flex; justify-content: center; margin: 14px 0 8px; }
.day span, .msg-system span {
  font-size: 12px; color: var(--steel); background: var(--surface);
  border: 1px solid var(--line); border-radius: 12px; padding: 2px 10px;
}
.msg-system { text-align: center; margin: 10px 0; }
.unread-divider { display: flex; align-items: center; gap: 10px; margin: 14px 0 8px; color: var(--accent); font-size: 13px; font-weight: 600; }
.unread-divider::before, .unread-divider::after { content: ""; flex: 1; height: 1px; background: var(--accent); opacity: .5; }

/* ======================================================================
   Сообщение
   ====================================================================== */
.msg { display: flex; gap: 8px; align-items: flex-end; margin-top: 10px; position: relative; }
.msg.grouped { margin-top: 2px; }
.msg.mine { justify-content: flex-end; }
.msg-body { display: flex; flex-direction: column; align-items: flex-start; max-width: min(72%, 560px); min-width: 0; position: relative; }
.msg.mine .msg-body { align-items: flex-end; }
.avatar-btn { padding: 0; border-radius: 50%; }
.avatar-btn .avatar, .avatar-gap { width: 30px; height: 30px; font-size: 12px; flex: none; }
.avatar-gap { display: block; }

.bubble {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: 14px 14px 14px 4px; padding: 7px 11px 6px;
  min-width: 64px; max-width: 100%;
}
.msg.grouped .bubble { border-radius: 14px; }
.msg.mine .bubble { background: var(--mine); border-color: var(--mine-line); border-radius: 14px 14px 4px 14px; }
.msg.mine.grouped .bubble { border-radius: 14px; }
.msg.mentioned .bubble { box-shadow: inset 3px 0 0 var(--accent); background-image: linear-gradient(var(--mention-bg), var(--mention-bg)); }
.msg.flash .bubble { animation: flash 1.6s ease-out; }

.author { display: block; padding: 0; font-size: 13px; font-weight: 650; margin-bottom: 2px; color: var(--accent); }
.author:hover { text-decoration: underline; }
.text { white-space: pre-wrap; overflow-wrap: anywhere; }
.text a { color: var(--focus); }
.mention {
  display: inline; cursor: pointer; -webkit-box-decoration-break: clone; box-decoration-break: clone;
  padding: 0 2px; border-radius: 4px; font: inherit; font-weight: 600;
  color: var(--accent); background: var(--mention-bg);
}
.mention.me { background: var(--accent); color: var(--accent-ink); }

.quote {
  display: grid; width: 100%; text-align: left; gap: 0;
  border-left: 3px solid var(--accent); border-radius: 4px;
  background: var(--surface-2); padding: 3px 8px; margin: 2px 0 5px;
  font-size: 13px;
}
.msg.mine .quote { background: var(--accent-glow); }
.quote strong { font-weight: 650; color: var(--accent); }
.quote span { color: var(--steel); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.msg-meta {
  display: flex; justify-content: flex-end; align-items: center; gap: 4px;
  font-size: 11px; color: var(--steel); margin-top: 2px; font-variant-numeric: tabular-nums;
}
.ticks { letter-spacing: -3px; padding-right: 3px; }
.ticks.read { color: var(--accent); }

.attachments { list-style: none; margin: 4px 0 2px; padding: 0; display: grid; gap: 4px; }
.att {
  display: flex; align-items: center; gap: 4px;
  border: 1px solid var(--line); border-radius: 8px; background: var(--surface);
}
.att-main {
  display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0;
  padding: 6px 8px; text-align: left; color: inherit; text-decoration: none; border-radius: 8px;
}
.att-main:hover { background: var(--surface-2); }
.att-dl { font-size: 13px; color: var(--accent); padding: 6px 10px; white-space: nowrap; }
.att.gone .name-text { text-decoration: line-through; color: var(--steel); }

.reactions { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
.reaction {
  display: flex; align-items: center; gap: 4px; padding: 2px 8px;
  border: 1px solid var(--line); border-radius: 12px; background: var(--surface); font-size: 13px;
}
.reaction.mine { border-color: var(--accent); background: var(--mention-bg); }
.reaction .count { font-variant-numeric: tabular-nums; color: var(--steel); }
.reaction.mine .count { color: var(--ink); font-weight: 600; }

.msg-actions {
  position: absolute; bottom: calc(100% - 2px); z-index: 2;
  display: none; align-items: center; gap: 2px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 18px;
  padding: 2px 4px; box-shadow: 0 4px 14px rgba(16, 24, 32, .14);
}
.msg.theirs .msg-actions { left: 8px; }
.msg.mine .msg-actions { right: 8px; }
.msg:hover .msg-actions, .msg:focus-within .msg-actions, .msg.active .msg-actions { display: flex; }
.react-btn { padding: 2px 5px; font-size: 18px; border-radius: 50%; line-height: 1.2; }
.react-btn:hover { background: var(--surface-2); transform: scale(1.15); }
.reply-btn { font-size: 13px; padding: 4px 10px; border-radius: 14px; color: var(--steel); }
.reply-btn:hover { background: var(--surface-2); color: var(--ink); }

.to-bottom {
  position: absolute; right: 22px; bottom: 96px; z-index: 3;
  width: 42px; height: 42px; border-radius: 50%; padding: 0;
  background: var(--surface); border: 1px solid var(--line); font-size: 20px;
  box-shadow: 0 4px 14px rgba(16, 24, 32, .16);
}

/* ======================================================================
   Поле ввода
   ====================================================================== */
.composer {
  position: relative; background: var(--surface); border-top: 1px solid var(--line);
  padding: 10px 16px calc(10px + env(safe-area-inset-bottom));
}
.composer-row { display: flex; align-items: flex-end; gap: 8px; max-width: 860px; margin: 0 auto; }
.composer textarea {
  flex: 1; resize: none; min-height: 42px; max-height: 160px;
  padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px;
  background: var(--bg); line-height: 1.4; font: inherit; color: inherit;
}
.icon-btn { display: grid; place-items: center; width: 42px; height: 42px; padding: 0; border-radius: 10px; color: var(--steel); }
.icon-btn:hover { background: var(--surface-2); color: var(--ink); }
.icon-btn.send { color: var(--accent-ink); }
.icon-btn.send:hover { background: var(--accent); }

.reply-bar, .attach-bar { display: flex; align-items: center; gap: 8px; max-width: 860px; margin: 0 auto 8px; }
.reply-bar .quote { margin: 0; flex: 1; min-width: 0; }
.reply-bar .close { margin: 0; }
.attach-bar { flex-wrap: wrap; }
.chip {
  display: inline-flex; align-items: center; gap: 6px; max-width: 260px;
  border: 1px solid var(--line); border-radius: 8px; padding: 3px 4px 3px 6px; background: var(--surface-2);
}
.chip .ficon { width: 22px; height: 26px; font-size: 7px; }
.chip-x { padding: 0 6px; font-size: 18px; line-height: 1; color: var(--steel); }

.mention-pop {
  position: absolute; left: 16px; bottom: calc(100% - 4px); z-index: 4;
  min-width: 220px; max-width: calc(100% - 32px);
  background: var(--surface); border: 1px solid var(--line); border-radius: 10px;
  box-shadow: 0 8px 24px rgba(16, 24, 32, .18); padding: 4px;
}
.mention-item { display: flex; align-items: center; gap: 10px; width: 100%; padding: 6px 8px; text-align: left; }
.mention-item.current, .mention-item:hover { background: var(--surface-2); }

/* ======================================================================
   Окна: контакт, выбор файлов и людей, группа
   ====================================================================== */
.modal { width: min(440px, calc(100% - 32px)); padding: 22px; position: relative; max-height: calc(100vh - 40px); overflow: auto; }
.modal.wide { width: min(560px, calc(100% - 32px)); }
.modal-close { position: absolute; top: 14px; right: 14px; }
.modal h2 { margin: 0 0 6px; font-size: 19px; }
.modal h3 { font-size: 14px; margin: 20px 0 8px; }
.avatar.xl { width: 64px; height: 64px; font-size: 24px; }
.contact-head { display: flex; align-items: center; gap: 16px; padding-right: 30px; }
.contact-head h2 { margin: 0 0 2px; word-break: break-word; }
.contact-head p { margin: 0; }
.contact .facts { margin: 18px 0 0; }
.contact-files, .member-list { list-style: none; margin: 0; padding: 0; }
.file-link, .member { display: flex; align-items: center; gap: 10px; width: 100%; padding: 6px 4px; text-align: left; border-radius: 6px; }
.file-link:hover, .member:hover { background: var(--surface-2); }
.member-list li { display: flex; align-items: center; gap: 8px; }
.member { flex: 1; min-width: 0; }
.small-note { font-size: 12px; }
.danger-link { color: var(--danger); }

.picker > input[type=search] { width: 100%; margin: 6px 0 10px; }
.pick-list { list-style: none; margin: 0; padding: 0; max-height: 46vh; overflow: auto; border: 1px solid var(--line); border-radius: 8px; }
.pick-list.short { max-height: 30vh; }
.pick-item { display: flex; align-items: center; gap: 10px; padding: 8px 10px; cursor: pointer; min-width: 0; }
.pick-item:hover { background: var(--surface-2); }
.pick-item input { width: 18px; height: 18px; accent-color: var(--accent); flex: none; }
.pick-list li + li { border-top: 1px solid var(--line); }
.pick-empty { padding: 16px; text-align: center; }
.group-title { margin-top: 12px; }
.title-row { display: flex; gap: 8px; margin-top: 10px; }
.push-left { margin-right: auto; }
.dialog-actions.spaced { margin-top: 22px; padding-top: 14px; border-top: 1px solid var(--line); justify-content: flex-start; }

/* ======================================================================
   Телефон
   ====================================================================== */
@media (max-width: 760px) {
  .tabs { margin-left: 2px; }
  .tab { padding: 6px 9px; }
  .status-text { display: none; }
  .me { padding: 2px; }

  .chat-list-pane { width: 100%; border-right: 0; }
  .conversation { display: none; }
  .chat-view.has-chat .chat-list-pane { display: none; }
  .chat-view.has-chat .conversation { display: flex; }
  .conv-head { padding: 6px 8px; }
  .conv-head .back { display: block; }
  .msg-list { padding: 0 10px; }
  .msg-body { max-width: 84%; }
  .to-bottom { right: 14px; bottom: 84px; }
  .composer { padding: 8px 8px calc(8px + env(safe-area-inset-bottom)); }
  .composer-row { gap: 4px; }
  .modal .dialog-actions { flex-wrap: wrap; }
  .modal .push-left { margin-right: 0; flex-basis: 100%; }
}
@media (max-width: 380px) {
  .brand { display: none; }
}

.view-chats .toasts { bottom: 96px; }
.view-chats .uploads { bottom: 90px; }

/* ======================================================================
   Роли: метки tech / design / founder у имён
   ====================================================================== */
.role-tag {
  display: inline-block; vertical-align: 1px; margin-left: 6px;
  padding: 0 6px; border-radius: 4px; line-height: 17px;
  font-size: 11px; font-weight: 700; letter-spacing: .02em; white-space: nowrap;
}
.role-tech { background: var(--tech-bg); color: var(--tech-ink); }
.role-design { background: var(--design-bg); color: var(--design-ink); }
.role-founder { background: var(--founder-bg); color: var(--founder-ink); }
.topbar .role-tag { background: var(--top-hover); }
.topbar .role-tech { color: #A9CBF5; }
.topbar .role-design { color: #EDB3E8; }
.topbar .role-founder { color: #F6B98D; }
.name-role { display: inline-flex; align-items: center; min-width: 0; }
.name-role .nr-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.who .name-role { min-width: 0; }
.author-line { display: flex; align-items: center; margin-bottom: 2px; }
.author-line .author { margin-bottom: 0; }
.role-title { margin: 0 0 2px; font-size: 14px; }

/* ======================================================================
   Статусы задач
   ====================================================================== */
.status-badge {
  display: inline-flex; align-items: center; gap: 6px; white-space: nowrap;
  font-size: 12px; font-weight: 600; padding: 1px 8px 1px 7px; border-radius: 10px;
  border: 1px solid currentColor;
}
.status-badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.st-not_started { color: var(--steel); }
.st-in_progress { color: var(--st-blue); }
.st-redirected { color: var(--st-violet); }
.st-needs_approval { color: var(--st-amber); }
.st-done { color: var(--ok); }
.status-badge.st-overdue { background: var(--danger); border-color: var(--danger); color: var(--on-danger); }
.status-badge.st-overdue::before { background: var(--on-danger); }
.late { color: var(--danger); }

/* ======================================================================
   Раздел «Задачи»
   ====================================================================== */
.tasks-view { flex: 1; min-height: 0; display: flex; }
.task-list-pane {
  width: 400px; flex: none; display: flex; flex-direction: column; min-height: 0;
  border-right: 1px solid var(--line); background: var(--surface);
}
.task-list-head { display: flex; align-items: center; gap: 8px; padding: 14px 14px 8px; }
.task-list-head .primary { margin-left: auto; }
.task-list-tools { display: flex; gap: 8px; padding: 0 14px 10px; border-bottom: 1px solid var(--line); }
.task-list-tools input { flex: 1; width: auto; min-width: 0; }
select {
  font: inherit; color: inherit; background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--radius-s); padding: 8px 10px; max-width: 100%;
}
.segmented { display: inline-flex; border: 1px solid var(--line); border-radius: var(--radius-s); overflow: hidden; }
.segmented button { border-radius: 0; padding: 7px 12px; font-size: 14px; color: var(--steel); }
.segmented button + button { border-left: 1px solid var(--line); }
.segmented button[aria-pressed="true"] { background: var(--ink); color: var(--bg); }

.task-list { list-style: none; margin: 0; padding: 0 0 16px; overflow: auto; flex: 1; }
.task-list-pane .empty { padding: 40px 20px; }
.task-item {
  display: flex; align-items: center; gap: 12px; width: 100%; text-align: left;
  padding: 12px 14px 12px 12px; border-radius: 0; border-bottom: 1px solid var(--line);
  border-left: 3px solid transparent;
}
.task-item:hover { background: var(--surface-2); }
.task-item.current { background: var(--surface-2); }
.st-line-not_started { border-left-color: var(--line); }
.st-line-in_progress { border-left-color: var(--st-blue); }
.st-line-redirected { border-left-color: var(--st-violet); }
.st-line-needs_approval { border-left-color: var(--st-amber); }
.st-line-done { border-left-color: var(--ok); }
.st-line-overdue { border-left-color: var(--danger); }
.task-item-body { flex: 1; min-width: 0; display: grid; gap: 5px; }
.task-item-title { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.task-item-title.done, .related-title.done { color: var(--steel); text-decoration: line-through; }
.task-item-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-size: 13px; }
.task-deadline { color: var(--steel); font-variant-numeric: tabular-nums; }
.task-deadline.late { color: var(--danger); font-weight: 600; }
.task-item-doc { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--steel); min-width: 0; }
.task-item-doc span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.task-item-doc .ficon, .notice-doc .ficon { width: 18px; height: 21px; font-size: 6px; padding-bottom: 2px; }
.gone { text-decoration: line-through; color: var(--steel); }
.avatars { display: flex; flex: none; }
.avatars .avatar { border: 2px solid var(--surface); width: 28px; height: 28px; }
.avatars .avatar + .avatar { margin-left: -8px; }
.avatar.more { background: var(--steel); font-size: 11px; }

.task-pane { flex: 1; min-width: 0; display: flex; overflow: auto; background: var(--bg); }
.task-detail { width: 100%; max-width: 780px; margin: 0 auto; padding: 22px 28px 60px; }
.task-head { display: flex; align-items: flex-start; gap: 10px; }
.task-head h2 { flex: 1; margin: 0; font-size: 22px; line-height: 1.3; letter-spacing: -0.01em; word-break: break-word; }
.task-head .back { display: none; font-size: 28px; line-height: 1; padding: 0 10px 4px; color: var(--steel); }
.task-admin { display: flex; gap: 6px; flex: none; }
.task-badges { display: flex; gap: 8px; margin: 10px 0 4px; }
.task-facts { margin: 16px 0; align-items: center; }
.file-link.inline { display: inline-flex; width: auto; padding: 2px 6px; margin-left: -6px; }
.status-row {
  display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px;
  padding: 14px; border: 1px solid var(--line); border-radius: var(--radius-m); background: var(--surface);
}
.status-row label { display: grid; gap: 4px; font-size: 13px; color: var(--steel); flex: 1; min-width: 200px; }
.status-row label select { color: var(--ink); width: 100%; }
.task-detail h3 { font-size: 15px; margin: 24px 0 8px; }
.assignee-list { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.assignee {
  display: flex; align-items: center; gap: 2px;
  border: 1px solid var(--line); border-radius: 18px; background: var(--surface); padding-right: 4px;
}
.assignee .member { padding: 3px 8px 3px 3px; border-radius: 18px; }
.task-description { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-m); padding: 12px 14px; }

.activity { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.activity .event { font-size: 13px; color: var(--steel); padding: 0 0 0 2px; }
.activity .event .role-tag { margin-right: 2px; }
.activity .event.late { color: var(--danger); }
.activity .event .sep { display: inline-block; width: 8px; }
.activity time { font-variant-numeric: tabular-nums; }
.comment { display: flex; gap: 10px; align-items: flex-start; }
.comment .avatar { width: 30px; height: 30px; font-size: 12px; }
.comment-body {
  flex: 1; min-width: 0; background: var(--surface); border: 1px solid var(--line);
  border-radius: 4px 12px 12px 12px; padding: 8px 12px;
}
.comment-head { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--steel); margin-bottom: 2px; }
.person-inline { padding: 0; font: inherit; font-weight: 600; color: var(--ink); }
.person-inline:hover .nr-name { text-decoration: underline; }
.comment-form { display: flex; gap: 8px; align-items: flex-end; margin-top: 14px; }
.comment-form textarea {
  flex: 1; resize: vertical; min-height: 44px; padding: 10px 12px; font: inherit; color: inherit;
  border: 1px solid var(--line); border-radius: 10px; background: var(--surface);
}

/* связанные задачи внизу панели файла */
.related-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.related-head h3 { margin: 26px 0 8px; }
.related-head button { margin-top: 18px; }
.related-tasks { list-style: none; margin: 0; padding: 0; font-size: 14px; }
.related-tasks li { border-bottom: 1px solid var(--line); }
.related-task { display: grid; gap: 4px; width: 100%; text-align: left; padding: 9px 4px; border-radius: 0; }
.related-task:hover { background: var(--surface-2); }
.related-title { font-weight: 600; }

/* окно постановки задачи */
.task-editor .field { display: grid; gap: 5px; margin-top: 14px; font-size: 14px; font-weight: 600; }
.task-editor .field > * { font-weight: 400; }
.task-editor textarea, .task-editor input[type=datetime-local] {
  font: inherit; color: inherit; background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--radius-s); padding: 9px 12px; resize: vertical;
}
.task-editor input[type=search] { width: 100%; }
.doc-current { display: flex; align-items: center; gap: 8px; min-height: 30px; }
.doc-current .ficon { width: 22px; height: 26px; font-size: 7px; }
.hint { margin: 2px 0 0; font-size: 13px; }

/* ======================================================================
   Чат «Система»: карточки задач
   ====================================================================== */
.avatar.system { background: var(--ink); padding: 0; overflow: hidden; border-radius: 12px; }
.avatar.system img { width: 100%; height: 100%; }
.notice .msg-body { max-width: min(92%, 460px); }
.notice-card { border-left: 4px solid var(--st-blue); border-radius: 6px 14px 14px 6px; padding: 10px 14px; min-width: 260px; }
.notice-card.ev-overdue { border-left-color: var(--danger); }
.notice-card.ev-done { border-left-color: var(--ok); }
.notice-head { font-size: 13px; font-weight: 700; color: var(--st-blue); }
.ev-overdue .notice-head { color: var(--danger); }
.ev-done .notice-head { color: var(--ok); }
.notice-title { font-size: 16px; font-weight: 650; margin: 2px 0 8px; overflow-wrap: anywhere; }
.notice-facts { display: grid; grid-template-columns: auto 1fr; gap: 3px 12px; margin: 0 0 10px; font-size: 13px; }
.notice-facts dt { color: var(--steel); }
.notice-facts dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.notice-doc { display: inline-flex; align-items: center; gap: 6px; }
.notice-actions { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.system-note {
  margin: 0; padding: 14px 16px calc(14px + env(safe-area-inset-bottom));
  text-align: center; color: var(--steel); font-size: 14px;
  background: var(--surface); border-top: 1px solid var(--line);
}
.view-tasks .toasts { bottom: 24px; }

@media (max-width: 760px) {
  .tab { padding: 6px 7px; font-size: 14px; gap: 5px; }
  #logout { display: none; }              /* на телефоне выход — в своей карточке */
  .contact .logout-here { display: inline-block; margin-right: auto; }
  .task-list-pane { width: 100%; border-right: 0; }
  .task-pane { display: none; }
  .tasks-view.has-task .task-list-pane { display: none; }
  .tasks-view.has-task .task-pane { display: flex; }
  .task-head .back { display: block; }
  .task-detail { padding: 14px 16px 60px; }
  .task-head h2 { font-size: 19px; }
  .task-admin { flex-direction: column; }
  .task-list-head { flex-wrap: wrap; }
  .task-list-tools { flex-wrap: wrap; }
  .task-list-tools input, .task-list-tools select { flex: 1 1 100%; }
  .comment-form { flex-direction: column; align-items: stretch; }
}
@media (max-width: 420px) {
  .brand { display: none; }
  .tabs { margin-left: 0; }
}

/* ======================================================================
   OrgTeam: логотип и название
   ====================================================================== */
.logo {
  display: inline-block; flex: none; height: 28px; aspect-ratio: 300 / 512;
  background: currentColor;
  -webkit-mask: url(logo-mask.png) center / contain no-repeat;
  mask: url(logo-mask.png) center / contain no-repeat;
}
.brand { color: var(--top-ink); text-decoration: none; gap: 9px; border-radius: var(--radius-s); padding: 2px 4px; }
.brand .logo { height: 32px; color: var(--top-accent); }
.wordmark { font-weight: 750; letter-spacing: -0.02em; }
.brand .wordmark { font-size: 18px; }

.login-box { text-align: center; }
.login-box label, .login-box .error { text-align: left; }
.login-logo { display: block; height: 104px; margin: 0 auto 16px; color: var(--accent); }
.login-box h1.wordmark { font-size: 30px; margin: 0; }
.tagline { margin: 2px 0 20px; color: var(--steel); font-size: 15px; }
.login-box p.muted { margin-bottom: 18px; }

.avatar.system { background: var(--accent); color: var(--accent-ink); display: grid; place-items: center; }
.avatar.system .logo { height: 72%; }

/* ======================================================================
   Оформление: выбор темы в своём профиле
   ====================================================================== */
.appearance { margin-top: 20px; padding-top: 4px; border-top: 1px solid var(--line); }
.appearance h3 { margin: 16px 0 10px; }
.theme-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 8px; }
.theme-option {
  display: grid; gap: 7px; padding: 8px; text-align: left; font-size: 14px; font-weight: 600;
  border: 1px solid var(--line); border-radius: var(--radius-m); background: var(--surface);
}
.theme-option:hover { border-color: var(--steel); }
.theme-option[aria-pressed="true"] { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.theme-option[aria-pressed="true"] .theme-name::after { content: " ✓"; color: var(--accent); }
.swatch { display: flex; height: 30px; border-radius: 6px; overflow: hidden; border: 1px solid var(--line); }
.swatch span { flex: 1; }
.mode-row { display: flex; align-items: center; gap: 12px; margin-top: 12px; flex-wrap: wrap; }
.mode-row .muted { font-size: 13px; }

/* мелкие размеры логотипа — утолщённые линии, чтобы читался */
.brand .logo, .avatar.system .logo {
  -webkit-mask-image: url(logo-mask-bold.png);
  mask-image: url(logo-mask-bold.png);
}
.brand .logo { height: 36px; }
.theme-grid { grid-template-columns: repeat(5, minmax(0, 1fr)); }
@media (max-width: 560px) {
  .theme-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

/* расширение в значке файла — всегда одной строкой */
.ficon { white-space: nowrap; overflow: hidden; letter-spacing: 0; }
.task-item-doc .ficon, .notice-doc .ficon, .chip .ficon { font-size: 5.5px; }

/* ======================================================================
   Вкладки: короткие подписи на телефоне
   ====================================================================== */
.tab-short { display: none; }
.tab-short svg { display: block; }
@media (max-width: 760px) {
  .tab-long { display: none; }
  .tab-short { display: inline-flex; }
}

/* ======================================================================
   Профиль: должность, день рождения, версия
   ====================================================================== */
.job-title { margin: 0 0 4px; font-size: 15px; font-weight: 600; color: var(--ink); overflow-wrap: anywhere; }
.contact-head .link.small-note { padding: 0; margin: 0 0 4px; }
.profile-edit { margin-top: 20px; padding-top: 4px; border-top: 1px solid var(--line); }
.profile-edit h3 { margin: 16px 0 4px; }
.field { display: grid; gap: 5px; margin-top: 12px; font-size: 14px; font-weight: 600; }
.field > * { font-weight: 400; }
.field .hint { font-size: 13px; }
input[type=date], input[type=time] {
  font: inherit; color: inherit; background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--radius-s); padding: 8px 10px; max-width: 100%;
}
.profile-edit input[type=date] { width: 200px; }
.app-version { margin: 18px 0 0; text-align: center; font-size: 12px; color: var(--steel); font-variant-numeric: tabular-nums; }

/* ======================================================================
   Картинки и стикеры в сообщениях
   ====================================================================== */
.msg-images { display: grid; gap: 3px; margin: 2px 0 4px; border-radius: 10px; overflow: hidden; max-width: 340px; }
.msg-images.n2, .msg-images.n3, .msg-images.n4 { grid-template-columns: 1fr 1fr; }
.msg-image { display: block; padding: 0; border: 0; border-radius: 0; background: var(--surface-2); cursor: zoom-in; }
.msg-image img { display: block; width: 100%; height: auto; max-height: 420px; object-fit: cover; }
.msg-images.n2 img, .msg-images.n3 img, .msg-images.n4 img { aspect-ratio: 1; height: 100%; }
.msg-images.n3 .msg-image:first-child { grid-column: 1 / -1; }
.msg-images.n3 .msg-image:first-child img { aspect-ratio: 2 / 1; }
.bubble:has(> .msg-images:first-child) { padding-top: 4px; }

.sticker-bubble { background: none !important; border-color: transparent !important; padding: 0; box-shadow: none !important; }
.sticker-img { display: block; width: 160px; height: auto; max-height: 180px; object-fit: contain; border-radius: 10px; }
.sticker-bubble .quote { max-width: 220px; }
.sticker-bubble .msg-meta { justify-content: flex-end; }
.sticker-bubble .msg-meta time { background: var(--surface); border-radius: 8px; padding: 0 6px; }
.sticker-bubble .author-line { margin-bottom: 4px; }

/* картинки к отправке */
.img-chip {
  position: relative; display: inline-grid; width: 64px; height: 64px; border-radius: 8px; overflow: hidden;
  border: 1px solid var(--line); background: var(--surface-2);
}
.img-chip img { width: 100%; height: 100%; object-fit: cover; }
.img-chip.uploading img { opacity: .55; }
.img-chip.failed { border-color: var(--danger); }
.img-chip.failed img { opacity: .4; }
.img-progress {
  position: absolute; inset: auto 4px 4px 4px; text-align: center; font-size: 11px; font-weight: 700;
  background: var(--surface); color: var(--ink); border-radius: 6px; font-variant-numeric: tabular-nums;
}
.img-chip.failed .img-progress { background: var(--danger); color: var(--on-danger); }
.img-chip .chip-x {
  position: absolute; top: 2px; right: 2px; width: 22px; height: 22px; padding: 0; border-radius: 50%;
  background: var(--surface); border: 1px solid var(--line); font-size: 15px; line-height: 1; color: var(--ink);
}

/* просмотр картинки */
.image-modal { width: min(1100px, calc(100% - 24px)); padding: 14px; background: var(--surface); }
.lightbox { margin: 0; display: grid; gap: 10px; justify-items: center; }
.lightbox img { max-width: 100%; max-height: calc(100vh - 140px); border-radius: 6px; cursor: zoom-out; }
.lightbox figcaption { display: flex; gap: 8px; }
.lightbox .modal-close { background: var(--surface); }

/* перетаскивание в переписку */
.conversation > .drop-hint { position: absolute; inset: 0; z-index: 5; text-align: center; padding: 20px; }

/* панель стикеров */
.sticker-pop {
  position: absolute; right: 16px; bottom: calc(100% - 4px); z-index: 4;
  width: min(380px, calc(100% - 32px)); max-height: min(440px, 60vh);
  display: flex; flex-direction: column;
  background: var(--surface); border: 1px solid var(--line); border-radius: 12px;
  box-shadow: 0 10px 30px rgba(16, 24, 32, .22);
}
.sticker-head { display: flex; align-items: center; gap: 8px; padding: 10px 12px 8px; border-bottom: 1px solid var(--line); }
.sticker-head strong { margin-right: auto; }
.sticker-head .link.on { font-weight: 700; }
.sticker-grid {
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px;
  padding: 10px; overflow-y: auto; overscroll-behavior: contain;
}
.sticker-cell { position: relative; }
.sticker-pick {
  display: block; width: 100%; aspect-ratio: 1; padding: 4px; border-radius: 10px; background: var(--surface-2);
}
.sticker-pick:hover:not(:disabled) { background: var(--accent-glow); transform: scale(1.04); }
.sticker-pick:disabled { opacity: .6; cursor: default; }
.sticker-pick img { width: 100%; height: 100%; object-fit: contain; border-radius: 6px; }
.sticker-del {
  position: absolute; top: -4px; right: -4px; width: 24px; height: 24px; padding: 0; border-radius: 50%;
  background: var(--danger); color: var(--on-danger); font-size: 16px; line-height: 1;
}
.sticker-empty { padding: 20px 14px; margin: 0; text-align: center; }
.sticker-note { margin: 0; padding: 6px 12px 10px; font-size: 12px; border-top: 1px solid var(--line); }
#sticker-btn[aria-expanded="true"] { background: var(--surface-2); color: var(--accent); }

@media (max-width: 760px) {
  .sticker-pop { right: 8px; left: 8px; width: auto; max-height: 55vh; }
  .msg-images { max-width: 260px; }
  .sticker-img { width: 130px; }
}

/* ======================================================================
   Календарь: цвета видов (из темы — --ev-* в themes.css)
   ====================================================================== */
.ev-meeting { --c: var(--ev-meeting); }
.ev-planerka { --c: var(--ev-planerka); }
.ev-trip { --c: var(--ev-trip); }
.ev-call { --c: var(--ev-call); }
.ev-training { --c: var(--ev-training); }
.ev-other { --c: var(--ev-other); }
.ev-birthday { --c: var(--ev-birthday); }
.ev-deadline { --c: var(--ev-deadline); }

.calendar-view { flex: 1; min-height: 0; display: flex; background: var(--bg); }
.cal-main { flex: 1; min-width: 0; display: flex; flex-direction: column; min-height: 0; }
.cal-toolbar {
  display: flex; align-items: center; gap: 10px; padding: 12px 16px;
  background: var(--surface); border-bottom: 1px solid var(--line);
}
.cal-nav { display: flex; }
.cal-nav .icon-btn { font-size: 26px; line-height: 1; width: 38px; height: 38px; color: var(--ink); }
.cal-title { margin: 0 auto 0 4px; font-size: 21px; font-weight: 650; letter-spacing: -0.01em; }

.cal-grid {
  flex: 1; min-height: 0; display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  grid-template-rows: auto repeat(6, minmax(0, 1fr));
  border-left: 1px solid var(--line);
}
.cal-wd {
  padding: 6px 8px; font-size: 12px; font-weight: 600; color: var(--steel); text-transform: uppercase;
  letter-spacing: .04em; background: var(--surface); border: solid var(--line); border-width: 0 1px 1px 0;
}
.cal-cell {
  position: relative; min-width: 0; min-height: 0; overflow: hidden;
  display: flex; flex-direction: column; gap: 2px; padding: 4px 4px 2px;
  background: var(--surface); border: solid var(--line); border-width: 0 1px 1px 0; cursor: pointer;
}
.cal-cell.weekend { background: var(--surface-2); }
.cal-cell.other { background: var(--bg); }
.cal-cell.other .cal-num { color: var(--steel); opacity: .75; }
.cal-cell:hover { box-shadow: inset 0 0 0 1px var(--steel); }
.cal-cell.selected { box-shadow: inset 0 0 0 2px var(--accent); }
.cal-cell:focus-visible { outline-offset: -3px; }
.cal-num {
  align-self: flex-start; min-width: 26px; height: 26px; padding: 0 6px; border-radius: 13px;
  display: grid; place-items: center; font-size: 13px; font-weight: 600; font-variant-numeric: tabular-nums;
}
.cal-cell.today .cal-num { background: var(--accent); color: var(--accent-ink); }
.cal-chips { display: grid; gap: 2px; min-width: 0; }
.cal-chip {
  display: block; width: 100%; min-width: 0; padding: 1px 6px; text-align: left;
  font-size: 12px; line-height: 18px; border-radius: 4px; color: var(--ink);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.cal-chip.all-day { background: color-mix(in srgb, var(--c) 20%, var(--surface)); box-shadow: inset 3px 0 0 var(--c); }
.cal-chip.timed { padding-left: 4px; }
.cal-chip.timed::before {
  content: ""; display: inline-block; width: 7px; height: 7px; border-radius: 50%;
  background: var(--c); margin-right: 5px; vertical-align: 1px;
}
.cal-chip:hover { filter: brightness(.97); background: color-mix(in srgb, var(--c) 28%, var(--surface)); }
.cal-chip.done .cal-chip-text { text-decoration: line-through; color: var(--steel); }
.cal-chip.late { font-weight: 600; }
.cal-more { padding: 0 6px; font-size: 12px; color: var(--steel); text-align: left; }
.cal-more:hover { color: var(--ink); text-decoration: underline; }
.cal-dots { display: none; }
.cal-dot { display: inline-block; flex: none; width: 8px; height: 8px; border-radius: 50%; background: var(--c); }

.cal-day {
  width: 330px; flex: none; overflow: auto; padding: 16px;
  background: var(--surface); border-left: 1px solid var(--line);
}
.cal-day-head { display: flex; align-items: flex-start; gap: 8px; }
.cal-day-head h2 { flex: 1; margin: 2px 0 0; font-size: 17px; }
.cal-agenda { list-style: none; margin: 14px 0 0; padding: 0; display: grid; gap: 6px; }
.cal-agenda-item {
  display: flex; align-items: stretch; gap: 10px; width: 100%; text-align: left; white-space: normal;
  padding: 8px 10px 8px 8px; border-radius: 8px; background: color-mix(in srgb, var(--c) 12%, var(--surface));
}
.cal-agenda-item:hover { background: color-mix(in srgb, var(--c) 22%, var(--surface)); }
.cal-bar { flex: none; width: 4px; border-radius: 2px; background: var(--c); }
.cal-agenda-title { font-weight: 600; overflow-wrap: anywhere; }
.cal-agenda-sub { font-size: 13px; color: var(--steel); }
.cal-agenda-item.done .cal-agenda-title { text-decoration: line-through; color: var(--steel); }
.cal-free { margin: 16px 0 0; }
.cal-legend { display: flex; flex-wrap: wrap; gap: 6px 12px; margin-top: 22px; padding-top: 12px; border-top: 1px solid var(--line); font-size: 12px; color: var(--steel); }
.cal-legend-item { display: inline-flex; align-items: center; gap: 6px; }

/* карточка мероприятия */
.event-head { display: flex; gap: 12px; padding-right: 30px; }
.event-head .cal-bar { width: 6px; }
.event-head h2 { margin: 0 0 4px; overflow-wrap: anywhere; }
.event-head p { margin: 0; }
.event-type { font-size: 13px; font-weight: 700; color: var(--c); text-transform: uppercase; letter-spacing: .04em; }
.event-when { font-size: 15px; }
.event-card .facts { margin: 16px 0 8px; }
.event-card .member-list { margin-top: 4px; }

/* окно мероприятия */
.event-editor .type-pills { display: flex; flex-wrap: wrap; gap: 6px; }
.type-pill {
  display: inline-flex; align-items: center; gap: 7px; padding: 5px 12px 5px 10px; border-radius: 16px;
  border: 1px solid var(--line); background: var(--surface); font-size: 14px;
}
.type-pill[aria-checked="true"] {
  border-color: var(--c); background: color-mix(in srgb, var(--c) 18%, var(--surface));
  box-shadow: inset 0 0 0 1px var(--c); font-weight: 600;
}
.when-row, .time-row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.inline-field { display: inline-flex; align-items: center; gap: 8px; font-weight: 400; color: var(--steel); }
.inline-field input, .inline-field select { color: var(--ink); }
.check-row { display: inline-flex; align-items: center; gap: 8px; font-weight: 400; cursor: pointer; width: fit-content; }
.check-row input { width: 18px; height: 18px; accent-color: var(--accent); }
.pick-list.disabled { opacity: .55; }

/* уведомления о мероприятиях в чате «Система» */
.notice-card.cal-notice { border-left-color: var(--c); }
.cal-notice .notice-head { color: var(--c); }
.notice-card.gone-card { border-left-color: var(--steel); }
.gone-card .notice-head { color: var(--steel); }

@media (max-width: 760px) {
  .calendar-view { flex-direction: column; overflow: auto; }
  .cal-main { flex: none; }
  .cal-toolbar { padding: 8px 10px; gap: 6px; flex-wrap: wrap; }
  .cal-title { font-size: 18px; order: -1; flex-basis: 100%; margin: 0 0 2px 2px; }
  #cal-add { margin-left: auto; padding: 8px 12px; }
  #cal-today { padding: 7px 12px; }
  .cal-grid { grid-template-rows: auto repeat(6, 52px); flex: none; }
  .cal-wd { padding: 4px 0; text-align: center; font-size: 11px; }
  .cal-cell { align-items: center; padding: 3px 1px; gap: 3px; }
  .cal-num { align-self: center; min-width: 26px; height: 26px; }
  .cal-chips { display: none; }
  .cal-dots { display: flex; gap: 3px; justify-content: center; }
  .cal-dot { width: 6px; height: 6px; }
  .cal-day { width: auto; border-left: 0; border-top: 1px solid var(--line); overflow: visible; padding: 14px 14px 40px; }
  .view-calendar .toasts { bottom: 24px; }
}

/* ======================================================================
   Прогресс, подзадачи, этап у задачи
   ====================================================================== */
.progress {
  display: block; position: relative; height: 8px; min-width: 60px; border-radius: 4px; overflow: hidden;
  background: var(--surface-2); box-shadow: inset 0 0 0 1px var(--line);
}
.progress-fill { position: absolute; inset: 0 auto 0 0; background: var(--accent); border-radius: 4px; }
.progress-pct { font-size: 13px; font-weight: 700; font-variant-numeric: tabular-nums; }
.progress-row { display: flex; align-items: center; gap: 8px; }
.progress-row .progress { flex: 1; }

.task-item-stage { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--steel); min-width: 0; }
.stage-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.subtask-count { font-size: 12px; color: var(--steel); font-variant-numeric: tabular-nums; white-space: nowrap; }
.stage-link { padding: 0; text-align: left; white-space: normal; }

.subtasks-head { display: flex; align-items: center; gap: 10px; margin: 24px 0 8px; }
.subtasks-head h3 { margin: 0; }
.subtasks-head .progress { flex: 1; max-width: 240px; }
.subtask-list { list-style: none; margin: 0; padding: 0; border: 1px solid var(--line); border-radius: var(--radius-m); background: var(--surface); }
.subtask-list li { display: flex; align-items: center; gap: 8px; padding: 6px 8px 6px 10px; }
.subtask-list li + li { border-top: 1px solid var(--line); }
.subtask-list .check-row { flex: 1; min-width: 0; }
.subtask-title { overflow-wrap: anywhere; }
.subtask-list li.done .subtask-title { text-decoration: line-through; color: var(--steel); }
.subtask-add { display: flex; gap: 8px; margin-top: 8px; }
.subtask-add input { flex: 1; min-width: 0; }
.subtask-num { min-width: 22px; color: var(--steel); font-variant-numeric: tabular-nums; }
.subtask-list li > .subtask-title { flex: 1; min-width: 0; }
.task-editor .subtask-list li { padding: 4px 6px 4px 10px; }
.subtasks .hint { margin: 0; }
.task-editor select { width: 100%; }

/* ======================================================================
   Проекты
   ====================================================================== */
.projects-view { flex: 1; min-height: 0; display: flex; background: var(--bg); }
.project-list-pane { display: none; }
.projects-view.manage .project-list-pane {
  display: flex; flex-direction: column; width: 280px; flex: none; min-height: 0;
  border-right: 1px solid var(--line); background: var(--surface);
}
.project-list-head { display: flex; align-items: center; gap: 8px; padding: 14px 14px 10px; }
.project-list-head h2 { flex: 1; margin: 0; font-size: 17px; }
.project-list { list-style: none; margin: 0; padding: 0 0 16px; overflow: auto; flex: 1; }
.project-item {
  display: grid; gap: 4px; width: 100%; text-align: left; padding: 12px 14px; border-radius: 0;
  border-bottom: 1px solid var(--line); white-space: normal;
}
.project-item:hover { background: var(--surface-2); }
.project-item.current { background: var(--surface-2); box-shadow: inset 3px 0 0 var(--accent); }
.project-item-title { font-weight: 650; overflow-wrap: anywhere; }
.project-item-dates { font-size: 13px; color: var(--steel); }
.empty-note { padding: 20px 14px; }

.project-pane { flex: 1; min-width: 0; display: flex; flex-direction: column; overflow: auto; }
.project { display: flex; flex-direction: column; gap: 14px; padding: 18px 20px 30px; min-height: 0; }
.project-head { display: flex; align-items: flex-start; gap: 12px; }
.project-head .back { display: none; font-size: 28px; line-height: 1; padding: 0 10px 4px; color: var(--steel); }
.project-head-main { flex: 1; min-width: 0; }
.project-head h1 { margin: 0; font-size: 22px; letter-spacing: -0.01em; overflow-wrap: anywhere; }
.project-desc { margin: 4px 0 0; white-space: pre-wrap; }
.project-actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.project-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 10px; }
.stat {
  display: grid; gap: 6px; padding: 12px 14px; text-align: left; white-space: normal;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-m);
}
.stat.clickable:hover { border-color: var(--steel); }
.stat-label { font-size: 13px; color: var(--steel); }
.stat-value { font-size: 24px; font-weight: 750; font-variant-numeric: tabular-nums; line-height: 1.1; }
.gantt-tools { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }

/* --- таблица + диаграмма Ганта --- */
.gantt {
  --table-w: 640px;
  position: relative; overflow: auto; max-height: calc(100vh - 260px); min-height: 160px;
  border: 1px solid var(--line); border-radius: var(--radius-m); background: var(--surface);
}
.g-row { display: flex; width: calc(var(--table-w) + var(--g-width)); height: 40px; }
.g-table {
  position: sticky; left: 0; z-index: 3; flex: none; width: var(--table-w);
  display: grid; grid-template-columns: 44px minmax(0, 1fr) 96px 132px 96px 66px 50px; align-items: center;
  background: var(--surface); border-right: 1px solid var(--line); border-bottom: 1px solid var(--line);
}
.g-time { position: relative; flex: none; width: var(--g-width); border-bottom: 1px solid var(--line); }
.g-head { position: sticky; top: 0; z-index: 4; height: 48px; }
.g-head .g-table { font-size: 12px; font-weight: 650; color: var(--steel); background: var(--surface-2); }
.g-head .g-time { background: var(--surface-2); }
.g-c { padding: 0 6px; min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; font-size: 13px; }
.g-wbs { color: var(--steel); font-variant-numeric: tabular-nums; }
.g-name { display: flex; align-items: center; gap: 4px; }
.g-title { padding: 2px 4px; min-width: 0; overflow: hidden; text-overflow: ellipsis; text-align: left; border-radius: 4px; }
.g-title:hover { background: var(--surface-2); text-decoration: underline; }
.g-row.stage .g-title { font-weight: 700; }
.g-row.sub .g-name { padding-left: 22px; }
.g-add { padding: 0 6px; font-size: 16px; line-height: 20px; color: var(--steel); border-radius: 4px; }
.g-add:hover { background: var(--surface-2); color: var(--accent); }
.g-dur { display: flex; align-items: center; gap: 4px; }
.g-dur input { width: 56px; padding: 4px 6px; font: inherit; color: inherit; background: var(--bg); border: 1px solid var(--line); border-radius: 4px; }
.g-start input[type=date] { padding: 3px 4px; font-size: 13px; width: 120px; background: var(--bg); }
.g-end, .g-pct { font-variant-numeric: tabular-nums; }
.g-pct { font-weight: 650; text-align: right; }
.g-deps { color: var(--steel); }
.g-deps.late { color: var(--danger); font-weight: 650; }
.g-row.current .g-table { box-shadow: inset 3px 0 0 var(--accent); }

.g-scale { position: relative; height: 100%; }
.g-months, .g-days { position: absolute; left: 0; right: 0; height: 24px; }
.g-months { top: 0; border-bottom: 1px solid var(--line); }
.g-days { top: 24px; }
.g-month { position: absolute; top: 0; height: 24px; padding: 4px 0; font-size: 12px; font-weight: 650; border-left: 1px solid var(--line); white-space: nowrap; }
.g-month-text { position: sticky; left: calc(var(--table-w) + 6px); padding: 0 6px; }
.g-day { position: absolute; top: 0; height: 24px; padding-top: 4px; font-size: 11px; text-align: center; color: var(--steel); border-left: 1px solid var(--line); }
.g-day.weekend { background: var(--bg); }
.g-day.today { background: var(--accent); color: var(--accent-ink); font-weight: 700; }

.g-body { position: relative; }
.g-layer { position: absolute; top: 0; left: var(--table-w); z-index: 1; pointer-events: none; }
.g-today { position: absolute; top: 0; bottom: 0; width: 2px; margin-left: -1px; background: var(--danger); opacity: .55; }
.g-arrows { position: absolute; inset: 0; overflow: visible; }
.g-arrow { fill: none; stroke: var(--steel); stroke-width: 1.4; }
.g-arrow-head { fill: var(--steel); }
.g-arrow.late { stroke: var(--danger); }
.g-arrow-head.late { fill: var(--danger); }

.g-bar {
  position: absolute; z-index: 2; padding: 0; border-radius: 4px; overflow: hidden; cursor: pointer;
  background: color-mix(in srgb, var(--accent) 30%, var(--surface)); box-shadow: inset 0 0 0 1px var(--accent);
}
.g-bar.sub { top: 11px; height: 18px; }
.g-bar .g-fill { position: absolute; inset: 0 auto 0 0; background: var(--accent); }
.g-bar.stage {
  top: 13px; height: 12px; border-radius: 2px; overflow: visible;
  background: color-mix(in srgb, var(--ink) 25%, var(--surface)); box-shadow: none;
}
.g-bar.stage .g-fill { background: var(--ink); border-radius: 2px; }
.g-bar.stage::before, .g-bar.stage::after {
  content: ""; position: absolute; bottom: -5px; width: 0; height: 0;
  border: 5px solid transparent; border-top-color: var(--ink);
}
.g-bar.stage::before { left: -5px; }
.g-bar.stage::after { right: -5px; }
.g-bar.outside { box-shadow: inset 0 0 0 2px var(--danger); }
.g-bar:hover { filter: brightness(1.08); }
.g-label { position: absolute; top: 11px; z-index: 2; font-size: 12px; white-space: nowrap; color: var(--steel); pointer-events: none; }
.g-row.stage .g-label { font-weight: 650; color: var(--ink); }

.g-wbs-tag { min-width: 32px; font-size: 12px; color: var(--steel); font-variant-numeric: tabular-nums; }
.name-text.strong { font-weight: 650; }
.item-progress { display: flex; align-items: center; gap: 10px; margin: 6px 0 4px; }
.item-progress .progress { flex: 1; max-width: 260px; }
.milestone-card h2 { margin-top: 2px; }
.ev-milestone { --c: var(--accent); }
.ev-milestone.sub { --c: var(--ev-other); }

/* --- продвижение текущего этапа (для сотрудников) --- */
.progress-only { width: 100%; max-width: 820px; margin: 0 auto; padding: 22px 20px 50px; }
.progress-only > h2 { margin: 0 0 14px; font-size: 21px; }
.project-progress { margin-bottom: 26px; }
.project-progress-title { margin: 0; font-size: 17px; }
.project-progress > .muted { margin: 2px 0 8px; font-size: 14px; }
.stage-card { padding: 16px 18px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-m); }
.stage-card > .progress { height: 12px; border-radius: 6px; }
.stage-card-head { display: flex; align-items: flex-start; gap: 12px; margin-bottom: 10px; }
.stage-card-head > div:first-child { flex: 1; min-width: 0; }
.stage-card h3 { margin: 2px 0 2px; font-size: 19px; overflow-wrap: anywhere; }
.stage-card h4 { margin: 18px 0 8px; font-size: 14px; }
.stage-card p { margin: 0; }
.stage-kicker { font-size: 12px; font-weight: 700; color: var(--accent); text-transform: uppercase; letter-spacing: .04em; }
.big-pct { font-size: 34px; font-weight: 800; font-variant-numeric: tabular-nums; line-height: 1; color: var(--accent); }
.stage-card .hint { margin-top: 6px; }
.stage-desc { margin-top: 10px; padding: 10px 12px; background: var(--surface-2); border-radius: var(--radius-s); }
.substage-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.substage-top { display: flex; align-items: baseline; gap: 10px; margin-bottom: 4px; font-size: 14px; }
.substage-title { flex: 1; min-width: 0; font-weight: 600; overflow-wrap: anywhere; }
.stage-tasks { list-style: none; margin: 0; padding: 0; border: 1px solid var(--line); border-radius: var(--radius-s); }
.stage-tasks li + li { border-top: 1px solid var(--line); }
.stage-task { display: flex; align-items: center; gap: 8px; width: 100%; text-align: left; padding: 8px 10px; border-radius: 0; }
.stage-task:hover { background: var(--surface-2); }
.stage-task-title { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; font-weight: 600; }
.stage-task-title.done { text-decoration: line-through; color: var(--steel); }
.stage-task .avatars .avatar { width: 24px; height: 24px; font-size: 11px; }

@media (max-width: 760px) {
  .projects-view.manage .project-list-pane { width: 100%; border-right: 0; }
  .projects-view.manage .project-pane { display: none; }
  .projects-view.manage.has-project .project-list-pane { display: none; }
  .projects-view.manage.has-project .project-pane { display: flex; }
  .project { padding: 12px 12px 30px; }
  .project-head { flex-wrap: wrap; }
  .project-head .back { display: block; }
  .project-head h1 { font-size: 19px; }
  .project-actions { width: 100%; justify-content: flex-start; }
  .gantt { --table-w: 190px; max-height: none; }
  .g-table { grid-template-columns: 34px minmax(0, 1fr) 42px; }
  .g-dur, .g-start, .g-end, .g-deps { display: none; }
  .g-row.sub .g-name { padding-left: 8px; }
  .progress-only { padding: 14px 12px 40px; }
  .big-pct { font-size: 28px; }
}

/* ======================================================================
   Сводки и напоминания в чате «Система»
   ====================================================================== */
.notice .msg-body:has(.digest-card) { max-width: min(96%, 600px); }
.digest-card { border-left-color: var(--accent); min-width: min(100%, 420px); }
.digest-card .notice-head { color: var(--accent); font-size: 14px; }
.digest-evening { border-left-color: var(--st-violet); }
.digest-evening .notice-head { color: var(--st-violet); }
.digest-day { border-left-color: var(--st-amber); }
.digest-day .notice-head { color: var(--st-amber); }
.digest-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; margin: 10px 0 4px; }
.digest-stat { display: grid; gap: 2px; padding: 8px; border-radius: 8px; background: var(--surface-2); text-align: center; }
.digest-stat strong { font-size: 20px; line-height: 1.1; font-variant-numeric: tabular-nums; }
.digest-stat span { font-size: 11px; color: var(--steel); line-height: 1.25; }
.digest-stat.late strong { color: var(--danger); }
.digest-card h4 { margin: 12px 0 4px; font-size: 13px; }
.digest-card h4.late { color: var(--danger); }
.digest-line { margin: 0; font-size: 14px; }
.delta { color: var(--ok); font-weight: 700; font-size: 12px; }
.digest-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; font-size: 14px; }
.digest-list .link { padding: 0; text-align: left; white-space: normal; color: var(--ink); text-decoration-color: var(--line); }
.digest-stages { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; font-size: 14px; }
.digest-stage-top { display: flex; align-items: center; gap: 10px; margin-bottom: 3px; }
.digest-stage-top span { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.digest-stage-top .progress { flex: 1; }
.team-table { width: 100%; border-collapse: collapse; font-size: 13px; font-variant-numeric: tabular-nums; }
.team-table th { text-align: left; font-weight: 600; color: var(--steel); font-size: 11px; padding: 4px 6px; border-bottom: 1px solid var(--line); }
.team-table td { padding: 5px 6px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.team-table td:first-child { max-width: 160px; overflow: hidden; text-overflow: ellipsis; }
.team-table tr.idle td { color: var(--steel); }
.team-table td.late { color: var(--danger); font-weight: 650; }
.digest-card .notice-actions { margin-top: 12px; }
.birthday-card { border-left-color: var(--ev-birthday); }
.birthday-card .notice-head { color: var(--ev-birthday); }
.stage-card-notice { border-left-color: var(--accent); }
.stage-card-notice .notice-head { color: var(--accent); }
.notice-card.ev-soon { border-left-color: var(--st-amber); }
.ev-soon .notice-head { color: var(--st-amber); }
.notify-settings { margin-top: 20px; padding-top: 4px; border-top: 1px solid var(--line); }
.notify-settings h3 { margin: 16px 0 6px; }
.notify-settings .mode-row { font-size: 14px; }
.notify-settings .mode-row > span { flex: 1; min-width: 200px; }
@media (max-width: 760px) {
  .digest-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .team-table th:nth-child(3), .team-table td:nth-child(3), .team-table th:nth-child(4), .team-table td:nth-child(4) { display: none; }
}
.topbar .avatar { box-shadow: 0 0 0 1.5px var(--top-accent); }
