:root {
  --bg: #0A0A0A;
  --surface: #111111;
  --surface-elevated: #151515;
  --fg: #E8E8E8;
  --muted: #8A8A8A;
  --dim: #5A5A5A;
  --accent: #7FD962;
  --warning: #E0A33C;
  --danger: #D06D6D;
  --border: #1E1E1E;
  --border-soft: rgba(127, 217, 98, 0.28);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
}

body {
  background: var(--bg);
  color: var(--fg);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  min-height: 100vh;
}

.view[hidden],
[hidden] { display: none !important; }

/* ---------- login ---------- */
#login-view {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 16px;
}

.login-card {
  width: 100%;
  max-width: 360px;
}

.login-card h1 {
  margin: 0 0 0.5rem;
  font-size: 2.25rem;
  font-weight: 500;
  letter-spacing: -0.02em;
}

.login-card .subtitle {
  margin: 0 0 2.25rem;
  color: var(--muted);
  font-size: 1rem;
}

.login-card label {
  display: block;
  margin: 1.25rem 0 0.5rem;
  font-size: 0.75rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.login-card input {
  width: 100%;
  padding: 0.75rem 0.875rem;
  background: var(--surface);
  color: var(--fg);
  border: 1px solid var(--border);
  border-radius: 4px;
  font-family: inherit;
  font-size: 0.9375rem;
  outline: none;
  transition: border-color 150ms ease;
}

.login-card input:focus {
  border-color: var(--accent);
}

.login-card button[type="submit"] {
  margin-top: 1.75rem;
  width: 100%;
  padding: 0.75rem 1rem;
  background: var(--accent);
  color: #0A0A0A;
  border: none;
  border-radius: 4px;
  font-family: inherit;
  font-size: 0.9375rem;
  font-weight: 500;
  cursor: pointer;
  transition: opacity 150ms ease;
}

.login-card button[type="submit"]:hover:not(:disabled) {
  opacity: 0.9;
}

.login-card button[type="submit"]:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.login-card .error {
  margin-top: 1rem;
  color: var(--danger);
  font-size: 0.875rem;
  white-space: pre-line;
}

.login-card .hint {
  margin-top: 2rem;
  color: var(--muted);
  font-size: 0.8125rem;
}

.login-card .hint a {
  color: var(--accent);
  text-decoration: none;
}

.login-card .hint a:hover {
  text-decoration: underline;
}

/* ---------- dashboard header ---------- */
.app-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.25rem 1.75rem;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  position: sticky;
  top: 0;
  z-index: 10;
  flex-wrap: wrap;
  gap: 1rem;
}

.header-left,
.header-right {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.user-badge {
  font-weight: 500;
  font-size: 0.9375rem;
}

.user-badge::before {
  content: "●";
  color: var(--accent);
  margin-right: 0.45em;
  font-size: 0.75em;
  vertical-align: 0.1em;
}

.trial-badge {
  color: var(--muted);
  font-size: 0.8125rem;
  padding: 0.25rem 0.6rem;
  border: 1px solid var(--border);
  border-radius: 3px;
}

.app-header button {
  padding: 0.45rem 0.85rem;
  font-family: inherit;
  font-size: 0.8125rem;
  border-radius: 3px;
  cursor: pointer;
  transition: border-color 150ms ease, color 150ms ease;
}

.app-header button.secondary {
  background: transparent;
  color: var(--accent);
  border: 1px solid var(--border-soft);
}

.app-header button.secondary:hover {
  border-color: var(--accent);
}

.app-header button.ghost {
  background: transparent;
  color: var(--muted);
  border: 1px solid transparent;
}

.app-header button.ghost:hover {
  color: var(--fg);
  border-color: var(--border);
}

/* ---------- agent grid + cards ---------- */
.agents-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(480px, 1fr));
  gap: 1.5rem;
  padding: 1.75rem;
  max-width: 1400px;
  margin: 0 auto;
}

.agent-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 1.25rem 1.5rem;
}

.agent-card > header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  border-bottom: 1px solid var(--border);
  padding-bottom: 0.75rem;
  margin-bottom: 1rem;
  gap: 1rem;
  flex-wrap: wrap;
}

.agent-card h2 {
  margin: 0;
  font-size: 1.375rem;
  font-weight: 500;
  letter-spacing: -0.01em;
  word-break: break-all;
}

.status {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  white-space: nowrap;
}

.status.on { color: var(--accent); }
.status.stale { color: var(--warning); }
.status.off { color: var(--danger); }

.meta {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 0.75rem 1.25rem;
  margin: 0 0 1.25rem;
  font-size: 0.875rem;
}

.meta > div { display: block; }

.meta dt {
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.6875rem;
  margin: 0 0 0.2rem;
}

.meta dd {
  margin: 0;
  word-break: break-word;
}

.agent-card section { margin-top: 1.25rem; }

.agent-card section h3 {
  font-size: 0.6875rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--muted);
  margin: 0 0 0.5rem;
}

.agent-card table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8125rem;
}

.agent-card table th,
.agent-card table td {
  padding: 0.4rem 0.6rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}

.agent-card table th {
  color: var(--muted);
  font-weight: 400;
  font-size: 0.6875rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.agent-card table tr:last-child td {
  border-bottom: none;
}

.agent-card table td:first-child,
.agent-card table th:first-child {
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  width: 5em;
}

.agent-card table td:last-child {
  font-variant-numeric: tabular-nums;
}

.muted {
  color: var(--muted);
  font-size: 0.875rem;
}

/* ---------- empty state ---------- */
.empty {
  padding: 5rem 1.5rem;
  text-align: center;
  max-width: 520px;
  margin: 0 auto;
}

.empty h2 {
  font-size: 1.375rem;
  font-weight: 500;
  margin: 0 0 0.75rem;
}

.empty p {
  color: var(--muted);
  margin: 0 0 1.5rem;
}

.empty button {
  padding: 0.6rem 1rem;
  background: var(--accent);
  color: #0A0A0A;
  border: none;
  border-radius: 3px;
  font-family: inherit;
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
}

.refresh-note {
  text-align: center;
  color: var(--dim);
  font-size: 0.75rem;
  padding: 0 1rem 1.5rem;
  margin: 0;
}

/* ---------- modal ---------- */
dialog {
  background: var(--surface-elevated);
  color: var(--fg);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 1.75rem;
  max-width: 560px;
  width: calc(100% - 32px);
  font-family: inherit;
}

dialog::backdrop {
  background: rgba(0, 0, 0, 0.7);
}

dialog h2 {
  margin: 0 0 0.75rem;
  font-size: 1.25rem;
  font-weight: 500;
}

dialog p {
  color: var(--muted);
  margin: 0 0 1rem;
  font-size: 0.9375rem;
}

dialog strong {
  color: var(--fg);
}

dialog pre {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 1rem;
  overflow-x: auto;
  font-size: 0.8125rem;
  color: var(--fg);
  line-height: 1.55;
  margin: 0 0 1rem;
}

dialog code {
  font-family: SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.8125rem;
}

.modal-actions {
  display: flex;
  gap: 0.5rem;
  justify-content: flex-end;
  margin-top: 1.25rem;
}

.modal-actions button {
  padding: 0.5rem 0.9rem;
  font-family: inherit;
  font-size: 0.8125rem;
  border-radius: 3px;
  cursor: pointer;
}

.modal-actions button.secondary {
  background: var(--accent);
  color: #0A0A0A;
  border: none;
}

.modal-actions button.ghost {
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--border);
}

.modal-actions button.ghost:hover {
  color: var(--fg);
  border-color: var(--muted);
}

/* ---------- view toggle (graph / list) ---------- */
.view-toggle {
  display: inline-flex;
  border: 1px solid var(--border);
  border-radius: 4px;
  overflow: hidden;
  margin-left: 0.5rem;
}

.toggle-btn {
  padding: 0.4rem 0.95rem;
  background: transparent;
  color: var(--muted);
  border: none;
  font-family: inherit;
  font-size: 0.8125rem;
  cursor: pointer;
  transition: background-color 150ms ease, color 150ms ease;
}

.toggle-btn + .toggle-btn {
  border-left: 1px solid var(--border);
}

.toggle-btn:hover {
  color: var(--fg);
}

.toggle-btn.active {
  background: var(--accent);
  color: #0A0A0A;
  font-weight: 500;
}

.panel[hidden] { display: none !important; }

/* ---------- graph panel ---------- */
#graph-panel {
  position: relative;
  width: 100%;
  height: calc(100vh - 70px);
  min-height: 520px;
  background: var(--bg);
  overflow: hidden;
}

#cy {
  width: 100%;
  height: 100%;
  display: block;
}

.graph-tooltip {
  position: fixed;
  z-index: 50;
  pointer-events: none;
  background: rgba(18, 18, 18, 0.96);
  border: 1px solid var(--border-soft);
  border-radius: 4px;
  padding: 0.55rem 0.8rem;
  font-size: 0.8125rem;
  color: var(--fg);
  max-width: 300px;
  line-height: 1.45;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

.graph-tooltip .tip-title {
  color: var(--accent);
  font-weight: 500;
  margin-bottom: 0.35rem;
  font-size: 0.875rem;
  letter-spacing: -0.005em;
}

.graph-tooltip .tip-row {
  display: flex;
  gap: 0.6rem;
  margin-top: 0.15rem;
}

.graph-tooltip .tip-k {
  color: var(--muted);
  text-transform: uppercase;
  font-size: 0.6875rem;
  letter-spacing: 0.08em;
  min-width: 4.5em;
  flex-shrink: 0;
}

.graph-legend {
  position: absolute;
  bottom: 1rem;
  left: 1rem;
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  padding: 0.55rem 0.85rem;
  background: rgba(18, 18, 18, 0.8);
  border: 1px solid var(--border);
  border-radius: 4px;
  font-size: 0.75rem;
  color: var(--muted);
  letter-spacing: 0.02em;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  white-space: nowrap;
}

.dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

.dot-host { background: #7FD962; }
.dot-service { background: #E8E8E8; }
.dot-port { background: #5A5A5A; border-radius: 2px; width: 14px; height: 7px; }
.dot-identity { background: #56B6C2; transform: rotate(45deg); border-radius: 1px; }

.panel-error {
  padding: 1.25rem 1.5rem;
  margin: 1rem;
  background: rgba(208, 109, 109, 0.08);
  border: 1px solid rgba(208, 109, 109, 0.4);
  border-radius: 4px;
  color: var(--danger);
  font-size: 0.875rem;
}

#graph-error-banner {
  position: absolute;
  bottom: 1rem;
  right: 1rem;
  max-width: 340px;
  margin: 0;
  z-index: 40;
}

@media (max-width: 600px) {
  .app-header {
    padding: 0.875rem 1rem;
    flex-direction: column;
    align-items: flex-start;
  }
  .header-left, .header-right { flex-wrap: wrap; }
  .view-toggle { margin-left: 0; }
  .agents-grid {
    grid-template-columns: 1fr;
    padding: 1rem;
    gap: 1rem;
  }
  .agent-card {
    padding: 1rem;
  }
  .agent-card h2 {
    font-size: 1.125rem;
  }
  #graph-panel {
    height: calc(100vh - 140px);
  }
  .graph-legend {
    font-size: 0.7rem;
    gap: 0.6rem;
    padding: 0.4rem 0.6rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .login-card input,
  .app-header button,
  .login-card button[type="submit"],
  .toggle-btn {
    transition: none;
  }
}

/* ─── v0.4 Incidents view ─────────────────────────────────────────────── */

.toggle-count {
  display: inline-block;
  min-width: 1.25rem;
  padding: 0 0.35rem;
  margin-left: 0.25rem;
  background: rgba(232, 232, 232, 0.08);
  border-radius: 8px;
  font-size: 0.7rem;
  font-variant-numeric: tabular-nums;
  color: var(--muted);
  line-height: 1.2;
}

.toggle-btn.active .toggle-count {
  background: rgba(10, 10, 10, 0.18);
  color: #0A0A0A;
}

.toggle-dot {
  display: inline-block;
  width: 6px;
  height: 6px;
  margin-left: 0.35rem;
  border-radius: 50%;
  background: var(--danger);
  box-shadow: 0 0 6px rgba(208, 109, 109, 0.8);
  vertical-align: middle;
}

.incidents-panel {
  padding: 1rem 1.25rem 2rem;
  max-width: 1080px;
  margin: 0 auto;
}

.incidents-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin: 0 0 1rem;
  gap: 1rem;
}

.incidents-header h2 {
  font-size: 1.1rem;
  font-weight: 500;
  margin: 0;
  color: var(--fg);
  letter-spacing: 0.02em;
}

.incidents-filters .filter-inline {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.8125rem;
  color: var(--muted);
  cursor: pointer;
  user-select: none;
}

.incidents-filters input[type="checkbox"] {
  accent-color: var(--accent);
}

.incidents-list {
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
}

.incidents-empty {
  padding: 2.5rem 1rem;
  text-align: center;
  color: var(--muted);
  border: 1px dashed var(--border);
  border-radius: 6px;
}

.incident-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-left-width: 3px;
  border-radius: 4px;
  padding: 0.85rem 1rem;
  transition: opacity 150ms ease, border-color 150ms ease;
}

.incident-card.status-acknowledged { opacity: 0.7; }
.incident-card.status-dismissed    { opacity: 0.4; }

.incident-card.status-open { border-left-color: var(--dim); }
.incident-card.status-open:has(.severity-badge.sev-low)      { border-left-color: var(--dim); }
.incident-card.status-open:has(.severity-badge.sev-medium)   { border-left-color: var(--warning); }
.incident-card.status-open:has(.severity-badge.sev-high)     { border-left-color: var(--danger); }
.incident-card.status-open:has(.severity-badge.sev-critical) { border-left-color: var(--danger); box-shadow: 0 0 0 1px rgba(208,109,109,0.25); }

.incident-head {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.4rem;
}

.severity-badge {
  display: inline-block;
  padding: 0.12rem 0.55rem;
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  border-radius: 2px;
  flex-shrink: 0;
}
.severity-badge.sev-low      { background: rgba(138, 138, 138, 0.15); color: var(--muted); }
.severity-badge.sev-medium   { background: rgba(224, 163, 60, 0.15);  color: var(--warning); }
.severity-badge.sev-high     { background: rgba(208, 109, 109, 0.18); color: var(--danger); }
.severity-badge.sev-critical { background: var(--danger);             color: #0A0A0A; }

.incident-title {
  color: var(--fg);
  font-size: 0.9375rem;
  font-weight: 500;
  flex: 1;
}

.incident-time {
  color: var(--muted);
  font-size: 0.75rem;
  font-variant-numeric: tabular-nums;
  flex-shrink: 0;
}

.incident-body {
  padding: 0.25rem 0 0.5rem;
}

.incident-trigger {
  color: var(--fg);
  font-size: 0.875rem;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.incident-chain {
  margin-top: 0.4rem;
  color: var(--muted);
  font-size: 0.8125rem;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  align-items: center;
}

.chain-arrow {
  color: var(--dim);
  padding: 0 0.15rem;
}

.incident-actions {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.25rem;
  align-items: center;
}

.incident-actions .ghost {
  padding: 0.28rem 0.7rem;
  font-size: 0.8125rem;
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--border);
  border-radius: 3px;
  cursor: pointer;
  font-family: inherit;
  transition: color 150ms ease, border-color 150ms ease;
}

.incident-actions .incident-ack:hover {
  color: var(--accent);
  border-color: var(--border-soft);
}

.incident-actions .incident-dismiss:hover {
  color: var(--fg);
  border-color: var(--dim);
}

.status-pill {
  padding: 0.2rem 0.55rem;
  font-size: 0.72rem;
  letter-spacing: 0.05em;
  border-radius: 2px;
  color: var(--muted);
  background: rgba(138, 138, 138, 0.1);
}

.status-pill.status-acknowledged {
  color: var(--accent);
  background: rgba(127, 217, 98, 0.10);
}

.status-pill.status-dismissed {
  color: var(--dim);
}

@media (max-width: 720px) {
  .incidents-panel { padding: 0.8rem 0.8rem 1.5rem; }
  .incident-head { flex-wrap: wrap; }
  .incident-title { flex-basis: 100%; }
}

/* ─── v0.5.1 Remediation — Recommended actions inside incident cards ─── */

.incident-card.urgent {
  box-shadow: 0 0 0 1px rgba(208, 109, 109, 0.4), 0 0 12px rgba(208, 109, 109, 0.15);
}

.rem-urgency-banner {
  margin: 0.55rem 0 0.4rem;
  padding: 0.35rem 0.7rem;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #0A0A0A;
  background: var(--danger);
  border-radius: 3px;
  display: inline-block;
}

.rem-block {
  margin-top: 0.85rem;
  padding-top: 0.85rem;
  border-top: 1px dashed var(--border);
}

.rem-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.5rem;
  flex-wrap: wrap;
}

.rem-label {
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
}

.rem-urgency {
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  color: var(--muted);
  text-transform: uppercase;
}

.rem-urgency-immediate    { color: var(--danger); font-weight: 600; }
.rem-urgency-within_hours { color: var(--warning); }

.rem-explain {
  margin: 0 0 0.65rem;
  color: rgba(232, 232, 232, 0.82);
  font-size: 0.88rem;
  line-height: 1.55;
}

.rem-actions-list {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

.rem-action {
  padding: 0.6rem 0.75rem 0.55rem;
  background: var(--surface-elevated);
  border: 1px solid var(--border);
  border-left-width: 3px;
  border-radius: 4px;
}

.rem-risk-safe     { border-left-color: var(--accent); }
.rem-risk-moderate { border-left-color: var(--warning); }
.rem-risk-risky    { border-left-color: var(--danger); }

.rem-action-head {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  margin-bottom: 0.3rem;
}

.rem-action-prio {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.75rem;
  color: var(--muted);
}

.rem-action-name {
  flex: 1;
  color: var(--fg);
  font-size: 0.9rem;
  font-weight: 500;
}

.rem-risk-badge {
  display: inline-block;
  padding: 0.08rem 0.45rem;
  font-size: 0.66rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  border-radius: 2px;
  background: rgba(138, 138, 138, 0.12);
  color: var(--muted);
}

.rem-risk-badge.rem-risk-safe     { background: rgba(127, 217, 98, 0.14); color: var(--accent); }
.rem-risk-badge.rem-risk-moderate { background: rgba(224, 163, 60, 0.15); color: var(--warning); }
.rem-risk-badge.rem-risk-risky    { background: rgba(208, 109, 109, 0.18); color: var(--danger); }

.rem-action-desc {
  margin: 0 0 0.45rem;
  color: rgba(232, 232, 232, 0.82);
  font-size: 0.84rem;
  line-height: 1.5;
}

.rem-cmd {
  margin: 0 0 0.45rem;
  padding: 0.55rem 0.7rem;
  background: #0A0A0A;
  border: 1px solid var(--border);
  border-radius: 3px;
  color: #C8C8C8;
  font-size: 0.8rem;
  line-height: 1.5;
  overflow-x: auto;
}

.rem-cmd code { color: inherit; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }

.rem-action-meta {
  display: flex;
  gap: 0.9rem;
  color: var(--muted);
  font-size: 0.75rem;
  padding-top: 0.15rem;
}

.rem-risk-why {
  cursor: help;
  border-bottom: 1px dotted var(--muted);
}

.rem-escalation {
  margin-top: 0.55rem;
  padding: 0.45rem 0.7rem;
  color: var(--warning);
  font-size: 0.82rem;
  border: 1px solid rgba(224, 163, 60, 0.25);
  border-radius: 3px;
  background: rgba(224, 163, 60, 0.06);
}

.rem-client-actions {
  display: flex;
  gap: 0.45rem;
  margin-top: 0.6rem;
}

.rem-client-actions .ghost {
  padding: 0.24rem 0.65rem;
  font-size: 0.78rem;
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--border);
  border-radius: 3px;
  cursor: pointer;
  font-family: inherit;
  transition: color 150ms ease, border-color 150ms ease;
}

.rem-client-actions .rem-accept:hover  { color: var(--accent);  border-color: var(--border-soft); }
.rem-client-actions .rem-applied:hover { color: var(--accent);  border-color: var(--border-soft); }
.rem-client-actions .rem-reject:hover  { color: var(--danger);  border-color: rgba(208,109,109,0.4); }

.rem-pending, .rem-unavailable {
  margin-top: 0.85rem;
  padding-top: 0.7rem;
  border-top: 1px dashed var(--border);
  color: var(--muted);
  font-size: 0.8rem;
  font-style: italic;
}

/* ─── v0.6 Billing + email banner + trial overlay ─────────────────────── */

.email-banner {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.65rem 1rem;
  background: rgba(224, 163, 60, 0.08);
  border-bottom: 1px solid rgba(224, 163, 60, 0.25);
  color: var(--warning);
  font-size: 0.875rem;
  flex-wrap: wrap;
}

.email-banner-msg { flex: 1; min-width: 240px; }

.email-banner input[type="email"] {
  flex: 0 0 auto;
  padding: 0.35rem 0.6rem;
  min-width: 220px;
  background: #0A0A0A;
  border: 1px solid var(--border);
  color: var(--fg);
  border-radius: 3px;
  font-size: 0.875rem;
}

.email-banner button {
  padding: 0.38rem 0.9rem;
  font-size: 0.825rem;
  border: 1px solid var(--border-soft);
  border-radius: 3px;
  background: transparent;
  color: var(--accent);
  font-family: inherit;
  cursor: pointer;
}

.email-banner button.ghost {
  color: var(--muted);
  border-color: var(--border);
}

#subscribe-link {
  display: inline-flex;
  align-items: center;
  padding: 0.4rem 0.9rem;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--accent);
  text-decoration: none;
  border: 1px solid var(--border-soft);
  border-radius: 4px;
  transition: background-color 150ms ease;
}

#subscribe-link:hover {
  background: rgba(127, 217, 98, 0.08);
}

.trial-overlay {
  position: fixed;
  inset: 0;
  background: rgba(10, 10, 10, 0.92);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem 1rem;
  z-index: 1000;
  overflow-y: auto;
}

.trial-overlay-card {
  max-width: 1000px;
  width: 100%;
  padding: 2.5rem 2rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  text-align: center;
}

.trial-overlay-card h2 {
  font-size: 1.6rem;
  font-weight: 500;
  margin: 0 0 0.5rem;
  letter-spacing: -0.01em;
}

.trial-overlay-card > p {
  color: var(--muted);
  margin: 0 0 1.75rem;
}

.trial-plans {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

@media (max-width: 720px) {
  .trial-plans { grid-template-columns: 1fr; }
}

.trial-plan-card {
  padding: 1.5rem 1.25rem;
  background: var(--surface-elevated);
  border: 1px solid var(--border);
  border-radius: 6px;
  text-align: left;
  display: flex;
  flex-direction: column;
}

.trial-plan-card h3 {
  margin: 0 0 0.5rem;
  font-size: 1.1rem;
  font-weight: 500;
  color: var(--fg);
}

.trial-plan-price {
  margin: 0 0 1rem;
  font-size: 1.6rem;
  font-weight: 500;
  color: var(--accent);
}

.trial-plan-price span {
  font-size: 0.875rem;
  color: var(--muted);
  margin-left: 0.2rem;
}

.trial-plan-card ul {
  list-style: none;
  padding: 0;
  margin: 0 0 1.25rem;
  color: var(--fg);
  font-size: 0.875rem;
  line-height: 1.65;
  flex: 1;
}

.trial-plan-card ul li {
  position: relative;
  padding-left: 1.15rem;
}

.trial-plan-card ul li::before {
  content: "✓";
  position: absolute;
  left: 0;
  color: var(--accent);
}

.trial-plan-subscribe {
  padding: 0.65rem 1rem;
  border: 1px solid var(--accent);
  background: var(--accent);
  color: #0A0A0A;
  border-radius: 4px;
  font-family: inherit;
  font-size: 0.925rem;
  font-weight: 500;
  cursor: pointer;
  transition: background-color 150ms ease;
}

.trial-plan-subscribe:hover { background: #8FE972; border-color: #8FE972; }

.trial-overlay-note {
  color: var(--muted);
  font-size: 0.825rem;
  margin: 1rem 0 0;
}

#forgot-panel {
  margin-top: 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border);
}

#forgot-panel label {
  display: block;
  font-size: 0.8rem;
  color: var(--muted);
  margin: 0 0 0.3rem;
}

#forgot-panel input[type="email"] {
  width: 100%;
  padding: 0.5rem 0.7rem;
  background: #0A0A0A;
  border: 1px solid var(--border);
  color: var(--fg);
  border-radius: 3px;
  font-size: 0.875rem;
}

#forgot-panel button {
  margin-top: 0.65rem;
  padding: 0.5rem 0.95rem;
  width: 100%;
  border: 1px solid var(--border-soft);
  background: transparent;
  color: var(--accent);
  border-radius: 3px;
  font-family: inherit;
  font-size: 0.9rem;
  cursor: pointer;
}

#forgot-panel button:hover { background: rgba(127, 217, 98, 0.06); }

.success { color: var(--accent) !important; }

/* ─── v0.6.2 Navigation ────────────────────────────────────────────── */

.dashboard-logo {
  display: inline-flex;
  align-items: center;
  padding: 0.1rem 0.4rem 0.1rem 0;
  margin-right: 0.6rem;
  color: var(--accent);
  font-weight: 600;
  font-size: 1rem;
  letter-spacing: -0.01em;
  text-decoration: none;
  border-right: 1px solid var(--border);
  padding-right: 0.8rem;
  transition: color 150ms ease;
}

.dashboard-logo:hover,
.dashboard-logo:focus-visible { color: var(--fg); }

.back-to-landing {
  margin-top: 0.4rem !important;
  font-size: 0.825rem !important;
}

.back-to-landing a {
  color: var(--muted);
  text-decoration: none;
  transition: color 150ms ease;
}

.back-to-landing a:hover { color: var(--accent); }

/* ─── v0.7 Role-based visibility ──────────────────────────────────── */

/* Viewer = read-only : hide mutation controls everywhere. */
body[data-role="viewer"] .incident-ack,
body[data-role="viewer"] .incident-dismiss,
body[data-role="viewer"] .rem-accept,
body[data-role="viewer"] .rem-applied,
body[data-role="viewer"] .rem-reject,
body[data-role="viewer"] #subscribe-link,
body[data-role="viewer"] #email-save,
body[data-role="viewer"] #add-machine-btn,
body[data-role="viewer"] .trial-plan-subscribe {
  display: none !important;
}

body[data-role="viewer"] .user-badge::after {
  content: " (viewer)";
  color: #4dd0e1;
  font-size: 0.7em;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

/* Admin link is its own element — visibility driven inline by JS. */
#admin-link {
  color: var(--accent);
  text-decoration: none;
  font-weight: 600;
  padding: 0.35rem 0.9rem;
  border: 1px solid var(--border-soft);
  border-radius: 4px;
  font-size: 0.85rem;
  transition: background-color 150ms ease;
}

#admin-link:hover { background: rgba(127, 217, 98, 0.08); }
