/* EzSuppBot — app design system v1 (2026-07).
   Used by the authenticated panel / Telegram Mini App only (base.html).
   Marketing pages keep site.css. Tailwind CDN utilities still available;
   these components are the canonical look for interactive chrome. */

:root {
  --bg: #0c0a14;
  --bar: #0e1017;
  --card: #14161b;
  --card2: #0c0a14;          /* inset fields on cards */
  --line: #1b1e25;
  --line-strong: rgba(92, 184, 239, 0.35);
  --ink: #eef3fa;
  --ink2: #c9d3e2;
  --mut: #8d9ab0;
  --faint: #5b6576;
  --blue: #2e7fd0;
  --blue2: #5cb8ef;
  --pale: #7fb4e8;
  --ok: #34d399;
  --warn: #fbbf24;
  --err: #f56565;
  --r: 16px;
  --r-sm: 10px;
  --tap: 44px;               /* minimum touch target */
  --tabbar-h: calc(58px + env(safe-area-inset-bottom, 0px));
}

/* ── App bar + bottom tab bar (compact chrome) ─────────────────────── */

.appbar {
  position: sticky; top: 0; z-index: 40;
  display: flex; align-items: center; gap: 10px;
  height: 52px; padding: 0 14px;
  background: rgba(12, 10, 20, 0.92);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
}
.appbar-title { font-family: 'Sora', 'Inter', sans-serif; font-weight: 700; font-size: 16px;
  color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.appbar-back { display: inline-flex; align-items: center; justify-content: center;
  width: 36px; height: 36px; margin-left: -8px; border-radius: 12px; color: var(--ink2);
  font-size: 20px; text-decoration: none; }
.appbar-back:active { background: rgba(255,255,255,0.08); }

.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
  display: flex; align-items: stretch;
  height: var(--tabbar-h);
  padding-bottom: env(safe-area-inset-bottom, 0px);
  background: rgba(10, 11, 16, 0.96);
  backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
  border-top: 1px solid var(--line);
}
.tabbar a {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 2px; text-decoration: none; color: var(--mut); font-size: 10.5px; font-weight: 600;
  -webkit-tap-highlight-color: transparent;
}
.tabbar a .ico { font-size: 20px; line-height: 1; }
.tabbar a.active { color: var(--blue2); }
.tabbar a:active { color: var(--ink); }
body.has-tabbar { padding-bottom: calc(var(--tabbar-h) + 12px); }

/* "More" sheet */
.sheet-scrim { position: fixed; inset: 0; z-index: 60; background: rgba(0,0,0,0.55);
  opacity: 0; pointer-events: none; transition: opacity .18s; }
.sheet { position: fixed; left: 0; right: 0; bottom: 0; z-index: 61;
  background: var(--card); border-radius: 20px 20px 0 0; border: 1px solid var(--line);
  border-bottom: none; padding: 10px 14px calc(16px + env(safe-area-inset-bottom, 0px));
  transform: translateY(105%); transition: transform .22s cubic-bezier(.3,.9,.3,1); }
.sheet-open .sheet-scrim { opacity: 1; pointer-events: auto; }
.sheet-open .sheet { transform: none; }
.sheet-grab { width: 38px; height: 4px; border-radius: 2px; background: var(--line);
  margin: 2px auto 10px; }
.sheet a, .sheet button.sheet-item { display: flex; align-items: center; gap: 12px;
  width: 100%; min-height: var(--tap); padding: 0 10px; border-radius: 12px;
  color: var(--ink2); font-size: 15px; text-decoration: none; background: none; border: none;
  text-align: left; font-family: inherit; }
.sheet a:active, .sheet button.sheet-item:active { background: rgba(255,255,255,0.06); }
.sheet .danger { color: var(--err); }

/* ── Cards, rows ───────────────────────────────────────────────────── */

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); }

.row-item { display: flex; align-items: center; gap: 12px; min-height: var(--tap);
  padding: 12px 0; border-bottom: 1px solid var(--line); }
.row-item:last-child { border-bottom: none; }
.row-main { flex: 1; min-width: 0; }
.row-label { font-size: 14px; font-weight: 600; color: var(--ink); }
.row-help { font-size: 12px; color: var(--mut); margin-top: 2px; }

.list-row { display: flex; align-items: center; gap: 12px; min-height: 56px;
  padding: 10px 14px; text-decoration: none; border-bottom: 1px solid var(--line);
  -webkit-tap-highlight-color: transparent; }
.list-row:last-child { border-bottom: none; }
.list-row:active { background: rgba(255,255,255,0.045); }

/* ── Buttons ───────────────────────────────────────────────────────── */

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  min-height: 40px; padding: 0 18px; border-radius: 13px; border: 1px solid transparent;
  font: 600 14px 'Inter', sans-serif; color: var(--ink); cursor: pointer;
  text-decoration: none; transition: filter .12s, background .12s;
  -webkit-tap-highlight-color: transparent; }
.btn:active { filter: brightness(1.18); }
.btn-primary { background: var(--blue); color: #fff; }
.btn-primary:hover { background: #2569b8; }
.btn-ghost { background: rgba(255,255,255,0.06); border-color: var(--line); color: var(--ink2); }
.btn-ghost:hover { background: rgba(255,255,255,0.1); }
.btn-danger { background: rgba(245,101,101,0.12); border-color: rgba(245,101,101,0.35); color: var(--err); }
.btn-sm { min-height: 34px; padding: 0 13px; font-size: 13px; border-radius: 11px; }
.btn[disabled] { opacity: 0.45; cursor: not-allowed; }

/* Overflow ⋯ menu */
.menu-wrap { position: relative; }
.menu { position: absolute; right: 0; top: calc(100% + 6px); z-index: 50; min-width: 210px;
  background: #191c23; border: 1px solid var(--line); border-radius: 14px; padding: 6px;
  box-shadow: 0 16px 40px -12px rgba(0,0,0,0.6); display: none; }
.menu.open { display: block; }
.menu a, .menu button { display: flex; align-items: center; gap: 10px; width: 100%;
  min-height: 40px; padding: 0 12px; border-radius: 9px; background: none; border: none;
  color: var(--ink2); font: 500 14px 'Inter', sans-serif; text-align: left; cursor: pointer;
  text-decoration: none; }
.menu a:active, .menu button:active, .menu a:hover, .menu button:hover { background: rgba(255,255,255,0.07); }
.menu .danger { color: var(--err); }
.menu .menu-sep { height: 1px; margin: 5px 8px; background: var(--line); }

/* ── Form fields ───────────────────────────────────────────────────── */

.field { width: 100%; min-height: 42px; padding: 9px 12px; border-radius: 12px;
  background: var(--card2); border: 1px solid var(--line); color: var(--ink);
  font: 400 14px 'Inter', sans-serif; outline: none; transition: border-color .15s, box-shadow .15s; }
.field:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(46,127,208,0.25); }
textarea.field { resize: vertical; line-height: 1.5; }
select.field { appearance: none; -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%238d9ab0' stroke-width='1.6' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center; padding-right: 34px; }

/* Toggle switch */
.switch { position: relative; display: inline-block; flex-shrink: 0; width: 46px; height: 28px; }
.switch input { position: absolute; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.switch .knob { position: absolute; inset: 0; border-radius: 999px; background: #262a33;
  border: 1px solid var(--line); transition: background .18s, border-color .18s; pointer-events: none; }
.switch .knob::after { content: ''; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px;
  border-radius: 50%; background: #aeb7c4; transition: transform .18s, background .18s; }
.switch input:checked + .knob { background: var(--blue); border-color: var(--blue); }
.switch input:checked + .knob::after { transform: translateX(18px); background: #fff; }
.switch input:disabled + .knob { opacity: 0.45; }

/* Segmented control */
.seg { display: inline-flex; padding: 3px; gap: 3px; background: var(--card2);
  border: 1px solid var(--line); border-radius: 13px; }
.seg label { position: relative; }
.seg input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.seg span { display: inline-flex; align-items: center; justify-content: center; min-height: 34px;
  padding: 0 14px; border-radius: 10px; font: 600 13px 'Inter', sans-serif; color: var(--mut);
  transition: background .15s, color .15s; }
.seg input:checked + span { background: var(--blue); color: #fff; }

/* Day / choice pills */
.pills { display: flex; flex-wrap: wrap; gap: 8px; }
.pills label { position: relative; }
.pills input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.pills span { display: inline-flex; align-items: center; justify-content: center; min-height: 34px;
  padding: 0 14px; border-radius: 999px; border: 1px solid var(--line); background: var(--card2);
  font: 600 13px 'Inter', sans-serif; color: var(--mut); transition: all .15s; }
.pills input:checked + span { background: rgba(46,127,208,0.18); border-color: var(--blue);
  color: var(--blue2); }

/* Chips */
.chip { display: inline-flex; align-items: center; gap: 6px; min-height: 30px; padding: 0 12px;
  border-radius: 999px; border: 1px solid var(--line); background: transparent;
  font: 600 12.5px 'Inter', sans-serif; color: var(--mut); text-decoration: none;
  white-space: nowrap; -webkit-tap-highlight-color: transparent; }
.chip.active { background: rgba(46,127,208,0.16); border-color: var(--blue); color: var(--blue2); }
.chip:active { filter: brightness(1.25); }
.chip .n { font-size: 11px; padding: 1px 7px; border-radius: 999px; background: rgba(255,255,255,0.08); }

.pro-chip { display: inline-flex; align-items: center; gap: 4px; padding: 2px 9px;
  border-radius: 999px; background: rgba(46,127,208,0.2); color: var(--pale);
  font: 600 11px 'Inter', sans-serif; }

.status-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.status-dot.open { background: var(--ok); box-shadow: 0 0 8px rgba(52,211,153,0.6); }
.status-dot.closed { background: #4b5563; }

/* Chip-nav (settings sections) */
.chipnav { display: flex; gap: 8px; overflow-x: auto; -webkit-overflow-scrolling: touch;
  scrollbar-width: none; padding: 10px 0; position: sticky; top: 52px; z-index: 30;
  background: linear-gradient(var(--bg) 82%, transparent); }
.chipnav::-webkit-scrollbar { display: none; }
.desktop-chrome .chipnav { top: 67px; }

/* ── Autosave feedback ─────────────────────────────────────────────── */

.save-state { display: inline-flex; align-items: center; font-size: 11.5px; color: var(--mut);
  opacity: 0; transition: opacity .2s; white-space: nowrap; }
.save-state.saving { opacity: 1; }
.save-state.saved { opacity: 1; color: var(--ok); }
.save-state.error { opacity: 1; color: var(--err); }

/* Toast */
.toast-wrap { position: fixed; left: 0; right: 0; z-index: 70; display: flex;
  flex-direction: column; align-items: center; gap: 8px; pointer-events: none;
  bottom: calc(var(--tabbar-h) + 10px); }
body:not(.has-tabbar) .toast-wrap { bottom: 24px; }
.toast { display: inline-flex; align-items: center; gap: 8px; max-width: 92vw;
  padding: 10px 16px; border-radius: 13px; background: #1d212a; border: 1px solid var(--line);
  color: var(--ink); font: 500 13.5px 'Inter', sans-serif;
  box-shadow: 0 12px 32px -8px rgba(0,0,0,0.55); animation: toastIn .22s cubic-bezier(.3,.9,.3,1); }
.toast.ok { border-color: rgba(52,211,153,0.4); }
.toast.err { border-color: rgba(245,101,101,0.45); }
@keyframes toastIn { from { opacity: 0; transform: translateY(8px) scale(.97); } }

/* Locked (Pro) rows */
.locked { opacity: 0.55; }
.locked .field, .locked .switch input, .locked .seg input, .locked .pills input { pointer-events: none; }

/* Chat bubbles (ticket detail + previews) */
.bubble { max-width: 85%; padding: 9px 13px; border-radius: 16px; font-size: 14px;
  line-height: 1.45; white-space: pre-wrap; overflow-wrap: anywhere; word-break: break-word; }
.bubble.in { background: #191d26; color: var(--ink2); border-bottom-left-radius: 5px; }
.bubble.out { background: #1d3a5f; color: #eaf3fc; border-bottom-right-radius: 5px; }
.bubble.note { background: rgba(251,191,36,0.1); border: 1px dashed rgba(251,191,36,0.4); color: #fbd38d; }

/* Utility */
.tap { min-height: var(--tap); min-width: var(--tap); }
.no-scrollbar { scrollbar-width: none; }
.no-scrollbar::-webkit-scrollbar { display: none; }

@media (prefers-reduced-motion: reduce) {
  * { transition-duration: .01ms !important; animation-duration: .01ms !important; }
}
