:root {
  --canvas: #071016;
  --canvas-soft: #0a141b;
  --surface: #0e1921;
  --surface-raised: #111e27;
  --surface-warm: #171b1d;
  --text-primary: #f2eee6;
  --text-secondary: #a8b0b5;
  --text-muted: #737f87;
  --gold: #d7b46a;
  --gold-soft: #a98a4f;
  --teal: #55c7c4;
  --green: #7bcf91;
  --amber: #e2a94f;
  --red: #df6658;
  --line-subtle: rgba(255, 255, 255, 0.065);
  --line-faint: rgba(255, 255, 255, 0.045);
  --shadow-soft: 0 24px 70px rgba(1, 7, 10, 0.22);
  --font-ui: "Manrope", "Avenir Next", Arial, sans-serif;
  --font-editorial: "Cormorant Garamond", "Iowan Old Style", Georgia, serif;
  color-scheme: dark;
}

html {
  background: var(--canvas);
}

body {
  color: var(--text-primary);
  font-family: var(--font-ui);
  font-weight: 400;
  letter-spacing: -0.012em;
  background:
    radial-gradient(circle at 53% -12%, rgba(85, 199, 196, 0.055), transparent 31%),
    var(--canvas);
}

button,
select,
input {
  font-family: var(--font-ui);
}

.dashboard {
  grid-template-columns: 300px minmax(860px, 1fr) 360px;
  gap: 20px;
  padding: 0 20px 20px 0;
}

.sidebar {
  padding: 26px 18px 18px;
  background: var(--canvas-soft);
  border-right: 1px solid rgba(215, 180, 106, 0.16);
  box-shadow: 16px 0 60px rgba(1, 7, 10, 0.18);
}

.brand {
  padding: 0 16px 15px;
}

.brand-title,
.auth-title {
  color: var(--gold);
  font-family: var(--font-editorial);
  font-weight: 600;
  letter-spacing: 0.025em;
  text-shadow: none;
}

.brand-title {
  font-size: 30px;
  line-height: 0.72;
}

.brand-title span,
.auth-title span {
  display: block;
}

.brand-title span:last-child {
  margin-top: 8px;
  font-size: 27px;
}

.brand-subtitle {
  margin-top: 8px;
  color: var(--text-secondary);
  font-size: 13px;
  letter-spacing: 0.025em;
}

.hero-photo {
  height: 238px;
  margin: 0 -18px 14px;
  border-bottom-color: rgba(215, 180, 106, 0.14);
  background: #08131a;
}

.hero-photo img {
  object-position: 67% center;
  opacity: 0.88;
  filter: saturate(0.82) contrast(1.04) brightness(0.9);
}

.hero-photo::after {
  background:
    linear-gradient(180deg, rgba(7, 16, 22, 0.02) 36%, rgba(7, 16, 22, 0.86) 100%),
    linear-gradient(90deg, rgba(7, 16, 22, 0.15), transparent 62%);
}

.nav {
  gap: 1px;
  padding: 0 3px;
}

.nav-item {
  height: 43px;
  position: relative;
  grid-template-columns: 28px 1fr;
  gap: 10px;
  padding: 0 13px;
  color: var(--text-secondary);
  font-size: 15px;
  font-weight: 500;
  border: 0;
  border-radius: 8px;
  background: transparent;
  transition: color 160ms ease, background 160ms ease, transform 160ms ease;
}

.nav-item::before {
  content: "";
  width: 2px;
  height: 0;
  position: absolute;
  top: 50%;
  left: 0;
  border-radius: 3px;
  background: var(--gold);
  transform: translateY(-50%);
  transition: height 160ms ease;
}

.nav-item:hover,
.nav-item.active {
  color: #ead29d;
  border: 0;
  background: rgba(215, 180, 106, 0.045);
  box-shadow: none;
  transform: translateX(2px);
}

.nav-item:hover::before,
.nav-item.active::before {
  height: 20px;
}

.nav-ico {
  width: 25px;
  height: 25px;
  color: var(--gold-soft);
  font-size: 18px;
  opacity: 0.86;
}

.weather {
  margin-top: 14px;
  padding: 15px 15px 12px;
  border: 1px solid var(--line-subtle);
  border-radius: 19px;
  background: var(--surface);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.035),
    var(--shadow-soft);
}

.weather-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}

.weather h3 {
  margin: 0;
  color: var(--text-secondary);
  font-family: var(--font-ui);
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.weather .place {
  margin: 5px 0 11px;
  color: var(--text-muted);
  font-size: 11.5px;
  line-height: 1.4;
}

.weather-tools {
  display: flex;
  flex: 0 0 auto;
  gap: 5px;
}

.weather-tool {
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 0 8px;
  color: #d9c28f;
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.015em;
  text-decoration: none;
  border: 1px solid rgba(215, 180, 106, 0.18);
  border-radius: 8px;
  background: rgba(215, 180, 106, 0.035);
  transition: color 150ms ease, border-color 150ms ease, background 150ms ease, transform 150ms ease;
}

.weather-tool i {
  font-size: 14px;
}

.weather-tool:hover,
.weather-tool:focus-visible {
  color: #f0d8a4;
  border-color: rgba(215, 180, 106, 0.38);
  background: rgba(215, 180, 106, 0.075);
  outline: none;
  transform: translateY(-1px);
}

.weather-tool:active {
  transform: translateY(1px);
}

.weather-main {
  grid-template-columns: 40px 1fr;
  gap: 10px;
  margin-bottom: 9px;
}

.moon {
  width: 35px;
  height: 35px;
  background: #e6c471;
  box-shadow: none;
}

.moon::after {
  width: 28px;
  height: 28px;
  background: var(--surface);
}

.temp {
  color: var(--text-primary);
  font-size: 22px;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.03em;
}

.weather-small {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 3px 7px;
  color: var(--text-secondary);
  font-size: 10.5px;
  line-height: 1.35;
}

.forecast {
  border-top-color: var(--line-faint);
}

.forecast > div {
  padding-top: 8px;
  border-right-color: var(--line-faint);
}

.forecast strong,
.forecast span {
  font-variant-numeric: tabular-nums;
}

.main,
.right-col {
  padding-top: 24px;
}

.main {
  grid-template-rows: 176px 326px minmax(0, 1fr);
  gap: 20px;
}

.right-col {
  grid-template-rows: 300px 350px minmax(0, 1fr);
  gap: 16px;
}

.card {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--line-subtle);
  border-radius: 20px;
  background: var(--surface);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.032),
    var(--shadow-soft);
}

.card::before {
  content: "";
  position: absolute;
  top: 0;
  right: 22px;
  left: 22px;
  height: 1px;
  pointer-events: none;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.055), transparent);
}

.kpis {
  gap: 13px;
}

.kpi {
  min-height: 0;
  padding: 19px 18px 13px;
  display: grid;
  grid-template-columns: 38px 1fr;
  grid-template-rows: auto auto 1fr;
  column-gap: 11px;
  align-items: center;
}

.kpi-icon {
  width: 36px;
  height: 36px;
  grid-row: 1;
  grid-column: 1;
  color: currentColor;
  font-size: 20px;
  border: 1px solid currentColor;
  border-radius: 11px;
  background: rgba(255, 255, 255, 0.018);
  box-shadow: none;
  opacity: 0.86;
}

.kpi-title {
  grid-row: 1;
  grid-column: 2;
  color: var(--text-muted);
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.kpi-value {
  grid-row: 2;
  grid-column: 1 / -1;
  margin-top: 10px;
  color: var(--text-primary);
  font-size: clamp(36px, 2.15vw, 42px);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.055em;
  line-height: 1;
}

.kpi-delta {
  grid-row: 3;
  grid-column: 1 / -1;
  align-self: start;
  margin-top: 7px;
  color: var(--teal);
  font-size: 12.5px;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}

.kpi-delta.negative {
  color: var(--red);
}

.spark {
  right: 13px;
  bottom: 10px;
  left: auto;
  width: 48%;
  height: 35px;
  opacity: 0.64;
  filter: none;
}

.spark path {
  stroke-width: 1.65;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.agents-section {
  min-height: 0;
}

.section-title {
  margin: 0 0 10px 3px;
  color: var(--text-primary);
  font-family: var(--font-editorial);
  font-size: 34px;
  font-weight: 600;
  letter-spacing: -0.03em;
}

.agents-row {
  gap: 13px;
}

.agent-grid {
  gap: 11px;
}

.agent-card {
  height: 278px;
  border: 1px solid var(--line-subtle);
  border-radius: 18px;
  background: var(--surface);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.03);
  transition: transform 180ms ease, border-color 180ms ease, background 180ms ease;
}

.agent-card:hover,
.agent-card:focus-within {
  border-color: rgba(215, 180, 106, 0.22);
  background: var(--surface-raised);
  box-shadow: none;
  transform: translateY(-2px);
}

.agent-card img {
  width: 100%;
  height: 182px;
  object-fit: cover;
  object-position: center 13%;
  filter: saturate(0.84) contrast(1.02);
}

.agent-card::after {
  background: linear-gradient(180deg, transparent 34%, rgba(14, 25, 33, 0.22) 57%, var(--surface) 100%);
}

.agent-card figcaption {
  right: 12px;
  bottom: 12px;
  left: 12px;
  z-index: 2;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 3px 8px;
  text-align: left;
}

.agent-card strong {
  grid-column: 1 / -1;
  color: #e4c88e;
  font-family: var(--font-ui);
  font-size: 16px;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.agent-card span {
  min-width: 0;
  overflow: hidden;
  color: var(--text-secondary);
  font-size: 11px;
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.agent-status {
  display: inline-flex;
  align-items: center;
  justify-self: end;
  gap: 5px;
  color: var(--text-muted);
  font-size: 9.5px;
  font-weight: 500;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.agent-status i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--green);
}

.agent-card[data-status="idle"] .agent-status i {
  background: var(--amber);
}

.agent-actions {
  top: 9px;
  right: 9px;
}

.agent-actions button {
  border-color: rgba(255, 255, 255, 0.08);
  background: rgba(7, 16, 22, 0.88);
}

.agent-pager {
  width: 78px;
}

.pager-button {
  width: 48px;
  height: 48px;
  color: var(--gold);
  border: 1px solid rgba(215, 180, 106, 0.32);
  background: transparent;
  box-shadow: none;
  transition: transform 150ms ease, background 150ms ease;
}

.pager-button:hover {
  background: rgba(215, 180, 106, 0.055);
  transform: translateX(2px);
}

.page-indicator {
  color: var(--text-secondary);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}

.agent-note {
  color: var(--text-muted);
  font-size: 10.5px;
  line-height: 1.45;
}

.lower {
  grid-template-columns: minmax(540px, 1.18fr) minmax(380px, 0.82fr);
  gap: 16px;
}

.chart-card,
.opportunity,
.side-card {
  padding: 21px;
}

.card-head {
  min-height: 36px;
  margin-bottom: 10px;
}

.card-head h2,
.side-card h2 {
  margin: 0;
  color: var(--text-primary);
  font-family: var(--font-ui);
  font-size: 20px;
  font-weight: 600;
  letter-spacing: -0.025em;
}

.range-select {
  min-height: 34px;
  padding: 0 31px 0 11px;
  color: var(--text-secondary);
  font-size: 12px;
  border: 1px solid var(--line-subtle);
  border-radius: 9px;
  background-color: rgba(7, 16, 22, 0.55);
}

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

.chart-svg {
  overflow: visible;
}

.gridline {
  stroke: rgba(255, 255, 255, 0.052);
  stroke-width: 0.75;
}

#chartGrid line[y1="12"][y2="202"] {
  opacity: 0;
}

.axis-label {
  fill: var(--text-muted);
  font-family: var(--font-ui);
  font-size: 11.5px;
  font-weight: 400;
}

#areaGradient stop:first-child {
  stop-color: var(--teal);
  stop-opacity: 0.2;
}

#areaGradient stop:last-child {
  stop-color: var(--teal);
  stop-opacity: 0.015;
}

.area-fill {
  opacity: 0.72;
}

.area-line {
  stroke: var(--teal);
  stroke-width: 1.85;
  stroke-linecap: round;
  stroke-linejoin: round;
  filter: none;
}

.chart-halo {
  fill: rgba(215, 180, 106, 0.16);
  stroke: rgba(215, 180, 106, 0.42);
  stroke-width: 1;
}

.chart-endpoint {
  fill: var(--gold);
  stroke: var(--canvas-soft);
  stroke-width: 3;
}

.chart-pill {
  right: 3px;
  top: 105px;
  padding: 7px 10px;
  color: #f6efe3;
  font-size: 12px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  border: 1px solid rgba(215, 180, 106, 0.22);
  border-radius: 9px;
  background: var(--surface-warm);
  box-shadow: 0 12px 28px rgba(1, 7, 10, 0.2);
}

.chart-pill::after {
  display: none;
}

.chart-footer {
  margin-top: 8px;
  padding-top: 12px;
  color: var(--text-muted);
  font-size: 12px;
  border-top: 1px solid var(--line-faint);
}

.chart-footer span {
  color: var(--teal);
  font-size: 17px;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}

.insights,
.alerts,
.timeline {
  display: grid;
  gap: 0;
}

.insight {
  min-height: 76px;
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr) auto;
  gap: 11px;
  align-items: center;
  padding: 9px 0;
  border: 0;
  border-bottom: 1px solid var(--line-faint);
  background: transparent;
}

.insight:last-child {
  border-bottom: 0;
}

.insight-icon {
  width: 36px;
  height: 36px;
  color: currentColor;
  font-size: 17px;
  border: 1px solid currentColor;
  border-radius: 11px;
  background: transparent;
  box-shadow: none;
  opacity: 0.75;
}

.insight-copy strong,
.alert-copy strong,
.activity strong {
  color: var(--text-primary);
  font-size: 13px;
  font-weight: 600;
}

.insight-copy small,
.alert-copy small,
.activity span {
  color: var(--text-muted);
  font-size: 11px;
  line-height: 1.4;
}

.insight-value {
  color: var(--teal);
  font-size: 15px;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}

.alert-row {
  min-height: 58px;
  position: relative;
  display: grid;
  grid-template-columns: 22px 1fr;
  gap: 9px;
  align-items: center;
  padding: 8px 2px 8px 9px;
  border: 0;
  border-bottom: 1px solid var(--line-faint);
  border-radius: 0;
  background: transparent;
}

.alert-row::before {
  content: "";
  width: 2px;
  position: absolute;
  top: 10px;
  bottom: 10px;
  left: 0;
  border-radius: 2px;
  background: var(--red);
}

.alert-row.warn::before {
  background: var(--amber);
}

.alert-row:last-child {
  border-bottom: 0;
}

.alert-dot {
  width: 17px;
  height: 17px;
  color: var(--red);
  font-size: 9px;
  border: 1px solid currentColor;
  background: transparent;
}

.alert-row.warn .alert-dot {
  color: var(--amber);
}

.alert-link {
  min-height: 34px;
  margin-top: 8px;
  color: var(--gold);
  font-size: 12px;
  font-weight: 500;
  border-top: 1px solid var(--line-faint);
}

.activity {
  min-height: 60px;
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 4px 10px;
  padding: 8px 0 8px 20px;
  border-bottom: 1px solid var(--line-faint);
}

.activity:last-child {
  border-bottom: 0;
}

.activity::before {
  width: 1px;
  left: 5px;
  background: rgba(255, 255, 255, 0.08);
}

.activity::after {
  content: "";
  width: 7px;
  height: 7px;
  position: absolute;
  top: 13px;
  left: 2px;
  border-radius: 50%;
  background: var(--dot);
}

.activity .time {
  color: var(--text-secondary);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}

.quick-grid {
  gap: 8px;
}

.quick {
  min-height: 76px;
  padding: 10px 6px;
  color: var(--text-secondary);
  border: 1px solid var(--line-subtle);
  border-radius: 14px;
  background: rgba(7, 16, 22, 0.34);
  transition: color 150ms ease, border-color 150ms ease, background 150ms ease, transform 150ms ease;
}

.quick:hover {
  color: #ead29d;
  border-color: rgba(215, 180, 106, 0.18);
  background: rgba(215, 180, 106, 0.035);
  transform: translateY(-1px);
}

.quick-ico {
  color: var(--gold-soft);
  font-size: 25px;
}

.quick span {
  font-size: 11px;
  font-weight: 500;
}

.auth-gate {
  background:
    radial-gradient(circle at 50% 38%, rgba(85, 199, 196, 0.045), transparent 28%),
    var(--canvas);
}

.auth-card {
  width: min(92vw, 460px);
  padding: 42px;
  border: 1px solid var(--line-subtle);
  border-radius: 20px;
  background: var(--surface);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.035),
    var(--shadow-soft);
}

.auth-title {
  font-size: 35px;
  line-height: 0.72;
}

.auth-title span:last-child {
  margin-top: 9px;
  font-size: 30px;
}

.auth-subtitle {
  max-width: 34ch;
  margin-right: auto;
  margin-left: auto;
  color: var(--text-secondary);
  font-size: 14px;
  line-height: 1.55;
}

.auth-input,
.auth-submit,
.auth-logout {
  border-radius: 11px;
}

.auth-input {
  color: var(--text-primary);
  border-color: var(--line-subtle);
  background: rgba(7, 16, 22, 0.55);
}

.auth-input:focus {
  border-color: rgba(215, 180, 106, 0.36);
  box-shadow: 0 0 0 3px rgba(215, 180, 106, 0.055);
}

.auth-submit {
  color: #dcc590;
  border-color: rgba(215, 180, 106, 0.26);
  background: rgba(215, 180, 106, 0.045);
}

.auth-submit:not(:disabled):hover {
  background: rgba(215, 180, 106, 0.075);
}

@media (max-width: 1660px) {
  .dashboard {
    grid-template-columns: 265px minmax(780px, 1fr) 330px;
    gap: 15px;
    padding-right: 15px;
  }

  .sidebar {
    padding: 22px 15px 15px;
  }

  .brand-title {
    font-size: 30px;
  }

  .hero-photo {
    height: 205px;
    margin-right: -15px;
    margin-left: -15px;
  }

  .nav-item {
    height: 39px;
  }

  .weather {
    padding: 12px;
  }

  .main,
  .right-col {
    padding-top: 18px;
  }

  .main {
    grid-template-rows: 160px 300px minmax(0, 1fr);
    gap: 15px;
  }

  .right-col {
    grid-template-rows: 284px 330px minmax(0, 1fr);
    gap: 13px;
  }

  .kpi {
    padding: 15px;
  }

  .kpi-value {
    font-size: 35px;
  }

  .section-title {
    font-size: 31px;
  }

  .agent-card {
    height: 254px;
  }

  .agent-card img {
    height: 164px;
  }

  .chart-card,
  .opportunity,
  .side-card {
    padding: 17px;
  }

  .insight {
    min-height: 68px;
  }
}

@media (max-width: 1440px) {
  .dashboard {
    grid-template-columns: 245px minmax(720px, 1fr) 310px;
    min-width: 1280px;
  }

  .brand-title {
    font-size: 29px;
  }

  .brand-subtitle {
    font-size: 12px;
  }

  .hero-photo {
    height: 176px;
  }

  .nav-item {
    height: 39px;
    font-size: 13.5px;
  }

  .weather-tool {
    height: 32px;
    font-size: 10.5px;
  }

  .weather-main {
    margin-bottom: 5px;
  }

  .forecast > div {
    padding-top: 5px;
  }

  .agent-card {
    height: 230px;
  }

  .agent-card img {
    height: 146px;
  }

  .agent-card strong {
    font-size: 15px;
  }

  .agent-card span {
    font-size: 10px;
  }

  .chart-wrap {
    min-height: 230px;
  }
}

@media (max-width: 900px) {
  body {
    overflow: auto;
  }

  .dashboard {
    width: 100%;
    min-width: 0;
    height: auto;
    min-height: 100dvh;
    grid-template-columns: 1fr;
    gap: 16px;
    padding: 0 14px 22px;
  }

  .sidebar {
    min-height: auto;
    margin: 0 -14px;
    padding: 22px 16px 16px;
    border-right: 0;
    border-bottom: 1px solid rgba(215, 180, 106, 0.14);
  }

  .hero-photo {
    height: 220px;
    margin-right: -16px;
    margin-left: -16px;
  }

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

  .weather {
    margin-top: 15px;
  }

  .main,
  .right-col {
    padding-top: 0;
  }

  .main {
    display: grid;
    grid-template-rows: auto auto auto;
  }

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

  .kpi {
    min-height: 145px;
  }

  .agent-card {
    height: 230px;
  }

  .agent-card img {
    height: 150px;
  }

  .lower,
  .right-col {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .dashboard {
    padding-right: 10px;
    padding-left: 10px;
  }

  .sidebar {
    margin-right: -10px;
    margin-left: -10px;
  }

  .nav,
  .kpis {
    grid-template-columns: 1fr;
  }

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

  .kpi {
    min-height: 132px;
  }

  .agent-pager {
    width: 54px;
  }

  .auth-card {
    padding: 34px 24px;
  }
}

/*
 * Responsive product layout
 * Keeps the three-rail desktop composition, then progressively turns the
 * sidebar into a compact header and dense card rows into touch scroll areas.
 */
body {
  overflow-x: hidden;
}

.dashboard,
.main,
.right-col,
.lower,
.agents-row,
.agent-viewport {
  min-width: 0;
}

@media (max-width: 1441px) {
  .dashboard {
    width: 100%;
    min-width: 0;
    height: auto;
    min-height: 100dvh;
    grid-template-columns: 230px minmax(0, 1fr);
    grid-template-areas:
      "sidebar main"
      "sidebar right";
    align-items: start;
    gap: 14px;
    padding: 0 14px 18px 0;
  }

  .sidebar {
    grid-area: sidebar;
    position: sticky;
    top: 0;
    min-height: 100dvh;
  }

  .main {
    grid-area: main;
    grid-template-rows: auto auto auto;
  }

  .right-col {
    grid-area: right;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    grid-template-rows: none;
    padding-top: 0;
  }

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

  .agent-page {
    grid-template-columns: repeat(5, minmax(128px, 1fr));
  }

  .kpi-value {
    font-size: clamp(30px, 3vw, 38px);
  }

  .kpi {
    min-height: 124px;
  }
}

@media (max-width: 1180px) {
  .dashboard {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas:
      "sidebar"
      "main"
      "right";
    gap: 16px;
    padding: 0 16px 22px;
    overflow: clip;
  }

  .sidebar {
    display: grid;
    grid-template-columns: 220px minmax(0, 1fr);
    grid-template-areas:
      "brand nav"
      "weather weather";
    gap: 10px 18px;
    position: static;
    min-height: 0;
    margin: 0 -16px;
    padding: 16px;
    border-right: 0;
    border-bottom: 1px solid rgba(215, 180, 106, 0.14);
    box-shadow: 0 14px 45px rgba(1, 7, 10, 0.18);
  }

  .brand {
    grid-area: brand;
    align-self: center;
    padding: 0;
  }

  .brand-title {
    font-size: 27px;
  }

  .brand-title span:last-child {
    margin-top: 5px;
    font-size: 24px;
  }

  .brand-subtitle {
    max-width: 20ch;
    margin-top: 7px;
    font-size: 12px;
  }

  .hero-photo {
    display: none;
  }

  .nav {
    grid-area: nav;
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    align-self: center;
    gap: 4px;
    padding: 0;
  }

  .nav-item {
    width: 100%;
    height: 40px;
    gap: 6px;
    padding: 0 8px;
    font-size: 12px;
  }

  .nav-ico {
    width: 22px;
    height: 22px;
    font-size: 16px;
  }

  .weather {
    grid-area: weather;
    display: grid;
    grid-template-columns: minmax(180px, 0.9fr) minmax(150px, 0.65fr) minmax(300px, 1.45fr);
    grid-template-areas:
      "weather-head weather-main forecast"
      "weather-place weather-main forecast";
    align-items: center;
    gap: 4px 18px;
    margin-top: 4px;
    padding: 12px 14px;
  }

  .weather-head {
    grid-area: weather-head;
  }

  .weather .place {
    grid-area: weather-place;
    margin: 0;
  }

  .weather-main {
    grid-area: weather-main;
    margin: 0;
  }

  .forecast {
    grid-area: forecast;
    align-self: stretch;
  }

  .main,
  .right-col {
    padding-top: 0;
  }

  .main {
    gap: 18px;
  }

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

  .kpi {
    min-height: 138px;
  }

  .agents-row {
    grid-template-columns: minmax(0, 1fr);
  }

  .agent-viewport {
    overflow-x: auto;
    overflow-y: hidden;
    overscroll-behavior-inline: contain;
    scroll-snap-type: inline mandatory;
    scrollbar-width: thin;
    scrollbar-color: rgba(215, 180, 106, 0.35) transparent;
  }

  .agent-track {
    display: flex;
    width: max-content;
    transform: none !important;
  }

  .agent-page {
    display: flex;
    width: auto;
    flex: none;
    gap: 12px;
  }

  .agent-card {
    width: 190px;
    height: 250px;
    flex: none;
    scroll-snap-align: start;
  }

  .agent-card img {
    height: 170px;
  }

  .agent-pager {
    display: none;
  }

  .right-col {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    margin-top: 0;
  }
}

@media (max-width: 720px) {
  .dashboard {
    gap: 14px;
    padding: 0 10px 18px;
  }

  .sidebar {
    display: block;
    margin: 0 -10px;
    padding: 14px 10px;
  }

  .brand {
    padding: 0 4px 12px;
  }

  .brand-title {
    font-size: 25px;
  }

  .brand-title span:last-child {
    font-size: 22px;
  }

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

  .nav-item {
    min-width: 0;
    height: 44px;
    padding-inline: 10px;
    font-size: 12.5px;
  }

  .weather {
    display: block;
    margin-top: 12px;
    padding: 13px;
  }

  .weather .place {
    margin: 3px 0 0;
  }

  .weather-main {
    margin: 12px 0 6px;
  }

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

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

  .kpi {
    min-height: 126px;
    padding: 14px;
    grid-template-columns: 34px minmax(0, 1fr);
    column-gap: 9px;
  }

  .kpi-icon {
    position: static;
    width: 34px;
    height: 34px;
    font-size: 19px;
  }

  .kpi-title {
    min-width: 0;
    margin: 0;
    font-size: 10px;
    line-height: 1.25;
  }

  .kpi-value {
    margin-top: 9px;
    font-size: clamp(27px, 8vw, 34px);
  }

  .kpi-delta {
    margin-top: 7px;
    padding-right: 38%;
    font-size: 11px;
    line-height: 1.25;
  }

  .spark {
    width: 42%;
  }

  .section-title {
    margin-left: 0;
    font-size: 27px;
  }

  .agent-card {
    width: 178px;
    height: 230px;
  }

  .agent-card img {
    height: 150px;
  }

  .agent-actions {
    opacity: 1;
    transform: none;
    pointer-events: auto;
  }

  .chart-card,
  .opportunity,
  .side-card {
    padding: 14px;
  }

  .card-head {
    align-items: stretch;
    flex-direction: column;
    gap: 8px;
  }

  .range-select {
    width: 100%;
  }

  .chart-wrap {
    overflow-x: auto;
    overflow-y: hidden;
    overscroll-behavior-inline: contain;
    scrollbar-width: thin;
  }

  .chart-svg {
    width: 560px;
    min-width: 560px;
    height: 220px;
  }

  .chart-pill {
    display: none;
  }

  .right-col {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .auth-logout {
    top: 8px;
    right: 8px;
  }
}

@media (max-width: 480px) {
  .brand-subtitle {
    max-width: none;
  }

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

  .kpi {
    min-height: 116px;
  }

  .kpi-delta {
    padding-right: 30%;
  }

  .agent-card {
    width: min(82vw, 300px);
    height: 282px;
  }

  .agent-card img {
    height: 198px;
  }

  .agent-card strong {
    font-size: 16px;
  }

  .agent-card span {
    font-size: 11px;
  }

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

  .auth-card {
    width: min(92vw, 430px);
    padding: 30px 20px;
  }
}

@media (max-width: 350px) {
  .forecast {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

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

/*
 * Device-aware desktop preservation
 * ---------------------------------
 * Phones and touch tablets keep the compact header/mobile flow above.
 * Desktop browsers retain the original sidebar composition even when the
 * window is narrow (split-screen, remote desktop, or browser side-by-side).
 */
@media (max-width: 1180px) {
  html[data-device-view="desktop"] .dashboard {
    display: grid;
    grid-template-columns: clamp(196px, 22vw, 222px) minmax(0, 1fr);
    grid-template-areas:
      "sidebar main"
      "sidebar right";
    gap: 12px;
    padding: 0 12px 18px 0;
    overflow: clip;
  }

  html[data-device-view="desktop"] .sidebar {
    grid-area: sidebar;
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    align-self: start;
    height: auto;
    min-height: 100dvh;
    margin: 0;
    padding: 18px 12px 14px;
    overflow: visible;
    border-right: 1px solid rgba(215, 180, 106, 0.16);
    border-bottom: 0;
  }

  html[data-device-view="desktop"] .brand {
    align-self: stretch;
    padding: 0 8px 12px;
  }

  html[data-device-view="desktop"] .brand-title {
    font-size: 28px;
  }

  html[data-device-view="desktop"] .brand-title span:last-child {
    margin-top: 7px;
    font-size: 25px;
  }

  html[data-device-view="desktop"] .brand-subtitle {
    max-width: none;
    font-size: 11.5px;
  }

  html[data-device-view="desktop"] .hero-photo {
    display: block;
    height: clamp(138px, 21vh, 190px);
    margin: 0 -12px 10px;
  }

  html[data-device-view="desktop"] .nav {
    display: flex;
    flex-direction: column;
    gap: 1px;
    padding: 0 2px;
  }

  html[data-device-view="desktop"] .nav-item {
    width: 100%;
    min-width: 0;
    height: 40px;
    gap: 8px;
    padding: 0 9px;
    font-size: 12.5px;
  }

  html[data-device-view="desktop"] .nav-ico {
    width: 24px;
    height: 24px;
    font-size: 17px;
  }

  html[data-device-view="desktop"] .weather {
    display: block;
    margin: auto 0 0;
    padding: 12px 11px 10px;
  }

  html[data-device-view="desktop"] .weather-head {
    align-items: stretch;
    flex-direction: column;
    gap: 7px;
  }

  html[data-device-view="desktop"] .weather-tools {
    width: 100%;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  html[data-device-view="desktop"] .weather-tool {
    min-width: 0;
    padding-inline: 5px;
  }

  html[data-device-view="desktop"] .weather .place {
    margin: 5px 0 9px;
  }

  html[data-device-view="desktop"] .weather-main {
    margin: 0 0 8px;
  }

  html[data-device-view="desktop"] .forecast {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  html[data-device-view="desktop"] .main {
    grid-area: main;
    gap: 16px;
    padding-top: 14px;
  }

  html[data-device-view="desktop"] .right-col {
    grid-area: right;
    padding-top: 0;
  }

  html[data-device-view="desktop"] .kpis {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  html[data-device-view="desktop"] .kpi {
    min-height: 126px;
  }

  html[data-device-view="desktop"] .section-title {
    margin-left: 0;
  }

  html[data-device-view="desktop"] .agents-row {
    grid-template-columns: minmax(0, 1fr);
  }

  html[data-device-view="desktop"] .agent-viewport {
    overflow: visible;
  }

  html[data-device-view="desktop"] .agent-track {
    display: block;
    width: 100%;
    transform: none !important;
  }

  html[data-device-view="desktop"] .agent-page {
    width: 100%;
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 8px;
  }

  html[data-device-view="desktop"] .agent-card {
    width: auto;
    min-width: 0;
    height: 214px;
  }

  html[data-device-view="desktop"] .agent-card img {
    height: 142px;
  }

  html[data-device-view="desktop"] .agent-card strong {
    font-size: clamp(12px, 1.35vw, 15px);
  }

  html[data-device-view="desktop"] .agent-card span {
    font-size: 8.5px;
  }

  html[data-device-view="desktop"] .agent-pager {
    display: none;
  }
}

@media (max-width: 700px) {
  html[data-device-view="desktop"] .dashboard {
    grid-template-columns: 176px minmax(0, 1fr);
    gap: 8px;
    padding-right: 8px;
  }

  html[data-device-view="desktop"] .sidebar {
    padding-inline: 9px;
  }

  html[data-device-view="desktop"] .hero-photo {
    margin-inline: -9px;
  }

  html[data-device-view="desktop"] .kpis {
    grid-template-columns: 1fr;
  }

  html[data-device-view="desktop"] .agent-page {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/*
 * KPI layout A
 * ------------
 * The icon and label share a dedicated header row. The value always starts
 * below that row, so neither text nor numerals can overlap the badge.
 */
.kpi {
  padding: 16px 16px 13px;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: auto auto 1fr;
  column-gap: 0;
  row-gap: 7px;
  align-items: start;
}

.kpi-head {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 10px;
}

.kpi-icon {
  position: static;
  width: 36px;
  height: 36px;
  display: inline-grid;
  place-items: center;
  flex: 0 0 auto;
  font-size: 20px;
}

.kpi-title {
  min-width: 0;
  margin: 0;
  line-height: 1.25;
}

.kpi-value {
  margin-top: 0;
}

.kpi-delta {
  margin-top: 0;
}

.kpi-table-plan {
  width: 25px;
  height: 25px;
  position: relative;
  display: block;
  color: currentColor;
}

.kpi-table-plan .table-top {
  position: absolute;
  inset: 6px 5px;
  border: 1.4px solid currentColor;
  border-radius: 4px;
}

.kpi-table-plan .table-seat {
  width: 5px;
  height: 5px;
  position: absolute;
  border: 1.2px solid currentColor;
  border-radius: 50%;
  background: var(--surface);
}

.kpi-table-plan .table-seat--top {
  top: 0;
  left: 10px;
}

.kpi-table-plan .table-seat--right {
  top: 10px;
  right: 0;
}

.kpi-table-plan .table-seat--bottom {
  bottom: 0;
  left: 10px;
}

.kpi-table-plan .table-seat--left {
  top: 10px;
  left: 0;
}

@media (max-width: 720px) {
  .kpi {
    padding: 14px;
    row-gap: 6px;
  }

  .kpi-head {
    gap: 9px;
  }

  .kpi-icon {
    width: 34px;
    height: 34px;
    font-size: 19px;
  }
}

/* Operational workspace */
button.kpi {
  width: 100%;
  appearance: none;
  text-align: left;
  font: inherit;
  cursor: pointer;
  transition: border-color 160ms ease, background 160ms ease, transform 160ms ease;
}

button.kpi:hover,
button.kpi:focus-visible {
  border-color: color-mix(in srgb, currentColor 42%, transparent);
  background: var(--surface-raised);
  outline: none;
  transform: translateY(-1px);
}

.agent-card {
  cursor: pointer;
}

.agent-card:focus-visible,
.quick:focus-visible,
.alert-link:focus-visible {
  outline: 2px solid rgba(215, 180, 106, 0.78);
  outline-offset: 3px;
}

body.workspace-open {
  overflow: hidden;
}

.workspace-overlay[hidden] {
  display: none;
}

.workspace-overlay {
  position: fixed;
  inset: 0;
  z-index: 70;
  display: grid;
  justify-items: end;
  padding: 12px;
}

.workspace-backdrop {
  position: absolute;
  inset: 0;
  width: 100%;
  border: 0;
  background: rgba(2, 8, 12, 0.72);
  backdrop-filter: blur(8px);
  cursor: default;
}

.workspace-panel {
  width: min(620px, calc(100vw - 24px));
  height: calc(100dvh - 24px);
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  overflow: hidden;
  border: 1px solid rgba(215, 180, 106, 0.2);
  border-radius: 22px;
  background:
    radial-gradient(circle at 85% 0%, rgba(85, 199, 196, 0.07), transparent 28%),
    var(--surface);
  box-shadow: -28px 0 90px rgba(0, 0, 0, 0.42);
}

.workspace-header {
  min-height: 94px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 22px 24px 20px;
  border-bottom: 1px solid var(--line-subtle);
}

.workspace-kicker {
  margin: 0 0 5px;
  color: var(--gold);
  font-size: 11px;
  font-weight: 650;
  letter-spacing: 0.11em;
  text-transform: uppercase;
}

.workspace-header h2 {
  margin: 0;
  font-family: var(--font-editorial);
  font-size: clamp(28px, 4vw, 38px);
  font-weight: 600;
  line-height: 1;
}

.workspace-close {
  width: 42px;
  height: 42px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  border: 1px solid var(--line-subtle);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.025);
  color: var(--text-primary);
  font-size: 21px;
  cursor: pointer;
}

.workspace-close:hover,
.workspace-close:focus-visible {
  border-color: rgba(215, 180, 106, 0.55);
  color: var(--gold);
  outline: none;
}

.workspace-body {
  min-width: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 24px;
}

.workspace-metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 22px;
}

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

.workspace-metric {
  min-width: 0;
  min-height: 108px;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 14px;
  border: 1px solid var(--line-subtle);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.018);
}

.workspace-metric span {
  margin-bottom: auto;
  color: var(--text-muted);
  font-size: 10px;
  font-weight: 650;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.workspace-metric strong {
  overflow-wrap: anywhere;
  color: var(--text-primary);
  font-size: clamp(18px, 2.4vw, 25px);
  font-weight: 600;
  letter-spacing: -0.035em;
}

.workspace-metric small {
  margin-top: 4px;
  color: var(--text-secondary);
  font-size: 11px;
}

.workspace-metric--sales {
  overflow: hidden;
  padding-bottom: 0;
}

.sales-previous-button {
  width: calc(100% + 28px);
  min-height: 58px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  margin: 12px -14px 0;
  padding: 10px 14px;
  border: 0;
  border-top: 1px solid rgba(215, 180, 106, 0.18);
  background: rgba(215, 180, 106, 0.055);
  color: var(--text-primary);
  text-align: left;
  cursor: pointer;
  transition: background 160ms ease, color 160ms ease;
}

.sales-previous-button > span {
  min-width: 0;
  display: grid;
  gap: 2px;
  margin: 0;
}

.sales-previous-button small {
  margin: 0;
  color: var(--text-muted);
  font-size: 9px;
  font-weight: 650;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.sales-previous-button strong {
  color: var(--gold);
  font-size: 15px;
  letter-spacing: -0.015em;
}

.sales-previous-button i {
  color: var(--gold);
  font-size: 18px;
}

.sales-previous-button:hover,
.sales-previous-button:focus-visible,
.sales-previous-button.is-open {
  background: rgba(215, 180, 106, 0.12);
  outline: none;
}

.sales-previous-button:focus-visible {
  box-shadow: inset 0 0 0 2px rgba(215, 180, 106, 0.7);
}

.sales-previous-button:active {
  transform: translateY(1px);
}

.sales-previous-button:disabled {
  color: var(--text-muted);
  cursor: not-allowed;
  opacity: 0.62;
}

.sales-day-comparison {
  margin: -4px 0 22px;
  padding: 18px;
  border: 1px solid rgba(215, 180, 106, 0.22);
  border-radius: 14px;
  background: rgba(215, 180, 106, 0.035);
}

.sales-day-comparison:focus {
  outline: none;
}

.sales-comparison-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 20px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--line-subtle);
}

.sales-comparison-header span {
  color: var(--text-muted);
  font-size: 9px;
  font-weight: 650;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.sales-comparison-header h3 {
  margin: 5px 0 0;
  color: var(--text-primary);
  font-size: 21px;
  font-weight: 600;
  letter-spacing: -0.025em;
  text-transform: capitalize;
}

.sales-comparison-delta {
  color: var(--text-secondary);
  font-size: 14px;
  font-weight: 650;
  white-space: nowrap;
}

.sales-comparison-delta.is-positive {
  color: var(--green);
}

.sales-comparison-delta.is-negative {
  color: #ef8f82;
}

.sales-comparison-head,
.sales-comparison-row {
  display: grid;
  grid-template-columns: minmax(130px, 1.25fr) repeat(2, minmax(100px, 1fr));
  gap: 12px;
  align-items: center;
}

.sales-comparison-head {
  padding: 14px 0 8px;
  color: var(--text-muted);
  font-size: 10px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.sales-comparison-head strong {
  color: var(--text-secondary);
  font-size: 10px;
  font-weight: 650;
  text-align: right;
}

.sales-comparison-table {
  margin: 0;
}

.sales-comparison-row {
  min-height: 43px;
  border-top: 1px solid var(--line-subtle);
}

.sales-comparison-row dt,
.sales-comparison-row dd {
  margin: 0;
}

.sales-comparison-row dt {
  color: var(--text-secondary);
  font-size: 12px;
}

.sales-comparison-row dd {
  color: var(--text-primary);
  font-size: 13px;
  font-weight: 600;
  text-align: right;
}

.sales-day-comparison .workspace-note {
  margin: 14px 0 0;
}

.sales-day-comparison code {
  color: var(--gold);
  font-family: "IBM Plex Mono", Consolas, monospace;
  font-size: 0.95em;
}

.workspace-agent {
  min-width: 0;
  display: grid;
  grid-template-columns: 64px minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
  margin-bottom: 22px;
  padding: 12px;
  border: 1px solid var(--line-subtle);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.018);
}

.workspace-agent img {
  width: 64px;
  height: 64px;
  object-fit: cover;
  border-radius: 12px;
  background: var(--canvas);
}

.workspace-agent div {
  min-width: 0;
}

.workspace-agent strong,
.workspace-agent span {
  display: block;
}

.workspace-agent strong {
  margin-bottom: 3px;
  font-family: var(--font-editorial);
  font-size: 24px;
  line-height: 1;
}

.workspace-agent span {
  color: var(--text-secondary);
  font-size: 12px;
}

.workspace-agent em {
  padding: 5px 8px;
  border-radius: 999px;
  background: rgba(226, 169, 79, 0.1);
  color: var(--amber);
  font-size: 10px;
  font-style: normal;
  text-transform: uppercase;
}

.workspace-agent em.is-active {
  background: rgba(123, 207, 145, 0.1);
  color: var(--green);
}

.workspace-section-title {
  margin: 28px 0 12px;
  color: var(--text-primary);
  font-size: 13px;
  font-weight: 650;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.workspace-list {
  border-top: 1px solid var(--line-subtle);
}

.workspace-list-row {
  min-width: 0;
  display: grid;
  grid-template-columns: 26px minmax(0, 1fr) auto;
  align-items: center;
  gap: 11px;
  padding: 14px 2px;
  border-bottom: 1px solid var(--line-subtle);
}

.workspace-list-row div {
  min-width: 0;
}

.workspace-list-row strong,
.workspace-list-row span {
  display: block;
}

.workspace-list-row strong {
  color: var(--text-primary);
  font-size: 13px;
  font-weight: 600;
}

.workspace-list-row div > span {
  margin-top: 3px;
  color: var(--text-muted);
  font-size: 11px;
  line-height: 1.45;
}

.workspace-list-row time,
.workspace-list-row b {
  color: var(--text-secondary);
  font-size: 11px;
  font-weight: 600;
  text-align: right;
}

.workspace-list-dot {
  width: 8px;
  height: 8px;
  justify-self: center;
  border-radius: 50%;
  background: var(--row-color);
  box-shadow: 0 0 0 5px color-mix(in srgb, var(--row-color) 12%, transparent);
}

.workspace-list-icon {
  color: var(--row-color);
  font-size: 20px;
  text-align: center;
}

.workspace-hero {
  margin-bottom: 16px;
  padding: 22px;
  border: 1px solid color-mix(in srgb, var(--workspace-accent) 24%, transparent);
  border-radius: 18px;
  background: color-mix(in srgb, var(--workspace-accent) 5%, var(--canvas-soft));
}

.workspace-hero > span,
.workspace-hero > strong,
.workspace-hero > small {
  display: block;
}

.workspace-hero > span {
  color: var(--text-muted);
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.workspace-hero > strong {
  margin-top: 5px;
  color: var(--text-primary);
  font-size: clamp(38px, 8vw, 58px);
  font-weight: 600;
  letter-spacing: -0.055em;
}

.workspace-hero > small {
  color: var(--workspace-accent);
  font-size: 12px;
}

.workspace-spark {
  width: 100%;
  height: auto;
  margin-top: 18px;
  overflow: visible;
}

.workspace-spark path {
  fill: none;
  stroke: var(--workspace-accent);
  stroke-width: 2;
  vector-effect: non-scaling-stroke;
}

.workspace-alerts {
  display: grid;
  gap: 9px;
}

.sales-discrepancy-alerts {
  margin: -4px 0 22px;
}

.sales-comparison-alerts {
  margin-top: 14px;
}

.workspace-alert {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  padding: 13px;
  border: 1px solid rgba(223, 102, 88, 0.18);
  border-radius: 13px;
  background: rgba(223, 102, 88, 0.045);
}

.workspace-alert > span {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: rgba(223, 102, 88, 0.12);
  color: var(--red);
  font-weight: 700;
}

.workspace-alert.is-warning {
  border-color: rgba(226, 169, 79, 0.18);
  background: rgba(226, 169, 79, 0.04);
}

.workspace-alert.is-warning > span {
  background: rgba(226, 169, 79, 0.12);
  color: var(--amber);
}

.workspace-alert strong,
.workspace-alert small {
  display: block;
}

.workspace-alert strong {
  font-size: 13px;
}

.workspace-alert small {
  margin-top: 3px;
  color: var(--text-muted);
  font-size: 11px;
}

.workspace-report,
.workspace-setting,
.workspace-note,
.workspace-empty {
  border: 1px solid var(--line-subtle);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.018);
}

.workspace-report {
  padding: 20px;
}

.workspace-report span,
.workspace-report strong,
.workspace-report small {
  display: block;
}

.workspace-report span,
.workspace-report small {
  color: var(--text-muted);
  font-size: 11px;
}

.workspace-report strong {
  margin: 5px 0;
  font-size: 34px;
  font-weight: 600;
}

.workspace-setting {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  gap: 12px;
  margin-top: 10px;
  padding: 15px;
}

.workspace-setting > i {
  color: var(--gold);
  font-size: 24px;
}

.workspace-setting strong,
.workspace-setting span {
  display: block;
}

.workspace-setting strong {
  margin-bottom: 4px;
  font-size: 13px;
}

.workspace-setting span {
  color: var(--text-muted);
  font-size: 11px;
  line-height: 1.5;
}

.workspace-note,
.workspace-empty {
  padding: 14px;
  color: var(--text-secondary);
  font-size: 12px;
  line-height: 1.55;
}

.panel-empty {
  margin: 0;
  padding: 18px;
  border: 1px dashed var(--line-subtle);
  border-radius: 12px;
  color: var(--text-muted);
  font-size: 12px;
  line-height: 1.5;
}

.workspace-form {
  display: grid;
  gap: 14px;
  margin-top: 22px;
  padding: 18px;
  border: 1px solid var(--line-subtle);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.018);
}

.workspace-form .workspace-section-title {
  margin: 0 0 2px;
}

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

.workspace-form label {
  min-width: 0;
  display: grid;
  gap: 7px;
}

.workspace-form label > span {
  color: var(--text-secondary);
  font-size: 11px;
  font-weight: 600;
}

.workspace-form input,
.workspace-form select {
  width: 100%;
  min-width: 0;
  min-height: 44px;
  padding: 0 12px;
  border: 1px solid rgba(215, 180, 106, 0.18);
  border-radius: 10px;
  outline: none;
  background: #0a171d;
  color: var(--text-primary);
  font: inherit;
  color-scheme: dark;
}

.workspace-form input:focus,
.workspace-form select:focus {
  border-color: rgba(215, 180, 106, 0.62);
  box-shadow: 0 0 0 3px rgba(215, 180, 106, 0.08);
}

.workspace-form input:disabled,
.workspace-form select:disabled,
.workspace-form[aria-busy="true"] input,
.workspace-form[aria-busy="true"] select {
  opacity: 0.62;
}

.workspace-form-wide {
  grid-column: 1 / -1;
}

.workspace-form .workspace-primary {
  justify-self: start;
  margin-top: 2px;
}

.workspace-primary:disabled {
  cursor: wait;
  opacity: 0.62;
}

.workspace-form-status {
  min-height: 18px;
  margin: -4px 0 0;
  color: var(--text-muted);
  font-size: 11px;
  line-height: 1.5;
}

.workspace-form-status.is-success {
  color: #7bcf91;
}

.workspace-form-status.is-error {
  color: #ef8478;
}

.consumer-mapping-stack {
  display: grid;
  gap: 12px;
}

.consumer-mapping-form {
  border-color: rgba(215, 180, 106, 0.24);
  background:
    linear-gradient(145deg, rgba(215, 180, 106, 0.05), transparent 42%),
    var(--surface-raised);
}

.consumer-mapping-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.consumer-mapping-heading div {
  min-width: 0;
  display: grid;
  gap: 3px;
}

.consumer-mapping-heading span,
.consumer-mapping-heading small {
  color: var(--text-muted);
  font-size: 11px;
}

.consumer-mapping-heading strong {
  color: var(--text-primary);
  font-size: 16px;
}

.consumer-mapping-heading > i {
  flex: 0 0 auto;
  color: var(--gold);
  font-size: 22px;
}

.workspace-primary {
  min-height: 46px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  margin-top: 16px;
  padding: 0 18px;
  border: 1px solid rgba(215, 180, 106, 0.38);
  border-radius: 10px;
  background: rgba(215, 180, 106, 0.11);
  color: #f3d999;
  font-weight: 600;
  cursor: pointer;
}

.workspace-primary:hover,
.workspace-primary:focus-visible {
  background: rgba(215, 180, 106, 0.18);
  outline: none;
}

@media (max-width: 720px) {
  .workspace-overlay {
    padding: 0;
  }

  .workspace-panel {
    width: 100%;
    height: 100dvh;
    border: 0;
    border-radius: 0;
  }

  .workspace-header {
    min-height: 82px;
    padding: 18px 16px;
  }

  .workspace-body {
    padding: 18px 16px 28px;
  }

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

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

  .workspace-metric:last-child:nth-child(odd) {
    grid-column: 1 / -1;
  }

  .sales-comparison-header {
    grid-template-columns: 1fr;
    align-items: start;
    gap: 8px;
  }

  .sales-comparison-delta {
    white-space: normal;
  }

  .sales-comparison-head,
  .sales-comparison-row {
    grid-template-columns: minmax(96px, 1fr) repeat(2, minmax(82px, 0.85fr));
    gap: 8px;
  }

  .sales-comparison-row dd {
    font-size: 12px;
  }

  .workspace-agent {
    grid-template-columns: 54px minmax(0, 1fr);
  }

  .workspace-agent img {
    width: 54px;
    height: 54px;
  }

  .workspace-agent em {
    grid-column: 2;
    justify-self: start;
    margin-top: -9px;
  }

  .workspace-list-row {
    grid-template-columns: 22px minmax(0, 1fr);
  }

  .workspace-list-row time,
  .workspace-list-row b {
    grid-column: 2;
    justify-self: start;
    text-align: left;
  }

  .workspace-form {
    padding: 15px;
  }

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

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

.workspace-overlay--wide .workspace-panel {
  width: min(1080px, calc(100vw - 24px));
}

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

.product-cost-toolbar {
  position: sticky;
  top: -24px;
  z-index: 4;
  display: grid;
  grid-template-columns: minmax(240px, 1fr) minmax(220px, auto);
  gap: 10px;
  margin: 0 -2px 16px;
  padding: 12px 2px;
  background: linear-gradient(180deg, var(--surface) 75%, transparent);
}

.product-cost-toolbar label {
  min-width: 0;
  position: relative;
}

.product-cost-toolbar i {
  position: absolute;
  top: 50%;
  left: 14px;
  color: var(--text-muted);
  font-size: 18px;
  transform: translateY(-50%);
  pointer-events: none;
}

.product-cost-toolbar input,
.product-cost-toolbar select {
  width: 100%;
  min-height: 46px;
  border: 1px solid var(--line-subtle);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.025);
  color: var(--text-primary);
  font: inherit;
  outline: none;
}

.product-cost-toolbar input {
  padding: 0 14px 0 42px;
}

.product-cost-toolbar select {
  padding: 0 38px 0 14px;
}

.product-cost-toolbar input:focus,
.product-cost-toolbar select:focus {
  border-color: rgba(85, 199, 196, 0.7);
  box-shadow: 0 0 0 3px rgba(85, 199, 196, 0.1);
}

.product-cost-toolbar option {
  background: var(--surface);
}

.product-cost-table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line-subtle);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.012);
}

.product-cost-table {
  width: 100%;
  min-width: 820px;
  border-collapse: collapse;
  table-layout: fixed;
}

.product-cost-table thead th {
  padding: 13px 14px;
  border-bottom: 1px solid var(--line-subtle);
  color: var(--text-muted);
  font-size: 10px;
  font-weight: 650;
  letter-spacing: 0.08em;
  text-align: left;
  text-transform: uppercase;
}

.product-cost-table thead th:first-child {
  width: 27%;
}

.product-cost-table thead th:nth-child(2) {
  width: 16%;
}

.product-cost-table thead th:nth-child(3) {
  width: 20%;
}

.product-cost-table thead th:nth-child(4) {
  width: 23%;
}

.product-cost-table thead th:last-child {
  width: 14%;
}

.product-cost-category th {
  padding: 14px;
  border-top: 1px solid rgba(215, 180, 106, 0.16);
  border-bottom: 1px solid var(--line-subtle);
  background: rgba(215, 180, 106, 0.045);
  color: var(--gold);
  text-align: left;
}

.product-cost-group:first-of-type .product-cost-category th {
  border-top: 0;
}

.product-cost-category span {
  font-family: var(--font-editorial);
  font-size: 18px;
  font-weight: 600;
}

.product-cost-category small {
  margin-left: 9px;
  color: var(--text-muted);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.product-cost-row td {
  padding: 12px 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.045);
  color: var(--text-secondary);
  font-size: 12px;
  vertical-align: middle;
}

.product-cost-row:last-child td {
  border-bottom: 0;
}

.product-cost-row:hover td {
  background: rgba(85, 199, 196, 0.025);
}

.product-cost-row button {
  max-width: 100%;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.product-cost-row button strong,
.product-cost-row button small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.product-cost-row button strong {
  color: var(--text-primary);
  font-size: 13px;
  font-weight: 600;
}

.product-cost-row button small {
  margin-top: 3px;
  color: var(--text-muted);
  font-size: 10px;
}

.product-cost-row button:hover strong,
.product-cost-row button:focus-visible strong,
.product-cost-row button[aria-selected="true"] strong {
  color: var(--teal);
}

.product-cost-row button:focus-visible {
  border-radius: 4px;
  outline: 2px solid rgba(85, 199, 196, 0.55);
  outline-offset: 4px;
}

.product-cost-value {
  color: var(--text-primary) !important;
  font-variant-numeric: tabular-nums;
}

.product-cost-change {
  display: inline-flex;
  min-width: 58px;
  justify-content: center;
  padding: 5px 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-secondary);
  font-size: 11px;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
}

.product-cost-change.is-up,
.product-cost-detail-grid strong.is-up {
  color: #f38b7c;
}

.product-cost-change.is-down,
.product-cost-detail-grid strong.is-down {
  color: #7ad66d;
}

.product-cost-detail {
  margin-top: 22px;
  padding: 20px;
  border: 1px solid rgba(85, 199, 196, 0.18);
  border-radius: 18px;
  background:
    radial-gradient(circle at 95% 0%, rgba(85, 199, 196, 0.07), transparent 28%),
    rgba(255, 255, 255, 0.016);
}

.product-cost-detail-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
}

.product-cost-detail-head span {
  color: var(--gold);
  font-size: 10px;
  font-weight: 650;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.product-cost-detail-head h3 {
  margin: 5px 0 4px;
  color: var(--text-primary);
  font-family: var(--font-editorial);
  font-size: clamp(24px, 4vw, 34px);
  font-weight: 600;
}

.product-cost-detail-head p,
.product-cost-note {
  margin: 0;
  color: var(--text-secondary);
  font-size: 12px;
  line-height: 1.5;
}

.product-cost-detail-head > strong {
  flex: 0 0 auto;
  color: var(--teal);
  font-size: clamp(20px, 3vw, 28px);
  font-weight: 650;
  font-variant-numeric: tabular-nums;
}

.product-cost-detail-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin: 18px 0;
}

.product-cost-detail-grid div {
  min-width: 0;
  padding: 10px;
  border: 1px solid var(--line-subtle);
  border-radius: 11px;
}

.product-cost-detail-grid span,
.product-cost-detail-grid strong {
  display: block;
}

.product-cost-detail-grid span {
  margin-bottom: 5px;
  color: var(--text-muted);
  font-size: 9px;
  font-weight: 650;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.product-cost-detail-grid strong {
  overflow-wrap: anywhere;
  color: var(--text-primary);
  font-size: 12px;
}

.product-cost-note {
  margin: 0 0 16px;
  padding: 10px 12px;
  border-left: 2px solid var(--gold);
  background: rgba(215, 180, 106, 0.045);
}

.product-cost-chart {
  min-width: 0;
  margin-top: 16px;
}

.product-cost-chart svg {
  width: 100%;
  height: auto;
  display: block;
  overflow: visible;
}

.product-cost-line {
  fill: none;
  stroke: var(--teal);
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 3;
}

.product-cost-chart circle {
  fill: var(--surface);
  stroke: var(--teal);
  stroke-width: 2;
}

.product-cost-chart-legend {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 12px;
  margin-top: -3px;
  color: var(--text-muted);
  font-size: 10px;
}

.product-cost-chart-legend strong {
  color: var(--text-secondary);
  font-weight: 600;
}

.product-cost-chart-legend span:last-child {
  text-align: right;
}

.product-cost-history {
  margin-top: 16px;
  border-top: 1px solid var(--line-subtle);
}

.product-cost-history div {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  padding: 9px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  color: var(--text-secondary);
  font-size: 11px;
}

.product-cost-history strong {
  color: var(--text-primary);
  font-variant-numeric: tabular-nums;
}

.product-cost-empty,
.product-cost-filter-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 96px;
  margin: 0;
  padding: 20px;
  border: 1px dashed var(--line-subtle);
  border-radius: 14px;
  color: var(--text-secondary);
  font-size: 12px;
  text-align: center;
}

.product-cost-filter-empty {
  min-height: 64px;
  margin-bottom: 14px;
}

@media (max-width: 720px) {
  .product-cost-metrics,
  .product-cost-detail-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .product-cost-toolbar {
    top: -18px;
    grid-template-columns: 1fr;
    margin-inline: -2px;
  }

  .product-cost-detail {
    padding: 16px;
  }

  .product-cost-detail-head {
    display: block;
  }

  .product-cost-detail-head > strong {
    display: block;
    margin-top: 12px;
  }
}

.menu-ranking-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 16px;
}

.menu-ranking-toolbar > span {
  color: var(--text-muted);
  font-size: 12px;
  white-space: nowrap;
}

.menu-ranking-periods {
  display: inline-grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  padding: 3px;
  border: 1px solid var(--line-subtle);
  border-radius: 12px;
  background: var(--canvas-soft);
}

.menu-ranking-periods button {
  min-height: 34px;
  padding: 7px 13px;
  border: 0;
  border-radius: 9px;
  color: var(--text-secondary);
  background: transparent;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: color 160ms ease, background 160ms ease, transform 160ms ease;
}

.menu-ranking-periods button:hover {
  color: var(--text-primary);
}

.menu-ranking-periods button:active {
  transform: translateY(1px);
}

.menu-ranking-periods button[aria-pressed="true"] {
  color: #172027;
  background: var(--gold);
}

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

.menu-ranking-category {
  overflow: hidden;
  border: 1px solid var(--line-subtle);
  border-radius: 14px;
  background: var(--surface-raised);
}

.menu-ranking-category > header {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 14px 15px;
  border-bottom: 1px solid var(--line-subtle);
}

.menu-ranking-icon {
  display: inline-grid;
  width: 34px;
  height: 34px;
  flex: 0 0 34px;
  place-items: center;
  border-radius: 10px;
  color: var(--gold);
  background: rgba(215, 180, 106, 0.1);
  font-size: 18px;
}

.menu-ranking-category h4,
.menu-ranking-category h5,
.menu-ranking-category p {
  margin: 0;
}

.menu-ranking-category h4 {
  color: var(--text-primary);
  font-size: 14px;
  line-height: 1.25;
}

.menu-ranking-category header div > span {
  display: block;
  margin-top: 3px;
  color: var(--text-muted);
  font-size: 11px;
}

.menu-ranking-section {
  padding: 13px 15px 11px;
}

.menu-ranking-section + .menu-ranking-section {
  border-top: 1px solid var(--line-faint);
}

.menu-ranking-section h5 {
  margin-bottom: 8px;
  color: var(--text-muted);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.menu-ranking-list {
  display: grid;
  gap: 2px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.menu-ranking-list li {
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  min-height: 31px;
  color: var(--text-secondary);
  font-size: 12px;
}

.menu-ranking-list li strong {
  color: var(--text-primary);
  font-variant-numeric: tabular-nums;
}

.menu-ranking-position {
  color: var(--gold);
  font-size: 11px;
  font-weight: 800;
  text-align: center;
}

.menu-ranking-list--bottom .menu-ranking-position {
  color: var(--red);
  font-size: 14px;
}

.menu-ranking-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.menu-ranking-empty {
  padding: 7px 0 9px;
  color: var(--text-muted);
  font-size: 11px;
}

@media (max-width: 760px) {
  .menu-ranking-toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .menu-ranking-periods {
    width: 100%;
  }

  .menu-ranking-toolbar > span {
    white-space: normal;
  }

  .menu-ranking-grid {
    grid-template-columns: 1fr;
  }
}

@media print {
  body > * {
    display: none !important;
  }

  .workspace-overlay,
  .workspace-panel,
  .workspace-body {
    display: block !important;
    position: static !important;
    width: auto !important;
    height: auto !important;
    overflow: visible !important;
    color: #111 !important;
    background: #fff !important;
  }

  .workspace-backdrop,
  .workspace-close,
  .workspace-primary {
    display: none !important;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
}

@media (prefers-reduced-transparency: reduce) {
  .card,
  .weather,
  .auth-card {
    background: var(--surface);
  }
}
