/* ============================================================
   BIOSFERA — Design System
   Dark theme · DM Sans + Saira + JetBrains Mono
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=DM+Sans:ital,opsz,wght@0,9..40,400;0,9..40,500;0,9..40,600;1,9..40,400&family=Saira:wght@700;800&family=JetBrains+Mono:wght@400;500&display=swap');

/* ─────────────────────────────────────────────
   CUSTOM PROPERTIES
──────────────────────────────────────────────── */
:root {
  /* Brand — symbol colors */
  --c-cyan:   #29B8E8;
  --c-yellow: #F5C518;
  --c-orange: #F07A28;
  --c-coral:  #E85448;
  --c-purple: #9B5CC4;
  --c-indigo: #5B2D8E;
  --c-olive:  #7A9E1E;

  /* Dark surfaces */
  --c-bg:             #0D0F0A;
  --c-surface:        #161A10;
  --c-surface-raised: #1E2418;
  --c-border:         #2A3020;
  --c-border-strong:  #3D4A2A;

  /* Text */
  --c-text-primary:   #E8EDD8;
  --c-text-secondary: #8A9A70;
  --c-text-muted:     #556047;

  /* Accent — primary action */
  --c-accent:        #7A9E1E;
  --c-accent-hover:  #8DB822;
  --c-accent-subtle: #1A2610;

  /* Semantic */
  --c-success:        #4ADE80;
  --c-success-subtle: #081A0E;
  --c-warning:        #F5C518;
  --c-warning-subtle: #1A1600;
  --c-danger:         #E85448;
  --c-danger-subtle:  #1E0806;

  /* Layout */
  --sidebar-w:   240px;
  --topbar-h:    56px;

  /* Radius */
  --r-sm:  6px;
  --r-md:  10px;
  --r-lg:  14px;
  --r-xl:  18px;
  --r-full: 9999px;

  /* Shadows */
  --shadow-sm: 0 1px 3px rgba(0,0,0,.35);
  --shadow-md: 0 4px 14px rgba(0,0,0,.45);
  --shadow-lg: 0 8px 28px rgba(0,0,0,.55);

  /* Transitions */
  --t-fast: 0.12s ease;
  --t-base: 0.2s ease;
}

/* ─────────────────────────────────────────────
   RESET & BASE
──────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  scroll-behavior: smooth;
}

body {
  background: var(--c-bg);
  color: var(--c-text-primary);
  font-family: 'DM Sans', system-ui, sans-serif;
  line-height: 1.6;
  min-height: 100vh;
}

img { max-width: 100%; display: block; }

a {
  color: var(--c-accent);
  text-decoration: none;
  transition: color var(--t-fast);
}
a:hover { color: var(--c-accent-hover); text-decoration: none; }

/* Scrollbars */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: var(--c-border-strong);
  border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover { background: var(--c-text-muted); }

/* ─────────────────────────────────────────────
   TYPOGRAPHY
──────────────────────────────────────────────── */
h1, h2, h3, h4, h5, h6 {
  font-family: 'Saira', sans-serif;
  line-height: 1.2;
  color: var(--c-text-primary);
  font-weight: 800;
}

h1 { font-size: 1.75rem; }
h2 { font-size: 1.375rem; font-weight: 700; }
h3 { font-size: 1.125rem; font-weight: 700; }
h4 { font-size: 0.9375rem; font-weight: 700; }

code {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.82em;
  background: var(--c-surface-raised);
  border-radius: var(--r-sm);
  padding: 1px 6px;
  color: var(--c-cyan);
}

pre {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.8125rem;
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--r-md);
  padding: 14px 16px;
  overflow-x: auto;
  white-space: pre-wrap;
  word-break: break-word;
  line-height: 1.7;
  color: var(--c-text-primary);
}
pre code { background: none; padding: 0; color: inherit; }

/* ─────────────────────────────────────────────
   APP SHELL
──────────────────────────────────────────────── */
.app-shell {
  display: flex;
  min-height: 100vh;
}

/* ─────────────────────────────────────────────
   SIDEBAR
──────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  position: fixed;
  top: 0; left: 0; bottom: 0;
  background: var(--c-surface);
  border-right: 1px solid var(--c-border);
  display: flex;
  flex-direction: column;
  z-index: 100;
  transition: transform 0.25s cubic-bezier(.4,0,.2,1);
  overflow: hidden;
}

/* Logo */
.sidebar-logo {
  padding: 18px 16px 14px;
  border-bottom: 1px solid var(--c-border);
  flex-shrink: 0;
}
.sidebar-logo .logo-full    { display: block; height: 32px; width: auto; }
.sidebar-logo .logo-symbol  { display: none;  height: 32px; width: auto; }

/* Nav */
.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 10px 8px;
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.sidebar-nav .nav-section {
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--c-text-muted);
  padding: 12px 12px 4px;
  pointer-events: none;
}

.sidebar-nav a {
  --mod: var(--c-accent);
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 9px 12px;
  border-radius: var(--r-md);
  color: var(--c-text-secondary);
  font-size: 0.875rem;
  font-weight: 500;
  font-family: 'DM Sans', sans-serif;
  border-left: 2px solid transparent;
  transition: background var(--t-fast), color var(--t-fast), border-color var(--t-fast);
  white-space: nowrap;
  text-decoration: none;
}
.sidebar-nav a svg { flex-shrink: 0; opacity: .65; transition: opacity var(--t-fast); }
.sidebar-nav a:hover {
  background: var(--c-surface-raised);
  color: var(--c-text-primary);
  border-left-color: transparent;
}
.sidebar-nav a:hover svg { opacity: 1; }
.sidebar-nav a.active {
  background: color-mix(in srgb, var(--mod) 12%, transparent);
  color: var(--mod);
  border-left-color: var(--mod);
}
.sidebar-nav a.active svg { opacity: 1; color: var(--mod); }

/* Footer */
.sidebar-footer {
  padding: 10px 8px 12px;
  border-top: 1px solid var(--c-border);
  flex-shrink: 0;
}
.sidebar-operator {
  font-size: 0.75rem;
  color: var(--c-text-muted);
  padding: 6px 12px 2px;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sidebar-footer form { display: block; }
.btn-logout {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 9px 12px;
  border-radius: var(--r-md);
  color: var(--c-text-muted);
  font-size: 0.875rem;
  font-weight: 500;
  font-family: 'DM Sans', sans-serif;
  background: none;
  border: none;
  cursor: pointer;
  text-align: left;
  transition: background var(--t-fast), color var(--t-fast);
}
.btn-logout:hover {
  background: var(--c-danger-subtle);
  color: var(--c-danger);
}

/* Mobile overlay */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.65);
  z-index: 99;
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
}
.sidebar-overlay.open { display: block; }

/* ─────────────────────────────────────────────
   APP CONTENT
──────────────────────────────────────────────── */
.app-content {
  margin-left: var(--sidebar-w);
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

/* ─────────────────────────────────────────────
   TOPBAR
──────────────────────────────────────────────── */
.topbar {
  height: var(--topbar-h);
  background: var(--c-surface);
  border-bottom: 1px solid var(--c-border);
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 50;
  gap: 16px;
  flex-shrink: 0;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  flex: 1;
}

.topbar-title {
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--c-text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

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

/* Hamburger (mobile only) */
.btn-menu {
  display: none;
  align-items: center;
  justify-content: center;
  width: 34px; height: 34px;
  border-radius: var(--r-md);
  border: 1px solid var(--c-border);
  background: none;
  color: var(--c-text-secondary);
  cursor: pointer;
  flex-shrink: 0;
  transition: background var(--t-fast);
}
.btn-menu:hover { background: var(--c-surface-raised); }

/* ─────────────────────────────────────────────
   PAGE CONTENT
──────────────────────────────────────────────── */
.page-content {
  flex: 1;
  padding: 28px 24px;
  width: 100%;
}

/* ─────────────────────────────────────────────
   PAGE HEADER
──────────────────────────────────────────────── */
.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 28px;
  flex-wrap: wrap;
}
.page-header-left { min-width: 0; }

.page-title {
  font-size: 1.5rem;
  font-weight: 800;
  font-family: 'Saira', sans-serif;
  color: var(--c-text-primary);
  line-height: 1.2;
}
.page-subtitle {
  font-size: 0.875rem;
  color: var(--c-text-secondary);
  margin-top: 4px;
}
.page-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

/* Back link */
.back-link {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 0.8125rem;
  color: var(--c-text-secondary);
  margin-bottom: 18px;
  transition: color var(--t-fast);
}
.back-link:hover { color: var(--c-text-primary); }

/* ─────────────────────────────────────────────
   BUTTONS
──────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: var(--r-md);
  font-size: 0.875rem;
  font-weight: 500;
  font-family: 'DM Sans', sans-serif;
  line-height: 1;
  cursor: pointer;
  border: 1px solid transparent;
  transition: background var(--t-fast), color var(--t-fast), border-color var(--t-fast), transform 0.1s;
  text-decoration: none;
  white-space: nowrap;
  user-select: none;
  -webkit-user-select: none;
}
.btn:active:not(:disabled) { transform: scale(.97); }
.btn:disabled, .btn[disabled] { opacity: .4; cursor: not-allowed; pointer-events: none; }

.btn-primary {
  background: var(--c-accent);
  color: #fff;
  border-color: var(--c-accent);
}
.btn-primary:hover:not(:disabled) {
  background: var(--c-accent-hover);
  border-color: var(--c-accent-hover);
  color: #fff;
}

.btn-ghost {
  background: transparent;
  color: var(--c-text-secondary);
  border-color: var(--c-border-strong);
}
.btn-ghost:hover:not(:disabled) {
  background: var(--c-surface-raised);
  color: var(--c-text-primary);
  border-color: var(--c-border-strong);
}

.btn-danger {
  background: var(--c-danger-subtle);
  color: var(--c-danger);
  border-color: var(--c-danger);
}
.btn-danger:hover:not(:disabled) {
  background: var(--c-danger);
  color: #fff;
}

.btn-sm { padding: 5px 12px; font-size: 0.8125rem; }
.btn-xs { padding: 3px 9px;  font-size: 0.75rem; }
.btn-icon { padding: 7px; width: 34px; height: 34px; }

/* ─────────────────────────────────────────────
   CARDS
──────────────────────────────────────────────── */
.card {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--r-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.card-header {
  padding: 14px 20px;
  border-bottom: 1px solid var(--c-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.card-header h2,
.card-header h3,
.card-header h4 {
  font-size: 0.9375rem;
  font-weight: 600;
  font-family: 'DM Sans', sans-serif;
  color: var(--c-text-primary);
}

.card-body { padding: 20px; }

.card-footer {
  padding: 14px 20px;
  border-top: 1px solid var(--c-border);
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Module left-border accents */
.card-module-cyan   { border-left: 3px solid var(--c-cyan); }
.card-module-yellow { border-left: 3px solid var(--c-yellow); }
.card-module-orange { border-left: 3px solid var(--c-orange); }
.card-module-coral  { border-left: 3px solid var(--c-coral); }
.card-module-purple { border-left: 3px solid var(--c-purple); }
.card-module-indigo { border-left: 3px solid var(--c-indigo); }
.card-module-olive  { border-left: 3px solid var(--c-olive); }

/* Clickable card */
a.card, .card-link {
  display: block;
  text-decoration: none;
  color: inherit;
  transition: background var(--t-fast), border-color var(--t-fast);
  cursor: pointer;
}
a.card:hover, .card-link:hover {
  background: var(--c-surface-raised);
  border-color: var(--c-border-strong);
  color: inherit;
  text-decoration: none;
}

/* ─────────────────────────────────────────────
   BADGES
──────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: var(--r-full);
  font-size: 0.75rem;
  font-weight: 600;
  line-height: 1.4;
  white-space: nowrap;
  background: var(--c-surface-raised);
  color: var(--c-text-secondary);
}

.badge-cyan   { background: color-mix(in srgb, var(--c-cyan)   15%, transparent); color: var(--c-cyan); }
.badge-yellow { background: color-mix(in srgb, var(--c-yellow) 15%, transparent); color: var(--c-yellow); }
.badge-orange { background: color-mix(in srgb, var(--c-orange) 15%, transparent); color: var(--c-orange); }
.badge-coral  { background: color-mix(in srgb, var(--c-coral)  15%, transparent); color: var(--c-coral); }
.badge-purple { background: color-mix(in srgb, var(--c-purple) 15%, transparent); color: var(--c-purple); }
.badge-indigo { background: color-mix(in srgb, var(--c-indigo) 20%, transparent); color: var(--c-purple); }
.badge-olive  { background: var(--c-accent-subtle);  color: var(--c-accent); }
.badge-green  { background: var(--c-success-subtle); color: var(--c-success); }
.badge-red    { background: var(--c-danger-subtle);  color: var(--c-danger); }
.badge-amber  { background: var(--c-warning-subtle); color: var(--c-warning); }
.badge-gray   { background: var(--c-surface-raised); color: var(--c-text-muted); }

/* ─────────────────────────────────────────────
   TABLES
──────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; }

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

.table th {
  padding: 10px 14px;
  text-align: left;
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--c-text-muted);
  border-bottom: 1px solid var(--c-border);
  white-space: nowrap;
}

.table td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--c-border);
  color: var(--c-text-secondary);
  vertical-align: middle;
}
.table td:first-child { color: var(--c-text-primary); font-weight: 500; }

.table tbody tr { transition: background var(--t-fast); }
.table tbody tr:hover { background: var(--c-surface-raised); }
.table tbody tr:nth-child(even) { background: rgba(255,255,255,.018); }
.table tbody tr:last-child td { border-bottom: none; }

/* ─────────────────────────────────────────────
   FORMS
──────────────────────────────────────────────── */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-label {
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--c-text-secondary);
}

.form-input,
.form-select,
.form-textarea {
  width: 100%;
  padding: 9px 13px;
  background: var(--c-bg);
  border: 1px solid var(--c-border-strong);
  border-radius: var(--r-md);
  color: var(--c-text-primary);
  font-size: 0.875rem;
  font-family: 'DM Sans', sans-serif;
  line-height: 1.5;
  outline: none;
  transition: border-color var(--t-fast), box-shadow var(--t-fast);
  appearance: none;
  -webkit-appearance: none;
}
.form-input::placeholder,
.form-textarea::placeholder { color: var(--c-text-muted); }
.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  border-color: var(--c-accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--c-accent) 18%, transparent);
}
.form-input:disabled,
.form-select:disabled,
.form-textarea:disabled { opacity: .45; cursor: not-allowed; }

.form-select {
  cursor: pointer;
  padding-right: 34px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%238A9A70' stroke-width='2.5'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 11px center;
}
.form-select option { background: var(--c-surface); color: var(--c-text-primary); }

.form-textarea { resize: vertical; min-height: 96px; }

.form-textarea.mono-area {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.8125rem;
  line-height: 1.7;
}

.form-error {
  font-size: 0.8125rem;
  color: var(--c-danger);
}
.form-hint {
  font-size: 0.8125rem;
  color: var(--c-text-muted);
}

/* Input + copy button row */
.input-row {
  display: flex;
  gap: 8px;
}
.input-row .form-input { flex: 1; }

/* ─────────────────────────────────────────────
   MODALS
──────────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.72);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.modal {
  background: var(--c-surface);
  border: 1px solid var(--c-border-strong);
  border-radius: var(--r-xl);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 480px;
  max-height: 90vh;
  overflow-y: auto;
}
.modal-header {
  padding: 20px 24px 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.modal-body   { padding: 20px 24px; }
.modal-footer {
  padding: 0 24px 20px;
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

/* ─────────────────────────────────────────────
   KANBAN
──────────────────────────────────────────────── */
.kanban-board {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  padding-bottom: 16px;
  align-items: flex-start;
}

.kanban-col {
  min-width: 230px;
  flex-shrink: 0;
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-top: 2px solid var(--c-border-strong);
  border-radius: var(--r-lg);
  overflow: hidden;
}
.kanban-col[data-status="new"]         { border-top-color: var(--c-cyan); }
.kanban-col[data-status="qualified"]   { border-top-color: var(--c-yellow); }
.kanban-col[data-status="meeting"]     { border-top-color: var(--c-orange); }
.kanban-col[data-status="proposal"]    { border-top-color: var(--c-purple); }
.kanban-col[data-status="negotiation"] { border-top-color: var(--c-indigo); }
.kanban-col[data-status="won"]         { border-top-color: var(--c-success); }
.kanban-col[data-status="lost"]        { border-top-color: var(--c-danger); }

.kanban-col-header {
  padding: 11px 13px;
  background: var(--c-surface-raised);
  border-bottom: 1px solid var(--c-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.kanban-col-title {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--c-text-secondary);
  text-transform: capitalize;
}

.kanban-col-count {
  font-size: 0.6875rem;
  font-family: 'JetBrains Mono', monospace;
  font-weight: 600;
  background: var(--c-border-strong);
  color: var(--c-text-secondary);
  padding: 2px 7px;
  border-radius: var(--r-full);
}

.kanban-col-body {
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-height: 64px;
}

.kanban-card {
  display: block;
  background: var(--c-bg);
  border: 1px solid var(--c-border);
  border-radius: var(--r-md);
  padding: 11px 12px;
  text-decoration: none;
  color: var(--c-text-primary);
  cursor: grab;
  transition: border-color var(--t-fast), background var(--t-fast), transform 0.1s;
}
.kanban-card:hover {
  border-color: var(--c-border-strong);
  background: var(--c-surface-raised);
  transform: translateY(-1px);
  color: var(--c-text-primary);
}
.kanban-card.dragging {
  opacity: 0.4;
  cursor: grabbing;
}
.kanban-col-body.drag-over {
  background: var(--c-accent-subtle);
  outline: 2px dashed var(--c-accent);
  outline-offset: -4px;
  border-radius: var(--r-md);
}
.kanban-card-name {
  font-size: 0.875rem;
  font-weight: 500;
  margin-bottom: 4px;
}
.kanban-card-meta {
  font-size: 0.75rem;
  color: var(--c-text-muted);
  display: flex;
  flex-direction: column;
  gap: 2px;
}

/* ─────────────────────────────────────────────
   VIEW TOGGLE (Kanban / Lista)
──────────────────────────────────────────────── */
.view-toggle {
  display: inline-flex;
  background: var(--c-surface-raised);
  border: 1px solid var(--c-border);
  border-radius: var(--r-md);
  padding: 2px;
  gap: 2px;
}
.view-toggle-btn {
  padding: 5px 12px;
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--c-text-muted);
  text-decoration: none;
  border-radius: calc(var(--r-md) - 2px);
  transition: background var(--t-fast), color var(--t-fast);
}
.view-toggle-btn:hover {
  color: var(--c-text-secondary);
}
.view-toggle-btn.active {
  background: var(--c-surface);
  color: var(--c-text-primary);
  box-shadow: var(--shadow-sm, 0 1px 2px rgba(0,0,0,.08));
}

/* ─────────────────────────────────────────────
   ALERTS
──────────────────────────────────────────────── */
.alert {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 13px 16px;
  border-radius: var(--r-md);
  font-size: 0.875rem;
  border: 1px solid;
  line-height: 1.5;
}
.alert-success {
  background: var(--c-success-subtle);
  border-color: color-mix(in srgb, var(--c-success) 28%, transparent);
  color: var(--c-success);
}
.alert-warning {
  background: var(--c-warning-subtle);
  border-color: color-mix(in srgb, var(--c-warning) 28%, transparent);
  color: var(--c-warning);
}
.alert-danger {
  background: var(--c-danger-subtle);
  border-color: color-mix(in srgb, var(--c-danger) 28%, transparent);
  color: var(--c-danger);
}
.alert-info {
  background: color-mix(in srgb, var(--c-cyan) 8%, transparent);
  border-color: color-mix(in srgb, var(--c-cyan) 25%, transparent);
  color: var(--c-cyan);
}

/* ─────────────────────────────────────────────
   EMPTY STATE
──────────────────────────────────────────────── */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 52px 24px;
  gap: 10px;
}
.empty-state-icon  { font-size: 2.75rem; line-height: 1; filter: grayscale(.4); }
.empty-state-title { font-size: 0.9375rem; font-weight: 600; color: var(--c-text-secondary); font-family: 'DM Sans', sans-serif; }
.empty-state-desc  { font-size: 0.8125rem; color: var(--c-text-muted); max-width: 260px; line-height: 1.55; }

/* ─────────────────────────────────────────────
   SPINNER
──────────────────────────────────────────────── */
.spinner {
  width: 18px; height: 18px;
  border: 2px solid var(--c-border-strong);
  border-top-color: var(--c-accent);
  border-radius: 50%;
  animation: spin .65s linear infinite;
  flex-shrink: 0;
  display: inline-block;
}
.spinner-lg { width: 32px; height: 32px; border-width: 3px; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ─────────────────────────────────────────────
   PROGRESS BAR
──────────────────────────────────────────────── */
.progress {
  width: 100%;
  height: 5px;
  background: var(--c-border);
  border-radius: var(--r-full);
  overflow: hidden;
}
.progress-bar {
  height: 100%;
  border-radius: var(--r-full);
  background: var(--c-accent);
  transition: width .4s ease;
}
.progress-bar.green  { background: var(--c-success); }
.progress-bar.cyan   { background: var(--c-cyan); }
.progress-bar.coral  { background: var(--c-coral); }
.progress-bar.orange { background: var(--c-orange); }

/* ─────────────────────────────────────────────
   STAT / METRIC CARD
──────────────────────────────────────────────── */
.stat-card {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--r-lg);
  padding: 20px;
  text-align: center;
}
.stat-value {
  font-size: 2rem;
  font-weight: 800;
  font-family: 'JetBrains Mono', monospace;
  color: var(--c-text-primary);
  line-height: 1;
  margin-bottom: 6px;
}
.stat-label { font-size: 0.8125rem; color: var(--c-text-muted); font-weight: 500; }

.stat-value.cyan   { color: var(--c-cyan); }
.stat-value.yellow { color: var(--c-yellow); }
.stat-value.orange { color: var(--c-orange); }
.stat-value.coral  { color: var(--c-coral); }
.stat-value.purple { color: var(--c-purple); }
.stat-value.green  { color: var(--c-success); }
.stat-value.red    { color: var(--c-danger); }
.stat-value.olive  { color: var(--c-olive); }

/* ─────────────────────────────────────────────
   MODULE GRID (client show)
──────────────────────────────────────────────── */
.module-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}
.module-tile {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--r-md);
  padding: 16px 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 7px;
  text-decoration: none;
  color: var(--c-text-secondary);
  transition: background var(--t-fast), border-color var(--t-fast), color var(--t-fast);
}
.module-tile:hover {
  background: var(--c-surface-raised);
  border-color: var(--c-border-strong);
  color: var(--c-text-primary);
}
.module-tile-icon  { font-size: 1.375rem; line-height: 1; }
.module-tile-label { font-size: 0.8125rem; font-weight: 500; }

/* ─────────────────────────────────────────────
   TIMELINE (lead interactions)
──────────────────────────────────────────────── */
.timeline { display: flex; flex-direction: column; }

.timeline-item {
  display: flex;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--c-border);
}
.timeline-item:last-child { border-bottom: none; }

.timeline-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--c-border-strong);
  flex-shrink: 0;
  margin-top: 5px;
}

.timeline-body { flex: 1; min-width: 0; }
.timeline-meta {
  font-size: 0.75rem;
  color: var(--c-text-muted);
  margin-bottom: 3px;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.timeline-content {
  font-size: 0.875rem;
  color: var(--c-text-secondary);
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-word;
}

/* ─────────────────────────────────────────────
   STEPPER (campaign)
──────────────────────────────────────────────── */
.stepper {
  display: flex;
  align-items: center;
  margin-bottom: 32px;
}
.stepper-step {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
}
.stepper-circle {
  width: 34px; height: 34px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.875rem;
  font-weight: 700;
  font-family: 'JetBrains Mono', monospace;
  transition: background var(--t-base), color var(--t-base), border var(--t-base);
  border: 2px solid transparent;
}
.stepper-circle.done   { background: var(--c-accent); color: #fff; border-color: var(--c-accent); }
.stepper-circle.active { background: color-mix(in srgb, var(--c-accent) 15%, transparent); color: var(--c-accent); border-color: var(--c-accent); }
.stepper-circle.locked { background: var(--c-surface-raised); color: var(--c-text-muted); border-color: var(--c-border); }
.stepper-label {
  font-size: 0.6875rem;
  font-weight: 600;
  color: var(--c-text-muted);
  white-space: nowrap;
}
.stepper-connector {
  flex: 1;
  height: 2px;
  background: var(--c-border);
  margin-bottom: 20px;
  transition: background var(--t-base);
}
.stepper-connector.done { background: var(--c-accent); }

/* ─────────────────────────────────────────────
   PIPELINE (guide)
──────────────────────────────────────────────── */
.pipeline-row {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 14px 16px;
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--r-lg);
  text-decoration: none;
  color: inherit;
  transition: background var(--t-fast), border-color var(--t-fast);
}
.pipeline-row:hover {
  background: var(--c-surface-raised);
  border-color: var(--c-border-strong);
  color: inherit;
}
.pipeline-info { flex: 1; min-width: 0; }
.pipeline-name { font-size: 0.9375rem; font-weight: 600; color: var(--c-text-primary); }
.pipeline-seg  { font-size: 0.75rem; color: var(--c-text-muted); }

/* ─────────────────────────────────────────────
   CHECKLIST / GUIDE STEPS
──────────────────────────────────────────────── */
.step-card {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-left-width: 3px;
  border-radius: var(--r-lg);
  padding: 16px 18px;
  transition: border-color var(--t-fast);
}
.step-card.done   { border-left-color: var(--c-accent); }
.step-card.active { border-left-color: var(--c-cyan); }
.step-card.locked { border-left-color: var(--c-border); opacity: .55; }

.step-card { cursor: default; }

/* .step-header agora é o <summary> do <details> — controle nativo de expandir/retrair, sem JS */
.step-header {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  cursor: pointer;
  list-style: none;
  user-select: none;
  -webkit-user-select: none;
}
.step-header::-webkit-details-marker { display: none; }
.step-header::marker                { display: none; }

.step-card[open] > .step-header { margin-bottom: 8px; }
.step-card[open] .step-chevron { transform: rotate(180deg); }
.step-num {
  width: 28px; height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8125rem;
  font-weight: 700;
  font-family: 'JetBrains Mono', monospace;
  flex-shrink: 0;
}
.step-num.done   { background: var(--c-accent); color: #fff; }
.step-num.active { background: color-mix(in srgb, var(--c-cyan) 15%, transparent); color: var(--c-cyan); border: 2px solid var(--c-cyan); }
.step-num.locked { background: var(--c-surface-raised); color: var(--c-text-muted); }

.step-title-row { flex: 1; min-width: 0; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.step-title     { font-size: 0.9375rem; font-weight: 600; color: var(--c-text-primary); font-family: 'DM Sans', sans-serif; }
.step-done-at   { font-size: 0.75rem; color: var(--c-success); }

.step-instruction {
  font-size: 0.8125rem;
  color: var(--c-text-secondary);
  line-height: 1.6;
  margin-bottom: 12px;
}
.step-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

/* ─────────────────────────────────────────────
   DIVIDER
──────────────────────────────────────────────── */
.divider {
  border: none;
  border-top: 1px solid var(--c-border);
  margin: 20px 0;
}

/* ─────────────────────────────────────────────
   UTILITY CLASSES
──────────────────────────────────────────────── */
.text-primary-color { color: var(--c-text-primary); }
.text-secondary-color { color: var(--c-text-secondary); }
.text-muted-color   { color: var(--c-text-muted); }
.text-accent-color  { color: var(--c-accent); }
.text-success-color { color: var(--c-success); }
.text-danger-color  { color: var(--c-danger); }
.text-warning-color { color: var(--c-warning); }

.text-sm   { font-size: 0.875rem; }
.text-xs   { font-size: 0.75rem; }
.font-mono { font-family: 'JetBrains Mono', monospace; }
.font-head { font-family: 'Saira', sans-serif; }
.font-500  { font-weight: 500; }
.font-600  { font-weight: 600; }

.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.sr-only {
  position: absolute; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}

.flex-center { display: flex; align-items: center; justify-content: center; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.gap-2  { gap: 8px; }
.gap-3  { gap: 12px; }
.mb-4   { margin-bottom: 16px; }
.mb-6   { margin-bottom: 24px; }
.mt-2   { margin-top: 8px; }
.w-full { width: 100%; }

/* ─────────────────────────────────────────────
   MOBILE  (< 768px)
──────────────────────────────────────────────── */
@media (max-width: 767px) {
  .sidebar {
    transform: translateX(calc(-1 * var(--sidebar-w)));
    box-shadow: none;
  }
  .sidebar.open {
    transform: translateX(0);
    box-shadow: var(--shadow-lg);
  }
  .sidebar-logo .logo-full   { display: none; }
  .sidebar-logo .logo-symbol { display: block; }

  .app-content { margin-left: 0; }

  .topbar      { padding: 0 16px; }
  .btn-menu    { display: flex; }

  .page-content { padding: 20px 16px; }

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

  h1, .page-title { font-size: 1.375rem; }

  .stepper-label { display: none; }

  .kanban-col { min-width: 200px; }

  .stat-value { font-size: 1.75rem; }
}

@media (min-width: 768px) {
  .btn-menu { display: none; }
}

/* ─────────────────────────────────────────────
   PRINT
──────────────────────────────────────────────── */
@media print {
  .sidebar, .topbar, .btn-menu, .sidebar-overlay { display: none !important; }
  .app-content { margin-left: 0 !important; }
  .page-content { padding: 0 !important; }
  body { background: #fff; color: #000; }
  .card { border-color: #ddd; background: #fff; }
}

/* ─────────────────────────────────────────────
   CAMPAIGN STEP DETAILS (collapsible)
──────────────────────────────────────────────── */
.step-details { overflow: hidden; }

.step-details > summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  list-style: none;
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
  gap: 12px;
}
.step-details > summary::-webkit-details-marker { display: none; }
.step-details > summary::marker              { display: none; }
.step-details > summary:hover { background: var(--c-surface-raised); }

.step-details[open] > summary {
  border-bottom: 1px solid var(--c-border);
}

.step-chevron {
  flex-shrink: 0;
  color: var(--c-text-muted);
  transition: transform 0.2s;
}
.step-details[open] .step-chevron { transform: rotate(180deg); }

/* ─────────────────────────────────────────────
   SPARKLINE (tendência diária — barras via CSS, sem lib de gráfico)
──────────────────────────────────────────────── */
.sparkline {
  display: flex;
  align-items: flex-end;
  gap: 2px;
  height: 32px;
  flex-shrink: 0;
}
.sparkline-bar {
  width: 4px;
  min-height: 2px;
  background: var(--c-accent);
  border-radius: 1px 1px 0 0;
  opacity: .85;
}

/* ─────────────────────────────────────────────
   RATING CHART (cliques por avaliação 1-5 — barras via CSS, sem lib de gráfico)
──────────────────────────────────────────────── */
.rating-chart {
  display: flex;
  align-items: flex-end;
  gap: 16px;
  height: 140px;
  padding: 12px 4px 0;
}
.rating-bar-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  height: 100%;
  gap: 6px;
}
.rating-bar-count {
  font-size: .75rem;
  font-weight: 700;
  color: var(--c-text-secondary);
}
.rating-bar-track {
  width: 100%;
  max-width: 40px;
  flex: 1;
  display: flex;
  align-items: flex-end;
  background: var(--c-bg);
  border-radius: var(--r-sm);
  overflow: hidden;
}
.rating-bar-fill {
  width: 100%;
  min-height: 3px;
  background: var(--c-accent);
  border-radius: var(--r-sm) var(--r-sm) 0 0;
}
.rating-bar-label {
  font-size: .75rem;
  font-weight: 600;
  color: var(--c-text-muted);
}

/* ─────────────────────────────────────────────
   PÁGINAS LEGAIS (Política / Termos) — layout de leitura público
──────────────────────────────────────────────── */
.legal-page {
  background: var(--c-bg);
  color: var(--c-text-primary);
  font-family: 'DM Sans', system-ui, sans-serif;
  min-height: 100vh;
  padding: 0 20px 64px;
}
.legal-header {
  max-width: 760px;
  margin: 0 auto;
  padding: 28px 0 20px;
  border-bottom: 1px solid var(--c-border);
}
.legal-wordmark {
  font-family: 'Saira', sans-serif;
  font-weight: 800;
  font-size: 1.25rem;
  letter-spacing: .02em;
  color: var(--c-text-primary);
}
.legal-container {
  max-width: 760px;
  margin: 0 auto;
}
.legal-doc {
  padding-top: 32px;
}
.legal-doc h1 {
  font-family: 'Saira', sans-serif;
  font-weight: 800;
  font-size: 1.75rem;
  line-height: 1.2;
  color: var(--c-text-primary);
  margin-bottom: 28px;
}
.legal-doc h2 {
  font-family: 'DM Sans', sans-serif;
  font-weight: 600;
  font-size: 1.1875rem;
  color: var(--c-text-primary);
  margin: 36px 0 12px;
  padding-top: 8px;
}
.legal-doc h3 {
  font-weight: 600;
  font-size: 1rem;
  color: var(--c-text-primary);
  margin: 22px 0 8px;
}
.legal-doc p {
  font-size: .9375rem;
  line-height: 1.75;
  color: var(--c-text-primary);
  margin-bottom: 14px;
}
.legal-doc ul {
  margin: 0 0 16px;
  padding-left: 22px;
}
.legal-doc li {
  font-size: .9375rem;
  line-height: 1.7;
  color: var(--c-text-primary);
  margin-bottom: 8px;
}
.legal-doc strong { font-weight: 600; color: var(--c-text-primary); }
.legal-doc a { color: var(--c-accent); text-decoration: underline; }
.legal-doc a:hover { color: var(--c-accent-hover); }

.legal-note {
  border-left: 3px solid var(--c-border-strong);
  background: var(--c-surface);
  border-radius: 0 var(--r-md) var(--r-md) 0;
  padding: 12px 16px;
  margin: 16px 0;
}
.legal-note p { margin: 0; font-size: .875rem; color: var(--c-text-secondary); }

.legal-table-wrap {
  overflow-x: auto;
  margin: 16px 0 20px;
  border: 1px solid var(--c-border);
  border-radius: var(--r-md);
}
.legal-table {
  border-collapse: collapse;
  width: 100%;
  min-width: 560px;
  font-size: .8125rem;
}
.legal-table th,
.legal-table td {
  text-align: left;
  padding: 10px 14px;
  border-bottom: 1px solid var(--c-border);
  vertical-align: top;
  line-height: 1.55;
}
.legal-table th {
  background: var(--c-surface);
  color: var(--c-text-primary);
  font-weight: 600;
  white-space: nowrap;
}
.legal-table td { color: var(--c-text-secondary); }
.legal-table tr:last-child td { border-bottom: none; }

.legal-updated {
  margin-top: 32px;
  padding-top: 20px;
  border-top: 1px solid var(--c-border);
  font-size: .8125rem;
  color: var(--c-text-muted);
}
.legal-footer {
  max-width: 760px;
  margin: 40px auto 0;
  padding-top: 24px;
  border-top: 1px solid var(--c-border);
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  align-items: center;
  justify-content: space-between;
}
.legal-footer a {
  color: var(--c-accent);
  text-decoration: none;
  font-size: .875rem;
  font-weight: 500;
}
.legal-footer a:hover { text-decoration: underline; }
.legal-footer span { font-size: .8125rem; color: var(--c-text-muted); }

@media (max-width: 600px) {
  .legal-doc h1 { font-size: 1.5rem; }
  .legal-doc h2 { font-size: 1.0625rem; }
}
