:root,
[data-theme="dark"] {
  color-scheme: dark;
  --bg: #070b14;
  --bg-accent: radial-gradient(ellipse 120% 80% at 10% -20%, rgba(56, 189, 248, 0.12), transparent 50%),
    radial-gradient(ellipse 80% 60% at 90% 0%, rgba(99, 102, 241, 0.1), transparent 45%),
    #070b14;
  --surface: #121a2b;
  --surface2: #1a2438;
  --surface-glass: rgba(18, 26, 43, 0.85);
  --border: #2a3654;
  --text: #eef2ff;
  --muted: #8b9cc0;
  --accent: #38bdf8;
  --accent-deep: #6366f1;
  --accent2: #22c55e;
  --danger: #ef4444;
  --warn: #f59e0b;
  --radius: 16px;
  --shadow: 0 16px 48px rgba(0, 0, 0, 0.35);
  --brand-gradient: linear-gradient(135deg, #38bdf8 0%, #6366f1 55%, #818cf8 100%);
  --chart-grid: rgba(139, 156, 192, 0.12);
  --chart-1: #38bdf8;
  --chart-2: #6366f1;
  --chart-3: #22c55e;
  --chart-4: #f59e0b;
  --chart-5: #f472b6;
  --chart-6: #a78bfa;
  --input-bg: #0f172a;
  --hero-glow: rgba(56, 189, 248, 0.08);
}

[data-theme="light"] {
  color-scheme: light;
  --bg: #f4f7fc;
  --bg-accent: radial-gradient(ellipse 100% 70% at 0% 0%, rgba(56, 189, 248, 0.14), transparent 55%),
    radial-gradient(ellipse 80% 50% at 100% 10%, rgba(99, 102, 241, 0.1), transparent 50%),
    #f4f7fc;
  --surface: #ffffff;
  --surface2: #eef2f9;
  --surface-glass: rgba(255, 255, 255, 0.92);
  --border: #d4dce8;
  --text: #0f172a;
  --muted: #5b6b84;
  --accent: #0284c7;
  --accent-deep: #4f46e5;
  --accent2: #16a34a;
  --danger: #dc2626;
  --warn: #d97706;
  --shadow: 0 16px 40px rgba(15, 23, 42, 0.07);
  --brand-gradient: linear-gradient(135deg, #0284c7 0%, #4f46e5 55%, #6366f1 100%);
  --chart-grid: rgba(91, 107, 132, 0.2);
  --chart-1: #0284c7;
  --chart-2: #4f46e5;
  --chart-3: #16a34a;
  --chart-4: #d97706;
  --chart-5: #db2777;
  --chart-6: #7c3aed;
  --input-bg: #ffffff;
  --hero-glow: rgba(2, 132, 199, 0.06);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: "DM Sans", system-ui, sans-serif;
  background: var(--bg-accent);
  background-color: var(--bg);
  color: var(--text);
  line-height: 1.5;
  min-height: 100vh;
  transition: background-color 0.25s ease, color 0.2s ease;
}

.screen { min-height: 100vh; }
.hidden { display: none !important; }

/* AUTH */
.auth-split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  min-height: 100vh;
}
@media (max-width: 900px) {
  .auth-split { grid-template-columns: 1fr; }
  .auth-brand { padding: 2rem !important; }
}
.auth-brand {
  padding: 3rem;
  background: linear-gradient(145deg, #1a2744 0%, #0f172a 60%);
  border-right: 1px solid var(--border);
}
.auth-brand h1 { font-size: 2rem; margin: 0.75rem 0 1rem; line-height: 1.2; }
.auth-brand p { color: var(--muted); max-width: 28rem; }
.brand-lockup {
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  text-decoration: none;
  color: inherit;
}
.brand-lockup:hover .brand-wordmark { opacity: 0.92; }
.brand-logo { display: block; flex-shrink: 0; }
.brand-logo.sm { width: 36px; height: 36px; }
.brand-wordmark {
  font-size: 1.65rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1;
}
.brand-wordmark.sm { font-size: 1.2rem; }
.brand-accent { color: var(--accent); }
.module-pill {
  display: inline-block;
  margin: 0.75rem 0 0;
  padding: 0.25rem 0.65rem;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--accent);
  background: rgba(56, 189, 248, 0.12);
  border: 1px solid rgba(56, 189, 248, 0.35);
  border-radius: 999px;
}
.module-pill.sm {
  margin: 0.15rem 0 0.35rem;
  display: block;
  width: fit-content;
  font-size: 0.65rem;
}
.auth-forms-head {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 1.25rem;
}
.auth-theme-toggle { margin-left: auto; }
.hint-box {
  padding: 1rem 1.25rem;
  border-radius: var(--radius);
  border: 1px dashed var(--border);
  background: var(--surface2);
  margin-bottom: 1rem;
}
.sidebar-brand {
  display: block;
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}
.sidebar-head strong {
  display: block;
  font-size: 0.85rem;
  margin-top: 0.15rem;
  color: var(--text);
}
.sidebar-marketing {
  display: block;
  margin: 0.5rem 0 0.25rem;
  padding: 0 0.75rem;
  font-size: 0.75rem;
  color: var(--muted);
  text-decoration: none;
}
.sidebar-marketing:hover { color: var(--accent); }
.story-list { list-style: none; padding: 0; margin: 2rem 0 0; }
.story-list li {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.5rem 0;
  color: var(--muted);
}
.story-icon {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--surface2);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 600;
}
.story-icon.done {
  background: rgba(34, 197, 94, 0.2);
  border-color: var(--accent2);
  color: var(--accent2);
}
.auth-forms {
  padding: 3rem;
  display: flex;
  flex-direction: column;
  justify-content: center;
  max-width: 440px;
  margin: 0 auto;
  width: 100%;
}
.auth-status {
  font-size: 0.85rem;
  min-height: 1.25rem;
  margin-bottom: 0.75rem;
  color: var(--muted);
}
.auth-status.error { color: #fca5a5; }
.auth-status.ok { color: var(--accent2); }
.auth-legal-check {
  display: flex;
  gap: 0.5rem;
  align-items: flex-start;
  font-size: 0.85rem;
  line-height: 1.4;
  margin: 0.75rem 0 1rem;
  color: var(--muted);
}
.auth-legal-check input { margin-top: 0.2rem; flex-shrink: 0; }
.auth-legal-check a { color: var(--accent, #60a5fa); }
.auth-legal-footer {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1rem;
  margin-top: 1.5rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border, rgba(255,255,255,0.08));
  font-size: 0.8rem;
}
.auth-legal-footer a { color: var(--muted); text-decoration: none; }
.auth-legal-footer a:hover { color: var(--accent, #60a5fa); }
.auth-forgot-row { margin-top: 0.75rem; text-align: center; }
.forgot-reset-link-box {
  margin-top: 1rem;
  padding: 1rem 1.1rem;
  background: #eff6ff;
  border: 2px solid #3b82f6;
  border-radius: 12px;
  font-size: 0.9rem;
  line-height: 1.5;
  word-break: break-all;
}
.forgot-reset-link-box .forgot-reset-link {
  color: #1d4ed8;
  font-weight: 600;
  text-decoration: underline;
}
.btn.linkish {
  background: none;
  border: none;
  padding: 0;
  color: var(--accent, #60a5fa);
  font-size: 0.85rem;
  cursor: pointer;
  text-decoration: underline;
}
.auth-step-title { margin: 0 0 0.5rem; font-size: 1.35rem; }
.auth-step { animation: fadeIn 0.2s ease; }
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}
.auth-back { margin-bottom: 1rem; padding-left: 0; }
.auth-choice-grid {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-top: 1.25rem;
}
.auth-choice-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.25rem;
  text-align: left;
  padding: 1rem 1.15rem;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--surface2);
  color: var(--text);
  cursor: pointer;
  font-family: inherit;
  transition: border-color 0.15s, background 0.15s;
}
.auth-choice-card:hover {
  border-color: var(--accent);
  background: rgba(59, 130, 246, 0.1);
}
.auth-choice-card strong { font-size: 1rem; }
.auth-choice-card .muted { font-size: 0.85rem; }
.lang-picker {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.5rem;
  margin: 1rem 0 1.25rem;
  max-height: 280px;
  overflow-y: auto;
}
.lang-option {
  padding: 0.65rem 0.75rem;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface2);
  color: var(--text);
  font-family: inherit;
  font-size: 0.9rem;
  cursor: pointer;
  text-align: left;
}
.lang-option:hover { border-color: var(--accent); }
.lang-option.selected {
  border-color: var(--accent);
  background: rgba(56, 189, 248, 0.15);
  font-weight: 600;
}
.platform-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 1rem;
}
.audit-list li { flex-direction: column; align-items: flex-start; gap: 0.2rem; }
html[dir="rtl"] .auth-back { text-align: right; }
.choice-icon {
  font-size: 1.25rem;
  margin-bottom: 0.25rem;
}
.tabs { display: flex; gap: 0.5rem; margin-bottom: 1.5rem; }
.tab {
  flex: 1;
  padding: 0.6rem;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--muted);
  border-radius: 8px;
  cursor: pointer;
  font-family: inherit;
  font-weight: 500;
}
.tab.active {
  background: var(--surface2);
  color: var(--text);
  border-color: var(--accent);
}

/* APP LAYOUT */
#screen-app {
  display: grid;
  grid-template-columns: 260px 1fr;
  min-height: 100vh;
}
.sidebar {
  background: var(--surface-glass);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-right: 1px solid var(--border);
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  box-shadow: 4px 0 24px rgba(0, 0, 0, 0.04);
}
.sidebar-head {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  margin-bottom: 1.5rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border);
}
.sidebar-head strong { display: block; font-size: 0.95rem; }
.sidebar-head small { color: var(--muted); font-size: 0.8rem; }
.step-nav { flex: 1; display: flex; flex-direction: column; gap: 0.35rem; }
.step-btn {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  width: 100%;
  padding: 0.65rem 0.75rem;
  border: 1px solid transparent;
  border-radius: 10px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  text-align: left;
  font-family: inherit;
  font-size: 0.9rem;
  transition: background 0.15s, color 0.15s;
}
.step-btn:hover { background: var(--surface2); color: var(--text); }
.step-btn.active {
  background: rgba(59, 130, 246, 0.15);
  border-color: rgba(59, 130, 246, 0.4);
  color: var(--text);
}
.step-btn .step-dot {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 2px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  flex-shrink: 0;
}
.step-btn.done .step-dot {
  background: rgba(34, 197, 94, 0.2);
  border-color: var(--accent2);
  color: var(--accent2);
}
.step-btn.active .step-dot {
  border-color: var(--accent);
  background: rgba(59, 130, 246, 0.25);
  color: var(--accent);
}
.step-btn.sub {
  padding-left: 1.35rem;
  font-size: 0.85rem;
}
.step-btn.sub .step-dot {
  width: 22px;
  height: 22px;
  font-size: 0.65rem;
}
.nav-section-label {
  margin: 0.85rem 0 0.35rem;
  padding: 0 0.5rem;
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}
.nav-section-label:first-child { margin-top: 0; }
.nav-section-label.kpi { color: var(--accent); }
.nav-section-label.insp { color: #a78bfa; }
.kpi-context-pill.insp { background: color-mix(in srgb, #a78bfa 18%, transparent); color: #c4b5fd; }
.kpi-intro-eyebrow.insp { color: #a78bfa; }
.kpi-context-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 1rem;
  padding: 0.5rem 0.75rem;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface);
}
.kpi-context-pill {
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  background: color-mix(in srgb, var(--accent) 18%, transparent);
  color: var(--accent);
}
.sidebar-profile { margin-top: auto; }
.sidebar-logout { margin-top: 0.35rem; }
.badge-pending {
  display: inline-block;
  font-size: 0.7rem;
  padding: 0.1rem 0.4rem;
  border-radius: 4px;
  background: rgba(245, 158, 11, 0.2);
  color: var(--warn);
  margin-left: 0.25rem;
}
.profile-panel {
  max-width: 560px;
}
.profile-panel label {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  margin-bottom: 0.85rem;
}
.profile-panel label span {
  font-size: 0.88rem;
  font-weight: 500;
}
.profile-lang-row h4,
.profile-theme-row h4 {
  margin: 0 0 0.35rem;
  font-size: 0.95rem;
}
.profile-lang-row .lang-picker {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.4rem;
  margin: 0.5rem 0 0;
  max-height: 220px;
}

.main {
  padding: 1.5rem 2rem 3rem;
  overflow-y: auto;
  max-height: 100vh;
}
.page-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 1.5rem;
  gap: 1rem;
}
.page-head-actions {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  flex-shrink: 0;
}
.page-head h2 { margin: 0.15rem 0 0; font-size: 1.5rem; }
.theme-toggle {
  width: 42px;
  height: 42px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface2);
  color: var(--text);
  cursor: pointer;
  font-size: 1.15rem;
  line-height: 1;
  transition: border-color 0.2s, transform 0.1s;
}
.theme-toggle:hover { border-color: var(--accent); }
.theme-toggle:active { transform: scale(0.96); }
[data-theme="dark"] .theme-toggle .icon-light { display: none; }
[data-theme="light"] .theme-toggle .icon-dark { display: none; }
.eyebrow {
  margin: 0;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent);
  font-weight: 600;
}
.status-pill {
  font-size: 0.85rem;
  padding: 0.35rem 0.85rem;
  border-radius: 999px;
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--muted);
  max-width: 280px;
}
.status-pill.ok { color: var(--accent2); border-color: rgba(34, 197, 94, 0.4); }
.status-pill.error { color: #fca5a5; border-color: rgba(239, 68, 68, 0.4); }

/* COMPONENTS */
label {
  display: block;
  margin: 0.65rem 0;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--muted);
}
input, select, textarea {
  display: block;
  width: 100%;
  margin-top: 0.35rem;
  padding: 0.6rem 0.75rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--input-bg);
  color: var(--text);
  font-family: inherit;
  font-size: 0.95rem;
  transition: border-color 0.15s, box-shadow 0.15s;
}
input:focus, select:focus, textarea:focus {
  outline: 2px solid rgba(59, 130, 246, 0.5);
  border-color: var(--accent);
}
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  padding: 0.65rem 1.15rem;
  border: none;
  border-radius: 8px;
  font-family: inherit;
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
  transition: transform 0.1s, opacity 0.15s;
}
.btn:active { transform: scale(0.98); }
.btn.primary { background: var(--accent); color: #fff; }
.btn.secondary { background: var(--surface2); color: var(--text); border: 1px solid var(--border); }
.btn.ghost { background: transparent; color: var(--muted); border: 1px solid var(--border); }
.btn.danger { background: rgba(239, 68, 68, 0.15); color: #fca5a5; border: 1px solid rgba(239, 68, 68, 0.4); }
.btn.small { padding: 0.35rem 0.65rem; font-size: 0.8rem; }
.muted { color: var(--muted); font-size: 0.9rem; }
.hint { font-size: 0.8rem; color: var(--muted); margin: 0.25rem 0; }

.hero-card {
  background: linear-gradient(145deg, var(--surface), var(--surface2));
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  margin-bottom: 1.25rem;
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
}
.hero-card::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 100% 0%, var(--hero-glow), transparent 55%);
  pointer-events: none;
}
.info-card {
  transition: transform 0.15s, box-shadow 0.15s, border-color 0.15s;
}
.info-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow);
  border-color: rgba(56, 189, 248, 0.35);
}
.journey-track {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  margin-top: 1.25rem;
}
.journey-step {
  flex: 1;
  min-width: 140px;
  padding: 1rem;
  border-radius: 10px;
  background: var(--bg);
  border: 1px solid var(--border);
  text-align: center;
}
.journey-step.done {
  border-color: var(--accent2);
  background: rgba(34, 197, 94, 0.08);
}
.journey-step .j-icon {
  width: 40px;
  height: 40px;
  margin: 0 auto 0.5rem;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  border: 2px solid var(--border);
}
.journey-step.done .j-icon {
  background: var(--accent2);
  border-color: var(--accent2);
  color: #052e16;
}
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}
.info-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
}
.info-card h4 { margin: 0 0 0.5rem; }
.split-panels {
  display: grid;
  grid-template-columns: 1fr 1.2fr;
  gap: 1.25rem;
  margin-bottom: 1rem;
}
@media (max-width: 1000px) {
  #screen-app { grid-template-columns: 1fr; }
  .sidebar { border-right: none; border-bottom: 1px solid var(--border); }
  .split-panels { grid-template-columns: 1fr; }
}
.panel, .panel-wide {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
}
.panel h3, .panel-wide h3 { margin-top: 0; }
.entity-list {
  list-style: none;
  padding: 0;
  margin: 0 0 1rem;
  max-height: 320px;
  overflow-y: auto;
}
.entity-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.65rem 0.75rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  margin-bottom: 0.5rem;
  background: var(--bg);
  font-size: 0.9rem;
}
.entity-list.compact li { padding: 0.45rem 0.6rem; font-size: 0.85rem; }
.entity-list li.selected {
  border-color: var(--accent);
  background: rgba(59, 130, 246, 0.1);
}
.nav-row {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  margin-top: 1rem;
}
.nav-row.tight { margin-top: 0.75rem; }

.field-builder {
  margin: 1rem 0;
  padding: 1rem;
  background: var(--bg);
  border-radius: 10px;
  border: 1px dashed var(--border);
}
.field-builder-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.75rem;
}
.field-builder-head h4 { margin: 0; }
.field-row {
  padding: 0.75rem;
  margin-bottom: 0.75rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface2);
}
.field-row .row-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 0.5rem;
}
.options-editor textarea {
  min-height: 72px;
  font-family: ui-monospace, monospace;
  font-size: 0.85rem;
}
.preview-box {
  margin-top: 1.25rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}
.card-preview {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1.25rem;
  min-height: 120px;
}
.card-preview h5 { margin: 0 0 1rem; font-size: 1.1rem; }
.dynamic-form label { margin-top: 0.5rem; }

/* Visual card designer */
.designer-shell {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 1rem;
  margin-bottom: 1rem;
}
@media (max-width: 1100px) {
  .designer-shell { grid-template-columns: 1fr; }
}
.designer-list-panel .compact-label { margin-top: 1rem; font-size: 0.8rem; }
.designer-main { min-width: 0; }
.designer-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  margin-bottom: 1rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border);
}
.designer-toolbar h3 { margin: 0 0 0.25rem; }
.visual-designer {
  display: grid;
  grid-template-columns: 140px 1fr 220px;
  gap: 1rem;
  align-items: start;
}
@media (max-width: 900px) {
  .visual-designer { grid-template-columns: 1fr; }
}
.palette {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.85rem;
}
.palette h4 { margin: 0 0 0.35rem; font-size: 0.9rem; }
.palette-chips { display: flex; flex-direction: column; gap: 0.5rem; margin-top: 0.5rem; }
.palette-chip {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.55rem 0.65rem;
  border-radius: 8px;
  border: 1px dashed var(--accent);
  background: rgba(59, 130, 246, 0.08);
  cursor: grab;
  font-size: 0.85rem;
  font-weight: 500;
  user-select: none;
}
.palette-chip:active { cursor: grabbing; opacity: 0.85; }
.palette-chip:hover { border-style: solid; background: rgba(56, 189, 248, 0.14); }
.card-template-list {
  list-style: none;
  padding: 0;
  margin: 0 0 1rem;
  max-height: 280px;
  overflow-y: auto;
}
.card-template-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.65rem 0.75rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  margin-bottom: 0.5rem;
  background: var(--surface2);
  font-size: 0.9rem;
  cursor: pointer;
}
.card-template-list li.selected {
  border-color: var(--accent);
  background: rgba(59, 130, 246, 0.12);
}
.card-list-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 0.5rem;
  padding: 1rem 0.75rem !important;
  border: 2px dashed var(--border) !important;
  background: transparent !important;
  cursor: default !important;
  color: var(--muted);
}
.card-list-empty-icon {
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  border: 2px dashed var(--accent);
  color: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  font-weight: 700;
}
.card-list-empty p { margin: 0; font-size: 0.82rem; line-height: 1.45; }
.reserved-zone-editable {
  background: #fff !important;
  border-bottom: 2px solid #e2e8f0 !important;
}
.reserved-zone-editable .zone-label { color: var(--accent-deep); }
.zone-title-input {
  width: 100%;
  margin-top: 0.35rem;
  padding: 0.5rem 0.6rem;
  border-radius: 8px;
  border: 2px solid var(--accent);
  background: #fff;
  color: #0f172a;
  font-size: 1rem;
  font-weight: 600;
}
.zone-title-input:focus { outline: none; box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.25); }
.zone-hint {
  display: block;
  margin-top: 0.35rem;
  font-size: 0.68rem;
  color: #64748b;
}
.cf-remove {
  border: none;
  background: transparent;
  color: var(--danger);
  font-size: 1.1rem;
  line-height: 1;
  cursor: pointer;
  padding: 0 0.2rem;
  opacity: 0.7;
}
.cf-remove:hover { opacity: 1; }
.palette-presets {
  margin-top: 1.25rem;
  padding-top: 1rem;
  border-top: 1px dashed var(--border);
}
.palette-presets h4 { margin: 0 0 0.35rem; font-size: 0.85rem; }
.palette-presets .preset-btn {
  display: block;
  width: 100%;
  margin-top: 0.35rem;
  text-align: left;
}
.card-designer-guide {
  margin-bottom: 1rem;
  padding: 0.85rem 1rem;
  border-radius: 10px;
  border: 1px solid rgba(56, 189, 248, 0.25);
  background: rgba(56, 189, 248, 0.06);
}
.card-guide-eyebrow {
  margin: 0 0 0.25rem;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--accent);
}
.hub-module-flows {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}
.hub-flow-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.1rem 1.25rem;
}
.hub-flow-card.kpi-cards { border-top: 3px solid var(--chart-1); }
.hub-flow-card.inspections { border-top: 3px solid var(--chart-3); }
.hub-flow-card.meetings { border-top: 3px solid var(--chart-4); }
.hub-flow-head {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  margin-bottom: 0.85rem;
}
.hub-flow-head h4 { margin: 0; font-size: 1rem; }
.hub-flow-icon { font-size: 1.35rem; line-height: 1; }
.hub-flow-track {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem 0.5rem;
  margin-bottom: 0.85rem;
  font-size: 0.78rem;
}
.flow-step {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.35rem 0.55rem;
  border-radius: 8px;
  background: var(--bg);
  border: 1px solid var(--border);
  font-weight: 500;
}
.flow-num {
  width: 1.25rem;
  height: 1.25rem;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  font-size: 0.65rem;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.flow-arrow { color: var(--muted); font-weight: 600; font-size: 0.85rem; }
.cf-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.35rem;
  margin-bottom: 0.35rem;
}
.cf-preview-label {
  display: block;
  font-size: 0.68rem;
  font-weight: 600;
  color: var(--muted);
  margin-bottom: 0.2rem;
}
.cf-mock {
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(0, 0, 0, 0.2);
  padding: 0.4rem 0.5rem;
  font-size: 0.75rem;
  color: var(--muted);
  min-height: 1.75rem;
}
.cf-mock-textarea { min-height: 2.5rem; }
.cf-mock-select { display: flex; justify-content: space-between; align-items: center; }
[data-theme="light"] .cf-mock {
  background: var(--input-bg);
  border-color: var(--border);
  color: var(--text);
}
.canvas-field.selected .cf-mock { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.chip-icon {
  width: 26px;
  height: 26px;
  border-radius: 6px;
  background: var(--surface2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 700;
}
.card-stage-wrap { min-width: 0; }
.kpi-card-canvas { max-width: 520px; margin: 0 auto; }
.kpi-card-frame {
  background: linear-gradient(180deg, #1e293b 0%, #0f172a 100%);
  border: 2px solid var(--border);
  border-radius: 16px;
  overflow: hidden;
  box-shadow: var(--shadow);
}
.kpi-card-reserved {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0;
  background: rgba(0, 0, 0, 0.25);
  border-bottom: 2px dashed rgba(245, 158, 11, 0.45);
}
.reserved-zone {
  position: relative;
  padding: 0.65rem 0.75rem 0.65rem 2rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  border-right: 1px solid rgba(255, 255, 255, 0.06);
  min-height: 52px;
  background: repeating-linear-gradient(
    -45deg,
    rgba(245, 158, 11, 0.06),
    rgba(245, 158, 11, 0.06) 6px,
    transparent 6px,
    transparent 12px
  );
}
.reserved-zone[style*="span 2"] { grid-column: 1 / -1; }
.zone-lock {
  position: absolute;
  left: 0.5rem;
  top: 0.55rem;
  font-size: 0.75rem;
  opacity: 0.7;
}
.zone-label {
  display: block;
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--warn);
  font-weight: 600;
}
.zone-value {
  display: block;
  font-size: 0.85rem;
  color: var(--muted);
  margin-top: 0.15rem;
}
.kpi-card-body-label {
  padding: 0.5rem 0.75rem;
  font-size: 0.75rem;
  color: var(--muted);
  background: var(--surface2);
  border-bottom: 1px solid var(--border);
}
.kpi-card-body {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
  padding: 0.75rem;
  min-height: 200px;
  background: #f8fafc;
}
.drop-slot {
  min-height: 88px;
  border-radius: 10px;
  border: 2px dashed #cbd5e1;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: border-color 0.15s, background 0.15s;
}
.drop-slot.empty .drop-hint {
  font-size: 0.75rem;
  color: #94a3b8;
}
.drop-slot.drag-over {
  border-color: var(--accent);
  background: rgba(59, 130, 246, 0.12);
}
.drop-slot.has-field {
  border-style: solid;
  border-color: #94a3b8;
  padding: 0.35rem;
  justify-content: stretch;
}
.drop-slot.has-field.selected {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.35);
}
.canvas-field {
  width: 100%;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 0.5rem 0.6rem;
  cursor: grab;
  color: #0f172a;
}
.canvas-field:active { cursor: grabbing; }
.cf-icon {
  display: inline-flex;
  width: 22px;
  height: 22px;
  align-items: center;
  justify-content: center;
  background: #e0e7ff;
  border-radius: 4px;
  font-size: 0.7rem;
  font-weight: 700;
  margin-right: 0.35rem;
}
.cf-label { font-weight: 600; font-size: 0.85rem; }
.cf-type {
  display: block;
  font-size: 0.7rem;
  color: #64748b;
  margin-top: 0.15rem;
}
.field-inspector {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.85rem;
}
.field-inspector h4 { margin: 0 0 0.35rem; font-size: 0.9rem; }
.inspector-form label { margin: 0.5rem 0; font-size: 0.8rem; }
.card-title-input { margin-top: 1rem; padding-top: 0.75rem; border-top: 1px solid var(--border); font-size: 0.8rem; }
.tpl-documents { margin-top: 1rem; padding-top: 0.75rem; border-top: 1px solid var(--border); }
.tpl-documents h4 { margin: 0 0 0.35rem; font-size: 0.85rem; }
.file-upload-label input[type="file"] { font-size: 0.8rem; padding: 0.4rem; }

.card-with-docs { position: relative; }
.card-doc-ring {
  list-style: none;
  padding: 0;
  margin: 0 0 0.5rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  justify-content: center;
}
.card-doc-ring.compact { margin-bottom: 0.35rem; }
.attachment-chips {
  list-style: none;
  padding: 0;
  margin: 0.35rem 0 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}
.attachment-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.35rem 0.5rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface2);
  font-size: 0.78rem;
  max-width: 100%;
}
.attachment-chip.pending { border-style: dashed; }
.att-icon {
  font-size: 0.7rem;
  font-weight: 700;
  min-width: 1.6rem;
  text-align: center;
}
.att-name {
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.att-size { font-size: 0.7rem; }
.submission-card-item {
  flex-direction: column !important;
  align-items: stretch !important;
}
.submission-card-wrap {
  width: 100%;
}
.submission-card-mini {
  padding: 0.5rem 0.65rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
  font-size: 0.85rem;
}
.submission-card-mini strong { display: block; }

.doc-viewer {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}
.doc-viewer-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
}
.doc-viewer-panel {
  position: relative;
  z-index: 1;
  width: min(920px, 96vw);
  max-height: 90vh;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: var(--shadow);
}
.doc-viewer-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border);
}
.doc-viewer-body {
  flex: 1;
  overflow: auto;
  padding: 1rem;
  min-height: 200px;
  background: #0f172a;
}
.doc-viewer-body img { max-width: 100%; height: auto; display: block; margin: 0 auto; }
.doc-viewer-body iframe { width: 100%; height: 70vh; border: none; }
.doc-viewer-body pre {
  white-space: pre-wrap;
  word-break: break-word;
  font-size: 0.85rem;
  color: var(--text);
}
#doc-viewer-download { margin: 0.75rem 1rem 1rem; align-self: flex-start; }

/* ——— Post-setup operations ——— */
.operate-banner {
  margin: 1.25rem 0;
  padding: 1rem 1.25rem;
  border: 1px solid var(--accent);
  border-radius: 12px;
  background: linear-gradient(135deg, rgba(56, 189, 248, 0.08), rgba(99, 102, 241, 0.06));
}
.operate-banner .hero-cta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.75rem;
}
.monitor-toolbar {
  display: flex;
  align-items: flex-end;
  gap: 0.75rem;
  margin-bottom: 1rem;
}
.monitor-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 0.75rem;
}
.stat-card {
  padding: 0.75rem 1rem;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--bg);
  text-align: center;
}
.stat-card.ok { border-color: #22c55e55; background: rgba(34, 197, 94, 0.08); }
.stat-card.warn { border-color: #f59e0b55; background: rgba(245, 158, 11, 0.08); }
.stat-num {
  display: block;
  font-size: 1.75rem;
  font-weight: 700;
  line-height: 1.2;
}
.stat-label {
  font-size: 0.75rem;
  color: var(--muted);
}
.monitor-page-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
}
.monitor-page-head h3 { margin: 0 0 0.25rem; }
.monitor-actions { display: flex; gap: 0.5rem; flex-shrink: 0; }
.monitor-cards-strip {
  margin-bottom: 1rem;
  padding: 1rem;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface, rgba(255,255,255,0.02));
}
.monitor-cards-head h4 { margin: 0 0 0.75rem; font-size: 0.95rem; }
.monitor-cards-empty {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.5rem 0;
}
.monitor-cards-empty p {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
}
.main.cards-wizard-main .page-head {
  border-bottom-color: rgba(56, 189, 248, 0.35);
}
.main.cards-wizard-main #page-title {
  color: var(--accent);
}
.monitor-cards-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}
.monitor-card-chip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.5rem 0.75rem;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--bg);
  min-width: min(100%, 240px);
}
.monitor-card-chip strong { display: block; font-size: 0.9rem; }
.monitor-stats-panel { margin-bottom: 1rem; }
.card-wizard-bar {
  margin-bottom: 1rem;
  padding: 1rem 1.25rem;
  border-radius: 12px;
  border: 1px solid var(--accent, #3b82f655);
  background: rgba(59, 130, 246, 0.06);
}
.wizard-eyebrow {
  margin: 0 0 0.5rem;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
}
.wizard-steps {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}
.wizard-step {
  padding: 0.35rem 0.75rem;
  border-radius: 999px;
  font-size: 0.85rem;
  border: 1px solid var(--border);
  color: var(--muted);
}
.wizard-step.active {
  border-color: var(--accent, #3b82f6);
  color: var(--text);
  background: rgba(59, 130, 246, 0.12);
}
.wizard-step.done {
  border-color: #22c55e55;
  color: #86efac;
}
.wizard-step-panel { max-width: 520px; }
.wizard-assign-panel { margin-top: 0.5rem; }
.wizard-card-preview { margin: 0.75rem 0 1rem; }
.wiz-user-fieldset {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.75rem 1rem;
  margin: 1rem 0 0;
}
.wiz-user-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.wiz-user-check {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
}
.coverage-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}
.coverage-table th,
.coverage-table td {
  padding: 0.5rem 0.65rem;
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: top;
}
.coverage-table tr.row-pending { background: rgba(245, 158, 11, 0.04); }
.coverage-table tr.row-done { background: rgba(34, 197, 94, 0.04); }
.status-badge {
  display: inline-block;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 600;
}
.status-open { background: #3b82f633; color: #93c5fd; }
.status-review { background: #f59e0b33; color: #fcd34d; }
.status-closed { background: #22c55e33; color: #86efac; }
.status-pending { background: #f59e0b33; color: #fcd34d; }
.followup-list .followup-item {
  cursor: pointer;
  padding: 0.65rem 0.75rem;
  border-radius: 8px;
  border: 1px solid transparent;
}
.followup-list .followup-item:hover,
.followup-list .followup-item.active {
  border-color: var(--accent);
  background: rgba(56, 189, 248, 0.06);
}
.progress-wrap {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0.35rem 0;
}
.progress-track {
  flex: 1;
  height: 6px;
  background: var(--border-subtle, rgba(255, 255, 255, 0.12));
  border-radius: 999px;
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #3b82f6, #22c55e);
  border-radius: 999px;
  transition: width 0.25s ease;
}
.progress-pct {
  font-size: 0.75rem;
  color: var(--text-muted);
  min-width: 2.5rem;
  text-align: right;
}
.mytasks-summary {
  margin-bottom: 1rem;
}
.mytasks-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 0.5rem;
  font-size: 0.9rem;
}
.task-card-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.5rem;
  margin-bottom: 0.25rem;
}
.action-item-checklist {
  list-style: none;
  padding: 0;
  margin: 0.25rem 0 0;
}
.action-item-checklist li {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.85rem;
  padding: 0.15rem 0;
}
.action-item-checklist .ai-done { color: #22c55e; }
.action-item-checklist .ai-pending { color: var(--text-muted); }
.form-action-items {
  border: 1px solid var(--border-subtle, rgba(255, 255, 255, 0.12));
  border-radius: 8px;
  padding: 0.75rem 1rem;
  margin-bottom: 1rem;
}
.form-action-items legend {
  font-weight: 600;
  padding: 0 0.25rem;
}
.action-item-check {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0.35rem 0;
}
.tpl-action-items {
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border-subtle, rgba(255, 255, 255, 0.08));
}
.action-item-row {
  cursor: pointer;
  padding: 0.35rem 0.5rem;
  border-radius: 6px;
}
.action-item-row.selected {
  background: rgba(59, 130, 246, 0.15);
}
.checkbox-inline {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.billing-plans-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(7.5rem, 1fr));
  gap: 0.5rem;
  margin: 0.75rem 0 1rem;
}
.billing-plan-card {
  border: 1px solid var(--border-subtle, rgba(255, 255, 255, 0.12));
  border-radius: 10px;
  padding: 0.65rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  align-items: stretch;
  text-align: center;
}
.billing-plan-card.active {
  border-color: #3b82f6;
  box-shadow: 0 0 0 1px rgba(59, 130, 246, 0.35);
}
.billing-plan-card .plan-price {
  font-size: 1.15rem;
  font-weight: 700;
}
.billing-plan-card .plan-price small {
  font-size: 0.65rem;
  font-weight: 400;
  color: var(--text-muted);
}
.billing-plan-card .plan-seats {
  font-size: 0.8rem;
  color: var(--text-muted);
}
.app-legal-footer {
  margin-top: 1rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border-subtle, rgba(255, 255, 255, 0.08));
  font-size: 0.8rem;
}
.app-legal-footer a {
  margin-right: 1rem;
}

.task-list .task-card {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.75rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  margin-bottom: 0.5rem;
}
.task-list .task-card.pending { border-left: 3px solid #f59e0b; }
.task-list .task-card.done { border-left: 3px solid #22c55e; opacity: 0.9; }
.panel-wide { flex: 1.4; }

/* Analytics UX */
.analytics-guide {
  margin: 0 0 1rem;
  padding: 0.85rem 1rem 0.85rem 2rem;
  border-radius: var(--radius);
  background: var(--hero-glow);
  border: 1px solid var(--border);
  font-size: 0.9rem;
}
.analytics-guide ol { margin: 0; padding: 0; }
.analytics-guide li { margin: 0.35rem 0; color: var(--muted); }
.analytics-summary-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1rem;
}
.analytics-pill {
  padding: 0.35rem 0.75rem;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 600;
  background: rgba(56, 189, 248, 0.12);
  border: 1px solid rgba(56, 189, 248, 0.35);
  color: var(--accent);
}
.analytics-loading {
  padding: 2rem;
  text-align: center;
  color: var(--muted);
}
.chart-type-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-bottom: 0.65rem;
}
.chart-type-btn {
  padding: 0.3rem 0.65rem;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--input-bg);
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
}
.chart-type-btn:hover { border-color: var(--accent); color: var(--text); }
.chart-type-btn.active {
  background: rgba(56, 189, 248, 0.15);
  border-color: var(--accent);
  color: var(--accent);
}
.analytics-stats-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1.25rem;
  font-size: 0.8rem;
  margin-bottom: 0.5rem;
  color: var(--muted);
}
.analytics-kpi-label select { font-weight: 600; }

/* Analytics grid */
.analytics-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 1rem;
  margin-bottom: 1.25rem;
}
.analytics-toolbar label { flex: 1; min-width: 160px; max-width: 280px; }
.analytics-summary {
  margin: 0 0 1rem;
  font-size: 0.95rem;
}
.analytics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 1.25rem;
}
.analytics-card {
  display: flex;
  flex-direction: column;
  min-height: 280px;
}
.analytics-card-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.75rem;
  margin-bottom: 0.5rem;
}
.analytics-card-head h4 { margin: 0; font-size: 1rem; }
.analytics-meta { margin: 0.2rem 0 0; font-size: 0.8rem; }
.chart-type-select {
  font-size: 0.75rem;
  flex-shrink: 0;
}
.chart-type-select select {
  margin-top: 0.25rem;
  padding: 0.35rem 0.5rem;
  font-size: 0.8rem;
}
.analytics-stats { font-size: 0.8rem; margin: 0 0 0.5rem; }
.chart-wrap {
  position: relative;
  flex: 1;
  min-height: 220px;
  margin-top: 0.5rem;
}
.profile-theme-row,
.profile-lang-row {
  margin-top: 1.5rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}
.platform-infra-banner {
  margin: 0.75rem 0 1rem;
  padding: 0.75rem 1rem;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: rgba(251, 191, 36, 0.08);
  color: var(--text);
  font-size: 0.88rem;
  line-height: 1.5;
}
.platform-infra-banner.warn { border-color: rgba(251, 191, 36, 0.45); }
.platform-infra-banner.ok { border-color: rgba(34, 197, 94, 0.35); background: rgba(34, 197, 94, 0.06); }
.theme-choice {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.5rem;
}
.theme-choice .btn.active {
  border-color: var(--accent);
  background: rgba(56, 189, 248, 0.12);
  color: var(--accent);
}
[data-theme="light"] .auth-brand {
  background: linear-gradient(145deg, #e0f2fe 0%, #f4f7fc 60%);
}
[data-theme="light"] .btn.danger { color: var(--danger); }

/* Messages popup */
body.modal-open { overflow: hidden; }
.messages-modal {
  position: fixed;
  inset: 0;
  z-index: 1100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}
.messages-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(4px);
}
.messages-modal-panel {
  position: relative;
  z-index: 1;
  width: min(920px, 96vw);
  max-height: 88vh;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.messages-modal-head {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border);
  background: var(--surface2);
}
.messages-modal-head h3 { margin: 0; font-size: 1.15rem; }
.messages-modal-sub { margin: 0.2rem 0 0; font-size: 0.85rem; }
.messages-modal-head > div { flex: 1; }
.messages-inbox-error {
  margin: 0;
  padding: 0.5rem 1.25rem;
  font-size: 0.85rem;
  color: var(--warn);
  background: rgba(245, 158, 11, 0.1);
}
.sidebar-messages {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  width: 100%;
  margin: 0.5rem 0;
  justify-content: flex-start;
}
.sidebar-messages .msg-icon { font-size: 1.1rem; }
.btn-messages-head {
  position: relative;
  min-width: 42px;
  padding: 0.5rem 0.65rem;
}
.btn-messages-head .msg-unread-badge {
  position: absolute;
  top: 2px;
  right: 2px;
  margin: 0;
  font-size: 0.6rem;
  padding: 0.05rem 0.3rem;
}
.messages-shell {
  display: grid;
  grid-template-columns: minmax(200px, 260px) 1fr;
  gap: 0;
  min-height: 420px;
  flex: 1;
  overflow: hidden;
}
.messages-peers-panel {
  border-right: 1px solid var(--border);
  padding: 0.75rem;
  display: flex;
  flex-direction: column;
  min-height: 0;
  background: var(--bg);
}
.messages-search {
  width: 100%;
  margin-bottom: 0.65rem;
  padding: 0.5rem 0.65rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--input-bg);
  color: var(--text);
  font-size: 0.9rem;
}
.messages-panel-head {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.35rem;
}
.messages-panel-head h3 { margin: 0; flex: 1; }
.messages-thread-panel {
  display: flex;
  flex-direction: column;
  min-height: 400px;
}
.messages-peer-title { margin: 0 0 0.75rem; }
.messages-thread {
  flex: 1;
  overflow-y: auto;
  padding: 0.5rem;
  margin-bottom: 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--input-bg);
  min-height: 240px;
  max-height: 360px;
}
.msg-bubble {
  max-width: 85%;
  margin-bottom: 0.65rem;
  padding: 0.55rem 0.75rem;
  border-radius: 10px;
  background: var(--surface2);
  border: 1px solid var(--border);
}
.msg-bubble.mine {
  margin-left: auto;
  background: rgba(56, 189, 248, 0.12);
  border-color: rgba(56, 189, 248, 0.35);
}
.msg-bubble p { margin: 0.25rem 0 0; white-space: pre-wrap; word-break: break-word; }
.msg-meta { font-size: 0.7rem; color: var(--muted); }
.msg-peer-list {
  flex: 1;
  overflow-y: auto;
  margin: 0;
  padding: 0;
  list-style: none;
}
.msg-peer-list .msg-peer-item {
  cursor: pointer;
  padding: 0.55rem 0.5rem;
  border-radius: 10px;
  border: 1px solid transparent;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 0.25rem;
}
.msg-peer-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--brand-gradient);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.9rem;
  flex-shrink: 0;
}
.msg-peer-text {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
}
.msg-peer-text strong {
  font-size: 0.9rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.msg-peer-text .muted { font-size: 0.75rem; }
.msg-peer-list .msg-peer-item:hover,
.msg-peer-list .msg-peer-item.active {
  border-color: var(--accent);
  background: rgba(56, 189, 248, 0.06);
}
.msg-peer-unread,
.msg-unread-badge {
  margin-left: auto;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 0.1rem 0.45rem;
  border-radius: 999px;
  background: var(--danger);
  color: #fff;
}
.step-btn .msg-unread-badge {
  margin-left: 0.35rem;
  padding: 0.05rem 0.35rem;
}
.messages-thread-panel {
  display: flex;
  flex-direction: column;
  padding: 0.75rem 1rem 1rem;
  min-height: 0;
}
.messages-compose {
  border-top: 1px solid var(--border);
  padding-top: 0.75rem;
  margin-top: auto;
}
.messages-compose textarea {
  margin-bottom: 0.5rem;
  resize: none;
  min-height: 56px;
}
.messages-compose-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
}
.messages-compose-actions .hint { margin: 0; font-size: 0.75rem; }
@media (max-width: 700px) {
  .messages-shell { grid-template-columns: 1fr; }
  .messages-peers-panel { max-height: 160px; border-right: none; border-bottom: 1px solid var(--border); }
}
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

/* ——— Workspace hub ——— */
.hub-welcome {
  margin-bottom: 1rem;
  border: 1px solid color-mix(in srgb, var(--accent) 35%, var(--border));
  background: color-mix(in srgb, var(--accent) 6%, var(--surface));
}
.hub-how-list {
  margin: 0.75rem 0 0;
  padding-left: 1.25rem;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.6;
}
.hub-how-list li + li { margin-top: 0.35rem; }
.kpi-intro-card .kpi-intro-eyebrow {
  margin: 0 0 0.35rem;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--accent);
}
.kpi-tips-grid {
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
}
.tip-card {
  position: relative;
  padding-top: 2.25rem;
}
.tip-num {
  position: absolute;
  top: 0.85rem;
  left: 0.85rem;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  font-size: 0.8rem;
  font-weight: 700;
  background: color-mix(in srgb, var(--accent) 20%, transparent);
  color: var(--accent);
}
.hub-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin: 0 0 1rem;
  padding: 0.85rem 1rem;
  border-radius: var(--radius);
  border: 1px solid color-mix(in srgb, var(--accent) 40%, var(--border));
  background: color-mix(in srgb, var(--accent) 8%, var(--surface));
}
.hub-hero { margin-bottom: 1.25rem; }
.hub-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.75rem;
  margin-top: 1rem;
}
.hub-stat {
  padding: 0.65rem 0.75rem;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--bg);
}
.hub-stat-label {
  display: block;
  font-size: 0.75rem;
  color: var(--muted);
  margin-bottom: 0.25rem;
}
.hub-section-title { margin: 0 0 0.75rem; }
.hub-showcase-sub { margin: -0.35rem 0 1rem; font-size: 0.92rem; }
.hub-modules {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.25rem;
  margin-bottom: 1.25rem;
}
.hub-showcase-card {
  display: flex;
  flex-direction: column;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface);
  overflow: hidden;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.hub-showcase-card.enabled {
  border-color: color-mix(in srgb, var(--accent) 45%, var(--border));
}
.hub-showcase-card.inspections.enabled {
  border-color: color-mix(in srgb, #a78bfa 45%, var(--border));
}
.hub-showcase-visual {
  padding: 1.5rem;
  font-size: 2.5rem;
  text-align: center;
  background: linear-gradient(135deg, color-mix(in srgb, var(--accent) 12%, var(--bg)), var(--bg));
}
.hub-showcase-card.inspections .hub-showcase-visual {
  background: linear-gradient(135deg, color-mix(in srgb, #a78bfa 14%, var(--bg)), var(--bg));
}
.hub-showcase-body { padding: 1rem 1rem 1.15rem; }
.hub-showcase-lead { margin: 0.35rem 0 0.65rem; font-size: 0.88rem; color: var(--muted); line-height: 1.45; }
.hub-showcase-bullets {
  margin: 0 0 0.85rem;
  padding-left: 1.1rem;
  font-size: 0.82rem;
  color: var(--muted);
  line-height: 1.5;
}
.hub-showcase-bullets li + li { margin-top: 0.25rem; }
.insp-form-canvas {
  min-height: 220px;
  padding: 1rem;
  border: 2px dashed var(--border);
  border-radius: 12px;
  background: var(--bg);
  margin-top: 0.75rem;
}
.insp-field-block {
  padding: 0.5rem;
  margin-bottom: 0.5rem;
  border: 1px solid transparent;
  border-radius: 8px;
  cursor: pointer;
}
.insp-field-block.selected { border-color: #a78bfa; background: color-mix(in srgb, #a78bfa 10%, transparent); }
.insp-photo-bar, .insp-file-preview {
  padding: 0.65rem;
  border-radius: 8px;
  border: 1px dashed var(--border);
  background: color-mix(in srgb, #a78bfa 8%, var(--surface));
  font-size: 0.85rem;
  color: var(--muted);
}
.insp-designer .palette-chip { cursor: grab; }
.insp-check-preview { display: flex; align-items: center; gap: 0.5rem; margin: 0.5rem 0; }
.hub-module-card {
  display: flex;
  gap: 0.85rem;
  padding: 1rem;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface);
  transition: border-color 0.15s, box-shadow 0.15s;
}
.hub-module-card.enabled {
  border-color: color-mix(in srgb, var(--accent) 50%, var(--border));
}
.hub-module-card.enabled:hover {
  box-shadow: 0 4px 20px color-mix(in srgb, var(--accent) 12%, transparent);
}
.hub-module-icon {
  flex-shrink: 0;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.35rem;
  border-radius: 12px;
  background: var(--bg);
  border: 1px solid var(--border);
}
.hub-module-body { flex: 1; min-width: 0; }
.hub-module-desc { margin: 0.25rem 0 0.5rem; font-size: 0.88rem; }
.hub-module-steps {
  margin: 0.5rem 0 0.75rem;
  padding-left: 1.1rem;
  font-size: 0.82rem;
  color: var(--muted);
  line-height: 1.45;
}
.hub-module-steps li + li { margin-top: 0.2rem; }
.hub-module-head {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.35rem;
}
.hub-module-tag {
  font-size: 0.7rem;
  font-weight: 600;
  padding: 0.15rem 0.45rem;
  border-radius: 999px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.hub-module-tag.ok { background: color-mix(in srgb, #22c55e 25%, transparent); color: #86efac; }
.hub-module-tag.trial { background: color-mix(in srgb, var(--accent) 25%, transparent); color: var(--accent); }
.hub-module-tag.soon { background: var(--border); color: var(--muted); }
.hub-module-actions { margin-top: 0.75rem; }
.hub-billing-panel { margin-top: 0.5rem; }
.billing-plans-grid.compact {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 0.65rem;
  margin: 0.75rem 0;
}
@media (max-width: 640px) {
  .hub-banner { flex-direction: column; align-items: flex-start; }
  .hub-stats { grid-template-columns: 1fr; }
}

/* Meetings module */
.kpi-context-pill.mtg { background: color-mix(in srgb, #8b5cf6 22%, transparent); color: #c4b5fd; }

.main.mtg-live-main {
  display: flex;
  flex-direction: column;
  min-height: 0;
  padding-bottom: 0;
}
.main.mtg-live-main .page-head { display: none; }
.main.mtg-live-main #view-mtg-live {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.mtg-workspace {
  display: flex;
  flex: 1;
  min-height: calc(100vh - 3rem);
  gap: 0;
  margin: -0.5rem -0.25rem 0;
  border-radius: 14px;
  overflow: hidden;
  border: 1px solid color-mix(in srgb, var(--border) 80%, #cbd5e1);
  box-shadow: 0 8px 32px rgba(15, 23, 42, 0.08);
}

.mtg-canvas {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  background: #ffffff;
  color: #0f172a;
}
[data-theme="dark"] .mtg-canvas {
  background: #fafafa;
  color: #0f172a;
}

.mtg-canvas-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.25rem 1.5rem 0.75rem;
  border-bottom: 1px solid #e8edf4;
  background: #fff;
}
.mtg-canvas-eyebrow {
  margin: 0 0 0.2rem;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #64748b;
}
.mtg-canvas-title {
  margin: 0;
  font-size: 1.35rem;
  font-weight: 700;
  line-height: 1.25;
  color: #0f172a;
}
.mtg-live-badge {
  flex-shrink: 0;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 0.35rem 0.65rem;
  border-radius: 999px;
  background: #ecfdf5;
  color: #047857;
  border: 1px solid #a7f3d0;
}

.mtg-canvas-body {
  flex: 1;
  overflow-y: auto;
  padding: 1.25rem 1.5rem 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  background: #fff;
}
.mtg-canvas-empty {
  margin: auto;
  max-width: 28rem;
  text-align: center;
  color: #94a3b8;
  font-size: 0.95rem;
  line-height: 1.55;
  padding: 2rem 1rem;
}
.mtg-entry {
  padding: 0;
  border: none;
  background: transparent;
  border-left: 3px solid #3b82f6;
  padding-left: 1rem;
}
.mtg-entry header {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  font-size: 0.78rem;
  margin-bottom: 0.35rem;
  color: #64748b;
}
.mtg-entry header strong { color: #0f172a; font-weight: 600; }
.mtg-entry p {
  margin: 0;
  font-size: 1rem;
  line-height: 1.55;
  color: #1e293b;
  white-space: pre-wrap;
}

.mtg-canvas-foot {
  display: flex;
  gap: 0.65rem;
  align-items: flex-end;
  padding: 0.85rem 1.25rem 1.1rem;
  border-top: 1px solid #e8edf4;
  background: #f8fafc;
}
.mtg-canvas-foot textarea {
  flex: 1;
  min-height: 2.75rem;
  resize: vertical;
  border-radius: 10px;
  border: 1px solid #cbd5e1;
  background: #fff;
  padding: 0.65rem 0.85rem;
  font-family: inherit;
  font-size: 0.95rem;
}
.mtg-canvas-foot .btn { flex-shrink: 0; }

.mtg-toolbar {
  width: min(300px, 34vw);
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 0;
  background: linear-gradient(180deg, #f1f5f9 0%, #e8eef5 100%);
  border-left: 1px solid #cbd5e1;
  overflow-y: auto;
}
.mtg-tool-block {
  padding: 1rem 1rem 0.85rem;
  border-bottom: 1px solid color-mix(in srgb, #cbd5e1 70%, transparent);
}
.mtg-tool-block-end {
  margin-top: auto;
  border-bottom: none;
  padding-bottom: 1.15rem;
}
.mtg-tool-label {
  margin: 0 0 0.65rem;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: #475569;
}
.mtg-tool-btn { width: 100%; justify-content: center; }
.mtg-tool-btn-wide { width: 100%; }
.mtg-voice-hint {
  margin: 0.45rem 0 0;
  font-size: 0.8rem;
  min-height: 1.1rem;
}
.btn.danger {
  background: #fef2f2;
  color: #b91c1c;
  border: 1px solid #fecaca;
}
.btn.danger:hover { background: #fee2e2; }

.mtg-task-board {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  max-height: 200px;
  overflow-y: auto;
  margin-bottom: 0.5rem;
}
.mtg-task-card {
  padding: 0.55rem 0.65rem;
  border-radius: 8px;
  border: 1px solid #cbd5e1;
  background: #fff;
  cursor: grab;
  font-size: 0.88rem;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}
.mtg-task-card strong { display: block; font-size: 0.9rem; color: #0f172a; }
.mtg-task-card .muted { font-size: 0.78rem; margin: 0.15rem 0; }
.mtg-task-compose, .mtg-invite-row {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  align-items: stretch;
}
.mtg-task-compose input,
.mtg-task-compose select,
.mtg-invite-row input {
  width: 100%;
  border-radius: 8px;
  border: 1px solid #cbd5e1;
  padding: 0.5rem 0.65rem;
  font-size: 0.88rem;
  background: #fff;
}

.mtg-presence {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}
.mtg-presence-chip {
  font-size: 0.78rem;
  padding: 0.28rem 0.55rem;
  border-radius: 999px;
  background: #fff;
  border: 1px solid #cbd5e1;
  color: #334155;
}
.mtg-presence-chip.mic-on {
  background: #ecfdf5;
  border-color: #6ee7b7;
  color: #047857;
}

@media (max-width: 900px) {
  .mtg-workspace {
    flex-direction: column;
    min-height: auto;
  }
  .mtg-toolbar {
    width: 100%;
    max-height: none;
    border-left: none;
    border-top: 1px solid #cbd5e1;
  }
  .mtg-canvas-body { min-height: 50vh; }
  .mtg-tool-block-end { margin-top: 0; }
}
