:root {
  color-scheme: light;
  --ink: #182033;
  --muted: #687188;
  --muted-2: #8e96a8;
  --paper: #ffffff;
  --canvas: #f5f6fa;
  --line: #e6e8ef;
  --purple: #6757e5;
  --purple-dark: #4938c4;
  --purple-soft: #efedff;
  --green: #1f9d68;
  --green-soft: #e8f8f0;
  --orange: #e78027;
  --orange-soft: #fff1e3;
  --red: #d44855;
  --red-soft: #ffedef;
  --yellow: #b27b10;
  --yellow-soft: #fff7d9;
  --blue: #3478d4;
  --blue-soft: #eaf3ff;
  font-family: Inter, ui-rounded, "SF Pro Rounded", "Segoe UI", system-ui, sans-serif;
  background: var(--canvas);
  color: var(--ink);
  font-synthesis: none;
}

* { box-sizing: border-box; }

body { margin: 0; min-width: 320px; min-height: 100vh; background: var(--canvas); }
button, input, select, textarea { font: inherit; }
button { color: inherit; }
button:not(:disabled), select:not(:disabled) { cursor: pointer; }
button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, a:focus-visible {
  outline: 3px solid rgba(103, 87, 229, .28);
  outline-offset: 2px;
}

.skip-link { position: fixed; top: -100px; left: 16px; z-index: 99; padding: 12px 16px; border-radius: 12px; background: var(--ink); color: white; }
.skip-link:focus { top: 16px; }
.app-shell { min-height: 100vh; display: grid; grid-template-columns: 250px minmax(0, 1fr); }

.sidebar {
  position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; padding: 28px 20px 22px;
  background: var(--paper); border-right: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 12px; color: inherit; text-decoration: none; padding: 0 10px 26px; }
.brand-mark { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 15px; color: white; background: linear-gradient(145deg, #7a6cec, #5140cf); box-shadow: 0 8px 18px rgba(103, 87, 229, .24); font-weight: 900; font-size: 21px; }
.brand strong, .brand small { display: block; line-height: 1.05; }
.brand strong { font-size: 18px; }
.brand small { color: var(--muted); margin-top: 5px; font-size: 13px; }
.main-nav { display: grid; gap: 6px; }
.nav-item { border: 0; background: transparent; display: flex; align-items: center; gap: 8px; width: 100%; padding: 12px; border-radius: 13px; text-align: left; color: #60697e; font-weight: 700; }
.nav-item b { min-width: 24px; padding: 4px 7px; border-radius: 999px; background: #eceef4; color: #666e80; text-align: center; font-size: 12px; }
.nav-item b { margin-left: auto; }
.nav-item:hover { background: #f5f4ff; color: var(--purple-dark); }
.nav-item.is-active { background: var(--purple-soft); color: var(--purple-dark); }
.nav-item.is-active b { background: var(--purple); color: white; }
.sidebar-safety { margin-top: auto; display: flex; align-items: center; gap: 10px; padding: 13px; border: 1px solid #caebdb; border-radius: 15px; background: #f4fcf8; }
.sidebar-safety strong, .sidebar-safety small { display: block; }
.sidebar-safety strong { font-size: 13px; }
.sidebar-safety small { margin-top: 3px; color: var(--green); font-size: 11px; }
.safety-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 5px rgba(31, 157, 104, .12); }

.content { width: min(1260px, 100%); padding: 38px clamp(24px, 4.5vw, 68px) 72px; margin: 0 auto; }
.topbar { display: flex; justify-content: space-between; align-items: center; gap: 24px; }
.eyebrow { margin: 0 0 7px; color: var(--purple); font-size: 12px; letter-spacing: .13em; font-weight: 900; }
h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 0; font-size: clamp(30px, 4vw, 44px); letter-spacing: -.045em; }
h2 { margin-bottom: 10px; font-size: clamp(24px, 3vw, 32px); letter-spacing: -.035em; }
h3 { margin-bottom: 6px; font-size: 18px; }
.topbar-actions { display: flex; align-items: center; gap: 10px; }
.demo-pill { padding: 8px 13px; border-radius: 999px; background: var(--yellow-soft); color: #8b5f0a; font-size: 12px; font-weight: 900; text-transform: uppercase; letter-spacing: .08em; }
.round-button { min-height: 42px; padding: 0 14px; border: 1px solid var(--line); border-radius: 999px; background: white; font-size: 12px; font-weight: 800; display: grid; place-items: center; }
.round-button:hover { border-color: #c8c1ff; background: var(--purple-soft); }
.round-button[hidden] { display: none; }

.demo-banner { margin: 28px 0 24px; display: flex; align-items: center; gap: 14px; padding: 16px 18px; border: 1px solid #d8d3ff; border-radius: 18px; background: linear-gradient(105deg, #f2f0ff, #faf9ff); }
.demo-banner > span { font-size: 25px; }
.demo-banner strong { font-size: 14px; }
.demo-banner p { margin: 3px 0 0; color: #665f91; font-size: 13px; }
.degraded-banner { display: flex; align-items: flex-start; gap: 12px; margin: 0 0 18px; padding: 14px 16px; border: 2px solid #c0392b; border-radius: 14px; background: #fdecea; color: #7b241c; font-weight: 600; line-height: 1.4; }
.degraded-banner > span { font-size: 22px; }
.loading-card { display: flex; align-items: center; justify-content: center; gap: 12px; min-height: 280px; border: 1px solid var(--line); border-radius: 24px; background: white; color: var(--muted); }
.spinner { width: 18px; height: 18px; border: 3px solid #ddd9ff; border-top-color: var(--purple); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.section-head { display: flex; justify-content: space-between; align-items: end; gap: 20px; margin: 34px 0 16px; }
.section-head h2 { margin: 0; }
.section-head p { margin: 5px 0 0; color: var(--muted); }
.grid { display: grid; gap: 16px; }
.summary-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.card { border: 1px solid var(--line); border-radius: 22px; background: white; box-shadow: 0 8px 24px rgba(26, 32, 51, .035); }
.summary-card { position: relative; overflow: hidden; min-height: 116px; padding: 20px; }
.summary-card::after { content: ""; position: absolute; right: -22px; bottom: -28px; width: 84px; height: 84px; border-radius: 50%; background: currentColor; opacity: .055; }
.summary-card strong { display: block; margin-bottom: 4px; font-size: 27px; letter-spacing: -.04em; }
.summary-card small { color: var(--muted); font-size: 13px; }
.summary-card.good { color: var(--green); }
.summary-card.decide { color: var(--purple); }
.summary-card.fix { color: var(--red); }
.summary-card.old { color: var(--orange); }
.summary-card strong, .summary-card small { color: var(--ink); }
.summary-card small { color: var(--muted); }

.button { display: inline-flex; align-items: center; justify-content: center; min-height: 44px; padding: 11px 17px; border: 1px solid transparent; border-radius: 13px; font-weight: 800; text-decoration: none; transition: transform .15s ease, background .15s ease, border .15s ease; }
.button:active { transform: translateY(1px); }
.button-primary { color: white; background: var(--purple); box-shadow: 0 7px 16px rgba(103, 87, 229, .2); }
.button-primary:hover { background: var(--purple-dark); }
.button-secondary { border-color: #d6d0ff; background: var(--purple-soft); color: var(--purple-dark); }
.button-secondary:hover { background: #e5e1ff; }
.button-quiet { border-color: var(--line); background: white; color: #505a70; }
.button-quiet:hover { border-color: #cfd3de; background: #f8f9fb; }
.source-link { color: var(--primary); font-weight: 700; overflow-wrap: anywhere; }
.source-link:hover { text-decoration: underline; }
.work-links { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 7px; }
.button-danger { border-color: #ffd0d5; background: var(--red-soft); color: #af3542; }
.button-small { min-height: 36px; padding: 8px 12px; border-radius: 10px; font-size: 13px; }
.button:disabled { opacity: .5; cursor: not-allowed; box-shadow: none; }
.button-row { display: flex; flex-wrap: wrap; gap: 9px; }

.home-layout { display: grid; grid-template-columns: minmax(0, 1.45fr) minmax(300px, .8fr); gap: 18px; }
.attention-card { padding: 26px; background: linear-gradient(145deg, #fff, #faf9ff); }
.attention-card .mini-label { display: inline-flex; gap: 7px; align-items: center; padding: 7px 10px; border-radius: 999px; background: var(--purple-soft); color: var(--purple-dark); font-size: 12px; font-weight: 900; }
.attention-card h2 { margin: 18px 0 9px; }
.attention-card p { color: var(--muted); line-height: 1.55; }
.attention-card .button { margin-top: 22px; }
.incident-list { display: grid; gap: 9px; margin: 18px 0 0; padding: 0; list-style: none; }
.incident-list li { border-left: 4px solid var(--orange); border-radius: 0 11px 11px 0; background: var(--orange-soft); }
.incident-list button { width: 100%; padding: 11px 13px; border: 0; background: transparent; color: inherit; text-align: left; cursor: pointer; }
.incident-list button:hover strong { text-decoration: underline; }
.incident-list strong, .incident-list small { display: block; }
.incident-list small { margin-top: 4px; color: #7a542f; line-height: 1.4; }
.timeline-card { padding: 22px; }
.timeline-card h3 { margin-bottom: 18px; }
.timeline { list-style: none; padding: 0; margin: 0; display: grid; gap: 18px; }
.timeline li { display: grid; grid-template-columns: 14px 1fr; gap: 12px; position: relative; }
.timeline li:not(:last-child)::after { content: ""; position: absolute; left: 6px; top: 19px; bottom: -15px; width: 2px; background: #eceaf8; }
.timeline-dot { width: 14px; height: 14px; margin-top: 3px; border: 4px solid #dcd7ff; border-radius: 50%; background: var(--purple); z-index: 1; }
.timeline strong, .timeline small { display: block; }
.timeline small { margin-top: 4px; color: var(--muted); }

.status-chip { display: inline-flex; align-items: center; gap: 6px; min-height: 28px; padding: 5px 10px; border-radius: 999px; background: #f0f2f6; color: #626b7e; font-size: 12px; font-weight: 900; white-space: nowrap; }
.status-chip::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.status-chip.good, .status-chip.active, .status-chip.completed { color: #15764d; background: var(--green-soft); }
.status-chip.paused, .status-chip.unknown { color: #687084; background: #f0f2f6; }
.status-chip.warning { color: #a7641b; background: var(--orange-soft); }
.status-chip.failed { color: #b13845; background: var(--red-soft); }
.status-chip.prepared { color: var(--purple-dark); background: var(--purple-soft); }

.proposal-list { display: grid; gap: 17px; }
.proposal-card { padding: 24px; }
.proposal-top { display: flex; justify-content: space-between; align-items: start; gap: 20px; }
.site-label { display: flex; align-items: center; gap: 9px; color: var(--muted); font-size: 13px; font-weight: 800; }
.site-avatar { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 11px; background: var(--purple-soft); font-size: 17px; }
.proposal-card h2 { margin: 18px 0 5px; font-size: 22px; }
.proposal-card .entity { color: var(--muted); }
.sensitive-banner { display: flex; gap: 10px; align-items: center; margin-top: 16px; padding: 12px 14px; border-radius: 13px; background: var(--yellow-soft); color: #79540b; font-size: 13px; font-weight: 750; }
.change-box { display: grid; grid-template-columns: 1fr 36px 1fr; align-items: stretch; gap: 10px; margin: 20px 0; }
.change-value { padding: 17px; border: 1px solid var(--line); border-radius: 15px; background: #fafbfc; }
.change-value.new { border-color: #d5d0ff; background: #f6f4ff; }
.change-value small, .change-value strong { display: block; }
.change-value small { margin-bottom: 8px; color: var(--muted); font-size: 12px; font-weight: 800; text-transform: uppercase; letter-spacing: .07em; }
.change-value strong { font-size: 16px; }
.change-arrow { display: grid; place-items: center; color: var(--purple); font-weight: 900; }
.evidence { padding: 15px 17px; border-left: 4px solid #cfc8ff; border-radius: 0 13px 13px 0; background: #f8f7ff; }
.evidence small { display: block; margin-bottom: 6px; color: var(--purple-dark); font-weight: 900; text-transform: uppercase; letter-spacing: .07em; }
.evidence p { margin: 0; color: #4e5670; line-height: 1.5; }
.proposal-meta { display: flex; flex-wrap: wrap; gap: 8px 16px; margin: 16px 0; color: var(--muted); font-size: 12px; }
.empty-state { padding: 50px 24px; text-align: center; }
.empty-state .empty-icon { display: grid; place-items: center; width: 66px; height: 66px; margin: 0 auto 18px; border-radius: 22px; background: var(--green-soft); font-size: 29px; }
.empty-state p { max-width: 480px; margin: 0 auto 20px; color: var(--muted); line-height: 1.6; }

.sites-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.site-card { overflow: hidden; padding: 22px; }
.site-card-top { display: flex; align-items: center; gap: 13px; }
.site-card-top .site-avatar { width: 48px; height: 48px; border-radius: 15px; font-size: 23px; }
.site-card-top h3 { margin: 0; }
.site-card-top p { margin: 4px 0 0; color: var(--muted); font-size: 13px; }
.site-card-top .status-chip { margin-left: auto; }
.site-capabilities { display: flex; flex-wrap: wrap; gap: 7px; margin: 18px 0; }
.capability { padding: 6px 9px; border-radius: 9px; background: #f3f4f7; color: #5e6678; font-size: 11px; font-weight: 800; }
.site-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1px; overflow: hidden; margin: 0 -22px 18px; border-block: 1px solid var(--line); background: var(--line); }
.site-stat { padding: 14px 10px; background: #fbfbfd; text-align: center; }
.site-stat strong, .site-stat small { display: block; }
.site-stat small { margin-top: 4px; color: var(--muted); font-size: 11px; }
.site-card-actions { display: flex; justify-content: space-between; gap: 9px; }

.source-toolbar { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 8px; }
.filter-pills { display: flex; flex-wrap: wrap; gap: 7px; }
.filter-pill { padding: 8px 12px; border: 1px solid var(--line); border-radius: 999px; background: white; color: var(--muted); font-size: 12px; font-weight: 800; }
.filter-pill.is-active { border-color: var(--purple); background: var(--purple-soft); color: var(--purple-dark); }
.source-search { display: grid; gap: 4px; margin-left: auto; color: var(--muted); font-size: 11px; font-weight: 850; }
.source-search input { width: min(220px, 28vw); min-height: 40px; padding: 8px 11px; border: 1px solid #d8dbe4; border-radius: 11px; background: white; }
.source-results { margin: 0 0 12px; color: var(--muted); font-size: 12px; font-weight: 800; }
.source-list, .activity-list { display: grid; gap: 12px; }
.source-row, .activity-row { display: grid; grid-template-columns: minmax(220px, 1.2fr) minmax(180px, .9fr) minmax(120px, .55fr) minmax(0, 2fr); align-items: center; gap: 18px; padding: 18px 20px; }
.row-primary { display: flex; align-items: center; gap: 11px; min-width: 0; }
.row-primary strong, .row-primary small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-primary small, .row-info small { margin-top: 4px; color: var(--muted); font-size: 12px; }
.row-info { min-width: 0; }
.row-info strong, .row-info small { display: block; overflow-wrap: anywhere; }
.row-actions { display: flex; min-width: 0; flex-wrap: wrap; gap: 7px; justify-content: end; }
.source-row .row-actions .button { white-space: normal; text-align: center; }
.schedule-control label { display: grid; gap: 5px; color: var(--muted); font-size: 11px; font-weight: 850; }
.schedule-fields { display: grid; grid-template-columns: minmax(105px, 1fr) minmax(105px, .8fr); gap: 7px; }
.schedule-control select, .schedule-control input { width: 100%; min-height: 38px; padding: 7px 10px; border: 1px solid #d8dbe4; border-radius: 10px; background: white; color: var(--ink); font-size: 12px; font-weight: 800; }
.schedule-control select { padding-right: 30px; }

.tabs { display: inline-flex; padding: 4px; border-radius: 13px; background: #e9ebf1; }
.tab { border: 0; padding: 9px 14px; border-radius: 10px; background: transparent; color: #687084; font-size: 13px; font-weight: 850; }
.tab.is-active { background: white; color: var(--ink); box-shadow: 0 2px 8px rgba(20, 25, 40, .08); }
.activity-row.failed { border-color: #f2cbd0; }
.activity-message { color: var(--muted); font-size: 13px; }

.settings-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.settings-card { padding: 23px; }
.settings-card.full { grid-column: 1 / -1; }
.settings-icon { display: grid; place-items: center; width: 42px; height: 42px; margin-bottom: 17px; border-radius: 14px; background: var(--purple-soft); font-size: 20px; }
.settings-card p { color: var(--muted); line-height: 1.55; }
.how-it-works { background: linear-gradient(135deg, #fff, #faf9ff); }
.how-steps { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.how-steps article { display: flex; gap: 12px; align-items: flex-start; padding: 15px; border: 1px solid var(--line); border-radius: 15px; background: rgba(255, 255, 255, .82); }
.how-steps article > span { display: grid; place-items: center; flex: 0 0 28px; width: 28px; height: 28px; border-radius: 50%; background: var(--purple); color: white; font-weight: 900; }
.how-steps h3 { margin: 0; font-size: 15px; }
.how-steps p { margin: 4px 0 0; font-size: 12px; line-height: 1.45; }
.how-rule { margin: 16px 0 0; padding: 12px 14px; border-radius: 12px; background: var(--purple-soft); color: var(--purple-dark) !important; font-size: 13px; }
.monitoring-section { margin-top: 16px; }
.monitoring-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.monitoring-card { padding: 17px; border-radius: 16px; box-shadow: none; }
.monitoring-head { display: grid; grid-template-columns: 38px minmax(0, 1fr) auto; align-items: start; gap: 10px; }
.monitoring-icon { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 12px; background: var(--purple-soft); font-size: 20px; }
.monitoring-head h3 { margin: 2px 0 0; font-size: 16px; }
.monitoring-head p { margin: 4px 0 0; font-size: 12px; line-height: 1.45; }
.monitoring-facts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin: 15px 0 0; }
.monitoring-facts div { padding: 9px 10px; border-radius: 10px; background: #f8f9fc; }
.monitoring-facts dt { color: var(--muted); font-size: 10px; font-weight: 850; }
.monitoring-facts dd { margin: 3px 0 0; font-size: 12px; font-weight: 800; }
.monitoring-note { margin: 14px 0 0; }
.app-registry { display: grid; gap: 12px; margin: 18px 0; }
.app-registry-row {
  display: grid;
  grid-template-columns: 110px repeat(4, minmax(140px, 1fr));
  gap: 10px;
  align-items: end;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fbfbfd;
}
.app-registry-row label { display: grid; gap: 5px; color: var(--muted); font-size: 12px; font-weight: 700; }
.app-registry-row input[type="text"] { width: 100%; min-width: 0; }
.app-registry-row select { width: 100%; min-width: 0; }
.app-registry-enabled { align-self: center; grid-row: span 2; }
.app-registry-enabled input { width: auto; }
.app-registry-links { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.app-ratings-status { display: grid; gap: 5px; margin-top: 14px; padding: 13px 15px; border-radius: 12px; background: var(--purple-soft); color: var(--muted); font-size: 13px; }
.app-ratings-status strong { color: var(--text); }
.danger-text { color: #b42318; }
.success-text { color: #16803d; }
.serpapi-result { display: grid; gap: 4px; margin-top: 16px; padding: 14px; border-radius: 12px; background: var(--purple-soft); }
.serpapi-result span { font-weight: 700; }
.serpapi-result small { color: var(--muted); }
.stop-card { display: flex; align-items: center; justify-content: space-between; gap: 22px; border-color: #f1cbd0; background: linear-gradient(120deg, #fff, #fff6f7); }
.stop-card .settings-icon { background: var(--red-soft); }
.stop-button { min-width: 154px; min-height: 48px; border: 0; border-radius: 15px; background: var(--red); color: white; font-weight: 900; }
.stop-button.is-paused { background: var(--green); }
.alarm-card { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 22px; border-color: #d9d2f4; background: linear-gradient(120deg, #fff, #f8f6ff); }
.alarm-card > div:first-child { max-width: 680px; }
.alarm-card h2 { margin-bottom: 7px; }
.alarm-card p { margin-bottom: 5px; }
.alarm-actions { display: flex; flex-wrap: wrap; justify-content: end; gap: 9px; }
.alarm-monitor { flex: 1 0 100%; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.alarm-monitor > div { min-height: 76px; padding: 13px 14px; border: 1px solid #e2def4; border-radius: 13px; background: rgba(255, 255, 255, .8); }
.alarm-monitor small, .alarm-monitor strong { display: block; }
.alarm-monitor small { margin-bottom: 7px; color: var(--muted); font-size: 11px; font-weight: 850; text-transform: uppercase; letter-spacing: .04em; }
.alarm-monitor strong { font-size: 13px; line-height: 1.35; }
.alarm-card .alarm-health { flex: 1 0 100%; margin: -8px 0 0; padding: 11px 13px; border-radius: 11px; background: var(--green-soft); color: #17633f; font-size: 12px; font-weight: 800; }
.alarm-card .alarm-health.is-late { background: var(--red-soft); color: #9d303d; }
.work-list { list-style: none; margin: 18px 0 0; padding: 0; display: grid; gap: 10px; }
.work-row { display: grid; grid-template-columns: minmax(220px, 1fr) minmax(210px, .8fr) auto; align-items: center; gap: 16px; padding: 14px; border: 1px solid var(--line); border-radius: 13px; background: #fbfbfd; }
.work-row strong, .work-row small { display: block; }
.work-row small { margin-top: 4px; color: var(--muted); font-size: 12px; }
.work-row .row-actions { max-width: 540px; flex-wrap: wrap; }
.simple-work-controls { display: flex; flex-wrap: wrap; align-items: end; gap: 10px; margin-top: 18px; }
.simple-work-controls label { display: grid; min-width: 150px; gap: 5px; color: var(--muted); font-size: 11px; font-weight: 850; }
.simple-work-controls select, .simple-work-controls input { min-height: 40px; padding: 8px 10px; border: 1px solid #d8dbe4; border-radius: 10px; background: white; color: var(--ink); font-size: 12px; font-weight: 800; }
.work-control-card { border-color: #ddd8f4; }
.diagnostic-list { display: grid; gap: 10px; }
.diagnostic-row { overflow: hidden; border-radius: 16px; }
.diagnostic-row.is-focused { border-color: var(--orange); box-shadow: 0 0 0 3px var(--orange-soft); }
.diagnostic-row > summary { display: grid; grid-template-columns: minmax(220px, 1.15fr) minmax(190px, .65fr) minmax(260px, 1fr) auto; align-items: center; gap: 18px; padding: 15px 18px; cursor: pointer; list-style: none; }
.diagnostic-row > summary::-webkit-details-marker { display: none; }
.diagnostic-row > summary::after { content: "›"; justify-self: end; color: var(--muted); font-size: 22px; font-weight: 900; transition: transform .15s ease; }
.diagnostic-row[open] > summary::after { transform: rotate(90deg); }
.diagnostic-row[open] > summary { border-bottom: 1px solid var(--line); background: #fbfbfd; }
.diagnostic-name strong, .diagnostic-name small { display: block; }
.diagnostic-name small { margin-top: 4px; color: var(--muted); font-size: 12px; }
.diagnostic-next { color: var(--muted); font-size: 12px; line-height: 1.45; }
.diagnostic-next strong { color: var(--ink); }
.diagnostic-affected, .diagnostic-correlation-inline { display: block; overflow-wrap: anywhere; }
.diagnostic-detail { padding: 18px; }
.diagnostic-detail > p { margin: 0 0 12px; color: var(--muted); line-height: 1.5; }
.diagnostic-correlation { overflow-wrap: anywhere; }
.diagnostic-history { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 8px; margin: 14px 0; }
.diagnostic-history div { padding: 10px; border: 1px solid var(--line); border-radius: 10px; background: #fbfbfd; }
.diagnostic-history dt { color: var(--muted); font-size: 10px; font-weight: 850; text-transform: uppercase; letter-spacing: .04em; }
.diagnostic-history dd { margin: 5px 0 0; color: var(--ink); font-size: 12px; font-weight: 800; }
.diagnostic-detail .row-actions { justify-content: start; margin-top: 14px; }
.source-inventory { margin-top: 24px; }
.source-inventory > summary { cursor: pointer; color: var(--purple-dark); font-weight: 900; }
.source-inventory:not([open]) > :not(summary) { display: none; }
.source-inventory[open] > summary { margin-bottom: 20px; }
.audit-list { list-style: none; padding: 0; margin: 18px 0 0; display: grid; gap: 12px; }
.audit-list li { display: grid; grid-template-columns: 10px 1fr auto; gap: 11px; align-items: start; }
.audit-list li::before { content: ""; width: 8px; height: 8px; margin-top: 6px; border-radius: 50%; background: #c5bedf; }
.audit-list p { margin: 0; color: #4e566b; font-size: 13px; }
.audit-list time { color: var(--muted-2); font-size: 11px; white-space: nowrap; }

.dialog { width: min(620px, calc(100% - 28px)); padding: 0; border: 0; border-radius: 24px; box-shadow: 0 28px 90px rgba(21, 27, 44, .25); }
.dialog::backdrop { background: rgba(24, 32, 51, .48); backdrop-filter: blur(5px); }
.dialog-card { padding: 26px; }
.dialog-head { display: flex; justify-content: space-between; align-items: start; gap: 20px; }
.dialog-head h2 { margin: 0; }
.step-dots { display: grid; grid-template-columns: repeat(5, 1fr); gap: 7px; margin: 20px 0 25px; }
.step-dots span { height: 5px; border-radius: 999px; background: #e5e6ec; }
.step-dots span.is-active { background: var(--purple); }
.choice-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.choice { position: relative; }
.choice input { position: absolute; opacity: 0; pointer-events: none; }
.choice label { display: flex; align-items: center; gap: 11px; min-height: 62px; padding: 13px 14px; border: 2px solid var(--line); border-radius: 14px; background: white; font-weight: 800; }
.choice label span { font-size: 21px; }
.choice input:checked + label { border-color: var(--purple); background: var(--purple-soft); color: var(--purple-dark); }
.field { display: grid; gap: 7px; margin-bottom: 15px; }
.field label { font-size: 13px; font-weight: 850; }
.field input, .field select, .field textarea { width: 100%; min-height: 48px; padding: 11px 13px; border: 1px solid #d8dbe4; border-radius: 12px; background: white; }
.field small { color: var(--muted); line-height: 1.45; }
.test-box { display: flex; align-items: center; gap: 14px; padding: 17px; border-radius: 15px; background: var(--green-soft); color: #17633f; }
.test-box span { font-size: 27px; }
.test-box strong, .test-box small { display: block; }
.test-box small { margin-top: 4px; color: #3d795d; }
.summary-check { display: grid; gap: 10px; padding: 18px; border-radius: 16px; background: #f7f7fa; }
.summary-check div { display: flex; justify-content: space-between; gap: 20px; }
.summary-check span { color: var(--muted); }
.summary-check strong { text-align: right; }
.proof-summary { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin: 22px 0 16px; }
.proof-summary > div { padding: 14px; border-radius: 13px; background: #f7f7fa; }
.proof-summary small, .proof-summary strong { display: block; }
.proof-summary small { margin-bottom: 5px; color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .06em; font-weight: 850; }
.proof-fact { margin-top: 14px; padding: 17px; border: 1px solid #d8d3ff; border-radius: 15px; background: #f8f7ff; }
.proof-fact strong { display: block; margin-bottom: 8px; color: var(--purple-dark); }
.proof-fact blockquote { margin: 0; color: #4e5670; line-height: 1.55; }
.technical-details { margin-top: 17px; padding-top: 16px; border-top: 1px solid var(--line); color: var(--muted); font-size: 12px; }
.technical-details summary { color: #596276; font-weight: 850; cursor: pointer; }
.technical-list { display: grid; gap: 6px; margin: 12px 0 0; padding-left: 18px; overflow-wrap: anywhere; }
.dialog-actions { display: flex; justify-content: space-between; gap: 12px; margin-top: 25px; padding-top: 19px; border-top: 1px solid var(--line); }
.dialog-actions .button-primary { margin-left: auto; }
.toast { position: fixed; right: 24px; bottom: 24px; z-index: 100; max-width: min(420px, calc(100% - 48px)); padding: 14px 17px; border-radius: 14px; background: #20283a; color: white; box-shadow: 0 12px 36px rgba(20, 25, 40, .25); font-weight: 750; transform: translateY(20px); opacity: 0; pointer-events: none; transition: .2s ease; }
.toast.is-visible { transform: translateY(0); opacity: 1; }
.toast.is-error { background: #a93441; }
.mobile-nav { display: none; }

.login-body { display: grid; place-items: center; padding: 24px; background: radial-gradient(circle at 50% 0, #ece9ff 0, var(--canvas) 42%); }
.login-shell { width: min(470px, 100%); }
.login-brand { display: flex; align-items: center; justify-content: center; gap: 12px; margin-bottom: 24px; }
.login-brand strong, .login-brand small { display: block; }
.login-brand strong { font-size: 18px; }
.login-brand small { margin-top: 3px; color: var(--muted); font-size: 12px; }
.login-card { padding: clamp(25px, 7vw, 40px); }
.login-card h1 { margin-bottom: 10px; }
.login-card > p:not(.eyebrow) { margin-bottom: 24px; color: var(--muted); line-height: 1.55; }
.login-icon { display: grid; place-items: center; width: 54px; height: 54px; margin-bottom: 22px; border-radius: 18px; background: var(--purple-soft); font-size: 27px; }
.login-button { width: 100%; margin-top: 4px; }
.login-safe { display: flex; align-items: center; justify-content: center; gap: 8px; margin-top: 23px; color: var(--green); font-size: 12px; font-weight: 800; }
.login-error { margin-bottom: 18px; padding: 12px 14px; border-radius: 12px; background: var(--red-soft); color: #a33440; font-size: 13px; font-weight: 800; }

@media (max-width: 1020px) {
  .app-shell { grid-template-columns: 210px minmax(0, 1fr); }
  .sidebar { padding-inline: 14px; }
  .summary-grid { grid-template-columns: repeat(2, 1fr); }
  .home-layout { grid-template-columns: 1fr; }
  .source-row, .activity-row { grid-template-columns: 1fr 1fr; }
  .source-row .row-actions { grid-column: 1 / -1; }
  .work-row { grid-template-columns: 1fr 1fr; }
  .row-actions { justify-content: start; }
}

@media (max-width: 760px) {
  .app-shell { display: block; }
  .sidebar { display: none; }
  .content { padding: 24px 16px 106px; }
  .topbar { align-items: start; }
  h1 { font-size: 32px; }
  .demo-banner { margin-top: 20px; }
  .summary-grid, .sites-grid, .settings-grid { grid-template-columns: 1fr; }
  .summary-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .summary-card { min-height: 126px; padding: 16px; }
  .settings-card.full { grid-column: auto; }
  .app-registry-row { grid-template-columns: 1fr; }
  .how-steps, .monitoring-grid { grid-template-columns: 1fr; }
  .app-registry-enabled { grid-row: auto; }
  .section-head, .source-toolbar, .stop-card, .alarm-card { align-items: stretch; flex-direction: column; }
  .alarm-card { flex-wrap: nowrap; }
  .alarm-card .alarm-monitor, .alarm-card .alarm-health { flex: 0 1 auto; width: 100%; }
  .source-toolbar .button { width: 100%; }
  .change-box { grid-template-columns: 1fr; }
  .change-arrow { transform: rotate(90deg); height: 24px; }
  .source-row, .activity-row { grid-template-columns: 1fr; gap: 12px; }
  .monitoring-facts { grid-template-columns: 1fr 1fr; }
  .work-row { grid-template-columns: 1fr; }
  .row-actions { display: grid; grid-template-columns: 1fr 1fr; }
  .alarm-actions { display: grid; grid-template-columns: 1fr; }
  .alarm-monitor { grid-template-columns: 1fr 1fr; }
  .site-card-actions { flex-direction: column; }
  .site-card-actions .button { width: 100%; }
  .choice-grid { grid-template-columns: 1fr; }
  .summary-check div { display: grid; gap: 3px; }
  .summary-check strong { text-align: left; }
  .proof-summary { grid-template-columns: 1fr; }
  .simple-work-controls { display: grid; grid-template-columns: 1fr 1fr; align-items: stretch; }
  .simple-work-controls label, .simple-work-controls .button { width: 100%; }
  .button-small { min-height: 44px; }
  .diagnostic-row > summary { grid-template-columns: 1fr; gap: 9px; padding: 14px; }
  .diagnostic-row > summary::after { position: absolute; right: 15px; }
  .diagnostic-row > summary { position: relative; padding-right: 42px; }
  .diagnostic-history { grid-template-columns: 1fr 1fr; }
  .mobile-nav { position: fixed; left: 0; right: 0; bottom: 0; z-index: 50; display: grid; grid-template-columns: repeat(4, minmax(54px, 1fr)); padding: 8px max(7px, env(safe-area-inset-right)) calc(8px + env(safe-area-inset-bottom)) max(7px, env(safe-area-inset-left)); border-top: 1px solid var(--line); background: rgba(255, 255, 255, .96); backdrop-filter: blur(16px); }
  .mobile-nav button { min-height: 48px; border: 0; padding: 5px 2px; border-radius: 10px; background: transparent; color: #747d91; font-size: 11px; font-weight: 850; }
  .mobile-nav svg { display: block; width: 17px; height: 17px; margin: 0 auto 3px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
  .mobile-nav button.is-active { color: var(--purple-dark); background: var(--purple-soft); }
  .toast { right: 16px; bottom: 94px; max-width: calc(100% - 32px); }
}

@media (max-width: 390px) {
  .summary-grid { grid-template-columns: 1fr; }
  .topbar .round-button { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
