/* Цвета берутся из темы Телеграма, поэтому приложение само подстраивается под светлую и тёмную тему.
   Свой фирменный цвет — в --accent. */
:root {
  --bg: var(--tg-theme-bg-color, #ffffff);
  --bg2: var(--tg-theme-secondary-bg-color, #f2f2f6);
  --text: var(--tg-theme-text-color, #16161a);
  --hint: var(--tg-theme-hint-color, #8a8a93);
  --accent: var(--tg-theme-button-color, #e8743b);
  --accent-text: var(--tg-theme-button-text-color, #ffffff);
  --danger: var(--tg-theme-destructive-text-color, #d93a3a);
  --radius: 18px;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--bg2); color: var(--text);
  font: 16px/1.4 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; }
main { padding: 16px 16px 96px; max-width: 560px; margin: 0 auto; min-height: 100vh; }
h1 { font-size: 26px; line-height: 1.2; margin: 8px 0 12px; }
h2 { font-size: 20px; margin: 20px 0 10px; }
p { margin: 0 0 12px; }
.hint { color: var(--hint); font-size: 14px; }
.loading { padding: 40vh 0; text-align: center; color: var(--hint); }

button, .btn { font: inherit; border: 0; cursor: pointer; border-radius: 14px; padding: 14px 18px;
  min-height: 48px; background: var(--bg); color: var(--text); }
.btn-primary { background: var(--accent); color: var(--accent-text); font-weight: 600; width: 100%; }
.btn-ghost { background: transparent; color: var(--accent); }
.btn-danger { background: transparent; color: var(--danger); }
.row { display: flex; gap: 10px; }
.row > * { flex: 1; }
.stack { display: flex; flex-direction: column; gap: 10px; }

.box { background: var(--bg); border-radius: var(--radius); padding: 16px; margin-bottom: 12px; }
.segmented { display: flex; background: var(--bg); border-radius: 14px; padding: 4px; margin-bottom: 16px; }
.segmented button { flex: 1; min-height: 40px; padding: 8px; background: transparent; border-radius: 10px; font-size: 15px; }
.segmented button.on { background: var(--accent); color: var(--accent-text); font-weight: 600; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { background: var(--bg); border: 1.5px solid transparent; border-radius: 999px; padding: 9px 14px;
  min-height: 40px; font-size: 15px; }
.chip.on { border-color: var(--accent); color: var(--accent); font-weight: 600; }
.chip small { color: var(--hint); font-weight: 400; }

/* карточка события со свайпом */
.deck { position: relative; height: min(62vh, 480px); margin-bottom: 16px; }
.card { position: absolute; inset: 0; background: var(--bg); border-radius: 24px; padding: 24px;
  display: flex; flex-direction: column; box-shadow: 0 6px 24px rgba(0,0,0,.08);
  touch-action: pan-y; user-select: none; transition: transform .25s ease, opacity .25s ease; }
.card.dragging { transition: none; }
.card .tag { align-self: flex-start; background: var(--bg2); border-radius: 999px; padding: 5px 12px;
  font-size: 13px; color: var(--hint); margin-bottom: 14px; }
.card h1 { margin-top: 0; }
.card .meta { color: var(--hint); margin-bottom: 4px; }
.card .desc { margin-top: 14px; }
.card .foot { margin-top: auto; color: var(--hint); font-size: 14px; }
.stamp { position: absolute; top: 24px; font-weight: 800; font-size: 22px; padding: 4px 12px; border-radius: 10px;
  border: 3px solid; opacity: 0; transform: rotate(-12deg); }
.stamp.yes { right: 24px; color: var(--accent); }
.stamp.no { left: 24px; color: var(--hint); transform: rotate(12deg); }
.actions { display: flex; justify-content: center; gap: 24px; }
.round { width: 68px; height: 68px; border-radius: 50%; font-size: 26px; padding: 0;
  box-shadow: 0 4px 14px rgba(0,0,0,.08); }
.round.yes { background: var(--accent); color: var(--accent-text); }

.person .avatar { width: 64px; height: 64px; border-radius: 50%; background: var(--accent); color: var(--accent-text);
  display: grid; place-items: center; font-size: 28px; font-weight: 700; margin-bottom: 12px; }
.quote { font-style: italic; margin-top: 10px; }

.empty { text-align: center; padding: 40px 12px; }
.empty .big { font-size: 44px; margin-bottom: 8px; }

.meeting h3 { margin: 0 0 4px; font-size: 18px; }
.meeting .members { margin: 10px 0; }
.meeting .warn { background: var(--bg2); border-radius: 12px; padding: 10px 12px; font-size: 14px; margin: 10px 0; }
.meeting .row button { padding: 10px; min-height: 44px; font-size: 15px; background: var(--bg2); }

label { display: block; font-size: 14px; color: var(--hint); margin: 14px 0 6px; }
input, textarea, select { width: 100%; font: inherit; color: var(--text); background: var(--bg);
  border: 1.5px solid transparent; border-radius: 14px; padding: 13px 14px; min-height: 48px; }
input:focus, textarea:focus, select:focus { outline: none; border-color: var(--accent); }
textarea { resize: vertical; min-height: 80px; }
.counter { text-align: right; font-size: 12px; color: var(--hint); margin-top: 4px; }

.rules { margin: 0 0 14px; padding: 16px 16px 8px 40px; }
.rules li { margin-bottom: 8px; padding-left: 4px; }
.toggle { display: flex; justify-content: space-between; align-items: center; }

nav { position: fixed; left: 0; right: 0; bottom: 0; display: flex; background: var(--bg);
  border-top: 1px solid rgba(127,127,127,.15); padding: 6px 6px calc(6px + env(safe-area-inset-bottom)); }
nav button { flex: 1; background: transparent; display: flex; flex-direction: column; align-items: center;
  font-size: 12px; color: var(--hint); padding: 6px; min-height: 52px; border-radius: 12px; }
nav button .ico { font-size: 20px; line-height: 1.2; }
nav button.on { color: var(--accent); font-weight: 600; }

#toast { position: fixed; left: 16px; right: 16px; bottom: 90px; background: var(--text); color: var(--bg);
  padding: 12px 16px; border-radius: 14px; text-align: center; z-index: 20; max-width: 528px; margin: 0 auto; }
#sheet { position: fixed; inset: 0; background: rgba(0,0,0,.4); z-index: 10; display: flex; align-items: flex-end; }
#sheet .panel { background: var(--bg2); width: 100%; max-width: 560px; margin: 0 auto; border-radius: 22px 22px 0 0;
  padding: 20px 16px calc(20px + env(safe-area-inset-bottom)); max-height: 85vh; overflow: auto; }

[hidden] { display: none !important; }
