/* ==========================================================================
   Mixsol CRM — Design System
   Tokens, primitivos e componentes reutilizáveis.
   ========================================================================== */

/* ---------- 1. Tokens ---------- */
:root {
  /* Marca */
  --brand-900: #022B4B;
  --brand-800: #023A63;
  --brand-700: #034374; /* azul institucional */
  --brand-600: #0A5B96;
  --brand-500: #1273BC;
  --brand-200: #BCD8EC;
  --brand-100: #DCEAF5;
  --brand-50:  #F0F6FB;

  --accent-700: #C85A08;
  --accent-600: #F77011; /* laranja institucional */
  --accent-500: #FF8730;
  --accent-100: #FDE4CE;
  --accent-50:  #FEF3E8;

  /* Neutros */
  --bg:          #F5F7F9;
  --surface:     #FFFFFF;
  --surface-2:   #FAFBFC;
  --surface-3:   #F1F4F7;
  --border:      #E3E8EE;
  --border-strong:#CFD6DF;
  --text:        #0F1B28;
  --text-2:      #4A5869;
  --text-3:      #6B7A8C;
  --text-4:      #8E9BAA;

  /* Semânticas */
  --success-700:#06603C; --success-600:#0A7A4D; --success-50:#E9F8F1; --success-200:#A9E2C8;
  --warning-700:#8A4B07; --warning-600:#B86A0C; --warning-50:#FEF5E7; --warning-200:#F6D9A6;
  --danger-700: #9A1C13; --danger-600: #C0271C; --danger-50: #FDEEEC; --danger-200:#F4BDB7;
  --info-700:   #034374; --info-600:   #0A5B96; --info-50:   #EDF4FA; --info-200: #BCD8EC;
  --neutral-50: #F1F4F7; --neutral-200:#D9E0E8;

  /* Tipografia */
  --font-sans: "Inter", "Geist", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --fs-11: 11px; --fs-12: 12px; --fs-13: 13px; --fs-14: 14px; --fs-16: 16px;
  --fs-20: 20px; --fs-24: 24px; --fs-28: 28px; --fs-32: 32px;

  /* Espaçamento (base 4) */
  --sp-1: 4px; --sp-2: 8px; --sp-3: 12px; --sp-4: 16px; --sp-5: 20px;
  --sp-6: 24px; --sp-8: 32px; --sp-10: 40px; --sp-12: 48px; --sp-16: 64px;

  /* Forma */
  --r-sm: 6px; --r-md: 8px; --r-lg: 10px; --r-xl: 14px; --r-full: 999px;
  --shadow-sm: 0 1px 2px rgba(15, 27, 40, .06);
  --shadow-md: 0 4px 12px rgba(15, 27, 40, .08);
  --shadow-lg: 0 12px 32px rgba(15, 27, 40, .14);

  /* Movimento */
  --t-fast: 150ms cubic-bezier(.2, 0, 0, 1);
  --t-base: 220ms cubic-bezier(.2, 0, 0, 1);

  /* Layout */
  --sidebar-w: 248px;
  --sidebar-w-collapsed: 64px;
  --topbar-h: 60px;
  --od-icon-size: 16px;
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: var(--fs-14);
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  font-feature-settings: "cv05" 1, "ss01" 1;
}

h1, h2, h3, h4, p, figure { margin: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--brand-600); }

:focus-visible {
  outline: 2px solid var(--brand-500);
  outline-offset: 2px;
  border-radius: var(--r-sm);
}

.num { font-variant-numeric: tabular-nums; }
.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;
}

/* ---------- 2. Tipografia utilitária ---------- */
.t-display { font-size: var(--fs-32); font-weight: 650; letter-spacing: -.02em; line-height: 1.2; }
.t-h1 { font-size: var(--fs-24); font-weight: 640; letter-spacing: -.015em; line-height: 1.25; }
.t-h2 { font-size: var(--fs-20); font-weight: 620; letter-spacing: -.01em; line-height: 1.3; }
.t-h3 { font-size: var(--fs-16); font-weight: 600; line-height: 1.35; }
.t-body { font-size: var(--fs-14); }
.t-sm { font-size: var(--fs-13); }
.t-xs { font-size: var(--fs-12); }
.t-label {
  font-size: var(--fs-11); font-weight: 600; letter-spacing: .06em;
  text-transform: uppercase; color: var(--text-3);
}
.t-muted { color: var(--text-3); }
.t-dim { color: var(--text-2); }

/* ---------- 3. Botões ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--sp-2);
  height: 36px; padding: 0 var(--sp-4);
  border-radius: var(--r-md); border: 1px solid transparent;
  font-size: var(--fs-13); font-weight: 560; white-space: nowrap;
  cursor: pointer; transition: background var(--t-fast), border-color var(--t-fast), color var(--t-fast);
}
.btn:disabled { cursor: not-allowed; opacity: .55; }
.btn-sm { height: 30px; padding: 0 var(--sp-3); font-size: var(--fs-12); }
.btn-lg { height: 42px; padding: 0 var(--sp-5); font-size: var(--fs-14); }
.btn-block { width: 100%; }

.btn-primary { background: var(--brand-700); color: #FFFFFF; }
.btn-primary:hover:not(:disabled) { background: var(--brand-800); }
.btn-primary:active:not(:disabled) { background: var(--brand-900); }

.btn-accent { background: var(--accent-600); color: #FFFFFF; }
.btn-accent:hover:not(:disabled) { background: var(--accent-700); }
.btn-accent:active:not(:disabled) { background: #A94B05; }

.btn-secondary { background: var(--surface); color: var(--text); border-color: var(--border-strong); }
.btn-secondary:hover:not(:disabled) { background: var(--surface-3); }

.btn-ghost { background: transparent; color: var(--text-2); }
.btn-ghost:hover:not(:disabled) { background: var(--surface-3); color: var(--text); }

.btn-danger { background: var(--danger-600); color: #FFFFFF; }
.btn-danger:hover:not(:disabled) { background: var(--danger-700); }

.btn-danger-soft { background: var(--danger-50); color: var(--danger-700); border-color: var(--danger-200); }
.btn-danger-soft:hover:not(:disabled) { background: #FBE2DF; }

.btn-icon { width: 36px; height: 36px; padding: 0; }
.btn-icon.btn-sm { width: 30px; height: 30px; }

/* ---------- 4. Formulários ---------- */
.field { display: grid; gap: var(--sp-1); }
.field > label, .form-label {
  display: block; font-size: var(--fs-12); font-weight: 560; color: var(--text-2);
}
.req { color: var(--danger-600); }
.input, .select, .textarea {
  width: 100%; min-height: 36px; padding: 7px var(--sp-3);
  background: var(--surface); color: var(--text);
  border: 1px solid var(--border-strong); border-radius: var(--r-md);
  font-size: var(--fs-13); transition: border-color var(--t-fast), box-shadow var(--t-fast);
}
.input::placeholder, .textarea::placeholder { color: var(--text-4); }
.input:hover, .select:hover, .textarea:hover { border-color: #B9C3CF; }
.input:focus, .select:focus, .textarea:focus {
  outline: none; border-color: var(--brand-500); box-shadow: 0 0 0 3px var(--brand-100);
}
.input:disabled, .select:disabled, .textarea:disabled { background: var(--surface-3); color: var(--text-4); cursor: not-allowed; }
.textarea { min-height: 76px; resize: vertical; }
.select {
  appearance: none; padding-right: var(--sp-8);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%236B7A8C' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 10px center;
}
.input-error, .input.is-invalid { border-color: var(--danger-600); }
.input-error:focus, .input.is-invalid:focus { box-shadow: 0 0 0 3px var(--danger-50); }
.field-msg { font-size: var(--fs-12); color: var(--danger-700); display: flex; gap: var(--sp-1); align-items: flex-start; }
.field-hint { font-size: var(--fs-12); color: var(--text-3); }

.input-group { position: relative; display: block; }
.input-group .input { padding-left: 34px; }
.input-group > .od-icon {
  position: absolute; left: 10px; top: 50%; transform: translateY(-50%);
  color: var(--text-4); pointer-events: none;
}

.checkbox, .radio { display: inline-flex; align-items: center; gap: var(--sp-2); cursor: pointer; font-size: var(--fs-13); }
.checkbox input, .radio input { width: 16px; height: 16px; accent-color: var(--brand-700); cursor: pointer; }

.switch { display: inline-flex; align-items: center; gap: var(--sp-2); cursor: pointer; font-size: var(--fs-13); }
.switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.switch-track {
  width: 36px; height: 20px; border-radius: var(--r-full); background: var(--border-strong);
  position: relative; transition: background var(--t-fast); flex: none;
}
.switch-track::after {
  content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px;
  border-radius: 50%; background: #FFFFFF; box-shadow: var(--shadow-sm);
  transition: transform var(--t-fast);
}
.switch input:checked + .switch-track { background: var(--brand-700); }
.switch input:checked + .switch-track::after { transform: translateX(16px); }
.switch input:focus-visible + .switch-track { outline: 2px solid var(--brand-500); outline-offset: 2px; }

/* ---------- 5. Superfícies ---------- */
.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-lg); box-shadow: var(--shadow-sm);
}
.card-head {
  display: flex; align-items: flex-start; justify-content: space-between; gap: var(--sp-3);
  padding: var(--sp-4) var(--sp-5); border-bottom: 1px solid var(--border);
}
.card-head .od-stat { gap: 2px; }
.card-body { padding: var(--sp-5); }
.card-body.tight { padding: var(--sp-3) var(--sp-4); }
.card-foot { padding: var(--sp-3) var(--sp-5); border-top: 1px solid var(--border); background: var(--surface-2); border-radius: 0 0 var(--r-lg) var(--r-lg); }

.section-title { display: flex; align-items: center; gap: var(--sp-2); }
.divider { height: 1px; background: var(--border); border: 0; margin: 0; }

/* ---------- 6. Badges e chips ---------- */
.badge {
  display: inline-flex; align-items: center; gap: var(--sp-1);
  padding: 2px var(--sp-2); border-radius: var(--r-full);
  font-size: var(--fs-11); font-weight: 580; line-height: 18px;
  border: 1px solid transparent; white-space: nowrap;
}
.badge::before {
  content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; flex: none;
}
.badge-plain::before { display: none; }
.badge-neutral { background: var(--neutral-50); color: var(--text-2); border-color: var(--neutral-200); }
.badge-info    { background: var(--info-50);    color: var(--info-700);    border-color: var(--info-200); }
.badge-success { background: var(--success-50); color: var(--success-700); border-color: var(--success-200); }
.badge-warning { background: var(--warning-50); color: var(--warning-700); border-color: var(--warning-200); }
.badge-danger  { background: var(--danger-50);  color: var(--danger-700);  border-color: var(--danger-200); }
.badge-accent  { background: var(--accent-50);  color: var(--accent-700);  border-color: var(--accent-100); }

.chip {
  display: inline-flex; align-items: center; gap: var(--sp-1);
  height: 26px; padding: 0 var(--sp-2) 0 var(--sp-3);
  background: var(--brand-50); border: 1px solid var(--brand-200); color: var(--brand-800);
  border-radius: var(--r-full); font-size: var(--fs-12); font-weight: 540;
}
.chip button {
  display: inline-flex; align-items: center; justify-content: center;
  width: 18px; height: 18px; border: 0; border-radius: 50%;
  background: transparent; color: inherit; cursor: pointer;
}
.chip button:hover { background: var(--brand-200); }

.delta { display: inline-flex; align-items: center; gap: 2px; font-size: var(--fs-12); font-weight: 580; }
.delta-up { color: var(--success-600); }
.delta-down { color: var(--danger-600); }
.delta-flat { color: var(--text-3); }

/* ---------- 7. Tooltip ---------- */
.tip { position: relative; display: inline-flex; }
.tip > .tip-trigger {
  display: inline-flex; align-items: center; justify-content: center;
  width: 18px; height: 18px; border: 0; padding: 0; border-radius: 50%;
  background: transparent; color: var(--text-4); cursor: help;
}
.tip > .tip-trigger:hover { color: var(--text-2); background: var(--surface-3); }
.tip-bubble {
  position: absolute; z-index: 60; bottom: calc(100% + 8px); left: 50%; transform: translateX(-50%) translateY(2px);
  width: max-content; max-width: 280px; padding: var(--sp-2) var(--sp-3);
  background: var(--brand-900); color: #EAF1F7; border-radius: var(--r-md);
  font-size: var(--fs-12); line-height: 1.45; font-weight: 450;
  box-shadow: var(--shadow-md); opacity: 0; pointer-events: none;
  transition: opacity var(--t-fast), transform var(--t-fast);
}
.tip-bubble::after {
  content: ""; position: absolute; top: 100%; left: 50%; margin-left: -5px;
  border: 5px solid transparent; border-top-color: var(--brand-900);
}
.tip:hover .tip-bubble, .tip:focus-within .tip-bubble { opacity: 1; transform: translateX(-50%) translateY(0); }
.tip-left .tip-bubble { left: auto; right: 0; transform: translateY(2px); }
.tip-left .tip-bubble::after { left: auto; right: 10px; }
.tip-left:hover .tip-bubble, .tip-left:focus-within .tip-bubble { transform: translateY(0); }

/* ---------- 8. Tabelas ---------- */
.table-wrap { width: 100%; overflow-x: auto; }
.table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: var(--fs-13); }
.table th {
  position: sticky; top: 0; z-index: 2;
  background: var(--surface-2); text-align: left; font-weight: 580; color: var(--text-2);
  font-size: var(--fs-12); white-space: nowrap;
  padding: var(--sp-3) var(--sp-4); border-bottom: 1px solid var(--border);
}
.table th.sortable { cursor: pointer; user-select: none; }
.table th.sortable:hover { color: var(--text); }
.table th .od-icon { vertical-align: -3px; margin-left: 2px; opacity: .6; }
.table td { padding: var(--sp-3) var(--sp-4); border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tbody tr:hover td { background: var(--surface-2); }
.table tbody tr.is-selected td { background: var(--brand-50); }
.table tbody tr:last-child td { border-bottom: 0; }
.table .num, .table .ta-r { text-align: right; }
.table .cell-strong { font-weight: 580; color: var(--text); }
.table tfoot td { padding: var(--sp-3) var(--sp-4); background: var(--surface-2); font-weight: 600; border-top: 1px solid var(--border); }
.leads-table { min-width: 1500px; }
.leads-table td { white-space: nowrap; }
.leads-table .od-stat { min-width: 168px; }
.row-link { color: var(--brand-700); font-weight: 580; text-decoration: none; cursor: pointer; background: none; border: 0; padding: 0; text-align: left; }
.row-link:hover { text-decoration: underline; }

.pagination { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3); flex-wrap: wrap; }
.pager { display: inline-flex; gap: var(--sp-1); }
.pager button {
  min-width: 30px; height: 30px; padding: 0 var(--sp-2);
  border: 1px solid var(--border-strong); background: var(--surface);
  border-radius: var(--r-sm); font-size: var(--fs-12); cursor: pointer; color: var(--text-2);
}
.pager button[aria-current="page"] { background: var(--brand-700); border-color: var(--brand-700); color: #FFFFFF; font-weight: 600; }
.pager button:disabled { opacity: .45; cursor: not-allowed; }
.pager button:not(:disabled):not([aria-current]):hover { background: var(--surface-3); }

/* ---------- 9. Estados ---------- */
.empty-state { display: grid; justify-items: center; gap: var(--sp-2); padding: var(--sp-10) var(--sp-6); text-align: center; }
.empty-state .empty-art {
  display: grid; place-items: center; width: 44px; height: 44px; border-radius: var(--r-lg);
  background: var(--surface-3); color: var(--text-4); --od-icon-size: 22px;
}
.empty-state p { max-width: 42ch; color: var(--text-3); font-size: var(--fs-13); }

.error-state {
  display: flex; gap: var(--sp-3); padding: var(--sp-4);
  background: var(--danger-50); border: 1px solid var(--danger-200); border-radius: var(--r-md);
  color: var(--danger-700); font-size: var(--fs-13);
}

.metric-na { color: var(--text-4); font-weight: 500; font-size: var(--fs-16); }

.skeleton {
  background: linear-gradient(90deg, var(--surface-3) 25%, #E8EDF2 37%, var(--surface-3) 63%);
  background-size: 400% 100%; border-radius: var(--r-sm);
  animation: skeleton 1.4s ease infinite; height: 12px;
}
@keyframes skeleton { 0% { background-position: 100% 50%; } 100% { background-position: 0 50%; } }

.spinner {
  width: 16px; height: 16px; border-radius: 50%; flex: none;
  border: 2px solid var(--brand-200); border-top-color: var(--brand-700);
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- 10. Abas ---------- */
.tabs { display: flex; gap: var(--sp-1); border-bottom: 1px solid var(--border); overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab {
  position: relative; display: inline-flex; align-items: center; gap: var(--sp-2);
  padding: var(--sp-3) var(--sp-3); border: 0; background: transparent;
  color: var(--text-3); font-size: var(--fs-13); font-weight: 540; cursor: pointer; white-space: nowrap;
}
.tab:hover { color: var(--text); }
.tab[aria-selected="true"] { color: var(--brand-700); font-weight: 600; }
.tab[aria-selected="true"]::after {
  content: ""; position: absolute; left: var(--sp-2); right: var(--sp-2); bottom: -1px; height: 2px;
  background: var(--brand-700); border-radius: 2px 2px 0 0;
}
.tab .count { font-size: var(--fs-11); color: var(--text-4); font-variant-numeric: tabular-nums; }

.segmented { display: inline-flex; padding: 3px; background: var(--surface-3); border-radius: var(--r-md); gap: 2px; }
.segmented button {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--sp-2);
  height: 28px; padding: 0 var(--sp-3); border: 0; border-radius: var(--r-sm);
  background: transparent; color: var(--text-2); font-size: var(--fs-12); font-weight: 540; cursor: pointer;
}
.segmented button[aria-pressed="true"] { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); font-weight: 600; }

/* ---------- 11. Dropdown / menu ---------- */
.dropdown { position: relative; }
.menu {
  position: absolute; z-index: 70; top: calc(100% + 6px); right: 0; min-width: 200px;
  padding: var(--sp-1); background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--r-lg); box-shadow: var(--shadow-lg);
}
.menu.menu-left { right: auto; left: 0; }
.menu-label { padding: var(--sp-2) var(--sp-3) var(--sp-1); font-size: var(--fs-11); font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--text-4); }
.menu-item {
  display: flex; align-items: center; gap: var(--sp-2); width: 100%;
  padding: var(--sp-2) var(--sp-3); border: 0; border-radius: var(--r-sm);
  background: transparent; text-align: left; font-size: var(--fs-13); color: var(--text); cursor: pointer;
}
.menu-item:hover { background: var(--surface-3); }
.menu-item.is-danger { color: var(--danger-700); }
.menu-item .od-icon { color: var(--text-3); }
.menu-item.is-active { color: var(--brand-700); font-weight: 580; }
.menu-sep { height: 1px; background: var(--border); margin: var(--sp-1) 0; }

/* ---------- 12. Modal (dialog nativo) ---------- */
dialog.modal {
  width: min(560px, calc(100vw - 32px)); max-height: calc(100vh - 64px);
  padding: 0; border: 1px solid var(--border); border-radius: var(--r-xl);
  box-shadow: var(--shadow-lg); color: var(--text); background: var(--surface);
  overflow: hidden;
}
dialog.modal[open] { animation: modal-in var(--t-base); }
dialog.modal.modal-lg { width: min(760px, calc(100vw - 32px)); }
dialog.modal::backdrop { background: rgba(15, 27, 40, .45); backdrop-filter: blur(2px); }
@keyframes modal-in { from { opacity: 0; transform: translateY(8px) scale(.99); } }
.modal-head { display: flex; align-items: flex-start; gap: var(--sp-3); padding: var(--sp-5) var(--sp-5) var(--sp-3); }
.modal-head .od-stat { flex: 1 1 auto; gap: 2px; }
.modal-body { padding: 0 var(--sp-5) var(--sp-5); max-height: 62vh; overflow-y: auto; }
.modal-foot {
  display: flex; align-items: center; justify-content: flex-end; gap: var(--sp-2);
  padding: var(--sp-4) var(--sp-5); background: var(--surface-2); border-top: 1px solid var(--border);
}

/* ---------- 13. Drawer ---------- */
.scrim {
  position: fixed; inset: 0; z-index: 80; background: rgba(15, 27, 40, .45);
  animation: fade-in var(--t-fast);
}
@keyframes fade-in { from { opacity: 0; } }
.drawer {
  position: fixed; z-index: 90; top: 0; right: 0; bottom: 0; width: min(420px, 100vw);
  display: grid; grid-template-rows: auto minmax(0, 1fr) auto;
  background: var(--surface); border-left: 1px solid var(--border); box-shadow: var(--shadow-lg);
  animation: drawer-in var(--t-base);
}
@keyframes drawer-in { from { transform: translateX(16px); opacity: .6; } }
.drawer-head { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3); padding: var(--sp-4) var(--sp-5); border-bottom: 1px solid var(--border); }
.drawer-body { overflow-y: auto; padding: var(--sp-4) var(--sp-5); }
.drawer-foot { padding: var(--sp-3) var(--sp-5); border-top: 1px solid var(--border); background: var(--surface-2); }

/* ---------- 14. Notificações (toast) ---------- */
.toast-stack {
  position: fixed; z-index: 120; right: var(--sp-5); bottom: var(--sp-5);
  display: grid; gap: var(--sp-2); width: min(360px, calc(100vw - 32px));
}
.toast {
  display: flex; align-items: flex-start; gap: var(--sp-3);
  padding: var(--sp-3) var(--sp-4); background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--r-lg); box-shadow: var(--shadow-lg);
  animation: toast-in var(--t-base);
}
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }
.toast .toast-icon { --od-icon-size: 18px; flex: none; margin-top: 1px; }
.toast-success .toast-icon { color: var(--success-600); }
.toast-danger .toast-icon { color: var(--danger-600); }
.toast-info .toast-icon { color: var(--brand-600); }
.toast-warning .toast-icon { color: var(--warning-600); }
.toast .toast-close { margin-left: auto; }

.notice {
  display: flex; gap: var(--sp-3); padding: var(--sp-3) var(--sp-4);
  border: 1px solid var(--border); border-radius: var(--r-md); background: var(--surface-2);
  font-size: var(--fs-13); color: var(--text-2);
}
.notice .od-icon { flex: none; margin-top: 2px; }
.notice-danger { background: var(--danger-50); border-color: var(--danger-200); color: var(--danger-700); }
.notice-warning { background: var(--warning-50); border-color: var(--warning-200); color: var(--warning-700); }
.notice-info { background: var(--info-50); border-color: var(--info-200); color: var(--info-700); }
.record-alert { align-items: center; }
.record-alert > .od-icon { margin-top: 0; }

/* ---------- 15. Shell da aplicação ---------- */
.app-shell {
  display: grid; grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
  height: 100vh; overflow: hidden; transition: grid-template-columns var(--t-base);
}
.app-shell.is-collapsed { grid-template-columns: var(--sidebar-w-collapsed) minmax(0, 1fr); }

.sidebar {
  display: grid; grid-template-rows: auto minmax(0, 1fr) auto;
  min-width: 0; min-height: 0; overflow: hidden;
  background: var(--surface); border-right: 1px solid var(--border);
}
.sidebar-head { display: flex; align-items: center; gap: var(--sp-2); height: var(--topbar-h); padding: 0 var(--sp-4); border-bottom: 1px solid var(--border); }
.sidebar-logo { height: 26px; width: auto; }
.app-shell.is-collapsed .sidebar-head { padding: 0 var(--sp-2); justify-content: center; }
.app-shell.is-collapsed .sidebar-logo { display: none; }
.sidebar-mark { display: none; }
.app-shell.is-collapsed .sidebar-mark { display: block; height: 26px; }

.sidebar-nav { overflow-y: auto; padding: var(--sp-3) var(--sp-2) var(--sp-4); }
.nav-group + .nav-group { margin-top: var(--sp-4); }
.nav-group-label { padding: var(--sp-1) var(--sp-3) var(--sp-2); font-size: var(--fs-11); font-weight: 600; letter-spacing: .07em; text-transform: uppercase; color: var(--text-4); }
.app-shell.is-collapsed .nav-group-label { opacity: 0; height: 10px; padding: 0; overflow: hidden; }
.nav-item {
  display: flex; align-items: center; gap: var(--sp-3); width: 100%;
  padding: 7px var(--sp-3); margin-bottom: 2px; border: 0; border-radius: var(--r-md);
  background: transparent; color: var(--text-2); font-size: var(--fs-13); font-weight: 520;
  cursor: pointer; text-align: left; white-space: nowrap;
}
.nav-item:hover { background: var(--surface-3); color: var(--text); }
.nav-item[aria-current="page"] { background: var(--brand-50); color: var(--brand-700); font-weight: 600; }
.nav-item[aria-current="page"] .od-icon { color: var(--brand-700); }
.nav-item .od-icon { color: var(--text-3); flex: none; --od-icon-size: 17px; }
.nav-item .nav-text { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.nav-item .nav-tag { font-size: 10px; font-weight: 600; color: var(--text-4); background: var(--surface-3); padding: 1px 6px; border-radius: var(--r-full); }
.nav-item .nav-count { font-size: var(--fs-11); font-weight: 600; color: var(--danger-700); background: var(--danger-50); padding: 1px 6px; border-radius: var(--r-full); }
.app-shell.is-collapsed .nav-text, .app-shell.is-collapsed .nav-tag, .app-shell.is-collapsed .nav-count { display: none; }
.app-shell.is-collapsed .nav-item { justify-content: center; padding: 9px 0; }

.sidebar-foot { padding: var(--sp-3); border-top: 1px solid var(--border); display: grid; gap: var(--sp-1); }

.main { display: grid; grid-template-rows: auto minmax(0, 1fr); min-width: 0; min-height: 0; overflow: hidden; }

.topbar {
  display: flex; align-items: center; gap: var(--sp-3);
  height: var(--topbar-h); padding: 0 var(--sp-5);
  background: var(--surface); border-bottom: 1px solid var(--border);
}
.global-search { position: relative; flex: 1 1 auto; max-width: 520px; }
.search-results {
  position: absolute; z-index: 70; top: calc(100% + 6px); left: 0; right: 0;
  max-height: 60vh; overflow-y: auto; padding: var(--sp-1);
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); box-shadow: var(--shadow-lg);
}
.search-item { display: grid; gap: 2px; width: 100%; padding: var(--sp-2) var(--sp-3); border: 0; border-radius: var(--r-sm); background: transparent; text-align: left; cursor: pointer; }
.search-item:hover, .search-item:focus-visible { background: var(--surface-3); }
.icon-btn {
  position: relative; display: inline-flex; align-items: center; justify-content: center;
  width: 36px; height: 36px; border: 1px solid transparent; border-radius: var(--r-md);
  background: transparent; color: var(--text-2); cursor: pointer; --od-icon-size: 18px;
}
.icon-btn:hover { background: var(--surface-3); color: var(--text); }
.icon-btn .dot {
  position: absolute; top: 6px; right: 6px; min-width: 15px; height: 15px; padding: 0 3px;
  border-radius: var(--r-full); background: var(--accent-600); color: #FFFFFF;
  font-size: 10px; font-weight: 700; line-height: 15px; text-align: center;
}
.avatar {
  display: grid; place-items: center; width: 32px; height: 32px; flex: none;
  border-radius: 50%; background: var(--brand-100); color: var(--brand-800);
  font-size: var(--fs-12); font-weight: 650;
}
.avatar-sm { width: 24px; height: 24px; font-size: 10px; }
.avatar-lg { width: 48px; height: 48px; font-size: var(--fs-16); }
.user-chip { display: flex; align-items: center; gap: var(--sp-2); padding: var(--sp-1) var(--sp-2); border: 0; background: transparent; border-radius: var(--r-md); cursor: pointer; }
.user-chip:hover { background: var(--surface-3); }

.view { overflow-y: auto; }
.view-inner { padding: var(--sp-5) var(--sp-6) var(--sp-10); max-width: 1680px; }
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--sp-4); flex-wrap: wrap; margin-bottom: var(--sp-4); }

/* ---------- 16. Barra de filtros ---------- */
.filterbar {
  position: sticky; top: 0; z-index: 30;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg);
  box-shadow: var(--shadow-sm); padding: var(--sp-3) var(--sp-4); margin-bottom: var(--sp-4);
  display: grid; gap: var(--sp-3);
}
.filter-row { display: flex; align-items: center; gap: var(--sp-2); flex-wrap: wrap; }
.filter-select {
  height: 32px; padding: 0 var(--sp-6) 0 var(--sp-3); font-size: var(--fs-12);
  min-height: 32px; width: auto; min-width: 132px;
}
.range-label { display: flex; align-items: center; gap: var(--sp-2); font-size: var(--fs-12); color: var(--text-3); }
.active-filters { display: flex; align-items: center; gap: var(--sp-2); flex-wrap: wrap; }

/* calendário */
.calendar { display: grid; gap: var(--sp-3); }
.cal-head { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-2); }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; }
.cal-dow { text-align: center; font-size: var(--fs-11); font-weight: 600; color: var(--text-4); padding: var(--sp-1) 0; }
.cal-day {
  display: grid; place-items: center; height: 34px; border: 0; border-radius: var(--r-sm);
  background: transparent; font-size: var(--fs-12); color: var(--text); cursor: pointer;
  font-variant-numeric: tabular-nums;
}
.cal-day:hover:not(:disabled) { background: var(--surface-3); }
.cal-day:disabled { color: var(--text-4); cursor: not-allowed; opacity: .5; }
.cal-day.is-out { color: var(--text-4); }
.cal-day.in-range { background: var(--brand-50); border-radius: 0; }
.cal-day.is-edge { background: var(--brand-700); color: #FFFFFF; font-weight: 650; }
.cal-day.is-today { box-shadow: inset 0 0 0 1px var(--brand-200); }

/* ---------- 17. KPIs ---------- */
.kpi-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--sp-3); }
.kpi {
  display: grid; gap: var(--sp-2); padding: var(--sp-4);
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg);
  box-shadow: var(--shadow-sm); text-align: left; cursor: pointer;
  transition: border-color var(--t-fast), box-shadow var(--t-fast), transform var(--t-fast);
}
.kpi:hover { border-color: var(--brand-200); box-shadow: var(--shadow-md); }
.kpi:active { transform: translateY(1px); }
.kpi-top { display: flex; align-items: center; gap: var(--sp-1); }
.kpi-top .kpi-name { font-size: var(--fs-12); font-weight: 560; color: var(--text-2); }
.kpi-name-tip { cursor: help; }
.kpi-name-tip:hover .kpi-name { color: var(--brand-700); text-decoration: underline dotted; text-underline-offset: 3px; }
.kpi-name-tip .tip-bubble { left: 0; transform: translateY(2px); }
.kpi-name-tip .tip-bubble::after { left: 18px; margin-left: 0; }
.kpi-name-tip:hover .tip-bubble, .kpi-name-tip:focus-within .tip-bubble,
.kpi:focus-visible .kpi-name-tip .tip-bubble { opacity: 1; transform: translateY(0); }
.kpi-value { font-size: var(--fs-28); font-weight: 650; letter-spacing: -.02em; line-height: 1.1; font-variant-numeric: tabular-nums; }
.kpi-foot { display: flex; align-items: center; gap: var(--sp-2); font-size: var(--fs-12); color: var(--text-3); }

/* ---------- 18. Gráficos ---------- */
.chart-area { position: relative; }
.chart-svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart-legend { display: flex; flex-wrap: wrap; gap: var(--sp-2) var(--sp-4); }
.legend-item {
  display: inline-flex; align-items: center; gap: var(--sp-2);
  border: 0; background: transparent; cursor: pointer; padding: 2px 0;
  font-size: var(--fs-12); color: var(--text-2);
}
.legend-item .swatch { width: 10px; height: 10px; border-radius: 3px; flex: none; }
.legend-item[aria-pressed="false"] { opacity: .4; text-decoration: line-through; }
.chart-tooltip {
  position: absolute; z-index: 40; pointer-events: none;
  padding: var(--sp-2) var(--sp-3); background: var(--brand-900); color: #EAF1F7;
  border-radius: var(--r-md); font-size: var(--fs-12); box-shadow: var(--shadow-md);
  transform: translate(-50%, -110%); white-space: nowrap;
}
.chart-tooltip .ct-row { display: flex; align-items: center; gap: var(--sp-2); justify-content: space-between; }
.chart-tooltip .swatch { width: 8px; height: 8px; border-radius: 2px; }

.funnel { display: grid; gap: var(--sp-2); }
.funnel-step { display: grid; gap: var(--sp-1); padding: var(--sp-2) 0; cursor: default; }
.funnel-bar-track { background: var(--surface-3); border-radius: var(--r-sm); height: 30px; position: relative; }
.funnel-bar {
  height: 100%; border-radius: var(--r-sm); background: var(--brand-600);
  display: flex; align-items: center; padding: 0 var(--sp-3); color: #FFFFFF;
  font-size: var(--fs-12); font-weight: 650; min-width: 54px;
  transition: width var(--t-base);
}
.funnel-meta { display: flex; justify-content: space-between; gap: var(--sp-3); font-size: var(--fs-12); color: var(--text-3); }
.funnel-drop { color: var(--danger-600); font-weight: 560; }

.hbar-row { display: grid; grid-template-columns: minmax(120px, 190px) minmax(0, 1fr) 76px; gap: var(--sp-3); align-items: center; padding: var(--sp-1) 0; }
.hbar-track { background: var(--surface-3); border-radius: var(--r-sm); height: 18px; }
.hbar { height: 100%; border-radius: var(--r-sm); background: var(--brand-500); transition: width var(--t-base); }

.attention-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: var(--sp-3); }
.attention-card {
  display: grid; gap: var(--sp-1); padding: var(--sp-3) var(--sp-4); text-align: left;
  background: var(--surface); border: 1px solid var(--border); border-left: 3px solid var(--border-strong);
  border-radius: var(--r-md); cursor: pointer; transition: background var(--t-fast), border-color var(--t-fast);
}
.attention-card:hover { background: var(--surface-2); }
.attention-card .ac-value { font-size: var(--fs-24); font-weight: 650; font-variant-numeric: tabular-nums; line-height: 1.1; }
.attention-card .ac-name { font-size: var(--fs-12); color: var(--text-2); }
.attention-card.is-danger { border-left-color: var(--danger-600); }
.attention-card.is-danger .ac-value { color: var(--danger-700); }
.attention-card.is-warning { border-left-color: var(--warning-600); }
.attention-card.is-warning .ac-value { color: var(--warning-700); }
.attention-card.is-info { border-left-color: var(--brand-600); }
.attention-card.is-ok .ac-value { color: var(--text); }

.report-kpis { grid-template-columns: repeat(3,minmax(0,1fr)); }
.report-kpis .kpi, .report-key { cursor: default; }
.report-bars { list-style: none; display: grid; gap: var(--sp-3); margin: 0; padding: 0; font-size: var(--fs-13); }
.report-bars .row-between { flex-wrap: wrap; row-gap: var(--sp-1); }
.report-bar { height: 7px; border-radius: var(--r-full); background: var(--surface-3); margin-top: var(--sp-1); }
.report-bar > span { display: block; height: 100%; border-radius: inherit; background: var(--brand-600); }

.dash-grid-2 { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr); gap: var(--sp-4); }
.dash-grid-3 { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: var(--sp-4); }

/* ---------- 19. Pipeline ---------- */
.view-inner:has(> .kanban) {
  display: flex; flex-direction: column; height: 100%; max-width: none; padding-bottom: var(--sp-2);
}
.view-inner:has(> .kanban) > :not(.kanban) { flex: none; }
.kanban {
  flex: 1 0 140px; min-width: 0; display: flex; align-items: stretch; gap: var(--sp-3);
  overflow-x: auto; overflow-y: hidden; padding-bottom: var(--sp-1);
}
.kanban-col {
  flex: 0 0 min(288px, 100%); min-width: 0; display: grid; grid-template-rows: auto minmax(0, 1fr) auto;
  background: var(--surface-3); border: 1px solid var(--border); border-radius: var(--r-lg);
}
.kanban-col.is-over { border-color: var(--brand-500); box-shadow: 0 0 0 3px var(--brand-100); }
.kanban-head { padding: var(--sp-3) var(--sp-3) var(--sp-2); display: grid; gap: 2px; }
.kanban-head .kh-top { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-2); }
.kanban-head .kh-name { font-size: var(--fs-13); font-weight: 620; overflow-wrap: anywhere; }
.kanban-head .kh-link { padding: 0; border: 0; background: transparent; color: var(--text); text-align: left; cursor: pointer; }
.kanban-head .kh-link:hover { color: var(--brand-700); text-decoration: underline; text-underline-offset: 3px; }
.kanban-head .kh-link:focus-visible { outline: 2px solid var(--brand-200); outline-offset: 2px; border-radius: 2px; }
.kanban-head .kh-count { font-size: var(--fs-11); font-weight: 650; color: var(--text-2); background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-full); padding: 1px 7px; }
.kanban-head .kh-value { font-size: var(--fs-12); color: var(--text-3); font-variant-numeric: tabular-nums; }
.kanban-list {
  overflow-x: hidden; overflow-y: auto; display: grid; grid-template-columns: minmax(0, 1fr);
  gap: var(--sp-2); align-content: start; padding: var(--sp-1) var(--sp-3) var(--sp-3);
}
.kanban-foot { padding: 0 var(--sp-3) var(--sp-3); }

.opp-card {
  display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--sp-2); padding: var(--sp-3); text-align: left;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-md);
  box-shadow: var(--shadow-sm); cursor: grab; transition: box-shadow var(--t-fast), border-color var(--t-fast);
}
.opp-card:hover { border-color: var(--brand-200); box-shadow: var(--shadow-md); }
.opp-card.is-dragging { opacity: .45; cursor: grabbing; }
.opp-card .oc-top { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--sp-2); }
.opp-card .oc-name { font-size: var(--fs-13); font-weight: 600; }
.opp-card .oc-meta { display: flex; flex-wrap: wrap; gap: var(--sp-1) var(--sp-2); font-size: var(--fs-11); color: var(--text-3); }
.opp-card .oc-meta > * { min-width: 0; white-space: normal; overflow-wrap: anywhere; }
.opp-card .row-between { flex-wrap: wrap; gap: var(--sp-2); }
.opp-card .oc-value { font-size: var(--fs-13); font-weight: 650; font-variant-numeric: tabular-nums; }
.opp-card .oc-foot { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-2); padding-top: var(--sp-2); border-top: 1px dashed var(--border); font-size: var(--fs-11); color: var(--text-3); }
.opp-card .oc-foot .num { flex: none; }

/* ---------- 20. Ficha do lead ---------- */
.record-head {
  display: grid; gap: var(--sp-4); padding: var(--sp-5);
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); box-shadow: var(--shadow-sm);
}
.record-id { display: flex; align-items: flex-start; gap: var(--sp-4); flex-wrap: wrap; }
.record-facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: var(--sp-3) var(--sp-5); }
.fact { display: grid; gap: 2px; min-width: 0; }
.fact > dt { font-size: var(--fs-11); font-weight: 600; letter-spacing: .05em; text-transform: uppercase; color: var(--text-4); }
.fact > dd { margin: 0; font-size: var(--fs-13); color: var(--text); overflow-wrap: anywhere; }
.quick-actions { display: flex; flex-wrap: wrap; gap: var(--sp-2); }

.timeline { display: grid; gap: 0; position: relative; }
.tl-item { display: grid; grid-template-columns: 28px minmax(0, 1fr); gap: var(--sp-3); padding-bottom: var(--sp-4); position: relative; }
.tl-item::before { content: ""; position: absolute; left: 13px; top: 24px; bottom: 0; width: 1px; background: var(--border); }
.tl-item:last-child { padding-bottom: 0; }
.tl-item:last-child::before { display: none; }
.tl-dot {
  display: grid; place-items: center; flex: none; width: 28px; height: 28px; border-radius: 50%;
  background: var(--surface-3); color: var(--text-2); border: 1px solid var(--border); --od-icon-size: 14px;
}
.tl-dot.is-success { background: var(--success-50); color: var(--success-700); border-color: var(--success-200); }
.tl-dot.is-info { background: var(--info-50); color: var(--info-700); border-color: var(--info-200); }
.tl-dot.is-warning { background: var(--warning-50); color: var(--warning-700); border-color: var(--warning-200); }
.tl-dot.is-danger { background: var(--danger-50); color: var(--danger-700); border-color: var(--danger-200); }
.tl-body { display: grid; gap: 2px; padding-top: 3px; }
.tl-when { font-size: var(--fs-11); color: var(--text-4); font-variant-numeric: tabular-nums; }

.stack-list { display: grid; gap: var(--sp-2); }
.list-row {
  display: flex; align-items: center; gap: var(--sp-3); padding: var(--sp-3);
  border: 1px solid var(--border); border-radius: var(--r-md); background: var(--surface);
}
.list-row.is-overdue { border-left: 3px solid var(--danger-600); }
.list-row.is-today { border-left: 3px solid var(--warning-600); }
.list-row.is-done { opacity: .7; }

/* ---------- 21. Equipe, usuários e perfil ---------- */
.team-summary {
  display: flex; align-items: center; gap: var(--sp-4); flex-wrap: wrap;
  padding: 0 var(--sp-1) var(--sp-3); color: var(--text-3); font-size: var(--fs-12);
}
.team-summary span { display: inline-flex; align-items: baseline; gap: var(--sp-1); }
.team-summary strong { color: var(--text); font-size: var(--fs-14); font-variant-numeric: tabular-nums; }
.team-filters { position: static; }
.team-search { flex: 1 1 320px; max-width: 560px; }
.team-search > .od-icon { position: absolute; z-index: 1; left: 10px; top: 50%; transform: translateY(-50%); color: var(--text-4); }
.team-search > .input { padding-left: 34px; }
.users-table { min-width: 1080px; }
.users-table td { white-space: nowrap; }
.user-main { display: flex; align-items: center; gap: var(--sp-3); min-width: 220px; }
.form-grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--sp-3); }
.access-preview { display: grid; gap: var(--sp-3); padding: var(--sp-3); background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--r-md); }
.permission-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--sp-2) var(--sp-4); }
.permission-item { display: flex; align-items: flex-start; gap: var(--sp-2); min-width: 0; color: var(--text-2); font-size: var(--fs-12); line-height: 1.45; }
.permission-item .od-icon { flex: none; margin-top: 1px; color: var(--success-600); }
.profile-hero { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-5); padding: var(--sp-5); }
.profile-identity { display: flex; align-items: center; gap: var(--sp-4); min-width: 0; }
.profile-avatar { width: 72px; height: 72px; font-size: var(--fs-24); background: var(--brand-800); color: #FFFFFF; }
.profile-photo-action { width: fit-content; margin-top: var(--sp-1); }
.profile-access-state { align-items: flex-end; text-align: right; }
.profile-grid { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(320px, .65fr); gap: var(--sp-4); align-items: start; }

/* ---------- 22. Login ---------- */
.login {
  min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr);
  background: var(--surface);
}
.login-form-side { display: grid; place-items: center; padding: var(--sp-8) var(--sp-6); }
.login-card { width: min(380px, 100%); display: grid; gap: var(--sp-5); }
.login-brand { height: 34px; width: auto; }
.login-aside {
  position: relative; overflow: hidden; background: var(--brand-900);
}
.login-photo { display: block; width: 100%; height: 100%; object-fit: cover; object-position: center; }

/* ---------- 23. Utilidades ---------- */
.stack { display: grid; }
.gap-1 { gap: var(--sp-1); } .gap-2 { gap: var(--sp-2); } .gap-3 { gap: var(--sp-3); }
.gap-4 { gap: var(--sp-4); } .gap-5 { gap: var(--sp-5); } .gap-6 { gap: var(--sp-6); }
.mt-2 { margin-top: var(--sp-2); } .mt-3 { margin-top: var(--sp-3); } .mt-4 { margin-top: var(--sp-4); }
.mt-5 { margin-top: var(--sp-5); } .mt-6 { margin-top: var(--sp-6); }
.mb-2 { margin-bottom: var(--sp-2); } .mb-3 { margin-bottom: var(--sp-3); } .mb-4 { margin-bottom: var(--sp-4); }
.row { display: flex; align-items: center; gap: var(--sp-2); }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3); }
.wrap { flex-wrap: wrap; }
.grow { flex: 1 1 auto; min-width: 0; }
.ta-r { text-align: right; }
.demo-flag {
  display: inline-flex; align-items: center; gap: var(--sp-1); padding: 2px var(--sp-2);
  border: 1px dashed var(--border-strong); border-radius: var(--r-full);
  font-size: var(--fs-11); color: var(--text-3); background: var(--surface-2);
}

/* ---------- 24. Responsivo ---------- */
.module-filterbar { position: static; }
.module-summary {
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: var(--sp-3); margin-bottom: var(--sp-4);
}
.module-summary > span, .module-summary > button {
  display: grid; gap: 3px; min-width: 0; padding: var(--sp-3) var(--sp-4);
  border: 1px solid var(--border); border-radius: var(--r-md);
  background: var(--surface); color: var(--text); text-align: left;
}
.module-summary > button { cursor: pointer; }
.module-summary > button:hover { border-color: var(--brand-200); background: var(--brand-50); }
.module-summary strong { overflow-wrap: anywhere; font-size: var(--fs-20); line-height: 1.2; font-variant-numeric: tabular-nums; }
.module-summary span span, .module-summary button span { font-size: var(--fs-12); color: var(--text-3); }
.module-table { min-width: 920px; }
.module-table td { vertical-align: middle; }
.activity-row { display: grid; grid-template-columns: 86px minmax(220px, 1fr) 120px auto; }
.activity-date { min-width: 0; }
.activity-status { align-items: flex-start; }
.activity-actions { justify-content: flex-end; }
.week-board {
  display: grid; grid-template-columns: repeat(7, minmax(138px, 1fr));
  gap: var(--sp-2); overflow-x: auto; padding-bottom: var(--sp-2);
}
.week-day { min-width: 138px; min-height: 390px; border: 1px solid var(--border); border-radius: var(--r-md); background: var(--surface); }
.week-day > header { display: flex; align-items: center; justify-content: space-between; padding: var(--sp-3); border-bottom: 1px solid var(--border); color: var(--text-3); text-transform: capitalize; }
.week-day.is-today > header { background: var(--brand-50); color: var(--brand-800); }
.week-day > div { display: grid; gap: var(--sp-2); padding: var(--sp-2); align-content: start; }
.mini-activity { display: grid; gap: 2px; width: 100%; padding: var(--sp-2); border: 1px solid var(--border); border-left: 3px solid var(--brand-500); border-radius: var(--r-sm); background: var(--surface-2); color: var(--text); text-align: left; cursor: pointer; }
.mini-activity:hover { border-color: var(--brand-300); }
.mini-activity.is-overdue { border-left-color: var(--danger-600); }
.mini-activity span, .mini-activity small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mini-activity small { color: var(--text-3); }
.week-empty { padding: var(--sp-4) var(--sp-2); color: var(--text-4); font-size: var(--fs-11); text-align: center; }
.notification-list { display: grid; }
.notification-item { display: flex; align-items: center; gap: var(--sp-3); padding: var(--sp-4); border-bottom: 1px solid var(--border); }
.notification-item:last-child { border-bottom: 0; }
.notification-item.is-read { background: var(--surface-2); opacity: .78; }
.notification-main { display: grid; gap: 3px; flex: 1 1 auto; min-width: 0; border: 0; background: transparent; color: var(--text); text-align: left; cursor: pointer; }
.notification-main:hover strong { color: var(--brand-700); }
.notification-main span { color: var(--text-2); font-size: var(--fs-13); overflow-wrap: anywhere; }
.notification-main small { color: var(--text-4); }
.compact-field { min-width: 190px; }
.compact-field label { font-size: var(--fs-11); }
.settings-layout { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--sp-4); align-items: start; }
.settings-layout > :last-child { grid-column: 1 / -1; }
.check-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--sp-2); }
.config-list { display: grid; gap: var(--sp-2); }
.config-list > span, .config-list > label {
  display: flex; align-items: center; gap: var(--sp-3); min-width: 0;
  padding: var(--sp-3); border: 1px solid var(--border); border-radius: var(--r-md); background: var(--surface-2);
}
.config-list > label { cursor: pointer; }
.config-list > label input { width: 18px; height: 18px; flex: none; }
.integration-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--sp-4); }
.integration-card { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: var(--sp-4); padding: var(--sp-5); align-items: start; }
.integration-card > .btn, .integration-card > .integration-facts { grid-column: 1 / -1; }
.integration-icon { display: grid; place-items: center; width: 44px; height: 44px; border-radius: var(--r-md); background: var(--brand-50); color: var(--brand-700); --od-icon-size: 22px; }
.integration-facts, .integration-detail { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--sp-3); margin: 0; }
.integration-facts > div { display: grid; gap: 2px; padding: var(--sp-3); border-radius: var(--r-sm); background: var(--surface-2); }
.integration-facts dt { color: var(--text-4); font-size: var(--fs-11); }
.integration-facts dd { margin: 0; color: var(--text); font-size: var(--fs-13); font-weight: 600; }
.integration-detail { grid-template-columns: repeat(3, minmax(0, 1fr)); padding: var(--sp-3); border: 1px solid var(--border); border-radius: var(--r-md); }

@media (max-width: 1440px) {
  .view-inner { padding: var(--sp-5); }
}
@media (max-width: 1280px) {
  .kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .attention-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .dash-grid-2, .dash-grid-3 { grid-template-columns: minmax(0, 1fr); }
  .activity-row { grid-template-columns: 78px minmax(200px, 1fr) auto; }
  .activity-actions { grid-column: 2 / -1; justify-content: flex-start; }
}
@media (max-width: 1024px) {
  .app-shell { grid-template-columns: var(--sidebar-w-collapsed) minmax(0, 1fr); }
  .login { grid-template-columns: minmax(0, 1fr); }
  .login-aside { display: none; }
  .profile-grid { grid-template-columns: minmax(0, 1fr); }
  .module-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .settings-layout, .integration-grid { grid-template-columns: minmax(0, 1fr); }
  .settings-layout > :last-child { grid-column: auto; }
}
@media (max-width: 860px) {
  .attention-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .topbar { padding: 0 var(--sp-3); }
  .view-inner { padding: var(--sp-4) var(--sp-3) var(--sp-10); }
}
@media (max-width: 600px) {
  .kpi-grid, .attention-grid { grid-template-columns: minmax(0, 1fr); }
  .record-facts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .form-grid-2, .permission-list { grid-template-columns: minmax(0, 1fr); }
  .profile-hero, .profile-identity { align-items: flex-start; }
  .profile-hero { flex-direction: column; }
  .profile-access-state { align-items: flex-start; text-align: left; }
  .module-summary { grid-template-columns: minmax(0, 1fr); }
  .activity-row { grid-template-columns: 68px minmax(0, 1fr); align-items: start; }
  .activity-status { grid-column: 2; }
  .activity-actions { grid-column: 1 / -1; }
  .notification-item { display: grid; grid-template-columns: 28px minmax(0, 1fr); align-items: start; }
  .notification-item > :last-child { grid-column: 2; justify-self: start; }
  .check-grid, .integration-facts, .integration-detail { grid-template-columns: minmax(0, 1fr); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
