.app {
  max-width: 640px;
  margin: 0 auto;
  padding: max(var(--gap), env(safe-area-inset-top)) var(--gap) max(var(--gap), env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  gap: var(--gap);
  min-height: 100vh;
  min-height: 100dvh;
  box-sizing: border-box;
}

.hidden { display: none !important; }

/* === Card === */
.card {
  background: var(--tg-theme-section-bg-color);
  border-radius: var(--radius-card);
  padding: 16px;
}
.card-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--tg-theme-section-header-text-color);
  margin-bottom: 10px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.card-header { display: flex; justify-content: space-between; align-items: center; }
.icon-btn {
  background: transparent;
  color: var(--tg-theme-hint-color);
  padding: 4px 8px;
  font-size: 16px;
}

/* === Status card === */
.status-card {
  text-align: center;
  padding: 28px 16px;
  background: var(--tg-theme-section-bg-color);
  transition: background-color .3s ease;
}
.status-card[data-state="up"] { background: linear-gradient(135deg, #1d4d2b, #2ea043); }
.status-card[data-state="down"] { background: linear-gradient(135deg, #5a1a16, #f04438); }
.status-card[data-state="warn"] { background: linear-gradient(135deg, #5a3f0a, #f0b400); }
.status-icon { font-size: 48px; margin-bottom: 8px; }
.status-title { font-size: 22px; font-weight: 700; }
.status-subtitle { font-size: 13px; color: rgba(255,255,255,.85); margin-top: 4px; }

/* === Incident === */
.incident-card { border-left: 3px solid var(--color-err); }
.incident-body { font-size: 14px; line-height: 1.5; }
.incident-body strong { color: var(--color-err); }

/* === Metrics === */
.metric-row {
  display: flex;
  justify-content: space-between;
  padding: 6px 0;
  font-size: 14px;
}
.metric-label { color: var(--tg-theme-hint-color); }
.metric-value { font-weight: 600; }

.disks { margin-top: 12px; display: flex; flex-direction: column; gap: 10px; }
.disk {
  font-size: 13px;
}
.disk-header {
  display: flex;
  justify-content: space-between;
  margin-bottom: 4px;
}
.disk-mount { color: var(--tg-theme-text-color); font-weight: 500; font-family: monospace; }
.disk-info { color: var(--tg-theme-hint-color); }
.disk-bar {
  height: 6px;
  background: var(--tg-theme-secondary-bg-color);
  border-radius: 3px;
  overflow: hidden;
}
.disk-fill {
  height: 100%;
  background: var(--color-ok);
  transition: width .3s ease;
}
.disk-fill.warn { background: var(--color-warn); }
.disk-fill.err { background: var(--color-err); }

/* === Containers === */
.containers-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 4px;
}
.container-chip {
  font-size: 12px;
  padding: 5px 10px;
  border-radius: 100px;
  background: var(--tg-theme-secondary-bg-color);
  color: var(--tg-theme-text-color);
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.container-chip.up::before { content: "🟢"; }
.container-chip.down::before { content: "🔴"; }
.badge {
  display: inline-block;
  background: var(--tg-theme-secondary-bg-color);
  color: var(--tg-theme-hint-color);
  padding: 2px 8px;
  border-radius: 100px;
  font-size: 11px;
  font-weight: 600;
  margin-left: 6px;
  text-transform: none;
  letter-spacing: 0;
}

/* === Diagnostic === */
.diag-block { margin-bottom: 10px; }
.diag-row {
  display: flex;
  justify-content: space-between;
  padding: 6px 0;
  border-bottom: 1px solid var(--tg-theme-secondary-bg-color);
}
.diag-row:last-of-type { border-bottom: none; }
.status-dot {
  font-family: monospace;
  font-weight: 700;
}
.status-dot.ok { color: var(--color-ok); }
.status-dot.err { color: var(--color-err); }
.status-dot.warn { color: var(--color-warn); }
.diag-verdict {
  margin-top: 12px;
  padding: 10px;
  background: var(--tg-theme-secondary-bg-color);
  border-radius: 8px;
  font-size: 14px;
  line-height: 1.5;
}
.diag-verdict.recommend { border-left: 3px solid var(--color-warn); }

/* === Actions === */
.actions-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.action-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 14px 10px;
  background: var(--tg-theme-secondary-bg-color);
  color: var(--tg-theme-text-color);
  font-size: 13px;
  text-align: center;
  min-height: 80px;
}
.action-icon { font-size: 22px; }
.action-label { line-height: 1.3; }
.btn-warning {
  background: linear-gradient(135deg, #b54708, #f0b400);
  color: #fff;
}

/* === Settings === */
details summary {
  cursor: pointer;
  list-style: none;
}
details summary::-webkit-details-marker { display: none; }
details summary::after { content: "▾"; float: right; }
details[open] summary::after { content: "▴"; }
.settings-block { margin-top: 12px; }
.setting-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 0;
  gap: 8px;
}
.seg-control {
  display: inline-flex;
  background: var(--tg-theme-secondary-bg-color);
  border-radius: 8px;
  overflow: hidden;
}
.seg-btn {
  background: transparent;
  color: var(--tg-theme-hint-color);
  padding: 6px 10px;
  font-size: 13px;
  border-radius: 0;
}
.seg-btn.active {
  background: var(--tg-theme-button-color);
  color: var(--tg-theme-button-text-color);
}
.hint { font-size: 12px; color: var(--tg-theme-hint-color); }

/* === Incidents list === */
.incident-item {
  padding: 10px 0;
  border-bottom: 1px solid var(--tg-theme-secondary-bg-color);
  font-size: 13px;
}
.incident-item:last-child { border-bottom: none; }
.incident-when { color: var(--tg-theme-hint-color); }
.incident-duration { font-weight: 600; }
.empty-state {
  text-align: center;
  color: var(--tg-theme-hint-color);
  padding: 16px;
  font-size: 13px;
}

/* === Buttons === */
.btn {
  display: inline-block;
  font-size: 14px;
}
.btn-secondary {
  background: var(--tg-theme-secondary-bg-color);
  color: var(--tg-theme-text-color);
  width: 100%;
}
.btn-primary { background: var(--tg-theme-button-color); }

/* === Toast === */
.toast {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0,0,0,.85);
  color: #fff;
  padding: 10px 16px;
  border-radius: 10px;
  font-size: 13px;
  max-width: 90%;
  z-index: 100;
  opacity: 0;
  transition: opacity .25s ease;
}
.toast.show { opacity: 1; }
.toast.err { background: var(--color-err); }
.toast.ok { background: var(--color-ok); }

/* === Modal === */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
  padding: 20px;
}
.modal-content {
  background: var(--tg-theme-section-bg-color);
  border-radius: var(--radius-card);
  padding: 20px;
  max-width: 400px;
  width: 100%;
}
.modal-title { font-size: 16px; font-weight: 600; margin-bottom: 10px; }
.modal-body { font-size: 14px; color: var(--tg-theme-hint-color); margin-bottom: 16px; }
.modal-actions { display: flex; gap: 8px; }
.modal-actions .btn { flex: 1; }

.footer {
  text-align: center;
  font-size: 11px;
  color: var(--tg-theme-hint-color);
  padding: 8px 0;
}
