:root {
  --bg: #f4f6f8;
  --surface: #ffffff;
  --surface-soft: #eef3f6;
  --ink: #17212b;
  --muted: #66727f;
  --line: #d9e1e7;
  --brand: #0d6b6f;
  --brand-strong: #095357;
  --accent: #c4822f;
  --success: #1b8a5a;
  --warning: #b36b00;
  --danger: #b93737;
  --shadow: 0 14px 38px rgba(20, 35, 48, 0.08);
  --radius: 8px;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
}

body {
  margin: 0;
  color: var(--ink);
  background: var(--bg);
  font-family: "Segoe UI", Arial, sans-serif;
  line-height: 1.45;
  -webkit-text-size-adjust: 100%;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

.hidden {
  display: none !important;
}

.login-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background: linear-gradient(135deg, #102934 0%, #214a55 100%);
}

.login-card {
  width: min(420px, 100%);
  display: grid;
  gap: 16px;
  padding: 26px;
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.login-card .brand {
  color: var(--ink);
  border-bottom-color: var(--line);
}

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

.login-card label,
.stack-form {
  display: grid;
  gap: 7px;
}

.message {
  min-height: 20px;
  margin: 0;
  color: var(--danger);
  font-size: 13px;
}

.app-shell {
  display: flex;
  min-height: 100vh;
  min-height: 100dvh;
}

.sidebar {
  position: sticky;
  top: 0;
  width: 280px;
  height: 100vh;
  height: 100dvh;
  padding: 20px 16px;
  background: #102934;
  color: #fff;
  display: flex;
  flex-direction: column;
  gap: 22px;
  z-index: 10;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 4px 6px 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.14);
}

.brand-mark {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  font-weight: 800;
  font-size: 24px;
}

.brand strong,
.brand span {
  display: block;
}

.brand span {
  color: #a9bdc7;
  font-size: 13px;
}

.nav {
  display: grid;
  gap: 5px;
}

.nav-item {
  width: 100%;
  border: 0;
  border-radius: var(--radius);
  padding: 11px 12px;
  color: #dce8ee;
  text-align: left;
  background: transparent;
}

.nav-item:hover,
.nav-item.active {
  background: #1e4350;
  color: #fff;
}

.sidebar-card {
  margin-top: auto;
  display: flex;
  gap: 10px;
  padding: 12px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.06);
}

.sidebar-card strong,
.sidebar-card small {
  display: block;
}

.sidebar-card small {
  color: #b7c8d1;
}

.status-dot {
  width: 10px;
  height: 10px;
  margin-top: 5px;
  border-radius: 50%;
  background: #50d490;
}

.main {
  width: calc(100% - 280px);
  padding: 24px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 22px;
  margin-bottom: 24px;
}

.eyebrow {
  margin: 0 0 2px;
  color: var(--brand);
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: 28px;
}

h2 {
  margin-bottom: 4px;
  font-size: 22px;
}

h3 {
  margin-bottom: 8px;
  font-size: 17px;
}

p {
  color: var(--muted);
}

.topbar-actions {
  display: flex;
  align-items: end;
  gap: 12px;
}

.search {
  display: grid;
  gap: 4px;
  color: var(--muted);
  font-size: 12px;
}

input,
select,
textarea {
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0 12px;
  background: var(--surface);
  color: var(--ink);
  font-size: 16px;
}

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

.search input {
  width: min(320px, 32vw);
}

.icon-button,
.primary-button,
.secondary-button,
.danger-button {
  border: 0;
  border-radius: var(--radius);
  min-height: 40px;
  padding: 0 14px;
}

.icon-button {
  display: none;
  background: var(--surface);
  border: 1px solid var(--line);
}

.primary-button {
  background: var(--brand);
  color: #fff;
  font-weight: 700;
}

.primary-button:hover {
  background: var(--brand-strong);
}

.secondary-button,
.danger-button {
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  font-weight: 700;
}

.secondary-button:hover {
  background: var(--surface-soft);
}

.danger-button {
  border-color: #f0caca;
  color: var(--danger);
}

.danger-button:hover {
  background: #fff0f0;
}

.toast {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 50;
  max-width: min(420px, calc(100vw - 32px));
  margin: 0;
  padding: 12px 14px;
  border-radius: var(--radius);
  background: #e9f8f0;
  color: var(--success);
  box-shadow: var(--shadow);
  font-weight: 700;
}

.toast.error {
  background: #fff0f0;
  color: var(--danger);
}

.view {
  display: none;
}

.view.active {
  display: block;
}

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

.metric,
.panel,
.setting-card,
.company-card,
.opportunity-card,
.kanban-column {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.metric {
  padding: 18px;
}

.metric-wide {
  grid-column: span 2;
}

.metric span,
.metric small {
  display: block;
  color: var(--muted);
}

.metric strong {
  display: block;
  margin: 7px 0;
  font-size: 30px;
}

.dashboard-hero {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 18px;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: linear-gradient(135deg, #ffffff 0%, #eef6f5 100%);
  box-shadow: var(--shadow);
}

.dashboard-hero h2 {
  margin-bottom: 6px;
  font-size: 26px;
}

.dashboard-hero p:last-child {
  max-width: 720px;
  margin-bottom: 0;
}

.dashboard-status {
  align-self: flex-start;
  padding: 8px 11px;
  border-radius: 999px;
  background: #e7f5ef;
  color: var(--success);
  white-space: nowrap;
  font-size: 12px;
  font-weight: 800;
}

.dashboard-filters {
  display: grid;
  grid-template-columns: repeat(6, minmax(120px, 1fr)) auto;
  gap: 10px;
  align-items: end;
  margin-bottom: 16px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.dashboard-filters label {
  display: grid;
  gap: 5px;
  min-width: 0;
  color: var(--muted);
  font-size: 12px;
}

.dashboard-alerts {
  display: grid;
  gap: 8px;
  margin-bottom: 16px;
}

.dashboard-alerts p {
  margin: 0;
  padding: 10px 12px;
  border: 1px solid #f0c36d;
  border-radius: var(--radius);
  background: #fff7e6;
  color: var(--warning);
  font-weight: 700;
}

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

.dashboard-metrics .metric {
  position: relative;
  overflow: hidden;
}

.dashboard-metrics .metric::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 4px;
  background: var(--brand);
}

.dashboard-chart-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 16px;
}

.chart-panel {
  min-height: 260px;
}

.chart-panel .panel-header span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.chart-body {
  display: grid;
  gap: 8px;
}

.pro-bar-chart {
  display: grid;
  gap: 9px;
}

.pro-bar {
  display: grid;
  grid-template-columns: minmax(124px, 0.5fr) minmax(150px, 1fr) minmax(160px, auto);
  gap: 10px;
  align-items: center;
  width: 100%;
  min-height: 36px;
  border: 0;
  padding: 0;
  background: transparent;
  color: var(--ink);
  text-align: left;
}

.pro-bar span,
.pro-bar strong {
  min-width: 0;
  overflow-wrap: anywhere;
  font-size: 13px;
}

.pro-bar strong {
  color: var(--muted);
  text-align: right;
}

.pro-bar div {
  height: 14px;
  overflow: hidden;
  border-radius: 999px;
  background: #e8eef2;
}

.pro-bar i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--brand), var(--brand-strong));
}

.pie-chart {
  display: grid;
  grid-template-columns: 170px 1fr;
  gap: 18px;
  align-items: center;
}

.pie-chart svg {
  width: 170px;
  height: 170px;
  transform: rotate(-90deg);
}

.pie-legend {
  display: grid;
  gap: 8px;
}

.pie-legend button {
  display: grid;
  grid-template-columns: 10px minmax(0, 1fr);
  gap: 8px 10px;
  align-items: center;
  border: 0;
  padding: 0;
  background: transparent;
  color: var(--ink);
  text-align: left;
}

.pie-legend i {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

.pie-legend strong {
  grid-column: 2;
  color: var(--muted);
  font-size: 12px;
}

.line-chart {
  display: grid;
  gap: 10px;
}

.line-chart svg {
  width: 100%;
  height: 190px;
  border-left: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  overflow: visible;
}

.line-chart polyline {
  fill: none;
  stroke: var(--brand);
  stroke-width: 2.4;
  vector-effect: non-scaling-stroke;
}

.line-chart circle {
  fill: var(--accent);
  stroke: #fff;
  stroke-width: 0.9;
  vector-effect: non-scaling-stroke;
}

.line-axis {
  display: flex;
  justify-content: space-between;
  gap: 6px;
}

.line-axis button {
  border: 0;
  padding: 0;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
}

.chart-row {
  display: grid;
  grid-template-columns: minmax(118px, 0.55fr) minmax(130px, 1fr) minmax(140px, auto);
  gap: 10px;
  align-items: center;
  width: 100%;
  min-height: 42px;
  border: 0;
  padding: 0;
  background: transparent;
  color: var(--ink);
  text-align: left;
}

.chart-row span,
.chart-row strong {
  min-width: 0;
  overflow-wrap: anywhere;
  font-size: 13px;
}

.chart-row strong {
  color: var(--muted);
  text-align: right;
}

.chart-row div {
  height: 12px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--surface-soft);
}

.chart-row i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--brand);
}

.chart-row:hover span,
.chart-row:hover strong {
  color: var(--brand-strong);
}

.column-chart {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(62px, 1fr));
  align-items: end;
  gap: 12px;
  min-height: 220px;
  padding-top: 8px;
}

.column-chart button {
  display: grid;
  grid-template-rows: 1fr auto;
  gap: 8px;
  min-height: 210px;
  border: 0;
  padding: 0;
  background: transparent;
  color: var(--muted);
}

.column-chart i {
  align-self: end;
  min-height: 8px;
  border-radius: 7px 7px 2px 2px;
  background: var(--accent);
}

.column-chart span {
  min-height: 32px;
  overflow-wrap: anywhere;
  font-size: 12px;
}

.chart-empty {
  display: grid;
  min-height: 150px;
  place-items: center;
  padding: 16px;
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  color: var(--muted);
  text-align: center;
}

.dashboard-records {
  align-items: start;
}

#dashboard {
  --dash-ink: #111827;
  --dash-muted: #5d6878;
  --dash-panel: rgba(255, 255, 255, 0.92);
  --dash-line: rgba(139, 154, 174, 0.24);
  --dash-shadow: 0 22px 70px rgba(15, 23, 42, 0.11);
  --dash-deep: #0b1720;
}

.dashboard-hero {
  position: relative;
  overflow: hidden;
  align-items: stretch;
  min-height: 254px;
  margin-bottom: 18px;
  padding: clamp(22px, 3vw, 34px);
  border: 1px solid rgba(255, 255, 255, 0.68);
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(16, 41, 52, 0.95) 0%, rgba(13, 107, 111, 0.9) 48%, rgba(196, 130, 47, 0.84) 100%),
    radial-gradient(circle at 78% 18%, rgba(255, 255, 255, 0.42), transparent 32%);
  color: #fff;
  box-shadow: 0 26px 80px rgba(15, 23, 42, 0.22);
}

.dashboard-hero::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.08) 1px, transparent 1px),
    linear-gradient(0deg, rgba(255, 255, 255, 0.08) 1px, transparent 1px);
  background-size: 52px 52px;
  mask-image: linear-gradient(90deg, #000, transparent 78%);
  pointer-events: none;
}

.dashboard-hero > * {
  position: relative;
  z-index: 1;
}

.dashboard-hero .eyebrow {
  color: rgba(255, 255, 255, 0.76);
  letter-spacing: 0;
}

.dashboard-hero h2 {
  max-width: 760px;
  margin: 4px 0 10px;
  color: #fff;
  font-size: clamp(32px, 4vw, 54px);
  line-height: 0.98;
}

.dashboard-hero p:last-child,
.dashboard-hero p {
  max-width: 650px;
  color: rgba(255, 255, 255, 0.82);
}

.dashboard-hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 24px;
}

.dashboard-hero-actions .primary-button,
.dashboard-hero-actions .secondary-button {
  min-height: 42px;
  border-color: rgba(255, 255, 255, 0.24);
}

.dashboard-hero-actions .secondary-button {
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
}

.dashboard-executive-card {
  width: min(390px, 100%);
  display: grid;
  align-content: space-between;
  gap: 12px;
  padding: 20px;
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.16);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.2);
  backdrop-filter: blur(14px);
}

.dashboard-executive-card > span,
.dashboard-executive-card small {
  color: rgba(255, 255, 255, 0.76);
  font-weight: 700;
}

.dashboard-executive-card strong {
  color: #fff;
  font-size: clamp(32px, 4vw, 44px);
  line-height: 1;
}

.dashboard-status {
  justify-self: start;
  align-self: start;
  background: rgba(255, 255, 255, 0.18);
  color: #fff;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.22);
}

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

.executive-split span {
  display: grid;
  gap: 4px;
  min-height: 76px;
  padding: 13px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.15);
  color: rgba(255, 255, 255, 0.72);
  font-size: 12px;
}

.executive-split b {
  color: #fff;
  font-size: 26px;
}

.dashboard-filters {
  grid-template-columns: repeat(auto-fit, minmax(164px, 1fr));
  padding: 16px;
  border-color: var(--dash-line);
  background: var(--dash-panel);
  box-shadow: var(--dash-shadow);
}

.dashboard-filters label {
  color: var(--dash-muted);
  font-weight: 800;
}

.dashboard-filters input,
.dashboard-filters select {
  width: 100%;
  min-width: 0;
  border-color: rgba(139, 154, 174, 0.34);
  background: #f8fafc;
}

.dashboard-filters button {
  min-height: 42px;
}

.dashboard-alerts p {
  border-color: rgba(196, 130, 47, 0.36);
  background: #fff8eb;
  box-shadow: 0 14px 34px rgba(196, 130, 47, 0.12);
}

.executive-kpis {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
}

.dashboard-metrics .kpi-card {
  position: relative;
  min-height: 172px;
  overflow: hidden;
  padding: 22px;
  border: 1px solid var(--dash-line);
  border-radius: 8px;
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.98), rgba(246, 249, 252, 0.9)),
    var(--surface);
  box-shadow: var(--dash-shadow);
  animation: dashboardRise 360ms ease both;
}

.dashboard-metrics .kpi-card::before {
  inset: 0 0 auto 0;
  width: auto;
  height: 5px;
  background: var(--kpi);
}

.dashboard-metrics .kpi-card::after {
  content: "";
  position: absolute;
  right: -44px;
  top: -48px;
  width: 144px;
  height: 144px;
  border-radius: 50%;
  background: color-mix(in srgb, var(--kpi) 18%, transparent);
}

.dashboard-metrics .kpi-card:nth-child(1) { animation-delay: 20ms; }
.dashboard-metrics .kpi-card:nth-child(2) { animation-delay: 70ms; }
.dashboard-metrics .kpi-card:nth-child(3) { animation-delay: 120ms; }
.dashboard-metrics .kpi-card:nth-child(4) { animation-delay: 170ms; }
.dashboard-metrics .kpi-card:nth-child(5) { animation-delay: 220ms; }
.dashboard-metrics .kpi-card:nth-child(6) { animation-delay: 270ms; }

.kpi-hero {
  grid-column: span 2;
  background:
    linear-gradient(135deg, rgba(16, 41, 52, 0.98), rgba(13, 107, 111, 0.9) 52%, rgba(196, 130, 47, 0.88)),
    var(--dash-deep);
  color: #fff;
}

.kpi-hero span,
.kpi-hero small,
.kpi-hero strong {
  color: #fff;
}

.kpi-hero small {
  color: rgba(255, 255, 255, 0.78);
}

.kpi-card span {
  color: var(--dash-muted);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.kpi-card strong {
  position: relative;
  z-index: 1;
  margin: 12px 0 8px;
  color: var(--dash-ink);
  font-size: clamp(28px, 3vw, 40px);
  line-height: 1;
}

.kpi-card small {
  position: relative;
  z-index: 1;
  color: var(--dash-muted);
  font-weight: 700;
}

.kpi-featured {
  grid-column: span 2;
}

.kpi-teal { --kpi: #0f766e; }
.kpi-blue { --kpi: #2563eb; }
.kpi-gold { --kpi: #c4822f; }
.kpi-violet { --kpi: #7c3aed; }
.kpi-slate { --kpi: #475569; }
.kpi-green { --kpi: #16a34a; }
.kpi-red { --kpi: #dc2626; }
.kpi-orange { --kpi: #ea580c; }

.dashboard-donut-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 16px;
}

.dashboard-chart-grid {
  grid-template-columns: minmax(0, 1.12fr) minmax(0, 0.88fr);
  gap: 16px;
}

.executive-charts {
  grid-template-columns: minmax(0, 1.15fr) minmax(360px, 0.85fr);
}

.chart-panel {
  min-height: 320px;
  border-color: var(--dash-line);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(248, 250, 252, 0.9)),
    var(--dash-panel);
  box-shadow: var(--dash-shadow);
}

.chart-panel-large {
  min-height: 360px;
}

.chart-panel-wide {
  min-height: 380px;
}

.donut-panel {
  min-height: 360px;
}

.chart-panel .panel-header {
  align-items: center;
  padding-bottom: 13px;
  border-bottom: 1px solid rgba(139, 154, 174, 0.18);
}

.chart-panel .panel-header h2 {
  color: var(--dash-ink);
}

.chart-panel .panel-header span {
  padding: 6px 9px;
  border-radius: 999px;
  background: #eef2f7;
  color: #475569;
}

.chart-body {
  gap: 12px;
}

.pro-bar-chart {
  gap: 13px;
}

.pro-bar {
  grid-template-columns: minmax(150px, 0.58fr) minmax(170px, 1fr) minmax(150px, auto);
  min-height: 46px;
  transition: transform 160ms ease, color 160ms ease;
}

.pro-bar:hover,
.chart-row:hover,
.pie-legend button:hover,
.line-axis button:hover {
  transform: translateY(-1px);
}

.pro-bar span {
  display: flex;
  align-items: center;
  gap: 9px;
  color: var(--dash-ink);
  font-weight: 800;
}

.pro-bar em {
  min-width: 30px;
  padding: 5px 7px;
  border-radius: 999px;
  background: #eef2f7;
  color: #64748b;
  font-style: normal;
  font-size: 11px;
  text-align: center;
}

.pro-bar div,
.chart-row div {
  height: 16px;
  background: #e6edf3;
  box-shadow: inset 0 1px 2px rgba(15, 23, 42, 0.08);
}

.pro-bar i,
.chart-row i {
  width: var(--value);
  background: linear-gradient(90deg, #0f766e, #2563eb 58%, #c4822f);
  animation: dashboardBar 560ms ease both;
  animation-delay: var(--delay, 0ms);
}

.pro-bar strong,
.chart-row strong {
  color: var(--dash-muted);
  font-weight: 800;
}

.pie-chart {
  grid-template-columns: minmax(140px, 0.82fr) minmax(160px, 1fr);
  min-height: 245px;
  align-content: center;
}

.pie-visual {
  position: relative;
  display: grid;
  place-items: center;
}

.pie-visual svg {
  width: min(190px, 100%);
  height: auto;
  filter: drop-shadow(0 18px 22px rgba(15, 23, 42, 0.14));
  transform: rotate(-90deg);
}

.pie-visual span {
  position: absolute;
  display: grid;
  place-items: center;
  width: 88px;
  height: 88px;
  border-radius: 50%;
  background: #fff;
  color: var(--dash-muted);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  box-shadow: 0 12px 32px rgba(15, 23, 42, 0.12);
}

.pie-visual b {
  color: var(--dash-ink);
  font-size: 26px;
}

.pie-legend button {
  grid-template-columns: 12px minmax(0, 1fr) auto;
  min-height: 42px;
  padding: 9px 0;
  border-bottom: 1px solid rgba(139, 154, 174, 0.16);
  transition: transform 160ms ease;
}

.pie-legend span {
  min-width: 0;
  overflow-wrap: anywhere;
  font-weight: 800;
}

.pie-legend strong {
  grid-column: auto;
  text-align: right;
}

.line-chart {
  gap: 14px;
}

.chart-note {
  padding: 9px 11px;
  border: 1px solid rgba(37, 99, 235, 0.16);
  border-radius: 8px;
  background: rgba(37, 99, 235, 0.07);
  color: #315a9d;
  font-size: 12px;
  font-weight: 800;
}

.line-chart svg {
  height: 230px;
  padding: 8px;
  border: 1px solid rgba(139, 154, 174, 0.2);
  border-radius: 8px;
  background:
    linear-gradient(#eef2f7 1px, transparent 1px),
    linear-gradient(90deg, #eef2f7 1px, transparent 1px),
    #fbfdff;
  background-size: 100% 25%, 20% 100%, auto;
}

.line-chart polygon {
  fill: url(#dashboardLineFill);
}

.line-chart polyline {
  stroke: #0f766e;
  stroke-width: 3;
}

.line-chart circle {
  fill: #c4822f;
  stroke-width: 1.2;
}

.line-axis {
  overflow-x: auto;
  padding-bottom: 2px;
}

.line-axis button {
  min-width: max-content;
  padding: 5px 7px;
  border-radius: 999px;
  background: #eef2f7;
  font-weight: 800;
}

.chart-row {
  grid-template-columns: minmax(136px, 0.6fr) minmax(140px, 1fr) minmax(138px, auto);
  min-height: 48px;
  padding: 8px 0;
  border-bottom: 1px solid rgba(139, 154, 174, 0.14);
  transition: transform 160ms ease;
}

.chart-row span {
  color: var(--dash-ink);
  font-weight: 800;
}

.funnel-chart {
  display: grid;
  gap: 11px;
  padding: 8px 0;
}

.funnel-chart button {
  display: grid;
  grid-template-columns: minmax(120px, 0.45fr) minmax(180px, 1fr) minmax(130px, auto);
  gap: 12px;
  align-items: center;
  min-height: 48px;
  border: 0;
  padding: 0;
  background: transparent;
  color: var(--dash-ink);
  text-align: left;
}

.funnel-chart span {
  min-width: 0;
  overflow-wrap: anywhere;
  font-weight: 900;
}

.funnel-chart i {
  display: block;
  width: var(--value);
  height: 30px;
  justify-self: center;
  border-radius: 5px;
  background:
    linear-gradient(90deg, rgba(15, 118, 110, 0.95), rgba(37, 99, 235, 0.86), rgba(196, 130, 47, 0.88));
  box-shadow: 0 12px 28px rgba(15, 23, 42, 0.16);
  animation: dashboardFunnel 560ms ease both;
  animation-delay: var(--delay, 0ms);
}

.funnel-chart strong {
  color: var(--dash-muted);
  font-size: 12px;
  text-align: right;
}

.chart-empty {
  min-height: 220px;
  gap: 6px;
  border-color: rgba(139, 154, 174, 0.34);
  background:
    linear-gradient(135deg, rgba(15, 118, 110, 0.06), rgba(196, 130, 47, 0.08)),
    #fbfdff;
}

.chart-empty strong {
  color: var(--dash-ink);
}

.chart-empty span {
  color: var(--dash-muted);
}

.dashboard-records .panel {
  border-color: var(--dash-line);
  border-radius: 8px;
  background: var(--dash-panel);
  box-shadow: var(--dash-shadow);
}

.dashboard-summary-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(320px, 0.8fr) minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}

.summary-panel {
  min-height: 320px;
}

.executive-table table {
  border-collapse: separate;
  border-spacing: 0 8px;
}

.executive-table thead th {
  border: 0;
  color: var(--dash-muted);
  font-size: 11px;
  text-transform: uppercase;
}

.executive-table tbody tr {
  background: #f8fafc;
  box-shadow: inset 0 0 0 1px rgba(139, 154, 174, 0.14);
}

.executive-table tbody td {
  border: 0;
}

.executive-table tbody td:first-child {
  border-radius: 8px 0 0 8px;
  font-weight: 800;
}

.executive-table tbody td:last-child {
  border-radius: 0 8px 8px 0;
  font-weight: 900;
}

.executive-activity {
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  border-color: rgba(139, 154, 174, 0.18);
  background: #f8fafc;
}

.executive-activity div {
  min-width: 0;
}

.status-badge {
  display: inline-flex;
  align-items: center;
  width: max-content;
  max-width: 100%;
  min-height: 25px;
  padding: 5px 9px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 900;
  white-space: nowrap;
}

.status-success {
  background: rgba(22, 163, 74, 0.12);
  color: #13733a;
}

.status-danger {
  background: rgba(220, 38, 38, 0.11);
  color: #b91c1c;
}

.status-warning {
  background: rgba(196, 130, 47, 0.15);
  color: #99611f;
}

.status-info {
  background: rgba(37, 99, 235, 0.11);
  color: #1d4ed8;
}

.status-neutral {
  background: rgba(71, 85, 105, 0.11);
  color: #475569;
}

@keyframes dashboardRise {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes dashboardBar {
  from {
    width: 0;
  }
  to {
    width: var(--value);
  }
}

@keyframes dashboardFunnel {
  from {
    width: 20%;
    opacity: 0.3;
  }
  to {
    width: var(--value);
    opacity: 1;
  }
}

.content-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.7fr) minmax(320px, 0.8fr);
  gap: 18px;
}

.panel {
  padding: 18px;
}

.panel-header,
.section-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 16px;
}

.panel-header.compact {
  margin-bottom: 10px;
}

.table-wrap {
  overflow-x: auto;
}

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

th,
td {
  padding: 13px 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
}

th {
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
}

td {
  font-size: 14px;
}

td small,
th small {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 0 9px;
  border-radius: 999px;
  background: var(--surface-soft);
  color: var(--brand-strong);
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.badge.service {
  background: #fff0dc;
  color: #805000;
}

.badge.high {
  background: #ffe7e7;
  color: var(--danger);
}

.activity-list,
.timeline,
.opportunity-list {
  display: grid;
  gap: 12px;
}

.activity-summary,
.activity-workspace {
  margin-bottom: 18px;
}

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

.activity-item,
.timeline-item {
  display: grid;
  gap: 3px;
  padding: 12px;
  border-radius: var(--radius);
  background: var(--surface-soft);
}

.activity-item strong,
.timeline-item strong {
  font-size: 14px;
}

.activity-item span,
.timeline-item span {
  color: var(--muted);
  font-size: 13px;
}

.activity-row {
  cursor: pointer;
}

.activity-row p {
  margin-bottom: 0;
}

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

.calendar-day {
  display: grid;
  gap: 8px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-soft);
}

.calendar-day h3 {
  margin: 0;
  color: var(--brand-strong);
  font-size: 14px;
}

.calendar-day button {
  display: grid;
  gap: 2px;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 9px;
  background: var(--surface);
  text-align: left;
}

.calendar-day small {
  color: var(--muted);
}

.activity-history {
  display: grid;
  gap: 4px;
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
}

.activity-history strong {
  color: var(--ink);
  font-size: 13px;
}

.activity-history span {
  color: var(--muted);
  font-size: 12px;
}

.quote-items {
  display: grid;
  gap: 10px;
}

.quote-items-field {
  display: grid;
  gap: 8px;
}

.field-title {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.quote-item-row {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: 8px;
  align-items: end;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-soft);
}

.quote-item-field {
  display: grid;
  grid-column: span 2;
  gap: 5px;
  min-width: 0;
  color: var(--muted);
  font-size: 12px;
}

.quote-item-description {
  grid-column: span 4;
}

.quote-item-field span {
  min-height: 34px;
  font-weight: 700;
  line-height: 1.25;
}

.quote-item-field input,
.quote-item-field select {
  width: 100%;
  min-width: 0;
}

.quote-item-remove {
  grid-column: span 2;
}

.section-toolbar {
  margin-bottom: 18px;
}

.filters-bar {
  display: grid;
  grid-template-columns: repeat(5, minmax(150px, 1fr));
  gap: 12px;
  align-items: end;
  margin-bottom: 16px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.filters-bar label {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: 12px;
}

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

.company-card,
.opportunity-card,
.setting-card {
  padding: 18px;
}

.company-card footer,
.opportunity-card footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-top: 16px;
  color: var(--muted);
  font-size: 13px;
}

.opportunity-card footer {
  grid-column: 1 / -1;
  justify-content: flex-start;
  flex-wrap: wrap;
}

.row-actions {
  white-space: nowrap;
}

.company-details {
  display: grid;
  gap: 8px;
  margin: 14px 0;
}

.company-details div {
  display: grid;
  grid-template-columns: 88px 1fr;
  gap: 10px;
}

.company-details dt {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.company-details dd {
  margin: 0;
  min-width: 0;
  overflow-wrap: anywhere;
  font-size: 14px;
}

.empty-state {
  grid-column: 1 / -1;
}

.panel-table {
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.form-panel {
  display: grid;
  gap: 14px;
  margin-bottom: 16px;
}

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

.form-grid label,
.inline-field {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: 12px;
}

.wide-field {
  grid-column: 1 / -1;
}

dialog {
  width: min(820px, calc(100vw - 32px));
  border: 0;
  border-radius: var(--radius);
  padding: 0;
  box-shadow: var(--shadow);
}

dialog::backdrop {
  background: rgba(16, 41, 52, 0.38);
}

.dialog-card {
  display: grid;
  gap: 16px;
  padding: 18px;
  background: var(--surface);
}

.dialog-card header,
.dialog-card footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.dialog-card .visible {
  display: inline-flex;
}

.inline-field {
  margin-top: 14px;
}

.form-grid label span,
.inline-field span {
  font-weight: 700;
}

.segmented {
  display: flex;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.segmented button {
  border: 0;
  border-radius: 6px;
  padding: 8px 12px;
  background: transparent;
  color: var(--muted);
}

.segmented button.active {
  background: var(--brand);
  color: #fff;
}

.opportunity-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
}

.opportunity-card p {
  margin-bottom: 0;
}

.amount {
  font-weight: 800;
  color: var(--brand-strong);
  white-space: nowrap;
}

.amount small {
  display: block;
  margin-top: 5px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}

.kanban {
  display: grid;
  grid-template-columns: repeat(4, minmax(240px, 1fr));
  gap: 14px;
  overflow-x: auto;
  padding-bottom: 8px;
}

.kanban-column {
  min-height: 420px;
  padding: 12px;
  box-shadow: none;
}

.kanban-column.drag-over {
  border-color: var(--brand);
  background: #eef8f7;
}

.kanban-column h3 {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin: 0 0 12px;
  color: var(--muted);
  font-size: 14px;
  text-transform: uppercase;
}

.kanban-card {
  display: grid;
  gap: 8px;
  margin-bottom: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
}

.kanban-card[draggable="true"] {
  cursor: grab;
}

.kanban-card.dragging {
  opacity: 0.56;
}

.kanban-card strong,
.kanban-card span {
  display: block;
}

.kanban-card span {
  color: var(--muted);
  font-size: 13px;
}

.stage-select {
  width: 100%;
}

.compact-action {
  justify-self: start;
  min-height: 34px;
  padding: 0 10px;
}

.report-grid,
.settings-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

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

.currency-settings {
  grid-column: span 4;
}

.user-settings {
  grid-column: span 4;
}

.current-user {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin: 10px 0 14px;
  color: var(--text);
  font-size: 14px;
}

.current-user span {
  margin-top: 0;
}

.user-form {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}

.user-form input,
.users-table input {
  width: 100%;
  min-width: 120px;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 4px 9px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
}

.status-pill.active {
  background: rgba(30, 123, 72, 0.12);
  color: #1e7b48;
}

.status-pill.inactive {
  background: rgba(154, 52, 18, 0.12);
  color: #9a3412;
}

.compact-table {
  min-width: 620px;
}

.rate-input {
  width: 150px;
}

.currency-settings input {
  width: 100%;
  min-width: 120px;
}

.currency-settings td small {
  display: block;
  margin-top: 6px;
  color: var(--muted);
  font-size: 12px;
}

.currency-settings td:last-child {
  white-space: nowrap;
}

.setting-card span {
  display: inline-flex;
  margin-top: 10px;
  padding: 6px 9px;
  border-radius: 999px;
  background: var(--surface-soft);
  color: var(--brand-strong);
  font-size: 12px;
  font-weight: 700;
}

.bar-row {
  display: grid;
  grid-template-columns: 92px 1fr 44px;
  align-items: center;
  gap: 10px;
  margin: 14px 0;
  font-size: 14px;
}

.bar-row div {
  height: 10px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--surface-soft);
}

.bar-row i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--brand);
}

.currency-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 14px 0;
}

.currency-tags span {
  padding: 8px 11px;
  border-radius: var(--radius);
  background: var(--surface-soft);
  font-weight: 800;
}

.big-number {
  display: block;
  margin: 10px 0;
  color: var(--brand);
  font-size: 42px;
}

body.searching .search-hidden {
  display: none;
}

/* Dashboard CRM profesional: capa final sobre iteraciones anteriores. */
#dashboard .dashboard-hero {
  min-height: 220px;
}

#dashboard .dashboard-hero h2 {
  max-width: 680px;
  font-size: clamp(34px, 3.6vw, 50px);
}

#dashboard .executive-kpis {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

#dashboard .dashboard-metrics .kpi-card {
  min-height: 148px;
  padding: 20px;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 16px 44px rgba(15, 23, 42, 0.09);
}

#dashboard .dashboard-metrics .kpi-card::after {
  width: 110px;
  height: 110px;
  opacity: 0.78;
}

#dashboard .kpi-hero {
  grid-column: span 1;
  background: linear-gradient(135deg, #102934, #0d6b6f 66%, #b7772d);
}

#dashboard .kpi-card strong {
  font-size: clamp(30px, 2.8vw, 42px);
  letter-spacing: 0;
}

.crm-chart-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(360px, 0.75fr);
  gap: 16px;
  margin-bottom: 16px;
}

.crm-chart-wide {
  min-height: 360px;
}

#dashboard .chart-panel {
  min-height: 300px;
  padding: 18px;
  border: 1px solid rgba(139, 154, 174, 0.22);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 18px 48px rgba(15, 23, 42, 0.09);
}

#dashboard .chart-panel-large {
  min-height: 350px;
}

#dashboard .chart-panel .panel-header {
  margin-bottom: 14px;
}

.crm-bar-chart {
  display: grid;
  gap: 12px;
}

.crm-bar-row {
  display: grid;
  grid-template-columns: minmax(100px, 0.42fr) minmax(100px, 1fr) minmax(92px, 0.5fr);
  gap: 12px;
  align-items: center;
  width: 100%;
  min-height: 38px;
  border: 0;
  padding: 0;
  background: transparent;
  color: var(--dash-ink);
  text-align: left;
}

.crm-bar-row span,
.crm-bar-row strong {
  min-width: 0;
  overflow-wrap: anywhere;
  font-size: 13px;
}

.crm-bar-row span {
  font-weight: 800;
}

.crm-bar-row strong {
  color: var(--dash-muted);
  font-weight: 800;
  text-align: right;
}

.crm-bar-row div {
  height: 12px;
  overflow: hidden;
  border-radius: 999px;
  background: #e8eef4;
}

.crm-bar-row i {
  display: block;
  width: var(--value);
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #0d6b6f, #2f7dd1);
  animation: dashboardBar 520ms ease both;
  animation-delay: var(--delay, 0ms);
}

.crm-donut {
  display: grid;
  grid-template-columns: 150px minmax(0, 1fr);
  gap: 16px;
  align-items: center;
  min-height: 210px;
}

.crm-donut .pie-visual {
  width: 150px;
  height: 150px;
}

.crm-donut .pie-visual svg {
  width: 150px;
  height: 150px;
  transform: rotate(-90deg);
  filter: drop-shadow(0 12px 18px rgba(15, 23, 42, 0.12));
}

.crm-donut .pie-visual span {
  width: 76px;
  height: 76px;
  color: var(--dash-muted);
  line-height: 1.1;
}

.crm-donut .pie-visual span b {
  font-size: 24px;
}

.crm-donut .pie-visual span small {
  display: block;
  max-width: 64px;
  color: var(--dash-muted);
  font-size: 10px;
  font-weight: 900;
  text-align: center;
}

.crm-donut .pie-legend {
  min-width: 0;
  gap: 6px;
}

.crm-donut .pie-legend button {
  grid-template-columns: 10px minmax(0, 1fr) minmax(38px, auto);
  min-height: 34px;
  padding: 6px 0;
}

.crm-donut .pie-legend span,
.crm-donut .pie-legend strong {
  min-width: 0;
  overflow-wrap: anywhere;
  font-size: 12px;
}

.crm-donut .pie-legend strong {
  color: var(--dash-muted);
  text-align: right;
}

.crm-line-chart {
  display: grid;
  gap: 12px;
}

.crm-line-chart svg {
  width: 100%;
  height: 230px;
  padding: 8px;
  border: 1px solid rgba(139, 154, 174, 0.22);
  border-radius: 8px;
  background:
    linear-gradient(#edf2f7 1px, transparent 1px),
    linear-gradient(90deg, #edf2f7 1px, transparent 1px),
    #fbfdff;
  background-size: 100% 25%, 20% 100%, auto;
}

.crm-line-chart polygon {
  fill: url(#dashboardLineFill);
}

.crm-line-chart polyline {
  fill: none;
  stroke: #0d6b6f;
  stroke-width: 2.6;
  vector-effect: non-scaling-stroke;
}

.crm-line-chart circle {
  fill: #c4822f;
  stroke: #fff;
  stroke-width: 1;
  vector-effect: non-scaling-stroke;
}

.crm-line-chart .line-axis {
  display: flex;
  gap: 8px;
  justify-content: space-between;
  overflow-x: auto;
}

.crm-line-chart .line-axis button {
  min-width: max-content;
  border: 0;
  border-radius: 999px;
  padding: 5px 8px;
  background: #eef2f7;
  color: var(--dash-muted);
  font-size: 12px;
  font-weight: 800;
}

#dashboard .dashboard-summary-grid {
  grid-template-columns: minmax(0, 1.05fr) minmax(320px, 0.8fr) minmax(0, 1fr);
}

#dashboard .executive-table table {
  min-width: 520px;
}

#dashboard .summary-panel {
  min-height: 300px;
}

#dashboard .status-badge {
  line-height: 1;
}

@media (max-width: 1100px) {
  .metric-grid,
  .card-grid,
  .settings-grid,
  .dashboard-metrics,
  .dashboard-filters,
  .filters-bar {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .dashboard-chart-grid,
  .dashboard-donut-grid,
  .dashboard-summary-grid,
  .crm-chart-grid {
    grid-template-columns: 1fr;
  }

  #dashboard .executive-kpis,
  .executive-kpis {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .quote-item-row {
    grid-template-columns: repeat(6, minmax(0, 1fr));
  }

  .quote-item-field {
    grid-column: span 3;
  }

  .quote-item-description {
    grid-column: 1 / -1;
  }

  .quote-item-remove {
    grid-column: span 3;
  }

  .metric-wide,
  .currency-settings,
  .user-settings {
    grid-column: span 2;
  }

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

  .content-grid,
  .dashboard-summary-grid,
  .report-grid,
  .activity-summary,
  .activity-calendar {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 1400px) {
  #dashboard .dashboard-summary-grid {
    grid-template-columns: 1fr;
  }

  #dashboard .summary-panel {
    min-height: 0;
  }
}

@media (max-width: 820px) {
  .app-shell {
    display: block;
  }

  .sidebar {
    position: fixed;
    padding-top: max(20px, env(safe-area-inset-top));
    transform: translateX(-100%);
    transition: transform 180ms ease;
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .main {
    width: 100%;
    padding: 16px max(16px, env(safe-area-inset-right)) max(16px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
  }

  .topbar {
    align-items: flex-start;
    flex-wrap: wrap;
  }

  .icon-button {
    display: inline-grid;
    place-items: center;
  }

  .topbar-actions {
    width: 100%;
    align-items: stretch;
  }

  .search,
  .search input,
  .topbar-actions select {
    width: 100%;
  }

  .section-toolbar,
  .panel-header,
  .opportunity-card {
    display: grid;
  }

  .metric-grid,
  .card-grid,
  .settings-grid,
  .dashboard-metrics,
  .dashboard-donut-grid,
  .dashboard-summary-grid,
  .crm-chart-grid,
  .dashboard-filters,
  .filters-bar {
    grid-template-columns: 1fr;
  }

  .kpi-featured,
  .kpi-hero {
    grid-column: span 1;
  }

  .executive-split {
    grid-template-columns: 1fr;
  }

  .dashboard-hero {
    display: grid;
  }

  .dashboard-status {
    justify-self: start;
    white-space: normal;
  }

  .chart-row {
    grid-template-columns: 1fr;
  }

  .pro-bar,
  .funnel-chart button,
  .crm-bar-row,
  .pie-chart {
    grid-template-columns: 1fr;
  }

  .crm-donut {
    grid-template-columns: 1fr;
  }

  .crm-donut .pie-visual {
    justify-self: center;
  }

  .pie-chart svg {
    justify-self: center;
  }

  .chart-row strong {
    text-align: left;
  }

  .pro-bar strong {
    text-align: left;
  }

  .crm-bar-row strong {
    text-align: left;
  }

  .funnel-chart i {
    justify-self: stretch;
  }

  .funnel-chart strong {
    text-align: left;
  }

  .executive-activity {
    grid-template-columns: 1fr;
  }

  .metric-wide,
  .currency-settings,
  .user-settings {
    grid-column: span 1;
  }

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

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

  .quote-item-row {
    grid-template-columns: 1fr;
  }

  .quote-item-field,
  .quote-item-description,
  .quote-item-remove {
    grid-column: 1 / -1;
  }
}

@media (max-width: 520px) {
  h1 {
    font-size: 23px;
  }

  .topbar-actions,
  .segmented {
    display: grid;
  }

  .metric strong {
    font-size: 26px;
  }

  .panel,
  .metric,
  .company-card,
  .opportunity-card,
  .setting-card {
    padding: 14px;
  }
}

/* Dashboard premium ECharts: scope isolated to #dashboard. */
.app-shell:has(#dashboard.view.active) .main > .topbar,
.app-shell:has(#dashboard.view.active) .sidebar-card {
  display: none;
}

#dashboard {
  --dash-surface: #ffffff;
  --dash-soft: #f7fafc;
  --dash-ink: #102033;
  --dash-muted: #637188;
  --dash-line: #d9e3ed;
  --dash-teal: #0d6b6f;
  --dash-blue: #2563eb;
  --dash-gold: #c4822f;
  --dash-green: #16a34a;
  --dash-red: #dc2626;
  --dash-purple: #7c3aed;
  --dash-shadow: 0 14px 34px rgba(15, 23, 42, 0.08);
}

#dashboard .dash-topbar {
  min-height: 112px;
  display: grid;
  grid-template-columns: minmax(320px, 1fr) auto;
  gap: 18px;
  align-items: center;
  margin-bottom: 12px;
  padding: 14px 16px;
  border: 1px solid rgba(148, 163, 184, 0.24);
  border-radius: 8px;
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.96), rgba(255, 255, 255, 0.9)),
    linear-gradient(135deg, rgba(13, 107, 111, 0.12), rgba(196, 130, 47, 0.1));
  box-shadow: var(--dash-shadow);
}

#dashboard .dash-topbar > div {
  min-width: 0;
}

#dashboard .dash-topbar h2 {
  margin: 0 0 4px;
  color: var(--dash-ink);
  font-size: clamp(26px, 2vw, 36px);
  line-height: 1.05;
}

#dashboard .dash-topbar p:last-child {
  max-width: 760px;
  margin: 0;
  color: var(--dash-muted);
  font-size: 14px;
}

#dashboard .dashboard-status {
  min-height: 34px;
  display: inline-grid;
  place-items: center;
  border-radius: 999px;
  padding: 0 12px;
  background: #fff4dc;
  color: #99611f;
  font-size: 11px;
  font-weight: 900;
  white-space: nowrap;
}

#dashboard .dash-toolbar {
  display: flex;
  align-items: end;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-end;
  margin-bottom: 0;
  border: 0;
  padding: 0;
  background: transparent;
  box-shadow: none;
}

#dashboard .dash-toolbar label {
  display: grid;
  gap: 4px;
  color: var(--dash-muted);
  font-size: 10px;
  font-weight: 900;
}

#dashboard .dash-toolbar input,
#dashboard .dash-toolbar select {
  width: 142px;
  min-height: 36px;
  border: 1px solid var(--dash-line);
  border-radius: 8px;
  padding: 0 10px;
  background: #fff;
  color: var(--dash-ink);
  font-size: 12px;
  font-weight: 800;
}

#dashboard .dash-toolbar button {
  min-height: 36px;
  padding: 0 12px;
}

#dashboard .logout-action {
  border-color: rgba(220, 38, 38, 0.18);
  color: #9f1d1d;
  background: rgba(220, 38, 38, 0.06);
  font-weight: 900;
}

#dashboard .advanced-filters {
  position: relative;
}

#dashboard .advanced-filters summary {
  min-height: 36px;
  display: grid;
  place-items: center;
  border: 1px solid var(--dash-line);
  border-radius: 8px;
  padding: 0 12px;
  background: #fff;
  color: var(--dash-ink);
  cursor: pointer;
  font-size: 12px;
  font-weight: 850;
  list-style: none;
  white-space: nowrap;
}

#dashboard .advanced-filters summary::-webkit-details-marker {
  display: none;
}

#dashboard .advanced-filter-panel {
  position: absolute;
  z-index: 20;
  top: calc(100% + 8px);
  right: 0;
  width: min(480px, calc(100vw - 48px));
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  padding: 12px;
  border: 1px solid rgba(148, 163, 184, 0.28);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 18px 44px rgba(15, 23, 42, 0.16);
}

#dashboard .advanced-filter-panel button {
  align-self: end;
}

#dashboard .dashboard-alerts {
  margin-bottom: 12px;
}

#dashboard .dashboard-alerts p {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 44px;
  margin: 0;
  border: 1px solid rgba(196, 130, 47, 0.26);
  border-radius: 8px;
  padding: 8px 12px;
  background: #fff8ed;
  color: #a36313;
  font-size: 13px;
  font-weight: 850;
}

#dashboard .dashboard-alerts p span {
  min-width: 0;
}

#dashboard .dashboard-alerts button {
  flex: 0 0 auto;
  min-height: 30px;
  padding: 0 10px;
  font-size: 12px;
}

#dashboard .dash-kpi-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 12px;
}

#dashboard .dash-kpi,
#dashboard .dash-panel {
  min-width: 0;
  border: 1px solid rgba(148, 163, 184, 0.26);
  border-radius: 8px;
  background: var(--dash-surface);
  box-shadow: var(--dash-shadow);
}

#dashboard .dash-kpi {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  min-height: 92px;
  padding: 13px;
  border-top: 4px solid var(--dash-accent);
}

#dashboard .dash-kpi-icon {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: color-mix(in srgb, var(--dash-accent) 13%, #ffffff);
  color: var(--dash-accent);
  font-size: 13px;
  font-weight: 950;
}

#dashboard .dash-kpi span,
#dashboard .dash-kpi small {
  display: block;
  color: var(--dash-muted);
  font-weight: 850;
}

#dashboard .dash-kpi span {
  font-size: 10px;
  text-transform: uppercase;
}

#dashboard .dash-kpi strong {
  display: block;
  margin: 5px 0 4px;
  color: var(--dash-ink);
  font-size: clamp(20px, 1.35vw, 28px);
  line-height: 1;
}

#dashboard .dash-accent-gold { --dash-accent: var(--dash-gold); }
#dashboard .dash-accent-green { --dash-accent: var(--dash-green); }
#dashboard .dash-accent-red { --dash-accent: var(--dash-red); }
#dashboard .dash-accent-blue { --dash-accent: var(--dash-blue); }
#dashboard .dash-accent-teal { --dash-accent: var(--dash-teal); }
#dashboard .dash-accent-purple { --dash-accent: var(--dash-purple); }

#dashboard .dash-primary-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(390px, 0.85fr);
  gap: 12px;
  margin-bottom: 12px;
}

#dashboard .dash-secondary-grid {
  display: grid;
  grid-template-columns: minmax(280px, 0.85fr) minmax(300px, 0.9fr) minmax(300px, 0.95fr) minmax(300px, 0.85fr);
  gap: 12px;
  margin-bottom: 12px;
}

#dashboard .dash-tables-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(320px, 0.85fr) minmax(0, 1fr);
  gap: 12px;
}

#dashboard .dash-panel {
  padding: 14px 16px;
}

#dashboard .dash-panel .panel-header {
  margin-bottom: 8px;
  padding-bottom: 8px;
}

#dashboard .dash-panel .panel-header h2 {
  font-size: 17px;
  line-height: 1.15;
}

#dashboard .dash-chart {
  width: 100%;
  height: 286px;
}

#dashboard .dash-chart-compact {
  height: 220px;
}

#dashboard .dash-summary-stack {
  display: grid;
  gap: 9px;
}

#dashboard .dash-summary-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  min-height: 48px;
  padding: 10px;
  border-radius: 8px;
  background: var(--dash-soft);
}

#dashboard .dash-summary-row strong,
#dashboard .dash-summary-row span {
  display: block;
  min-width: 0;
}

#dashboard .dash-summary-row span {
  color: var(--dash-muted);
  font-size: 11px;
  font-weight: 800;
}

#dashboard .dash-summary-row b {
  font-size: 18px;
}

#dashboard .dash-table table {
  min-width: 680px;
  border-spacing: 0 7px;
}

#dashboard .dash-table th {
  padding: 0 8px 2px;
  color: var(--dash-muted);
  font-size: 10px;
}

#dashboard .dash-table td {
  padding: 8px;
  background: var(--dash-soft);
  font-size: 12px;
  vertical-align: middle;
}

#dashboard .dash-table td:first-child {
  border-radius: 8px 0 0 8px;
}

#dashboard .dash-table td:last-child {
  border-radius: 0 8px 8px 0;
}

#dashboard .dash-table-main {
  display: block;
  color: var(--dash-ink);
  font-weight: 850;
}

#dashboard .dash-table-sub {
  display: block;
  margin-top: 2px;
  color: var(--dash-muted);
  font-size: 11px;
  font-weight: 750;
}

@media (max-width: 1500px) {
  #dashboard .dash-kpi-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  #dashboard .dash-secondary-grid,
  #dashboard .dash-tables-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 1180px) {
  #dashboard .dash-topbar,
  #dashboard .dash-primary-grid,
  #dashboard .dash-secondary-grid,
  #dashboard .dash-tables-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 760px) {
  #dashboard .dash-topbar {
    min-height: 0;
    padding: 12px;
  }

  #dashboard .dash-topbar h2 {
    font-size: 23px;
  }

  #dashboard .dash-topbar p:last-child {
    display: none;
  }

  #dashboard .dash-toolbar {
    display: grid;
    justify-content: stretch;
  }

  #dashboard .dash-toolbar input,
  #dashboard .dash-toolbar select,
  #dashboard .dash-toolbar button,
  #dashboard .advanced-filters summary {
    width: 100%;
  }

  #dashboard .advanced-filter-panel {
    position: static;
    width: 100%;
    grid-template-columns: 1fr;
    margin-top: 8px;
    box-shadow: none;
  }

  #dashboard .dashboard-alerts p {
    display: grid;
  }

  #dashboard .dash-kpi-grid {
    grid-template-columns: 1fr;
  }

  #dashboard .dash-kpi {
    grid-template-columns: 30px minmax(0, 1fr);
    min-height: 72px;
    padding: 10px;
  }

  #dashboard .dash-kpi-icon {
    width: 28px;
    height: 28px;
    font-size: 11px;
  }

  #dashboard .dash-kpi strong {
    font-size: 18px;
    overflow-wrap: anywhere;
  }

  #dashboard .dash-panel {
    padding: 12px;
  }

  #dashboard .dash-chart {
    height: 260px;
  }

  #dashboard .dash-chart-compact {
    height: 220px;
  }
}
