/* =============================================================================
   CloneTesti Dashboard v3.0 - Professional Stylesheet
   Font Awesome icons, dark theme, Tailwind companion, glassmorphism
   ============================================================================= */

:root {
  --bg:      #0a0d14;
  --bg2:     #111620;
  --bg3:     #171d2a;
  --bg4:     #1e2536;
  --border:  #262d3d;
  --border2: #313a4f;
  --text:    #e6edf3;
  --text2:   #8b949e;
  --text3:   #5c647a;
  --accent:  #58a6ff;
  --accent2: #79b8ff;
  --green:   #3fb950;
  --red:     #f85149;
  --orange:  #d29922;
  --purple:  #bc8cff;
  --cyan:    #39d2c0;
  --glow:    0 0 20px rgba(88,166,255,0.08);
  --shadow:  0 2px 12px rgba(0,0,0,0.25);
  --shadow2: 0 8px 32px rgba(0,0,0,0.4);
  --radius:  10px;
  --radius-lg: 14px;
  --transition: 0.2s cubic-bezier(.4,0,.2,1);
}

* { margin: 0; padding: 0; box-sizing: border-box; }
body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Scrollbar */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 6px; transition: background 0.2s; }
::-webkit-scrollbar-thumb:hover { background: var(--border2); }
::-webkit-scrollbar-track { background: transparent; }

/* Selection */
::selection { background: rgba(88,166,255,0.25); color: var(--text); }

/* ── Sidebar ──────────────────────────────────────────────────── */
.sidebar-wrap nav a i,
.ico i { width: 18px; text-align: center; font-size: 14px; }

.sidebar-wrap {
  background: var(--bg2);
  border-right: 1px solid var(--border);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}
.sidebar-wrap nav a {
  position: relative;
  transition: all var(--transition);
}
.sidebar-wrap nav a::before {
  content: '';
  position: absolute;
  left: 0; top: 50%;
  transform: translateY(-50%) scaleY(0);
  width: 3px;
  height: 60%;
  background: var(--accent);
  border-radius: 0 3px 3px 0;
  transition: transform var(--transition);
}
.sidebar-wrap nav a.active::before,
.sidebar-wrap nav a:hover::before {
  transform: translateY(-50%) scaleY(1);
}
.sidebar-wrap nav a .ico {
  transition: transform var(--transition);
}
.sidebar-wrap nav a:hover .ico {
  transform: scale(1.12);
}

/* ── Pages ────────────────────────────────────────────────────── */
.page { display: none; opacity: 0; transform: translateY(6px); }
.page.active {
  display: block;
  animation: pageIn 0.32s ease-out forwards;
}
#page-messages.active {
  padding: 0;
  display: flex;
  flex-direction: column;
  height: calc(100vh);
  animation: pageIn 0.32s ease-out forwards;
}
@keyframes pageIn {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── Toggle Switch ────────────────────────────────────────────── */
.toggle { position: relative; width: 40px; height: 22px; flex-shrink: 0; }
.toggle input { opacity: 0; width: 0; height: 0; }
.slider {
  position: absolute; inset: 0;
  background: var(--border2);
  border-radius: 22px;
  cursor: pointer;
  transition: all 0.3s ease;
}
.slider::before {
  content: "";
  position: absolute;
  height: 16px; width: 16px;
  left: 3px; bottom: 3px;
  background: var(--text2);
  border-radius: 50%;
  transition: all 0.3s cubic-bezier(.68,-0.6,.32,1.6);
  box-shadow: 0 1px 3px rgba(0,0,0,0.3);
}
.toggle input:checked + .slider { background: var(--green); box-shadow: 0 0 12px rgba(63,185,80,0.3); }
.toggle input:checked + .slider::before { transform: translateX(18px); background: #fff; }

/* ── Toast ────────────────────────────────────────────────────── */
@keyframes toastIn {
  from { transform: translateX(110%) scale(0.9); opacity: 0; }
  to   { transform: translateX(0) scale(1); opacity: 1; }
}
.toast-anim {
  animation: toastIn 0.35s cubic-bezier(.21,1.02,.73,1);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid rgba(255,255,255,0.1);
  position: relative;
  overflow: hidden;
}
.toast-anim::after {
  content: '';
  position: absolute;
  bottom: 0; left: 0;
  height: 2px;
  background: rgba(255,255,255,0.4);
  animation: toastTimer var(--toast-dur, 3200ms) linear forwards;
}
@keyframes toastTimer {
  from { width: 100%; }
  to   { width: 0%; }
}

/* ── Modal ────────────────────────────────────────────────────── */
@keyframes mIn {
  from { transform: scale(0.92) translateY(10px); opacity: 0; }
  to   { transform: scale(1) translateY(0); opacity: 1; }
}
.modal-anim {
  animation: mIn 0.28s cubic-bezier(.21,1.02,.73,1);
  box-shadow: var(--shadow2);
}
.moverlay {
  transition: opacity 0.2s ease;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

/* ── Spinner ──────────────────────────────────────────────────── */
@keyframes sp { to { transform: rotate(360deg); } }
.spin {
  display: inline-block; width: 14px; height: 14px;
  border: 2px solid rgba(255,255,255,0.2);
  border-top-color: currentColor;
  border-radius: 50%;
  animation: sp 0.65s linear infinite;
}

/* ── Skeleton loading ─────────────────────────────────────────── */
@keyframes shimmer {
  0%   { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}
.skeleton {
  background: linear-gradient(90deg, var(--bg3) 25%, var(--bg4) 50%, var(--bg3) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s ease-in-out infinite;
  border-radius: 6px;
}

/* ── Buttons ──────────────────────────────────────────────────── */
.btn {
  padding: 7px 14px;
  border: none;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
  line-height: 1.4;
  position: relative;
  overflow: hidden;
  user-select: none;
}
.btn::after {
  content: '';
  position: absolute; inset: 0;
  background: radial-gradient(circle at var(--x, 50%) var(--y, 50%), rgba(255,255,255,0.15), transparent 60%);
  opacity: 0;
  transition: opacity 0.3s;
}
.btn:hover::after { opacity: 1; }
.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.4; cursor: not-allowed; transform: none; }
.btn:disabled::after { display: none; }
.btn i { font-size: 12px; }
.btn-primary { background: var(--accent); color: #000; }
.btn-primary:hover:not(:disabled) { box-shadow: 0 0 16px rgba(88,166,255,0.35); }
.btn-success { background: var(--green); color: #000; }
.btn-success:hover:not(:disabled) { box-shadow: 0 0 16px rgba(63,185,80,0.35); }
.btn-danger { background: var(--red); color: #fff; }
.btn-danger:hover:not(:disabled) { box-shadow: 0 0 16px rgba(248,81,73,0.35); }
.btn-warn { background: var(--orange); color: #000; }
.btn-warn:hover:not(:disabled) { box-shadow: 0 0 16px rgba(210,153,34,0.35); }
.btn-out {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text2);
}
.btn-out:hover:not(:disabled) { border-color: var(--accent); color: var(--accent); background: rgba(88,166,255,0.06); }
.btn-ghost { background: transparent; color: var(--text2); padding: 6px 9px; }
.btn-ghost:hover { background: rgba(255,255,255,0.06); color: var(--text); }
.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn-xs { padding: 3px 8px; font-size: 11px; border-radius: 6px; }

/* ── Badges ───────────────────────────────────────────────────── */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 8px; border-radius: 20px;
  font-size: 11px; font-weight: 600;
  white-space: nowrap;
  letter-spacing: 0.01em;
}
.bg { background: rgba(63,185,80,0.12); color: var(--green); border: 1px solid rgba(63,185,80,0.2); }
.br { background: rgba(248,81,73,0.12); color: var(--red); border: 1px solid rgba(248,81,73,0.2); }
.bb { background: rgba(88,166,255,0.12); color: var(--accent); border: 1px solid rgba(88,166,255,0.2); }
.bo { background: rgba(210,153,34,0.12); color: var(--orange); border: 1px solid rgba(210,153,34,0.2); }
.bp { background: rgba(188,140,255,0.12); color: var(--purple); border: 1px solid rgba(188,140,255,0.2); }
.bc { background: rgba(57,210,192,0.12); color: var(--cyan); border: 1px solid rgba(57,210,192,0.2); }
.bx { background: rgba(139,148,158,0.08); color: var(--text2); border: 1px solid rgba(139,148,158,0.15); }

/* ── Status Dots ──────────────────────────────────────────────── */
.dot {
  width: 8px; height: 8px; border-radius: 50%;
  display: inline-block; flex-shrink: 0; vertical-align: middle;
}
.dot-g { background: var(--green); box-shadow: 0 0 6px rgba(63,185,80,0.5); }
.dot-r { background: var(--red); box-shadow: 0 0 6px rgba(248,81,73,0.5); }
@keyframes pulse-dot {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}
.dot-pulse { animation: pulse-dot 2s ease-in-out infinite; }

/* ── Tables ───────────────────────────────────────────────────── */
table { border-collapse: collapse; width: 100%; }
th { white-space: nowrap; font-weight: 600; }
td { padding: 10px 12px; border-bottom: 1px solid var(--border); font-size: 13px; transition: background 0.15s; }
tr:last-child td { border-bottom: none; }
tr:hover td { background: rgba(88,166,255,0.03); }
thead tr:hover td { background: transparent; }

/* ── Alert Boxes ──────────────────────────────────────────────── */
.ibox {
  background: rgba(88,166,255,0.06);
  border: 1px solid rgba(88,166,255,0.2);
  border-radius: var(--radius);
  padding: 12px 14px;
  font-size: 13px;
  backdrop-filter: blur(4px);
}
.wbox {
  background: rgba(210,153,34,0.06);
  border: 1px solid rgba(210,153,34,0.2);
  border-radius: var(--radius);
  padding: 12px 14px;
  font-size: 13px;
}
.sbox {
  background: rgba(63,185,80,0.06);
  border: 1px solid rgba(63,185,80,0.2);
  border-radius: var(--radius);
  padding: 12px 14px;
  font-size: 13px;
}

/* ── Empty States ─────────────────────────────────────────────── */
.empty {
  text-align: center;
  padding: 40px 20px;
  color: var(--text3);
  font-size: 13px;
}

/* ── Chat Dialogs ─────────────────────────────────────────────── */
.dlg {
  display: flex; align-items: center; gap: 11px;
  padding: 10px 14px; cursor: pointer;
  transition: all 0.15s ease;
  border-left: 3px solid transparent;
}
.dlg:hover { background: rgba(88,166,255,0.04); }
.dlg.active { background: rgba(88,166,255,0.08); border-left-color: var(--accent); }
.dlg-av {
  width: 44px; height: 44px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 16px; font-weight: 700; flex-shrink: 0;
  color: #fff; user-select: none;
  box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}
.dlg-av.av-user { background: linear-gradient(135deg, #2563eb, #3b82f6); }
.dlg-body { flex: 1; min-width: 0; }
.dlg-row1 { display: flex; justify-content: space-between; align-items: center; gap: 4px; }
.dlg-name { font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; flex: 1; }
.dlg-date { font-size: 10px; color: var(--text3); flex-shrink: 0; }
.dlg-row2 { display: flex; justify-content: space-between; align-items: center; gap: 4px; margin-top: 3px; }
.dlg-row3 { margin-top: 2px; }
.dlg-acct-badge {
  display: inline-block; font-size: 10px; color: var(--text3);
  background: var(--bg3, rgba(128,128,128,0.12)); border-radius: 8px;
  padding: 0 6px; line-height: 16px; max-width: 180px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  vertical-align: middle;
}
.dlg-last { font-size: 12px; color: var(--text2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; flex: 1; }
.dlg-last .out-tick { color: var(--accent); font-size: 11px; }
.dlg-badge { display: flex; align-items: center; gap: 3px; flex-shrink: 0; }
.dlg-unread {
  background: var(--accent); color: #fff;
  border-radius: 10px; font-size: 10px;
  padding: 1px 6px; font-weight: 700;
  min-width: 18px; text-align: center;
  box-shadow: 0 0 8px rgba(88,166,255,0.3);
}
.dlg-divider {
  padding: 6px 14px; font-size: 10px; color: var(--text3);
  text-transform: uppercase; letter-spacing: 0.8px; font-weight: 600;
  background: var(--bg2); border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 2;
}

/* ── Messages ─────────────────────────────────────────────────── */
.msg-group { display: flex; flex-direction: column; margin-bottom: 3px; }
.msg-group.out { align-items: flex-end; }
.msg-group.in { align-items: flex-start; }
.msg-wrap { display: flex; align-items: flex-end; gap: 7px; max-width: 72%; }
.msg-group.out .msg-wrap { flex-direction: row-reverse; }
.msg-sender-av {
  width: 28px; height: 28px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 700; flex-shrink: 0;
  background: var(--bg4); color: var(--text2); align-self: flex-end;
}
.msg-bubble {
  padding: 8px 12px 6px;
  border-radius: 14px;
  font-size: 13px; line-height: 1.55;
  word-break: break-word;
  position: relative; min-width: 80px;
  transition: background 0.2s;
}
.msg-reply-action {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--bg2);
  color: var(--text2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s, color 0.15s, border-color 0.15s;
}
.msg-group.in .msg-reply-action { right: -34px; }
.msg-group.out .msg-reply-action { left: -34px; }
.msg-bubble:hover .msg-reply-action {
  opacity: 1;
  pointer-events: auto;
}
.msg-reply-action:hover {
  color: var(--accent);
  border-color: var(--accent);
}
@media (hover: none) {
  .msg-reply-action {
    opacity: 1;
    pointer-events: auto;
  }
}
.msg-group.out .msg-bubble {
  background: linear-gradient(135deg, #1a4a72, #1d3d66);
  border-bottom-right-radius: 4px;
}
.msg-group.in .msg-bubble {
  background: var(--bg3);
  border-bottom-left-radius: 4px;
}
.msg-fwd { font-size: 11px; color: var(--cyan); margin-bottom: 3px; font-style: italic; }
.msg-reply-bar {
  background: rgba(88,166,255,0.1);
  border-left: 3px solid var(--accent);
  padding: 5px 9px; border-radius: 5px;
  font-size: 11px; color: var(--text2);
  margin-bottom: 5px; cursor: pointer;
  transition: background 0.15s;
}
.msg-reply-bar:hover { background: rgba(88,166,255,0.18); }
.msg-text { color: var(--text); }
.msg-media {
  display: flex; align-items: center; gap: 6px; margin-top: 3px;
  font-size: 12px; color: var(--text2);
  background: rgba(255,255,255,0.04); padding: 6px 9px; border-radius: 7px;
}
.msg-meta { display: flex; align-items: center; gap: 5px; margin-top: 4px; justify-content: flex-end; }
.msg-time { font-size: 10px; color: var(--text3); }
.msg-edited { font-size: 10px; color: var(--text3); font-style: italic; }
.msg-status { font-size: 11px; color: var(--accent); }
.msg-views { font-size: 10px; color: var(--text3); display: flex; align-items: center; gap: 2px; }
.msg-sender-name { font-size: 11px; font-weight: 700; margin-bottom: 2px; }
.sc0 { color: #e17055; } .sc1 { color: #00b894; } .sc2 { color: #0984e3; }
.sc3 { color: #6c5ce7; } .sc4 { color: #fdcb6e; } .sc5 { color: #e84393; }
.sc6 { color: #55efc4; } .sc7 { color: #fd79a8; }

/* ── Context Menu ─────────────────────────────────────────────── */
.msg-context-menu {
  position: fixed;
  background: var(--bg2);
  border: 1px solid var(--border2);
  border-radius: 10px;
  padding: 4px 0;
  z-index: 9000;
  box-shadow: var(--shadow2);
  min-width: 170px;
  animation: mIn 0.15s cubic-bezier(.21,1.02,.73,1);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}
.ctx-item {
  padding: 9px 16px; font-size: 13px; cursor: pointer;
  display: flex; align-items: center; gap: 10px;
  transition: all 0.12s;
  border-radius: 6px; margin: 2px 4px;
}
.ctx-item:hover { background: rgba(88,166,255,0.1); color: var(--accent); }
.ctx-item.ctx-danger { color: #f85149; }
.ctx-item.ctx-danger:hover { background: rgba(248,81,73,0.12); color: #f85149; }
.ctx-sep { border-top: 1px solid var(--border); margin: 4px 8px; }

/* ── Avatar ───────────────────────────────────────────────────── */
.avt {
  width: 42px; height: 42px; border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--purple));
  display: flex; align-items: center; justify-content: center;
  font-size: 17px; font-weight: 700; flex-shrink: 0; color: #fff;
  box-shadow: 0 2px 10px rgba(88,166,255,0.2);
}

/* ── Privacy Grid ─────────────────────────────────────────────── */
.pgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 11px; }
.pitem {
  background: var(--bg3); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 12px;
  transition: border-color 0.2s;
}
.pitem:hover { border-color: var(--border2); }
.pitem label { font-size: 12px; color: var(--text2); font-weight: 500; }
.pitem select {
  margin-top: 6px; padding: 7px 10px; width: 100%;
  background: var(--bg4); border: 1px solid var(--border);
  border-radius: 7px; color: var(--text); font-size: 13px;
}

/* ── Device Card ──────────────────────────────────────────────── */
.dvc {
  background: var(--bg3); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 13px;
  display: flex; justify-content: space-between; align-items: center;
  gap: 12px; margin-bottom: 9px;
  transition: border-color 0.2s;
}
.dvc:hover { border-color: var(--border2); }
.dvc-info { flex: 1; }
.dvc-name { font-weight: 600; font-size: 13px; }
.dvc-det { font-size: 11px; color: var(--text2); margin-top: 3px; }

/* ── Inputs ───────────────────────────────────────────────────── */
input[type=text], input[type=number], input[type=time], input[type=password], input[type=tel], select, textarea {
  width: 100%; padding: 9px 12px;
  background: var(--bg3); border: 1px solid var(--border);
  border-radius: 8px; color: var(--text);
  font-size: 13px; font-family: inherit;
  transition: all var(--transition);
  min-width: 0;
}
input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(88,166,255,0.1);
}
textarea { min-height: 90px; resize: vertical; }
input::placeholder, textarea::placeholder { color: var(--text3); }

.chat-inp {
  flex: 1; background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 22px; padding: 9px 18px;
  color: var(--text); font-size: 13px;
  font-family: inherit; resize: none;
  max-height: 120px; min-height: 38px;
  line-height: 1.4; overflow-y: auto;
}
.chat-inp:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(88,166,255,0.1); }

/* ── Form Groups ──────────────────────────────────────────────── */
.irow { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; }
.irow .fg { flex: 1; margin: 0; }
.fg { margin-bottom: 14px; }

/* ── Stat Cards ───────────────────────────────────────────────── */
.stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px; margin-bottom: 18px; }
.sc {
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 18px;
  transition: all 0.2s ease;
  position: relative; overflow: hidden;
}
.sc::before {
  content: '';
  position: absolute; top: 0; left: 0; right: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--accent), transparent);
  opacity: 0;
  transition: opacity 0.3s;
}
.sc:hover { border-color: var(--border2); transform: translateY(-1px); }
.sc:hover::before { opacity: 1; }
.sc .lbl { font-size: 10px; color: var(--text3); text-transform: uppercase; letter-spacing: 0.8px; font-weight: 600; }
.sc .val { font-size: 24px; font-weight: 700; margin-top: 6px; line-height: 1; }
.cg { color: var(--green); } .cb { color: var(--accent); } .co { color: var(--orange); } .cp { color: var(--purple); } .cc { color: var(--cyan); } .cr { color: var(--red); }

/* ── Card ─────────────────────────────────────────────────────── */
.card {
  background: var(--bg3); border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: border-color 0.2s;
}
.card:hover { border-color: var(--border2); }

/* ── Section Panels ───────────────────────────────────────────── */
.panel {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: border-color 0.3s;
}
.panel:hover { border-color: var(--border2); }
.panel-hdr {
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  display: flex; justify-content: space-between; align-items: center;
  flex-wrap: wrap; gap: 8px;
}
.panel-hdr h3 { font-size: 14px; font-weight: 600; }
.panel-body { padding: 16px 18px; }

/* ── Utilities ────────────────────────────────────────────────── */
.toolbar { display: flex; gap: 7px; align-items: center; flex-wrap: wrap; }
.fb { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.muted { color: var(--text2); }
.tsm { font-size: 12px; } .txs { font-size: 11px; }
code {
  background: rgba(88,166,255,0.08); padding: 2px 7px;
  border-radius: 5px; font-size: 12px; font-family: 'JetBrains Mono', monospace;
  color: var(--cyan); border: 1px solid rgba(88,166,255,0.1);
}
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media(max-width: 640px) { .grid2 { grid-template-columns: 1fr; } }

/* ── Connection Indicator ─────────────────────────────────────── */
.conn-indicator {
  display: flex; align-items: center; gap: 6px;
  font-size: 11px; padding: 4px 10px;
  border-radius: 20px; font-weight: 500;
}
.conn-indicator.online { color: var(--green); background: rgba(63,185,80,0.1); }
.conn-indicator.offline { color: var(--red); background: rgba(248,81,73,0.1); }

/* ── Pulse animation for live indicator ───────────────────────── */
@keyframes livePulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(63,185,80,0.4); }
  50% { box-shadow: 0 0 0 6px rgba(63,185,80,0); }
}
.live-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--green); display: inline-block;
  animation: livePulse 2s ease-in-out infinite;
}

/* ── Responsive ───────────────────────────────────────────────── */
@media(max-width: 768px) {
  .sb-label, .sb-sectitle, .sb-bottom-text { display: none !important; }
  .sidebar-wrap { width: 56px !important; min-width: 56px !important; }
  .sidebar-wrap .logo-text { display: none !important; }
  .sidebar-wrap nav a { justify-content: center !important; padding-left: 0 !important; padding-right: 0 !important; }
  .sidebar-wrap nav a .ico { margin: 0 !important; }
  .main-wrap { margin-left: 56px !important; }
  .chat-left-panel { display: none; }
  .chat-left-panel.mobile-show { display: flex !important; position: fixed; inset: 0; z-index: 200; width: 100% !important; max-width: 100% !important; }
}
@media(min-width: 769px) { .mobile-back-btn { display: none !important; } }

/* ── Smooth highlight for navigated messages ──────────────────── */
@keyframes highlightMsg {
  0%   { background: rgba(88,166,255,0.2); }
  100% { background: transparent; }
}
.msg-highlight { animation: highlightMsg 1.5s ease-out; }

/* ── Keyboard shortcut hint ───────────────────────────────────── */
.kbd {
  display: inline-block; padding: 1px 5px;
  background: var(--bg4); border: 1px solid var(--border);
  border-radius: 4px; font-size: 10px;
  font-family: 'JetBrains Mono', monospace;
  color: var(--text3); margin-left: 4px;
  line-height: 1.6;
}

/* ── Ripple effect ────────────────────────────────────────────── */
.ripple {
  position: relative; overflow: hidden;
}
.ripple::before {
  content: '';
  position: absolute;
  top: 50%; left: 50%;
  width: 0; height: 0;
  border-radius: 50%;
  background: rgba(255,255,255,0.1);
  transform: translate(-50%, -50%);
  transition: width 0.5s, height 0.5s;
}
.ripple:active::before { width: 200px; height: 200px; }

/* ── Account Tab Buttons ──────────────────────────────────────── */
.atab button {
  padding: 7px 14px; border: none; border-radius: 8px;
  font-size: 12px; font-weight: 500; cursor: pointer;
  background: transparent; color: var(--text2);
  transition: all var(--transition);
}
.atab button:hover { background: rgba(255,255,255,0.06); color: var(--text); }
.atab button.active { background: rgba(88,166,255,0.12); color: var(--accent); }

/* ── Footer / Version ─────────────────────────────────────────── */
.sb-bottom-text { font-family: inherit; }

/* ── Pagination ───────────────────────────────────────────────── */
.pagination-wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  border-top: 1px solid var(--border);
  font-size: 12px;
  color: var(--text2);
  flex-wrap: wrap;
  gap: 8px;
}
.pagination-wrap:empty {
  display: none;
}
.pagination-info {
  display: flex;
  align-items: center;
  gap: 8px;
}
.pagination-info select {
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  font-size: 12px;
  padding: 3px 8px;
  cursor: pointer;
}
.pagination-info select:focus {
  outline: none;
  border-color: var(--accent);
}
.pagination-controls {
  display: flex;
  align-items: center;
  gap: 4px;
}
.pagination-controls button {
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text2);
  font-size: 11px;
  padding: 4px 10px;
  cursor: pointer;
  transition: all var(--transition);
  min-width: 32px;
  text-align: center;
}
.pagination-controls button:hover:not(:disabled) {
  background: var(--bg4);
  color: var(--text);
  border-color: var(--border2);
}
.pagination-controls button:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}
.pagination-controls button.pg-active {
  background: var(--accent);
  color: #000;
  border-color: var(--accent);
  font-weight: 600;
}
.pagination-controls .pg-ellipsis {
  color: var(--text3);
  padding: 4px 6px;
  font-size: 11px;
  user-select: none;
}

/* ── Sent Clones Page ─────────────────────────────────────────── */
.sc-row { transition: opacity var(--transition), background var(--transition); }
.sc-row:hover { background: var(--bg3); }
.sc-row td { vertical-align: middle; }
#sc-tb .btn-sm { padding: 4px 8px; font-size: 11px; }

/* ── 2026 UI polish ────────────────────────────────────────────────────── */
html { background: var(--bg); scroll-behavior: smooth; }
body {
  background:
    radial-gradient(circle at 88% -12%, rgba(88,166,255,.09), transparent 30rem),
    radial-gradient(circle at 30% 110%, rgba(57,210,192,.045), transparent 34rem),
    var(--bg);
}

#app-sidebar {
  background: rgba(17,22,32,.94) !important;
  border-right-color: rgba(88,166,255,.12) !important;
  box-shadow: 12px 0 36px rgba(0,0,0,.16);
  scrollbar-width: thin;
}
#app-sidebar .sidebar-brand {
  min-height: 70px;
  background: linear-gradient(135deg, rgba(88,166,255,.08), transparent 65%);
}
#app-sidebar .nav-section-label {
  margin-top: .35rem;
  color: #697389;
  letter-spacing: .12em;
}
#app-sidebar nav { padding: 0 .55rem; gap: .18rem; }
#app-sidebar nav a {
  min-height: 39px;
  border: 0 !important;
  border-radius: 9px;
  padding-left: .75rem !important;
  padding-right: .75rem !important;
}
#app-sidebar nav a::before {
  left: 0;
  width: 3px;
  height: 52%;
  border-radius: 999px;
}
#app-sidebar nav a:hover { background: rgba(255,255,255,.035) !important; }
#app-sidebar nav a.active {
  color: #f3f7fb !important;
  background: linear-gradient(90deg, rgba(88,166,255,.15), rgba(88,166,255,.055)) !important;
  box-shadow: inset 0 0 0 1px rgba(88,166,255,.10);
}
#app-sidebar nav a.active i { color: var(--accent); }

#app-main {
  width: auto;
  max-width: 1680px;
  padding: clamp(1rem, 2.2vw, 2rem) !important;
}
#app-main > [data-page-panel="true"] { max-width: 1440px; margin-inline: auto; }
#app-main > [data-page-panel="true"] > .flex:first-child h2 {
  letter-spacing: -.025em;
  line-height: 1.2;
}

.panel,
.sc,
#app-main .bg-bg2.border.border-border {
  box-shadow: 0 1px 0 rgba(255,255,255,.025), 0 12px 30px rgba(0,0,0,.10);
}
.panel {
  background: rgba(17,22,32,.82);
  border-color: rgba(49,58,79,.78);
}
.panel-hdr {
  min-height: 55px;
  background: linear-gradient(180deg, rgba(255,255,255,.018), transparent);
}
.card { background: rgba(23,29,42,.78); }
.sc { min-height: 112px; }
.sc .val { letter-spacing: -.035em; }

.btn { min-height: 34px; font-weight: 600; }
.btn-primary,
.btn-success,
.btn-warn { box-shadow: inset 0 1px 0 rgba(255,255,255,.18); }
.btn-out { background: rgba(255,255,255,.015); }

input[type=text], input[type=number], input[type=time], input[type=password],
input[type=tel], select, textarea {
  min-height: 40px;
  background: rgba(10,13,20,.58);
  border-color: var(--border2);
}
input:hover, select:hover, textarea:hover { border-color: #3d4860; }
label { line-height: 1.45; }

.ui-table-scroll { border-radius: 0 0 var(--radius-lg) var(--radius-lg); }
table thead { background: rgba(10,13,20,.38); }
table th { color: var(--text2); font-size: 11px; text-transform: uppercase; letter-spacing: .055em; }
table td { padding-block: 11px; }
tbody tr { transition: background-color .16s ease; }

.badge { min-height: 22px; padding-inline: 9px; }
.empty { padding-block: 54px; }

@media (max-width: 900px) {
  #app-main { padding: 1rem !important; }
  .panel-hdr, .panel-body { padding-left: 14px; padding-right: 14px; }
}

@media (max-width: 640px) {
  #app-sidebar { width: 60px !important; }
  #app-sidebar .sidebar-brand { min-height: 60px; padding: .75rem !important; }
  #app-sidebar nav { padding-inline: .4rem; }
  #app-sidebar nav a { min-height: 42px; padding: 0 !important; }
  #app-sidebar nav a::before { display: none; }
  #app-main { margin-left: 60px !important; padding: .75rem !important; }
  #app-main > [data-page-panel="true"] > .flex:first-child { margin-bottom: 1rem; }
  #app-main > [data-page-panel="true"] > .flex:first-child h2 { font-size: 1.05rem; }
  .panel { border-radius: 11px; }
  .panel-hdr { align-items: flex-start; }
  .panel-body { padding: 13px; }
  .btn { min-height: 38px; }
  .ui-table-actions { min-width: 120px; justify-content: flex-start; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    scroll-behavior: auto !important;
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}
