/* ── Design tokens ── */
:root {
  --bg-base: #0a1018;
  --bg-surface: #111a24;
  --bg-elevated: #182430;
  --bg-input: #0d161f;

  --border-subtle: rgba(255, 255, 255, 0.06);
  --border-default: rgba(255, 255, 255, 0.10);
  --border-focus: rgba(24, 160, 251, 0.5);

  --text-primary: #e8f0f8;
  --text-secondary: #8a9bb0;
  --text-muted: #6b7a8d;

  --status-ok: #2dd4a8;
  --status-warn: #f5aa34;
  --status-danger: #ef5454;
  --status-info: #4da6ff;
  --status-purple: #b48eff;
  --status-muted: #6b7a8d;

  --status-ok-surface: rgba(45, 212, 168, 0.12);
  --status-warn-surface: rgba(245, 170, 52, 0.12);
  --status-danger-surface: rgba(239, 84, 84, 0.12);
  --status-info-surface: rgba(77, 166, 255, 0.12);
  --status-purple-surface: rgba(180, 142, 255, 0.12);
  --status-muted-surface: rgba(107, 122, 141, 0.12);

  --accent: #18a0fb;
  --accent-hover: #3cb4ff;
  --accent-surface: rgba(24, 160, 251, 0.12);

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-pill: 999px;

  --space-2xs: 2px;
  --space-xs: 6px;
  --space-sm: 8px;
  --space-md: 12px;
  --space-lg: 16px;
  --space-xl: 24px;
  --space-2xl: 32px;

  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 12px 40px rgba(0, 0, 0, 0.5);
  --shadow-card: 0 1px 4px rgba(0, 0, 0, 0.2);
  --shadow-hover: 0 4px 16px rgba(0,0,0,0.35), 0 0 0 1px rgba(24,160,251,0.12);

  --text-2xs: 10px;
  --text-xs: 12px;
  --text-sm: 13px;
  --text-md: 14px;
  --text-lg: 18px;

  --transition-fast: 120ms ease;
  --transition-medium: 180ms ease;
  --transition-normal: 200ms ease;

  --glow-ok: 0 0 12px rgba(45, 212, 168, 0.3);
  --glow-warn: 0 0 12px rgba(245, 170, 52, 0.3);
  --glow-danger: 0 0 12px rgba(239, 84, 84, 0.3);
  --glow-info: 0 0 12px rgba(77, 166, 255, 0.3);
  --glow-accent: 0 0 12px rgba(24, 160, 251, 0.3);
  --glow-purple: 0 0 12px rgba(180, 142, 255, 0.3);
  --transition-smooth: 300ms cubic-bezier(0.4, 0, 0.2, 1);

  /* Layout */
  --nav-height: 56px;
  --header-height: 48px;
  --sheet-radius: 16px;

  /* Z-index scale */
  --z-nav: 50;
  --z-sheet: 60;
  --z-scrim: 40;
  --z-modal: 80;
  --z-toast: 90;

  /* Safe area for iOS */
  --safe-area-top: env(safe-area-inset-top, 0px);
  --safe-area-right: env(safe-area-inset-right, 0px);
  --safe-area-bottom: env(safe-area-inset-bottom, 0px);
  --safe-area-left: env(safe-area-inset-left, 0px);

  /* Font weights */
  --weight-regular: 400;
  --weight-medium: 500;
  --weight-semibold: 600;
  --weight-bold: 700;

  /* Line heights */
  --leading-tight: 1.2;
  --leading-normal: 1.5;
  --leading-relaxed: 1.6;
}

/* ── Reset & base ── */
*, *::before, *::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100dvh;
  width: 100%;
  font: 400 var(--text-md)/1.5 "IBM Plex Sans", -apple-system, system-ui, sans-serif;
  color: var(--text-primary);
  background: var(--bg-base);
  overscroll-behavior-y: contain;
  -webkit-font-smoothing: antialiased;
  overflow-x: clip;
}

body::before {
  content: "";
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: constant(safe-area-inset-top);
  height: var(--safe-area-top);
  background: var(--bg-base);
  z-index: 19;
  pointer-events: none;
}

h1, h2, h3, h4 {
  margin: 0;
  font-family: "Space Grotesk", "IBM Plex Sans", sans-serif;
  font-weight: 600;
}

p { margin: 0; }

input, select, textarea, button {
  font: inherit;
  color: inherit;
}

.hidden { display: none !important; }

.mono {
  font-family: "IBM Plex Mono", monospace;
  font-size: var(--text-sm);
}

.hint {
  color: var(--text-secondary);
  font-size: var(--text-sm);
  font-weight: 400;
}

.label {
  font-size: var(--text-xs);
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--text-muted);
}

/* ── Inputs ── */
input, select, textarea {
  width: 100%;
  padding: 10px 12px;
  background: var(--bg-input);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  transition: border-color var(--transition-fast);
}

input::placeholder, textarea::placeholder {
  color: var(--text-muted);
}

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--border-focus);
}

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

/* ── Buttons ── */
button {
  border: 0;
  cursor: pointer;
  background: transparent;
  transition: background var(--transition-fast), transform var(--transition-fast);
}

button:active {
  transform: scale(0.97);
}

.btn-primary {
  padding: 10px 20px;
  border-radius: var(--radius-sm);
  background: var(--accent);
  color: #fff;
  font-weight: 600;
}

.btn-primary:hover {
  background: var(--accent-hover);
}

.btn-ghost {
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-primary);
}

.btn-ghost:hover {
  background: rgba(255, 255, 255, 0.10);
}

.btn-danger {
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  background: var(--status-danger-surface);
  color: var(--status-danger);
  font-weight: 600;
}

.btn-danger:hover {
  background: rgba(239, 84, 84, 0.16);
}

.btn-sm {
  padding: 6px 12px;
  font-size: var(--text-sm);
}

button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

button:disabled, button.btn-loading {
  opacity: 0.5;
  pointer-events: none;
}

.btn-loading::after {
  content: '';
  display: inline-block;
  width: 12px;
  height: 12px;
  margin-left: 6px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  vertical-align: middle;
  animation: spin 800ms linear infinite;
}

.btn-row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-sm);
}

/* ── Chips ── */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: var(--radius-pill);
  font-size: var(--text-xs);
  font-weight: 500;
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-secondary);
  transition: background var(--transition-fast), color var(--transition-fast);
}

.chip.ok {
  background: var(--status-ok-surface);
  color: var(--status-ok);
}

.chip.warn {
  background: var(--status-warn-surface);
  color: var(--status-warn);
}

.chip.bad {
  background: var(--status-danger-surface);
  color: var(--status-danger);
}

.chip.info {
  background: var(--status-info-surface);
  color: var(--status-info);
}

.chip.purple {
  background: var(--status-purple-surface);
  color: var(--status-purple);
}

.chip.muted {
  background: var(--status-muted-surface);
  color: var(--status-muted);
}

/* ── Status dot ── */
.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--text-muted);
  flex-shrink: 0;
}

.dot.ok {
  background: var(--status-ok);
  box-shadow: 0 0 6px rgba(45, 212, 168, 0.4);
}

.dot.warn {
  background: var(--status-warn);
  box-shadow: 0 0 6px rgba(245, 170, 52, 0.3);
}

.dot.bad {
  background: var(--status-danger);
  box-shadow: 0 0 6px rgba(239, 84, 84, 0.4);
}

.dot.info {
  background: var(--status-info);
  box-shadow: 0 0 6px rgba(77, 166, 255, 0.3);
}

.dot.runtime-outdated {
  box-shadow:
    0 0 0 2px rgba(245, 170, 52, 0.95),
    0 0 0 4px rgba(245, 170, 52, 0.18);
}

.dot.ok.runtime-outdated {
  box-shadow:
    0 0 0 2px rgba(245, 170, 52, 0.95),
    0 0 0 4px rgba(245, 170, 52, 0.18),
    0 0 6px rgba(45, 212, 168, 0.38);
}

.dot.info.runtime-outdated {
  box-shadow:
    0 0 0 2px rgba(245, 170, 52, 0.95),
    0 0 0 4px rgba(245, 170, 52, 0.18),
    0 0 6px rgba(77, 166, 255, 0.28);
}

.dot.purple {
  background: var(--status-purple);
  box-shadow: 0 0 6px rgba(180, 142, 255, 0.3);
}

.dot.muted {
  background: var(--status-muted);
}

.dot.pulse {
  animation: pulse 1.4s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.4; transform: scale(0.75); }
}

/* ── App shell ── */
.app {
  max-width: 1200px;
  width: 100%;
  margin: 0 auto;
  padding:
    var(--safe-area-top)
    max(var(--space-lg), calc(var(--safe-area-right) + var(--space-lg)))
    calc(var(--nav-height) + var(--safe-area-bottom) + var(--space-sm))
    max(var(--space-lg), calc(var(--safe-area-left) + var(--space-lg)));
  display: grid;
  gap: 0;
  min-height: 100dvh;
  grid-template-rows: auto 1fr;
  overflow-x: hidden;
}

/* ── Global bar ── */
.global-bar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  justify-content: space-between;
  align-items: center;
  min-height: var(--header-height);
  padding: 0;
  background: var(--bg-base);
}

.bar-left, .bar-right {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.bar-btn {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  background: transparent;
}

.bar-btn:hover {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-primary);
  box-shadow: var(--glow-accent);
}

.sync-inline .dot.ok {
  --_glow-color: rgba(45, 212, 168, 0.4);
  animation: glowPulse 2s infinite;
}

.bar-btn.spinning svg {
  animation: spin 800ms linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.logo-text {
  font-family: "Space Grotesk", sans-serif;
  font-weight: 700;
  font-size: 16px;
  background: linear-gradient(135deg, var(--text-primary), var(--accent));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

/* ── Sync inline indicator ── */
.sync-inline {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--text-secondary);
}

.sync-label {
  white-space: nowrap;
}

/* ── Bottom navigation ── */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: var(--z-nav);
  height: calc(var(--nav-height) + var(--safe-area-bottom));
  padding-bottom: var(--safe-area-bottom);
  background: var(--bg-surface);
  border-top: 1px solid var(--border-subtle);
  backdrop-filter: blur(12px);
  display: flex;
  align-items: stretch;
  justify-content: space-around;
}

.nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  min-height: 44px;
  padding: var(--space-xs) 0;
  color: var(--text-muted);
  background: transparent;
  border: none;
  position: relative;
  transition: color var(--transition-fast);
}

.nav-item:hover {
  color: var(--text-secondary);
}

.nav-item.active {
  color: var(--accent);
}

.nav-item.active::after {
  content: '';
  position: absolute;
  top: 0;
  left: 25%;
  right: 25%;
  height: 2px;
  background: var(--accent);
  border-radius: 0 0 2px 2px;
}

.nav-label {
  font-size: 10px;
  font-weight: var(--weight-semibold);
  letter-spacing: 0.02em;
}

.nav-badge {
  position: absolute;
  top: 4px;
  right: calc(50% - 18px);
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: var(--radius-pill);
  background: var(--status-danger);
  color: #fff;
  font-size: 9px;
  font-weight: var(--weight-bold);
  display: grid;
  place-items: center;
  line-height: 1;
}

/* ── Tab bar (service detail tabs, legacy) ── */
.tab-bar {
  display: flex;
  gap: var(--space-xs);
  padding: 6px 0;
  overflow-x: auto;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
  border-bottom: 1px solid var(--border-subtle);
}

.register-layout {
  display: grid;
  gap: var(--space-lg);
  grid-template-columns: minmax(0, 1.4fr) minmax(280px, 0.8fr);
  margin-top: var(--space-lg);
}

.register-card {
  min-height: 100%;
}

.register-form-grid {
  display: grid;
  gap: var(--space-sm);
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.register-preview {
  margin-top: var(--space-md);
  margin-bottom: var(--space-md);
}

@media (max-width: 980px) {
  .register-layout,
  .register-form-grid {
    grid-template-columns: 1fr;
  }
}

.tab-bar::-webkit-scrollbar { display: none; }

.tab-bar.scroll-left {
  box-shadow: inset 24px 0 16px -16px rgba(10, 16, 24, 0.8);
}

.tab-bar.scroll-right {
  box-shadow: inset -24px 0 16px -16px rgba(10, 16, 24, 0.8);
}

.tab-bar.scroll-left.scroll-right {
  box-shadow:
    inset 24px 0 16px -16px rgba(10, 16, 24, 0.8),
    inset -24px 0 16px -16px rgba(10, 16, 24, 0.8);
}


.tab {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--text-secondary);
  background: transparent;
  border-bottom: 2px solid transparent;
  transition: color var(--transition-fast), border-color var(--transition-fast), background var(--transition-fast);
  white-space: nowrap;
}

.tab:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.03);
}

.tab.active {
  color: var(--text-primary);
  border-bottom: 2px solid transparent;
  border-image: linear-gradient(90deg, var(--accent), var(--status-purple)) 1;
  background: rgba(255, 255, 255, 0.04);
}

.tab-icon {
  opacity: 0.6;
  display: inline-flex;
  transition: opacity var(--transition-fast);
}

.tab:hover .tab-icon,
.tab.active .tab-icon {
  opacity: 1;
}

.tab .dot {
  width: 6px;
  height: 6px;
}

.tab-badge {
  margin-left: 6px;
  background: var(--status-danger-surface);
  color: var(--status-danger);
}

/* ── Dashboard toolbar ── */
.dashboard-toolbar {
  display: flex;
  gap: var(--space-md);
  margin-bottom: var(--space-lg);
  align-items: center;
  flex-wrap: wrap;
}

.dashboard-toolbar.compact {
  margin-bottom: var(--space-md);
  gap: var(--space-sm);
}

.dashboard-search {
  flex: 1;
  min-width: 180px;
  position: relative;
}

.search-icon {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  pointer-events: none;
  display: flex;
  align-items: center;
}

.search-shortcut {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  font: 11px/1 "IBM Plex Mono", monospace;
  color: var(--text-muted);
  padding: 2px 6px;
  border-radius: 4px;
  border: 1px solid var(--border-default);
  background: var(--bg-elevated);
  pointer-events: none;
}

.dashboard-search input {
  padding: 8px 12px 8px 32px;
  font-size: var(--text-sm);
}

.dashboard-search input:focus {
  box-shadow: 0 0 0 1px var(--accent), var(--glow-accent);
}

.dashboard-search.compact input {
  height: 36px;
  padding: 4px 12px 4px 32px;
  font-size: var(--text-xs);
}

.dashboard-toolbar.compact .filter-chip {
  padding: 5px 10px;
  font-size: var(--text-xs);
}

.dashboard-filters {
  display: flex;
  gap: var(--space-xs);
  flex-shrink: 0;
  min-width: 0;
}

.dashboard-toolbar-controls {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  flex-wrap: wrap;
  justify-content: flex-end;
  min-width: 0;
}

/* ── Sort dropdown ── */
.sort-dropdown {
  position: relative;
  flex-shrink: 0;
}

.sort-dropdown-trigger {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border-subtle);
  background: rgba(255, 255, 255, 0.04);
  font-size: var(--text-xs);
  font-weight: var(--weight-medium);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.sort-dropdown-trigger:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-primary);
}

.sort-dropdown-trigger[aria-expanded="true"] {
  border-color: var(--accent);
  color: var(--accent);
}

.sort-dropdown-menu {
  position: absolute;
  top: calc(100% + 4px);
  right: 0;
  min-width: 140px;
  padding: 4px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-default);
  background: var(--bg-elevated);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
  z-index: var(--z-modal);
  animation: fadeIn 100ms ease;
}

.sort-dropdown-item {
  display: block;
  width: 100%;
  padding: 8px 12px;
  border: none;
  border-radius: var(--radius-sm);
  background: transparent;
  font-size: var(--text-xs);
  color: var(--text-secondary);
  text-align: left;
  cursor: pointer;
  transition: background var(--transition-fast), color var(--transition-fast);
}

.sort-dropdown-item:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-primary);
}

.sort-dropdown-item[aria-selected="true"] {
  color: var(--accent);
  background: rgba(24, 160, 251, 0.08);
}

.dashboard-gesture-hint {
  margin: 2px 0 var(--space-sm);
  font-size: var(--text-xs);
  padding: var(--space-sm) var(--space-md);
  border-radius: var(--radius-md);
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  cursor: pointer;
  transition: opacity var(--transition-normal), max-height var(--transition-normal), margin var(--transition-normal), padding var(--transition-normal);
  max-height: 80px;
  overflow: hidden;
}

.dashboard-gesture-hint::after {
  content: ' (tap to dismiss)';
  color: var(--text-muted);
  font-style: italic;
}

.dashboard-gesture-hint:hover {
  border-color: var(--border-default);
}

.dashboard-gesture-hint.hint-dismissed {
  opacity: 0;
  max-height: 0;
  margin: 0;
  padding: 0;
  border-width: 0;
  pointer-events: none;
}

.filter-chip {
  padding: 6px 12px;
  border-radius: var(--radius-pill);
  font-size: var(--text-xs);
  font-weight: 500;
  color: var(--text-secondary);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-subtle);
  transition: all var(--transition-fast);
}

.filter-chip:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-primary);
}

.filter-chip.active {
  background: var(--accent-surface);
  color: var(--accent);
  border-color: rgba(24, 160, 251, 0.5);
  box-shadow: 0 0 8px rgba(24, 160, 251, 0.2);
}

/* ── Content area ── */
.content-area {
  padding: var(--space-sm) 0;
  min-height: 0;
  min-width: 0;
  overflow-x: clip;
}

.tab-panel {
  display: none;
  animation: fadeIn 150ms ease;
  min-width: 0;
  overflow-x: clip;
}

.tab-panel.active {
  display: block;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ── Status strip ── */
.status-strip {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--space-sm);
  margin-bottom: var(--space-lg);
}

/* ── Status strip compact (mini-card grid) ── */
.status-strip-compact {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--space-sm);
  padding: var(--space-sm) 0;
  margin-bottom: var(--space-md);
  position: sticky;
  top: var(--header-height);
  z-index: 10;
  background: var(--bg-base);
  min-width: 0;
}

.status-badge-compact {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  border-radius: var(--radius-md);
  font-size: var(--text-xs);
  font-weight: 600;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  animation: fadeInUp 300ms ease backwards;
  min-width: 0;
  overflow: hidden;
}

.status-badge-compact.attention {
  background: var(--status-warn-surface);
  color: var(--status-warn);
  box-shadow: var(--glow-warn);
}

.status-badge-compact.danger {
  background: var(--status-danger-surface);
  color: var(--status-danger);
  box-shadow: var(--glow-danger);
}

.status-badge-compact .badge-value {
  font-family: "IBM Plex Mono", monospace;
  font-size: 15px;
  font-weight: 700;
  margin-left: auto;
  flex-shrink: 0;
}

.dashboard-overview-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-md);
  margin-bottom: var(--space-lg);
}

@media (min-width: 1025px) {
  .dashboard-overview-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.overview-card {
  padding: var(--space-lg);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.02), transparent),
    var(--bg-surface);
  display: grid;
  gap: var(--space-md);
  position: relative;
  overflow: hidden;
}

.overview-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--status-ok);
}

.overview-card:nth-child(2)::before { background: var(--status-warn); }
.overview-card:nth-child(3)::before { background: var(--status-info); }
.overview-card:nth-child(4)::before { background: var(--status-purple); }

.overview-card-head {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: var(--space-md);
}

.overview-card h3 {
  font-size: var(--text-lg);
}

.overview-card-title-group {
  display: flex;
  align-items: center;
  gap: var(--space-md);
}

.overview-card-icon {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  display: grid;
  place-items: center;
  flex-shrink: 0;
}

.overview-card-icon.icon-ok { background: var(--status-ok-surface); color: var(--status-ok); }
.overview-card-icon.icon-warn { background: var(--status-warn-surface); color: var(--status-warn); }
.overview-card-icon.icon-info { background: var(--status-info-surface); color: var(--status-info); }
.overview-card-icon.icon-purple { background: var(--status-purple-surface); color: var(--status-purple); }

.bulk-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--space-md);
  margin-bottom: var(--space-md);
  padding: var(--space-md) var(--space-lg);
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
}

.stack-list,
.security-list {
  display: grid;
  gap: var(--space-sm);
}

.stack-item,
.security-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: var(--space-md);
  align-items: center;
  padding: var(--space-md);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
  background: rgba(255, 255, 255, 0.03);
}

.stack-item-copy,
.security-item-copy {
  min-width: 0;
  display: grid;
  gap: 6px;
}

.stack-item-copy strong,
.security-item-copy strong {
  font-family: "Space Grotesk", sans-serif;
  font-size: 15px;
}

.stack-item-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.stack-item-actions {
  display: flex;
  flex-direction: column;
  gap: 4px;
  align-items: stretch;
  min-width: 0;
}

.stack-item-actions .btn-action {
  width: 100%;
  justify-content: center;
  padding: 5px 12px;
  font-size: var(--text-xs);
}

.stack-item-actions .btn-action svg {
  flex-shrink: 0;
}

.system-grid {
  display: grid;
  gap: var(--space-sm);
}

.system-card {
  display: grid;
  gap: var(--space-sm);
  padding: var(--space-md);
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-subtle);
}

.system-card-head,
.system-metric-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-sm);
}

.meter {
  width: 100%;
  height: 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  overflow: hidden;
}

.meter span {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--accent), var(--status-info));
  transition: width 600ms cubic-bezier(0.4, 0, 0.2, 1);
}

.timeline-item {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: var(--space-sm);
  align-items: start;
  padding: var(--space-md);
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-subtle);
}

.timeline-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  margin-top: 6px;
}

.timeline-dot.bad {
  background: var(--status-danger);
}

.timeline-dot.warn {
  background: var(--status-warn);
}

.timeline-dot.info {
  background: var(--status-info);
}

.timeline-dot.ok {
  background: var(--status-ok);
}

.timeline-copy {
  display: grid;
  gap: 6px;
}

.timeline-item.compact {
  padding: var(--space-sm) var(--space-md);
}

.timeline-time {
  display: grid;
  gap: 2px;
  text-align: right;
  font-size: var(--text-xs);
  color: var(--text-secondary);
}

.metric {
  padding: var(--space-md) var(--space-lg);
  border-radius: var(--radius-md);
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
}

.metric-label {
  font-size: var(--text-xs);
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--text-muted);
}

.metric-value {
  font: 700 24px/1.2 "IBM Plex Mono", monospace;
  color: var(--text-primary);
}

.metric-meta {
  font-size: var(--text-xs);
  color: var(--text-secondary);
  margin-top: 2px;
}

.metric.attention .metric-value {
  color: var(--status-warn);
}

.metric.danger .metric-value {
  color: var(--status-danger);
}

.text-bad {
  color: var(--status-danger);
}

/* ── Service grid (dashboard) ── */
.service-grid {
  display: grid;
  gap: var(--space-sm);
  min-width: 0;
}

.service-grid .swipe-shell,
.service-grid .swipe-shell * {
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}

.swipe-shell {
  position: relative;
  overflow: hidden;
  width: 100%;
  max-width: 100%;
  contain: paint;
  -webkit-mask-image: linear-gradient(#000, #000);
  transform: translateZ(0);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
  --swipe-offset: 0px;
  touch-action: pan-y;
  transition: border-color var(--transition-fast), box-shadow var(--transition-smooth);
}

.swipe-actions {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 200px;
  display: none;
  align-items: stretch;
  padding: 6px;
  pointer-events: none;
}

.swipe-actions-left {
  left: 0;
  justify-content: flex-start;
}

.swipe-actions-right {
  right: 0;
  justify-content: flex-end;
}

.swipe-actions-panel {
  width: 100%;
  min-height: 100%;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 8px;
  padding: 2px;
  border: none;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  pointer-events: none;
  position: relative;
  overflow: visible;
  user-select: none;
  opacity: 0.01;
  filter: saturate(0.95) brightness(0.98);
  transition:
    transform 240ms cubic-bezier(0.22, 1, 0.36, 1),
    opacity 180ms ease,
    filter 240ms cubic-bezier(0.22, 1, 0.36, 1),
    background 240ms cubic-bezier(0.22, 1, 0.36, 1);
}

.swipe-actions-left .swipe-actions-panel {
  transform: translateX(-14px) scale(0.985);
  transform-origin: left center;
}

.swipe-actions-right .swipe-actions-panel {
  transform: translateX(14px) scale(0.985);
  transform-origin: right center;
}

.swipe-actions-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  min-height: 24px;
  padding: 0 2px;
}

.swipe-scope {
  display: inline-flex;
  align-items: center;
  min-height: 18px;
  padding: 0 6px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.05);
  font-size: var(--text-2xs);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-primary);
}

.swipe-actions-head .chip {
  font-size: var(--text-2xs);
  padding: 1px 6px;
}

.swipe-actions-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1 1 auto;
  min-height: 0;
}

.grid-header {
  display: none;
}

.grid-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-rows: auto auto auto;
  grid-template-areas:
    "name   action"
    "envs   envs"
    "meta   meta";
  gap: var(--space-xs) var(--space-sm);
  padding: var(--space-md) var(--space-lg);
  background-color: var(--bg-surface, #111a24);
  background: var(--bg-surface);
  cursor: pointer;
  transition:
    background 220ms ease,
    transform var(--transition-smooth),
    filter 220ms cubic-bezier(0.22, 1, 0.36, 1),
    box-shadow 220ms cubic-bezier(0.22, 1, 0.36, 1);
  transform: translateX(var(--swipe-offset));
  animation: cardFadeIn 300ms ease backwards;
  position: relative;
  z-index: 1;
  touch-action: pan-y;
  will-change: transform;
  user-select: none;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.02);
  overflow: hidden;
  max-width: 100%;
}

.grid-row-meta {
  grid-area: meta;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-xs);
  justify-content: space-between;
  user-select: none;
  min-width: 0;
  overflow: hidden;
}

.swipe-shell:not(.is-swiping):hover {
  border-color: rgba(24, 160, 251, 0.25);
  box-shadow: var(--shadow-hover);
}

.swipe-shell:not(.is-swiping):hover .grid-row {
  background: var(--bg-elevated);
  transform: translateX(var(--swipe-offset));
}

.swipe-shell.is-swiping[data-swipe-preview="staging"] .swipe-actions-left,
.swipe-shell.is-swiping[data-swipe-preview="production"] .swipe-actions-right {
  display: flex;
}

.swipe-shell.is-swiping[data-swipe-preview="staging"] .swipe-actions-left .swipe-actions-panel,
.swipe-shell.is-swiping[data-swipe-preview="production"] .swipe-actions-right .swipe-actions-panel {
  pointer-events: auto;
  opacity: 1;
  filter: saturate(1) brightness(1);
  transform: translateX(0) scale(1);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.05),
    0 18px 34px rgba(0, 0, 0, 0.3);
}

.swipe-shell.is-swiping[data-swipe-preview="staging"] .swipe-actions-right,
.swipe-shell.is-swiping[data-swipe-preview="production"] .swipe-actions-left {
  display: none;
}

.swipe-shell[data-swipe-open="staging"] .swipe-actions-left,
.swipe-shell[data-swipe-open="production"] .swipe-actions-right {
  display: flex;
}

.swipe-shell[data-swipe-open="staging"] .swipe-actions-left .swipe-actions-panel,
.swipe-shell[data-swipe-open="production"] .swipe-actions-right .swipe-actions-panel {
  pointer-events: auto;
  opacity: 1;
  filter: saturate(1) brightness(1);
  transform: translateX(0) scale(1);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.05),
    0 20px 38px rgba(0, 0, 0, 0.32);
}

.swipe-shell[data-swipe-open="staging"] .swipe-actions-right,
.swipe-shell[data-swipe-open="production"] .swipe-actions-left {
  display: none;
}

.grid-row:active {
  transform: translateX(var(--swipe-offset)) scale(0.995);
}

.swipe-shell[data-swipe-open="staging"] .grid-row,
.swipe-shell[data-swipe-open="production"] .grid-row {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.045), rgba(255, 255, 255, 0.016)),
    var(--bg-surface);
  filter: saturate(0.94) brightness(1.02);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.04),
    inset 0 0 0 1px rgba(255, 255, 255, 0.02);
}

.swipe-shell.is-swiping .grid-row {
  transition: none;
  cursor: grabbing;
}

body.swipe-gesture-active,
body.swipe-gesture-active * {
  user-select: none;
}

.swipe-shell:has(.grid-row[data-tone="ok"]) {
  border-left: 4px solid var(--status-ok);
}
.grid-row[data-tone="ok"] {
  background: linear-gradient(90deg, #122a25, var(--bg-surface) 40%);
}

.swipe-shell:has(.grid-row[data-tone="bad"]) {
  border-left: 4px solid var(--status-danger);
}
.grid-row[data-tone="bad"] {
  background: linear-gradient(90deg, #1f1519, var(--bg-surface) 40%);
}

.swipe-shell:has(.grid-row[data-tone="warn"]) {
  border-left: 4px solid var(--status-warn);
}
.grid-row[data-tone="warn"] {
  background: linear-gradient(90deg, #1f1b14, var(--bg-surface) 40%);
}

.swipe-shell:has(.grid-row[data-tone="muted"]) {
  border-left: 4px solid var(--status-muted);
}
.grid-row[data-tone="muted"] {
  background: linear-gradient(90deg, #161c22, var(--bg-surface) 40%);
}

.swipe-shell:has(.grid-row[data-tone="info"]) {
  border-left: 4px solid var(--status-info);
}
.grid-row[data-tone="info"] {
  background: linear-gradient(90deg, #121e2a, var(--bg-surface) 40%);
}

.grid-row:hover .grid-row-name {
  color: var(--accent);
}

.swipe-shell:has(.grid-row:focus-visible) {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
  box-shadow: var(--glow-accent);
}

.swipe-shell:has(.grid-row.incident) {
  border-left: 4px solid var(--status-warn);
}

.swipe-shell:has(.grid-row.incident-critical) {
  border-left: 4px solid var(--status-danger);
}

.grid-row-name {
  grid-area: name;
  font-family: "Space Grotesk", sans-serif;
  font-weight: 600;
  font-size: var(--text-md);
  transition: color var(--transition-fast);
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.service-name-icon {
  opacity: 0.5;
  display: inline-flex;
  flex-shrink: 0;
  transition: opacity var(--transition-fast), color var(--transition-fast);
}

.grid-row:hover .service-name-icon {
  opacity: 1;
  color: var(--accent);
}

.grid-row-select {
  display: none;
}

.service-grid.custom-sort-active .grid-row-select {
  display: grid;
  place-items: center;
  grid-area: name;
  justify-self: start;
}

.service-grid.custom-sort-active .grid-row {
  grid-template-columns: 28px minmax(0, 1fr) auto;
  grid-template-areas:
    "select name   action"
    "select envs   envs"
    "meta   meta   meta";
}

.service-grid.custom-sort-active .grid-row-select {
  grid-area: select;
  grid-row: 1 / span 2;
}

.service-grid:not(.custom-sort-active) .grid-row-select + .grid-row-name {
  /* Checkbox mode: show inline checkbox */
}

.grid-row-select input {
  width: 16px;
  height: 16px;
  margin: 0;
}

.grid-row-status {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: var(--text-sm);
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
}

.grid-row-status span:last-child {
  overflow: hidden;
  text-overflow: ellipsis;
}

.grid-row-status svg {
  flex-shrink: 0;
}

.grid-row-envs {
  grid-area: envs;
  display: flex;
  flex-direction: row;
  gap: var(--space-sm);
  min-width: 0;
  overflow: hidden;
}

.env-line {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: var(--text-sm);
  color: var(--text-secondary);
  white-space: nowrap;
  line-height: 1.4;
  overflow: hidden;
  text-overflow: ellipsis;
}

.env-line .env-label {
  font-size: 10px;
  font-weight: 600;
  color: var(--text-muted);
  width: 12px;
  flex-shrink: 0;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.grid-row-action {
  grid-area: action;
  align-self: stretch;
  display: flex;
  align-items: stretch;
  min-width: 120px;
  max-width: 160px;
  position: relative;
  z-index: 2;
  pointer-events: auto;
}

/* grid-row-action is only rendered when a smart action button exists */

.grid-row-action .btn-primary {
  padding: var(--space-sm) 14px;
  font-size: var(--text-xs);
  white-space: nowrap;
  transition: background var(--transition-fast), box-shadow var(--transition-fast);
}

.grid-row-action .btn-primary:hover {
  box-shadow: var(--glow-accent);
}

.grid-row-action .btn-ghost {
  padding: var(--space-sm) 14px;
  font-size: var(--text-xs);
  white-space: nowrap;
}

/* ── Action pill buttons ── */
.btn-action {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 14px;
  border: none;
  border-radius: var(--radius-pill);
  font-family: inherit;
  font-size: var(--text-xs);
  font-weight: 600;
  cursor: pointer;
  width: 100%;
  justify-content: center;
  white-space: nowrap;
  transition: background var(--transition-fast), box-shadow var(--transition-fast), transform var(--transition-fast);
}

.grid-row-action .btn-action {
  margin: 0;
  align-self: stretch;
  min-height: 40px;
  padding: 8px 10px;
  border-radius: var(--radius-md);
  display: grid;
  grid-template-columns: 20px minmax(0, 1fr);
  gap: 8px;
  justify-items: start;
  align-content: center;
  text-align: left;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.06),
    0 6px 14px rgba(0, 0, 0, 0.16);
  position: relative;
  z-index: 2;
  pointer-events: auto;
}

.btn-action svg {
  flex-shrink: 0;
}

.btn-action-icon {
  width: 20px;
  height: 20px;
  border-radius: 7px;
  display: grid;
  place-items: center;
  background: rgba(255, 255, 255, 0.08);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.btn-action-label {
  min-width: 0;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  line-height: 1.1;
}

.grid-row-openers {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-xs);
  margin-left: auto;
  flex-shrink: 0;
  position: relative;
  z-index: 2;
  pointer-events: auto;
  min-width: 100px;
}

.grid-lane-toggle {
  min-height: 28px;
  padding: 6px 8px;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.055), rgba(255, 255, 255, 0.02));
  color: var(--text-secondary);
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  position: relative;
  z-index: 2;
  pointer-events: auto;
}

.grid-lane-toggle:hover {
  color: var(--text-primary);
  border-color: rgba(255, 255, 255, 0.14);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.035));
}

.swipe-shell[data-swipe-open="staging"] .grid-lane-toggle[data-open-quick="staging"],
.swipe-shell[data-swipe-open="production"] .grid-lane-toggle[data-open-quick="production"] {
  color: var(--accent);
  border-color: rgba(24, 160, 251, 0.36);
  background: linear-gradient(180deg, rgba(24, 160, 251, 0.18), rgba(24, 160, 251, 0.08));
  box-shadow: 0 0 14px rgba(24, 160, 251, 0.14);
}

.btn-action.btn-sm {
  gap: 7px;
}

.btn-action.btn-sm .btn-action-icon {
  width: 18px;
  height: 18px;
  border-radius: 7px;
}

.btn-action.btn-sm .btn-action-label {
  -webkit-line-clamp: 1;
}

.btn-action-accent {
  background: var(--accent-surface);
  color: var(--accent);
}

.btn-action-accent:hover {
  background: rgba(24, 160, 251, 0.22);
  box-shadow: 0 0 10px rgba(24, 160, 251, 0.25);
}

.btn-action-warn {
  background: var(--status-warn-surface);
  color: var(--status-warn);
}

.btn-action-warn:hover {
  background: rgba(245, 170, 52, 0.22);
  box-shadow: 0 0 10px rgba(245, 170, 52, 0.25);
}

.btn-action-danger {
  background: var(--status-danger-surface);
  color: var(--status-danger);
}

.btn-action-danger:hover {
  background: rgba(239, 84, 84, 0.22);
  box-shadow: 0 0 10px rgba(239, 84, 84, 0.25);
}

.btn-action-ghost {
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid var(--border-subtle);
}

.btn-action-ghost:hover {
  background: var(--bg-elevated);
  border-color: var(--border-default);
  box-shadow: 0 0 8px rgba(255, 255, 255, 0.05);
}

.btn-action-accent .btn-action-icon {
  background: rgba(24, 160, 251, 0.16);
}

.btn-action-warn .btn-action-icon {
  background: rgba(245, 170, 52, 0.16);
}

.btn-action-danger .btn-action-icon {
  background: rgba(239, 84, 84, 0.16);
}

.btn-action-ghost .btn-action-icon {
  background: rgba(255, 255, 255, 0.06);
}

/* ── Compact grid (dashboard) ── */
.service-grid.compact {
  gap: var(--space-sm);
}

.service-grid.compact .grid-row {
  padding: var(--space-sm) var(--space-lg);
  min-height: 44px;
}

.grid-quick-btn {
  width: 100%;
  border: 1px solid transparent;
  border-radius: 12px;
  min-height: 48px;
  padding: 10px 12px;
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr);
  gap: 8px;
  align-items: center;
  text-align: left;
  font-size: 12px;
  font-weight: 600;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05);
  flex: 1 1 0;
}

.grid-quick-btn .btn-action-icon {
  width: 18px;
  height: 18px;
  border-radius: 6px;
}

.grid-quick-btn .btn-action-label {
  -webkit-line-clamp: 2;
  line-height: 1.15;
  overflow: hidden;
  text-overflow: initial;
  white-space: normal;
  display: -webkit-box;
}

.grid-quick-btn-accent {
  background: rgba(24, 160, 251, 0.14);
  border-color: rgba(24, 160, 251, 0.18);
  color: #8fd0ff;
}

.grid-quick-btn-warn {
  background: rgba(245, 170, 52, 0.14);
  border-color: rgba(245, 170, 52, 0.18);
  color: #ffd289;
}

.grid-quick-btn-danger {
  background: rgba(239, 84, 84, 0.14);
  border-color: rgba(239, 84, 84, 0.18);
  color: #ffb0b0;
}

.grid-quick-btn-ghost {
  background: rgba(255, 255, 255, 0.05);
  border-color: var(--border-subtle);
  color: var(--text-secondary);
}

.grid-quick-btn:hover {
  filter: brightness(1.08);
  transform: translateY(-1px);
}

.service-grid.compact .grid-row-name {
  font-size: var(--text-sm);
}

.service-grid.compact .grid-row-status {
  font-size: var(--text-xs);
}

.service-grid.compact .grid-row-status .dot {
  width: 6px;
  height: 6px;
}

.service-grid.compact .grid-row-envs .env-line {
  font-size: var(--text-xs);
}

.service-grid.compact .grid-row-envs .env-line .dot {
  width: 7px;
  height: 7px;
}

.service-grid.compact .chip {
  font-size: 10px;
  padding: 2px 8px;
}

.service-grid.compact .grid-row-action .btn-primary,
.service-grid.compact .grid-row-action .btn-ghost {
  padding: 4px 10px;
  font-size: 10px;
}

.service-grid.compact .grid-row-action .btn-action {
  min-height: 38px;
  padding: 7px 10px;
  font-size: 11px;
  gap: 8px;
}

/* ── Service panel (detail view) ── */
.service-panel {
  display: grid;
  gap: var(--space-xl);
}

.service-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--space-lg);
  flex-wrap: wrap;
}

.service-header-left {
  display: flex;
  align-items: center;
  gap: var(--space-lg);
}

.service-header h2 {
  font-size: var(--text-lg);
}

.service-header-status {
  display: flex;
  align-items: center;
  gap: var(--space-md);
}

/* ── Detail accordion ── */
.detail-accordion {
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  margin-bottom: var(--space-sm);
  background: var(--bg-surface);
  overflow: hidden;
}

.detail-accordion summary {
  padding: var(--space-md) var(--space-lg);
  font-weight: var(--weight-semibold);
  font-size: var(--text-sm);
  color: var(--text-primary);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  user-select: none;
  transition: background var(--transition-fast);
  list-style: none;
}

.detail-accordion summary::-webkit-details-marker {
  display: none;
}

.detail-accordion summary::before {
  content: '';
  display: inline-block;
  width: 6px;
  height: 6px;
  border-right: 2px solid var(--text-muted);
  border-bottom: 2px solid var(--text-muted);
  transform: rotate(-45deg);
  transition: transform 200ms ease;
  flex-shrink: 0;
}

.detail-accordion[open] summary::before {
  transform: rotate(45deg);
}

.detail-accordion summary:hover {
  background: rgba(255, 255, 255, 0.04);
}

.detail-accordion[open] summary {
  border-bottom: 1px solid var(--border-subtle);
}

.detail-accordion > :not(summary) {
  padding: var(--space-md) var(--space-lg);
}

.accordion-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: var(--radius-pill);
  background: rgba(255, 255, 255, 0.08);
  font-size: var(--text-xs);
  font-weight: var(--weight-medium);
  color: var(--text-muted);
}

.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: var(--text-sm);
  color: var(--text-secondary);
}

/* ── Info grid (3 columns) ── */
.info-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-md);
}

.info-card {
  padding: var(--space-lg);
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  display: grid;
  gap: var(--space-md);
}

.info-card-title {
  font-size: var(--text-xs);
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--text-muted);
  padding-bottom: var(--space-sm);
  border-bottom: 1px solid var(--border-subtle);
}

.info-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--space-sm);
}

.info-row .label {
  flex-shrink: 0;
}

.info-row .value {
  font-family: "IBM Plex Mono", monospace;
  font-size: 13px;
  text-align: right;
  word-break: break-all;
}

.domain-stack,
.policy-list {
  display: grid;
  gap: var(--space-sm);
}

.domain-stack-row,
.policy-row {
  display: grid;
  gap: 6px;
}

.domain-stack-main {
  display: grid;
  gap: 6px;
}

.static-config-grid {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.field-stack {
  display: grid;
  gap: 6px;
}

.field-span {
  grid-column: 1 / -1;
}

.domain-chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

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

/* ── Domain links ── */
.domain-link {
  color: var(--accent);
  text-decoration: none;
  font-family: "IBM Plex Mono", monospace;
  font-size: 13px;
  transition: color var(--transition-fast);
}

.domain-link:hover {
  color: var(--accent-hover);
  text-decoration: underline;
}

/* ── Action group ── */
.action-group {
  display: grid;
  gap: var(--space-sm);
}

.action-group-label {
  font-size: var(--text-xs);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--text-muted);
  padding-bottom: var(--space-xs);
}

/* ── Changes section ── */
.changes-section {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: var(--space-lg);
  display: grid;
  gap: var(--space-lg);
}

.changes-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--space-md);
}

.changes-count {
  font: 700 18px/1 "IBM Plex Mono", monospace;
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  display: grid;
  place-items: center;
  background: var(--accent-surface);
  color: var(--accent);
}

.file-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.diff-view {
  padding: var(--space-md);
  border-radius: var(--radius-sm);
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  font: 12px/1.6 "IBM Plex Mono", monospace;
  white-space: pre-wrap;
  overflow-x: auto;
  max-height: 400px;
  overflow-y: auto;
}

.log-view {
  min-height: 120px;
}

.log-output {
  margin: 0;
  font: 12px/1.6 "IBM Plex Mono", monospace;
  color: var(--text-primary);
  white-space: pre-wrap;
}

.diff-line { display: block; }
.diff-line.add { color: var(--status-ok); background: rgba(45, 212, 168, 0.06); }
.diff-line.remove { color: var(--status-danger); background: rgba(239, 84, 84, 0.06); }
.diff-line.meta { color: var(--text-muted); }
.diff-line.file { color: var(--status-info); }

/* ── Write operations (commit, branch, upstream) ── */
.write-ops {
  display: grid;
  gap: var(--space-lg);
}

.write-op {
  display: grid;
  gap: var(--space-sm);
}

.push-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-sm);
}

.push-diagnostics {
  display: grid;
  gap: var(--space-sm);
}

.push-diagnostics-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-sm);
}

.push-diagnostic-card {
  display: grid;
  gap: 6px;
  padding: var(--space-sm) var(--space-md);
  border-radius: var(--radius-md);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0.03));
  border: 1px solid var(--border-subtle);
  min-width: 0;
}

.push-diagnostic-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--text-muted);
}

.push-diagnostic-hint {
  font-size: var(--text-xs);
  color: var(--text-secondary);
  min-width: 0;
  overflow-wrap: anywhere;
}

.push-diagnostics-note {
  display: grid;
  gap: 6px;
  padding: var(--space-sm) var(--space-md);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
  background: rgba(255, 255, 255, 0.03);
  font-size: var(--text-xs);
  color: var(--text-secondary);
}

.push-history {
  display: grid;
  gap: var(--space-sm);
  max-height: 240px;
  overflow-y: auto;
}

.history-row-unread {
  border-color: rgba(239, 84, 84, 0.26);
  background: linear-gradient(180deg, rgba(239, 84, 84, 0.08), rgba(255, 255, 255, 0.03));
}

.write-op-label {
  font-size: var(--text-xs);
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--text-muted);
}

.write-op-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-sm);
}

.file-action-list {
  display: grid;
  gap: var(--space-sm);
}

.file-action-row,
.history-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: var(--space-sm);
  align-items: center;
  padding: var(--space-sm) var(--space-md);
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-subtle);
}

.file-action-path {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.logs-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-sm);
}

/* ── Activity FAB ── */
.activity-fab {
  position: fixed;
  right: var(--space-lg);
  bottom: calc(var(--nav-height) + var(--safe-area-bottom) + var(--space-lg));
  z-index: var(--z-nav);
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  display: grid;
  place-items: center;
  box-shadow: var(--shadow-md), 0 0 16px rgba(24, 160, 251, 0.3);
  border: none;
  cursor: pointer;
  transition: transform var(--transition-fast), box-shadow var(--transition-fast);
}

.activity-reset-fab {
  position: fixed;
  right: calc(var(--space-lg) + 36px);
  bottom: calc(var(--nav-height) + var(--safe-area-bottom) + 46px);
  z-index: calc(var(--z-nav) + 1);
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  border: 1px solid rgba(239, 84, 84, 0.28);
  background: rgba(239, 84, 84, 0.96);
  color: #fff;
  box-shadow: var(--shadow-md), 0 0 16px rgba(239, 84, 84, 0.28);
  cursor: pointer;
  transition: transform var(--transition-fast), box-shadow var(--transition-fast), opacity var(--transition-fast);
}

.activity-reset-fab:hover {
  transform: scale(1.08);
  box-shadow: var(--shadow-lg), 0 0 20px rgba(239, 84, 84, 0.34);
}

.activity-reset-fab:active {
  transform: scale(0.95);
}

.activity-fab:hover {
  transform: scale(1.08);
  box-shadow: var(--shadow-lg), 0 0 24px rgba(24, 160, 251, 0.4);
}

.activity-fab:active {
  transform: scale(0.95);
}

.fab-badge {
  position: absolute;
  top: -2px;
  right: -2px;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: var(--radius-pill);
  background: var(--status-danger);
  color: #fff;
  font-size: 10px;
  font-weight: var(--weight-bold);
  display: grid;
  place-items: center;
  line-height: 1;
}

/* ── Activity overlay ── */
.activity-overlay {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  max-height: 70vh;
  z-index: calc(var(--z-nav) + 1);
  background: var(--bg-surface);
  border-top: 1px solid var(--border-subtle);
  border-radius: var(--sheet-radius) var(--sheet-radius) 0 0;
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  transform: translateY(100%);
  transition: transform var(--transition-smooth);
  overflow: hidden;
}

.activity-overlay.open {
  transform: translateY(0);
}

.activity-overlay-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--space-md) var(--space-lg);
  border-bottom: 1px solid var(--border-subtle);
  flex-shrink: 0;
}

.activity-overlay-header h3 {
  font-size: var(--text-md);
}

.activity-overlay .activity-list {
  flex: 1;
  overflow-y: auto;
  padding-bottom: var(--space-lg);
}

.badge {
  padding: 2px 8px;
  border-radius: var(--radius-pill);
  font-size: var(--text-xs);
  font-weight: 600;
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-muted);
  transition: background var(--transition-fast), color var(--transition-fast), box-shadow var(--transition-fast);
}

.badge.badge-active {
  background: var(--accent);
  color: #fff;
  box-shadow: var(--glow-accent);
}

.badge.badge-danger {
  background: var(--status-danger);
  color: #fff;
  box-shadow: var(--glow-danger);
}

.activity-panel {
  padding: var(--space-sm) 0;
  max-height: 280px;
  overflow-y: auto;
}

.activity-filters {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-xs);
  padding: 0 var(--space-md) var(--space-sm);
}

.activity-project-filter {
  padding: 0 var(--space-md) var(--space-sm);
}

.activity-list {
  display: grid;
  gap: var(--space-xs);
}

.activity-item {
  display: flex;
  align-items: start;
  gap: var(--space-sm);
  padding: var(--space-sm) var(--space-md);
  border-radius: var(--radius-sm);
  font-size: var(--text-sm);
}

.activity-item:hover {
  background: rgba(255, 255, 255, 0.02);
}

.activity-item .dot {
  margin-top: 5px;
}

.activity-item-text {
  flex: 1;
}

.activity-item-copy {
  flex: 1;
  display: grid;
  gap: 6px;
}

.activity-item-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.activity-item-time {
  font-size: var(--text-xs);
  color: var(--text-muted);
  flex-shrink: 0;
}

/* ── Settings page ── */
.settings-page {
  display: grid;
  gap: var(--space-lg);
  padding: var(--space-md) 0;
  max-width: 640px;
}

/* ── Auth row ── */
.auth-row {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.auth-row-label {
  flex: 1;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-primary);
}

.menu-item {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  width: 100%;
  padding: 10px var(--space-md);
  border-radius: var(--radius-sm);
  font-size: var(--text-md);
  font-weight: 400;
  color: var(--text-primary);
  background: transparent;
  text-align: left;
  transition: background var(--transition-fast);
}

.menu-item:hover {
  background: rgba(255, 255, 255, 0.06);
}

.menu-item:active {
  background: rgba(255, 255, 255, 0.10);
}

.menu-icon {
  flex-shrink: 0;
  color: var(--text-secondary);
}

.menu-label {
  flex: 1;
  min-width: 0;
}

.menu-badge {
  padding: 2px 8px;
  border-radius: var(--radius-pill);
  font-size: var(--text-xs);
  font-weight: 600;
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-muted);
}

.menu-divider {
  height: 1px;
  margin: var(--space-sm) 0;
  background: var(--border-subtle);
}

.menu-group-label {
  font-size: var(--text-xs);
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--text-muted);
  padding: var(--space-xs) var(--space-md);
}

.drawer-passkeys .security-list {
  gap: 2px;
}

.drawer-passkeys .security-item {
  border: 0;
  background: transparent;
  padding: var(--space-sm) var(--space-md);
  border-radius: var(--radius-sm);
}

.drawer-passkeys .security-item:hover {
  background: rgba(255, 255, 255, 0.04);
}

.security-item .hint {
  word-break: break-word;
}

/* ── Modal ── */
.modal {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  z-index: var(--z-modal);
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(6px);
}

.modal:not(.hidden) .modal-backdrop {
  animation: modalBackdropIn 200ms ease;
}

.modal-card {
  position: relative;
  width: min(440px, calc(100% - 32px));
  padding: var(--space-xl);
  border-radius: var(--radius-lg);
  background: var(--bg-elevated);
  border: 1px solid var(--border-default);
  box-shadow: var(--shadow-lg);
  display: grid;
  gap: var(--space-md);
}

.modal:not(.hidden) .modal-card {
  animation: modalCardIn 200ms ease;
}

@keyframes modalCardIn {
  from { opacity: 0; transform: scale(0.95) translateY(8px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

@keyframes modalBackdropIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.modal-card h3 {
  font-size: var(--text-lg);
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: var(--space-sm);
  margin-top: var(--space-sm);
}

/* ── Toast ── */
.toast-stack {
  position: fixed;
  right: var(--space-lg);
  bottom: calc(var(--nav-height) + var(--safe-area-bottom) + var(--space-lg));
  display: grid;
  gap: var(--space-sm);
  z-index: var(--z-toast);
  max-width: min(400px, calc(100% - 32px));
}

.toast {
  position: relative;
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr) 20px;
  gap: 12px;
  align-items: start;
  padding: 14px 16px 16px;
  border-radius: 18px;
  font-size: var(--text-sm);
  font-weight: 500;
  animation: slideIn 220ms cubic-bezier(0.22, 1, 0.36, 1);
  border: 1px solid var(--border-subtle);
  background: linear-gradient(180deg, rgba(15, 20, 28, 0.96), rgba(10, 14, 20, 0.94));
  box-shadow:
    0 18px 48px rgba(3, 6, 10, 0.38),
    inset 0 1px 0 rgba(255, 255, 255, 0.05);
  backdrop-filter: blur(16px);
  overflow: hidden;
}

.toast::before {
  content: '';
  position: absolute;
  inset: 0 auto 0 0;
  width: 4px;
  background: var(--status-info);
}

.toast.is-leaving {
  animation: slideOut 180ms ease forwards;
}

.toast-icon {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.06);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

.toast-copy {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.toast-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-sm);
  min-width: 0;
}

.toast-kicker {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--text-muted);
}

.toast-time {
  font-size: 11px;
  color: var(--text-muted);
  white-space: nowrap;
}

.toast-text {
  min-width: 0;
  line-height: 1.35;
  color: var(--text-primary);
}

.toast-close {
  width: 20px;
  height: 20px;
  display: grid;
  place-items: center;
  border-radius: 6px;
  color: var(--text-secondary);
  opacity: 0.85;
  padding: 0;
  margin-top: 2px;
}

.toast-close:hover {
  opacity: 1;
  background: rgba(255, 255, 255, 0.08);
}

.toast-progress {
  position: absolute;
  left: 10px;
  right: 10px;
  bottom: 8px;
  height: 2px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
}

.toast-progress::after {
  content: '';
  position: absolute;
  inset: 0;
  background: currentColor;
  transform-origin: left center;
  animation: toastCountdown var(--toast-timeout, 3200ms) linear forwards;
}

.toast.ok {
  color: var(--status-ok);
  border-color: rgba(45, 212, 168, 0.18);
}

.toast.warn {
  color: var(--status-warn);
  border-color: rgba(245, 170, 52, 0.18);
}

.toast.bad {
  color: var(--status-danger);
  border-color: rgba(239, 84, 84, 0.18);
}

.toast.ok::before {
  background: linear-gradient(180deg, rgba(45, 212, 168, 0.95), rgba(45, 212, 168, 0.45));
}

.toast.warn::before {
  background: linear-gradient(180deg, rgba(245, 170, 52, 0.95), rgba(245, 170, 52, 0.45));
}

.toast.bad::before {
  background: linear-gradient(180deg, rgba(239, 84, 84, 0.95), rgba(239, 84, 84, 0.45));
}

@keyframes slideIn {
  from { opacity: 0; transform: translateY(14px) scale(0.98); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes slideOut {
  from { opacity: 1; transform: translateY(0) scale(1); }
  to { opacity: 0; transform: translateY(10px) scale(0.98); }
}

@keyframes toastCountdown {
  from { transform: scaleX(1); }
  to { transform: scaleX(0); }
}

/* ── Pull indicator ── */
.pull-indicator {
  position: fixed;
  left: 50%;
  top: 12px;
  transform: translate(-50%, -140%);
  padding: 8px 14px;
  border-radius: var(--radius-pill);
  background: var(--bg-elevated);
  color: var(--text-primary);
  font: 12px "IBM Plex Mono", monospace;
  border: 1px solid var(--border-default);
  z-index: var(--z-nav);
  transition: transform 140ms ease;
}

.pull-indicator.visible {
  transform: translate(-50%, 0);
}

/* ── Auth screen ── */
.auth-screen {
  display: grid;
  place-items: center;
  padding: var(--space-2xl) 0;
  min-height: 300px;
}

.auth-card {
  text-align: center;
  max-width: 360px;
  display: grid;
  gap: var(--space-lg);
}

.auth-card h3 {
  font-size: var(--text-lg);
}

.auth-card .hint {
  line-height: 1.6;
}

/* ── Empty state ── */
.empty-state {
  padding: var(--space-xl);
  border-radius: var(--radius-md);
  background: var(--bg-surface);
  color: var(--text-muted);
  text-align: center;
  font-size: var(--text-sm);
}

.empty-state-ok {
  color: var(--status-ok);
  background: var(--status-ok-surface);
}

.empty-state-illustrated {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-md);
  padding: var(--space-2xl);
}

.empty-state-illustrated svg {
  animation: fadeInUp 300ms ease backwards;
}

/* ── Skeleton loading ── */
@keyframes shimmer {
  0% { background-position: -400px 0; }
  100% { background-position: 400px 0; }
}

.skeleton {
  background: linear-gradient(90deg, var(--bg-surface) 25%, rgba(24, 160, 251, 0.04) 40%, var(--bg-elevated) 50%, rgba(24, 160, 251, 0.04) 60%, var(--bg-surface) 75%);
  background-size: 800px 100%;
  animation: shimmer 1.6s ease-in-out infinite;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
}

.skeleton-metric {
  height: 80px;
}

.skeleton-row {
  height: 56px;
}

.skeleton-row-compact {
  height: 36px;
}

/* ── Skeleton card (overview) ── */
.skeleton-card {
  height: 120px;
  background: linear-gradient(90deg, var(--bg-surface) 25%, var(--bg-elevated) 50%, var(--bg-surface) 75%);
  background-size: 800px 100%;
  animation: shimmer 1.6s ease-in-out infinite;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
}

/* ── Collapsible details ── */
details.overview-collapsible {
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.02), transparent),
    var(--bg-surface);
}

details.overview-collapsible summary {
  padding: var(--space-lg);
  cursor: pointer;
  list-style: none;
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  font-size: var(--text-xs);
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--text-muted);
  user-select: none;
}

details.overview-collapsible summary::-webkit-details-marker { display: none; }

details.overview-collapsible summary::before {
  content: '';
  display: inline-block;
  width: 0;
  height: 0;
  border-left: 5px solid currentColor;
  border-top: 4px solid transparent;
  border-bottom: 4px solid transparent;
  transition: transform var(--transition-fast);
}

details.overview-collapsible[open] summary::before {
  transform: rotate(90deg);
}

details.overview-collapsible .overview-collapsible-body {
  padding: 0 var(--space-lg) var(--space-lg);
  animation: fadeIn 150ms ease;
}

/* ── Skip link ── */
.skip-link {
  position: absolute;
  left: -9999px;
  top: auto;
  width: 1px;
  height: 1px;
  overflow: hidden;
  z-index: 100;
  padding: var(--space-sm) var(--space-lg);
  background: var(--accent);
  color: #fff;
  font-size: var(--text-sm);
  font-weight: 600;
  border-radius: var(--radius-sm);
  text-decoration: none;
}

.skip-link:focus {
  position: fixed;
  left: var(--space-lg);
  top: var(--space-lg);
  width: auto;
  height: auto;
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* ── Focus-visible inputs ── */
input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* ── Activity toggle chevron ── */
.activity-toggle .chevron {
  display: inline-block;
  transition: transform var(--transition-smooth);
}

.activity-toggle.open .chevron {
  transform: rotate(180deg);
}

/* ── Loading pulse ── */
.loading {
  opacity: 0.6;
  pointer-events: none;
}

/* ── Animation keyframes ── */
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes cardFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes glowPulse {
  0%, 100% { box-shadow: 0 0 6px var(--_glow-color, rgba(45, 212, 168, 0.3)); }
  50% { box-shadow: 0 0 14px var(--_glow-color, rgba(45, 212, 168, 0.5)); }
}

/* gradientShift removed — overview cards now use static top borders */

/* ── Desktop: nav becomes top bar ── */
@media (min-width: 1025px) {
  .bottom-nav {
    position: static;
    width: 100%;
    height: auto;
    padding: 0 var(--space-lg);
    border-top: none;
    border-bottom: 1px solid var(--border-subtle);
    backdrop-filter: none;
    justify-content: center;
    align-items: center;
    gap: 0;
    background: var(--bg-surface);
  }
  .nav-item {
    flex: 0;
    flex-direction: row;
    gap: 6px;
    padding: 4px 14px;
    border-radius: var(--radius-sm);
    min-height: 0;
  }
  .nav-item.active::after {
    display: none;
  }
  .nav-item.active {
    background: var(--accent-surface);
  }
  .nav-label {
    font-size: var(--text-sm);
  }
  .nav-badge {
    position: static;
    margin-left: var(--space-xs);
  }
  .app {
    padding-bottom: var(--space-sm);
    grid-template-rows: auto auto 1fr;
  }
  .activity-fab {
    bottom: var(--space-lg);
  }
  .service-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .service-grid .grid-header {
    grid-column: 1 / -1;
  }
}

/* ── Bottom sheet (mobile service detail) ── */
.bottom-sheet {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  border-radius: var(--sheet-radius) var(--sheet-radius) 0 0;
  background: var(--bg-base);
  z-index: var(--z-sheet);
  transform: translateY(100%);
  transition: transform 300ms cubic-bezier(0.4, 0, 0.2, 1);
  max-height: 95dvh;
  overflow: hidden;
  box-shadow: 0 -4px 32px rgba(0, 0, 0, 0.4);
}

.bottom-sheet.sheet-open {
  transform: translateY(0);
}

.bottom-sheet.sheet-half {
  transform: translateY(40%);
}

.bottom-sheet.sheet-peek {
  transform: translateY(60%);
}

.bottom-sheet.sheet-dragging {
  transition: none;
}

.sheet-handle {
  height: 32px;
  display: grid;
  place-items: center;
  cursor: grab;
  touch-action: none;
  user-select: none;
  flex-shrink: 0;
}

.sheet-handle-bar {
  width: 40px;
  height: 4px;
  border-radius: 2px;
  background: var(--text-muted);
  opacity: 0.5;
}

.sheet-content {
  overflow-y: auto;
  height: calc(95dvh - 32px);
  overscroll-behavior: contain;
  padding: 0 var(--space-lg) var(--space-lg);
}

.sheet-scrim {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: calc(var(--z-sheet) - 1);
  opacity: 0;
  transition: opacity 300ms ease;
}

.sheet-scrim.sheet-scrim-visible {
  opacity: 1;
}

/* Desktop: never show bottom sheet */
@media (min-width: 1025px) {
  .bottom-sheet,
  .sheet-scrim {
    display: none !important;
  }
}

/* ── Responsive: tablet ── */
@media (max-width: 1024px) {
  .info-grid {
    grid-template-columns: 1fr 1fr;
  }

  .info-grid .info-card:last-child {
    grid-column: 1 / -1;
  }
}

/* ── Responsive: mobile ── */
@media (max-width: 767px) {
  .app {
    padding:
      var(--safe-area-top)
      max(var(--space-md), calc(var(--safe-area-right) + var(--space-md)))
      calc(var(--nav-height) + var(--safe-area-bottom) + var(--space-sm))
      max(var(--space-md), calc(var(--safe-area-left) + var(--space-md)));
  }

  .dashboard-toolbar {
    flex-direction: column;
    align-items: stretch;
  }

  .dashboard-toolbar-controls {
    justify-content: flex-start;
    width: 100%;
  }

  .dashboard-search {
    min-width: 0;
    width: 100%;
  }

  .dashboard-filters {
    flex-wrap: wrap;
    width: 100%;
  }

  .sort-dropdown {
    max-width: 100%;
  }

  .sort-dropdown-menu {
    right: auto;
    left: 0;
  }

  .bulk-toolbar {
    flex-direction: column;
    align-items: stretch;
  }

  .status-strip {
    grid-template-columns: 1fr 1fr;
  }

  .status-strip-compact {
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-xs);
  }

  .status-badge-compact {
    padding: 6px 10px;
    min-height: 38px;
  }

  .info-grid {
    grid-template-columns: 1fr;
  }

  .info-grid .info-card:last-child {
    grid-column: auto;
  }

  .grid-row-name {
    font-size: 15px;
  }

  .grid-row-envs {
    font-size: var(--text-xs);
  }

  .overview-card {
    padding: var(--space-md);
  }

  /* Touch targets */
  .filter-chip {
    min-height: 36px;
    padding: 8px 14px;
  }

  .sort-dropdown-trigger {
    min-height: 36px;
  }

  .service-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .service-header-left {
    flex-direction: column;
    align-items: flex-start;
    gap: var(--space-sm);
  }

  .changes-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .modal-card {
    width: calc(100% - 24px);
  }

  .toast-stack {
    right: var(--space-sm);
    bottom: calc(var(--nav-height) + var(--safe-area-bottom) + var(--space-sm));
    left: var(--space-sm);
    max-width: none;
  }

  .push-diagnostics-grid {
    grid-template-columns: 1fr;
  }

  .toast {
    grid-template-columns: 24px minmax(0, 1fr) 20px;
    padding: 12px 14px 15px;
    border-radius: 16px;
  }

  .grid-row {
    padding: var(--space-sm) var(--space-md);
    gap: var(--space-2xs) var(--space-xs);
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas:
      "name"
      "envs"
      "meta"
      "action";
  }

  .grid-row-name,
  .grid-row-envs,
  .grid-row-meta,
  .grid-row-action {
    min-width: 0;
    width: 100%;
  }

  .grid-row-action {
    min-width: 0;
    max-width: none;
    width: 100%;
  }

  .grid-row-action .btn-action {
    min-height: 40px;
    padding: 7px 10px;
    font-size: var(--text-2xs);
    gap: 6px;
    grid-template-columns: 18px minmax(0, 1fr);
  }

  .service-grid.custom-sort-active .grid-row {
    grid-template-columns: 24px minmax(0, 1fr);
    grid-template-areas:
      "select name"
      "envs envs"
      "meta meta"
      "action action";
  }

  .service-grid.custom-sort-active .grid-row-select {
    grid-row: 1;
    align-self: center;
  }

  .grid-row-meta {
    justify-content: flex-start;
    align-items: stretch;
  }

  .grid-row-openers {
    min-width: 0;
    width: 100%;
    gap: 4px;
    margin-left: 0;
  }

  .grid-lane-toggle {
    min-height: 26px;
    padding: 5px 6px;
    font-size: 9px;
  }

  .grid-row-envs {
    flex-wrap: wrap;
  }

  .swipe-actions {
    width: 180px;
    padding: 3px;
  }

}

@media (max-width: 480px) {
  .status-strip-compact {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .status-badge-compact {
    padding: 6px 8px;
    font-size: var(--text-2xs);
  }

  .status-badge-compact .badge-value {
    font-size: 13px;
  }
}

/* ── Drag handle ── */
.drag-handle {
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  font-size: 16px;
  color: var(--text-muted);
  cursor: grab;
  border-radius: var(--radius-sm);
  touch-action: none;
  user-select: none;
}
.drag-handle:hover {
  color: var(--accent);
  background: rgba(24, 160, 251, 0.12);
}
.drag-handle:active {
  cursor: grabbing;
}

/* ── Dragging state ── */
.swipe-shell.is-dragging {
  opacity: 0.92;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(24, 160, 251, 0.3);
  border-radius: var(--radius-md);
}
.swipe-shell.is-dragging .grid-row {
  transform: scale(1.02);
  border-color: rgba(24, 160, 251, 0.4);
  animation: none;
}
.drag-placeholder {
  border-radius: var(--radius-md);
  background: rgba(24, 160, 251, 0.06);
  border: 2px dashed rgba(24, 160, 251, 0.25);
}

@media (max-width: 400px) {
  .logo-text { display: none; }
  .sync-label-full { display: none; }
}

/* ── Accessibility: focus-visible for new components ── */
.nav-item:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
  border-radius: var(--radius-sm);
}

.activity-fab:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.sheet-handle:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}

.detail-accordion summary:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}

.sort-dropdown-trigger:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.sort-dropdown-item:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}

/* ── Accessibility: reduced motion ── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
