:root {
  color-scheme: light dark;
  --bg: var(--tg-theme-bg-color, #0f1419);
  --text: var(--tg-theme-text-color, #e7ecf3);
  --hint: var(--tg-theme-hint-color, #8b98a5);
  --button: var(--tg-theme-button-color, #2aabee);
  --button-text: var(--tg-theme-button-text-color, #ffffff);
  --secondary: var(--tg-theme-secondary-bg-color, #1c242d);
  --link: var(--tg-theme-link-color, #6ab3f3);
  --danger: #e25555;
  --radius: 14px;
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

#app {
  max-width: 560px;
  margin: 0 auto;
  padding: 12px 14px 28px;
}

.top {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 14px;
}

.top h1 {
  font-size: 1.15rem;
  margin: 0;
  font-weight: 650;
}

.ghost {
  border: 0;
  background: transparent;
  color: var(--link);
  font-size: 1.2rem;
  padding: 4px 8px;
  cursor: pointer;
}

.hidden {
  display: none !important;
}

.stack {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.btn {
  display: block;
  width: 100%;
  border: 0;
  border-radius: var(--radius);
  padding: 14px 16px;
  background: var(--button);
  color: var(--button-text);
  font-size: 1rem;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
}

.btn.secondary {
  background: var(--secondary);
  color: var(--text);
}

.btn.danger {
  background: color-mix(in srgb, var(--danger) 85%, black);
  color: #fff;
}

.btn:disabled {
  opacity: 0.55;
  cursor: default;
}

.card {
  background: var(--secondary);
  border-radius: var(--radius);
  padding: 14px;
}

.muted {
  color: var(--hint);
  font-size: 0.92rem;
  line-height: 1.4;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.field label {
  font-size: 0.85rem;
  color: var(--hint);
}

.field input {
  border: 1px solid color-mix(in srgb, var(--hint) 35%, transparent);
  background: var(--bg);
  color: var(--text);
  border-radius: 10px;
  padding: 12px;
  font-size: 1rem;
}

.kw-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 0;
  border-bottom: 1px solid color-mix(in srgb, var(--hint) 25%, transparent);
}

.kw-row:last-child {
  border-bottom: 0;
}

.news-item {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px 0;
  border-bottom: 1px solid color-mix(in srgb, var(--hint) 25%, transparent);
}

.news-item:last-child {
  border-bottom: 0;
}

.news-item a {
  color: var(--link);
  text-decoration: none;
  font-weight: 600;
  line-height: 1.35;
}

.row-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.chip {
  display: inline-block;
  font-size: 0.75rem;
  color: var(--hint);
  background: color-mix(in srgb, var(--bg) 70%, transparent);
  border-radius: 999px;
  padding: 3px 8px;
}

.toolbar {
  display: flex;
  gap: 8px;
  margin-bottom: 8px;
}

.toolbar .btn {
  text-align: center;
  padding: 10px 12px;
  font-size: 0.9rem;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 18px;
  transform: translateX(-50%);
  background: var(--secondary);
  color: var(--text);
  padding: 10px 14px;
  border-radius: 999px;
  font-size: 0.9rem;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
  z-index: 20;
  max-width: 90vw;
}
