/* Цвета — темы Telegram; фолбэк — светлая тема прототипа (открытие вне Telegram) */
:root {
  --bg: var(--tg-theme-bg-color, #ffffff);
  --secondary-bg: var(--tg-theme-secondary-bg-color, #f1f2f6);
  --text: var(--tg-theme-text-color, #000000);
  --hint: var(--tg-theme-hint-color, #8e8e93);
  --link: var(--tg-theme-link-color, #2481cc);
  --button: var(--tg-theme-button-color, #2481cc);
  --button-text: var(--tg-theme-button-text-color, #ffffff);
  --section-bg: var(--tg-theme-section-bg-color, #ffffff);
  --separator: var(--tg-theme-section-separator-color, #e3e3e8);
  --accent: var(--tg-theme-link-color, #2481cc);
  --destructive: var(--tg-theme-destructive-text-color, #e53935);
  --ok: #31b545;
  --coffee: #8b5a2b;
}
.dark { --coffee: #c08a5a; }  /* на тёмном фоне тёмно-коричневый теряется */
.c-coffee { color: var(--coffee); }
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; }
body { margin: 0; font: 15px/1.35 -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, sans-serif;
       background: var(--secondary-bg); color: var(--text); }
#app { height: 100%; display: flex; flex-direction: column; max-width: 640px; margin: 0 auto; }
.in-telegram .tg-header { display: none; }
.tg-header { background: var(--bg); padding: 14px 16px 10px; font-weight: 600; border-bottom: 1px solid var(--separator);
             display: flex; align-items: center; justify-content: center; gap: 10px; }
.avatar { width: 30px; height: 30px; border-radius: 50%; object-fit: cover; flex: none;
          background: var(--button); color: var(--button-text);
          display: flex; align-items: center; justify-content: center; }
main { flex: 1; overflow-y: auto; padding: 12px 0 20px; }
.screen { display: none; } .screen.active { display: block; }
.fatal { padding: 40px 24px; text-align: center; font-size: 17px; }
.section-title { color: var(--hint); font-size: 13px; text-transform: uppercase; letter-spacing: .02em; padding: 14px 20px 6px; }
.section { background: var(--section-bg); margin: 0 12px; border-radius: 12px; overflow: hidden; }
.row { display: flex; align-items: center; gap: 12px; padding: 12px 16px; min-height: 46px; border-bottom: 1px solid var(--separator); }
.row:last-child { border-bottom: none; }
.row .label { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.hint { color: var(--hint); font-size: 13px; padding: 6px 20px 0; }
.switch { width: 51px; height: 31px; border-radius: 16px; background: var(--separator); position: relative;
          cursor: pointer; flex: none; transition: background .2s; }
.switch::after { content: ""; position: absolute; top: 2px; left: 2px; width: 27px; height: 27px; border-radius: 50%;
                 background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.25); transition: left .2s; }
.switch.on { background: var(--ok); } .switch.on::after { left: 22px; }
.switch.disabled { opacity: .4; }
input.field { width: 100%; border: none; background: transparent; color: var(--text); font: inherit; outline: none; }
input.field.place { text-align: right; max-width: 55%; }
input.locked { cursor: pointer; caret-color: transparent; }
.suggest { border-top: 1px solid var(--separator); }
.suggest:empty { display: none; }
.suggest .row { color: var(--link); cursor: pointer; }
.suggest .row.own { color: var(--text); display: flex; align-items: center; gap: 8px; }
.tabs { display: flex; background: var(--bg); border-top: 1px solid var(--separator); padding-bottom: env(safe-area-inset-bottom); }
.tab { flex: 1; text-align: center; padding: 8px 0 12px; font-size: 11px; color: var(--hint); cursor: pointer; }
.tab .ico { display: flex; justify-content: center; margin-bottom: 2px; }
.tab.active { color: var(--accent); }
.meeting .who { font-weight: 500; display: flex; align-items: center; gap: 6px; overflow-wrap: anywhere; }
.meeting .who svg.i { color: var(--accent); }
.meeting .meta { color: var(--hint); font-size: 13px; }
.ava { width: 36px; height: 36px; border-radius: 50%; flex: none; display: flex; align-items: center; justify-content: center;
       color: #fff; font-weight: 600; font-size: 14px; overflow: hidden; }
.ava img { width: 100%; height: 100%; object-fit: cover; }
.main-button { margin: 14px 0 0; padding: 13px; text-align: center; border-radius: 10px;
               background: var(--button); color: var(--button-text); font-weight: 600; cursor: pointer; }
.ring-wrap { display: flex; flex-direction: column; align-items: center; padding: 22px 0 18px; }
.ring { position: relative; width: 160px; height: 160px; }
.ring svg { transform: rotate(-90deg); }
.ring .num { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.ring .num b { font-size: 38px; font-weight: 700; }
.ring .num span { color: var(--hint); font-size: 13px; }
.tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 0 12px; }
.tile { background: var(--section-bg); border-radius: 12px; padding: 12px 14px; }
.tile b { font-size: 24px; display: flex; align-items: center; gap: 8px; }
.tile span { color: var(--hint); font-size: 13px; }
.bar-row { padding: 12px 16px; border-bottom: 1px solid var(--separator); }
.bar-row:last-child { border-bottom: none; }
.bar-head { display: flex; justify-content: space-between; gap: 10px; margin-bottom: 6px; }
.bar-head b { overflow-wrap: anywhere; }
.bar-head span { color: var(--hint); font-size: 13px; flex: none; }
.bar { height: 8px; border-radius: 4px; background: color-mix(in srgb, var(--hint) 22%, transparent); overflow: hidden; }
.bar i { display: block; height: 100%; background: var(--accent); border-radius: 4px; }
.title-row { display: flex; align-items: center; gap: 6px; }
.info { color: var(--hint); cursor: pointer; display: inline-flex; }
svg.i { display: block; flex: none; }
.c-done { color: var(--ok); } .c-cancelled { color: var(--destructive); } .c-pending { color: var(--accent); }
.c-all { color: var(--hint); }
.chips { display: flex; gap: 6px; padding: 4px 12px 2px; overflow-x: auto; }
.chip { flex: none; display: inline-flex; align-items: center; gap: 5px; padding: 6px 12px; border-radius: 16px;
        background: var(--section-bg); color: var(--text); font-size: 14px; cursor: pointer; }
.chip.on { background: var(--button); color: var(--button-text); }
.chip.on svg.i { color: var(--button-text); }
.st { flex: none; width: 34px; height: 34px; display: flex; align-items: center; justify-content: center; cursor: pointer; }
.menu { position: fixed; z-index: 15; background: var(--section-bg); border-radius: 12px; min-width: 190px;
        box-shadow: 0 8px 24px rgba(0,0,0,.28); overflow: hidden; font-size: 15px; }
.menu[hidden] { display: none; }
.menu div { display: flex; align-items: center; gap: 10px; padding: 11px 14px; border-bottom: 1px solid var(--separator);
            cursor: pointer; white-space: nowrap; color: var(--text); }
.menu div:last-child { border-bottom: none; } .menu div.cur { font-weight: 600; }
.collapse-head { display: flex; justify-content: space-between; padding: 12px 16px; cursor: pointer; color: var(--hint); }
.empty { padding: 18px 16px; color: var(--hint); text-align: center; }
.dim { opacity: .5; }
.eye { color: var(--hint); cursor: pointer; display: flex; flex: none; }
.fab { position: fixed; right: 18px; bottom: calc(76px + env(safe-area-inset-bottom)); width: 56px; height: 56px; border-radius: 50%;
       background: var(--button); color: var(--button-text); align-items: center; justify-content: center;
       box-shadow: 0 6px 16px rgba(0,0,0,.28); cursor: pointer; display: none; z-index: 5; }
.fab.show { display: flex; }
.sheet-bg { position: fixed; inset: 0; background: rgba(0,0,0,.35); display: none; align-items: flex-end; z-index: 10; }
.sheet-bg.show { display: flex; }
.sheet { width: 100%; max-width: 640px; margin: 0 auto; background: var(--secondary-bg); border-radius: 16px 16px 0 0; padding: 8px 14px 22px; }
.sheet-grip { width: 36px; height: 5px; border-radius: 3px; background: var(--hint); opacity: .4; margin: 0 auto 10px; }
.sheet-title { font-weight: 600; font-size: 17px; text-align: center; margin-bottom: 12px; }
.popover-bg { position: fixed; inset: 0; z-index: 20; display: none; align-items: center; justify-content: center; background: rgba(0,0,0,.35); }
.popover-bg.show { display: flex; }
.popover { width: 290px; max-width: calc(100% - 32px); background: var(--section-bg); color: var(--text); border-radius: 14px;
           padding: 18px 18px 8px; text-align: center; box-shadow: 0 10px 30px rgba(0,0,0,.3); }
.popover p { margin: 0 0 14px; }
.popover button { width: 100%; border: none; border-top: 1px solid var(--separator); background: none; color: var(--link);
                  font: inherit; font-weight: 600; padding: 12px 0 6px; cursor: pointer; }
.toast { position: fixed; bottom: 90px; left: 50%; transform: translateX(-50%); background: rgba(0,0,0,.8); color: #fff;
         padding: 9px 16px; border-radius: 10px; font-size: 14px; opacity: 0; transition: opacity .2s; pointer-events: none;
         z-index: 30; max-width: calc(100% - 32px); text-align: center; }
.toast.show { opacity: 1; }
