/* Matrix24 CRM — Obsidian & Soft Lavender Theme (API-compatible drop-in for styles.css) */

:root {
  color-scheme: dark;
  --bg: #101017;
  --bg-elevated: #171722;
  --sidebar: #181722;
  --topbar: rgba(16, 16, 23, 0.88);
  --card: #1b1b26;
  --card-2: #21212f;
  --surface-2: #262636;
  --hover: #2d2d40;
  --text: #f0eff7;
  --text-muted: #9c99b0;
  --text-meta: #75728c;
  --accent: #dcaeff;
  --accent-2: #c68ef5;
  --accent-soft: rgba(220, 174, 255, 0.16);
  --accent-ink: #161122;
  --cyan: #28b8e5;
  --success: #7cd98e;
  --success-lime: #a5e887;
  --warning: #e8b36d;
  --danger: #ef7b87;
  --border: rgba(255, 255, 255, 0.065);
  --border-strong: rgba(255, 255, 255, 0.14);
  --shadow: 0 18px 42px rgba(0, 0, 0, 0.36);
  --radius: 14px;
  --sidebar-width: 256px;
  --topbar-height: 68px;
  --chart-1: #dcaeff;
  --chart-2: #7cd98e;
  --chart-grid: rgba(255, 255, 255, 0.065);
  --chart-track: rgba(255, 255, 255, 0.06);
  font-family: "Plus Jakarta Sans", "DM Sans", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

[data-theme="monokai"] {
  --bg: #1e1f1c;
  --bg-elevated: #252622;
  --sidebar: #1b1c19;
  --topbar: rgba(30, 31, 28, 0.9);
  --card: #272822;
  --card-2: #2f3029;
  --surface-2: #36372f;
  --hover: #3f4037;
  --text: #f8f8f2;
  --text-muted: #b5b4a7;
  --text-meta: #8a897d;
  --accent: #a6e22e;
  --accent-2: #8ec920;
  --accent-soft: rgba(166, 226, 46, 0.16);
  --accent-ink: #1a1b16;
  --cyan: #66d9ef;
  --success: #a6e22e;
  --warning: #fd971f;
  --danger: #f92672;
  --chart-1: #66d9ef;
  --chart-2: #a6e22e;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  overflow-x: hidden;
  font-feature-settings: "cv02", "cv03", "cv04", "cv11";
}

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

input[type="checkbox"] {
  accent-color: var(--accent);
}

button {
  border: 0;
}

a {
  color: inherit;
}

:focus-visible {
  outline: 2px solid rgba(220, 174, 255, 0.72);
  outline-offset: 2px;
}

.hidden {
  display: none !important;
}

.muted {
  color: var(--text-meta);
}

.ui-icon {
  width: 19px;
  height: 19px;
  display: block;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex-shrink: 0;
}

/* ── Login & First-Run Setup ── */
.login-shell,
.setup-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1fr 440px;
  background:
    radial-gradient(circle at 18% 16%, rgba(220, 174, 255, 0.12), transparent 34%),
    radial-gradient(circle at 80% 82%, rgba(40, 184, 229, 0.08), transparent 32%),
    var(--bg);
}

.login-visual {
  padding: 56px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 100vh;
}

.brand-row,
.brand-mark {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-icon {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  background: var(--accent);
  flex-shrink: 0;
}

.brand-icon img {
  display: block;
  width: 24px;
  height: 24px;
}

.brand-copy strong {
  display: block;
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text);
}

.brand-copy span {
  color: var(--text-muted);
  font-size: 12px;
}

.login-intro {
  max-width: 680px;
}

.login-intro h2 {
  margin: 0 0 12px;
  font-size: 40px;
  line-height: 1.08;
  font-weight: 700;
  letter-spacing: -0.03em;
  text-wrap: balance;
}

.login-intro p {
  margin: 0;
  max-width: 520px;
  color: var(--text-muted);
  font-size: 16px;
  line-height: 1.55;
}

.login-panel {
  min-height: 100vh;
  background: var(--sidebar);
  border-left: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 40px;
}

.login-card {
  width: 100%;
}

.login-card h1 {
  margin: 0 0 8px;
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.025em;
}

.login-card p {
  margin: 0 0 28px;
  color: var(--text-muted);
  font-size: 14px;
}

.setup-restore {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}

.setup-restore small {
  color: var(--text-meta);
  font-size: 12px;
  line-height: 1.45;
}

.setup-restore-divider {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text-meta);
  font-size: 12px;
}

.setup-restore-divider::before,
.setup-restore-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--border);
}

/* ── Fields & Controls ── */
.field {
  display: grid;
  gap: 7px;
  margin-bottom: 14px;
}

.field label,
.field > span {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
}

.field.inline {
  margin-bottom: 0;
  display: flex;
  align-items: center;
  gap: 8px;
}

.field.inline span {
  white-space: nowrap;
}

.input,
.select,
.textarea {
  min-height: 42px;
  width: 100%;
  color: var(--text);
  background: #222230;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 9px 13px;
  outline: none;
  font-size: 14px;
  transition: border-color 0.16s ease, background-color 0.16s ease, box-shadow 0.16s ease;
}

.input::placeholder,
.textarea::placeholder {
  color: var(--text-meta);
}

.textarea {
  min-height: 92px;
  resize: vertical;
  line-height: 1.5;
}

.input:focus,
.select:focus,
.textarea:focus {
  border-color: rgba(220, 174, 255, 0.72);
  background: #252535;
  box-shadow: 0 0 0 3px rgba(220, 174, 255, 0.14);
}

.select option,
select option {
  color: var(--text);
  background: #1b1b26;
}

.select optgroup,
select optgroup {
  color: var(--text-muted);
  background: #1b1b26;
}

.readonly-line {
  min-height: 42px;
  display: flex;
  align-items: center;
  padding: 9px 13px;
  color: var(--text-muted);
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border);
  border-radius: 12px;
  font-size: 14px;
}

.btn {
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 18px;
  border-radius: 999px;
  cursor: pointer;
  color: var(--text);
  background: var(--surface-2);
  border: 1px solid var(--border);
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  flex-shrink: 0;
  transition: transform 0.16s cubic-bezier(0.16, 1, 0.3, 1), background-color 0.16s ease, border-color 0.16s ease, box-shadow 0.16s ease;
}

.btn:hover:not(:disabled) {
  transform: translateY(-1px);
  background: var(--hover);
  border-color: var(--border-strong);
}

.btn:active:not(:disabled) {
  transform: translateY(0);
}

.btn:disabled {
  opacity: 0.48;
  cursor: not-allowed;
}

.btn-primary {
  color: var(--accent-ink);
  background: var(--accent);
  border-color: transparent;
  font-weight: 700;
}

.btn-primary:hover:not(:disabled) {
  background: #e7c5ff;
  border-color: transparent;
  box-shadow: 0 8px 24px rgba(220, 174, 255, 0.24);
}

.btn-danger {
  color: #ffd7dc;
  background: rgba(239, 123, 135, 0.16);
  border: 1px solid rgba(239, 123, 135, 0.36);
}

.btn-danger:hover:not(:disabled) {
  background: rgba(239, 123, 135, 0.24);
}

.btn-ghost {
  background: rgba(255, 255, 255, 0.035);
  border: 1px solid var(--border);
  color: var(--text-muted);
}

.btn-ghost:hover:not(:disabled) {
  color: var(--text);
  background: rgba(255, 255, 255, 0.07);
}

.btn-sm {
  min-height: 32px;
  padding: 0 13px;
  font-size: 12px;
}

.icon-btn {
  width: 38px;
  min-width: 38px;
  height: 38px;
  padding: 0;
  display: inline-grid;
  place-items: center;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.045);
  color: var(--text-muted);
  cursor: pointer;
  border: 1px solid var(--border);
  transition: background-color 0.16s ease, color 0.16s ease, border-color 0.16s ease, transform 0.16s ease;
}

.icon-btn:hover {
  color: var(--text);
  background: var(--hover);
  border-color: var(--border-strong);
}

.icon-btn-sm {
  width: 30px;
  min-width: 30px;
  height: 30px;
  border-radius: 10px;
  font-size: 12px;
}

.icon-btn-sm.danger {
  color: var(--text-muted);
}

.icon-btn-sm.danger:hover {
  color: var(--danger);
  border-color: rgba(239, 123, 135, 0.3);
  background: rgba(239, 123, 135, 0.12);
}

/* ── App Shell & Sidebar ── */
.app-shell,
.app-shell.premium-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
  background: var(--bg);
}

.sidebar,
.sidebar.premium-sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: var(--sidebar-width);
  background: var(--sidebar);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  z-index: 25;
}

.sidebar-header,
.premium-sidebar-header {
  min-height: var(--topbar-height);
  padding: 16px 18px;
  display: flex;
  align-items: center;
  border-bottom: 1px solid var(--border);
}

.premium-brand {
  gap: 12px;
}

.brand-icon.premium-logo {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: var(--accent);
}

.brand-icon.premium-logo img {
  width: 20px;
  height: 20px;
}

.premium-brand .brand-copy strong {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.025em;
  color: var(--text);
}

.premium-brand .brand-copy strong span {
  color: var(--accent);
}

.profile-card {
  margin-top: 14px;
  padding: 10px 12px;
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border);
  border-radius: 14px;
}

.avatar {
  width: 36px;
  height: 36px;
  min-width: 36px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  background: #9ec5ff;
  color: #101726;
  font-size: 12px;
  font-weight: 800;
  overflow: hidden;
}

.avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.avatar-sm {
  width: 34px;
  height: 34px;
  min-width: 34px;
  font-size: 11px;
}

.avatar-xs {
  width: 32px;
  height: 32px;
  min-width: 32px;
  font-size: 11px;
}

.avatar-mini {
  width: 26px;
  height: 26px;
  min-width: 26px;
  font-size: 10px;
  background: #f0a8b8;
  color: #1d1016;
}

.profile-card strong,
.user-title {
  display: block;
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.profile-card span,
.user-subtitle {
  display: block;
  font-size: 12px;
  color: var(--text-meta);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.nav,
.premium-nav {
  padding: 14px 12px 16px;
  display: grid;
  align-content: start;
  gap: 3px;
  overflow-y: auto;
  flex: 1;
}

.nav-section-label {
  margin: 6px 12px 6px;
  display: block;
  color: var(--text-meta);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.nav-section-spaced {
  margin-top: 18px;
}

.nav-item,
.premium-nav .nav-item {
  min-height: 42px;
  width: 100%;
  padding: 0 14px;
  border-radius: 999px;
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--text-muted);
  background: transparent;
  cursor: pointer;
  text-align: left;
  font-size: 14px;
  font-weight: 500;
  position: relative;
  transition: background-color 0.16s ease, color 0.16s ease;
}

.nav-item:hover,
.premium-nav .nav-item:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.045);
}

.nav-item.active,
.premium-nav .nav-item.active {
  color: var(--text);
  font-weight: 600;
  background: rgba(196, 152, 238, 0.2);
}

.nav-item.active::before,
.premium-nav .nav-item.active::before {
  display: none;
}

.nav-icon,
.premium-nav .nav-icon {
  width: 20px;
  height: 20px;
  display: grid;
  place-items: center;
  border: 0;
  color: currentColor;
  opacity: 0.86;
}

.nav-item.active .nav-icon,
.premium-nav .nav-item.active .nav-icon {
  color: var(--accent);
  opacity: 1;
}

.shortcut-item b {
  margin-left: auto;
  min-width: 22px;
  height: 20px;
  padding: 0 6px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  color: var(--accent-ink);
  background: var(--accent);
  font-size: 11px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.sidebar-footer,
.premium-sidebar-footer {
  margin-top: auto;
  padding: 14px 16px;
  border-top: 1px solid var(--border);
}

.premium-sidebar-footer.compact-footer {
  border-top: 1px solid var(--border);
}

.premium-sidebar-footer small {
  display: block;
  color: var(--text-meta);
  font-size: 11px;
}

.upgrade-card {
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--card);
}

.upgrade-title {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}

.upgrade-title strong {
  color: var(--text);
  font-size: 15px;
}

.upgrade-title span {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  color: var(--accent);
  background: var(--accent-soft);
}

.upgrade-card p {
  margin: 10px 0 14px;
  color: var(--text-muted);
  font-size: 12px;
  line-height: 1.45;
}

.upgrade-card .btn {
  width: 100%;
}

/* ── Main & Topbar ── */
.main {
  grid-column: 2;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.topbar,
.premium-topbar {
  height: var(--topbar-height);
  position: sticky;
  top: 0;
  z-index: 15;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 26px;
  background: var(--topbar);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(18px);
}

.menu-toggle {
  display: none;
}

.page-title {
  min-width: 140px;
}

.page-title h1 {
  margin: 0;
  font-size: 19px;
  font-weight: 700;
}

.page-title span {
  display: block;
  margin-top: 2px;
  color: var(--text-meta);
  font-size: 12px;
}

.search,
.premium-search {
  flex: 1;
  max-width: 480px;
  position: relative;
  display: flex;
  align-items: center;
}

.premium-search {
  margin-right: auto;
}

.search::before,
.filter-search-inline::before {
  display: none;
}

.premium-search > .ui-icon,
.filter-search-inline > .ui-icon {
  position: absolute;
  left: 15px;
  top: 50%;
  transform: translateY(-50%);
  width: 17px;
  height: 17px;
  color: var(--text-meta);
  pointer-events: none;
  z-index: 1;
}

.search input,
.premium-search input {
  width: 100%;
  height: 40px;
  min-height: 40px;
  padding-left: 42px;
  padding-right: 76px;
  border-radius: 999px;
  background: #1d1d29;
  border: 1px solid var(--border);
  font-size: 13px;
}

.search input:focus,
.premium-search input:focus {
  background: #222230;
  border-color: rgba(220, 174, 255, 0.55);
}

.premium-search kbd {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  height: 22px;
  min-width: 38px;
  padding: 0 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  color: var(--text-meta);
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border);
  font-size: 11px;
  font-family: inherit;
}

.search .search-clear {
  position: absolute;
  right: 58px;
  top: 50%;
  transform: translateY(-50%);
  cursor: pointer;
  color: var(--text-meta);
  font-size: 13px;
  border-radius: 999px;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  transition: background-color 0.16s ease, color 0.16s ease;
}

.search .search-clear:hover {
  background: var(--hover);
  color: var(--text);
}

.topbar-actions {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.premium-round-btn {
  width: 38px;
  min-width: 38px;
  height: 38px;
  border-radius: 999px;
  color: var(--accent-ink);
  background: var(--accent);
  border-color: transparent;
}

.premium-round-btn:hover {
  color: var(--accent-ink);
  background: #e7c5ff;
  border-color: transparent;
}

.premium-notify {
  position: relative;
  color: var(--text-muted);
}

.premium-notify .ui-icon {
  width: 17px;
  height: 17px;
}

.premium-notify::after {
  content: attr(data-notification-count);
  position: absolute;
  right: -4px;
  top: -4px;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  color: #1c1015;
  background: var(--danger);
  border: 2px solid var(--bg);
  font-size: 9px;
  font-weight: 800;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.premium-notify[data-notification-count="0"]::after {
  display: none;
}

.top-profile {
  height: 42px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 12px 4px 4px;
  border-radius: 999px;
  background: var(--card);
  border: 1px solid var(--border);
}

.top-profile strong,
.manager-cell strong,
.client-cell strong,
.stack-cell strong {
  display: block;
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
}

.top-profile span,
.manager-cell span,
.client-cell span,
.stack-cell span {
  display: block;
  color: var(--text-meta);
  font-size: 11px;
}

.profile-caret {
  margin-left: 2px;
  color: var(--text-meta) !important;
  font-size: 14px !important;
  line-height: 1;
}

/* ── Workspace & Page Headers ── */
.workspace {
  padding: 24px 26px 32px;
  flex: 1;
}

.section,
.premium-page {
  display: grid;
  gap: 18px;
}

.toolbar,
.premium-page-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.toolbar h2,
.premium-page-head h1 {
  margin: 0;
  color: var(--text);
  font-size: 24px;
  line-height: 1.15;
  font-weight: 700;
  letter-spacing: -0.025em;
}

.toolbar p,
.premium-page-head p {
  margin: 5px 0 0;
  color: var(--text-muted);
  font-size: 13px;
}

.premium-page-head.compact h1 {
  font-size: 24px;
}

.premium-add-btn {
  min-height: 40px;
  padding: 0 18px;
  font-weight: 700;
}

.premium-add-btn .ui-icon {
  width: 17px;
  height: 17px;
}

/* ── Filter Bar ── */
.filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--card);
}

.filter-bar .select,
.filter-bar .input {
  width: auto;
  min-width: 168px;
  height: 40px;
  min-height: 40px;
}

/* ── Cards & Grids ── */
.card,
.premium-card {
  border-radius: 16px;
  background: var(--card);
  border: 1px solid var(--border);
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.16);
}

.card-header,
.premium-card-header {
  min-height: 52px;
  padding: 14px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid var(--border);
}

.card-header h3,
.premium-card-header h3 {
  margin: 0;
  color: var(--text);
  font-size: 15px;
  font-weight: 650;
  display: flex;
  align-items: center;
  gap: 8px;
}

.card-header > div > span,
.premium-card-header > div > span,
.card-header > span,
.premium-card-header > span {
  display: block;
  margin-top: 3px;
  color: var(--text-meta);
  font-size: 12px;
}

.card-body {
  padding: 16px 18px;
}

.compact-card .card-body {
  padding: 14px;
}

.grid {
  display: grid;
  gap: 14px;
}

.grid-2 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.grid-3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.grid-4 {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.split {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 16px;
}

/* ── KPI Cards (Reference Style: Squircle Colored Icon + Tabular Figures) ── */
.kpi-grid {
  grid-template-columns: repeat(7, minmax(0, 1fr));
}

.premium-kpi-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 14px;
}

.client-kpi-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.kpi-card,
.premium-kpi-card {
  min-height: 132px;
  padding: 16px;
  display: grid;
  align-content: space-between;
  gap: 12px;
  overflow: hidden;
  transition: border-color 0.16s ease, transform 0.16s ease;
}

.premium-kpi-card:hover {
  border-color: var(--border-strong);
  transform: translateY(-1px);
}

.kpi-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.kpi-icon,
.premium-kpi-icon {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  color: var(--accent);
  background: var(--accent-soft);
  border: 0;
  font-weight: 700;
}

.premium-kpi-card:nth-child(1) .premium-kpi-icon {
  color: #8ab4f8;
  background: rgba(138, 180, 248, 0.16);
}

.premium-kpi-card:nth-child(2) .premium-kpi-icon {
  color: #dcaeff;
  background: rgba(220, 174, 255, 0.16);
}

.premium-kpi-card:nth-child(3) .premium-kpi-icon {
  color: #7cd98e;
  background: rgba(124, 217, 142, 0.16);
}

.premium-kpi-card:nth-child(4) .premium-kpi-icon {
  color: #c792ea;
  background: rgba(199, 146, 234, 0.16);
}

.premium-kpi-card:nth-child(5) .premium-kpi-icon {
  color: #ef7b87;
  background: rgba(239, 123, 135, 0.16);
}

.kpi-more {
  color: var(--text-meta);
  opacity: 0.75;
}

.kpi-more .ui-icon {
  width: 16px;
  height: 16px;
}

.kpi-value,
.premium-kpi-card .kpi-value {
  font-size: 25px;
  line-height: 1.05;
  font-weight: 700;
  color: var(--text);
  margin: 4px 0;
  letter-spacing: -0.025em;
  font-variant-numeric: tabular-nums;
}

.kpi-label,
.premium-kpi-card .kpi-label {
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 500;
  margin-bottom: 6px;
}

.delta {
  font-size: 12px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.delta.up {
  color: var(--success);
}

.delta.down {
  color: var(--danger);
}

.delta span {
  color: var(--text-meta);
  font-weight: 500;
}

.sparkline {
  height: 24px;
  width: 100%;
  opacity: 0.9;
}

/* ── Dashboard Grid & Charts ── */
.premium-dashboard-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 390px;
  gap: 16px;
  align-items: start;
}

.premium-main-col,
.premium-side-col {
  display: grid;
  gap: 16px;
}

.premium-bottom-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.hero-chart {
  min-height: 300px;
}

.premium-chart-card .card-body {
  padding-top: 12px;
}

.chart-legend-inline {
  display: flex;
  align-items: center;
  gap: 14px;
  color: var(--text-muted);
  font-size: 12px;
}

.chart-legend-inline span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.orange-dot,
.green-dot,
.gray-dot,
.chart-legend-inline i {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  display: inline-block;
  background: #706d85;
}

.orange-dot {
  background: var(--accent) !important;
}

.green-dot {
  background: var(--success) !important;
}

.gray-dot {
  background: #706d85 !important;
}

.chart-canvas {
  width: 100%;
  height: 256px;
  display: block;
}

.chart-canvas-compact {
  height: 224px;
}

.chart-stats {
  margin-top: 12px;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.chart-stats div {
  min-width: 0;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.025);
}

.chart-stats span,
.legend-row span,
.bar-meta {
  color: var(--text-meta);
  font-size: 11px;
}

.chart-stats strong {
  display: block;
  margin-top: 4px;
  color: var(--text);
  font-size: 14px;
  font-variant-numeric: tabular-nums;
}

.chart-panel {
  display: grid;
  gap: 12px;
}

.chart-legend {
  display: grid;
  gap: 6px;
}

.legend-row {
  min-width: 0;
  display: grid;
  grid-template-columns: 10px minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  padding: 8px 10px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.025);
}

.legend-row i {
  width: 10px;
  height: 10px;
  border-radius: 999px;
}

.legend-row div {
  min-width: 0;
}

.legend-row strong,
.legend-row span {
  display: block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.legend-row strong {
  color: var(--text);
  font-size: 12px;
}

.legend-row b {
  color: var(--text);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

.pipeline-step-row {
  margin-top: 12px;
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 6px;
}

.pipeline-step {
  min-width: 0;
  padding: 10px;
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr) auto;
  align-items: center;
  gap: 9px;
  color: var(--text);
  text-align: left;
  background: #21212e;
  border: 1px solid var(--border);
  border-radius: 12px;
  cursor: pointer;
  transition: background-color 0.16s ease, border-color 0.16s ease;
}

.pipeline-step:hover {
  background: var(--hover);
  border-color: var(--border-strong);
}

.pipeline-step span:first-child {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  color: var(--accent);
  background: var(--accent-soft);
}

.pipeline-step strong,
.pipeline-step small {
  display: block;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.pipeline-step strong {
  font-size: 12px;
  font-weight: 650;
}

.pipeline-step small {
  margin-top: 2px;
  color: var(--text-meta);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}

.pipeline-step em {
  color: var(--text-meta);
  font-style: normal;
  font-size: 18px;
}

.stat-bars {
  display: grid;
  gap: 10px;
}

.bar-row {
  display: grid;
  gap: 6px;
  padding: 4px 0;
}

.premium-stage-bars .bar-row {
  gap: 8px;
}

.bar-label {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  color: var(--text-muted);
  font-size: 13px;
}

.bar-label span,
.bar-label strong {
  min-width: 0;
}

.bar-label span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.bar-label strong {
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

.bar-track {
  height: 6px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.07);
  overflow: hidden;
}

.bar-fill {
  height: 100%;
  border-radius: 999px;
  background: var(--cyan);
}

.bar-meta {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  font-variant-numeric: tabular-nums;
}

.premium-list,
.premium-task-list {
  gap: 0;
}

.premium-list-row,
.premium-task-row {
  display: grid;
  align-items: center;
  gap: 12px;
  min-height: 52px;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
}

.premium-list-row {
  grid-template-columns: 32px minmax(0, 1fr) auto;
}

.premium-task-row {
  grid-template-columns: 20px minmax(0, 1fr) auto auto;
}

.premium-list-row:last-child,
.premium-task-row:last-child {
  border-bottom: 0;
}

.premium-list-row strong,
.premium-task-row strong {
  display: block;
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.premium-list-row span,
.premium-task-row span,
.premium-list-row small,
.premium-task-row small {
  color: var(--text-meta);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

.priority-badge {
  min-width: 58px;
  padding: 4px 9px;
  border-radius: 999px;
  text-align: center;
  font-size: 11px;
  font-weight: 600;
}

.priority-badge.high {
  background: rgba(232, 179, 109, 0.16);
  color: #f0c48a;
}

.priority-badge.medium {
  background: var(--accent-soft);
  color: var(--accent);
}

.priority-badge.low {
  background: rgba(156, 153, 176, 0.16);
  color: #c2bfd4;
}

.ai-feature-banner {
  min-height: 112px;
  padding: 16px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 84px;
  align-items: center;
  gap: 12px;
  border: 1px solid rgba(220, 174, 255, 0.25);
  border-radius: 14px;
  background: linear-gradient(135deg, rgba(220, 174, 255, 0.12), rgba(255, 255, 255, 0.02));
}

.ai-feature-banner.small {
  min-height: 140px;
}

.ai-feature-banner strong,
.ai-feature-banner span {
  display: block;
}

.ai-feature-banner strong {
  color: var(--text);
  font-size: 15px;
}

.ai-feature-banner span {
  margin: 6px 0 12px;
  color: var(--text-muted);
  font-size: 13px;
  line-height: 1.45;
}

.glow-cube {
  width: 72px;
  height: 72px;
  border-radius: 20px;
  transform: rotate(35deg);
  background: linear-gradient(135deg, var(--accent), var(--cyan));
  opacity: 0.85;
}

.insight-list {
  display: grid;
  gap: 2px;
  margin-top: 12px;
}

.insight-row {
  width: 100%;
  min-height: 58px;
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  color: var(--text);
  text-align: left;
  background: transparent;
  border: 0;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
}

.insight-row > span {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  color: var(--accent);
  background: var(--accent-soft);
}

.insight-row strong,
.insight-row small {
  display: block;
}

.insight-row small {
  margin-top: 2px;
  color: var(--text-meta);
  font-size: 12px;
}

.insight-row em {
  color: var(--accent);
  font-style: normal;
  font-size: 12px;
  font-weight: 700;
}

/* ── Clients Page & Card Grid ── */
.clients-page-head {
  margin-bottom: 14px;
}

.clients-controls {
  display: grid;
  gap: 12px;
  margin-bottom: 14px;
}

.clients-toolbar-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.clients-search-pill {
  position: relative;
  flex: 0 1 320px;
  min-width: 220px;
  display: block;
}

.clients-search-pill .ui-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  width: 16px;
  height: 16px;
  color: var(--text-meta);
  pointer-events: none;
}

.clients-search-pill input {
  width: 100%;
  height: 40px;
  min-height: 40px;
  padding: 0 16px 0 40px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: #232332;
  color: var(--text);
  font-size: 13px;
}

.clients-search-pill input::placeholder {
  color: var(--text-meta);
}

.clients-search-pill input:focus {
  border-color: rgba(220, 174, 255, 0.45);
  outline: none;
}

.clients-filter-toggle {
  min-height: 40px;
  padding: 0 16px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: rgba(220, 174, 255, 0.14);
  border: 1px solid rgba(220, 174, 255, 0.22);
  color: var(--accent);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: background-color 0.16s ease, border-color 0.16s ease, color 0.16s ease;
}

.clients-filter-toggle .ui-icon {
  width: 15px;
  height: 15px;
}

.clients-filter-toggle b {
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  display: inline-grid;
  place-items: center;
  background: var(--accent);
  color: var(--accent-ink);
  font-size: 11px;
  font-weight: 700;
}

.clients-filter-toggle:hover,
.clients-filter-toggle.active {
  background: rgba(220, 174, 255, 0.22);
  border-color: rgba(220, 174, 255, 0.4);
}

.clients-import-btn {
  min-height: 40px;
  padding: 0 14px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: background-color 0.16s ease, color 0.16s ease, border-color 0.16s ease;
}

.clients-import-btn .ui-icon {
  width: 15px;
  height: 15px;
}

.clients-import-btn:hover {
  color: var(--text);
  background: var(--card);
  border-color: var(--border);
}

.clients-status-chips {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.client-filters-panel {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  padding: 12px 14px;
  border-radius: 16px;
  border: 1px solid var(--border);
  background: var(--card);
}

.client-filter-field {
  display: grid;
  gap: 5px;
  min-width: 0;
}

.client-filter-field span {
  color: var(--text-meta);
  font-size: 11px;
  font-weight: 600;
}

.client-filter-field .select,
.client-filter-field .date-input {
  width: 100%;
  min-width: 0;
  height: 38px;
  min-height: 38px;
}

.clients-grid-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 0 0 10px;
  color: var(--text-meta);
  font-size: 12px;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}

.clients-card-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  align-items: start;
}

.client-create-tile {
  min-height: 184px;
  padding: 20px;
  border: 1.5px dashed var(--border-strong);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.012);
  color: var(--text-muted);
  display: grid;
  place-items: center;
  align-content: center;
  gap: 10px;
  cursor: pointer;
  transition: border-color 0.16s ease, background-color 0.16s ease, color 0.16s ease, transform 0.16s ease;
}

.client-create-tile:hover {
  transform: translateY(-1px);
  border-color: var(--accent);
  background: rgba(220, 174, 255, 0.06);
  color: var(--text);
}

.client-create-icon {
  display: grid;
  place-items: center;
  color: var(--text-muted);
}

.client-create-tile:hover .client-create-icon {
  color: var(--accent);
}

.client-create-icon .ui-icon {
  width: 32px;
  height: 32px;
  stroke-width: 1.5;
}

.client-create-tile strong {
  font-size: 14px;
  font-weight: 600;
}

.client-tile {
  position: relative;
  min-width: 0;
  min-height: 184px;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--card);
  display: grid;
  grid-template-rows: auto auto auto 1fr;
  align-content: start;
  gap: 12px;
  cursor: pointer;
  transition: transform 0.16s ease, border-color 0.16s ease, background-color 0.16s ease, box-shadow 0.16s ease;
}

.client-tile:hover,
.client-tile:focus-visible {
  transform: translateY(-2px);
  border-color: var(--border-strong);
  background: var(--card-2);
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.24);
}

.client-tile-head {
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr);
  align-items: start;
  gap: 12px;
}

.client-tile-avatar {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  background: var(--avatar-bg, #8cb4ff);
  color: var(--avatar-ink, #10192b);
  font-size: 14px;
  font-weight: 800;
  letter-spacing: 0.01em;
}

.client-tile-identity {
  min-width: 0;
  display: grid;
  gap: 2px;
  padding-top: 1px;
}

.client-tile-name {
  color: var(--text);
  font-size: 14px;
  font-weight: 650;
  line-height: 1.3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.client-tile-sub {
  color: var(--text-meta);
  font-size: 12px;
  line-height: 1.25;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.client-tile-actions {
  position: absolute;
  top: 12px;
  right: 12px;
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 3px;
  border-radius: 9px;
  border: 1px solid var(--border);
  background: color-mix(in srgb, var(--card-2) 94%, transparent);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.28);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.16s ease;
}

.client-tile:hover .client-tile-actions,
.client-tile:focus-within .client-tile-actions {
  opacity: 1;
  pointer-events: auto;
}

.client-tile-icon-btn {
  width: 24px;
  height: 24px;
  padding: 0;
  border-radius: 7px;
  display: inline-grid;
  place-items: center;
  background: transparent;
  color: var(--text-muted);
  font-size: 15px;
  line-height: 1;
  cursor: pointer;
  transition: background-color 0.14s ease, color 0.14s ease;
}

.client-tile-icon-btn .ui-icon {
  width: 13px;
  height: 13px;
}

.client-tile-icon-btn:hover {
  background: var(--hover);
  color: var(--text);
}

.client-tile-icon-btn.ai:hover {
  background: var(--accent-soft);
  color: var(--accent);
}

.client-tile-icon-btn.danger:hover {
  background: rgba(239, 123, 135, 0.18);
  color: var(--danger);
}

.client-tile-contact {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  color: var(--text-muted);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}

.client-tile-contact .ui-icon {
  width: 14px;
  height: 14px;
  color: var(--text-meta);
  flex-shrink: 0;
}

.client-tile-contact span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.client-tile-deal-row {
  display: flex;
  align-items: center;
  min-height: 28px;
}

.client-deal-badge {
  max-width: 100%;
  min-height: 26px;
  padding: 0 10px;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.client-deal-badge .ui-icon {
  width: 13px;
  height: 13px;
  flex-shrink: 0;
}

.client-deal-badge span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.client-deal-badge.has-deal {
  background: rgba(56, 128, 214, 0.16);
  border: 1px solid rgba(96, 165, 250, 0.22);
  color: #90c2ff;
}

.client-deal-badge.has-deal:hover {
  background: rgba(56, 128, 214, 0.26);
  border-color: rgba(96, 165, 250, 0.38);
}

.client-deal-badge.no-deal {
  background: rgba(255, 255, 255, 0.055);
  border: 1px solid var(--border);
  color: var(--text-muted);
}

.client-deal-badge.no-deal:hover {
  background: var(--hover);
  color: var(--text);
}

.client-tile-footer {
  margin-top: auto;
  padding-top: 10px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.client-tile-manager {
  min-width: 0;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--text-muted);
  font-size: 12px;
}

.client-tile-manager span:last-child {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.client-tile-manager-dot {
  width: 20px;
  height: 20px;
  min-width: 20px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  background: var(--avatar-bg, #f48db4);
  color: var(--avatar-ink, #241019);
  font-size: 9px;
  font-weight: 800;
}

.client-tile-date {
  color: var(--text-meta);
  font-size: 12px;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.clients-pager-bar {
  margin-top: 16px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--card);
}

.mobile-clients-fab {
  display: none;
}

.clients-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 256px;
  gap: 16px;
  align-items: start;
}

.clients-main-card {
  overflow: hidden;
  min-width: 0;
}

.premium-filter-bar,
.clients-page .premium-filter-bar {
  display: grid;
  grid-template-columns: minmax(175px, 1.3fr) minmax(128px, 152px) minmax(128px, 152px) minmax(244px, 286px);
  gap: 10px;
  align-items: end;
  padding: 14px 16px;
  border: 0;
  border-bottom: 1px solid var(--border);
  border-radius: 0;
  background: transparent;
}

.filter-search-inline {
  display: block;
  width: 100%;
  min-width: 0;
  position: relative;
}

.filter-search-inline input {
  width: 100%;
  min-width: 0;
  max-width: 100%;
  height: 40px;
  min-height: 40px;
  padding-left: 40px;
  border-radius: 999px;
  background: #232332;
}

.premium-filter-bar .select,
.date-input {
  width: 100%;
  min-width: 0;
  height: 40px;
  min-height: 40px;
}

.date-filter-group {
  width: 100%;
  min-width: 0;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  align-items: end;
}

.date-filter-group label {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.date-filter-group span {
  color: var(--text-meta);
  font-size: 11px;
  font-weight: 600;
  line-height: 1;
  white-space: nowrap;
}

.date-filter-group .date-input,
.date-filter-group input[type="date"] {
  width: 100%;
  min-width: 0;
  height: 40px;
  padding: 0 10px;
  font-size: 12px;
  color-scheme: dark;
}

.client-status-filter {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding-top: 2px;
}

.status-chip {
  min-height: 32px;
  padding: 0 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  color: var(--text-muted);
  background: #252534;
  border: 1px solid var(--border);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.16s ease, color 0.16s ease, border-color 0.16s ease;
}

.status-chip:hover {
  color: var(--text);
  border-color: var(--border-strong);
  background: var(--hover);
}

.status-chip.active {
  color: var(--accent-ink);
  background: var(--accent);
  border-color: transparent;
  font-weight: 700;
}

.client-filter-reset {
  min-height: 32px;
  padding: 0 14px;
}

.premium-table-wrap {
  width: 100%;
  overflow-x: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--hover) transparent;
}

.table-card {
  overflow: hidden;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
}

.premium-clients-table {
  min-width: 920px;
}

.data-table th,
.data-table td {
  padding: 11px 10px;
  border-bottom: 1px solid var(--border);
  text-align: left;
  font-size: 13px;
  vertical-align: middle;
}

.data-table th {
  position: sticky;
  top: 0;
  z-index: 2;
  color: var(--text-meta);
  background: #171722;
  font-size: 12px;
  font-weight: 600;
}

.data-table tr:hover td {
  background: rgba(255, 255, 255, 0.025);
}

.client-table-row {
  cursor: pointer;
}

.premium-clients-table tr:hover td {
  background: rgba(220, 174, 255, 0.05);
}

.check-col {
  width: 36px;
}

.client-cell,
.manager-cell {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 10px;
}

.client-initials {
  background: #9ec5ff;
  color: #101726;
}

.stack-cell,
.link-cell {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.stack-cell strong,
.stack-cell span,
.link-cell strong,
.link-cell span {
  max-width: 175px;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.link-cell {
  border: 0;
  padding: 0;
  color: var(--text);
  text-align: left;
  background: transparent;
  cursor: pointer;
}

.link-cell:hover strong {
  color: var(--accent);
}

.link-cell span {
  color: var(--text-meta);
  font-size: 11px;
}

.source-pill {
  --pill-color: var(--cyan);
  min-height: 24px;
  padding: 3px 9px;
  display: inline-flex;
  align-items: center;
  border-radius: 8px;
  color: color-mix(in srgb, var(--pill-color) 76%, #fff);
  background: color-mix(in srgb, var(--pill-color) 16%, transparent);
  border: 1px solid color-mix(in srgb, var(--pill-color) 28%, transparent);
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}

.last-activity {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

.last-activity .ui-icon {
  width: 15px;
  height: 15px;
  color: var(--text-meta);
}

.ai-col {
  width: 54px;
  text-align: center;
}

.ai-row-btn {
  width: 32px;
  height: 32px;
  display: inline-grid;
  place-items: center;
  border-radius: 999px;
  color: var(--accent);
  background: var(--accent-soft);
  border: 1px solid rgba(220, 174, 255, 0.28);
  cursor: pointer;
  transition: transform 0.16s ease, background-color 0.16s ease;
}

.ai-row-btn:hover {
  transform: translateY(-1px);
  background: rgba(220, 174, 255, 0.26);
}

.row-actions-cell {
  width: 78px;
  text-align: right;
  white-space: nowrap;
}

.row-actions {
  display: inline-flex;
  gap: 8px;
  align-items: center;
}

.row-menu {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
}

.table-footer,
.premium-table-footer {
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  border-top: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.015);
}

.page-info {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  color: var(--text-muted);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

.pager {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.pager-current {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  color: var(--accent-ink);
  background: var(--accent);
  font-size: 12px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.clients-side {
  display: grid;
  gap: 16px;
}

.status-summary {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  align-items: start;
}

.donut-mini {
  width: 96px;
  height: 96px;
  margin: 0 auto;
  border-radius: 50%;
  display: grid;
  place-items: center;
  align-content: center;
  background:
    radial-gradient(circle, var(--card) 0 50%, transparent 52%),
    conic-gradient(var(--success) 0 38%, var(--accent) 38% 76%, #59566d 76% 100%);
}

.donut-mini b,
.donut-mini span {
  display: block;
  text-align: center;
}

.donut-mini b {
  color: var(--text);
  font-size: 19px;
  font-variant-numeric: tabular-nums;
}

.donut-mini span {
  color: var(--text-meta);
  font-size: 11px;
}

.status-legend {
  display: grid;
  gap: 8px;
}

.status-legend span {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-muted);
  font-size: 12px;
  white-space: nowrap;
}

.status-legend i {
  flex: 0 0 auto;
}

.status-legend b {
  margin-left: auto;
  padding-left: 8px;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

.mobile-list {
  display: none;
}

.list-stack {
  display: grid;
  gap: 10px;
}

.list-item {
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: var(--card-2);
}

/* ── Kanban Board & Deal Cards (Reference Screenshot 3) ── */
.kanban-wrap {
  display: grid;
  gap: 14px;
}

.kanban-hero {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) auto auto;
  align-items: center;
  gap: 14px;
  padding: 14px 18px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--card);
}

.kanban-hero h2 {
  margin: 0;
  font-size: 19px;
  font-weight: 700;
}

.kanban-hero p {
  margin: 3px 0 0;
  color: var(--text-muted);
  font-size: 13px;
}

.kanban-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.kanban-summary div {
  min-height: 36px;
  padding: 5px 12px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: #232332;
  font-variant-numeric: tabular-nums;
}

.kanban-summary div:nth-child(2) {
  background: rgba(124, 217, 142, 0.14);
  border-color: rgba(124, 217, 142, 0.25);
}

.kanban-summary div:nth-child(2) strong {
  color: #9be9a8;
}

.kanban-summary strong {
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
}

.kanban-summary span {
  color: var(--text-meta);
  font-size: 11px;
}

.kanban-board {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(292px, 326px);
  gap: 12px;
  overflow-x: auto;
  padding: 2px 2px 12px;
  min-height: calc(100vh - 240px);
  scrollbar-color: var(--surface-2) transparent;
}

.kanban-column {
  min-width: 0;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: #171721;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.kanban-column.drag-over {
  outline: 2px solid color-mix(in srgb, var(--stage-color, var(--accent)) 70%, transparent);
  background: rgba(220, 174, 255, 0.05);
}

.kanban-head {
  padding: 14px 14px 10px;
  display: grid;
  gap: 8px;
  border-bottom: 1px solid var(--border);
  background: transparent;
}

.kanban-head-main {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.kanban-head-main strong {
  min-width: 0;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 650;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.kanban-head-main strong::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 999px;
  flex-shrink: 0;
  background: var(--stage-color, var(--cyan));
}

.kanban-head-main span {
  min-width: 26px;
  height: 22px;
  padding: 0 8px;
  display: inline-grid;
  place-items: center;
  border-radius: 999px;
  color: var(--text-muted);
  background: #252534;
  font-size: 11px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.kanban-head-amount {
  color: var(--text-meta);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

.kanban-stage-meter {
  height: 3px;
  border-radius: 999px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.07);
}

.kanban-stage-meter i {
  display: block;
  width: var(--stage-progress);
  height: 100%;
  border-radius: inherit;
  background: var(--stage-color, var(--cyan));
}

.kanban-list {
  display: grid;
  align-content: start;
  gap: 10px;
  padding: 10px;
  overflow-y: auto;
}

.deal-card {
  border-radius: 14px;
  padding: 12px 13px;
  display: grid;
  gap: 8px;
  background: var(--card-2);
  border: 1px solid var(--border);
  border-left: 3px solid var(--cyan);
  cursor: grab;
  transition: transform 0.16s ease, border-color 0.16s ease, background-color 0.16s ease, box-shadow 0.16s ease;
}

.deal-card:hover {
  transform: translateY(-1px);
  background: #262637;
  border-color: var(--border-strong);
  border-left-color: var(--cyan);
  box-shadow: 0 10px 26px rgba(0, 0, 0, 0.24);
}

.deal-card.overdue {
  border-left-color: var(--danger);
}

.deal-card.high {
  border-left-color: var(--warning);
}

.deal-card.won {
  border-left-color: var(--success);
}

.deal-card-top {
  min-width: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 28px;
  align-items: start;
  gap: 8px;
}

.deal-card-top div {
  min-width: 0;
  display: grid;
  gap: 3px;
}

.deal-card-top strong,
.deal-card-top span {
  overflow: hidden;
  text-overflow: ellipsis;
}

.deal-card-top strong {
  color: var(--text);
  font-size: 13px;
  line-height: 1.3;
  font-weight: 650;
  overflow-wrap: anywhere;
}

.deal-card-top span {
  color: var(--text-meta);
  font-size: 12px;
  white-space: nowrap;
}

.deal-card-value {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 6px 0 2px;
}

.deal-card-value .amount {
  font-size: 14px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.deal-card-value span:last-child {
  color: var(--text-meta);
  font-size: 11px;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.deal-card-tags {
  gap: 6px;
}

.kanban-list .empty-state {
  min-height: 110px;
  padding: 16px;
  border-radius: 14px;
  background: transparent;
}

/* ── Kanban Client Cards ── */
.client-card {
  position: relative;
  border-radius: 14px;
  padding: 12px;
  display: grid;
  gap: 9px;
  overflow: hidden;
  background: var(--card-2);
  border: 1px solid var(--border);
  border-left: 3px solid var(--client-stage-color, var(--cyan));
  cursor: grab;
  transition: transform 0.16s ease, box-shadow 0.16s ease, border-color 0.16s ease;
}

.client-card:hover {
  transform: translateY(-1px);
  border-color: var(--border-strong);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.24);
}

.client-card-top {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
}

.client-card-avatar {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  color: #101726;
  background: color-mix(in srgb, var(--client-stage-color, var(--accent)) 75%, #fff);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.client-card-main {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.client-card-name {
  color: var(--text);
  font-size: 13px;
  font-weight: 650;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.client-card-company {
  color: var(--text-meta);
  font-size: 11px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.client-card-meta {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  padding-top: 8px;
  border-top: 1px solid var(--border);
}

.client-card-meta span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text-muted);
  font-size: 11px;
}

.client-card-meta span:last-child {
  max-width: 112px;
  padding: 3px 8px;
  border-radius: 999px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.06);
  font-size: 10px;
  font-weight: 600;
}

.deal-title-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.deal-title-row strong {
  min-width: 0;
  font-size: 14px;
  line-height: 1.3;
  overflow-wrap: anywhere;
}

.amount {
  font-weight: 700;
  color: var(--text);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.meta-line {
  margin-top: 8px;
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-muted);
  font-size: 12px;
  min-width: 0;
}

.meta-line span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  min-width: 0;
  align-items: center;
}

.chip {
  max-width: 100%;
  min-width: 0;
  min-height: 24px;
  padding: 2px 9px;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid transparent;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chip.cyan {
  color: #8adbf5;
  background: rgba(40, 184, 229, 0.16);
}

.chip.green {
  color: #9be9a8;
  background: rgba(124, 217, 142, 0.16);
}

.chip.amber {
  color: #f4c98e;
  background: rgba(232, 179, 109, 0.16);
}

.chip.red {
  color: #f7a4ad;
  background: rgba(239, 123, 135, 0.16);
}

.chip.gray {
  color: var(--text-muted);
  background: rgba(255, 255, 255, 0.06);
}

.chip-button {
  cursor: pointer;
}

.chip-button:hover {
  border-color: rgba(220, 174, 255, 0.5);
  background: var(--accent-soft);
  color: var(--text);
}

.quick-actions {
  margin-top: 8px;
  display: flex;
  gap: 6px;
  opacity: 0.78;
}

.deal-card:hover .quick-actions {
  opacity: 1;
}

.quick-actions button {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-muted);
  cursor: pointer;
  border: 1px solid var(--border);
}

.quick-actions button:hover {
  color: var(--text);
  background: var(--hover);
}

/* ── Entity Tiles (Deals & Products) ── */
.tile-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(270px, 1fr));
  gap: 14px;
  align-items: start;
}

.deal-tile-grid {
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  align-items: start;
}

.deal-tile-grid.is-masonry {
  display: grid;
  grid-template-columns: repeat(var(--masonry-cols, 3), minmax(0, 1fr));
  gap: 14px;
  align-items: start;
}

.deal-masonry-col {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.deal-masonry-col > .deal-tile {
  width: 100%;
  align-self: stretch;
}

.entity-tile {
  min-width: 0;
  min-height: 0;
  align-self: start;
  padding: 16px;
  display: grid;
  align-content: start;
  gap: 12px;
  border: 1px solid var(--border);
  border-left: 3px solid var(--tile-color, var(--cyan));
  border-radius: 16px;
  background: var(--card);
  cursor: pointer;
  transition: transform 0.16s ease, border-color 0.16s ease, box-shadow 0.16s ease, background-color 0.16s ease;
}

.entity-tile:hover {
  transform: translateY(-2px);
  border-color: var(--border-strong);
  border-left-color: var(--tile-color, var(--cyan));
  background: var(--card-2);
  box-shadow: 0 14px 32px rgba(0, 0, 0, 0.24);
}

.entity-tile-head {
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.entity-avatar {
  width: 40px;
  height: 40px;
  min-width: 40px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  color: #101726;
  background: color-mix(in srgb, var(--tile-color, var(--accent)) 75%, #fff);
  font-size: 13px;
  font-weight: 800;
  overflow: hidden;
}

.entity-tile-main {
  min-width: 0;
  display: grid;
  gap: 4px;
}

.entity-tile-main strong,
.entity-tile-main span,
.tile-info span,
.tile-metric span,
.tile-metric small {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.entity-tile-main strong {
  color: var(--text);
  font-size: 15px;
  line-height: 1.3;
  font-weight: 650;
  overflow-wrap: anywhere;
}

.entity-tile-main span {
  color: var(--text-muted);
  font-size: 12px;
  white-space: nowrap;
}

.tile-info {
  min-height: 52px;
  padding: 9px 11px;
  display: grid;
  gap: 4px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.025);
}

.tile-info span {
  color: var(--text-muted);
  font-size: 12px;
  white-space: nowrap;
}

.tile-metric {
  min-height: 50px;
  padding: 10px 12px;
  display: grid;
  gap: 3px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.025);
}

.tile-metric span {
  color: var(--text);
  font-size: 17px;
  font-weight: 700;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.tile-metric small {
  color: var(--text-meta);
  font-size: 11px;
  white-space: nowrap;
}

.deal-tile.overdue {
  --tile-color: var(--danger);
}

.deal-tile.high {
  --tile-color: var(--warning);
}

.deal-tile.won {
  --tile-color: var(--success);
}

.product-tile {
  align-self: start;
  min-height: 0;
}

.product-media {
  height: 138px;
  display: grid;
  place-items: center;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #232332;
  overflow: hidden;
}

.product-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.product-media span {
  width: 54px;
  height: 54px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: var(--accent-ink);
  background: var(--warning);
  font-weight: 800;
}

.tile-footer-card {
  margin-top: 14px;
}

/* ── Loss Reason Drawer ── */
.loss-reason-form {
  display: grid;
  gap: 14px;
}

.loss-reason-hero {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr);
  gap: 12px;
  align-items: start;
  padding: 14px;
  border-radius: 14px;
  border: 1px solid rgba(239, 123, 135, 0.28);
  background: rgba(239, 123, 135, 0.08);
}

.loss-reason-mark {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  color: #1d1014;
  background: var(--loss-stage-color, var(--danger));
}

.loss-reason-mark .ui-icon {
  width: 20px;
  height: 20px;
}

.loss-reason-hero strong {
  display: block;
  color: var(--text);
  font-size: 15px;
  font-weight: 700;
}

.loss-reason-hero p {
  margin: 4px 0 0;
  color: var(--text-muted);
  font-size: 12px;
  line-height: 1.45;
}

.loss-reason-presets {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.loss-reason-chip {
  min-height: 32px;
  padding: 0 12px;
  border-radius: 999px;
  color: var(--text);
  background: var(--surface-2);
  border: 1px solid var(--border);
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
}

.loss-reason-chip:hover {
  border-color: rgba(239, 123, 135, 0.45);
  background: rgba(239, 123, 135, 0.14);
}

.loss-reason-textarea {
  min-height: 112px;
}

.form-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

/* ── Checklists & Settings Dictionaries ── */
.settings-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.dictionary-header {
  align-items: flex-start;
}

.dictionary-header h3 {
  margin-bottom: 3px;
}

.dictionary-list {
  display: grid;
  gap: 8px;
}

.dictionary-item {
  min-height: 52px;
  display: grid;
  grid-template-columns: 10px minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.02);
}

.dictionary-item:hover {
  border-color: var(--border-strong);
  background: rgba(255, 255, 255, 0.04);
}

.dictionary-color {
  width: 8px;
  height: 24px;
  border-radius: 99px;
}

.dictionary-main {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.dictionary-main strong,
.dictionary-main span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dictionary-main strong {
  font-size: 13px;
  font-weight: 600;
}

.dictionary-main span {
  color: var(--text-meta);
  font-size: 11px;
}

.dictionary-actions {
  display: flex;
  gap: 6px;
}

.color-palette {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.color-swatch {
  width: 30px;
  height: 30px;
  border-radius: 10px;
  border: 1px solid var(--border-strong);
  cursor: pointer;
}

.color-swatch:hover {
  transform: translateY(-1px);
}

.check-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.02);
}

.check-grid label {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-muted);
  font-size: 12px;
  padding: 9px 11px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.02);
  cursor: pointer;
}

.check-grid label:hover {
  border-color: var(--border-strong);
  background: rgba(255, 255, 255, 0.04);
}

.scroll-checks {
  max-height: 180px;
  overflow: auto;
}

.drawer-section {
  margin-top: 14px;
}

.checklist-section {
  margin-top: 14px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.02);
}

.section-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 6px 10px;
  align-items: center;
  margin-bottom: 12px;
}

.section-head strong {
  font-size: 14px;
}

.section-head .muted {
  grid-column: 1 / -1;
  color: var(--text-meta);
  font-size: 12px;
}

.section-head .full {
  grid-column: 1 / -1;
}

.progress-pill {
  min-height: 24px;
  padding: 0 10px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--accent);
  background: var(--accent-soft);
  font-size: 11px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.checklist-progress,
.deal-card-progress {
  height: 4px;
  border-radius: 999px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.08);
}

.checklist-progress i,
.deal-card-progress i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent), var(--success));
}

.checklist-list {
  display: grid;
  gap: 10px;
}

.checklist-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.02);
}

.checklist-row.done {
  border-color: rgba(124, 217, 142, 0.3);
  background: rgba(124, 217, 142, 0.06);
}

.checklist-main {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  cursor: pointer;
}

.checklist-main input[type="checkbox"] {
  appearance: none;
  width: 18px;
  min-width: 18px;
  height: 18px;
  border-radius: 5px;
  border: 1px solid var(--border-strong);
  background: #171722;
  display: grid;
  place-items: center;
  cursor: pointer;
}

.checklist-main input[type="checkbox"]::after {
  content: "";
  width: 9px;
  height: 5px;
  border-left: 2px solid var(--accent-ink);
  border-bottom: 2px solid var(--accent-ink);
  transform: rotate(-45deg) scale(0);
  transition: transform 0.12s ease;
}

.checklist-main input[type="checkbox"]:checked {
  border-color: var(--success);
  background: var(--success);
}

.checklist-main input[type="checkbox"]:checked::after {
  transform: rotate(-45deg) scale(1);
}

.checklist-main span {
  min-width: 0;
  overflow-wrap: anywhere;
}

.checklist-main .input {
  min-width: 0;
  flex: 1;
}

.checklist-side {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.checklist-date {
  width: 150px;
}

.checklist-builder-row {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr);
  gap: 10px;
  align-items: start;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--card-2);
}

.checklist-builder-row:hover {
  border-color: rgba(220, 174, 255, 0.3);
}

.checklist-builder-row.dragging {
  opacity: 0.55;
  border-color: var(--success);
}

.checklist-drag {
  width: 28px;
  height: 38px;
  border-radius: 8px;
  color: var(--text-meta);
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.03);
  cursor: grab;
}

.checklist-builder-main {
  display: grid;
  gap: 8px;
  min-width: 0;
}

.checklist-builder-top {
  display: grid;
  grid-template-columns: minmax(200px, 1fr) 160px 110px 32px 32px;
  gap: 8px;
  align-items: center;
}

.checklist-title-input,
.checklist-type-select {
  min-height: 38px;
}

.checklist-builder-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  color: var(--text-meta);
  font-size: 11px;
}

.checklist-builder-meta span {
  min-height: 20px;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.05);
}

.checklist-builder-meta .required-dot {
  color: var(--success);
  background: rgba(124, 217, 142, 0.14);
}

.checklist-builder-details {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.16);
}

.checklist-builder-details.collapsed {
  display: none;
}

.checklist-builder-details .field {
  margin-bottom: 0;
}

.checklist-options {
  display: grid;
  gap: 8px;
}

.checklist-option {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 30px;
  gap: 8px;
}

.switch-line {
  min-height: 38px;
  padding: 0 8px;
  display: flex;
  align-items: center;
  gap: 7px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.02);
  cursor: pointer;
}

.switch-line input {
  display: none;
}

.switch-line span {
  width: 30px;
  height: 16px;
  border-radius: 999px;
  padding: 2px;
  background: rgba(255, 255, 255, 0.14);
  transition: background-color 0.16s ease;
}

.switch-line span::after {
  content: "";
  width: 12px;
  height: 12px;
  display: block;
  border-radius: 50%;
  background: var(--text-meta);
  transition: transform 0.16s ease, background-color 0.16s ease;
}

.switch-line input:checked + span {
  background: rgba(124, 217, 142, 0.3);
}

.switch-line input:checked + span::after {
  transform: translateX(14px);
  background: var(--success);
}

.switch-line b {
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 600;
}

.deal-checklist-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(160px, 230px);
  gap: 10px;
  align-items: center;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.02);
}

.deal-checklist-row.done {
  border-color: rgba(124, 217, 142, 0.3);
  background: rgba(124, 217, 142, 0.05);
}

.deal-checklist-row.invalid {
  border-color: rgba(239, 123, 135, 0.6);
  background: rgba(239, 123, 135, 0.08);
}

.deal-checklist-label {
  min-width: 0;
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr);
  gap: 9px;
  align-items: center;
}

.check-icon {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  color: var(--item-color, var(--accent));
  background: color-mix(in srgb, var(--item-color, var(--accent)) 14%, transparent);
  font-size: 13px;
  font-weight: 700;
}

.deal-checklist-label strong,
.deal-checklist-label small {
  display: block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.deal-checklist-label strong {
  font-size: 13px;
}

.deal-checklist-label small {
  margin-top: 2px;
  color: var(--text-meta);
  font-size: 11px;
}

.compact-input {
  min-height: 38px;
  margin: 0;
}

textarea.compact-input {
  min-height: 58px;
}

.checklist-file-control {
  min-width: 0;
}

.checklist-file-drop {
  min-height: 40px;
  padding: 8px 10px;
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr);
  gap: 8px;
  align-items: center;
  border: 1px dashed rgba(220, 174, 255, 0.35);
  border-radius: 10px;
  color: var(--text-muted);
  background: rgba(220, 174, 255, 0.05);
  cursor: pointer;
}

.checklist-file-drop:hover,
.checklist-file-drop.drag-over {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.checklist-file-drop input {
  display: none;
}

.checklist-file-drop b {
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  border-radius: 6px;
  color: var(--accent);
  background: var(--accent-soft);
}

.checklist-file-drop span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 12px;
}

.deal-check-toggle {
  justify-self: end;
  display: flex;
  align-items: center;
}

.deal-check-toggle span {
  width: 42px;
  height: 24px;
  padding: 3px;
  border-radius: 999px;
  border: 1px solid var(--border-strong);
  background: #171722;
  cursor: pointer;
}

.deal-check-toggle span::after {
  content: "";
  width: 16px;
  height: 16px;
  display: block;
  border-radius: 50%;
  background: var(--text-meta);
  transition: transform 0.16s ease, background-color 0.16s ease;
}

.deal-check-toggle input {
  display: none;
}

.deal-check-toggle input:checked + span::after {
  transform: translateX(18px);
  background: var(--success);
}

.deal-card-checklist {
  display: grid;
  gap: 6px;
  padding: 8px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: rgba(16, 16, 23, 0.35);
}

.deal-card-checklist.saving {
  border-color: var(--accent);
}

.deal-card-checklist-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  color: var(--text-meta);
  font-size: 11px;
}

.deal-card-checklist-head strong {
  color: var(--text);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}

.deal-card-checklist-list {
  display: grid;
  gap: 4px;
  max-height: 180px;
  overflow-y: auto;
}

.mini-check {
  min-width: 0;
  min-height: 28px;
  display: grid;
  grid-template-columns: 20px minmax(0, 1fr) auto;
  align-items: center;
  gap: 7px;
  padding: 4px 6px;
  border-radius: 8px;
  color: var(--text-muted);
  font-size: 11px;
  background: rgba(255, 255, 255, 0.025);
}

.mini-check:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.05);
}

.mini-check.done:not(.data) > span {
  color: var(--text-meta);
  text-decoration: line-through;
}

.mini-check span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mini-check b {
  width: 20px;
  height: 20px;
  display: grid;
  place-items: center;
  border-radius: 6px;
  color: var(--accent);
  background: var(--accent-soft);
  font-size: 11px;
  font-weight: 700;
}

.mini-check-toggle {
  width: 20px;
  height: 20px;
  padding: 0;
  border: 0;
  background: transparent;
  display: grid;
  place-items: center;
  cursor: pointer;
}

.mini-check-toggle span {
  width: 17px;
  height: 17px;
  display: grid;
  place-items: center;
  border-radius: 5px;
  border: 1px solid var(--border-strong);
  background: #171722;
}

.mini-check-toggle span::after {
  content: "";
  width: 8px;
  height: 4px;
  border-left: 2px solid var(--accent-ink);
  border-bottom: 2px solid var(--accent-ink);
  transform: rotate(-45deg) scale(0);
  transition: transform 0.12s ease;
}

.mini-check-toggle[data-checked="1"] span {
  border-color: var(--success);
  background: var(--success);
}

.mini-check-toggle[data-checked="1"] span::after {
  transform: rotate(-45deg) scale(1);
}

.mini-check-input {
  width: 100%;
  min-width: 72px;
  max-width: 112px;
  min-height: 24px;
  padding: 2px 6px;
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  background: #171722;
  font: inherit;
  font-size: 10px;
  outline: none;
}

.mini-check-input:focus {
  border-color: var(--accent);
}

.mini-check-input[multiple] {
  min-height: 42px;
}

.mini-check-textarea {
  resize: vertical;
  min-height: 34px;
  max-height: 70px;
}

.mini-check-file {
  min-width: 0;
  max-width: 112px;
  min-height: 24px;
  display: flex;
  align-items: center;
  padding: 2px 7px;
  border: 1px dashed rgba(220, 174, 255, 0.35);
  border-radius: 6px;
  background: rgba(220, 174, 255, 0.06);
  cursor: pointer;
}

.mini-check-file input {
  display: none;
}

.mini-check-file small {
  color: var(--accent);
  font-size: 10px;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mini-check-more {
  color: var(--text-meta);
  font-size: 11px;
  padding-left: 24px;
}

/* ── Dropzones & Notices ── */
.dropzone {
  min-height: 112px;
  display: grid;
  align-content: center;
  gap: 6px;
  padding: 18px;
  border: 1px dashed rgba(220, 174, 255, 0.4);
  border-radius: 14px;
  background: rgba(220, 174, 255, 0.04);
  cursor: pointer;
  text-align: center;
  transition: border-color 0.16s ease, background-color 0.16s ease;
}

.dropzone strong {
  font-size: 14px;
}

.dropzone span {
  color: var(--text-meta);
  font-size: 12px;
}

.dropzone:hover,
.dropzone.drag-over {
  border-color: var(--accent);
  background: rgba(220, 174, 255, 0.09);
}

.file-summary {
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text-muted);
  background: rgba(255, 255, 255, 0.025);
  font-size: 12px;
  word-break: break-word;
}

.notice.warning {
  margin-top: 10px;
  padding: 12px 14px;
  border: 1px solid rgba(232, 179, 109, 0.32);
  border-radius: 12px;
  color: #f4c98e;
  background: rgba(232, 179, 109, 0.09);
  font-size: 13px;
}

/* ── Mail ── */
.mail-shell {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  gap: 16px;
}

.mail-sidebar {
  display: grid;
  align-content: start;
  gap: 6px;
}

.mail-sidebar button {
  min-height: 44px;
  padding: 0 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: var(--text-muted);
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
}

.mail-sidebar button.active {
  color: var(--text);
  border-color: rgba(220, 174, 255, 0.36);
  background: var(--accent-soft);
}

.mail-list {
  display: grid;
  gap: 10px;
}

.mail-item {
  padding: 14px 16px;
  display: grid;
  gap: 8px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--card);
  cursor: pointer;
}

.mail-item.unread {
  border-left: 3px solid var(--accent);
  background: linear-gradient(90deg, rgba(220, 174, 255, 0.08), var(--card) 44%);
}

.mail-item-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
}

.mail-item-head div {
  min-width: 0;
  display: grid;
  gap: 3px;
}

.mail-item-head strong,
.mail-item-head span,
.mail-item p {
  overflow: hidden;
  text-overflow: ellipsis;
}

.mail-item-head strong {
  font-size: 14px;
}

.mail-item-head span,
.mail-item-head time,
.mail-item p {
  color: var(--text-muted);
  font-size: 12px;
}

.mail-item-head span,
.mail-item p {
  white-space: nowrap;
}

.mail-item p {
  margin: 0;
}

.mail-reader {
  display: grid;
  gap: 14px;
}

.mail-reader-meta {
  display: grid;
  gap: 5px;
  color: var(--text-muted);
  font-size: 12px;
}

.mail-quote {
  padding: 10px 12px;
  text-align: left;
  color: var(--accent);
  border: 1px solid rgba(220, 174, 255, 0.32);
  border-radius: 12px;
  background: var(--accent-soft);
  cursor: pointer;
}

.mail-body-text {
  white-space: pre-wrap;
  line-height: 1.55;
}

.mail-compose-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 310px;
  gap: 16px;
}

.mail-compose-main,
.mail-compose-side {
  min-width: 0;
  display: grid;
  align-content: start;
  gap: 10px;
}

.mail-search-results {
  max-height: 280px;
  overflow: auto;
  display: grid;
  align-content: start;
  gap: 6px;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.02);
}

.quote-results {
  max-height: 410px;
}

.mail-result {
  min-width: 0;
  display: grid;
  gap: 2px;
  padding: 9px 10px;
  text-align: left;
  color: var(--text);
  background: transparent;
  border: 1px solid transparent;
  border-radius: 10px;
  cursor: pointer;
}

.mail-result:hover {
  background: rgba(255, 255, 255, 0.05);
  border-color: var(--border);
}

.mail-result strong,
.mail-result span {
  min-width: 0;
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mail-result span {
  color: var(--text-meta);
  font-size: 11px;
}

.mail-selected,
.mail-selected-quote {
  min-height: 36px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.mail-token {
  max-width: 100%;
  min-height: 30px;
  padding: 4px 10px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--text);
  background: var(--accent-soft);
  border: 1px solid rgba(220, 174, 255, 0.32);
  border-radius: 999px;
  cursor: pointer;
  font-size: 12px;
}

.mail-token span {
  color: var(--text-meta);
  font-size: 11px;
}

.mail-empty-inline {
  min-height: 30px;
  display: inline-flex;
  align-items: center;
  color: var(--text-meta);
  font-size: 12px;
}

.mail-compose-body {
  min-height: 260px;
}

.mail-compose-footer {
  margin-top: 14px;
  display: flex;
  justify-content: flex-end;
}

/* ── Employees & Automation ── */
.employee-card .card-body {
  display: grid;
  gap: 10px;
}

.employee-head {
  min-width: 0;
  min-height: 62px;
  padding: 10px 12px;
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border);
  border-radius: 12px;
}

.employee-main {
  min-width: 0;
}

.employee-main strong,
.employee-main span,
.employee-role {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.employee-main strong {
  font-size: 14px;
  font-weight: 650;
}

.employee-main span,
.employee-role {
  color: var(--text-meta);
  font-size: 12px;
}

.employee-chips,
.employee-actions {
  align-items: center;
}

.automation-rule {
  display: grid;
  gap: 10px;
}

.automation-title-row {
  align-items: flex-start;
}

.automation-title-row .chip {
  flex: 0 0 auto;
}

.automation-meta {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  margin-top: 0;
}

.automation-meta span:last-child {
  flex: 0 0 auto;
  color: var(--text-meta);
}

.automation-chips .chip {
  max-width: min(100%, 280px);
}

.automation-actions {
  margin-top: 0;
}

.automation-editor {
  display: grid;
  gap: 16px;
}

.automation-editor-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px;
  border: 1px solid rgba(220, 174, 255, 0.2);
  border-radius: 16px;
  background: rgba(220, 174, 255, 0.07);
}

.automation-editor-top h2 {
  margin: 4px 0;
  color: var(--text);
  font-size: 20px;
}

.automation-editor-top p {
  margin: 0;
  color: var(--text-muted);
  font-size: 13px;
}

.automation-builder-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.automation-builder-card {
  min-width: 0;
  padding: 16px;
  border-radius: 16px;
  border: 1px solid var(--border);
  background: var(--card-2);
}

.automation-builder-wide {
  grid-column: 1 / -1;
}

.automation-step-title {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
}

.automation-step-title > span {
  width: 32px;
  height: 32px;
  min-width: 32px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  color: var(--accent-ink);
  background: var(--accent);
  font-weight: 800;
}

.automation-step-title strong,
.automation-step-title small {
  display: block;
}

.automation-step-title strong {
  color: var(--text);
  font-size: 14px;
}

.automation-step-title small {
  color: var(--text-meta);
  font-size: 12px;
  margin-top: 2px;
}

.compact-grid {
  gap: 12px;
}

.automation-action-section {
  display: contents;
}

.automation-action-section.hidden,
[data-telegram-user-field].hidden {
  display: none !important;
}

.automation-muted-box {
  grid-column: 1 / -1;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.03);
  color: var(--text-muted);
  font-size: 13px;
  line-height: 1.5;
}

.automation-field-hints {
  padding: 14px;
  border-radius: 14px;
  border: 1px solid rgba(220, 174, 255, 0.16);
  background: rgba(220, 174, 255, 0.05);
}

.automation-field-hints strong {
  display: block;
  margin-bottom: 10px;
  color: var(--text);
  font-size: 13px;
}

.template-vars-box {
  grid-column: 1 / -1;
  padding: 10px 12px;
  border-radius: 12px;
  background: var(--accent-soft);
  border: 1px solid rgba(220, 174, 255, 0.22);
}

.template-vars-box strong {
  display: block;
  margin-bottom: 8px;
  color: var(--text);
  font-size: 12px;
}

/* ── Telegram ── */
.telegram-page .template-preview {
  margin: 10px 0;
  color: var(--text-muted);
  font-size: 13px;
  line-height: 1.45;
  white-space: pre-wrap;
}

.tg-field-list {
  display: grid;
  gap: 8px;
}

.tg-field-token {
  width: 100%;
  padding: 11px 12px;
  display: grid;
  gap: 3px;
  text-align: left;
  border-radius: 12px;
  border: 1px solid rgba(220, 174, 255, 0.18);
  background: rgba(220, 174, 255, 0.06);
  color: var(--text);
  cursor: pointer;
}

.tg-field-token strong {
  color: var(--accent);
  font-size: 13px;
}

.tg-field-token span {
  color: var(--text-meta);
  font-size: 12px;
}

.telegram-bot-card,
.telegram-link-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.telegram-bot-card {
  justify-content: flex-start;
  padding: 14px;
  border-radius: 14px;
  border: 1px solid rgba(220, 174, 255, 0.22);
  background: rgba(220, 174, 255, 0.07);
}

.telegram-bot-orb {
  width: 44px;
  height: 44px;
  min-width: 44px;
  display: grid;
  place-items: center;
  border-radius: 14px;
  color: var(--accent-ink);
  font-weight: 800;
  background: var(--accent);
}

.telegram-bot-card strong,
.telegram-link-row strong {
  display: block;
  color: var(--text);
}

.telegram-bot-card span,
.telegram-link-row span {
  display: block;
  color: var(--text-meta);
  font-size: 12px;
  margin-top: 3px;
}

.telegram-admin-shell {
  display: grid;
  gap: 16px;
}

.telegram-links-list {
  display: grid;
  gap: 10px;
}

.telegram-link-row {
  padding: 12px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--card-2);
}

.telegram-code-popup {
  margin-top: 12px;
  padding: 14px;
  display: grid;
  gap: 6px;
  border-radius: 14px;
  border: 1px solid rgba(220, 174, 255, 0.35);
  background: var(--accent-soft);
}

.telegram-code-popup strong {
  color: var(--text);
  font-size: 22px;
  letter-spacing: 0.08em;
}

.automation-hint-card {
  padding: 12px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--accent-soft);
}

/* ── Drawers ── */
.drawer-backdrop {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: none;
  background: rgba(6, 6, 10, 0.6);
  backdrop-filter: blur(2px);
}

.drawer-backdrop.open {
  display: block;
}

.drawer {
  position: fixed;
  z-index: 50;
  top: 0;
  right: 0;
  width: min(520px, 100vw);
  height: 100vh;
  background: #161620;
  border-left: 1px solid var(--border-strong);
  box-shadow: var(--shadow);
  transform: translateX(102%);
  transition: transform 0.22s cubic-bezier(0.16, 1, 0.3, 1);
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
}

.drawer-wide {
  width: min(960px, 100vw);
}

.drawer.open {
  transform: translateX(0);
}

.drawer-head {
  min-height: 62px;
  padding: 0 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border);
}

.drawer-head h3 {
  margin: 0;
  font-size: 17px;
  font-weight: 700;
}

.drawer-body {
  padding: 20px;
  overflow: auto;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.form-grid .full {
  grid-column: 1 / -1;
}

/* ── Client Graph Editor ── */
.graph-layout {
  min-height: calc(100vh - 112px);
  display: grid;
  grid-template-columns: minmax(0, 1fr) 280px;
  gap: 16px;
}

.graph-workspace {
  min-width: 0;
  display: grid;
  grid-template-rows: auto minmax(500px, 1fr);
  gap: 12px;
}

.graph-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.graph-zoom-controls {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--card);
}

.graph-zoom-value {
  min-width: 52px;
  height: 28px;
  border: 0;
  border-radius: 999px;
  color: var(--text);
  background: var(--surface-2);
  cursor: pointer;
  font-size: 12px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.client-graph-canvas {
  position: relative;
  min-height: 500px;
  overflow: auto;
  cursor: grab;
  touch-action: none;
  user-select: none;
  border: 1px solid var(--border);
  border-radius: 16px;
  background:
    radial-gradient(rgba(255, 255, 255, 0.08) 1px, transparent 1px),
    #12121a;
  background-size: 24px 24px;
}

.client-graph-canvas.is-panning,
.client-graph-canvas.is-panning * {
  cursor: grabbing !important;
}

.client-graph-canvas.is-generating {
  overflow: hidden;
  border-color: rgba(220, 174, 255, 0.4);
}

.client-graph-canvas.is-generating .graph-scale-layer {
  opacity: 0.1;
  filter: blur(3px);
  pointer-events: none;
}

.graph-scale-layer {
  position: relative;
  min-width: 100%;
  min-height: 100%;
}

.graph-stage {
  position: relative;
  transform-origin: 0 0;
}

.graph-edges {
  position: absolute;
  inset: 0;
  width: 1200px;
  height: 760px;
  pointer-events: none;
  overflow: visible;
}

.graph-edges path {
  fill: none;
  stroke: rgba(220, 174, 255, 0.7);
  stroke-width: 2.25;
}

.graph-node {
  position: absolute;
  width: 220px;
  min-height: 84px;
  padding: 10px 12px;
  display: grid;
  gap: 5px;
  text-align: left;
  color: var(--text);
  background: var(--card-2);
  border: 1px solid var(--border-strong);
  border-radius: 14px;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.25);
  cursor: grab;
  user-select: none;
}

.graph-node:active {
  cursor: grabbing;
}

.graph-node.selected {
  outline: 2px solid var(--accent);
}

.graph-node.connect-from {
  outline: 2px solid var(--success);
}

.graph-node.date {
  border-left: 3px solid var(--cyan);
}

.graph-node.text {
  border-left: 3px solid var(--warning);
}

.graph-node.action {
  border-left: 3px solid var(--success);
}

.graph-node span {
  color: var(--text-meta);
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.graph-node strong,
.graph-node small {
  overflow: hidden;
  text-overflow: ellipsis;
}

.graph-node strong {
  font-size: 14px;
}

.graph-node small {
  display: -webkit-box;
  color: var(--text-muted);
  font-size: 12px;
  line-height: 1.35;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.graph-inspector {
  min-width: 0;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--card);
}

.graph-generation-status {
  margin: 10px 0 12px;
  padding: 14px;
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  border-radius: 14px;
  border: 1px solid rgba(220, 174, 255, 0.3);
  background: rgba(220, 174, 255, 0.08);
}

.graph-generation-overlay {
  position: absolute;
  inset: 0;
  z-index: 12;
  margin: 0 !important;
  min-height: 100%;
  place-content: center;
  grid-template-columns: 44px minmax(220px, 480px);
  border: 0;
  border-radius: inherit;
  background: rgba(16, 16, 23, 0.92);
  backdrop-filter: blur(8px);
}

.graph-generation-status strong {
  display: block;
  color: var(--text);
  font-size: 14px;
}

.graph-generation-status small {
  display: block;
  margin-top: 3px;
  color: var(--text-muted);
  font-size: 12px;
}

.graph-generation-spinner {
  width: 30px;
  height: 30px;
  border-radius: 999px;
  border: 2px solid rgba(220, 174, 255, 0.2);
  border-top-color: var(--accent);
  animation: graphSpin 0.9s linear infinite;
}

.graph-generation-progress {
  width: min(360px, 100%);
  height: 5px;
  margin-top: 12px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
}

.graph-generation-progress i {
  display: block;
  width: 38%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, transparent, var(--accent), var(--cyan), transparent);
  animation: graphProgress 1.15s ease-in-out infinite;
}

@keyframes graphSpin {
  to { transform: rotate(360deg); }
}

@keyframes graphProgress {
  0% { transform: translateX(-105%); }
  100% { transform: translateX(285%); }
}

/* ── AI Summary ── */
.ai-tile-btn {
  min-width: 34px;
  color: var(--accent-ink);
  background: var(--accent);
  font-weight: 800;
}

.ai-summary-shell {
  display: grid;
  gap: 16px;
}

.ai-hero {
  position: relative;
  overflow: hidden;
  min-height: 148px;
  padding: 20px;
  display: flex;
  align-items: center;
  gap: 16px;
  border: 1px solid rgba(220, 174, 255, 0.24);
  border-radius: 18px;
  background:
    radial-gradient(circle at 12% 20%, rgba(220, 174, 255, 0.16), transparent 36%),
    radial-gradient(circle at 88% 18%, rgba(40, 184, 229, 0.12), transparent 36%),
    var(--card);
}

.ai-hero::after {
  content: "";
  position: absolute;
  inset: auto -12% -72% 28%;
  height: 170px;
  transform: rotate(-8deg);
  background: linear-gradient(90deg, transparent, rgba(220, 174, 255, 0.14), transparent);
  pointer-events: none;
}

.ai-hero-loading::after {
  animation: aiSweep 1.35s ease-in-out infinite;
}

@keyframes aiSweep {
  0% { transform: translateX(-80%) rotate(-8deg); }
  100% { transform: translateX(120%) rotate(-8deg); }
}

.ai-hero-error {
  border-color: rgba(239, 123, 135, 0.34);
  background:
    radial-gradient(circle at 18% 18%, rgba(239, 123, 135, 0.16), transparent 34%),
    var(--card);
}

.ai-orb {
  width: 64px;
  height: 64px;
  min-width: 64px;
  display: grid;
  place-items: center;
  border-radius: 18px;
  color: var(--accent-ink);
  background: linear-gradient(135deg, var(--accent), #9ec5ff);
  font-size: 20px;
  font-weight: 800;
}

.ai-hero h2 {
  margin: 4px 0 6px;
  font-size: clamp(22px, 2.5vw, 28px);
  line-height: 1.1;
  font-weight: 700;
}

.ai-hero p {
  margin: 0;
  max-width: 720px;
  color: var(--text-muted);
  font-size: 13px;
  line-height: 1.5;
}

.ai-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--accent);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.ai-client-strip {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 10px;
}

.ai-client-chip {
  min-width: 0;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--card);
}

.ai-client-chip span,
.ai-client-chip strong {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ai-client-chip span {
  margin-bottom: 4px;
  color: var(--text-meta);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.ai-client-chip strong {
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
}

.ai-summary-card {
  padding: 20px;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: var(--card);
}

.ai-summary-card h3,
.ai-summary-card h4,
.ai-summary-card h5,
.ai-summary-card h6 {
  margin: 20px 0 10px;
  color: var(--accent);
  font-weight: 700;
}

.ai-summary-card h3:first-child,
.ai-summary-card h4:first-child,
.ai-summary-card h5:first-child,
.ai-summary-card h6:first-child {
  margin-top: 0;
}

.ai-summary-card h3 { font-size: 17px; }
.ai-summary-card h4 { font-size: 15px; }

.ai-summary-card strong {
  color: var(--text);
  font-weight: 700;
}

.ai-summary-card code {
  padding: 2px 6px;
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--cyan);
  background: #12121a;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.9em;
}

.ai-summary-card p {
  margin: 0 0 12px;
  color: var(--text);
  line-height: 1.6;
}

.ai-summary-card ul,
.ai-summary-card ol {
  margin: 0 0 14px;
  padding: 0;
  display: grid;
  gap: 8px;
  list-style: none;
}

.ai-summary-card li {
  position: relative;
  padding: 10px 12px 10px 34px;
  border: 1px solid var(--border);
  border-radius: 12px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.025);
  line-height: 1.45;
}

.ai-summary-card li::before {
  content: "✦";
  position: absolute;
  top: 10px;
  left: 12px;
  color: var(--accent);
}

.ai-summary-card ol {
  counter-reset: ai-step;
}

.ai-summary-card ol li {
  counter-increment: ai-step;
}

.ai-summary-card ol li::before {
  content: counter(ai-step);
  width: 17px;
  height: 17px;
  top: 10px;
  left: 10px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  color: var(--accent-ink);
  background: var(--accent);
  font-size: 10px;
  font-weight: 800;
}

.ai-summary-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-end;
}

.ai-skeleton {
  height: 14px;
  width: 72%;
  margin-bottom: 12px;
  border-radius: 999px;
  background: linear-gradient(90deg, rgba(255,255,255,0.05), rgba(255,255,255,0.12), rgba(255,255,255,0.05));
  background-size: 220% 100%;
  animation: aiPulse 1.1s ease-in-out infinite;
}

.ai-skeleton.wide { width: 92%; }
.ai-skeleton.short { width: 44%; }
.ai-skeleton.block { width: 100%; height: 112px; border-radius: 14px; }

@keyframes aiPulse {
  0% { background-position: 0% 50%; }
  100% { background-position: -220% 50%; }
}

/* ── Backup / Restore Modal ── */
.backup-card {
  margin-bottom: 16px;
}

.backup-card-body {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 18px;
}

.backup-card-icon {
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: var(--accent-soft);
  color: var(--accent);
}

.backup-card-icon svg {
  width: 22px;
  height: 22px;
}

.backup-card-text {
  flex: 1 1 auto;
  min-width: 0;
}

.backup-card-text h3 {
  margin: 0 0 4px;
  font-size: 16px;
}

.backup-card-text p {
  margin: 0;
  color: var(--text-muted);
  font-size: 13px;
  line-height: 1.45;
}

.backup-modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: grid;
  place-items: center;
  padding: 16px;
  background: rgba(10, 10, 16, 0.72);
  backdrop-filter: blur(4px);
}

.backup-modal {
  width: min(460px, 100%);
  padding: 22px;
  border-radius: 16px;
  background: var(--card);
  border: 1px solid var(--border-strong);
  box-shadow: var(--shadow);
  color: var(--text);
}

.backup-modal h3 {
  margin: 0 0 14px;
  font-size: 18px;
}

.backup-modal-stage {
  margin-bottom: 10px;
  color: var(--text-muted);
  font-size: 14px;
}

.backup-progress {
  height: 8px;
  border-radius: 999px;
  background: var(--surface-2);
  overflow: hidden;
}

.backup-progress-bar {
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent), var(--cyan));
  transition: width 0.25s ease;
}

.backup-modal-backdrop.is-done .backup-progress-bar {
  background: var(--success);
}

.backup-modal-backdrop.is-error .backup-progress-bar {
  background: var(--danger);
}

.backup-modal-meta {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-top: 8px;
  color: var(--text-meta);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

.backup-modal-result {
  margin-top: 16px;
  font-size: 14px;
  line-height: 1.5;
}

.backup-modal-result p {
  margin: 0 0 12px;
}

.backup-modal-backdrop.is-error .backup-modal-result {
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid rgba(239, 123, 135, 0.45);
  background: rgba(239, 123, 135, 0.08);
}

.backup-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(72px, 1fr));
  gap: 8px;
}

.backup-summary div {
  display: grid;
  gap: 2px;
  padding: 8px 10px;
  border-radius: 10px;
  background: var(--surface-2);
}

.backup-summary strong {
  font-size: 16px;
  font-variant-numeric: tabular-nums;
}

.backup-summary span {
  color: var(--text-muted);
  font-size: 12px;
}

.backup-modal-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 18px;
}

/* ── Toast, Skeleton, Empty ── */
.toast-root {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 80;
  display: grid;
  gap: 10px;
}

.toast {
  min-width: 260px;
  max-width: 360px;
  border-radius: 12px;
  padding: 12px 16px;
  background: var(--card-2);
  color: var(--text);
  border: 1px solid var(--border-strong);
  box-shadow: var(--shadow);
  font-size: 13px;
}

.toast.error {
  border-color: rgba(239, 123, 135, 0.5);
}

.toast.success {
  border-color: rgba(124, 217, 142, 0.45);
}

.skeleton {
  min-height: 120px;
  border-radius: 16px;
  background: linear-gradient(90deg, var(--card), var(--surface-2), var(--card));
  background-size: 240% 100%;
  animation: shimmer 1.2s linear infinite;
}

@keyframes shimmer {
  to { background-position: -240% 0; }
}

.empty-state {
  min-height: 180px;
  display: grid;
  place-items: center;
  text-align: center;
  color: var(--text-meta);
  border: 1px dashed var(--border-strong);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.015);
  font-size: 13px;
}

.bottom-nav {
  display: none;
}

.stage-tabs {
  display: none;
}

/* ── Tablet Breakpoints ── */
@media (max-width: 1280px) {
  .premium-dashboard-grid,
  .clients-layout {
    grid-template-columns: minmax(0, 1fr);
  }

  .premium-side-col,
  .clients-side {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .premium-kpi-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .client-kpi-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .clients-card-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .client-filters-panel {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .clients-page .premium-filter-bar {
    grid-template-columns: minmax(200px, 1fr) repeat(2, minmax(140px, 1fr));
  }

  .clients-page .date-filter-group {
    grid-column: 1 / -1;
    max-width: 420px;
  }
}

@media (max-width: 960px) {
  .clients-card-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 1199px) {
  :root {
    --sidebar-width: 74px;
  }

  .sidebar,
  .sidebar.premium-sidebar {
    width: var(--sidebar-width);
  }

  .sidebar .brand-copy,
  .profile-card div,
  .nav-item span:not(.nav-icon),
  .nav-section-label,
  .shortcut-item b,
  .sidebar-footer {
    display: none;
  }

  .profile-card {
    justify-content: center;
    padding: 8px;
  }

  .nav-item,
  .premium-nav .nav-item {
    justify-content: center;
    padding: 0;
  }

  .kpi-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .grid-4 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 980px) {
  .automation-editor-top,
  .automation-builder-grid {
    grid-template-columns: 1fr;
  }

  .automation-editor-top {
    display: grid;
  }

  .pipeline-step-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* ── Mobile Breakpoint (Reference Screenshots 4 & 5) ── */
@media (max-width: 767px) {
  :root {
    --sidebar-width: 0px;
    --topbar-height: 58px;
  }

  .login-shell,
  .setup-shell {
    grid-template-columns: 1fr;
  }

  .login-visual {
    min-height: 32vh;
    padding: 28px 18px;
  }

  .login-intro h2 {
    font-size: 28px;
  }

  .login-panel {
    min-height: 68vh;
    padding: 24px 18px calc(24px + env(safe-area-inset-bottom));
    border-left: 0;
  }

  .app-shell,
  .app-shell.premium-shell {
    display: block;
    padding-bottom: calc(74px + env(safe-area-inset-bottom));
  }

  .sidebar,
  .sidebar.premium-sidebar {
    width: min(86vw, 310px);
    max-width: 310px;
    transform: translateX(-104%);
    transition: transform 0.22s ease;
    z-index: 60;
  }

  .sidebar.open,
  .sidebar.premium-sidebar.open {
    transform: translateX(0);
  }

  .sidebar .brand-copy,
  .profile-card div,
  .nav-item span:not(.nav-icon),
  .nav-section-label,
  .shortcut-item b,
  .sidebar-footer {
    display: block;
  }

  .nav-item,
  .premium-nav .nav-item {
    justify-content: flex-start;
    padding: 0 14px;
  }

  .main {
    grid-column: auto;
  }

  .topbar,
  .premium-topbar {
    position: sticky;
    top: 0;
    z-index: 35;
    padding: 0 12px;
    gap: 8px;
  }

  .menu-toggle {
    display: inline-grid;
    flex-shrink: 0;
  }

  .page-title {
    min-width: 0;
    flex: 1;
  }

  .page-title h1 {
    font-size: 17px;
  }

  .page-title span,
  .topbar-actions .desktop-only,
  .top-profile.desktop-only {
    display: none !important;
  }

  .search.premium-search {
    display: flex;
    flex: 1;
    min-width: 0;
    max-width: none;
    margin: 0;
  }

  .premium-search input {
    height: 36px;
    min-height: 36px;
    padding-left: 36px;
    padding-right: 12px;
    font-size: 13px;
  }

  .premium-search kbd,
  .search-clear {
    display: none;
  }

  .workspace {
    padding: 14px;
  }

  .toolbar,
  .premium-page-head {
    display: grid;
    grid-template-columns: 1fr;
    align-items: start;
    gap: 10px;
  }

  .toolbar .btn,
  .row-actions,
  .row-actions .btn,
  .premium-add-btn {
    width: 100%;
  }

  .row-actions {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .kanban-hero {
    grid-template-columns: 1fr;
    align-items: stretch;
  }

  .grid,
  .grid-2,
  .grid-3,
  .grid-4,
  .kpi-grid,
  .mail-shell,
  .mail-compose-layout,
  .split,
  .premium-dashboard-grid,
  .premium-bottom-grid,
  .premium-side-col,
  .clients-side,
  .clients-layout {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .premium-kpi-grid,
  .client-kpi-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }

  .premium-kpi-card {
    min-height: 112px;
    padding: 14px;
  }

  .premium-kpi-card .kpi-value {
    font-size: 22px;
  }

  .pipeline-step-row {
    grid-template-columns: 1fr;
  }

  .chart-canvas {
    height: 210px;
  }

  .chart-stats {
    grid-template-columns: 1fr;
  }

  .stage-tabs {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding: 6px;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: var(--card);
  }

  .stage-tab {
    min-height: 36px;
    padding: 0 14px;
    border-radius: 999px;
    border: 1px solid var(--border);
    color: var(--text-muted);
    background: var(--surface-2);
    white-space: nowrap;
    cursor: pointer;
    font-size: 12px;
    font-weight: 600;
  }

  .stage-tab.active {
    color: var(--accent-ink);
    border-color: transparent;
    background: var(--accent);
    font-weight: 700;
  }

  .kanban-board {
    display: block;
    overflow: visible;
    min-height: 0;
  }

  .kanban-column {
    display: none;
    margin-bottom: 12px;
  }

  .kanban-column.active-mobile {
    display: flex;
  }

  .clients-page .premium-filter-bar {
    grid-template-columns: 1fr;
    padding: 12px;
  }

  .clients-page .date-filter-group {
    grid-column: auto;
    max-width: none;
  }

  .clients-search-pill {
    flex: 1 1 100%;
    min-width: 0;
  }

  .clients-card-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .client-create-tile {
    min-height: 156px;
  }

  .client-tile {
    min-height: 0;
  }

  .client-tile-head {
    grid-template-columns: 40px minmax(0, 1fr) auto;
  }

  .client-tile-actions {
    position: static;
    padding: 0;
    border: 0;
    background: transparent;
    box-shadow: none;
    opacity: 0.72;
    pointer-events: auto;
  }

  .client-filters-panel {
    grid-template-columns: 1fr;
  }

  .mobile-clients-fab {
    position: fixed;
    right: 16px;
    bottom: calc(80px + env(safe-area-inset-bottom));
    z-index: 25;
    width: 52px;
    height: 52px;
    border-radius: 16px;
    display: grid;
    place-items: center;
    background: var(--accent);
    color: var(--accent-ink);
    box-shadow: 0 12px 28px rgba(0, 0, 0, 0.44);
    cursor: pointer;
  }

  .mobile-clients-fab .ui-icon {
    width: 22px;
    height: 22px;
  }

  .clients-page .client-status-filter .status-chip,
  .clients-page .client-status-filter .client-filter-reset {
    flex: 0 0 auto;
    justify-content: center;
  }

  .clients-main-card {
    overflow: visible;
    background: transparent;
    border: 0;
    box-shadow: none;
  }

  .clients-page .premium-filter-bar {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 16px;
    margin-bottom: 12px;
  }

  .premium-table-wrap {
    overflow: visible;
  }

  .data-table {
    display: none;
  }

  .premium-clients-table {
    min-width: 0;
    width: 100%;
    display: block;
  }

  .premium-clients-table thead {
    display: none;
  }

  .premium-clients-table tbody {
    display: grid;
    gap: 10px;
  }

  .premium-clients-table tr.client-table-row {
    display: grid;
    gap: 0;
    padding: 12px 14px;
    border: 1px solid var(--border);
    border-radius: 16px;
    background: var(--card);
  }

  .premium-clients-table td {
    display: grid;
    grid-template-columns: 98px minmax(0, 1fr);
    align-items: center;
    gap: 10px;
    min-height: 36px;
    padding: 7px 0;
    border-bottom: 1px solid var(--border);
    background: transparent !important;
  }

  .premium-clients-table td::before {
    color: var(--text-meta);
    font-size: 11px;
    font-weight: 600;
  }

  .premium-clients-table td:nth-child(1) {
    display: none;
  }

  .premium-clients-table td:nth-child(2)::before { content: "Клиент"; }
  .premium-clients-table td:nth-child(3)::before { content: "Менеджер"; }
  .premium-clients-table td:nth-child(4)::before { content: "Контакты"; }
  .premium-clients-table td:nth-child(5)::before { content: "Источник"; }
  .premium-clients-table td:nth-child(6)::before { content: "Сделка"; }
  .premium-clients-table td:nth-child(7)::before { content: "Статус"; }
  .premium-clients-table td:nth-child(8)::before { content: "Активность"; }
  .premium-clients-table td:nth-child(9)::before { content: "ИИ"; }
  .premium-clients-table td:nth-child(10)::before { content: "Действия"; }

  .premium-clients-table td:last-child {
    border-bottom: 0;
  }

  .stack-cell strong,
  .stack-cell span,
  .link-cell strong,
  .link-cell span {
    max-width: 100%;
  }

  .ai-col,
  .row-actions-cell {
    width: auto;
    text-align: left;
  }

  .row-menu {
    justify-content: flex-start;
  }

  .premium-table-footer {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
    margin-top: 10px;
    border-radius: 16px;
    border: 1px solid var(--border);
    background: var(--card);
  }

  .page-info,
  .pager {
    width: 100%;
    justify-content: space-between;
  }

  .status-summary {
    grid-template-columns: 96px minmax(0, 1fr);
    align-items: center;
  }

  .donut-mini {
    margin: 0;
  }

  .mobile-list {
    display: grid;
    gap: 10px;
  }

  .form-grid {
    grid-template-columns: 1fr;
  }

  .checklist-builder-top,
  .deal-checklist-row {
    grid-template-columns: 1fr;
  }

  .checklist-builder-top .icon-btn,
  .deal-check-toggle {
    justify-self: start;
  }

  .checklist-builder-details {
    grid-template-columns: 1fr;
  }

  .graph-layout {
    min-height: 0;
    grid-template-columns: 1fr;
  }

  .graph-workspace {
    grid-template-rows: auto minmax(400px, 1fr);
  }

  .client-graph-canvas {
    min-height: 400px;
  }

  .graph-zoom-controls {
    width: 100%;
    margin-left: 0;
    justify-content: center;
  }

  .graph-generation-overlay {
    grid-template-columns: 1fr;
    justify-items: center;
    text-align: center;
    padding: 20px;
  }

  .telegram-bot-card,
  .telegram-link-row {
    align-items: flex-start;
    flex-direction: column;
  }

  .telegram-link-row .chips {
    width: 100%;
  }

  .backup-card-body {
    flex-wrap: wrap;
  }

  .backup-card-body .btn {
    width: 100%;
  }

  .drawer {
    top: auto;
    right: 0;
    bottom: 0;
    width: 100vw;
    max-width: 100vw;
    height: min(88vh, 720px);
    border-left: 0;
    border-top: 1px solid var(--border-strong);
    border-radius: 18px 18px 0 0;
    transform: translateY(102%);
  }

  .drawer.open {
    transform: translateY(0);
  }

  /* Mobile Bottom Navigation (Reference Screenshots 4 & 5) */
  .bottom-nav {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 30;
    height: calc(66px + env(safe-area-inset-bottom));
    padding: 6px 8px env(safe-area-inset-bottom);
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 4px;
    background: var(--sidebar);
    border-top: 1px solid var(--border);
  }

  .bottom-nav button {
    min-height: 50px;
    display: grid;
    place-items: center;
    align-content: center;
    gap: 3px;
    color: var(--text-muted);
    background: transparent;
    border-radius: 16px;
    font-size: 11px;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.16s ease, color 0.16s ease;
  }

  .bottom-nav button.active {
    color: var(--accent);
    font-weight: 650;
    background: var(--accent-soft);
  }

  .toast-root {
    left: 12px;
    right: 12px;
    bottom: calc(78px + env(safe-area-inset-bottom));
  }

  .toast {
    min-width: 0;
    max-width: none;
  }
}

@media (max-width: 430px) {
  .premium-kpi-grid,
  .client-kpi-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .date-filter-group {
    grid-template-columns: 1fr;
  }

  .premium-clients-table td {
    grid-template-columns: 88px minmax(0, 1fr);
  }

  .premium-search input::placeholder {
    color: transparent;
  }
}
