:root {
  color-scheme: light;
  --bg: #f8f8f9;
  --surface: #ffffff;
  --surface-soft: #f3f0f1;
  --surface-raised: #ffffff;
  --ink: #181818;
  --muted: #696165;
  --line: #eadcdf;
  --brand: #c1121f;
  --brand-strong: #8f0d17;
  --accent: #e5383b;
  --ok: #177245;
  --warn: #b42318;
  --info: #1d5d88;
  --attention: #9a6700;
  --neutral: #667085;
  --chart-blue: #2667a7;
  --chart-teal: #168078;
  --chart-amber: #bf812d;
  --chart-red: #c1121f;
  --chart-gray: #77808d;
  --shadow: 0 10px 28px rgba(45, 18, 22, 0.08);
}

html {
  scrollbar-gutter: stable;
}

body[data-theme="dark"] {
  color-scheme: dark;
  --bg: #070707;
  --surface: #111111;
  --surface-soft: #1b1718;
  --surface-raised: #151515;
  --ink: #f7f4f4;
  --muted: #b9b0b2;
  --line: #332024;
  --brand: #ff3347;
  --brand-strong: #ff6b78;
  --accent: #d90429;
  --ok: #43c17a;
  --warn: #ff6b6b;
  --info: #6eb5e8;
  --attention: #f1c75b;
  --neutral: #aaa2a5;
  --chart-blue: #6eb5e8;
  --chart-teal: #53c5b8;
  --chart-amber: #f1c75b;
  --chart-red: #ff5a6b;
  --chart-gray: #aaa2a5;
  --shadow: 0 16px 38px rgba(0, 0, 0, 0.28);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family: Inter, "Segoe UI", Arial, sans-serif;
  line-height: 1.4;
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
  transition: background-color 140ms ease, border-color 140ms ease, color 140ms ease, box-shadow 140ms ease;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.58;
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--brand) 24%, transparent);
  outline-offset: 2px;
}

input[type="checkbox"] {
  accent-color: var(--brand);
}

.shell {
  width: min(1440px, calc(100% - 32px));
  margin: 0 auto;
  padding: 24px 0 44px;
  min-width: 0;
}

.app,
.view,
.panel,
.metric-card,
.dashboard-grid > *,
.indicators-chart-grid > *,
.process-layout > *,
.access-layout > *,
.integration-grid > * {
  min-width: 0;
}

.auth-panel {
  min-height: calc(100vh - 68px);
  display: grid;
  grid-template-columns: minmax(0, 1fr) 420px;
  align-items: center;
  gap: 44px;
}

.auth-copy h1,
.app-header h1 {
  margin: 6px 0 0;
  line-height: 1;
  letter-spacing: 0;
}

.auth-copy h1 {
  font-size: 3.25rem;
}

.app-header h1 {
  font-size: 2rem;
}

.auth-copy .muted {
  max-width: 560px;
  font-size: 1.05rem;
}

.auth-card,
.panel,
.metric-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.auth-card {
  padding: 24px;
}

.auth-tabs,
.theme-switch,
.app-tabs {
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.auth-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  margin-bottom: 20px;
  padding: 4px;
}

.tab,
.ghost,
.primary,
.small-action,
.theme-switch button,
.app-tabs button {
  border: 0;
  border-radius: 6px;
  min-height: 40px;
}

.tab,
.theme-switch button,
.app-tabs button {
  background: transparent;
  color: var(--muted);
}

.tab.active,
.theme-switch button.active,
.app-tabs button.active {
  background: var(--surface);
  color: var(--brand-strong);
  box-shadow: 0 4px 14px rgba(20, 35, 48, 0.1);
}

body[data-theme="dark"] .tab.active,
body[data-theme="dark"] .theme-switch button.active,
body[data-theme="dark"] .app-tabs button.active {
  color: var(--ink);
}

.field {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 0.85rem;
}

.field input,
.field select,
.field textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface-raised);
  color: var(--ink);
  padding: 0 12px;
}

.field input,
.field select {
  min-height: 44px;
}

.field textarea {
  min-height: 96px;
  padding: 12px;
  resize: vertical;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
  outline: 3px solid color-mix(in srgb, var(--brand) 20%, transparent);
  border-color: var(--brand);
}

.auth-card .field + .field,
.primary,
.form-message {
  margin-top: 14px;
}

.primary {
  width: 100%;
  background: var(--brand);
  color: #fff;
  font-weight: 750;
}

body[data-theme="dark"] .primary {
  color: #0b0b0b;
}

.primary.inline {
  width: auto;
  padding: 0 18px;
}

.ghost {
  padding: 0 14px;
  background: var(--surface-soft);
  color: var(--brand-strong);
}

.ghost:hover,
.theme-switch button:hover,
.app-tabs button:hover {
  background: color-mix(in srgb, var(--brand) 9%, var(--surface-soft));
  color: var(--brand-strong);
}

.ghost.inline-gap {
  margin-top: 12px;
  width: fit-content;
}

.small-action {
  padding: 0 10px;
  background: var(--brand);
  color: #fff;
  white-space: nowrap;
}

body[data-theme="dark"] .small-action {
  color: #0b0b0b;
}

.small-action.remove {
  background: rgba(184, 76, 67, 0.12);
  color: var(--warn);
}

.form-message,
.empty-state,
.muted {
  color: var(--muted);
}

.form-message {
  min-height: 22px;
}

.app-header,
.header-actions,
.user-chip,
.panel-heading,
.saved-row,
.saved-main,
.saved-meta {
  display: flex;
  align-items: center;
}

.app-header {
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 16px;
}

.header-actions {
  justify-content: flex-end;
  gap: 12px;
  flex-wrap: wrap;
}

.theme-switch {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  padding: 4px;
}

.theme-switch button {
  padding: 0 12px;
}

.user-chip {
  gap: 12px;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.user-chip span {
  padding-left: 8px;
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.app-tabs {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 4px;
  margin-bottom: 18px;
  padding: 4px;
  position: sticky;
  top: 0;
  z-index: 5;
  box-shadow: 0 8px 18px color-mix(in srgb, var(--bg) 82%, transparent);
}

.app-tabs button {
  min-height: 44px;
  font-weight: 700;
}

.eyebrow {
  margin: 0;
  color: var(--accent);
  font-size: 0.74rem;
  font-weight: 850;
  letter-spacing: 0;
  text-transform: uppercase;
}

.view {
  display: none;
}

.view.active {
  display: grid;
  gap: 18px;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

.metric-grid > *,
.dashboard-grid > *,
.dashboard-custom-grid > *,
.indicators-chart-grid > * {
  height: 100%;
}

.metric-card {
  padding: 18px;
  min-height: 106px;
  display: grid;
  align-content: space-between;
  border-top: 3px solid color-mix(in srgb, var(--brand) 52%, transparent);
}

.metric-card span {
  color: var(--muted);
}

.metric-card strong {
  font-size: 2.15rem;
  line-height: 1;
}

.metric-card.alert strong {
  color: var(--warn);
}

.dashboard-grid,
.contact-grid,
.integration-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.indicator-heading h2,
.indicator-section-heading h2 {
  margin: 4px 0 3px;
  font-size: 1.25rem;
  letter-spacing: 0;
}

.indicator-filter-panel {
  display: grid;
  gap: 14px;
}

.period-segmented {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(130px, 1fr);
  width: fit-content;
  max-width: 100%;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
}

.period-segmented button {
  min-height: 38px;
  padding: 0 14px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font-weight: 750;
  white-space: nowrap;
}

.period-segmented button.active {
  background: var(--surface);
  color: var(--brand-strong);
  box-shadow: 0 3px 10px rgba(45, 18, 22, 0.1);
}

.indicator-filter-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(170px, 1fr)) auto;
  gap: 12px;
  align-items: end;
}

.indicator-refresh {
  min-height: 44px;
}

.indicator-filter-note {
  margin: 0;
  color: var(--muted);
  font-size: 0.82rem;
}

.indicator-metric-grid .metric-card:nth-child(3) strong {
  color: var(--ok);
}

.indicator-sla-section {
  display: grid;
  gap: 14px;
  padding: 4px 0;
}

.indicator-section-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 18px;
}

.indicator-section-heading > .muted {
  max-width: 430px;
  text-align: right;
  font-size: 0.82rem;
}

.indicator-sla-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

.sla-card {
  min-width: 0;
  min-height: 196px;
  padding: 16px;
  border: 1px solid var(--line);
  border-top: 3px solid var(--neutral);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.sla-card.good {
  border-top-color: var(--ok);
}

.sla-card.attention {
  border-top-color: var(--attention);
}

.sla-card.critical {
  border-top-color: var(--warn);
}

.sla-card.unavailable {
  opacity: 0.72;
}

.sla-title-row,
.sla-result-row,
.sla-meta-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.sla-title-row h3 {
  margin: 0;
  font-size: 0.94rem;
  line-height: 1.3;
}

.sla-limit {
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 750;
}

.sla-route {
  min-height: 34px;
  margin: 8px 0 16px;
  color: var(--muted);
  font-size: 0.76rem;
  line-height: 1.35;
}

.sla-result-row strong {
  font-size: 1.8rem;
  line-height: 1;
}

.sla-result-row span,
.sla-meta-row {
  color: var(--muted);
  font-size: 0.76rem;
}

.sla-progress {
  display: block;
  width: 100%;
  height: 7px;
  margin: 12px 0 10px;
  overflow: hidden;
  border: 0;
  border-radius: 4px;
  appearance: none;
  background: var(--surface-soft);
}

.sla-progress::-webkit-progress-bar {
  border-radius: 4px;
  background: var(--surface-soft);
}

.sla-progress::-webkit-progress-value {
  border-radius: 4px;
  background: var(--neutral);
}

.sla-progress::-moz-progress-bar {
  border-radius: 4px;
  background: var(--neutral);
}

.sla-card.good .sla-progress::-webkit-progress-value {
  background: var(--ok);
}

.sla-card.good .sla-progress::-moz-progress-bar {
  background: var(--ok);
}

.sla-card.attention .sla-progress::-webkit-progress-value {
  background: var(--attention);
}

.sla-card.attention .sla-progress::-moz-progress-bar {
  background: var(--attention);
}

.sla-card.critical .sla-progress::-webkit-progress-value {
  background: var(--warn);
}

.sla-card.critical .sla-progress::-moz-progress-bar {
  background: var(--warn);
}

.indicators-chart-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.indicator-chart-card {
  min-height: 355px;
}

.indicator-chart-card.wide {
  grid-column: 1 / -1;
}

.indicator-chart-card canvas {
  height: 275px;
}

.indicator-chart-card.wide canvas {
  height: 300px;
}

.indicator-empty {
  margin: 0;
  padding: 14px;
  border-left: 3px solid var(--attention);
  background: color-mix(in srgb, var(--attention) 8%, transparent);
}

.panel {
  padding: 18px;
  overflow: hidden;
}

.panel-heading {
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 16px;
}

.panel-heading > div,
.process-hero > div,
.indicator-section-heading > div {
  min-width: 0;
}

.panel-heading h2,
.quiet-panel h2 {
  margin: 4px 0 0;
  font-size: 1.18rem;
  letter-spacing: 0;
}

.live-pill {
  border: 1px solid color-mix(in srgb, var(--brand) 24%, transparent);
  background: color-mix(in srgb, var(--brand) 12%, transparent);
  color: var(--ok);
  border-radius: 999px;
  padding: 6px 10px;
  font-size: 0.78rem;
  font-weight: 850;
  text-transform: uppercase;
}

.live-pill.loading {
  border-color: color-mix(in srgb, var(--accent) 30%, transparent);
  background: color-mix(in srgb, var(--accent) 12%, transparent);
  color: var(--accent);
}

.search-controls {
  display: grid;
  grid-template-columns: 180px 240px minmax(0, 1fr);
  gap: 12px;
  align-items: end;
  margin-bottom: 14px;
}

.sort-toolbar {
  display: flex;
  align-items: end;
  gap: 12px;
  flex-wrap: wrap;
  margin: -2px 0 16px;
}

.sort-toolbar.wallet-sort {
  margin: 0 0 14px;
}

.field.compact {
  min-width: min(260px, 100%);
}

.table-wrap {
  width: 100%;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  max-height: 560px;
  overscroll-behavior: contain;
}

table {
  width: 100%;
  min-width: 820px;
  border-collapse: collapse;
}

th,
td {
  padding: 12px 11px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
  font-size: 0.9rem;
}

th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--surface-soft);
  color: var(--ink);
}

td {
  color: var(--ink);
}

.saved-list {
  display: grid;
  gap: 10px;
}

.saved-list.compact {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.saved-row {
  justify-content: space-between;
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-raised);
  min-width: 0;
}

.saved-main {
  min-width: 0;
  align-items: flex-start;
  flex-direction: column;
  gap: 5px;
}

.saved-main strong,
.saved-main span {
  max-width: 100%;
  overflow: visible;
  text-overflow: clip;
  white-space: normal;
  overflow-wrap: anywhere;
}

.saved-main span,
.saved-meta {
  color: var(--muted);
  font-size: 0.82rem;
}

.saved-meta {
  gap: 8px;
  flex-wrap: wrap;
}

.saved-context {
  line-height: 1.35;
}

.wallet .saved-row {
  min-height: 88px;
}

.contact-form {
  display: grid;
  gap: 14px;
  align-content: start;
}

.integration-form {
  display: grid;
  gap: 14px;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.form-actions {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}

.integration-status {
  align-content: start;
}

.test-result {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-raised);
  color: var(--muted);
  white-space: pre-wrap;
}

.check-field {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  color: var(--muted);
  line-height: 1.4;
}

.compact-check {
  align-items: center;
  font-size: 0.84rem;
}

.check-field input {
  margin-top: 3px;
}

.quiet-panel {
  align-content: start;
}

canvas {
  display: block;
  width: 100%;
  height: 320px;
  min-width: 0;
}

.auth-heading {
  margin-bottom: 20px;
}

.auth-heading h2 {
  margin: 5px 0 0;
  font-size: 1.25rem;
}

.view-toolbar,
.preview-actions,
.permission-actions,
.saved-actions {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.view-toolbar {
  justify-content: space-between;
}

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

.numbers-hidden .metric-card strong,
.numbers-hidden .dashboard-grid canvas,
.numbers-hidden .dashboard-custom-grid canvas {
  visibility: hidden;
}

.numbers-hidden .metric-card::after {
  content: "•••";
  color: var(--muted);
  font-size: 1.4rem;
  font-weight: 800;
}

.numbers-hidden .metric-card strong + * {
  display: none;
}

.consultation-summary {
  margin: 4px 0 18px;
  padding: 16px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.dashboard-builder {
  border-color: color-mix(in srgb, var(--brand) 28%, var(--line));
}

.builder-grid {
  display: grid;
  grid-template-columns: 1.4fr 1fr 1.2fr 1.2fr 180px auto;
  gap: 12px;
  align-items: end;
}

.dashboard-custom-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.custom-chart-card {
  min-height: 360px;
}

.custom-chart-card canvas {
  height: 270px;
}

.compact-heading {
  align-items: flex-start;
  margin-bottom: 8px;
}

.compact-heading h2 {
  margin-bottom: 2px;
}

.icon-action {
  min-height: 34px;
  padding: 0 10px;
  font-size: 0.82rem;
}

.insight-strip {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}

.insight-strip article {
  min-width: 0;
  padding-left: 12px;
  border-left: 3px solid var(--brand);
}

.insight-strip span,
.detail-item span,
.access-user span,
.access-user small,
.timeline-step span {
  color: var(--muted);
}

.insight-strip strong {
  display: block;
  margin-top: 4px;
  font-size: 1.45rem;
}

.consultation-charts {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 24px;
}

.mini-chart {
  min-width: 0;
}

.mini-chart + .mini-chart {
  padding-left: 24px;
  border-left: 1px solid var(--line);
}

.mini-chart h3 {
  margin: 4px 0 2px;
  font-size: 1rem;
}

.mini-chart canvas {
  height: 220px;
}

.process-link {
  border: 0;
  padding: 0;
  background: transparent;
  color: var(--brand-strong);
  font-weight: 800;
  text-align: left;
  text-decoration: underline;
  text-decoration-color: transparent;
  text-underline-offset: 3px;
  overflow-wrap: anywhere;
}

.process-cell,
.process-title-line,
.saved-title-line {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  flex-wrap: wrap;
}

.process-cell,
.saved-title-line {
  align-items: flex-start;
  flex-wrap: wrap;
}

.process-cell .process-link,
.saved-title-line > strong,
.saved-title-line > .process-link {
  flex: 0 0 auto;
}

.process-cell .process-status,
.saved-title-line .process-status {
  flex: 0 1 auto;
  min-width: 0;
}

.saved-process-link {
  line-height: 1.35;
}

.process-title-line h2 {
  min-width: 0;
  overflow-wrap: anywhere;
}

.process-link:hover,
.process-link:focus-visible {
  text-decoration-color: currentColor;
}

.result-row.expanded td {
  background: color-mix(in srgb, var(--surface-soft) 72%, transparent);
}

.result-detail td {
  padding: 0;
  background: var(--surface-soft);
}

.result-preview {
  padding: 18px;
}

.preview-grid,
.detail-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.preview-grid {
  margin-bottom: 16px;
}

.preview-grid div,
.detail-item {
  min-width: 0;
}

.preview-grid span,
.preview-grid strong,
.detail-item span,
.detail-item strong {
  display: block;
}

.preview-grid span,
.detail-item span {
  margin-bottom: 4px;
  font-size: 0.76rem;
}

.preview-grid strong,
.detail-item strong {
  overflow-wrap: anywhere;
  font-size: 0.9rem;
}

.process-hero {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  padding: 10px 2px 4px;
}

.process-hero h2 {
  margin: 5px 0 4px;
  font-size: 1.75rem;
}

.process-status {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 8px 11px;
  border: 1px solid color-mix(in srgb, var(--neutral) 35%, var(--line));
  border-left: 3px solid var(--neutral);
  border-radius: 6px;
  background: color-mix(in srgb, var(--neutral) 8%, var(--surface));
  color: var(--neutral);
  font-size: 0.8rem;
  font-weight: 850;
  line-height: 1.2;
  text-transform: none;
  min-width: 0;
  max-width: min(440px, 100%);
  white-space: normal;
  overflow-wrap: anywhere;
}

.process-status::before {
  content: "";
  width: 7px;
  height: 7px;
  flex: 0 0 7px;
  border-radius: 50%;
  background: currentColor;
  box-shadow: 0 0 0 3px color-mix(in srgb, currentColor 12%, transparent);
}

.process-status.status-complete {
  border-color: color-mix(in srgb, var(--ok) 38%, var(--line));
  border-left-color: var(--ok);
  background: color-mix(in srgb, var(--ok) 10%, var(--surface));
  color: var(--ok);
}

.process-status.status-info {
  border-color: color-mix(in srgb, var(--info) 38%, var(--line));
  border-left-color: var(--info);
  background: color-mix(in srgb, var(--info) 10%, var(--surface));
  color: var(--info);
}

.process-status.status-attention {
  border-color: color-mix(in srgb, var(--attention) 42%, var(--line));
  border-left-color: var(--attention);
  background: color-mix(in srgb, var(--attention) 11%, var(--surface));
  color: var(--attention);
}

.process-status.status-critical {
  border-color: color-mix(in srgb, var(--warn) 42%, var(--line));
  border-left-color: var(--warn);
  background: color-mix(in srgb, var(--warn) 10%, var(--surface));
  color: var(--warn);
}

.process-status.inline-status {
  max-width: min(360px, 100%);
  padding: 5px 7px;
  overflow: visible;
  text-overflow: clip;
  white-space: normal;
  overflow-wrap: anywhere;
  font-size: 0.72rem;
}

.process-layout,
.access-layout {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.access-layout {
  grid-template-columns: minmax(0, 1.35fr) minmax(320px, 0.65fr);
  align-items: start;
}

.process-timeline {
  display: grid;
  gap: 0;
}

.timeline-step {
  position: relative;
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr);
  gap: 12px;
  min-height: 56px;
}

.timeline-step:not(:last-child)::before {
  content: "";
  position: absolute;
  top: 15px;
  bottom: -1px;
  left: 6px;
  width: 2px;
  background: var(--line);
}

.timeline-step.complete:not(:last-child)::before {
  background: var(--ok);
}

.timeline-dot {
  position: relative;
  z-index: 1;
  width: 14px;
  height: 14px;
  margin-top: 2px;
  border: 3px solid var(--surface);
  border-radius: 50%;
  background: var(--line);
  box-shadow: 0 0 0 1px var(--line);
}

.timeline-step.complete .timeline-dot {
  background: var(--ok);
  box-shadow: 0 0 0 1px var(--ok);
}

.timeline-step strong,
.timeline-step span {
  display: block;
}

.timeline-step span {
  margin-top: 3px;
  font-size: 0.82rem;
}

.detail-grid.full {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.access-form {
  display: grid;
  gap: 14px;
  align-content: start;
}

.column-permissions {
  min-width: 0;
  margin: 0;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 6px;
}

.column-permissions legend {
  padding: 0 6px;
  font-weight: 800;
}

.field-note {
  margin: 0 0 12px;
  color: var(--muted);
  font-size: 0.82rem;
}

.field .field-note {
  margin: -2px 0 0;
}

.permission-actions {
  margin-bottom: 12px;
}

.permission-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  max-height: 390px;
  overflow: auto;
  padding-right: 4px;
}

.division-permission-grid {
  max-height: 220px;
}

.permission-option {
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr);
  gap: 8px;
  align-items: start;
  padding: 9px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface-raised);
  font-size: 0.82rem;
  line-height: 1.3;
}

.permission-option span {
  overflow-wrap: anywhere;
}

.permission-option.required {
  border-color: color-mix(in srgb, var(--brand) 45%, var(--line));
}

.access-list {
  display: grid;
  gap: 10px;
}

.access-user {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}

.access-user div {
  min-width: 0;
}

.access-user strong,
.access-user span,
.access-user small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.access-user small {
  white-space: normal;
  overflow-wrap: anywhere;
}

.access-user span,
.access-user small {
  margin-top: 3px;
  font-size: 0.8rem;
}

.profile-badge {
  display: inline-flex !important;
  max-width: 220px;
  margin-left: 6px;
  padding: 3px 7px;
  border: 1px solid color-mix(in srgb, var(--brand) 28%, var(--line));
  border-radius: 999px;
  background: color-mix(in srgb, var(--brand) 10%, transparent);
  color: var(--brand-strong) !important;
  font-size: 0.72rem !important;
  font-weight: 800;
  vertical-align: middle;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(10, 18, 26, 0.52);
}

.modal-card {
  width: min(480px, 100%);
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.28);
}

.modal-card .field {
  margin-top: 12px;
}

[hidden] {
  display: none !important;
}

@media (max-width: 1180px) {
  .app-tabs {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .builder-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .indicator-filter-grid,
  .indicator-sla-grid {
    grid-template-columns: repeat(2, minmax(170px, 1fr));
  }

  .indicator-refresh {
    width: fit-content;
  }
}

@media (max-width: 980px) {
  .auth-panel,
  .dashboard-grid,
  .dashboard-custom-grid,
  .indicators-chart-grid,
  .contact-grid,
  .integration-grid {
    grid-template-columns: 1fr;
  }

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

  .indicator-filter-grid,
  .indicator-sla-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .indicator-chart-card.wide {
    grid-column: auto;
  }

  .process-layout,
  .access-layout,
  .consultation-charts {
    grid-template-columns: 1fr;
  }

  .mini-chart + .mini-chart {
    padding-left: 0;
    padding-top: 18px;
    border-top: 1px solid var(--line);
    border-left: 0;
  }

  .detail-grid.full {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .metric-grid,
  .saved-list.compact {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .search-controls {
    grid-template-columns: 1fr;
  }

  .form-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 680px) {
  .shell {
    width: min(100% - 20px, 1440px);
    padding-top: 14px;
    padding-bottom: 28px;
  }

  .auth-panel {
    min-height: auto;
    gap: 24px;
    padding: 28px 0;
  }

  .auth-copy h1 {
    font-size: 2.2rem;
    overflow-wrap: anywhere;
  }

  .app-header h1 {
    font-size: 1.75rem;
  }

  .app-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .header-actions,
  .user-chip {
    width: 100%;
  }

  .header-actions {
    align-items: stretch;
  }

  .theme-switch,
  .user-chip {
    flex: 1;
  }

  .user-chip {
    justify-content: space-between;
  }

  .user-chip span {
    max-width: calc(100% - 76px);
  }

  .app-tabs {
    display: flex;
    gap: 4px;
    overflow-x: auto;
    overscroll-behavior-inline: contain;
    scroll-snap-type: x proximity;
    scrollbar-width: none;
  }

  .app-tabs::-webkit-scrollbar {
    display: none;
  }

  .app-tabs button {
    flex: 0 0 auto;
    min-width: 126px;
    padding: 0 12px;
    scroll-snap-align: center;
  }

  .metric-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }

  .saved-list.compact {
    grid-template-columns: 1fr;
  }

  .metric-card {
    min-height: 96px;
  }

  .metric-card strong {
    font-size: 1.55rem;
    overflow-wrap: anywhere;
  }

  .insight-strip,
  .builder-grid,
  .indicator-filter-grid,
  .indicator-sla-grid,
  .preview-grid,
  .detail-grid,
  .detail-grid.full,
  .permission-grid {
    grid-template-columns: 1fr;
  }

  .process-hero {
    flex-direction: column;
  }

  .process-hero h2 {
    font-size: 1.5rem;
  }

  .process-title-line,
  .process-cell,
  .saved-title-line {
    flex-wrap: wrap;
  }

  .saved-row,
  .access-user {
    align-items: flex-start;
    flex-direction: column;
  }

  .saved-actions {
    width: 100%;
  }

  .saved-main strong,
  .saved-main span,
  .access-user strong {
    overflow: visible;
    text-overflow: clip;
    white-space: normal;
    overflow-wrap: anywhere;
  }

  .saved-actions button,
  .access-user > button {
    flex: 1 1 auto;
  }

  .process-status.inline-status {
    max-width: min(250px, 100%);
    overflow: visible;
    text-overflow: clip;
    white-space: normal;
    overflow-wrap: anywhere;
  }

  .period-segmented {
    grid-auto-flow: initial;
    grid-auto-columns: initial;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    width: 100%;
  }

  .period-segmented button {
    min-height: 52px;
    padding: 6px;
    white-space: normal;
  }

  .indicator-refresh {
    width: 100%;
  }

  .indicator-section-heading {
    align-items: flex-start;
    flex-direction: column;
  }

  .indicator-section-heading > .muted {
    text-align: left;
  }

  .view-toolbar {
    align-items: flex-start;
  }

  .toolbar-actions {
    width: 100%;
  }

  .toolbar-actions button {
    flex: 1 1 140px;
  }

  .panel-heading {
    align-items: flex-start;
    flex-wrap: wrap;
  }

  .access-form > .panel-heading,
  .integration-form > .panel-heading {
    align-items: stretch;
    flex-direction: column;
  }

  .access-form > .panel-heading button,
  .integration-form > .panel-heading button {
    width: 100%;
  }

  .permission-actions .compact-check {
    flex-basis: 100%;
  }

  .form-actions .primary {
    width: 100%;
  }

  #processoView > .view-toolbar {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-items: stretch;
  }

  #processoView > .view-toolbar button {
    min-height: 50px;
    padding: 8px;
    white-space: normal;
  }

  #carteiraView .panel-heading > button,
  .contact-form .primary.inline,
  .quiet-panel .ghost.inline-gap {
    width: 100%;
  }

  .test-result {
    overflow-wrap: anywhere;
  }

  canvas,
  .indicator-chart-card canvas,
  .indicator-chart-card.wide canvas,
  .custom-chart-card canvas {
    height: 235px;
  }

  .mini-chart canvas {
    height: 205px;
  }

  .table-wrap {
    max-height: none;
    overflow: visible;
    border: 0;
    border-radius: 0;
  }

  table {
    min-width: 0;
  }

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

  .table-wrap tbody {
    display: grid;
    gap: 12px;
  }

  .table-wrap tr,
  .table-wrap td {
    display: block;
    width: 100%;
  }

  .result-row {
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface-raised);
  }

  .result-row.expanded {
    border-bottom: 0;
    border-radius: 8px 8px 0 0;
  }

  .result-row td {
    display: grid;
    grid-template-columns: minmax(84px, 0.42fr) minmax(0, 1fr);
    gap: 12px;
    align-items: center;
    padding: 10px 12px;
    border: 0;
  }

  .result-row td + td {
    border-top: 1px solid var(--line);
  }

  .result-row td::before {
    content: attr(data-label);
    color: var(--muted);
    font-size: 0.72rem;
    font-weight: 800;
    text-transform: uppercase;
  }

  .result-row td:first-child {
    display: block;
    padding: 13px 12px;
    background: var(--surface-soft);
  }

  .result-row td:first-child::before {
    display: none;
  }

  .result-row td:last-child .small-action {
    width: 100%;
  }

  .result-detail {
    margin-top: -12px;
    overflow: hidden;
    border: 1px solid var(--line);
    border-top: 0;
    border-radius: 0 0 8px 8px;
    background: var(--surface-soft);
  }

  .result-detail td,
  .result-detail .result-preview {
    border: 0;
  }

  .result-preview {
    padding: 14px;
  }

  .preview-actions button {
    width: 100%;
  }

  .panel,
  .auth-card,
  .metric-card {
    padding: 14px;
  }
}
