/* ============================================================
   MihaMini — UI styles (built on Rostelecom design system tokens)
   ============================================================ */

*, *::before, *::after { box-sizing: border-box; }

html, body {
  margin: 0;
  background:
    radial-gradient(1200px 600px at 80% -10%, rgba(155, 51, 255, 0.06), transparent 60%),
    radial-gradient(900px 500px at -10% 30%, rgba(116, 159, 214, 0.055), transparent 55%),
    radial-gradient(700px 400px at 50% 100%, rgba(119, 0, 255, 0.025), transparent 55%),
    linear-gradient(180deg, #FAFAFC 0%, #F5F4F8 100%);
  background-attachment: fixed;
  color: var(--rt-fg);
  font-family: var(--rt-font-sans);
  font-size: var(--rt-fs-14);
  line-height: var(--rt-lh-body);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  letter-spacing: 0;
}
body.rt {
  height: 100vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

input, select, textarea, button {
  font: inherit;
  color: inherit;
}

button { cursor: pointer; }
textarea { resize: vertical; }
.hidden-shim { display: none; }
.hidden-select { display: none; }

/* ============================ FORM CONTROLS ============================ */
.btn, .btn-lite, .btn-danger,
input:not([type="checkbox"]):not([type="radio"]):not([type="file"]),
select, textarea {
  border-radius: var(--rt-radius-md);
  border: 1px solid var(--rt-border);
  background: var(--rt-surface);
  color: var(--rt-fg);
  padding: 10px 14px;
  font-size: var(--rt-fs-14);
  transition: border-color var(--rt-dur-fast) var(--rt-ease-standard),
              background var(--rt-dur-fast) var(--rt-ease-standard),
              box-shadow var(--rt-dur-fast) var(--rt-ease-standard);
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--rt-purple-400);
  box-shadow: 0 0 0 3px rgba(119, 0, 255, 0.12);
}

.btn {
  background:
    linear-gradient(180deg, rgba(255,255,255,0.12), rgba(0,0,0,0) 60%),
    var(--rt-purple-500);
  color: #fff;
  border-color: var(--rt-purple-500);
  font-weight: 600;
  letter-spacing: 0;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.20),
    0 1px 2px rgba(119, 0, 255, 0.25),
    0 6px 14px -6px rgba(119, 0, 255, 0.45);
}
.btn:hover { background:
    linear-gradient(180deg, rgba(255,255,255,0.10), rgba(0,0,0,0) 60%),
    var(--rt-purple-600);
  border-color: var(--rt-purple-600);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.18),
    0 2px 4px rgba(119, 0, 255, 0.30),
    0 10px 20px -8px rgba(119, 0, 255, 0.50);
}
.btn:active { background: var(--rt-purple-700); border-color: var(--rt-purple-700); transform: translateY(0.5px); }
.btn--accent {
  background:
    linear-gradient(180deg, rgba(255,255,255,0.14), rgba(0,0,0,0) 60%),
    var(--rt-orange-500);
  border-color: var(--rt-orange-500);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.20),
    0 1px 2px rgba(255, 79, 18, 0.25),
    0 6px 14px -6px rgba(255, 79, 18, 0.45);
}
.btn--accent:hover { background:
    linear-gradient(180deg, rgba(255,255,255,0.10), rgba(0,0,0,0) 60%),
    var(--rt-orange-600);
  border-color: var(--rt-orange-600);
}

.btn-lite {
  background: var(--rt-surface);
  color: var(--rt-fg);
  border-color: var(--rt-border);
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}
.btn-lite:hover { border-color: var(--rt-purple-300); background: var(--rt-purple-50); color: var(--rt-purple-700); }

.btn-danger {
  background: var(--rt-danger-bg);
  color: var(--rt-danger);
  border-color: rgba(229, 53, 75, 0.3);
}
.btn-danger:hover { background: #fbd5da; }

.btn-sm { padding: 6px 10px; font-size: var(--rt-fs-12); border-radius: var(--rt-radius-sm); font-weight: 500; }

input[type="file"] {
  padding: 6px 10px;
  background: var(--rt-surface-2);
}

/* ============================ HEADER ============================ */
.app-header {
  position: relative; z-index: 50;
  flex-shrink: 0;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(255, 255, 255, 0.88));
  backdrop-filter: blur(14px) saturate(140%);
  -webkit-backdrop-filter: blur(14px) saturate(140%);
  border-bottom: 1px solid rgba(119, 0, 255, 0.08);
  box-shadow: 0 1px 0 rgba(255,255,255,0.6) inset, 0 8px 24px -16px rgba(16, 16, 24, 0.12);
}
.app-header__inner {
  max-width: 1480px;
  margin: 0 auto;
  padding: 14px 24px;
  display: grid;
  grid-template-columns: 320px minmax(280px, 1fr) auto;
  gap: 20px;
  align-items: center;
}
.app-brand {
  display: flex; align-items: center; gap: 12px;
}
.app-brand__logo {
  width: 72px; height: 72px;
  border-radius: 50%;
  background:
    radial-gradient(120% 120% at 30% 20%, #D8B4FE 0%, #A855F7 55%, #6D28D9 100%);
  display: grid; place-items: center;
  overflow: hidden;
  flex-shrink: 0;
  position: relative;
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.30),
    0 8px 22px -8px rgba(168, 85, 247, 0.70),
    0 3px 6px -1px rgba(0, 0, 0, 0.40),
    0 0 0 3px rgba(168, 85, 247, 0.18);
}
.app-brand__logo-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 45%;
  display: block;
}
.app-brand { gap: 16px; }
.app-brand__name { font-size: var(--rt-fs-20); }
.app-brand__name { font-weight: 700; font-size: var(--rt-fs-18); letter-spacing: 0; }
.app-brand__meta {
  display: flex; gap: 6px;
  font-size: var(--rt-fs-12);
  color: var(--rt-fg-muted);
  font-weight: 500;
}
.app-brand__meta .dot { opacity: 0.5; }

/* Search */
.searchbox {
  position: relative;
}
.search__input {
  width: 100%;
  height: 44px;
  padding: 0 56px 0 44px !important;
  font-size: var(--rt-fs-14);
  background: var(--rt-surface) !important;
  border-radius: var(--rt-radius-md);
}
.search__icon {
  position: absolute; left: 14px; top: 13px;
  color: var(--rt-fg-muted);
  pointer-events: none;
}
.search__kbd {
  position: absolute; right: 10px; top: 11px;
  padding: 3px 7px;
  font-family: var(--rt-font-mono);
  font-size: 11px;
  color: var(--rt-fg-muted);
  background: var(--rt-surface-2);
  border: 1px solid var(--rt-border);
  border-radius: var(--rt-radius-sm);
  pointer-events: none;
  white-space: nowrap;
}
.search-results {
  position: absolute; left: 0; right: 0; top: 50px;
  background: var(--rt-surface);
  border: 1px solid var(--rt-border);
  border-radius: var(--rt-radius-md);
  box-shadow: var(--rt-shadow-lg);
  padding: 6px;
  display: none;
  z-index: 60;
  max-height: 440px;
  overflow: auto;
}
.search-results.show { display: block; }
.search-item {
  padding: 10px 12px;
  border-radius: var(--rt-radius-sm);
}
.search-item:hover { background: var(--rt-purple-50); }
.search-item .subtle { color: var(--rt-fg-muted); font-size: var(--rt-fs-12); }

/* Header actions */
.header-actions { display: flex; gap: 8px; align-items: center; }
.icon-btn {
  width: 44px; height: 44px;
  border-radius: var(--rt-radius-md);
  background: var(--rt-surface);
  border: 1px solid var(--rt-border);
  display: grid; place-items: center;
  color: var(--rt-fg);
  position: relative;
  transition: all var(--rt-dur-fast) var(--rt-ease-standard);
}
.icon-btn:hover {
  background: var(--rt-purple-50);
  border-color: var(--rt-purple-200);
  color: var(--rt-purple-700);
}
.icon-btn--ghost {
  background: transparent;
  border-color: transparent;
}
.icon-btn--ghost:hover { background: var(--rt-purple-50); }
.icon-btn__chip {
  position: absolute; top: 6px; right: 6px;
  width: 8px; height: 8px;
  background: var(--rt-orange-500);
  border-radius: 50%;
  font-size: 0;
}

/* ============================ ROLE RAIL ============================ */
.role-rail {
  position: relative; z-index: 40;
  flex-shrink: 0;
  background:
    linear-gradient(180deg, var(--rt-surface), rgba(255,255,255,0.92));
  border-bottom: 1px solid rgba(119, 0, 255, 0.08);
  box-shadow: 0 1px 0 rgba(255,255,255,0.6) inset, 0 4px 16px -8px rgba(16, 16, 24, 0.06);
}
.role-rail__inner {
  max-width: 1480px;
  margin: 0 auto;
  padding: 14px 24px 16px;
}
.role-rail__head {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 24px;
  margin-bottom: 14px;
}
.role-rail__heading {
  display: inline-flex;
  align-items: center;
  gap: 14px;
}
.role-rail__breadcrumb {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
  color: var(--rt-fg-muted);
  font-size: var(--rt-fs-13, 13px);
}
.bc-step {
  background: none;
  border: none;
  padding: 4px 8px;
  border-radius: var(--rt-radius-sm);
  font: inherit;
  font-size: var(--rt-fs-13, 13px);
  color: var(--rt-fg-muted);
  cursor: pointer;
}
.bc-step:hover { background: var(--rt-purple-50); color: var(--rt-purple-700); }
.bc-step.is-current { color: var(--rt-purple-700); font-weight: 600; background: var(--rt-purple-50); }
.bc-sep { color: var(--rt-border-strong); font-weight: 400; }
.bc-empty { font-style: italic; color: var(--rt-fg-muted); font-size: var(--rt-fs-12); }

.rt-eyebrow {
  font-size: var(--rt-fs-12);
  font-weight: 500;
  letter-spacing: var(--rt-ls-wide);
  text-transform: uppercase;
  color: var(--rt-fg-brand);
}
.rt-eyebrow--muted { color: var(--rt-fg-muted); }

.role-current {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 6px 14px 6px 6px;
  background: var(--rt-purple-50);
  border: 1px solid var(--rt-purple-100);
  border-radius: var(--rt-radius-pill);
}
.role-current__avatar {
  width: 30px; height: 30px;
  border-radius: 50%;
  background: var(--rt-purple-500);
  color: #fff;
  display: grid; place-items: center;
  font-weight: 700; font-size: 12px;
  letter-spacing: 0;
}
.role-current > div { display: flex; flex-direction: column; gap: 0; min-width: 0; }
.role-current__name { font-weight: 600; font-size: var(--rt-fs-14); color: var(--rt-fg); line-height: 1; white-space: nowrap; }
.role-current__path { font-size: 11px; color: var(--rt-fg-muted); font-family: var(--rt-font-mono); margin-top: 2px; white-space: nowrap; }

/* Top-down context tree */
.context-tree {
  display: grid;
  gap: 18px;
}
.context-level {
  display: grid;
  gap: 8px;
}
.context-level-items {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}
.context-pill {
  display: inline-flex;
  flex-direction: column;
  justify-content: center;
  min-width: 132px;
  max-width: 280px;
  padding: 10px 14px;
  border-radius: var(--rt-radius-pill);
  border: 1px solid var(--rt-border);
  background: linear-gradient(180deg, rgba(255,255,255,0.03), rgba(0,0,0,0)) var(--rt-surface);
  color: var(--rt-fg-muted);
  text-align: left;
  box-shadow: var(--rt-shadow-xs);
  transition: transform var(--rt-dur-fast) var(--rt-ease-standard), border-color var(--rt-dur-fast) var(--rt-ease-standard), background var(--rt-dur-fast) var(--rt-ease-standard);
}
.context-pill:hover {
  transform: translateY(-1px);
  border-color: var(--rt-purple-300);
  background: var(--rt-purple-50);
}
.context-pill strong,
.context-pill small {
  display: block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.context-pill strong {
  color: var(--rt-fg);
  font-size: var(--rt-fs-14);
  line-height: 1.15;
}
.context-pill small {
  color: var(--rt-fg-muted);
  font-size: 11px;
  font-family: var(--rt-font-mono);
  margin-top: 2px;
}
.context-pill.ancestor {
  border-color: var(--rt-purple-200);
  background: var(--rt-purple-50);
}
.context-pill.active {
  background:
    linear-gradient(180deg, rgba(255,255,255,0.12), rgba(0,0,0,0) 60%),
    var(--rt-purple-500);
  border-color: var(--rt-purple-500);
  color: #fff;
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.18),
    0 2px 4px rgba(119, 0, 255, 0.25),
    0 8px 18px -8px rgba(119, 0, 255, 0.45);
}
.context-pill.active strong,
.context-pill.active small {
  color: #fff;
}
.context-tree__lane {
  display: grid;
  grid-template-columns: 88px 1fr;
  gap: 14px;
  align-items: center;
}
.context-tree__lane-label {
  font-size: 11px;
  font-weight: 500;
  letter-spacing: var(--rt-ls-wide);
  text-transform: uppercase;
  color: var(--rt-fg-muted);
  text-align: right;
  line-height: 1.2;
}
.context-tree__row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}
.context-tree__empty {
  font-size: var(--rt-fs-13, 13px);
  color: var(--rt-fg-muted);
  font-style: italic;
}
.context-tree__lane--projects.is-hidden,
.context-tree__lane--children.is-hidden { display: none; }

.context-node {
  display: grid;
  grid-template-columns: 26px 1fr;
  gap: 10px;
  align-items: center;
  background: var(--rt-surface);
  border: 1px solid var(--rt-border);
  border-radius: var(--rt-radius-md);
  padding: 6px 14px 6px 6px;
  cursor: pointer;
  font: inherit;
  color: var(--rt-fg);
  text-align: left;
  transition: all var(--rt-dur-fast) var(--rt-ease-standard);
  min-width: 0;
}
.context-node:hover {
  border-color: var(--rt-purple-300);
  background: var(--rt-purple-50);
}
.context-node__avatar {
  width: 26px; height: 26px;
  border-radius: 50%;
  background: var(--rt-purple-100);
  color: var(--rt-purple-700);
  display: grid; place-items: center;
  font-weight: 700;
  font-size: 11px;
  letter-spacing: 0;
  flex-shrink: 0;
}
.context-node__body {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.context-node__name {
  font-weight: 600;
  font-size: var(--rt-fs-14);
  line-height: 1.15;
  color: var(--rt-fg);
  white-space: nowrap;
}
.context-node__desc {
  font-size: 11px;
  color: var(--rt-fg-muted);
  line-height: 1.2;
  white-space: nowrap;
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
}
.context-node.level-3,
.context-node.level-4 {
  padding: 5px 12px 5px 5px;
}
.context-node.level-3 .context-node__avatar,
.context-node.level-4 .context-node__avatar {
  width: 22px; height: 22px;
  font-size: 10px;
  background: var(--rt-lavander);
}
.context-node.level-3 .context-node__name,
.context-node.level-4 .context-node__name { font-size: var(--rt-fs-13, 13px); }

.context-node.is-ancestor {
  border-color: var(--rt-purple-300);
  background: var(--rt-purple-50);
}
.context-node.is-ancestor .context-node__avatar {
  background: var(--rt-purple-200);
  color: var(--rt-purple-800);
}
.context-tree__lane--projects {
  position: relative;
}
.context-tree__lane--projects .context-tree__lane-label,
.context-tree__lane--children .context-tree__lane-label {
  color: var(--rt-purple-700);
  font-weight: 600;
}
.context-node.is-open {
  border-color: var(--rt-purple-400);
  background: var(--rt-purple-50);
  box-shadow: 0 0 0 2px rgba(119, 0, 255, 0.10);
  position: relative;
}
.context-node.is-open::after {
  content: '↓';
  position: absolute;
  left: 50%;
  bottom: -18px;
  transform: translateX(-50%);
  color: var(--rt-purple-500);
  font-size: 14px;
  font-weight: 700;
  line-height: 1;
  z-index: 2;
}
.context-node.is-open .context-node__avatar {
  background: var(--rt-purple-200);
  color: var(--rt-purple-800);
}
.context-node.is-active {
  background:
    linear-gradient(180deg, rgba(255,255,255,0.10), rgba(0,0,0,0) 50%),
    var(--rt-purple-500);
  border-color: var(--rt-purple-500);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.22),
    0 2px 4px rgba(119, 0, 255, 0.25),
    0 8px 18px -8px rgba(119, 0, 255, 0.45);
}
.context-node.is-active .context-node__name,
.context-node.is-active .context-node__desc { color: #fff; }
.context-node.is-active .context-node__avatar {
  background: rgba(255,255,255,0.22);
  color: #fff;
}

.context-add {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: transparent;
  border: 1px dashed var(--rt-purple-300);
  color: var(--rt-purple-500);
  font-size: 18px;
  line-height: 1;
  padding: 0;
  cursor: pointer;
  transition: all var(--rt-dur-fast) var(--rt-ease-standard);
}
.context-add:hover { background: var(--rt-purple-50); border-style: solid; }
.context-add--inline { width: 28px; height: 28px; font-size: 16px; }

/* ============================ NAV ============================ */
.app-nav {
  background: var(--rt-surface);
  border-bottom: 1px solid var(--rt-border);
  border-top: 1px solid var(--rt-border);
  box-shadow: var(--rt-shadow-xs);
  position: relative;
  flex-shrink: 0;
  z-index: 30;
}
.app-nav__inner {
  max-width: 1480px;
  margin: 0 auto;
  padding: 0 24px;
  display: flex;
  gap: 4px;
  align-items: center;
}
.tab {
  padding: 14px 16px 12px;
  border: none;
  background: none;
  font: inherit;
  font-weight: 500;
  font-size: var(--rt-fs-14);
  color: var(--rt-fg-muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: color var(--rt-dur-fast) var(--rt-ease-standard);
}
.tab:hover { color: var(--rt-fg); }
.tab.active {
  color: var(--rt-purple-700);
  border-bottom-color: var(--rt-purple-500);
}
.tab.active::after {
  content: '';
  position: absolute;
  left: 50%; bottom: -1px;
  width: 60%;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--rt-purple-500), transparent);
  filter: blur(4px);
  opacity: 0.6;
  transform: translateX(-50%);
}
.tab { position: relative; }
.tab--hidden { display: none !important; }

/* ============================ MAIN ============================ */
.main {
  max-width: 1480px;
  width: 100%;
  margin: 0 auto;
  padding: 24px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: 24px;
  align-items: stretch;
  background: var(--rt-bg);
  flex: 1;
  min-height: 0;
  overflow: hidden;
}
.main__content {
  min-width: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding-right: 6px;
}
.main__aside {
  align-self: stretch;
  display: grid;
  gap: 14px;
  grid-auto-rows: min-content;
  overflow-y: auto;
  overflow-x: hidden;
  padding-right: 6px;
}
.main__content::-webkit-scrollbar,
.main__aside::-webkit-scrollbar { width: 8px; }
.main__content::-webkit-scrollbar-thumb,
.main__aside::-webkit-scrollbar-thumb {
  background: rgba(119, 0, 255, 0.12);
  border-radius: 999px;
  border: 2px solid var(--rt-bg);
}
.main__content::-webkit-scrollbar-thumb:hover,
.main__aside::-webkit-scrollbar-thumb:hover {
  background: rgba(119, 0, 255, 0.28);
}

.section { display: none; }
.section.active { display: block; }

/* ============================ PAGE HEAD ============================ */
.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 20px;
}
.page-head__title {
  margin: 0;
  font-size: var(--rt-fs-32);
  font-weight: 500;
  line-height: var(--rt-lh-display);
  letter-spacing: 0;
  color: var(--rt-fg);
}
.page-head__sub {
  margin: 6px 0 0;
  color: var(--rt-fg-muted);
  font-size: var(--rt-fs-14);
}
.page-head__hint {
  font-size: var(--rt-fs-12);
  color: var(--rt-fg-muted);
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.page-head__hint kbd, .kbd, kbd {
  font-family: var(--rt-font-mono);
  font-size: 11px;
  padding: 2px 6px;
  background: var(--rt-surface);
  border: 1px solid var(--rt-border);
  border-radius: var(--rt-radius-sm);
}
.page-head__stats { display: flex; gap: 10px; }
.stat-mini {
  text-align: right;
  background: var(--rt-surface);
  border: 1px solid var(--rt-border);
  border-radius: var(--rt-radius-md);
  padding: 10px 16px;
}
.stat-mini strong {
  display: block;
  font-size: var(--rt-fs-24);
  font-weight: 700;
  color: var(--rt-purple-700);
  line-height: 1;
  letter-spacing: 0;
}
.stat-mini span { font-size: var(--rt-fs-12); color: var(--rt-fg-muted); }

/* ============================ TODAY GRID ============================ */
.today-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-areas:
    "chat"
    "team"
    "digest";
  gap: 18px;
}
.today-grid .card--chat   { grid-area: chat; }
.today-grid .card--team   { grid-area: team; }
.today-grid .card--digest { grid-area: digest; }

/* Card--team — visually distinct from chat */
.card--team {
  background: var(--rt-surface-2);
  border: 1px solid var(--rt-border-strong);
  border-left: 4px solid var(--rt-purple-300);
}
.card--team .card__head { background: transparent; }
.card--team .today-list { padding: 8px 14px 14px; }

/* Team filter as flat row of pills, similar to context tree */
.team-filter-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}
.team-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px 4px 4px;
  background: var(--rt-surface);
  border: 1px solid var(--rt-border);
  border-radius: var(--rt-radius-pill);
  font: inherit;
  font-size: var(--rt-fs-12);
  font-weight: 500;
  color: var(--rt-fg);
  cursor: pointer;
  transition: all var(--rt-dur-fast) var(--rt-ease-standard);
}
.team-chip:hover {
  border-color: var(--rt-purple-300);
  background: var(--rt-purple-50);
}
.team-chip.is-active {
  background: var(--rt-purple-500);
  border-color: var(--rt-purple-500);
  color: #fff;
}
.team-chip.is-active .team-chip__avatar {
  background: rgba(255,255,255,0.22);
  color: #fff;
}
.team-chip.is-active .team-chip__count {
  background: rgba(255,255,255,0.22);
  color: #fff;
}
.team-chip__avatar {
  width: 20px; height: 20px;
  border-radius: 50%;
  background: var(--rt-purple-100);
  color: var(--rt-purple-700);
  display: grid; place-items: center;
  font-weight: 700;
  font-size: 9px;
  letter-spacing: 0;
}
.team-chip__count {
  background: var(--rt-purple-50);
  color: var(--rt-purple-700);
  border-radius: var(--rt-radius-pill);
  padding: 1px 7px;
  font-size: 10px;
  font-weight: 600;
  margin-left: 2px;
}

.card--chat   .chatbox { flex: 1; min-height: 520px; }
.card--digest .digest  { padding: 14px 20px 18px; }
.card--digest.is-collapsed .digest { display: none; }
.today-overview-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}
.today-overview-grid .mini-item {
  min-height: 92px;
}
@media (max-width: 980px) {
  .today-overview-grid {
    grid-template-columns: 1fr;
  }
}

.card {
  background: var(--rt-surface);
  border: 1px solid var(--rt-border);
  border-radius: var(--rt-radius-lg);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow:
    0 1px 0 rgba(255,255,255,0.6) inset,
    0 1px 2px rgba(16, 16, 24, 0.04),
    0 8px 24px -16px rgba(16, 16, 24, 0.10);
  transition: box-shadow var(--rt-dur-base) var(--rt-ease-standard),
              border-color var(--rt-dur-base) var(--rt-ease-standard);
}
.card:hover {
  border-color: rgba(119, 0, 255, 0.18);
  box-shadow:
    0 1px 0 rgba(255,255,255,0.6) inset,
    0 1px 2px rgba(16, 16, 24, 0.04),
    0 12px 32px -16px rgba(119, 0, 255, 0.18);
}
.card--chat {
  background:
    linear-gradient(180deg, rgba(232, 210, 237, 0.12), rgba(255,255,255,0) 200px),
    var(--rt-surface);
  border-color: rgba(119, 0, 255, 0.12);
  box-shadow:
    0 1px 0 rgba(255,255,255,0.6) inset,
    0 4px 8px -4px rgba(16, 16, 24, 0.06),
    0 18px 40px -22px rgba(119, 0, 255, 0.22);
}
.card__head {
  padding: 16px 20px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid var(--rt-border);
}
.card__head--compact {
  padding: 12px 20px;
  background: var(--rt-surface-2);
}
.card__head-actions {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.digest-head-row {
  display: inline-flex;
  align-items: baseline;
  gap: 12px;
}
.digest-head-row .card__title {
  font-size: var(--rt-fs-16);
}
.card__title {
  margin: 0;
  font-size: var(--rt-fs-18);
  font-weight: 500;
  letter-spacing: 0;
  color: var(--rt-fg);
  line-height: 1.2;
}
.card__head > div:first-child { min-width: 0; flex: 1; }
.card__head-actions { flex-shrink: 0; }
.card__sub {
  margin: 4px 0 0;
  font-size: var(--rt-fs-12);
  color: var(--rt-fg-muted);
}
.card__badges { display: inline-flex; gap: 6px; flex-wrap: wrap; }
.chat-topic-controls {
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  max-width: min(520px, 52vw);
}
.topic-select {
  min-width: 180px;
  max-width: 260px;
  height: 34px;
  padding: 0 34px 0 10px !important;
  font-size: var(--rt-fs-12);
  background: var(--rt-surface-2) !important;
}

.link-btn {
  background: none;
  border: none;
  color: var(--rt-purple-600);
  font-weight: 500;
  font-size: var(--rt-fs-13, 13px);
  padding: 6px 8px;
  border-radius: var(--rt-radius-sm);
  cursor: pointer;
}
.link-btn:hover { background: var(--rt-purple-50); color: var(--rt-purple-700); }

/* Today task list */
.today-list {
  padding: 12px;
  display: grid;
  gap: 6px;
}
.today-task {
  display: grid;
  grid-template-columns: 26px 1fr;
  gap: 12px;
  padding: 10px 12px;
  border-radius: var(--rt-radius-md);
  align-items: center;
  transition: background var(--rt-dur-fast) var(--rt-ease-standard);
}
.today-task:hover { background: var(--rt-surface-2); }
.today-task__check {
  width: 22px; height: 22px;
  border-radius: var(--rt-radius-sm);
  border: 1.5px solid var(--rt-border-strong);
  background: transparent;
  cursor: pointer;
  padding: 0;
}
.today-task__check:hover { border-color: var(--rt-purple-500); background: var(--rt-purple-50); }
.today-task__avatar {
  width: 26px; height: 26px;
  border-radius: 50%;
  background: var(--rt-lavander);
  color: var(--rt-purple-800);
  display: grid; place-items: center;
  font-weight: 700;
  font-size: 10px;
  letter-spacing: 0;
}
.today-task__title {
  font-size: var(--rt-fs-14);
  font-weight: 500;
  color: var(--rt-fg);
  line-height: 1.3;
  margin-bottom: 4px;
}
.today-task__meta {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  align-items: center;
}
.today-task.is-overdue .today-task__title { color: var(--rt-fg); }
.today-task.is-overdue .today-task__check { border-color: var(--rt-orange-500); }

/* Chips */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  font-size: 11px;
  font-weight: 500;
  border-radius: var(--rt-radius-pill);
  background: var(--rt-surface-2);
  color: var(--rt-fg-muted);
  border: 1px solid var(--rt-border);
  white-space: nowrap;
}
.chip--soft { background: var(--rt-purple-50); color: var(--rt-purple-700); border-color: var(--rt-purple-100); }
.chip--accent { background: var(--rt-orange-50); color: var(--rt-orange-700); border-color: rgba(255, 79, 18, 0.2); }
.chip--muted { background: transparent; color: var(--rt-fg-muted); }

/* ============================ DIGEST ============================ */
.digest { padding: 18px 20px 20px; }
.digest__head {
  display: flex; align-items: center; gap: 12px;
  margin-bottom: 10px;
}
.digest__lead {
  font-size: var(--rt-fs-16);
  line-height: 1.5;
  color: var(--rt-fg);
  margin-bottom: 16px;
}
.digest__list {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px dashed var(--rt-border);
}
.digest__list strong {
  display: block;
  font-size: var(--rt-fs-12);
  text-transform: uppercase;
  letter-spacing: var(--rt-ls-wide);
  color: var(--rt-fg-muted);
  margin-bottom: 8px;
}
.digest__item {
  display: flex; gap: 10px; align-items: flex-start;
  padding: 6px 0;
  font-size: var(--rt-fs-14);
  color: var(--rt-fg);
}
.digest__item .chip { flex-shrink: 0; }

/* ============================ CHAT ============================ */
.chatbox {
  height: 420px;
  overflow: auto;
  padding: 18px 20px;
  background: var(--rt-bg);
  display: flex;
  flex-direction: column;
  gap: 12px;
  border-bottom: 1px solid var(--rt-border);
}
.msg {
  max-width: 78%;
  border-radius: var(--rt-radius-lg);
  padding: 12px 14px;
  font-size: var(--rt-fs-14);
  line-height: 1.4;
}
.msg.me {
  align-self: flex-end;
  background:
    linear-gradient(180deg, rgba(255,255,255,0.10), rgba(0,0,0,0) 60%),
    var(--rt-purple-500);
  color: #fff;
  border-bottom-right-radius: 6px;
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.18),
    0 8px 18px -8px rgba(119, 0, 255, 0.40);
}
.msg.bot {
  align-self: flex-start;
  background: var(--rt-surface);
  color: var(--rt-fg);
  border: 1px solid var(--rt-border);
  border-bottom-left-radius: 6px;
  box-shadow:
    0 1px 0 rgba(255,255,255,0.6) inset,
    0 4px 12px -8px rgba(16, 16, 24, 0.08);
}
.msg-h {
  display: flex; gap: 7px; align-items: center;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  opacity: 0.7;
  margin-bottom: 6px;
}
.msg.me .msg-h { color: rgba(255,255,255,0.9); }
.msg.bot .msg-h { color: var(--rt-purple-600); }
.msg-t { white-space: pre-wrap; }
.msg-d {
  font-size: 11px;
  opacity: 0.6;
  margin-top: 6px;
}

.composer {
  padding: 14px 16px;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  align-items: flex-end;
}
.chat-attachments {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  min-height: 0;
}
.chat-attachments.is-empty {
  display: none;
}
.attachment-chip,
.msg-attachment {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  max-width: 100%;
  border: 1px solid rgba(190, 124, 255, 0.32);
  background: rgba(190, 124, 255, 0.12);
  color: var(--rt-text);
  border-radius: 999px;
  padding: 7px 10px;
  font-size: var(--rt-fs-12);
}
.attachment-chip__name {
  max-width: min(360px, 62vw);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.attachment-chip__meta,
.msg-attachment small {
  color: var(--rt-muted);
  white-space: nowrap;
}
.attachment-chip__remove {
  width: 20px;
  height: 20px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  color: var(--rt-text);
  cursor: pointer;
}
.msg-attachments {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}
.composer textarea {
  min-height: 56px;
  max-height: 200px;
  border-radius: var(--rt-radius-md);
}
.composer__actions {
  display: flex;
  gap: 8px;
  align-items: center;
}
.statusline {
  min-height: 14px;
  padding: 0 18px 6px;
  font-size: var(--rt-fs-12);
  color: var(--rt-purple-600);
}

/* ============================ QUICK CAPTURE ============================ */
.capture-tabs {
  display: inline-flex;
  background: var(--rt-surface-2);
  border: 1px solid var(--rt-border);
  border-radius: var(--rt-radius-pill);
  padding: 3px;
  gap: 2px;
}
.capture-tab {
  border: none;
  background: transparent;
  padding: 6px 12px;
  font: inherit;
  font-size: var(--rt-fs-13, 13px);
  font-weight: 500;
  color: var(--rt-fg-muted);
  border-radius: var(--rt-radius-pill);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all var(--rt-dur-fast) var(--rt-ease-standard);
}
.capture-tab:hover { color: var(--rt-fg); }
.capture-tab.active {
  background: var(--rt-surface);
  color: var(--rt-purple-700);
  box-shadow: var(--rt-shadow-xs);
}
.capture-mode { display: grid; gap: 12px; }
.capture-mode[hidden] { display: none; }

.quick-card {
  background: var(--rt-surface);
  border: 1px solid var(--rt-border);
  border-radius: var(--rt-radius-lg);
  padding: 16px;
  display: grid;
  gap: 14px;
  box-shadow:
    0 1px 0 rgba(255,255,255,0.6) inset,
    0 1px 2px rgba(16, 16, 24, 0.04),
    0 8px 24px -16px rgba(16, 16, 24, 0.08);
}
.quick-card--ghost {
  background: var(--rt-surface-2);
  border-style: dashed;
}
.quick-card__head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}
.quick-card__input {
  width: 100%;
  min-height: 130px;
  resize: vertical;
  font-size: var(--rt-fs-14);
  border-radius: var(--rt-radius-md);
  border: 1px solid var(--rt-border);
  padding: 12px 14px;
  background: var(--rt-bg);
}
.quick-card__input--single {
  min-height: auto;
  height: 44px;
}
.quick-task-row {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 10px;
  align-items: center;
}
.quick-task-row__label {
  font-size: var(--rt-fs-13, 13px);
  color: var(--rt-fg-muted);
  font-weight: 500;
}
.quick-card__row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}
.quick-card__row .hint {
  font-size: var(--rt-fs-12);
  color: var(--rt-fg-muted);
  flex: 1;
}
.quick-card__row .hint strong {
  color: var(--rt-purple-700);
  font-family: var(--rt-font-mono);
  font-weight: 600;
}
.quick-recent {
  display: grid;
  gap: 8px;
  max-height: 280px;
  overflow: auto;
}
.quick-recent__item {
  background: var(--rt-surface);
  border: 1px solid var(--rt-border);
  border-radius: var(--rt-radius-md);
  padding: 10px 12px;
  font-size: var(--rt-fs-13, 13px);
}
.quick-recent__meta {
  font-size: 11px;
  color: var(--rt-fg-muted);
  margin-bottom: 4px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-weight: 500;
}

/* Tasks aside card — visible across all sections */
.quick-card--tasks {
  position: relative;
  display: grid;
  grid-template-rows: auto 1fr auto;
  max-height: none;
  min-height: 240px;
}
.quick-card--tasks .today-list {
  padding: 4px 0;
  display: grid;
  gap: 1px;
  overflow-y: auto;
  overflow-x: hidden;
  min-height: 0;
  /* Scroll hint — soft fade at bottom */
  mask-image: linear-gradient(to bottom, #000 0, #000 calc(100% - 12px), transparent);
  -webkit-mask-image: linear-gradient(to bottom, #000 0, #000 calc(100% - 12px), transparent);
}
.quick-card--tasks .today-list::-webkit-scrollbar { width: 6px; }
.quick-card--tasks .today-list::-webkit-scrollbar-thumb {
  background: var(--rt-border-strong);
  border-radius: 3px;
  border: 0;
}
.today-list.today-list--compact {
  grid-template-columns: none;
}
.today-list--compact .today-task {
  padding: 6px 8px !important;
  gap: 8px !important;
  grid-template-columns: 16px minmax(0, 1fr) !important;
  align-items: start !important;
}
.today-list--compact .today-task__check {
  width: 16px !important;
  height: 16px !important;
  margin-top: 1px;
}
.today-list--compact .today-task__title {
  font-size: var(--rt-fs-13, 13px) !important;
  margin-bottom: 2px !important;
  line-height: 1.25 !important;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.today-list--compact .today-task__meta { gap: 4px !important; }
.today-list--compact .today-task__meta .chip { font-size: 10px; padding: 1px 6px; }
.today-list--compact .today-task__check:hover { background: var(--rt-purple-50); }
.today-list--compact .today-task.is-done .today-task__title { text-decoration: line-through; color: var(--rt-fg-muted); }
.today-list--compact .today-task.is-done .today-task__check {
  background: var(--rt-purple-500);
  border-color: var(--rt-purple-500);
  position: relative;
}
.today-list--compact .today-task.is-done .today-task__check::after {
  content: '';
  position: absolute;
  left: 4px; top: 1px;
  width: 5px; height: 9px;
  border-right: 2px solid #fff;
  border-bottom: 2px solid #fff;
  transform: rotate(45deg);
}

.btn-block {
  width: 100%;
  justify-content: center;
}
.link-btn--sm {
  font-size: var(--rt-fs-12);
  padding: 4px 8px;
}

/* ============================ PANEL ============================ */
.panel {
  background: var(--rt-surface);
  border: 1px solid var(--rt-border);
  border-radius: var(--rt-radius-lg);
  overflow: hidden;
}
.panel-h {
  padding: 14px 18px;
  border-bottom: 1px solid var(--rt-border);
  font-weight: 600;
  font-size: var(--rt-fs-14);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.panel-b { padding: 16px 18px; }
.panel-soft {
  background: var(--rt-surface-2);
  border: 1px solid var(--rt-border);
  border-radius: var(--rt-radius-md);
  padding: 14px;
}
.panel-soft strong {
  display: block;
  margin-bottom: 8px;
  font-size: var(--rt-fs-12);
  text-transform: uppercase;
  letter-spacing: var(--rt-ls-wide);
  color: var(--rt-fg-muted);
}

/* ============================ TASKS ============================ */
.filter-row {
  display: flex;
  gap: 6px;
  align-items: center;
  flex-wrap: wrap;
}
.filter-row__search {
  flex: 1;
  min-width: 200px;
  height: 36px;
  padding: 0 12px !important;
  font-size: var(--rt-fs-13, 13px);
}
.task-filter { font-weight: 500; }
.task-filter.active {
  background: var(--rt-purple-500);
  color: #fff;
  border-color: var(--rt-purple-500);
}
.task-filter.active:hover {
  background: var(--rt-purple-600);
  color: #fff;
  border-color: var(--rt-purple-600);
}
.task-count {
  display: inline-flex;
  min-width: 18px; height: 18px;
  align-items: center;
  justify-content: center;
  margin-left: 4px;
  padding: 0 5px;
  border-radius: var(--rt-radius-pill);
  background: var(--rt-purple-100);
  color: var(--rt-purple-700);
  font-size: 11px;
  font-weight: 600;
}
.task-filter.active .task-count {
  background: rgba(255,255,255,0.22);
  color: #fff;
}
.composer-inline {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}
.composer-inline #task-text { flex: 1; min-width: 280px; }

/* ============================ TABLES ============================ */
.table-wrap { overflow: auto; max-width: 100%; }
.data-table, table {
  width: 100%;
  border-collapse: collapse;
}
.data-table th,
.data-table td,
table th,
table td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--rt-border);
  text-align: left;
  vertical-align: top;
  font-size: var(--rt-fs-14);
}
.data-table th, table th {
  font-size: var(--rt-fs-12);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--rt-fg-muted);
  background: var(--rt-surface-2);
}
.data-table tbody tr:hover { background: var(--rt-surface-2); }
.compact-table th, .compact-table td { padding: 8px 12px; }

.task-row { cursor: grab; }
.task-row:hover .task-order { background: var(--rt-purple-100); }
.task-row:hover { background: var(--rt-purple-50) !important; }
.task-row.dragging {
  opacity: 0.55;
  background: var(--rt-purple-100) !important;
  cursor: grabbing;
  box-shadow: 0 4px 12px rgba(119, 0, 255, 0.18);
}
.task-row.drop-above td:first-child { box-shadow: inset 0 2px 0 var(--rt-purple-500); }
.task-row.drop-below td:first-child { box-shadow: inset 0 -2px 0 var(--rt-purple-500); }
.task-row { border-left: 3px solid transparent; transition: border-color 0.15s; }
.task-row:hover { border-left-color: var(--ctx-color, transparent) !important; }
#task-scope-toggle.active { background: rgba(168,85,247,0.15); color: var(--rt-purple-500); border-color: var(--rt-purple-400); }
.task-title {
  display: grid;
  grid-template-columns: 16px 22px minmax(0, 1fr);
  gap: 10px;
  align-items: start;
  font-weight: 500;
}
.task-title::before {
  content: '⋮⋮';
  color: var(--rt-fg-muted);
  font-size: 14px;
  line-height: 1.5;
  letter-spacing: 0;
  cursor: grab;
  user-select: none;
  opacity: 0.5;
  transition: opacity var(--rt-dur-fast) var(--rt-ease-standard);
}
.task-row:hover .task-title::before { opacity: 1; color: var(--rt-purple-500); }
.task-order {
  display: inline-flex;
  align-items: center; justify-content: center;
  width: 22px; height: 22px;
  border-radius: 50%;
  background: var(--rt-purple-50);
  color: var(--rt-purple-700);
  border: 1px solid var(--rt-purple-100);
  font-size: 11px; font-weight: 600;
}
.task-context {
  font-weight: 600;
  font-size: var(--rt-fs-13, 13px);
  color: var(--rt-purple-700);
  background: var(--rt-purple-50);
  padding: 3px 10px;
  border-radius: var(--rt-radius-pill);
  white-space: nowrap;
  border: 1px solid var(--rt-purple-100);
}

.task-title__text { cursor: text; border-radius: 4px; padding: 1px 4px; transition: background 0.1s; }
.task-title__text:hover { background: rgba(168,85,247,0.08); }
.task-inline-input {
  width: 100%; font: inherit; font-size: var(--rt-fs-13,13px); font-weight: 500;
  background: var(--rt-surface-2); border: 1.5px solid var(--rt-purple-400);
  border-radius: 4px; padding: 2px 6px; color: var(--rt-fg); outline: none;
}
.task-ctx-select {
  font: inherit; font-size: var(--rt-fs-13,13px); background: var(--rt-surface-2);
  border: 1.5px solid var(--rt-purple-400); border-radius: 4px; padding: 2px 6px;
  color: var(--rt-fg); outline: none; cursor: pointer; max-width: 180px;
}
/* Tasks table close button → accent CTA */
#tasks-body .btn-lite {
  background: var(--rt-orange-500);
  border-color: var(--rt-orange-500);
  color: #fff;
  font-weight: 600;
}
#tasks-body .btn-lite:hover {
  background: var(--rt-orange-600);
  border-color: var(--rt-orange-600);
  color: #fff;
}

/* Documents table — compact context column: chip on top, edit row appears as floating popover (no row reflow) */
#docs-body td { padding: 10px 16px; vertical-align: middle; }
#docs-body td:nth-child(2) {
  position: relative;
  white-space: nowrap;
}
#docs-body td:nth-child(2) > div:first-child {
  display: inline-flex;
  align-items: center;
  font-weight: 600;
  font-size: var(--rt-fs-13, 13px);
  color: var(--rt-purple-700);
  background: var(--rt-purple-50);
  padding: 3px 10px;
  border-radius: var(--rt-radius-pill);
  border: 1px solid var(--rt-purple-100);
  white-space: nowrap;
  line-height: 1.2;
  cursor: pointer;
}
#docs-body td:nth-child(2) > div:first-child::after {
  content: '⌄';
  margin-left: 6px;
  color: var(--rt-purple-400);
  font-size: 10px;
}
/* The select+button row lives as a floating popover so it doesn't push the table around */
#docs-body td:nth-child(2) .row {
  position: absolute;
  top: calc(100% - 6px);
  left: 12px;
  z-index: 20;
  margin: 0;
  display: none;
  align-items: center;
  gap: 6px;
  background: var(--rt-surface);
  border: 1px solid var(--rt-border);
  border-radius: var(--rt-radius-md);
  padding: 8px;
  box-shadow: var(--rt-shadow-lg);
  white-space: nowrap;
}
#docs-body td:nth-child(2):hover .row,
#docs-body td:nth-child(2):focus-within .row {
  display: inline-flex;
}
#docs-body td:nth-child(2) .row select {
  padding: 4px 8px !important;
  font-size: var(--rt-fs-12);
  height: 28px;
  max-width: 220px;
}
#docs-body td:nth-child(2) .row button {
  padding: 4px 10px;
  font-size: var(--rt-fs-12);
  height: 28px;
}

/* ============================ NOTEBOOK ============================ */
.notebook-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 14px;
}
@media (max-width: 1280px) {
  .notebook-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 720px) {
  .notebook-grid { grid-template-columns: 1fr; }
}

/* New notebook layout — primary notes + secondary lists + collapsed memory */
.notebook-search {
  position: relative;
  margin-bottom: 18px;
}
.notebook-search svg {
  position: absolute; left: 14px; top: 14px;
  color: var(--rt-fg-muted);
  pointer-events: none;
}
.notebook-search input {
  width: 100%;
  height: 44px;
  padding: 0 16px 0 44px !important;
  font-size: var(--rt-fs-14);
}
.notebook-primary {
  margin-bottom: 18px;
}
.notes-grid {
  display: grid;
  gap: 2px;
}
.note-row {
  display: grid;
  grid-template-columns: 1fr;
  padding: 10px 12px;
  border-radius: var(--rt-radius-md);
  border: 1px solid transparent;
  transition: all var(--rt-dur-fast) var(--rt-ease-standard);
  cursor: pointer;
}
.note-row:hover {
  background: var(--rt-surface-2);
  border-color: var(--rt-border);
}
.note-row__body {
  display: grid;
  gap: 4px;
}
.note-row__text {
  font-size: var(--rt-fs-14);
  line-height: 1.4;
  color: var(--rt-fg);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.note-row__meta {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: var(--rt-fs-12);
}

/* ---- iOS-style notes layout ---- */
.notes-ios-layout {
  display: grid;
  grid-template-columns: 280px 1fr;
  min-height: 420px;
  border-top: 1px solid var(--rt-border);
}
@media (max-width: 768px) {
  .notes-ios-layout { grid-template-columns: 1fr; }
}
.note-list-panel {
  border-right: 1px solid var(--rt-border);
  overflow-y: auto;
  max-height: 580px;
  min-height: 200px;
}
.note-list-item {
  position: relative;
  padding: 12px 36px 12px 14px;
  border-bottom: 1px solid var(--rt-border);
  cursor: pointer;
  transition: background var(--rt-dur-fast);
}
.note-list-item:hover { background: var(--rt-surface-2); }
.note-list-item.is-active { background: rgba(168,85,247,0.10); border-left: 3px solid var(--rt-aurora); }
.note-list-item__title {
  font-size: var(--rt-fs-14);
  font-weight: 600;
  color: var(--rt-fg);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.note-list-item__preview {
  font-size: var(--rt-fs-12);
  color: var(--rt-fg-muted);
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.note-list-item__meta {
  font-size: 11px;
  color: var(--rt-fg-muted);
  margin-top: 4px;
}
.note-list-item__del {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--rt-danger, #f87171);
  padding: 4px;
  border-radius: 4px;
}
.note-list-item:hover .note-list-item__del { display: flex; align-items: center; }
.note-editor-panel {
  display: flex;
  flex-direction: column;
  min-height: 200px;
}
.note-editor__body { display: flex; flex-direction: column; flex: 1; padding: 0; }
.note-editor__ta {
  flex: 1;
  width: 100%;
  min-height: 420px;
  padding: 16px 18px;
  background: transparent;
  border: none;
  outline: none;
  resize: none;
  font-size: var(--rt-fs-14);
  line-height: 1.6;
  color: var(--rt-fg);
  font-family: inherit;
}
.note-editor__ta--hidden { display: none !important; }
.note-preview {
  flex: 1;
  padding: 16px 18px;
  min-height: 420px;
  font-size: var(--rt-fs-14);
  line-height: 1.7;
  color: var(--rt-fg);
  cursor: text;
  white-space: pre-wrap;
  word-break: break-word;
}
.note-preview:hover { background: rgba(255,255,255,0.02); }
.note-preview--placeholder { color: var(--rt-fg-muted); font-style: italic; }
.note-editor__empty {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  min-height: 200px;
  color: var(--rt-fg-muted);
  font-size: var(--rt-fs-14);
}
.note-img {
  max-width: 100%;
  max-height: 320px;
  border-radius: var(--rt-radius-md);
  margin: 6px 0;
}

/* ---- List card improvements ---- */
.list-card__action-btn { opacity: 0.5; transition: opacity var(--rt-dur-fast); }
.list-card__head:hover .list-card__action-btn { opacity: 1; }
.list-card__action-btn--del:hover { color: var(--rt-danger, #f87171); }
.list-card__ctx-row {
  padding: 0 16px 8px;
  display: none;
}
.list-card[open] .list-card__ctx-row { display: block; }
.list-ctx-select {
  font-size: 12px;
  background: var(--rt-surface-2);
  border: 1px solid var(--rt-border);
  border-radius: var(--rt-radius-sm);
  color: var(--rt-fg-muted);
  padding: 3px 6px;
  cursor: pointer;
}
.checklist__drag {
  color: var(--rt-fg-muted);
  cursor: grab;
  font-size: 14px;
  opacity: 0.4;
  user-select: none;
  flex-shrink: 0;
}
.checklist__item:hover .checklist__drag { opacity: 0.8; }
.checklist__text { flex: 1; min-width: 0; user-select: text; }
.checklist__item-actions {
  display: none;
  align-items: center;
  gap: 2px;
  flex-shrink: 0;
}
.checklist__item:hover .checklist__item-actions { display: flex; }
.checklist__item.dragging { opacity: 0.4; }
.checklist__item.drop-above { box-shadow: inset 0 2px 0 var(--rt-purple-500); }
.checklist__item.drop-below { box-shadow: inset 0 -2px 0 var(--rt-purple-500); }

/* Notebook tabs */
.nb-tabs { display:flex; gap:4px; margin:12px 0 0; padding:0 0 4px; border-bottom:1px solid var(--rt-border); }
.nb-tab { border:none; background:transparent; padding:8px 16px; font-size:14px; font-weight:500; color:var(--rt-fg-muted); cursor:pointer; border-radius:8px 8px 0 0; border-bottom:2px solid transparent; transition:color .15s; }
.nb-tab:hover { color:var(--rt-fg); }
.nb-tab.active { color:var(--rt-purple-600); border-bottom-color:var(--rt-purple-500); }
#section-notebook[data-nb-active="notes"] .notebook-lists-panel { display:none; }
#section-notebook[data-nb-active="lists"] .notebook-primary { display:none; }
.btn-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  cursor: pointer;
  padding: 3px;
  border-radius: 3px;
  color: var(--rt-fg-muted);
  opacity: 0.7;
}
.btn-icon:hover { opacity: 1; background: var(--rt-surface-2); }
.btn-icon--del:hover { color: var(--rt-danger, #f87171); }

.notebook-lists-panel { margin-bottom: 18px; }
.lists-row {
  display: grid;
  gap: 6px;
}
.list-card {
  background: var(--rt-surface-2);
  border: 1px solid var(--rt-border);
  border-radius: var(--rt-radius-md);
  overflow: hidden;
  transition: border-color var(--rt-dur-fast) var(--rt-ease-standard);
}
.list-card[open] {
  background: var(--rt-surface);
  border-color: var(--rt-purple-200);
}
.list-card__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  cursor: pointer;
  list-style: none;
  gap: 12px;
}
.list-card__head::-webkit-details-marker { display: none; }
.list-card__title {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  min-width: 0;
}
.list-card__name {
  font-weight: 600;
  font-size: var(--rt-fs-14);
  color: var(--rt-fg);
}
.list-card__progress {
  flex: 1;
  max-width: 140px;
  height: 4px;
  background: var(--rt-border);
  border-radius: 999px;
  overflow: hidden;
  position: relative;
}
.list-card__progress-bar {
  position: absolute;
  left: 0; top: 0;
  height: 100%;
  background: var(--rt-purple-500);
  border-radius: 999px;
  transition: width var(--rt-dur-base) var(--rt-ease-standard);
}
.list-card__actions {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.list-card[open] .collapse-chevron { transform: rotate(180deg); }
.collapse-chevron { transition: transform var(--rt-dur-fast) var(--rt-ease-standard); }
.list-card ul.checklist {
  padding: 4px 18px 14px 18px !important;
  margin: 0 !important;
}

.notebook-collapse {
  border: 1px solid var(--rt-border);
  border-radius: var(--rt-radius-lg);
  background: var(--rt-surface);
  overflow: hidden;
}
.notebook-collapse > summary {
  list-style: none;
  cursor: pointer;
  padding: 14px 18px;
  display: flex;
  align-items: center;
  gap: 12px;
  font-weight: 500;
  color: var(--rt-fg-muted);
}
.notebook-collapse > summary::-webkit-details-marker { display: none; }
.notebook-collapse > summary .collapse-title {
  color: var(--rt-fg);
  font-weight: 600;
}
.notebook-collapse > summary .collapse-chevron { margin-left: auto; }
.notebook-collapse[open] > summary .collapse-chevron { transform: rotate(180deg); }
.notebook-collapse__body {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  padding: 0 18px 18px;
}
@media (max-width: 900px) {
  .notebook-collapse__body { grid-template-columns: 1fr; }
}
.mini-list { display: grid; gap: 8px; }
.mini-item {
  background: var(--rt-surface);
  border: 1px solid var(--rt-border);
  border-radius: var(--rt-radius-md);
  padding: 12px 14px;
  font-size: var(--rt-fs-14);
}
.mini-item strong { font-weight: 600; color: var(--rt-fg); }
.mini-item .row { margin-top: 8px; }
.mini-item__meta {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 8px;
  font-size: var(--rt-fs-12);
}
.mini-item__body { font-size: var(--rt-fs-13, 13px); line-height: 1.45; color: var(--rt-fg); }

.telethon-dialog-item {
  width: 100%;
  text-align: left;
  display: grid;
  gap: 4px;
}
.telethon-dialog-item .telethon-dialog-head {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: flex-start;
}
.telethon-dialog-item .telethon-dialog-badges {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: flex-end;
}
.telethon-dialog-item .telethon-dialog-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  border-radius: 999px;
  padding: 2px 8px;
  font-size: var(--rt-fs-11);
  line-height: 1.2;
  background: rgba(119, 0, 255, 0.10);
  color: var(--rt-fg);
  border: 1px solid rgba(119, 0, 255, 0.18);
}
.telethon-dialog-item .telethon-dialog-badge.unread {
  background: rgba(255, 122, 0, 0.12);
  border-color: rgba(255, 122, 0, 0.24);
  color: var(--rt-orange-500);
}
.telethon-dialog-item.active {
  border-color: rgba(119, 0, 255, 0.35);
  background: linear-gradient(180deg, rgba(119,0,255,0.10), rgba(119,0,255,0.05));
  box-shadow: 0 8px 20px -16px rgba(119, 0, 255, 0.55);
}
.telethon-dialog-item .telethon-dialog-title {
  font-weight: 700;
  color: var(--rt-fg);
}
.telethon-dialog-item .telethon-dialog-meta,
.telethon-dialog-item .telethon-dialog-preview,
.telethon-dialog-item .telethon-dialog-count {
  font-size: var(--rt-fs-12);
  color: var(--rt-fg-muted);
  line-height: 1.35;
}
.telethon-dialog-item .telethon-dialog-count {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: center;
}
.telethon-dialog-filter.active {
  border-color: rgba(119, 0, 255, 0.35);
  background: rgba(119, 0, 255, 0.10);
}
.telethon-message {
  display: grid;
  gap: 10px;
}
.telethon-message-row {
  display: flex;
  width: 100%;
}
.telethon-message-row.incoming {
  justify-content: flex-start;
}
.telethon-message-row.outgoing {
  justify-content: flex-end;
}
.telethon-message-bubble {
  max-width: min(78%, 760px);
  min-width: 220px;
  background: var(--rt-surface);
  border: 1px solid var(--rt-border);
  border-radius: 18px;
  padding: 12px 14px 10px;
  box-shadow: 0 10px 26px -22px rgba(0, 0, 0, 0.35);
}
.telethon-message-row.outgoing .telethon-message-bubble {
  background: linear-gradient(180deg, rgba(119,0,255,0.10), rgba(119,0,255,0.04));
  border-color: rgba(119, 0, 255, 0.22);
}
.telethon-message-row.incoming .telethon-message-bubble {
  background: linear-gradient(180deg, rgba(255,255,255,0.78), rgba(255,255,255,0.62));
}
.telethon-message__author {
  font-weight: 700;
  color: var(--rt-fg);
  margin-bottom: 6px;
}
.telethon-message__meta {
  font-size: var(--rt-fs-12);
  color: var(--rt-fg-muted);
  font-weight: 500;
}
.telethon-message__text {
  font-size: var(--rt-fs-14);
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-word;
}
.telethon-message__footer {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  margin-top: 8px;
  font-size: var(--rt-fs-11);
  color: var(--rt-fg-muted);
}
.telethon-message__time,
.telethon-message__scope {
  white-space: nowrap;
}

#pane-telegram .split {
  grid-template-columns: minmax(360px, 0.72fr) minmax(420px, 1.28fr);
  align-items: start;
}
#pane-telegram .split > .panel-soft {
  min-width: 0;
}
#pane-telegram .split > .panel-soft:last-child {
  min-height: 520px;
}
@media (max-width: 1700px) {
  #pane-telegram .split {
    grid-template-columns: 1fr;
  }
}

/* Checklist */
.checklist { list-style: none; margin: 4px 0 0; padding: 0; display: grid; gap: 6px; }
.checklist__item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: var(--rt-fs-13, 13px);
  color: var(--rt-fg);
}
.checklist__check {
  width: 14px; height: 14px;
  padding: 0;
  appearance: none;
  cursor: pointer;
  border-radius: 4px;
  border: 1.5px solid var(--rt-border-strong);
  background: transparent;
  position: relative;
}
.checklist__item.is-done .checklist__check {
  background: var(--rt-purple-500);
  border-color: var(--rt-purple-500);
}
.checklist__item.is-done .checklist__check::after {
  content: '';
  position: absolute;
  left: 3px; top: 0px;
  width: 5px; height: 9px;
  border-right: 2px solid #fff;
  border-bottom: 2px solid #fff;
  transform: rotate(45deg);
}
.checklist__item.is-done {
  color: var(--rt-fg-muted);
  text-decoration: line-through;
}

/* ============================ FORMS / SETTINGS ============================ */
.toolbar, .row {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}
.split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
}
.grid-3 {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px 18px;
}
.field { display: grid; gap: 6px; }
.field label {
  font-size: var(--rt-fs-13, 13px);
  color: var(--rt-fg-muted);
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  width: fit-content;
}
.field input, .field select, .field textarea, #policy-rule-json { width: 100%; }
.help-text {
  color: var(--rt-fg-muted);
  font-size: var(--rt-fs-12);
  line-height: 1.4;
}
.check-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px 18px;
  margin-top: 14px;
}
.check {
  display: flex; align-items: center; gap: 8px;
  font-weight: 500;
  font-size: var(--rt-fs-14);
  cursor: pointer;
  padding: 10px 12px;
  background: var(--rt-surface-2);
  border: 1px solid var(--rt-border);
  border-radius: var(--rt-radius-md);
  transition: all var(--rt-dur-fast) var(--rt-ease-standard);
}
.check:hover { border-color: var(--rt-purple-300); }
.check input { width: 16px; height: 16px; accent-color: var(--rt-purple-500); }
.check .help-tip { margin-left: auto; }

/* Rule templates */
.rule-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}
.rule-card {
  background: var(--rt-surface);
  border: 1px solid var(--rt-border);
  border-radius: var(--rt-radius-md);
  padding: 12px 14px;
  cursor: pointer;
  transition: all var(--rt-dur-fast) var(--rt-ease-standard);
}
.rule-card:hover { border-color: var(--rt-purple-400); background: var(--rt-purple-50); }
.rule-card strong { display: block; margin-bottom: 4px; font-weight: 600; }

.codebox {
  background: var(--rt-gray-900);
  color: #C9A3FF;
  font-family: var(--rt-font-mono);
  font-size: 12px;
  padding: 12px 14px;
  border-radius: var(--rt-radius-md);
  overflow: auto;
  border: none;
}

/* ============================ STATS / OPS ============================ */
.stats {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
}
.stat {
  background: var(--rt-surface);
  border: 1px solid var(--rt-border);
  border-radius: var(--rt-radius-md);
  padding: 14px;
}
.stat strong {
  display: block;
  font-size: var(--rt-fs-24);
  font-weight: 700;
  letter-spacing: 0;
  color: var(--rt-purple-700);
  line-height: 1;
  margin-bottom: 4px;
}
.stat .subtle {
  font-size: var(--rt-fs-12);
  color: var(--rt-fg-muted);
}
.ha-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}
.ha-summary .stat strong { font-size: var(--rt-fs-20); }

/* HA entities */
.entity-name { font-weight: 600; font-size: var(--rt-fs-14); color: var(--rt-fg); }
.entity-id {
  font-family: var(--rt-font-mono);
  color: var(--rt-fg-muted);
  font-size: var(--rt-fs-12);
  margin-top: 2px;
}
.state-pill {
  display: inline-flex;
  align-items: center;
  border-radius: var(--rt-radius-pill);
  padding: 3px 12px;
  background: var(--rt-surface-2);
  border: 1px solid var(--rt-border);
  font-weight: 600;
  font-size: var(--rt-fs-12);
}
.state-on { color: var(--rt-success); background: var(--rt-success-bg); border-color: rgba(31, 173, 102, 0.3); }
.state-off { color: var(--rt-fg-muted); }
.action-row { display: flex; gap: 6px; flex-wrap: wrap; }
#pane-ha .table-wrap {
  overflow-x: hidden;
}
#pane-ha .compact-table {
  table-layout: fixed;
  min-width: 0;
}
#pane-ha .compact-table th,
#pane-ha .compact-table td {
  padding: 8px 8px;
  overflow-wrap: anywhere;
}
#pane-ha .compact-table th:nth-child(1),
#pane-ha .compact-table td:nth-child(1) { width: 33%; }
#pane-ha .compact-table th:nth-child(2),
#pane-ha .compact-table td:nth-child(2) { width: 24%; }
#pane-ha .compact-table th:nth-child(3),
#pane-ha .compact-table td:nth-child(3) { width: 13%; }
#pane-ha .compact-table th:nth-child(4),
#pane-ha .compact-table td:nth-child(4) { width: 30%; }
#pane-ha .entity-name {
  font-size: var(--rt-fs-13, 13px);
  line-height: 1.2;
  overflow-wrap: anywhere;
}
#pane-ha .entity-id {
  font-size: 10px;
  line-height: 1.25;
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: break-all;
}
#pane-ha .state-pill {
  padding: 3px 8px;
}
.ha-action-row {
  display: grid;
  grid-template-columns: repeat(4, minmax(34px, 1fr));
  gap: 4px;
  width: 100%;
  min-width: 0;
  max-width: 100%;
}
.ha-action-row .ha-action {
  min-height: 26px;
  padding: 4px 5px !important;
  justify-content: center;
  white-space: nowrap;
  font-size: 11px;
  min-width: 0;
}
.tg-context-cell {
  position: relative;
  display: inline-flex;
  align-items: center;
  min-width: 0;
  white-space: nowrap;
}
.tg-context-cell > .subtle {
  display: none;
}
.tg-context-cell > .chip::after {
  content: '⌄';
  margin-left: 6px;
  color: var(--rt-purple-400);
  font-size: 10px;
}
.tg-bind-row {
  position: absolute;
  top: calc(100% - 4px);
  left: 0;
  z-index: 35;
  display: none !important;
  grid-template-columns: minmax(190px, 1fr) auto auto;
  gap: 6px;
  align-items: center;
  background: var(--rt-surface);
  border: 1px solid var(--rt-border);
  border-radius: var(--rt-radius-md);
  padding: 8px;
  box-shadow: var(--rt-shadow-lg);
  flex-wrap: nowrap !important;
  white-space: nowrap;
}
#tg-body td:nth-child(3) {
  position: relative;
}
#tg-body td:nth-child(3):hover .tg-bind-row,
#tg-body td:nth-child(3):focus-within .tg-bind-row {
  display: grid !important;
}
.tg-bind-row select {
  min-width: 0;
  height: 30px;
  padding: 4px 8px !important;
  font-size: var(--rt-fs-12);
}
.tg-bind-row button {
  height: 30px;
  padding: 4px 10px !important;
  font-size: var(--rt-fs-12);
  white-space: nowrap;
}
.regular-ops-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 12px;
}
.automation-table {
  width: 100%;
  min-width: 0;
  table-layout: fixed;
}
.automation-table th,
.automation-table td {
  white-space: normal;
  overflow-wrap: anywhere;
}
.automation-table th:nth-child(1),
.automation-table td:nth-child(1) { width: 34%; }
.automation-table th:nth-child(2),
.automation-table td:nth-child(2) { width: 20%; }
.automation-table th:nth-child(3),
.automation-table td:nth-child(3) { width: 22%; }
.automation-table th:nth-child(4),
.automation-table td:nth-child(4) { width: 24%; }
#pane-automations .panel-b {
  display: grid;
  gap: 12px;
}
#pane-automations #executive-text {
  max-height: 96px;
  overflow: auto;
}

/* Pills/Badges */
.badge, .pill {
  display: inline-flex;
  align-items: center;
  border-radius: var(--rt-radius-pill);
  background: var(--rt-purple-50);
  color: var(--rt-purple-700);
  padding: 3px 10px;
  font-size: 11px;
  font-weight: 600;
  border: 1px solid var(--rt-purple-100);
  white-space: nowrap;
}
.pill.good { color: var(--rt-success); background: var(--rt-success-bg); border-color: rgba(31, 173, 102, 0.3); }
.pill.warn { color: var(--rt-warning); background: var(--rt-warning-bg); border-color: rgba(245, 166, 35, 0.3); }
.pill.danger { color: var(--rt-danger); background: var(--rt-danger-bg); border-color: rgba(229, 53, 75, 0.3); }

.segmented {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  padding: 4px;
  border: 1px solid var(--rt-border);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.02);
}

.seg-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid transparent;
  border-radius: 12px;
  padding: 10px 14px;
  color: var(--rt-fg-muted);
  background: transparent;
  cursor: pointer;
  transition: background-color 0.16s ease, color 0.16s ease, border-color 0.16s ease, transform 0.16s ease;
}

.seg-btn:hover {
  background: rgba(168, 85, 247, 0.08);
  color: var(--rt-fg);
  transform: translateY(-1px);
}

.seg-btn.active {
  background: linear-gradient(135deg, rgba(168, 85, 247, 0.9), rgba(216, 134, 255, 0.8));
  color: #fff;
  border-color: rgba(255, 255, 255, 0.18);
}

.seg-btn .chip {
  pointer-events: none;
}

.subtle, .muted { color: var(--rt-fg-muted); font-size: var(--rt-fs-12); }
.empty {
  padding: 20px;
  color: var(--rt-fg-muted);
  font-size: var(--rt-fs-13, 13px);
  text-align: center;
  font-style: italic;
}

/* JS-rendered `.chat-item` (header lists). Hidden visually since we removed that panel. */
.chat-item { display: none; }

/* ============================ ADMIN OVERLAY ============================ */
.admin-overlay {
  position: fixed;
  inset: 0;
  display: none;
  z-index: 100;
  animation: adminFadeIn var(--rt-dur-base) var(--rt-ease-standard);
}
.admin-overlay.is-open { display: block; }
body.admin-open { overflow: hidden; }
.admin-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(16, 16, 24, 0.5);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}
.admin-panel {
  position: absolute;
  top: 0; right: 0; bottom: 0;
  width: min(1280px, 100%);
  background: var(--rt-bg);
  display: grid;
  grid-template-rows: auto 1fr;
  box-shadow: var(--rt-shadow-xl);
  animation: adminSlideIn var(--rt-dur-slow) var(--rt-ease-out);
}
@keyframes adminFadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes adminSlideIn { from { transform: translateX(20px); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

.admin-panel__head {
  padding: 20px 28px;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 18px;
  background: var(--rt-surface);
  border-bottom: 1px solid var(--rt-border);
}
.admin-panel__head h2 {
  margin: 6px 0 0;
  font-size: var(--rt-fs-24);
  font-weight: 500;
  letter-spacing: var(--rt-ls-snug);
}
.admin-panel__body {
  display: grid;
  grid-template-columns: 260px 1fr;
  overflow: hidden;
}
.admin-rail {
  background: var(--rt-surface);
  border-right: 1px solid var(--rt-border);
  padding: 18px 14px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.admin-rail__tab {
  padding: 12px 14px !important;
  border-radius: var(--rt-radius-md) !important;
  text-align: left;
  justify-content: flex-start !important;
  border-bottom: 0 !important;
  margin: 0 !important;
  font-weight: 500;
  color: var(--rt-fg-muted);
}
.admin-rail__tab:hover { background: var(--rt-purple-50); color: var(--rt-fg); }
.admin-rail__tab.active {
  background: var(--rt-purple-500);
  color: #fff !important;
  border-bottom: 0 !important;
}
.admin-rail__divider {
  height: 1px;
  background: var(--rt-border);
  margin: 14px 4px;
}
.admin-rail__hint {
  font-size: var(--rt-fs-12);
  color: var(--rt-fg-muted);
  line-height: 1.5;
  padding: 8px 6px;
}

.admin-pane {
  padding: 24px 28px;
  overflow: auto;
  background: var(--rt-bg);
}

/* Settings sub-tabs */
.settings-tabs {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 18px;
  padding: 4px;
  background: var(--rt-surface-2);
  border-radius: var(--rt-radius-md);
  width: fit-content;
}
.settings-tab {
  padding: 8px 14px;
  background: transparent;
  border: none;
  border-radius: var(--rt-radius-sm);
  font: inherit;
  font-weight: 500;
  font-size: var(--rt-fs-13, 13px);
  color: var(--rt-fg-muted);
  cursor: pointer;
  transition: all var(--rt-dur-fast) var(--rt-ease-standard);
}
.settings-tab:hover { color: var(--rt-fg); }
.settings-tab.active {
  background: var(--rt-surface);
  color: var(--rt-purple-700);
  box-shadow: var(--rt-shadow-xs);
}
.settings-pane { display: none; }
.settings-pane.active { display: block; }

/* ============================ TOASTS ============================ */
.toast-wrap {
  position: fixed;
  right: 18px;
  top: 18px;
  z-index: 200;
  display: grid;
  gap: 10px;
}
.toast {
  min-width: 280px;
  max-width: 420px;
  background: var(--rt-surface);
  border: 1px solid var(--rt-border);
  border-left: 4px solid var(--rt-purple-500);
  border-radius: var(--rt-radius-md);
  padding: 12px 16px;
  box-shadow: var(--rt-shadow-lg);
  font-size: var(--rt-fs-14);
  animation: toastIn var(--rt-dur-base) var(--rt-ease-out);
}
.toast.err { border-left-color: var(--rt-danger); }
.toast.warn { border-left-color: var(--rt-warning); }
@keyframes toastIn {
  from { transform: translateX(20px); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}
.ui-tooltip {
  position: fixed;
  z-index: 1000;
  max-width: 420px;
  padding: 10px 12px;
  border-radius: var(--rt-radius-sm);
  background: rgba(18, 13, 35, 0.96);
  border: 1px solid rgba(168, 85, 247, 0.32);
  color: var(--rt-fg);
  box-shadow: var(--rt-shadow-lg);
  font-size: 13px;
  line-height: 1.45;
  pointer-events: none;
  opacity: 0;
  transform: translateY(3px);
  transition: opacity var(--rt-dur-fast) var(--rt-ease-standard), transform var(--rt-dur-fast) var(--rt-ease-standard);
}
.ui-tooltip.is-visible {
  opacity: 1;
  transform: translateY(0);
}
.help-tip {
  display: inline-grid;
  place-items: center;
  flex: 0 0 auto;
  width: 17px;
  height: 17px;
  margin-left: 6px;
  border-radius: 50%;
  border: 1px solid rgba(168, 85, 247, 0.42);
  background: rgba(168, 85, 247, 0.10);
  color: var(--rt-purple-700);
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
  cursor: help;
  user-select: none;
}
.help-tip:hover,
.help-tip:focus-visible {
  background: rgba(168, 85, 247, 0.22);
  color: #fff;
  outline: none;
  border-color: rgba(168, 85, 247, 0.70);
}
.settings-tab .help-tip,
.admin-rail__tab .help-tip {
  width: 16px;
  height: 16px;
  font-size: 10px;
}
.help-line {
  display: flex;
  justify-content: flex-end;
  min-height: 0;
  margin: -2px 0 6px;
}
.help-line .help-tip {
  margin-left: 0;
}

/* ============================ RESPONSIVE ============================ */
@media (max-width: 1280px) {
  .main { grid-template-columns: minmax(0, 1fr) 300px; }
}
@media (max-width: 1100px) {
  body.rt { height: auto; overflow: auto; }
  .app-header__inner { grid-template-columns: 1fr; gap: 12px; }
  .app-header__inner .searchbox { order: 3; }
  .main {
    grid-template-columns: 1fr;
    overflow: visible;
  }
  .main__content, .main__aside { overflow: visible; padding-right: 0; }
  .today-grid, .notebook-grid, .stats, .grid-3, .form-grid, .rule-grid, .check-grid, .split {
    grid-template-columns: 1fr;
  }
  .stats { grid-template-columns: repeat(2, 1fr); }
  .today-grid {
    grid-template-columns: 1fr;
    grid-template-areas:
      "chat"
      "tasks"
      "team"
      "digest";
  }
  .admin-panel__body { grid-template-columns: 1fr; }
  .admin-rail { flex-direction: row; flex-wrap: wrap; border-right: 0; border-bottom: 1px solid var(--rt-border); }
  .admin-rail__hint, .admin-rail__divider { display: none; }
}
@media (max-width: 640px) {
  .page-head { flex-direction: column; align-items: flex-start; }
  .page-head__title { font-size: var(--rt-fs-24); }
}

/* ============================ MISC ============================ */
::selection { background: var(--rt-purple-200); color: var(--rt-purple-900); }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--rt-border-strong); border-radius: 999px; border: 2px solid var(--rt-bg); }
::-webkit-scrollbar-thumb:hover { background: var(--rt-purple-300); }

/* Hide lane elements in non-lane variants */
.role-rail[data-variant="tabs"] .context-tree__lane,
.role-rail[data-variant="breadcrumb"] .context-tree__lane { display: none; }
.role-rail[data-variant="tabs"] .context-tree,
.role-rail[data-variant="breadcrumb"] .context-tree { gap: 0; }

/* === Variant B: TABS === */
.role-rail[data-variant="tabs"] .role-rail__inner { padding-top: 38px; padding-bottom: 12px; }
.role-tabs {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
  border-bottom: 1px solid var(--rt-border);
  padding-bottom: 8px;
}
.role-tabs__sep {
  width: 1px;
  height: 20px;
  background: var(--rt-border);
  margin: 0 6px;
}
.role-tab {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 14px 7px 7px;
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--rt-radius-md) var(--rt-radius-md) 0 0;
  font: inherit;
  font-size: var(--rt-fs-13, 13px);
  font-weight: 500;
  color: var(--rt-fg-muted);
  cursor: pointer;
  position: relative;
  transition: all var(--rt-dur-fast) var(--rt-ease-standard);
  margin-bottom: -1px;
}
.role-tab__avatar {
  width: 22px; height: 22px;
  border-radius: 50%;
  background: var(--rt-purple-100);
  color: var(--rt-purple-700);
  display: grid; place-items: center;
  font-weight: 700;
  font-size: 10px;
}
.role-tab:hover { color: var(--rt-fg); background: var(--rt-purple-50); }
.role-tab.is-open {
  color: var(--rt-purple-700);
  background: var(--rt-purple-50);
  border-color: var(--rt-border);
  border-bottom-color: var(--rt-surface);
}
.role-tab.is-active {
  color: var(--rt-purple-700);
  background: var(--rt-surface);
  border-color: var(--rt-border);
  border-bottom-color: var(--rt-surface);
  box-shadow: 0 -2px 0 var(--rt-purple-500) inset;
}
.role-tab.is-active .role-tab__avatar {
  background: var(--rt-purple-500);
  color: #fff;
}
.role-tab--root { font-weight: 600; color: var(--rt-fg); }
.role-tab--add {
  border: 1px dashed var(--rt-purple-300);
  border-radius: 50%;
  width: 30px; height: 30px;
  justify-content: center;
  padding: 0;
  color: var(--rt-purple-500);
  margin-left: 4px;
  margin-bottom: 4px;
}
.role-tab--add:hover { background: var(--rt-purple-50); border-style: solid; }

.role-projects {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  padding-top: 10px;
}
.role-projects__label {
  font-size: 11px;
  color: var(--rt-purple-700);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: var(--rt-ls-wide);
  margin-right: 4px;
}
.role-projects__empty {
  font-size: var(--rt-fs-12);
  color: var(--rt-fg-muted);
  font-style: italic;
}
.role-chip {
  background: var(--rt-surface);
  border: 1px solid var(--rt-border);
  border-radius: var(--rt-radius-pill);
  padding: 5px 14px;
  font: inherit;
  font-size: var(--rt-fs-13, 13px);
  font-weight: 500;
  color: var(--rt-fg);
  cursor: pointer;
  transition: all var(--rt-dur-fast) var(--rt-ease-standard);
}
.role-chip:hover {
  border-color: var(--rt-purple-300);
  background: var(--rt-purple-50);
  color: var(--rt-purple-700);
}
.role-chip.is-active {
  background:
    linear-gradient(180deg, rgba(255,255,255,0.10), rgba(0,0,0,0) 50%),
    var(--rt-purple-500);
  border-color: var(--rt-purple-500);
  color: #fff;
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.20),
    0 2px 4px rgba(119, 0, 255, 0.20);
}
.role-chip--add {
  border-style: dashed;
  color: var(--rt-purple-500);
  padding: 5px 10px;
}

/* === Variant C: BREADCRUMB === */
.role-rail[data-variant="breadcrumb"] .role-rail__inner { padding-top: 38px; padding-bottom: 14px; }
.role-breadcrumb-bar {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  background: var(--rt-surface);
  border: 1px solid var(--rt-border);
  border-radius: var(--rt-radius-pill);
  padding: 4px 8px 4px 12px;
  box-shadow:
    0 1px 0 rgba(255,255,255,0.6) inset,
    0 1px 2px rgba(16, 16, 24, 0.04),
    0 4px 12px -6px rgba(16, 16, 24, 0.08);
}
.role-bc__label {
  font-size: 11px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: var(--rt-ls-wide);
  color: var(--rt-fg-muted);
  margin-right: 6px;
}
.role-bc__seg {
  position: relative;
  display: inline-block;
}
.role-bc__seg-summary {
  list-style: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 8px;
  border-radius: var(--rt-radius-md);
  font: inherit;
  font-size: var(--rt-fs-13, 13px);
  font-weight: 500;
  color: var(--rt-fg);
  transition: all var(--rt-dur-fast) var(--rt-ease-standard);
}
.role-bc__seg-summary::-webkit-details-marker { display: none; }
.role-bc__seg-summary:hover { background: var(--rt-purple-50); color: var(--rt-purple-700); }
.role-bc__seg.is-current .role-bc__seg-summary {
  color: var(--rt-purple-700);
  font-weight: 600;
}
.role-bc__seg-av {
  width: 20px; height: 20px;
  border-radius: 50%;
  background: var(--rt-purple-100);
  color: var(--rt-purple-700);
  display: grid; place-items: center;
  font-weight: 700;
  font-size: 9px;
}
.role-bc__seg.is-current .role-bc__seg-av { background: var(--rt-purple-500); color: #fff; }
.role-bc__seg-chev { font-size: 9px; opacity: 0.6; }
.role-bc__sep { color: var(--rt-border-strong); margin: 0 2px; }
.role-bc__menu {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  z-index: 90;
  min-width: 240px;
  max-width: 360px;
  background: var(--rt-surface);
  border: 1px solid var(--rt-border);
  border-radius: var(--rt-radius-md);
  box-shadow:
    0 1px 0 rgba(255,255,255,0.6) inset,
    0 8px 32px -8px rgba(16, 16, 24, 0.16);
  padding: 6px;
  display: grid;
  gap: 2px;
}
.role-bc__opt {
  display: grid;
  grid-template-columns: 26px 1fr;
  gap: 10px;
  align-items: center;
  padding: 8px 10px;
  background: transparent;
  border: none;
  border-radius: var(--rt-radius-sm);
  font: inherit;
  text-align: left;
  cursor: pointer;
  color: var(--rt-fg);
}
.role-bc__opt:hover { background: var(--rt-purple-50); }
.role-bc__opt.is-current { background: var(--rt-purple-50); color: var(--rt-purple-700); }
.role-bc__opt-av {
  width: 26px; height: 26px;
  border-radius: 50%;
  background: var(--rt-purple-100);
  color: var(--rt-purple-700);
  display: grid; place-items: center;
  font-weight: 700;
  font-size: 10px;
}
.role-bc__opt-body { display: grid; gap: 2px; min-width: 0; }
.role-bc__opt-name { font-weight: 600; font-size: var(--rt-fs-13, 13px); }
.role-bc__opt-desc { font-size: 11px; color: var(--rt-fg-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.role-bc__drill { display: inline-block; position: relative; }
.role-bc__drill-summary {
  list-style: none;
  cursor: pointer;
  width: 22px; height: 22px;
  border-radius: 50%;
  background: var(--rt-purple-50);
  color: var(--rt-purple-500);
  display: inline-grid;
  place-items: center;
  font-weight: 700;
  font-size: 14px;
  border: 1px dashed var(--rt-purple-300);
  margin-left: 4px;
}
.role-bc__drill-summary::-webkit-details-marker { display: none; }
.role-bc__drill[open] .role-bc__drill-summary {
  background: var(--rt-purple-500);
  color: #fff;
  border-style: solid;
  border-color: var(--rt-purple-500);
}


/* ============================ LANES TWEAKS (per user request) ============================ */
/* 1) Larger level-2 pills */
.role-rail[data-variant="lanes"] .context-tree {
  row-gap: 22px;
}
.role-rail[data-variant="lanes"] .context-node.level-2 {
  padding: 10px 18px 10px 8px;
}
.role-rail[data-variant="lanes"] .context-node.level-2 .context-node__avatar {
  width: 34px; height: 34px;
  font-size: 13px;
}
.role-rail[data-variant="lanes"] .context-node.level-2 .context-node__name {
  font-size: var(--rt-fs-16);
  font-weight: 600;
}

/* Hide the generic arrow on the open level-2 area — SVG connector replaces it */
.context-node.is-open::after { display: none !important; }
.role-rail[data-variant="lanes"] .context-tree__lane--projects .context-node,
.role-rail[data-variant="lanes"] .context-tree__lane--children .context-node {
  position: relative;
}


/* ============================ PREMIUM POLISH ============================
   Goals: 1) premium materiality, 2) signal of innovation, 3) keep brand.
   Strategy: warmer ivory surfaces, deeper "ink" headings, gradient primary
   buttons with subtle highlight sweep, soft inner glow on active CTA cards.
============================================================================ */

:root {
  --rt-ink: #F6F0FF;               /* keep headlines readable on dark surfaces */
  --rt-ivory: #1A122C;             /* keep cards/panels aligned with dark shell */
  --rt-ivory-2: #231738;
  --rt-aurora: linear-gradient(135deg, #7700FF 0%, #9B33FF 50%, #B561FF 100%);
  --rt-aurora-soft: linear-gradient(135deg, rgba(119,0,255,0.08) 0%, rgba(181,97,255,0.10) 100%);
  --rt-shine: linear-gradient(135deg, transparent 0%, rgba(255,255,255,0.18) 40%, transparent 80%);
}

/* Warmer surfaces */
.card, .panel, .quick-card {
  background: var(--rt-ivory);
}

/* Deeper, more premium headlines */
.page-head__title,
.card__title,
.admin-panel__head h2 {
  color: var(--rt-ink);
  letter-spacing: 0;
}

/* Primary CTA — Aurora gradient with subtle shine on hover (Linear/Vercel feel) */
.btn:not(.btn-lite):not(.btn-danger):not(.btn--accent) {
  background: var(--rt-aurora);
  border-color: transparent;
  position: relative;
  overflow: hidden;
}
.btn:not(.btn-lite):not(.btn-danger):not(.btn--accent)::before {
  content: '';
  position: absolute;
  inset: 0;
  background: var(--rt-shine);
  transform: translateX(-100%);
  transition: transform 600ms cubic-bezier(0.22, 1, 0.36, 1);
  pointer-events: none;
}
.btn:not(.btn-lite):not(.btn-danger):not(.btn--accent):hover::before {
  transform: translateX(100%);
}

/* Hero CTA card (Chat) — soft inner aurora glow */
.card--chat {
  background:
    radial-gradient(circle at 100% 0%, rgba(155,51,255,0.05), transparent 50%),
    var(--rt-ivory);
  border-color: rgba(119, 0, 255, 0.12);
  position: relative;
}
.card--chat::before {
  content: '';
  position: absolute;
  inset: -1px;
  border-radius: inherit;
  padding: 1px;
  background: linear-gradient(135deg, rgba(155,51,255,0.30), rgba(119,0,255,0) 40%, rgba(181,97,255,0.18));
  -webkit-mask:
    linear-gradient(#000 0 0) content-box,
    linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
          mask-composite: exclude;
  pointer-events: none;
  opacity: 0.7;
}

/* Active context node — premium aurora fill */
.context-node.is-active {
  background: var(--rt-aurora);
  border-color: transparent;
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.30),
    0 2px 4px rgba(119, 0, 255, 0.25),
    0 12px 24px -10px rgba(119, 0, 255, 0.55);
}

/* Active role chip + nav active tab — innovation glow */
.tab.active::after {
  background: linear-gradient(90deg, transparent, var(--rt-purple-500), #B561FF, transparent);
  opacity: 0.7;
}

/* Logo with light-sweep animation (subtle, runs once on load) */
.app-brand__logo {
  position: relative;
}
.app-brand__logo::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: linear-gradient(135deg, transparent 30%, rgba(255,255,255,0.25) 50%, transparent 70%);
  transform: translateX(-100%);
  animation: logoShine 2.4s cubic-bezier(0.22, 1, 0.36, 1) 600ms 1;
  pointer-events: none;
}
@keyframes logoShine {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}

/* Send/CTA in composer — gradient send button (subtle distinguishing) */
.composer .btn:not(.btn-lite) {
  background: var(--rt-aurora);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.25),
    0 4px 12px -4px rgba(119, 0, 255, 0.45);
}

/* Body chat-bot messages — touch of warm cream so they don't look generic-white */
.msg.bot {
  background: linear-gradient(180deg, #FFFFFF, #FBFAFD);
}

/* Status-line / loading text uses gradient text for an AI-vibe */
.statusline:not(:empty) {
  background: linear-gradient(90deg, var(--rt-purple-500), #B561FF);
  -webkit-background-clip: text;
          background-clip: text;
  -webkit-text-fill-color: transparent;
  font-weight: 500;
}


/* ============================================================================
   DARK PREMIUM THEME — Linear/Arc/Vercel direction
   Deep ink surfaces, electric violet accents, aurora gradients.
   Overrides Rostelecom tokens — applied at body.rt root.
============================================================================ */

body.rt {
  /* Core palette */
  --rt-bg:           #0A0612;        /* deep ink */
  --rt-bg-2:         #0D0817;
  --rt-surface:      #14102A;        /* card / panel */
  --rt-surface-2:    #1A1531;
  --rt-surface-3:    #221B3D;
  --rt-border:       rgba(255, 255, 255, 0.07);
  --rt-border-strong:rgba(255, 255, 255, 0.14);

  /* Text */
  --rt-fg:           #ECE7F5;
  --rt-fg-strong:    #F8F5FF;
  --rt-fg-muted:     #8E83AE;
  --rt-fg-brand:     #C896FF;
  --rt-ink:          #F8F5FF;

  /* Brand violet (lighter for dark bg pop) */
  --rt-purple-50:   rgba(168, 85, 247, 0.08);
  --rt-purple-100:  rgba(168, 85, 247, 0.16);
  --rt-purple-200:  rgba(168, 85, 247, 0.28);
  --rt-purple-300:  #8B5CF6;
  --rt-purple-400:  #A855F7;
  --rt-purple-500:  #A855F7;
  --rt-purple-600:  #9333EA;
  --rt-purple-700:  #C084FC;
  --rt-purple-800:  #D8B4FE;
  --rt-purple-900:  #E9D5FF;
  --rt-lavander:    rgba(192, 132, 252, 0.18);

  /* Accent (warm, for "act now") */
  --rt-orange-500:  #FB923C;
  --rt-orange-600:  #F97316;
  --rt-orange-700:  #C2410C;
  --rt-orange-50:   rgba(251, 146, 60, 0.10);

  /* Semantic */
  --rt-success:     #34D399;
  --rt-success-bg:  rgba(52, 211, 153, 0.10);
  --rt-warning:     #FBBF24;
  --rt-warning-bg:  rgba(251, 191, 36, 0.10);
  --rt-danger:      #FB7185;
  --rt-danger-bg:   rgba(251, 113, 133, 0.10);

  /* Shadows for dark backgrounds — use light glows instead of dark drop */
  --rt-shadow-xs:   0 1px 2px rgba(0, 0, 0, 0.4);
  --rt-shadow-sm:   0 2px 6px rgba(0, 0, 0, 0.4);
  --rt-shadow-md:   0 4px 12px rgba(0, 0, 0, 0.45);
  --rt-shadow-lg:   0 12px 28px -8px rgba(0, 0, 0, 0.55);
  --rt-shadow-xl:   0 30px 70px -20px rgba(0, 0, 0, 0.7);
  --rt-shadow-brand:0 6px 20px -4px rgba(168, 85, 247, 0.45);
  --rt-shadow-accent:0 6px 20px -4px rgba(251, 146, 60, 0.40);

  /* Aurora */
  --rt-aurora: linear-gradient(135deg, #7C3AED 0%, #A855F7 50%, #C084FC 100%);
  --rt-aurora-strong: linear-gradient(135deg, #6D28D9 0%, #A855F7 50%, #D946EF 100%);
  --rt-aurora-soft: linear-gradient(135deg, rgba(168,85,247,0.18) 0%, rgba(217,70,239,0.12) 100%);
  --rt-shine: linear-gradient(135deg, transparent 0%, rgba(255,255,255,0.22) 40%, transparent 80%);
}

/* Page background — mesh gradient with violet aurora glows */
html, body {
  background:
    radial-gradient(1100px 700px at 85% -10%, rgba(168, 85, 247, 0.18), transparent 55%),
    radial-gradient(900px 600px at -10% 30%, rgba(76, 41, 173, 0.18), transparent 55%),
    radial-gradient(700px 500px at 50% 110%, rgba(217, 70, 239, 0.10), transparent 55%),
    radial-gradient(800px 500px at 20% 90%, rgba(99, 102, 241, 0.10), transparent 55%),
    #0A0612 !important;
  background-attachment: fixed !important;
  color: var(--rt-fg);
}

/* Optional grain noise — texture that screams premium (Linear-style) */
body.rt::before {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 1000;
  opacity: 0.04;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='200' height='200'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='3'/></filter><rect width='100%' height='100%' filter='url(%23n)' opacity='1'/></svg>");
}

/* Header — translucent dark with violet edge */
.app-header {
  background:
    linear-gradient(180deg, rgba(20, 16, 42, 0.85), rgba(20, 16, 42, 0.55));
  backdrop-filter: blur(18px) saturate(160%);
  -webkit-backdrop-filter: blur(18px) saturate(160%);
  border-bottom: 1px solid rgba(168, 85, 247, 0.14);
  box-shadow: 0 1px 0 rgba(255,255,255,0.04) inset, 0 12px 28px -16px rgba(0, 0, 0, 0.6);
}

.app-brand__name { color: var(--rt-fg-strong); }
.app-brand__meta { color: var(--rt-fg-muted); }

/* Search */
.search__input {
  background: rgba(255,255,255,0.04) !important;
  border-color: rgba(255,255,255,0.08) !important;
  color: var(--rt-fg);
}
.search__input::placeholder { color: var(--rt-fg-muted); }
.search__icon { color: var(--rt-fg-muted); }
.search__kbd {
  background: rgba(255,255,255,0.06);
  border-color: rgba(255,255,255,0.08);
  color: var(--rt-fg-muted);
}
.search-results {
  background: var(--rt-surface);
  border-color: var(--rt-border);
  box-shadow: var(--rt-shadow-lg), 0 0 0 1px rgba(168, 85, 247, 0.15);
}

/* Icon buttons */
.icon-btn {
  background: rgba(255,255,255,0.04);
  border-color: rgba(255,255,255,0.08);
  color: var(--rt-fg);
}
.icon-btn:hover {
  background: rgba(168, 85, 247, 0.14);
  border-color: rgba(168, 85, 247, 0.32);
  color: var(--rt-purple-700);
}

/* Role rail */
.role-rail {
  background:
    linear-gradient(180deg, rgba(26, 21, 49, 0.85), rgba(20, 16, 42, 0.65));
  border-bottom: 1px solid rgba(168, 85, 247, 0.10);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}
/* Nav */
.app-nav {
  background: rgba(20, 16, 42, 0.80);
  border-top-color: rgba(255,255,255,0.06);
  border-bottom-color: rgba(255,255,255,0.06);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}
.tab { color: var(--rt-fg-muted); }
.tab:hover { color: var(--rt-fg-strong); }
.tab.active {
  color: var(--rt-purple-700);
  border-bottom-color: var(--rt-purple-500);
}
.tab.active::after {
  background: linear-gradient(90deg, transparent, var(--rt-purple-400), #D946EF, transparent);
  filter: blur(8px);
  opacity: 0.7;
}

/* Cards — deep ink with subtle violet edge */
.card, .panel, .quick-card {
  background:
    linear-gradient(180deg, rgba(255,255,255,0.02), transparent 60%),
    var(--rt-surface);
  border-color: var(--rt-border);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.05),
    0 1px 2px rgba(0, 0, 0, 0.3),
    0 12px 32px -16px rgba(0, 0, 0, 0.5);
}
.card:hover, .panel:hover {
  border-color: rgba(168, 85, 247, 0.22);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.06),
    0 4px 12px -2px rgba(0, 0, 0, 0.4),
    0 16px 40px -16px rgba(168, 85, 247, 0.25);
}

.card__head {
  border-bottom-color: var(--rt-border);
}
.card__title, .page-head__title, .admin-panel__head h2 {
  color: var(--rt-fg-strong);
  letter-spacing: 0;
}
.card__sub, .page-head__sub { color: var(--rt-fg-muted); }

/* Hero chat card — aurora outline */
.card--chat {
  background:
    radial-gradient(circle at 100% 0%, rgba(168, 85, 247, 0.12), transparent 50%),
    radial-gradient(circle at 0% 100%, rgba(217, 70, 239, 0.06), transparent 50%),
    var(--rt-surface) !important;
  border-color: rgba(168, 85, 247, 0.18);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.08),
    0 4px 12px -2px rgba(0, 0, 0, 0.4),
    0 28px 60px -24px rgba(168, 85, 247, 0.45);
}
.card--chat::before {
  background: linear-gradient(135deg, rgba(192, 132, 252, 0.50), rgba(168, 85, 247, 0.0) 40%, rgba(217, 70, 239, 0.32));
  opacity: 0.9;
}

/* Chatbox — dark with subtle gradient bg */
.chatbox {
  background:
    radial-gradient(circle at 50% 0%, rgba(168, 85, 247, 0.05), transparent 50%),
    var(--rt-bg);
  border-bottom-color: var(--rt-border);
}

/* Messages */
.msg.me {
  background: var(--rt-aurora);
  color: #fff;
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.20),
    0 6px 16px -6px rgba(168, 85, 247, 0.55);
}
.msg.bot {
  background: linear-gradient(180deg, rgba(255,255,255,0.04), rgba(255,255,255,0.02));
  color: var(--rt-fg);
  border-color: rgba(255,255,255,0.06);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.04);
}
.msg.bot .msg-h { color: var(--rt-purple-700); }

/* Composer / inputs */
input:not([type="checkbox"]):not([type="radio"]):not([type="file"]),
select, textarea {
  background: rgba(255,255,255,0.03);
  border-color: rgba(255,255,255,0.10);
  color: var(--rt-fg);
}
input::placeholder, textarea::placeholder { color: var(--rt-fg-muted); }
input:focus, select:focus, textarea:focus {
  border-color: var(--rt-purple-400);
  box-shadow: 0 0 0 3px rgba(168, 85, 247, 0.18), 0 0 24px -4px rgba(168, 85, 247, 0.30);
}

/* Buttons */
.btn:not(.btn-lite):not(.btn-danger):not(.btn--accent) {
  background: var(--rt-aurora);
  border-color: transparent;
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.25),
    0 2px 4px rgba(168, 85, 247, 0.30),
    0 8px 24px -8px rgba(168, 85, 247, 0.55);
}
.btn:not(.btn-lite):not(.btn-danger):not(.btn--accent):hover {
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.30),
    0 4px 8px rgba(168, 85, 247, 0.40),
    0 12px 32px -8px rgba(168, 85, 247, 0.70);
}
.btn-lite {
  background: rgba(255,255,255,0.04);
  border-color: rgba(255,255,255,0.10);
  color: var(--rt-fg);
}
.btn-lite:hover {
  background: rgba(168, 85, 247, 0.14);
  border-color: rgba(168, 85, 247, 0.32);
  color: var(--rt-purple-700);
}

/* Tables */
.data-table th, table th {
  background: rgba(255,255,255,0.025);
  color: var(--rt-fg-muted);
  border-bottom-color: var(--rt-border);
}
.data-table td, table td { border-bottom-color: var(--rt-border); }
.data-table tbody tr:hover { background: rgba(168, 85, 247, 0.06); }

/* Task styling */
.today-task:hover { background: rgba(168, 85, 247, 0.06); }
.today-task__check {
  border-color: rgba(255,255,255,0.20);
  background: transparent;
}
.today-task__check:hover { border-color: var(--rt-purple-500); background: rgba(168, 85, 247, 0.12); }
.task-context, .chip--soft, .task-count {
  background: rgba(168, 85, 247, 0.12);
  color: var(--rt-purple-700);
  border-color: rgba(168, 85, 247, 0.22);
}
.chip {
  background: rgba(255,255,255,0.04);
  color: var(--rt-fg-muted);
  border-color: rgba(255,255,255,0.10);
}

/* Role tree — lanes variant */
.context-node {
  background: rgba(255,255,255,0.03);
  border-color: rgba(255,255,255,0.10);
  color: var(--rt-fg);
}
.context-node:hover {
  border-color: rgba(168, 85, 247, 0.35);
  background: rgba(168, 85, 247, 0.08);
}
.context-node__avatar {
  background: rgba(168, 85, 247, 0.16);
  color: var(--rt-purple-700);
}
.context-node__name { color: var(--rt-fg); }
.context-node__desc { color: var(--rt-fg-muted); }
.context-node.is-ancestor {
  border-color: rgba(168, 85, 247, 0.40);
  background: rgba(168, 85, 247, 0.10);
}
.context-node.is-open {
  border-color: rgba(168, 85, 247, 0.50);
  background: rgba(168, 85, 247, 0.12);
  box-shadow: 0 0 0 2px rgba(168, 85, 247, 0.15), 0 0 24px -4px rgba(168, 85, 247, 0.30);
}
.context-node.is-active {
  background: var(--rt-aurora) !important;
  border-color: transparent;
  color: #fff;
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.25),
    0 4px 12px rgba(168, 85, 247, 0.40),
    0 12px 32px -8px rgba(168, 85, 247, 0.60);
}
.context-node.is-active .context-node__name,
.context-node.is-active .context-node__desc { color: #fff !important; }
.context-node.is-active .context-node__avatar {
  background: rgba(255,255,255,0.25);
  color: #fff;
}
.context-tree__lane-label { color: var(--rt-fg-muted); }
.context-add {
  border-color: rgba(168, 85, 247, 0.35);
  color: var(--rt-purple-700);
}
.context-add:hover { background: rgba(168, 85, 247, 0.10); }

/* Lane connector — already SVG, just change stroke color via override */
.lane-connector path { stroke: #C084FC !important; }
.lane-connector polygon { fill: #C084FC !important; }

/* Quick capture */
.quick-card--ghost {
  background: rgba(255,255,255,0.02);
  border-color: rgba(255,255,255,0.06);
}
.quick-card__input { background: rgba(255,255,255,0.03); border-color: rgba(255,255,255,0.10); }
.capture-tabs {
  background: rgba(255,255,255,0.04);
  border-color: rgba(255,255,255,0.08);
}
.capture-tab { color: var(--rt-fg-muted); }
.capture-tab.active {
  background: rgba(168, 85, 247, 0.16);
  color: var(--rt-purple-700);
  box-shadow: inset 0 0 0 1px rgba(168, 85, 247, 0.30);
}

/* Quick recent items */
.quick-recent__item {
  background: rgba(255,255,255,0.03);
  border-color: rgba(255,255,255,0.07);
}

/* Note cards / list cards / panels */
.note-card, .list-card { background: rgba(255,255,255,0.03); border-color: rgba(255,255,255,0.07); }
.note-card:hover { background: rgba(255,255,255,0.05); border-color: rgba(168, 85, 247, 0.30); }
.list-card[open] { background: rgba(168, 85, 247, 0.06); border-color: rgba(168, 85, 247, 0.25); }
.notebook-collapse, .notebook-collapse > summary { background: var(--rt-surface); color: var(--rt-fg); }
.notes-ios-layout { border-top-color: rgba(255,255,255,0.07); }
.note-list-panel { border-right-color: rgba(255,255,255,0.07); }
.note-list-item { border-bottom-color: rgba(255,255,255,0.05); }
.note-list-item.is-active { background: rgba(168,85,247,0.12); border-left-color: var(--rt-aurora); }
.note-editor__ta { background: transparent; color: var(--rt-fg); }
.list-ctx-select { background: rgba(255,255,255,0.04); border-color: rgba(255,255,255,0.10); color: var(--rt-fg-muted); }
.mini-item { background: rgba(255,255,255,0.03); border-color: rgba(255,255,255,0.07); }

/* Admin overlay */
.admin-backdrop { background: rgba(5, 2, 12, 0.65); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); }
.admin-panel { background: var(--rt-bg); }
.admin-panel__head { background: var(--rt-surface); border-bottom-color: var(--rt-border); }
.admin-rail { background: var(--rt-surface-2); border-right-color: var(--rt-border); }
.admin-pane { background: var(--rt-bg); }
.admin-rail__hint { color: var(--rt-fg-muted); }
.admin-rail__tab { color: var(--rt-fg-muted); }
.admin-rail__tab:hover { background: rgba(168, 85, 247, 0.10); color: var(--rt-fg); }
.admin-rail__tab.active { background: var(--rt-aurora) !important; color: #fff !important; }

/* Settings tabs */
.settings-tabs { background: rgba(255,255,255,0.04); border: 1px solid rgba(255,255,255,0.07); }
.settings-tab { color: var(--rt-fg-muted); }
.settings-tab.active {
  background: rgba(168, 85, 247, 0.16);
  color: var(--rt-purple-700);
  box-shadow: inset 0 0 0 1px rgba(168, 85, 247, 0.30);
}

/* Logo wrapper — keep aurora glow */
.app-brand__logo {
  background:
    radial-gradient(120% 120% at 30% 20%, #D8B4FE 0%, #A855F7 55%, #6D28D9 100%);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.40),
    0 8px 22px -8px rgba(168, 85, 247, 0.70),
    0 3px 6px -1px rgba(0, 0, 0, 0.40),
    0 0 0 3px rgba(168, 85, 247, 0.12);
}

/* Toasts */
.toast {
  background: var(--rt-surface);
  border-color: var(--rt-border);
  color: var(--rt-fg);
  border-left-color: var(--rt-purple-500);
}

/* Scrollbars */
::-webkit-scrollbar-thumb {
  background: rgba(168, 85, 247, 0.20);
  border: 2px solid var(--rt-bg);
}
::-webkit-scrollbar-thumb:hover { background: rgba(168, 85, 247, 0.40); }
.main__content::-webkit-scrollbar-thumb,
.main__aside::-webkit-scrollbar-thumb {
  background: rgba(168, 85, 247, 0.20);
  border: 2px solid transparent;
  background-clip: padding-box;
}

/* Selection */
::selection { background: rgba(168, 85, 247, 0.40); color: #fff; }

/* Notebook search input */
.notebook-search input {
  background: rgba(255,255,255,0.03);
  border-color: rgba(255,255,255,0.10);
}

/* Progress bar */
.list-card__progress { background: rgba(255,255,255,0.08); }
.list-card__progress-bar { background: var(--rt-aurora); }

/* Checkbox check on dark */
.checklist__check { background: transparent; border-color: rgba(255,255,255,0.25); }
.checklist__item.is-done .checklist__check { background: var(--rt-purple-500); border-color: var(--rt-purple-500); }
.checklist__item.is-done { color: var(--rt-fg-muted); }

/* Stat cards */
.stat strong, .stat-mini strong { color: var(--rt-purple-700); }
.stat-mini { background: rgba(255,255,255,0.03); border-color: rgba(255,255,255,0.07); }
.stat { background: rgba(255,255,255,0.03); border-color: rgba(255,255,255,0.07); }

/* Pills/Badges */
.pill, .badge { background: rgba(168, 85, 247, 0.16); color: var(--rt-purple-700); border-color: rgba(168, 85, 247, 0.30); }
.pill.good { background: rgba(52, 211, 153, 0.14); color: var(--rt-success); border-color: rgba(52, 211, 153, 0.30); }
.pill.warn { background: rgba(251, 191, 36, 0.14); color: var(--rt-warning); border-color: rgba(251, 191, 36, 0.30); }
.pill.danger { background: rgba(251, 113, 133, 0.14); color: var(--rt-danger); border-color: rgba(251, 113, 133, 0.30); }

/* Entity state pills (HA) */
.state-pill { background: rgba(255,255,255,0.04); border-color: rgba(255,255,255,0.07); }
.state-on { background: rgba(52, 211, 153, 0.14); color: var(--rt-success); border-color: rgba(52, 211, 153, 0.30); }

/* Codebox / pre */
.codebox { background: #050310; color: #C084FC; border: 1px solid rgba(168, 85, 247, 0.18); }

/* Form fields polish */
.field label { color: var(--rt-fg-muted); }
.check { background: rgba(255,255,255,0.03); border-color: rgba(255,255,255,0.07); }
.check:hover { border-color: rgba(168, 85, 247, 0.35); }
.help-text { color: var(--rt-fg-muted); }

/* Empty states */
.empty { color: var(--rt-fg-muted); }
.muted, .subtle { color: var(--rt-fg-muted); }


/* ============================================================================
   READABILITY PASS — larger base sizes, better muted contrast on dark bg
============================================================================ */

/* Bump body up from 14 → 15px, more comfortable line-height */
html, body { font-size: 15px; line-height: 1.55; }

/* Strengthen muted text contrast — was too faint on dark surfaces */
body.rt {
  --rt-fg-muted: #B0A6CC;   /* was #8E83AE — much higher contrast */
}

/* Card meta / sub / hints / placeholders — all bumped */
.card__sub,
.page-head__sub,
.app-brand__meta,
.help-text,
.hint,
.muted,
.subtle,
.empty {
  font-size: 13px;
  line-height: 1.5;
}

/* Card / panel titles — bigger and bolder */
.card__title { font-size: 18px; font-weight: 600; }
.panel-h { font-size: 15px; padding: 16px 20px; }
.page-head__title { font-size: 34px; }

/* Today task title — was 13px, now 14px and a touch bolder */
.today-task__title { font-size: 14px; line-height: 1.4; }
.today-list--compact .today-task__title { font-size: 14px !important; line-height: 1.35 !important; }

/* Chat messages — larger, more comfortable */
.msg { font-size: 15px; line-height: 1.5; max-width: 80%; padding: 14px 16px; }
.msg-h { font-size: 11px; letter-spacing: 0.05em; }

/* Inputs / composer — larger comfortable text */
input:not([type="checkbox"]):not([type="radio"]):not([type="file"]),
select, textarea {
  font-size: 15px;
  padding: 11px 14px;
}
.composer textarea { font-size: 15px; min-height: 64px; }
.search__input { font-size: 15px; height: 46px; padding: 0 56px 0 46px !important; }

/* Buttons — slightly larger */
.btn { padding: 11px 16px; font-size: 14px; }
.btn-sm { padding: 7px 12px; font-size: 13px; }
.btn-lite { font-size: 14px; padding: 10px 14px; }

/* Tables — larger row text */
.data-table th, table th { font-size: 12px; padding: 12px 16px; }
.data-table td, table td { font-size: 14px; padding: 14px 16px; }

/* Context tree — larger names */
.context-node__name { font-size: 15px; }
.context-node.level-2 .context-node__name { font-size: 17px !important; }
.context-node.level-3 .context-node__name,
.context-node.level-4 .context-node__name { font-size: 14px !important; }
.context-tree__lane-label { font-size: 12px; }

/* Quick-card content */
.quick-card__input { font-size: 15px; }
.quick-recent__item { font-size: 14px; padding: 12px 14px; }
.quick-recent__meta { font-size: 11px; }

/* Notebook */
.note-card__body { font-size: 14px; line-height: 1.5; }
.list-card__name { font-size: 15px; }
.checklist__item { font-size: 14px; }
.mini-item { font-size: 14px; padding: 14px 16px; }

/* Tabs / nav */
.tab { font-size: 15px; padding: 16px 18px 14px; }
.app-brand__name { font-size: 22px; font-weight: 700; }
.app-brand__meta { font-size: 13px; }

/* Chips — was tiny, now readable */
.chip { font-size: 12px; padding: 3px 10px; }
.chip--soft { font-size: 12px; }

/* kbd / search shortcut */
kbd, .kbd, .search__kbd { font-size: 12px; padding: 3px 8px; }

/* Page-head hint */
.page-head__hint { font-size: 13px; }

/* Admin */
.admin-rail__tab { font-size: 14px; padding: 12px 14px !important; }
.settings-tab { font-size: 14px; padding: 9px 16px; }
.admin-panel__head h2 { font-size: 26px; }

/* Status line — bigger */
.statusline { font-size: 13px; }

/* Form labels */
.field label { font-size: 14px; font-weight: 500; }
.check { font-size: 14px; padding: 11px 14px; }

/* Eyebrow — keep small but with more contrast */
.rt-eyebrow { font-size: 12px; color: var(--rt-purple-700); }

/* Make placeholder text more readable on dark bg */
input::placeholder, textarea::placeholder {
  color: #8B82A6;
  opacity: 1;
}
