/* ── Reset & Variables ─────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --primary:       #2563eb;
  --primary-light: #eff6ff;
  --primary-hover: #1d4ed8;
  --sidebar-w:     220px;
  --sidebar-sm:    60px;
  --topbar-h:      56px;
  --bg:            #f0f2f5;
  --white:         #ffffff;
  --border:        #e5e7eb;
  --text:          #111827;
  --muted:         #6b7280;
  --radius:        10px;
  --shadow:        0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.05);
  --shadow-md:     0 4px 16px rgba(0,0,0,.10);
  --tr:            .22s ease;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  font-size: 14px;
}

a { text-decoration: none; }

/* ── Auth ──────────────────────────────────────────────────── */
.auth-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--ws-accent-soft,#e8eeff) 0%, #f5f7ff 60%, #fafbff 100%);
}

.auth-page-image {
  background: var(--ws-soft,#f8fafc);
  padding: 24px;
  position: relative;
  overflow: hidden;
}

.auth-page-image::before,
.auth-page-image::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
}

.auth-page-image::before {
  z-index: 0;
  background: url("assets/landing/hero-private-home-saas-v2.png") center / cover no-repeat;
  filter: saturate(.92) brightness(1.04);
  transform: scale(1.02);
}

.auth-login-page::before {
  background-image: url("assets/landing/enter.png");
}

.auth-page-image::after {
  z-index: 0;
  background:
    radial-gradient(circle at 50% 50%, rgba(255,255,255,.58), rgba(255,255,255,.78)),
    rgba(255,255,255,.34);
  backdrop-filter: blur(1.5px);
}

.auth-card {
  background: var(--white);
  border-radius: 16px;
  box-shadow: 0 8px 40px rgba(37,99,235,.12);
  padding: 40px;
  width: 100%;
  max-width: 420px;
}

.auth-page-image .auth-card {
  position: relative;
  z-index: 1;
  border: 1px solid rgba(226,232,240,.84);
  background: rgba(255,255,255,.9);
  box-shadow: 0 24px 70px rgba(15,23,42,.18);
  backdrop-filter: blur(16px);
}

.register-auth-shell {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: minmax(360px, 420px) minmax(480px, 650px);
  gap: 24px;
  width: min(1120px, 100%);
  align-items: stretch;
}
.auth-page-image .register-auth-card {
  max-width: none;
  padding: 32px 36px;
}
.register-auth-card .auth-logo { margin-bottom: 22px; }
.register-auth-card .auth-subtitle { margin-bottom: 22px; }
.register-auth-card .form-group { margin-bottom: 14px; }
.register-demo-optout {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin: 2px 0 14px;
  padding: 11px 12px;
  border: 1px solid var(--ws-accent-line,#dbe5f2);
  border-radius: 10px;
  background: rgba(248,250,252,.86);
  color: var(--ws-text,#334155);
  cursor: pointer;
}
.register-demo-optout input {
  width: 17px;
  height: 17px;
  margin-top: 2px;
  flex: 0 0 auto;
  accent-color: var(--primary);
}
.register-demo-optout span { display: grid; gap: 2px; }
.register-demo-optout strong { font-size: 12.5px; line-height: 1.3; }
.register-demo-optout small { color: var(--ws-muted,#64748b); font-size: 10.5px; line-height: 1.35; }

.register-demo-panel {
  min-width: 0;
  padding: 34px 38px;
  border: 1px solid rgba(203,213,225,.88);
  border-radius: 18px;
  background: rgba(248,251,255,.92);
  box-shadow: 0 24px 70px rgba(15,23,42,.16);
  backdrop-filter: blur(18px);
  color: var(--ws-ink,#0f172a);
}
.register-demo-kicker {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 9px;
  color: var(--ws-accent,#2563eb);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .06em;
  text-transform: uppercase;
}
.register-demo-kicker span {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #22c55e;
  box-shadow: 0 0 0 4px rgba(34,197,94,.12);
}
.register-demo-panel h2 {
  margin: 0 0 8px;
  max-width: 570px;
  font-size: clamp(22px, 2vw, 30px);
  line-height: 1.14;
  letter-spacing: -.025em;
}
.register-demo-lead {
  margin: 0 0 18px;
  max-width: 585px;
  color: var(--ws-muted,#536176);
  font-size: 13px;
  line-height: 1.55;
}
.register-demo-lead strong { color: var(--ws-accent-hover,#1e3a8a); }
.register-demo-project-card {
  margin-bottom: 18px;
  padding: 16px;
  border: 1px solid var(--ws-accent-line,#cfe0f7);
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 8px 22px rgba(37,99,235,.07);
}
.register-demo-project-top {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr) auto;
  gap: 11px;
  align-items: center;
}
.register-demo-house-icon {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border: 1px solid rgba(236,205,121,.36);
  border-radius: 10px;
  background: linear-gradient(145deg, var(--ws-ink,#090b0f), var(--ws-ink,#20242b));
  color: #e1bb5d;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.08), 0 7px 16px rgba(9,11,15,.18);
}
.register-demo-house-icon svg {
  width: 25px;
  height: 25px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.register-demo-project-top strong { display: block; font-size: 13.5px; line-height: 1.3; }
.register-demo-project-top small { display: block; margin-top: 2px; color: var(--ws-muted,#64748b); font-size: 10.5px; }
.register-demo-status {
  padding: 5px 9px;
  border: 1px solid #bbf7d0;
  border-radius: 999px;
  background: #f0fdf4;
  color: #15803d;
  font-size: 10px;
  font-weight: 800;
  white-space: nowrap;
}
.register-demo-progress {
  height: 6px;
  margin: 13px 0 10px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--ws-accent-soft,#e8eef7);
}
.register-demo-progress span { display: block; width: 48%; height: 100%; border-radius: inherit; background: linear-gradient(90deg,var(--ws-accent,#2563eb),var(--ws-accent-line,#60a5fa)); }
.register-demo-stats { display: flex; gap: 18px; color: var(--ws-muted,#64748b); font-size: 10.5px; }
.register-demo-stats b { color: var(--ws-accent-hover,#1e3a8a); font-size: 12px; }
.register-demo-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 9px 16px;
}
.register-demo-grid > div { display: flex; align-items: flex-start; gap: 9px; min-width: 0; }
.register-demo-check {
  display: grid;
  place-items: center;
  width: 21px;
  height: 21px;
  flex: 0 0 auto;
  margin-top: 1px;
  border-radius: 7px;
  background: #eafaf0;
  color: #16a34a;
  font-size: 12px;
  font-weight: 900;
}
.register-demo-grid p { margin: 0; min-width: 0; }
.register-demo-grid strong { display: block; margin-bottom: 1px; font-size: 11.5px; line-height: 1.35; }
.register-demo-grid small { display: block; color: var(--ws-muted,#64748b); font-size: 9.8px; line-height: 1.4; }
.register-demo-note {
  margin: 17px 0 0;
  padding-top: 12px;
  border-top: 1px solid var(--ws-line,#e2e8f0);
  color: var(--ws-muted,#64748b);
  font-size: 10.5px;
  line-height: 1.45;
}
.register-demo-optout-panel {
  max-width: 380px;
  margin: 16px 0 0;
  border-color: var(--ws-accent-line,#cfe0f7);
  background: #fff;
  box-shadow: 0 6px 18px rgba(37,99,235,.06);
}

@media (max-width: 980px) {
  .auth-page-image { overflow: auto; align-items: flex-start; }
  .register-auth-shell { grid-template-columns: minmax(0, 620px); justify-content: center; }
  .register-demo-panel { padding: 26px 28px; }
  .register-demo-panel h2 { font-size: 24px; }
}
@media (max-width: 620px) {
  .auth-page-image { padding: 12px; }
  .auth-page-image .register-auth-card, .register-demo-panel { padding: 24px 20px; border-radius: 14px; }
  .register-demo-grid { grid-template-columns: 1fr; }
  .register-demo-stats { justify-content: space-between; gap: 8px; }
}

.auth-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 32px;
}

.auth-logo-icon {
  width: 38px;
  height: 38px;
  background: var(--primary);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 800;
  font-size: 18px;
  letter-spacing: -1px;
}

.auth-logo-text { font-size: 18px; font-weight: 700; color: var(--text); }

.auth-title    { font-size: 22px; font-weight: 700; margin-bottom: 4px; }
.auth-subtitle { color: var(--muted); font-size: 13px; margin-bottom: 28px; }

/* Forms */
.form-group   { margin-bottom: 18px; }
.form-label   { display: block; font-size: 13px; font-weight: 500; color: var(--ws-text,#374151); margin-bottom: 6px; }

.form-control {
  width: 100%;
  padding: 10px 14px;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  font-size: 14px;
  outline: none;
  transition: border-color var(--tr), box-shadow var(--tr);
  background: var(--white);
  color: var(--text);
}
.form-control:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37,99,235,.12);
}
.form-control::placeholder { color: var(--ws-subtle,#9ca3af); }

.form-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

.form-check {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 13px;
  color: var(--ws-text,#374151);
  cursor: pointer;
}
.form-check input { width: 15px; height: 15px; accent-color: var(--primary); cursor: pointer; }

.form-link { font-size: 13px; color: var(--primary); font-weight: 500; }
.form-link:hover { text-decoration: underline; }

.form-footer { text-align: center; margin-top: 22px; font-size: 13px; color: var(--muted); }
.form-footer a { color: var(--primary); font-weight: 500; }
.auth-reset-form {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}
.auth-legal {
  margin-top: 12px;
  color: var(--ws-muted,#6b7280);
  font-size: 12px;
  line-height: 1.45;
  text-align: center;
}
.auth-legal a {
  color: var(--primary);
  font-weight: 600;
}
.auth-legal a:hover { text-decoration: underline; }
.captcha-group {
  min-height: 100px;
  overflow: hidden;
}
.captcha-group .smart-captcha {
  max-width: 100%;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 20px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  border: none;
  cursor: pointer;
  transition: all var(--tr);
  text-decoration: none;
  line-height: 1;
}
.btn-primary  { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-hover); }
.btn-outline  { background: transparent; border: 1.5px solid var(--border); color: var(--text); }
.btn-outline:hover { background: var(--ws-soft,#f9fafb); }
.btn-danger   { background: #dc2626; color: #fff; }
.btn-danger:hover { background: #b91c1c; }
.btn-sm       { padding: 7px 14px; font-size: 13px; }
.btn-full     { width: 100%; justify-content: center; }
.btn:disabled { opacity:.55; cursor:not-allowed; }

/* Alerts */
.alert {
  padding: 11px 16px;
  border-radius: 8px;
  font-size: 13px;
  margin-bottom: 16px;
}
.alert-error   { background: #fef2f2; color: #dc2626; border: 1px solid #fecaca; }
.alert-success { background: #f0fdf4; color: #16a34a; border: 1px solid #bbf7d0; }

/* ── App layout ────────────────────────────────────────────── */
.app-wrap { display: flex; height: 100vh; overflow: hidden; }

/* Sidebar */
.sidebar {
  width: var(--sidebar-w);
  min-width: var(--sidebar-w);
  background: var(--white);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: relative;
  z-index: 100;
  transition: width var(--tr), min-width var(--tr);
  overflow: hidden;
}
/* Без анимации при первичной загрузке — только по клику пользователя */
.sidebar:not(.ready) { transition: none !important; }
.sidebar:not(.ready) * { transition: none !important; }
.sidebar.collapsed { width: var(--sidebar-sm); min-width: var(--sidebar-sm); }

/* Logo — не изменяется при collapse */
.sidebar-logo {
  display: flex;
  align-items: center;
  justify-content: center;
  height: var(--topbar-h);
  padding: 0 12px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  overflow: hidden;
}
/* Логотип остаётся без изменений при свёрнутом сайдбаре */
.sidebar.collapsed .sidebar-logo { padding: 0 6px; }
.sidebar-logo-img {
  max-height: 28px;
  max-width: 120px;
  width: 100%;
  object-fit: contain;
}
.sidebar-logo-mini { display: none; }
.sidebar.collapsed .sidebar-logo-full { display: none; }
.sidebar.collapsed .sidebar-logo-mini { display: block; max-width: 32px; }

/* Sidebar: current company */
.sidebar-company {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  text-decoration: none;
  color: inherit;
  flex-shrink: 0;
  transition: background .15s;
}
.sidebar-company:hover { background: var(--hover, rgba(0,0,0,.04)); }
.sidebar-company-logo {
  width: 30px;
  height: 30px;
  min-width: 30px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--ws-soft,#f8fafc);
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  font-size: 13px;
  font-weight: 800;
}
.sidebar-company-logo img { width: 100%; height: 100%; object-fit: contain; background: #fff; }
.sidebar-company-info { flex: 1; min-width: 0; }
.sidebar-company-name {
  font-weight: 600;
  font-size: 13px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.sidebar-company-meta {
  font-size: 11px;
  color: var(--muted);
  margin-top: 2px;
}
.sidebar-company-meta.is-expired { color: #ef4444; }
.sidebar-company-arrow { color: var(--muted); flex-shrink: 0; }
.sidebar.collapsed .sidebar-company-info,
.sidebar.collapsed .sidebar-company-arrow { display: none; }
.sidebar.collapsed .sidebar-company {
  justify-content: center;
  padding: 10px 0;
}

/* Nav */
.sidebar-nav { flex: 1; overflow-y: auto; overflow-x: hidden; padding: 8px 0; }
.sidebar.collapsed .sidebar-nav { overflow-x: visible; }
.sidebar-nav::-webkit-scrollbar { display: none; }

.nav-section-label {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--ws-subtle,#9ca3af);
  padding: 12px 16px 4px;
  white-space: nowrap;
  transition: opacity var(--tr);
}
.sidebar.collapsed .nav-section-label { opacity: 0; }

.nav-item {
  display: flex;
  align-items: center;
  gap: 11px;
  height: 38px;
  padding: 0 10px;
  margin: 1px 8px;
  border-radius: 8px;
  cursor: pointer;
  color: var(--ws-text,#374151);
  font-size: 13.5px;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-decoration: none;
  transition: background var(--tr), color var(--tr);
}
.nav-item:hover { background: var(--ws-canvas,#f3f4f6); color: var(--text); }
.nav-item.active { background: var(--primary-light); color: var(--primary); }
.nav-item.active .nav-icon svg { color: var(--primary); }

.nav-icon {
  width: 20px;
  height: 20px;
  min-width: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--ws-muted,#6b7280);
}
.nav-item.active .nav-icon { color: var(--primary); }
.nav-item:hover .nav-icon  { color: var(--text); }

.nav-label {
  transition: opacity var(--tr), max-width var(--tr);
  max-width: 160px;
  overflow: hidden;
  white-space: nowrap;
  flex-shrink: 0;
}
.sidebar.collapsed .nav-label { display: none; }
.sidebar.collapsed .nav-item {
  justify-content: center;
  gap: 0;
  padding: 0;
  margin: 1px 8px;
  overflow: visible;
}
.sidebar.collapsed .sidebar-user {
  justify-content: center;
  gap: 0;
  padding: 7px 0;
}

/* Sidebar collapse button — расположен в topbar */
.sidebar-collapse-btn {
  width: 34px;
  height: 34px;
  min-width: 34px;
  border: none;
  background: transparent;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--muted);
  transition: background var(--tr), color var(--tr), transform var(--tr);
  flex-shrink: 0;
}
.sidebar-collapse-btn:hover { background: var(--ws-canvas,#f3f4f6); color: var(--text); }
/* Вращаем иконку бургера когда сайдбар свёрнут */
.sidebar.collapsed ~ .main-area .sidebar-collapse-btn { transform: rotate(90deg); }

/* Тултипы для иконок в свёрнутом сайдбаре */
.sidebar.collapsed .nav-item {
  position: relative;
}
.sidebar.collapsed .nav-item[data-tip]::after {
  content: attr(data-tip);
  position: absolute;
  left: calc(100% + 10px);
  top: 50%;
  transform: translateY(-50%);
  background: var(--ws-ink,#1f2937);
  color: #fff;
  font-size: 12px;
  font-weight: 500;
  padding: 4px 10px;
  border-radius: 6px;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: opacity .15s;
  z-index: 300;
  box-shadow: 0 2px 8px rgba(0,0,0,.18);
}
.sidebar.collapsed .nav-item[data-tip]:hover::after {
  opacity: 1;
}

/* Footer */
.sidebar-footer {
  border-top: 1px solid var(--border);
  padding: 8px 0 6px;
  flex-shrink: 0;
  overflow: hidden;
}

.sidebar-user {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 7px 14px;
  margin: 0 8px;
  border-radius: 8px;
  cursor: pointer;
  overflow: hidden;
  white-space: nowrap;
  transition: background var(--tr);
  text-decoration: none;
  color: var(--text);
}
.sidebar-user:hover { background: var(--ws-canvas,#f3f4f6); }
.sidebar-user-static { cursor: default; }
.sidebar-user-static:hover { background: transparent; }

.sidebar-avatar {
  width: 30px;
  height: 30px;
  min-width: 30px;
  box-sizing: border-box;
  border: 2px solid var(--ws-accent-line,#d8e2f0);
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 600;
  overflow: hidden;
}
.sidebar-avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }

.sidebar-user-info { overflow: hidden; }
.sidebar-user-name { font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-user-role { font-size: 11px; color: var(--muted); }
.sidebar.collapsed .sidebar-user-info { display: none; }

/* Main area */
.main-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-width: 0;
}

/* Top bar */
.topbar {
  height: var(--topbar-h);
  background: var(--white);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 24px;
  gap: 10px;
  flex-shrink: 0;
  z-index: 50;
}
.topbar.has-widget-menu-open { z-index: 6100; }
.topbar-title { font-size: 20px; font-weight: 700; flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar-actions { display: flex; align-items: center; gap: 6px; }
.topbar-notification-btn {
  position: relative;
  width: 34px;
  height: 34px;
  min-width: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--ws-line,#dbe4ef);
  border-radius: 8px;
  background: #fff;
  color: var(--ws-text,#475569);
  cursor: pointer;
  transition: background .15s ease, border-color .15s ease, color .15s ease;
}
.topbar-notification-btn:hover,
.topbar-notification-btn.has-unread {
  border-color: var(--ws-accent-line,#bfdbfe);
  background: var(--ws-accent-soft,#eff6ff);
  color: var(--ws-accent-hover,#1d4ed8);
}
.topbar-notification-btn:focus-visible { outline: 2px solid rgba(37,99,235,.28); outline-offset: 2px; }
.topbar-notification-btn svg { width: 18px; height: 18px; pointer-events: none; }
/* Атрибут hidden должен побеждать display из базового правила: иначе в режиме
   «чат снизу» остаётся видимым лишний колокольчик уведомлений (два входа
   показывали одно и то же). */
.topbar-notification-btn[hidden] { display: none; }
/* Бадж-счётчик: в него пишется число непрочитанных, поэтому это не «точка»
   7×7, а пилюля минимум 18×18 с центрированной цифрой. Раньше размеры
   числового баджа задавались только классом `.is-chat-count` (его получала
   лишь кнопка чата), и у колокольчика уведомлений цифра вылезала за кружок. */
.topbar-notification-dot {
  position: absolute;
  top: -4px;
  right: -5px;
  min-width: 18px;
  width: auto;
  height: 18px;
  padding: 0 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  border: 2px solid #fff;
  border-radius: 9px;
  background: #dc2626;
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  line-height: 1;
  box-shadow: 0 0 0 1px rgba(239,68,68,.16);
}
.topbar-notification-dot[hidden] { display: none; }
.topbar-notification-dot:empty { display: none; }
.icon-btn {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  border: none;
  background: transparent;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  transition: background var(--tr), color var(--tr);
}
.icon-btn:hover { background: var(--ws-canvas,#f3f4f6); color: var(--text); }
.topbar-help-btn {
  height: 34px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 0 11px;
  border: 1px solid var(--ws-line,#dbe4ef);
  border-radius: 8px;
  background: #fff;
  color: var(--ws-text,#334155);
  font: 700 13px/1 inherit;
  cursor: pointer;
  white-space: nowrap;
  transition: background var(--tr), border-color var(--tr), color var(--tr);
}
.topbar-help-btn:hover {
  background: var(--ws-soft,#f8fafc);
  border-color: var(--ws-line-strong,#b9c7d8);
  color: var(--ws-ink,#0f172a);
}
.topbar-help-btn svg {
  width: 17px;
  height: 17px;
  flex-shrink: 0;
  color: var(--ws-accent,#2563eb);
}

.admin-impersonation-banner {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 10px 24px;
  border-bottom: 1px solid #fed7aa;
  background: #fff7ed;
  color: #7c2d12;
  font-size: 13px;
}
.admin-impersonation-banner div {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 9px;
  flex-wrap: wrap;
}
.admin-impersonation-banner strong {
  font-weight: 800;
}
.admin-impersonation-banner span {
  overflow-wrap: anywhere;
}
.admin-impersonation-banner form {
  flex-shrink: 0;
  margin: 0;
}
.admin-impersonation-banner a,
.admin-impersonation-return {
  flex-shrink: 0;
  color: #9a3412;
  font: inherit;
  font-weight: 800;
  text-decoration: none;
  border: 1px solid #fdba74;
  background: #fff;
  border-radius: 8px;
  padding: 7px 10px;
  cursor: pointer;
}
.admin-impersonation-banner a:hover,
.admin-impersonation-return:hover {
  background: #ffedd5;
}
@media (max-width: 640px) {
  .admin-impersonation-banner {
    align-items: stretch;
    flex-direction: column;
    padding: 10px 16px;
  }
  .admin-impersonation-banner a,
  .admin-impersonation-return {
    width: 100%;
    text-align: center;
  }
}

/* Page content */
.page-content {
  position: relative;
  flex: 1;
  overflow-y: auto;
  padding: 22px 24px;
  margin-bottom: 44px;
}

/* Local loading feedback. The sidebar and topbar always stay interactive. */
.portal-loading-region { position: relative !important; }
.portal-loading-region.portal-area-loading { cursor: progress; }
.portal-loading-region.portal-area-loading > :not(.portal-area-loader) {
  opacity: .48;
  transition: opacity .16s ease;
  pointer-events: none;
  user-select: none;
}
.portal-area-loader {
  position: absolute;
  inset: 0;
  z-index: 8900;
  display: block;
  overflow: hidden;
  background: rgba(248, 250, 252, .34);
  pointer-events: auto;
}
.portal-area-loader-card {
  position: absolute;
  top: var(--portal-loader-top, 50%);
  left: 50%;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  max-width: min(360px, calc(100% - 32px));
  padding: 12px 16px;
  border: 1px solid var(--ws-line,#dbe4ef);
  border-radius: 10px;
  background: #fff;
  color: var(--ws-text,#475569);
  box-shadow: 0 12px 30px rgba(15, 23, 42, .14);
  transform: translate(-50%, -50%);
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
}
.portal-area-loader-spinner,
.portal-action-loading::before {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
  box-sizing: border-box;
  border: 2.5px solid var(--ws-accent-line,#d8e2f0);
  border-top-color: var(--ws-accent,#1565c0);
  border-radius: 50%;
  animation: portal-area-spin .72s linear infinite;
}
.portal-action-loading {
  pointer-events: none !important;
  cursor: wait !important;
  opacity: .78;
}
.portal-action-loading::before {
  content: "";
  display: inline-block;
}
@keyframes portal-area-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) {
  .portal-loading-region.portal-area-loading > :not(.portal-area-loader) { transition: none; }
  .portal-area-loader-spinner,.portal-action-loading::before { animation-duration: 1.4s; }
}

/* ── Projects page ──────────────────────────────────────────── */
.projects-page {
  min-height: 100%;
  display: flex;
  flex-direction: column;
}
.projects-page #project-registry-results {
  min-height: 0;
  display: flex;
  flex: 1;
  flex-direction: column;
}
.projects-page #project-registry-results > .app-pager {
  margin-top: auto;
}

.page-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.filter-chip {
  display: inline-flex;
  align-items: center;
  padding: 5px 12px;
  border: 1px solid var(--border);
  border-radius: 20px;
  background: var(--white);
  color: var(--ws-text,#374151);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: background .18s, border-color .18s, color .18s;
}
.filter-chip:hover,
.filter-chip.active {
  border-color: var(--primary);
  background: var(--primary);
  color: #fff;
}

.project-search-submit {
  all: unset;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}
.project-search-submit:focus-visible {
  border-radius: 3px;
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

.filter-dropdown-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 7px 12px;
  background: var(--white);
  border: 1.5px solid var(--border);
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  color: var(--ws-text,#374151);
  cursor: pointer;
  white-space: nowrap;
  transition: background var(--tr);
}
.filter-dropdown-btn:hover { background: var(--ws-soft,#f9fafb); }
.filter-dropdown-btn .badge {
  background: var(--primary);
  color: #fff;
  border-radius: 20px;
  font-size: 11px;
  padding: 1px 6px;
  margin-left: 2px;
}

.search-box {
  display: flex;
  align-items: center;
  gap: 7px;
  background: var(--white);
  border: 1.5px solid var(--border);
  border-radius: 8px;
  padding: 7px 12px;
  min-width: 220px;
  max-width: 300px;
}
.search-box input {
  border: none;
  outline: none;
  font-size: 13px;
  background: transparent;
  width: 100%;
  color: var(--text);
}
.search-box input::placeholder { color: var(--ws-subtle,#9ca3af); }
.search-box svg { color: var(--muted); flex-shrink: 0; }

.spacer { flex: 1; }

.view-toggle {
  display: flex;
  align-items: center;
  background: var(--white);
  border: 1.5px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
}
.view-btn {
  width: 34px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--muted);
  transition: background var(--tr), color var(--tr);
  border: none;
  background: transparent;
}
.view-btn.active { background: var(--primary-light); color: var(--primary); }
.view-btn:hover:not(.active) { background: var(--ws-canvas,#f3f4f6); color: var(--text); }
.view-btn + .view-btn { border-left: 1.5px solid var(--border); }

/* Breadcrumb */
.breadcrumb {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 16px;
}
.breadcrumb a { color: var(--primary); }
.breadcrumb a:hover { text-decoration: underline; }
.bc-sep { color: var(--ws-line-strong,#d1d5db); margin: 0 2px; }

/* Section label */
.section-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--muted);
  margin: 0 0 10px;
}

/* Folder cards grid */
.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 12px;
  margin-bottom: 26px;
}

.folder-card {
  height: 112px;
  min-height: 112px;
  background: var(--white);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  overflow: hidden;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  transition: box-shadow var(--tr), transform var(--tr);
  position: relative;
}
.folder-card:hover { box-shadow: var(--shadow-md); transform: translateY(-1px); }

.card-strip { height: 3px; width: 100%; }
.folder-card-body { padding: 12px 14px 14px; display: flex; flex-direction: column; flex: 1; min-height: 0; }

.folder-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 4px;
  margin-bottom: 4px;
  min-width: 0;
}
.folder-card-name { font-size: 13.5px; font-weight: 600; color: var(--text); flex: 1; min-width: 0; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; line-clamp: 3; }
.folder-card-count { font-size: 11px; color: var(--muted); margin-top: auto; }

.folder-more-btn {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--muted);
  padding: 2px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  flex-shrink: 0;
}
.folder-more-btn:hover { background: var(--ws-canvas,#f3f4f6); color: var(--text); }

/* Add folder card */
.folder-card-add {
  background: transparent;
  border: 1.5px dashed var(--border);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 112px;
  min-height: 80px;
  gap: 6px;
  padding: 14px;
}
.folder-card-add:hover { border-color: var(--primary); background: var(--primary-light); }
.folder-card-add .add-circle {
  position: relative;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--ws-line,#e5e7eb);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  font-size: 0;
  transition: background var(--tr), color var(--tr);
}
.folder-card-add .add-circle::before,
.folder-card-add .add-circle::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 10px;
  height: 1.5px;
  border-radius: 999px;
  background: currentColor;
  transform: translate(-50%, -50%);
}
.folder-card-add .add-circle::after {
  transform: translate(-50%, -50%) rotate(90deg);
}
.folder-card-add:hover .add-circle { background: var(--primary); color: #fff; }
.folder-card-add span { font-size: 11px; color: var(--muted); font-weight: 500; }
.folder-card-add:hover span { color: var(--primary); }

/* Project cards grid */
.projects-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 14px;
  margin-bottom: 20px;
}

.project-card {
  background: var(--white);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  overflow: hidden;
  cursor: pointer;
  transition: box-shadow var(--tr), transform var(--tr);
  display: flex;
  flex-direction: column;
}
.project-card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }
.project-card-body { padding: 16px 18px 14px; flex: 1; }
.project-card-top { display: flex; align-items: flex-start; justify-content: space-between; }
.project-card-top { min-width: 0; }
.project-card-name { font-size: 16px; font-weight: 700; line-height: 1.3; margin-bottom: 8px; min-width: 0; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; line-clamp: 3; }
.project-card-desc { font-size: 12px; color: var(--muted); margin-bottom: 10px; }
.project-card-date { font-size: 12px; color: var(--muted); margin-bottom: 10px; }
.project-card-footer { display: flex; align-items: center; gap: 6px; margin-top: 10px; }

.project-progress { height: 3px; background: var(--ws-line,#e5e7eb); }
.project-progress-fill { height: 100%; border-radius: 0 0 var(--radius) var(--radius); }

/* ── Archived project card ───────────────────────────────── */
.project-card-archived { opacity: .65; filter: grayscale(.4); }
.project-card-archived:hover { opacity: .85; filter: grayscale(.2); }

/* ── Archive section ─────────────────────────────────────── */
.archive-section {
  margin-top: 32px;
}
.archive-section-header {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .06em;
  cursor: pointer;
  user-select: none;
  list-style: none;
  padding: 6px 0;
  border-top: 1px solid var(--border);
}
.archive-section-header::-webkit-details-marker { display: none; }
.archive-section-header:hover { color: var(--text); }
.archive-count {
  background: var(--ws-line,#e5e7eb);
  color: var(--ws-muted,#6b7280);
  font-size: 10px;
  font-weight: 600;
  border-radius: 10px;
  padding: 1px 6px;
  margin-left: 2px;
}
.archive-chevron { margin-left: auto; transition: transform var(--tr); }
details.archive-section[open] .archive-chevron { transform: rotate(180deg); }
.archive-grid { margin-top: 12px; }

/* Add project card */
.project-card-add {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 140px;
  border: 1.5px dashed var(--border);
  background: transparent;
  color: inherit;
  font: inherit;
  cursor: pointer;
  gap: 8px;
  border-radius: var(--radius);
  transition: all var(--tr);
}
.project-card-add:hover { border-color: var(--primary); background: var(--primary-light); }
.project-card-add .add-circle-lg {
  position: relative;
  width: 40px; height: 40px;
  border-radius: 50%;
  background: var(--ws-line,#e5e7eb);
  display: flex; align-items: center; justify-content: center;
  color: var(--muted); font-size: 0;
  transition: background var(--tr), color var(--tr);
}
.project-card-add .add-circle-lg::before,
.project-card-add .add-circle-lg::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 14px;
  height: 2px;
  border-radius: 999px;
  background: currentColor;
  transform: translate(-50%, -50%);
}
.project-card-add .add-circle-lg::after {
  transform: translate(-50%, -50%) rotate(90deg);
}
.project-card-add:hover .add-circle-lg { background: var(--primary); color: #fff; }
.project-card-add span { font-size: 13px; color: var(--muted); font-weight: 500; }
.project-card-add:hover span { color: var(--primary); }

.sort-ghost {
  opacity: .3;
  border: 2px dashed var(--primary, #6366f1) !important;
  background: transparent !important;
}
.folder-card:not(.folder-card-archive):not(.folder-card-add),
.project-card {
  cursor: grab;
}
.folder-card:not(.folder-card-archive):not(.folder-card-add):active,
.project-card:active {
  cursor: grabbing;
}

/* Status badges */
.badge-status {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 500;
}
.badge-active  { background: #dbeafe; color: #1d4ed8; }
.badge-done    { background: #dcfce7; color: #15803d; }
.badge-paused  { background: #ffedd5; color: #c2410c; }
.badge-pending { background: #f3f4f6; color: #6b7280; }
.badge-draft    { background: #f3f4f6; color: #6b7280; }
.badge-planning { background: #e0e7ff; color: #4338ca; }
.badge-archive  { background: #e2e8f0; color: #475569; }

/* ── Modal ──────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.4);
  z-index: 300;
  display: none;
  align-items: center;
  justify-content: center;
}
.modal-overlay.open { display: flex; }

.modal {
  background: var(--white);
  border-radius: 14px;
  padding: 26px 28px;
  width: 100%;
  max-width: 440px;
  box-shadow: 0 10px 50px rgba(0,0,0,.18);
  animation: modalIn .18s ease;
}
@keyframes modalIn { from { transform: translateY(10px); opacity: 0; } to { transform: none; opacity: 1; } }

.modal-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; }
.modal-title  { font-size: 16px; font-weight: 700; }
.modal-close  { width: 28px; height: 28px; border: none; background: none; cursor: pointer; border-radius: 6px; display: flex; align-items: center; justify-content: center; color: var(--muted); }
.modal-close:hover { background: var(--ws-canvas,#f3f4f6); color: var(--text); }

.modal-footer { display: flex; gap: 10px; margin-top: 22px; justify-content: flex-end; }

/* Portal feature modals use the same window controls as project modals. */
.portal-window-dialog {
  position: relative;
  max-height: calc(100vh - 20px);
}
.portal-window-fullscreen-button {
  position: absolute;
  top: 10px;
  right: var(--portal-window-control-right, 50px);
  z-index: 80;
  width: 30px;
  height: 30px;
  padding: 7px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 8px;
  background: #fff;
  color: var(--ws-subtle,#94a3b8);
  cursor: pointer;
}
.portal-window-fullscreen-button:hover { background: var(--ws-canvas,#f1f5f9); color: var(--ws-ink,#1e293b); }
.portal-window-header-actions {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  margin-left: auto;
  flex: 0 0 auto;
}
.portal-window-header-actions > .portal-window-fullscreen-button,
.portal-window-header-actions > .modal-close,
.portal-window-header-actions > .fin-modal-close,
.portal-window-header-actions > .ts-icon-btn {
  position: static !important;
  inset: auto !important;
  width: 32px !important;
  height: 32px !important;
  margin: 0 !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  flex: 0 0 32px;
}
.portal-window-fullscreen-button svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.portal-window-resize-handle {
  position: absolute;
  right: 0;
  bottom: 0;
  z-index: 90;
  width: 24px;
  height: 24px;
  cursor: se-resize;
  touch-action: none;
}
.portal-window-resize-handle::after {
  content: '';
  position: absolute;
  right: 5px;
  bottom: 5px;
  width: 10px;
  height: 10px;
  border-right: 2px solid var(--ws-subtle,#94a3b8);
  border-bottom: 2px solid var(--ws-subtle,#94a3b8);
  border-radius: 1px;
  opacity: .55;
}
.portal-window-resize-handle:hover::after { opacity: 1; }
.portal-window-has-side {
  grid-template-columns: minmax(0, 1fr) var(--portal-modal-side-width, 280px) !important;
}
.portal-window-side-resizer,
.portal-window-dialog > .project-modal-split-resizer {
  position: absolute;
  top: 0;
  right: calc(var(--portal-modal-side-width, 280px) - 7px);
  bottom: 0;
  z-index: 85;
  width: 14px;
  border: 0;
  background: transparent;
  cursor: col-resize;
  touch-action: none;
  outline: none;
}
.portal-window-side-resizer::before,
.portal-window-dialog > .project-modal-split-resizer::before {
  content: '';
  position: absolute;
  inset: 0 auto 0 6px;
  width: 1px;
  background: transparent;
  transition: background-color .15s ease, box-shadow .15s ease;
}
.portal-window-side-resizer::after,
.portal-window-dialog > .project-modal-split-resizer::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 5px;
  width: 3px;
  height: 34px;
  border-radius: 999px;
  background: var(--ws-subtle,#94a3b8);
  box-shadow: 0 0 0 4px rgba(255,255,255,.82);
  opacity: .42;
  transform: translateY(-50%);
  transition: height .15s ease, background-color .15s ease, box-shadow .15s ease, opacity .15s ease;
}
.portal-window-side-resizer:hover::before,
.portal-window-side-resizer:focus-visible::before,
.portal-window-side-resizing > .portal-window-side-resizer::before,
.project-modal-split-resizing > .project-modal-split-resizer::before {
  background: rgba(37,99,235,.32);
  box-shadow: 0 0 10px rgba(37,99,235,.12);
}
.portal-window-side-resizer:hover::after,
.portal-window-side-resizer:focus-visible::after,
.portal-window-side-resizing > .portal-window-side-resizer::after,
.project-modal-split-resizing > .project-modal-split-resizer::after {
  height: 42px;
  background: var(--ws-accent,#2563eb);
  box-shadow: 0 0 0 4px rgba(239,246,255,.92);
  opacity: 1;
}
.portal-window-side-disabled > .portal-window-side-resizer { display: none; }
.portal-window-fullscreen {
  align-items: center !important;
  justify-content: center !important;
  padding: 10px !important;
  overflow: hidden !important;
}
.portal-window-fullscreen > .portal-window-dialog {
  width: calc(100vw - 20px) !important;
  height: calc(100vh - 20px) !important;
  max-width: none !important;
  max-height: none !important;
  border-radius: 10px !important;
}
.portal-window-fullscreen .portal-window-resize-handle,
.portal-window-fullscreen .so-resize-handle,
.portal-window-fullscreen .mps-resize-handle { display: none !important; }
body.portal-window-resizing,
body.portal-window-resizing * { cursor: se-resize !important; user-select: none !important; }
body.portal-window-side-resizing,
body.portal-window-side-resizing * { cursor: col-resize !important; user-select: none !important; }
.ap-modal-card.portal-window-dialog > h2,
.ap-modal-card.portal-window-dialog > .ap-route-toolbar { padding-right: 42px; }
.so-modal.portal-window-dialog .so-head { padding-right: 92px; }
.modal-project-split.portal-window-dialog .mps-head { padding-right: 90px; }
@media (max-width: 760px) {
  .portal-window-resize-handle,
  .portal-window-side-resizer { display: none; }
  .portal-window-has-side { grid-template-columns: 1fr !important; }
}

.project-copy-modal {
  max-width: 540px;
  max-height: calc(100vh - 32px);
  overflow: auto;
}
.copy-options-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 10px;
}
.copy-check-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 12px;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
  color: var(--text);
  background: var(--white);
  transition: border-color var(--tr), background var(--tr);
}
.copy-check-row:hover {
  border-color: var(--ws-line-strong,#cbd5e1);
  background: var(--ws-soft,#f8fafc);
}
.copy-check-row-all { margin-bottom: 10px; }
.copy-check-row input {
  width: 16px;
  height: 16px;
  margin-top: 2px;
  flex-shrink: 0;
  accent-color: var(--primary);
}
.copy-check-row strong {
  display: block;
  font-size: 13px;
  line-height: 1.25;
  font-weight: 600;
}
.copy-check-row small {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.25;
}
.copy-empty-note {
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}
@media (max-width: 640px) {
  .project-copy-modal { max-width: calc(100vw - 24px); }
  .copy-options-grid { grid-template-columns: 1fr; }
}

/* Color picker */
.color-picker { display: flex; gap: 8px; flex-wrap: wrap; }
.color-dot {
  width: 22px; height: 22px;
  border-radius: 50%;
  cursor: pointer;
  border: 2px solid transparent;
  transition: transform var(--tr), border-color var(--tr);
}
.color-dot:hover { transform: scale(1.15); }
.color-dot.selected { border-color: var(--ws-text,#374151); transform: scale(1.15); }

/* Icon picker */
.icon-picker { display: flex; gap: 6px; flex-wrap: wrap; }
.icon-dot {
  width: 32px; height: 32px;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 18px; line-height: 1;
  border-radius: 8px;
  cursor: pointer;
  background: var(--ws-canvas,#f3f4f6);
  border: 2px solid transparent;
  transition: transform var(--tr), border-color var(--tr), background var(--tr);
  user-select: none;
}
.icon-dot:hover { transform: scale(1.1); background: var(--ws-line,#e5e7eb); }
.icon-dot.selected { border-color: var(--ws-text,#374151); background: #fff; }

/* Folder card icon */
.folder-card-icon { font-size: 16px; line-height: 1; flex-shrink: 0; }

/* Dropdown context menu */
.ctx-menu {
  position: fixed;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 6px 24px rgba(0,0,0,.12);
  min-width: 160px;
  z-index: 400;
  display: none;
  overflow: hidden;
}
.ctx-menu.open { display: block; }
.ctx-item {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 9px 14px;
  font-size: 13px;
  cursor: pointer;
  color: var(--text);
  transition: background var(--tr);
}
.ctx-item:hover { background: var(--ws-canvas,#f3f4f6); }
.ctx-item.danger { color: #dc2626; }
.ctx-item.danger:hover { background: #fef2f2; }

/* ── Stub pages ─────────────────────────────────────────────── */
.stub-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 60vh;
  text-align: center;
  color: var(--muted);
  gap: 14px;
}
.stub-wrap h2 { font-size: 22px; font-weight: 700; color: var(--text); }
.stub-wrap p  { font-size: 14px; max-width: 340px; }
.stub-icon    { font-size: 56px; opacity: .3; display:inline-flex; align-items:center; justify-content:center; }
.stub-icon [data-lucide],
.stub-icon svg.lucide { width: 64px; height: 64px; stroke-width: 1.5; }

/* ── Lucide icons ────────────────────────────────────────────── */
[data-lucide],
svg.lucide {
  width: 1em;
  height: 1em;
  stroke-width: 2;
  vertical-align: -0.15em;
  flex-shrink: 0;
}
.icon-sm svg.lucide, .icon-sm[data-lucide] { width: 14px; height: 14px; }
.icon-md svg.lucide, .icon-md[data-lucide] { width: 18px; height: 18px; }
.icon-lg svg.lucide, .icon-lg[data-lucide] { width: 24px; height: 24px; }
.icon-xl svg.lucide, .icon-xl[data-lucide] { width: 48px; height: 48px; }

/* ── Tooltip ─────────────────────────────────────────────────── */
[data-tip] {
  position: relative;
}
[data-tip]::after {
  content: attr(data-tip);
  position: absolute;
  left: 110%;
  top: 50%;
  transform: translateY(-50%);
  background: var(--ws-ink,#1f2937);
  color: #fff;
  font-size: 12px;
  white-space: nowrap;
  padding: 5px 10px;
  border-radius: 6px;
  opacity: 0;
  pointer-events: none;
  transition: opacity .15s;
  z-index: 500;
}
.sidebar.collapsed [data-tip]:hover::after { opacity: 1; }

/* ── Scrollbar ──────────────────────────────────────────────── */
::-webkit-scrollbar       { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--ws-line-strong,#d1d5db); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--ws-subtle,#9ca3af); }

/* ── Responsive ─────────────────────────────────────────────── */
@media (max-width: 768px) {
  .sidebar { position: fixed; top: 0; left: 0; bottom: 0; transform: translateX(-100%); transition: transform var(--tr), width var(--tr); }
  .sidebar.mobile-open { transform: translateX(0); }
  .sidebar.collapsed { width: var(--sidebar-w); }
  .main-area { margin-left: 0 !important; }
  .cards-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
  .projects-grid { grid-template-columns: 1fr 1fr; }
}


/* ===== Generic card + table + badge utilities (companies / billing / members) ===== */

.card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px;
  transition: box-shadow var(--tr), transform var(--tr), border-color var(--tr);
}
.card:hover { box-shadow: var(--shadow-md); }
.card.card-active {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(99,102,241,.15), var(--shadow);
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 500;
  background: #f3f4f6;
  color: #4b5563;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
}
.data-table th,
.data-table td {
  padding: 12px 14px;
  text-align: left;
  font-size: 13px;
  border-bottom: 1px solid var(--border);
}
.data-table th {
  background: var(--ws-soft,#f9fafb);
  font-weight: 600;
  color: var(--ws-text,#374151);
  text-transform: none;
  font-size: 12px;
}
.data-table tbody tr:last-child td { border-bottom: 0; }
.data-table tbody tr:hover { background: var(--ws-soft,#fafbfc); }


/* ===== Companies page ===== */

.companies-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 14px;
}

.company-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  transition: box-shadow var(--tr), border-color var(--tr), transform var(--tr);
}
.company-card:hover { box-shadow: var(--shadow-md); transform: translateY(-1px); }
.company-card-active { border-color: var(--primary); box-shadow: 0 0 0 2px rgba(99,102,241,.12), var(--shadow); }

.company-card-head { display: flex; gap: 14px; align-items: flex-start; }
.company-card-info { flex: 1; min-width: 0; }
.company-card-title {
  font-size: 15px; font-weight: 700; color: var(--text);
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 6px;
  word-break: break-word;
}
.company-card-meta {
  font-size: 12.5px; color: var(--muted); display: flex; gap: 6px; flex-wrap: wrap;
}
.company-card-meta strong { color: var(--text); font-weight: 600; }
.company-card-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: auto; }

.company-logo {
  width: 56px; height: 56px; border-radius: 12px;
  background: linear-gradient(135deg, #eef2ff, var(--ws-accent-soft,#e0e7ff));
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; overflow: hidden;
  font-weight: 700; font-size: 22px; color: var(--primary);
  border: 1px solid var(--border);
}
.company-logo img { width: 100%; height: 100%; object-fit: contain; background: var(--white); }
.company-logo-lg { width: 96px; height: 96px; border-radius: 16px; font-size: 36px; }

/* ===== Large modal + blurred overlay ===== */

.modal-overlay-blur { background: rgba(15, 23, 42, .45); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); }

.modal-lg {
  max-width: 780px;
  width: calc(100% - 32px);
  max-height: calc(100vh - 60px);
  padding: 22px 26px;
  display: flex;
  flex-direction: column;
}
.modal-lg .modal-header { margin-bottom: 14px; }
.modal-lg .modal-title { font-size: 18px; }

/* Tabs */
.tabs {
  display: flex; gap: 4px;
  border-bottom: 1px solid var(--border);
  margin: 0 -26px 18px;
  padding: 0 18px;
  overflow-x: auto;
}
.tab {
  background: none; border: none; cursor: pointer;
  padding: 10px 14px; font-size: 13px; font-weight: 500;
  color: var(--muted); border-bottom: 2px solid transparent;
  white-space: nowrap;
  transition: color var(--tr), border-color var(--tr);
}
.tab:hover { color: var(--text); }
.tab.is-active { color: var(--primary); border-bottom-color: var(--primary); }

.tab-content { flex: 1; min-height: 0; overflow-y: auto; padding-right: 4px; }

/* General tab */
.ce-row { display: flex; gap: 22px; align-items: flex-start; flex-wrap: wrap; }
.ce-logo-block { display: flex; flex-direction: column; gap: 10px; align-items: center; }
.ce-logo-actions { display: flex; flex-direction: column; gap: 6px; align-items: stretch; min-width: 180px; }
.ce-hint { font-size: 11px; color: var(--muted); text-align: center; }
.ce-fields { flex: 1; min-width: 220px; }

/* Legal grid */
.form-grid-2 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px 14px;
}
.form-group-full { grid-column: 1 / -1; }
@media (max-width: 640px) {
  .form-grid-2 { grid-template-columns: 1fr; }
  .form-group-full { grid-column: auto; }
}

/* Bank tab */
.ce-list { display: flex; flex-direction: column; gap: 12px; margin-bottom: 12px; }
.ce-bank-row {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 14px;
  background: var(--ws-soft,#fafbfc);
}
.ce-bank-foot {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; margin-top: 8px;
}
.ce-check { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--text); cursor: pointer; }

/* Categories tab */
.ce-cats { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
@media (max-width: 640px) { .ce-cats { grid-template-columns: 1fr; } }
.ce-cats-col { display: flex; flex-direction: column; gap: 10px; }
.ce-cats-title { font-weight: 600; font-size: 13px; color: var(--text); }
.ce-tags { display: flex; flex-wrap: wrap; gap: 6px; min-height: 36px; }
.ce-tag {
  display: inline-flex; align-items: center; gap: 4px;
  background: var(--ws-canvas,#f3f4f6); border-radius: 14px;
  padding: 4px 4px 4px 10px; font-size: 12.5px; color: var(--text);
}
.ce-tag button {
  width: 20px; height: 20px; border-radius: 50%; border: none; background: transparent;
  cursor: pointer; color: var(--muted); font-size: 16px; line-height: 1;
  display: flex; align-items: center; justify-content: center;
}
.ce-tag button:hover { background: var(--ws-line,#e5e7eb); color: #ef4444; }
.ce-add-row { display: flex; gap: 8px; }
.ce-add-row .form-control { flex: 1; }

.ce-empty { color: var(--muted); font-size: 13px; padding: 8px 4px; }

/* Footer message */
.modal-lg .modal-footer { border-top: 1px solid var(--border); padding-top: 14px; margin-top: 14px; align-items: center; }
.ce-msg { flex: 1; font-size: 12.5px; color: var(--muted); }
.ce-msg-ok  { color: #10b981; }
.ce-msg-err { color: #ef4444; }


/* ===== Auth: wider card + centered tabs ===== */
.auth-card-wide { max-width: 480px; }
.tabs-center {
  justify-content: center;
  margin: 8px -28px 0;
  padding: 0 18px;
}
.tabs-center .tab { text-decoration: none; }

/* ===== Project modal: split layout ===== */

.modal-project-split {
  display: grid;
  grid-template-columns: 1fr 260px;
  max-width: 820px;
  width: calc(100% - 32px);
  height: min(88vh, 720px);
  max-height: calc(100vh - 48px);
  padding: 0;
  overflow: hidden;
  border-radius: 12px;
  align-items: stretch;
  animation: modalIn .18s ease;
  position: relative;
}

/* Left panel */
.mps-left { display: flex; flex-direction: column; min-height: 0; overflow: hidden; border-right: 1px solid var(--border); }
#project-form { display: flex; flex-direction: column; flex: 1; min-height: 0; overflow: hidden; }
.mps-head {
  display: flex; align-items: flex-start;
  padding: 22px 52px 14px 24px; border-bottom: 1px solid var(--border); flex-shrink: 0;
}
.modal-project-split > .modal-close {
  position: absolute; top: 10px; right: 12px; z-index: 10;
  width: 30px; height: 30px; border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  background: transparent; color: var(--ws-subtle,#94a3b8); border: none; cursor: pointer; font-size: 15px;
  transition: background .15s, color .15s;
}
.modal-project-split > .modal-close:hover { background: var(--ws-canvas,#f1f5f9); color: var(--ws-ink,#1e293b); }

/* Resize handle */
.mps-resize-handle {
  position: absolute; bottom: 0; right: 0;
  width: 22px; height: 22px; cursor: se-resize; z-index: 20;
}
.mps-resize-handle::after {
  content: '';
  position: absolute; bottom: 5px; right: 5px;
  width: 10px; height: 10px;
  border-right: 2px solid var(--ws-subtle,#94a3b8);
  border-bottom: 2px solid var(--ws-subtle,#94a3b8);
  border-radius: 1px;
  opacity: .5;
  transition: opacity .15s;
}
.mps-resize-handle:hover::after { opacity: 1; }
.mps-title    { font-size: 18px; font-weight: 700; line-height: 1.3; }
.mps-subtitle { font-size: 12px; color: var(--muted); margin-top: 3px; }
.mps-scroll   { flex: 1; min-height: 0; overflow-y: auto; padding: 18px 24px; }
.mps-footer   { padding: 12px 24px; border-top: 1px solid var(--border); display: flex; gap: 10px; flex-shrink: 0; }
.mps-date-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.mps-field-note {
  margin-top: 6px;
  color: var(--ws-muted,#64748b);
  font-size: 11px;
  line-height: 1.4;
}
.mps-date-note {
  margin-top: -5px;
  margin-bottom: 16px;
  padding: 9px 11px;
  border-radius: 8px;
  background: var(--ws-soft,#f8fafc);
  color: var(--ws-muted,#64748b);
}

.mps-expand-row  { margin-bottom: 14px; }
.mps-expand-link { font-size: 13px; color: var(--ws-muted,#64748b); text-decoration: none; border-bottom: 1px dashed var(--ws-line-strong,#cbd5e1); padding-bottom: 1px; }
.mps-expand-link:hover { color: var(--primary); border-bottom-color: var(--primary); }
.req { color: #ef4444; margin-left: 2px; }

.mps-avatar      { width: 32px; height: 32px; border-radius: 8px; background: var(--ws-text,#475569); color: #fff; font-weight: 600; font-size: 12px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.mps-avatar-sm   { width: 24px; height: 24px; border-radius: 6px; font-size: 10px; }

/* Right panel */
.mps-right {
  padding: 20px 18px; display: flex; flex-direction: column; gap: 22px;
  background: var(--ws-canvas,#f1f5f9); border-radius: 0 12px 12px 0; overflow-y: auto;
}
.mps-right-label {
  font-size: 10px; font-weight: 700; color: var(--ws-subtle,#94a3b8);
  text-transform: uppercase; letter-spacing: .9px; margin-bottom: 10px;
}
.mps-right-section { position: relative; }

.mps-pick-btn {
  width: 100%; background: #fff; border: 1.5px solid var(--ws-line,#e2e8f0);
  border-radius: 8px; padding: 7px 12px;
  font-size: 13px; color: var(--ws-text,#475569); cursor: pointer; text-align: left;
  display: flex; align-items: center; gap: 6px;
  transition: border-color var(--tr), background var(--tr);
}
.mps-pick-btn:hover, .mps-pick-btn-selected { border-color: var(--ws-text,#475569); background: var(--ws-soft,#f8fafc); }

.mps-pick-link {
  background: none; border: none; cursor: pointer;
  color: var(--primary); font-size: 13px; padding: 0;
  display: block;
}
.mps-pick-link:hover { text-decoration: underline; }

.mps-picker-dropdown {
  position: absolute; top: calc(100% + 4px); left: 0; right: 0;
  background: var(--white); border: 1px solid var(--border);
  border-radius: 10px; box-shadow: 0 6px 24px rgba(0,0,0,.12);
  z-index: 50; overflow: hidden;
}
.mps-picker-search {
  width: 100%; border: none; border-bottom: 1px solid var(--border);
  padding: 10px 14px; font-size: 13px; outline: none; background: var(--ws-soft,#f9fafb);
}
.mps-picker-list  { max-height: 200px; overflow-y: auto; }
.mps-picker-item  {
  display: flex; align-items: center; gap: 8px;
  padding: 9px 12px; cursor: pointer; font-size: 13px;
  transition: background var(--tr);
}
.mps-picker-item:hover   { background: var(--ws-canvas,#f3f4f6); }
.mps-picker-item.selected { background: var(--ws-accent-soft,#eff6ff); }
.mps-picker-radio { width: 16px; height: 16px; border-radius: 50%; border: 1.5px solid var(--ws-line-strong,#d1d5db); margin-left: auto; flex-shrink: 0; }
.mps-picker-item.selected .mps-picker-radio { background: var(--primary); border-color: var(--primary); }
.mps-folder-dot { width: 10px; height: 10px; border-radius: 3px; flex-shrink: 0; }
.mps-picker-create {
  width: 100%;
  min-height: 40px;
  padding: 9px 12px;
  display: flex;
  align-items: center;
  gap: 8px;
  border: 0;
  border-top: 1px solid var(--border);
  background: #fff;
  color: var(--primary);
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
}
.mps-picker-create:hover { background: var(--primary-light); }
.mps-picker-create > span { font-size: 18px; line-height: 1; font-weight: 400; }

.mps-selected-user { display: flex; align-items: center; gap: 8px; font-size: 13px; cursor: pointer; padding: 2px 0; }
.mps-owner-row { cursor: default; color: var(--ws-text,#334155); font-weight: 500; }

.customer-quick-overlay {
  z-index: 340;
  background: rgba(15, 23, 42, .28);
}
.customer-quick-modal { max-width: 500px; }
.customer-quick-modal .modal-header { align-items: flex-start; }
.customer-quick-subtitle {
  max-width: 390px;
  margin-top: 5px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}
.customer-quick-body { padding: 0; }
.customer-quick-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.customer-quick-error {
  margin-top: 10px;
  padding: 9px 11px;
  border-radius: 8px;
  background: #fef2f2;
  color: #b91c1c;
  font-size: 12px;
  line-height: 1.4;
}
.customer-quick-error[hidden] { display: none; }

/* btn-slate (dark save) */
.btn-slate { background: var(--ws-ink,#1e293b); color: #fff; border: none; font-weight: 600; letter-spacing: .4px; border-radius: 8px; }
.btn-slate:hover { background: var(--ws-ink,#0f172a); }

@media (max-width: 700px) {
  .modal-project-split { grid-template-columns: 1fr; max-height: calc(100vh - 20px); }
  .mps-right { display: none; }
  .mps-date-fields,
  .customer-quick-grid { grid-template-columns: 1fr; }
}

/* ── SPA loading state for project page content ───────────────────────── */
#project-content { position: relative; }
#project-content.spa-loading { pointer-events: none; }
#project-content.spa-loading > :not(.project-spa-loader) { opacity: .48; transition: opacity .15s; }
#project-content > .project-spa-loader {
  position: absolute;
  inset: 0;
  min-height: 260px;
  display: none;
  overflow: hidden;
  background: rgba(248,250,252,.34);
  z-index: 8999;
  pointer-events: auto;
}
#project-content.spa-loading > .project-spa-loader { display: block; opacity: 1; }
#project-content .project-spa-loader-card {
  position: absolute;
  top: clamp(130px, 28vh, 300px);
  left: 50%;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  max-width: min(360px, calc(100% - 32px));
  padding: 12px 16px;
  border: 1px solid var(--ws-line,#dbe4ef);
  border-radius: 10px;
  background: #fff;
  color: var(--ws-text,#475569);
  box-shadow: 0 12px 30px rgba(15,23,42,.14);
  transform: translate(-50%, -50%);
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
}
#project-content .project-spa-loader-spinner {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
  box-sizing: border-box;
  border: 2.5px solid var(--ws-accent-line,#d8e2f0);
  border-top-color: var(--ws-accent,#1565c0);
  border-radius: 50%;
  animation: spa-spin .72s linear infinite;
}
@keyframes spa-spin { to { transform: rotate(360deg); } }

/* ══════════════════════════════════════════════════════════════════════════
   Chat Widget — multi-room floating messenger
   ══════════════════════════════════════════════════════════════════════════ */

/* FAB badge */
.chat-bubble {
  position: fixed;
  right: 24px;
  bottom: 0;
  width: 126px;
  height: 44px;
  border: 0;
  border-radius: 12px 12px 0 0;
  background: var(--primary);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 14px;
  cursor: pointer;
  box-shadow: 0 10px 26px rgba(37,99,235,.26), 0 2px 8px rgba(15,23,42,.18);
  z-index: 1100;
}
.chat-bubble:active { transform: translateY(1px); }
.chat-bubble svg {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  pointer-events: none;
}
.chat-bubble-label {
  font-size: 13px;
  font-weight: 800;
  line-height: 1;
  pointer-events: none;
}
.cw-unread-badge {
  position: absolute; top: -7px; right: 8px;
  background: #f44336; color: #fff; font-size: 10px; font-weight: 700;
  min-width: 18px; height: 18px; border-radius: 9px; padding: 0 4px;
  display: flex; align-items: center; justify-content: center;
  border: 2px solid #fff; line-height: 1;
}

/* Widget container */
.chat-widget {
  position: fixed; bottom: 80px; right: 24px;
  width: 600px; height: 540px;
  background: #fff; border-radius: 14px;
  box-shadow: 0 12px 48px rgba(0,0,0,.22), 0 2px 8px rgba(0,0,0,.10);
  display: flex; flex-direction: column;
  z-index: 1200; overflow: hidden;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: 14px; transition: height .22s cubic-bezier(.4,0,.2,1);
}
.chat-widget.cw-hidden    { display: none !important; }
.chat-widget.cw-minimized { height: 50px; }
.chat-widget.cw-minimized .cw-panes { display: none; }
.chat-widget.cw-minimized .cw-header { border-radius: 14px; }

/* ── Resize handle (bottom-right corner) ────────────────────────────── */
.cw-resize-handle {
  position: absolute; bottom: 0; right: 0;
  width: 18px; height: 18px;
  cursor: se-resize; z-index: 20;
}
.cw-resize-handle::after {
  content: '';
  position: absolute; bottom: 3px; right: 3px;
  width: 11px; height: 11px;
  background: repeating-linear-gradient(
    -45deg,
    transparent, transparent 2px,
    var(--ws-subtle,#90a4ae) 2px, var(--ws-subtle,#90a4ae) 3px
  );
  clip-path: polygon(100% 0, 100% 100%, 0 100%);
  opacity: .6;
}

/* ── Header ─────────────────────────────────────────────────────────────── */
.cw-header {
  background: linear-gradient(135deg, var(--ws-accent,#1565c0) 0%, #1a78d4 100%);
  color: #fff; padding: 0 12px;
  display: flex; align-items: center; gap: 10px; height: 50px;
  cursor: grab; flex-shrink: 0;
  border-radius: 14px 14px 0 0; user-select: none;
}
.cw-header:active { cursor: grabbing; }
.cw-header-icon {
  width: 32px; height: 32px; border-radius: 50%;
  background: rgba(255,255,255,.2);
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.cw-header-icon svg { width: 18px; height: 18px; pointer-events: none; }
.cw-header-title { flex: 1; font-weight: 600; font-size: 15px; }
.cw-hbtns { display: flex; gap: 4px; }
.cw-hbtn {
  background: rgba(255,255,255,.15); border: none; color: #fff;
  width: 30px; height: 30px; border-radius: 8px; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: background .15s; flex-shrink: 0;
}
.cw-hbtn:hover { background: rgba(255,255,255,.30); }
.cw-hbtn.is-active { background: rgba(255,255,255,.34); }
.cw-hbtn svg { width: 16px; height: 16px; pointer-events: none; }
.cw-settings {
  position: absolute;
  top: 58px;
  right: 14px;
  width: min(300px, calc(100% - 28px));
  padding: 12px;
  border: 1px solid var(--ws-line,#dbe4ef);
  border-radius: 10px;
  background: #fff;
  color: var(--ws-ink,#1f2937);
  box-shadow: 0 18px 42px rgba(15,23,42,.22);
  z-index: 35;
}
.cw-settings[hidden] { display: none; }
.cw-settings-title {
  margin-bottom: 10px;
  color: var(--ws-ink,#0f172a);
  font-size: 13px;
  font-weight: 800;
}
.cw-setting-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  cursor: pointer;
}
.cw-setting-row span {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.cw-setting-row b {
  color: var(--ws-ink,#0f172a);
  font-size: 13px;
  line-height: 1.2;
}
.cw-setting-row small {
  color: var(--ws-subtle,#78909c);
  font-size: 11.5px;
  line-height: 1.3;
}
.cw-setting-row input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}
.cw-setting-row i {
  position: relative;
  width: 42px;
  height: 24px;
  border-radius: 999px;
  background: var(--ws-line-strong,#cbd5e1);
  transition: background .15s;
}
.cw-setting-row i::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(15,23,42,.22);
  transition: transform .15s;
}
.cw-setting-row input:checked + i { background: var(--ws-accent,#1565c0); }
.cw-setting-row input:checked + i::after { transform: translateX(18px); }
.cw-setting-row input:focus-visible + i { box-shadow: 0 0 0 3px rgba(21,101,192,.18); }

/* ── Two-pane body ──────────────────────────────────────────────────────── */
.cw-panes {
  display: grid;
  grid-template-columns: 190px 14px 1fr;
  flex: 1; overflow: hidden; min-height: 0;
  transition: grid-template-columns .2s cubic-bezier(.4,0,.2,1);
}

/* ── Left sidebar: room list ────────────────────────────────────────────── */
.cw-sidebar {
  min-width: 0; overflow: hidden;
  display: flex; flex-direction: column;
  background: var(--ws-soft,#f4f6fa); border-right: 1px solid var(--ws-line,#e2e7f0);
}
.cw-sidebar.cw-collapsed .cw-room-info,
.cw-sidebar.cw-collapsed .cw-room-badge,
.cw-sidebar.cw-collapsed .cw-sidebar-tabs,
.cw-sidebar.cw-collapsed .cw-sidebar-empty,
.cw-sidebar.cw-collapsed .cw-sidebar-section,
.cw-sidebar.cw-collapsed .cw-room-pin,
.cw-sidebar.cw-collapsed .cw-sidebar-member-name,
.cw-sidebar.cw-collapsed .cw-member-vk { display: none; }
.cw-sidebar.cw-collapsed .cw-room-item { justify-content: center; padding: 8px 0; border-left: none; }
.cw-sidebar.cw-collapsed .cw-sidebar-member { justify-content: center; padding: 6px 0; border-left: none; }
.cw-sidebar.cw-collapsed .cw-new-dm-btn { justify-content: center; padding: 8px 0; font-size: 0; }

/* ── Sidebar toggle (collapse/expand button) ─────────────────────────── */
.cw-sidebar-toggle {
  min-width: 0; overflow: hidden;
  border: none; border-left: 1px solid var(--ws-line,#e2e7f0); border-right: 1px solid var(--ws-line,#dce2ed);
  background: var(--ws-canvas,#edf0f5); cursor: ew-resize;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 0; z-index: 1;
  touch-action: none;
  transition: background .15s;
}
.cw-sidebar-toggle:hover { background: var(--ws-accent-line,#dde5f5); }
.cw-sidebar-toggle svg {
  width: 10px; height: 16px; pointer-events: none; color: var(--ws-subtle,#78909c);
  transition: transform .2s cubic-bezier(.4,0,.2,1);
}
.cw-sidebar.cw-collapsed + .cw-sidebar-toggle svg { transform: scaleX(-1); }
.cw-sidebar-head {
  padding: 10px 12px 6px; font-size: 11px; font-weight: 600;
  color: var(--ws-subtle,#78909c); letter-spacing: .05em; text-transform: uppercase; flex-shrink: 0;
}
.cw-rooms { flex: 1; display: flex; flex-direction: column; overflow: hidden; min-height: 0; }
.cw-sidebar-tabs {
  display: flex;
  gap: 4px;
  padding: 8px;
  border-bottom: 1px solid var(--ws-line,#e2e7f0);
  background: var(--ws-soft,#f4f6fa);
  flex-shrink: 0;
}
.cw-sidebar-tab {
  position: relative;
  flex: 1;
  min-width: 0;
  min-height: 30px;
  border: 1px solid transparent;
  border-radius: 7px;
  background: transparent;
  color: var(--ws-muted,#607080);
  cursor: pointer;
  font-size: 11.5px;
  font-weight: 700;
  line-height: 1;
  transition: background .15s, color .15s, border-color .15s;
}
.cw-sidebar-tab:hover { background: var(--ws-canvas,#e8ecf5); color: var(--ws-ink,#1a2035); }
.cw-sidebar-tab.is-active {
  background: #fff;
  border-color: var(--ws-line,#dbe3ef);
  color: var(--ws-accent,#1565c0);
  box-shadow: 0 1px 2px rgba(15,23,42,.06);
}
.cw-tab-badge {
  position: absolute;
  top: -5px;
  right: -5px;
  min-width: 17px;
  height: 17px;
  padding: 0 4px;
  border-radius: 999px;
  background: #f44336;
  color: #fff;
  border: 2px solid var(--ws-soft,#f4f6fa);
  font-size: 9px;
  line-height: 13px;
  font-weight: 800;
}
.cw-room-scroll { flex: 1; overflow-y: auto; min-height: 0; padding-bottom: 6px; }
.cw-room-scroll::-webkit-scrollbar { width: 3px; }
.cw-room-scroll::-webkit-scrollbar-thumb { background: var(--ws-line-strong,#c5cdd8); border-radius: 2px; }
.cw-sidebar-empty {
  padding: 12px;
  color: var(--ws-subtle,#90a4ae);
  font-size: 12px;
  line-height: 1.35;
}
.cw-room-item {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 10px; cursor: pointer; position: relative;
  border-left: 3px solid transparent;
  transition: background .12s;
}
.cw-room-item:hover   { background: var(--ws-canvas,#e8ecf5); }
.cw-room-item.cw-active { background: var(--ws-accent-line,#dde5f5); border-left-color: var(--ws-accent,#1565c0); }
.cw-room-item.cw-pinned { background: var(--ws-accent-soft,#eef6ff); }
.cw-room-item.cw-pinned.cw-active { background: var(--ws-accent-line,#dcecff); }
.cw-room-av {
  width: 34px; height: 34px; border-radius: 50%; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 700; color: #fff;
}
.cw-room-av.type-general       { background: var(--ws-accent,#1565c0); }
.cw-room-av.type-project       { background: #2e7d32; }
.cw-room-av.type-direct        { background: #6a1b9a; }
.cw-room-av.type-notifications { background: #e65100; }
.cw-room-av svg { width: 17px; height: 17px; pointer-events: none; }
.cw-room-info { flex: 1; min-width: 0; }
.cw-room-name {
  font-size: 12.5px; font-weight: 500; color: var(--ws-ink,#1a2035);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.cw-room-pin {
  display: inline-flex;
  margin-left: 6px;
  padding: 1px 5px;
  border-radius: 999px;
  background: var(--ws-accent-line,#dbeafe);
  color: var(--ws-accent-hover,#1d4ed8);
  font-size: 9px;
  font-weight: 800;
  vertical-align: middle;
  text-transform: uppercase;
}
.cw-room-preview {
  font-size: 11px; color: var(--ws-subtle,#90a4ae);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.cw-room-badge {
  background: #f44336; color: #fff; font-size: 10px; font-weight: 700;
  min-width: 17px; height: 17px; border-radius: 9px; padding: 0 3px;
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}

/* Sidebar section header */
.cw-sidebar-section {
  padding: 10px 12px 4px; font-size: 10.5px; font-weight: 600;
  color: var(--ws-subtle,#90a4ae); letter-spacing: .06em; text-transform: uppercase;
  border-top: 1px solid var(--ws-line,#e2e7f0); margin-top: 4px; flex-shrink: 0;
}

/* Member item in sidebar */
.cw-sidebar-member {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 10px; cursor: pointer; position: relative;
  border-left: 3px solid transparent; transition: background .12s;
}
.cw-sidebar-member:hover   { background: var(--ws-canvas,#e8ecf5); }
.cw-sidebar-member.cw-active { background: var(--ws-accent-line,#dde5f5); border-left-color: #6a1b9a; }
.cw-sidebar-member-av {
  width: 28px; height: 28px; border-radius: 50%; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700; color: #fff;
  background: var(--ws-muted,#546e7a);
  overflow: hidden;
}
.cw-sidebar-member-name {
  flex: 1; min-width: 0; font-size: 12.5px; color: var(--ws-ink,#1a2035);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.cw-member-vk {
  flex-shrink: 0;
  min-width: 22px;
  padding: 1px 5px;
  border-radius: 999px;
  background: var(--ws-canvas,#e7ecf3);
  color: var(--ws-subtle,#78909c);
  font-size: 9px;
  line-height: 14px;
  font-weight: 700;
  text-align: center;
}
.cw-member-vk.is-linked {
  background: #e7f6ed;
  color: #16803a;
}
.cw-new-dm-btn {
  display: flex; align-items: center; gap: 6px;
  padding: 9px 12px; border: none; background: none; cursor: pointer;
  font-size: 12px; color: var(--ws-accent,#1565c0); font-weight: 500;
  border-top: 1px solid var(--ws-line,#e2e7f0); flex-shrink: 0; width: 100%;
  transition: background .12s;
}
.cw-new-dm-btn:hover { background: var(--ws-canvas,#e8ecf5); }
.cw-new-dm-btn svg { width: 15px; height: 15px; pointer-events: none; }

@media (max-width: 720px) {
  .chat-bubble {
    width: 112px;
    height: 42px;
    right: 12px;
  }
  .chat-widget {
    max-width: calc(100vw - 16px);
    max-height: calc(100vh - 16px);
    border-radius: 12px;
  }
  .cw-panes { grid-template-columns: 54px 12px 1fr; }
}

/* ── Right: chat area ───────────────────────────────────────────────────── */
.cw-chat-area {
  display: flex; flex-direction: column; flex: 1; overflow: hidden; min-width: 0;
}

/* Chat area header */
.cw-chat-header {
  display: flex; align-items: center; gap: 8px;
  padding: 0 14px; height: 46px; flex-shrink: 0;
  background: #fff; border-bottom: 1px solid var(--ws-line,#e4e8ef);
}
.cw-chat-header-av {
  width: 30px; height: 30px; border-radius: 50%; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700; color: #fff;
  overflow: hidden;
}
.cw-chat-header-av.type-general { background: var(--ws-accent,#1565c0); }
.cw-chat-header-av.type-project { background: #2e7d32; }
.cw-chat-header-av.type-direct  { background: #6a1b9a; }
.cw-chat-header-av.type-notifications { background: #e65100; }
.cw-chat-header-av svg { width: 15px; height: 15px; pointer-events: none; }
.cw-chat-header-info { flex: 1; min-width: 0; }
.cw-chat-header-name {
  font-weight: 600; font-size: 13.5px; color: var(--ws-ink,#1a2035);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.cw-chat-header-sub { font-size: 11px; color: var(--ws-subtle,#90a4ae); }
.cw-vk-bind {
  flex-shrink: 0;
  border: 1px solid var(--ws-line,#c9d5e6);
  background: var(--ws-soft,#f7f9fc);
  color: var(--ws-accent-hover,#1f4f8f);
  border-radius: 6px;
  padding: 5px 8px;
  font-size: 11px;
  font-weight: 600;
  line-height: 1;
  cursor: pointer;
}
.cw-vk-bind:hover { background: var(--ws-accent-soft,#eef4ff); border-color: var(--ws-accent-line,#9eb8dc); }
.cw-vk-bind.is-linked {
  width: 30px;
  height: 30px;
  padding: 0;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #e7f7ed;
  border-color: #9bd8b2;
  color: #16803a;
}
.cw-vk-bind.is-linked:hover { background: #d9f1e3; border-color: #74c992; }
.cw-vk-bind.is-linked svg { width: 16px; height: 16px; pointer-events: none; }

.cw-vk-guide {
  position: fixed;
  inset: 0;
  z-index: 1500;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(15, 23, 42, .38);
}
.cw-vk-guide-card {
  width: min(520px, calc(100vw - 32px));
  max-height: calc(100vh - 40px);
  overflow-y: auto;
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 18px 60px rgba(15, 23, 42, .28);
}
.cw-vk-guide-head {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 16px 18px 12px;
  border-bottom: 1px solid var(--ws-line,#e4e8ef);
}
.cw-vk-guide-head > div:first-child { flex: 1; min-width: 0; }
.cw-vk-guide-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--ws-ink,#1a2035);
}
.cw-vk-guide-sub {
  margin-top: 2px;
  font-size: 12px;
  color: var(--ws-subtle,#78909c);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.cw-vk-guide-close {
  width: 30px;
  height: 30px;
  border: 0;
  border-radius: 8px;
  background: var(--ws-accent-soft,#f0f4fb);
  color: var(--ws-muted,#607080);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
.cw-vk-guide-close:hover { background: var(--ws-accent-line,#e3eaf5); color: var(--ws-ink,#1a2035); }
.cw-vk-guide-close svg { width: 17px; height: 17px; pointer-events: none; }
.cw-vk-guide-status {
  margin: 14px 18px 0;
  padding: 8px 10px;
  border-radius: 8px;
  background: var(--ws-soft,#f3f6fb);
  color: var(--ws-muted,#546575);
  font-size: 12.5px;
  font-weight: 600;
}
.cw-vk-guide-status.is-linked {
  display: flex;
  align-items: center;
  gap: 7px;
  background: #e7f7ed;
  color: #16803a;
}
.cw-vk-guide-status.is-linked span {
  width: 19px;
  height: 19px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #16803a;
  color: #fff;
}
.cw-vk-guide-status.is-linked svg { width: 12px; height: 12px; pointer-events: none; }
.cw-vk-guide-video {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 14px 18px;
  padding: 14px;
  min-height: 82px;
  border: 1px dashed var(--ws-line-strong,#b8c7dc);
  border-radius: 8px;
  background: var(--ws-soft,#f8fafc);
}
.cw-vk-video-play {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: var(--ws-accent,#1565c0);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.cw-vk-video-play svg { width: 20px; height: 20px; margin-left: 2px; pointer-events: none; }
.cw-vk-video-title { font-size: 13.5px; font-weight: 700; color: var(--ws-ink,#1a2035); }
.cw-vk-video-note { margin-top: 2px; font-size: 12px; color: var(--ws-subtle,#78909c); line-height: 1.35; }
.cw-vk-guide-text {
  margin: 0 18px 16px;
  color: var(--ws-text,#334155);
  font-size: 13px;
  line-height: 1.5;
}
.cw-vk-guide-steps {
  margin: 0 18px 16px;
  padding-left: 20px;
  color: var(--ws-text,#334155);
  font-size: 13px;
  line-height: 1.5;
}
.cw-vk-guide-steps li { margin: 7px 0; }
.cw-vk-command {
  border: 1px solid var(--ws-line,#c8d5e7);
  border-radius: 6px;
  background: var(--ws-soft,#f7f9fc);
  color: var(--ws-accent-hover,#174d8c);
  padding: 2px 7px;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}
.cw-vk-command:hover { background: var(--ws-accent-soft,#eef4ff); border-color: var(--ws-accent-line,#9eb8dc); }
.cw-vk-guide-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 12px 18px 16px;
  border-top: 1px solid var(--ws-line,#e4e8ef);
}
.cw-vk-guide-link,
.cw-vk-guide-secondary {
  min-height: 32px;
  border-radius: 8px;
  padding: 0 12px;
  font-size: 12px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  cursor: pointer;
}
.cw-vk-guide-link {
  border: 1px solid var(--ws-accent,#1565c0);
  background: var(--ws-accent,#1565c0);
  color: #fff;
}
.cw-vk-guide-link:hover { background: var(--ws-accent,#1976d2); border-color: var(--ws-accent,#1976d2); }
.cw-vk-guide-secondary {
  border: 1px solid var(--ws-line-strong,#cbd5e1);
  background: #fff;
  color: var(--ws-text,#475569);
}
.cw-vk-guide-secondary:hover { background: var(--ws-soft,#f8fafc); }

/* No room selected */
.cw-no-room {
  flex: 1; display: flex; flex-direction: column; align-items: center;
  justify-content: center; color: var(--ws-line-strong,#b0bec5); gap: 10px; font-size: 13px;
  text-align: center; padding: 24px; background: var(--ws-soft,#f7f9fc);
}
.cw-no-room svg { width: 52px; height: 52px; opacity: .3; }

/* Messages list */
.cw-messages {
  flex: 1; overflow-y: auto; padding: 12px 12px 8px;
  display: flex; flex-direction: column; gap: 3px;
  background: var(--ws-canvas,#edf0f5); min-height: 0;
  color-scheme: light; isolation: isolate; overscroll-behavior: contain;
  scrollbar-gutter: stable;
}
.cw-messages::-webkit-scrollbar { width: 4px; }
.cw-messages::-webkit-scrollbar-thumb { background: var(--ws-line-strong,#b0bec5); border-radius: 2px; }
.cw-messages.is-page-loading::before {
  content: '';
  position: sticky;
  top: 8px;
  z-index: 6;
  align-self: center;
  width: 18px;
  height: 18px;
  margin-bottom: -18px;
  border: 2px solid rgba(21,101,192,.2);
  border-top-color: var(--ws-accent,#1565c0);
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 2px 8px rgba(15,23,42,.12);
  animation: portal-area-spin .72s linear infinite;
  pointer-events: none;
}

/* Day separator */
.cw-daysep {
  display: flex; align-items: center; gap: 8px;
  position: relative; z-index: 1;
  color: var(--ws-subtle,#78909c); font-size: 11px; line-height: 1.2; margin: 6px 0; flex-shrink: 0;
}
.cw-daysep::before, .cw-daysep::after { content: ''; flex: 1; height: 1px; background: var(--ws-line,#cdd2dc); }

/* Empty state */
.cw-empty {
  flex: 1; display: flex; flex-direction: column; align-items: center;
  justify-content: center; color: var(--ws-subtle,#90a4ae); gap: 10px; font-size: 13px;
  text-align: center; padding: 24px;
}
.cw-empty svg { width: 48px; height: 48px; opacity: .3; }

/* Message row */
.cw-row { display: flex; align-items: flex-end; gap: 6px; }
.cw-row.out { flex-direction: row-reverse; align-self: flex-end; max-width: 85%; }
.cw-row.in  { align-self: flex-start; max-width: 85%; }
.cw-row-av {
  width: 26px; height: 26px; border-radius: 50%; flex-shrink: 0;
  background: var(--ws-accent-line,#bbdefb); overflow: hidden;
  display: flex; align-items: center; justify-content: center;
  font-size: 10px; font-weight: 700; color: var(--ws-accent,#1565c0);
}
.cw-avatar-img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  border-radius: inherit;
}
.cw-row.out .cw-row-av { display: none; }
.cw-row-body { display: flex; flex-direction: column; gap: 1px; }
.cw-row.out .cw-row-body { align-items: flex-end; }
.cw-sender-name { font-size: 11px; font-weight: 600; color: var(--ws-accent,#1565c0); padding: 0 2px; }

/* Bubble */
.cw-bubble {
  padding: 7px 11px 6px; border-radius: 14px;
  font-size: 13.5px; line-height: 1.45; word-break: break-word;
  position: relative;
}
.cw-row.in  .cw-bubble { background: #fff; border-bottom-left-radius: 4px;
  box-shadow: 0 1px 2px rgba(0,0,0,.08); color: var(--ws-ink,#1a1a2e); padding-right: 32px; }
.cw-row.out .cw-bubble { background: var(--ws-accent,#1565c0); color: #fff; border-bottom-right-radius: 4px; padding-left: 32px; }
.cw-msg-menu {
  position: absolute;
  top: 3px;
  right: 5px;
  z-index: 2;
}
.cw-row.out .cw-msg-menu { left: 5px; right: auto; }
.cw-msg-menu summary {
  width: 22px;
  height: 20px;
  border-radius: 999px;
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 14px;
  line-height: 1;
  color: var(--ws-subtle,#78909c);
  opacity: 0;
  transition: opacity .12s, background .12s;
}
.cw-msg-menu summary::-webkit-details-marker { display: none; }
.cw-row:hover .cw-msg-menu summary,
.cw-msg-menu[open] summary { opacity: 1; }
.cw-row.in .cw-msg-menu summary:hover,
.cw-row.in .cw-msg-menu[open] summary { background: var(--ws-accent-soft,#edf3fb); color: var(--ws-text,#334155); }
.cw-row.out .cw-msg-menu summary { color: rgba(255,255,255,.78); }
.cw-row.out .cw-msg-menu summary:hover,
.cw-row.out .cw-msg-menu[open] summary { background: rgba(255,255,255,.16); color: #fff; }
.cw-msg-menu-list {
  position: absolute;
  top: 22px;
  right: 0;
  min-width: 132px;
  padding: 4px;
  border: 1px solid var(--ws-line,#dce3ee);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 8px 24px rgba(15,23,42,.18);
  color: var(--ws-ink,#1f2937);
  max-width: calc(100vw - 16px);
}
.cw-row.out .cw-msg-menu-list,
.cw-msg-menu.cw-open-left .cw-msg-menu-list { left: auto; right: 0; }
.cw-msg-menu.cw-open-right .cw-msg-menu-list { left: 0; right: auto; }
.cw-msg-menu.cw-open-up .cw-msg-menu-list { top: auto; bottom: 22px; }
.cw-msg-menu-list button {
  width: 100%;
  border: 0;
  background: transparent;
  border-radius: 6px;
  padding: 7px 9px;
  color: var(--ws-text,#334155);
  text-align: left;
  font: inherit;
  font-size: 12px;
  cursor: pointer;
}
.cw-msg-menu-list button:hover { background: var(--ws-canvas,#f1f5f9); }
.cw-msg-menu-list button.is-danger { color: #dc2626; }
.cw-reply-ref {
  border-left: 3px solid var(--ws-accent-line,#90caf9);
  padding: 5px 8px;
  margin: 0 18px 6px 0;
  border-radius: 7px;
  background: rgba(21,101,192,.08);
}
.cw-row.out .cw-reply-ref {
  margin: 0 0 6px 18px;
  border-left-color: rgba(255,255,255,.72);
  background: rgba(255,255,255,.14);
}
.cw-reply-name {
  font-size: 11px;
  font-weight: 700;
  color: var(--ws-accent,#1565c0);
}
.cw-row.out .cw-reply-name { color: rgba(255,255,255,.88); }
.cw-reply-preview {
  margin-top: 1px;
  font-size: 12px;
  color: var(--ws-muted,#64748b);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.cw-row.out .cw-reply-preview { color: rgba(255,255,255,.78); }
.cw-bubble-text { white-space: pre-wrap; }
.cw-bubble-text + .cw-attachments { margin-top: 6px; }
.cw-attachments {
  display: grid;
  gap: 6px;
  min-width: 180px;
  max-width: 280px;
}
.cw-attach-image {
  display: block;
  overflow: hidden;
  border-radius: 10px;
  background: rgba(15,23,42,.08);
  border: 1px solid rgba(15,23,42,.08);
}
.cw-attach-image img {
  display: block;
  width: 100%;
  max-width: 280px;
  max-height: 220px;
  object-fit: cover;
}
.cw-attach-file {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  padding: 8px;
  border-radius: 10px;
  text-decoration: none;
  color: inherit;
  background: rgba(255,255,255,.72);
  border: 1px solid rgba(15,23,42,.08);
}
.cw-row.in .cw-attach-file { background: var(--ws-soft,#f5f7fb); }
.cw-row.out .cw-attach-file {
  background: rgba(255,255,255,.16);
  border-color: rgba(255,255,255,.18);
}
.cw-attach-file-icon {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  background: var(--ws-accent-soft,#e6edf7);
  color: var(--ws-accent,#255a9b);
}
.cw-row.out .cw-attach-file-icon {
  background: rgba(255,255,255,.2);
  color: #fff;
}
.cw-attach-file-icon svg { width: 17px; height: 17px; pointer-events: none; }
.cw-attach-file-info { min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.cw-attach-file-name {
  max-width: 200px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 12.5px;
  font-weight: 600;
}
.cw-attach-file-meta {
  font-size: 10.5px;
  color: var(--ws-subtle,#78909c);
}
.cw-row.out .cw-attach-file-meta { color: rgba(255,255,255,.72); }
.cw-bubble-foot { display: flex; align-items: center; gap: 3px; justify-content: flex-end; margin-top: 2px; }
.cw-edited { font-size: 10.5px; color: var(--ws-subtle,#90a4ae); }
.cw-row.out .cw-edited { color: rgba(255,255,255,.62); }
.cw-time { font-size: 10.5px; }
.cw-row.in  .cw-time { color: var(--ws-subtle,#90a4ae); }
.cw-row.out .cw-time { color: rgba(255,255,255,.7); }
.cw-tick svg { width: 14px; height: 14px; stroke: rgba(255,255,255,.75); pointer-events: none; }
.cw-row.pending .cw-bubble { opacity: .65; }
.cw-row.failed .cw-bubble { outline: 1px solid #ef9a9a; }
.cw-reply-action {
  border: 0;
  background: transparent;
  color: var(--ws-subtle,#78909c);
  cursor: pointer;
  font-size: 11px;
  padding: 2px 4px;
  align-self: flex-start;
}
.cw-row.out .cw-reply-action { align-self: flex-end; }
.cw-reply-action:hover { color: var(--ws-accent,#1565c0); text-decoration: underline; }
.cw-notification-row {
  align-self: stretch;
  max-width: none;
  justify-content: center;
  margin: 4px 0;
}

.notification-deep-link-target {
  outline: 2px solid var(--ws-accent,#42a5f5) !important;
  outline-offset: -2px;
  background: var(--ws-accent-soft,#eff6ff) !important;
  transition: background .25s ease, outline-color .25s ease;
}
.cw-notice-card {
  width: min(430px, 100%);
  border: 1px solid var(--ws-line,#d8e2ef);
  border-left: 4px solid var(--ws-accent,#1565c0);
  border-radius: 10px;
  background: #fff;
  padding: 10px 12px;
  box-shadow: 0 2px 8px rgba(15,23,42,.08);
  color: var(--ws-ink,#1a2035);
}
.cw-notice-card.is-important { border-left-color: #d97706; background: #fffaf0; }
.cw-notice-card.is-success { border-left-color: #16a34a; background: #f0fdf4; }
.cw-notice-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 5px;
}
.cw-notice-kicker {
  display: inline-flex;
  align-items: center;
  padding: 2px 7px;
  border-radius: 999px;
  background: var(--ws-accent-soft,#e8f1fb);
  color: var(--ws-accent-hover,#155aa0);
  font-size: 10.5px;
  line-height: 15px;
  font-weight: 800;
  text-transform: uppercase;
}
.cw-notice-text {
  font-size: 13px;
  line-height: 1.45;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.cw-notice-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 28px;
  margin-top: 8px;
  padding: 0 10px;
  border-radius: 7px;
  background: var(--ws-accent,#1565c0);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  text-decoration: none;
}
.cw-notice-link:hover { background: var(--ws-accent,#1976d2); }

/* Smetrum chat shell and rich notification timeline */
.chat-widget {
  border: 1px solid var(--ws-line,#dbe4ef);
  border-radius: 16px;
  box-shadow: 0 22px 60px rgba(15,23,42,.20), 0 4px 16px rgba(15,23,42,.08);
}
.chat-widget .cw-header {
  height: 54px;
  padding: 0 14px;
  border-bottom: 1px solid var(--ws-canvas,#e5ebf3);
  border-radius: 16px 16px 0 0;
  background: #fff;
  color: var(--ws-ink,#0f172a);
}
.chat-widget .cw-header-icon {
  border-radius: 10px;
  background: var(--ws-accent-soft,#eaf3ff);
  color: var(--ws-accent,#1565c0);
}
.chat-widget .cw-header-title { font-weight: 800; }
.chat-widget .cw-hbtn {
  border: 1px solid var(--ws-line,#dbe4ef);
  background: var(--ws-soft,#f8fafc);
  color: var(--ws-muted,#64748b);
}
.chat-widget .cw-hbtn:hover { background: var(--ws-accent-soft,#eef4fb); color: var(--ws-accent,#1565c0); }
.chat-widget .cw-panes { grid-template-columns: 210px 1px minmax(0,1fr); }
.chat-widget .cw-sidebar-toggle { border-color: var(--ws-canvas,#e5ebf3); background: var(--ws-canvas,#edf2f7); cursor: pointer; }
.chat-widget .cw-sidebar { background: var(--ws-soft,#f8fafc); }
.chat-widget .cw-sidebar-tabs { padding: 9px; background: var(--ws-soft,#f8fafc); border-bottom-color: var(--ws-canvas,#e5ebf3); }
.chat-widget .cw-sidebar-tab { border-radius: 9px; }
.chat-widget .cw-room-item,
.chat-widget .cw-sidebar-member { margin: 2px 7px; border-left: 0; border-radius: 10px; }
.chat-widget .cw-room-item.cw-active,
.chat-widget .cw-sidebar-member.cw-active { background: var(--ws-accent-soft,#e8f2ff); box-shadow: inset 0 0 0 1px var(--ws-accent-line,#d4e5f8); }
.chat-widget .cw-sidebar.cw-collapsed .cw-room-item,
.chat-widget .cw-sidebar.cw-collapsed .cw-sidebar-member {
  width: 100%;
  min-height: 50px;
  margin: 0;
  padding: 0;
  gap: 0;
  border-radius: 0;
  box-shadow: none;
}
.chat-widget .cw-sidebar.cw-collapsed .cw-room-item.cw-active,
.chat-widget .cw-sidebar.cw-collapsed .cw-sidebar-member.cw-active {
  background: var(--ws-accent-line,#dcecff);
  box-shadow: inset 3px 0 var(--ws-accent,#1976d2);
}
.chat-widget .cw-chat-header {
  height: 56px;
  padding: 0 18px;
  border-bottom-color: var(--ws-canvas,#e5ebf3);
}
.chat-widget .cw-chat-header-av { border-radius: 10px; }
.chat-widget .cw-chat-header-av.type-notifications {
  border-radius: 10px;
  background: var(--ws-accent-soft,#eaf3ff);
  color: var(--ws-accent,#1565c0);
}
.chat-widget .cw-chat-header-name { font-size: 14px; font-weight: 800; }
.chat-widget .cw-chat-header-sub { margin-top: 2px; font-size: 11px; color: var(--ws-muted,#64748b); }
.chat-widget .cw-messages { padding: 16px; background: var(--ws-soft,#f5f7fb); scrollbar-color: var(--ws-line,#c7d2e2) transparent; }
.chat-widget .cw-row.in .cw-bubble {
  border: 1px solid var(--ws-line,#e1e8f1);
  border-bottom-left-radius: 12px;
  box-shadow: 0 4px 14px rgba(15,23,42,.05);
}
.chat-widget .cw-row.out .cw-bubble {
  border-bottom-right-radius: 12px;
  background: var(--ws-accent,#1d6fc1);
  box-shadow: 0 4px 14px rgba(21,101,192,.16);
}
.chat-widget .cw-input-wrap { padding: 11px 14px; border-top-color: var(--ws-canvas,#e5ebf3); }
.chat-widget .cw-input { border-radius: 12px; background: var(--ws-soft,#f8fafc); }
.chat-widget .cw-attach,
.chat-widget .cw-send { border-radius: 11px; }
.chat-widget.cw-notifications-mode .cw-messages {
  gap: 0;
  padding: 18px 20px 28px;
}
.chat-widget.cw-notifications-mode .cw-daysep {
  position: relative;
  top: auto;
  z-index: 1;
  width: max-content;
  margin: 8px 0 14px 52px;
  padding: 5px 10px;
  border: 1px solid var(--ws-line,#dbe4ef);
  border-radius: 999px;
  background: rgba(255,255,255,.94);
  box-shadow: 0 3px 10px rgba(15,23,42,.05);
  color: var(--ws-muted,#64748b);
  font-size: 11px;
  font-weight: 800;
  backdrop-filter: blur(8px);
}
.chat-widget.cw-notifications-mode .cw-daysep::before,
.chat-widget.cw-notifications-mode .cw-daysep::after { display: none; }
/* Кнопка «Прочитать все» в шапке комнаты уведомлений. */
.cw-notice-read-all {
  flex-shrink: 0;
  border: 1px solid var(--ws-line,#c9d5e6);
  background: var(--ws-soft,#f7f9fc);
  color: var(--ws-accent-hover,#1f4f8f);
  border-radius: 6px;
  padding: 5px 9px;
  font-size: 11px;
  font-weight: 600;
  line-height: 1;
  cursor: pointer;
  white-space: nowrap;
}
.cw-notice-read-all:hover { background: var(--ws-accent-soft,#eef4ff); border-color: var(--ws-accent-line,#9eb8dc); }

.cw-notification-row {
  display: grid;
  grid-template-columns: 42px minmax(0,1fr);
  align-items: stretch;
  gap: 14px;
  width: 100%;
  margin: 0;
}
.cw-notice-rail { position: relative; display: flex; justify-content: center; }
.cw-notice-rail::after {
  content: '';
  position: absolute;
  top: 40px;
  bottom: 0;
  width: 2px;
  border-radius: 2px;
  background: var(--ws-line,#dce5f0);
}
.cw-notification-row:last-child .cw-notice-rail::after { display: none; }
.cw-notice-icon {
  position: relative;
  z-index: 2;
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border: 4px solid var(--ws-soft,#f5f7fb);
  border-radius: 12px;
  background: var(--ws-accent-soft,#eaf3ff);
  color: var(--ws-accent,#1565c0);
}
.cw-notice-icon svg { width: 18px; height: 18px; }
.cw-notice-icon.is-approvals { background: #f3e8ff; color: #7e22ce; }
.cw-notice-icon.is-finance { background: #fff4df; color: #b45309; }
.cw-notice-icon.is-supply { background: #eafaf0; color: #15803d; }
.cw-notice-icon.is-documents { background: var(--ws-accent-soft,#eef2ff); color: #4f46e5; }
.cw-notice-icon.is-estimates { background: #e8fbfb; color: #0f766e; }
.cw-notice-icon.is-schedule { background: #fff0f0; color: #dc2626; }
.cw-notice-card {
  width: 100%;
  margin-bottom: 14px;
  padding: 18px 20px 16px;
  border: 1px solid var(--ws-line,#e0e7f0);
  border-left: 1px solid var(--ws-line,#e0e7f0);
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 8px 24px rgba(15,23,42,.055);
  color: var(--ws-ink,#172033);
  transition: border-color .16s ease, box-shadow .16s ease, transform .16s ease;
}
.cw-notice-card:hover { transform: translateY(-1px); border-color: var(--ws-line,#cbd8e8); box-shadow: 0 12px 30px rgba(15,23,42,.08); }
.cw-notice-card.is-important,
.cw-notice-card.is-success,
.cw-notice-card.is-critical { background: #fff; }
.cw-notice-card.is-important { border-color: #f1dfbd; }
.cw-notice-card.is-success { border-color: #cce8d5; }
.cw-notice-card.is-critical { border-color: #f2caca; }
.cw-notice-head { margin-bottom: 10px; }
.cw-notice-kicker {
  padding: 4px 9px;
  background: var(--ws-accent-soft,#edf5ff);
  color: var(--ws-accent-hover,#155aa0);
  font-size: 10px;
  line-height: 14px;
  letter-spacing: .045em;
}
.cw-notice-kicker.is-approvals { background: #f5ecff; color: #7e22ce; }
.cw-notice-kicker.is-finance { background: #fff5e6; color: #a85a08; }
.cw-notice-kicker.is-supply { background: #ecf9f0; color: #16733a; }
.cw-notice-kicker.is-documents { background: var(--ws-accent-soft,#eef2ff); color: #4338ca; }
.cw-notice-kicker.is-estimates { background: #e9f9f8; color: #0f766e; }
.cw-notice-kicker.is-schedule { background: #fff0f0; color: #c52222; }
.cw-notice-head .cw-time { color: var(--ws-subtle,#94a3b8); font-size: 11px; font-weight: 700; }
.cw-notice-title { margin: 0 0 12px; color: var(--ws-ink,#0f172a); font-size: 16px; line-height: 1.3; font-weight: 850; }
.cw-notice-actor { display: flex; align-items: center; gap: 9px; margin-bottom: 12px; }
.cw-notice-avatar {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: linear-gradient(135deg,var(--ws-accent-line,#dbeafe),var(--ws-accent-line,#bfdbfe));
  color: var(--ws-accent-hover,#1d4ed8);
  font-size: 12px;
  font-weight: 900;
}
.cw-notice-actor > span:last-child { min-width: 0; display: flex; flex-direction: column; }
.cw-notice-actor b { color: var(--ws-ink,#263247); font-size: 12px; line-height: 1.25; }
.cw-notice-actor small { margin-top: 2px; color: var(--ws-subtle,#94a3b8); font-size: 10.5px; }
.cw-notice-text { color: var(--ws-text,#475569); font-size: 13px; line-height: 1.55; }
.cw-notice-quote {
  margin: 14px 0 0;
  padding: 12px 14px;
  display: flex;
  gap: 10px;
  border: 1px solid var(--ws-accent-line,#dce8f7);
  border-radius: 10px;
  background: var(--ws-soft,#f7faff);
  color: var(--ws-text,#334155);
  font-size: 13px;
  line-height: 1.5;
}
.cw-notice-quote svg { width: 17px; height: 17px; flex: 0 0 auto; margin-top: 1px; color: var(--ws-accent,#4b85c7); }
.cw-notice-facts { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 8px; margin-top: 14px; }
.cw-notice-facts span { min-width: 0; padding: 9px 11px; border-radius: 9px; background: var(--ws-soft,#f8fafc); }
.cw-notice-facts small { display: block; margin-bottom: 3px; color: var(--ws-subtle,#94a3b8); font-size: 9px; font-weight: 800; text-transform: uppercase; letter-spacing: .05em; }
.cw-notice-facts b { display: block; overflow: hidden; color: var(--ws-text,#334155); font-size: 11.5px; text-overflow: ellipsis; white-space: nowrap; }
.cw-notice-footer { display: flex; justify-content: flex-end; min-height: 1px; margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--ws-canvas,#edf1f6); }
.cw-notice-link { min-height: 32px; margin: 0; padding: 0 12px; gap: 7px; border: 1px solid var(--ws-accent-line,#cfe0f5); background: var(--ws-accent-soft,#eff6ff); color: var(--ws-accent-hover,#155aa0); }
.cw-notice-link:hover { border-color: var(--ws-accent-line,#a9caef); background: var(--ws-accent-soft,#e1efff); color: var(--ws-accent-hover,#0f4f91); }
.cw-notice-link svg { width: 14px; height: 14px; }

@media (max-width: 720px) {
  .chat-widget .cw-panes { grid-template-columns: 54px 1px minmax(0,1fr); }
  .chat-widget .cw-room-item,
  .chat-widget .cw-sidebar-member { margin: 2px 4px; padding-left: 6px; padding-right: 6px; }
  .chat-widget .cw-chat-header { padding: 0 12px; }
  .chat-widget.cw-notifications-mode .cw-messages { padding: 14px 10px 22px; }
  .chat-widget.cw-notifications-mode .cw-daysep { margin-left: 48px; }
  .cw-notification-row { grid-template-columns: 36px minmax(0,1fr); gap: 8px; }
  .cw-notice-icon { width: 34px; height: 34px; border-width: 3px; }
  .cw-notice-card { padding: 15px 14px 13px; border-radius: 12px; }
  .cw-notice-facts { grid-template-columns: 1fr; }
}

.chat-widget.cw-drag-over .cw-messages {
  outline: 2px dashed var(--ws-accent,#6fa8dc);
  outline-offset: -8px;
  background: var(--ws-accent-soft,#e9f2fb);
}

.cw-attach-preview {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 8px 12px;
  background: #fff;
  border-top: 1px solid var(--ws-line,#e4e8ef);
}
.cw-attach-preview[hidden] { display: none; }
.cw-pending-file {
  width: 166px;
  min-width: 166px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px;
  border: 1px solid var(--ws-line,#dce3ee);
  border-radius: 8px;
  background: var(--ws-soft,#f8fafc);
  position: relative;
}
.cw-pending-thumb {
  width: 34px;
  height: 34px;
  border-radius: 7px;
  overflow: hidden;
  background: var(--ws-accent-soft,#e6edf7);
  color: var(--ws-accent,#255a9b);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}
.cw-pending-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.cw-pending-thumb svg { width: 18px; height: 18px; pointer-events: none; }
.cw-pending-info { min-width: 0; padding-right: 14px; }
.cw-pending-name {
  font-size: 12px;
  color: var(--ws-ink,#1a2035);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.cw-pending-size { font-size: 10.5px; color: var(--ws-subtle,#78909c); }
.cw-pending-remove {
  position: absolute;
  top: 2px;
  right: 2px;
  width: 18px;
  height: 18px;
  border: 0;
  border-radius: 50%;
  background: var(--ws-canvas,#e6ebf2);
  color: var(--ws-muted,#607080);
  cursor: pointer;
  line-height: 18px;
  padding: 0;
  font-size: 14px;
}
.cw-pending-remove:hover { background: var(--ws-line,#d9e1ed); color: var(--ws-ink,#1a2035); }

.cw-compose-context {
  padding: 8px 12px 0;
  background: #fff;
  border-top: 1px solid var(--ws-line,#e4e8ef);
  flex-shrink: 0;
}
.cw-compose-context[hidden] { display: none; }
.cw-compose-context-bar {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  align-items: center;
  border: 1px solid var(--ws-accent-line,#dbe7f5);
  border-left: 3px solid var(--ws-accent,#1565c0);
  border-radius: 8px;
  background: var(--ws-soft,#f8fbff);
  padding: 7px 9px;
}
.cw-compose-context-bar.is-edit {
  border-color: #fde68a;
  border-left-color: #d97706;
  background: #fffbeb;
}
.cw-compose-context-bar b {
  display: block;
  margin-bottom: 1px;
  color: var(--ws-ink,#0f172a);
  font-size: 12px;
}
.cw-compose-context-bar span {
  display: block;
  color: var(--ws-muted,#64748b);
  font-size: 12px;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.cw-compose-context-bar button {
  width: 24px;
  height: 24px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--ws-muted,#64748b);
  cursor: pointer;
  font-size: 18px;
  line-height: 1;
}
.cw-compose-context-bar button:hover { background: rgba(15,23,42,.08); color: var(--ws-ink,#0f172a); }

/* Input area */
.cw-input-wrap {
  display: flex; align-items: flex-end; gap: 8px;
  padding: 10px 12px; background: #fff;
  border-top: 1px solid var(--ws-line,#e4e8ef); flex-shrink: 0;
}
.cw-compose-context + .cw-attach-preview + .cw-input-wrap,
.cw-compose-context + .cw-input-wrap { border-top: 0; }
.cw-file-input { display: none; }
.cw-attach {
  width: 38px; height: 38px; border-radius: 50%; border: 1px solid var(--ws-line,#d9e2ef);
  background: var(--ws-soft,#f7f9fc); color: var(--ws-muted,#52677f); cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; transition: background .15s, transform .1s, border-color .15s;
}
.cw-attach:hover:not(:disabled) { background: var(--ws-accent-soft,#edf3fb); border-color: var(--ws-line,#c4d2e4); }
.cw-attach:active:not(:disabled) { transform: scale(.92); }
.cw-attach:disabled { opacity: .55; cursor: default; }
.cw-attach svg { width: 18px; height: 18px; pointer-events: none; }
.cw-input {
  flex: 1; border: 1px solid var(--ws-line,#dde3ec); border-radius: 20px;
  padding: 8px 14px; font-size: 13.5px; resize: none; outline: none;
  max-height: 120px; overflow-y: auto; line-height: 1.45;
  transition: border-color .15s; font-family: inherit; color: var(--ws-ink,#1a1a2e);
}
.cw-input:focus { border-color: var(--ws-accent-line,#90caf9); }
.cw-input::placeholder { color: var(--ws-line-strong,#aab4c0); }
.cw-send {
  width: 38px; height: 38px; border-radius: 50%; border: none;
  background: var(--ws-accent,#1565c0); color: #fff; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; transition: background .15s, transform .1s;
}
.cw-send:hover:not(:disabled) { background: var(--ws-accent,#1976d2); }
.cw-send:active:not(:disabled) { transform: scale(.92); }
.cw-send:disabled { background: var(--ws-line,#cfd8e4); cursor: default; }
.cw-send svg { width: 17px; height: 17px; pointer-events: none; }

/* ── DM picker overlay ──────────────────────────────────────────────────── */
.cw-dm-picker {
  position: absolute; inset: 50px 0 0 0;
  background: #fff; display: flex; flex-direction: column;
  z-index: 10; border-top: 1px solid var(--ws-line,#e4e8ef);
}
.cw-dm-picker.cw-hidden { display: none; }
.cw-dm-picker-head {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 14px; border-bottom: 1px solid var(--ws-line,#e4e8ef); flex-shrink: 0;
}
.cw-dm-picker-head span { font-weight: 600; font-size: 14px; flex: 1; }
.cw-dm-picker-head button { background: none; border: none; cursor: pointer; color: var(--ws-subtle,#78909c);
  display: flex; align-items: center; }
.cw-dm-picker-head button svg { width: 18px; height: 18px; pointer-events: none; }
.cw-dm-search {
  padding: 10px 14px; border-bottom: 1px solid var(--ws-canvas,#edf0f5); flex-shrink: 0;
}
.cw-dm-search input {
  width: 100%; border: 1px solid var(--ws-line,#dde3ec); border-radius: 20px;
  padding: 7px 14px; font-size: 13px; outline: none; font-family: inherit;
}
.cw-dm-search input:focus { border-color: var(--ws-accent-line,#90caf9); }
.cw-dm-list { flex: 1; overflow-y: auto; padding: 6px 0; }
.cw-dm-member {
  display: flex; align-items: center; gap: 10px;
  width: 100%; padding: 9px 14px; cursor: pointer; transition: background .12s;
  border: 0; background: transparent; text-align: left; font: inherit;
}
.cw-dm-member:hover { background: var(--ws-accent-soft,#f0f4fb); }
.cw-dm-member:focus-visible { outline: 2px solid var(--ws-accent,#2563eb); outline-offset: -2px; }
.cw-dm-member:disabled { cursor: wait; opacity: .65; }
.cw-dm-member-av {
  width: 34px; height: 34px; border-radius: 50%; background: #6a1b9a;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; font-weight: 700; color: #fff; flex-shrink: 0;
  overflow: hidden;
}
.cw-dm-member-name {
  flex: 1;
  min-width: 0;
  font-size: 13.5px;
  color: var(--ws-ink,#1a2035);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.cw-dm-empty { padding: 24px; text-align: center; color: var(--ws-line-strong,#b0bec5); font-size: 13px; }
.cw-dm-error { color: #b91c1c; }
.cw-dm-error button { margin-top: 12px; padding: 7px 12px; border: 1px solid #fecaca; border-radius: 7px; background: #fff; color: #991b1b; cursor: pointer; }
.cw-dm-action-error { margin: 6px 10px; padding: 8px 10px; border-radius: 7px; background: #fef2f2; color: #b91c1c; font-size: 12px; }

/* ── Members / data table ─────────────────────────────────── */
.members-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
}
.members-table th {
  text-align: left;
  padding: 10px 16px;
  font-weight: 600;
  font-size: 12px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .04em;
  border-bottom: 1px solid var(--border);
  background: var(--bg);
}
.members-table td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.members-table tbody tr:last-child td {
  border-bottom: none;
}
.members-table tbody tr:hover {
  background: var(--bg);
}
.perm-cb {
  width: 16px;
  height: 16px;
  accent-color: var(--primary);
  cursor: pointer;
}

/* ── Унифицированные фильтры (единый стиль как в «Снабжении») ──────────────
   Переопределяет per-part стили (.so-/.sk-/.fi-/.st-) за счёт более высокой
   специфичности (body .class). HTML/JS не меняются. */
body .so-filter-btn,
body .sk-filter-btn,
body .fi-filter-btn,
body .st-filter-btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 12px; border: 1px solid var(--ws-line,#e0e0e0); border-radius: 8px;
  background: #fff; font-size: 12px; font-weight: 600; color: var(--ws-text,#475569);
  cursor: pointer; letter-spacing: .3px; white-space: nowrap;
  text-transform: uppercase; transition: border-color .15s, background .15s;
}
body .so-filter-btn svg,
body .sk-filter-btn svg,
body .fi-filter-btn svg,
body .st-filter-btn svg { width: 13px; height: 13px; color: var(--ws-subtle,#94a3b8); flex-shrink: 0; }
body .so-filter-btn:hover,
body .sk-filter-btn:hover,
body .fi-filter-btn:hover,
body .st-filter-btn:hover { border-color: var(--ws-subtle,#94a3b8); }
body .so-filter-btn.active,
body .sk-filter-btn.active,
body .fi-filter-btn.has-filter,
body .st-filter-btn.primary {
  border-color: var(--ws-accent,#1565c0); color: var(--ws-accent,#1565c0); background: var(--ws-accent-soft,#eff6ff);
}
body .so-filter-btn.active svg,
body .sk-filter-btn.active svg,
body .fi-filter-btn.has-filter svg,
body .st-filter-btn.primary svg { color: var(--ws-accent,#1565c0); }

/* Контейнер выпадающего списка (визуал; позицию/видимость оставляем за part) */
body .so-filter-dd,
body .sk-filter-dd,
body .fi-filter-dd,
body .st-filter-menu {
  min-width: 200px; background: #fff; border: 1px solid var(--ws-line,#e2e8f0);
  border-radius: 10px; box-shadow: 0 8px 24px rgba(0,0,0,.13);
  overflow: hidden; padding: 0; z-index: 300;
}

/* Пункт списка */
body .so-filter-dd-item,
body .sk-filter-dd-item,
body .fi-filter-dd-item,
body .st-filter-menu-item {
  display: flex; align-items: center; gap: 8px;
  padding: 9px 14px; font-size: 13px; cursor: pointer; color: var(--ws-ink,#1e293b);
  border-bottom: 1px solid var(--ws-soft,#f8fafc);
}
body .so-filter-dd-item:last-child,
body .sk-filter-dd-item:last-child,
body .fi-filter-dd-item:last-child,
body .st-filter-menu-item:last-child { border-bottom: none; }
body .so-filter-dd-item:hover,
body .sk-filter-dd-item:hover,
body .fi-filter-dd-item:hover,
body .st-filter-menu-item:hover { background: var(--ws-canvas,#f3f4f6); }
body .so-filter-dd-item.selected,
body .sk-filter-dd-item.selected,
body .fi-filter-dd-item.selected,
body .st-filter-menu-item.selected { background: var(--ws-accent-soft,#eff6ff); color: var(--ws-accent,#1565c0); font-weight: 600; }

/* Чек-бокс слева (для sk/fi/st — у supply уже есть свой span.chk) */
body .sk-filter-dd-item::before,
body .fi-filter-dd-item::before,
body .st-filter-menu-item::before {
  content: ''; width: 14px; height: 14px; border-radius: 3px;
  border: 1.5px solid var(--ws-line-strong,#d1d5db); flex-shrink: 0; box-sizing: border-box; display: inline-block;
}
body .sk-filter-dd-item.selected::before,
body .fi-filter-dd-item.selected::before,
body .st-filter-menu-item.selected::before {
  background: #1565c0 url("data:image/svg+xml,%3Csvg viewBox='0 0 10 8' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 4l3 3 5-6' stroke='white' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") no-repeat center;
  border-color: var(--ws-accent,#1565c0);
}
/* убираем старую «галочку» у финансов */
body .fi-filter-dd-item.selected::after { content: none; }

/* ── Правая панель модалки: табы (Детали | Комментарии) ───────────────────── */
.mr-tabs { display: flex; gap: 3px; background: var(--ws-canvas,#eef1f5); border-radius: 9px; padding: 3px; }
.mr-tab {
  flex: 1; text-align: center; padding: 7px 10px; font-size: 12px; font-weight: 700;
  color: var(--ws-muted,#64748b); cursor: pointer; border: none; background: none; border-radius: 7px;
  letter-spacing: .2px; transition: background .12s, color .12s;
}
.mr-tab:hover { color: var(--ws-ink,#1e293b); }
.mr-tab.active { background: #fff; color: var(--ws-accent,#1565c0); box-shadow: 0 1px 2px rgba(0,0,0,.1); }
.mr-pane { display: none; }
.mr-pane.active { display: block; }
.mr-pane[data-rt-pane="details"] { flex-direction: column; gap: 18px; }
.mr-pane[data-rt-pane="details"].active { display: flex; }
.mr-pane[data-rt-pane="comments"].active { display: flex; flex-direction: column; flex: 1; min-height: 0; }
.so-right, .mr-host { min-height: 0; }
.so-right > .mr-tabs, .mr-host > .mr-tabs { flex-shrink: 0; }
.so-right > .mr-pane[data-rt-pane="comments"].active,
.mr-host > .mr-pane[data-rt-pane="comments"].active { flex: 1 1 auto; min-height: 0; }

/* ── Лента комментариев к документу (переиспользуемая) ────────────────────── */
.dc-thread { display: flex; flex-direction: column; min-height: 300px; flex: 1; min-height: 0; }
.dc-list {
  flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 10px;
  padding: 4px 2px 10px; min-height: 220px; max-height: 52vh;
}
.so-right .dc-thread, .mr-host .dc-thread { height: 100%; flex: 1 1 auto; min-height: 0; }
.so-right .dc-list, .mr-host .dc-list { min-height: 0; max-height: none; }
.dc-item { display: flex; gap: 9px; align-items: flex-start; }
.dc-av {
  width: 30px; height: 30px; border-radius: 50%; background: var(--ws-accent,#1565c0); color: #fff;
  font-size: 11px; font-weight: 800; display: flex; align-items: center; justify-content: center; flex-shrink: 0;
  box-shadow: 0 1px 2px rgba(21,101,192,.18);
}
.dc-body {
  flex: 1; min-width: 0; padding: 9px 10px 10px; border: 1px solid var(--ws-line,#e2e8f0);
  border-radius: 10px; background: #fff; box-shadow: 0 1px 2px rgba(15,23,42,.04);
}
.dc-meta {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: start;
  gap: 8px; margin-bottom: 6px;
}
.dc-meta-info { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.dc-author {
  display: block; min-width: 0; font-size: 12px; line-height: 1.25; font-weight: 800;
  color: var(--ws-ink,#0f172a); overflow-wrap: anywhere;
}
.dc-details { display: inline-flex; align-items: center; flex-wrap: wrap; gap: 6px; min-height: 16px; }
.dc-time { font-size: 11px; color: var(--ws-subtle,#94a3b8); line-height: 1.2; }
.dc-edited {
  display: inline-flex; align-items: center; height: 16px; padding: 0 6px; border-radius: 999px;
  background: var(--ws-canvas,#f1f5f9); color: var(--ws-muted,#64748b); font-size: 10px; font-weight: 700; line-height: 1;
}
.dc-actions { display:inline-flex; gap:4px; white-space:nowrap; opacity:.82; }
.dc-action-btn {
  width: 26px; height: 26px; display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid transparent; border-radius: 7px; background: transparent; color: var(--ws-muted,#64748b);
  padding: 0; cursor: pointer; transition: background .12s, border-color .12s, color .12s;
}
.dc-action-btn:hover { background: var(--ws-accent-soft,#eff6ff); border-color: var(--ws-accent-line,#bfdbfe); color: var(--ws-accent,#1565c0); }
.dc-action-btn.danger:hover { background: #fff1f2; border-color: #fecdd3; color: #dc2626; }
.dc-action-btn svg, .dc-action-btn [data-lucide] { width: 14px; height: 14px; stroke-width: 2.3; pointer-events: none; }
.dc-text {
  font-size: 13px; color: var(--ws-text,#334155); word-break: normal; overflow-wrap: anywhere;
  white-space: pre-wrap; line-height: 1.45;
}
.dc-item.is-editing .dc-actions { visibility: hidden; }
.dc-inline-editor { display: flex; flex-direction: column; gap: 8px; }
.dc-edit-input {
  width: 100%; min-height: 62px; max-height: 160px; box-sizing: border-box; resize: vertical;
  border: 1px solid var(--ws-accent-line,#90caf9); border-radius: 8px; padding: 8px 10px; background: #fff;
  color: var(--ws-text,#334155); font: inherit; font-size: 13px; line-height: 1.45; outline: none;
  box-shadow: 0 0 0 3px rgba(21,101,192,.08);
}
.dc-edit-actions { display: flex; justify-content: flex-end; gap: 6px; }
.dc-edit-btn {
  min-height: 30px; padding: 5px 10px; border: 1px solid var(--ws-line,#dbe2ea); border-radius: 7px;
  background: #fff; color: var(--ws-text,#475569); font: inherit; font-size: 12px; font-weight: 700; cursor: pointer;
}
.dc-edit-btn:hover { background: var(--ws-soft,#f8fafc); color: var(--ws-ink,#0f172a); }
.dc-edit-btn.primary { border-color: var(--ws-accent,#1565c0); background: var(--ws-accent,#1565c0); color: #fff; }
.dc-edit-btn.primary:hover { background: var(--ws-accent-hover,#0d47a1); }
.dc-edit-btn:disabled { opacity: .55; cursor: default; }
.dc-empty {
  margin: auto; color: var(--ws-subtle,#94a3b8); font-size: 13px; text-align: center; padding: 30px 12px;
  display: flex; flex-direction: column; align-items: center; gap: 6px;
}
.dc-empty svg, .dc-empty [data-lucide] { width: 28px; height: 28px; color: var(--ws-line-strong,#cbd5e1); stroke-width: 1.8; }
.dc-empty b { color: var(--ws-muted,#64748b); font-size: 13px; }
.dc-empty span { max-width: 220px; line-height: 1.35; }
.dc-input-row { display: flex; gap: 8px; align-items: flex-end; padding-top: 10px; border-top: 1px solid var(--ws-line,#e2e8f0); }
.dc-input {
  flex: 1; border: 1px solid var(--ws-line,#dde3ec); border-radius: 8px; padding: 8px 10px;
  font-size: 13px; resize: none; outline: none; font-family: inherit; max-height: 110px; line-height: 1.4;
}
.dc-input:focus { border-color: var(--ws-accent-line,#90caf9); }
.dc-send {
  width: 34px; height: 34px; border-radius: 8px; border: none; background: var(--ws-accent,#1565c0); color: #fff;
  cursor: pointer; display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.dc-send:hover { background: var(--ws-accent-hover,#0d47a1); }
.dc-send:disabled { background: var(--ws-line,#cfd8e4); cursor: default; }
.dc-send svg { width: 16px; height: 16px; pointer-events: none; }

/* ── Список прикреплённых файлов в модалке ────────────────────────────────── */
.dc-files { display: flex; flex-direction: column; gap: 6px; }
.dc-file {
  display: flex; align-items: center; gap: 8px; padding: 7px 9px;
  background: var(--ws-canvas,#f1f5f9); border-radius: 7px; font-size: 12px; color: var(--ws-text,#334155);
  text-decoration: none; transition: background .12s;
}
.dc-file:hover { background: var(--ws-line,#e2e8f0); }
.dc-file svg { width: 14px; height: 14px; color: var(--ws-muted,#64748b); flex-shrink: 0; }
.dc-file-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dc-files-empty { font-size: 12px; color: var(--ws-subtle,#94a3b8); }

/* ── Widgets ───────────────────────────────────────────────── */
.btn-secondary,
.btn-light {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  padding: 0 14px;
  border-radius: 8px;
  font: 700 13px/1 inherit;
  cursor: pointer;
  transition: background var(--tr), border-color var(--tr), color var(--tr);
}
.btn-secondary { border: 1px solid var(--ws-accent,#2563eb); background: var(--ws-accent,#2563eb); color: #fff; }
.btn-secondary:hover { background: var(--ws-accent-hover,#1d4ed8); border-color: var(--ws-accent-hover,#1d4ed8); }
.btn-light { border: 1px solid var(--ws-line,#dbe4ef); background: #fff; color: var(--ws-text,#334155); }
.btn-light:hover { background: var(--ws-soft,#f8fafc); border-color: var(--ws-line-strong,#cbd5e1); color: var(--ws-ink,#0f172a); }

.widget-launcher { position: relative; }
.widget-launcher.is-open { z-index: 6101; }
.topbar-mail-btn {
  position: relative;
  width: 34px;
  height: 34px;
  min-width: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--ws-line,#dbe4ef);
  border-radius: 8px;
  background: #fff;
  color: var(--ws-text,#475569);
  cursor: pointer;
  transition: background .15s ease, border-color .15s ease, color .15s ease;
}
.topbar-mail-btn:hover {
  border-color: var(--ws-accent-line,#bfdbfe);
  background: var(--ws-accent-soft,#eff6ff);
  color: var(--ws-accent-hover,#1d4ed8);
}
.topbar-mail-btn svg {
  width: 18px;
  height: 18px;
}
.topbar-mail-badge {
  position: absolute;
  top: -5px;
  right: -5px;
  min-width: 17px;
  height: 17px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 5px;
  border: 2px solid #fff;
  border-radius: 999px;
  background: #ef4444;
  color: #fff;
  font-size: 10px;
  font-weight: 800;
  line-height: 1;
}
.widget-launcher-btn {
  height: 34px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 0 11px;
  border: 1px solid var(--ws-line,#dbe4ef);
  border-radius: 8px;
  background: #fff;
  color: var(--ws-text,#334155);
  font: 700 13px/1 inherit;
  cursor: pointer;
  white-space: nowrap;
}
.widget-launcher-btn:hover,
.widget-launcher.is-open .widget-launcher-btn {
  background: var(--ws-soft,#f8fafc);
  border-color: var(--ws-line-strong,#b9c7d8);
  color: var(--ws-ink,#0f172a);
}
.widget-launcher-btn svg { width: 17px; height: 17px; flex-shrink: 0; }
.widget-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 360px;
  max-width: calc(100vw - 24px);
  display: none;
  padding: 8px;
  border: 1px solid var(--ws-line,#dbe4ef);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 16px 38px rgba(15, 23, 42, .16);
  z-index: 6200;
}
.widget-launcher.is-open .widget-menu { display: block; }
.widget-menu-tabs {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 4px;
  margin-bottom: 6px;
  padding: 3px;
  border-radius: 9px;
  background: var(--ws-canvas,#f1f5f9);
}
.widget-menu-tab {
  min-width: 0;
  min-height: 34px;
  padding: 6px 8px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--ws-muted,#64748b);
  font: 800 11px/1.2 inherit;
  cursor: pointer;
}
.widget-menu-tab:hover { color: var(--ws-accent,#1e40af); }
.widget-menu-tab:focus-visible { outline: 2px solid var(--ws-accent-line,#93c5fd); outline-offset: 1px; }
.widget-menu-tab.is-active {
  background: #fff;
  color: var(--ws-accent-hover,#1d4ed8);
  box-shadow: 0 1px 3px rgba(15, 23, 42, .12);
}
.widget-menu-panel { min-height: 56px; }
.widget-menu-title {
  padding: 5px 7px 7px;
  color: var(--ws-muted,#64748b);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .04em;
}
.widget-menu-item {
  width: 100%;
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  gap: 9px;
  align-items: center;
  padding: 8px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--ws-ink,#0f172a);
  cursor: pointer;
  text-align: left;
}
.widget-menu-item:hover { background: var(--ws-canvas,#f1f5f9); }
.widget-menu-icon {
  width: 34px;
  height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  background: var(--ws-accent-soft,#eff6ff);
  color: var(--ws-accent-hover,#1d4ed8);
}
.widget-menu-icon svg { width: 20px; height: 20px; }
.widget-menu-copy { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.widget-menu-title-line {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 6px;
}
.widget-menu-copy strong { min-width: 0; font-size: 13px; line-height: 1.2; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.widget-menu-badge,
.widgets-card-badge,
.room-planner-demo-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 18px;
  padding: 0 7px;
  border: 1px solid var(--ws-accent-line,#bfdbfe);
  border-radius: 999px;
  background: var(--ws-accent-soft,#eff6ff);
  color: var(--ws-accent-hover,#1d4ed8);
  font-size: 10px;
  font-style: normal;
  font-weight: 900;
  line-height: 1;
  text-transform: uppercase;
  white-space: nowrap;
}
.widget-menu-copy small { color: var(--ws-muted,#64748b); font-size: 11px; line-height: 1.25; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.widget-menu-empty { padding: 16px 8px; color: var(--ws-muted,#64748b); font-size: 13px; text-align: center; }
.widget-menu-manage {
  display: flex;
  justify-content: center;
  margin-top: 6px;
  padding: 8px;
  border-top: 1px solid var(--ws-canvas,#edf2f7);
  color: var(--ws-accent,#2563eb);
  font-size: 13px;
  font-weight: 800;
}
.widget-menu-manage:hover { color: var(--ws-accent-hover,#1d4ed8); }

.widgets-page {
  min-height: calc(100vh - var(--topbar-h));
  padding: 0 0 34px;
  background: var(--ws-soft,#f5f7fb);
  color: var(--ws-ink,#0f172a);
}
.widgets-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 16px;
  padding: 16px 24px;
  background: #fff;
  border-bottom: 1px solid var(--ws-canvas,#eef1f5);
}
.widgets-head h1 { margin: 0; color: var(--ws-ink,#0f172a); font-size: 22px; line-height: 1.2; font-weight: 700; }
.widgets-head p,
.widgets-section-head p {
  margin: 6px 0 0;
  color: var(--ws-muted,#64748b);
  font-size: 13px;
  line-height: 1.45;
}
.widgets-tabs {
  display: flex;
  gap: 0;
  padding: 0 24px;
  background: #fff;
  border-bottom: 1px solid var(--ws-line,#e5e7eb);
  overflow: auto;
}
.widgets-tab {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 12px 14px 10px;
  border: 0;
  border-bottom: 2px solid transparent;
  background: transparent;
  color: var(--ws-muted,#64748b);
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
}
.widgets-tab:hover { color: var(--ws-ink,#0f172a); }
.widgets-tab.active { color: var(--ws-accent-hover,#1d4ed8); border-bottom-color: var(--ws-accent-hover,#1d4ed8); }
.widgets-panel { display: none; }
.widgets-panel.active { display: block; }
.widgets-section { padding: 18px 24px 0; }
.widgets-section-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 14px;
  margin-bottom: 12px;
}
.widgets-section-head h2 { margin: 0; color: var(--ws-ink,#0f172a); font-size: 18px; line-height: 1.25; }
.widgets-catalog-layout {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  align-items: start;
  min-height: calc(100vh - var(--topbar-h) - 112px);
}
.widgets-filters {
  min-height: inherit;
  padding: 18px 18px 22px 24px;
  background: #fff;
  border-right: 1px solid var(--ws-line,#e5e7eb);
}
.widgets-filter-title {
  margin-bottom: 12px;
  color: var(--ws-ink,#0f172a);
  font-size: 14px;
  font-weight: 700;
}
.widgets-filter-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 12px;
}
.widgets-filter-group span {
  color: var(--ws-subtle,#94a3b8);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .6px;
  text-transform: uppercase;
}
.widgets-filter-control {
  width: 100%;
  box-sizing: border-box;
  border: 1px solid var(--ws-line,#dbe3ea);
  border-radius: 7px;
  background: #fff;
  color: var(--ws-ink,#0f172a);
  font: inherit;
  font-size: 13px;
  padding: 8px 10px;
}
.widgets-filter-control:focus {
  outline: none;
  border-color: var(--ws-accent,#2563eb);
  box-shadow: 0 0 0 2px rgba(37, 99, 235, .08);
}
.widgets-filter-reset { width: 100%; justify-content: center; }
.widgets-catalog-main {
  min-width: 0;
  padding: 18px 24px 0;
}
.widgets-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 12px;
}
.widgets-card {
  display: grid;
  grid-template-columns: 46px minmax(0, 1fr);
  gap: 12px;
  min-height: 160px;
  padding: 14px;
  border: 1px solid var(--ws-line,#dbe4ef);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 1px 2px rgba(15, 23, 42, .04);
}
.widgets-card.is-coming-soon {
  background: linear-gradient(180deg, #fff 0%, #fffaf0 100%);
  border-color: #fed7aa;
}
.widgets-card-icon {
  width: 44px;
  height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  background: var(--ws-accent-soft,#eff6ff);
  color: var(--ws-accent-hover,#1d4ed8);
}
.widgets-card.is-coming-soon .widgets-card-icon {
  background: #fff7ed;
  color: #c2410c;
}
.widgets-card-icon svg { width: 24px; height: 24px; }
.widgets-card-body { min-width: 0; }
.widgets-card-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.widgets-card h3 {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 7px;
  margin: 0;
  color: var(--ws-ink,#0f172a);
  font-size: 15px;
  line-height: 1.25;
}
.widgets-card h3 span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.widgets-card p {
  min-height: 36px;
  margin: 7px 0 10px;
  color: var(--ws-muted,#64748b);
  font-size: 13px;
  line-height: 1.4;
}
.widgets-card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  color: var(--ws-text,#475569);
  font-size: 12px;
  font-weight: 700;
}
.widgets-card-meta span {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  padding: 0 8px;
  border-radius: 999px;
  background: var(--ws-soft,#f8fafc);
  border: 1px solid var(--ws-line,#e2e8f0);
}
.widgets-card-status {
  flex-shrink: 0;
  border-radius: 999px;
  padding: 3px 8px;
  background: var(--ws-canvas,#f1f5f9);
  color: var(--ws-muted,#64748b);
  font-size: 11px;
  font-weight: 800;
  white-space: nowrap;
}
.widgets-card-status.is-active { background: #dcfce7; color: #15803d; }
.widgets-card-status.is-coming-soon,
.widgets-card-badge.is-soon {
  background: #fff7ed;
  border-color: #fed7aa;
  color: #c2410c;
}
.widgets-card-actions {
  grid-column: 1 / -1;
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: auto;
}
.widgets-card-actions button[disabled],
.widgets-card-soon-action {
  cursor: not-allowed;
  opacity: .78;
}
.widgets-empty {
  grid-column: 1 / -1;
  min-height: 98px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px dashed var(--ws-line-strong,#cbd5e1);
  border-radius: 8px;
  background: #fff;
  color: var(--ws-muted,#64748b);
  font-size: 13px;
}

.widget-window {
  position: fixed;
  top: 88px;
  right: 28px;
  width: min(352px, calc(100vw - 24px));
  display: none;
  border: 1px solid var(--ws-line,#d8e2ef);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 24px 54px rgba(15, 23, 42, .22);
  overflow: hidden;
  z-index: 5200;
}
.widget-window.is-open { display: block; }
.widget-window-head {
  height: 54px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 9px 10px 9px 14px;
  border-bottom: 1px solid var(--ws-line,#e2e8f0);
  background: var(--ws-soft,#f8fafc);
  cursor: move;
  user-select: none;
  touch-action: none;
}
.widget-window-head strong { display: block; color: var(--ws-ink,#0f172a); font-size: 14px; line-height: 1.2; }
.widget-window-head span { display: block; margin-top: 2px; color: var(--ws-muted,#64748b); font-size: 11px; line-height: 1.2; }
.widget-window-close {
  width: 30px;
  height: 30px;
  border: 1px solid var(--ws-line,#dbe4ef);
  border-radius: 8px;
  background: #fff;
  color: var(--ws-text,#475569);
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
}
.widget-window-close:hover { background: #fee2e2; border-color: #fecaca; color: #b91c1c; }
.widget-calc { padding: 12px; }
.widget-calc-input {
  width: 100%;
  height: 48px;
  margin-bottom: 10px;
  border: 1px solid var(--ws-line-strong,#cbd5e1);
  border-radius: 8px;
  background: #fff;
  color: var(--ws-ink,#0f172a);
  font: 800 22px/1.2 inherit;
  text-align: right;
  padding: 0 12px;
  outline: none;
}
.widget-calc-input:focus { border-color: var(--ws-accent-line,#93c5fd); box-shadow: 0 0 0 3px rgba(37, 99, 235, .12); }
.widget-calc-input.is-error { border-color: #ef4444; box-shadow: 0 0 0 3px rgba(239, 68, 68, .12); }
.widget-calc-keys {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}
.widget-calc-keys button {
  height: 42px;
  border: 1px solid var(--ws-line,#dbe4ef);
  border-radius: 8px;
  background: #fff;
  color: var(--ws-ink,#0f172a);
  font: 800 15px/1 inherit;
  cursor: pointer;
}
.widget-calc-keys button:hover { background: var(--ws-canvas,#f1f5f9); }
.widget-calc-keys button.is-op { background: var(--ws-accent-soft,#eff6ff); border-color: var(--ws-accent-line,#bfdbfe); color: var(--ws-accent-hover,#1d4ed8); }
.widget-calc-keys button.is-equals { grid-column: 1 / -1; background: var(--ws-accent,#2563eb); border-color: var(--ws-accent,#2563eb); color: #fff; }
.widget-calc-history {
  display: flex;
  flex-direction: column;
  gap: 5px;
  max-height: 128px;
  margin-top: 10px;
  overflow: auto;
}
.widget-calc-history-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  padding: 6px 8px;
  border: 0;
  border-radius: 7px;
  background: var(--ws-soft,#f8fafc);
  color: var(--ws-muted,#64748b);
  cursor: pointer;
  text-align: left;
}
.widget-calc-history-item:hover { background: var(--ws-canvas,#edf2f7); }
.widget-calc-history-item span,
.widget-calc-history-item strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.widget-calc-history-item strong { color: var(--ws-ink,#0f172a); }
.widget-window-notes {
  width: min(720px, calc(100vw - 24px));
  height: min(680px, calc(100vh - 28px));
}
.widget-window-notes.is-open {
  display: flex;
  flex-direction: column;
}
.widget-window-notes .widget-window-head {
  flex: 0 0 auto;
}
.widget-notes {
  flex: 1;
  min-height: 0;
  height: auto;
  display: grid;
  grid-template-columns: 228px minmax(0, 1fr);
}
.widget-notes-list-wrap {
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--ws-line,#e2e8f0);
  background: var(--ws-soft,#f8fafc);
}
.widget-notes-list-head {
  height: 46px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 10px 8px 12px;
  border-bottom: 1px solid var(--ws-line,#e2e8f0);
}
.widget-notes-list-head strong {
  color: var(--ws-ink,#0f172a);
  font-size: 13px;
  line-height: 1.2;
}
.widget-notes-add {
  width: 30px;
  height: 30px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--ws-accent-line,#bfdbfe);
  border-radius: 8px;
  background: var(--ws-accent-soft,#eff6ff);
  color: var(--ws-accent-hover,#1d4ed8);
  font: 800 20px/1 inherit;
  cursor: pointer;
}
.widget-notes-add:hover { background: var(--ws-accent-line,#dbeafe); }
.widget-notes-search {
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding: 8px 10px;
  border-bottom: 1px solid var(--ws-line,#e2e8f0);
}
.widget-notes-search span {
  color: var(--ws-subtle,#94a3b8);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .04em;
  text-transform: uppercase;
}
.widget-notes-search input {
  width: 100%;
  height: 32px;
  border: 1px solid var(--ws-line,#dbe4ef);
  border-radius: 7px;
  background: #fff;
  color: var(--ws-ink,#0f172a);
  font: 600 12px/1 inherit;
  outline: none;
  padding: 0 9px;
}
.widget-notes-search input:focus {
  border-color: var(--ws-accent-line,#93c5fd);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, .1);
}
.widget-notes-list {
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding: 8px;
}
.widget-notes-item {
  width: 100%;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 6px;
  padding: 6px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--ws-text,#475569);
}
.widget-notes-item:hover { background: var(--ws-canvas,#eef2f7); }
.widget-notes-item.is-active {
  border-color: var(--ws-accent-line,#bfdbfe);
  background: var(--ws-accent-soft,#eff6ff);
}
.widget-notes-main {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 3px 4px;
  border: 0;
  background: transparent;
  color: inherit;
  cursor: pointer;
  text-align: left;
}
.widget-notes-item strong {
  color: var(--ws-ink,#0f172a);
  font-size: 13px;
  line-height: 1.25;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.widget-notes-item span {
  min-height: 17px;
  color: var(--ws-muted,#64748b);
  font-size: 12px;
  line-height: 1.35;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.widget-notes-item small {
  color: var(--ws-subtle,#94a3b8);
  font-size: 10px;
  font-weight: 700;
}
.widget-notes-row-actions {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.widget-notes-row-actions button {
  width: 26px;
  height: 26px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid transparent;
  border-radius: 7px;
  background: transparent;
  color: var(--ws-muted,#64748b);
  cursor: pointer;
  padding: 0;
}
.widget-notes-row-actions button:hover {
  border-color: var(--ws-accent-line,#bfdbfe);
  background: var(--ws-accent-soft,#eff6ff);
  color: var(--ws-accent-hover,#1d4ed8);
}
.widget-notes-row-actions button.danger:hover {
  border-color: #fecaca;
  background: #fee2e2;
  color: #b91c1c;
}
.widget-notes-row-actions svg {
  width: 14px;
  height: 14px;
  pointer-events: none;
}
.widget-notes-empty,
.widget-notes-more {
  width: 100%;
  min-height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px dashed var(--ws-line-strong,#cbd5e1);
  border-radius: 8px;
  background: #fff;
  color: var(--ws-muted,#64748b);
  font: 700 12px/1.2 inherit;
  text-align: center;
}
.widget-notes-more {
  margin-top: 8px;
  border-style: solid;
  cursor: pointer;
}
.widget-notes-more:hover {
  border-color: var(--ws-accent-line,#bfdbfe);
  background: var(--ws-accent-soft,#eff6ff);
  color: var(--ws-accent-hover,#1d4ed8);
}
.widget-notes-workspace {
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  background: #fff;
}
.widget-notes-editor {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  border: 0;
}
.widget-notes-editor .pell-actionbar {
  min-height: 46px;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  padding: 7px 10px;
  border-bottom: 1px solid var(--ws-line,#e2e8f0);
  background: #fff;
}
.widget-notes-editor .pell-button {
  width: auto;
  min-width: 30px;
  height: 30px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 8px;
  border: 1px solid var(--ws-line,#dbe4ef);
  border-radius: 7px;
  background: #fff;
  color: var(--ws-text,#334155);
  font: 800 12px/1 inherit;
  cursor: pointer;
}
.widget-notes-editor .pell-button:hover,
.widget-notes-editor .pell-button-selected {
  background: var(--ws-accent-soft,#eff6ff);
  border-color: var(--ws-accent-line,#bfdbfe);
  color: var(--ws-accent-hover,#1d4ed8);
}
.widget-note-pell-swatch {
  content: "";
  width: 16px;
  height: 16px;
  display: block;
  margin: 0 auto;
  border-radius: 5px;
  border: 1px solid rgba(15, 23, 42, .12);
}
.widget-note-pell-swatch.is-yellow { background: #fef08a; }
.widget-note-pell-swatch.is-green { background: #bbf7d0; }
.widget-note-pell-swatch.is-blue { background: var(--ws-accent-hover,#1d4ed8); }
.widget-notes-footer {
  flex: 0 0 auto;
  display: flex;
  justify-content: flex-end;
  padding: 8px 10px;
  border-top: 1px solid var(--ws-line,#e2e8f0);
  background: #fff;
}
.widget-notes-delete {
  min-height: 30px;
  padding: 0 10px;
  border: 1px solid #fecaca;
  border-radius: 7px;
  background: #fff;
  color: #b91c1c;
  font: 800 12px/1 inherit;
  cursor: pointer;
}
.widget-notes-delete:hover {
  background: #fee2e2 !important;
  border-color: #fecaca !important;
  color: #b91c1c !important;
}
.widget-notes-editor .pell-content,
.widget-notes-editor.is-fallback {
  flex: 1;
  min-height: 0;
  padding: 18px 20px;
  color: var(--ws-ink,#0f172a);
  font-size: 14px;
  line-height: 1.55;
  overflow: auto;
  outline: none;
  word-break: normal;
  overflow-wrap: anywhere;
}
.widget-notes-editor .pell-content:focus,
.widget-notes-editor.is-fallback:focus { box-shadow: inset 0 0 0 2px rgba(37, 99, 235, .08); }
.widget-notes-editor .pell-content p,
.widget-notes-editor .pell-content div,
.widget-notes-editor.is-fallback p,
.widget-notes-editor.is-fallback div { margin: 0 0 10px; }
.widget-notes-editor .pell-content h1,
.widget-notes-editor .pell-content h2 {
  margin: 0 0 12px;
  color: var(--ws-ink,#0f172a);
  line-height: 1.2;
}
.widget-notes-editor .pell-content h1 { font-size: 22px; }
.widget-notes-editor .pell-content h2 { font-size: 18px; }
.widget-notes-editor .pell-content blockquote {
  margin: 0 0 12px;
  padding: 8px 12px;
  border-left: 3px solid var(--ws-accent-line,#bfdbfe);
  background: var(--ws-soft,#f8fafc);
  color: var(--ws-text,#475569);
}
.widget-notes-editor .pell-content ul,
.widget-notes-editor .pell-content ol,
.widget-notes-editor.is-fallback ul,
.widget-notes-editor.is-fallback ol { margin: 0 0 10px 20px; padding: 0; }
.widget-notes-editor .pell-content:empty::before,
.widget-notes-editor.is-fallback:empty::before {
  content: "Начните писать заметку...";
  color: var(--ws-subtle,#94a3b8);
}

.room-planner-modal {
  position: fixed;
  inset: 0;
  z-index: 7550;
  display: none;
  background: transparent;
  pointer-events: none;
}
.room-planner-modal.is-open { display: block; }
.room-planner-dialog {
  position: absolute;
  left: 22px;
  top: 22px;
  width: min(1320px, calc(100vw - 44px));
  height: min(840px, calc(100vh - 44px));
  min-width: min(780px, calc(100vw - 24px));
  min-height: min(520px, calc(100vh - 24px));
  display: flex;
  flex-direction: column;
  border: 1px solid var(--ws-line,#cfd9e6);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 24px 60px rgba(15, 23, 42, .24);
  overflow: hidden;
  pointer-events: auto;
}
.room-planner-modal.is-fullscreen .room-planner-dialog {
  inset: 12px !important;
  width: auto !important;
  height: auto !important;
  min-width: 0;
  min-height: 0;
}
.room-planner-head {
  height: 58px;
  display: grid;
  grid-template-columns: minmax(220px, 1fr) minmax(220px, 360px) auto;
  align-items: center;
  gap: 12px;
  padding: 9px 12px 9px 14px;
  border-bottom: 1px solid var(--ws-line,#e2e8f0);
  background: var(--ws-soft,#f8fafc);
  cursor: move;
  user-select: none;
  touch-action: none;
}
.room-planner-title {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 10px;
}
.room-planner-title-icon {
  width: 36px;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  background: var(--ws-accent-soft,#eff6ff);
  color: var(--ws-accent-hover,#1d4ed8);
  flex: 0 0 auto;
}
.room-planner-title-icon svg,
.room-planner-head-actions svg,
.room-planner-tools svg,
.room-planner-canvas-actions svg,
.room-planner-inspector-head svg { width: 18px; height: 18px; }
.room-planner-title strong {
  display: block;
  color: var(--ws-ink,#0f172a);
  font-size: 15px;
  line-height: 1.2;
}
.room-planner-title span:not(.room-planner-title-icon) {
  display: block;
  margin-top: 2px;
  color: var(--ws-muted,#64748b);
  font-size: 12px;
  line-height: 1.2;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.room-planner-project {
  min-width: 0;
  display: grid;
  grid-template-columns: 54px minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  color: var(--ws-muted,#64748b);
  font-size: 12px;
  font-weight: 800;
}
.room-planner-project select,
.room-planner-field input,
.room-planner-field select {
  width: 100%;
  min-width: 0;
  height: 36px;
  border: 1px solid var(--ws-line,#dbe4ef);
  border-radius: 7px;
  background: #fff;
  color: var(--ws-ink,#0f172a);
  font: 600 13px/1.2 inherit;
  padding: 0 10px;
}
.room-planner-field input[type="color"] {
  padding: 3px;
  cursor: pointer;
}
.room-planner-project select:focus,
.room-planner-field input:focus,
.room-planner-field select:focus {
  outline: none;
  border-color: var(--ws-accent-line,#93c5fd);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, .10);
}
.room-planner-head-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}
.room-planner-head-actions button,
.room-planner-canvas-actions button,
.room-planner-inspector-head button {
  width: 34px;
  height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--ws-line,#dbe4ef);
  border-radius: 8px;
  background: #fff;
  color: var(--ws-text,#475569);
  cursor: pointer;
}
.room-planner-head-actions button:hover,
.room-planner-canvas-actions button:hover,
.room-planner-inspector-head button:hover {
  background: var(--ws-accent-soft,#eef6ff);
  border-color: var(--ws-accent-line,#bfdbfe);
  color: var(--ws-accent-hover,#1d4ed8);
}
.room-planner-status {
  max-width: 168px;
  color: var(--ws-muted,#64748b);
  font-size: 12px;
  font-weight: 800;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.room-planner-status[data-status-type="error"],
.room-planner-canvas-status[data-status-type="error"] { color: #dc2626; }
.room-planner-status[data-status-type="success"],
.room-planner-canvas-status[data-status-type="success"] { color: #15803d; }
.room-planner-body {
  min-height: 0;
  flex: 1 1 auto;
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr) 260px;
  background: var(--ws-soft,#f5f7fb);
}
.room-planner-sidebar,
.room-planner-preview {
  min-width: 0;
  background: #fff;
}
.room-planner-sidebar {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 14px;
  border-right: 1px solid var(--ws-line,#e2e8f0);
  overflow: auto;
}
.room-planner-tools {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}
.room-planner-tools button {
  min-height: 64px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: 1px solid var(--ws-line,#dbe4ef);
  border-radius: 8px;
  background: #fff;
  color: var(--ws-text,#475569);
  font: 800 12px/1.15 inherit;
  cursor: pointer;
}
.room-planner-tools button:hover {
  border-color: var(--ws-accent-line,#bfdbfe);
  background: var(--ws-soft,#f8fbff);
  color: var(--ws-accent-hover,#1d4ed8);
}
.room-planner-tools button.is-active {
  border-color: var(--ws-accent,#2563eb);
  background: var(--ws-accent-soft,#eff6ff);
  color: var(--ws-accent-hover,#1d4ed8);
  box-shadow: inset 0 0 0 1px rgba(37, 99, 235, .16);
}
.room-planner-field {
  display: grid;
  gap: 6px;
  margin: 0;
}
.room-planner-field span {
  color: var(--ws-subtle,#94a3b8);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .04em;
  text-transform: uppercase;
}
.room-planner-inspector {
  display: grid;
  gap: 12px;
}
.room-planner-inspector-empty {
  display: grid;
  gap: 5px;
  padding: 12px;
  border: 1px dashed var(--ws-line-strong,#cbd5e1);
  border-radius: 8px;
  color: var(--ws-muted,#64748b);
  font-size: 13px;
}
.room-planner-inspector-empty strong { color: var(--ws-ink,#0f172a); font-size: 14px; }
.room-planner-inspector-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.room-planner-inspector-head strong {
  display: block;
  color: var(--ws-ink,#0f172a);
  font-size: 14px;
}
.room-planner-inspector-head span {
  display: block;
  max-width: 148px;
  margin-top: 2px;
  color: var(--ws-subtle,#94a3b8);
  font-size: 11px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.room-planner-inspector-fields {
  display: grid;
  gap: 10px;
}
.room-planner-stage {
  min-width: 0;
  min-height: 0;
  display: grid;
  grid-template-rows: 44px minmax(0, 1fr);
}
.room-planner-canvasbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 7px 10px;
  border-bottom: 1px solid var(--ws-line,#e2e8f0);
  background: #fff;
}
.room-planner-canvas-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}
.room-planner-canvas-status {
  color: var(--ws-muted,#64748b);
  font-size: 12px;
  font-weight: 800;
}
.room-planner-canvas-wrap {
  min-height: 0;
  position: relative;
  background: var(--ws-soft,#f8fafc);
}
.room-planner-canvas-wrap canvas {
  width: 100%;
  height: 100%;
  display: block;
  cursor: crosshair;
  touch-action: none;
}
.room-planner-preview {
  display: grid;
  grid-template-rows: auto minmax(180px, 1fr) auto;
  border-left: 1px solid var(--ws-line,#e2e8f0);
  min-height: 0;
}
.room-planner-preview-head {
  display: grid;
  gap: 2px;
  padding: 13px 14px;
  border-bottom: 1px solid var(--ws-line,#e2e8f0);
}
.room-planner-preview-head strong {
  color: var(--ws-ink,#0f172a);
  font-size: 14px;
}
.room-planner-preview-head span {
  min-height: 14px;
  color: var(--ws-muted,#64748b);
  font-size: 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.room-planner-preview canvas {
  width: 100%;
  height: 100%;
  min-height: 180px;
  display: block;
  background: var(--ws-soft,#f8fafc);
}
.room-planner-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  padding: 12px;
  border-top: 1px solid var(--ws-line,#e2e8f0);
  background: #fff;
}
.room-planner-summary span {
  min-width: 0;
  display: grid;
  gap: 2px;
  padding: 9px 7px;
  border: 1px solid var(--ws-line,#e2e8f0);
  border-radius: 8px;
  background: var(--ws-soft,#f8fafc);
}
.room-planner-summary b {
  color: var(--ws-ink,#0f172a);
  font-size: 13px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.room-planner-summary em {
  color: var(--ws-muted,#64748b);
  font-size: 10px;
  font-style: normal;
  font-weight: 800;
  text-transform: uppercase;
}
@media (max-width: 1040px) {
  .room-planner-head {
    grid-template-columns: minmax(180px, 1fr) minmax(190px, 280px) auto;
  }
  .room-planner-body {
    grid-template-columns: 190px minmax(0, 1fr);
  }
  .room-planner-preview {
    display: none;
  }
  .room-planner-tools {
    grid-template-columns: 1fr;
  }
}
@media (max-width: 760px) {
  .room-planner-modal.is-fullscreen .room-planner-dialog,
  .room-planner-dialog {
    inset: 8px !important;
    width: auto !important;
    height: auto !important;
    min-width: 0;
    min-height: 0;
  }
  .room-planner-head {
    height: auto;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: start;
  }
  .room-planner-project {
    grid-column: 1 / -1;
    grid-template-columns: 48px minmax(0, 1fr);
    order: 3;
  }
  .room-planner-head-actions {
    align-self: center;
  }
  .room-planner-status {
    display: none;
  }
  .room-planner-body {
    grid-template-columns: 1fr;
    grid-template-rows: auto minmax(0, 1fr);
  }
  .room-planner-sidebar {
    max-height: 190px;
    border-right: 0;
    border-bottom: 1px solid var(--ws-line,#e2e8f0);
  }
  .room-planner-tools {
    grid-template-columns: repeat(5, minmax(56px, 1fr));
  }
  .room-planner-tools button {
    min-height: 54px;
  }
  .room-planner-tools button span {
    display: none;
  }
}

.room-planner-body.is-blueprint {
  grid-template-columns: 270px minmax(0, 1fr);
  background: var(--ws-soft,#f8fafc);
}
.room-planner-body.is-blueprint .room-planner-sidebar {
  gap: 12px;
  padding: 12px;
}
.room-planner-blueprint-main {
  min-width: 0;
  min-height: 0;
  display: grid;
  grid-template-rows: 44px minmax(0, 1fr);
  background: #fff;
}
.bp3d-section {
  display: grid;
  gap: 8px;
}
.bp3d-section-title {
  color: var(--ws-text,#475569);
  font-size: 12px;
  font-weight: 800;
}
.bp3d-tabs {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}
.bp3d-view-tabs {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
.bp3d-tabs button {
  min-height: 56px;
  padding: 8px 6px;
}
.bp3d-tabs svg {
  flex: 0 0 auto;
}
.bp3d-floor-panel {
  display: grid;
  gap: 9px;
}
.bp3d-floor-actions {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}
.bp3d-floor-actions button {
  min-height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--ws-line,#dbe4ef);
  border-radius: 8px;
  background: #fff;
  color: var(--ws-text,#475569);
  cursor: pointer;
}
.bp3d-floor-actions button:hover {
  background: var(--ws-accent-soft,#eef6ff);
  border-color: var(--ws-accent-line,#bfdbfe);
  color: var(--ws-accent-hover,#1d4ed8);
}
.bp3d-floor-actions svg {
  width: 18px;
  height: 18px;
}
.bp3d-item-list,
.bp3d-items-grid {
  min-height: 0;
  display: grid;
  gap: 8px;
}
.bp3d-item-list {
  max-height: 300px;
  overflow: auto;
  padding-right: 2px;
}
.bp3d-items-grid {
  height: 100%;
  overflow: auto;
  grid-template-columns: repeat(auto-fill, minmax(188px, 1fr));
  align-content: start;
  padding: 14px;
}
.bp3d-item {
  min-width: 0;
  min-height: 64px;
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) 26px;
  align-items: center;
  gap: 10px;
  border: 1px solid var(--ws-line,#dbe4ef);
  border-radius: 8px;
  background: #fff;
  color: var(--ws-ink,#0f172a);
  padding: 8px;
  text-align: left;
  cursor: pointer;
}
.bp3d-item:hover {
  border-color: var(--ws-accent-line,#bfdbfe);
  background: var(--ws-soft,#f8fbff);
  box-shadow: 0 10px 22px rgba(15, 23, 42, .06);
}
.bp3d-item-thumb {
  width: 44px;
  height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  border-radius: 7px;
  background: var(--ws-canvas,#f1f5f9);
}
.bp3d-item-thumb img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}
.bp3d-item-text {
  min-width: 0;
  display: grid;
  gap: 2px;
}
.bp3d-item-text strong,
.bp3d-item-text em {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.bp3d-item-text strong {
  font-size: 13px;
  font-weight: 800;
}
.bp3d-item-text em {
  color: var(--ws-muted,#64748b);
  font-size: 11px;
  font-style: normal;
}
.bp3d-item-plus {
  width: 26px;
  height: 26px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 7px;
  background: var(--ws-accent-soft,#eff6ff);
  color: var(--ws-accent-hover,#1d4ed8);
}
.bp3d-item-plus svg {
  width: 16px;
  height: 16px;
}
.bp3d-context {
  padding-top: 2px;
}
.bp3d-inspector-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}
.bp3d-inspector-card {
  min-width: 0;
  min-height: 58px;
  display: grid;
  align-content: center;
  gap: 2px;
  border: 1px solid var(--ws-line,#e2e8f0);
  border-radius: 8px;
  background: #fff;
  padding: 8px;
}
.bp3d-inspector-card b,
.bp3d-inspector-card em,
.bp3d-inspector-card small {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.bp3d-inspector-card b {
  color: var(--ws-ink,#0f172a);
  font-size: 13px;
  line-height: 1.15;
}
.bp3d-inspector-card em {
  color: var(--ws-muted,#64748b);
  font-size: 10px;
  font-style: normal;
  font-weight: 800;
  text-transform: uppercase;
}
.bp3d-inspector-card small {
  color: var(--ws-subtle,#94a3b8);
  font-size: 10px;
}
.bp3d-inspector-list {
  display: grid;
  gap: 6px;
}
.bp3d-inspector-list span {
  min-width: 0;
  min-height: 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  border-radius: 7px;
  background: var(--ws-soft,#f8fafc);
  padding: 7px 8px;
  color: var(--ws-muted,#64748b);
  font-size: 12px;
}
.bp3d-inspector-list b,
.bp3d-inspector-list em {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.bp3d-inspector-list b {
  color: var(--ws-text,#334155);
}
.bp3d-inspector-list em {
  font-style: normal;
  font-weight: 800;
  text-align: right;
}
.bp3d-check {
  min-height: 36px;
  display: flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--ws-line,#dbe4ef);
  border-radius: 8px;
  background: #fff;
  color: var(--ws-text,#334155);
  font-size: 12px;
  font-weight: 800;
  padding: 8px 10px;
}
.bp3d-check input {
  width: 16px;
  height: 16px;
  flex: 0 0 auto;
}
.bp3d-topbar {
  min-width: 0;
}
.bp3d-topbar [hidden] {
  display: none !important;
}
.bp3d-camera-actions {
  overflow-x: auto;
  max-width: min(420px, 48vw);
}
.bp3d-view-shell {
  position: relative;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  background: var(--ws-canvas,#eef2f7);
}
.bp3d-view {
  position: absolute;
  inset: 0;
  display: none;
  min-width: 0;
  min-height: 0;
}
.bp3d-view.is-active {
  display: block;
}
.bp3d-viewer,
.bp3d-canvas {
  width: 100%;
  height: 100%;
  display: block;
}
.bp3d-viewer {
  background: var(--ws-line,#dbe4ef);
}
.bp3d-house-canvas {
  width: 100%;
  height: 100%;
  display: block;
  background: var(--ws-soft,#f8fafc);
}
.bp3d-house-panel {
  position: absolute;
  right: 14px;
  top: 14px;
  width: min(320px, calc(100% - 28px));
  display: grid;
  gap: 8px;
  border: 1px solid rgba(203, 213, 225, .92);
  border-radius: 8px;
  background: rgba(255, 255, 255, .94);
  box-shadow: 0 16px 36px rgba(15, 23, 42, .12);
  padding: 12px;
}
.bp3d-house-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.bp3d-house-panel-head strong {
  color: var(--ws-ink,#0f172a);
  font-size: 14px;
}
.bp3d-house-panel-head span {
  color: var(--ws-muted,#64748b);
  font-size: 12px;
  font-weight: 800;
}
.bp3d-viewer canvas {
  width: 100% !important;
  height: 100% !important;
  display: block;
}
.bp3d-canvas {
  background: #fff;
  cursor: crosshair;
  touch-action: none;
}
.bp3d-calculations {
  height: 100%;
  min-height: 0;
  overflow: auto;
  padding: 14px;
  background: var(--ws-soft,#f8fafc);
}
.bp3d-calc-head {
  min-height: 48px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 12px;
}
.bp3d-calc-head strong,
.bp3d-calc-room header strong {
  display: block;
  color: var(--ws-ink,#0f172a);
  font-size: 15px;
  line-height: 1.25;
}
.bp3d-calc-head span,
.bp3d-calc-room header span {
  display: block;
  margin-top: 2px;
  color: var(--ws-muted,#64748b);
  font-size: 12px;
}
.bp3d-settings-panel {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 8px;
  margin-bottom: 12px;
}
.bp3d-setting-field,
.bp3d-ceiling-field {
  width: 100%;
  min-height: 38px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 86px auto;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--ws-line,#dbe4ef);
  border-radius: 8px;
  background: #fff;
  padding: 7px 9px;
  color: var(--ws-text,#475569);
  font-size: 12px;
  font-weight: 800;
}
.bp3d-setting-field input,
.bp3d-setting-field select,
.bp3d-ceiling-field input {
  width: 100%;
  min-width: 0;
  height: 28px;
  border: 1px solid var(--ws-line,#dbe4ef);
  border-radius: 7px;
  background: #fff;
  color: var(--ws-ink,#0f172a);
  font: 700 13px/1.2 inherit;
  padding: 0 8px;
}
.bp3d-setting-field input:focus,
.bp3d-setting-field select:focus,
.bp3d-ceiling-field input:focus {
  outline: none;
  border-color: var(--ws-accent-line,#93c5fd);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, .10);
}
.bp3d-setting-field em,
.bp3d-ceiling-field em {
  color: var(--ws-muted,#64748b);
  font-style: normal;
}
.bp3d-calc-summary,
.bp3d-calc-room-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(142px, 1fr));
  gap: 8px;
}
.bp3d-calc-summary {
  margin-bottom: 12px;
}
.bp3d-calc-card {
  min-width: 0;
  min-height: 72px;
  display: grid;
  align-content: center;
  gap: 3px;
  border: 1px solid var(--ws-line,#e2e8f0);
  border-radius: 8px;
  background: #fff;
  padding: 10px;
}
.bp3d-calc-card b,
.bp3d-calc-card em,
.bp3d-calc-card small {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.bp3d-calc-card b {
  color: var(--ws-ink,#0f172a);
  font-size: 16px;
  line-height: 1.15;
}
.bp3d-calc-card em {
  color: var(--ws-muted,#64748b);
  font-size: 11px;
  font-style: normal;
  font-weight: 800;
  text-transform: uppercase;
}
.bp3d-calc-card small {
  color: var(--ws-subtle,#94a3b8);
  font-size: 11px;
}
.bp3d-calc-rooms {
  display: grid;
  gap: 10px;
}
.bp3d-calc-room {
  display: grid;
  gap: 10px;
  border: 1px solid var(--ws-line,#e2e8f0);
  border-radius: 8px;
  background: #fff;
  padding: 12px;
}
.bp3d-calc-room header {
  min-width: 0;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}
.bp3d-calc-room-grid {
  grid-template-columns: repeat(auto-fit, minmax(132px, 1fr));
}
.bp3d-calc-room-grid .bp3d-calc-card {
  min-height: 58px;
  border: 0;
  border-radius: 0;
  background: transparent;
  border-top: 1px solid var(--ws-canvas,#edf2f7);
  padding: 9px 0 0;
}
.bp3d-calc-room-grid .bp3d-calc-card b {
  font-size: 14px;
}
.bp3d-calc-wall-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 6px;
}
.bp3d-calc-wall-list span {
  min-width: 0;
  min-height: 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  border-radius: 7px;
  background: var(--ws-soft,#f8fafc);
  padding: 7px 9px;
  color: var(--ws-muted,#64748b);
  font-size: 12px;
}
.bp3d-calc-wall-list b,
.bp3d-calc-wall-list em {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.bp3d-calc-wall-list b {
  color: var(--ws-text,#334155);
}
.bp3d-calc-wall-list em {
  font-style: normal;
  font-weight: 800;
}
.bp3d-calc-empty {
  min-height: 180px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px dashed var(--ws-line-strong,#cbd5e1);
  border-radius: 8px;
  background: #fff;
  color: var(--ws-muted,#64748b);
  font-size: 13px;
  font-weight: 800;
}
.bp3d-loading {
  position: absolute;
  inset: 0;
  z-index: 3;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  background: rgba(248, 250, 252, .84);
  color: var(--ws-text,#334155);
  font-size: 13px;
  font-weight: 800;
}
.bp3d-loading[hidden] {
  display: none !important;
}
.bp3d-loading b {
  width: 22px;
  height: 22px;
  border: 3px solid var(--ws-accent-line,#bfdbfe);
  border-top-color: var(--ws-accent,#2563eb);
  border-radius: 50%;
  animation: bp3d-spin .8s linear infinite;
}
@keyframes bp3d-spin {
  to { transform: rotate(360deg); }
}

@media (max-width: 1040px) {
  .room-planner-body.is-blueprint {
    grid-template-columns: 230px minmax(0, 1fr);
  }
  .bp3d-tabs {
    grid-template-columns: 1fr;
  }
  .bp3d-view-tabs {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .bp3d-camera-actions {
    max-width: min(320px, 44vw);
  }
}
@media (max-width: 760px) {
  .room-planner-body.is-blueprint {
    grid-template-columns: 1fr;
    grid-template-rows: minmax(174px, 224px) minmax(0, 1fr);
  }
  .room-planner-body.is-blueprint .room-planner-sidebar {
    max-height: none;
    overflow: auto;
  }
  .room-planner-blueprint-main {
    grid-template-rows: auto minmax(0, 1fr);
  }
  .bp3d-topbar {
    flex-wrap: wrap;
    align-items: center;
  }
  .bp3d-tabs {
    grid-template-columns: repeat(3, minmax(54px, 1fr));
  }
  .bp3d-view-tabs {
    grid-template-columns: repeat(2, minmax(48px, 1fr));
  }
  .bp3d-camera-actions {
    max-width: 100%;
  }
  .bp3d-items-grid {
    grid-template-columns: 1fr;
  }
  .bp3d-house-panel {
    left: 10px;
    right: 10px;
    top: 10px;
    width: auto;
  }
  .bp3d-calculations {
    padding: 10px;
  }
  .bp3d-calc-head {
    align-items: stretch;
    flex-direction: column;
  }
  .bp3d-setting-field,
  .bp3d-ceiling-field {
    width: 100%;
  }
}

.sheet-widget-modal {
  position: fixed;
  inset: 0;
  z-index: 7600;
  display: none;
  padding: 0;
  background: transparent;
  pointer-events: none;
}
.sheet-widget-modal.is-open { display: block; }
body.sheet-widget-open [data-radix-portal],
body.sheet-widget-open [data-radix-popper-content-wrapper],
body.sheet-widget-open #univer-popup-portal,
body.sheet-widget-open #univer-popup-portal [data-u-comp],
body.sheet-widget-open #univer-popup-portal [class*="univer-"],
body.sheet-widget-open [class*="univer-popup"],
body.sheet-widget-open [class*="univer-popup-portal"],
body.sheet-widget-open [class*="univer-popup-portal"] [class*="univer-"],
body.sheet-widget-open [class*="univer-z-"],
body.sheet-widget-open [class*="univer-menu"],
body.sheet-widget-open [class*="univer-popover"],
body.sheet-widget-open [class*="univer-dropdown"],
body.sheet-widget-open [class*="univer-tooltip"],
body.sheet-widget-open [class*="univer"][role="menu"],
body.sheet-widget-open [class*="univer"][role="listbox"],
body.sheet-widget-open [class*="univer"][style*="z-index"] {
  z-index: 7805 !important;
}
.sheet-widget-dialog {
  position: absolute;
  left: 22px;
  top: 22px;
  width: min(1180px, calc(100vw - 44px));
  height: min(760px, calc(100vh - 44px));
  min-width: min(520px, calc(100vw - 24px));
  min-height: min(260px, calc(100vh - 24px));
  max-width: calc(100vw - 24px);
  max-height: calc(100vh - 24px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  resize: both;
  border: 1px solid rgba(148, 163, 184, .36);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 28px 72px rgba(15, 23, 42, .28);
  pointer-events: auto;
}
.sheet-widget-modal.is-fullscreen .sheet-widget-dialog {
  left: 0 !important;
  top: 0 !important;
  width: 100vw !important;
  height: 100vh !important;
  min-width: 0;
  min-height: 0;
  max-width: none;
  max-height: none;
  resize: none;
  border-radius: 0;
}
.sheet-widget-modal.is-minimized .sheet-widget-dialog {
  height: auto !important;
  min-height: 0;
  resize: none;
}
.sheet-widget-modal.is-minimized .sheet-widget-body,
.sheet-widget-modal.is-minimized .sheet-widget-header-tools { display: none !important; }
.sheet-widget-head {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 14px;
  min-height: 58px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--ws-line,#dbe4ef);
  background: var(--ws-soft,#f8fafc);
  cursor: move;
  user-select: none;
}
.sheet-widget-dialog.is-dragging { opacity: .98; }
.sheet-widget-head button,
.sheet-widget-head input { cursor: auto; }
.sheet-widget-title {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1 1 auto;
  min-width: 0;
}
.sheet-widget-title-icon,
.sheet-widget-row-icon,
.sheet-widget-empty-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #0f766e;
}
.sheet-widget-title-icon {
  flex: 0 0 auto;
  width: 34px;
  height: 34px;
  border: 1px solid #ccfbf1;
  border-radius: 8px;
  background: #f0fdfa;
}
.sheet-widget-title-icon svg,
.sheet-widget-row-icon svg,
.sheet-widget-empty-icon svg,
.sheet-widget-window-actions svg,
.sheet-widget-toolbar svg,
.sheet-widget-header-tools svg,
.sheet-widget-row-actions svg,
.sheet-icon-btn svg {
  width: 18px;
  height: 18px;
  display: block;
  flex: 0 0 auto;
}
.sheet-widget-title strong {
  display: block;
  overflow: hidden;
  color: var(--ws-ink,#0f172a);
  font-size: 15px;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.sheet-widget-title > div > span {
  display: block;
  margin-top: 2px;
  overflow: hidden;
  color: var(--ws-muted,#64748b);
  font-size: 12px;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.sheet-widget-window-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 0 0 auto;
}
.sheet-widget-header-tools {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
  min-width: 0;
}
.sheet-widget-header-tools .sheet-editor-back-btn {
  order: -1;
  padding-inline: 12px;
}
.sheet-widget-header-tools .sheet-ai-head-btn.is-active {
  border-color: var(--ws-accent-line,#bfdbfe);
  background: var(--ws-accent-soft,#eff6ff);
  color: var(--ws-accent,#0b63ce);
}
.sheet-widget-header-tools[hidden] { display: none !important; }
.sheet-widget-header-tools .sheet-widget-status {
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.sheet-widget-window-actions button,
.sheet-icon-btn {
  width: 34px;
  height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--ws-line,#dbe4ef);
  border-radius: 8px;
  background: #fff;
  color: var(--ws-text,#475569);
  cursor: pointer;
}
.sheet-widget-window-actions button:hover,
.sheet-icon-btn:hover { background: var(--ws-accent-soft,#eef6ff); border-color: var(--ws-accent-line,#bfdbfe); color: var(--ws-accent-hover,#1d4ed8); }
.sheet-icon-btn.danger:hover { background: #fee2e2; border-color: #fecaca; color: #b91c1c; }
.sheet-widget-body {
  flex: 1 1 auto;
  min-height: 0;
  background: var(--ws-soft,#f8fafc);
}
.sheet-widget-home,
.sheet-widget-editor {
  height: 100%;
  min-height: 0;
}
.sheet-widget-home[hidden],
.sheet-widget-editor[hidden] { display: none !important; }
.sheet-widget-home {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 14px;
}
.sheet-widget-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  flex-wrap: wrap;
}
.sheet-widget-toolbar button,
.sheet-widget-header-tools button,
.sheet-widget-row-actions button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 34px;
}
.sheet-widget-status {
  min-height: 18px;
  color: var(--ws-muted,#64748b);
  font-size: 12px;
}
.sheet-widget-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  overflow: auto;
  padding-right: 2px;
}
.sheet-widget-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 260px;
  border: 1px dashed var(--ws-line-strong,#cbd5e1);
  border-radius: 8px;
  background: #fff;
  color: var(--ws-muted,#64748b);
  text-align: center;
  padding: 22px;
}
.sheet-widget-empty-icon {
  width: 46px;
  height: 46px;
  border-radius: 8px;
  background: #ecfdf5;
}
.sheet-widget-empty strong { color: var(--ws-ink,#0f172a); font-size: 16px; }
.sheet-widget-empty span { max-width: 440px; font-size: 13px; line-height: 1.45; }
.sheet-widget-row {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--ws-line,#e2e8f0);
  border-radius: 8px;
  background: #fff;
}
.sheet-widget-row:hover { border-color: var(--ws-accent-line,#bfdbfe); box-shadow: 0 10px 24px rgba(15, 23, 42, .06); }
.sheet-widget-row-icon {
  width: 42px;
  height: 42px;
  border-radius: 8px;
  background: #f0fdfa;
}
.sheet-widget-row-main { min-width: 0; }
.sheet-widget-row-main strong,
.sheet-widget-row-main span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.sheet-widget-row-main strong { color: var(--ws-ink,#0f172a); font-size: 14px; }
.sheet-widget-row-main span { margin-top: 3px; color: var(--ws-muted,#64748b); font-size: 12px; }
.sheet-widget-row-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
}
.sheet-widget-search {
  width: min(360px, 100%);
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 0 10px;
  border: 1px solid var(--ws-line,#dbe4ef);
  border-radius: 8px;
  background: #fff;
  color: var(--ws-muted,#64748b);
}
.sheet-widget-search svg { width: 17px; height: 17px; flex: 0 0 auto; }
.sheet-widget-search input {
  width: 100%;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ws-ink,#0f172a);
  font: inherit;
}
.sheet-widget-pagination {
  min-height: 38px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: var(--ws-muted,#64748b);
  font-size: 12px;
}
.sheet-widget-page-actions {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.sheet-widget-page-actions strong { color: var(--ws-text,#334155); font-size: 12px; }
.sheet-widget-page-actions button:disabled {
  opacity: .45;
  cursor: default;
}
.sheet-widget-submodal {
  position: absolute;
  inset: 0;
  z-index: 3;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
  background: rgba(15, 23, 42, .38);
  pointer-events: auto;
}
.sheet-widget-dialog-card {
  width: min(520px, 100%);
  max-height: min(680px, calc(100vh - 80px));
  display: flex;
  flex-direction: column;
  gap: 14px;
  overflow: hidden;
  border: 1px solid var(--ws-line,#dbe4ef);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 24px 64px rgba(15, 23, 42, .26);
  padding: 16px;
}
.sheet-widget-dialog-card-sm { width: min(430px, 100%); }
.sheet-widget-dialog-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}
.sheet-widget-dialog-head strong {
  display: block;
  color: var(--ws-ink,#0f172a);
  font-size: 16px;
  line-height: 1.25;
}
.sheet-widget-dialog-head span {
  display: block;
  margin-top: 3px;
  color: var(--ws-muted,#64748b);
  font-size: 12px;
}
.sheet-widget-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  color: var(--ws-text,#475569);
  font-size: 12px;
  font-weight: 700;
}
.sheet-widget-field input {
  height: 38px;
  border: 1px solid var(--ws-line,#dbe4ef);
  border-radius: 8px;
  padding: 0 10px;
  color: var(--ws-ink,#0f172a);
  font: inherit;
  font-weight: 500;
}
.sheet-widget-field input:focus {
  outline: 2px solid rgba(37, 99, 235, .16);
  border-color: var(--ws-accent-line,#93c5fd);
}
.sheet-widget-dialog-text {
  margin: 0;
  color: var(--ws-text,#475569);
  font-size: 13px;
  line-height: 1.45;
}
.sheet-widget-dialog-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}
.sheet-widget-access-card { width: min(620px, 100%); }
.sheet-widget-access-options {
  display: grid;
  gap: 8px;
}
.sheet-widget-access-options label {
  min-height: 36px;
  display: flex;
  align-items: center;
  gap: 9px;
  border: 1px solid var(--ws-line,#e2e8f0);
  border-radius: 8px;
  background: var(--ws-soft,#f8fafc);
  padding: 8px 10px;
  color: var(--ws-text,#334155);
  font-size: 13px;
  font-weight: 700;
}
.sheet-widget-members {
  max-height: 240px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  overflow: auto;
  border: 1px solid var(--ws-line,#e2e8f0);
  border-radius: 8px;
  padding: 8px;
}
.sheet-widget-member-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  border-radius: 7px;
  padding: 7px 8px;
}
.sheet-widget-member-row:hover { background: var(--ws-soft,#f8fafc); }
.sheet-widget-member-row span { min-width: 0; }
.sheet-widget-member-row strong,
.sheet-widget-member-row small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.sheet-widget-member-row strong { color: var(--ws-ink,#0f172a); font-size: 13px; }
.sheet-widget-member-row small { color: var(--ws-muted,#64748b); font-size: 12px; }
.sheet-widget-members-empty {
  padding: 12px;
  color: var(--ws-muted,#64748b);
  font-size: 13px;
  text-align: center;
}
.sheet-widget-editor {
  display: flex;
  flex-direction: column;
  background: #fff;
}
.sheet-editor-shell {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  overflow: hidden;
  background: #fff;
}
.sheet-univer-host {
  position: relative;
  flex: 1 1 auto;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  background: #fff;
}
.sheet-ai-univer-btn {
  position: absolute;
  top: 8px;
  right: 10px;
  z-index: 7810;
  height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 0 10px;
  border: 1px solid var(--ws-accent-line,#bfdbfe);
  border-radius: 7px;
  background: var(--ws-accent-soft,#eff6ff);
  color: var(--ws-accent,#0b63ce);
  font-size: 12px;
  font-weight: 800;
  line-height: 1;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(37, 99, 235, .12);
}
.sheet-ai-univer-btn:hover,
.sheet-ai-univer-btn.is-active {
  border-color: var(--ws-accent-line,#93c5fd);
  background: var(--ws-accent-line,#dbeafe);
  color: var(--ws-accent-hover,#084fab);
}
.sheet-ai-univer-btn svg {
  width: 15px;
  height: 15px;
  display: block;
}
.sheet-ai-panel {
  position: relative;
  flex: 0 0 var(--sheet-ai-panel-width, 350px);
  width: var(--sheet-ai-panel-width, 350px);
  min-width: min(320px, 100%);
  max-width: min(680px, 65vw);
  min-height: 0;
  display: flex;
  flex-direction: column;
  border-left: 1px solid var(--ws-line,#dbe4ef);
  background: var(--ws-soft,#f8fafc);
}
.sheet-ai-panel[hidden] { display: none !important; }
.sheet-ai-resizer {
  position: absolute;
  top: 0;
  bottom: 0;
  left: -5px;
  z-index: 2;
  width: 10px;
  cursor: col-resize;
  touch-action: none;
}
.sheet-ai-resizer::before {
  content: "";
  position: absolute;
  top: 12px;
  bottom: 12px;
  left: 4px;
  width: 2px;
  border-radius: 999px;
  background: transparent;
}
.sheet-ai-resizer:hover::before,
.sheet-widget-modal.is-sheet-ai-resizing .sheet-ai-resizer::before {
  background: var(--ws-accent-line,#93c5fd);
}
.sheet-widget-modal.is-sheet-ai-resizing,
.sheet-widget-modal.is-sheet-ai-resizing * {
  cursor: col-resize !important;
  user-select: none;
}
.sheet-ai-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 54px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--ws-line,#dbe4ef);
  background: #fff;
}
.sheet-ai-panel-head strong,
.sheet-ai-panel-head span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.sheet-ai-panel-head strong {
  color: var(--ws-ink,#0f172a);
  font-size: 14px;
  line-height: 1.25;
}
.sheet-ai-panel-head span {
  margin-top: 2px;
  color: var(--ws-muted,#64748b);
  font-size: 12px;
}
.sheet-ai-usage {
  display: grid;
  gap: 8px;
  padding: 10px 12px 11px;
  border-bottom: 1px solid var(--ws-line,#dbe4ef);
  background: #fff;
}
.sheet-ai-usage-loading,
.sheet-ai-usage-error,
.sheet-ai-usage-note {
  color: var(--ws-muted,#64748b);
  font-size: 12px;
  line-height: 1.35;
}
.sheet-ai-usage-error {
  color: #b91c1c;
}
.sheet-ai-usage-top,
.sheet-ai-usage-line,
.sheet-ai-usage-sources span {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-width: 0;
}
.sheet-ai-usage-top div {
  min-width: 0;
  display: grid;
  gap: 2px;
}
.sheet-ai-usage-top span,
.sheet-ai-usage-top em,
.sheet-ai-usage-line,
.sheet-ai-usage-sources {
  color: var(--ws-muted,#64748b);
  font-size: 12px;
  line-height: 1.35;
}
.sheet-ai-usage-top em {
  font-style: normal;
  white-space: nowrap;
}
.sheet-ai-usage-top b {
  color: var(--ws-ink,#0f172a);
  font-size: 18px;
  line-height: 1.05;
}
.sheet-ai-usage-progress {
  height: 5px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--ws-line,#e2e8f0);
}
.sheet-ai-usage-progress span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--ws-accent,#2563eb);
}
.sheet-ai-usage-sources {
  display: grid;
  gap: 4px;
}
.sheet-ai-usage-sources span {
  padding: 5px 7px;
  border: 1px solid var(--ws-canvas,#edf2f7);
  border-radius: 7px;
  background: var(--ws-soft,#f8fafc);
}
.sheet-ai-usage-sources b,
.sheet-ai-usage-sources em {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.sheet-ai-usage-sources b {
  color: var(--ws-text,#334155);
  font-size: 11px;
}
.sheet-ai-usage-sources em {
  color: var(--ws-ink,#0f172a);
  font-style: normal;
  font-weight: 800;
  font-size: 11px;
}
.sheet-ai-usage-pay {
  min-height: 30px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  border: 1px solid var(--ws-accent,#0f62d8);
  border-radius: 8px;
  background: var(--ws-accent,#0b63ce);
  color: #fff;
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
}
.sheet-ai-usage-pay svg {
  width: 15px;
  height: 15px;
}
.sheet-ai-messages {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
  overflow: auto;
  padding: 12px;
}
.sheet-ai-empty {
  margin: auto;
  display: grid;
  justify-items: center;
  gap: 8px;
  color: var(--ws-muted,#64748b);
  text-align: center;
}
.sheet-ai-empty span {
  width: 38px;
  height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--ws-accent-line,#bfdbfe);
  border-radius: 8px;
  background: var(--ws-accent-soft,#eff6ff);
  color: var(--ws-accent,#0b63ce);
}
.sheet-ai-empty svg { width: 19px; height: 19px; }
.sheet-ai-empty strong { color: var(--ws-ink,#0f172a); font-size: 14px; }
.sheet-ai-message {
  display: flex;
  align-items: flex-start;
}
.sheet-ai-message.is-user { justify-content: flex-end; }
.sheet-ai-bubble {
  max-width: 100%;
  border: 1px solid var(--ws-line,#e2e8f0);
  border-radius: 8px;
  background: #fff;
  padding: 9px 10px;
  color: var(--ws-text,#334155);
  font-size: 13px;
  line-height: 1.45;
  box-shadow: 0 8px 20px rgba(15, 23, 42, .04);
}
.sheet-ai-message.is-user .sheet-ai-bubble {
  border-color: var(--ws-accent-line,#bfdbfe);
  background: var(--ws-accent-soft,#eff6ff);
  color: var(--ws-ink,#0f172a);
}
.sheet-ai-message.is-error .sheet-ai-bubble {
  border-color: #fecaca;
  background: #fef2f2;
  color: #991b1b;
}
.sheet-ai-bubble p { margin: 0; white-space: pre-wrap; }
.sheet-ai-warnings {
  margin: 8px 0 0;
  padding-left: 18px;
  color: #9a3412;
}
.sheet-ai-op {
  margin-top: 9px;
  overflow: hidden;
  border: 1px solid var(--ws-line,#dbe4ef);
  border-radius: 7px;
  background: var(--ws-soft,#f8fafc);
}
.sheet-ai-op-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 7px 8px;
  border-bottom: 1px solid var(--ws-line,#e2e8f0);
}
.sheet-ai-op-head strong,
.sheet-ai-op strong {
  color: var(--ws-ink,#0f172a);
  font-size: 12px;
}
.sheet-ai-op-head span,
.sheet-ai-op > span {
  color: var(--ws-muted,#64748b);
  font-size: 11px;
}
.sheet-ai-op > strong,
.sheet-ai-op > span {
  display: block;
  padding: 7px 8px;
}
.sheet-ai-op > span { padding-top: 0; }
.sheet-ai-preview-table-wrap {
  max-height: 170px;
  overflow: auto;
}
.sheet-ai-preview-table-wrap table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
  background: #fff;
}
.sheet-ai-preview-table-wrap td {
  max-width: 120px;
  overflow: hidden;
  padding: 5px 6px;
  border-right: 1px solid var(--ws-line,#e2e8f0);
  border-bottom: 1px solid var(--ws-line,#e2e8f0);
  color: var(--ws-text,#334155);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.sheet-ai-preview-table-wrap tr:first-child td {
  background: var(--ws-accent-soft,#eff6ff);
  color: var(--ws-ink,#0f172a);
  font-weight: 800;
}
.sheet-ai-message-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 9px;
}
.sheet-ai-message-actions button {
  min-height: 30px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 0 10px;
  border: 1px solid var(--ws-accent,#1d63c8);
  border-radius: 7px;
  background: var(--ws-accent,#0b63ce);
  color: #fff;
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
}
.sheet-ai-message-actions button:disabled {
  border-color: #bbf7d0;
  background: #dcfce7;
  color: #166534;
  cursor: default;
}
.sheet-ai-message-actions svg { width: 15px; height: 15px; display: block; }
.sheet-ai-composer {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 42px;
  gap: 10px;
  padding: 10px;
  border-top: 1px solid var(--ws-line,#dbe4ef);
  background: #fff;
}
.sheet-ai-composer textarea {
  width: 100%;
  max-height: 150px;
  min-height: 40px;
  resize: none;
  border: 1px solid var(--ws-line-strong,#cbd5e1);
  border-radius: 8px;
  padding: 9px 10px;
  color: var(--ws-ink,#0f172a);
  font-size: 13px;
  line-height: 1.35;
  outline: none;
}
.sheet-ai-composer textarea:focus {
  border-color: var(--ws-accent-line,#93c5fd);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, .12);
}
.sheet-ai-composer button {
  width: 42px;
  height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--ws-accent,#0f62d8);
  border-radius: 10px;
  background: linear-gradient(180deg, var(--ws-accent,#2f86ff) 0%, var(--ws-accent,#0f66df) 100%);
  color: #fff;
  cursor: pointer;
  box-shadow: 0 8px 18px rgba(15, 102, 223, .24);
  transition: transform .15s ease, box-shadow .15s ease, background .15s ease;
}
.sheet-ai-composer button:hover:not(:disabled) {
  background: linear-gradient(180deg, var(--ws-accent,#4392ff) 0%, var(--ws-accent,#0b5fda) 100%);
  box-shadow: 0 10px 22px rgba(15, 102, 223, .32);
  transform: translateY(-1px);
}
.sheet-ai-composer button:active:not(:disabled) { transform: translateY(0); }
.sheet-ai-composer button:focus-visible {
  outline: 3px solid rgba(47, 134, 255, .24);
  outline-offset: 2px;
}
.sheet-ai-composer button:disabled { opacity: .65; cursor: default; box-shadow: none; }
.sheet-ai-composer button svg { width: 19px; height: 19px; display: block; }
.sheet-widget-modal.is-sheet-ai-busy .sheet-ai-panel {
  cursor: progress;
}
.sheet-univer-loading {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--ws-muted,#64748b);
  font-size: 14px;
}

body.doc-widget-open [data-radix-portal],
body.doc-widget-open [data-radix-popper-content-wrapper],
body.doc-widget-open [role="dialog"][data-state],
body.doc-widget-open [role="listbox"][data-state],
body.doc-widget-open [style*="z-index"] {
  z-index: 7805 !important;
}
.doc-widget-modal .sheet-widget-title-icon,
.doc-widget-modal .sheet-widget-row-icon,
.doc-widget-modal .sheet-widget-empty-icon {
  color: var(--ws-accent-hover,#1d4ed8);
}
.doc-widget-modal .sheet-widget-title-icon,
.doc-widget-modal .sheet-widget-row-icon {
  border-color: var(--ws-accent-line,#dbeafe);
  background: var(--ws-accent-soft,#eff6ff);
}
.doc-widget-modal .sheet-widget-empty-icon {
  background: var(--ws-accent-soft,#eff6ff);
}
.doc-editor-shell {
  background: var(--ws-canvas,#eef2f7);
}
.doc-editor-host {
  position: relative;
  flex: 1 1 auto;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  background: var(--ws-canvas,#eef2f7);
}
.doc-editor-host .ep-root,
.doc-editor-host .docx-editor,
.doc-editor-host .smetrum-docx-editor {
  height: 100%;
  min-height: 0;
}
.doc-editor-host .docx-editor {
  border: 0;
}
.doc-widget-row .sheet-widget-row-main span {
  white-space: nowrap;
}

.mail-widget-modal .sheet-widget-title-icon {
  border-color: var(--ws-accent-line,#dbeafe);
  background: var(--ws-accent-soft,#eff6ff);
  color: var(--ws-accent-hover,#1d4ed8);
}
.mail-widget-dialog {
  min-width: min(760px, calc(100vw - 24px));
  min-height: min(520px, calc(100vh - 24px));
}
.mail-widget-body {
  position: relative;
  overflow: hidden;
}
.mail-widget-layout {
  height: 100%;
  min-height: 0;
  display: grid;
  grid-template-columns: 340px minmax(0, 1fr);
  background: #fff;
}
.mail-widget-list-pane {
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--ws-line,#dbe4ef);
  background: var(--ws-soft,#f8fafc);
}
.mail-widget-account {
  min-height: 62px;
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  padding: 12px;
  border-bottom: 1px solid var(--ws-line,#e2e8f0);
  background: #fff;
}
.mail-widget-account > span {
  width: 36px;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--ws-accent-line,#dbeafe);
  border-radius: 8px;
  background: var(--ws-accent-soft,#eff6ff);
  color: var(--ws-accent-hover,#1d4ed8);
}
.mail-widget-account svg {
  width: 18px;
  height: 18px;
}
.mail-widget-account strong,
.mail-widget-account small {
  display: block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.mail-widget-account strong {
  color: var(--ws-ink,#0f172a);
  font-size: 14px;
}
.mail-widget-account small {
  margin-top: 2px;
  color: var(--ws-muted,#64748b);
  font-size: 12px;
}
.mail-widget-search {
  width: auto;
  margin: 12px;
  flex: 0 0 auto;
  background: #fff;
}
.mail-widget-list {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
  overflow: auto;
  padding: 0 10px 10px;
}
.mail-widget-message {
  width: 100%;
  min-height: 86px;
  display: grid;
  gap: 5px;
  padding: 10px;
  border: 1px solid var(--ws-line,#e2e8f0);
  border-radius: 8px;
  background: #fff;
  color: var(--ws-text,#334155);
  text-align: left;
  cursor: pointer;
  transition: border-color .15s ease, background .15s ease, box-shadow .15s ease;
}
.mail-widget-message:hover,
.mail-widget-message.is-active {
  border-color: var(--ws-accent-line,#bfdbfe);
  background: var(--ws-accent-soft,#eff6ff);
  box-shadow: 0 8px 20px rgba(15, 23, 42, .05);
}
.mail-widget-message.is-unread {
  border-color: var(--ws-accent-line,#93c5fd);
}
.mail-widget-message-top {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
}
.mail-widget-message-top strong,
.mail-widget-message-subject,
.mail-widget-message-meta {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.mail-widget-message-top strong {
  color: var(--ws-ink,#0f172a);
  font-size: 13px;
  font-weight: 800;
}
.mail-widget-message-top time {
  color: var(--ws-subtle,#94a3b8);
  font-size: 11px;
  font-weight: 700;
}
.mail-widget-message-subject {
  color: var(--ws-text,#334155);
  font-size: 13px;
  font-weight: 700;
}
.mail-widget-message-meta {
  color: var(--ws-muted,#64748b);
  font-size: 11px;
}
.mail-widget-pagination {
  min-height: 42px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 12px;
  border-top: 1px solid var(--ws-line,#e2e8f0);
  color: var(--ws-muted,#64748b);
  font-size: 12px;
}
.mail-widget-page-actions {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.mail-widget-page-actions strong {
  color: var(--ws-text,#334155);
  font-size: 12px;
}
.mail-widget-page-actions button:disabled {
  opacity: .45;
  cursor: default;
}
.mail-widget-list-empty {
  margin: auto;
  padding: 18px 12px;
  color: var(--ws-muted,#64748b);
  font-size: 13px;
  text-align: center;
}
.mail-widget-preview {
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: #fff;
}
.mail-widget-preview-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  padding: 15px 16px;
  border-bottom: 1px solid var(--ws-line,#e2e8f0);
  background: #fff;
}
.mail-widget-preview-head h3 {
  margin: 0 0 8px;
  color: var(--ws-ink,#0f172a);
  font-size: 18px;
  line-height: 1.25;
}
.mail-widget-preview-head p {
  margin: 3px 0 0;
  color: var(--ws-text,#475569);
  font-size: 12px;
  line-height: 1.35;
  word-break: break-word;
}
.mail-widget-preview-actions {
  display: flex;
  align-items: flex-start;
  gap: 8px;
}
.mail-widget-attachments {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 8px 16px;
  border-bottom: 1px solid var(--ws-canvas,#edf2f7);
  background: var(--ws-soft,#f8fafc);
}
.mail-widget-attachments span {
  max-width: 220px;
  overflow: hidden;
  padding: 5px 8px;
  border: 1px solid var(--ws-line,#dbe4ef);
  border-radius: 7px;
  background: #fff;
  color: var(--ws-text,#475569);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.mail-widget-frame {
  flex: 1 1 auto;
  width: 100%;
  min-height: 0;
  border: 0;
  background: #fff;
}
.mail-widget-empty {
  min-height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 24px;
  color: var(--ws-muted,#64748b);
  text-align: center;
}
.mail-widget-empty > span {
  width: 48px;
  height: 48px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--ws-accent-line,#dbeafe);
  border-radius: 8px;
  background: var(--ws-accent-soft,#eff6ff);
  color: var(--ws-accent-hover,#1d4ed8);
}
.mail-widget-empty svg {
  width: 22px;
  height: 22px;
}
.mail-widget-empty strong {
  color: var(--ws-ink,#0f172a);
  font-size: 16px;
}
.mail-widget-empty p {
  max-width: 440px;
  margin: 0;
  font-size: 13px;
  line-height: 1.45;
}
.mail-widget-empty.is-error > span {
  border-color: #fecaca;
  background: #fef2f2;
  color: #dc2626;
}
.mail-widget-overlay {
  position: absolute;
  inset: 0;
  z-index: 4;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
  background: rgba(15, 23, 42, .34);
}
.mail-widget-overlay[hidden] {
  display: none !important;
}
.mail-widget-card {
  width: min(760px, 100%);
  max-height: min(720px, calc(100vh - 60px));
  display: flex;
  flex-direction: column;
  gap: 14px;
  overflow: auto;
  border: 1px solid var(--ws-line,#dbe4ef);
  border-radius: 8px;
  background: #fff;
  padding: 18px;
  box-shadow: 0 24px 70px rgba(15, 23, 42, .22);
}
.mail-widget-compose-card {
  width: min(620px, 100%);
}
.mail-widget-provider-grid,
.mail-widget-server-grid {
  display: grid;
  gap: 10px;
}
.mail-widget-provider-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
.mail-widget-server-grid {
  grid-template-columns: minmax(0, 1.3fr) 110px 140px;
}
.mail-widget-field-wide {
  grid-column: 1 / -1;
}
.mail-widget-card .sheet-widget-field select,
.mail-widget-card .sheet-widget-field textarea,
.mail-widget-card .sheet-widget-field input {
  width: 100%;
  min-width: 0;
  border: 1px solid var(--ws-line,#dbe4ef);
  border-radius: 8px;
  color: var(--ws-ink,#0f172a);
  font: inherit;
  outline: 0;
}
.mail-widget-card .sheet-widget-field input,
.mail-widget-card .sheet-widget-field select {
  height: 38px;
  padding: 0 10px;
  background: #fff;
}
.mail-widget-card .sheet-widget-field textarea {
  min-height: 170px;
  resize: vertical;
  padding: 10px;
  line-height: 1.45;
}
.mail-widget-card .sheet-widget-field input:focus,
.mail-widget-card .sheet-widget-field select:focus,
.mail-widget-card .sheet-widget-field textarea:focus {
  border-color: var(--ws-accent-line,#93c5fd);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, .12);
}
.mail-widget-note {
  display: grid;
  grid-template-columns: 20px minmax(0, 1fr);
  gap: 8px;
  align-items: start;
  padding: 10px;
  border: 1px solid var(--ws-accent-line,#dbeafe);
  border-radius: 8px;
  background: var(--ws-accent-soft,#eff6ff);
  color: var(--ws-text,#475569);
  font-size: 12px;
  line-height: 1.4;
}
.mail-widget-note svg {
  width: 18px;
  height: 18px;
  color: var(--ws-accent-hover,#1d4ed8);
}
.mail-widget-settings-status {
  flex: 1 1 auto;
  min-height: 18px;
  color: var(--ws-muted,#64748b);
  font-size: 12px;
  text-align: right;
}
.sheet-widget-dialog-actions .danger {
  color: #b91c1c;
}

.disk-widget-modal .sheet-widget-title-icon {
  border-color: var(--ws-accent-line,#dbeafe);
  background: var(--ws-accent-soft,#eff6ff);
  color: var(--ws-accent-hover,#1d4ed8);
}
.disk-widget-dialog {
  min-width: min(800px, calc(100vw - 24px));
  min-height: min(540px, calc(100vh - 24px));
}
.disk-widget-body {
  min-height: 0;
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr);
  overflow: hidden;
  background: #fff;
}
.disk-sidebar {
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
  overflow: auto;
  padding: 12px;
  border-right: 1px solid var(--ws-line,#dbe4ef);
  background: var(--ws-soft,#f8fafc);
}
.disk-side-header {
  display: grid;
  gap: 4px;
  padding: 10px;
  border: 1px solid var(--ws-line,#dbe4ef);
  border-radius: 8px;
  background: #fff;
}
.disk-side-header strong {
  min-width: 0;
  overflow: hidden;
  color: var(--ws-ink,#0f172a);
  font-size: 13px;
  font-weight: 850;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.disk-side-header span {
  min-width: 0;
  overflow: hidden;
  color: var(--ws-muted,#64748b);
  font-size: 11px;
  font-weight: 750;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.disk-segmented {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 4px;
  padding: 4px;
  border: 1px solid var(--ws-line,#dbe4ef);
  border-radius: 8px;
  background: #fff;
}
.disk-segmented button {
  min-width: 0;
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--ws-muted,#64748b);
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
}
.disk-segmented button.is-active {
  background: var(--ws-accent-soft,#eff6ff);
  color: var(--ws-accent-hover,#1d4ed8);
  box-shadow: inset 0 0 0 1px var(--ws-accent-line,#bfdbfe);
}
.disk-segmented svg,
.disk-side-title svg,
.disk-folder-item svg,
.disk-project-item svg {
  width: 16px;
  height: 16px;
}
.disk-side-section {
  display: grid;
  gap: 8px;
}
.disk-side-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  color: var(--ws-muted,#64748b);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}
.disk-side-title small {
  color: var(--ws-subtle,#94a3b8);
  font-size: 10px;
  text-transform: none;
}
.disk-side-add {
  width: 26px;
  height: 26px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--ws-line,#dbe4ef);
  border-radius: 7px;
  background: #fff;
  color: var(--ws-muted,#64748b);
  cursor: pointer;
  transition: border-color .15s ease, background .15s ease, color .15s ease;
}
.disk-side-add:hover {
  border-color: var(--ws-accent-line,#bfdbfe);
  background: var(--ws-accent-soft,#eff6ff);
  color: var(--ws-accent-hover,#1d4ed8);
}
.disk-side-add:disabled {
  cursor: not-allowed;
  opacity: .45;
}
.disk-side-add:disabled:hover {
  border-color: var(--ws-line,#dbe4ef);
  background: #fff;
  color: var(--ws-muted,#64748b);
}
.disk-side-add svg {
  width: 14px;
  height: 14px;
}
.disk-folder-search {
  width: 100%;
}
.disk-switch {
  min-width: 0;
  min-height: 36px;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 8px 10px;
  border: 1px solid var(--ws-line,#e2e8f0);
  border-radius: 8px;
  background: #fff;
  color: var(--ws-text,#334155);
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
  user-select: none;
}
.disk-switch input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}
.disk-switch-track {
  width: 34px;
  height: 20px;
  position: relative;
  flex: 0 0 auto;
  border-radius: 999px;
  background: var(--ws-line-strong,#cbd5e1);
  pointer-events: none;
  transition: background .15s ease;
}
.disk-switch-track::after {
  content: "";
  width: 16px;
  height: 16px;
  position: absolute;
  left: 2px;
  top: 2px;
  border-radius: 999px;
  background: #fff;
  box-shadow: 0 1px 3px rgba(15, 23, 42, .22);
  transition: transform .15s ease;
}
.disk-switch input:checked + .disk-switch-track {
  background: var(--ws-accent,#2563eb);
}
.disk-switch input:checked + .disk-switch-track::after {
  transform: translateX(14px);
}
.disk-switch input:focus-visible + .disk-switch-track {
  outline: 2px solid var(--ws-accent-line,#93c5fd);
  outline-offset: 2px;
}
.disk-folder-list,
.disk-project-list {
  display: grid;
  gap: 6px;
}
.disk-folder-item,
.disk-project-item {
  width: 100%;
  min-width: 0;
  min-height: 38px;
  display: grid;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--ws-line,#e2e8f0);
  border-radius: 8px;
  background: #fff;
  color: var(--ws-text,#334155);
  text-align: left;
  cursor: pointer;
}
.disk-folder-item {
  grid-template-columns: 18px 10px minmax(0, 1fr);
  padding: 8px 10px;
  padding-left: calc(10px + var(--disk-folder-depth, 0) * 14px);
}
.disk-folder-item[data-disk-folder="__root"] {
  grid-template-columns: 10px minmax(0, 1fr);
}
.disk-folder-item:hover,
.disk-folder-item.is-active,
.disk-project-item:hover,
.disk-project-item.is-active {
  border-color: var(--ws-accent-line,#bfdbfe);
  background: var(--ws-accent-soft,#eff6ff);
}
.disk-folder-item.is-sorting {
  opacity: .72;
}
.disk-folder-grip {
  width: 18px;
  height: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--ws-subtle,#94a3b8);
  cursor: grab;
}
.disk-folder-color {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: var(--folder-color, #6366f1);
}
.disk-folder-name {
  min-width: 0;
  overflow: hidden;
  color: var(--ws-ink,#0f172a);
  font-size: 12px;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.disk-project-item {
  grid-template-columns: 28px minmax(0, 1fr);
  padding: 9px 10px;
}
.disk-project-item > span {
  width: 28px;
  height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--ws-accent-line,#dbeafe);
  border-radius: 7px;
  background: var(--ws-accent-soft,#eff6ff);
  color: var(--ws-accent-hover,#1d4ed8);
  grid-row: span 2;
}
.disk-project-item strong,
.disk-project-item small {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.disk-project-item strong {
  color: var(--ws-ink,#0f172a);
  font-size: 12px;
}
.disk-project-item small {
  color: var(--ws-muted,#64748b);
  font-size: 11px;
}
.disk-side-empty {
  padding: 11px;
  border: 1px dashed var(--ws-line-strong,#cbd5e1);
  border-radius: 8px;
  color: var(--ws-muted,#64748b);
  font-size: 12px;
  text-align: center;
}
.disk-main {
  min-width: 0;
  min-height: 0;
  display: grid;
  grid-template-rows: auto auto auto minmax(0, 1fr);
  background: #fff;
}
.disk-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--ws-line,#dbe4ef);
}
.disk-current {
  min-width: 0;
  display: grid;
  gap: 2px;
}
.disk-current strong,
.disk-current span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.disk-current strong {
  color: var(--ws-ink,#0f172a);
  font-size: 15px;
}
.disk-current span {
  color: var(--ws-muted,#64748b);
  font-size: 12px;
}
.disk-search {
  width: min(320px, 48%);
  flex: 0 0 auto;
}
.disk-selection-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: 12px 14px 0;
  padding: 9px 10px;
  border: 1px solid var(--ws-accent-line,#bfdbfe);
  border-radius: 8px;
  background: var(--ws-accent-soft,#eff6ff);
}
.disk-selection-bar[hidden] {
  display: none;
}
.disk-selection-bar strong {
  min-width: 0;
  overflow: hidden;
  color: var(--ws-accent-hover,#1e3a8a);
  font-size: 12px;
  font-weight: 850;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.disk-selection-bar > div {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
}
.disk-selection-bar .btn-light {
  min-height: 30px;
  padding: 6px 9px;
  font-size: 11px;
}
.disk-selection-bar .btn-light.danger {
  border-color: #fecaca;
  background: #fff;
  color: #b91c1c;
}
.disk-dropzone {
  margin: 12px 14px 0;
  border: 1px dashed var(--ws-accent-line,#bfdbfe);
  border-radius: 8px;
  background: var(--ws-soft,#f8fbff);
  color: var(--ws-muted,#64748b);
}
.disk-drop-copy {
  min-height: 92px;
  display: grid;
  place-items: center;
  gap: 5px;
  padding: 14px;
  text-align: center;
}
.disk-drop-copy > span {
  width: 34px;
  height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--ws-accent-line,#bfdbfe);
  border-radius: 8px;
  background: var(--ws-accent-soft,#eff6ff);
  color: var(--ws-accent-hover,#1d4ed8);
}
.disk-drop-copy svg {
  width: 18px;
  height: 18px;
}
.disk-drop-copy strong {
  color: var(--ws-ink,#0f172a);
  font-size: 13px;
}
.disk-drop-copy p {
  margin: 0;
  font-size: 12px;
}
.disk-widget-modal.is-dragover .disk-dropzone {
  border-color: var(--ws-accent,#2563eb);
  background: var(--ws-accent-soft,#eff6ff);
  box-shadow: inset 0 0 0 1px rgba(37, 99, 235, .24);
}
.disk-file-grid {
  min-height: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  align-content: start;
  gap: 10px;
  overflow: auto;
  padding: 14px;
}
.disk-item-card {
  position: relative;
}
.disk-item-card.is-selected {
  border-color: var(--ws-accent,#2563eb);
  background: var(--ws-soft,#f8fbff);
  box-shadow: 0 0 0 2px rgba(37, 99, 235, .14);
}
.disk-item-card.is-sorting,
.disk-item-card.is-dragging {
  opacity: .74;
}
.disk-card-tools {
  position: absolute;
  z-index: 2;
  top: 8px;
  right: 8px;
  display: inline-flex;
  gap: 5px;
}
.disk-card-drag,
.disk-card-select {
  width: 26px;
  height: 26px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--ws-line,#dbe4ef);
  border-radius: 7px;
  background: rgba(255, 255, 255, .94);
  color: var(--ws-muted,#64748b);
  cursor: pointer;
  transition: border-color .15s ease, background .15s ease, color .15s ease, box-shadow .15s ease;
}
.disk-card-drag {
  cursor: grab;
}
.disk-card-drag:active {
  cursor: grabbing;
}
.disk-card-drag svg,
.disk-card-select svg {
  width: 15px;
  height: 15px;
}
.disk-card-select svg {
  opacity: 0;
}
.disk-card-drag:hover,
.disk-card-select:hover,
.disk-card-select.is-selected {
  border-color: var(--ws-accent-line,#bfdbfe);
  background: var(--ws-accent-soft,#eff6ff);
  color: var(--ws-accent-hover,#1d4ed8);
}
.disk-card-select.is-selected svg {
  opacity: 1;
}
.disk-folder-card {
  min-width: 0;
  min-height: 126px;
  display: grid;
  align-content: start;
  gap: 8px;
  border: 1px solid var(--ws-line,#e2e8f0);
  border-radius: 8px;
  background: #fff;
  color: inherit;
  text-align: left;
  cursor: pointer;
  transition: border-color .15s ease, background .15s ease, box-shadow .15s ease, transform .15s ease;
  padding: 14px;
}
.disk-folder-card.is-drop-target {
  border-color: #16a34a;
  background: #f0fdf4;
  box-shadow: 0 0 0 2px rgba(22, 163, 74, .16);
}
.disk-folder-card:hover {
  border-color: var(--ws-accent-line,#bfdbfe);
  background: var(--ws-soft,#f8fbff);
  box-shadow: 0 10px 24px rgba(15, 23, 42, .06);
  transform: translateY(-1px);
}
.disk-folder-card.is-disabled {
  cursor: not-allowed;
  opacity: .58;
}
.disk-folder-card.is-disabled:hover {
  background: #fff;
  box-shadow: none;
  transform: none;
}
.disk-folder-open {
  min-width: 0;
  display: grid;
  align-content: start;
  gap: 8px;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  text-align: left;
  cursor: pointer;
}
.disk-folder-card-icon {
  width: 52px;
  height: 52px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--ws-accent-line,#bfdbfe);
  border-radius: 8px;
  background: var(--ws-accent-soft,#eff6ff);
  color: var(--folder-color, #2563eb);
}
.disk-folder-card-icon svg {
  width: 26px;
  height: 26px;
}
.disk-project-folder-card .disk-folder-card-icon {
  border-color: #bbf7d0;
  background: #f0fdf4;
  color: #15803d;
}
.disk-up-card .disk-folder-card-icon {
  border-color: var(--ws-line,#e2e8f0);
  background: var(--ws-soft,#f8fafc);
  color: var(--ws-text,#475569);
}
.disk-folder-card strong,
.disk-folder-card small {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.disk-folder-card strong {
  color: var(--ws-ink,#0f172a);
  font-size: 13px;
  font-weight: 850;
}
.disk-folder-card small {
  color: var(--ws-muted,#64748b);
  font-size: 11px;
}
.disk-card-actions {
  display: flex;
  justify-content: flex-end;
  gap: 6px;
  margin-top: auto;
}
.disk-file-card {
  min-width: 0;
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  border: 1px solid var(--ws-line,#e2e8f0);
  border-radius: 8px;
  background: #fff;
  overflow: hidden;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.disk-file-card:hover {
  border-color: var(--ws-accent-line,#bfdbfe);
  box-shadow: 0 10px 24px rgba(15, 23, 42, .06);
}
.disk-file-main {
  min-width: 0;
  display: grid;
  gap: 8px;
  padding: 12px;
  color: inherit;
  text-decoration: none;
}
.disk-file-thumb,
.disk-file-ext {
  width: 52px;
  height: 52px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
}
.disk-file-thumb {
  overflow: hidden;
  border: 1px solid var(--ws-accent-line,#dbeafe);
  background: var(--ws-soft,#f8fafc);
}
.disk-file-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.disk-file-ext {
  border: 1px solid var(--ws-accent-line,#dbeafe);
  background: var(--ws-accent-soft,#eff6ff);
  color: var(--ws-accent-hover,#1d4ed8);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}
.disk-file-name,
.disk-file-meta {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.disk-file-name {
  color: var(--ws-ink,#0f172a);
  font-size: 13px;
  font-weight: 800;
}
.disk-file-meta {
  color: var(--ws-muted,#64748b);
  font-size: 11px;
}
.disk-file-actions {
  display: flex;
  justify-content: flex-end;
  gap: 6px;
  padding: 8px;
  border-top: 1px solid var(--ws-canvas,#edf2f7);
  background: var(--ws-soft,#f8fafc);
}
.disk-empty {
  grid-column: 1 / -1;
  min-height: 260px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  color: var(--ws-muted,#64748b);
  text-align: center;
}
.disk-empty > span {
  width: 48px;
  height: 48px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--ws-accent-line,#dbeafe);
  border-radius: 8px;
  background: var(--ws-accent-soft,#eff6ff);
  color: var(--ws-accent-hover,#1d4ed8);
}
.disk-empty svg {
  width: 22px;
  height: 22px;
}
.disk-empty strong {
  color: var(--ws-ink,#0f172a);
  font-size: 16px;
}
.disk-empty p {
  max-width: 380px;
  margin: 0;
  font-size: 13px;
  line-height: 1.45;
}
.disk-dialog-layer {
  position: absolute;
  inset: 0;
  z-index: 8;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
  background: rgba(15, 23, 42, .34);
}
.disk-dialog-layer[hidden] {
  display: none;
}
.disk-dialog {
  width: min(520px, 100%);
  max-height: min(620px, calc(100vh - 48px));
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid var(--ws-line,#dbe4ef);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 22px 54px rgba(15, 23, 42, .26);
}
.disk-dialog-sm {
  width: min(430px, 100%);
}
.disk-dialog-head {
  min-height: 52px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--ws-line,#e2e8f0);
  background: var(--ws-soft,#f8fafc);
}
.disk-dialog-head strong {
  min-width: 0;
  overflow: hidden;
  color: var(--ws-ink,#0f172a);
  font-size: 15px;
  font-weight: 850;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.disk-dialog-body {
  min-height: 0;
  overflow: auto;
  padding: 14px;
}
.disk-dialog-field {
  display: grid;
  gap: 6px;
}
.disk-dialog-field span {
  color: var(--ws-muted,#64748b);
  font-size: 12px;
  font-weight: 800;
}
.disk-dialog-field input {
  width: 100%;
  min-height: 40px;
  padding: 9px 10px;
  border: 1px solid var(--ws-line-strong,#cbd5e1);
  border-radius: 8px;
  color: var(--ws-ink,#0f172a);
  font-size: 14px;
  outline: none;
}
.disk-dialog-field input:focus {
  border-color: var(--ws-accent,#2563eb);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, .12);
}
.disk-dialog-text {
  margin: 0;
  color: var(--ws-text,#334155);
  font-size: 13px;
  line-height: 1.5;
}
.disk-dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 12px 14px;
  border-top: 1px solid var(--ws-line,#e2e8f0);
  background: var(--ws-soft,#f8fafc);
}
.disk-dialog-actions .btn-primary {
  min-width: 104px;
  min-height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px 14px;
  border: 1px solid var(--ws-accent-hover,#1d4ed8);
  border-radius: 8px;
  background: var(--ws-accent,#2563eb);
  color: #fff;
  font-size: 13px;
  font-weight: 800;
  line-height: 1;
  cursor: pointer;
  box-shadow: 0 8px 18px rgba(37, 99, 235, .18);
  transition: background .15s ease, border-color .15s ease, box-shadow .15s ease, transform .15s ease;
}
.disk-dialog-actions .btn-primary:hover {
  border-color: var(--ws-accent,#1e40af);
  background: var(--ws-accent-hover,#1d4ed8);
}
.disk-dialog-actions .btn-primary:focus-visible {
  outline: 2px solid var(--ws-accent-line,#93c5fd);
  outline-offset: 2px;
}
.disk-dialog-actions .btn-primary:active {
  transform: translateY(1px);
}
.disk-dialog-actions .btn-primary.danger {
  border-color: #dc2626;
  background: #dc2626;
  color: #fff;
  box-shadow: 0 8px 18px rgba(220, 38, 38, .16);
}
.disk-dialog-actions .btn-primary.danger:hover {
  border-color: #b91c1c;
  background: #b91c1c;
}
.disk-dialog-folder-list {
  display: grid;
  gap: 6px;
}
.disk-dialog-folder-option {
  min-height: 38px;
  display: grid;
  grid-template-columns: 10px minmax(0, 1fr);
  align-items: center;
  gap: 9px;
  padding: 8px 10px;
  padding-left: calc(10px + var(--disk-folder-depth, 0) * 14px);
  border: 1px solid var(--ws-line,#e2e8f0);
  border-radius: 8px;
  background: #fff;
  color: var(--ws-ink,#0f172a);
  font-size: 12px;
  font-weight: 800;
  text-align: left;
  cursor: pointer;
}
.disk-dialog-folder-option:hover {
  border-color: var(--ws-accent-line,#bfdbfe);
  background: var(--ws-accent-soft,#eff6ff);
}
.disk-dialog-folder-option.is-disabled,
.disk-dialog-folder-option:disabled {
  cursor: not-allowed;
  opacity: .48;
}
.disk-dialog-folder-option span:last-child {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

@media (max-width: 760px) {
  .sheet-widget-modal { padding: 0; }
  .sheet-widget-dialog {
    left: 0 !important;
    top: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    min-width: 0;
    min-height: 0;
    max-width: none;
    max-height: none;
    resize: none;
    border-radius: 0;
  }
  .sheet-widget-head { flex-wrap: wrap; }
  .sheet-widget-title { flex-basis: calc(100% - 96px); }
  .sheet-widget-header-tools {
    order: 3;
    width: 100%;
    flex: 1 1 100%;
  }
  .sheet-widget-header-tools .sheet-widget-status { max-width: none; }
  .sheet-ai-panel {
    position: absolute;
    inset: 0 0 0 auto;
    z-index: 7820;
    width: min(360px, 100%);
    max-width: 100%;
    box-shadow: -18px 0 36px rgba(15, 23, 42, .14);
  }
  .sheet-ai-resizer { display: none; }
  .sheet-ai-univer-btn {
    top: 7px;
    right: 8px;
  }
  .sheet-widget-row {
    grid-template-columns: 34px minmax(0, 1fr);
    gap: 10px;
  }
  .sheet-widget-row-icon {
    width: 34px;
    height: 34px;
  }
  .sheet-widget-row-actions {
    grid-column: 1 / -1;
    justify-content: flex-end;
  }
  .mail-widget-layout {
    grid-template-columns: 1fr;
    grid-template-rows: minmax(210px, 42%) minmax(0, 1fr);
  }
  .mail-widget-list-pane {
    border-right: 0;
    border-bottom: 1px solid var(--ws-line,#dbe4ef);
  }
  .mail-widget-provider-grid,
  .mail-widget-server-grid {
    grid-template-columns: 1fr;
  }
  .mail-widget-preview-head {
    grid-template-columns: 1fr;
  }
  .mail-widget-card {
    max-height: calc(100vh - 36px);
  }
  .disk-widget-body {
    grid-template-columns: 1fr;
    grid-template-rows: minmax(230px, 38%) minmax(0, 1fr);
  }
  .disk-sidebar {
    border-right: 0;
    border-bottom: 1px solid var(--ws-line,#dbe4ef);
  }
  .disk-toolbar {
    align-items: stretch;
    flex-direction: column;
  }
  .disk-search {
    width: 100%;
  }
  .disk-selection-bar {
    align-items: stretch;
    flex-direction: column;
  }
  .disk-selection-bar > div {
    justify-content: stretch;
  }
  .disk-selection-bar .btn-light {
    flex: 1 1 auto;
  }
  .disk-file-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 760px) {
  .widget-launcher-btn span { display: none; }
  .widgets-head { align-items: flex-start; flex-direction: column; padding: 16px; }
  .widgets-tabs { padding-left: 16px; padding-right: 16px; }
  .widgets-section,
  .widgets-catalog-main { padding-left: 16px; padding-right: 16px; }
  .widgets-catalog-layout { grid-template-columns: 1fr; min-height: auto; }
  .widgets-filters {
    min-height: 0;
    padding: 14px 16px 16px;
    border-right: 0;
    border-bottom: 1px solid var(--ws-line,#e5e7eb);
  }
  .widgets-grid { grid-template-columns: 1fr; }
  .widgets-card-actions { justify-content: stretch; }
  .widgets-card-actions button { flex: 1; }
  .widget-window {
    top: 66px;
    right: 12px;
    left: 12px;
    width: auto;
  }
  .widget-window-notes {
    width: auto;
    height: calc(100vh - 90px);
  }
  .widget-notes {
    grid-template-columns: 1fr;
    height: auto;
  }
  .widget-notes-list-wrap {
    max-height: 168px;
    border-right: 0;
    border-bottom: 1px solid var(--ws-line,#e2e8f0);
  }
  .widget-notes-editor .pell-actionbar {
    flex-wrap: wrap;
  }
  .widget-notes-footer { justify-content: stretch; }
  .widget-notes-delete { width: 100%; }
}

/* Portal help */
.portal-help-modal {
  position: fixed;
  inset: 0;
  z-index: 10040;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(15, 23, 42, .42);
}
.portal-help-modal.is-open { display: flex; }
.portal-help-dialog {
  width: min(820px, 100%);
  max-height: calc(100vh - 40px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid var(--ws-line,#dbe3ef);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 24px 70px rgba(15, 23, 42, .22);
}
.portal-help-head {
  min-height: 50px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 20px 6px;
  flex-shrink: 0;
}
.portal-help-head h2 {
  margin: 0;
  color: var(--ws-ink,#0f172a);
  font-size: 20px;
  line-height: 1.2;
  font-weight: 800;
}
.portal-help-close {
  width: 32px;
  height: 32px;
  border: 1px solid var(--ws-line,#dbe3ef);
  border-radius: 8px;
  background: #fff;
  color: var(--ws-muted,#64748b);
  cursor: pointer;
  font-size: 22px;
  line-height: 1;
}
.portal-help-close:hover {
  background: var(--ws-soft,#f8fafc);
  color: var(--ws-ink,#0f172a);
}
.portal-help-body {
  min-height: 0;
  overflow: auto;
  padding: 0 20px 18px;
}
.portal-help-command {
  display: grid;
  grid-template-columns: minmax(0, 1.34fr) minmax(250px, .86fr);
  gap: 12px;
  margin-top: 2px;
}
.portal-help-command-card,
.portal-help-side-card,
.portal-help-guide,
.portal-help-wide-link {
  text-decoration: none;
}
.portal-help-command-card {
  min-height: 174px;
  position: relative;
  display: grid;
  grid-template-columns: 54px minmax(0, 1fr);
  align-content: center;
  gap: 5px 14px;
  overflow: hidden;
  border: 1px solid var(--ws-line,#dbe4ef);
  border-radius: 8px;
  padding: 20px 54px 20px 18px;
  background:
    linear-gradient(135deg, rgba(248, 251, 255, .96), rgba(236, 247, 255, .96)),
    url("assets/landing/screen-analytics.jpg") right bottom / 48% auto no-repeat;
  color: var(--ws-ink,#0f172a);
}
.portal-help-command-card::before {
  content: "";
  position: absolute;
  left: 0;
  top: 18px;
  bottom: 18px;
  width: 4px;
  border-radius: 0 6px 6px 0;
  background: var(--ws-accent,#2563eb);
}
.portal-help-command-card:hover,
.portal-help-side-card:hover {
  border-color: var(--ws-accent-line,#b7d7ff);
  box-shadow: 0 10px 24px rgba(15, 23, 42, .08);
}
.portal-help-command-icon {
  grid-row: 1 / span 3;
  width: 42px;
  height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--ws-accent,#2563eb);
}
.portal-help-kicker {
  color: var(--ws-accent,#2563eb);
  font-size: 11px;
  line-height: 1;
  font-weight: 900;
  letter-spacing: .05em;
  text-transform: uppercase;
}
.portal-help-command-card strong {
  position: relative;
  z-index: 1;
  color: var(--ws-ink,#0f172a);
  font-size: 20px;
  line-height: 1.25;
  font-weight: 900;
}
.portal-help-command-card > span:not(.portal-help-command-icon):not(.portal-help-arrow):not(.portal-help-kicker) {
  position: relative;
  z-index: 1;
  max-width: 360px;
  color: var(--ws-text,#475569);
  font-size: 13px;
  line-height: 1.4;
}
.portal-help-arrow {
  position: absolute;
  right: 16px;
  bottom: 18px;
  width: 24px;
  height: 24px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--ws-accent,#2563eb);
}
.portal-help-side-stack {
  display: grid;
  gap: 12px;
}
.portal-help-side-card {
  min-height: 81px;
  position: relative;
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) 22px;
  align-items: center;
  gap: 12px;
  overflow: hidden;
  border: 1px solid var(--ws-line,#dbe4ef);
  border-radius: 8px;
  padding: 14px 15px;
  background: #fff;
  color: var(--ws-ink,#0f172a);
}
.portal-help-side-card .portal-help-arrow {
  position: static;
  width: 22px;
  height: 22px;
  justify-self: end;
  color: var(--ws-accent,#2563eb);
}
.portal-help-side-line {
  width: 34px;
  height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--ws-accent,#2563eb);
}
.portal-help-side-line svg {
  width: 30px;
  height: 30px;
}
.portal-help-side-copy {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.portal-help-side-copy strong {
  overflow: hidden;
  color: inherit;
  font-size: 14px;
  line-height: 1.25;
  font-weight: 900;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.portal-help-side-copy span {
  overflow: hidden;
  color: var(--ws-subtle,#94a3b8);
  font-size: 12px;
  line-height: 1.3;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.portal-help-section-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 20px 0 10px;
}
.portal-help-section-title {
  margin: 0;
  color: var(--ws-ink,#0f172a);
  font-size: 15px;
  font-weight: 800;
}
.portal-help-all {
  color: var(--ws-accent,#2563eb);
  font-size: 12px;
  font-weight: 800;
}
.portal-help-all:hover { color: var(--ws-accent-hover,#1d4ed8); }
.portal-help-guide-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
}
.portal-help-guide {
  min-height: 108px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 10px;
  border: 1px solid var(--ws-line,#dbe4ef);
  border-radius: 8px;
  padding: 14px;
  background: #fff;
  color: var(--ws-ink,#0f172a);
  transition: background var(--tr), border-color var(--tr), box-shadow var(--tr);
}
.portal-help-guide:hover {
  border-color: var(--ws-accent-line,#b7d7ff);
  background: var(--ws-soft,#f8fbff);
  box-shadow: 0 8px 20px rgba(15, 23, 42, .06);
}
.portal-help-guide svg {
  width: 22px;
  height: 22px;
  color: var(--ws-accent,#2563eb);
}
.portal-help-guide span {
  color: var(--ws-text,#334155);
  font-size: 12px;
  line-height: 1.25;
  font-weight: 700;
}
.portal-help-wide-links {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 22px;
}
.portal-help-wide-link {
  min-height: 78px;
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) 22px;
  align-items: center;
  gap: 12px;
  border: 1px solid var(--ws-line,#dbe4ef);
  border-left: 3px solid var(--ws-accent-line,#dbeafe);
  border-radius: 8px;
  padding: 14px 16px 14px 14px;
  background: #fff;
  color: var(--ws-ink,#0f172a);
}
.portal-help-wide-link:hover {
  border-color: var(--ws-accent-line,#b7d7ff);
  background: var(--ws-soft,#f8fbff);
}
.portal-help-wide-icon {
  width: 34px;
  height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--ws-accent,#2563eb);
}
.portal-help-wide-icon svg {
  width: 30px;
  height: 30px;
}
.portal-help-wide-copy {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.portal-help-wide-copy strong {
  overflow: hidden;
  color: var(--ws-ink,#0f172a);
  font-size: 14px;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.portal-help-wide-copy span {
  overflow: hidden;
  color: var(--ws-subtle,#94a3b8);
  font-size: 12px;
  line-height: 1.3;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.portal-help-wide-link .portal-help-arrow {
  position: static;
  width: 22px;
  height: 22px;
  color: var(--ws-accent,#2563eb);
}
.portal-help-footer {
  min-height: 58px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 20px;
  border-top: 1px solid var(--ws-line,#e5e7eb);
  background: #fff;
  color: var(--ws-text,#334155);
  font-size: 12px;
  flex-shrink: 0;
}
.portal-help-footer a {
  color: var(--ws-accent,#2563eb);
  font-weight: 700;
}
.portal-help-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  color: var(--ws-text,#334155);
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
  cursor: pointer;
}
.portal-help-toggle input {
  width: 16px;
  height: 16px;
  accent-color: var(--ws-accent,#2563eb);
  cursor: pointer;
}
.portal-help-status {
  margin-left: 8px;
  color: var(--ws-muted,#64748b);
  font-size: 11px;
  font-weight: 600;
}
.portal-help-status.is-error { color: #b91c1c; }
@media (max-width: 760px) {
  .topbar-help-btn span { display: none; }
  .portal-help-modal { padding: 10px; align-items: flex-start; }
  .portal-help-dialog { max-height: calc(100vh - 20px); }
  .portal-help-command,
  .portal-help-wide-links { grid-template-columns: 1fr; }
  .portal-help-command-card { min-height: 150px; }
  .portal-help-guide-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .portal-help-footer {
    align-items: flex-start;
    flex-direction: column;
  }
}
@media (max-width: 420px) {
  .portal-help-guide-grid { grid-template-columns: 1fr; }
  .portal-help-wide-link { grid-template-columns: 36px minmax(0, 1fr); }
  .portal-help-wide-link > .portal-help-arrow { display: none; }
}

/* Plan upgrade gate */
.plan-upgrade-modal {
  position: fixed;
  inset: 0;
  z-index: 10050;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(15, 23, 42, .42);
}
.plan-upgrade-modal.open { display: flex; }
.plan-upgrade-dialog {
  position: relative;
  width: min(460px, 100%);
  border: 1px solid var(--ws-line,#dbe3ef);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 24px 70px rgba(15, 23, 42, .22);
  padding: 22px;
}
.plan-upgrade-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 30px;
  height: 30px;
  border: 1px solid var(--ws-line,#dbe3ef);
  border-radius: 8px;
  background: #fff;
  color: var(--ws-muted,#64748b);
  cursor: pointer;
  font-size: 22px;
  line-height: 1;
}
.plan-upgrade-kicker {
  margin-bottom: 8px;
  color: var(--ws-accent,#2563eb);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
}
.plan-upgrade-dialog h3 {
  margin: 0 36px 8px 0;
  color: var(--ws-ink,#0f172a);
  font-size: 22px;
  line-height: 1.2;
}
.plan-upgrade-message {
  margin: 0 0 16px;
  color: var(--ws-text,#475569);
  font-size: 14px;
  line-height: 1.45;
}
.plan-upgrade-calc {
  border: 1px solid var(--ws-line,#e2e8f0);
  border-radius: 8px;
  overflow: hidden;
}
.plan-upgrade-calc > div {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--ws-canvas,#edf2f7);
  color: var(--ws-muted,#64748b);
  font-size: 13px;
}
.plan-upgrade-calc > div:last-child { border-bottom: 0; }
.plan-upgrade-calc strong {
  color: var(--ws-ink,#0f172a);
  font-weight: 700;
  text-align: right;
}
.plan-upgrade-total {
  background: var(--ws-soft,#f8fafc);
  font-size: 14px;
}
.plan-upgrade-total strong { color: var(--ws-accent-hover,#1d4ed8); }
.plan-upgrade-note {
  margin: 12px 0 0;
  color: var(--ws-muted,#64748b);
  font-size: 12px;
  line-height: 1.4;
}
.plan-upgrade-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 18px;
}
@media (max-width: 520px) {
  .plan-upgrade-dialog { padding: 18px; }
  .plan-upgrade-actions { flex-direction: column-reverse; }
  .plan-upgrade-actions .btn { width: 100%; }
}

.ai-estimate-modal {
  position: fixed;
  inset: 0;
  z-index: 7550;
  display: none;
  background: transparent;
  pointer-events: none;
}
.ai-estimate-modal.is-open { display: block; }
.ai-estimate-dialog {
  position: absolute;
  left: 24px;
  top: 24px;
  width: min(1120px, calc(100vw - 40px));
  height: min(820px, calc(100vh - 40px));
  min-width: min(720px, calc(100vw - 24px));
  min-height: min(460px, calc(100vh - 24px));
  max-width: calc(100vw - 24px);
  max-height: calc(100vh - 24px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  resize: both;
  border: 1px solid rgba(100, 116, 139, .32);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 28px 72px rgba(15, 23, 42, .24);
  pointer-events: auto;
}
.ai-estimate-dialog.is-dragging { opacity: .98; }
.ai-estimate-modal.is-minimized .ai-estimate-dialog {
  height: auto !important;
  min-height: 0;
  resize: none;
}
.ai-estimate-modal.is-minimized .ai-estimate-body { display: none; }
.ai-estimate-modal.is-fullscreen .ai-estimate-dialog {
  left: 12px !important;
  top: 12px !important;
  width: calc(100vw - 24px) !important;
  height: calc(100vh - 24px) !important;
  resize: none;
}
.ai-estimate-modal.is-project-context [data-ai-project-field] { display: none !important; }
.ai-estimate-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  min-height: 58px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--ws-line,#dbe4ef);
  background: var(--ws-soft,#f8fafc);
  cursor: move;
  user-select: none;
}
.ai-estimate-title {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}
.ai-estimate-title-icon {
  width: 34px;
  height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--ws-accent-line,#bfdbfe);
  border-radius: 8px;
  background: var(--ws-accent-soft,#eff6ff);
  color: var(--ws-accent,#2563eb);
}
.ai-estimate-title-icon svg,
.ai-estimate-actions svg,
.ai-estimate-usage-line svg { width: 18px; height: 18px; }
.ai-estimate-title strong {
  display: block;
  overflow: hidden;
  color: var(--ws-ink,#0f172a);
  font-size: 15px;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.ai-estimate-title span {
  display: block;
  margin-top: 2px;
  overflow: hidden;
  color: var(--ws-muted,#64748b);
  font-size: 12px;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.ai-estimate-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 0 0 auto;
}
.ai-estimate-actions button {
  width: 34px;
  height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--ws-line,#dbe4ef);
  border-radius: 8px;
  background: #fff;
  color: var(--ws-text,#475569);
  cursor: pointer;
}
.ai-estimate-actions button:hover { background: var(--ws-accent-soft,#eef6ff); border-color: var(--ws-accent-line,#bfdbfe); color: var(--ws-accent-hover,#1d4ed8); }
.ai-estimate-body {
  flex: 1 1 auto;
  min-height: 0;
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  overflow: hidden;
  padding: 0;
  background: var(--ws-canvas,#f1f5f9);
}
.ai-estimate-history {
  min-height: 0;
  overflow: auto;
  padding: 12px;
  border-right: 1px solid var(--ws-line,#dbe4ef);
  background: var(--ws-soft,#f8fafc);
}
.ai-estimate-new {
  width: 100%;
  min-height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-bottom: 10px;
  border: 1px solid var(--ws-accent-line,#bfdbfe);
  border-radius: 8px;
  background: var(--ws-accent-soft,#eff6ff);
  color: var(--ws-accent-hover,#1d4ed8);
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
}
.ai-estimate-new svg { width: 16px; height: 16px; }
.ai-estimate-history-list {
  display: grid;
  gap: 8px;
}
.ai-estimate-history-empty {
  padding: 10px;
  border: 1px dashed var(--ws-line-strong,#cbd5e1);
  border-radius: 8px;
  color: var(--ws-muted,#64748b);
  font-size: 12px;
  line-height: 1.35;
}
.ai-estimate-history-item {
  width: 100%;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  padding: 9px 10px;
  border: 1px solid var(--ws-line,#e2e8f0);
  border-radius: 8px;
  background: #fff;
  color: var(--ws-text,#334155);
  text-align: left;
  cursor: pointer;
}
.ai-estimate-history-item:hover,
.ai-estimate-history-item.is-active {
  border-color: var(--ws-accent-line,#93c5fd);
  background: var(--ws-accent-soft,#eff6ff);
}
.ai-estimate-history-text {
  display: grid;
  min-width: 0;
  gap: 3px;
}
.ai-estimate-history-item strong {
  overflow: hidden;
  color: var(--ws-ink,#0f172a);
  font-size: 12px;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.ai-estimate-history-item small {
  color: var(--ws-muted,#64748b);
  font-size: 11px;
  line-height: 1.2;
}
.ai-estimate-history-actions {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  opacity: 0;
  transition: opacity .15s ease;
}
.ai-estimate-history-item:hover .ai-estimate-history-actions,
.ai-estimate-history-item.is-active .ai-estimate-history-actions { opacity: 1; }
.ai-estimate-history-actions [role="button"] {
  width: 26px;
  height: 26px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid transparent;
  border-radius: 7px;
  color: var(--ws-muted,#64748b);
  cursor: pointer;
}
.ai-estimate-history-actions [role="button"]:hover {
  border-color: var(--ws-accent-line,#bfdbfe);
  background: #fff;
  color: var(--ws-accent-hover,#1d4ed8);
}
.ai-estimate-history-actions svg { width: 14px; height: 14px; }
.ai-estimate-chat {
  min-width: 0;
  min-height: 0;
  display: grid;
  grid-template-rows: minmax(120px, 1fr) auto;
  background: #fff;
}
.ai-estimate-messages {
  min-height: 0;
  overflow: auto;
  display: grid;
  align-content: start;
  gap: 16px;
  padding: 22px min(32px, 4vw);
  background: #fff;
}
.ai-estimate-msg {
  display: flex;
  width: 100%;
  min-width: 0;
}
.ai-estimate-msg-user { justify-content: flex-end; }
.ai-estimate-msg-assistant,
.ai-estimate-msg-error { justify-content: flex-start; }
.ai-estimate-msg-body {
  position: relative;
  max-width: min(760px, 88%);
  padding: 10px 40px 10px 12px;
  border: 1px solid var(--ws-line,#e2e8f0);
  border-radius: 8px;
  background: var(--ws-soft,#f8fafc);
  color: var(--ws-ink,#0f172a);
}
.ai-estimate-msg-delete {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 26px;
  height: 26px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid transparent;
  border-radius: 7px;
  background: transparent;
  color: var(--ws-subtle,#94a3b8);
  cursor: pointer;
  opacity: .52;
  transition: opacity .15s ease, background .15s ease, border-color .15s ease, color .15s ease;
}
.ai-estimate-msg-delete:hover,
.ai-estimate-msg-delete:focus-visible {
  border-color: var(--ws-accent-line,#bfdbfe);
  background: #fff;
  color: var(--ws-accent-hover,#1d4ed8);
  opacity: 1;
}
.ai-estimate-msg-delete svg {
  width: 14px;
  height: 14px;
}
.ai-estimate-msg-has-draft .ai-estimate-msg-body {
  width: 100%;
  max-width: none;
}
.ai-estimate-msg-user .ai-estimate-msg-body {
  border-color: var(--ws-accent-line,#bfdbfe);
  background: var(--ws-accent-soft,#eff6ff);
}
.ai-estimate-msg-error .ai-estimate-msg-body {
  border-color: #fecaca;
  background: #fef2f2;
  color: #991b1b;
}
.ai-estimate-msg-body p {
  margin: 0;
  font-size: 13px;
  line-height: 1.45;
}
.ai-estimate-msg-content {
  min-width: 0;
  color: inherit;
  font-size: 13px;
  line-height: 1.45;
}
.ai-estimate-msg-content p + p,
.ai-estimate-msg-content ul + p,
.ai-estimate-msg-content ol + p,
.ai-estimate-msg-content blockquote + p {
  margin-top: 8px;
}
.ai-estimate-msg-content h3,
.ai-estimate-msg-content h4,
.ai-estimate-msg-content h5,
.ai-estimate-msg-content h6 {
  margin: 10px 0 6px;
  color: var(--ws-ink,#0f172a);
  font-weight: 900;
  line-height: 1.25;
}
.ai-estimate-msg-content h3:first-child,
.ai-estimate-msg-content h4:first-child,
.ai-estimate-msg-content h5:first-child,
.ai-estimate-msg-content h6:first-child { margin-top: 0; }
.ai-estimate-msg-content h3 { font-size: 15px; }
.ai-estimate-msg-content h4,
.ai-estimate-msg-content h5,
.ai-estimate-msg-content h6 { font-size: 14px; }
.ai-estimate-msg-content ul,
.ai-estimate-msg-content ol {
  margin: 6px 0 0;
  padding-left: 20px;
}
.ai-estimate-msg-content li {
  margin: 3px 0;
  padding-left: 2px;
}
.ai-estimate-msg-content strong { font-weight: 900; }
.ai-estimate-msg-content em { color: var(--ws-text,#334155); }
.ai-estimate-msg-content code {
  padding: 1px 5px;
  border: 1px solid var(--ws-line,#dbe4ef);
  border-radius: 5px;
  background: var(--ws-soft,#f8fafc);
  color: var(--ws-ink,#0f172a);
  font: 12px/1.4 Consolas, "Liberation Mono", monospace;
}
.ai-estimate-msg-content blockquote {
  margin: 8px 0 0;
  padding: 6px 10px;
  border-left: 3px solid var(--ws-accent-line,#93c5fd);
  background: var(--ws-soft,#f8fafc);
  color: var(--ws-text,#334155);
}
.ai-estimate-msg-content a {
  color: var(--ws-accent-hover,#1d4ed8);
  font-weight: 700;
  text-decoration: none;
}
.ai-estimate-msg-content a:hover { text-decoration: underline; }
.ai-estimate-md-table-wrap {
  max-width: 100%;
  overflow: auto;
  margin: 8px 0 0;
  border: 1px solid var(--ws-line,#dbe4ef);
  border-radius: 8px;
  background: #fff;
}
.ai-estimate-msg-content > .ai-estimate-md-table-wrap:first-child { margin-top: 0; }
.ai-estimate-msg-content .ai-estimate-md-table-wrap + p,
.ai-estimate-msg-content .ai-estimate-md-table-wrap + ul,
.ai-estimate-msg-content .ai-estimate-md-table-wrap + ol {
  margin-top: 8px;
}
.ai-estimate-md-table {
  width: 100%;
  min-width: 420px;
  border-collapse: collapse;
  color: var(--ws-ink,#0f172a);
  font-size: 12px;
  line-height: 1.35;
}
.ai-estimate-md-table th,
.ai-estimate-md-table td {
  padding: 8px 10px;
  border-right: 1px solid var(--ws-line,#e2e8f0);
  border-bottom: 1px solid var(--ws-line,#e2e8f0);
  text-align: left;
  vertical-align: top;
}
.ai-estimate-md-table th:last-child,
.ai-estimate-md-table td:last-child { border-right: 0; }
.ai-estimate-md-table tbody tr:last-child td { border-bottom: 0; }
.ai-estimate-md-table th {
  background: var(--ws-canvas,#f1f5f9);
  color: var(--ws-text,#475569);
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0;
}
.ai-estimate-md-table td {
  background: #fff;
  word-break: normal;
  overflow-wrap: anywhere;
}
.ai-estimate-md-table .is-align-right { text-align: right; }
.ai-estimate-md-table .is-align-center { text-align: center; }
.ai-estimate-md-table code {
  white-space: nowrap;
}
.ai-estimate-msg-body time {
  display: block;
  margin-top: 6px;
  color: var(--ws-subtle,#94a3b8);
  font-size: 10px;
  line-height: 1;
}
.ai-estimate-msg-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 8px;
}
.ai-estimate-msg-meta span {
  min-height: 22px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 0 7px;
  border: 1px solid var(--ws-line,#dbe4ef);
  border-radius: 999px;
  background: #fff;
  color: var(--ws-muted,#64748b);
  font-size: 11px;
}
.ai-estimate-msg-meta b { color: var(--ws-ink,#0f172a); }
.ai-estimate-msg-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 10px;
}
.ai-estimate-msg-actions button {
  min-height: 32px;
  padding: 0 12px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 800;
}
.ai-estimate-loader {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-left: 8px;
  vertical-align: middle;
}
.ai-estimate-loader i {
  width: 5px;
  height: 5px;
  display: block;
  border-radius: 50%;
  background: var(--ws-accent,#2563eb);
  animation: aiEstimatePulse 1s infinite ease-in-out;
}
.ai-estimate-loader i:nth-child(2) { animation-delay: .15s; }
.ai-estimate-loader i:nth-child(3) { animation-delay: .3s; }
@keyframes aiEstimatePulse {
  0%, 80%, 100% { opacity: .25; transform: translateY(0); }
  40% { opacity: 1; transform: translateY(-3px); }
}
.ai-estimate-chat-estimate {
  width: 100%;
  margin-top: 12px;
  overflow: auto;
  border: 1px solid var(--ws-line,#dbe4ef);
  border-radius: 8px;
  background: #fff;
}
.ai-estimate-table-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 10px 14px 0;
}
.ai-estimate-table-actions button {
  min-height: 30px;
  padding: 0 10px;
  border: 1px solid var(--ws-line,#dbe4ef);
  border-radius: 8px;
  background: var(--ws-soft,#f8fafc);
  color: var(--ws-accent-hover,#1d4ed8);
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
}
.ai-estimate-table-actions button:hover {
  border-color: var(--ws-accent-line,#bfdbfe);
  background: var(--ws-accent-soft,#eff6ff);
}
.ai-estimate-chat-debug {
  margin-top: 10px;
  overflow: hidden;
  border: 1px solid #fecaca;
  border-radius: 8px;
  background: #fff;
}
.ai-estimate-chat-debug pre {
  max-height: 150px;
  overflow: auto;
  margin: 0;
  padding: 10px 12px;
  border-top: 1px solid #fecaca;
  background: var(--ws-ink,#0f172a);
  color: var(--ws-line,#e2e8f0);
  font: 11px/1.45 Consolas, "Liberation Mono", monospace;
  white-space: pre-wrap;
  word-break: break-word;
}
.ai-estimate-usage,
.ai-estimate-debug,
.ai-estimate-form,
.ai-estimate-preview {
  border: 1px solid var(--ws-line,#e2e8f0);
  border-radius: 8px;
  background: #fff;
}
.ai-estimate-usage {
  padding: 12px;
  margin-bottom: 12px;
}
.ai-estimate-debug {
  margin-bottom: 12px;
  overflow: hidden;
}
.ai-estimate-debug-head {
  padding: 10px 12px;
  border-bottom: 1px solid var(--ws-canvas,#edf2f7);
  background: var(--ws-soft,#f8fafc);
}
.ai-estimate-debug-head b {
  color: var(--ws-ink,#0f172a);
  font-size: 13px;
  line-height: 1.25;
}
.ai-estimate-debug-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  padding: 10px 12px;
}
.ai-estimate-debug-list div {
  min-width: 0;
  padding: 8px 10px;
  border: 1px solid var(--ws-canvas,#edf2f7);
  border-radius: 8px;
  background: #fbfdff;
}
.ai-estimate-debug-list span,
.ai-estimate-debug-list strong {
  display: block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.ai-estimate-debug-list span {
  color: var(--ws-muted,#64748b);
  font-size: 11px;
  line-height: 1.2;
}
.ai-estimate-debug-list strong {
  margin-top: 3px;
  color: var(--ws-ink,#0f172a);
  font-size: 12px;
  line-height: 1.25;
}
.ai-estimate-debug pre {
  max-height: 160px;
  overflow: auto;
  margin: 0;
  padding: 10px 12px;
  border-top: 1px solid var(--ws-canvas,#edf2f7);
  background: var(--ws-ink,#0f172a);
  color: var(--ws-line,#e2e8f0);
  font: 11px/1.45 Consolas, "Liberation Mono", monospace;
  white-space: pre-wrap;
  word-break: break-word;
}
.ai-estimate-usage-compact {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}
.ai-estimate-usage-compact div {
  min-width: 0;
  display: grid;
  gap: 2px;
}
.ai-estimate-usage-compact b {
  color: var(--ws-ink,#0f172a);
  font-size: 18px;
  line-height: 1.05;
}
.ai-estimate-usage-compact span,
.ai-estimate-usage-compact em,
.ai-estimate-usage-line {
  color: var(--ws-muted,#64748b);
  font-size: 12px;
  line-height: 1.35;
}
.ai-estimate-usage-compact em {
  font-style: normal;
  white-space: nowrap;
}
.ai-estimate-progress {
  height: 5px;
  overflow: hidden;
  margin: 8px 0;
  border-radius: 999px;
  background: var(--ws-line,#e2e8f0);
}
.ai-estimate-progress span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--ws-accent,#2563eb);
}
.ai-estimate-usage-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.ai-estimate-usage-line button {
  min-height: 26px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0 10px;
  border: 1px solid var(--ws-accent-line,#bfdbfe);
  border-radius: 8px;
  background: var(--ws-accent-soft,#eff6ff);
  color: var(--ws-accent-hover,#1d4ed8);
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
}
.ai-estimate-alert {
  padding: 10px 12px;
  border: 1px solid #fecaca;
  border-radius: 8px;
  background: #fef2f2;
  color: #b91c1c;
  font-size: 13px;
}
.ai-estimate-form {
  display: grid;
  gap: 12px;
  padding: 14px;
}
.ai-estimate-field {
  display: grid;
  gap: 6px;
  min-width: 0;
  color: var(--ws-text,#334155);
  font-size: 12px;
  font-weight: 700;
}
.ai-estimate-field input,
.ai-estimate-field textarea,
.ai-estimate-field select {
  width: 100%;
  min-width: 0;
  border: 1px solid var(--ws-line,#dbe4ef);
  border-radius: 8px;
  background: #fff;
  color: var(--ws-ink,#0f172a);
  font: 500 13px/1.35 inherit;
  outline: none;
}
.ai-estimate-field input,
.ai-estimate-field select { height: 38px; padding: 0 10px; }
.ai-estimate-field textarea {
  min-height: 112px;
  resize: vertical;
  padding: 10px;
}
.ai-estimate-field input:focus,
.ai-estimate-field textarea:focus,
.ai-estimate-field select:focus {
  border-color: var(--ws-accent-line,#93c5fd);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, .12);
}
.ai-estimate-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(220px, .8fr);
  gap: 12px;
  align-items: start;
}
.ai-estimate-composer {
  border-width: 1px 0 0;
  border-radius: 0;
  gap: 8px;
  padding: 10px 12px;
  background: #fff;
}
.ai-estimate-mode-tabs {
  width: max-content;
  max-width: 100%;
  display: inline-flex;
  gap: 4px;
  padding: 3px;
  border: 1px solid var(--ws-line,#dbe4ef);
  border-radius: 8px;
  background: var(--ws-soft,#f8fafc);
}
.ai-estimate-mode-tabs button {
  min-height: 28px;
  padding: 0 12px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--ws-muted,#64748b);
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
}
.ai-estimate-mode-tabs button.is-active {
  background: var(--ws-accent,#2563eb);
  color: #fff;
  box-shadow: 0 1px 3px rgba(37, 99, 235, .24);
}
.ai-estimate-prompt textarea {
  min-height: 58px;
  max-height: 96px;
}
.ai-estimate-composer-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
}
.ai-estimate-sendbar {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  min-width: 0;
}
.ai-estimate-sendbar button {
  min-height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.ai-estimate-modal.is-project-context .ai-estimate-sendbar [data-ai-action="generate"] {
  min-width: 126px;
  border: 1px solid var(--ws-accent-hover,#1d4ed8);
  background: var(--ws-accent,#2563eb);
  color: #fff;
  box-shadow: 0 8px 18px rgba(37, 99, 235, .24);
  font-weight: 900;
}
.ai-estimate-modal.is-project-context .ai-estimate-sendbar [data-ai-action="generate"]:hover {
  border-color: var(--ws-accent,#1e40af);
  background: var(--ws-accent-hover,#1d4ed8);
  box-shadow: 0 10px 22px rgba(37, 99, 235, .3);
}
.ai-estimate-context-panel {
  min-width: 0;
  display: grid;
  gap: 7px;
}
.ai-estimate-detail {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
}
.ai-estimate-detail > span {
  color: var(--ws-muted,#64748b);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0;
}
.ai-estimate-detail label {
  position: relative;
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  cursor: pointer;
}
.ai-estimate-detail input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}
.ai-estimate-detail label span {
  min-height: 28px;
  display: inline-flex;
  align-items: center;
  padding: 0 10px;
  border: 1px solid var(--ws-line,#dbe4ef);
  border-radius: 999px;
  background: #fff;
  color: var(--ws-text,#334155);
  font-size: 12px;
  font-weight: 800;
  line-height: 1.2;
}
.ai-estimate-detail input:checked + span {
  border-color: var(--ws-accent-line,#93c5fd);
  background: var(--ws-accent-soft,#eff6ff);
  color: var(--ws-accent-hover,#1d4ed8);
  box-shadow: inset 0 0 0 1px rgba(37, 99, 235, .08);
}
.ai-estimate-checks {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px 8px;
  padding-top: 0;
}
.ai-estimate-context-title {
  color: var(--ws-muted,#64748b);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0;
}
.ai-estimate-checks label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 28px;
  padding: 0 9px;
  border: 1px solid var(--ws-line,#dbe4ef);
  border-radius: 999px;
  background: var(--ws-soft,#f8fafc);
  color: var(--ws-text,#334155);
  font-size: 12px;
  line-height: 1.25;
  white-space: nowrap;
}
.ai-estimate-checks input {
  width: 14px;
  height: 14px;
  accent-color: var(--ws-accent,#2563eb);
}
.ai-estimate-preview {
  display: none;
  margin-top: 12px;
  overflow: auto;
}
.ai-estimate-preview:not(:empty) { display: block; }
.ai-estimate-preview-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 12px 14px;
  border-bottom: 1px solid var(--ws-canvas,#edf2f7);
  background: #fff;
}
.ai-estimate-preview-head b {
  display: block;
  color: var(--ws-ink,#0f172a);
  font-size: 14px;
  line-height: 1.25;
}
.ai-estimate-preview-head span {
  display: block;
  margin-top: 2px;
  color: var(--ws-muted,#64748b);
  font-size: 12px;
}
.ai-estimate-warnings,
.ai-estimate-notes {
  margin: 12px 14px 0;
  padding: 10px 12px;
  border: 1px solid #fde68a;
  border-radius: 8px;
  background: #fffbeb;
  color: #92400e;
  font-size: 12px;
  line-height: 1.4;
}
.ai-estimate-notes {
  border-color: var(--ws-line,#dbe4ef);
  background: var(--ws-soft,#f8fafc);
  color: var(--ws-text,#475569);
}
.ai-estimate-warnings b,
.ai-estimate-notes summary {
  color: var(--ws-ink,#0f172a);
  font-weight: 800;
}
.ai-estimate-warnings ul,
.ai-estimate-notes ul {
  margin: 6px 0 0;
  padding-left: 18px;
}
.ai-estimate-tree {
  display: grid;
  gap: 10px;
  padding: 12px 14px 14px;
}
.ai-estimate-table {
  width: 100%;
  min-width: 980px;
  padding: 10px 12px 12px;
}
.ai-estimate-table-row {
  display: grid;
  grid-template-columns: minmax(320px, 2.2fr) 110px 130px 130px 130px 120px;
  gap: 8px;
  align-items: center;
  min-height: 36px;
  padding: 7px 8px;
  border-bottom: 1px solid var(--ws-canvas,#edf2f7);
  color: var(--ws-text,#334155);
  font-size: 12px;
  line-height: 1.25;
}
.ai-estimate-table-row:last-child { border-bottom: 0; }
.ai-estimate-table-head {
  min-height: 30px;
  border: 1px solid var(--ws-line,#e2e8f0);
  border-radius: 8px 8px 0 0;
  background: var(--ws-soft,#f8fafc);
  color: var(--ws-muted,#64748b);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}
.ai-estimate-node-row {
  border-right: 1px solid var(--ws-line,#e2e8f0);
  border-left: 1px solid var(--ws-line,#e2e8f0);
  background: #fff;
  font-weight: 800;
}
.ai-estimate-stage-row {
  margin-top: 6px;
  background: var(--ws-accent-soft,#eef6ff);
  color: var(--ws-ink,#0f172a);
}
.ai-estimate-section-row {
  background: var(--ws-soft,#f8fafc);
}
.ai-estimate-table-row > span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.ai-estimate-table-row > span:first-child {
  display: flex;
  align-items: center;
  gap: 8px;
}
.ai-estimate-section-row > span:first-child { padding-left: 20px; }
.ai-estimate-item-row > span:first-child { padding-left: 48px; }
.ai-estimate-table-row b {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.ai-estimate-table-row small {
  display: block;
  overflow: hidden;
  color: var(--ws-muted,#64748b);
  font-size: 11px;
  font-weight: 500;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.ai-estimate-table-row button {
  width: 24px;
  height: 24px;
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--ws-accent-line,#bfdbfe);
  border-radius: 6px;
  background: #fff;
  color: var(--ws-accent-hover,#1d4ed8);
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
}
.ai-estimate-stage {
  border: 1px solid var(--ws-line,#e2e8f0);
  border-radius: 8px;
  background: #fff;
  overflow: hidden;
}
.ai-estimate-stage h4 {
  margin: 0;
  padding: 10px 12px;
  border-bottom: 1px solid var(--ws-canvas,#edf2f7);
  background: var(--ws-soft,#f8fafc);
  color: var(--ws-ink,#0f172a);
  font-size: 13px;
  line-height: 1.25;
}
.ai-estimate-section {
  padding: 10px 12px;
  border-bottom: 1px solid var(--ws-canvas,#edf2f7);
}
.ai-estimate-section:last-child { border-bottom: 0; }
.ai-estimate-section > strong {
  display: block;
  margin-bottom: 8px;
  color: var(--ws-text,#334155);
  font-size: 12px;
  line-height: 1.2;
}
.ai-estimate-items { display: grid; gap: 6px; }
.ai-estimate-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 8px 10px;
  border: 1px solid var(--ws-canvas,#edf2f7);
  border-radius: 8px;
  background: #fbfdff;
}
.ai-estimate-item b {
  display: block;
  overflow: hidden;
  color: var(--ws-ink,#0f172a);
  font-size: 12px;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.ai-estimate-item span {
  display: block;
  margin-top: 2px;
  color: var(--ws-muted,#64748b);
  font-size: 11px;
  line-height: 1.25;
}
.ai-estimate-item-metrics {
  display: grid;
  grid-template-columns: repeat(3, max-content);
  gap: 6px;
  align-items: center;
}
.ai-estimate-item-metrics span {
  min-height: 24px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin: 0;
  padding: 0 8px;
  border: 1px solid var(--ws-line,#dbe4ef);
  border-radius: 999px;
  background: #fff;
  color: var(--ws-text,#334155);
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
}
.ai-estimate-modal.is-busy .ai-estimate-sendbar [data-ai-action="generate"] { opacity: .7; }
@media (max-width: 900px) {
  .ai-estimate-dialog {
    left: 12px !important;
    top: 12px !important;
    width: calc(100vw - 24px) !important;
    height: calc(100vh - 24px) !important;
  }
  .ai-estimate-body {
    grid-template-columns: 1fr;
    grid-template-rows: auto minmax(0, 1fr);
  }
  .ai-estimate-history {
    max-height: 168px;
    border-right: 0;
    border-bottom: 1px solid var(--ws-line,#dbe4ef);
  }
  .ai-estimate-history-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .ai-estimate-chat {
    min-height: 0;
  }
  .ai-estimate-grid,
  .ai-estimate-composer-row,
  .ai-estimate-debug-list,
  .ai-estimate-preview-head,
  .ai-estimate-item {
    grid-template-columns: 1fr;
  }
  .ai-estimate-checks {
    flex-wrap: wrap;
    padding-top: 0;
  }
  .ai-estimate-sendbar {
    flex-wrap: wrap;
    justify-content: stretch;
  }
  .ai-estimate-sendbar button { flex: 1 1 auto; }
  .ai-estimate-item-metrics { grid-template-columns: repeat(2, max-content); }
}

/* Money visibility permission for portal-level modules */
body.no-money-supply .supply-page .so-total,
body.no-money-supply .supply-page .so-static-row:has(#supply-view-paid),
body.no-money-supply .supply-page button[name="order_action"][value="submit"],
body.no-money-supply #supply-view-submit-form,
body.no-money-supply .supply-page .so-items :is(th,td):nth-child(4),
body.no-money-supply .supply-page .so-items :is(th,td):nth-child(5),
body.no-money-supply .supply-page #supply-view-body table :is(th,td):nth-child(3),
body.no-money-supply .supply-page #supply-view-body table :is(th,td):nth-child(4),
body.no-money-supply .supply-view-needs #sup-stats .so-stat-card:nth-child(2),
body.no-money-supply .supply-view-needs .so-tbl-wrap table:not(.so-items) :is(th,td):nth-child(7),
body.no-money-supply .supply-view-needs .so-tbl-wrap table:not(.so-items) :is(th,td):nth-child(8),
body.no-money-supply .supply-view-needs .so-tbl-wrap table:not(.so-items) :is(th,td):nth-child(9),
body.no-money-supply .supply-view-orders .so-stats-row .so-stat-card:nth-child(2),
body.no-money-supply .supply-view-orders .so-tbl-wrap table.compact :is(th,td):nth-child(4),
body.no-money-supply .supply-view-reports .so-stats-row .so-stat-card,
body.no-money-supply .supply-view-reports .so-tbl-wrap table.compact :is(th,td):nth-child(n+2) {
  display: none !important;
}

body.no-money-warehouse .wh-view-warehouses .wh-stats-row .wh-stat-card:nth-child(5),
body.no-money-warehouse .wh-view-stock .wh-stats-row .wh-stat-card:nth-child(4),
body.no-money-warehouse .wh-view-receipts .wh-stats-row .wh-stat-card:nth-child(4),
body.no-money-warehouse .wh-view-documents .wh-stats-row .wh-stat-card:nth-child(5),
body.no-money-warehouse .wh-view-reports .wh-stats-row .wh-stat-card:nth-child(1),
body.no-money-warehouse .wh-view-reports .wh-stats-row .wh-stat-card:nth-child(2),
body.no-money-warehouse .wh-view-reports .wh-stats-row .wh-stat-card:nth-child(3) {
  display: none !important;
}

body.no-money-timesheet .ts-tab[data-ts-tab="payroll"],
body.no-money-timesheet .ts-panel[data-ts-panel="payroll"],
body.no-money-timesheet .ts-money-field,
body.no-money-timesheet [data-ts-export-payroll],
body.no-money-timesheet [data-ts-save-payroll],
body.no-money-timesheet #ts-payroll-finance-link,
body.no-money-timesheet .ts-panel[data-ts-panel="people"] .ts-list-table col:nth-child(6),
body.no-money-timesheet .ts-panel[data-ts-panel="people"] .ts-list-table :is(th,td):nth-child(6) {
  display: none !important;
}

body.no-money-finance .fin-grid,
body.no-money-finance .fin-action-buttons,
body.no-money-finance .fin-modal-backdrop,
body.no-money-finance .fin-payroll-actions,
body.no-money-finance .fin-reimburse-form {
  display: none !important;
}

/* Compact, consistent application notifications */
.app-toast-stack {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 10050;
  width: min(380px, calc(100vw - 32px));
  display: grid;
  gap: 8px;
  pointer-events: none;
}
.app-toast {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr) 24px;
  gap: 10px;
  align-items: start;
  padding: 11px 10px 11px 12px;
  border: 1px solid var(--ws-line,#dbe4ef);
  border-left: 4px solid var(--ws-accent,#3b82f6);
  border-radius: 10px;
  background: rgba(255,255,255,.98);
  color: var(--ws-ink,#172033);
  box-shadow: 0 10px 30px rgba(15,23,42,.16);
  pointer-events: auto;
  animation: appToastIn .18s ease-out both;
}
.app-toast.is-success { border-left-color:#16a34a; }
.app-toast.is-warning { border-left-color:#f59e0b; }
.app-toast.is-error { border-left-color:#dc2626; }
.app-toast.is-leaving { animation:appToastOut .18s ease-in both; }
.app-toast-icon {
  width: 26px;
  height: 26px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--ws-accent-soft,#eff6ff);
  color: var(--ws-accent,#2563eb);
  font-size: 13px;
  font-weight: 900;
}
.app-toast.is-success .app-toast-icon { background:#ecfdf5; color:#15803d; }
.app-toast.is-warning .app-toast-icon { background:#fffbeb; color:#b45309; }
.app-toast.is-error .app-toast-icon { background:#fef2f2; color:#b91c1c; }
.app-toast-content { min-width:0; display:grid; gap:2px; }
.app-toast-content strong { font-size:12px; line-height:1.3; }
.app-toast-content > span { color:var(--ws-muted,#526174); font-size:12px; line-height:1.4; overflow-wrap:anywhere; }
.app-toast-close { width:24px; height:24px; border:0; border-radius:6px; background:transparent; color:var(--ws-subtle,#94a3b8); font-size:18px; line-height:1; cursor:pointer; }
.app-toast-close:hover { background:var(--ws-canvas,#f1f5f9); color:var(--ws-text,#475569); }
@keyframes appToastIn { from { opacity:0; transform:translateY(8px) scale(.98); } to { opacity:1; transform:none; } }
@keyframes appToastOut { to { opacity:0; transform:translateX(12px) scale(.98); } }
@media (max-width:600px) {
  .app-toast-stack { right:16px; bottom:16px; }
}
/* Завершённый проект: заметный, но компактный режим только для просмотра. */
.project-readonly-banner {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 42px;
  padding: 8px 14px;
  color: var(--ws-accent-hover,#1e3a5f);
  background: var(--ws-accent-soft,#eef6ff);
  border-bottom: 1px solid var(--ws-accent-line,#bfdbfe);
  font-size: 12px;
  line-height: 1.35;
}
.project-readonly-banner > span:nth-child(2) { flex: 1; }
.project-readonly-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  flex: 0 0 24px;
  border-radius: 50%;
  color: #fff;
  background: var(--ws-accent,#1565c0);
  font-weight: 800;
}
.project-readonly-banner button {
  flex: 0 0 auto;
  padding: 7px 12px;
  color: var(--ws-accent-hover,#1557a0);
  background: #fff;
  border: 1px solid var(--ws-accent-line,#93c5fd);
  border-radius: 7px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 700;
}
.project-readonly-banner button:hover { background: var(--ws-soft,#f8fbff); }
[data-project-readonly-disabled="1"] { cursor: not-allowed !important; }
button[data-project-readonly-disabled="1"],
input[data-project-readonly-disabled="1"],
select[data-project-readonly-disabled="1"],
textarea[data-project-readonly-disabled="1"] { opacity: .52 !important; }
@media (max-width: 760px) {
  .project-readonly-banner { align-items: flex-start; flex-wrap: wrap; }
  .project-readonly-banner button { margin-left: 34px; }
}
