/* src/main-frontend.css */
:root {
  color-scheme: light;
  --bg: #f3f6fb;
  --bg-strong: #edf1f6;
  --surface: #ffffff;
  --surface-soft: #f7f9fc;
  --surface-muted: #f1f4f8;
  --text: #171b24;
  --muted: #727b8c;
  --muted-strong: #505766;
  --border: #dde4ee;
  --border-strong: #d3dbe7;
  --active: #232930;
  --active-text: #ffffff;
  --blue: #1976d2;
  --green: #18a058;
  --green-soft: #dff5ea;
  --mint: #def4ec;
  --red: #ef4444;
  --red-soft: #fde8e8;
  --amber: #f4b74b;
  --amber-soft: #fff2d6;
  --pink: #e55ca6;
  --neutral-pill: #eef2f7;
  --shadow:
    rgba(14, 63, 126, 0.04) 0 0 0 1px,
    rgba(42, 51, 69, 0.04) 0 1px 1px -0.5px,
    rgba(42, 51, 70, 0.04) 0 3px 3px -1.5px,
    rgba(42, 51, 70, 0.04) 0 6px 6px -3px,
    rgba(14, 63, 126, 0.04) 0 12px 12px -6px,
    rgba(14, 63, 126, 0.04) 0 24px 24px -12px;
  --radius-lg: 18px;
  --radius-xl: 22px;
  --radius-2xl: 26px;
}
*,
*::before,
*::after {
  box-sizing: border-box;
}
html,
body,
#main-frontend-root {
  min-height: 100%;
}
body {
  margin: 0;
  font-family:
    "DM Sans",
    "Segoe UI",
    sans-serif;
  background: var(--bg);
  color: var(--text);
}
button,
input,
textarea,
select {
  font: inherit;
}
button {
  cursor: pointer;
}
code,
kbd {
  font-family:
    "Cascadia Code",
    "SFMono-Regular",
    Consolas,
    monospace;
}
.console-body,
.console-body--signin {
  background: var(--bg);
}
.console-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr);
  background: var(--bg);
}
.console-stage {
  min-width: 0;
  display: flex;
  flex-direction: column;
}
.console-content {
  padding: 38px 40px 40px;
}
.console-sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border-right: 1px solid var(--border);
  overflow: hidden;
}
.console-sidebar--preview {
  pointer-events: none;
}
.brand-block {
  padding: 20px 20px 18px;
  display: flex;
  align-items: center;
  gap: 14px;
  border-bottom: 1px solid var(--border);
}
.brand-mark {
  width: 42px;
  height: 42px;
  border-radius: 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--blue);
  color: #fff;
  flex: 0 0 auto;
}
.brand-copy {
  min-width: 0;
  display: flex;
  flex-direction: column;
}
.brand-copy strong {
  font-size: 1.06rem;
  line-height: 1.1;
}
.brand-copy span {
  margin-top: 3px;
  font-size: 0.88rem;
  color: var(--muted);
}
.live-pill {
  margin-left: auto;
  padding: 6px 12px;
  border-radius: 999px;
  background: #e8fbef;
  color: var(--green);
  font-size: 0.82rem;
  line-height: 1;
}
.sidebar-search {
  margin: 22px 18px 0;
  min-height: 48px;
  border: 1px solid transparent;
  border-radius: 18px;
  background: var(--surface-muted);
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 16px;
  color: var(--muted);
  text-align: left;
}
.sidebar-search kbd {
  margin-left: auto;
  min-width: 24px;
  height: 24px;
  padding: 0 8px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
  background: var(--surface);
  font-size: 0.76rem;
  color: var(--muted);
}
.sidebar-search--ghost {
  opacity: 0.92;
}
.sidebar-scroll {
  flex: 1 1 auto;
  overflow: auto;
  overflow-x: hidden;
  padding: 22px 14px 18px;
}
.sidebar-section + .sidebar-section {
  margin-top: 18px;
}
.sidebar-section__title {
  margin: 0 12px 10px;
  color: var(--muted);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.sidebar-nav {
  display: grid;
  gap: 6px;
  min-width: 0;
}
.sidebar-item,
.sidebar-item.is-preview {
  width: 100%;
  min-height: 52px;
  border: 0;
  border-radius: 18px;
  background: transparent;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 0 14px;
  color: var(--text);
  text-align: left;
  overflow: hidden;
}
.sidebar-item:hover {
  background: var(--surface-soft);
}
.sidebar-item.is-active {
  background: var(--active);
  color: var(--active-text);
  box-shadow: 0 10px 20px rgba(24, 30, 40, 0.12);
}
.sidebar-item__icon {
  flex: 0 0 auto;
  color: inherit;
  opacity: 0.9;
}
.sidebar-item__label {
  min-width: 0;
  font-size: 1rem;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.nav-badge {
  margin-left: auto;
  min-width: 24px;
  min-height: 24px;
  padding: 0 8px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.78rem;
  line-height: 1;
}
.nav-badge--danger {
  background: var(--red-soft);
  color: var(--red);
}
.nav-badge--warning {
  background: var(--amber-soft);
  color: #d8921f;
}
.nav-badge--neutral {
  background: var(--neutral-pill);
  color: var(--muted-strong);
}
.sidebar-footer {
  padding: 16px 14px 18px;
  border-top: 1px solid var(--border);
  display: grid;
  gap: 12px;
}
.sidebar-settings {
  min-height: 44px;
  border: 0;
  border-radius: 16px;
  background: transparent;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 14px;
  color: var(--muted-strong);
}
.sidebar-settings:hover {
  background: var(--surface-soft);
}
.sidebar-user-card {
  min-height: 68px;
  border: 0;
  border-radius: 18px;
  background: transparent;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 10px 12px;
  text-align: left;
}
.sidebar-user-card:hover {
  background: var(--surface-soft);
}
.sidebar-user-card--preview {
  background: transparent;
}
.sidebar-user-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #d7ecff;
  color: var(--blue);
  font-weight: 700;
  flex: 0 0 auto;
}
.sidebar-user-meta {
  min-width: 0;
  display: flex;
  flex-direction: column;
}
.sidebar-user-meta strong {
  font-size: 1rem;
  line-height: 1.1;
}
.sidebar-user-meta span {
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.86rem;
}
.sidebar-user-theme {
  margin-left: auto;
  width: 30px;
  height: 30px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--muted-strong);
}
.console-header {
  position: sticky;
  top: 0;
  z-index: 10;
  min-height: 86px;
  padding: 18px 40px 16px;
  background: rgba(255, 255, 255, 0.96);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(18px);
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 18px;
}
.console-header h1 {
  margin: 0;
  font-size: 2rem;
  line-height: 1.05;
  letter-spacing: -0.03em;
}
.console-header p {
  margin: 6px 0 0;
  font-size: 1.04rem;
  color: var(--muted);
}
.header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: flex-end;
}
.top-action,
.primary-action,
.top-icon-button,
.primary-submit {
  border-radius: 16px;
  border: 1px solid var(--border);
  background: var(--surface);
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 0 16px;
  color: var(--text);
}
.top-action:hover,
.primary-action:hover,
.top-icon-button:hover,
.primary-submit:hover {
  border-color: var(--border-strong);
}
.top-action:disabled,
.primary-action:disabled,
.top-icon-button:disabled,
.primary-submit:disabled {
  cursor: default;
  opacity: 0.68;
}
.top-icon-button {
  width: 42px;
  justify-content: center;
  padding: 0;
  position: relative;
}
.top-icon-dot {
  position: absolute;
  top: 9px;
  right: 9px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #f29ba2;
}
.primary-action,
.primary-submit {
  border-color: #e84a4a;
  background: #ef4444;
  color: #fff;
}
.primary-action:hover,
.primary-submit:hover {
  border-color: #d53c3c;
  background: #e23b3b;
}
.top-action--wide {
  width: 100%;
  justify-content: center;
}
.surface-card {
  border-radius: var(--radius-2xl);
  background: var(--surface);
  box-shadow: var(--shadow);
}
.surface-eyebrow {
  display: inline-block;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.78rem;
}
.loading-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}
.loading-card {
  width: min(520px, 100%);
  padding: 30px 30px 28px;
}
.loading-card h1 {
  margin: 12px 0 10px;
  font-size: 2rem;
}
.loading-card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.6;
}
.loading-line {
  margin-top: 22px;
  height: 8px;
  border-radius: 999px;
  background: var(--surface-muted);
  overflow: hidden;
}
.loading-line span {
  display: block;
  width: 42%;
  height: 100%;
  border-radius: inherit;
  background:
    linear-gradient(
      90deg,
      var(--blue),
      #7db7ff);
}
.dashboard-shell,
.section-shell {
  display: grid;
  gap: 26px;
}
.dashboard-metrics,
.section-metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 22px;
}
.metric-card {
  padding: 26px 26px 24px;
}
.metric-card__top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
}
.metric-icon {
  width: 50px;
  height: 50px;
  border-radius: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.metric-icon--danger {
  background: var(--red-soft);
  color: var(--red);
}
.metric-icon--primary {
  background: #e6f1ff;
  color: var(--blue);
}
.metric-icon--mint {
  background: var(--mint);
  color: var(--green);
}
.metric-delta {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.95rem;
  font-weight: 600;
}
.metric-delta--danger {
  color: var(--red);
}
.metric-delta--success {
  color: var(--green);
}
.metric-card strong {
  display: block;
  margin-top: 22px;
  font-size: 2.2rem;
  line-height: 1;
  letter-spacing: -0.04em;
}
.metric-card p {
  margin: 14px 0 0;
  color: var(--muted-strong);
  font-size: 1rem;
}
.dashboard-grid,
.section-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.9fr) minmax(310px, 0.86fr);
  gap: 22px;
}
.chart-card,
.section-card,
.sidebar-panel,
.incidents-card {
  padding: 26px 28px 28px;
}
.chart-card {
  min-height: 496px;
}
.chart-card--short {
  min-height: 340px;
}
.incidents-card {
  min-height: 496px;
}
.card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 14px;
}
.card-header h2 {
  margin: 0;
  font-size: 1.2rem;
  line-height: 1.2;
}
.card-header p {
  margin: 6px 0 0;
  color: var(--muted);
  line-height: 1.5;
}
.chart-legend,
.legend-cluster,
.legend-chip {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}
.legend-cluster {
  flex-wrap: wrap;
  gap: 18px;
}
.legend-dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  display: inline-block;
}
.legend-dot--blue {
  background: var(--blue);
}
.legend-dot--green {
  background: #36ae6e;
}
.legend-dot--pink {
  background: var(--pink);
}
.chart-svg {
  width: 100%;
  height: calc(100% - 56px);
  min-height: 280px;
  margin-top: 18px;
}
.chart-grid-line {
  stroke: #ecf0f5;
  stroke-width: 1;
}
.chart-grid-line--vertical {
  stroke-dasharray: 3 8;
}
.chart-line {
  fill: none;
  stroke-width: 4;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.chart-line--blue {
  stroke: var(--blue);
}
.chart-line--green {
  stroke: #36ae6e;
}
.chart-line--pink {
  stroke: var(--pink);
}
.chart-point {
  fill: #fff;
  stroke-width: 3;
}
.chart-point--blue {
  stroke: var(--blue);
}
.soft-pill,
.severity-pill,
.status-pill,
.ghost-chip {
  min-height: 30px;
  padding: 0 12px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.83rem;
  line-height: 1;
}
.soft-pill--danger {
  background: #ffeef0;
  color: var(--red);
}
.severity-pill--warning {
  background: #fff2d6;
  color: #d69519;
}
.severity-pill--danger {
  background: #ffe4e4;
  color: var(--red);
}
.severity-pill--neutral {
  background: var(--neutral-pill);
  color: var(--muted-strong);
}
.status-pill--success {
  background: #e8fbef;
  color: var(--green);
}
.status-pill--warning {
  background: var(--amber-soft);
  color: #cc8a16;
}
.status-pill--danger {
  background: var(--red-soft);
  color: var(--red);
}
.status-pill--neutral {
  background: var(--neutral-pill);
  color: var(--muted-strong);
}
.incident-list {
  margin-top: 20px;
  display: grid;
  gap: 18px;
}
.incident-card {
  padding: 16px 16px 18px;
  border-radius: 20px;
  background: var(--surface-soft);
}
.incident-card__top {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: center;
}
.incident-code {
  color: var(--muted);
  font-size: 0.95rem;
}
.incident-card h3 {
  margin: 14px 0;
  font-size: 1rem;
  line-height: 1.45;
}
.incident-meta {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  color: var(--muted);
  font-size: 0.95rem;
}
.incident-meta span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.summary-card {
  padding: 22px 24px;
}
.summary-card span {
  display: block;
  color: var(--muted);
  font-size: 0.9rem;
}
.summary-card strong {
  display: block;
  margin-top: 16px;
  font-size: 2rem;
  line-height: 1;
  letter-spacing: -0.03em;
}
.summary-card p {
  margin: 14px 0 0;
  color: var(--muted);
  line-height: 1.5;
}
.summary-card__state-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
}
.module-grid {
  margin-top: 18px;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}
.module-card {
  min-height: 148px;
  border: 1px solid var(--border);
  border-radius: 20px;
  background: var(--surface-soft);
  padding: 18px;
  text-align: left;
}
.module-card:hover,
.module-card.is-selected {
  border-color: #c8d5e6;
  background: #fdfefe;
  box-shadow: inset 0 0 0 1px rgba(25, 118, 210, 0.06);
}
.module-card h3 {
  margin: 0;
  font-size: 1rem;
  line-height: 1.3;
}
.module-card p {
  margin: 10px 0 0;
  color: var(--muted);
  line-height: 1.55;
}
.stack-list,
.rule-list,
.option-list,
.timeline-list {
  display: grid;
  gap: 14px;
}
.stack-list {
  margin-top: 18px;
}
.stack-list__row {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--muted-strong);
}
.stack-list__dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--blue);
  flex: 0 0 auto;
}
.rule-list {
  margin-top: 18px;
}
.rule-row {
  padding: 16px 18px;
  border-radius: 18px;
  background: var(--surface-soft);
  display: grid;
  gap: 8px;
}
.rule-row strong {
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
}
.rule-row span {
  color: var(--text);
  line-height: 1.55;
}
.runtime-grid,
.profile-detail-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin-top: 18px;
}
.runtime-tile {
  padding: 16px;
  border-radius: 18px;
  background: var(--surface-soft);
}
.runtime-tile span {
  display: block;
  color: var(--muted);
  font-size: 0.86rem;
}
.runtime-tile strong {
  display: block;
  margin-top: 10px;
  font-size: 1.1rem;
}
.quick-link-row {
  margin-top: 18px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}
.ghost-chip {
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--muted-strong);
}
.ghost-chip--button {
  min-height: 40px;
  padding: 0 16px;
}
.ghost-chip.is-selected,
.ghost-chip:hover {
  border-color: #c3d3e6;
  color: var(--text);
}
.profile-grid {
  grid-template-columns: minmax(0, 1.4fr) minmax(310px, 0.86fr);
}
.profile-hero {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 20px;
  border-radius: 22px;
  background: var(--surface-soft);
}
.profile-avatar {
  width: 58px;
  height: 58px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #d7ecff;
  color: var(--blue);
  font-size: 1.1rem;
  font-weight: 700;
}
.profile-copy {
  min-width: 0;
  flex: 1 1 auto;
}
.profile-copy h3 {
  margin: 0;
  font-size: 1.1rem;
}
.profile-copy p {
  margin: 5px 0 0;
  color: var(--muted);
}
.profile-action-row {
  margin-top: 18px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}
.option-list,
.timeline-list {
  margin-top: 18px;
}
.option-card,
.timeline-card {
  padding: 16px 18px;
  border-radius: 18px;
  background: var(--surface-soft);
}
.option-card__header,
.timeline-card__header {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: center;
}
.option-card p,
.timeline-card p {
  margin: 10px 0 0;
  color: var(--muted);
  line-height: 1.55;
}
.status-card {
  padding: 14px 16px;
  border-radius: 18px;
  border: 1px solid var(--border);
  background: var(--surface-soft);
}
.status-card strong {
  display: block;
  margin-bottom: 8px;
}
.status-card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.55;
}
.status-card--danger {
  border-color: rgba(239, 68, 68, 0.18);
  background: rgba(253, 232, 232, 0.92);
}
.signin-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(360px, 0.78fr);
  gap: 24px;
}
.signin-preview {
  display: grid;
  gap: 24px;
}
.signin-panel {
  padding: 28px;
  align-self: start;
}
.signin-panel__head h2 {
  margin: 12px 0 8px;
  font-size: 1.8rem;
  letter-spacing: -0.03em;
}
.signin-panel__head p {
  margin: 0;
  color: var(--muted);
  line-height: 1.6;
}
.signin-notes {
  margin-top: 20px;
  display: grid;
  gap: 12px;
}
.signin-form {
  margin-top: 22px;
  display: grid;
  gap: 16px;
}
.field {
  display: grid;
  gap: 8px;
}
.field span {
  font-size: 0.92rem;
  color: var(--muted-strong);
}
.field input {
  width: 100%;
  min-height: 48px;
  border-radius: 16px;
  border: 1px solid var(--border);
  background: #fff;
  padding: 0 16px;
  color: var(--text);
}
.field input:focus {
  outline: none;
  border-color: #a7c7ec;
  box-shadow: 0 0 0 4px rgba(25, 118, 210, 0.08);
}
.signin-security {
  margin-top: 22px;
  padding-top: 22px;
  border-top: 1px solid var(--border);
}
.signin-security h3 {
  margin: 0 0 12px;
  font-size: 1rem;
}
.signin-security ul {
  margin: 0;
  padding-left: 18px;
  color: var(--muted);
  display: grid;
  gap: 10px;
  line-height: 1.55;
}
@media (max-width: 1380px) {
  .console-shell,
  .console-shell--signin {
    grid-template-columns: 280px minmax(0, 1fr);
  }
  .dashboard-metrics,
  .section-metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .module-grid {
    grid-template-columns: 1fr;
  }
}
@media (max-width: 1160px) {
  .console-shell,
  .console-shell--signin {
    grid-template-columns: 1fr;
  }
  .console-sidebar {
    position: static;
    height: auto;
  }
  .console-header,
  .console-content {
    padding-left: 24px;
    padding-right: 24px;
  }
  .signin-grid,
  .dashboard-grid,
  .section-grid,
  .profile-grid {
    grid-template-columns: 1fr;
  }
}
@media (max-width: 760px) {
  .console-header {
    min-height: auto;
  }
  .console-header,
  .header-actions {
    flex-direction: column;
    align-items: stretch;
  }
  .console-header h1 {
    font-size: 1.65rem;
  }
  .dashboard-metrics,
  .section-metrics,
  .runtime-grid,
  .profile-detail-grid {
    grid-template-columns: 1fr;
  }
  .chart-card,
  .incidents-card {
    min-height: auto;
  }
  .chart-svg {
    min-height: 220px;
  }
  .profile-hero,
  .option-card__header,
  .timeline-card__header,
  .summary-card__state-row {
    flex-direction: column;
    align-items: flex-start;
  }
  .sidebar-user-card,
  .brand-block {
    align-items: center;
  }
}
