/* MagicOps V6 Smart Dashboard */

body.mo-dashboard-active
.workspace > .workspace-head,
body.mo-dashboard-active
.workspace > .table-panel,
body.mo-dashboard-active
.workspace > .overview-grid,
body.mo-dashboard-active
.workspace > .notice,
body.mo-dashboard-active
.workspace > .error-banner {
  display: none !important;
}

.mo-smart-dashboard[hidden] {
  display: none !important;
}

.mo-smart-dashboard {
  display: grid;
  gap: 18px;
  width: 100%;
}

.mo-dashboard-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  padding: 2px 2px 0;
}

.mo-dashboard-heading {
  display: grid;
  gap: 6px;
}

.mo-dashboard-eyebrow {
  color: #7f8aa2;
  font-size: 10px;
  font-weight: 850;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

.mo-dashboard-heading h1 {
  margin: 0;
  color: #f5f7ff;
  font-size: clamp(24px, 3vw, 34px);
  letter-spacing: -0.035em;
}

.mo-dashboard-heading p {
  max-width: 720px;
  margin: 0;
  color: #7f899e;
  font-size: 13px;
  line-height: 1.55;
}

.mo-dashboard-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 9px;
}

.mo-dashboard-button {
  min-height: 39px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 8px 13px;
  border: 1px solid rgba(148, 163, 184, 0.16);
  border-radius: 12px;
  color: #c8d0e0;
  background: rgba(255, 255, 255, 0.045);
  font: inherit;
  font-size: 12px;
  font-weight: 750;
  cursor: pointer;
  transition:
    color 0.16s ease,
    border-color 0.16s ease,
    background 0.16s ease,
    transform 0.16s ease;
}

.mo-dashboard-button:hover {
  color: #ffffff;
  border-color: rgba(126, 141, 255, 0.45);
  background: rgba(126, 141, 255, 0.11);
  transform: translateY(-1px);
}

.mo-dashboard-button.is-primary {
  color: #ffffff;
  border-color: rgba(126, 141, 255, 0.54);
  background:
    linear-gradient(
      135deg,
      #536dfe,
      #7047eb
    );
  box-shadow: 0 10px 28px rgba(83, 109, 254, 0.2);
}

.mo-dashboard-button.is-danger:hover {
  color: #fecaca;
  border-color: rgba(248, 113, 113, 0.34);
  background: rgba(248, 113, 113, 0.08);
}

.mo-dashboard-button svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.mo-dashboard-status {
  min-height: 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 7px 11px;
  border: 1px solid rgba(148, 163, 184, 0.1);
  border-radius: 11px;
  color: #7f899e;
  background: rgba(255, 255, 255, 0.025);
  font-size: 11px;
}

.mo-dashboard-status strong {
  color: #aeb8cc;
}

.mo-dashboard-grid {
  display: grid;
  grid-template-columns:
    repeat(12, minmax(0, 1fr));
  gap: 15px;
  align-items: stretch;
}

.mo-dashboard-empty {
  grid-column: 1 / -1;
  min-height: 390px;
  display: grid;
  place-items: center;
  padding: 35px;
  border: 1px dashed rgba(126, 141, 255, 0.24);
  border-radius: 20px;
  color: #8d98ad;
  background:
    radial-gradient(
      circle at center,
      rgba(99, 102, 241, 0.08),
      transparent 48%
    ),
    rgba(255, 255, 255, 0.025);
  text-align: center;
}

.mo-dashboard-empty-content {
  display: grid;
  justify-items: center;
  gap: 13px;
  max-width: 500px;
}

.mo-dashboard-empty-icon {
  width: 64px;
  height: 64px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(126, 141, 255, 0.25);
  border-radius: 19px;
  color: #aeb8ff;
  background: rgba(99, 102, 241, 0.12);
}

.mo-dashboard-empty-icon svg {
  width: 30px;
  height: 30px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
}

.mo-dashboard-empty h2 {
  margin: 0;
  color: #eef2ff;
  font-size: 20px;
}

.mo-dashboard-empty p {
  margin: 0;
  line-height: 1.6;
}

.mo-dashboard-widget {
  grid-column: span 6;
  min-width: 0;
  min-height: 330px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid rgba(148, 163, 184, 0.12);
  border-radius: 19px;
  background:
    radial-gradient(
      circle at top right,
      rgba(99, 102, 241, 0.1),
      transparent 40%
    ),
    linear-gradient(
      145deg,
      rgba(20, 23, 33, 0.96),
      rgba(11, 13, 20, 0.94)
    );
  box-shadow:
    0 18px 50px rgba(0, 0, 0, 0.2),
    inset 0 1px rgba(255, 255, 255, 0.03);
}

.mo-dashboard-widget.is-stat {
  grid-column: span 3;
  min-height: 245px;
}

.mo-dashboard-widget-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  padding: 17px 17px 12px;
  border-bottom: 1px solid rgba(148, 163, 184, 0.09);
}

.mo-dashboard-widget-title {
  min-width: 0;
  display: grid;
  gap: 5px;
}

.mo-dashboard-widget-title h3 {
  overflow: hidden;
  margin: 0;
  color: #edf1fb;
  font-size: 14px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mo-dashboard-widget-title span {
  overflow: hidden;
  color: #778297;
  font-size: 10px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mo-dashboard-widget-tools {
  display: flex;
  align-items: center;
  gap: 5px;
}

.mo-dashboard-widget-tool {
  width: 29px;
  height: 29px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 1px solid rgba(148, 163, 184, 0.12);
  border-radius: 9px;
  color: #8792a7;
  background: rgba(255, 255, 255, 0.035);
  cursor: pointer;
}

.mo-dashboard-widget-tool:hover {
  color: #ffffff;
  border-color: rgba(126, 141, 255, 0.35);
  background: rgba(126, 141, 255, 0.1);
}

.mo-dashboard-widget-tool.is-remove:hover {
  color: #fda4af;
  border-color: rgba(244, 63, 94, 0.3);
  background: rgba(244, 63, 94, 0.08);
}

.mo-dashboard-widget-tool svg {
  width: 14px;
  height: 14px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  pointer-events: none;
}

.mo-dashboard-widget-body {
  flex: 1;
  min-height: 0;
  display: grid;
  align-content: center;
  gap: 17px;
  padding: 17px;
}

.mo-dashboard-widget-loading,
.mo-dashboard-widget-error {
  min-height: 190px;
  display: grid;
  place-items: center;
  color: #7f899e;
  font-size: 12px;
  text-align: center;
}

.mo-dashboard-widget-error {
  color: #fda4af;
}

.mo-dashboard-kpis {
  display: grid;
  grid-template-columns:
    repeat(auto-fit, minmax(95px, 1fr));
  gap: 9px;
}

.mo-dashboard-kpi {
  min-width: 0;
  padding: 11px;
  border: 1px solid rgba(148, 163, 184, 0.1);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.035);
}

.mo-dashboard-kpi span {
  display: block;
  overflow: hidden;
  color: #79849a;
  font-size: 10px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mo-dashboard-kpi strong {
  display: block;
  margin-top: 5px;
  color: #f2f5ff;
  font-size: 21px;
  letter-spacing: -0.035em;
}

.mo-dashboard-stat {
  display: grid;
  align-content: center;
  gap: 13px;
  min-height: 145px;
}

.mo-dashboard-stat-value {
  color: #ffffff;
  font-size: clamp(42px, 5vw, 64px);
  font-weight: 820;
  letter-spacing: -0.06em;
  line-height: 1;
}

.mo-dashboard-stat-label {
  color: #7f899e;
  font-size: 12px;
}

.mo-dashboard-chart-layout {
  display: grid;
  grid-template-columns:
    minmax(155px, 0.8fr)
    minmax(180px, 1.2fr);
  align-items: center;
  gap: 18px;
}

.mo-dashboard-doughnut-wrap {
  position: relative;
  width: min(190px, 100%);
  aspect-ratio: 1;
  margin: auto;
}

.mo-dashboard-doughnut {
  width: 100%;
  height: 100%;
  overflow: visible;
  transform: rotate(-90deg);
}

.mo-dashboard-doughnut-track {
  fill: none;
  stroke: rgba(148, 163, 184, 0.1);
  stroke-width: 17;
}

.mo-dashboard-doughnut-segment {
  fill: none;
  stroke-width: 17;
  stroke-linecap: butt;
  transition:
    stroke-dasharray 0.25s ease,
    stroke-dashoffset 0.25s ease;
}

.mo-dashboard-doughnut-center {
  position: absolute;
  inset: 24%;
  display: grid;
  place-content: center;
  border: 1px solid rgba(148, 163, 184, 0.09);
  border-radius: 50%;
  background: rgba(10, 12, 19, 0.88);
  text-align: center;
}

.mo-dashboard-doughnut-center strong {
  color: #ffffff;
  font-size: 25px;
}

.mo-dashboard-doughnut-center span {
  color: #7f899e;
  font-size: 10px;
}

.mo-dashboard-legend {
  display: grid;
  gap: 8px;
  max-height: 220px;
  overflow-y: auto;
  padding-right: 3px;
}

.mo-dashboard-legend-row {
  display: grid;
  grid-template-columns:
    10px minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  min-height: 27px;
}

.mo-dashboard-legend-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  box-shadow: 0 0 10px color-mix(
    in srgb,
    currentColor 45%,
    transparent
  );
}

.mo-dashboard-legend-label {
  overflow: hidden;
  color: #aab3c5;
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mo-dashboard-legend-value {
  color: #eef2ff;
  font-size: 11px;
  font-weight: 800;
}

.mo-dashboard-bars {
  display: grid;
  gap: 11px;
  max-height: 260px;
  overflow-y: auto;
  padding-right: 4px;
}

.mo-dashboard-bar-row {
  display: grid;
  gap: 6px;
}

.mo-dashboard-bar-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-width: 0;
}

.mo-dashboard-bar-label span {
  overflow: hidden;
  color: #aeb7c8;
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mo-dashboard-bar-label strong {
  flex: 0 0 auto;
  color: #eef2ff;
  font-size: 11px;
}

.mo-dashboard-bar-track {
  height: 9px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.1);
}

.mo-dashboard-bar-fill {
  min-width: 3px;
  height: 100%;
  border-radius: inherit;
  transition: width 0.25s ease;
}

.mo-dashboard-bar-breakdown {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.mo-dashboard-bar-breakdown span {
  padding: 3px 6px;
  border: 1px solid rgba(148, 163, 184, 0.1);
  border-radius: 999px;
  color: #7f899e;
  background: rgba(255, 255, 255, 0.025);
  font-size: 9px;
}

.mo-dashboard-modal-backdrop {
  position: fixed;
  z-index: 11000;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(2, 4, 10, 0.78);
  backdrop-filter: blur(10px);
}

.mo-dashboard-modal-backdrop[hidden] {
  display: none !important;
}

.mo-dashboard-modal {
  width: min(620px, calc(100vw - 28px));
  max-height: min(780px, calc(100vh - 34px));
  overflow-y: auto;
  border: 1px solid rgba(148, 163, 184, 0.19);
  border-radius: 20px;
  color: #dfe5f2;
  background:
    radial-gradient(
      circle at top right,
      rgba(99, 102, 241, 0.16),
      transparent 38%
    ),
    #0d111b;
  box-shadow: 0 35px 110px rgba(0, 0, 0, 0.7);
}

.mo-dashboard-modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  padding: 20px 20px 14px;
}

.mo-dashboard-modal-header h2 {
  margin: 0;
  color: #f5f7ff;
  font-size: 18px;
}

.mo-dashboard-modal-header p {
  margin: 6px 0 0;
  color: #7f899e;
  font-size: 12px;
  line-height: 1.5;
}

.mo-dashboard-modal-close {
  width: 35px;
  height: 35px;
  flex: 0 0 auto;
  border: 1px solid rgba(148, 163, 184, 0.14);
  border-radius: 11px;
  color: #9aa5ba;
  background: rgba(255, 255, 255, 0.04);
  font-size: 20px;
  cursor: pointer;
}

.mo-dashboard-form {
  display: grid;
  grid-template-columns:
    repeat(2, minmax(0, 1fr));
  gap: 15px;
  padding: 5px 20px 20px;
}

.mo-dashboard-field {
  display: grid;
  gap: 7px;
  min-width: 0;
}

.mo-dashboard-field.is-full {
  grid-column: 1 / -1;
}

.mo-dashboard-field label {
  color: #abb4c7;
  font-size: 11px;
  font-weight: 750;
}

.mo-dashboard-field input,
.mo-dashboard-field select {
  width: 100%;
  min-width: 0;
  min-height: 43px;
  padding: 9px 11px;
  border: 1px solid rgba(148, 163, 184, 0.15);
  border-radius: 11px;
  outline: none;
  color: #f4f7ff;
  background: rgba(255, 255, 255, 0.045);
  font: inherit;
}

.mo-dashboard-field input:focus,
.mo-dashboard-field select:focus {
  border-color: rgba(126, 141, 255, 0.64);
  box-shadow: 0 0 0 3px rgba(126, 141, 255, 0.1);
}

.mo-dashboard-field select option {
  color: #edf1fa;
  background: #111621;
}

.mo-dashboard-modal-message {
  grid-column: 1 / -1;
  padding: 9px 11px;
  border: 1px solid rgba(248, 113, 113, 0.25);
  border-radius: 10px;
  color: #fecaca;
  background: rgba(248, 113, 113, 0.07);
  font-size: 11px;
}

.mo-dashboard-modal-message[hidden] {
  display: none !important;
}

.mo-dashboard-modal-actions {
  grid-column: 1 / -1;
  display: flex;
  justify-content: flex-end;
  gap: 9px;
  margin-top: 5px;
}

/* Light mode */

html[data-mo-theme="light"]
.mo-dashboard-heading h1,
html[data-mo-theme="light"]
.mo-dashboard-empty h2,
html[data-mo-theme="light"]
.mo-dashboard-widget-title h3,
html[data-mo-theme="light"]
.mo-dashboard-kpi strong,
html[data-mo-theme="light"]
.mo-dashboard-stat-value,
html[data-mo-theme="light"]
.mo-dashboard-legend-value,
html[data-mo-theme="light"]
.mo-dashboard-bar-label strong,
html[data-mo-theme="light"]
.mo-dashboard-modal-header h2 {
  color: #172033 !important;
}

html[data-mo-theme="light"]
.mo-dashboard-heading p,
html[data-mo-theme="light"]
.mo-dashboard-eyebrow,
html[data-mo-theme="light"]
.mo-dashboard-status,
html[data-mo-theme="light"]
.mo-dashboard-widget-title span,
html[data-mo-theme="light"]
.mo-dashboard-kpi span,
html[data-mo-theme="light"]
.mo-dashboard-stat-label,
html[data-mo-theme="light"]
.mo-dashboard-doughnut-center span,
html[data-mo-theme="light"]
.mo-dashboard-legend-label,
html[data-mo-theme="light"]
.mo-dashboard-bar-label span,
html[data-mo-theme="light"]
.mo-dashboard-modal-header p {
  color: #66748b !important;
}

html[data-mo-theme="light"]
.mo-dashboard-status,
html[data-mo-theme="light"]
.mo-dashboard-empty,
html[data-mo-theme="light"]
.mo-dashboard-widget,
html[data-mo-theme="light"]
.mo-dashboard-modal {
  border-color: rgba(71, 85, 105, 0.14) !important;
  background:
    radial-gradient(
      circle at top right,
      rgba(99, 102, 241, 0.08),
      transparent 40%
    ),
    rgba(255, 255, 255, 0.97) !important;
  box-shadow:
    0 16px 42px rgba(71, 85, 105, 0.1),
    inset 0 1px rgba(255, 255, 255, 0.9) !important;
}

html[data-mo-theme="light"]
.mo-dashboard-widget-header {
  border-color: rgba(71, 85, 105, 0.11) !important;
}

html[data-mo-theme="light"]
.mo-dashboard-button,
html[data-mo-theme="light"]
.mo-dashboard-widget-tool,
html[data-mo-theme="light"]
.mo-dashboard-kpi,
html[data-mo-theme="light"]
.mo-dashboard-bar-breakdown span,
html[data-mo-theme="light"]
.mo-dashboard-modal-close {
  color: #526079 !important;
  border-color: rgba(71, 85, 105, 0.14) !important;
  background: rgba(247, 249, 252, 0.95) !important;
}

html[data-mo-theme="light"]
.mo-dashboard-button.is-primary {
  color: #ffffff !important;
  border-color: rgba(79, 70, 229, 0.42) !important;
  background:
    linear-gradient(
      135deg,
      #536dfe,
      #7047eb
    ) !important;
}

html[data-mo-theme="light"]
.mo-dashboard-doughnut-center {
  border-color: rgba(71, 85, 105, 0.11) !important;
  background: rgba(255, 255, 255, 0.94) !important;
}

html[data-mo-theme="light"]
.mo-dashboard-doughnut-center strong {
  color: #172033 !important;
}

html[data-mo-theme="light"]
.mo-dashboard-bar-track,
html[data-mo-theme="light"]
.mo-dashboard-doughnut-track {
  background: rgba(71, 85, 105, 0.09) !important;
  stroke: rgba(71, 85, 105, 0.09) !important;
}

html[data-mo-theme="light"]
.mo-dashboard-field label {
  color: #526079 !important;
}

html[data-mo-theme="light"]
.mo-dashboard-field input,
html[data-mo-theme="light"]
.mo-dashboard-field select {
  color: #172033 !important;
  border-color: rgba(71, 85, 105, 0.17) !important;
  background: #ffffff !important;
}

html[data-mo-theme="light"]
.mo-dashboard-field select option {
  color: #172033 !important;
  background: #ffffff !important;
}

@media (max-width: 1100px) {
  .mo-dashboard-widget {
    grid-column: span 12;
  }

  .mo-dashboard-widget.is-stat {
    grid-column: span 6;
  }
}

@media (max-width: 760px) {
  .mo-dashboard-header {
    flex-direction: column;
  }

  .mo-dashboard-actions {
    width: 100%;
    justify-content: flex-start;
  }

  .mo-dashboard-widget.is-stat {
    grid-column: span 12;
  }

  .mo-dashboard-chart-layout {
    grid-template-columns: 1fr;
  }

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

  .mo-dashboard-field,
  .mo-dashboard-field.is-full {
    grid-column: 1;
  }
}

/* Hide dashboard description */
.mo-dashboard-heading > p {
  display: none !important;
}
