* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --bg: #f5f6fa;
  --bg-white: #ffffff;
  --bg-dark: #1a1a2e;
  --bg-sidebar: #0f0f1a;
  --border: #e2e5f1;
  --border-light: #eef0f6;
  --text: #1e1e2e;
  --text-secondary: #4a4a68;
  --muted: #8b8da3;
  --accent: #f5c518;
  --accent-hover: #e6b800;
  --accent-light: rgba(245,197,24,0.12);
  --accent-dark: #1a1a1a;
  --success: #00c48c;
  --success-light: rgba(0,196,140,0.1);
  --warning: #ff9f43;
  --warning-light: rgba(255,159,67,0.1);
  --danger: #ff5252;
  --danger-light: rgba(255,82,82,0.1);
  --info: #4a90d9;
  --info-light: rgba(74,144,217,0.1);
  --purple: #7c5cfc;
  --purple-light: rgba(124,92,252,0.1);
  --pink: #e84393;
  --pink-light: rgba(232,67,147,0.1);
  --radius: 10px;
  --radius-sm: 6px;
  --radius-lg: 14px;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.06);
  --shadow: 0 2px 12px rgba(0,0,0,0.08);
  --shadow-lg: 0 8px 32px rgba(0,0,0,0.12);
  --transition: 0.2s ease;
}

body {
  font-family: 'Inter', -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
}

[hidden] { display: none !important; }

.auth-screen {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(280px, 1.15fr) minmax(360px, .85fr);
  background:
    radial-gradient(circle at 18% 22%, rgba(245,197,24,.18), transparent 32%),
    linear-gradient(90deg, #11110f 0%, #1d1b13 54%, #f5f3eb 54%);
}

.auth-brand {
  color: #fff;
  padding: clamp(40px, 8vw, 110px);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 100vh;
}

.auth-brand p {
  max-width: 520px;
  font-size: clamp(24px, 3.5vw, 52px);
  line-height: 1.06;
  letter-spacing: -2px;
  font-weight: 700;
}

.auth-logo { font-size: 24px; }

.auth-card {
  align-self: center;
  justify-self: center;
  width: min(430px, calc(100% - 40px));
  padding: 36px;
  background: rgba(255,255,255,.92);
  border: 1px solid rgba(0,0,0,.08);
  border-radius: 18px;
  box-shadow: 0 30px 80px rgba(0,0,0,.16);
  backdrop-filter: blur(18px);
}

.auth-card h1 {
  margin-top: 8px;
  font-size: 30px;
  letter-spacing: -1px;
}

.auth-card > div > p { color: var(--muted); margin: 6px 0 28px; }
.eyebrow { font-size: 10px; letter-spacing: 1.8px; font-weight: 800; color: #9d7d00; }
.auth-error { min-height: 22px; color: var(--danger); font-size: 12px; }
.auth-submit { width: 100%; justify-content: space-between; padding: 12px 16px; }
.auth-submit:disabled { opacity: .6; cursor: wait; }

/* ===== TOP BAR ===== */
.topbar {
  height: 56px;
  background: var(--accent-dark);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 200;
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

.topbar-left { display: flex; align-items: center; }
.mobile-menu { display: none; margin-right: 8px; }

.logo {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 18px;
  color: #fff;
  font-weight: 400;
}

.logo i { color: var(--accent); font-size: 22px; }
.logo strong { color: var(--accent); font-weight: 800; }

.topbar-center { flex: 1; max-width: 520px; margin: 0 32px; }

.global-search {
  display: flex;
  align-items: center;
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 8px;
  padding: 0 14px;
  transition: var(--transition);
}

.global-search:focus-within {
  background: rgba(255,255,255,0.14);
  border-color: var(--accent);
}

.global-search i { color: rgba(255,255,255,0.4); font-size: 13px; }

.global-search input {
  background: none;
  border: none;
  color: #fff;
  font-family: inherit;
  font-size: 13px;
  padding: 9px 10px;
  width: 100%;
  outline: none;
}

.global-search input::placeholder { color: rgba(255,255,255,0.35); }

.topbar-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.topbar-btn {
  width: 36px; height: 36px;
  border: none;
  background: rgba(255,255,255,0.06);
  color: rgba(255,255,255,0.7);
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  transition: var(--transition);
  position: relative;
}

.topbar-btn:hover { background: rgba(255,255,255,0.12); color: #fff; }
.topbar-btn.accent { background: var(--accent); color: #000; }
.topbar-btn.accent:hover { background: var(--accent-hover); }

.notif-dot {
  position: absolute;
  top: 6px; right: 6px;
  width: 7px; height: 7px;
  background: var(--danger);
  border-radius: 50%;
  display: none;
}

.topbar-user {
  display: flex;
  align-items: center;
  gap: 8px;
  color: rgba(255,255,255,0.8);
  font-size: 13px;
  font-weight: 500;
  margin-left: 8px;
  padding-left: 12px;
  border-left: 1px solid rgba(255,255,255,0.1);
}

.avatar-sm {
  width: 30px; height: 30px;
  background: var(--accent);
  color: #000;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
}

/* ===== LAYOUT ===== */
.app-layout {
  display: flex;
  padding-top: 56px;
  min-height: 100vh;
}

/* ===== SIDEBAR ===== */
.sidebar {
  width: 220px;
  background: var(--bg-white);
  border-right: 1px solid var(--border);
  position: fixed;
  top: 56px; left: 0; bottom: 0;
  overflow-y: auto;
  z-index: 100;
}

.nav-menu { list-style: none; padding: 8px 0; }

.nav-section-title {
  padding: 18px 20px 6px;
  font-size: 10px;
  font-weight: 700;
  color: var(--muted);
  letter-spacing: 1.2px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 20px;
  cursor: pointer;
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 500;
  transition: var(--transition);
  border-left: 3px solid transparent;
}

.nav-item:hover {
  background: var(--bg);
  color: var(--text);
}

.nav-item.active {
  background: var(--accent-light);
  color: var(--accent-dark);
  border-left-color: var(--accent);
  font-weight: 600;
}

.nav-item i { width: 18px; text-align: center; font-size: 14px; }
.nav-item.active i { color: var(--accent-dark); }

/* ===== MAIN ===== */
.main {
  margin-left: 220px;
  flex: 1;
  padding: 28px 32px;
  min-height: calc(100vh - 56px);
}

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

/* ===== PAGE HEADER ===== */
.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 24px;
  flex-wrap: wrap;
  gap: 16px;
}

.page-header h1 {
  font-size: 24px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.3px;
}

.page-subtitle {
  font-size: 13px;
  color: var(--muted);
  margin-top: 2px;
}

.page-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

/* ===== BUTTONS ===== */
.btn {
  padding: 8px 18px;
  border: none;
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: var(--transition);
  white-space: nowrap;
}

.btn-accent {
  background: var(--accent);
  color: #000;
}

.btn-accent:hover { background: var(--accent-hover); transform: translateY(-1px); box-shadow: var(--shadow); }

.btn-outline {
  background: var(--bg-white);
  color: var(--text-secondary);
  border: 1px solid var(--border);
}

.btn-outline:hover { border-color: var(--muted); color: var(--text); }

.btn-sm { padding: 5px 10px; font-size: 12px; }

.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #e63946; }

.btn-link {
  background: none;
  border: none;
  color: var(--info);
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
}

.btn-link:hover { text-decoration: underline; }

.btn-group {
  display: inline-flex;
  background: var(--bg-white);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.btn-tab {
  padding: 7px 14px;
  border: none;
  background: transparent;
  color: var(--muted);
  font-family: inherit;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  align-items: center;
  gap: 5px;
  border-right: 1px solid var(--border);
}

.btn-tab:last-child { border-right: none; }
.btn-tab:hover { background: var(--bg); color: var(--text); }
.btn-tab.active { background: var(--accent); color: #000; font-weight: 600; }

.btn-icon {
  width: 32px; height: 32px;
  border: none;
  background: none;
  color: var(--muted);
  cursor: pointer;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
}

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

/* ===== INPUTS ===== */
.search-input {
  display: flex;
  align-items: center;
  background: var(--bg-white);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0 12px;
}

.search-input i { color: var(--muted); font-size: 13px; }

.search-input input {
  background: none;
  border: none;
  padding: 8px 8px;
  font-family: inherit;
  font-size: 13px;
  color: var(--text);
  outline: none;
  width: 180px;
}

.select-filter {
  padding: 8px 12px;
  background: var(--bg-white);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 13px;
  color: var(--text-secondary);
  cursor: pointer;
  outline: none;
}

.select-filter:focus { border-color: var(--accent); }

/* ===== PANELS ===== */
.panel {
  background: var(--bg-white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.panel-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.panel-header h3 {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 8px;
}

.panel-body { padding: 20px; }
.panel-body.scrollable { max-height: 360px; overflow-y: auto; }

/* ===== KPI ROW ===== */
.kpi-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.kpi-card {
  background: var(--bg-white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow-sm);
  display: flex;
  align-items: flex-start;
  gap: 14px;
}

.kpi-icon {
  width: 42px; height: 42px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
}

.kpi-data { flex: 1; }

.kpi-data .kpi-value {
  font-size: 26px;
  font-weight: 800;
  letter-spacing: -0.5px;
  line-height: 1.1;
}

.kpi-data .kpi-label {
  font-size: 12px;
  color: var(--muted);
  margin-top: 4px;
  font-weight: 500;
}

/* ===== GRID ===== */
.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

/* ===== DATA TABLE ===== */
.data-table {
  width: 100%;
  border-collapse: collapse;
}

.data-table th {
  text-align: left;
  padding: 11px 16px;
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.6px;
  border-bottom: 1px solid var(--border);
  background: var(--bg);
  position: sticky;
  top: 0;
}

.data-table th:first-child { width: 36px; }

.data-table td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-light);
  font-size: 13px;
  vertical-align: middle;
}

.data-table tr { transition: var(--transition); cursor: pointer; }
.data-table tbody tr:hover td { background: rgba(245,197,24,0.04); }

.data-table th input[type="checkbox"],
.data-table td input[type="checkbox"] {
  accent-color: var(--accent);
}

.table-empty {
  text-align: center;
  padding: 60px 20px;
  color: var(--muted);
}

.table-empty i { font-size: 48px; margin-bottom: 16px; opacity: 0.3; }
.table-empty p { margin-bottom: 16px; }

/* ===== BADGES ===== */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}

.badge-source-trafego { background: var(--warning-light); color: #c77600; }
.badge-source-prospeccao { background: var(--purple-light); color: var(--purple); }
.badge-source-social_selling { background: var(--pink-light); color: var(--pink); }
.badge-source-indicacao { background: var(--success-light); color: #00875a; }

.badge-stage {
  padding: 4px 10px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
}

.badge-stage-abordagem { background: var(--purple-light); color: var(--purple); }
.badge-stage-contato { background: var(--info-light); color: var(--info); }
.badge-stage-followup { background: var(--warning-light); color: #c77600; }
.badge-stage-proposta { background: var(--pink-light); color: var(--pink); }
.badge-stage-negociacao { background: rgba(249,115,22,0.1); color: #d2691e; }
.badge-stage-fechamento { background: var(--success-light); color: #00875a; }

.badge-priority-alta { color: var(--danger); }
.badge-priority-media { color: var(--warning); }
.badge-priority-baixa { color: var(--info); }

/* ===== KANBAN ===== */
.kanban-board {
  display: flex;
  gap: 14px;
  overflow-x: auto;
  padding-bottom: 20px;
  min-height: 70vh;
}

.kanban-col {
  min-width: 272px;
  max-width: 272px;
  display: flex;
  flex-direction: column;
}

.kanban-col-head {
  padding: 12px 14px;
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  color: #fff;
}

.kanban-col-head .kch-count {
  background: rgba(255,255,255,0.25);
  padding: 1px 7px;
  border-radius: 10px;
  font-size: 11px;
}

.kanban-col-head .kch-value {
  font-size: 11px;
  font-weight: 500;
  opacity: 0.85;
}

.kanban-col-body {
  flex: 1;
  background: var(--bg);
  border: 1px solid var(--border);
  border-top: none;
  border-radius: 0 0 var(--radius-sm) var(--radius-sm);
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 200px;
  transition: background var(--transition);
}

.kanban-col-body.drag-over { background: var(--accent-light); }

.k-card {
  background: var(--bg-white);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px;
  cursor: pointer;
  transition: var(--transition);
  border-left: 3px solid transparent;
}

.k-card:hover {
  box-shadow: var(--shadow);
  transform: translateY(-1px);
  border-left-color: var(--accent);
}

.k-card.dragging { opacity: 0.35; }

.k-card .kc-name {
  font-weight: 600;
  font-size: 13px;
  margin-bottom: 2px;
  color: var(--text);
}

.k-card .kc-company {
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 10px;
}

.k-card .kc-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.k-card .kc-value {
  font-weight: 700;
  font-size: 14px;
  color: var(--success);
}

/* ===== FUNNEL VISUAL ===== */
.funnel-visual {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.fv-stage {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 28px;
  border-radius: var(--radius-sm);
  color: #fff;
  transition: var(--transition);
  cursor: default;
}

.fv-stage:hover { transform: scaleX(1.01); filter: brightness(1.08); }

.fv-stage .fv-label { font-weight: 700; font-size: 14px; text-transform: uppercase; letter-spacing: 0.5px; }

.fv-stage .fv-stats {
  display: flex;
  align-items: center;
  gap: 20px;
  font-size: 13px;
}

.fv-stage .fv-stats strong { font-size: 15px; }

.fv-arrow {
  color: var(--muted);
  font-size: 11px;
  display: flex;
  align-items: center;
  gap: 6px;
}

/* ===== ACTIVITY LIST ===== */
.act-list { display: flex; flex-direction: column; }

.act-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border-light);
}

.act-item:last-child { border-bottom: none; }

.act-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.act-item .act-text {
  flex: 1;
  font-size: 13px;
  color: var(--text-secondary);
}

.act-item .act-text strong { color: var(--text); }

.act-item .act-time {
  font-size: 11px;
  color: var(--muted);
  white-space: nowrap;
}

/* ===== TASK CARDS ===== */
.task-card {
  background: var(--bg-white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 20px;
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 8px;
  transition: var(--transition);
  box-shadow: var(--shadow-sm);
}

.task-card:hover { box-shadow: var(--shadow); border-color: var(--accent); }

.task-checkbox {
  width: 20px; height: 20px;
  border: 2px solid var(--border);
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: var(--transition);
  font-size: 10px;
  color: transparent;
}

.task-checkbox:hover { border-color: var(--accent); }
.task-checkbox.checked { background: var(--success); border-color: var(--success); color: #fff; }

.task-card .tc-info { flex: 1; }
.task-card .tc-title { font-weight: 600; font-size: 14px; }
.task-card .tc-title.done { text-decoration: line-through; color: var(--muted); }

.task-card .tc-meta {
  font-size: 12px;
  color: var(--muted);
  margin-top: 3px;
  display: flex;
  gap: 14px;
  align-items: center;
}

.tc-meta .priority-indicator {
  width: 6px; height: 6px;
  border-radius: 50%;
  display: inline-block;
}

.task-card .tc-actions { display: flex; gap: 4px; }

/* ===== CALENDAR ===== */
.cal-day-group { margin-bottom: 20px; }

.cal-day-label {
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 8px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border-light);
}

/* ===== CODE ===== */
.code-block {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
}

.code-method {
  background: var(--accent);
  color: #000;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 4px;
}

.code-block code {
  font-family: 'JetBrains Mono', 'Fira Code', monospace;
  font-size: 13px;
  color: var(--text);
  flex: 1;
}

.code-example {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px 18px;
  font-family: 'JetBrains Mono', 'Fira Code', monospace;
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 10px;
  line-height: 1.7;
  overflow-x: auto;
}

/* ===== CONNECTIONS ===== */
.connections-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 14px;
}

.conn-card {
  background: var(--bg-white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: var(--shadow-sm);
}

.conn-card .cc-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.conn-card .cc-name { font-weight: 700; font-size: 14px; }

.cc-status {
  width: 9px; height: 9px;
  border-radius: 50%;
  background: var(--success);
}

.cc-status.off { background: var(--muted); }

.conn-card .cc-type { font-size: 12px; color: var(--muted); }

.integrations-catalog {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 12px;
}

.integration-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition);
}

.integration-item:hover { border-color: var(--accent); background: var(--accent-light); }

.int-icon {
  width: 40px; height: 40px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 18px;
  flex-shrink: 0;
}

.integration-item p { font-size: 12px; color: var(--muted); margin-top: 2px; }

/* ===== STATS TABLE ===== */
.stat-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 0;
  border-bottom: 1px solid var(--border-light);
  font-size: 13px;
}

.stat-row:last-child { border-bottom: none; }
.stat-row .sr-label { color: var(--text-secondary); display: flex; align-items: center; gap: 8px; }
.stat-row .sr-value { font-weight: 700; font-size: 15px; }

.sr-dot {
  width: 10px; height: 10px;
  border-radius: 50%;
  display: inline-block;
}

/* ===== BAR CHART (CSS) ===== */
.bar-chart { display: flex; flex-direction: column; gap: 12px; }

.bar-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.bar-label {
  width: 90px;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
  text-align: right;
  flex-shrink: 0;
}

.bar-track {
  flex: 1;
  height: 28px;
  background: var(--bg);
  border-radius: 4px;
  overflow: hidden;
  position: relative;
}

.bar-fill {
  height: 100%;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding: 0 8px;
  font-size: 11px;
  font-weight: 700;
  color: #fff;
  min-width: 30px;
  transition: width 0.6s ease;
}

.bar-value {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  width: 90px;
  text-align: right;
  flex-shrink: 0;
}

/* ===== MODAL ===== */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  backdrop-filter: blur(3px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.modal-backdrop.active { display: flex; }

.modal-dialog {
  background: var(--bg-white);
  border-radius: var(--radius-lg);
  width: 520px;
  max-width: 92vw;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
}

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
}

.modal-head h2 { font-size: 17px; font-weight: 700; }

.modal-head button {
  width: 32px; height: 32px;
  border: none;
  background: var(--bg);
  border-radius: var(--radius-sm);
  color: var(--muted);
  cursor: pointer;
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
}

.modal-head button:hover { background: var(--danger-light); color: var(--danger); }

.modal-content { padding: 24px; }

/* ===== FORMS ===== */
.form-group { margin-bottom: 16px; }

.form-group label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 5px;
}

.form-group label .required { color: var(--danger); }

.form-input {
  width: 100%;
  padding: 9px 13px;
  background: var(--bg-white);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: inherit;
  font-size: 13px;
  outline: none;
  transition: var(--transition);
}

.form-input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-light); }

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

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--border-light);
}

/* ===== SIDE PANEL ===== */
.side-panel-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.35);
  display: none;
  z-index: 1000;
}

.side-panel-backdrop.active { display: block; }

.side-panel {
  position: fixed;
  top: 0; right: 0; bottom: 0;
  width: 520px;
  max-width: 95vw;
  background: var(--bg-white);
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
}

.sp-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  background: var(--bg-white);
  z-index: 1;
}

.sp-body { padding: 24px; flex: 1; overflow-y: auto; }

.sp-section { margin-bottom: 28px; }

.sp-section-title {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--muted);
  font-weight: 700;
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border-light);
}

.sp-detail {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 0;
  font-size: 13px;
}

.sp-detail .sp-label { color: var(--muted); }
.sp-detail .sp-value { font-weight: 600; }

.stage-pills {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}

.stage-pill {
  padding: 5px 12px;
  border: 1px solid var(--border);
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  background: var(--bg-white);
  color: var(--text-secondary);
}

.stage-pill:hover { border-color: var(--accent); }

.stage-pill.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #000;
}

/* ===== TOAST ===== */
.toast-container {
  position: fixed;
  bottom: 24px; right: 24px;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  background: var(--bg-dark);
  color: #fff;
  padding: 12px 20px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  animation: toastIn 0.3s ease;
  display: flex;
  align-items: center;
  gap: 10px;
}

.toast.success { border-left: 3px solid var(--success); }
.toast.error { border-left: 3px solid var(--danger); }
.toast.info { border-left: 3px solid var(--info); }

@keyframes toastIn {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

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

/* ===== RESPONSIVE ===== */
@media (max-width: 900px) {
  .sidebar { width: 56px; }
  .sidebar .nav-item span, .nav-section-title { display: none; }
  .sidebar .nav-item { justify-content: center; padding: 12px; }
  .main { margin-left: 56px; padding: 20px 16px; }
  .grid-2 { grid-template-columns: 1fr; }
  .topbar-center { display: none; }
  .topbar-user span { display: none; }
  .kanban-col { min-width: 240px; }
}

@media (max-width: 720px) {
  .auth-screen {
    grid-template-columns: 1fr;
    background:
      radial-gradient(circle at 10% 5%, rgba(245,197,24,.22), transparent 30%),
      linear-gradient(180deg, #11110f 0 34%, #f5f3eb 34%);
    padding: 24px 0;
  }

  .auth-brand {
    min-height: auto;
    padding: 20px 28px 50px;
    gap: 38px;
  }

  .auth-brand p { font-size: 28px; letter-spacing: -1px; }
  .auth-card { padding: 28px 22px; align-self: start; }

  .mobile-menu { display: flex; }
  .sidebar {
    width: 248px;
    transform: translateX(-100%);
    transition: transform .25s ease;
    box-shadow: var(--shadow-lg);
  }
  .sidebar.open { transform: translateX(0); }
  .sidebar .nav-item span, .nav-section-title { display: initial; }
  .sidebar .nav-item { justify-content: flex-start; padding: 10px 20px; }
  .main { margin-left: 0; padding: 18px 12px; }
  .topbar { padding: 0 12px; }
  .topbar-user { display: none; }
  .page-header h1 { font-size: 21px; }
  .kpi-row { grid-template-columns: 1fr 1fr; gap: 10px; }
  .kpi-card { padding: 14px; }
  .kpi-data .kpi-value { font-size: 19px; }
  .data-table { min-width: 900px; }
  .panel:has(.data-table) { overflow-x: auto; }
  .form-row { grid-template-columns: 1fr; }
  .btn-group { max-width: 100%; overflow-x: auto; }
  .modal-dialog { max-height: 94vh; }
}
