/* tokens */
:root {
  color-scheme: light;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --bg: #f8f9fb;
  --panel: #ffffff;
  --panel-soft: #fcfcfd;
  --panel-muted: #fbfcfe;
  --text: #243041;
  --muted: #7f8a99;
  --line: #edf1f5;
  --line-strong: #dbe3ec;
  --blue: #5b8def;
  --blue-soft: #f2f7ff;
  --green-soft: #f2faf4;
  --yellow-soft: #fffbee;
  --shadow-soft: 0 18px 40px rgba(148, 163, 184, 0.12);
  --radius: 12px;
  --radius-lg: 18px;
  --radius-modal: 26px;
}

/* layout */
* { box-sizing: border-box; }

html,
body {
  width: 100%;
  max-width: 100%;
  margin: 0;
  overflow-x: hidden;
}

body {
  background: var(--bg);
  color: var(--text);
}

a { color: inherit; }

/* buttons */
button,
.button-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 38px;
  padding: 0 14px;
  border: 1px solid transparent;
  border-radius: 999px;
  background: #ffffff;
  color: var(--text);
  text-decoration: none;
  font: inherit;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: background .16s ease, border-color .16s ease, color .16s ease;
}

button:hover,
.button-link:hover { background: #f3f4f6; }

button.primary,
button[data-variant="primary"],
.button-primary {
  background: #eef1f5;
  border-color: #e3e8ee;
  color: #374151;
  font-weight: 600;
}

button.primary:hover,
button[data-variant="primary"]:hover,
.button-primary:hover { background: #e3e8ee; }

.button-quiet {
  background: transparent;
  border-color: var(--line);
}

.close-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  min-width: 34px;
  padding: 0;
  border: 0;
  border-radius: 9px;
  background: transparent;
  font-size: 20px;
  line-height: 1;
  color: #6b7280;
  text-decoration: none;
  cursor: pointer;
}

.close-button:hover {
  color: var(--text);
  background: #f3f4f6;
  text-decoration: none;
}

/* forms */
input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #ffffff;
  color: var(--text);
  padding: 9px 11px;
  font: inherit;
}

textarea {
  min-height: 120px;
  resize: vertical;
}

code {
  background: #f3f4f6;
  color: #374151;
  border-radius: 6px;
  padding: 2px 6px;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.meta {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.5;
}

/* badges */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  background: #f3f4f6;
  color: #4b5563;
  font-size: 12px;
  font-weight: 500;
}

.badge-ok {
  background: var(--green-soft);
  color: #2f6b3c;
}

.badge-warn {
  background: var(--yellow-soft);
  color: #8a5a00;
}


.trust-badge {
  display:inline-flex;
  align-items:center;
  min-height:24px;
  max-width:100%;
  padding:3px 9px;
  border-radius:999px;
  border:1px solid transparent;
  font-size:11px;
  font-weight:700;
  line-height:1.25;
  white-space:nowrap;
}

.trust-verified {
  background:var(--green-soft);
  color:#2f6b3c;
  border-color:#cce8d2;
}

.trust-not-verified {
  background:#f3f4f6;
  color:#526071;
  border-color:#e5e7eb;
}

.trust-blocked {
  background:#fee4e2;
  color:#b42318;
  border-color:#fecdca;
}

.trust-na {
  background:#f8fafc;
  color:#8a96a8;
  border-color:#edf2f7;
}


/* inline help */
.label-help {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-width: 0;
  vertical-align: middle;
}

.help-tip {
  position: relative;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  flex: 0 0 16px;
  border-radius: 999px;
  background: #edf2f8;
  color: #667085;
  font-size: 10px;
  font-weight: 800;
  line-height: 1;
  cursor: help;
  text-transform: none;
  letter-spacing: 0;
}

.help-tip::before,
.help-tip::after {
  position: absolute;
  left: 50%;
  opacity: 0;
  pointer-events: none;
  transition: opacity .14s ease, transform .14s ease;
}

.help-tip::before {
  content: '';
  bottom: calc(100% + 4px);
  transform: translate(-50%, 3px);
  border: 5px solid transparent;
  border-top-color: #111827;
}

.help-tip::after {
  content: attr(data-tip);
  bottom: calc(100% + 14px);
  left: auto;
  right: 0;
  transform: translateY(3px);
  width: 240px;
  max-width: calc(100vw - 32px);
  padding: 8px 10px;
  border-radius: 10px;
  background: #111827;
  color: #fff;
  box-shadow: 0 14px 34px rgba(15, 23, 42, .22);
  font-size: 12px;
  font-weight: 500;
  line-height: 1.45;
  white-space: normal;
  overflow-wrap: anywhere;
  text-align: left;
}

.help-tip:hover,
.help-tip:focus-visible {
  background: #dfe8f5;
  color: #344054;
  outline: none;
}

.help-tip:hover::before,
.help-tip:hover::after,
.help-tip:focus-visible::before,
.help-tip:focus-visible::after {
  opacity: 1;
  transform: translate(-50%, 0);
}

.help-tip:hover::after,
.help-tip:focus-visible::after {
  transform: translateY(0);
}

.badge .help-tip {
  width: 14px;
  height: 14px;
  flex-basis: 14px;
  background: rgba(255,255,255,.65);
  font-size: 9px;
}

.action-help {
  display: inline-flex;
  align-items: center;
  color: #8a96a8;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .04em;
  text-transform: uppercase;
}

/* tables */
.table-wrap {
  width: 100%;
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
  font-size: 12px;
}

th,
td {
  padding: 8px 7px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

th {
  color: var(--muted);
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .06em;
}

/* cards */
.panel,
.summary-card,
.project-card,
.item,
.settings-card,
.alert-card,
.compact-panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
}

.panel,
.compact-panel { padding: 14px; }

.panel-title,
.section-heading,
.item-head,
.settings-head,
.module-row-main,
.project-topline,
.panel-actions,
.inline-actions,
.header-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-width: 0;
}

.stack,
.module-list,
.project-page,
.compact-stack {
  display: grid;
  gap: 10px;
}

.inline-actions,
.settings-actions,
.project-card-actions,
.project-chip-list,
.project-card-badges,
.badges,
.home-header-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}

/* operations home */
.home-page {
  min-height: 100vh;
  background: var(--bg);
}

.home-shell {
  max-width: 1200px;
  margin: 0 auto;
  padding: 24px 20px 32px;
}

.home-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 18px;
}

.brand-block h1 {
  margin: 0;
  font-size: 34px;
  line-height: 1.05;
}

.home-subtitle {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 16px;
}

.header-link {
  color: var(--muted);
  text-decoration: none;
  font-size: 11px;
  font-weight: 500;
}

.header-link:hover { color: var(--text); }

.health-link {
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #ffffff;
  color: var(--text);
}

.home-summary-grid,
.summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}

.summary-card {
  display: grid;
  gap: 8px;
  padding: 14px;
}

.summary-card span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}

.summary-card strong {
  font-size: 24px;
  line-height: 1;
}

.home-section {
  display: grid;
  gap: 12px;
}

.section-heading h2,
.panel-title h2,
.compact-panel h2 {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
}

.project-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 14px;
}

.project-card {
  display: grid;
  gap: 14px;
  padding: 18px;
}

.project-card h3 {
  margin: 8px 0 2px;
  font-size: 20px;
}

.project-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 26px;
  padding: 0 10px;
  border-radius: 999px;
  background: #f8fafc;
  color: #475467;
  font-size: 12px;
  font-weight: 700;
}

.project-chip-short {
  min-width: 28px;
  padding: 0 8px;
  background: var(--blue-soft);
  color: var(--blue);
}

.project-card-meta {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px 12px;
  margin: 0;
}

.project-card-meta div { min-width: 0; }

.project-card-meta dt {
  margin: 0 0 4px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
}

.project-card-meta dd {
  margin: 0;
  font-size: 13px;
  font-weight: 600;
  overflow-wrap: anywhere;
}

.empty-card {
  min-height: 180px;
  align-content: center;
}

.footer-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px 20px;
  margin-top: 28px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 12px;
}

.footer-line {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.footer-line img {
  width: 18px;
  height: 18px;
  object-fit: contain;
}

.footer-line a {
  color: inherit;
  text-decoration: none;
}

.footer-line a:hover { text-decoration: underline; }

/* settings modal */
.settings-page {
  min-height: 100vh;
  overflow: hidden;
}

.settings-overlay {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 28px 24px;
  background: rgba(245, 246, 248, 0.72);
  backdrop-filter: blur(18px);
}

.settings-popover {
  width: min(1120px, calc(100vw - 72px));
  height: min(820px, calc(100vh - 72px));
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  grid-template-rows: auto minmax(0, 1fr);
  background: rgba(255,255,255,0.98);
  border: 1px solid rgba(229,231,235,0.9);
  border-radius: 24px;
  box-shadow: var(--shadow-soft);
  overflow: hidden;
}

.settings-popover-header {
  grid-column: 1 / -1;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 20px 22px 16px;
  border-bottom: 1px solid var(--line);
  background: rgba(255,255,255,0.96);
}

.settings-popover-header h1 {
  margin: 0;
  font-size: 26px;
}

.settings-popover-header .meta { margin-top: 6px; }

/* settings sidebar */
.settings-sidebar {
  min-width: 0;
  padding: 18px 14px;
  border-right: 1px solid var(--line);
  background: #fbfbfd;
  overflow: auto;
}

.settings-brand { margin-bottom: 16px; }

.settings-brand strong {
  display: block;
  font-size: 18px;
}

.settings-nav {
  display: grid;
  gap: 14px;
}

.settings-nav-title {
  padding: 0 8px;
  color: #8a93a3;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.settings-nav-item {
  display: flex;
  align-items: center;
  min-height: 38px;
  padding: 0 10px;
  border-radius: 12px;
  color: #273244;
  text-decoration: none;
  font-size: 13px;
  font-weight: 600;
}

.settings-nav-item:hover { background: #f3f4f6; }

.settings-nav-item.is-active {
  background: #edf3ff;
  color: var(--blue);
}

.settings-nav-item.level-1 { margin-left: 8px; }

.settings-main {
  min-width: 0;
  min-height: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  padding: 16px 18px 18px;
}

.status-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  min-height: 24px;
  padding-bottom: 12px;
}

/* settings tabs */
.settings-content {
  min-width: 0;
  min-height: 0;
  overflow: auto;
  padding-right: 2px;
  display: grid;
  gap: 12px;
}

.settings-two-col {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 12px;
}

.compact-panel { min-width: 0; }

.form-grid,
.runtime-grid,
.nginx-grid,
.module-settings-grid,
.alert-fields,
.settings-bar {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.form-grid label,
.compact-form label,
.alert-fields label,
.nginx-grid label,
.settings-bar label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
}

.form-grid label em,
.runtime-grid em,
.source-badge {
  color: #98a2b3;
  font-style: normal;
  font-size: 11px;
}

.project-chip-list { margin-top: 6px; }

.project-chip-link {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #ffffff;
  color: var(--text);
  text-decoration: none;
  font-size: 13px;
  font-weight: 600;
}

.project-chip-link.is-active,
.project-chip-link:hover {
  background: var(--blue-soft);
  border-color: transparent;
  color: var(--blue);
}

.store-override-list,
.helper-text,
.system-warning,
.warning-note {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.system-warning,
.warning-note {
  padding: 9px 11px;
  border-radius: 12px;
  background: #fffbeb;
  color: #92400e;
}

.module-row,
.alert-edit-card,
.alert-card,
.compact-item {
  padding: 12px;
  background: var(--panel-muted);
}

.module-table td,
.overview-table td { white-space: normal; }

.order-input {
  max-width: 72px;
}

.inline-setting {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 12px;
}

.switch {
  display: inline-flex;
  align-items: center;
  width: 40px;
  height: 24px;
}

.switch input { display: none; }

.switch span {
  position: relative;
  width: 40px;
  height: 24px;
  border-radius: 999px;
  background: #d1d5db;
  transition: background .16s ease;
}

.switch span::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #ffffff;
  transition: transform .16s ease;
  box-shadow: 0 1px 3px rgba(0,0,0,.18);
}

.switch input:checked + span { background: var(--blue); }

.switch input:checked + span::after { transform: translateX(16px); }

.checkbox-group,
.gate-selector,
.alert-fieldset {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px;
  background: #ffffff;
}

.checkbox-group-head,
.gate-selector-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
  color: var(--muted);
  font-size: 12px;
}

.checkbox-option,
.gate-option {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
  font-size: 13px;
  color: var(--text);
}

.gate-option small { color: var(--muted); }

.alert-fieldset {
  display: grid;
  gap: 12px;
}

.alert-fieldset legend {
  padding: 0 6px;
  color: var(--text);
  font-size: 13px;
  font-weight: 700;
}

.alert-group-grid {
  display: grid;
  gap: 12px;
}

.advanced-section,
.advanced-inline,
.module-settings,
.runtime-config {
  border-top: 1px solid var(--line);
  padding-top: 10px;
}

.advanced-section summary,
.advanced-inline summary,
.module-settings summary,
.runtime-config summary {
  cursor: pointer;
  color: #374151;
  font-size: 13px;
  font-weight: 650;
}

.auth-card {
  display: grid;
  gap: 12px;
  max-width: 460px;
}

.auth-card h2 {
  margin: 0 0 4px;
}

.error-cell { color: #b42318; }

/* responsive rules */
@media (max-width: 1024px) {
  .settings-popover {
    width: min(100vw - 24px, 1040px);
    height: min(100vh - 28px, 860px);
  }

  .form-grid,
  .runtime-grid,
  .nginx-grid,
  .module-settings-grid,
  .alert-fields,
  .settings-two-col,
  .settings-bar {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 860px) {
  .home-shell {
    padding: 22px 16px 32px;
  }

  .home-header,
  .settings-popover-header,
  .footer-bar {
    flex-direction: column;
    align-items: flex-start;
  }

  .project-card-meta { grid-template-columns: 1fr; }

  .settings-overlay { padding: 0; }

  .settings-popover {
    width: 100vw;
    height: 100vh;
    border-radius: 0;
    grid-template-columns: 1fr;
    grid-template-rows: auto auto minmax(0, 1fr);
  }

  .settings-sidebar {
    border-right: 0;
    border-bottom: 1px solid var(--line);
    padding-bottom: 12px;
  }

  .settings-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
  }

  .settings-nav-title {
    width: 100%;
    padding: 0;
  }

  .settings-nav-item,
  .settings-nav-item.level-1 { margin-left: 0; }

  .settings-main {
    padding: 12px 14px 14px;
  }
}

.settings-home-backdrop {
  position: fixed;
  inset: 0;
  padding: 58px 7vw;
  background: linear-gradient(180deg, #f7f8fb 0%, #eef2f7 100%);
  color: #111827;
  filter: blur(1px);
  transform: scale(1.01);
  opacity: .58;
}
.backdrop-header { display: flex; align-items: flex-start; justify-content: space-between; max-width: 1180px; margin: 0 auto 28px; }
.backdrop-header h1 { margin: 4px 0 6px; font-size: 38px; }
.backdrop-grid { max-width: 1180px; margin: 0 auto; display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 18px; }
.backdrop-grid article { height: 280px; border-radius: 18px; background: rgba(255,255,255,.72); border: 1px solid rgba(226,232,240,.72); box-shadow: 0 18px 50px rgba(15,23,42,.08); }
.project-toolbar { display: grid; grid-template-columns: minmax(220px, 1fr) auto auto; align-items: end; gap: 14px; }
.project-toolbar-meta { display: flex; gap: 8px; align-items: center; padding-bottom: 4px; }
.kv-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 10px; }
.kv-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-width: 0; padding: 10px 12px; border-radius: 12px; background: #f8fafc; border: 1px solid #edf1f7; }
.kv-row span { color: #718096; font-size: 12px; }
.kv-row strong { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; color: #172033; }
.credential-list { margin-top: 12px; display: grid; gap: 8px; }
.credential-row { display: flex; justify-content: space-between; gap: 16px; padding: 9px 12px; border-radius: 12px; background: #fbfcfe; border: 1px solid #edf1f7; }
.credential-row span { color: #718096; font-size: 12px; }
.credential-row strong { font-size: 13px; }
.button-soft { border: 0; background: #eef4ff; color: #3164d9; border-radius: 999px; padding: 10px 14px; font-weight: 700; }
.button-soft:disabled { opacity: .68; cursor: default; }
@media (max-width: 900px) {
  .project-toolbar, .kv-grid { grid-template-columns: 1fr; }
  .backdrop-grid { grid-template-columns: 1fr; }
}

/* operations home */
body { font-size: 14px; }
.home-shell { max-width: 1480px; padding: 30px 28px 40px; }
.home-header { align-items: center; margin-bottom: 22px; }
.brand-block h1 { font-size: 30px; font-weight: 600; letter-spacing: 0; color: #1f2937; }
.home-subtitle { font-size: 14px; color: #778398; }
.home-header-actions { display: flex; align-items: center; gap: 10px; padding: 0; background: none; border: none; }
.seg-control { display: inline-flex; align-items: center; gap: 2px; padding: 4px; border-radius: 999px; background: #f1f3f6; border: 1px solid var(--line); }
.seg { min-height: 32px; display: inline-flex; align-items: center; padding: 0 14px; border-radius: 999px; color: var(--muted); text-decoration: none; font-size: 13px; font-weight: 500; transition: background .14s, color .14s; }
.seg:hover { color: #1f2937; }
.seg.is-active { background: #fff; color: #111827; font-weight: 600; box-shadow: 0 1px 3px rgba(15,23,42,.08); }
.header-btn { min-height: 34px; display: inline-flex; align-items: center; padding: 0 16px; border-radius: 999px; border: 1px solid var(--line); background: #fff; color: #1f2937; text-decoration: none; font-size: 13px; font-weight: 600; }
.header-btn:hover { background: #f6f8fb; border-color: #dbe3ec; }
.header-status { display: inline-flex; align-items: center; gap: 7px; padding: 0 4px; color: var(--muted); text-decoration: none; font-size: 13px; font-weight: 500; }
.header-status:hover { color: #1f2937; }
.home-summary-grid { grid-template-columns: repeat(5, minmax(0,1fr)); gap: 14px; }
.metric-card { background: #fff; border: 1px solid #eef2f7; border-radius: 20px; padding: 18px; box-shadow: 0 4px 14px rgba(15,23,42,.03); display: grid; gap: 8px; }
.metric-card span { color: #8a96a8; font-size: 12px; font-weight: 500; }
.metric-card strong { color: #1f2937; font-size: 25px; font-weight: 500; line-height: 1; }
.metric-card small { color: #98a2b3; font-size: 11px; }
.project-grid { grid-template-columns: repeat(auto-fit, minmax(400px, 1fr)); gap: 14px; }
.ops-project-card { background:#fff; border:1px solid #eef2f7; border-radius:22px; padding:18px; display:grid; gap:16px; box-shadow:0 4px 16px rgba(15,23,42,.03); }
.ops-project-head { display:grid; grid-template-columns:auto minmax(0,1fr) auto; gap:12px; align-items:start; }
.ops-project-head h3 { margin:0 0 3px; font-size:16px; font-weight:600; color:#1f2937; }
.ops-project-head p { margin:0; color:#7b8798; font-size:12px; }
.type-dot { width:32px; height:32px; display:inline-grid; place-items:center; border-radius:11px; background:#eceef1; color:#374151; font-weight:700; font-size:13px; }
.type-dot-d { background:#eef4ff; color:#3164d9; }
.type-dot-r { background:#e6f6ec; color:#15803d; }
.soft-pill { display:inline-flex; align-items:center; min-height:26px; padding:0 10px; border-radius:999px; background:#f6f8fb; color:#7a8699; font-size:12px; font-weight:500; }
.ops-project-flag { display:flex; align-items:center; gap:8px; }
.status-dot { width:9px; height:9px; border-radius:50%; flex-shrink:0; }
.status-dot.is-on { background:#16a34a; box-shadow:0 0 0 3px rgba(22,163,74,.16); }
.status-dot.is-off { background:#cbd5e1; }
.skeleton-card { pointer-events:none; }
.sk { display:block; position:relative; overflow:hidden; background:#e9edf1; border-radius:8px; }
.settings-skeleton { display:grid; gap:14px; padding:4px; }
.settings-skeleton .sk-grid { display:grid; grid-template-columns:repeat(5,minmax(0,1fr)); gap:10px; }
.settings-skeleton .sk-card { height:84px; border-radius:16px; }
.settings-skeleton .sk-block { height:140px; border-radius:16px; }
.sk::after { content:''; position:absolute; inset:0; transform:translateX(-100%); background:linear-gradient(90deg, transparent, rgba(255,255,255,.65), transparent); animation:sk-shimmer 1.3s ease-in-out infinite; }
@keyframes sk-shimmer { 100% { transform:translateX(100%); } }
.sk-dot { width:34px; height:34px; border-radius:12px; flex-shrink:0; }
.sk-line { height:13px; border-radius:6px; }
.sk-line.lg { height:18px; }
.sk-head { display:flex; align-items:center; gap:12px; }
.sk-head-text { display:grid; gap:7px; flex:1; }
.sk-box { height:56px; border-radius:14px; }
.ops-project-stats { display:grid; grid-template-columns:repeat(4,minmax(0,1fr)); gap:8px; }
.ops-project-stats div { background:#f8fafc; border:1px solid #edf2f7; border-radius:14px; padding:10px; }
.ops-project-stats span { display:block; color:#7a8699; font-size:11px; margin-bottom:5px; }
.ops-project-stats strong { color:#1f2937; font-size:14px; font-weight:600; }
.ops-health-stat { position:relative; }
.ops-health-value { display:flex !important; align-items:flex-start; gap:5px; margin:0 !important; color:inherit !important; font-size:inherit !important; }
.ops-health-value strong { min-width:0; }
.ops-health-help { width:16px; min-width:16px; height:16px; min-height:16px; padding:0; margin:0; border:0; flex:0 0 16px; overflow:visible; }
.ops-health-help::after { left:auto; right:-8px; transform:translateY(3px); width:max-content; min-width:240px; max-width:min(320px,calc(100vw - 48px)); white-space:pre-line; }
.ops-health-help::before { left:auto; right:3px; transform:translateY(3px); }
.ops-health-help:hover::before, .ops-health-help:hover::after, .ops-health-help:focus-visible::before, .ops-health-help:focus-visible::after { transform:translateY(0); }

.ops-card-footer { display:flex; flex-direction:column; align-items:stretch; gap:10px; color:#8b95a5; font-size:12px; }
.ops-card-actions { display:flex; gap:8px; flex-wrap:nowrap; justify-content:flex-start; }
.ops-card-actions a:nth-child(2) { margin-left:auto; }
.ops-card-actions .button-link { min-height:36px; padding:0 12px; border-color:transparent; background:transparent; color:#a3acb9; font-weight:500; }
.ops-card-actions .button-link:hover { background:#f6f8fb; color:#5f6b7a; }
.ops-card-actions .button-primary { padding:0 16px; border:1px solid var(--line); background:#fff; color:#1f2937; font-weight:600; }
.ops-card-actions .button-primary:hover { background:#f6f8fb; border-color:#dbe3ec; color:#1f2937; }
.ops-card-last { color:#8b95a5; font-size:12px; }

.settings-overlay { padding: 30px 24px; background: rgba(20, 27, 40, .16); backdrop-filter: blur(20px); }
#settingsDialog { width:100vw; height:100vh; max-width:100vw; max-height:100vh; margin:0; padding:0; border:0; background:transparent; overflow:hidden; }
#settingsDialog::backdrop { background: rgba(20, 27, 40, .30); backdrop-filter: blur(6px); }
#settingsFrame { width:100%; height:100%; border:0; background:transparent; }
body.in-frame { background: transparent; }
body.in-frame .settings-home-backdrop { display:none; }
body.in-frame .settings-overlay { background: transparent; backdrop-filter: none; }
.settings-popover { width: min(1060px, calc(100vw - 64px)); height: min(82vh, 820px); grid-template-columns: 202px minmax(0,1fr); border-radius: 28px; box-shadow: 0 30px 90px rgba(15,23,42,.20); border: 1px solid rgba(219,226,237,.9); }
.settings-popover-header { padding: 22px 24px 18px; }
.settings-popover-header h1 { font-size: 22px; font-weight: 600; color:#1f2937; }
.settings-popover-header .meta { font-size: 12px; }
.header-actions { gap: 7px; }
#adminAuthStatus, #adminLogout, #refresh { opacity:.78; }
.settings-sidebar { width:202px; padding:16px 12px; background:#fbfcff; }
.settings-nav { gap:7px; }
.settings-nav-item { min-height:40px; display:grid; grid-template-columns:24px minmax(0,1fr) auto; gap:8px; align-items:center; border:1px solid transparent; color:#5f6b7a; font-size:13px; font-weight:500; }
.settings-nav-item em { font-style:normal; min-width:24px; height:22px; display:inline-grid; place-items:center; border-radius:999px; background:#f1f5f9; color:#667085; font-size:11px; }
.settings-nav-item.is-active { background:#eff6ff; border-color:#d7e7ff; color:#2563eb; }
.settings-nav-item.is-active em { background:#dbeafe; color:#2563eb; }
.nav-icon { width:20px; height:20px; display:inline-grid; place-items:center; color:#8a96a8; }
.nav-icon svg { width:20px; height:20px; display:block; }
.settings-nav-item.is-active .nav-icon { color:currentColor; }
.settings-main { padding:16px 18px 18px; background:#fff; }
.status-strip { min-height:16px; padding-bottom:8px; }
.settings-content { gap:14px; }
.settings-hero { border-radius:22px; padding:20px; background:linear-gradient(135deg,#f8fbff,#f4f7fb); border:1px solid #edf2f7; display:flex; align-items:flex-start; justify-content:space-between; gap:16px; }
.settings-hero h2 { margin:0 0 6px; font-size:20px; font-weight:600; }
.settings-hero p { margin:0; color:#748095; }
.metric-grid { display:grid; grid-template-columns:repeat(5,minmax(0,1fr)); gap:10px; }
.project-overview-panel, .settings-card { background:#fff; border:1px solid #edf2f7; border-radius:22px; padding:16px; box-shadow:0 10px 30px rgba(15,23,42,.035); }
.overview-project-list { display:grid; gap:9px; }
.overview-project-row { display:grid; grid-template-columns:minmax(220px,1.2fr) minmax(260px,1.5fr) auto; gap:14px; align-items:center; padding:12px; border:1px solid #eef2f7; border-radius:16px; background:#fbfcfe; }
.project-row-title { display:flex; gap:10px; align-items:center; min-width:0; }
.project-row-title strong { display:block; font-size:14px; font-weight:600; color:#1f2937; }
.project-row-title p { margin:2px 0 0; color:#7b8798; font-size:12px; }
.project-row-metrics { display:flex; gap:8px; flex-wrap:wrap; align-items:center; }
.project-row-metrics span { color:#7b8798; font-size:12px; }
.project-row-metrics strong { color:#374151; font-weight:600; }
.row-actions { display:flex; gap:6px; justify-content:flex-end; }
.row-actions-col { display:flex; flex-direction:column; align-items:flex-end; gap:8px; }
.overview-status { align-self:flex-end; padding:4px 12px; border-radius:999px; font-size:12px; font-weight:600; line-height:1; }
.overview-status.is-running { background:#dcfce7; color:#15803d; }
.overview-status.is-stopped { background:#fee2e2; color:#b91c1c; }
.overview-status.is-warn { background:#fef9c3; color:#854d0e; }
.btn-start { color:#15803d !important; border-color:#bbf7d0 !important; }
.btn-start:hover { background:#f0fdf4 !important; }
.btn-stop { color:#b91c1c !important; border-color:#fecaca !important; }
.btn-stop:hover { background:#fef2f2 !important; }
.project-selector-card { display:grid; grid-template-columns:minmax(220px,1fr) auto auto; gap:12px; align-items:end; padding:16px; border-radius:22px; border:1px solid #edf2f7; background:#fbfcff; }
.project-selector-card label { display:grid; gap:6px; color:#7b8798; font-size:12px; }
.selector-badges { display:flex; gap:8px; padding-bottom:2px; }
.project-detail-grid { display:grid; grid-template-columns:minmax(0,1fr) minmax(0,1fr); gap:14px; }
.settings-card-head { display:flex; justify-content:space-between; gap:12px; align-items:flex-start; margin-bottom:14px; }
.settings-card-head h2 { margin:0 0 4px; font-size:16px; font-weight:600; }
.settings-card-head p { margin:0; color:#7b8798; font-size:12px; }
.detail-grid { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:10px; }
.detail-grid div, .secret-list div { min-width:0; padding:10px 12px; border-radius:14px; background:#f8fafc; border:1px solid #eef2f7; }
.detail-grid span, .secret-list span, .store-card span { display:block; color:#7b8798; font-size:11px; margin-bottom:5px; }
.detail-grid strong, .secret-list strong, .store-card strong { display:block; min-width:0; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; font-size:13px; color:#172033; }
.secret-list { margin-top:10px; display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:8px; }
.store-card-list { display:grid; gap:9px; }
.store-card { display:grid; grid-template-columns:minmax(170px,1.2fr) repeat(4,minmax(0,1fr)); gap:10px; align-items:center; padding:12px; border:1px solid #eef2f7; border-radius:16px; background:#fbfcfe; }
.store-card p { margin:3px 0 0; color:#7b8798; font-size:12px; }
.project-module-list { min-width:0; display:grid; grid-template-columns:minmax(0,1fr); gap:12px; }
.project-module-row { display:grid; grid-template-columns:minmax(0,1.35fr) minmax(0,.7fr) minmax(0,.85fr) minmax(0,.9fr); gap:12px; align-items:start; padding:14px; border:1px solid #eef2f7; border-radius:16px; background:#fbfcfe; }
.project-module-main { min-width:0; }
.project-module-main strong { display:block; font-size:15px; color:#172033; }
.project-module-main p { margin:4px 0 0; color:#667085; font-size:12px; line-height:1.35; }
.project-module-title-row { display:flex; align-items:flex-start; justify-content:space-between; gap:10px; min-width:0; }
.project-module-title-row .project-module-title { min-width:0; overflow-wrap:anywhere; }
.module-help-button { display:inline-flex; align-items:center; gap:5px; flex:0 0 auto; min-height:28px; padding:0 9px; border:1px solid #dbe3ec; border-radius:999px; background:#fff; color:#526071; font-size:11px; font-weight:700; }
.module-help-button span[aria-hidden="true"] { display:inline-grid; place-items:center; width:16px; height:16px; border-radius:999px; background:#edf2f8; color:#667085; font-size:10px; }
.module-help-button:hover, .module-help-button:focus-visible { border-color:#b9c7da; background:#f8fafc; outline:none; }
.module-id-line { margin-top:5px; color:#98a2b3; font-family:ui-monospace,SFMono-Regular,Menlo,monospace; font-size:11px; }
.project-module-runtime, .project-module-config-state, .project-module-trust, .project-module-meta-group, .project-module-ops { min-width:0; }
.project-module-runtime, .project-module-trust { display:grid; gap:5px; align-content:start; padding:8px 10px; border-radius:14px; background:#f8fafc; border:1px solid #eef2f7; }
.project-module-runtime > span, .project-module-trust > span:not(.trust-badge), .module-section-label, .project-module-meta > span, .module-order-field > span, .project-module-error > span { display:block; color:#8a96a8; font-size:10px; font-weight:700; letter-spacing:.04em; text-transform:uppercase; margin-bottom:4px; }
.project-module-runtime small, .project-module-trust small, .project-module-meta small { display:block; min-width:0; margin-top:4px; color:#8a96a8; font-size:11px; line-height:1.35; overflow-wrap:anywhere; }
.project-module-config-state { display:grid; gap:8px; align-content:start; }
.project-module-meta-group, .project-module-ops { grid-column:1 / -1; display:grid; grid-template-columns:repeat(4,minmax(0,1fr)); gap:10px; padding-top:2px; }
.project-module-ops { grid-template-columns:repeat(2,minmax(0,1fr)); }
.project-module-meta strong, .project-module-error strong { display:block; min-width:0; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; color:#243041; font-size:12px; }
.mini-check { display:flex; align-items:center; gap:7px; color:#526071; font-size:12px; font-weight:700; }
.mini-check input { width:15px; height:15px; margin:0; }
.module-order-field input { width:64px; min-height:32px; padding:0 8px; }
.project-module-badges { grid-column:1 / -1; }
.project-module-actions { grid-column:1 / -1; display:flex; flex-wrap:wrap; justify-content:space-between; align-items:center; gap:10px 16px; padding-top:2px; border-top:1px solid #eef2f7; }
.project-module-actions .action-help { margin-right:4px; }
.project-module-actions .meta { margin-right:auto; }
.project-module-runtime-actions, .project-module-config-actions { display:flex; flex-wrap:wrap; align-items:center; gap:8px; min-width:0; }
.module-action-state { display:flex; align-items:center; flex-wrap:wrap; gap:7px; min-width:0; color:#7b8798; }
.module-action-state small { min-width:0; color:#7b8798; font-size:11px; overflow-wrap:anywhere; }
.project-module-debug { grid-column:1 / -1; margin-top:0; }
.project-module-debug summary { gap:10px; }
.project-module-debug summary .trust-badge { margin-left:auto; }
.module-debug-help { display:block; margin:8px 0; color:#7b8798; font-size:12px; line-height:1.45; }
.project-module-debug textarea { width:100%; min-height:110px; font-family:ui-monospace,SFMono-Regular,Menlo,monospace; }
.badges { gap:5px; }

.module-help-backdrop {
  position:fixed;
  inset:0;
  z-index:80;
  display:grid;
  place-items:center;
  padding:24px;
  background:rgba(15,23,42,.28);
}

.module-help-modal {
  width:min(720px,calc(100vw - 48px));
  max-height:min(760px,calc(100vh - 48px));
  display:grid;
  grid-template-rows:auto minmax(0,1fr) auto;
  overflow:hidden;
  border:1px solid #dfe7f1;
  border-radius:22px;
  background:#fff;
  box-shadow:0 28px 90px rgba(15,23,42,.22);
}

.module-help-modal:focus { outline:none; }

.module-help-modal-head,
.module-help-modal-foot {
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap:14px;
  padding:18px 20px;
  border-bottom:1px solid #eef2f7;
}

.module-help-modal-foot {
  border-top:1px solid #eef2f7;
  border-bottom:0;
  justify-content:flex-end;
}

.module-help-eyebrow {
  display:block;
  margin-bottom:4px;
  color:#8a96a8;
  font-size:11px;
  font-weight:800;
  letter-spacing:.05em;
  text-transform:uppercase;
}

.module-help-modal h2 { margin:0; font-size:20px; line-height:1.25; }
.module-help-warning { margin:14px 20px 0; padding:10px 12px; border:1px solid #fecdca; border-radius:14px; background:#fff5f4; color:#b42318; font-size:13px; line-height:1.45; }
.module-help-body { min-height:0; overflow:auto; padding:16px 20px 20px; display:grid; gap:12px; }
.module-help-body article { padding-bottom:12px; border-bottom:1px solid #f0f3f7; }
.module-help-body article:last-child { border-bottom:0; padding-bottom:0; }
.module-help-body span { display:block; margin-bottom:4px; color:#8a96a8; font-size:11px; font-weight:800; letter-spacing:.04em; text-transform:uppercase; }
.module-help-body p { margin:0; color:#344054; font-size:13px; line-height:1.55; overflow-wrap:anywhere; }
.module-save-result { grid-column:1 / -1; display:grid; gap:4px; padding:10px 12px; border:1px solid #dbe3ec; border-radius:14px; background:#f8fafc; color:#344054; }
.module-save-result strong { font-size:13px; line-height:1.35; }
.module-save-result small { color:#667085; font-size:12px; line-height:1.45; overflow-wrap:anywhere; }
.module-save-result.is-success { border-color:#bbf7d0; background:#f0fdf4; color:#15803d; }
.module-save-result.is-success small { color:#166534; }
.module-save-result.is-warn { border-color:#fde68a; background:#fffbeb; color:#92400e; }
.module-save-result.is-warn small { color:#854d0e; }
.module-save-result.is-danger { border-color:#fecdca; background:#fff5f4; color:#b42318; }
.module-save-result.is-danger small { color:#b42318; }
.module-save-result.is-neutral { border-color:#e5e7eb; background:#fafafa; color:#526071; }
.module-save-confirm-modal { width:min(620px,calc(100vw - 48px)); }
.module-save-confirm-body { gap:10px; }
.module-save-confirm-body .module-help-warning { margin:4px 0 0; }
/* Read-only Alerts: parent supplies available height; internal panels own scrolling. */
.alerts-page { display:flex; flex-direction:column; gap:14px; min-height:0; }
.alerts-readonly-page { height:100%; overflow:hidden; }
.alerts-page-head { display:flex; align-items:flex-start; justify-content:space-between; gap:12px; }
.alerts-page-head h2 { margin:0; font-size:18px; font-weight:700; }
.alerts-page-head p { margin:4px 0 0; color:var(--muted); font-size:12px; }
.alert-readonly-tabs { display:flex; gap:6px; padding:4px; align-self:flex-start; border:1px solid #edf2f7; border-radius:12px; background:#f8fafc; }
.alert-readonly-tabs a { padding:7px 11px; border-radius:9px; color:#667085; font-size:12px; font-weight:600; text-decoration:none; }
.alert-readonly-tabs a.is-active { color:#2563eb; background:#fff; box-shadow:0 2px 8px rgba(15,23,42,.08); }
.alerts-shell { flex:1; min-height:0; display:grid; grid-template-columns:minmax(240px,280px) minmax(0,1fr); gap:14px; align-items:stretch; overflow:hidden; }
.alert-list { min-height:0; display:flex; flex-direction:column; border:1px solid #edf2f7; border-radius:14px; background:#fff; overflow:hidden; }
.alert-list-title { padding:12px 14px 8px; font-size:11px; font-weight:700; text-transform:uppercase; letter-spacing:.05em; color:var(--muted); }
.alert-list-scroll { min-height:0; overflow:auto; padding:0 8px 8px; display:grid; align-content:start; gap:4px; }
.alert-row { width:100%; display:grid; grid-template-columns:minmax(0,1fr); justify-content:stretch; justify-items:start; gap:3px; padding:9px 11px; border-radius:10px; border:1px solid transparent; background:transparent; text-align:left; cursor:pointer; }
.alert-row > * { justify-self:start; margin-left:0; text-align:left; }
.alert-row:hover { background:#f6f8fb; }
.alert-row strong { font-size:14px; font-weight:600; color:#1f2937; }
.alert-row-compat { color:#7b8798; font-size:12px; }
.alert-row .badge { height:auto; padding:1px 8px; font-size:11px; font-weight:600; white-space:nowrap; }
.alert-row.is-active { background:#eff6ff; border-color:#d7e7ff; }
.alert-row.is-active strong { color:#2563eb; }
.alert-preview-panel { min-width:0; min-height:0; border:1px solid #edf2f7; border-radius:16px; background:#fff; overflow:hidden; }
.alert-preview-scroll { height:100%; min-height:0; overflow:auto; padding:18px 20px; display:flex; flex-direction:column; gap:16px; }
.alert-preview-loading { padding:20px; color:var(--muted); }
.alert-preview-head { display:flex; align-items:flex-start; justify-content:space-between; gap:12px; }
.alert-preview-head h3, .alert-history-head h3 { margin:0; font-size:16px; font-weight:600; color:#1f2937; }
.alert-preview-head p, .alert-history-head p { margin:4px 0 0; color:var(--muted); font-size:12px; line-height:1.5; }
.alert-preview-meta { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:8px; }
.alert-preview-meta div { min-width:0; padding:10px 12px; border:1px solid #eef2f7; border-radius:12px; background:#fbfcfe; }
.alert-preview-meta span { display:block; margin-bottom:4px; color:var(--muted); font-size:10px; font-weight:700; letter-spacing:.04em; text-transform:uppercase; }
.alert-preview-meta strong { display:block; overflow-wrap:anywhere; color:#243041; font-size:12px; }
.alert-preview-warnings { display:grid; gap:8px; }
.alert-preview-warnings h4, .alert-preview-json h4 { margin:0; font-size:13px; }
.alert-preview-warning { padding:11px 13px; border:1px solid #f3df98; border-radius:12px; background:#fffdf1; }
.alert-preview-warning strong { color:#92400e; font-size:12px; }
.alert-preview-warning p { margin:4px 0; color:#8a5a00; font-size:12px; line-height:1.45; }
.alert-preview-warning span { color:#9a6a00; font-family:ui-monospace,SFMono-Regular,Menlo,monospace; font-size:11px; }
.alert-preview-json-grid { display:grid; grid-template-columns:minmax(0,1fr) minmax(0,1fr); gap:12px; align-items:start; }
.alert-preview-json { min-width:0; border:1px solid #eef2f7; border-radius:14px; overflow:hidden; }
.alert-preview-json header { padding:11px 13px; border-bottom:1px solid #eef2f7; background:#fbfcfe; }
.alert-preview-json header p { margin:3px 0 0; color:var(--muted); font-size:11px; }
.alert-preview-json pre, .alert-history-detail pre { max-height:320px; margin:0; padding:13px; overflow:auto; background:#fff; color:#334155; font:11px/1.55 ui-monospace,SFMono-Regular,Menlo,monospace; white-space:pre; }
.alert-history-panel { flex:1; min-height:0; display:flex; flex-direction:column; gap:12px; padding:16px; border:1px solid #edf2f7; border-radius:16px; background:#fff; overflow:hidden; }
.alert-history-head { display:flex; align-items:flex-start; justify-content:space-between; gap:12px; }
.alert-history-head-actions { display:flex; align-items:center; justify-content:flex-end; gap:8px; flex-wrap:wrap; }
.alert-history-view-toggle { width:34px; min-width:34px; min-height:34px; padding:0; flex:0 0 auto; border-radius:10px; border:1px solid transparent; background:#f5f7fa; color:#667085; transition:transform .18s ease, background .18s ease, color .18s ease, box-shadow .18s ease; }
.alert-history-view-toggle svg { width:17px; height:17px; fill:none; stroke:currentColor; stroke-width:1.8; stroke-linecap:round; stroke-linejoin:round; transition:transform .18s ease; }
.alert-history-view-toggle:hover { background:#e9edf3; color:#1f2937; transform:translateY(-1px); box-shadow:0 4px 10px rgba(15,23,42,.08); }
.alert-history-view-toggle:hover svg { transform:scale(1.08); }
.alert-history-view-toggle:active { transform:translateY(0) scale(.96); box-shadow:none; }
.alert-history-view-toggle:focus-visible { outline:2px solid #2563eb; outline-offset:2px; }
body.alert-history-overlay-open { overflow:hidden; }
.alert-history-overlay-backdrop { position:fixed; inset:0; z-index:45; display:grid; place-items:center; padding:16px; background:rgba(15,23,42,.38); backdrop-filter:blur(6px); animation:alert-history-backdrop-in .22s ease both; }
.alert-history-overlay-backdrop .alert-history-panel.is-expanded { width:84vw; height:84vh; max-width:calc(100vw - 32px); max-height:calc(100vh - 32px); box-shadow:0 28px 90px rgba(15,23,42,.28); outline:none; transform-origin:center; animation:alert-history-panel-in .26s cubic-bezier(.2,.8,.2,1) both; }
.alert-history-overlay-backdrop.is-closing { pointer-events:none; animation:alert-history-backdrop-out .2s ease forwards; }
.alert-history-overlay-backdrop.is-closing .alert-history-panel.is-expanded { animation:alert-history-panel-out .2s cubic-bezier(.4,0,1,1) forwards; }
@keyframes alert-history-backdrop-in { from { opacity:0; } to { opacity:1; } }
@keyframes alert-history-backdrop-out { from { opacity:1; } to { opacity:0; } }
@keyframes alert-history-panel-in { from { opacity:0; transform:scale(.94) translateY(10px); } to { opacity:1; transform:scale(1) translateY(0); } }
@keyframes alert-history-panel-out { from { opacity:1; transform:scale(1) translateY(0); } to { opacity:0; transform:scale(.94) translateY(10px); } }
@media (prefers-reduced-motion: reduce) {
  .alert-history-overlay-backdrop, .alert-history-overlay-backdrop .alert-history-panel.is-expanded, .alert-history-view-toggle, .alert-history-view-toggle svg { animation-duration:.01ms !important; transition-duration:.01ms !important; }
}
.alert-history-overlay-backdrop .alert-history-scroll { flex:1; }
.alert-history-filters { display:grid; grid-template-columns:repeat(4,minmax(120px,1fr)); gap:8px; align-items:end; }
.alert-history-filters label { display:grid; gap:5px; color:var(--muted); font-size:11px; }
.alert-history-filters input, .alert-history-filters select { min-height:36px; padding:7px 9px; font-size:12px; }
.alert-history-filter-actions { display:flex; gap:6px; align-items:center; }
.alert-history-scroll { min-height:0; overflow:auto; border:1px solid #eef2f7; border-radius:12px; }
.alert-history-scroll table { width:100%; min-width:1040px; table-layout:fixed; }
.alert-history-col-time { width:130px; }
.alert-history-col-type { width:140px; }
.alert-history-col-project { width:110px; }
.alert-history-col-store { width:130px; }
.alert-history-col-severity { width:90px; }
.alert-history-col-status { width:80px; }
.alert-history-col-message { width:auto; }
.alert-history-scroll th { position:sticky; top:0; z-index:1; background:#fbfcfe; }
.alert-history-scroll td { vertical-align:top; }
.alert-history-message { min-width:0; max-width:none; white-space:normal; overflow-wrap:anywhere; }
.alert-history-detail { margin-top:6px; color:var(--muted); font-size:11px; }
.alert-history-detail > div { display:grid; gap:2px; margin-top:6px; }
.alert-history-detail span { color:#475467; }
.alert-history-pagination { display:flex; justify-content:flex-end; align-items:center; gap:10px; }
@media (max-width: 1024px) {
  .alerts-readonly-page { height:100%; min-height:0; overflow:hidden; }
  .alerts-shell {
    flex:1;
    min-height:0;
    grid-template-columns:1fr;
    grid-template-rows:minmax(96px,34%) minmax(0,1fr);
    overflow:hidden;
  }
  .alert-list, .alert-preview-panel { min-height:0; max-height:none; }
  .alert-preview-meta, .alert-preview-json-grid { grid-template-columns:1fr; }
  .alert-history-panel { min-height:0; overflow:hidden; }
  .alert-history-filters { grid-template-columns:repeat(2,minmax(0,1fr)); }
  .alert-history-overlay-backdrop .alert-history-panel.is-expanded { width:calc(100vw - 32px); height:calc(100vh - 32px); }
}
@media (max-width: 640px), (max-height: 640px) {
  .alert-history-overlay-backdrop { padding:16px; }
  .alert-history-overlay-backdrop .alert-history-panel.is-expanded { width:calc(100vw - 32px); height:calc(100vh - 32px); padding:12px; gap:10px; }
  .alert-history-head { align-items:flex-start; }
  .alert-history-head-actions { gap:6px; }
  .alert-history-head-actions .meta { width:100%; text-align:right; }
  .alert-history-filters { grid-template-columns:1fr; overflow:auto; max-height:38%; padding-right:4px; }
  .alert-history-filter-actions { position:sticky; bottom:0; padding-top:4px; background:#fff; }
  .alert-history-pagination { justify-content:space-between; }
}
.access-grid .settings-card { min-height:260px; }
.single-line { grid-template-columns:minmax(0,1fr) auto; align-items:end; }
.wizard-backdrop { position:fixed; inset:0; z-index:50; display:grid; place-items:center; padding:24px; background:rgba(15,23,42,.28); backdrop-filter:blur(14px); }
.create-project-modal { width:min(900px,calc(100vw - 48px)); max-height:min(86vh,760px); overflow:auto; border-radius:26px; background:#fff; border:1px solid #e5edf7; box-shadow:0 28px 90px rgba(15,23,42,.24); }
.create-project-modal header, .create-project-modal footer { display:flex; align-items:flex-start; justify-content:space-between; gap:14px; padding:20px 22px; border-bottom:1px solid #eef2f7; }
.create-project-modal footer { border-top:1px solid #eef2f7; border-bottom:0; align-items:center; }
.create-project-modal h2 { margin:0 0 5px; }
.create-project-modal p { margin:0; color:#7b8798; }
.wizard-steps { display:flex; gap:8px; flex-wrap:wrap; padding:14px 22px; border-bottom:1px solid #eef2f7; }
.wizard-steps span { padding:7px 10px; border-radius:999px; background:#f4f7fb; color:#667085; font-size:12px; font-weight:700; }
.wizard-grid { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:16px; padding:18px 22px; }
.wizard-grid section { display:grid; gap:10px; align-content:start; }
.wizard-grid h3 { margin:0; font-size:15px; }
.wizard-grid label { display:grid; gap:5px; color:#7b8798; font-size:12px; }
@media (max-width: 1100px) {
  .home-summary-grid, .metric-grid { grid-template-columns:repeat(2,minmax(0,1fr)); }
  .project-grid, .project-detail-grid, .alerts-layout { grid-template-columns:1fr; }
  .overview-project-row, .store-card, .project-module-row { grid-template-columns:1fr; align-items:start; }
  .project-module-meta-group { grid-template-columns:repeat(2,minmax(0,1fr)); }
}
@media (max-width: 860px) {
  .settings-popover { width:100vw; height:100vh; border-radius:0; grid-template-columns:1fr; }
  .settings-sidebar { width:auto; }
  .settings-nav { display:flex; overflow:auto; }
  .settings-nav-item { min-width:max-content; }
  .wizard-grid { grid-template-columns:1fr; }
  .project-module-meta-group, .project-module-ops { grid-template-columns:1fr; }
}

/* Alert defaults and project alert clarity */
.alert-defaults-intro { margin-bottom: 14px; }
.alert-defaults-intro p, .info-note { color: var(--muted); line-height: 1.5; max-width: 880px; }
.alert-default-summary { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px 24px; margin: 14px 0; }
.alert-default-summary > div { min-width: 0; display: grid; gap: 3px; padding: 0; border: 0; background: none; }
.alert-default-summary > div:last-child { grid-column: 1 / -1; }
.alert-default-summary span { display: block; font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.alert-default-summary strong { display: block; font-size: 13px; font-weight: 600; color: var(--text); overflow-wrap: anywhere; }
.alert-default-summary p { margin: 0; color: var(--text); line-height: 1.45; font-size: 13px; }
.project-alert-history .table-scroll { max-height: 260px; overflow: auto; }
.project-alert-history td { vertical-align: top; }
@media (max-width: 760px) { .alert-default-summary { grid-template-columns: 1fr; } }

/* Project runtime master controls */
.project-runtime-card { border-color:#e6edf5; }
.project-runtime-main { display:flex; justify-content:space-between; gap:16px; align-items:center; margin:12px 0; }
.project-runtime-main strong { font-size:18px; }
.project-runtime-main p { margin:4px 0 0; color:var(--muted); }
.runtime-enabled { display:inline-flex; align-items:center; gap:8px; color:var(--muted); font-weight:700; }
.compact-detail-grid { grid-template-columns:repeat(3,minmax(0,1fr)); }
.soft-warning { margin:12px 0 0; background:#f8fafc; border-color:#e6edf5; color:#667085; }
@media (max-width:760px){ .project-runtime-main { align-items:flex-start; flex-direction:column; } .compact-detail-grid { grid-template-columns:1fr; } }


/* Dashboard layout editor */
.dashboard-layout-card { scroll-margin-top: 16px; }
.dashboard-layout-editor { display:grid; grid-template-columns: minmax(220px, .75fr) minmax(0, 1.6fr); gap:16px; align-items:start; }
.available-widgets-panel, .active-layout-panel { min-width:0; border:1px solid #e8edf5; border-radius:14px; background:#fbfcff; padding:14px; }
.available-widgets-panel h3, .active-layout-panel h3 { margin:0 0 6px; font-size:14px; }
.available-widget-list { display:grid; gap:8px; margin-top:10px; }
.available-widget { text-align:left; border:0; border-radius:12px; background:#fff; padding:10px 12px; box-shadow:inset 0 0 0 1px #e6ecf5; color:#152033; }
.available-widget span { display:block; color:#8a96a8; font-size:11px; margin-top:2px; }
.layout-row-list { display:grid; gap:10px; }
.layout-row { display:grid; grid-template-columns:minmax(0,1fr); gap:6px; align-items:stretch; }
.layout-row-label { color:#8a96a8; font-size:11px; font-weight:800; letter-spacing:.04em; text-transform:uppercase; padding-left:2px; }
.layout-row-shell { min-width:0; display:grid; grid-template-columns:18px minmax(0,1fr) auto; gap:12px; align-items:center; border:1px solid #e6ecf5; border-radius:12px; background:#fff; padding:12px; }
.layout-drag-handle { color:#98a2b3; font-size:15px; font-weight:700; line-height:1; letter-spacing:-3px; user-select:none; }
.layout-row-items { min-width:0; display:grid; grid-template-columns:repeat(12,minmax(0,1fr)); gap:0; align-items:stretch; }
.layout-item { grid-column:span 12; min-width:0; display:grid; grid-template-columns:minmax(0,1fr) auto; gap:12px; align-items:center; border:0; border-radius:0; background:transparent; padding:2px 12px; }
.layout-item.width-half { grid-column:span 6; }
.layout-item.width-third { grid-column:span 4; }
.layout-item + .layout-item { border-left:1px solid #e6ecf5; }
.layout-item.width-third { grid-template-columns:minmax(0,1fr); }
.layout-item-main { min-width:0; }
.layout-item strong { display:block; min-width:0; overflow-wrap:anywhere; }
.layout-item small { display:block; min-width:0; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.layout-item small { color:#8a96a8; font-size:11px; margin-top:2px; }
.layout-item-controls { min-width:0; display:flex; align-items:center; justify-content:flex-end; }
.layout-width-select > span { display:block; color:#8a96a8; font-size:10px; font-weight:800; letter-spacing:.04em; text-transform:uppercase; margin-bottom:4px; }
.layout-width-select select { min-height:32px; padding:0 28px 0 10px; }
.layout-item-actions { display:flex; gap:6px; flex-wrap:wrap; justify-content:flex-end; }
.layout-item-actions button { min-height:30px; padding:0 10px; }
.layout-item-retained-controls { display:none !important; }
.layout-row-meta { min-width:0; display:flex; align-items:center; justify-content:flex-end; }
.layout-width-badge { display:inline-flex; align-items:center; min-height:28px; padding:0 10px; border:1px solid #dbe3ec; border-radius:9px; background:#fbfcfe; color:#526071; font-size:11px; font-weight:600; white-space:nowrap; }
.dashboard-layout-card .help-tip::after { left:auto; right:0; width:240px; max-width:calc(100vw - 32px); transform:translateY(3px); }
.dashboard-layout-card .help-tip:hover::after,
.dashboard-layout-card .help-tip:focus-visible::after { transform:translateY(0); }
@media (max-width: 1180px) {
  .dashboard-layout-editor { grid-template-columns:1fr; }
}
@media (max-width: 920px) {
  .dashboard-layout-editor { grid-template-columns:1fr; }
  .layout-row { grid-template-columns:1fr; }
  .layout-row-shell { grid-template-columns:18px minmax(0,1fr); }
  .layout-row-meta { grid-column:2; justify-content:flex-start; }
  .layout-row-items { grid-template-columns:repeat(12,minmax(0,1fr)); }
  .layout-item, .layout-item.width-half, .layout-item.width-third { grid-template-columns:minmax(0,1fr); }
  .layout-item-controls { justify-content:flex-start; }
}
