:root {
  --color-bg-primary: #000000;
  --color-bg-secondary: #0B0B0C;
  --color-bg-tertiary: #141616;
  --color-bg-quaternary: #1C1C1C;

  --color-text-primary: #FFFFFF;
  --color-text-secondary: #E7E7E8;
  --color-text-tertiary: #98999B;
  --color-text-muted: #6B6C6E;

  --color-brand-primary: #E8390E;
  --color-brand-hover: #FF4A1C;
  --color-brand-dark: #B82E0B;
  --color-brand-glow: rgba(232, 57, 14, 0.15);

  --color-success: #27AE60;
  --color-success-soft: rgba(39, 174, 96, 0.12);
  --color-warning: #F39C12;
  --color-error: #E74C3C;
  --color-info: #2E86C1;

  --color-border: #232425;
  --color-border-strong: #2A2A2C;

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

  --t-fast: 180ms;
  --t-pulse: 2400ms;
  --ease-pulse: cubic-bezier(0.4, 0, 0.2, 1);
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 24px;
  --space-6: 32px;
  --radius-xl: 20px;

  --shadow-card: 0 1px 0 rgba(255,255,255,0.02) inset, 0 8px 24px rgba(0,0,0,0.35);

  --font-sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }

html { scrollbar-gutter: stable; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--color-bg-primary);
  color: var(--color-text-secondary);
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

a { color: inherit; text-decoration: none; }
button { font-family: inherit; }

.container {
  width: 100%;
  max-width: 760px;
  margin: 0 auto;
  padding: 0 24px;
}

.page-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 28px;
  gap: 16px;
}
.brand {
  display: inline-flex;
  align-items: center;
  flex: 0 1 auto;
  min-width: 0;
}
.brand-logo {
  height: 24px;
  width: auto;
  max-width: 100%;
  display: block;
  user-select: none;
}

.head-actions {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

/* Bell icon ships only as a mobile affordance; the desktop button uses the label. */
#subscribe-btn .btn-icon { display: none; }

/* Language switcher (per status-handoff-lang-selector.md) */
.lang-menu { position: relative; }

.lang-menu__trigger {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--color-bg-tertiary);
  border: 1px solid var(--color-border-strong);
  color: var(--color-text-secondary);
  font: inherit;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.04em;
  padding: 6px 10px;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: border-color var(--t-fast), background var(--t-fast);
}
.lang-menu__trigger:hover { border-color: var(--color-brand-primary); }
.lang-menu__icon,
.lang-menu__caret { display: block; flex: 0 0 auto; }
.lang-menu__caret { transition: transform var(--t-fast); }
.lang-menu.is-open .lang-menu__caret { transform: rotate(180deg); }

.lang-menu__list {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  min-width: 200px;
  max-height: 320px;
  overflow-y: auto;
  background: var(--color-bg-tertiary);
  border: 1px solid var(--color-border-strong);
  border-radius: var(--radius-md);
  padding: 4px;
  list-style: none;
  margin: 0;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.5);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-4px);
  transition: opacity var(--t-fast), transform var(--t-fast), visibility var(--t-fast);
  z-index: 110;
}
.lang-menu.is-open .lang-menu__list {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.lang-menu__list li { list-style: none; }
.lang-menu__list button {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  background: transparent;
  border: none;
  color: var(--color-text-secondary);
  font: inherit;
  font-size: 13px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  text-align: left;
  transition: background var(--t-fast), color var(--t-fast);
}
.lang-menu__list button:hover {
  background: var(--color-bg-quaternary);
  color: var(--color-text-primary);
}
.lang-menu__list button.is-active {
  background: rgba(232, 57, 14, 0.12);
  color: var(--color-brand-primary);
}

.lang-menu__code {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--color-text-muted);
  font-family: 'JetBrains Mono', monospace;
}
.lang-menu__list button.is-active .lang-menu__code {
  color: var(--color-brand-primary);
}
.lang-menu__name { font-weight: 500; }

/* RTL: anchor the menu to the left edge instead of the right */
[dir="rtl"] .lang-menu__list { right: auto; left: 0; }

/* Buttons */
/* Buttons (per docs/status-handoff-buttons.md) */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  border-radius: var(--radius-md);
  padding: 10px 16px;
  font-size: 14px;
  font-weight: 500;
  border: none;
  cursor: pointer;
  font-family: inherit;
  transition:
    background var(--t-fast),
    transform var(--t-fast),
    border-color var(--t-fast),
    box-shadow var(--t-fast),
    color var(--t-fast);
  white-space: nowrap;
}
.btn:active { transform: scale(0.98); }
.btn:focus-visible {
  outline: 2px solid var(--color-brand-primary);
  outline-offset: 2px;
}

.btn--primary {
  background: var(--color-brand-primary);
  color: #fff;
  box-shadow: 0 0 20px rgba(232, 57, 14, 0.15);
  position: relative;
  overflow: hidden;
}
.btn--primary::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(120deg,
    transparent 30%,
    rgba(255, 255, 255, 0.25) 50%,
    transparent 70%);
  background-size: 200% 100%;
  background-position: -200% 0;
  pointer-events: none;
}
.btn--primary:hover::before { animation: shimmer 1.1s ease forwards; }
.btn--primary:hover {
  background: var(--color-brand-hover);
  transform: translateY(-1px);
  box-shadow: 0 4px 24px rgba(232, 57, 14, 0.30);
}
.btn--primary:active { background: var(--color-brand-dark); }

.btn--secondary {
  background: transparent;
  color: var(--color-text-secondary);
  border: 1px solid var(--color-border-strong);
}
.btn--secondary:hover {
  border-color: var(--color-brand-primary);
  color: var(--color-text-primary);
}

.btn--ghost {
  background: transparent;
  color: var(--color-text-tertiary);
  padding: 6px 12px;
}
.btn--ghost:hover { color: var(--color-text-primary); }

.btn--lg {
  padding: 14px 22px;
  font-size: 15px;
}

@keyframes shimmer {
  0%   { background-position: -200% 0; }
  100% { background-position:  200% 0; }
}

@media (prefers-reduced-motion: reduce) {
  .btn,
  .btn:active,
  .btn--primary:hover { transform: none; }
  .btn--primary::before,
  .btn--primary:hover::before { animation: none; }
}

/* Main */
.main {
  padding: 40px 24px 32px;
  flex: 1 0 auto;
  display: flex;
  flex-direction: column;
}

/* Page footer pinned to bottom when content is short, otherwise sits
   ~48px below the View history button. Spans the full content width. */
.page-footer {
  margin-top: auto;
  padding-top: 0;
  text-align: center;
  color: var(--color-text-muted);
  font-size: 12.5px;
  line-height: 1.6;
  width: 100%;
}
.page-footer p { margin: 0; }
.powered-by {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 12px;
  color: var(--color-text-muted);
  font-size: 12.5px;
  line-height: 1;
  opacity: 0.7;
  transition: opacity 0.18s ease;
}
.powered-by:hover { opacity: 1; }
.powered-by a { display: inline-flex; align-items: center; }
.powered-logo {
  height: 0.75em;
  width: auto;
  display: block;
  filter: grayscale(1) brightness(0.85);
  opacity: 0.9;
}

/* Banner */
.banner {
  border-radius: var(--radius-lg);
  border: 1px solid var(--color-border);
  padding: 20px 22px;
  margin-bottom: 28px;
}
.banner-operational {
  background: var(--color-success-soft);
  border-color: rgba(39, 174, 96, 0.35);
}
.banner-warning {
  background: rgba(243, 156, 18, 0.10);
  border-color: rgba(243, 156, 18, 0.45);
}
.banner-error {
  background: rgba(231, 76, 60, 0.10);
  border-color: rgba(231, 76, 60, 0.45);
}
.banner-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  flex: 0 0 18px;
}
.banner-warning .banner-icon { color: var(--color-warning); }
.banner-error .banner-icon { color: var(--color-error); }

.banner-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 14px 0 0;
}
.banner-chip {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  font-size: 12.5px;
  font-weight: 600;
  border-radius: 6px;
  line-height: 1.4;
}
.banner-chip--warn {
  background: rgba(243, 156, 18, 0.18);
  color: var(--color-warning);
}
.banner-chip--err {
  background: rgba(231, 76, 60, 0.18);
  color: var(--color-error);
}

.banner-issues {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--color-border);
}

.incident {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  cursor: pointer;
  border-radius: 8px;
  padding: 6px 8px;
  margin: -6px -8px;
  transition: background var(--t-fast);
}
.incident:hover { background: rgba(255, 255, 255, 0.03); }
.incident:focus-visible {
  outline: 2px solid var(--color-brand-primary);
  outline-offset: 2px;
}
.incident__icon {
  display: inline-flex;
  flex: 0 0 18px;
  width: 18px;
  height: 18px;
  margin-top: 2px;
}
.incident--warn .incident__icon { color: var(--color-warning); }
.incident--err .incident__icon { color: var(--color-error); }
.incident__body { flex: 1; min-width: 0; }
.incident__title {
  margin: 0;
  font-size: 14.5px;
  font-weight: 600;
  color: var(--color-text-primary);
}
.incident__desc {
  margin: 4px 0 0;
  font-size: 13.5px;
  color: var(--color-text-secondary);
}
.incident__meta {
  margin: 6px 0 0;
  font-size: 12.5px;
  color: var(--color-text-muted);
}

/* Incident detail view */
.incident-detail__hero {
  position: relative;
  margin-bottom: 16px;
}
.incident-detail__back {
  background: transparent;
  border: 0;
  color: var(--color-text-secondary);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 6px;
  padding: 0;
  margin-bottom: 8px;
  transition: background var(--t-fast), color var(--t-fast);
}
.incident-detail__back:hover {
  background: rgba(255, 255, 255, 0.06);
  color: var(--color-text-primary);
}
.incident-detail__title {
  margin: 0 0 12px;
  font-size: 18px;
  font-weight: 600;
  color: var(--color-text-primary);
}
.incident-detail__pills {
  margin: 0 0 14px;
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  font-size: 13px;
}
.incident-pill {
  font-weight: 600;
  letter-spacing: 0.01em;
}
.incident-pill--warn { color: var(--color-warning); }
.incident-pill--err  { color: var(--color-error); }
.incident-detail__desc {
  margin: 0 0 8px;
  color: var(--color-text-secondary);
  font-size: 14px;
  line-height: 1.55;
}
.incident-detail__meta {
  margin: 0;
  color: var(--color-text-muted);
  font-size: 12.5px;
}
.incident-detail__ago { margin-left: 4px; }
.incident-detail__notfound {
  padding: 24px 22px;
  color: var(--color-text-secondary);
}

.incident-section {
  padding: 20px 22px;
  margin-bottom: 16px;
}
.incident-section__heading {
  margin: 0 0 14px;
  font-size: 16px;
  font-weight: 600;
  color: var(--color-text-primary);
}

.incident-affected__icon {
  width: 16px;
  height: 16px;
  flex: 0 0 16px;
  color: var(--color-warning);
  display: inline-flex;
}
.incident-affected__icon svg { width: 16px; height: 16px; }

/* Affected components — timeline header + colored bar per service */
.affected-timeline-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12.5px;
  color: var(--color-text-muted);
  padding-bottom: 12px;
  border-bottom: 1px solid var(--color-border);
  margin-bottom: 16px;
}
.affected-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.affected-row__head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}
.affected-row__name {
  font-weight: 600;
  color: var(--color-text-primary);
  font-size: 14px;
}
.affected-row__count {
  color: var(--color-text-tertiary);
  font-size: 13px;
}
.affected-bar {
  display: flex;
  height: 14px;
  border-radius: 4px;
  overflow: hidden;
  gap: 1px;
  background: var(--color-bg-quaternary);
}
.affected-bar__seg { display: block; height: 100%; }
.affected-bar__seg--ok   { background: var(--color-success); }
.affected-bar__seg--warn { background: var(--color-warning); }
.affected-bar__seg--err  { background: var(--color-error); }

/* Updates — vertical timeline with connector line and per-status dot */
.incident-updates {
  display: flex;
  flex-direction: column;
}
.incident-update {
  position: relative;
  padding-left: 22px;
  padding-bottom: 22px;
}
.incident-update:last-child { padding-bottom: 0; }
.incident-update::before {
  content: '';
  position: absolute;
  left: 3px;
  top: 14px;
  bottom: 0;
  width: 2px;
  background: var(--color-warning);
  opacity: 0.55;
}
.incident-update--ok::before  { background: var(--color-success); }
.incident-update--err::before { background: var(--color-error); }
.incident-update:last-child::before { display: none; }
.incident-update__dot {
  position: absolute;
  left: 0;
  top: 6px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
}
.incident-update__dot--ok   { background: var(--color-success); }
.incident-update__dot--warn { background: var(--color-warning); }
.incident-update__dot--err  { background: var(--color-error); }
.incident-update__status {
  margin: 0 0 6px;
  font-size: 14px;
  font-weight: 600;
  color: var(--color-text-primary);
}
.incident-update__body {
  margin: 0 0 6px;
  font-size: 13.5px;
  color: var(--color-text-secondary);
  line-height: 1.55;
}
.incident-update__time {
  margin: 0;
  font-size: 12.5px;
  color: var(--color-text-muted);
}
.incident-update__earlier { margin-left: 4px; }

/* Resolved status pill should read green instead of warn-yellow. */
.incident-pill--ok { color: var(--color-success); }
.banner-row {
  display: flex;
  align-items: center;
  gap: 12px;
}
.banner-title {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
  color: var(--color-text-primary);
}
.banner-sub {
  margin: 8px 0 0 26px;
  color: var(--color-text-tertiary);
  font-size: 14px;
}

.status-dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  flex: 0 0 14px;
  display: inline-block;
  position: relative;
}
.status-dot::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: inherit;
  opacity: 0;
  pointer-events: none;
  z-index: -1;
  transform: scale(1);
}
.status-dot-ok   { background: var(--color-success); }
.status-dot-warn { background: var(--color-warning); }
.status-dot-err  { background: var(--color-error); }

/* Card */
.card {
  background: var(--color-bg-secondary);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
}
.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 22px;
  border-bottom: 1px solid var(--color-border);
}
.card-head h2 {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
  color: var(--color-text-primary);
}

.period-switch {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--color-text-tertiary);
  font-size: 13px;
}
.period-btn {
  background: transparent;
  border: 1px solid var(--color-border);
  color: var(--color-text-tertiary);
  width: 26px;
  height: 26px;
  border-radius: 6px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.period-btn:hover:not(:disabled) { color: var(--color-text-primary); border-color: var(--color-border-strong); }
.period-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

/* Services */
.services {
  display: flex;
  flex-direction: column;
}
.service-group {
  padding: 18px 22px;
  border-bottom: 1px solid var(--color-border);
}
.service-group:last-child { border-bottom: none; }

.service-group-head {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 10px;
}
.service-group-title {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 15px;
  font-weight: 600;
  color: var(--color-text-primary);
  background: transparent;
  border: 0;
  padding: 0;
  cursor: pointer;
  font-family: inherit;
  text-align: left;
  flex: 0 1 auto;
  min-width: 0;
}
.service-group-title > * { flex: 0 0 auto; }
.service-group-title > .service-component-count { margin-left: 4px; }
.service-uptime { margin-left: auto; }
.service-group-title:hover .service-toggle { color: var(--color-text-primary); }
.service-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  color: var(--color-text-tertiary);
  transition: transform 0.18s ease;
}
.service-group[data-open="true"] > .service-group-head .service-toggle {
  transform: rotate(90deg);
}

.service-info {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: transparent;
  border: 1px solid var(--color-border-strong);
  color: var(--color-text-tertiary);
  font-size: 10px;
  font-weight: 700;
  cursor: help;
  transition: color 0.15s ease, border-color 0.15s ease, background 0.15s ease;
  padding: 0;
  line-height: 1;
}
.service-info:hover {
  color: var(--color-text-primary);
  border-color: var(--color-text-muted);
  background: var(--color-bg-tertiary);
}
.service-component-count {
  color: var(--color-text-tertiary);
  font-size: 13px;
  font-weight: 400;
}
.service-uptime {
  color: var(--color-text-tertiary);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}
.service-uptime b { color: var(--color-text-secondary); font-weight: 600; }

.uptime-bar {
  display: flex;
  gap: 2px;
  height: 32px;
  align-items: stretch;
}
.uptime-cell {
  flex: 1;
  border-radius: 2px;
  background: var(--color-success);
  opacity: 0.95;
  min-width: 2px;
  position: relative;
  cursor: default;
}
.uptime-cell:hover { opacity: 1; outline: 1px solid rgba(255,255,255,0.18); }
.uptime-cell.warn { background: var(--color-warning); }
.uptime-cell.err { background: var(--color-error); }
.uptime-cell.none { background: var(--color-border-strong); opacity: 0.6; }

.service-children {
  margin-top: 14px;
  padding-left: 24px;
  border-left: 1px dashed var(--color-border-strong);
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.service-group[data-open="false"] > .service-children { display: none; }

.service-child .service-group-head { margin-bottom: 8px; }
.service-child .service-group-title { font-size: 14px; font-weight: 500; }

/* Actions */
.actions {
  display: flex;
  justify-content: center;
  margin-top: 28px;
  margin-bottom: 48px;
}

/* Animations */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}
@keyframes cellGrow {
  from { transform: scaleY(0.3); opacity: 0; }
  to   { transform: scaleY(1); opacity: 0.95; }
}
@keyframes pulseHaloLg {
  0%        { transform: scale(0.9); opacity: 0.55; }
  70%, 100% { transform: scale(2.4); opacity: 0; }
}
@keyframes pulseHaloSm {
  0%        { transform: scale(0.9); opacity: 0.45; }
  70%, 100% { transform: scale(1.9); opacity: 0; }
}

.banner { animation: fadeUp 0.5s ease both; }
.card { animation: fadeUp 0.55s ease 0.08s both; }
.actions { animation: fadeIn 0.6s ease 0.2s both; }
.page-footer { animation: fadeIn 0.6s ease 0.25s both; }
/* Animated halo on operational status dots; uses the shared
   --t-pulse / --ease-pulse tokens defined alongside --t-fast. */
.banner-operational .status-dot-ok::after {
  animation: pulseHaloLg var(--t-pulse) var(--ease-pulse) infinite;
}
.service-group:not(.service-child) > .service-group-head .status-dot-ok::after {
  animation: pulseHaloSm var(--t-pulse) var(--ease-pulse) infinite;
}

@media (prefers-reduced-motion: reduce) {
  .status-dot::after { animation: none !important; }
}

.uptime-cell {
  transform-origin: center;
  animation: cellGrow 0.5s cubic-bezier(0.2, 0.7, 0.3, 1) both;
}

.service-children {
  overflow: hidden;
  transition: opacity 0.22s ease;
}
.service-group[data-open="false"] > .service-children { opacity: 0; }
.service-group[data-open="true"]  > .service-children { opacity: 1; animation: fadeUp 0.28s ease both; }


/* Day tooltip */
.day-tooltip {
  position: absolute;
  z-index: 50;
  min-width: 200px;
  max-width: 260px;
  padding: 12px 14px;
  background: var(--color-bg-tertiary);
  color: var(--color-text-primary);
  border: 1px solid var(--color-border-strong);
  border-radius: 12px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.45);
  pointer-events: none;
  opacity: 0;
  transform: translateY(4px);
  transition: opacity 0.14s ease, transform 0.14s ease;
  font-size: 14px;
}
.day-tooltip[data-visible="true"] { opacity: 1; transform: translateY(0); }
.day-tooltip .tt-date {
  display: block;
  color: var(--color-text-muted);
  font-size: 12.5px;
  margin-bottom: 8px;
}
.day-tooltip .tt-row {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--color-text-primary);
  font-weight: 500;
}
.day-tooltip .tt-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  flex: 0 0 18px;
}
.day-tooltip .tt-icon.ok   { background: var(--color-success); color: #fff; }
.day-tooltip .tt-icon.warn { background: var(--color-warning); color: #1a1300; }
.day-tooltip .tt-icon.err  { background: var(--color-error);   color: #fff; }
.day-tooltip .tt-icon.none { background: var(--color-border-strong); color: var(--color-text-muted); }
.day-tooltip .tt-icon svg { width: 12px; height: 12px; }

/* Subscribe modal — per docs/status-handoff-modal.md (class-driven lifecycle) */
.modal {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-4);
  opacity: 0;
  transition: opacity 0.22s ease;
}
.modal[hidden] { display: none; }
.modal.is-shown { opacity: 1; }

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

.modal__panel {
  position: relative;
  background: var(--color-bg-tertiary);
  border: 1px solid var(--color-border-strong);
  border-radius: var(--radius-xl);
  padding: var(--space-6);
  max-width: 520px;
  width: 100%;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
  transform: translateY(16px) scale(0.97);
  opacity: 0;
  transition:
    transform 0.28s cubic-bezier(0.22, 1, 0.36, 1),
    opacity 0.22s ease;
  max-height: calc(100vh - 32px);
  overflow-y: auto;
}
.modal.is-shown .modal__panel {
  transform: translateY(0) scale(1);
  opacity: 1;
}

.modal__panel h3 {
  font-size: 22px;
  margin: 0 0 var(--space-4);
  color: var(--color-text-primary);
}
.modal__sub {
  color: var(--color-text-tertiary);
  font-size: 14px;
  margin: 0 0 var(--space-4);
  line-height: 1.55;
}

.modal__close {
  position: absolute;
  top: 12px;
  right: 12px;
  background: transparent;
  border: 0;
  color: var(--color-text-tertiary);
  cursor: pointer;
  width: 32px;
  height: 32px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background var(--t-fast), color var(--t-fast);
}
.modal__close:hover { background: var(--color-bg-quaternary); color: var(--color-text-primary); }

.modal__tabs {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--color-border);
  margin-bottom: var(--space-5);
}
.modal__tabs button[role="tab"] {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  background: transparent;
  border: 0;
  color: var(--color-text-tertiary);
  font: inherit;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  position: relative;
  transition: color var(--t-fast);
}
.modal__tabs button[role="tab"]:hover { color: var(--color-text-secondary); }
.modal__tabs button[role="tab"][aria-selected="true"] { color: var(--color-text-primary); }
.modal__tabs button[role="tab"][aria-selected="true"]::after {
  content: '';
  position: absolute;
  left: 8px;
  right: 8px;
  bottom: -1px;
  height: 2px;
  background: var(--color-text-primary);
  border-radius: 2px;
}

.modal__actions {
  display: flex;
  gap: var(--space-3);
  justify-content: flex-end;
  margin-top: var(--space-5);
}
.btn--block { width: 100%; }

/* Notify-form layout (per spec) */
.notify-form {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}
.notify-form > label {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  font-size: 13px;
}
.notify-form > label > span:first-child {
  color: var(--color-text-tertiary);
  text-transform: uppercase;
  font-size: 11px;
  letter-spacing: 0.06em;
  font-weight: 500;
}
.notify-form input,
.notify-form textarea {
  background: var(--color-bg-secondary);
  border: 1px solid var(--color-border-strong);
  border-radius: var(--radius-md);
  padding: 10px 12px;
  color: var(--color-text-primary);
  font-size: 14px;
  font-family: inherit;
  outline: none;
  transition: border-color var(--t-fast), box-shadow var(--t-fast);
}
.notify-form input::placeholder,
.notify-form textarea::placeholder { color: var(--color-text-muted); }
.notify-form input:focus,
.notify-form textarea:focus {
  border-color: var(--color-brand-primary);
  box-shadow: 0 0 0 2px rgba(232, 57, 14, 0.2);
}
.notify-form input.is-invalid,
.notify-form textarea.is-invalid {
  border-color: var(--color-error);
  box-shadow: 0 0 0 2px rgba(231, 76, 60, 0.12);
}

/* iOS focus-zoom fix — fonts < 16px trigger zoom-on-focus on mobile Safari */
@media (max-width: 640px) {
  .notify-form input,
  .notify-form textarea { font-size: 16px; }
}

/* Validation chip — visible red pill with leading error icon */
.notify-form .field-error {
  display: none;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 500;
  color: var(--color-error);
  margin-top: var(--space-2);
  padding: 6px 10px 6px 8px;
  background: rgba(231, 76, 60, 0.07);
  border: 1px solid rgba(231, 76, 60, 0.22);
  border-radius: var(--radius-sm);
  line-height: 1.35;
  width: max-content;
  max-width: 100%;
  animation: field-error-in 0.22s cubic-bezier(0.22, 1, 0.36, 1);
}
.notify-form .field-error.is-shown { display: inline-flex; }
.notify-form .field-error::before {
  content: '';
  width: 14px;
  height: 14px;
  background: currentColor;
  flex-shrink: 0;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 2a10 10 0 1 0 0 20 10 10 0 0 0 0-20zm-1 5h2v6h-2V7zm0 8h2v2h-2v-2z'/%3E%3C/svg%3E") center / contain no-repeat;
          mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 2a10 10 0 1 0 0 20 10 10 0 0 0 0-20zm-1 5h2v6h-2V7zm0 8h2v2h-2v-2z'/%3E%3C/svg%3E") center / contain no-repeat;
}

@keyframes field-error-in {
  from { opacity: 0; transform: translateY(-4px); }
  to   { opacity: 1; transform: translateY(0); }
}

@media (prefers-reduced-motion: reduce) {
  .notify-form input,
  .notify-form textarea { transition: none; }
  .notify-form .field-error { animation: none; }
}

/* Component checklist (sub-options of "Subscribe to specific components") */
.modal__components {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  padding: var(--space-3);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-bg-secondary);
  animation: fadeUp var(--t-fast) ease both;
}
.modal__components[hidden] { display: none; }
.modal__components label {
  display: inline-flex;
  align-items: center;
  gap: var(--space-3);
  font-size: 13.5px;
  color: var(--color-text-secondary);
  cursor: pointer;
}
.modal__components label[data-depth="1"] { padding-left: var(--space-4); color: var(--color-text-tertiary); }

/* Megaphone helper + success card */
.modal__helper {
  display: flex;
  gap: var(--space-3);
  align-items: flex-start;
  padding: var(--space-3) var(--space-4);
  background: var(--color-bg-secondary);
  border-radius: var(--radius-md);
  color: var(--color-text-secondary);
  font-size: 13px;
  line-height: 1.55;
}
.modal__helper svg { flex: 0 0 auto; color: var(--color-text-tertiary); margin-top: 1px; }

/* Component-tree dropdown inside "Subscribe to specific components" */
.modal__components {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: var(--space-3) var(--space-3);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-bg-secondary);
  animation: fadeUp var(--t-fast) ease both;
}
.modal__components[hidden] { display: none; }

.component-tree__heading {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--color-text-muted);
  margin: 2px 4px 6px;
}

.component-row {
  display: flex;
  flex-direction: column;
}
.component-row__head {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: 6px 4px;
  border-radius: 6px;
  transition: background var(--t-fast);
}
.component-row__head:hover { background: var(--color-bg-tertiary); }
.component-row__head > label.check {
  flex: 0 1 auto;
  min-width: 0;
}
.component-row__head > label.check > span:not(.field-error) {
  flex: 0 0 auto;
  color: var(--color-text-primary);
  font-weight: 500;
}
.component-row__count {
  color: var(--color-text-tertiary);
  font-size: 13px;
}
.component-row__toggle {
  margin-left: auto;
  background: transparent;
  border: 0;
  color: var(--color-text-tertiary);
  cursor: pointer;
  width: 24px;
  height: 24px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  transition: color var(--t-fast), background var(--t-fast), transform var(--t-fast);
}
.component-row__toggle:hover { color: var(--color-text-primary); background: var(--color-bg-tertiary); }
.component-row[data-open="true"] .component-row__toggle { transform: rotate(180deg); }

.component-children {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 4px 4px 8px 30px;
  animation: fadeUp var(--t-fast) ease both;
}
.component-children[hidden] { display: none; }
.component-children label.check > span:not(.field-error) { font-weight: 400; color: var(--color-text-secondary); }

/* RSS feed URL row */
.modal__rss-url {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 4px 4px 12px;
  background: var(--color-bg-secondary);
  border: 1px solid var(--color-border-strong);
  border-radius: var(--radius-md);
}
.modal__rss-url input {
  flex: 1;
  background: transparent;
  border: 0;
  outline: 0;
  color: var(--color-text-primary);
  font-family: 'JetBrains Mono', monospace;
  font-size: 13px;
  padding: 6px 0;
  min-width: 0;
}
.modal__rss-url button {
  background: var(--color-bg-tertiary);
  border: 1px solid var(--color-border-strong);
  color: var(--color-text-secondary);
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 12.5px;
  font-weight: 500;
  cursor: pointer;
  transition: background var(--t-fast), color var(--t-fast), border-color var(--t-fast);
}
.modal__rss-url button:hover { background: var(--color-bg-quaternary); color: var(--color-text-primary); }
.modal__rss-url button.is-copied {
  background: rgba(39, 174, 96, 0.12);
  color: var(--color-success);
  border-color: rgba(39, 174, 96, 0.35);
}

/* Custom checkbox — per docs/status-handoff-checkbox.md */
.notify-form label.check {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: var(--space-3);
  font-size: 13px;
  color: var(--color-text-secondary);
  line-height: 1.5;
  cursor: pointer;
}
.notify-form label.check > span:not(.field-error) {
  flex: 1;
  min-width: 0;
}
.notify-form label.check a {
  color: var(--color-brand-primary);
  text-decoration: underline;
}

.notify-form .check > input[type="checkbox"] {
  appearance: none;
  -webkit-appearance: none;
  box-sizing: border-box;
  width: 18px;
  height: 18px;
  min-width: 18px;
  min-height: 18px;
  padding: 0;
  margin: 0;
  border: 2px solid var(--color-border-strong);
  border-radius: 4px;
  background: transparent;
  cursor: pointer;
  flex: 0 0 18px;
  flex-shrink: 0;
  position: relative;
  vertical-align: middle;
  transition:
    border-color 0.15s ease,
    background-color 0.15s ease,
    box-shadow 0.15s ease;
}
.notify-form .check > input[type="checkbox"]:hover {
  border-color: var(--color-brand-primary);
}
.notify-form .check > input[type="checkbox"]:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(255, 122, 41, 0.25);
}
.notify-form .check > input[type="checkbox"]:checked {
  background: var(--color-brand-primary);
  border-color: var(--color-brand-primary);
}
.notify-form .check > input[type="checkbox"]:checked::after {
  content: "";
  position: absolute;
  left: 4px;
  top: 1px;
  width: 4px;
  height: 8px;
  border: solid #fff;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}
.notify-form .check.is-invalid > input[type="checkbox"] {
  border-color: var(--color-error);
  box-shadow: 0 0 0 3px rgba(231, 76, 60, 0.18);
}
.notify-form .check.is-invalid > input[type="checkbox"]:checked {
  background: var(--color-error);
  border-color: var(--color-error);
}
/* On a label.check the red border alone is the visual signal — the
   chip stays in DOM for screen readers only. */
.notify-form label.check .field-error {
  display: inline-block;
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
  background: transparent;
  animation: none;
}
.notify-form label.check .field-error::before { content: none; }

@media (prefers-reduced-motion: reduce) {
  .modal,
  .modal__panel {
    transition: opacity 0.15s ease;
  }
  .modal__panel,
  .modal.is-shown .modal__panel {
    transform: none;
  }
  .notify-form .check > input[type="checkbox"] { transition: none; }
}

/* Toast notification (per docs/status-handoff-toast.md) */
.toast {
  position: fixed;
  bottom: var(--space-5);
  right: var(--space-5);
  z-index: 250;
  min-width: 300px;
  max-width: 380px;
  background: var(--color-bg-tertiary);
  border: 1px solid var(--color-border-strong);
  border-left: 3px solid var(--color-success);
  border-radius: var(--radius-lg);
  padding: var(--space-4) var(--space-5);
  display: flex;
  gap: var(--space-3);
  align-items: flex-start;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.6);
  transform: translateX(120%);
  opacity: 0;
  transition:
    transform 0.45s cubic-bezier(0.22, 1, 0.36, 1),
    opacity 0.3s ease;
}
.toast.is-shown {
  transform: translateX(0);
  opacity: 1;
}
.toast--error { border-left-color: var(--color-error); }
.toast--error .toast__icon { color: var(--color-error); }
.toast--warning { border-left-color: var(--color-warning); }
.toast--warning .toast__icon { color: var(--color-warning); }

.toast__icon {
  color: var(--color-success);
  flex-shrink: 0;
  margin-top: 1px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.toast__icon svg { display: block; }

.toast__body { flex: 1; min-width: 0; }
.toast__body strong {
  display: block;
  color: var(--color-text-primary);
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 2px;
}
.toast__body p {
  font-size: 12px;
  color: var(--color-text-tertiary);
  line-height: 1.5;
  margin: 0;
}

.toast__close {
  background: transparent;
  border: none;
  color: var(--color-text-muted);
  cursor: pointer;
  width: 24px;
  height: 24px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color var(--t-fast), background var(--t-fast);
  flex-shrink: 0;
}
.toast__close:hover {
  color: var(--color-text-primary);
  background: var(--color-bg-quaternary);
}

[dir="rtl"] .toast {
  right: auto;
  left: var(--space-5);
  transform: translateX(-120%);
}
[dir="rtl"] .toast.is-shown { transform: translateX(0); }

@media (prefers-reduced-motion: reduce) {
  .toast { transition: opacity 0.2s ease; transform: none; }
  .toast.is-shown { transform: none; }
}

@media (max-width: 640px) {
  .toast {
    left: var(--space-3);
    right: var(--space-3);
    bottom: var(--space-3);
    min-width: auto;
    max-width: none;
  }
}

/* Responsive */
@media (max-width: 640px) {
  .brand-logo { height: 22px; }
  .btn { padding: 7px 12px; font-size: 12.5px; }
  .main { padding: 40px 16px 40px; }
  .container { padding: 0 14px; }
  .page-head { margin-bottom: 16px; }
  .service-group-head { flex-wrap: wrap; }
  .card-head { flex-wrap: wrap; gap: 10px; }
  .head-actions { gap: 6px; }
  .lang-menu__trigger { padding: 5px 8px; gap: 4px; }
  /* Drop the globe glyph — the EN code + caret is enough on a phone. */
  .lang-menu__icon { display: none; }
  /* Collapse Subscribe to a square icon-only button; the bell glyph
     plus aria-label carry the meaning. */
  #subscribe-btn { padding: 0; width: 36px; height: 36px; }
  #subscribe-btn .btn-icon { display: block; }
  #subscribe-btn .btn-label { display: none; }
  /* On phones the row collapses to dot + name + chevron — the per-day
     bar, uptime %, info pill, and component count are too dense to
     read at this width. */
  .uptime-bar,
  .service-uptime,
  .service-info,
  .service-component-count,
  .period-switch { display: none; }
}
