/* =========================================================
   H-CHAT V3 — THEME SYSTEM 190
   Same theme ids as current H-Chat:
   light dark ocean forest sunset violet rose whatsapp
   ========================================================= */

/* ---------- Shared theme variables ---------- */
html{
  --theme-bg:#f3f5f8;
  --theme-surface:#ffffff;
  --theme-surface-2:#f8f9fb;
  --theme-elevated:#ffffff;
  --theme-input:#fbfcfd;
  --theme-hover:#fafbfd;
  --theme-rail:#fafbfc;
  --theme-chat:#ffffff;
  --theme-topic:#fbfcfd;
  --theme-line:#dfe4ea;
  --theme-line-2:#edf0f4;
  --theme-text:#18202a;
  --theme-message:#303946;
  --theme-muted:#6d7785;
  --theme-faint:#9aa3ae;
  --theme-brand:#0A2E6D;
  --theme-brand-soft:#E8F7F6;
  --theme-avatar:#e8ebf1;
  --theme-avatar-text:#344052;
  --theme-role:#252e39;
  --theme-bot:#fcfbff;
  --theme-bot-line:#baa9eb;
  --theme-shadow:rgba(25,33,43,.10);
  --theme-overlay:rgba(243,245,248,.96);
  --theme-scroll:#c9d0d9;
  --theme-panel-copy:#f8f9fb;
}

html[data-theme="light"]{
  --theme-bg:#f3f5f8;
  --theme-surface:#ffffff;
  --theme-surface-2:#f8f9fb;
  --theme-elevated:#ffffff;
  --theme-input:#fbfcfd;
  --theme-hover:#fafbfd;
  --theme-rail:#fafbfc;
  --theme-chat:#ffffff;
  --theme-topic:#fbfcfd;
  --theme-line:#dfe4ea;
  --theme-line-2:#edf0f4;
  --theme-text:#18202a;
  --theme-message:#303946;
  --theme-muted:#6d7785;
  --theme-faint:#9aa3ae;
  --theme-brand:#0A2E6D;
  --theme-brand-soft:#E8F7F6;
  --theme-avatar:#e8ebf1;
  --theme-avatar-text:#344052;
  --theme-role:#252e39;
  --theme-bot:#fcfbff;
  --theme-bot-line:#baa9eb;
  --theme-shadow:rgba(25,33,43,.10);
  --theme-overlay:rgba(243,245,248,.96);
  --theme-scroll:#c9d0d9;
  --theme-panel-copy:#f8f9fb;
}

html[data-theme="dark"]{
  --theme-bg:#11161c;
  --theme-surface:#171d24;
  --theme-surface-2:#1c232c;
  --theme-elevated:#202832;
  --theme-input:#151b22;
  --theme-hover:#1d252e;
  --theme-rail:#131920;
  --theme-chat:#171d24;
  --theme-topic:#151b22;
  --theme-line:#303945;
  --theme-line-2:#252e38;
  --theme-text:#edf1f6;
  --theme-message:#dfe5ec;
  --theme-muted:#9ca7b4;
  --theme-faint:#737f8d;
  --theme-brand:#25D2C7;
  --theme-brand-soft:#143B43;
  --theme-avatar:#29323e;
  --theme-avatar-text:#e5ebf2;
  --theme-role:#303947;
  --theme-bot:#1d1b27;
  --theme-bot-line:#8c79ca;
  --theme-shadow:rgba(0,0,0,.28);
  --theme-overlay:rgba(11,15,20,.96);
  --theme-scroll:#46515e;
  --theme-panel-copy:#1c232c;
}

html[data-theme="ocean"]{
  --theme-bg:#edf6fb;
  --theme-surface:#ffffff;
  --theme-surface-2:#f2f8fc;
  --theme-elevated:#ffffff;
  --theme-input:#f6fbfe;
  --theme-hover:#f0f8fc;
  --theme-rail:#f4f9fc;
  --theme-chat:#ffffff;
  --theme-topic:#f4fafe;
  --theme-line:#d3e4ee;
  --theme-line-2:#e4eff5;
  --theme-text:#18303d;
  --theme-message:#274453;
  --theme-muted:#647d89;
  --theme-faint:#90a6b1;
  --theme-brand:#2f7fa8;
  --theme-brand-soft:#e2f2fa;
  --theme-avatar:#e4f0f6;
  --theme-avatar-text:#345766;
  --theme-role:#28586e;
  --theme-bot:#f5fbfe;
  --theme-bot-line:#81b8d0;
  --theme-shadow:rgba(33,89,116,.10);
  --theme-overlay:rgba(237,246,251,.96);
  --theme-scroll:#b8d1de;
  --theme-panel-copy:#f2f8fc;
}

html[data-theme="forest"]{
  --theme-bg:#eef5f0;
  --theme-surface:#ffffff;
  --theme-surface-2:#f4f8f5;
  --theme-elevated:#ffffff;
  --theme-input:#f8fbf9;
  --theme-hover:#f1f7f3;
  --theme-rail:#f3f8f4;
  --theme-chat:#ffffff;
  --theme-topic:#f6faf7;
  --theme-line:#d7e4da;
  --theme-line-2:#e7efe9;
  --theme-text:#203329;
  --theme-message:#30483a;
  --theme-muted:#6a7f72;
  --theme-faint:#96a69b;
  --theme-brand:#3f7d58;
  --theme-brand-soft:#e4f1e8;
  --theme-avatar:#e4eee7;
  --theme-avatar-text:#3e5e49;
  --theme-role:#315744;
  --theme-bot:#f6faf7;
  --theme-bot-line:#91b99e;
  --theme-shadow:rgba(47,91,64,.10);
  --theme-overlay:rgba(238,245,240,.96);
  --theme-scroll:#bfd0c3;
  --theme-panel-copy:#f4f8f5;
}

html[data-theme="sunset"]{
  --theme-bg:#fbf2ed;
  --theme-surface:#fffdfb;
  --theme-surface-2:#fdf7f3;
  --theme-elevated:#fffdfb;
  --theme-input:#fffaf7;
  --theme-hover:#fcf3ee;
  --theme-rail:#fdf8f5;
  --theme-chat:#fffdfb;
  --theme-topic:#fff8f4;
  --theme-line:#ecdcd3;
  --theme-line-2:#f3e7e0;
  --theme-text:#3b2922;
  --theme-message:#4e3830;
  --theme-muted:#887065;
  --theme-faint:#ae978d;
  --theme-brand:#ce704f;
  --theme-brand-soft:#fae7de;
  --theme-avatar:#f2e6df;
  --theme-avatar-text:#6c4d41;
  --theme-role:#795041;
  --theme-bot:#fff7f2;
  --theme-bot-line:#d9a48e;
  --theme-shadow:rgba(104,67,49,.10);
  --theme-overlay:rgba(251,242,237,.96);
  --theme-scroll:#dcc2b5;
  --theme-panel-copy:#fdf7f3;
}

html[data-theme="violet"]{
  --theme-bg:#f4f1f9;
  --theme-surface:#ffffff;
  --theme-surface-2:#f9f7fc;
  --theme-elevated:#ffffff;
  --theme-input:#fbf9fe;
  --theme-hover:#f7f4fb;
  --theme-rail:#f8f6fb;
  --theme-chat:#ffffff;
  --theme-topic:#faf8fd;
  --theme-line:#e2dbec;
  --theme-line-2:#eee9f4;
  --theme-text:#2f2840;
  --theme-message:#423953;
  --theme-muted:#766c86;
  --theme-faint:#a197af;
  --theme-brand:#7255bd;
  --theme-brand-soft:#eee8ff;
  --theme-avatar:#eee9f5;
  --theme-avatar-text:#594b73;
  --theme-role:#55446d;
  --theme-bot:#fcfaff;
  --theme-bot-line:#baa9eb;
  --theme-shadow:rgba(80,59,114,.10);
  --theme-overlay:rgba(244,241,249,.96);
  --theme-scroll:#cfc4df;
  --theme-panel-copy:#f9f7fc;
}

html[data-theme="rose"]{
  --theme-bg:#fbf2f6;
  --theme-surface:#ffffff;
  --theme-surface-2:#fdf7fa;
  --theme-elevated:#ffffff;
  --theme-input:#fffafd;
  --theme-hover:#fcf4f8;
  --theme-rail:#fdf7fa;
  --theme-chat:#ffffff;
  --theme-topic:#fff8fb;
  --theme-line:#edd9e3;
  --theme-line-2:#f4e8ee;
  --theme-text:#3c2933;
  --theme-message:#513943;
  --theme-muted:#876d79;
  --theme-faint:#ad96a1;
  --theme-brand:#bd5d87;
  --theme-brand-soft:#f9e6ef;
  --theme-avatar:#f2e6ec;
  --theme-avatar-text:#704d5d;
  --theme-role:#704658;
  --theme-bot:#fff8fb;
  --theme-bot-line:#dda7bf;
  --theme-shadow:rgba(109,63,84,.10);
  --theme-overlay:rgba(251,242,246,.96);
  --theme-scroll:#ddc2ce;
  --theme-panel-copy:#fdf7fa;
}

html[data-theme="whatsapp"]{
  --theme-bg:#edf4ef;
  --theme-surface:#ffffff;
  --theme-surface-2:#f4f8f5;
  --theme-elevated:#ffffff;
  --theme-input:#f7faf8;
  --theme-hover:#f0f7f3;
  --theme-rail:#f3f8f5;
  --theme-chat:#ffffff;
  --theme-topic:#f4f9f6;
  --theme-line:#d4e3da;
  --theme-line-2:#e5eee9;
  --theme-text:#20312a;
  --theme-message:#30473d;
  --theme-muted:#657a70;
  --theme-faint:#91a49a;
  --theme-brand:#258b5e;
  --theme-brand-soft:#e1f2e9;
  --theme-avatar:#e2eee7;
  --theme-avatar-text:#3a5d4c;
  --theme-role:#345f4b;
  --theme-bot:#f4faf7;
  --theme-bot-line:#8bc2a6;
  --theme-shadow:rgba(38,92,65,.10);
  --theme-overlay:rgba(237,244,239,.96);
  --theme-scroll:#b9d0c3;
  --theme-panel-copy:#f4f8f5;
}

/* ---------- Map theme vars onto V3 core vars ---------- */
html[data-theme]{
  --bg:var(--theme-bg);
  --surface:var(--theme-surface);
  --surface-2:var(--theme-surface-2);
  --line:var(--theme-line);
  --line-2:var(--theme-line-2);
  --text:var(--theme-text);
  --muted:var(--theme-muted);
  --faint:var(--theme-faint);
  --brand:var(--theme-brand);
  --brand-soft:var(--theme-brand-soft);
}

/* ---------- Hard-coded V3 surfaces normalized ---------- */
html[data-theme] body,
html[data-theme] .app{
  background:var(--theme-bg);
  color:var(--theme-text);
}

html[data-theme] .rail{
  background:var(--theme-rail);
  border-color:var(--theme-line);
}

html[data-theme] .workspace{
  background:var(--theme-surface-2);
  border-color:var(--theme-line);
}

html[data-theme] .chat,
html[data-theme] .chat-head,
html[data-theme] .composer,
html[data-theme] .people-drawer,
html[data-theme] .profile-drawer,
html[data-theme] .profile-head,
html[data-theme] .radio-panel{
  background:var(--theme-surface);
  color:var(--theme-text);
  border-color:var(--theme-line);
}

html[data-theme] .topic-bar{
  background:var(--theme-topic);
  border-color:var(--theme-line-2);
}

html[data-theme] .quick-search,
html[data-theme] .people-search,
html[data-theme] .icon-btn,
html[data-theme] .people-btn,
html[data-theme] .attach,
html[data-theme] .profile-secondary,
html[data-theme] .radio-mute,
html[data-theme] .reaction-pill{
  background:var(--theme-elevated);
  color:var(--theme-text);
  border-color:var(--theme-line);
}

html[data-theme] .composer-box,
html[data-theme] .field input{
  background:var(--theme-input);
  color:var(--theme-text);
  border-color:var(--theme-line);
}

html[data-theme] input,
html[data-theme] textarea{
  color:var(--theme-text);
}

html[data-theme] input::placeholder,
html[data-theme] textarea::placeholder{
  color:var(--theme-faint);
  opacity:1;
}

html[data-theme] .room:hover,
html[data-theme] .room.active,
html[data-theme] .dm:hover,
html[data-theme] .dm.active,
html[data-theme] .message:hover,
html[data-theme] .raw-line:hover{
  background:var(--theme-hover);
}

html[data-theme] .room-mark{
  background:var(--theme-avatar);
  color:var(--theme-avatar-text);
}

html[data-theme] .avatar,
html[data-theme] .my-avatar:not(.self-avatar){
  background:var(--theme-avatar);
  color:var(--theme-avatar-text);
}

html[data-theme] .message p,
html[data-theme] .message.action p{
  color:var(--theme-message);
}

html[data-theme] .role{
  background:var(--theme-role);
}

html[data-theme] .bot{
  background:var(--theme-bot);
  border-left-color:var(--theme-bot-line);
}

html[data-theme] .reactions button,
html[data-theme] .reaction-pill{
  background:var(--theme-elevated);
  border-color:var(--theme-line);
}

html[data-theme] .message-reply-quote{
  background:var(--theme-panel-copy);
}

html[data-theme] .message-reply-quote span{
  color:var(--theme-muted);
}

html[data-theme] .message-actions{
  background:var(--theme-surface);
  color:var(--theme-text);
  border-color:var(--theme-line);
  box-shadow:0 14px 38px var(--theme-shadow);
}

html[data-theme] .message-action-main{
  border-color:var(--theme-line-2);
}

html[data-theme] .message-action-main button{
  color:var(--theme-text);
}

html[data-theme] .message-action-main button:hover,
html[data-theme] .reaction-picker button:hover{
  background:var(--theme-hover);
}

html[data-theme] .profile-avatar,
html[data-theme] .radio-cover,
html[data-theme] .login-mark{
  background:var(--theme-role);
}

html[data-theme] .profile-secondary{
  color:var(--theme-text);
}

html[data-theme] .profile-field b{
  color:var(--theme-text);
}

html[data-theme] .profile-channels div span,
html[data-theme] .profile-status,
html[data-theme] .radio-auto-row{
  background:var(--theme-panel-copy);
  color:var(--theme-muted);
  border-color:var(--theme-line-2);
}

html[data-theme] .radio-now-card{
  background:var(--theme-panel-copy);
}

html[data-theme] .radio-dj-card,
html[data-theme] .radio-foot,
html[data-theme] .radio-panel-head{
  border-color:var(--theme-line-2);
}

html[data-theme] .radio-mini.is-playing{
  background:var(--theme-brand-soft);
  border-color:var(--theme-brand);
}

html[data-theme] .login-overlay{
  background:var(--theme-overlay);
}

html[data-theme] .login-card{
  background:var(--theme-surface);
  color:var(--theme-text);
  border-color:var(--theme-line);
  box-shadow:0 24px 70px var(--theme-shadow);
}

html[data-theme] .field>span{
  color:var(--theme-muted);
}

html[data-theme] .field input:focus{
  border-color:var(--theme-brand);
  box-shadow:0 0 0 3px color-mix(in srgb,var(--theme-brand) 12%,transparent);
}

html[data-theme] .profile-drawer,
html[data-theme] .people-drawer,
html[data-theme] .workspace,
html[data-theme] .radio-panel{
  box-shadow:0 18px 50px var(--theme-shadow);
}

html[data-theme] .room-close:hover,
html[data-theme] .room-close:focus{
  background:var(--theme-hover);
}

html[data-theme] .moment-ring b{
  background:var(--theme-avatar);
  color:var(--theme-avatar-text);
}

html[data-theme] .day-sep:before,
html[data-theme] .day-sep:after{
  background:var(--theme-line-2);
}

/* Keep the IRC-style flat timeline in every palette. WhatsApp is color only. */
html[data-theme="whatsapp"] .message{
  border-radius:7px;
}
html[data-theme="whatsapp"] .message p{
  background:transparent;
  padding:0;
}

/* Dark-specific role/card tuning */
html[data-theme="dark"] .profile-role[data-role="rootadmin"],
html[data-theme="dark"] .profile-role[data-role="netadmin"],
html[data-theme="dark"] .profile-role[data-role="admin"]{
  background:#332840;
  color:#d7b7ee;
}
html[data-theme="dark"] .profile-role[data-role="technicaladmin"]{
  background:#203244;
  color:#94c5ee;
}
html[data-theme="dark"] .profile-role[data-role="ircop"],
html[data-theme="dark"] .profile-role[data-role="globaloper"],
html[data-theme="dark"] .profile-role[data-role="localoper"]{
  background:#432c21;
  color:#f0b48d;
}
html[data-theme="dark"] .radio-mode[data-mode="live"]{
  background:#412326;
  color:#ff9ca5;
}
html[data-theme="dark"] .radio-mode[data-mode="auto"]{
  background:#203145;
  color:#91bfea;
}
html[data-theme="dark"] .radio-mode[data-mode="offline"]{
  background:#282f38;
  color:#9ca7b4;
}

/* Scrollbar */
html[data-theme] *{
  scrollbar-color:var(--theme-scroll) transparent;
}
html[data-theme] *::-webkit-scrollbar{
  width:8px;
  height:8px;
}
html[data-theme] *::-webkit-scrollbar-thumb{
  background:var(--theme-scroll);
  border-radius:8px;
  border:2px solid transparent;
  background-clip:padding-box;
}

/* ---------- Theme picker ---------- */
.theme-toggle-btn{
  font-size:16px;
}
.theme-toggle-btn[data-current-theme="dark"]{
  background:var(--brand-soft);
  color:var(--brand);
}

.theme-backdrop{
  position:fixed;
  inset:0;
  z-index:176;
  background:rgba(16,22,29,.20);
  opacity:0;
  transition:opacity .16s ease;
}
.theme-backdrop.show{
  opacity:1;
}

.theme-panel{
  position:fixed;
  z-index:180;
  top:72px;
  right:18px;
  width:360px;
  max-height:calc(100dvh - 90px);
  overflow:auto;
  background:var(--theme-surface);
  color:var(--theme-text);
  border:1px solid var(--theme-line);
  border-radius:12px;
  box-shadow:0 24px 70px var(--theme-shadow);
  opacity:0;
  visibility:hidden;
  transform:translateY(-8px) scale(.985);
  transition:opacity .16s ease,transform .16s ease,visibility .16s ease;
}
.theme-panel.open{
  opacity:1;
  visibility:visible;
  transform:none;
}

.theme-panel-head{
  height:62px;
  padding:0 14px;
  display:flex;
  align-items:center;
  justify-content:space-between;
  border-bottom:1px solid var(--theme-line);
  position:sticky;
  top:0;
  z-index:3;
  background:var(--theme-surface);
}
.theme-panel-head small{
  display:block;
  color:var(--theme-brand);
  font-size:8px;
  font-weight:900;
  letter-spacing:.11em;
}
.theme-panel-head b{
  display:block;
  margin-top:3px;
  font-size:14px;
}
.theme-panel-head button{
  width:32px;
  height:32px;
  border:0;
  background:transparent;
  color:var(--theme-muted);
  font-size:20px;
  cursor:pointer;
}

.theme-panel-copy{
  margin:12px 12px 2px;
  padding:10px 11px;
  border:1px solid var(--theme-line-2);
  background:var(--theme-panel-copy);
  color:var(--theme-muted);
  font-size:9px;
  line-height:1.5;
}

.theme-grid{
  display:grid;
  grid-template-columns:1fr 1fr;
  gap:8px;
  padding:12px;
}

.theme-card{
  position:relative;
  min-width:0;
  min-height:98px;
  padding:8px;
  border:1px solid var(--theme-line);
  border-radius:9px;
  background:var(--theme-surface);
  color:var(--theme-text);
  text-align:left;
  cursor:pointer;
  transition:border-color .14s ease,transform .14s ease,box-shadow .14s ease;
}
.theme-card:hover{
  transform:translateY(-1px);
  box-shadow:0 8px 22px var(--theme-shadow);
}
.theme-card.active{
  border-color:var(--theme-brand);
  box-shadow:0 0 0 2px color-mix(in srgb,var(--theme-brand) 11%,transparent);
}
.theme-card>b{
  display:block;
  margin-top:7px;
  font-size:10.5px;
}
.theme-card>small{
  display:block;
  margin-top:2px;
  color:var(--theme-muted);
  font-size:8px;
}
.theme-card>em{
  position:absolute;
  top:8px;
  right:8px;
  width:18px;
  height:18px;
  display:none;
  place-items:center;
  border-radius:50%;
  background:var(--theme-brand);
  color:#fff;
  font-size:9px;
  font-style:normal;
  font-weight:800;
}
.theme-card.active>em{
  display:grid;
}

.theme-preview{
  height:45px;
  border-radius:6px;
  overflow:hidden;
  display:grid;
  grid-template-columns:14px 38px 1fr;
  border:1px solid rgba(0,0,0,.08);
}
.theme-preview i{
  display:block;
  position:relative;
}
.theme-preview i:nth-child(3):before,
.theme-preview i:nth-child(3):after{
  content:"";
  position:absolute;
  left:7px;
  right:7px;
  height:4px;
  border-radius:3px;
  background:rgba(70,80,95,.18);
}
.theme-preview i:nth-child(3):before{top:11px}
.theme-preview i:nth-child(3):after{top:20px;right:18px}

.tp-light i:nth-child(1){background:#fafbfc}
.tp-light i:nth-child(2){background:#f3f5f8}
.tp-light i:nth-child(3){background:#fff}
.tp-light{box-shadow:inset 0 3px 0 #4f68e8}

.tp-dark i:nth-child(1){background:#131920}
.tp-dark i:nth-child(2){background:#1c232c}
.tp-dark i:nth-child(3){background:#171d24}
.tp-dark i:nth-child(3):before,.tp-dark i:nth-child(3):after{background:rgba(235,240,246,.24)}
.tp-dark{box-shadow:inset 0 3px 0 #8495ff}

.tp-ocean i:nth-child(1){background:#e9f3f8}
.tp-ocean i:nth-child(2){background:#edf6fb}
.tp-ocean i:nth-child(3){background:#fff}
.tp-ocean{box-shadow:inset 0 3px 0 #2f7fa8}

.tp-forest i:nth-child(1){background:#edf4ef}
.tp-forest i:nth-child(2){background:#f4f8f5}
.tp-forest i:nth-child(3){background:#fff}
.tp-forest{box-shadow:inset 0 3px 0 #3f7d58}

.tp-sunset i:nth-child(1){background:#fbefe8}
.tp-sunset i:nth-child(2){background:#fdf7f3}
.tp-sunset i:nth-child(3){background:#fffdfb}
.tp-sunset{box-shadow:inset 0 3px 0 #ce704f}

.tp-violet i:nth-child(1){background:#f0ecf7}
.tp-violet i:nth-child(2){background:#f9f7fc}
.tp-violet i:nth-child(3){background:#fff}
.tp-violet{box-shadow:inset 0 3px 0 #7255bd}

.tp-rose i:nth-child(1){background:#faedf3}
.tp-rose i:nth-child(2){background:#fdf7fa}
.tp-rose i:nth-child(3){background:#fff}
.tp-rose{box-shadow:inset 0 3px 0 #bd5d87}

.tp-whatsapp i:nth-child(1){background:#e9f1ec}
.tp-whatsapp i:nth-child(2){background:#f4f8f5}
.tp-whatsapp i:nth-child(3){background:#fff}
.tp-whatsapp{box-shadow:inset 0 3px 0 #258b5e}

.theme-panel-foot{
  min-height:42px;
  padding:0 14px;
  display:flex;
  align-items:center;
  justify-content:space-between;
  border-top:1px solid var(--theme-line);
  color:var(--theme-muted);
  font-size:8.5px;
}
.theme-panel-foot b{
  color:var(--theme-brand);
  font-size:9px;
}

@media (max-width:760px){
  .theme-panel{
    top:auto;
    left:8px;
    right:8px;
    bottom:66px;
    width:auto;
    max-height:75dvh;
    border-radius:14px;
    transform:translateY(12px);
  }
  .theme-panel.open{
    transform:none;
  }
  .theme-grid{
    grid-template-columns:1fr 1fr;
  }
  .theme-card{
    min-height:94px;
  }
}

/* Compact phones */
@media (max-width:390px){
  .theme-grid{
    grid-template-columns:1fr;
  }
  .theme-card{
    min-height:86px;
  }
}

/* H-CHAT V3 — desktop right user list */
html[data-theme] .drawer-head button,
html[data-theme] .people-search{
  background:var(--theme-elevated);
  color:var(--theme-text);
  border-color:var(--theme-line);
}
html[data-theme] .people-search>i,
html[data-theme] .people-empty{
  color:var(--theme-faint);
}
html[data-theme] .person:hover{
  background:var(--theme-hover);
}
html[data-theme] .person .presence-dot{
  border-color:var(--theme-surface);
}
html[data-theme] .people-btn.active{
  background:var(--theme-brand-soft);
  color:var(--theme-brand);
  border-color:color-mix(in srgb,var(--theme-brand) 34%,var(--theme-line));
}
@media (min-width:761px){
  html[data-theme] .people-drawer{box-shadow:none}
}


/* H-CHAT V3 — settings privacy controls */
.settings-section{
  margin:2px 12px 12px;
  border:1px solid var(--theme-line);
  border-radius:10px;
  overflow:hidden;
  background:var(--theme-surface);
}
.settings-section-title{
  min-height:48px;
  padding:0 11px;
  display:flex;
  align-items:center;
  gap:10px;
  border-bottom:1px solid var(--theme-line-2);
}
.settings-section-icon{
  width:30px;
  height:30px;
  display:grid;
  place-items:center;
  border-radius:8px;
  background:color-mix(in srgb,var(--theme-brand) 10%,transparent);
  color:var(--theme-brand);
}
.settings-section-title small,
.settings-section-title b{display:block}
.settings-section-title small{
  color:var(--theme-muted);
  font-size:7px;
  font-weight:900;
  letter-spacing:.09em;
}
.settings-section-title b{
  margin-top:2px;
  color:var(--theme-text);
  font-size:10.5px;
}
.settings-toggle-row{
  width:100%;
  min-height:62px;
  padding:10px 11px;
  border:0;
  background:transparent;
  color:var(--theme-text);
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  text-align:left;
  cursor:pointer;
}
.settings-toggle-row>span{min-width:0}
.settings-toggle-row b,
.settings-toggle-row small{display:block}
.settings-toggle-row b{font-size:9.5px}
.settings-toggle-row small{
  margin-top:4px;
  color:var(--theme-muted);
  font-size:8px;
  line-height:1.35;
}
.settings-switch{
  position:relative;
  flex:0 0 36px;
  width:36px;
  height:20px;
  border-radius:999px;
  background:var(--theme-brand);
  transition:background .16s ease;
}
.settings-switch i{
  position:absolute;
  top:3px;
  right:3px;
  width:14px;
  height:14px;
  border-radius:50%;
  background:#fff;
  box-shadow:0 1px 4px rgba(0,0,0,.18);
  transition:transform .16s ease,right .16s ease;
}
.settings-toggle-row.is-off .settings-switch{
  background:color-mix(in srgb,var(--theme-muted) 45%,var(--theme-line));
}
.settings-toggle-row.is-off .settings-switch i{
  right:19px;
}

/* HChat V3 - own presence selector */
.presence-setting{
  padding:8px;
  display:grid;
  gap:5px;
}
.presence-setting>button{
  width:100%;
  min-height:48px;
  border:1px solid var(--theme-line-2);
  background:transparent;
  color:var(--theme-text);
  border-radius:8px;
  padding:7px 9px;
  display:grid;
  grid-template-columns:10px minmax(0,1fr);
  gap:9px;
  align-items:center;
  text-align:left;
  cursor:pointer;
}
.presence-setting>button:hover,
.presence-setting>button.active{
  border-color:color-mix(in srgb,var(--theme-brand) 38%,var(--theme-line-2));
  background:color-mix(in srgb,var(--theme-brand) 7%,transparent);
}
.presence-setting>button span,
.presence-setting>button b,
.presence-setting>button small{display:block}
.presence-setting>button b{font-size:9.5px}
.presence-setting>button small{margin-top:2px;color:var(--theme-muted);font-size:7.5px;line-height:1.35}
.presence-setting-current{
  border-top:1px solid var(--theme-line-2);
  padding:8px 11px 10px;
  color:var(--theme-muted);
  font-size:8px;
}
.presence-setting-current b{color:var(--theme-text)}


/* =========================================================
   SOHBERA YAZI KISISELLESTIRME V1
   ========================================================= */
.text-style-quick span{
  display:block;font:800 11px/1 Inter,ui-sans-serif,sans-serif;letter-spacing:-.55px;
  transform:translateY(-.5px)
}
.text-style-settings{scroll-margin-top:16px}
.settings-aa-icon{
  display:grid;place-items:center;width:100%;height:100%;font:800 11px/1 Inter,ui-sans-serif,sans-serif;
  letter-spacing:-.6px;color:var(--theme-accent,#18c7be)
}
.text-style-preview{
  margin-top:9px;padding:10px 11px;border:1px solid var(--theme-border);border-radius:11px;
  background:var(--theme-soft);overflow:hidden
}
.text-style-preview>small{display:block;font-size:7px;font-weight:800;letter-spacing:.11em;color:var(--theme-muted);margin-bottom:6px}
.text-style-preview p{margin:0;max-width:100%;line-height:1.45;overflow-wrap:anywhere;transition:.15s ease}
.text-style-preview p.has-custom-bg{display:inline-block;padding:5px 8px;border-radius:7px}
.text-style-field{
  display:flex;align-items:center;justify-content:space-between;gap:10px;margin-top:8px;padding:9px 10px;
  border:1px solid var(--theme-border);border-radius:10px;background:var(--theme-surface)
}
.text-style-field>span{min-width:0}.text-style-field>span b,.text-style-field>span small{display:block}
.text-style-field>span b{font-size:9.5px}.text-style-field>span small{margin-top:2px;font-size:7.5px;color:var(--theme-muted)}
.text-style-field select{
  max-width:132px;min-width:108px;height:30px;border:1px solid var(--theme-border);border-radius:8px;
  background:var(--theme-soft);color:var(--theme-text);font:700 8px/1 Inter,sans-serif;padding:0 24px 0 8px;outline:0
}
.text-size-control{display:flex;align-items:center;gap:7px;min-width:145px}
.text-size-control input{width:105px;accent-color:var(--theme-accent,#18c7be)}
.text-size-control>b{font-size:8px;white-space:nowrap;color:var(--theme-text);min-width:32px;text-align:right}
.text-style-format{display:grid;grid-template-columns:repeat(3,1fr);gap:6px;margin-top:8px}
.text-style-format button{
  min-height:45px;border:1px solid var(--theme-border);border-radius:9px;background:var(--theme-surface);color:var(--theme-text);
  display:flex;align-items:center;justify-content:center;gap:5px;cursor:pointer;padding:6px;transition:.15s ease
}
.text-style-format button>b,.text-style-format button>i,.text-style-format button>u{font-size:12px;min-width:14px;text-align:center}
.text-style-format button>span{font-size:7.5px;font-weight:750}
.text-style-format button:hover,.text-style-format button.active{
  border-color:color-mix(in srgb,var(--theme-accent,#18c7be) 60%,var(--theme-border));
  background:color-mix(in srgb,var(--theme-accent,#18c7be) 10%,var(--theme-surface));
  color:var(--theme-accent,#18c7be)
}
.text-style-colors{display:grid;grid-template-columns:1fr 1fr;gap:7px;margin-top:8px}
.text-color-card{padding:9px;border:1px solid var(--theme-border);border-radius:10px;background:var(--theme-surface)}
.text-color-card>span b,.text-color-card>span small{display:block}
.text-color-card>span b{font-size:9px}.text-color-card>span small{margin-top:2px;font-size:7px;color:var(--theme-muted)}
.text-color-card>div{display:flex;align-items:center;gap:5px;margin-top:7px}
.text-color-card input[type=color]{
  width:30px;height:28px;padding:2px;border:1px solid var(--theme-border);border-radius:7px;background:var(--theme-soft);cursor:pointer
}
.text-color-card button{
  flex:1;height:28px;border:1px solid var(--theme-border);border-radius:7px;background:var(--theme-soft);color:var(--theme-muted);
  font-size:7px;font-weight:750;cursor:pointer
}
.text-color-card button.active{border-color:var(--theme-accent,#18c7be);color:var(--theme-accent,#18c7be)}
.text-style-foot{display:flex;align-items:center;justify-content:space-between;gap:8px;margin-top:8px}
.text-style-foot>span{font-size:7px;line-height:1.35;color:var(--theme-muted)}
.text-style-foot>button{
  flex:0 0 auto;height:29px;padding:0 9px;border:1px solid var(--theme-border);border-radius:8px;background:var(--theme-soft);
  color:var(--theme-text);font-size:7.5px;font-weight:800;display:flex;align-items:center;gap:5px;cursor:pointer
}
.message .message-body>p.has-custom-bg{display:inline-block;padding:4px 7px;border-radius:7px;max-width:100%}
@media (max-width:700px){
  .text-style-colors{grid-template-columns:1fr}
  .text-style-field{align-items:flex-start;flex-direction:column}
  .text-style-field select,.text-size-control{width:100%;max-width:none}.text-size-control input{flex:1;width:auto}
}


/* =========================================================
   SOHBERA TAM TEMA EDITORU V1
   ========================================================= */
.theme-panel{width:min(420px,calc(100vw - 24px))}
.theme-editor-settings{overflow:visible}
.theme-editor-toggle{border-bottom:1px solid var(--theme-line-2)}
.theme-editor-body{padding:10px}
.theme-editor-body[hidden]{display:none!important}
.theme-editor-live{
  height:72px;border:1px solid var(--theme-line);border-radius:12px;overflow:hidden;
  display:grid;grid-template-columns:16px 72px 1fr;background:var(--theme-bg);box-shadow:inset 0 0 0 1px rgba(255,255,255,.18)
}
.theme-editor-live>span{display:block;min-width:0}
.theme-editor-live .tel-rail{background:var(--theme-rail)}
.theme-editor-live .tel-panel{background:var(--theme-surface-2);border-left:1px solid var(--theme-line);border-right:1px solid var(--theme-line)}
.theme-editor-live .tel-chat{position:relative;background:var(--theme-chat)}
.theme-editor-live .tel-chat:before{content:"";position:absolute;left:12px;right:12px;top:11px;height:7px;border-radius:7px;background:var(--theme-brand);opacity:.9}
.theme-editor-live .tel-chat i{position:absolute;left:12px;height:6px;border-radius:6px;background:var(--theme-message);opacity:.22}
.theme-editor-live .tel-chat i:nth-child(1){top:31px;width:54%}.theme-editor-live .tel-chat i:nth-child(2){top:43px;width:72%}.theme-editor-live .tel-chat i:nth-child(3){top:55px;width:42%}
.theme-editor-colors{display:grid;grid-template-columns:1fr 1fr;gap:7px;margin-top:9px}
.theme-editor-colors label{
  min-height:54px;padding:8px 9px;border:1px solid var(--theme-line);border-radius:10px;background:var(--theme-surface);
  display:flex;align-items:center;justify-content:space-between;gap:8px
}
.theme-editor-colors label>span{min-width:0}.theme-editor-colors label b,.theme-editor-colors label small{display:block}
.theme-editor-colors label>span{font-size:8.5px;font-weight:800}.theme-editor-colors label small{margin-top:2px;color:var(--theme-muted);font-size:6.8px;font-weight:500;line-height:1.25}
.theme-editor-colors input[type=color]{width:34px;height:34px;flex:0 0 34px;padding:2px;border:1px solid var(--theme-line);border-radius:9px;background:var(--theme-input);cursor:pointer}
.theme-editor-layout{display:grid;gap:7px;margin-top:9px}
.theme-editor-field{min-height:51px;padding:8px 9px;border:1px solid var(--theme-line);border-radius:10px;background:var(--theme-surface);display:flex;align-items:center;justify-content:space-between;gap:9px}
.theme-editor-field>span b,.theme-editor-field>span small{display:block}.theme-editor-field>span b{font-size:8.7px}.theme-editor-field>span small{margin-top:2px;color:var(--theme-muted);font-size:7px}
.theme-editor-field select{min-width:124px;height:30px;border:1px solid var(--theme-line);border-radius:8px;background:var(--theme-input);color:var(--theme-text);padding:0 8px;font-size:7.6px;font-weight:750;outline:none}
.theme-radius-field>div{display:flex;align-items:center;gap:7px;min-width:145px}.theme-radius-field input{width:105px;accent-color:var(--theme-brand)}.theme-radius-field>div>b{min-width:34px;text-align:right;font-size:7.4px;color:var(--theme-muted)}
.theme-wallpaper-card{margin-top:9px;padding:9px;border:1px solid var(--theme-line);border-radius:10px;background:var(--theme-surface)}
.theme-wallpaper-card>div:first-child b,.theme-wallpaper-card>div:first-child small{display:block}.theme-wallpaper-card>div:first-child b{font-size:8.7px}.theme-wallpaper-card>div:first-child small{margin-top:2px;font-size:7px;color:var(--theme-muted)}
.theme-wallpaper-actions{display:flex;gap:6px;margin-top:8px}.theme-wallpaper-actions button,.theme-editor-actions button{height:31px;border:1px solid var(--theme-line);border-radius:8px;background:var(--theme-input);color:var(--theme-text);font-size:7.4px;font-weight:800;display:inline-flex;align-items:center;justify-content:center;gap:5px;cursor:pointer}
.theme-wallpaper-actions button{flex:1}.theme-wallpaper-actions button:hover,.theme-editor-actions button:hover{border-color:color-mix(in srgb,var(--theme-brand) 45%,var(--theme-line));color:var(--theme-brand)}
.theme-wallpaper-opacity{margin-top:8px;display:grid;grid-template-columns:auto 1fr auto;gap:7px;align-items:center;color:var(--theme-muted);font-size:7px}.theme-wallpaper-opacity input{width:100%;accent-color:var(--theme-brand)}.theme-wallpaper-opacity b{min-width:28px;text-align:right;color:var(--theme-text);font-size:7px}
.theme-editor-actions{display:grid;grid-template-columns:1fr 1fr;gap:6px;margin-top:9px}.theme-editor-actions .danger-lite{color:#c04b4b}.theme-editor-note{display:block;margin:8px 2px 0;color:var(--theme-muted);font-size:6.8px;line-height:1.4}

html[data-custom-theme="1"] body,
html[data-custom-theme="1"] button,
html[data-custom-theme="1"] input,
html[data-custom-theme="1"] textarea,
html[data-custom-theme="1"] select{font-family:var(--sohbera-ui-font,Inter,ui-sans-serif,system-ui,sans-serif)}
html[data-custom-theme="1"] .timeline{
  background-color:var(--theme-chat);
  background-image:linear-gradient(var(--sohbera-wallpaper-overlay,rgba(255,255,255,1)),var(--sohbera-wallpaper-overlay,rgba(255,255,255,1))),var(--sohbera-chat-wallpaper,none);
  background-size:cover;background-position:center;background-repeat:no-repeat
}
html[data-custom-theme="1"] .room,
html[data-custom-theme="1"] .dm,
html[data-custom-theme="1"] .person,
html[data-custom-theme="1"] .composer-box,
html[data-custom-theme="1"] .icon-btn,
html[data-custom-theme="1"] .quick-search,
html[data-custom-theme="1"] .people-search,
html[data-custom-theme="1"] .settings-section,
html[data-custom-theme="1"] .theme-card,
html[data-custom-theme="1"] .notification-center,
html[data-custom-theme="1"] .profile-drawer,
html[data-custom-theme="1"] .message-file-card{border-radius:var(--sohbera-radius,10px)}
html[data-custom-theme="1"][data-message-shape="soft"] .message{background:color-mix(in srgb,var(--sohbera-message-bubble,#eef7f6) 62%,transparent);border-radius:var(--sohbera-radius,10px)}
html[data-custom-theme="1"][data-message-shape="soft"] .message:hover{background:color-mix(in srgb,var(--sohbera-message-bubble,#eef7f6) 78%,transparent)}
html[data-custom-theme="1"][data-message-shape="bubble"] .message .message-body>p:not(.youtube-description){display:inline-block;max-width:min(82%,720px);padding:6px 9px;border-radius:calc(var(--sohbera-radius,10px) + 2px);background:var(--sohbera-message-bubble,#eef7f6)}
html[data-custom-theme="1"][data-message-shape="bubble"] .message.own .message-body>p:not(.youtube-description){background:var(--theme-brand-soft)}

html[data-ui-density="compact"] .timeline{padding:8px 14px 14px}
html[data-ui-density="compact"] .message{padding:4px 3px;gap:7px}
html[data-ui-density="compact"] .room{min-height:44px;padding-top:3px;padding-bottom:3px}
html[data-ui-density="compact"] .dm{min-height:41px;padding-top:3px;padding-bottom:3px}
html[data-ui-density="compact"] .person{min-height:42px;padding-top:4px;padding-bottom:4px}
html[data-ui-density="compact"] .workspace-section{padding-top:9px}
html[data-ui-density="compact"] .composer{padding:7px 12px}
html[data-ui-density="compact"] .composer-box{height:40px}
html[data-ui-density="spacious"] .timeline{padding:20px 26px 30px}
html[data-ui-density="spacious"] .message{padding:10px 6px;gap:11px}
html[data-ui-density="spacious"] .room{min-height:58px}
html[data-ui-density="spacious"] .dm{min-height:54px}
html[data-ui-density="spacious"] .person{min-height:55px}
html[data-ui-density="spacious"] .composer{padding:13px 16px}
html[data-ui-density="spacious"] .composer-box{height:49px}

@media(max-width:760px){
  .theme-panel{width:auto}
  .theme-editor-colors{grid-template-columns:1fr 1fr}
  .theme-editor-field{align-items:flex-start;flex-direction:column}.theme-editor-field select,.theme-radius-field>div{width:100%;min-width:0}.theme-radius-field input{flex:1;width:auto}
}
@media(max-width:390px){.theme-editor-colors{grid-template-columns:1fr}.theme-editor-actions{grid-template-columns:1fr}}
