:root {
  --bg: #ffffff;
  --bg-soft: #f5f6f8;
  --bg-hover: #eef0f4;
  --bg-active: #e7ecfd;
  --border: #e4e6eb;
  --text: #16181d;
  --muted: #6b7280;
  --accent: #3d63dd;
  --accent-hover: #3455c4;
  --accent-soft: #e7ecfd;
  --bubble-me: #3d63dd;
  --bubble-me-text: #ffffff;
  --bubble-them: #f0f2f5;
  --danger: #e5484d;
  --ok: #30a46c;
  --warn: #f5a524;
  --shadow: 0 10px 30px rgba(16, 24, 40, .16);
  --radius: 16px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #15171c;
    --bg-soft: #1c1f26;
    --bg-hover: #242832;
    --bg-active: #232c4a;
    --border: #2a2e38;
    --text: #e8eaef;
    --muted: #8f96a3;
    --accent: #6d8bff;
    --accent-hover: #809aff;
    --accent-soft: #232c4a;
    --bubble-me: #4767e8;
    --bubble-them: #252933;
    --shadow: 0 10px 30px rgba(0, 0, 0, .5);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  width: 720px;
  height: 600px;
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
  font: 13.5px/1.45 "Segoe UI", "Noto Sans Georgian", "BPG Arial", system-ui, -apple-system, sans-serif;
  -webkit-font-smoothing: antialiased;
}
button { font: inherit; color: inherit; }
a { color: inherit; }
.hidden { display: none !important; }
.muted { color: var(--muted); }

.screen { width: 100%; height: 100%; }
.screen.center { display: grid; place-items: center; }

/* ---------- spinner ---------- */
.spinner {
  width: 26px; height: 26px; border-radius: 50%;
  border: 3px solid var(--border); border-top-color: var(--accent);
  animation: spin .8s linear infinite; display: inline-block;
}
.spinner.sm { width: 14px; height: 14px; border-width: 2px; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 36px; padding: 0 16px; border-radius: 10px;
  border: 1px solid var(--border); background: var(--bg); cursor: pointer;
  font-weight: 600; transition: background .15s, border-color .15s, opacity .15s;
}
.btn:hover { background: var(--bg-hover); }
.btn:disabled { opacity: .5; cursor: default; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover:not(:disabled) { background: var(--accent-hover); }
.btn.danger { color: var(--danger); margin-left: auto; height: 32px; padding: 0 12px; }
.btn.lg { height: 44px; padding: 0 24px; font-size: 14.5px; border-radius: 12px; }
.btn .btn-spinner { display: none; border-color: rgba(255,255,255,.35); border-top-color: #fff; }
.btn.loading .btn-spinner { display: inline-block; }
/* Google-ის ოფიციალური ღილაკი — SVG უცვლელად, მხოლოდ პროპორციულად გადიდებული */
.gsi-btn { position: relative; padding: 0; border: 0; background: none; cursor: pointer; border-radius: 22px; line-height: 0; }
.gsi-btn img { display: block; height: 44px; width: auto; }
.gsi-btn:hover img { filter: brightness(0.97); }
.gsi-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.gsi-btn:disabled { cursor: wait; }
.gsi-btn.loading img { opacity: .55; }
.gsi-spinner { display: none; position: absolute; top: 50%; left: 50%; margin: -7px 0 0 -7px; }
.gsi-btn.loading .gsi-spinner { display: inline-block; }
.link { background: none; border: 0; color: var(--muted); cursor: pointer; text-decoration: underline; font-size: 12px; }

.icon-btn {
  width: 34px; height: 34px; flex: none; display: grid; place-items: center;
  border: 0; border-radius: 10px; background: transparent; color: var(--muted); cursor: pointer;
  transition: background .15s, color .15s;
}
.icon-btn:hover, .icon-btn.active { background: var(--bg-hover); color: var(--text); }

.send-btn {
  width: 36px; height: 36px; flex: none; display: grid; place-items: center;
  border: 0; border-radius: 50%; background: var(--accent); color: #fff; cursor: pointer;
}
.send-btn:hover { background: var(--accent-hover); }

/* ---------- login ---------- */
.login-card { width: 340px; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 10px; }
.login-logo {
  width: 72px; height: 72px; border-radius: 22px; display: grid; place-items: center;
  background: linear-gradient(135deg, var(--accent), #8a5cf6); color: #fff; box-shadow: var(--shadow);
}
.login-card h1 { margin: 8px 0 0; font-size: 22px; }
.login-card p { margin: 0 0 8px; }
.error { color: var(--danger); min-height: 18px; font-size: 12.5px; }

/* ---------- main layout ---------- */
#screen-main { display: grid; grid-template-columns: 255px 1fr; }

.sidebar { display: flex; flex-direction: column; border-right: 1px solid var(--border); background: var(--bg-soft); min-height: 0; }
.sidebar-head { display: flex; align-items: center; justify-content: space-between; padding: 10px 8px 6px 12px; }
.me { position: relative; display: flex; align-items: center; gap: 8px; min-width: 0; }
.me-name { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 140px; }
.conn-dot {
  position: absolute; left: 23px; top: 23px; width: 11px; height: 11px; border-radius: 50%;
  border: 2px solid var(--bg-soft); background: var(--muted);
}
.conn-dot[data-state="connected"] { background: var(--ok); }
.conn-dot[data-state="connecting"] { background: var(--warn); }
.conn-dot[data-state="disconnected"] { background: var(--danger); }
.actions { display: flex; gap: 2px; }

.search { position: relative; margin: 4px 10px 8px; }
.search input {
  width: 100%; height: 34px; padding: 0 30px 0 32px; border-radius: 10px;
  border: 1px solid var(--border); background: var(--bg); color: var(--text); outline: none; font: inherit;
}
.search input:focus { border-color: var(--accent); }
.search input::-webkit-search-cancel-button { display: none; }
.search-icon { position: absolute; left: 10px; top: 9px; color: var(--muted); display: flex; }
.search-clear {
  position: absolute; right: 6px; top: 6px; width: 22px; height: 22px; border: 0; border-radius: 6px;
  background: var(--bg-hover); color: var(--muted); display: grid; place-items: center; cursor: pointer;
}

.conv-list { flex: 1; overflow-y: auto; padding: 0 6px 8px; }
.sidebar-foot { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; padding: 8px; border-top: 1px solid var(--border); }
.foot-btn {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; height: 54px; padding: 0 6px; min-width: 0;
  border: 1px solid var(--border); border-radius: 10px; background: var(--bg); color: var(--text);
  font: inherit; font-size: 12px; font-weight: 600; cursor: pointer; transition: background .15s, border-color .15s;
}
.foot-btn span { max-width: 100%; }
.foot-btn svg { flex: none; color: var(--accent); }
.foot-btn span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.foot-btn:hover { background: var(--bg-hover); border-color: var(--accent); }
.list-section { padding: 10px 8px 4px; font-size: 11px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.list-hint { display: flex; align-items: center; gap: 8px; padding: 8px; color: var(--muted); font-size: 12.5px; }
.list-empty { text-align: center; padding: 40px 16px; color: var(--text); }
.list-empty p { margin: 4px 0; }
.list-empty-ic { color: var(--muted); margin-bottom: 8px; }

.conv-item {
  width: 100%; display: flex; align-items: center; gap: 10px; padding: 8px; border: 0; border-radius: 12px;
  background: transparent; text-align: left; cursor: pointer;
}
.conv-item { position: relative; color: inherit; }
.conv-item:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.conv-item:hover, .conv-item.menu-open { background: var(--bg-hover); }
.conv-item.active { background: var(--bg-active); }
.conv-item:disabled { opacity: .6; }
.conv-avatar { position: relative; flex: none; }
.group-mark {
  position: absolute; right: -2px; bottom: -2px; width: 16px; height: 16px; border-radius: 50%;
  display: grid; place-items: center; background: var(--accent); color: #fff; border: 2px solid var(--bg-soft);
}
.conv-main { flex: 1; min-width: 0; }
.conv-row { display: flex; align-items: center; justify-content: space-between; gap: 6px; }
.conv-title { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.conv-time { flex: none; font-size: 11px; color: var(--muted); }
.conv-preview { font-size: 12.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.conv-item.unread .conv-preview { color: var(--text); font-weight: 600; }
.conv-item.unread .conv-time { color: var(--accent); font-weight: 600; }
.badge {
  flex: none; min-width: 19px; height: 19px; padding: 0 6px; border-radius: 10px; background: var(--accent);
  color: #fff; font-size: 11px; font-weight: 700; display: grid; place-items: center;
}

.avatar {
  flex: none; border-radius: 50%; object-fit: cover; display: grid; place-items: center;
  color: #fff; font-weight: 700; user-select: none;
}

/* ---------- chat ---------- */
.chat { position: relative; min-width: 0; min-height: 0; display: flex; flex-direction: column; }
.chat-empty { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; }
.chat-empty p { margin: 0; }
.chat-empty-ic {
  width: 72px; height: 72px; border-radius: 50%; display: grid; place-items: center; margin-bottom: 10px;
  background: var(--accent-soft); color: var(--accent);
}

.chat-view { position: relative; flex: 1; display: flex; flex-direction: column; min-height: 0; }
.chat-head { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-bottom: 1px solid var(--border); }
.chat-head-text { min-width: 0; }
.chat-title { font-weight: 700; font-size: 14.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-subtitle { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-subtitle.typing { color: var(--accent); font-style: italic; }

.messages-wrap { position: relative; flex: 1; min-height: 0; }
.messages { position: absolute; inset: 0; overflow-y: auto; padding: 12px 14px 8px; overscroll-behavior: contain; }
.top-loader {
  position: absolute; z-index: 2; top: 8px; left: 50%; transform: translateX(-50%);
  background: var(--bg); border-radius: 20px; padding: 6px; box-shadow: var(--shadow); display: flex;
}
.msg-begin { text-align: center; font-size: 11.5px; color: var(--muted); padding: 6px 0 12px; }
.day-sep { display: flex; justify-content: center; margin: 12px 0 8px; }
.day-sep span { font-size: 11px; font-weight: 600; color: var(--muted); background: var(--bg-soft); padding: 3px 10px; border-radius: 10px; }

.msg { display: flex; align-items: flex-start; gap: 8px; margin-top: 8px; }
.msg.cont { margin-top: 2px; }
.msg.me { justify-content: flex-end; }
.msg-avatar { width: 28px; flex: none; }
.msg.cont .msg-avatar { visibility: hidden; height: 0; }
.msg.cont .msg-name { display: none; }
.msg-body { max-width: 72%; display: flex; flex-direction: column; min-width: 0; }
.msg.me .msg-body { align-items: flex-end; }
.msg-name { font-size: 11.5px; font-weight: 700; margin: 0 0 2px 10px; }

.bubble {
  position: relative; padding: 7px 11px 6px; border-radius: var(--radius);
  background: var(--bubble-them); word-wrap: break-word; overflow-wrap: anywhere; white-space: pre-wrap;
}
.msg.me .bubble { background: var(--bubble-me); color: var(--bubble-me-text); }
.msg.them:not(.cont) .bubble { border-top-left-radius: 6px; }
.msg.me:not(.cont) .bubble { border-top-right-radius: 6px; }
.msg.failed .bubble { opacity: .65; }
.bubble .text a { text-decoration: underline; }
.meta {
  float: right; display: inline-flex; align-items: center; gap: 3px; margin: 6px 0 -2px 10px;
  font-size: 10.5px; opacity: .7; white-space: nowrap; line-height: 1;
}
.status { display: inline-flex; }
.status .read { color: #9ee6ff; display: inline-flex; }
@media (prefers-color-scheme: light) { .msg.them .status .read { color: var(--accent); } }

.bubble.sticker { background: transparent !important; padding: 0; color: var(--text) !important; }
.sticker-emoji { font-size: 64px; line-height: 1.1; display: block; }
.bubble.sticker img { width: 120px; height: 120px; object-fit: contain; display: block; }
.bubble.sticker .meta { float: none; display: flex; justify-content: flex-end; margin: 0; }

.bubble.media { padding: 4px; overflow: hidden; }
.bubble.media img {
  display: block; max-width: 280px; max-height: 300px; min-width: 80px; width: 100%;
  object-fit: cover; border-radius: 12px; cursor: zoom-in; background: var(--bg-hover);
}
.bubble.media .text { padding: 6px 7px 0; }
.bubble.media .meta { position: absolute; right: 10px; bottom: 9px; margin: 0; padding: 3px 6px; border-radius: 8px; background: rgba(0,0,0,.45); color: #fff; opacity: 1; }
.bubble.media .text + .progress + .meta, .bubble.media .text + .meta { position: static; background: none; color: inherit; opacity: .7; float: right; margin: 6px 6px 2px 10px; }

.file-card { display: flex; align-items: center; gap: 10px; min-width: 210px; max-width: 280px; }
.file-ic { width: 40px; height: 40px; flex: none; border-radius: 10px; display: grid; place-items: center; background: rgba(127,127,127,.18); }
.file-info { flex: 1; min-width: 0; }
.file-name { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.file-size { font-size: 11.5px; opacity: .75; }
.file-dl { width: 32px; height: 32px; flex: none; display: grid; place-items: center; border-radius: 50%; background: rgba(127,127,127,.18); }
.file-dl:hover { background: rgba(127,127,127,.3); }

.vp { display: flex; align-items: center; gap: 10px; min-width: 210px; padding: 2px 0; }
.vp-btn { width: 34px; height: 34px; flex: none; border-radius: 50%; border: 0; display: grid; place-items: center; cursor: pointer; background: var(--accent); color: #fff; }
.msg.me .vp-btn { background: #fff; color: var(--bubble-me); }
.vp-bar { flex: 1; height: 4px; border-radius: 2px; background: rgba(127,127,127,.3); cursor: pointer; position: relative; }
.vp-bar i { position: absolute; inset: 0 auto 0 0; width: 0; border-radius: 2px; background: currentColor; }
.vp-time { font-size: 11.5px; font-variant-numeric: tabular-nums; opacity: .8; min-width: 32px; }

.progress { height: 3px; margin: 6px 2px 0; border-radius: 2px; background: rgba(127,127,127,.3); overflow: hidden; }
.progress i { display: block; height: 100%; width: 0; background: currentColor; transition: width .2s; }
.bubble.media .progress { margin: 6px 6px 4px; }

.retry { margin-top: 3px; border: 0; background: none; color: var(--danger); font-size: 11.5px; cursor: pointer; padding: 0; }
.retry:hover { text-decoration: underline; }

.jump-bottom {
  position: absolute; right: 16px; bottom: 12px; z-index: 2; width: 38px; height: 38px; border-radius: 50%;
  border: 1px solid var(--border); background: var(--bg); color: var(--text); box-shadow: var(--shadow);
  display: grid; place-items: center; cursor: pointer;
}

/* ---------- composer ---------- */
.composer-wrap { border-top: 1px solid var(--border); padding: 8px 10px; }
.composer { display: flex; align-items: flex-end; gap: 4px; }
.composer textarea {
  flex: 1; resize: none; max-height: 120px; min-height: 36px; padding: 8px 12px; border-radius: 18px;
  border: 1px solid var(--border); background: var(--bg-soft); color: var(--text); outline: none;
  font: inherit; line-height: 1.4;
}
.composer textarea:focus { border-color: var(--accent); }
.recording { display: flex; align-items: center; gap: 10px; height: 38px; }
.rec-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--danger); animation: pulse 1s ease-in-out infinite; }
.rec-label { color: var(--muted); }
.rec-time { flex: 1; font-variant-numeric: tabular-nums; font-weight: 600; }
@keyframes pulse { 50% { opacity: .3; } }

.sticker-panel {
  position: absolute; z-index: 3; right: 10px; bottom: 8px; width: 320px; height: 270px;
  display: flex; flex-direction: column; background: var(--bg); border: 1px solid var(--border);
  border-radius: 14px; box-shadow: var(--shadow); overflow: hidden;
}
.sp-tabs { display: flex; gap: 2px; padding: 6px; border-bottom: 1px solid var(--border); }
.sp-tab { border: 0; background: none; border-radius: 8px; padding: 4px 8px; font-size: 18px; cursor: pointer; }
.sp-tab.text { font-size: 12px; font-weight: 600; margin-left: auto; }
.sp-tab:hover, .sp-tab.active { background: var(--bg-hover); }
.sp-grid { flex: 1; overflow-y: auto; display: grid; padding: 6px; align-content: start; }
.sp-grid.stickers { grid-template-columns: repeat(5, 1fr); }
.sp-grid.emoji { grid-template-columns: repeat(8, 1fr); }
.sp-item { border: 0; background: none; border-radius: 10px; cursor: pointer; aspect-ratio: 1; display: grid; place-items: center; }
.sp-grid.stickers .sp-item { font-size: 36px; }
.sp-grid.emoji .sp-item { font-size: 21px; }
.sp-item:hover { background: var(--bg-hover); transform: scale(1.08); }

.drop-overlay {
  position: absolute; inset: 8px; z-index: 5; border: 2px dashed var(--accent); border-radius: 16px;
  background: color-mix(in srgb, var(--accent-soft) 88%, transparent); color: var(--accent);
  display: grid; place-items: center; font-weight: 700; font-size: 15px; pointer-events: none;
}

/* ---------- modal ---------- */
.modal-overlay { position: fixed; inset: 0; z-index: 20; background: rgba(10, 12, 18, .45); display: grid; place-items: center; animation: fade .15s; }
.modal { width: 380px; max-height: 520px; display: flex; flex-direction: column; background: var(--bg); border-radius: 16px; box-shadow: var(--shadow); }
.modal.wide { width: 460px; }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 12px 12px 4px 18px; }
.modal-head h3 { margin: 0; font-size: 16px; }
.modal-body { padding: 8px 18px; overflow-y: auto; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 18px 16px; }
@keyframes fade { from { opacity: 0; } }

.form { display: flex; flex-direction: column; gap: 10px; }
.input {
  width: 100%; height: 36px; padding: 0 12px; border-radius: 10px; border: 1px solid var(--border);
  background: var(--bg-soft); color: var(--text); outline: none; font: inherit;
}
.input:focus { border-color: var(--accent); }
.field { display: flex; flex-direction: column; gap: 4px; }
.field-label { font-size: 12px; font-weight: 600; }
.field-hint { font-size: 11px; color: var(--muted); }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.me-card { display: flex; align-items: center; gap: 10px; padding: 10px; border-radius: 12px; background: var(--bg-soft); }

.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chips:empty { display: none; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 3px 4px 3px 3px; border-radius: 20px; background: var(--accent-soft); font-size: 12.5px; font-weight: 600; }
.chip button { width: 18px; height: 18px; border: 0; border-radius: 50%; background: transparent; display: grid; place-items: center; cursor: pointer; color: var(--muted); }
.chip button:hover { background: var(--bg-hover); }
.pick-list { max-height: 210px; overflow-y: auto; margin: 0 -6px; }
.pick-item { display: flex; align-items: center; gap: 10px; padding: 6px; border-radius: 10px; cursor: pointer; }
.pick-item:hover { background: var(--bg-hover); }
.pick-item.checked { background: var(--bg-active); }
.pick-item input { accent-color: var(--accent); }
.pick-main { min-width: 0; }
.pick-name { font-weight: 600; }
.pick-sub { font-size: 12px; color: var(--muted); }

/* ---------- toast ---------- */
#toast-root { position: fixed; z-index: 50; left: 50%; bottom: 70px; transform: translateX(-50%); display: flex; flex-direction: column; gap: 6px; align-items: center; pointer-events: none; }
.toast {
  max-width: 420px; padding: 8px 14px; border-radius: 10px; background: #1f2330; color: #fff;
  font-size: 12.5px; box-shadow: var(--shadow); opacity: 0; transform: translateY(8px); transition: opacity .2s, transform .2s;
}
.toast.show { opacity: 1; transform: none; }
.toast.error { background: var(--danger); }
.toast.success { background: var(--ok); }

/* ---------- scrollbars ---------- */
::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--muted); }

/* ვებ-რეჟიმი (ტესტი): popup ბრაუზერის ტაბში, ცენტრში */
html.web-mode { background: #c9ced8; min-height: 100%; }
html.web-mode body { margin: 24px auto; border-radius: 12px; box-shadow: 0 20px 60px rgba(0,0,0,.25); }

/* ===================== ჩატის თემები ===================== */
/* ყველა თემა ცვლის მხოლოდ ცვლადებს — ყველა ჩატზე ერთად ვრცელდება */
.messages-wrap { background: var(--chat-bg, var(--bg)); }

:root[data-theme="ocean"] { --accent:#0b8fa3; --accent-hover:#097d8e; --accent-soft:#def3f6; --bg-active:#def3f6; --bubble-me:#0b8fa3; --bubble-them:#e6f4f6; --chat-bg:#f4fbfc; }
:root[data-theme="forest"] { --accent:#2f9e44; --accent-hover:#2b8a3e; --accent-soft:#e6f4ea; --bg-active:#e6f4ea; --bubble-me:#2f9e44; --bubble-them:#edf6ef; --chat-bg:#f6fbf7; }
:root[data-theme="sunset"] { --accent:#f76707; --accent-hover:#e8590c; --accent-soft:#fff0e3; --bg-active:#fff0e3; --bubble-me:linear-gradient(135deg,#ff8a3d,#f03e3e); --bubble-them:#fff4ec; --chat-bg:#fffaf5; }
:root[data-theme="rose"] { --accent:#d6336c; --accent-hover:#c2255c; --accent-soft:#fde8ef; --bg-active:#fde8ef; --bubble-me:linear-gradient(135deg,#e64980,#be4bdb); --bubble-them:#fdf0f4; --chat-bg:#fff8fa; }
:root[data-theme="mono"] { --accent:#25262b; --accent-hover:#000; --accent-soft:#e9ecef; --bg-active:#e9ecef; --bubble-me:#25262b; --bubble-them:#f1f3f5; --chat-bg:#fff; }

@media (prefers-color-scheme: dark) {
  :root[data-theme="ocean"] { --accent:#22b8cf; --accent-hover:#3bc9db; --accent-soft:#12343a; --bg-active:#12343a; --bubble-me:#0b7c8c; --bubble-them:#1f2c30; --chat-bg:#12181b; }
  :root[data-theme="forest"] { --accent:#40c057; --accent-hover:#51cf66; --accent-soft:#17311f; --bg-active:#17311f; --bubble-me:#2b8a3e; --bubble-them:#1f2a22; --chat-bg:#121814; }
  :root[data-theme="sunset"] { --accent:#ff922b; --accent-hover:#ffa94d; --accent-soft:#3a2414; --bg-active:#3a2414; --bubble-them:#2e241e; --chat-bg:#1a1512; }
  :root[data-theme="rose"] { --accent:#f06595; --accent-hover:#f783ac; --accent-soft:#3a1a28; --bg-active:#3a1a28; --bubble-them:#2e1f26; --chat-bg:#1a1216; }
  :root[data-theme="mono"] { --accent:#e9ecef; --accent-hover:#fff; --accent-soft:#2c2e33; --bg-active:#2c2e33; --bubble-me:#e9ecef; --bubble-me-text:#111; --bubble-them:#25262b; --chat-bg:#141517; }
}
/* შუაღამე — ყოველთვის მუქი */
:root[data-theme="midnight"] {
  --bg:#12131f; --bg-soft:#181a2b; --bg-hover:#22253a; --bg-active:#2a2d4a; --border:#2a2c44; --text:#e7e8f5; --muted:#9496b5;
  --accent:#7c5cff; --accent-hover:#8f74ff; --accent-soft:#2a2550; --bubble-me:linear-gradient(135deg,#7c5cff,#c056ff); --bubble-me-text:#fff;
  --bubble-them:#23253b; --chat-bg:#0f1020; color-scheme: dark;
}
:root[data-theme="mono"] .btn.primary, :root[data-theme="mono"] .send-btn, :root[data-theme="mono"] .badge { color: var(--bg); }

/* ===================== სტატუსი ===================== */
.av-wrap { position: relative; display: inline-block; flex: none; }
.av-wrap > .avatar { width: 100% !important; height: 100% !important; }
.status-dot {
  position: absolute; right: -1px; bottom: -1px; border-radius: 50%;
  border: 2px solid var(--bg-soft); background: #adb5bd; box-sizing: border-box;
}
.status-dot[data-status="active"] { background: #2fb344; }
.status-dot[data-status="idle"] { background: #f59f00; }
.status-dot[data-status="offline"] { background: var(--bg-soft); border-color: #adb5bd; }
.chat-head .status-dot, .modal .status-dot { border-color: var(--bg); }
.status-dot.inline { position: static; display: inline-block; width: 10px; height: 10px; border: 2px solid transparent; flex: none; }
.status-dot.inline[data-status="offline"] { border-color: #adb5bd; background: transparent; }
.status-text { font-size: 11.5px; color: var(--muted); white-space: nowrap; margin-left: auto; }
.status-text.active { color: #2fb344; }
.status-text.idle { color: #f59f00; }

/* ===================== სიდბარი / ჰედერი ===================== */
#me-avatar { cursor: pointer; }
.new-group-btn {
  display: flex; align-items: center; justify-content: center; gap: 6px; margin: 0 10px 8px; height: 32px;
  border: 1px dashed var(--border); border-radius: 10px; background: transparent; color: var(--muted);
  font-size: 12.5px; font-weight: 600; cursor: pointer;
}
.new-group-btn:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }
.chat-head.clickable { cursor: pointer; }
.chat-head.clickable:hover { background: var(--bg-hover); }

/* ===================== ფორმები / მოდალები ===================== */
.btn.sm { height: 30px; padding: 0 12px; font-size: 12.5px; border-radius: 8px; }
.btn.ghost-danger { color: var(--danger); }
.modal-foot .btn.danger { margin-right: auto; margin-left: 0; }
.muted { color: var(--muted); font-weight: 400; }
.pick-item.static { cursor: default; }
.pick-item.static:hover { background: transparent; }
.pick-list.members { max-height: 230px; }

.settings { display: flex; flex-direction: column; gap: 4px; }
.settings-profile { display: flex; align-items: center; gap: 14px; padding: 6px 0 12px; border-bottom: 1px solid var(--border); }
.settings-profile-main { min-width: 0; }
.settings-row-btns { display: flex; gap: 6px; margin-top: 8px; }
.settings-section { padding: 10px 0; border-bottom: 1px solid var(--border); }
.settings-section:last-child { border-bottom: 0; }
.settings-section h4 { margin: 0 0 8px; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }

.theme-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.theme-swatch {
  display: flex; flex-direction: column; align-items: center; gap: 5px; padding: 8px 4px; border-radius: 12px;
  border: 2px solid transparent; background: var(--bg-soft); cursor: pointer;
}
.theme-swatch:hover { background: var(--bg-hover); }
.theme-swatch.selected { border-color: var(--accent); }
.swatch { width: 34px; height: 34px; border-radius: 50%; box-shadow: inset 0 0 0 1px rgba(0,0,0,.08); }
.swatch-name { font-size: 11px; color: var(--text); text-align: center; line-height: 1.2; }

.toggle-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.toggle-right { display: flex; align-items: center; gap: 10px; }
.switch {
  appearance: none; width: 38px; height: 22px; border-radius: 11px; background: var(--border); position: relative;
  cursor: pointer; transition: background .15s; margin: 0;
}
.switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: transform .15s; box-shadow: 0 1px 2px rgba(0,0,0,.2); }
.switch:checked { background: var(--accent); }
.switch:checked::after { transform: translateX(16px); }

.radio-list { display: flex; flex-direction: column; gap: 4px; }
.radio-item { display: flex; align-items: center; gap: 10px; padding: 7px 8px; border-radius: 10px; cursor: pointer; }
.radio-item:hover { background: var(--bg-hover); }
.radio-item input { accent-color: var(--accent); margin: 0; }
.radio-text { display: flex; flex-direction: column; }
.radio-text small { color: var(--muted); font-size: 11.5px; }
.modal { max-height: 560px; }
.msg.me .vp-btn { color: var(--accent); }

/* ---------------- ფაილის ღილაკები ჩატში ---------------- */
.file-btns { display: flex; gap: 4px; flex: none; }
button.file-dl { border: 0; color: inherit; cursor: pointer; padding: 0; }
button.file-dl:disabled { opacity: .5; cursor: default; }

/* ---------------- პაკეტი / გამოყენება ---------------- */
.usage { display: grid; gap: 10px; }
.usage-top { display: flex; justify-content: space-between; gap: 8px; font-size: 13px; }
.usage-top b { font-weight: 600; }
.usage-bar { height: 5px; border-radius: 3px; background: var(--bg-hover); overflow: hidden; margin-top: 5px; }
.usage-bar i { display: block; height: 100%; background: var(--accent); border-radius: 3px; }
.usage-bar i.warn { background: var(--danger); }
.plan-box { display: grid; gap: 14px; }
.plan-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.plan-name { font-weight: 700; font-size: 16px; }
.packages { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; }
.package-card { border: 1px solid var(--border); border-radius: 14px; padding: 14px; display: flex; flex-direction: column; gap: 10px; }
.package-card.current { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.package-top { display: flex; justify-content: space-between; gap: 10px; align-items: flex-start; }
.package-price { font-size: 13px; color: var(--muted); }
.package-price b { font-size: 20px; color: var(--text); }
.package-price small { font-size: 12.5px; }
.package-limits { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; flex: 1; }
.package-limits li { display: flex; justify-content: space-between; gap: 8px; font-size: 12.5px; color: var(--muted); }
.package-limits b { color: var(--text); font-weight: 600; white-space: nowrap; }
.package-card .btn { width: 100%; justify-content: center; }
.package-price .yr-sub { margin-top: 3px; font-size: 12px; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.packages-wrap { display: grid; gap: 14px; }
.period-switch { justify-self: center; display: inline-flex; gap: 2px; padding: 3px; border: 1px solid var(--border); border-radius: 10px; }
.period-switch button { appearance: none; border: 0; background: none; color: var(--muted); font: inherit; font-size: 13px; font-weight: 600; padding: 6px 14px; border-radius: 8px; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; }
.period-switch button:hover { color: var(--text); }
.period-switch button[aria-pressed="true"] { background: var(--accent); color: #fff; }
.period-switch button[aria-pressed="true"] .save-off { background: rgba(255,255,255,.22); color: #fff; }
.save-off { font-size: 11px; font-weight: 700; padding: 1px 6px; border-radius: 6px; background: rgba(27,175,122,.14); color: #138a5e; }
.period-note[hidden] { display: none; }
.period-note { text-align: center; font-size: 12px; }
.plan-tag { margin-left: 8px; font-size: 11px; font-weight: 600; padding: 2px 7px; border-radius: 6px; background: var(--accent); color: #fff; vertical-align: middle; }

/* ---------------- ჩემი ფაილები ---------------- */
.drive { display: grid; gap: 12px; min-height: 260px; border-radius: 12px; transition: background .15s; }
.drive.dragging { background: var(--accent-soft); outline: 2px dashed var(--accent); outline-offset: 4px; }
.drive-top { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.drive-usage { flex: 1; min-width: 180px; }
.drive-list { display: grid; gap: 2px; max-height: 380px; overflow-y: auto; margin: 0 -4px; padding: 0 4px; }
.drive-row { position: relative; display: flex; align-items: center; gap: 12px; padding: 8px; border-radius: 10px; }
.drive-row:hover { background: var(--bg-hover); }
.drive-thumb { width: 40px; height: 40px; flex: none; border-radius: 8px; object-fit: cover; display: grid; place-items: center; background: var(--bg-soft); color: var(--muted); }
.drive-main { flex: 1; min-width: 0; }
.drive-name { font-size: 14px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.drive-meta { font-size: 12px; color: var(--muted); }
.drive-row .progress { color: var(--accent); }
.error-text { color: var(--danger); }
.drive-actions { display: flex; gap: 2px; flex: none; opacity: .75; }
.drive-row:hover .drive-actions, .drive-row:focus-within .drive-actions { opacity: 1; }
.icon-btn.danger-hover:hover, .icon-btn.confirm { color: var(--danger); }
.icon-btn.confirm { background: color-mix(in srgb, var(--danger) 14%, transparent); }
.drive-more { justify-self: center; margin-top: 6px; }
.drive-pick { position: fixed; z-index: 1000; width: 240px; max-height: 240px; overflow-y: auto;
  background: var(--bg); border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow); padding: 6px; }
.drive-pick-title { font-size: 12px; color: var(--muted); padding: 4px 8px 6px; }
.drive-pick-item { display: block; width: 100%; text-align: left; border: 0; background: none; color: var(--text); font: inherit; font-size: 14px; padding: 7px 8px; border-radius: 8px; cursor: pointer; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.drive-pick-item:hover, .drive-pick-item:focus-visible { background: var(--bg-hover); outline: none; }

/* ---------------- End-to-end დაშიფვრა ---------------- */
.e2ee-banner { margin: 0 12px 8px; }
.e2ee-banner-btn { display: flex; width: 100%; align-items: center; justify-content: space-between; gap: 8px; padding: 9px 12px; border: 0;
  border-radius: 12px; background: var(--accent-soft); color: var(--text); font: inherit; font-size: 13px; cursor: pointer; text-align: left; }
.e2ee-banner-btn:hover { filter: brightness(.97); }
.e2ee-banner-btn b { color: var(--accent); font-weight: 600; white-space: nowrap; }
.e2ee-banner-text { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; font-weight: 500; }
.e2ee-banner-text svg { flex: none; color: var(--accent); }
.e2ee-badge { display: inline-flex; vertical-align: middle; margin-left: 6px; color: var(--ok); }
.bubble.e2ee-locked { cursor: pointer; font-style: italic; opacity: .85; }
.e2ee-msg { display: inline-flex; align-items: center; gap: 6px; }
img.e2ee-pending { background: var(--bg-hover); min-height: 120px; }
.drive-thumb.e2ee { color: var(--ok); }
.e2ee-flow { display: grid; gap: 14px; }
.e2ee-flow p { margin: 0; line-height: 1.5; }
.e2ee-explain { display: flex; gap: 12px; align-items: flex-start; }
.e2ee-explain-ic { flex: none; width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); }
.e2ee-explain > div { display: grid; gap: 6px; }
.e2ee-actions { display: flex; justify-content: flex-end; gap: 8px; }
.e2ee-actions.spread { justify-content: space-between; align-items: center; }
.e2ee-step-title { margin: 0; font-size: 15px; }
.link-btn { border: 0; background: none; padding: 0; color: var(--accent); font: inherit; font-size: 13px; cursor: pointer; }
.link-btn:hover { text-decoration: underline; }
.form-error { color: var(--danger); font-size: 13px; min-height: 0; }
.form-error:empty { display: none; }
.small { font-size: 12.5px; }
.input.mono, .mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; letter-spacing: .04em; }
.recovery-code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 18px; font-weight: 600; letter-spacing: .08em;
  text-align: center; padding: 14px; border-radius: 12px; background: var(--bg-soft); border: 1px dashed var(--border); user-select: all; word-break: break-all; }
.check-row { display: flex; align-items: center; gap: 8px; font-size: 14px; cursor: pointer; }
.e2ee-warning { padding: 12px; border-radius: 12px; background: color-mix(in srgb, var(--danger) 10%, transparent); font-size: 13.5px; line-height: 1.5; }
.e2ee-box { display: grid; gap: 12px; }
.e2ee-status { display: flex; align-items: center; gap: 10px; }
.e2ee-dot { width: 10px; height: 10px; border-radius: 50%; flex: none; background: var(--muted); }
.e2ee-dot.on { background: var(--ok); }
.e2ee-dot.locked { background: var(--warn); }
.settings-row-btns.wrap { flex-wrap: wrap; }
.safety-number { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px 12px; padding: 14px; border-radius: 12px; background: var(--bg-soft);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 17px; text-align: center; letter-spacing: .06em; }

/* ===================== საუბრის თემა ===================== */
.chat-head .head-theme { margin-left: auto; flex: none; }
.theme-pick { position: fixed; z-index: 1000; width: 230px; padding: 6px; border-radius: 12px; background: var(--bg);
  border: 1px solid var(--border); box-shadow: 0 10px 30px rgba(16, 24, 40, .18); }
.theme-pick-title { font-weight: 700; font-size: 13.5px; padding: 6px 8px 0; }
.theme-pick-hint { font-size: 12px; color: var(--muted); padding: 2px 8px 6px; }
.theme-pick-item { display: flex; align-items: center; gap: 10px; width: 100%; border: 0; background: none; color: var(--text);
  font: inherit; font-size: 13.5px; padding: 7px 8px; border-radius: 8px; cursor: pointer; text-align: left; }
.theme-pick-item:hover, .theme-pick-item:focus-visible { background: var(--bg-hover); outline: none; }
.theme-pick-item.selected { font-weight: 600; }
.theme-dot { width: 20px; height: 20px; border-radius: 50%; flex: none; border: 1px solid var(--border); }
.theme-check { margin-left: auto; color: var(--accent); display: inline-flex; }
.settings-hint { font-size: 12px; color: var(--muted); margin: 8px 0 0; }
.lang-select { height: 36px; padding: 0 10px; border-radius: 10px; border: 1px solid var(--border); background: var(--bg); color: var(--text); font: inherit; font-size: 14px; }

/* ===================== გადახდის სტატუსი ===================== */
.billing-box { margin: 12px 0; padding: 12px 14px; border-radius: 12px; font-size: 13px; display: grid; gap: 6px; }
.billing-box p { margin: 0; }
.billing-box.danger { background: color-mix(in srgb, var(--danger, #e5484d) 12%, transparent); border: 1px solid color-mix(in srgb, var(--danger, #e5484d) 35%, transparent); }
.billing-box.danger > b { color: var(--danger, #e5484d); }
.billing-box.warn { background: color-mix(in srgb, #f5a524 14%, transparent); border: 1px solid color-mix(in srgb, #f5a524 40%, transparent); }
.billing-box .small { font-size: 12px; }
.warn-text { color: #b26a00; }
@media (prefers-color-scheme: dark) { .warn-text { color: #f5b14a; } }
.btn.danger-solid { background: var(--danger, #e5484d); color: #fff; border-color: transparent; }
.btn.danger-solid:hover { filter: brightness(1.05); }
.billing-banner { margin: 0 12px 8px; }
.billing-banner-btn { display: flex; width: 100%; align-items: center; justify-content: space-between; gap: 8px; padding: 9px 12px; border: 0;
  border-radius: 12px; background: color-mix(in srgb, var(--danger, #e5484d) 14%, transparent); color: var(--text); font: inherit; font-size: 13px; cursor: pointer; text-align: left; }
.billing-banner.warn .billing-banner-btn { background: color-mix(in srgb, #f5a524 16%, transparent); }
.billing-banner-btn b { color: var(--danger, #e5484d); font-weight: 600; white-space: nowrap; }
.billing-banner-text { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; min-width: 0; }
.billing-banner-text span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.billing-banner-text svg { flex: none; color: var(--danger, #e5484d); }
.billing-banner.warn .billing-banner-text svg { color: #d48806; }
.drive-row.locked { opacity: .75; }
.drive-row.locked .drive-thumb { color: #d48806; }
.drive-billing .billing-box { margin: 0 0 12px; }

/* ================= „ჩემი ფაილები“ — სრული ზომის მოდალი ================= */
.modal.full { width: calc(100vw - 24px); height: calc(100vh - 24px); max-height: none; }
.modal.full .modal-head { padding: 12px 12px 10px 18px; border-bottom: 1px solid var(--border); }
.modal.full .modal-body { flex: 1; min-height: 0; padding: 0; overflow: hidden; display: flex; }
.dv { flex: 1; min-width: 0; display: grid; grid-template-columns: 208px minmax(0, 1fr); }

/* მარცხენა პანელი */
.dv-side { display: flex; flex-direction: column; min-height: 0; border-right: 1px solid var(--border); background: var(--bg-soft); border-bottom-left-radius: var(--radius); }
.dv-side-top { display: grid; gap: 8px; padding: 14px 12px 10px; }
.dv-usage .usage-row { margin: 0; }
.dv-link { justify-self: center; border: 0; background: none; color: var(--accent); font: inherit; font-size: 12.5px; font-weight: 600; cursor: pointer; padding: 2px 6px; border-radius: 6px; }
.dv-link:hover { background: var(--accent-soft); }
.dv-side-btn, .dv-new { display: flex; align-items: center; justify-content: center; gap: 8px; height: 34px; padding: 0 10px; border: 1px solid var(--border); border-radius: 10px;
  background: var(--bg); color: var(--text); font: inherit; font-size: 13px; font-weight: 500; cursor: pointer; transition: background .15s, border-color .15s, color .15s; }
.dv-side-btn:hover, .dv-new:hover { border-color: var(--accent); }
.dv-side-btn.on { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }
.dv-side-btn svg, .dv-new svg { flex: none; color: var(--accent); }
.dv-tree { flex: 1; min-height: 0; overflow: auto; padding: 4px 6px 8px; border-top: 1px solid var(--border); }
.dv-node { display: flex; align-items: center; gap: 4px; height: 30px; padding-right: 8px; border-radius: 8px; cursor: pointer; color: var(--text); font-size: 13px; user-select: none; outline: none; }
.dv-node.root { margin-top: 4px; font-weight: 600; padding-left: 6px; }
.dv-node:hover { background: var(--bg-hover); }
.dv-node:focus-visible { box-shadow: inset 0 0 0 2px var(--accent); }
.dv-node.on { background: var(--bg-active); color: var(--accent); }
.dv-node.drop { background: var(--accent-soft); box-shadow: inset 0 0 0 2px var(--accent); }
.dv-node-ic { display: flex; flex: none; color: var(--muted); }
.dv-node.on .dv-node-ic { color: var(--accent); }
.dv-node-name { min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dv-caret, .dv-caret-gap { width: 18px; height: 18px; flex: none; }
.dv-caret { display: grid; place-items: center; padding: 0; border: 0; border-radius: 5px; background: none; color: var(--muted); cursor: pointer; transition: transform .15s; }
.dv-caret:hover { background: var(--bg-hover); color: var(--text); }
.dv-caret.open { transform: rotate(90deg); }
.dv-new { margin: 8px 10px 12px; }

/* მარჯვენა ნაწილი */
.dv-main { position: relative; min-width: 0; min-height: 0; display: flex; }
.dv-main.dragging::after { content: ""; position: absolute; inset: 8px; border: 2px dashed var(--accent); border-radius: 12px; background: color-mix(in srgb, var(--accent) 8%, transparent); pointer-events: none; }
.dv-pane { flex: 1; min-width: 0; min-height: 0; display: flex; flex-direction: column; }
.dv-pane[hidden] { display: none; }
.dv-billing:empty { display: none; }
.dv-billing .billing-box { margin: 12px 16px 0; }
.dv-toolbar { display: flex; gap: 8px; padding: 14px 16px 10px; }
.dv-toolbar .btn { display: inline-flex; align-items: center; gap: 6px; }
.dv-crumbs { display: flex; align-items: center; flex-wrap: wrap; gap: 2px; padding: 0 16px 10px; font-size: 13px; color: var(--muted); border-bottom: 1px solid var(--border); }
.dv-crumb { border: 0; background: none; color: var(--muted); font: inherit; padding: 3px 6px; border-radius: 6px; cursor: pointer; max-width: 180px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dv-crumb:hover, .dv-crumb.drop { background: var(--bg-hover); color: var(--text); }
.dv-crumb.cur { color: var(--text); font-weight: 600; cursor: default; }
.dv-sep { display: flex; color: var(--muted); opacity: .6; }
.dv-scroll { flex: 1; min-height: 0; overflow: auto; padding: 12px 16px 16px; }
.dv-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(108px, 1fr)); gap: 10px; align-content: start; }
.dv-grid > .list-hint, .dv-empty, .dv-more { grid-column: 1 / -1; }
.dv-more { justify-self: center; }
.dv-empty { padding-top: 40px; }

/* ფილა */
.dv-tile { position: relative; display: flex; flex-direction: column; min-width: 0; padding: 8px 8px 9px; border: 1px solid var(--border); border-radius: 12px; background: var(--bg);
  cursor: default; outline: none; transition: border-color .15s, background .15s, box-shadow .15s, transform .15s; }
.dv-tile:hover { border-color: color-mix(in srgb, var(--accent) 45%, var(--border)); box-shadow: 0 6px 16px -10px rgba(16, 24, 40, .35); }
.dv-tile:focus-visible { box-shadow: 0 0 0 2px var(--accent); }
.dv-tile.sel, .dv-tile.menu-open { border-color: var(--accent); background: var(--accent-soft); }
.dv-tile.drop { border-color: var(--accent); background: var(--accent-soft); transform: scale(1.03); }
.dv-tile.dragging { opacity: .45; }
.dv-tile-thumb { height: 74px; border-radius: 8px; background: var(--bg-soft); display: grid; place-items: center; overflow: hidden; margin-bottom: 7px; }
.dv-tile-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.dv-tile.folder .dv-tile-thumb { background: none; }
.dv-ic { position: relative; display: grid; place-items: center; color: var(--muted); }
.dv-ic.folder { color: var(--accent); }
.dv-ic.folder svg { fill: color-mix(in srgb, var(--accent) 16%, transparent); }
.dv-ic.e2ee { color: var(--ok); }
.dv-ext { position: absolute; bottom: -2px; left: 50%; transform: translateX(-50%); font-size: 9px; font-weight: 700; letter-spacing: .02em; padding: 0 4px; border-radius: 4px; background: var(--accent); color: #fff; line-height: 14px; }
.dv-tile-name { font-size: 12.5px; font-weight: 500; text-align: center; line-height: 1.3; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; word-break: break-word; }
.dv-tile-meta { margin-top: 2px; font-size: 11px; color: var(--muted); text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dv-tile.folder .dv-tile-name { font-weight: 600; }
.dv-tile-more { position: absolute; top: 4px; right: 4px; width: 26px; height: 26px; display: grid; place-items: center; padding: 0; border: 0; border-radius: 7px;
  background: color-mix(in srgb, var(--bg) 85%, transparent); color: var(--text); cursor: pointer; opacity: 0; transition: opacity .15s, background .15s; }
.dv-tile:hover .dv-tile-more, .dv-tile:focus-within .dv-tile-more, .dv-tile.menu-open .dv-tile-more { opacity: 1; }
.dv-tile-more:hover { background: var(--bg-hover); }
.dv-tile.locked { opacity: .7; }
.dv-tile.locked .dv-ic { color: #d48806; }
.dv-tile.uploading .progress { margin-top: 6px; }
.dv-rename { width: 100%; font: inherit; font-size: 12.5px; text-align: center; padding: 3px 5px; border: 1px solid var(--accent); border-radius: 6px; background: var(--bg); color: var(--text); outline: none; box-shadow: 0 0 0 3px var(--accent-soft); }

/* კონტექსტური მენიუ */
.dv-menu { position: fixed; z-index: 1000; min-width: 196px; padding: 5px; border: 1px solid var(--border); border-radius: 12px; background: var(--bg); box-shadow: var(--shadow); animation: dvpop .12s ease-out; }
@keyframes dvpop { from { opacity: 0; transform: scale(.97); } }
.dv-menu button { display: flex; align-items: center; gap: 10px; width: 100%; padding: 7px 10px; border: 0; border-radius: 8px; background: none; color: var(--text); font: inherit; font-size: 13px; text-align: left; cursor: pointer; }
.dv-menu button:hover, .dv-menu button:focus-visible { background: var(--bg-hover); outline: none; }
.dv-menu .dv-menu-ic { display: flex; color: var(--muted); }
.dv-menu button.danger { color: var(--danger); }
.dv-menu button.danger .dv-menu-ic { color: var(--danger); }

/* გადატანის დიალოგი, დადასტურება */
.dv-pick { display: grid; gap: 2px; max-height: 300px; overflow: auto; margin: 0 -6px; }
.dv-pick-row { display: flex; align-items: center; gap: 8px; height: 32px; padding-right: 10px; border: 0; border-radius: 8px; background: none; color: var(--text); font: inherit; font-size: 13px; text-align: left; cursor: pointer; }
.dv-pick-row span:first-child { display: flex; color: var(--muted); }
.dv-pick-row:hover:not(:disabled) { background: var(--bg-hover); }
.dv-pick-row.on { background: var(--bg-active); color: var(--accent); font-weight: 600; }
.dv-pick-row.on span:first-child { color: var(--accent); }
.dv-pick-row:disabled { opacity: .4; cursor: not-allowed; }
.dv-confirm { margin: 4px 0 6px; line-height: 1.5; }

/* შეძენის ისტორია */
.dv-hist-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 16px 12px; border-bottom: 1px solid var(--border); }
.dv-hist-head h4 { margin: 0; font-size: 15px; }
.dv-hist-head .btn { display: inline-flex; align-items: center; gap: 6px; }
.dv-hist { flex: 1; min-height: 0; overflow: auto; padding: 8px 10px 16px; }
.dv-hist-row { display: grid; grid-template-columns: 36px minmax(0, 1fr) auto auto; align-items: center; gap: 12px; padding: 10px 8px; border-radius: 10px; }
.dv-hist-row + .dv-hist-row { border-top: 1px solid var(--border); }
.dv-hist-row:hover { background: var(--bg-hover); }
.dv-hist-ic { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); }
.dv-hist-title { font-weight: 600; }
.dv-hist-meta { font-size: 12px; color: var(--muted); }
.dv-hist-amt { font-weight: 600; font-variant-numeric: tabular-nums; }
.dv-pill { font-size: 11.5px; font-weight: 600; padding: 2px 8px; border-radius: 999px; background: var(--bg-hover); color: var(--muted); white-space: nowrap; }
.dv-pill.ok { background: color-mix(in srgb, var(--ok) 15%, transparent); color: var(--ok); }
.dv-pill.warn { background: color-mix(in srgb, var(--warn) 18%, transparent); color: #b07400; }
.dv-pill.red { background: color-mix(in srgb, var(--danger) 14%, transparent); color: var(--danger); }

/* ================= პასუხი და რეაქციები ================= */
.bubble-wrap { position: relative; display: flex; max-width: 100%; min-width: 0; }
.msg-actions { position: absolute; top: 50%; left: 100%; transform: translateY(-50%); margin-left: 6px; display: flex; gap: 2px; opacity: 0; pointer-events: none; transition: opacity .12s; }
.msg.me .msg-actions { left: auto; right: 100%; margin: 0 6px 0 0; flex-direction: row-reverse; }
.msg:hover .msg-actions, .msg:focus-within .msg-actions { opacity: 1; pointer-events: auto; }
.msg-act { width: 28px; height: 28px; display: grid; place-items: center; padding: 0; border: 0; border-radius: 50%; background: var(--bg-soft); color: var(--muted); cursor: pointer; }
.msg-act:hover { background: var(--bg-hover); color: var(--text); }

.quote { display: grid; gap: 1px; width: 100%; min-width: 120px; margin: 0 0 6px; padding: 5px 9px; border: 0; border-left: 3px solid var(--q, var(--accent)); border-radius: 8px;
  background: color-mix(in srgb, currentColor 9%, transparent); color: inherit; font: inherit; text-align: left; cursor: pointer; }
.quote:hover { background: color-mix(in srgb, currentColor 14%, transparent); }
.quote-who { font-size: 12px; font-weight: 600; color: var(--q, var(--accent)); }
.msg.me .quote-who { color: inherit; opacity: .9; }
.msg.me .quote { border-left-color: color-mix(in srgb, currentColor 70%, transparent); }
.quote-text { font-size: 12.5px; opacity: .85; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 260px; }
.bubble.media .quote, .bubble.sticker .quote { color: var(--text); margin: 6px 6px 6px; width: auto; }
.bubble.sticker .quote { background: var(--bg-soft); }

.reactions { display: flex; flex-wrap: wrap; gap: 4px; margin-top: -4px; position: relative; z-index: 1; }
.msg.me .reactions { justify-content: flex-end; }
.reaction { display: inline-flex; align-items: center; gap: 3px; height: 24px; padding: 0 7px; border: 1px solid var(--border); border-radius: 999px; background: var(--bg);
  color: var(--text); font: inherit; font-size: 12px; cursor: pointer; box-shadow: 0 1px 2px rgba(16, 24, 40, .08); transition: transform .12s, border-color .12s; }
.reaction:hover { transform: scale(1.06); border-color: var(--accent); }
.reaction.mine { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }
.reaction-emoji { font-size: 14px; line-height: 1; }
.reaction-n { font-weight: 600; font-variant-numeric: tabular-nums; }

.react-pick { position: fixed; z-index: 1000; display: flex; align-items: center; gap: 2px; padding: 4px; border: 1px solid var(--border); border-radius: 999px;
  background: var(--bg); box-shadow: var(--shadow); animation: dvpop .12s ease-out; }
.react-opt { width: 34px; height: 34px; display: grid; place-items: center; padding: 0; border: 0; border-radius: 50%; background: none; font-size: 20px; cursor: pointer; transition: transform .12s, background .12s; }
.react-opt:hover, .react-opt:focus-visible { transform: scale(1.22); background: var(--bg-hover); outline: none; }
.react-opt.on { background: var(--accent-soft); }
.react-reply { display: flex; align-items: center; gap: 6px; height: 30px; margin-left: 4px; padding: 0 12px 0 10px; border: 0; border-left: 1px solid var(--border); border-radius: 0 999px 999px 0;
  background: none; color: var(--text); font: inherit; font-size: 13px; cursor: pointer; }
.react-reply:hover { color: var(--accent); }

.reply-bar { display: flex; align-items: center; gap: 10px; margin: 0 0 6px; padding: 6px 6px 6px 12px; border-left: 3px solid var(--accent); border-radius: 10px; background: var(--bg-soft); }
.reply-bar.hidden { display: none; }
.reply-ic { display: flex; color: var(--accent); flex: none; }
.reply-main { flex: 1; min-width: 0; }
.reply-who { font-size: 12px; font-weight: 600; color: var(--accent); }
.reply-text { font-size: 12.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

@keyframes msgflash { 0%, 60% { background: var(--accent-soft); } 100% { background: transparent; } }
.msg.flash { animation: msgflash 1.6s ease-out; border-radius: 12px; }

/* ---------------- ჩატის PIN ---------------- */
.conv-more {
  position: absolute; right: 6px; top: 50%; transform: translateY(-50%); width: 26px; height: 26px; border-radius: 8px;
  display: grid; place-items: center; color: var(--muted); background: var(--bg-hover);
  opacity: 0; pointer-events: none; transition: opacity .12s;
}
.conv-item:hover .conv-more, .conv-item.menu-open .conv-more, .conv-item:focus-within .conv-more, .conv-more:focus-visible { opacity: 1; pointer-events: auto; }
.conv-more:hover { color: var(--text); background: var(--bg-active); }
.conv-item:hover .conv-time, .conv-item.menu-open .conv-time { visibility: hidden; }
.conv-lock { display: inline-flex; vertical-align: -1px; margin-right: 4px; color: var(--accent); }
.conv-item.locked .conv-preview { font-style: italic; }

.pin-flow { display: grid; gap: 12px; }
.pin-flow p { margin: 0; line-height: 1.5; }
.pin-flow .center { text-align: center; }
.pin-hero { justify-self: center; width: 52px; height: 52px; border-radius: 16px; display: grid; place-items: center; background: var(--bg-hover); color: var(--accent); }
.pin-input { text-align: center; font-size: 22px; letter-spacing: .5em; padding-left: calc(12px + .5em); font-variant-numeric: tabular-nums; }
.pin-input.code { letter-spacing: .35em; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.pin-input::placeholder { letter-spacing: .3em; color: var(--muted); opacity: .6; }
.pin-forgot { justify-self: center; }
.pin-resend { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.pin-timer { font-variant-numeric: tabular-nums; }
.pin-input.shake { animation: pinshake .32s; border-color: var(--danger); }
@keyframes pinshake { 0%, 100% { transform: none; } 20%, 60% { transform: translateX(-6px); } 40%, 80% { transform: translateX(6px); } }
@media (prefers-reduced-motion: reduce) { .pin-input.shake { animation: none; } }
.pin-settings .pin-status { display: flex; align-items: center; gap: 10px; }
.pin-settings .pin-status > div { display: grid; gap: 2px; }
.pin-status-ic { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; background: var(--bg-hover); color: var(--muted); flex: none; }
.pin-status-ic.on { color: var(--accent); }
.pin-settings .settings-row-btns { align-items: center; flex-wrap: wrap; }
.pin-settings .btn.danger { margin-left: 0; height: 30px; }

/* ---------------- ჩატებში გაგზავნილი ფაილები ---------------- */
.dv-confirm { white-space: pre-line; line-height: 1.55; }
.dv-tree-head { display: flex; align-items: center; gap: 6px; margin: 14px 6px 4px; font-size: 11px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); }
.dv-tree-head svg { flex: none; }
.dv-node.dv-chat-node { padding-left: 8px; gap: 8px; }
.dv-chat-info[hidden], .dv-toolbar[hidden] { display: none !important; }
.dv-node-av { flex: none; display: grid; place-items: center; width: 20px; height: 20px; }
.dv-node-av .avatar { width: 20px !important; height: 20px !important; font-size: 9px !important; }
.dv-node-av .status-dot { display: none; }
.dv-node-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dv-node-count { flex: none; min-width: 20px; padding: 0 6px; height: 18px; border-radius: 9px; background: var(--bg-hover); color: var(--muted); font-size: 11px; font-weight: 600; display: grid; place-items: center; font-variant-numeric: tabular-nums; }
.dv-node.on .dv-node-count { background: var(--bg); color: var(--accent); }
.dv-chat-info { display: flex; align-items: flex-start; gap: 8px; margin: 0 16px 6px; padding: 9px 12px; border-radius: 10px; background: var(--bg-soft); border: 1px solid var(--border); color: var(--muted); font-size: 12.5px; line-height: 1.45; }
.dv-chat-info svg { flex: none; margin-top: 1px; color: var(--accent); }
.dv-tile { position: relative; }
.dv-badge { position: absolute; top: 8px; left: 8px; padding: 1px 7px; border-radius: 8px; background: var(--accent); color: #fff; font-size: 10.5px; font-weight: 600; pointer-events: none; }
.dv-lock-mark { position: absolute; right: 6px; bottom: 6px; width: 20px; height: 20px; border-radius: 6px; display: grid; place-items: center; background: rgba(0,0,0,.55); color: #fff; }
.dv-tile-thumb { position: relative; }
.dv-tile-thumb img.e2ee-pending { opacity: .25; }

/* ჩატი: წაშლილი ფაილი */
.bubble.file-deleted { display: flex; flex-direction: column; gap: 4px; font-style: italic; }
.file-deleted-msg { display: inline-flex; align-items: center; gap: 6px; opacity: .75; }
.react-reply.danger { color: var(--danger); }

/* ---------------- ფაილის გაზიარება ---------------- */
.dv-share-mark { position: absolute; left: 6px; bottom: 6px; width: 20px; height: 20px; border-radius: 6px; display: grid; place-items: center; background: var(--accent); color: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.25); }
.share-flow { display: grid; gap: 14px; min-width: 0; }
.share-flow p { margin: 0; line-height: 1.5; }
.share-file { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border: 1px solid var(--border); border-radius: 12px; }
.share-file-ic { flex: none; width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center; background: var(--bg-hover); color: var(--accent); }
.share-file-info { display: grid; min-width: 0; }
.share-file-info b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.share-private, .share-public { display: flex; align-items: center; gap: 8px; font-size: 13.5px; font-weight: 600; }
.share-private { color: var(--muted); }
.share-public { color: var(--accent); }
.share-private svg, .share-public svg { flex: none; }
.share-link { display: flex; gap: 8px; }
.share-link .input { flex: 1; min-width: 0; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12.5px; }
.share-row { display: flex; gap: 8px; flex-wrap: wrap; }
.share-actions { display: flex; justify-content: flex-end; }
.share-actions .btn.danger { margin-left: 0; }
.share-exp { width: 100%; }

/* ვერსია სიის ბოლოში */
.app-version { grid-column: 1 / -1; margin-top: 1px; text-align: center; font-size: 10.5px; line-height: 1.2; color: var(--muted); opacity: .75; letter-spacing: .02em; user-select: text; font-variant-numeric: tabular-nums; }

/* ---------- DenCloud: სისტემური შეტყობინებები ---------- */
.system-item { border-bottom: 1px solid var(--border); }
.system-item .conv-title { font-weight: 700; }
.system-mark {
  position: absolute; right: -2px; bottom: -2px; width: 15px; height: 15px; border-radius: 50%;
  display: grid; place-items: center; background: var(--accent); color: #fff; border: 2px solid var(--bg);
}
.system-mark svg { stroke-width: 3.2; }
.modal.notices-modal { width: 440px; }
.notices { display: flex; flex-direction: column; gap: 10px; }
.notice { border: 1px solid var(--border); border-radius: 12px; padding: 12px 12px 12px 14px; background: var(--bg); position: relative; }
.notice.unread { border-color: var(--accent); background: var(--accent-soft); }
.notice-head { display: flex; align-items: center; gap: 8px; }
.notice-ic { flex: none; width: 26px; height: 26px; border-radius: 8px; display: grid; place-items: center; background: var(--bg-soft); color: var(--accent); }
.notice.promo .notice-ic { color: var(--warn); }
.notice-title { flex: 1; min-width: 0; font-size: 13.5px; line-height: 1.35; }
.notice-time { flex: none; font-size: 11.5px; color: var(--muted); }
.notice-del { flex: none; width: 24px; height: 24px; opacity: .55; }
.notice-del:hover { opacity: 1; }
.notice-body { margin-top: 6px; font-size: 13px; line-height: 1.5; color: var(--text); overflow-wrap: anywhere; }
.notice-body p { margin: 0 0 6px; }
.notice-body p:last-child { margin-bottom: 0; }
.notice-foot { margin-top: 10px; display: flex; justify-content: flex-end; }

/* ---------- ჩემი ფაილები: „მეტი ადგილი“ და ცარიელი ფოლდერი ---------- */
.dv-upgrade {
  position: relative; overflow: hidden; display: flex; align-items: center; justify-content: center; gap: 7px;
  width: 100%; padding: 9px 12px; border: 0; border-radius: 10px; cursor: pointer;
  font: inherit; font-size: 13px; font-weight: 700; color: #fff;
  background: linear-gradient(135deg, #ff8a3d 0%, #f5487f 55%, #8b5cf6 100%);
  box-shadow: 0 4px 14px rgba(245, 72, 127, .35);
  transition: transform .15s, box-shadow .15s, filter .15s;
}
.dv-upgrade svg { flex: none; fill: currentColor; }
.dv-upgrade::after {
  content: ''; position: absolute; inset: 0; transform: translateX(-120%);
  background: linear-gradient(100deg, transparent 30%, rgba(255,255,255,.45) 50%, transparent 70%);
  animation: dv-shine 3.2s ease-in-out infinite;
}
.dv-upgrade:hover { transform: translateY(-1px); box-shadow: 0 6px 18px rgba(245, 72, 127, .45); filter: brightness(1.05); }
.dv-upgrade:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.dv-upgrade.urgent { animation: dv-pulse 1.8s ease-in-out infinite; }
@keyframes dv-shine { 0%, 55% { transform: translateX(-120%); } 85%, 100% { transform: translateX(120%); } }
@keyframes dv-pulse { 0%, 100% { box-shadow: 0 4px 14px rgba(245, 72, 127, .35); } 50% { box-shadow: 0 0 0 6px rgba(245, 72, 127, .18), 0 6px 20px rgba(245, 72, 127, .5); } }
@media (prefers-reduced-motion: reduce) { .dv-upgrade::after, .dv-upgrade.urgent { animation: none; } }

.dv-dropzone {
  grid-column: 1 / -1; align-self: center; justify-self: center; margin: 32px auto; width: min(440px, 100%);
  display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 34px 24px;
  border: 2px dashed var(--border); border-radius: 16px; background: var(--bg-soft); color: var(--text);
  font: inherit; text-align: center; cursor: pointer; transition: border-color .15s, background .15s;
}
.dv-dropzone:hover, .dv-dropzone:focus-visible { border-color: var(--accent); background: var(--accent-soft); outline: none; }
.dv-dropzone b { font-size: 14.5px; }
.dv-dropzone .muted { font-size: 12.5px; }
.dv-dropzone .btn { margin-top: 6px; pointer-events: none; }
.dv-dropzone-ic { width: 60px; height: 60px; border-radius: 50%; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); margin-bottom: 4px; }

/* ---------- პარამეტრები: დიდი ფანჯარა, მარცხნივ მენიუ ---------- */
.st { flex: 1; min-width: 0; display: grid; grid-template-columns: 212px minmax(0, 1fr); }
.st-nav { display: flex; flex-direction: column; gap: 1px; padding: 10px 8px; overflow-y: auto; border-right: 1px solid var(--border); background: var(--bg-soft); border-bottom-left-radius: var(--radius); }
.st-nav-group { padding: 12px 10px 4px; font-size: 11px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--muted); }
.st-nav-group:first-child { padding-top: 2px; }
.st-nav-btn { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 34px; padding: 6px 10px; border: 0; border-radius: 9px; background: none; color: var(--text); font: inherit; font-size: 13.5px; text-align: left; cursor: pointer; }
.st-nav-btn svg { flex: none; color: var(--muted); }
.st-nav-btn:hover { background: var(--bg-hover); }
.st-nav-btn.on { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.st-nav-btn.on svg { color: var(--accent); }
.st-nav-btn.danger.on, .st-nav-btn.danger:hover { color: var(--danger); }
.st-nav-btn.danger.on { background: color-mix(in srgb, var(--danger) 10%, transparent); }
.st-nav-btn.danger.on svg { color: var(--danger); }
.st-nav-foot { margin-top: auto; padding-top: 10px; border-top: 1px solid var(--border); }
.st-nav-btn.logout { color: var(--danger); }
.st-nav-btn.logout svg { color: var(--danger); }
.st-main { min-width: 0; overflow-y: auto; padding: 18px 22px 28px; display: flex; flex-direction: column; gap: 12px; }
.st-head h2 { margin: 0; font-size: 18px; }
.st-head p { margin: 4px 0 4px; font-size: 13px; }
.st-card { border: 1px solid var(--border); border-radius: 14px; padding: 14px 16px; background: var(--bg); display: flex; flex-direction: column; gap: 10px; }
.st-card h4 { margin: 0; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.st-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; cursor: pointer; }
.st-row-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.st-row-text b { font-weight: 600; font-size: 14px; }
.st-row-text small { color: var(--muted); font-size: 12.5px; line-height: 1.45; }
.st-row-ctl { flex: none; display: flex; align-items: center; gap: 8px; }
.st-list { margin: 0; padding-left: 18px; display: flex; flex-direction: column; gap: 4px; font-size: 13px; line-height: 1.5; }
.st-p { margin: 0; font-size: 13px; }
.st-actions { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.st-actions.end { justify-content: flex-end; }
.st-grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.st-field { display: flex; flex-direction: column; gap: 5px; font-size: 12.5px; color: var(--muted); }
.st-field .input { width: 100%; }
.st-readonly { display: flex; align-items: center; gap: 8px; padding: 8px 12px; border-radius: 10px; background: var(--bg-soft); font-size: 14px; }
.st-profile { display: flex; align-items: center; gap: 18px; }
.st-profile-main { min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.st-profile-name { font-size: 17px; font-weight: 700; }
.st-avatar { position: relative; flex: none; }
.st-avatar.busy { opacity: .5; transition: opacity .2s; }
.st-presets { display: grid; grid-template-columns: repeat(auto-fill, minmax(48px, 1fr)); gap: 8px; }
.st-preset { aspect-ratio: 1; padding: 0; border: 2px solid transparent; border-radius: 50%; background: none; cursor: pointer; transition: transform .12s, border-color .12s; }
.st-preset img { width: 100%; height: 100%; border-radius: 50%; display: block; }
.st-preset:hover { transform: scale(1.08); border-color: var(--accent); }
.st-preset:disabled { opacity: .5; }
.st-choices { display: flex; flex-direction: column; gap: 2px; }
.st-choice { display: flex; align-items: center; gap: 12px; padding: 9px 10px; border-radius: 10px; cursor: pointer; }
.st-choice:hover { background: var(--bg-hover); }
.st-choice:has(input:checked) { background: var(--accent-soft); }
.st-choice input { accent-color: var(--accent); margin: 0; }
.st-themes { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 10px; }
.st-theme { display: flex; flex-direction: column; gap: 6px; padding: 6px; border: 2px solid var(--border); border-radius: 12px; background: var(--bg); cursor: pointer; font: inherit; color: var(--text); }
.st-theme.selected { border-color: var(--accent); }
.st-theme-preview { position: relative; height: 64px; border-radius: 8px; display: flex; flex-direction: column; justify-content: center; gap: 5px; padding: 0 10px; }
.st-theme-preview i { display: block; height: 9px; width: 55%; border-radius: 6px; opacity: .85; }
.st-theme-preview i.me { align-self: flex-end; width: 45%; }
.st-theme-name { display: flex; align-items: center; justify-content: space-between; font-size: 12.5px; font-weight: 600; padding: 0 2px; }
.st-check { color: var(--accent); display: inline-flex; }
.st-convs { display: flex; flex-direction: column; gap: 2px; }
.st-convs.scroll { max-height: 280px; overflow-y: auto; }
.st-conv { display: flex; align-items: center; gap: 10px; padding: 6px 4px; border-radius: 10px; }
.st-conv:hover { background: var(--bg-hover); }
.st-conv-name { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 13.5px; }
.st-empty { margin: 0; font-size: 13px; }
.st-danger-head { display: flex; align-items: flex-start; gap: 12px; }
.st-danger-head > div { display: flex; flex-direction: column; gap: 3px; }
.st-danger-ic { flex: none; width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; background: color-mix(in srgb, var(--danger) 12%, transparent); color: var(--danger); }
.st-danger-ic.warn { background: color-mix(in srgb, var(--warn, #f59e0b) 15%, transparent); color: var(--warn, #b45309); }
.st-del-info { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.st-del-info > div { padding: 10px; border-radius: 10px; background: var(--bg-soft); display: flex; flex-direction: column; }
.st-del-info b { font-size: 18px; }
.st-del-info small { color: var(--muted); font-size: 11.5px; }
.st-warn { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 10px; background: color-mix(in srgb, var(--warn, #f59e0b) 14%, transparent); font-size: 13px; }
.st-warn[hidden] { display: none; }
.st-warn > span:nth-child(2) { flex: 1; }
.st-del { display: flex; flex-direction: column; gap: 14px; }
.st-del p { margin: 0; font-size: 13.5px; line-height: 1.5; }
.st-del-backup { display: flex; gap: 10px; align-items: flex-start; padding: 12px; border: 1px solid var(--border); border-radius: 12px; cursor: pointer; }
.st-del-backup input { margin-top: 3px; accent-color: var(--accent); }
.st-about { display: flex; align-items: center; gap: 14px; }
.st-about img { width: 44px; height: 44px; }
.st-about > div { display: flex; flex-direction: column; }
@media (max-width: 620px) { .st { grid-template-columns: 1fr; grid-template-rows: auto 1fr; } .st-nav { flex-direction: row; overflow-x: auto; border-right: 0; border-bottom: 1px solid var(--border); } .st-nav-group, .st-nav-foot { display: none; } .st-nav-btn { width: auto; white-space: nowrap; } .st-grid2, .st-del-info { grid-template-columns: 1fr; } }

/* ---------- სავალდებულო ფანჯრები (წესები / დახურული ანგარიში) ---------- */
body.account-gated .conv-list, body.account-gated .chat, body.account-gated #chat-empty { visibility: hidden; }
.modal-overlay.locked { backdrop-filter: blur(6px); background: color-mix(in srgb, var(--bg) 55%, rgba(0,0,0,.45)); }
.modal.gate { width: 420px; }
.modal.gate.wide-gate { width: min(640px, calc(100vw - 24px)); height: min(560px, calc(100vh - 24px)); }
.modal.wide-gate .modal-body { display: flex; flex-direction: column; min-height: 0; flex: 1; }
.gate-body { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 12px; padding: 8px 4px; }
.gate-body p { margin: 0; font-size: 14px; line-height: 1.55; }
.gate-ic { width: 56px; height: 56px; border-radius: 50%; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); }
.gate-ic.danger { background: color-mix(in srgb, var(--danger) 12%, transparent); color: var(--danger); }
.gate-terms { display: flex; flex-direction: column; gap: 10px; min-height: 0; flex: 1; }
.gate-terms > p { margin: 0; font-size: 13px; }
.gate-note { display: flex; gap: 8px; align-items: flex-start; padding: 10px 12px; border-radius: 10px; background: var(--accent-soft); font-size: 13px; color: var(--text); }
.gate-note svg { flex: none; color: var(--accent); margin-top: 2px; }
.gate-bar { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.gate-tabs { display: inline-flex; padding: 3px; border-radius: 10px; background: var(--bg-soft); }
.gate-tabs button { border: 0; background: none; padding: 6px 12px; border-radius: 8px; font: inherit; font-size: 13px; font-weight: 600; color: var(--muted); cursor: pointer; }
.gate-tabs button.on { background: var(--bg); color: var(--text); box-shadow: 0 1px 2px rgba(0,0,0,.08); }
.gate-doc { flex: 1; min-height: 160px; overflow-y: auto; padding: 4px 14px 14px; border: 1px solid var(--border); border-radius: 12px; font-size: 13px; line-height: 1.6; background: var(--bg); }
.gate-doc h1 { font-size: 17px; margin: 12px 0 2px; }
.gate-doc h2 { font-size: 14px; margin: 16px 0 4px; }
.gate-doc p, .gate-doc ul { margin: 0 0 8px; }
.gate-doc ul { padding-left: 18px; }
.gate-doc a { color: var(--accent); }
.gate-check { display: flex; align-items: center; gap: 10px; font-size: 13.5px; font-weight: 600; cursor: pointer; }
.gate-check input { width: 17px; height: 17px; accent-color: var(--accent); margin: 0; }
.login-legal { margin: 6px 0 0; font-size: 11.5px; color: var(--muted); line-height: 1.5; max-width: 300px; }
.login-legal a { color: var(--accent); }

.link-btn { display: inline-flex; align-items: center; gap: 5px; }

/* ---------- შემსწავლელი ტური ---------- */
.tour { position: fixed; inset: 0; z-index: 2000; }
.tour-hole { position: fixed; border-radius: 12px; box-shadow: 0 0 0 9999px rgba(10, 14, 25, .62); transition: left .25s, top .25s, width .25s, height .25s; pointer-events: none; outline: 2px solid color-mix(in srgb, var(--accent) 70%, #fff); outline-offset: 0; }
.tour-tip { position: fixed; width: 300px; max-width: calc(100vw - 20px); padding: 16px 16px 12px; border-radius: 16px; background: var(--bg); color: var(--text); box-shadow: 0 18px 48px rgba(0,0,0,.28); transition: left .25s, top .25s; }
.tour-tip.center { width: 340px; text-align: center; }
.tour-tip h3 { margin: 2px 0 6px; font-size: 16px; }
.tour-tip p { margin: 0 0 12px; font-size: 13px; line-height: 1.55; color: var(--text); opacity: .9; }
.tour-ic { width: 54px; height: 54px; margin: 0 auto 10px; border-radius: 50%; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); }
.tour-step { font-size: 11px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--accent); }
.tour-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.tour-tip.center .tour-foot { justify-content: space-between; }
.tour-btns { display: flex; gap: 6px; }
.tour-dots { display: flex; gap: 4px; }
.tour-dots i { width: 6px; height: 6px; border-radius: 50%; background: var(--border); }
.tour-dots i.past { background: color-mix(in srgb, var(--accent) 45%, var(--border)); }
.tour-dots i.on { background: var(--accent); width: 14px; border-radius: 4px; }
.tour-skip { font-size: 12.5px; color: var(--muted); }
@media (prefers-reduced-motion: reduce) { .tour-hole, .tour-tip { transition: none; } }

/* ---------- გამოკითხვა ---------- */
.modal.poll-modal { width: 460px; }
.poll-new { display: flex; flex-direction: column; gap: 14px; }
.poll-q { resize: none; font: inherit; font-size: 14px; }
.poll-opts-edit { display: flex; flex-direction: column; gap: 6px; }
.poll-opt-edit { display: flex; align-items: center; gap: 6px; }
.poll-opt-edit .input { flex: 1; }
.poll-drag { color: var(--muted); width: 10px; text-align: center; }
.poll-settings { display: flex; flex-direction: column; gap: 10px; padding: 12px 14px; border: 1px solid var(--border); border-radius: 12px; }
.poll-settings h4 { margin: 0; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.poll-setting .st-row-text b { font-size: 13.5px; }
.poll-sub { display: flex; align-items: center; justify-content: flex-end; gap: 8px; font-size: 12.5px; color: var(--muted); margin-top: -4px; }
.poll-sub[hidden] { display: none; }
.poll-deadline { width: auto; }
.poll-warn { display: flex; gap: 6px; align-items: flex-start; margin: 0; font-size: 12.5px; color: var(--muted); }
.bubble.poll { min-width: 260px; max-width: 340px; display: flex; flex-direction: column; gap: 8px; padding: 10px 12px 8px; }
.poll-head { display: flex; align-items: center; gap: 5px; font-size: 11px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; opacity: .7; }
.poll-question { font-size: 15px; font-weight: 700; line-height: 1.35; overflow-wrap: anywhere; }
.poll-tags { display: flex; flex-wrap: wrap; gap: 4px; margin-top: -2px; }
.poll-tags span { font-size: 11px; padding: 1px 7px; border-radius: 999px; background: color-mix(in srgb, currentColor 10%, transparent); }
.poll-opts { display: flex; flex-direction: column; gap: 6px; }
.poll-opt { display: flex; align-items: flex-start; gap: 9px; width: 100%; padding: 8px 10px; border: 1px solid color-mix(in srgb, currentColor 18%, transparent); border-radius: 10px; background: color-mix(in srgb, currentColor 4%, transparent); color: inherit; font: inherit; text-align: left; cursor: pointer; transition: border-color .12s, background .12s; }
.poll-opt:hover:not(:disabled) { border-color: var(--accent); }
.poll-opt:disabled { cursor: default; }
.poll-opt.on { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 12%, transparent); }
.poll-mark { flex: none; width: 18px; height: 18px; margin-top: 1px; border-radius: 50%; border: 2px solid color-mix(in srgb, currentColor 35%, transparent); display: grid; place-items: center; color: #fff; }
.poll-opt.multi .poll-mark { border-radius: 5px; }
.poll-opt.on .poll-mark { background: var(--accent); border-color: var(--accent); }
.poll-mark svg { stroke-width: 3.4; }
.poll-opt-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.poll-opt-top { display: flex; justify-content: space-between; gap: 8px; }
.poll-opt-text { font-size: 13.5px; overflow-wrap: anywhere; }
.poll-pct { flex: none; font-size: 12.5px; font-weight: 700; font-variant-numeric: tabular-nums; }
.poll-bar { height: 5px; border-radius: 3px; background: color-mix(in srgb, currentColor 12%, transparent); overflow: hidden; }
.poll-bar i { display: block; height: 100%; border-radius: 3px; background: var(--accent); transition: width .3s; }
.poll-voters { display: flex; align-items: center; gap: 2px; }
.poll-voters .avatar { border: 1px solid var(--bg); }
.poll-voters small, .poll-added { font-size: 11px; opacity: .7; }
.poll-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.poll-total { font-size: 12px; opacity: .75; }
.poll-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.poll-actions .link-btn { font-size: 12.5px; }
.link-btn.danger { color: var(--danger); }
.bubble.poll.closed .poll-question { opacity: .85; }
.msg.me .bubble.poll .poll-bar i { background: currentColor; }
.msg.me .bubble.poll .poll-opt.on { border-color: currentColor; background: color-mix(in srgb, currentColor 16%, transparent); }
.msg.me .bubble.poll .poll-opt.on .poll-mark { background: currentColor; border-color: currentColor; color: var(--accent); }
.msg.me .bubble.poll .link-btn { color: inherit; text-decoration: underline; }
.msg.me .bubble.poll .btn.primary { background: #fff; color: var(--accent); border-color: #fff; }
.msg.me .bubble.poll .btn.primary:disabled { opacity: .55; }
.msg.me .bubble.poll .poll-voters .avatar { border-color: transparent; }
