:root {
  --bg: var(--tg-theme-bg-color, #1a1a2e);
  --bg2: var(--tg-theme-secondary-bg-color, #16213e);
  --text: var(--tg-theme-text-color, #e0e0e0);
  --hint: var(--tg-theme-hint-color, #8a8a9a);
  --link: var(--tg-theme-link-color, #4fc3f7);
  --btn: var(--tg-theme-button-color, #0a84ff);
  --btn-text: var(--tg-theme-button-text-color, #fff);
  --card: rgba(255,255,255,0.05);
  --border: rgba(255,255,255,0.08);
  --green: #4caf50;
  --red: #ef5350;
  --yellow: #ffc107;
}
* { margin:0; padding:0; box-sizing:border-box; }
body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  overflow-x: hidden;
}
#app { display:flex; flex-direction:column; min-height:100vh; }
header {
  padding: 16px 20px 12px;
  display: flex; align-items: baseline; gap: 10px;
  border-bottom: 1px solid var(--border);
}
header h1 { font-size: 20px; font-weight: 700; }
#header-sub { font-size: 13px; color: var(--hint); }
#content {
  flex: 1; padding: 16px; overflow-y: auto;
  padding-bottom: 20px;
}
/* Dropdown navigation */
#nav-bar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 20px;
  background: var(--bg2);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 100;
}
#nav-current {
  font-size: 16px; font-weight: 600; cursor: pointer;
  display: flex; align-items: center; gap: 8px;
  padding: 8px 16px;
  border-radius: 10px;
  background: var(--card);
  border: 1px solid var(--border);
  -webkit-tap-highlight-color: transparent;
}
#nav-current::after {
  content: '▼'; font-size: 10px; color: var(--hint);
  transition: transform 0.2s;
}
#nav-current.open::after { transform: rotate(180deg); }
#nav-dropdown {
  display: none; position: absolute; top: 100%; left: 20px; right: 20px;
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: 12px; margin-top: 4px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.4);
  overflow: hidden; z-index: 200;
}
#nav-dropdown.show { display: block; }
.nav-item {
  padding: 14px 20px; font-size: 15px; cursor: pointer;
  display: flex; align-items: center; gap: 12px;
  border-bottom: 1px solid var(--border);
  -webkit-tap-highlight-color: transparent;
  transition: background 0.15s;
}
.nav-item:last-child { border-bottom: none; }
.nav-item:active { background: var(--card); }
.nav-item.active { color: var(--link); font-weight: 600; }
#nav-overlay {
  display: none; position: fixed; top: 0; left: 0; right: 0; bottom: 0;
  z-index: 150;
}
#nav-overlay.show { display: block; }

.card {
  background: var(--card); border: 1px solid var(--border);
  border-radius: 12px; padding: 16px; margin-bottom: 12px;
}
.card h3 { font-size: 14px; color: var(--hint); margin-bottom: 8px; text-transform: uppercase; letter-spacing: 0.5px; }
.stat { font-size: 28px; font-weight: 700; }
.stat-sm { font-size: 16px; font-weight: 600; }
.stat-label { font-size: 12px; color: var(--hint); margin-top: 2px; }
.row { display: flex; gap: 12px; }
.row > * { flex: 1; }

.progress-bar {
  height: 6px; background: var(--border); border-radius: 3px; margin-top: 8px; overflow: hidden;
}
.progress-fill { height: 100%; border-radius: 3px; transition: width 0.5s; }

.badge {
  display: inline-block; padding: 2px 8px; border-radius: 10px;
  font-size: 11px; font-weight: 600;
}
.badge-ok { background: rgba(76,175,80,0.2); color: var(--green); }
.badge-warn { background: rgba(255,193,7,0.2); color: var(--yellow); }
.badge-err { background: rgba(239,83,80,0.2); color: var(--red); }

.list-item {
  padding: 12px 0; border-bottom: 1px solid var(--border);
  display: flex; justify-content: space-between; align-items: center;
}
.list-item:last-child { border-bottom: none; }
.list-item-title { font-size: 14px; font-weight: 500; }
.list-item-sub { font-size: 12px; color: var(--hint); margin-top: 2px; }

.md-content {
  font-size: 13px; line-height: 1.6; white-space: pre-wrap;
  font-family: 'SF Mono', Monaco, monospace;
  background: var(--bg2); border-radius: 8px; padding: 12px;
  max-height: 60vh; overflow-y: auto;
}
.btn {
  background: var(--btn); color: var(--btn-text);
  border: none; border-radius: 8px; padding: 8px 16px;
  font-size: 13px; cursor: pointer; font-weight: 600;
}
.btn-sm { padding: 4px 10px; font-size: 11px; border-radius: 6px; }
.btn-outline {
  background: none; border: 1px solid var(--border); color: var(--text);
}
.loader { text-align: center; padding: 40px; color: var(--hint); }

.whisper-item { padding: 10px 0; border-bottom: 1px solid var(--border); }
.whisper-text { font-size: 14px; }
.whisper-time { font-size: 11px; color: var(--hint); }

@media (min-width: 500px) {
  #content { max-width: 480px; margin: 0 auto; }
}
