/* ============================================================
   ServerSend — Design System
   Futuristic, clean, no emojis. Dark + Light themes.
   ============================================================ */

/* ---------- tokens ---------- */
:root, [data-theme="dark"] {
  --bg: #08090f;
  --bg-2: #0c0e17;
  --panel: #11131f;
  --panel-2: #171a29;
  --panel-3: #1d2133;
  --line: rgba(148, 163, 255, 0.10);
  --line-soft: rgba(148, 163, 255, 0.06);
  --text: #e7e9f5;
  --text-dim: #9aa1bd;
  --text-faint: #5d647f;
  --accent: #6e6cff;
  --accent-2: #8b7bff;
  --accent-grad: linear-gradient(135deg, #6e6cff 0%, #9a7bff 100%);
  --cyan: #41d6ff;
  --green: #34d399;
  --green-2: #059669;
  --red: #f2546b;
  --orange: #ffb454;
  --yellow: #ffd166;
  --pink: #ff6bb5;
  --shadow: 0 8px 30px rgba(0,0,0,.45);
  --shadow-sm: 0 2px 10px rgba(0,0,0,.28);
  --radius: 14px;
  --radius-sm: 10px;
  --radius-lg: 20px;
  color-scheme: dark;
}

[data-theme="light"] {
  --bg: #eef0f6;
  --bg-2: #e7eaf2;
  --panel: #ffffff;
  --panel-2: #f2f4fb;
  --panel-3: #e6e9f3;
  --line: rgba(20, 24, 60, 0.12);
  --line-soft: rgba(20, 24, 60, 0.06);
  --text: #141a2e;
  --text-dim: #5a6177;
  --text-faint: #9aa0b5;
  --shadow: 0 8px 30px rgba(30, 40, 90, .12);
  --shadow-sm: 0 2px 10px rgba(30, 40, 90, .08);
  color-scheme: light;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body { height: 100%; }

body {
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.45;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

::selection { background: rgba(110, 108, 255, .35); }

/* scrollbars */
*::-webkit-scrollbar { width: 8px; height: 8px; }
*::-webkit-scrollbar-thumb { background: var(--panel-3); border-radius: 8px; }
*::-webkit-scrollbar-thumb:hover { background: var(--text-faint); }
*::-webkit-scrollbar-track { background: transparent; }

/* ---------- helpers ---------- */
.hidden { display: none !important; }

.ic { flex: none; }

svg.ic { width: 20px; height: 20px; }

button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; }

input, textarea { font-family: inherit; font-size: 14px; color: var(--text); background: var(--panel-2); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 10px 12px; outline: none; transition: border-color .2s, box-shadow .2s; }
input:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(110,108,255,.18); }
textarea { resize: none; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 7px;
  border-radius: var(--radius-sm); padding: 9px 15px;
  font-size: 13px; font-weight: 600;
  transition: transform .15s, box-shadow .2s, background .2s, border-color .2s, color .2s;
  border: 1px solid transparent; white-space: nowrap;
}
.btn:active { transform: translateY(1px) scale(.99); }
.btn svg.ic { width: 16px; height: 16px; }

.btn-primary { background: var(--accent-grad); color: #fff; box-shadow: 0 4px 14px rgba(110,108,255,.35); }
.btn-primary:hover { box-shadow: 0 6px 20px rgba(110,108,255,.45); filter: brightness(1.05); }

.btn-ghost { background: transparent; color: var(--text-dim); border: 1px solid var(--line); }
.btn-ghost:hover { color: var(--text); background: var(--panel-2); }

.btn-danger { background: rgba(242,84,107,.14); color: var(--red); border-color: rgba(242,84,107,.35); }
.btn-danger:hover { background: rgba(242,84,107,.22); }

.btn-block { width: 100%; justify-content: center; }
.btn.small { padding: 5px 9px; font-size: 12px; }

.icon-btn {
  position: relative; display: inline-flex; align-items: center; justify-content: center;
  width: 36px; height: 36px; border-radius: var(--radius-sm);
  color: var(--text-dim); transition: background .2s, color .2s, transform .15s;
}
.icon-btn:hover { background: var(--panel-2); color: var(--text); }
.icon-btn:active { transform: scale(.94); }
.icon-btn.small { width: 28px; height: 28px; }
.icon-btn svg.ic { width: 18px; height: 18px; }

/* badge */
.badge {
  position: absolute; top: 2px; right: 2px; min-width: 16px; height: 16px;
  background: var(--red); color: #fff; border-radius: 8px;
  font-size: 10px; font-weight: 700; line-height: 16px; text-align: center; padding: 0 4px;
}

/* ---------- avatar ---------- */
.ava {
  position: relative; display: inline-flex; align-items: center; justify-content: center;
  border-radius: 50%; overflow: hidden; flex: none;
  color: #fff; font-weight: 700; letter-spacing: .5px;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.08);
}
.ava img { width: 100%; height: 100%; object-fit: cover; }
.ava.fallback { background: var(--accent); }

/* ---------- login ---------- */
.screen { position: fixed; inset: 0; z-index: 100; display: flex; align-items: center; justify-content: center; }

.login-bg {
  position: absolute; inset: 0;
  background:
    radial-gradient(600px 400px at 20% 20%, rgba(110,108,255,.18), transparent 60%),
    radial-gradient(700px 500px at 80% 70%, rgba(65,214,255,.12), transparent 60%),
    var(--bg);
}
.login-bg::before {
  content: ""; position: absolute; inset: 0;
  background-image: linear-gradient(var(--line) 1px, transparent 1px), linear-gradient(90deg, var(--line) 1px, transparent 1px);
  background-size: 44px 44px;
  mask-image: radial-gradient(circle at 50% 40%, #000 10%, transparent 70%);
  opacity: .5;
}

.login-card {
  position: relative; width: 400px; max-width: calc(100vw - 32px);
  background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius-lg); padding: 36px 32px;
  box-shadow: var(--shadow); animation: rise .5s cubic-bezier(.2,.8,.2,1);
}
@keyframes rise { from { opacity: 0; transform: translateY(18px) scale(.98); } to { opacity: 1; transform: none; } }

.login-logo { text-align: center; margin-bottom: 24px; }
.logo-mark {
  width: 54px; height: 54px; margin: 0 auto 12px; border-radius: 16px;
  background: var(--accent-grad); color: #fff; font-weight: 800; font-size: 22px;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 6px 20px rgba(110,108,255,.4);
}
.logo-mark.small { width: 30px; height: 30px; border-radius: 9px; font-size: 13px; margin: 0; box-shadow: none; }
.login-logo h1 { font-size: 22px; font-weight: 700; letter-spacing: -.3px; }
.login-logo p { color: var(--text-dim); font-size: 13px; margin-top: 4px; }

.login-tabs {
  display: flex; gap: 4px; background: var(--panel-2); border-radius: var(--radius-sm); padding: 4px; margin-bottom: 20px;
}
.login-tab {
  flex: 1; padding: 8px; border-radius: 8px; font-size: 13px; font-weight: 600; color: var(--text-dim);
  transition: background .2s, color .2s;
}
.login-tab.active { background: var(--panel-3); color: var(--text); }

.login-form { display: flex; flex-direction: column; gap: 14px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: 12px; font-weight: 600; color: var(--text-dim); }
.login-error { color: var(--red); font-size: 13px; min-height: 18px; }
.login-hint { color: var(--text-faint); font-size: 12px; text-align: center; margin-top: 8px; line-height: 1.5; }

/* ---------- app shell ---------- */
.app { position: fixed; inset: 0; display: flex; }

.rail {
  width: 64px; flex: none; display: flex; flex-direction: column;
  background: var(--bg-2); border-right: 1px solid var(--line);
  align-items: center; padding: 14px 0; gap: 4px; z-index: 30;
}
.rail-brand { margin-bottom: 14px; }
.rail-nav { display: flex; flex-direction: column; gap: 4px; flex: 1; width: 100%; align-items: center; }
.nav-btn {
  position: relative; width: 46px; height: 46px; border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  color: var(--text-faint); transition: color .2s, background .2s, transform .15s;
}
.nav-btn svg.ic { width: 22px; height: 22px; }
.nav-btn:hover { color: var(--text); background: var(--panel-2); }
.nav-btn.active { color: #fff; background: var(--accent-grad); box-shadow: 0 4px 16px rgba(110,108,255,.4); }
.nav-btn.active::after {
  content: ""; position: absolute; left: -9px; top: 50%; transform: translateY(-50%);
  width: 3px; height: 22px; border-radius: 4px; background: var(--accent-2);
}
.nav-spacer { flex: 1; }
.rail-foot { width: 100%; display: flex; justify-content: center; }
.rail-btn {
  width: 40px; height: 40px; border-radius: 12px; display: flex; align-items: center; justify-content: center;
  color: var(--text-faint); transition: color .2s, background .2s;
}
.rail-btn:hover { color: var(--text); background: var(--panel-2); }
.nav-label { display: none; }

/* ---------- shell / topbar ---------- */
.shell { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.topbar {
  height: 56px; flex: none; display: flex; align-items: center; gap: 16px;
  padding: 0 18px; background: var(--bg-2); border-bottom: 1px solid var(--line);
}
.topbar-search {
  flex: 1; max-width: 420px; display: flex; align-items: center; gap: 8px;
  background: var(--panel-2); border: 1px solid var(--line); border-radius: var(--radius-sm);
  padding: 0 12px; color: var(--text-faint);
}
.topbar-search svg.ic { width: 16px; height: 16px; }
.topbar-search input { border: none; background: none; box-shadow: none !important; padding: 8px 0; flex: 1; }
.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: 4px; }
.self-avatar { cursor: pointer; }

/* ---------- layout ---------- */
.layout { flex: 1; min-height: 0; position: relative; }
.view {
  position: absolute; inset: 0; display: grid; grid-template-columns: 320px 1fr 280px;
  animation: fadeIn .25s ease;
}

#view-system {
  grid-template-columns: 1fr;
}

#view-system .thread-panel {
  width: 100%;
  max-width: none;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.panel {
  background: var(--panel); border-right: 1px solid var(--line);
  display: flex; flex-direction: column; min-height: 0;
}
.panel-header {
  height: 52px; flex: none; display: flex; align-items: center; justify-content: space-between;
  padding: 0 14px; font-weight: 700; font-size: 14px; border-bottom: 1px solid var(--line-soft);
}
.chat-list, .folder-list { flex: 1; overflow-y: auto; padding: 8px; }
.details-panel { border-right: none; border-left: 1px solid var(--line); }
.details-body { flex: 1; overflow-y: auto; padding: 12px; }

/* ---------- chat list ---------- */
.chat-item {
  display: flex; gap: 11px; align-items: center; padding: 10px 10px; border-radius: var(--radius);
  cursor: pointer; transition: background .15s; position: relative;
}
.chat-item:hover { background: var(--panel-2); }
.chat-item.active { background: linear-gradient(90deg, rgba(110,108,255,.14), rgba(110,108,255,.04)); }
.chat-item.active::before {
  content: ""; position: absolute; left: 0; top: 20%; bottom: 20%; width: 3px; border-radius: 3px; background: var(--accent-2);
}
.chat-meta { flex: 1; min-width: 0; }
.chat-name { display: flex; align-items: center; gap: 6px; }
.chat-name span:first-child { font-weight: 600; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-time { margin-left: auto; font-size: 11px; color: var(--text-faint); flex: none; }
.chat-preview { display: flex; gap: 5px; font-size: 12.5px; color: var(--text-dim); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-preview span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-unread {
  flex: none; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px;
  background: var(--accent); color: #fff; font-size: 11px; font-weight: 700; line-height: 18px; text-align: center;
}
.dot {
  display: inline-block; width: 9px; height: 9px; border-radius: 50%;
  background: var(--text-faint); border: 2px solid var(--panel);
}
.dot.online { background: var(--green); box-shadow: 0 0 0 3px rgba(52,211,153,.2); }

/* ---------- thread ---------- */
.thread-panel { display: flex; flex-direction: column; min-width: 0; background: var(--bg); }
.thread-empty { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; color: var(--text-dim); }
.empty-art {
  width: 72px; height: 72px; border-radius: 50%; background: var(--panel-2); color: var(--text-faint);
  display: flex; align-items: center; justify-content: center; font-size: 30px; margin-bottom: 6px;
}
.thread-empty h3 { color: var(--text); font-size: 17px; }
.thread-empty p { font-size: 13px; max-width: 300px; text-align: center; }

.thread { flex: 1; display: flex; flex-direction: column; min-height: 0; }

.thread-header {
  height: 60px; flex: none; display: flex; align-items: center; gap: 12px;
  padding: 0 16px; background: var(--panel); border-bottom: 1px solid var(--line);
}
.th-name { font-weight: 700; font-size: 15px; }
.th-sub { font-size: 12px; color: var(--text-dim); }
.th-actions { margin-left: auto; display: flex; gap: 2px; }

.thread-messages { flex: 1; overflow-y: auto; padding: 18px 22px; display: flex; flex-direction: column; gap: 3px; }

.msg-date {
  align-self: center; font-size: 11.5px; color: var(--text-faint);
  background: var(--panel-2); padding: 3px 12px; border-radius: 12px; margin: 8px 0;
}

.msg { display: flex; gap: 9px; max-width: 78%; animation: msgIn .22s ease; }
@keyframes msgIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.msg.me { align-self: flex-end; flex-direction: row-reverse; }
.msg.bubble-only { align-self: center; max-width: 92%; }

.m-avatar { flex: none; }
.msg-body { display: flex; flex-direction: column; min-width: 0; }
.msg-sender { font-size: 12px; font-weight: 700; color: var(--accent-2); margin-bottom: 2px; }

.msg-bubble {
  padding: 9px 13px; border-radius: var(--radius); background: var(--panel-2);
  border: 1px solid var(--line-soft); font-size: 14px; word-break: break-word;
  box-shadow: var(--shadow-sm);
}
.msg.me .msg-bubble {
  background: var(--accent-grad); color: #fff; border: none;
}
.msg.me .msg-bubble .msg-meta { color: rgba(255,255,255,.75); }
.msg.me .msg-bubble .msg-edited, .msg.me .msg-bubble .read-tick { color: rgba(255,255,255,.85); }

.msg-meta { display: flex; align-items: center; gap: 8px; font-size: 11px; color: var(--text-faint); margin-top: 4px; }
.msg.edited { font-style: italic; }

.msg-urgent .msg-bubble { border-color: var(--orange); box-shadow: 0 0 0 1px var(--orange), var(--shadow-sm); }
.msg-urgent .msg-bubble::after {
  content: "•"; position: absolute; right: -4px; top: -4px; width: 10px; height: 10px;
  background: var(--orange); border-radius: 50%;
}
.msg-reply-ref {
  font-size: 12px; color: var(--text-dim); background: var(--panel-3); padding: 4px 9px;
  border-radius: 8px; margin-bottom: 4px; cursor: pointer; border-left: 2px solid var(--accent-2);
}
.msg-bubble { position: relative; }

.reactions { display: flex; gap: 5px; margin-top: 5px; }
.reaction {
  font-size: 12px; padding: 2px 8px; border-radius: 10px; background: var(--panel-2);
  border: 1px solid var(--line); cursor: pointer; transition: background .15s;
}
.reaction.mine { background: rgba(110,108,255,.2); border-color: var(--accent-2); }
.reaction:hover { background: var(--panel-3); }

.image-preview { max-width: 320px; border-radius: 10px; overflow: hidden; cursor: zoom-in; }
.image-preview img { display: block; max-width: 100%; max-height: 340px; object-fit: cover; }
.file-name { font-size: 12px; color: var(--text-dim); margin-top: 5px; }
.audio-player audio { width: 260px; height: 40px; }

.clipboard-chip {
  margin-top: 6px; font-size: 12px; color: var(--text-dim); background: var(--panel-3);
  padding: 6px 10px; border-radius: 8px; border-left: 3px solid var(--cyan);
}

.msg-hover-actions { position: absolute; top: -30px; right: 8px; display: flex; gap: 4px; z-index: 10; background: var(--panel-3); border: 1px solid var(--line); border-radius: 10px; padding: 3px; box-shadow: var(--shadow-sm); }

.typing-indicator { height: 0; overflow: hidden; transition: height .2s; padding: 0 22px; }
.typing-indicator.show { height: 28px; padding-top: 4px; }
.typing-dots { display: inline-flex; gap: 4px; align-items: center; }
.typing-dots span { width: 6px; height: 6px; border-radius: 50%; background: var(--text-faint); animation: blink 1.2s infinite; }
.typing-dots span:nth-child(2) { animation-delay: .2s; }
.typing-dots span:nth-child(3) { animation-delay: .4s; }
@keyframes blink { 0%, 80%, 100% { opacity: .25; } 40% { opacity: 1; } }

/* ---------- composer ---------- */
.composer {
  display: flex; align-items: flex-end; gap: 8px; padding: 12px 16px;
  background: var(--panel); border-top: 1px solid var(--line);
}
.composer textarea {
  flex: 1; max-height: 120px; border-radius: 16px; padding: 11px 15px;
  background: var(--panel-2);
}
.send-btn { width: 44px; height: 44px; border-radius: 50%; padding: 0; justify-content: center; }
.send-btn svg.ic { width: 18px; height: 18px; }

.recorder-bar { display: flex; align-items: center; gap: 8px; color: var(--red); font-weight: 700; font-size: 13px; }
.rec-pulse { width: 10px; height: 10px; border-radius: 50%; background: var(--red); animation: pulse 1s infinite; }
@keyframes pulse { 0%,100% { transform: scale(1); opacity: 1; } 50% { transform: scale(1.4); opacity: .5; } }

/* ---------- dropzone ---------- */
.dropzone-overlay {
  position: absolute; inset: 0; z-index: 40; display: flex; align-items: center; justify-content: center;
  background: rgba(110,108,255,.15); backdrop-filter: blur(6px); border: 2px dashed var(--accent-2); border-radius: 14px; margin: 12px;
  color: #fff; font-weight: 700; font-size: 16px; animation: fadeIn .2s;
}

/* ---------- files ---------- */
.folder-item {
  display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: var(--radius-sm);
  cursor: pointer; transition: background .15s; color: var(--text-dim);
}
.folder-item:hover { background: var(--panel-2); }
.folder-item.active { background: rgba(110,108,255,.14); color: var(--text); }
.folder-ic { font-size: 15px; }
.folder-badge { margin-left: auto; font-size: 10px; color: var(--cyan); background: rgba(65,214,255,.12); padding: 2px 7px; border-radius: 6px; }

.files-main, .people-main, .clip-main, .admin-main, .search-main {
  grid-column: 1 / -1; display: flex; flex-direction: column; min-height: 0; padding: 18px 22px;
  overflow-y: auto; background: var(--bg);
}
.files-toolbar, .clip-toolbar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px;
}
.breadcrumb { display: flex; align-items: center; gap: 6px; font-size: 13px; }
.crumb { cursor: pointer; color: var(--text-dim); transition: color .15s; }
.crumb:hover { color: var(--text); }
.sep { color: var(--text-faint); }
.files-actions, .clip-actions { display: flex; gap: 8px; }

.files-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 12px; }
.file-tile {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 14px; cursor: pointer; transition: transform .15s, border-color .2s, box-shadow .2s; position: relative;
}
.file-tile:hover { transform: translateY(-2px); border-color: var(--accent); box-shadow: var(--shadow-sm); }
.tile-icon { font-size: 26px; margin-bottom: 8px; }
.tile-name { font-weight: 600; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tile-meta { font-size: 11.5px; color: var(--text-faint); margin-top: 3px; }
.tile-menu { position: absolute; top: 6px; right: 6px; opacity: 0; transition: opacity .15s; }
.file-tile:hover .tile-menu { opacity: 1; }

.empty-state { display: flex; flex-direction: column; align-items: center; gap: 8px; color: var(--text-faint); padding: 30px; text-align: center; }
.es-ic { font-size: 26px; }
.code-chip { font-family: "JetBrains Mono", Consolas, monospace; font-size: 11.5px; background: var(--panel-3); padding: 2px 6px; border-radius: 5px; }

/* ---------- people ---------- */
.people-main {
  grid-column: 1 / -1; display: flex; flex-direction: column; min-height: 0; padding: 22px 26px;
  overflow-y: auto; background: var(--bg); max-width: 1180px; margin: 0 auto; width: 100%;
}
.people-hero {
  display: flex; align-items: center; gap: 14px; margin-bottom: 20px; padding: 18px 20px;
  background: linear-gradient(135deg, rgba(110,108,255,.14), rgba(65,214,255,.06));
  border: 1px solid var(--line); border-radius: var(--radius-lg); position: relative; overflow: hidden;
}
.people-hero::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background-image: linear-gradient(var(--line) 1px, transparent 1px), linear-gradient(90deg, var(--line) 1px, transparent 1px);
  background-size: 34px 34px; mask-image: radial-gradient(circle at 15% 50%, #000 0%, transparent 70%);
}
.people-hero-ic {
  width: 46px; height: 46px; flex: none; border-radius: 14px; background: var(--accent-grad); color: #fff;
  display: flex; align-items: center; justify-content: center; box-shadow: 0 6px 18px rgba(110,108,255,.4);
}
.people-hero h3 { font-size: 18px; font-weight: 800; letter-spacing: -.3px; }
.people-hero p { font-size: 13px; color: var(--text-dim); margin-top: 2px; }
.people-hero .hero-count { margin-left: auto; font-size: 12px; color: var(--text-faint); background: var(--panel-2); border: 1px solid var(--line); padding: 5px 12px; border-radius: 20px; }

.section-title { display: flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 700; margin-bottom: 12px; color: var(--text); }
.section-title svg.ic { width: 16px; height: 16px; color: var(--accent-2); }
.people-section { margin-bottom: 26px; }
.people-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 14px; }
.person-card {
  display: flex; flex-direction: column; gap: 12px; background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 14px; transition: border-color .2s, transform .15s, box-shadow .2s; position: relative;
}
.person-card:hover { border-color: var(--accent); transform: translateY(-2px); box-shadow: var(--shadow-sm); }
.person-top { display: flex; align-items: center; gap: 12px; min-width: 0; }
.person-avatar { position: relative; flex: none; display: inline-flex; }
.person-avatar .dot { position: absolute; bottom: 0; right: 0; }
.person-info { flex: 1; min-width: 0; }
.person-name { font-weight: 700; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.person-status { font-size: 11.5px; color: var(--text-faint); margin-top: 2px; }
.person-actions {
  display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; margin-top: 2px;
  padding-top: 12px; border-top: 1px solid var(--line-soft);
}
.person-action {
  display: flex; flex-direction: column; align-items: center; gap: 5px; padding: 9px 4px;
  border-radius: var(--radius-sm); background: var(--panel-2); color: var(--text-dim);
  transition: background .15s, color .15s, transform .15s;
}
.person-action:hover { background: var(--accent); color: #fff; transform: translateY(-1px); }
.person-action .pa-ic { display: inline-flex; }
.person-action .pa-ic svg.ic { width: 17px; height: 17px; }
.person-action .pa-label { font-size: 10.5px; font-weight: 600; line-height: 1; }

.transfer-list { display: flex; flex-direction: column; gap: 10px; }
.transfer-card { display: flex; gap: 12px; align-items: flex-start; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 13px; }
.transfer-card.pending { border-color: rgba(255,180,84,.4); }
.transfer-card.accepted { border-color: rgba(52,211,153,.4); }
.transfer-card.completed { opacity: .7; }
.file-icon { font-size: 22px; }
.transfer-info { flex: 1; min-width: 0; }
.transfer-title { font-weight: 600; font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.transfer-sub { font-size: 12px; color: var(--text-faint); margin-top: 2px; }
.transfer-actions { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }

/* ---------- clipboard ---------- */
.clip-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px; }
.clip-card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 13px; display: flex; flex-direction: column; gap: 8px; }
.clip-kind { font-size: 10px; font-weight: 800; letter-spacing: .6px; text-transform: uppercase; color: var(--cyan); }
.clip-content { font-size: 13px; color: var(--text-dim); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.clip-img { max-height: 180px; object-fit: cover; border-radius: 8px; width: 100%; }
.clip-actions { display: flex; gap: 4px; align-items: center; }

/* ---------- admin ---------- */
.admin-tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 16px; }
.admin-tab {
  display: inline-flex; align-items: center; gap: 7px; padding: 8px 14px; border-radius: var(--radius-sm);
  font-size: 13px; font-weight: 600; color: var(--text-dim); background: var(--panel-2); border: 1px solid var(--line);
  transition: all .15s;
}
.admin-tab svg.ic { width: 15px; height: 15px; }
.admin-tab.active { color: #fff; background: var(--accent-grad); border-color: transparent; box-shadow: 0 4px 14px rgba(110,108,255,.35); }
.admin-content { flex: 1; min-height: 0; overflow-y: auto; }

.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; margin-bottom: 18px; }
.stat-card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
.stat-val { font-size: 26px; font-weight: 800; letter-spacing: -.5px; }
.stat-lbl { font-size: 12px; color: var(--text-faint); margin-top: 2px; }

.data-table { width: 100%; border-collapse: collapse; background: var(--panel); border-radius: var(--radius); overflow: hidden; }
.data-table th, .data-table td { text-align: left; padding: 10px 14px; font-size: 13px; border-bottom: 1px solid var(--line-soft); }
.data-table th { color: var(--text-faint); font-size: 11.5px; text-transform: uppercase; letter-spacing: .5px; background: var(--panel-2); }
.data-table tr:hover td { background: var(--panel-2); }

.log-box { background: var(--bg-2); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; font-family: "JetBrains Mono", Consolas, monospace; font-size: 12px; overflow: auto; max-height: 60vh; }
.log-line { color: var(--text-dim); line-height: 1.6; white-space: pre-wrap; }

/* ---------- search ---------- */
.result-item { display: flex; gap: 11px; align-items: center; padding: 11px; border-radius: var(--radius); cursor: pointer; transition: background .15s; }
.result-item:hover { background: var(--panel-2); }
.res-ic { width: 38px; height: 38px; border-radius: 10px; background: var(--panel-2); display: flex; align-items: center; justify-content: center; }
.res-title { font-weight: 600; font-size: 13.5px; }
.res-sub { font-size: 12.5px; color: var(--text-faint); margin-top: 1px; }

/* ---------- dropdown / notif ---------- */
.dropdown {
  position: absolute; top: 52px; right: 16px; width: 340px; max-height: 460px; overflow-y: auto;
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow);
  z-index: 60; padding: 8px; animation: dropIn .2s ease;
}
@keyframes dropIn { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }
.notif-item { display: flex; gap: 10px; padding: 10px; border-radius: var(--radius-sm); cursor: pointer; transition: background .15s; }
.notif-item:hover { background: var(--panel-2); }
.notif-ic { width: 34px; height: 34px; border-radius: 10px; background: var(--panel-2); display: flex; align-items: center; justify-content: center; color: var(--accent-2); }
.notif-title { font-weight: 600; font-size: 13px; }
.notif-sub { font-size: 12px; color: var(--text-dim); }
.notif-time { font-size: 11px; color: var(--text-faint); flex: none; }
.notif-empty { text-align: center; color: var(--text-faint); padding: 22px; }

/* ---------- drawer ---------- */
.drawer {
  position: absolute; top: 0; right: 0; bottom: 0; width: 360px; max-width: 90vw; z-index: 50;
  background: var(--panel); border-left: 1px solid var(--line); box-shadow: var(--shadow);
  display: flex; flex-direction: column; animation: slideIn .25s ease;
}
@keyframes slideIn { from { transform: translateX(100%); } to { transform: none; } }
.drawer-header { display: flex; align-items: center; justify-content: space-between; padding: 14px 16px; border-bottom: 1px solid var(--line); font-weight: 700; }
.drawer-body { flex: 1; overflow-y: auto; padding: 14px; }

/* ---------- modal ---------- */
.modal-backdrop {
  position: fixed; inset: 0; z-index: 90; background: rgba(5,6,12,.6); backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center; padding: 20px; animation: fadeIn .2s;
}
.modal {
  width: 460px; max-width: 100%; max-height: 86vh; overflow-y: auto;
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius-lg); box-shadow: var(--shadow);
  animation: pop .25s cubic-bezier(.2,.9,.3,1.2);
}
@keyframes pop { from { opacity: 0; transform: scale(.94) translateY(8px); } to { opacity: 1; transform: none; } }
.modal-header { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px; border-bottom: 1px solid var(--line-soft); font-weight: 700; font-size: 15px; }
.modal-body { padding: 18px 20px; display: flex; flex-direction: column; gap: 12px; }
.modal-footer { padding: 14px 20px; border-top: 1px solid var(--line-soft); display: flex; justify-content: flex-end; gap: 8px; }

/* ---------- context menu / emoji picker ---------- */
.context-menu, .emoji-picker {
  position: fixed; z-index: 95; background: var(--panel-3); border: 1px solid var(--line); border-radius: var(--radius-sm);
  box-shadow: var(--shadow); padding: 5px; min-width: 150px; animation: pop .15s ease;
}
.context-menu button { display: flex; align-items: center; gap: 8px; width: 100%; padding: 8px 10px; border-radius: 7px; font-size: 13px; color: var(--text); text-align: left; }
.context-menu button:hover { background: var(--accent); color: #fff; }
.context-menu button.danger:hover { background: var(--red); }
.emoji-picker { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; padding: 8px; font-size: 18px; }
.emoji-picker span { cursor: pointer; text-align: center; padding: 3px; border-radius: 6px; }
.emoji-picker span:hover { background: var(--panel-2); }

/* ---------- toasts ---------- */
#toasts { position: fixed; bottom: 18px; right: 18px; z-index: 120; display: flex; flex-direction: column; gap: 8px; max-width: 360px; }
.toast {
  display: flex; gap: 11px; align-items: flex-start; background: var(--panel-3); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 12px 14px; box-shadow: var(--shadow); animation: toastIn .3s ease;
}
.toast.urgent { border-color: var(--orange); }
@keyframes toastIn { from { opacity: 0; transform: translateX(20px); } to { opacity: 1; transform: none; } }
.toast-ic { width: 30px; height: 30px; border-radius: 9px; background: var(--accent-grad); display: flex; align-items: center; justify-content: center; color: #fff; }
.toast-title { font-weight: 600; font-size: 13.5px; }
.toast-sub { font-size: 12.5px; color: var(--text-dim); margin-top: 1px; }
.toast-actions { display: flex; gap: 6px; margin-top: 8px; }
.toast-bar { height: 3px; background: rgba(255,255,255,.15); border-radius: 3px; margin-top: 8px; overflow: hidden; }
.toast-bar div { height: 100%; background: var(--accent); }

/* ---------- calls ---------- */
.call-overlay {
  position: fixed; inset: 0; z-index: 100; background: rgba(5,6,12,.88); backdrop-filter: blur(8px);
  display: flex; flex-direction: column;
}
.call-top { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px; }
.call-status { font-weight: 700; font-size: 16px; }
.call-videos { flex: 1; display: flex; flex-direction: column; gap: 12px; align-items: center; justify-content: center; padding: 10px 20px; }
.call-video { max-width: 100%; max-height: 60vh; border-radius: var(--radius); background: #000; }
.call-video.local { width: 200px; height: 150px; object-fit: cover; position: fixed; bottom: 110px; right: 20px; z-index: 2; border: 2px solid var(--accent); border-radius: 14px; }
.call-videos-grid { display: flex; flex-wrap: wrap; gap: 12px; justify-content: center; }
.call-videos-grid video { max-width: 42vw; max-height: 55vh; border-radius: var(--radius); background: #000; }
.call-controls { display: flex; justify-content: center; gap: 14px; padding: 18px; }
.call-btn {
  width: 54px; height: 54px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
  background: var(--panel-2); color: var(--text); border: 1px solid var(--line); transition: all .2s;
}
.call-btn svg.ic { width: 22px; height: 22px; }
.call-btn:hover { transform: scale(1.06); }
.call-btn.off { background: rgba(242,84,107,.2); color: var(--red); }
.call-btn.danger { background: var(--red); color: #fff; border: none; }
.call-btn.danger:hover { background: #d93a52; }
.call-btn.success { background: var(--green); color: #fff; border: none; }
.call-btn.big { width: auto; border-radius: 30px; padding: 0 22px; gap: 8px; font-weight: 700; }

.call-incoming {
  position: fixed; inset: 0; z-index: 105; display: flex; align-items: center; justify-content: center;
  background: rgba(5,6,12,.82); backdrop-filter: blur(10px);
}
.incoming-card { text-align: center; display: flex; flex-direction: column; align-items: center; gap: 10px; }
.incoming-avatar { width: 96px; height: 96px; border-radius: 50%; background: var(--accent-grad); display: flex; align-items: center; justify-content: center; color: #fff; font-size: 38px; margin-bottom: 6px; animation: pulse 1.6s infinite; }
.incoming-name { font-size: 22px; font-weight: 800; }
.incoming-type { color: var(--text-dim); }
.incoming-actions { display: flex; gap: 18px; margin-top: 16px; }

/* ---------- misc ---------- */
.dropzone-inline { transition: border-color .2s; }
.dropzone-inline:hover { border-color: var(--accent) !important; color: var(--text); }

/* ---------- components (appendix) ---------- */
.logo-mark svg.ic { width: 26px; height: 26px; }
.logo-mark.small svg.ic { width: 16px; height: 16px; }

.empty-art svg.ic { width: 34px; height: 34px; color: var(--accent-2); }
.es-ic svg.ic, .es-ic { width: 26px; height: 26px; }
.spin { animation: rot 1.1s linear infinite; }
@keyframes rot { to { transform: rotate(360deg); } }

.chat-avatar { position: relative; flex: none; display: inline-flex; }
.chat-avatar .dot { position: absolute; bottom: 0; right: 0; }
.thread-title { flex: 1; min-width: 0; }
.thread-title h3 { font-size: 15px; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.members-line { font-size: 12px; color: var(--text-dim); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.detail-card { background: var(--panel-2); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; margin-bottom: 12px; }
.detail-card h4 { font-size: 12px; text-transform: uppercase; letter-spacing: .5px; color: var(--text-faint); margin-bottom: 8px; }
.detail-member { display: flex; align-items: center; gap: 10px; padding: 6px 0; }

.file-card { display: flex; align-items: center; gap: 11px; }
.file-card .file-icon { font-size: 20px; display: inline-flex; color: var(--accent-2); }
.file-card .file-icon svg.ic { width: 22px; height: 22px; }
.file-info { flex: 1; min-width: 0; }
.file-name { font-weight: 600; font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-size { font-size: 12px; color: var(--text-faint); }
.file-actions { display: flex; gap: 2px; }

.person-avatar { display: inline-flex; }
.folder-ic { display: inline-flex; color: var(--accent-2); }
.folder-ic svg.ic { width: 18px; height: 18px; }
.tile-icon { display: inline-flex; }
.tile-icon svg.ic { width: 30px; height: 30px; color: var(--accent-2); }
.file-icon { display: inline-flex; }
.file-icon svg.ic { width: 24px; height: 24px; }

.role-pill { font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 8px; text-transform: uppercase; letter-spacing: .4px; }
.role-pill.admin { background: rgba(110,108,255,.2); color: var(--accent-2); }
.role-pill.member { background: var(--panel-3); color: var(--text-dim); }

.stat-card svg.ic { width: 22px; height: 22px; color: var(--accent-2); }
.stat-sub { font-size: 11px; color: var(--text-faint); margin-top: 2px; }

.msg .m-avatar .ava { font-size: inherit; }
.log-view { background: var(--bg-2); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; font-family: "JetBrains Mono", Consolas, monospace; font-size: 12px; overflow: auto; max-height: 60vh; }

.call-btn svg.ic { width: 22px; height: 22px; }
.call-btn.big svg.ic { width: 18px; height: 18px; }
.incoming-avatar .ava { width: 96px !important; height: 96px !important; font-size: 38px !important; box-shadow: 0 0 0 4px var(--accent), 0 10px 40px rgba(110,108,255,.4); }

.msg-urgent .msg-bubble { border-color: var(--orange); }

.details-body { display: flex; flex-direction: column; gap: 8px; }
.search-results { display: flex; flex-direction: column; gap: 4px; }
.res-ic { color: var(--accent-2); }

.toast-body { flex: 1; min-width: 0; }
.toast-actions { display: flex; gap: 6px; margin-top: 8px; }
.toast-actions .btn { white-space: nowrap; }

.perm-select option { background: var(--panel); }

/* responsive: narrow screens collapse to single column */
@media (max-width: 900px) {
  .view { grid-template-columns: 1fr; }
  .details-panel, .chats-panel { display: none; }
  .msg { max-width: 92%; }
}
@media (max-width: 640px) {
  .rail { width: 52px; }
  .topbar { padding: 0 10px; gap: 8px; }
  .topbar-search { display: none; }
}

/* ============================================================
   Glassmorphism + fondo ambiental
   ============================================================ */
.glass {
  background: rgba(17, 19, 31, 0.62);
  backdrop-filter: blur(18px) saturate(1.5);
  -webkit-backdrop-filter: blur(18px) saturate(1.5);
}
[data-theme="light"] .glass {
  background: rgba(255, 255, 255, 0.72);
}

.ambient {
  position: fixed; inset: 0; z-index: 0;
  pointer-events: none; overflow: hidden;
}
.ambient-orb {
  position: absolute; border-radius: 50%;
  filter: blur(90px); will-change: transform;
}
.orb-1 {
  width: 520px; height: 520px; top: -160px; left: -140px;
  background: radial-gradient(circle, rgba(110,108,255,.35), transparent 65%);
  animation: orbFloat 26s ease-in-out infinite alternate;
}
.orb-2 {
  width: 460px; height: 460px; bottom: -180px; right: -120px;
  background: radial-gradient(circle, rgba(65,214,255,.22), transparent 65%);
  animation: orbFloat 32s ease-in-out infinite alternate-reverse;
}
.orb-3 {
  width: 360px; height: 360px; top: 34%; left: 52%;
  background: radial-gradient(circle, rgba(255,107,181,.16), transparent 65%);
  animation: orbFloat 40s ease-in-out infinite alternate;
}
@keyframes orbFloat {
  from { transform: translate3d(0, 0, 0) scale(1); }
  to { transform: translate3d(40px, -30px, 0) scale(1.12); }
}
.ambient-grid {
  position: absolute; inset: 0;
  background-image:
    linear-gradient(var(--line) 1px, transparent 1px),
    linear-gradient(90deg, var(--line) 1px, transparent 1px);
  background-size: 48px 48px;
  -webkit-mask-image: radial-gradient(circle at 50% 35%, #000 0%, transparent 72%);
  mask-image: radial-gradient(circle at 50% 35%, #000 0%, transparent 72%);
  opacity: .45;
}
.ambient-noise {
  position: absolute; inset: 0; opacity: .04; mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='3'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

.app { z-index: 1; }

.kbd-hint {
  flex: none; font-family: "JetBrains Mono", Consolas, monospace; font-size: 10.5px;
  color: var(--text-faint); background: var(--panel-3);
  border: 1px solid var(--line); border-radius: 6px; padding: 2px 6px;
}

/* ============================================================
   Admin dashboard (gráficos SVG reales)
   ============================================================ */
.dash-hero {
  display: grid; grid-template-columns: 1fr minmax(260px, 320px);
  gap: 14px; margin-bottom: 16px;
}
.dash-hero-main {
  display: flex; flex-direction: column; gap: 16px;
  background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius-lg); padding: 18px 20px;
}
.dash-hero-title h2 { font-size: 19px; font-weight: 800; letter-spacing: -.3px; }
.dash-hero-sub { font-size: 12.5px; color: var(--text-dim); margin-top: 3px; }
.dash-hero-metrics {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px;
}
.hero-metric {
  display: flex; gap: 11px; align-items: center;
  background: var(--panel-2); border: 1px solid var(--line-soft);
  border-radius: var(--radius); padding: 12px;
}
.hero-metric-icon {
  width: 40px; height: 40px; flex: none; border-radius: 12px;
  background: var(--panel-3); display: flex; align-items: center; justify-content: center;
}
.hero-metric-icon svg.ic { width: 20px; height: 20px; }
.hero-metric-body { min-width: 0; }
.hero-metric-val { font-size: 21px; font-weight: 800; letter-spacing: -.4px; line-height: 1.1; }
.hero-metric-lbl { font-size: 12px; color: var(--text-dim); margin-top: 1px; }
.hero-metric-sub { font-size: 11px; color: var(--text-faint); margin-top: 2px; }
.dash-hero-spark {
  display: flex; flex-direction: column; justify-content: center; gap: 8px;
  background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius-lg); padding: 18px;
}
.spark-cap { font-size: 13px; font-weight: 700; }
.spark-foot { font-size: 11px; color: var(--text-faint); }
.chart-spark { width: 100%; height: auto; }

.dash-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 14px; margin-bottom: 16px;
}
.chart-card {
  display: flex; flex-direction: column; gap: 12px;
  background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 16px;
}
.chart-card.wide { grid-column: 1 / -1; }
.chart-card-head { display: flex; align-items: center; justify-content: space-between; }
.chart-card-head h4 { font-size: 13.5px; font-weight: 700; }
.chip-dot {
  width: 28px; height: 28px; border-radius: 9px; color: var(--accent-2);
  background: var(--panel-2); display: flex; align-items: center; justify-content: center;
}
.chip-dot svg.ic { width: 14px; height: 14px; }
.chart-card-body { display: flex; gap: 14px; align-items: center; }
.donut-wrap, .gauge-wrap { justify-content: space-between; }
.donut-legend, .gauge-legend { flex: 1; display: flex; flex-direction: column; gap: 8px; }
.legend-row { display: flex; justify-content: space-between; gap: 8px; font-size: 12.5px; }
.legend-val { font-weight: 700; }

.chart-donut, .chart-gauge { flex: none; }
.donut-fill { transition: stroke-dashoffset 1.1s cubic-bezier(.2,.8,.2,1); }
.donut-label { fill: var(--text); font-family: inherit; font-size: 19px; font-weight: 800; }
.gauge-fill { transition: stroke-dasharray 1.1s ease; }
.gauge-needle { transition: all 1.1s cubic-bezier(.2,.8,.2,1); }
.gauge-label { fill: var(--text); font-family: inherit; font-size: 17px; font-weight: 800; }
.chart-bars { width: 100%; height: auto; }
.bar-rect { fill: var(--accent); transition: height .9s cubic-bezier(.2,.8,.2,1), y .9s cubic-bezier(.2,.8,.2,1); }
.bar-ghost { fill: var(--panel-3); }
.bar-label { fill: var(--text-faint); font-family: inherit; font-size: 11px; }
.chart-spark { width: 100%; height: auto; }
.spark-area { }
.spark-line { fill: none; stroke-linecap: round; }

.dash-table h4 { font-size: 14px; font-weight: 700; margin-bottom: 10px; }

.table-head-row { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.table-head-row h4 { margin-bottom: 0; }

.net-lines { flex-direction: column; align-items: stretch; gap: 8px; width: 100%; }
.net-line { display: flex; align-items: center; gap: 9px; background: var(--panel-2); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 9px 12px; }
.net-label { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--text-dim); min-width: 60px; }
.net-label svg.ic { width: 15px; height: 15px; }
.net-val { margin-left: auto; font-size: 13px; font-weight: 800; font-variant-numeric: tabular-nums; }

.server-hero .hero-metric-val { font-variant-numeric: tabular-nums; }

.system-main { padding: 22px 26px; max-width: 1180px; width: 100%; margin: 0 auto; }

.workspace-bar { display: flex; gap: 6px; padding: 8px 12px; border-bottom: 1px solid var(--line-soft); flex-wrap: wrap; align-items: center; }
.ws-chip { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 600; color: var(--text-dim); background: var(--panel-3); border: 1px solid var(--line); border-radius: 14px; padding: 4px 10px; cursor: pointer; transition: all .15s; white-space: nowrap; }
.ws-chip:hover { background: var(--panel-2); color: var(--text); }
.ws-chip.active { background: var(--accent); color: #fff; border-color: var(--accent); }
.ws-chip.ws-add { padding: 4px 8px; }
.ws-chip.ws-add svg.ic { width: 13px; height: 13px; }

.palette-results { display: flex; flex-direction: column; gap: 2px; max-height: 320px; overflow-y: auto; margin-top: 8px; }
.palette-item { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: var(--radius-sm); cursor: pointer; font-size: 13.5px; transition: background .12s; }
.palette-item:hover, .palette-item:focus { background: var(--panel-3); }
.palette-ic { color: var(--text-dim); display: inline-flex; }
.palette-ic svg.ic { width: 15px; height: 15px; }

.reports-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.report-days { display: flex; gap: 6px; }
.report-section { margin-bottom: 22px; }
.report-daily { display: flex; align-items: flex-end; gap: 4px; height: 88px; padding: 8px 0; }
.daily-col { display: flex; flex-direction: column; align-items: center; gap: 4px; flex: 1; min-width: 0; }
.daily-bar { width: 100%; max-width: 26px; background: var(--accent); border-radius: 4px 4px 0 0; opacity: .85; }
.daily-day { font-size: 10px; color: var(--text-dim); }
.data-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.data-table th { text-align: left; padding: 8px 10px; color: var(--text-dim); font-weight: 600; border-bottom: 1px solid var(--line); }
.data-table td { padding: 8px 10px; border-bottom: 1px solid var(--line-soft); }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; }
.dot-on { background: #22c55e; }
.dot-off { background: var(--text-dim); opacity: .4; }
.stat-card { background: var(--panel-2); border: 1px solid var(--line); border-radius: var(--radius-md); padding: 16px; display: flex; flex-direction: column; gap: 4px; }
.stat-ic { color: var(--accent); margin-bottom: 6px; }

.pill {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 11px; font-weight: 700; padding: 2px 9px; border-radius: 20px;
  white-space: nowrap;
}
.pill.ok { background: rgba(52, 211, 153, .14); color: var(--green); }
.pill.warn { background: rgba(255, 180, 84, .14); color: var(--orange); }
.pill.danger { background: rgba(242, 84, 107, .16); color: var(--red); }

.admin-form-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.select-dark {
  background: var(--panel-3); color: var(--text); border: 1px solid var(--line);
  border-radius: var(--radius-sm); padding: 8px 12px; font-size: 13px; font-family: inherit;
  outline: none; cursor: pointer;
}
.select-dark:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(110,108,255,.18); }

/* ============================================================
   Reaction picker (iconos SVG)
   ============================================================ */
.reaction-picker {
  position: fixed; z-index: 96;
  display: flex; gap: 3px; padding: 6px;
  background: var(--panel-3); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow);
  animation: pop .15s ease;
}
.reaction-opt {
  width: 34px; height: 34px; border-radius: 9px;
  display: flex; align-items: center; justify-content: center;
  color: var(--text-dim); transition: background .15s, color .15s, transform .15s;
}
.reaction-opt:hover { background: var(--accent); color: #fff; transform: translateY(-2px); }
.reaction-opt svg.ic { width: 18px; height: 18px; }

.reaction {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 12px; padding: 2px 8px; border-radius: 10px;
  background: var(--panel-2); border: 1px solid var(--line);
  cursor: pointer; transition: background .15s;
}
.reaction svg.ic { width: 14px; height: 14px; }
.reaction.mine { background: rgba(110,108,255,.2); border-color: var(--accent-2); }
.reaction:hover { background: var(--panel-3); }

.read-tick { display: inline-flex; align-items: center; }
.read-tick svg.ic { width: 15px; height: 15px; }
.msg-edited { font-style: italic; }

.pinned-bar { padding: 6px 16px; border-bottom: 1px solid var(--line-soft); background: var(--panel-2); display: flex; align-items: center; gap: 8px; overflow-x: auto; }
.pinned-row { display: flex; align-items: center; gap: 6px; white-space: nowrap; }
.pinned-count { font-size: 11px; color: var(--text-dim); font-weight: 700; }
.pinned-chip { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; color: var(--accent-2); background: rgba(110,108,255,.1); border: 1px solid rgba(110,108,255,.25); border-radius: 12px; padding: 3px 9px; cursor: pointer; transition: background .15s; }
.pinned-chip:hover { background: rgba(110,108,255,.22); }
.pinned-chip svg.ic { width: 12px; height: 12px; }
.msg-pinned-badge { display: inline-flex; align-items: center; gap: 3px; color: var(--accent-2); font-size: 11px; }
.msg-pinned-badge svg.ic { width: 12px; height: 12px; }
.msg.pinned { box-shadow: inset 2px 0 0 var(--accent); }

.mention { color: var(--accent-2); font-weight: 700; background: rgba(110,108,255,.12); border-radius: 6px; padding: 0 3px; }
.mention.me { color: #fff; background: var(--accent); }

.msg.me .msg-meta { color: rgba(255,255,255,.75); }
.msg.me .read-tick { color: rgba(255,255,255,.85); }
.msg.me .msg-edited { color: rgba(255,255,255,.7); }

.notif-body { min-width: 0; }
.folder-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }

.toast-ic svg.ic { width: 16px; height: 16px; }

.share-url-box { display: flex; gap: 8px; align-items: center; }
.share-url-box .input-dark { flex: 1; }

.transfer-card.rejected { border-color: rgba(242,84,107,.4); }
.transfer-card.cancelled { opacity: .65; }
.transfer-card.failed { border-color: rgba(242,84,107,.55); }

@media (max-width: 1100px) {
  .dash-hero { grid-template-columns: 1fr; }
}
@media (max-width: 900px) {
  .view { grid-template-columns: 1fr; }
  .files-main, .people-main, .clip-main, .admin-main, .search-main { grid-column: 1; }
}

/* ============================================================
   SYSTEM DASHBOARD — Responsive Grid & Advanced Charts
   ============================================================ */

.sys-dashboard {
  display: grid;
  grid-template-rows: auto 1fr;
  height: 100%;
  overflow: auto;
  padding: 20px 24px;
  gap: 20px;
}

.sys-header {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line-soft);
}

.sys-header-main {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.sys-title {
  font-size: 22px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
}

.sys-live {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 600;
  color: var(--green);
  padding: 4px 10px;
  background: rgba(52, 211, 153, .12);
  border-radius: 20px;
}

.sys-live svg.ic {
  animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: .4; }
}

.sys-header-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  font-size: 12.5px;
  color: var(--text-dim);
}

.sys-meta {
  display: flex;
  align-items: center;
  gap: 6px;
}

.sys-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 16px;
  overflow: visible;
}

.sys-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  min-height: 280px;
  transition: box-shadow .2s, border-color .2s;
}

.sys-card:hover {
  box-shadow: var(--shadow-sm);
  border-color: rgba(148, 163, 255, .18);
}

.sys-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--line-soft);
  background: var(--panel-2);
}

.sys-card-head h2 {
  font-size: 14.5px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text);
}

.sys-card-val {
  font-size: 16px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--accent);
}

.sys-card-body {
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  flex: 1;
}

.chart-wrap {
  height: 90px;
  width: 100%;
  min-width: 0;
}

.chart-wrap.dual {
  height: 100px;
}

.gauge-wrap, .donut-wrap {
  display: flex;
  justify-content: center;
  align-items: center;
}

.gauge-svg, .donut-svg {
  flex: none;
}

.gauge-text, .donut-text {
  font-family: "Inter", sans-serif;
}

.sys-legend {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-top: 4px;
}

.legend-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-size: 12.5px;
  padding: 2px 0;
}

.legend-label {
  color: var(--text-dim);
}

.legend-val {
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--text);
}

.net-metrics {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.net-metric {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  transition: border-color .2s;
}

.net-metric:hover {
  border-color: var(--accent);
}

.net-metric-icon {
  flex: none;
}

.net-metric-label {
  font-size: 11.5px;
  color: var(--text-dim);
  flex: 1;
  text-align: left;
}

.net-metric-val {
  font-size: 12.5px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--text);
  text-align: right;
}

.temp-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  margin-bottom: 6px;
  transition: border-color .2s;
}

.temp-row:hover {
  border-color: var(--accent);
}

.temp-name {
  font-size: 12.5px;
  color: var(--text-dim);
  display: flex;
  align-items: center;
  gap: 6px;
}

.temp-val {
  font-size: 13px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.load-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 12px;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  margin-bottom: 6px;
}

.load-label {
  font-size: 12.5px;
  color: var(--text-dim);
  min-width: 50px;
}

.load-bar-wrap {
  flex: 1;
  height: 8px;
  background: var(--panel-3);
  border-radius: 4px;
  overflow: hidden;
}

.load-bar {
  height: 100%;
  border-radius: 4px;
  transition: width .6s ease, background .3s;
}

.load-val {
  font-size: 13px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  min-width: 44px;
  text-align: right;
}

.empty-small {
  padding: 20px;
  text-align: center;
  color: var(--text-faint);
  font-size: 13px;
}

/* Chart SVG styles */
.chart-spark {
  width: 100%;
  height: 100%;
  display: block;
}

.spark-area {
  fill: var(--spark-area-fill, rgba(110,108,255,.12));
}

.spark-line {
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.spark-label {
  font-family: "Inter", sans-serif;
}

.spark-legend circle {
  stroke: none;
}

/* Responsive */
@media (max-width: 1100px) {
  .sys-grid {
    grid-template-columns: 1fr;
  }
  
  .sys-card {
    min-height: auto;
  }
}

@media (max-width: 700px) {
  .sys-dashboard {
    padding: 14px;
    gap: 14px;
  }
  
  .sys-title {
    font-size: 18px;
  }
  
  .net-metrics {
    grid-template-columns: 1fr;
  }
  
  .chart-wrap {
    height: 80px;
  }
  
  .chart-wrap.dual {
    height: 90px;
  }
}