/* Executive command center. The cc- pieces (card depth, chips, bars, segmented control, chart
   tooltip) carry no page logic, so other modules can adopt them later. */
@property --cc-angle {
  syntax: '<angle>';
  initial-value: 0deg;
  inherits: false;
}
.cc-root {
  --cc-orange: #ff7900;
  --cc-deep: #e85d04;
  --cc-soft: #fff1e6;
  --cc-surface: #ffffff;
  --cc-bg: #f5f7fc;
  --cc-text: #172033;
  --cc-muted: #64748b;
  --cc-line: #e7ebf3;
  --cc-good: #15803d;
  --cc-warn: #b45309;
  --cc-bad: #b91c1c;
  --cc-shadow: 0 1px 2px rgb(23 32 51 / 5%), 0 10px 24px -14px rgb(23 32 51 / 18%);
  --cc-shadow-up: 0 2px 4px rgb(23 32 51 / 6%), 0 22px 40px -18px rgb(232 93 4 / 30%);
  display: grid;
  gap: 18px;
  color: var(--cc-text);
}
:root[data-theme='dark'] .cc-root {
  --cc-soft: color-mix(in srgb, var(--cc-orange) 16%, var(--uv-surface));
  --cc-surface: var(--uv-surface);
  --cc-bg: var(--uv-bg);
  --cc-text: var(--uv-text);
  --cc-muted: var(--text-secondary);
  --cc-line: var(--uv-border);
  --cc-good: #4ade80;
  --cc-warn: #fbbf24;
  --cc-bad: #f87171;
}

/* Header */
.cc-hero {
  position: relative;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 22px 26px;
  overflow: hidden;
  border: 1px solid var(--cc-line);
  border-radius: 24px;
  background:
    radial-gradient(420px 180px at 92% -20%, rgb(255 121 0 / 16%), transparent 70%),
    var(--cc-surface);
  box-shadow: var(--cc-shadow);
}
[dir='rtl'] .cc-hero {
  background:
    radial-gradient(420px 180px at 8% -20%, rgb(255 121 0 / 16%), transparent 70%),
    var(--cc-surface);
}
.cc-hero::after {
  content: '';
  position: absolute;
  inset-inline: 26px;
  bottom: 0;
  height: 2px;
  border-radius: 2px;
  background: linear-gradient(90deg, transparent, var(--cc-orange), transparent);
  background-size: 40% 100%;
  background-repeat: no-repeat;
  animation: cc-sweep 1.4s ease-out 1 both;
}
@keyframes cc-sweep {
  from {
    background-position: -40% 0;
  }
  to {
    background-position: 140% 0;
  }
}
.cc-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--cc-deep);
  font-size: 0.82rem;
  font-weight: 700;
}
.cc-eyebrow i {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--cc-orange);
  box-shadow: 0 0 0 4px rgb(255 121 0 / 16%);
}
.cc-hero h1 {
  margin: 4px 0;
  font-size: clamp(1.6rem, 1.2rem + 1.4vw, 2.3rem);
  font-weight: 800;
  letter-spacing: -0.01em;
}
.cc-hero p {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0;
  color: var(--cc-muted);
}
.cc-hero-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}
.cc-ai {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 18px;
  border: 0;
  border-radius: 14px;
  background: linear-gradient(135deg, var(--cc-orange), var(--cc-deep));
  color: #fff;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 10px 22px -10px rgb(232 93 4 / 70%);
  transition:
    transform 0.18s ease,
    box-shadow 0.18s ease;
}
.cc-ai:hover {
  transform: translateY(-2px);
  box-shadow: 0 16px 28px -10px rgb(232 93 4 / 75%);
}
.cc-ai:active {
  transform: translateY(0);
}

/* Depth */
.cc-card {
  --cc-rx: 0deg;
  --cc-ry: 0deg;
  --cc-mx: 50%;
  --cc-my: 0%;
  position: relative;
  border: 1px solid var(--cc-line);
  border-radius: 20px;
  background: var(--cc-surface);
  box-shadow: var(--cc-shadow);
}
.cc-card[data-tilt] {
  transform: perspective(900px) rotateX(var(--cc-rx)) rotateY(var(--cc-ry));
  transform-style: preserve-3d;
  transition:
    transform 0.16s ease-out,
    box-shadow 0.2s ease,
    border-color 0.2s ease;
  will-change: transform;
}
.cc-card[data-tilt]::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: radial-gradient(
    260px circle at var(--cc-mx) var(--cc-my),
    rgb(255 121 0 / 12%),
    transparent 65%
  );
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}
/* The border light turns only while the pointer is on the card. */
.cc-card[data-tilt]::after {
  content: '';
  position: absolute;
  inset: -1px;
  padding: 1px;
  border-radius: inherit;
  background: conic-gradient(
    from var(--cc-angle),
    transparent 70%,
    var(--cc-orange) 88%,
    transparent
  );
  opacity: 0;
  pointer-events: none;
  mask:
    linear-gradient(#000 0 0) content-box,
    linear-gradient(#000 0 0);
  mask-composite: exclude;
  transition: opacity 0.2s ease;
}
.cc-card[data-tilt]:hover {
  box-shadow: var(--cc-shadow-up);
}
.cc-card[data-tilt]:hover::before,
.cc-card[data-tilt]:hover::after {
  opacity: 1;
}
.cc-card[data-tilt]:hover::after {
  animation: cc-turn 2.4s linear infinite;
}
@keyframes cc-turn {
  to {
    --cc-angle: 360deg;
  }
}
.cc-card[data-tilt]:focus-visible {
  outline: 2px solid var(--cc-orange);
  outline-offset: 2px;
}

/* KPI cards */
.cc-kpis {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(235px, 1fr));
  gap: 14px;
}
.cc-kpi {
  display: grid;
  gap: 10px;
  align-content: start;
  width: 100%;
  padding: 16px 18px;
  color: inherit;
  font: inherit;
  text-align: start;
  cursor: pointer;
  animation: cc-rise 0.36s ease-out both;
}
div.cc-kpi {
  cursor: default;
}
.cc-kpi:nth-child(2) {
  animation-delay: 30ms;
}
.cc-kpi:nth-child(3) {
  animation-delay: 60ms;
}
.cc-kpi:nth-child(4) {
  animation-delay: 90ms;
}
.cc-kpi:nth-child(n + 5) {
  animation-delay: 120ms;
}
@keyframes cc-rise {
  from {
    opacity: 0;
    translate: 0 8px;
  }
  to {
    opacity: 1;
    translate: 0 0;
  }
}
.cc-kpi.is-lead {
  border-color: transparent;
  background: linear-gradient(145deg, var(--cc-orange), var(--cc-deep));
  color: #fff;
  box-shadow: 0 18px 34px -18px rgb(232 93 4 / 70%);
}
.cc-kpi.is-lead :is(.cc-kpi-label, small, .cc-go) {
  color: rgb(255 255 255 / 88%);
}
.cc-kpi.is-lead .cc-icon {
  background: rgb(255 255 255 / 20%);
  color: #fff;
}
.cc-kpi.is-lead .cc-spark polyline {
  stroke: #fff;
}
.cc-kpi.is-lead .cc-spark polygon {
  fill: rgb(255 255 255 / 18%);
}
.cc-kpi.is-lead .cc-chip {
  background: rgb(255 255 255 / 20%);
  color: #fff;
}
.cc-kpi-head {
  display: flex;
  align-items: center;
  gap: 10px;
}
.cc-icon {
  display: inline-grid;
  flex: none;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 12px;
  background: var(--cc-soft);
  color: var(--cc-deep);
  transition: transform 0.2s ease;
}
.cc-icon.is-small {
  width: 30px;
  height: 30px;
  border-radius: 10px;
}
.cc-card:hover .cc-icon {
  transform: translateY(-1px) scale(1.05);
}
.cc-kpi-label {
  flex: 1;
  color: var(--cc-muted);
  font-size: 0.92rem;
  font-weight: 600;
}
[dir='rtl'] .cc-kpi-label {
  font-size: 1rem;
}
.cc-go {
  color: var(--cc-muted);
  opacity: 0;
  transition: opacity 0.18s ease;
}
.cc-kpi:hover .cc-go,
.cc-kpi:focus-visible .cc-go {
  opacity: 1;
}
.cc-kpi-value {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 6px;
  font-size: clamp(1.45rem, 1.2rem + 0.7vw, 1.9rem);
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}
.cc-kpi-value small {
  color: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  opacity: 0.75;
}
.cc-kpi-foot {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 10px;
  min-height: 38px;
}
.cc-kpi-support {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 6px;
}
.cc-kpi-support small {
  color: var(--cc-muted);
  font-size: 0.8rem;
}
.cc-chip {
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--cc-bg);
  color: var(--cc-muted);
  font-size: 0.78rem;
  font-weight: 700;
}
.cc-chip.is-up {
  color: var(--cc-good);
}
.cc-chip.is-down {
  color: var(--cc-bad);
}
.cc-kpi.is-warn .cc-icon {
  color: var(--cc-warn);
}
.cc-spark {
  flex: none;
  width: 96px;
  height: 36px;
}
[dir='rtl'] .cc-spark {
  transform: scaleX(-1);
}
.cc-spark polyline {
  fill: none;
  stroke: var(--cc-orange);
  stroke-width: 2;
  vector-effect: non-scaling-stroke;
}
.cc-spark polygon {
  fill: rgb(255 121 0 / 12%);
}

/* Layout */
.cc-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}
.cc-section {
  grid-column: 1 / -1;
  min-width: 0;
}
.cc-section.is-half {
  grid-column: auto;
}
.cc-analytics {
  display: grid;
  grid-template-columns: minmax(0, 2.2fr) minmax(280px, 1fr);
  gap: 14px;
}
.cc-three {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(270px, 1fr));
  gap: 14px;
  margin-block-start: 14px;
}
.cc-panel {
  padding: 18px 20px;
}
.cc-panel-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  margin-block-end: 12px;
}
.cc-panel-head h2,
.cc-flow > h2 {
  margin: 0;
  font-size: 1.1rem;
  font-weight: 700;
}
[dir='rtl'] .cc-panel-head h2,
[dir='rtl'] .cc-flow > h2 {
  font-size: 1.2rem;
}
.cc-panel-head p {
  margin: 2px 0 0;
  color: var(--cc-muted);
  font-size: 0.86rem;
}

/* Segmented control */
.cc-seg {
  display: inline-flex;
  gap: 2px;
  padding: 3px;
  border-radius: 12px;
  background: var(--cc-bg);
}
.cc-seg button {
  padding: 6px 12px;
  border: 0;
  border-radius: 9px;
  background: none;
  color: var(--cc-muted);
  font: inherit;
  font-size: 0.86rem;
  font-weight: 600;
  cursor: pointer;
}
.cc-seg button[aria-pressed='true'] {
  background: var(--cc-surface);
  color: var(--cc-deep);
  box-shadow: 0 1px 3px rgb(23 32 51 / 12%);
}

/* Chart */
.cc-chart {
  position: relative;
}
.cc-chart svg {
  display: block;
  width: 100%;
  height: auto;
  direction: ltr;
}
.cc-gridline {
  stroke: var(--cc-line);
}
.cc-axis {
  fill: var(--cc-muted);
  font-size: 11px;
}
.cc-line {
  fill: none;
  stroke-width: 2.5;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-dasharray: 1;
  animation: cc-draw 0.7s ease-out both;
}
@keyframes cc-draw {
  from {
    stroke-dashoffset: 1;
  }
  to {
    stroke-dashoffset: 0;
  }
}
.cc-line.is-sale {
  stroke: var(--cc-orange);
}
.cc-line.is-purchase {
  stroke: #475569;
}
.cc-cursor {
  stroke: var(--cc-orange);
  stroke-dasharray: 3 3;
}
.cc-cursor[hidden] {
  display: none;
}
.cc-hit {
  fill: transparent;
}
.cc-tooltip {
  position: absolute;
  top: 8px;
  display: grid;
  gap: 2px;
  min-width: 150px;
  padding: 8px 12px;
  border: 1px solid var(--cc-line);
  border-radius: 12px;
  background: color-mix(in srgb, var(--cc-surface) 88%, transparent);
  font-size: 0.84rem;
  pointer-events: none;
  box-shadow: var(--cc-shadow);
  backdrop-filter: blur(8px);
}
.cc-tooltip[hidden] {
  display: none;
}
.cc-legend {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 12px;
  margin-block-start: 4px;
  color: var(--cc-muted);
  font-size: 0.84rem;
}
.cc-legend small {
  font-size: 0.78rem;
}
:is(.cc-legend, .cc-tooltip) i {
  display: inline-block;
  width: 9px;
  height: 9px;
  margin-inline-end: 6px;
  border-radius: 50%;
}
:is(.cc-legend, .cc-tooltip) .is-sale i {
  background: var(--cc-orange);
}
:is(.cc-legend, .cc-tooltip) .is-purchase i {
  background: #475569;
}

/* Ring, bars and lists */
.cc-ring-wrap {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 18px;
}
.cc-ring {
  position: relative;
  width: 140px;
  height: 140px;
}
.cc-ring svg {
  transform: rotate(-90deg);
}
.cc-ring-track,
.cc-ring-value {
  fill: none;
  stroke-width: 12;
}
.cc-ring-track {
  stroke: var(--cc-bg);
}
.cc-ring-value {
  stroke: var(--cc-orange);
  stroke-linecap: round;
  transition: stroke-dashoffset 0.7s ease-out;
}
.cc-ring strong {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  grid-auto-flow: column;
  align-items: baseline;
  font-size: 1.7rem;
  font-weight: 800;
}
.cc-ring small {
  font-size: 0.9rem;
}
.cc-rows {
  display: grid;
  flex: 1 1 130px;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.cc-rows li {
  display: flex;
  align-items: center;
  gap: 8px;
}
.cc-rows b {
  margin-inline-start: auto;
}
.cc-rows i,
.cc-dot {
  flex: none;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--cc-orange);
}
.cc-rows .is-good i {
  background: var(--cc-good);
}
.cc-rows .is-warn i,
.cc-dot.is-warn {
  background: #f59e0b;
}
.cc-rows .is-bad i,
.cc-dot.is-bad {
  background: var(--cc-bad);
}
.cc-bar {
  display: block;
  width: 100%;
  height: 6px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--cc-bg);
}
.cc-bar-fill {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--cc-orange), var(--cc-deep));
  transition: width 0.6s ease-out;
}
.cc-status,
.cc-actions,
.cc-timeline {
  display: grid;
  gap: 4px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.cc-status button {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 4px 10px;
  width: 100%;
  padding: 8px 10px;
  border: 0;
  border-radius: 10px;
  background: none;
  color: inherit;
  font: inherit;
  text-align: start;
  cursor: pointer;
}
.cc-status .cc-bar {
  grid-column: 1 / -1;
}
.cc-actions button {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 8px 10px;
  border: 0;
  border-radius: 10px;
  background: none;
  color: inherit;
  font: inherit;
  text-align: start;
  cursor: pointer;
}
.cc-actions button > span:nth-child(2) {
  flex: 1;
  min-width: 0;
}
:is(.cc-status, .cc-actions) button:hover {
  background: var(--cc-soft);
}
.cc-timeline li {
  display: flex;
  gap: 10px;
  padding-block: 7px;
}
.cc-timeline .cc-dot {
  margin-block-start: 6px;
}
.cc-timeline strong,
.cc-timeline small {
  display: block;
}
.cc-timeline small {
  color: var(--cc-muted);
}

/* Operational overview */
.cc-flow > h2 {
  margin-block-end: 10px;
}
.cc-flow-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
}
.cc-step {
  display: grid;
  gap: 6px;
  justify-items: start;
  padding: 16px;
  color: inherit;
  font: inherit;
  text-align: start;
  cursor: pointer;
}
.cc-step small {
  color: var(--cc-muted);
}

/* Shortcuts and customization */
.cc-shortcuts {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.cc-shortcut {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 14px;
  border: 1px solid var(--cc-line);
  border-radius: 12px;
  background: var(--cc-surface);
  color: inherit;
  font: inherit;
  cursor: pointer;
  transition:
    border-color 0.16s ease,
    transform 0.16s ease;
}
.cc-shortcut:hover {
  border-color: var(--cc-orange);
  transform: translateY(-1px);
}
.cc-editor {
  display: grid;
  gap: 12px;
  padding: 18px 20px;
}
.cc-editor h2 {
  margin: 0;
}
.cc-editor p {
  margin: 2px 0 0;
  color: var(--cc-muted);
}
.cc-editor-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 8px;
}
.cc-editor-list > div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 6px 10px;
  border: 1px solid var(--cc-line);
  border-radius: 10px;
}
.cc-editor-list label {
  display: flex;
  align-items: center;
  gap: 8px;
}
.cc-skeleton {
  border-radius: 12px;
  background: linear-gradient(90deg, var(--cc-bg), var(--cc-line), var(--cc-bg));
  background-size: 200% 100%;
  animation: cc-shimmer 1.3s linear infinite;
}
@keyframes cc-shimmer {
  to {
    background-position: -200% 0;
  }
}

/* Smaller screens */
@media (max-width: 1100px) {
  .cc-analytics {
    grid-template-columns: minmax(0, 1fr);
  }
}
@media (max-width: 760px) {
  .cc-grid {
    grid-template-columns: minmax(0, 1fr);
  }
  .cc-section.is-half {
    grid-column: 1 / -1;
  }
  .cc-hero {
    padding: 18px;
  }
  .cc-hero-actions,
  .cc-ai {
    width: 100%;
  }
  .cc-ai {
    justify-content: center;
  }
  .cc-kpis {
    grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  }
  .cc-spark {
    width: 64px;
  }
}
@media (prefers-reduced-motion: reduce) {
  .cc-root *,
  .cc-root *::before,
  .cc-root *::after,
  .cc-hero::after {
    animation: none !important;
    transition: none !important;
  }
  .cc-card[data-tilt] {
    transform: none;
  }
}
@media print {
  .cc-hero-actions,
  .cc-shortcuts,
  .cc-seg {
    display: none;
  }
  .cc-card {
    box-shadow: none;
    transform: none !important;
  }
}
