:root {
  --bg: var(--tg-theme-bg-color, #ffffff);
  --bg2: var(--tg-theme-secondary-bg-color, #f2f2f7);
  --text: var(--tg-theme-text-color, #111111);
  --hint: var(--tg-theme-hint-color, #8a8a8e);
  --accent: var(--tg-theme-button-color, #6c4cf1);
  --accent-text: var(--tg-theme-button-text-color, #ffffff);
  --danger: var(--tg-theme-destructive-text-color, #e5484d);
  --ok: #2f9e44;
  --radius: 12px;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; background: var(--bg2); color: var(--text); font: 15px/1.45 -apple-system, system-ui, "Segoe UI", Roboto, sans-serif; }
body { padding-bottom: calc(72px + env(safe-area-inset-bottom)); }
button { font: inherit; color: inherit; cursor: pointer; }
.top { display: flex; justify-content: space-between; align-items: center; padding: 12px 16px; background: var(--bg); }
.brand { font-weight: 700; font-size: 18px; letter-spacing: -.01em; }
.chip { border: 1px solid var(--hint); background: none; border-radius: 999px; padding: 4px 12px; font-size: 13px; }
main { padding: 12px 16px; }
.tab { display: none; }
.tab.active { display: block; }

.accfilter { display: flex; gap: 10px; overflow-x: auto; padding: 2px 2px 12px; margin: 0 -2px; scrollbar-width: none; }
.accfilter::-webkit-scrollbar { display: none; }
.af { flex: 0 0 auto; border: none; background: none; display: flex; flex-direction: column; align-items: center; gap: 4px; width: 60px; padding: 0; }
.af .av { position: relative; width: 48px; height: 48px; border-radius: 50%; background: var(--bg); display: grid; place-items: center; font-size: 20px; outline: 2px solid transparent; outline-offset: 2px; }
.af .av img { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; }
.af .av .badge { position: absolute; right: -2px; bottom: -2px; width: 18px; height: 18px; border-radius: 50%; font-size: 10px; display: grid; place-items: center; background: var(--bg); }
.af small { font-size: 11px; color: var(--hint); max-width: 60px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.af.on .av { outline-color: var(--accent); }
.af.on small { color: var(--accent); font-weight: 600; }
.weekbar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; font-weight: 600; }
.icon { border: none; background: var(--bg); border-radius: 50%; width: 36px; height: 36px; font-size: 22px; line-height: 1; }
.days { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; margin-bottom: 14px; }
.day { background: var(--bg); border: none; border-radius: 10px; padding: 8px 0; display: flex; flex-direction: column; align-items: center; gap: 2px; }
.day small { color: var(--hint); font-size: 11px; }
.day b { font-size: 16px; }
.day i { width: 6px; height: 6px; border-radius: 50%; background: transparent; }
.day i.has { background: var(--accent); }
.day.on { background: var(--accent); color: var(--accent-text); }
.day.on small { color: var(--accent-text); opacity: .8; }
.day.on i.has { background: var(--accent-text); }

.list { display: flex; flex-direction: column; gap: 8px; }
.card { background: var(--bg); border-radius: var(--radius); padding: 12px 14px; }
.post .row { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.post .time { font-weight: 700; }
.post .text { margin: 6px 0; white-space: pre-wrap; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; }
.tags { display: flex; flex-wrap: wrap; gap: 4px; }
.tag { font-size: 12px; background: var(--bg2); border-radius: 6px; padding: 2px 8px; }
.tag.published { color: var(--ok); }
.tag.error { color: var(--danger); }
.empty { text-align: center; color: var(--hint); padding: 28px 0; }
.link { background: none; border: none; color: var(--danger); font-size: 13px; padding: 0; }

.field { display: block; margin-bottom: 14px; }
.field > span { display: block; font-size: 13px; color: var(--hint); margin-bottom: 6px; }
textarea, input[type=datetime-local] { width: 100%; border: none; border-radius: var(--radius); background: var(--bg); color: var(--text); padding: 10px 12px; font: inherit; }
textarea { resize: vertical; }
.upload { display: inline-block; background: var(--bg); border-radius: var(--radius); padding: 10px 14px; color: var(--accent); font-weight: 600; cursor: pointer; }
.media { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.thumb { position: relative; width: 76px; height: 76px; border-radius: 10px; overflow: hidden; background: var(--bg); }
.thumb img, .thumb video { width: 100%; height: 100%; object-fit: cover; }
.thumb .bar { position: absolute; left: 0; bottom: 0; height: 4px; background: var(--accent); transition: width .2s; }
.thumb .x { position: absolute; top: 2px; right: 2px; border: none; background: rgba(0,0,0,.55); color: #fff; border-radius: 50%; width: 22px; height: 22px; font-size: 13px; }
.thumb.fail { outline: 2px solid var(--danger); }

.pick { display: flex; flex-direction: column; gap: 6px; }
.pick label { display: flex; align-items: center; gap: 10px; background: var(--bg); border-radius: var(--radius); padding: 10px 12px; }
.pick input { width: 18px; height: 18px; accent-color: var(--accent); }
.seg { display: flex; background: var(--bg); border-radius: var(--radius); padding: 3px; gap: 3px; }
.seg button { flex: 1; border: none; background: none; border-radius: 9px; padding: 8px 0; }
.seg button.on { background: var(--accent); color: var(--accent-text); font-weight: 600; }
.quick { display: flex; gap: 6px; flex-wrap: wrap; margin: -6px 0 14px; }
.quick button { border: none; background: var(--bg); border-radius: 999px; padding: 6px 12px; font-size: 13px; }

.primary, .secondary { display: block; width: 100%; border: none; border-radius: var(--radius); padding: 13px; font-weight: 600; margin: 10px 0 6px; }
.primary { background: var(--accent); color: var(--accent-text); }
.secondary { background: var(--bg); color: var(--accent); }
.primary:disabled { opacity: .5; }
.error { color: var(--danger); font-size: 14px; }
.muted { color: var(--hint); }
.small { font-size: 13px; margin: 0 0 10px; }
.center { text-align: center; margin-top: 6px; }

.acc { display: flex; align-items: center; gap: 10px; }
.acc img, .acc .ph { width: 36px; height: 36px; border-radius: 50%; background: var(--bg2); object-fit: cover; display: grid; place-items: center; font-size: 18px; }
.acc .nm { flex: 1; }
.acc .nm small { display: block; color: var(--hint); font-size: 12px; }

.meter { margin: 8px 0; }
.meter .lbl { display: flex; justify-content: space-between; font-size: 13px; }
.meter .trk { height: 6px; background: var(--bg2); border-radius: 3px; margin-top: 4px; overflow: hidden; }
.meter .fill { height: 100%; background: var(--accent); }
.plans { display: flex; flex-direction: column; gap: 10px; margin-top: 10px; }
.plan h3 { margin: 0; font-size: 17px; }
.plan .price { font-size: 20px; font-weight: 700; margin: 4px 0; }
.plan ul { margin: 6px 0 10px; padding-left: 18px; color: var(--hint); font-size: 14px; }
.plan.current { outline: 2px solid var(--accent); }
.plan .btns { display: flex; gap: 8px; }
.plan .btns button { flex: 1; margin: 0; }
.plan .secondary { background: var(--bg2); }

.bottom { position: fixed; bottom: 0; left: 0; right: 0; display: grid; grid-template-columns: repeat(4, 1fr); background: var(--bg); border-top: 1px solid var(--bg2); padding-bottom: env(safe-area-inset-bottom); }
.bottom button { border: none; background: none; padding: 8px 0 10px; display: flex; flex-direction: column; align-items: center; gap: 2px; color: var(--hint); font-size: 11px; }
.bottom button b { font-size: 20px; font-weight: 400; }
.bottom button.on { color: var(--accent); }
.toast { position: fixed; left: 16px; right: 16px; bottom: calc(84px + env(safe-area-inset-bottom)); background: var(--text); color: var(--bg); border-radius: var(--radius); padding: 12px 14px; font-size: 14px; z-index: 5; }
