
:root {
  --bg: var(--tg-theme-bg-color, #f6f3ee);
  --bg2: var(--tg-theme-secondary-bg-color, #fffdf8);
  --fg: var(--tg-theme-text-color, #1c1915);
  --hint: var(--tg-theme-hint-color, #6f675e);
  --link: var(--tg-theme-link-color, #8a4b08);
  --btn: var(--tg-theme-button-color, #8a4b08);
  --btn-fg: var(--tg-theme-button-text-color, #fffaf3);
  --sep: color-mix(in srgb, var(--hint) 28%, transparent);
  --safe-b: env(safe-area-inset-bottom, 0px);
  color-scheme: light dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font: 16px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--fg);
  min-height: 100dvh;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
.hidden { display: none !important; }

.top, main { width: min(720px, 100%); margin-inline: auto; }
.top {
  position: sticky;
  top: 0;
  z-index: 3;
  padding: calc(10px + env(safe-area-inset-top, 0px)) 14px 10px;
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--sep);
}
.brand { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.eyebrow { margin: 0; font-size: 12px; letter-spacing: .08em; text-transform: uppercase; color: var(--hint); }
h1 { margin: 0; font-size: 22px; font-weight: 700; letter-spacing: -0.02em; }
.quiet { margin: 6px 0 10px; color: var(--hint); font-size: 13px; }
.ghost, .seg button, .chip-btn {
  border: 1px solid var(--sep);
  background: var(--bg2);
  border-radius: 999px;
  min-height: 36px;
  padding: 0 12px;
}
.ghost { min-height: 40px; }
.seg { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 2px; }
.seg button { flex: 0 0 auto; color: var(--hint); }
.seg button.on { background: var(--btn); color: var(--btn-fg); border-color: transparent; }
.seg.status { margin-top: 8px; }
.seg .n { opacity: .75; font-weight: 600; margin-left: 4px; }

#feed, #detail { padding: 12px 14px calc(28px + var(--safe-b)); }
.filters { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.filters label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--hint); }
.filters .wide { grid-column: 1 / -1; }
select, input, textarea {
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  border: 1px solid var(--sep);
  border-radius: 12px;
  background: var(--bg2);
}
textarea { min-height: 120px; line-height: 1.45; resize: vertical; }
.count { margin: 10px 2px; color: var(--hint); font-size: 13px; }

.list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.card {
  text-align: left;
  width: 100%;
  border: 1px solid var(--sep);
  background: var(--bg2);
  border-radius: 16px;
  padding: 12px 12px 12px 14px;
  border-left: 4px solid var(--btn);
}
.card[data-s="da_tra_loi"] { border-left-color: #2f7d4a; }
.card[data-s="sua"] { border-left-color: #c2410c; }
.card[data-s="bo"] { border-left-color: #8a8178; }
.card .meta, .sub { color: var(--hint); font-size: 13px; }
.card .meta { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; }
.card h2 { margin: 6px 0 0; font-size: 16px; font-weight: 600; letter-spacing: -0.01em; }
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.tag { font-size: 12px; padding: 3px 8px; border-radius: 999px; background: var(--bg); color: var(--hint); }
.badge { font-size: 12px; font-weight: 700; white-space: nowrap; }
.badge[data-s="moi"] { color: #8a4b08; }
.badge[data-s="da_tra_loi"] { color: #1f7a3a; }
.badge[data-s="sua"] { color: #c2410c; }
.badge[data-s="bo"] { color: var(--hint); }

.panel {
  background: var(--bg2);
  border: 1px solid var(--sep);
  border-radius: 16px;
  padding: 12px;
  margin-bottom: 10px;
}
.panel h3 { margin: 0 0 8px; font-size: 12px; letter-spacing: .06em; text-transform: uppercase; color: var(--hint); }
.question { margin: 0; white-space: pre-wrap; word-break: break-word; }
.k { font-size: 12px; color: var(--hint); margin-bottom: 4px; }
.warn { margin: 8px 0 0; font-size: 13px; color: #8a4b08; }
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { padding: 8px 0; border-top: 1px solid var(--sep); font-size: 14px; }
.timeline .when { color: var(--hint); font-size: 12px; }
.empty { text-align: center; color: var(--hint); padding: 36px 12px; }
.banner {
  margin: 0 0 10px;
  padding: 10px 12px;
  border-radius: 12px;
  background: color-mix(in srgb, var(--btn) 12%, var(--bg2));
  font-size: 13px;
}

.dock {
  position: sticky;
  bottom: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 0 -14px;
  padding: 10px 14px calc(10px + var(--safe-b));
  background: color-mix(in srgb, var(--bg) 94%, transparent);
  backdrop-filter: blur(10px);
  border-top: 1px solid var(--sep);
}
.row { display: flex; gap: 8px; }
.row > * { flex: 1; }
.btn {
  min-height: 48px;
  border-radius: 12px;
  border: 1px solid var(--sep);
  background: var(--bg2);
  font-weight: 700;
}
.btn.primary { background: var(--btn); color: var(--btn-fg); border-color: transparent; }
.btn.link { display: flex; align-items: center; justify-content: center; text-decoration: none; color: var(--fg); }
.btn:disabled { opacity: .45; }
.undo { background: none; border: 0; color: var(--link); min-height: 44px; padding: 0; font-weight: 600; }

.toast {
  position: fixed;
  left: 50%;
  right: auto;
  transform: translateX(-50%);
  width: min(692px, calc(100% - 28px));
  bottom: calc(16px + var(--safe-b));
  background: var(--fg); color: var(--bg);
  border-radius: 12px;
  padding: 12px 14px;
  text-align: center;
  z-index: 5;
}


