:root{
  --bg:#0B0D12;
  --surface:#12151C;
  --surface-2:#181C26;
  --surface-3:#1F2430;
  --surface-4:#272C3A;
  --border:#242A38;
  --border-soft:#1B2029;
  --text:#EDEFF5;
  --text-dim:#8A90A3;
  --text-faint:#565C6E;
  --accent:#4C7DFF;
  --accent-2:#7C93FF;
  --accent-soft:rgba(76,125,255,.14);
  --gold:#F0B429;
  --online:#34D399;
  --danger:#F76363;
  --danger-soft:rgba(247,99,99,.14);
  --font-display:'Sora',system-ui,sans-serif;
  --font-body:'Inter',system-ui,sans-serif;
  --font-mono:'JetBrains Mono',monospace;
  --radius-sm:8px;
  --radius-md:14px;
  --radius-lg:20px;
  --sidebar-w:76px;
  --panel-w:352px;
  --topbar-h:0px;
}

*{box-sizing:border-box;}
html,body{height:100%;}
body{
  margin:0;
  background:var(--bg);
  color:var(--text);
  font-family:var(--font-body);
  -webkit-font-smoothing:antialiased;
  overscroll-behavior:none;
}
button{font-family:inherit;}
input,textarea{font-family:inherit;}
.hidden{display:none !important;}
a{color:var(--accent-2);}
::selection{background:var(--accent-soft);}
::-webkit-scrollbar{width:8px;height:8px;}
::-webkit-scrollbar-thumb{background:var(--surface-4);border-radius:8px;}
::-webkit-scrollbar-track{background:transparent;}

.brand-mark{
  width:36px;height:36px;border-radius:10px;
  background:linear-gradient(155deg,var(--accent),#2E4FCC);
  color:var(--bg);
  display:flex;align-items:center;justify-content:center;
  box-shadow:0 4px 16px rgba(76,125,255,.35);
}
.brand-mark.large{width:64px;height:64px;border-radius:16px;}

/* ===================== AUTH ===================== */
.auth-screen{
  min-height:100vh;
  display:flex;align-items:center;justify-content:center;
  padding:24px;
  background:
    radial-gradient(900px 500px at 15% -10%, rgba(76,125,255,.18), transparent 60%),
    radial-gradient(700px 400px at 110% 110%, rgba(240,180,41,.10), transparent 60%),
    var(--bg);
}
.auth-card{
  width:100%;max-width:400px;
  background:var(--surface);
  border:1px solid var(--border-soft);
  border-radius:var(--radius-lg);
  padding:36px 32px 32px;
  box-shadow:0 30px 80px rgba(0,0,0,.45);
}
.brand{display:flex;align-items:center;gap:10px;font-family:var(--font-display);font-weight:700;font-size:20px;justify-content:center;}
.brand.small{justify-content:flex-start;}
.auth-tagline{text-align:center;color:var(--text-dim);margin:10px 0 26px;font-size:14px;}
.auth-tabs{display:flex;background:var(--surface-2);border-radius:999px;padding:4px;margin-bottom:24px;}
.auth-tab{
  flex:1;border:none;background:transparent;color:var(--text-dim);
  padding:10px 0;border-radius:999px;cursor:pointer;font-weight:600;font-size:14px;
  transition:.18s;
}
.auth-tab.active{background:var(--accent);color:#fff;}
.auth-form{display:flex;flex-direction:column;gap:16px;}
.auth-form.hidden{display:none;}
.auth-form label{display:flex;flex-direction:column;gap:7px;font-size:13px;color:var(--text-dim);font-weight:500;}
.auth-form .optional{color:var(--text-faint);font-weight:400;}
.auth-form input{
  background:var(--surface-2);border:1px solid var(--border);color:var(--text);
  border-radius:var(--radius-sm);padding:12px 14px;font-size:15px;outline:none;
  transition:.15s;
}
.auth-form input:focus{border-color:var(--accent);box-shadow:0 0 0 3px var(--accent-soft);}
.btn-primary{
  background:linear-gradient(155deg,var(--accent),#3A63E0);
  color:#fff;border:none;border-radius:var(--radius-sm);
  padding:13px;font-weight:700;font-size:15px;cursor:pointer;margin-top:4px;
  box-shadow:0 8px 24px rgba(76,125,255,.3);
  transition:transform .12s;
}
.btn-primary:hover{transform:translateY(-1px);}
.btn-primary:active{transform:translateY(0);}
.btn-primary.danger{background:linear-gradient(155deg,var(--danger),#c23f3f);box-shadow:0 8px 24px rgba(247,99,99,.25);}
.btn-secondary{
  background:var(--surface-3);color:var(--text);border:1px solid var(--border);
  border-radius:var(--radius-sm);padding:12px;font-weight:600;font-size:14px;cursor:pointer;
}
.form-error{color:var(--danger);font-size:13px;min-height:16px;}

/* ===================== APP LAYOUT ===================== */
.app{
  display:grid;
  grid-template-columns:var(--sidebar-w) var(--panel-w) 1fr;
  height:100vh;height:100dvh;
  overflow:hidden;
}
.mobile-topbar{display:none;}

.sidebar{
  background:var(--surface);
  border-right:1px solid var(--border-soft);
  display:flex;flex-direction:column;align-items:center;
  justify-content:space-between;
  padding:18px 0;
}
.sidebar-top{display:flex;flex-direction:column;align-items:center;gap:28px;}
.sidebar-tabs{display:flex;flex-direction:column;gap:6px;}
.side-tab{
  position:relative;
  width:48px;height:48px;border-radius:14px;border:none;background:transparent;
  color:var(--text-dim);cursor:pointer;display:flex;align-items:center;justify-content:center;
  transition:.15s;
}
.side-tab svg{width:22px;height:22px;}
.side-tab:hover{background:var(--surface-2);color:var(--text);}
.side-tab.active{background:var(--accent-soft);color:var(--accent-2);}
.badge-dot{
  position:absolute;top:8px;right:9px;width:9px;height:9px;border-radius:50%;
  background:var(--danger);border:2px solid var(--surface);
}
.sidebar-bottom{display:flex;flex-direction:column;align-items:center;gap:14px;}
.avatar-btn{
  position:relative;display:inline-flex;border:none;background:transparent;cursor:pointer;padding:0;margin:0;
  border-radius:50%;outline:none;-webkit-appearance:none;appearance:none;-webkit-tap-highlight-color:transparent;
}
.avatar-btn:focus-visible{box-shadow:0 0 0 2px var(--accent);}
.avatar{width:42px;height:42px;border-radius:50%;object-fit:cover;background:var(--surface-3);display:block;}
.avatar.xlarge{width:96px;height:96px;}
.avatar.small{width:30px;height:30px;}
.status-dot{
  position:absolute;bottom:0;right:0;width:12px;height:12px;border-radius:50%;
  border:2.5px solid var(--surface);background:var(--text-faint);
}
.status-dot.online{background:var(--online);}

/* Panel: list views */
.panel{
  background:var(--surface);
  border-right:1px solid var(--border-soft);
  display:flex;flex-direction:column;
  overflow:hidden;
  position:relative;
}
.panel-resize-handle{
  position:absolute;top:0;bottom:0;right:-3px;width:6px;cursor:col-resize;z-index:15;
  background:transparent;transition:background .15s;
}
.panel-resize-handle:hover,.panel-resize-handle.dragging{background:var(--accent);opacity:.5;}
body.panel-resizing{cursor:col-resize;user-select:none;}
body.panel-resizing *{user-select:none;}
.panel-view{display:flex;flex-direction:column;height:100%;overflow:hidden;}
.panel-header{
  display:flex;align-items:center;justify-content:space-between;
  padding:22px 20px 12px;
}
.panel-header h2{font-family:var(--font-display);font-size:21px;margin:0;font-weight:700;}
.icon-btn{
  width:36px;height:36px;border-radius:10px;border:none;background:transparent;color:var(--text-dim);
  cursor:pointer;display:flex;align-items:center;justify-content:center;transition:.15s;flex-shrink:0;
}
.icon-btn svg{width:19px;height:19px;}
.icon-btn:hover{background:var(--surface-3);color:var(--text);}
.icon-btn.small{width:26px;height:26px;}
.text-btn{background:none;border:none;color:var(--accent-2);font-weight:600;font-size:13px;cursor:pointer;}

.stories-row{display:flex;gap:14px;padding:4px 20px 16px;overflow-x:auto;}
.story-item{display:flex;flex-direction:column;align-items:center;gap:6px;cursor:pointer;flex-shrink:0;width:60px;}
.story-ring{
  width:56px;height:56px;border-radius:50%;padding:2.5px;
  background:linear-gradient(135deg,var(--accent),var(--gold));
  display:flex;align-items:center;justify-content:center;
}
.story-ring.viewed{background:var(--surface-4);}
.story-ring .avatar{width:100%;height:100%;border:2.5px solid var(--surface);}
.story-item span{font-size:11px;color:var(--text-dim);max-width:60px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;}
.story-add-ring{
  width:56px;height:56px;border-radius:50%;background:var(--surface-3);
  display:flex;align-items:center;justify-content:center;color:var(--accent-2);font-size:22px;font-weight:300;
  border:1.5px dashed var(--border);position:relative;
}

.list{flex:1;overflow-y:auto;padding:4px 10px 16px;}
.list-item{
  display:flex;align-items:center;gap:12px;padding:10px 10px;border-radius:var(--radius-md);
  cursor:pointer;transition:.12s;position:relative;
}
.list-item:hover{background:var(--surface-2);}
.list-item.active{background:var(--surface-3);}
.list-item .avatar-wrap{position:relative;flex-shrink:0;}
.list-item .meta{flex:1;min-width:0;}
.list-item .row1{display:flex;justify-content:space-between;align-items:center;gap:8px;}
.list-item .name{font-weight:600;font-size:14.5px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;display:flex;align-items:center;gap:4px;}
.list-item .time{font-size:11.5px;color:var(--text-faint);flex-shrink:0;}
.list-item .row2{display:flex;justify-content:space-between;align-items:center;gap:8px;margin-top:2px;}
.list-item .preview{font-size:13px;color:var(--text-dim);white-space:nowrap;overflow:hidden;text-overflow:ellipsis;}
.list-item.unread .preview{color:var(--text);font-weight:500;}
.list-item.unread .name{color:#fff;}
.unread-badge{
  background:var(--accent);color:#fff;font-size:11px;font-weight:700;
  min-width:20px;height:20px;border-radius:999px;display:flex;align-items:center;justify-content:center;padding:0 6px;flex-shrink:0;
}
.verified-badge{width:15px;height:15px;flex-shrink:0;color:var(--gold);}
.verified-badge svg{width:100%;height:100%;}

.empty-state{padding:40px 24px;text-align:center;color:var(--text-dim);}
.empty-state p{font-weight:600;color:var(--text);margin:0 0 4px;}
.empty-state span{font-size:13px;}

.subtabs{display:flex;gap:6px;padding:0 20px 14px;}
.subtab{
  background:var(--surface-2);border:1px solid transparent;color:var(--text-dim);
  padding:7px 13px;border-radius:999px;font-size:13px;font-weight:600;cursor:pointer;display:flex;align-items:center;gap:6px;
}
.subtab.active{background:var(--accent-soft);color:var(--accent-2);border-color:rgba(76,125,255,.3);}
.count-pill{background:var(--danger);color:#fff;font-size:10.5px;padding:1px 6px;border-radius:999px;}

.friend-actions{display:flex;gap:8px;}
.pill-btn{
  border:none;border-radius:999px;padding:7px 14px;font-size:12.5px;font-weight:700;cursor:pointer;
}
.pill-btn.accept{background:var(--accent);color:#fff;}
.pill-btn.deny{background:var(--surface-4);color:var(--text-dim);}
.pill-btn.add{background:var(--accent-soft);color:var(--accent-2);}
.pill-btn.pending{background:var(--surface-4);color:var(--text-faint);cursor:default;}

.notif-item{display:flex;gap:12px;padding:12px 10px;border-radius:var(--radius-md);cursor:pointer;}
.notif-item:hover{background:var(--surface-2);}
.notif-item.unread{background:var(--accent-soft);}
.notif-icon{
  width:38px;height:38px;border-radius:50%;background:var(--surface-3);flex-shrink:0;
  display:flex;align-items:center;justify-content:center;color:var(--accent-2);
}
.notif-body strong{font-size:13.5px;}
.notif-body p{margin:2px 0 0;font-size:13px;color:var(--text-dim);}
.notif-body time{font-size:11.5px;color:var(--text-faint);}

/* ===================== CHAT WINDOW ===================== */
.chat-window{display:flex;flex-direction:column;background:var(--bg);overflow:hidden;position:relative;}
.chat-empty{
  flex:1;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:16px;color:var(--text-faint);
}
.chat-active{display:flex;flex-direction:column;height:100%;overflow:hidden;}
.chat-header{
  display:flex;align-items:center;gap:10px;padding:14px 20px;
  border-bottom:1px solid var(--border-soft);background:var(--surface);flex-shrink:0;
}
.only-mobile{display:none;}
.chat-header-info{display:flex;align-items:center;gap:12px;flex:1;min-width:0;cursor:pointer;}
.chat-header-info .name-row{display:flex;align-items:center;gap:5px;font-weight:700;font-size:15px;}
.chat-header-info .sub{font-size:12.5px;color:var(--text-dim);}
.chat-header-actions{display:flex;gap:4px;}
.menu-wrap{position:relative;}
.dropdown{
  position:absolute;right:0;top:44px;background:var(--surface-3);border:1px solid var(--border);
  border-radius:var(--radius-md);padding:6px;min-width:200px;box-shadow:0 20px 50px rgba(0,0,0,.45);z-index:40;
}
.dropdown-item{
  padding:10px 12px;border-radius:8px;font-size:14px;cursor:pointer;display:flex;align-items:center;gap:10px;
  color:var(--text);
}
.dropdown-item:hover{background:var(--surface-4);}
.dropdown-item.danger{color:var(--danger);}
.dropdown-sep{height:1px;background:var(--border);margin:6px 4px;}

.messages{flex:1;overflow-y:auto;padding:18px 20px;display:flex;flex-direction:column;gap:3px;}
.msg-row{display:flex;gap:9px;max-width:74%;align-self:flex-start;position:relative;}
.msg-row.mine{align-self:flex-end;flex-direction:row-reverse;}
.msg-row .avatar{width:28px;height:28px;margin-top:auto;flex-shrink:0;visibility:hidden;}
.msg-row.show-avatar .avatar{visibility:visible;}
.msg-group-gap{margin-top:14px;}
.bubble-col{display:flex;flex-direction:column;gap:2px;min-width:0;}
.msg-row.mine .bubble-col{align-items:flex-end;}
.sender-name{font-size:12px;color:var(--accent-2);font-weight:600;margin:0 2px 2px;}
.bubble{
  background:var(--surface-3);color:var(--text);padding:9px 13px;border-radius:16px;
  font-size:14.5px;line-height:1.42;position:relative;word-wrap:break-word;white-space:pre-wrap;
}
.msg-row.mine .bubble{background:linear-gradient(155deg,var(--accent),#3A63E0);color:#fff;}
.bubble.deleted{font-style:italic;color:var(--text-faint);background:var(--surface-2);}
.msg-row.mine .bubble.deleted{background:var(--surface-2);color:var(--text-faint);}
.bubble-media img,.bubble-media video{max-width:280px;max-height:320px;border-radius:12px;display:block;}
.bubble-file{display:flex;align-items:center;gap:10px;}
.bubble-file .ficon{width:34px;height:34px;border-radius:8px;background:rgba(255,255,255,.12);display:flex;align-items:center;justify-content:center;flex-shrink:0;}
.voice-bubble{display:flex;align-items:center;gap:10px;min-width:190px;}
.voice-bubble button{background:rgba(255,255,255,.16);border:none;color:inherit;width:30px;height:30px;border-radius:50%;cursor:pointer;flex-shrink:0;display:flex;align-items:center;justify-content:center;}
.voice-wave{flex:1;height:22px;display:flex;align-items:center;gap:2px;}
.voice-wave span{width:2.5px;background:currentColor;opacity:.55;border-radius:2px;}
.voice-time{font-size:11px;opacity:.85;flex-shrink:0;}
.reply-quote{
  border-left:3px solid rgba(255,255,255,.4);padding:4px 8px;margin-bottom:5px;border-radius:4px;
  background:rgba(0,0,0,.12);font-size:12.5px;opacity:.85;cursor:pointer;
}
.msg-row:not(.mine) .reply-quote{border-left-color:var(--accent);}
.reply-quote strong{display:block;font-size:11.5px;}
.msg-meta-row{display:flex;align-items:center;gap:5px;font-size:10.5px;color:var(--text-faint);margin:1px 3px;}
.msg-row.mine .msg-meta-row{flex-direction:row-reverse;}
.reactions-row{display:flex;gap:4px;flex-wrap:wrap;margin:2px 3px;}
.reaction-chip{
  background:var(--surface-3);border:1px solid var(--border);border-radius:999px;padding:1px 7px;font-size:12px;
  display:flex;align-items:center;gap:3px;cursor:pointer;
}
.reaction-chip.mine{border-color:var(--accent);background:var(--accent-soft);}
.msg-hover-actions{
  position:absolute;top:-16px;display:flex;gap:2px;background:var(--surface-3);border:1px solid var(--border);
  border-radius:10px;padding:2px;opacity:0;pointer-events:none;transition:.12s;box-shadow:0 6px 16px rgba(0,0,0,.35);
}
.msg-row.mine .msg-hover-actions{right:36px;}
.msg-row:not(.mine) .msg-hover-actions{left:36px;}
.msg-row:hover .msg-hover-actions{opacity:1;pointer-events:auto;}
.msg-hover-actions button{width:26px;height:26px;border-radius:7px;border:none;background:none;color:var(--text-dim);cursor:pointer;font-size:13px;display:flex;align-items:center;justify-content:center;}
.msg-hover-actions button:hover{background:var(--surface-4);color:var(--text);}
.day-divider{align-self:center;font-size:11.5px;color:var(--text-faint);background:var(--surface-2);padding:4px 12px;border-radius:999px;margin:14px 0 6px;}
.emoji-picker-inline{
  position:absolute;bottom:34px;background:var(--surface-3);border:1px solid var(--border);border-radius:12px;
  padding:8px;display:flex;gap:4px;box-shadow:0 12px 30px rgba(0,0,0,.4);z-index:20;flex-wrap:wrap;max-width:220px;
}
.emoji-picker-inline button{background:none;border:none;font-size:19px;cursor:pointer;padding:4px;border-radius:6px;}
.emoji-picker-inline button:hover{background:var(--surface-4);}

.typing-indicator{padding:0 22px 6px;font-size:12.5px;color:var(--text-dim);font-style:italic;flex-shrink:0;}

.reply-preview{
  display:flex;align-items:center;justify-content:space-between;padding:8px 18px;background:var(--surface-2);
  border-top:1px solid var(--border-soft);flex-shrink:0;
}
.reply-preview-content{font-size:12.5px;color:var(--text-dim);border-left:2px solid var(--accent);padding-left:8px;}
.reply-preview-content strong{color:var(--accent-2);display:block;font-size:11.5px;}

.composer{
  display:flex;align-items:flex-end;gap:6px;padding:12px 16px;border-top:1px solid var(--border-soft);
  background:var(--surface);flex-shrink:0;
}
.composer-input-wrap{flex:1;background:var(--surface-2);border:1px solid var(--border);border-radius:20px;padding:2px 4px;}
.composer textarea{
  width:100%;background:transparent;border:none;color:var(--text);resize:none;outline:none;
  padding:9px 12px;font-size:14.5px;max-height:120px;line-height:1.4;
}
.send-btn{color:var(--accent);}
.hold-record{touch-action:none;}
.hold-record.recording{color:var(--danger);}
.recording-bar{
  display:flex;align-items:center;gap:10px;padding:10px 18px;background:var(--surface);border-top:1px solid var(--border-soft);
  font-size:13px;color:var(--text-dim);flex-shrink:0;
}
.rec-dot{width:9px;height:9px;border-radius:50%;background:var(--danger);animation:pulse 1.1s infinite;}
.rec-hint{color:var(--text-faint);margin-left:auto;font-size:12px;}
@keyframes pulse{0%,100%{opacity:1;}50%{opacity:.3;}}

/* ===================== MODALS ===================== */
.modal-backdrop{
  position:fixed;inset:0;background:rgba(6,7,10,.66);backdrop-filter:blur(3px);
  display:flex;align-items:center;justify-content:center;z-index:100;padding:20px;
  animation:fadeIn .15s ease;
}
@keyframes fadeIn{from{opacity:0;}to{opacity:1;}}
.modal{
  background:var(--surface);border:1px solid var(--border-soft);border-radius:var(--radius-lg);
  width:100%;max-width:440px;max-height:86vh;overflow-y:auto;box-shadow:0 30px 80px rgba(0,0,0,.5);
}
.modal-header{display:flex;align-items:center;justify-content:space-between;padding:20px 22px 4px;}
.modal-header h3{font-family:var(--font-display);font-size:18px;margin:0;}
.modal-body{padding:18px 22px 22px;display:flex;flex-direction:column;gap:16px;}
.modal-body label{display:flex;flex-direction:column;gap:6px;font-size:13px;color:var(--text-dim);font-weight:500;}
.modal-body input,.modal-body textarea{
  background:var(--surface-2);border:1px solid var(--border);color:var(--text);border-radius:var(--radius-sm);
  padding:11px 13px;font-size:14.5px;outline:none;font-family:inherit;
}
.modal-body input:focus,.modal-body textarea:focus{border-color:var(--accent);}
.field-error{color:var(--danger);font-size:12.5px;}
.field-hint{color:var(--text-faint);font-size:12px;}
.modal-tabs{display:flex;gap:8px;padding:0 22px;border-bottom:1px solid var(--border-soft);}
.modal-tab{background:none;border:none;color:var(--text-dim);padding:10px 4px;font-weight:600;font-size:13.5px;cursor:pointer;border-bottom:2px solid transparent;}
.modal-tab.active{color:var(--accent-2);border-color:var(--accent);}
.checkable-row{display:flex;align-items:center;gap:12px;padding:9px 6px;border-radius:10px;cursor:pointer;}
.checkable-row:hover{background:var(--surface-2);}
.checkable-row input{width:17px;height:17px;accent-color:var(--accent);}

.friend-tile-grid{display:flex;flex-wrap:wrap;gap:14px;max-height:280px;overflow-y:auto;padding:6px 2px;}
.friend-tile{
  display:flex;flex-direction:column;align-items:center;gap:6px;width:70px;cursor:pointer;
  padding:6px 4px;border-radius:12px;position:relative;transition:.12s;
}
.friend-tile:hover{background:var(--surface-2);}
.friend-tile input{position:absolute;opacity:0;width:0;height:0;pointer-events:none;}
.tile-avatar-wrap{position:relative;display:block;}
.tile-avatar-wrap .avatar{width:56px;height:56px;}
.tile-check{
  position:absolute;bottom:-2px;right:-2px;width:19px;height:19px;border-radius:50%;
  background:var(--surface-4);border:2px solid var(--surface);color:transparent;
  display:flex;align-items:center;justify-content:center;font-size:11px;font-weight:700;transition:.12s;
}
.friend-tile input:checked ~ .tile-avatar-wrap .tile-check{background:var(--accent);color:#fff;border-color:var(--accent);}
.friend-tile input:checked ~ .tile-avatar-wrap{outline:2px solid var(--accent);outline-offset:2px;border-radius:50%;}
.tile-name{font-size:11.5px;color:var(--text-dim);text-align:center;max-width:68px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;}
.friend-tile input:checked ~ .tile-name{color:var(--text);font-weight:600;}

/* Profile view specific */
.profile-hero{display:flex;flex-direction:column;align-items:center;gap:10px;padding:6px 0 4px;}
.profile-hero .name-row{display:flex;align-items:center;gap:6px;font-family:var(--font-display);font-weight:700;font-size:19px;}
.profile-hero .username{color:var(--text-dim);font-size:13.5px;}
.profile-hero .bio{text-align:center;color:var(--text-dim);font-size:13.5px;margin-top:4px;}
.avatar-upload-wrap{position:relative;width:96px;height:96px;}
.avatar-upload-overlay{
  position:absolute;inset:0;border-radius:50%;background:rgba(0,0,0,.45);color:#fff;
  display:flex;align-items:center;justify-content:center;opacity:0;cursor:pointer;font-size:11px;font-weight:600;transition:.15s;
}
.avatar-upload-wrap:hover .avatar-upload-overlay{opacity:1;}

/* ===================== STORIES VIEWER ===================== */
.story-viewer{position:fixed;inset:0;background:#000;z-index:200;display:flex;align-items:center;justify-content:center;}
.story-viewer-inner{width:100%;max-width:420px;height:100%;max-height:100vh;position:relative;display:flex;flex-direction:column;}
.story-progress-row{display:flex;gap:4px;padding:10px 10px 0;}
.story-progress-bar{flex:1;height:3px;background:rgba(255,255,255,.25);border-radius:3px;overflow:hidden;}
.story-progress-fill{height:100%;width:0%;background:#fff;}
.story-viewer-header{display:flex;align-items:center;gap:10px;padding:12px 14px;color:#fff;}
.story-viewer-header .name{font-weight:700;font-size:14px;flex:1;}
.story-viewer-header time{font-size:12px;opacity:.7;}
.story-media-wrap{flex:1;display:flex;align-items:center;justify-content:center;position:relative;overflow:hidden;}
.story-media-wrap img,.story-media-wrap video{max-width:100%;max-height:100%;object-fit:contain;}
.story-audio-card{width:80%;padding:40px 20px;text-align:center;color:#fff;}
.story-caption{position:absolute;bottom:20px;left:16px;right:16px;color:#fff;background:rgba(0,0,0,.4);padding:10px 14px;border-radius:12px;font-size:14px;}
.story-nav-zone{position:absolute;top:0;bottom:0;width:35%;z-index:5;}
.story-close{position:absolute;top:10px;right:10px;z-index:10;color:#fff;background:rgba(0,0,0,.3);}
.story-delete{position:absolute;top:10px;right:52px;z-index:10;color:#fff;background:rgba(0,0,0,.3);}

/* ===================== CALLS ===================== */
.call-overlay{position:fixed;inset:0;z-index:150;display:flex;align-items:center;justify-content:center;}
.call-bg{position:absolute;inset:0;background:radial-gradient(700px 500px at 50% 20%,#1a2240,#05060a 70%);}
.call-content{position:relative;width:100%;height:100%;display:flex;flex-direction:column;align-items:center;justify-content:center;color:#fff;}
.remote-video{position:absolute;inset:0;width:100%;height:100%;object-fit:cover;}
.local-video{
  position:absolute;bottom:110px;right:20px;width:120px;height:160px;object-fit:cover;border-radius:16px;
  border:2px solid rgba(255,255,255,.2);box-shadow:0 10px 30px rgba(0,0,0,.5);
}
.call-avatar-wrap{display:flex;flex-direction:column;align-items:center;gap:8px;z-index:2;}
.call-avatar-wrap h3{font-family:var(--font-display);margin:6px 0 0;font-size:22px;}
.call-avatar-wrap p{color:rgba(255,255,255,.7);margin:0;}
.call-controls{position:absolute;bottom:36px;display:flex;gap:18px;z-index:3;}
.call-btn{
  width:56px;height:56px;border-radius:50%;border:none;background:rgba(255,255,255,.12);color:#fff;
  display:flex;align-items:center;justify-content:center;cursor:pointer;backdrop-filter:blur(6px);
}
.call-btn svg{width:22px;height:22px;}
.call-btn.active{background:#fff;color:#111;}
.call-btn.danger{background:var(--danger);}
.call-btn.small{width:42px;height:42px;}
.call-btn.accept{background:var(--online);}

.incoming-call{
  position:fixed;top:18px;left:50%;transform:translateX(-50%);z-index:160;
  background:var(--surface-3);border:1px solid var(--border);border-radius:16px;padding:12px 14px;
  display:flex;align-items:center;gap:12px;box-shadow:0 20px 50px rgba(0,0,0,.5);min-width:280px;
}
.incoming-info{display:flex;flex-direction:column;flex:1;}
.incoming-info span{font-size:12.5px;color:var(--text-dim);}

.toast-root{position:fixed;bottom:20px;right:20px;z-index:300;display:flex;flex-direction:column;gap:10px;}
.toast{
  background:var(--surface-3);border:1px solid var(--border);color:var(--text);padding:12px 16px;border-radius:12px;
  font-size:13.5px;box-shadow:0 10px 30px rgba(0,0,0,.4);animation:slideUp .18s ease;max-width:300px;
}
.toast.error{border-color:rgba(247,99,99,.4);}
@keyframes slideUp{from{transform:translateY(10px);opacity:0;}to{transform:translateY(0);opacity:1;}}

/* ===================== ADMIN ===================== */
.admin-user-row{display:flex;align-items:center;gap:10px;padding:10px 6px;border-bottom:1px solid var(--border-soft);}
.admin-user-row .meta{flex:1;min-width:0;}
.admin-user-row .name{font-weight:600;font-size:13.5px;display:flex;align-items:center;gap:5px;}
.admin-user-row .username{font-size:12px;color:var(--text-dim);}
.admin-actions{display:flex;gap:6px;}

/* ===================== RESPONSIVE ===================== */
@media (max-width: 900px){
  :root{--sidebar-w:0px;--panel-w:100%;}
  .mobile-topbar{
    display:flex;align-items:center;justify-content:space-between;padding:12px 14px;
    background:var(--surface);border-bottom:1px solid var(--border-soft);position:sticky;top:0;z-index:30;
  }
  .mobile-title{font-family:var(--font-display);font-weight:700;font-size:16px;}
  .app{
    display:flex;flex-direction:column;
    height:100vh;height:100dvh;
  }
  .sidebar{
    flex-direction:row;justify-content:space-around;align-items:center;
    padding:8px 10px;order:3;border-right:none;border-top:1px solid var(--border-soft);width:100%;
  }
  .sidebar-top{flex-direction:row;gap:6px;}
  .sidebar-bottom{order:-1;flex-direction:row;gap:10px;}
  .sidebar-tabs{flex-direction:row;}
  .panel{border-right:none;flex:1;width:100%;display:none;}
  .panel.mobile-show{display:flex;}
  .chat-window{position:fixed;inset:0;bottom:0;z-index:40;display:none;padding-bottom:0;}
  .chat-window.mobile-show{display:flex;}
  .only-mobile{display:flex;}
  .local-video{width:88px;height:120px;bottom:130px;right:14px;}
  .modal{max-width:100%;margin:0 6px;}
  .panel-resize-handle{display:none;}
}
@media (min-width: 901px){
  .mobile-back{display:none;}
}
