/* Base legada do app (antigo styles.css), parte 04 (#533) · Comercial Rico e página Design System. Ordem de carga: scripts/helpers/styles-source.js. */

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgb(var(--mix-fx-paper, 255 255 255));
  color: var(--ink);
  padding: 10px 11px;
  outline: none;
}

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

input:focus,
select:focus,
textarea:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.help {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}

/* Comercial Rico */
.crm-pipeline-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-soft);
}

.crm-pipeline-segment {
  display: inline-flex;
  gap: 3px;
  padding: 3px;
  background: var(--surface-2);
  border-radius: 10px;
}

.crm-pipeline-segment button {
  border: 0;
  border-radius: 7px;
  padding: 8px 11px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font: inherit;
  font-size: 13px;
  font-weight: 750;
}

.crm-pipeline-segment button:hover { color: var(--text); }

.crm-pipeline-segment button.active {
  background: var(--surface);
  color: var(--blue);
  box-shadow: 0 1px 4px rgba(15, 23, 42, .14);
}

.crm-pipeline-kanban {
  grid-template-columns: repeat(auto-fit, minmax(270px, 1fr));
  align-items: start;
}

.crm-pipeline-kanban > article {
  border-top: 3px solid var(--blue);
  min-height: 180px;
}

@media (max-width: 720px) {
  .crm-pipeline-toolbar { align-items: stretch; flex-direction: column; }
  .crm-pipeline-segment { width: 100%; overflow-x: auto; }
  .crm-pipeline-segment button { white-space: nowrap; }
}

.comercial-page-head,
.comercial-panel,
.comercial-kpi-card,
.comercial-app-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-soft);
}

.comercial-page-head span,
.comercial-app-card span,
.comercial-kpi-card span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

.comercial-page-head h2,
.comercial-app-card h3,
.comercial-panel h3 {
  margin: 7px 0 0;
}

.comercial-page-head p,
.comercial-app-card p {
  margin: 8px 0 0;
  color: var(--muted);
  line-height: 1.5;
}

.comercial-app-card,
.comercial-kpi-card,
.comercial-panel {
  padding: 18px;
}

.comercial-app-card {
  display: grid;
  gap: 12px;
  align-content: start;
}

.comercial-kpi-card strong {
  display: block;
  margin-top: 8px;
  font-size: 26px;
}

.comercial-kpi-card small {
  display: block;
  margin-top: 6px;
  font-weight: 800;
}

.comercial-kpi-card .ok { color: var(--green); }
.comercial-kpi-card .warn { color: var(--amber); }
.comercial-kpi-card .danger { color: var(--red); }

/* Design System */
.design-system-page {
  display: grid;
  gap: 18px;
}

.ds-hero,
.ds-section,
.ds-token,
.ds-type-grid article,
.ds-architecture-card,
.ds-note {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-soft);
}

.ds-hero {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 20px;
  padding: 24px;
}

.ds-hero span,
.ds-token small,
.ds-type-grid span,
.ds-status span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

.ds-hero h2 {
  margin: 6px 0 0;
  font-size: 34px;
  line-height: 1.05;
}

.ds-hero p,
.ds-note p,
.ds-architecture-card p,
.ds-type-grid p {
  color: var(--muted);
  line-height: 1.55;
}

.ds-hero p {
  max-width: 720px;
  margin: 10px 0 0;
}

.ds-status {
  min-width: 116px;
  padding: 14px;
  text-align: right;
  background: var(--surface-2);
  border-radius: var(--radius);
}

.ds-status strong {
  display: block;
  font-size: 24px;
}

.ds-section {
  padding: 20px;
}

.ds-token-grid,
.ds-component-grid,
.ds-architecture-grid,
.ds-type-grid {
  display: grid;
  gap: 14px;
}

.ds-token-grid {
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
}

.ds-token {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px;
}

.ds-swatch,
.ds-radius-sample,
.ds-shadow-sample {
  width: 42px;
  height: 42px;
  flex: 0 0 auto;
  border: 1px solid var(--line);
}

.ds-swatch {
  border-radius: 999px;
}

.ds-radius-sample {
  border-radius: var(--radius);
  background: var(--surface-2);
}

.ds-shadow-sample {
  border-radius: var(--radius);
  background: rgb(var(--mix-fx-paper, 255 255 255));
  box-shadow: var(--shadow-soft);
}

.ds-token strong {
  display: block;
}

.ds-type-grid {
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.ds-type-grid article {
  padding: 18px;
}

.ds-type-grid h1,
.ds-type-grid h2,
.ds-type-grid h3,
.ds-type-grid p {
  margin: 8px 0;
}

.ds-type-grid code {
  display: inline-block;
  padding: 4px 7px;
  border-radius: 6px;
  background: var(--surface-2);
  color: var(--muted);
  font-size: 12px;
}

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

.section-head.compact {
  margin-bottom: 14px;
}

.section-head.compact h2 {
  font-size: 18px;
}

.ds-inline {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.ds-architecture-grid {
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.ds-architecture-card {
  padding: 16px;
}

.ds-architecture-card p {
  margin: 8px 0 0;
}

.ds-note {
  margin-top: 14px;
  padding: 18px;
  border-color: rgba(31, 111, 235, 0.24);
  background: rgb(var(--mix-fx-paper, 248 251 255));
}

.ds-note p {
  margin: 8px 0 0;
}

@media (max-width: 920px) {
  .ds-hero,
  .ds-component-grid {
    grid-template-columns: 1fr;
  }

  .ds-hero {
    display: grid;
  }

  .ds-status {
    text-align: left;
  }
}

.design-system-page {
  --ds-bg: #090909;
  --ds-panel: rgb(var(--mix-fx-paper, 255 255 255) / 10.5%);
  --ds-panel-strong: rgb(var(--mix-fx-paper, 255 255 255) / 16%);
  --ds-border: rgb(var(--mix-fx-line, 255 255 255) / 28%);
  --ds-border-soft: rgb(var(--mix-fx-line, 255 255 255) / 16%);
  --ds-text: #f6f2ea;
  --ds-muted: rgba(246, 242, 234, 0.68);
  --ds-orange: #ff6418;
  --ds-blue: #67c7ff;
  --ds-green: #66dd8f;
  --ds-pink: #ffb1bd;
  position: relative;
  margin: -12px;
  padding: 22px;
  min-height: calc(100vh - 160px);
  color: var(--ds-text);
  overflow: hidden;
  border-radius: 18px;
  background:
    linear-gradient(118deg, rgba(25, 29, 34, 0.94), rgba(73, 45, 50, 0.82) 34%, rgba(77, 88, 64, 0.78) 62%, rgba(103, 55, 31, 0.86)),
    linear-gradient(180deg, #111, #0a0a0a);
}

.design-system-page::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    repeating-linear-gradient(90deg, rgb(var(--mix-fx-paper, 255 255 255) / 3.5%) 0 1px, transparent 1px 24px),
    linear-gradient(180deg, rgba(0, 0, 0, 0.18), rgba(0, 0, 0, 0.44));
  pointer-events: none;
}

.design-system-page > * {
  position: relative;
  z-index: 1;
}

.design-system-page .ds-hero,
.design-system-page .ds-section,
.design-system-page .ds-token,
.design-system-page .ds-type-grid article,
.design-system-page .ds-architecture-card,
.design-system-page .ds-note,
.design-system-page .report-card,
.design-system-page input,
.design-system-page select,
.design-system-page textarea,
.design-system-page .metric-card,
.design-system-page .status-pill {
  color: var(--ds-text);
  background: var(--ds-panel);
  border: 1px solid var(--ds-border);
  box-shadow: inset 0 1px 0 rgb(var(--mix-fx-paper, 255 255 255) / 8%), 0 18px 48px rgba(0, 0, 0, 0.22);
  backdrop-filter: blur(18px);
}

.design-system-page .ds-hero,
.design-system-page .ds-section,
.design-system-page .report-card {
  border-radius: 20px;
}

.design-system-page .ds-hero {
  min-height: 210px;
  align-items: center;
}

.design-system-page .ds-hero h2 {
  font-size: clamp(42px, 7vw, 88px);
  font-weight: 500;
  letter-spacing: 0;
}

.design-system-page .ds-hero span,
.design-system-page .ds-token small,
.design-system-page .ds-type-grid span,
.design-system-page .ds-status span,
.design-system-page .section-head p,
.design-system-page .ds-architecture-card p,
.design-system-page .ds-note p,
.design-system-page .help {
  color: var(--ds-muted);
}

.design-system-page .ds-status,
.design-system-page .ds-type-grid code,
.design-system-page .ds-radius-sample,
.design-system-page .ds-shadow-sample {
  background: var(--ds-panel-strong);
  border: 1px solid var(--ds-border-soft);
}

.design-system-page .btn {
  background: var(--ds-orange);
  border-color: rgba(255, 100, 24, 0.82);
  color: #fff;
  box-shadow: 0 14px 30px rgba(255, 100, 24, 0.24);
}

.design-system-page .btn.secondary {
  background: rgb(var(--mix-fx-paper, 255 255 255) / 8%);
  border-color: var(--ds-border);
  color: var(--ds-text);
  box-shadow: none;
}

.design-system-page input,
.design-system-page select,
.design-system-page textarea {
  background-color: rgba(0, 0, 0, 0.12);
}

.design-system-page .field label,
.design-system-page table th,
.design-system-page .cr-page-head span {
  color: var(--ds-muted);
}

.design-system-page table td,
.design-system-page table th {
  border-color: var(--ds-border-soft);
}

.design-system-page .metric-card.blue {
  background: linear-gradient(135deg, rgba(103, 199, 255, 0.22), rgb(var(--mix-fx-paper, 255 255 255) / 8%));
}

.design-system-page .metric-card.mint {
  background: linear-gradient(135deg, rgba(102, 221, 143, 0.22), rgb(var(--mix-fx-paper, 255 255 255) / 8%));
}

.design-system-page .metric-card.amber {
  background: linear-gradient(135deg, rgba(255, 100, 24, 0.24), rgb(var(--mix-fx-paper, 255 255 255) / 8%));
}
