:root {
  --green: #00a884;
  --green-dark: #008069;
  --app-bg: #0b141a;
  --rail: #202c33;
  --panel: #111b21;
  --header: #202c33;
  --input-bg: #2a3942;
  --hover: #202c33;
  --active: #2a3942;
  --text: #e9edef;
  --muted: #8696a0;
  --border: #222d34;
  --bubble-out: #005c4b;
  --bubble-in: #202c33;
  --danger: #ea4c4c;
}

/* Light theme (toggled from Settings > Chats > Theme) */
body.theme-light {
  --green: #008069;
  --green-dark: #006a56;
  --app-bg: #eae6df;
  --rail: #f0f2f5;
  --panel: #ffffff;
  --header: #f0f2f5;
  --input-bg: #f0f2f5;
  --hover: #f5f6f6;
  --active: #f0f2f5;
  --text: #111b21;
  --muted: #667781;
  --border: #e9edef;
  --bubble-out: #d9fdd3;
  --bubble-in: #ffffff;
}
body.theme-light .rail { border-right: 1px solid #d1d7db; }
body.theme-light .bubble.out { color: #111b21; }
body.theme-light .bubble.out .time { color: rgba(17,27,33,.45); }

* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--app-bg);
  color: var(--text);
  height: 100vh;
  overflow: hidden;
}

/* ---------- Flash ---------- */
.flash-stack { position: fixed; top: 16px; left: 50%; transform: translateX(-50%); z-index: 999; }
.flash { padding: 10px 18px; border-radius: 8px; margin-bottom: 8px; color: #fff; font-size: 14px; }
.flash-error { background: var(--danger); }
.flash-message { background: var(--green-dark); }

/* ---------- Auth ---------- */
.auth-wrap {
  height: 100vh; display: flex; align-items: center; justify-content: center;
  background: var(--app-bg);
}
.auth-card {
  background: var(--panel); width: 400px; max-width: 92vw; padding: 40px 34px;
  border-radius: 16px; box-shadow: 0 20px 60px rgba(0,0,0,.5); border: 1px solid var(--border);
}
.brand { text-align: center; margin-bottom: 26px; }
.brand-logo { font-size: 46px; }
.brand h1 { font-size: 26px; color: var(--green); margin-top: 6px; }
.brand p { color: var(--muted); font-size: 14px; margin-top: 4px; }
.auth-card label { display: block; font-size: 13px; color: var(--muted); margin: 14px 0 6px; }
.auth-card input {
  width: 100%; padding: 12px 14px; border: 1px solid var(--border); background: var(--input-bg);
  color: var(--text); border-radius: 10px; font-size: 15px; outline: none;
}
.auth-card input:focus { border-color: var(--green); }
.btn-primary {
  width: 100%; margin-top: 22px; padding: 13px; background: var(--green);
  color: #06231d; border: none; border-radius: 10px; font-size: 16px;
  font-weight: 700; cursor: pointer;
}
.btn-primary:hover { background: var(--green-dark); color: #fff; }
.auth-switch { text-align: center; margin-top: 18px; font-size: 14px; color: var(--muted); }
.auth-switch a { color: var(--green); text-decoration: none; font-weight: 600; }

/* ---------- App shell ---------- */
.app { display: flex; height: 100vh; }

/* Left icon rail (WhatsApp desktop) */
.rail {
  width: 62px; background: var(--rail); display: flex; flex-direction: column;
  align-items: center; padding: 14px 0; gap: 6px; border-right: 1px solid #000;
}
.rail-btn {
  width: 44px; height: 44px; border-radius: 50%; border: none; background: transparent;
  color: var(--muted); font-size: 21px; cursor: pointer; display: flex;
  align-items: center; justify-content: center; position: relative; transition: background .15s;
}
.rail-btn:hover { background: #2a3942; color: var(--text); }
.rail-btn.active { background: #2a3942; color: var(--green); }
.rail-btn.active::before {
  content: ""; position: absolute; left: -14px; top: 8px; bottom: 8px; width: 4px;
  background: var(--green); border-radius: 3px;
}
.rail-spacer { flex: 1; }
.rail-avatar { width: 40px; height: 40px; border-radius: 50%; cursor: pointer; overflow: hidden; }
.rail-btn svg { width: 25px; height: 25px; }
.rail-divider { width: 28px; height: 1px; background: #2a3942; margin: 4px 0; }

/* ---------- Sidebar ---------- */
.sidebar { width: 400px; min-width: 320px; background: var(--panel); display: flex; flex-direction: column; border-right: 1px solid var(--border); }
.sidebar-head { display: flex; align-items: center; justify-content: space-between; padding: 18px 18px 10px; }
.sidebar-title { font-size: 22px; font-weight: 700; }
.head-actions { display: flex; gap: 4px; align-items: center; }
.icon-btn {
  width: 38px; height: 38px; border-radius: 50%; border: none; background: transparent;
  color: var(--muted); font-size: 20px; cursor: pointer; display: flex;
  align-items: center; justify-content: center; text-decoration: none;
}
.icon-btn:hover { background: var(--input-bg); color: var(--text); }
.icon-btn svg { width: 22px; height: 22px; }

.panel-heading { padding: 6px 18px 12px; font-size: 20px; font-weight: 700; }

.search { padding: 6px 12px 10px; position: relative; }
.search input {
  width: 100%; padding: 9px 16px 9px 46px; border: none; background: var(--input-bg);
  color: var(--text); border-radius: 20px; font-size: 14px; outline: none;
}
.search input::placeholder { color: var(--muted); }
.search-ico { position: absolute; left: 28px; top: 50%; transform: translateY(-50%); width: 18px; height: 18px; color: var(--muted); pointer-events: none; }

.list-scroll { overflow-y: auto; flex: 1; }
.hint { padding: 30px 24px; color: var(--muted); font-size: 14px; text-align: center; line-height: 1.6; }

/* ---------- Avatars ---------- */
.avatar {
  width: 48px; height: 48px; border-radius: 50%; color: #fff; background-size: cover;
  background-position: center; display: flex; align-items: center; justify-content: center;
  font-weight: 600; font-size: 19px; flex-shrink: 0;
}
.avatar-lg { width: 100px; height: 100px; font-size: 40px; }

/* ---------- Contact rows ---------- */
.contacts, .channel-list, .status-list, .group-list, .calls-list { list-style: none; }
.contact, .channel-item, .group-item, .call-row {
  display: flex; align-items: center; gap: 14px; padding: 10px 16px; cursor: pointer;
}
.contact:hover, .channel-item:hover, .group-item:hover, .call-row:hover, .status-item:hover { background: var(--hover); }
.contact.active { background: var(--active); }
.contact-body, .channel-body, .group-body { flex: 1; min-width: 0; border-top: 1px solid var(--border); padding: 8px 0; }
.contact:first-child .contact-body { border-top: none; }
.contact-row { display: flex; justify-content: space-between; align-items: baseline; }
.contact-name { font-weight: 500; font-size: 16px; color: var(--text); }
.contact-time { font-size: 12px; color: var(--muted); }
.contact-preview { font-size: 14px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 3px; }
.badge {
  background: var(--green); color: #06231d; font-size: 12px; font-weight: 700;
  min-width: 20px; height: 20px; border-radius: 10px; padding: 0 6px;
  display: flex; align-items: center; justify-content: center;
}
.presence-dot { width: 10px; height: 10px; border-radius: 50%; background: #3b4a54; }
.presence-dot.online { background: var(--green); }

/* ---------- Conversation ---------- */
.conversation { flex: 1; display: flex; flex-direction: column; background: var(--app-bg);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='60' height='60'%3E%3Cg fill='%23ffffff' fill-opacity='0.02'%3E%3Ccircle cx='15' cy='15' r='2'/%3E%3Ccircle cx='45' cy='45' r='2'/%3E%3C/g%3E%3C/svg%3E");
}
.empty-state { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; color: var(--muted); border-bottom: 5px solid var(--green); }
.empty-logo { font-size: 80px; opacity: .35; }
.empty-state h2 { margin: 14px 0 8px; color: var(--text); font-weight: 300; font-size: 30px; }

.chat-panel { flex: 1; display: flex; flex-direction: column; height: 100%; }
.chat-head { display: flex; align-items: center; gap: 14px; padding: 10px 18px; background: var(--header); }
.chat-head .avatar { width: 40px; height: 40px; font-size: 16px; }
.chat-head-info { flex: 1; min-width: 0; }
.chat-head-name { font-weight: 500; font-size: 16px; }
.chat-head-status { font-size: 13px; color: var(--muted); }
.chat-head-actions { display: flex; gap: 6px; }

.messages { flex: 1; overflow-y: auto; padding: 20px 7%; display: flex; flex-direction: column; gap: 3px; }
.bubble {
  max-width: 65%; padding: 6px 9px 8px 12px; border-radius: 8px; font-size: 14.2px;
  line-height: 1.4; box-shadow: 0 1px .5px rgba(0,0,0,.2); word-wrap: break-word; color: var(--text);
}
.bubble.out { align-self: flex-end; background: var(--bubble-out); border-top-right-radius: 2px; }
.bubble.in { align-self: flex-start; background: var(--bubble-in); border-top-left-radius: 2px; }
.bubble .time { font-size: 10.5px; color: rgba(233,237,239,.5); float: right; margin: 8px 0 -3px 12px; }
.bubble .sender { font-size: 12.5px; font-weight: 700; margin-bottom: 2px; display: block; }
.date-sep { align-self: center; background: var(--header); color: var(--muted); font-size: 12px; padding: 5px 13px; border-radius: 8px; margin: 12px 0; }

.typing-indicator { padding: 4px 7%; font-size: 13px; color: var(--green); font-style: italic; }

.composer { display: flex; gap: 10px; padding: 10px 18px; background: var(--header); align-items: center; }
.composer input {
  flex: 1; padding: 11px 16px; border: none; border-radius: 22px; background: var(--input-bg);
  color: var(--text); font-size: 15px; outline: none;
}
.composer input::placeholder { color: var(--muted); }
.send-btn { width: 44px; height: 44px; border-radius: 50%; border: none; background: transparent; color: var(--muted); font-size: 22px; cursor: pointer; flex-shrink: 0; display: flex; align-items: center; justify-content: center; }
.send-btn:hover { color: var(--green); }
.send-btn svg { width: 25px; height: 25px; }
.chat-head-actions svg { width: 22px; height: 22px; }
.s-ico svg { width: 22px; height: 22px; vertical-align: middle; }

/* Composer attach / mic buttons */
.composer { position: relative; }
.comp-btn { width: 42px; height: 44px; border: none; background: transparent; color: var(--muted); cursor: pointer; flex-shrink: 0; display: flex; align-items: center; justify-content: center; }
.comp-btn:hover { color: var(--text); }
.comp-btn svg { width: 24px; height: 24px; }
.mic-btn svg { width: 23px; height: 23px; }

/* Attach popup menu */
.attach-menu { position: fixed; z-index: 120; background: var(--header); border-radius: 12px; padding: 8px 0; box-shadow: 0 8px 30px rgba(0,0,0,.5); min-width: 210px; }
.attach-menu-item { display: flex; align-items: center; gap: 18px; width: 100%; padding: 13px 22px; background: none; border: none; color: var(--text); font-size: 15px; cursor: pointer; text-align: left; }
.attach-menu-item:hover { background: var(--hover); }
.attach-menu-item svg { width: 20px; height: 20px; color: var(--green); }

/* Recording bar */
.recording-bar { position: absolute; left: 0; right: 0; bottom: 0; height: 66px; background: var(--header); display: flex; align-items: center; gap: 14px; padding: 0 18px; }
.rec-cancel, .rec-send { width: 44px; height: 44px; border-radius: 50%; border: none; cursor: pointer; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.rec-cancel { background: transparent; color: var(--danger); }
.rec-send { background: var(--green); color: #06231d; }
.rec-cancel svg, .rec-send svg { width: 22px; height: 22px; }
.rec-info { display: flex; align-items: center; gap: 8px; font-size: 15px; color: var(--text); }
.rec-dot { width: 11px; height: 11px; border-radius: 50%; background: var(--danger); animation: blink 1s infinite; }
.rec-hint { flex: 1; color: var(--muted); font-size: 14px; }
@keyframes blink { 50% { opacity: .25; } }

/* Media in bubbles */
.bubble .att-image { display: block; max-width: 260px; width: 100%; border-radius: 8px; margin: 2px 0 4px; cursor: pointer; }
.bubble .att-file { display: flex; align-items: center; gap: 12px; background: rgba(0,0,0,.18); border-radius: 8px; padding: 12px 14px; margin: 2px 0 4px; color: inherit; text-decoration: none; min-width: 200px; }
.bubble .att-file svg { width: 30px; height: 30px; flex-shrink: 0; color: var(--text); }
.bubble .att-file .fname { font-size: 14px; word-break: break-all; }
.bubble .att-file .fmeta { font-size: 11px; color: var(--muted); margin-top: 2px; }
.bubble .att-audio { display: block; margin: 2px 0 4px; }
.bubble .att-audio audio { width: 250px; max-width: 60vw; height: 40px; }
.bubble.has-media { padding: 5px 5px 6px; }
.bubble.has-media .caption { padding: 2px 7px 0; }

/* Back button (mobile only) */
.back-btn { display: none; }

/* Lightbox for images */
.lightbox { position: fixed; inset: 0; background: rgba(0,0,0,.9); z-index: 250; display: flex; align-items: center; justify-content: center; }
.lightbox img { max-width: 92vw; max-height: 92vh; border-radius: 8px; }
.lightbox .lb-close { position: absolute; top: 18px; right: 22px; color: #fff; font-size: 28px; cursor: pointer; }

.hidden { display: none !important; }

/* ---------- Tabs / buttons ---------- */
.wide-btn {
  margin: 8px 16px; padding: 11px; width: calc(100% - 32px); background: var(--input-bg);
  color: var(--green); border: none; border-radius: 10px; font-weight: 600; cursor: pointer;
}
.wide-btn:hover { background: #34434d; }

/* ---------- Status ---------- */
.status-item { display: flex; align-items: center; gap: 14px; padding: 11px 16px; cursor: pointer; }
.status-section-label { padding: 12px 16px 6px; font-size: 14px; color: var(--muted); background: var(--app-bg); }
.status-ring { position: relative; border-radius: 50%; padding: 2px; }
.status-ring.unseen { background: conic-gradient(var(--green), #6fe0c9, var(--green)); }
.status-ring.seen { background: #3b4a54; }
.status-ring.empty { background: transparent; }
.add-badge { position: absolute; bottom: -2px; right: -2px; width: 20px; height: 20px; background: var(--green); color: #06231d; border: 2px solid var(--panel); border-radius: 50%; font-size: 13px; display: flex; align-items: center; justify-content: center; }
.status-name { font-weight: 500; font-size: 16px; }
.status-sub { font-size: 13px; color: var(--muted); }
.status-me { border-bottom: 8px solid var(--app-bg); position: relative; }
.status-head { display: flex; align-items: center; justify-content: space-between; padding: 6px 18px 12px; }
.status-head .icon-btn { background: var(--input-bg); }

/* Add-status popup menu */
.add-menu {
  position: absolute; top: 120px; left: 74px; z-index: 50;
  background: var(--header); border-radius: 10px; padding: 8px 0;
  box-shadow: 0 6px 24px rgba(0,0,0,.5); min-width: 210px;
}
.add-menu-item {
  display: flex; align-items: center; gap: 18px; width: 100%; padding: 13px 22px;
  background: none; border: none; color: var(--text); font-size: 15px; cursor: pointer; text-align: left;
}
.add-menu-item:hover { background: var(--hover); }
.add-menu-item svg { width: 20px; height: 20px; color: var(--muted); }

/* Status intro (main pane) */
.status-intro { flex: 1; display: flex; align-items: center; justify-content: center; border-bottom: 5px solid var(--green); }
.status-intro-inner { display: flex; gap: 60px; }
.intro-btn { display: flex; flex-direction: column; align-items: center; gap: 12px; cursor: pointer; color: var(--muted); }
.intro-btn:hover { color: var(--text); }
.intro-circle { width: 70px; height: 70px; border-radius: 50%; background: var(--input-bg); display: flex; align-items: center; justify-content: center; }
.intro-circle svg { width: 28px; height: 28px; color: var(--text); }
.intro-btn span { font-size: 14px; }

/* Text status editor */
.text-status-editor {
  width: 500px; max-width: 94vw; height: 420px; border-radius: 14px; overflow: hidden;
  display: flex; flex-direction: column; background: #128C7E; position: relative;
}
.tse-toolbar { display: flex; justify-content: space-between; padding: 12px 14px; }
.tse-icon { width: 40px; height: 40px; border-radius: 50%; border: none; background: rgba(0,0,0,.2); color: #fff; cursor: pointer; display: flex; align-items: center; justify-content: center; }
.tse-icon svg { width: 22px; height: 22px; }
.tse-icon:hover { background: rgba(0,0,0,.35); }
.text-status-editor textarea {
  flex: 1; border: none; background: transparent; color: #fff; text-align: center;
  font-size: 26px; font-weight: 500; padding: 20px 30px; outline: none; resize: none; font-family: inherit;
}
.text-status-editor textarea::placeholder { color: rgba(255,255,255,.75); }
.tse-send { position: absolute; bottom: 18px; right: 18px; width: 54px; height: 54px; border-radius: 50%; border: none; background: var(--green-dark); color: #fff; cursor: pointer; display: flex; align-items: center; justify-content: center; }
.tse-send svg { width: 26px; height: 26px; }

/* ---------- Channels / Groups ---------- */
.channel-sub, .group-sub { font-size: 12px; color: var(--muted); margin-top: 2px; }
.owner-tag { font-size: 10px; background: var(--green); color: #06231d; padding: 1px 6px; border-radius: 8px; font-weight: 700; vertical-align: middle; }
.follow-btn { margin-left: auto; padding: 7px 18px; border: none; border-radius: 18px; background: var(--green); color: #06231d; font-weight: 700; cursor: pointer; }
.channel-post { max-width: 80% !important; }

/* ---------- Calls list ---------- */
.call-row { gap: 14px; }
.call-info { flex: 1; border-top: 1px solid var(--border); padding: 10px 0; }
.call-dir { font-size: 12px; color: var(--muted); }
.call-dir.missed { color: var(--danger); }
.call-action { color: var(--green); font-size: 22px; }

/* ---------- Modals ---------- */
.modal-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,.6); z-index: 100; display: flex; align-items: center; justify-content: center; }
.modal { background: var(--panel); width: 420px; max-width: 92vw; border-radius: 14px; padding: 26px; border: 1px solid var(--border); box-shadow: 0 20px 60px rgba(0,0,0,.5); }
.modal h3 { color: var(--text); margin-bottom: 16px; }
.modal label { display: block; font-size: 13px; color: var(--muted); margin: 12px 0 5px; }
.modal input, .modal textarea {
  width: 100%; padding: 11px 13px; border: 1px solid var(--border); background: var(--input-bg);
  color: var(--text); border-radius: 9px; font-size: 15px; outline: none; font-family: inherit; resize: vertical;
}
.modal input:focus, .modal textarea:focus { border-color: var(--green); }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 22px; }
.btn-primary.sm { width: auto; margin: 0; padding: 10px 22px; font-size: 15px; }
.btn-secondary { padding: 10px 20px; background: var(--input-bg); border: none; border-radius: 9px; font-size: 15px; font-weight: 600; color: var(--text); cursor: pointer; }
.profile-avatar-wrap { display: flex; flex-direction: column; align-items: center; gap: 8px; margin-bottom: 8px; }
.upload-link { color: var(--green); font-size: 13px; font-weight: 600; cursor: pointer; display: inline-block; }

/* member picker */
.member-picker { max-height: 220px; overflow-y: auto; border: 1px solid var(--border); border-radius: 9px; margin-top: 6px; }
.member-opt { display: flex; align-items: center; gap: 10px; padding: 8px 12px; cursor: pointer; }
.member-opt:hover { background: var(--hover); }
.member-opt input { width: auto; }
.member-opt .avatar { width: 34px; height: 34px; font-size: 14px; }

/* ---------- Story viewer ---------- */
.story-viewer { position: fixed; inset: 0; background: #000; z-index: 200; display: flex; flex-direction: column; }
.story-progress { display: flex; gap: 4px; padding: 12px 16px 4px; }
.pbar { flex: 1; height: 3px; background: rgba(255,255,255,.3); border-radius: 2px; overflow: hidden; }
.pbar.done { background: #fff; }
.pbar.active { background: linear-gradient(90deg,#fff 50%, rgba(255,255,255,.3) 50%); }
.story-header { display: flex; align-items: center; gap: 10px; padding: 8px 16px; color: #fff; }
.story-header .avatar { width: 36px; height: 36px; font-size: 15px; }
.story-close { position: absolute; top: 14px; right: 18px; color: #fff; font-size: 24px; cursor: pointer; z-index: 210; }
.story-content { flex: 1; display: flex; align-items: center; justify-content: center; position: relative; }
.story-text { color: #fff; font-size: 26px; text-align: center; padding: 40px; line-height: 1.4; }
.story-img { max-width: 100%; max-height: 100%; object-fit: contain; }
.story-caption { position: absolute; bottom: 40px; left: 0; right: 0; text-align: center; color: #fff; padding: 0 20px; }
.story-nav { position: absolute; inset: 0; display: flex; }
.story-tap { flex: 1; cursor: pointer; }

/* ---------- Call overlay ---------- */
.call-overlay { position: fixed; inset: 0; background: #0b141a; z-index: 300; display: flex; flex-direction: column; align-items: center; }
.call-videos { flex: 1; width: 100%; position: relative; display: flex; align-items: center; justify-content: center; }
#remoteVideo { width: 100%; height: 100%; object-fit: cover; background: #000; }
#localVideo { position: absolute; bottom: 24px; right: 24px; width: 180px; height: 120px; object-fit: cover; border-radius: 10px; border: 2px solid #2a3942; background: #000; }
.call-voice-face { display: flex; flex-direction: column; align-items: center; gap: 18px; color: #fff; }
.call-voice-face .avatar { width: 130px; height: 130px; font-size: 52px; }
.call-status-text { font-size: 15px; color: var(--muted); }
.call-name { font-size: 26px; font-weight: 500; }
.call-controls { display: flex; gap: 22px; padding: 30px 0 46px; }
.call-ctrl { width: 60px; height: 60px; border-radius: 50%; border: none; font-size: 24px; cursor: pointer; color: #fff; display: flex; align-items: center; justify-content: center; background: #2a3942; }
.call-ctrl svg { width: 26px; height: 26px; }
.call-ctrl.muted svg { color: #111; }
.call-ctrl.hangup { background: var(--danger); }
.call-ctrl.accept { background: var(--green); }
.call-ctrl.muted { background: #fff; color: #111; }
.incoming-actions { display: flex; gap: 40px; }

/* ---------- Settings ---------- */
.settings-profile { display: flex; align-items: center; gap: 18px; padding: 14px 20px 20px; cursor: pointer; }
.settings-profile:hover { background: var(--hover); }
.settings-profile .avatar { width: 72px; height: 72px; font-size: 30px; }
.sp-name { font-size: 19px; font-weight: 500; }
.sp-about { font-size: 14px; color: var(--muted); margin-top: 3px; }
.settings-list { list-style: none; border-top: 1px solid var(--border); }
.settings-row { display: flex; align-items: center; gap: 18px; padding: 14px 20px; cursor: pointer; border-bottom: 1px solid var(--border); }
.settings-row:hover, .settings-row.active { background: var(--active); }
.settings-row .s-ico { font-size: 20px; width: 24px; text-align: center; color: var(--muted); }
.s-title { font-size: 16px; }
.s-sub { font-size: 13px; color: var(--muted); margin-top: 2px; }
.settings-row.danger .s-title, .settings-row.danger .s-ico { color: var(--danger); }

/* Settings detail (main pane) */
.settings-detail { flex: 1; overflow-y: auto; padding: 0; }
.settings-detail-head { display: flex; align-items: center; gap: 16px; padding: 22px 30px; background: var(--header); }
.settings-detail-head h2 { font-size: 20px; font-weight: 500; }
.settings-detail-body { padding: 24px 30px; max-width: 640px; }
.setting-group { margin-bottom: 30px; }
.setting-group h4 { color: var(--green); font-size: 14px; margin-bottom: 6px; }
.setting-item { display: flex; align-items: center; justify-content: space-between; padding: 14px 0; border-bottom: 1px solid var(--border); }
.setting-item .si-text { font-size: 15px; }
.setting-item .si-sub { font-size: 13px; color: var(--muted); margin-top: 3px; }
.kv { display: flex; justify-content: space-between; padding: 12px 0; border-bottom: 1px solid var(--border); }
.kv .k { color: var(--muted); font-size: 14px; }
.kv .v { font-size: 15px; }

/* Toggle switch */
.switch { position: relative; width: 46px; height: 26px; flex-shrink: 0; }
.switch input { display: none; }
.slider { position: absolute; inset: 0; background: #3b4a54; border-radius: 26px; transition: .2s; cursor: pointer; }
.slider::before { content: ""; position: absolute; width: 20px; height: 20px; left: 3px; top: 3px; background: #fff; border-radius: 50%; transition: .2s; }
.switch input:checked + .slider { background: var(--green); }
.switch input:checked + .slider::before { transform: translateX(20px); }

.theme-choice { display: flex; gap: 14px; margin-top: 10px; }
.theme-opt { flex: 1; padding: 16px; border: 2px solid var(--border); border-radius: 12px; cursor: pointer; text-align: center; font-weight: 600; }
.theme-opt.active { border-color: var(--green); color: var(--green); }
.shortcut-row { display: flex; justify-content: space-between; padding: 10px 0; border-bottom: 1px solid var(--border); font-size: 14px; }
.shortcut-row kbd { background: var(--input-bg); padding: 3px 9px; border-radius: 5px; font-family: monospace; }

/* ---------- Mobile ---------- */
@media (max-width: 768px) {
  .app { flex-direction: column; }
  /* Rail becomes a bottom tab bar */
  .rail {
    flex-direction: row; width: 100%; height: 60px; position: fixed; bottom: 0; left: 0;
    padding: 0 4px; z-index: 30; justify-content: space-around; border-right: none; border-top: 1px solid #000;
  }
  .rail-spacer { display: none; }
  .rail-divider { display: none; }
  .rail-btn.active::before { display: none; }
  .rail-btn.active { background: transparent; }
  .rail-avatar { width: 30px; height: 30px; font-size: 13px; }
  .rail-btn svg { width: 23px; height: 23px; }

  /* Sidebar fills screen above the bar; conversation overlays it when open */
  .sidebar { width: 100%; position: fixed; inset: 0 0 60px 0; min-width: 0; z-index: 10; }
  .conversation { position: fixed; inset: 0; z-index: 20; display: none; }
  .app.chat-open .conversation { display: flex; }
  .app.chat-open .rail { display: none; }
  .settings-detail { position: fixed; inset: 0; z-index: 25; background: var(--app-bg); }

  .back-btn { display: flex !important; }
  .messages { padding: 14px 10px; }
  .bubble { max-width: 82%; }
  .empty-state, .status-intro { display: none; }
  .app.chat-open .empty-state, .app.chat-open .status-intro { display: flex; }

  /* Full-screen overlays */
  #localVideo { width: 100px; height: 140px; bottom: 16px; right: 16px; }
  .modal { width: 94vw; padding: 20px; }
  .text-status-editor { width: 94vw; height: 70vh; }
  .status-intro-inner { gap: 34px; }
  .add-menu { left: 16px; top: auto; bottom: 130px; }
  .call-controls { gap: 16px; padding: 20px 0 30px; }
  .call-ctrl { width: 56px; height: 56px; }
}
