:root {
  --bg: #0f1115;
  --panel: #161a22;
  --panel-hi: #1e232e;
  --text: #e6e9ef;
  --muted: #8b94a7;
  --border: #262c39;
  --green: #3fb950;
  --yellow: #d29922;
  --red: #f85149;
  --paused: #6e7681;
  --unknown: #8b94a7;
  --link: #58a6ff;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; background: var(--bg); color: var(--text); font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; }
a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; }
code { font-family: "SF Mono", Menlo, monospace; font-size: 0.9em; color: var(--muted); }
.muted { color: var(--muted); }
.site-header { display: flex; justify-content: space-between; align-items: center; padding: 12px 24px; border-bottom: 1px solid var(--border); background: var(--panel); }
.header-left { display: flex; align-items: center; gap: 24px; }
.brand { font-weight: 600; color: var(--text); }
.site-nav { display: flex; gap: 4px; }
.site-nav-link { padding: 6px 12px; border-radius: 6px; font-size: 0.9em; color: var(--muted); text-decoration: none; }
.site-nav-link:hover { background: var(--panel-hi); color: var(--text); text-decoration: none; }
.site-nav-link.active { background: var(--panel-hi); color: var(--text); }
.header-right { display: flex; align-items: center; gap: 12px; }
.footer-data-age { color: var(--muted); font-size: 0.85em; }
.btn-sync { background: var(--panel-hi); color: var(--text); border: 1px solid var(--border); border-radius: 6px; padding: 6px 12px; font-size: 0.85em; cursor: pointer; font-family: inherit; }
.btn-sync:hover:not(:disabled) { background: var(--border); }
.btn-sync:disabled { opacity: 0.6; cursor: not-allowed; }
.btn-sync.syncing { background: rgba(88, 166, 255, 0.15); border-color: var(--link); color: var(--link); }
.btn-logout { text-decoration: none; display: inline-block; }

.user-chip { display: inline-flex; align-items: center; gap: 8px; font-size: 0.85em; color: var(--text); }
.user-chip img { width: 22px; height: 22px; border-radius: 50%; }

.login-body { display: flex; align-items: center; justify-content: center; min-height: 100vh; margin: 0; }
.login-main { width: 100%; }
.login-card { max-width: 380px; margin: 0 auto; background: var(--panel); border: 1px solid var(--border); border-radius: 8px; padding: 32px; text-align: center; }
.login-card h1 { margin: 0 0 32px 0; }
.login-card .muted { margin: 4px 0 20px 0; }
.login-card .muted.small { font-size: 0.8em; margin-top: 16px; }
.login-btn { display: inline-flex; align-items: center; gap: 10px; padding: 10px 20px; border-radius: 6px; background: #fff; color: #1f2937; font-weight: 600; text-decoration: none; border: 1px solid var(--border); }
.login-btn:hover { background: #f3f4f6; text-decoration: none; }
.login-error { background: rgba(248, 81, 73, 0.15); color: var(--red); padding: 10px 12px; border-radius: 6px; margin: 0 0 16px 0; font-size: 0.9em; }
main { padding: 24px; max-width: 1280px; margin: 0 auto; }
.site-footer { text-align: center; color: var(--muted); padding: 16px; font-size: 0.85em; border-top: 1px solid var(--border); margin-top: 48px; }

.summary-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 12px; margin-bottom: 32px; }
.card { background: var(--panel); border: 1px solid var(--border); border-radius: 8px; padding: 16px; display: block; text-decoration: none; color: inherit; }
.card-link { cursor: pointer; transition: background 0.12s ease, transform 0.12s ease; }
.card-link:hover { background: var(--panel-hi); text-decoration: none; transform: translateY(-1px); }
.card-value { font-size: 2em; font-weight: 600; }
.card-label { color: var(--muted); font-size: 0.85em; margin-top: 4px; }
.card-green { border-color: rgba(63, 185, 80, 0.4); }
.card-yellow { border-color: rgba(210, 153, 34, 0.4); }
.card-red { border-color: rgba(248, 81, 73, 0.4); }
.card-muted { opacity: 0.7; }
.card.active { background: var(--panel-hi); box-shadow: inset 0 0 0 2px currentColor; }
.card-green.active { color: rgba(63, 185, 80, 0.9); }
.card-yellow.active { color: rgba(210, 153, 34, 0.9); }
.card-red.active { color: rgba(248, 81, 73, 0.9); }
.card.active .card-value, .card.active .card-label { color: var(--text); }
.card-green.active .card-label, .card-yellow.active .card-label, .card-red.active .card-label { color: var(--muted); }

h1 { margin: 0 0 16px 0; }
h2 { margin: 24px 0 12px 0; font-size: 1.1em; color: var(--muted); text-transform: uppercase; letter-spacing: 0.05em; }

.status-table { width: 100%; border-collapse: collapse; background: var(--panel); border: 1px solid var(--border); border-radius: 8px; overflow: hidden; }
.status-table th, .status-table td { padding: 10px 12px; border-bottom: 1px solid var(--border); text-align: left; vertical-align: top; }
.status-table tbody tr:last-child td { border-bottom: 0; }
.status-table tbody tr:hover { background: var(--panel-hi); }
.status-table .num { text-align: right; }

.chip { display: inline-block; padding: 2px 8px; border-radius: 99px; font-size: 0.8em; font-weight: 600; }
.chip-green { background: rgba(63, 185, 80, 0.18); color: var(--green); }
.chip-yellow { background: rgba(210, 153, 34, 0.18); color: var(--yellow); }
.chip-red { background: rgba(248, 81, 73, 0.18); color: var(--red); }
.chip-paused { background: rgba(110, 118, 129, 0.18); color: var(--paused); }
.chip-unknown { background: rgba(139, 148, 167, 0.18); color: var(--unknown); }

.count-link { text-decoration: none; color: inherit; }
.count-link:hover { text-decoration: underline; }
.count-zero { opacity: 0.5; cursor: default; }
.count-zero:hover { text-decoration: none; }

.col-count { text-align: center; }
.col-count.num { text-align: center; }

.count-pill { display: inline-block; min-width: 44px; padding: 4px 12px; border-radius: 6px; font-weight: 600; font-variant-numeric: tabular-nums; text-align: center; }
.count-pill-green { background: rgba(63, 185, 80, 0.18); color: var(--green); }
.count-pill-yellow { background: rgba(210, 153, 34, 0.18); color: var(--yellow); }
.count-pill-red { background: rgba(248, 81, 73, 0.18); color: var(--red); }
.count-pill-paused { background: rgba(110, 118, 129, 0.18); color: var(--paused); }
.count-pill-unknown { background: rgba(139, 148, 167, 0.18); color: var(--unknown); }
.count-pill-total { background: rgba(88, 166, 255, 0.18); color: var(--link); }
.count-pill-zero { opacity: 0.35; }
.count-pill-link { text-decoration: none; display: inline-block; }
.count-pill-link:hover .count-pill { filter: brightness(1.35); }

.landing-split { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 24px; margin-top: 24px; }
@media (max-width: 960px) { .landing-split { grid-template-columns: 1fr; } }
.landing-main { min-width: 0; }
.landing-sidebar { min-width: 0; }

.sidebar-panel { background: var(--panel); border: 1px solid var(--border); border-radius: 8px; padding: 16px; }
.sidebar-panel + .sidebar-panel { margin-top: 16px; }
.sidebar-critical { border-color: rgba(248, 81, 73, 0.55); background: rgba(248, 81, 73, 0.08); }
.sidebar-critical h2 { color: var(--red); }
.sidebar-panel h2 { margin-top: 0; display: flex; justify-content: space-between; align-items: baseline; }
.sidebar-count { font-size: 0.7em; color: var(--muted); font-weight: 400; text-transform: none; letter-spacing: 0; }
.red-list { list-style: none; padding: 0; margin: 0; counter-reset: none; }
.red-list li { border-bottom: 1px solid var(--border); }
.red-list li:last-child { border-bottom: 0; }
.red-row { display: grid; grid-template-columns: 24px 1fr; grid-template-rows: auto auto; grid-column-gap: 8px; padding: 8px 2px; text-decoration: none; color: inherit; }
.red-row:hover { background: var(--panel-hi); text-decoration: none; }
.red-rank { grid-row: 1 / span 2; color: var(--muted); font-variant-numeric: tabular-nums; font-size: 0.85em; align-self: center; text-align: right; }
.red-name { grid-column: 2; font-size: 0.9em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.red-platform { grid-column: 2; grid-row: 2; color: var(--muted); font-size: 0.75em; }

.bar-cell { display: flex; align-items: center; gap: 8px; white-space: nowrap; min-width: 0; }
.bar { flex: 1 1 auto; min-width: 40px; max-width: 200px; height: 8px; background: var(--border); border-radius: 4px; overflow: hidden; }
.bar-fill { height: 100%; background: var(--green); }
.pct { font-size: 0.85em; color: var(--muted); flex-shrink: 0; font-variant-numeric: tabular-nums; }

.res-line { font-size: 0.85em; margin: 2px 0; }

.breadcrumb { margin-bottom: 8px; font-size: 0.9em; }
.controls { display: flex; gap: 16px; margin: 12px 0; align-items: center; }
.controls label { font-size: 0.9em; color: var(--muted); }
.controls select, .controls input { background: var(--panel); border: 1px solid var(--border); color: var(--text); border-radius: 6px; padding: 4px 8px; margin-left: 6px; }

.ds-block { margin: 20px 0; background: var(--panel); border: 1px solid var(--border); border-radius: 8px; padding: 16px; }
.ds-header { display: flex; gap: 12px; align-items: center; margin-bottom: 12px; }
.ds-header h2 { margin: 0; color: var(--text); text-transform: none; letter-spacing: 0; font-size: 1em; }
.ext { font-size: 0.85em; }

/* Silent Workflows page */
.silent-page-header { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; margin: 0 0 20px; }
.silent-title { margin: 0 0 4px; font-size: 1.6em; }
.silent-subtitle { margin: 0; }
.chip-window { background: rgba(88, 166, 255, 0.14); color: var(--link); font-family: "SF Mono", Menlo, monospace; font-size: 0.8em; padding: 4px 10px; }

.summary-grid-silent { grid-template-columns: repeat(2, 1fr); max-width: 480px; margin-bottom: 20px; }
.silent-stat { padding: 20px; }

/* Alert-type selector. Three standalone pill buttons — inactive ones read
   as tappable ghost buttons; active is a filled primary-accent button.
   Sits directly under the breadcrumb so it reads as page-level navigation. */
.alert-tabs { display: flex; gap: 10px; margin: 12px 0 16px; flex-wrap: wrap; }

/* Thin separator between tab navigation and the selected tab's content. */
.alert-section-divider { height: 1px; background: var(--border); margin: 0 0 20px; opacity: 0.6; }

.alert-tab {
  display: inline-flex; align-items: center; gap: 10px;
  padding: 10px 18px;
  background: var(--panel-hi);
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--text);
  text-decoration: none;
  font-size: 0.94em;
  font-weight: 500;
  line-height: 1;
  white-space: nowrap;
  cursor: pointer;
  transition: transform 0.12s ease, box-shadow 0.14s ease,
              background 0.14s ease, border-color 0.14s ease, color 0.14s ease;
}

.alert-tab:hover {
  background: var(--panel);
  border-color: rgba(88, 166, 255, 0.5);
  transform: translateY(-1px);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
}

.alert-tab:focus-visible {
  outline: none;
  border-color: var(--link);
  box-shadow: 0 0 0 3px rgba(88, 166, 255, 0.3);
}

.alert-tab.active {
  background: var(--link);
  border-color: var(--link);
  color: #fff;
  font-weight: 600;
  box-shadow: 0 2px 10px rgba(88, 166, 255, 0.35);
}

.alert-tab.active:hover {
  background: #4a95e8;
  border-color: #4a95e8;
  transform: translateY(-1px);
}

.alert-tab-icon { display: inline-flex; width: 16px; height: 16px; }
.alert-tab-icon svg { width: 100%; height: 100%; }

.alert-tab-count {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 24px;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  color: var(--muted);
  font-size: 0.8em;
  font-variant-numeric: tabular-nums;
  font-weight: 700;
}
.alert-tab-count-nonzero { background: rgba(248, 81, 73, 0.16); color: #f85149; }

.alert-tab.active .alert-tab-count { background: rgba(0, 0, 0, 0.22); color: #fff; }
.alert-tab.active .alert-tab-count-nonzero { background: rgba(0, 0, 0, 0.3); color: #fff; }

@media (max-width: 720px) {
  .alert-tab-label { display: none; }
  .alert-tab { padding: 10px 14px; }
}

.silent-toolbar { display: flex; align-items: center; gap: 16px; padding: 12px 16px; background: var(--panel); border: 1px solid var(--border); border-radius: 8px 8px 0 0; border-bottom: 0; margin-top: 8px; flex-wrap: wrap; }
.silent-toolbar .toolbar-item { display: flex; align-items: center; gap: 8px; font-size: 0.9em; color: var(--muted); }
.silent-toolbar select, .silent-toolbar input[type="text"] { background: var(--panel-hi); border: 1px solid var(--border); color: var(--text); border-radius: 6px; padding: 6px 10px; font-family: inherit; font-size: 0.9em; }
.silent-toolbar select:focus, .silent-toolbar input[type="text"]:focus { outline: none; border-color: var(--link); }
.silent-toolbar .toolbar-search input { min-width: 240px; }
.silent-toolbar .toolbar-checkbox { cursor: pointer; user-select: none; }
.silent-toolbar .toolbar-checkbox input { margin: 0; cursor: pointer; }
.silent-toolbar .toolbar-spacer { flex: 1; }
.btn-ghost { background: transparent; color: var(--muted); border: 1px solid var(--border); border-radius: 6px; padding: 6px 12px; font-size: 0.85em; cursor: pointer; font-family: inherit; }
.btn-ghost:hover { background: var(--panel-hi); color: var(--text); }

.silent-table { border-collapse: collapse; border-top-left-radius: 0; border-top-right-radius: 0; }
.silent-group { border-top: 1px solid var(--border); }
.silent-group:first-of-type { border-top: 0; }
.silent-group-header td { background: var(--panel-hi); padding: 12px 14px; cursor: pointer; user-select: none; transition: background 0.12s ease; }
.silent-group-header:hover td { background: var(--border); }
.silent-group-header:focus { outline: none; }
.silent-group-header:focus-visible td { box-shadow: inset 0 0 0 2px var(--link); }
.silent-caret { display: inline-block; width: 16px; color: var(--muted); font-size: 0.75em; }
.silent-domain-name { font-weight: 600; color: var(--text); margin-right: 10px; font-size: 0.98em; }
.silent-group-count { margin-right: 10px; font-size: 0.78em; min-width: 28px; padding: 2px 10px; }

/* Expanded workflow rows: indent + subtle red accent showing parent-child relationship. */
.silent-workflow-row td { background: rgba(248, 81, 73, 0.03); padding: 8px 14px; font-size: 0.92em; }
.silent-workflow-row td:first-child { padding-left: 38px; border-left: 3px solid rgba(248, 81, 73, 0.35); }
.silent-workflow-row:hover td { background: rgba(248, 81, 73, 0.08); }
.silent-workflow-name { color: var(--text); }

.silent-group.collapsed tr.silent-workflow-row { display: none; }

.empty-state { text-align: center; padding: 48px; color: var(--muted); background: var(--panel); border: 1px solid var(--border); border-radius: 8px; }
