/* ============================================================
   DARK — Device Management Console
   Theme: Dark / Glass / Mobile-first
   ============================================================ */

:root {
  --bg: #080808;
  --card: #111111;
  --border: #1f1f1f;
  --border-hover: #2a2a2a;
  --text: #ffffff;
  --text-dim: #aaaaaa;
  --text-muted: #555555;
  --red: #dc2626;
  --emerald: #22c55e;
  --purple: #a855f7;
  --amber: #f59e0b;
  --blue: #3b82f6;
  --red-grad: linear-gradient(135deg, #dc2626, #c2410c);
  --radius: 14px;
  --shadow-glow: 0 0 24px rgba(220, 38, 38, 0.35);
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body { height: 100%; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

::-webkit-scrollbar { width: 4px; height: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #333; border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: #444; }

button { font-family: var(--font); cursor: pointer; border: none; background: none; color: inherit; }
input, select, textarea { font-family: var(--font); }
.hidden { display: none !important; }

#app { min-height: 100vh; }

/* ---------- Screens ---------- */
.screen { display: none; min-height: 100vh; }
.screen.active { display: block; animation: fadeIn 0.35s ease; }

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes slideInRight {
  from { transform: translateX(100%); }
  to { transform: translateX(0); }
}
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.35; }
}
@keyframes glint {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

/* ---------- Login screen ---------- */
#screen-login {
  position: relative;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 32px 20px 48px;
  overflow: hidden;
}
#screen-login.active { display: flex; }

.login-glow {
  position: absolute;
  width: 420px; height: 420px;
  border-radius: 50%;
  filter: blur(120px);
  opacity: 0.35;
  pointer-events: none;
}
.login-glow-red { background: #dc2626; top: -140px; right: -140px; }
.login-glow-orange { background: #ea580c; bottom: -140px; left: -140px; }

.login-grid-overlay {
  position: absolute; inset: 0;
  background-image:
    linear-gradient(rgba(255,255,255,0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.035) 1px, transparent 1px);
  background-size: 44px 44px;
  mask-image: radial-gradient(ellipse at center, black 30%, transparent 75%);
  -webkit-mask-image: radial-gradient(ellipse at center, black 30%, transparent 75%);
  pointer-events: none;
}

.login-wrap { position: relative; width: 100%; max-width: 420px; z-index: 2; }

.logo-badge {
  width: 64px; height: 64px;
  margin: 0 auto 18px;
  border-radius: 18px;
  background: var(--red-grad);
  display: flex; align-items: center; justify-content: center;
  color: #fff;
  box-shadow: var(--shadow-glow), 0 0 60px rgba(220,38,38,0.25);
}
.logo-badge svg { width: 32px; height: 32px; }

.login-title {
  text-align: center;
  font-size: 44px;
  font-weight: 900;
  letter-spacing: 6px;
  margin-bottom: 4px;
}
.d-letter {
  background: var(--red-grad);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.glow-dot {
  display: inline-block;
  width: 9px; height: 9px;
  border-radius: 50%;
  background: var(--emerald);
  margin-left: 8px;
  vertical-align: middle;
  box-shadow: 0 0 12px var(--emerald);
  animation: pulse 2s infinite;
}

.login-sub {
  text-align: center;
  color: var(--text-dim);
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.5px;
  margin-bottom: 34px;
}

.login-foot {
  text-align: center;
  color: var(--text-muted);
  font-size: 11px;
  margin-top: 26px;
}

/* ---------- Account list ---------- */
.account-list { display: flex; flex-direction: column; gap: 10px; margin-bottom: 16px; }

.account-card {
  display: flex;
  align-items: center;
  gap: 12px;
  background: rgba(17,17,17,0.75);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  cursor: pointer;
  transition: border-color 0.2s, transform 0.2s, background 0.2s;
  animation: fadeIn 0.3s ease;
}
.account-card:hover { border-color: var(--border-hover); transform: translateY(-1px); }

.account-avatar {
  width: 42px; height: 42px;
  flex-shrink: 0;
  border-radius: 12px;
  background: linear-gradient(135deg, rgba(220,38,38,0.2), rgba(194,65,12,0.2));
  border: 1px solid rgba(220,38,38,0.3);
  display: flex; align-items: center; justify-content: center;
  font-weight: 800;
  font-size: 15px;
  color: #f87171;
}

.account-info { flex: 1; min-width: 0; }
.account-name {
  font-weight: 600;
  font-size: 13.5px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.account-meta {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.account-key {
  display: inline-block;
  font-size: 10px;
  color: var(--text-dim);
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--border);
  padding: 1px 6px;
  border-radius: 6px;
  margin-top: 4px;
  font-family: 'SF Mono', Consolas, monospace;
  letter-spacing: 0.5px;
}

.account-actions { display: flex; gap: 8px; flex-shrink: 0; }
.icon-btn {
  width: 36px; height: 36px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: rgba(255,255,255,0.03);
  display: flex; align-items: center; justify-content: center;
  color: var(--text-dim);
  transition: all 0.2s;
}
.icon-btn svg { width: 17px; height: 17px; }
.icon-btn:hover { border-color: var(--border-hover); color: var(--text); background: rgba(255,255,255,0.06); }
.icon-btn.blue:hover { color: var(--blue); border-color: rgba(59,130,246,0.5); }
.icon-btn.danger:hover { color: var(--red); border-color: rgba(220,38,38,0.5); }

.new-account-btn {
  width: 100%;
  padding: 15px;
  border-radius: var(--radius);
  border: 1.5px dashed var(--border-hover);
  background: transparent;
  color: var(--text-dim);
  font-size: 14px;
  font-weight: 600;
  transition: all 0.2s;
}
.new-account-btn:hover {
  border-color: var(--red);
  color: var(--text);
  background: rgba(220,38,38,0.06);
}

/* ---------- Topbar (screens 2) ---------- */
.screen-topbar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 16px 8px;
  position: sticky;
  top: 0;
  background: rgba(8,8,8,0.8);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  z-index: 20;
}
.topbar-title { font-weight: 700; font-size: 15px; flex: 1; }
.topbar-spacer { width: 36px; }

.form-wrap {
  padding: 16px;
  max-width: 520px;
  margin: 0 auto;
}

/* ---------- APK dropzone ---------- */
.apk-drop {
  border: 1.5px dashed var(--border-hover);
  border-radius: var(--radius);
  padding: 30px 16px;
  text-align: center;
  margin-bottom: 20px;
  transition: all 0.25s;
  background: rgba(255,255,255,0.02);
}
.apk-drop svg { width: 34px; height: 34px; color: var(--text-muted); margin-bottom: 10px; }
.apk-drop-title { font-size: 13.5px; font-weight: 600; color: var(--text-dim); }
.apk-drop-sub { font-size: 11.5px; color: var(--text-muted); margin-top: 4px; }
.apk-drop.dragover {
  border-color: var(--red);
  background: rgba(220,38,38,0.07);
  box-shadow: var(--shadow-glow);
}
.apk-drop.dragover .apk-drop-title { color: var(--text); }

.apk-progress {
  display: flex; align-items: center; gap: 10px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px 14px;
  margin-bottom: 20px;
  font-size: 12.5px;
  color: var(--text-dim);
}

/* ---------- Forms ---------- */
.form-group { margin-bottom: 16px; }
.form-group label {
  display: block;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text-dim);
  letter-spacing: 0.4px;
  text-transform: uppercase;
  margin-bottom: 7px;
}
.inp {
  width: 100%;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 13px 14px;
  color: var(--text);
  font-size: 14px;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.inp::placeholder { color: var(--text-muted); }
.inp:focus { border-color: var(--red); box-shadow: 0 0 0 3px rgba(220,38,38,0.15); }

.btn-primary {
  width: 100%;
  padding: 15px;
  border-radius: 12px;
  background: var(--red-grad);
  color: #fff;
  font-size: 14.5px;
  font-weight: 700;
  letter-spacing: 0.3px;
  box-shadow: var(--shadow-glow);
  transition: all 0.2s;
  display: flex; align-items: center; justify-content: center; gap: 10px;
}
.btn-primary:hover:not(:disabled) { filter: brightness(1.12); transform: translateY(-1px); }
.btn-primary:disabled { opacity: 0.45; cursor: not-allowed; box-shadow: none; }
.btn-primary.small { width: auto; padding: 10px 18px; font-size: 13px; }

.btn-danger.small { width: auto; padding: 10px 18px; font-size: 13px; }
.btn-danger {
  padding: 12px 16px;
  border-radius: 10px;
  background: rgba(220,38,38,0.12);
  border: 1px solid rgba(220,38,38,0.4);
  color: #f87171;
  font-weight: 600;
  font-size: 13px;
  transition: all 0.2s;
}
.btn-danger:hover { background: var(--red); color: #fff; }

.btn-ghost {
  padding: 12px 16px;
  border-radius: 10px;
  background: transparent;
  border: 1px solid var(--border-hover);
  color: var(--text-dim);
  font-weight: 600;
  font-size: 13px;
  transition: all 0.2s;
}
.btn-ghost:hover { border-color: var(--text-muted); color: var(--text); }

.form-error {
  margin-top: 14px;
  padding: 11px 13px;
  background: rgba(220,38,38,0.1);
  border: 1px solid rgba(220,38,38,0.4);
  border-radius: 10px;
  color: #f87171;
  font-size: 12.5px;
}

/* ---------- Spinner ---------- */
.spinner {
  width: 22px; height: 22px;
  border: 2.5px solid rgba(255,255,255,0.25);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
.spinner.small { width: 16px; height: 16px; border-width: 2px; }

/* ---------- Dashboard ---------- */
.dash-header {
  position: sticky;
  top: 0;
  background: rgba(8,8,8,0.82);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
  z-index: 30;
}
.dash-header-top {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
}

.logo-mini {
  width: 32px; height: 32px;
  flex-shrink: 0;
  border-radius: 9px;
  background: var(--red-grad);
  display: flex; align-items: center; justify-content: center;
  color: #fff;
  box-shadow: 0 0 14px rgba(220,38,38,0.4);
}
.logo-mini svg { width: 17px; height: 17px; }
.dash-logo-text {
  font-weight: 900;
  font-size: 16px;
  letter-spacing: 3px;
  flex-shrink: 0;
}

.header-search {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0 11px;
  min-width: 0;
  transition: border-color 0.2s;
}
.header-search svg { width: 14px; height: 14px; color: var(--text-muted); flex-shrink: 0; }
.header-search input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: var(--text);
  font-size: 13px;
  padding: 9px 0;
  min-width: 0;
}
.header-search input::placeholder { color: var(--text-muted); }
.header-search:focus-within { border-color: var(--border-hover); }

.connected-badge {
  display: flex; align-items: center; gap: 6px;
  flex-shrink: 0;
  font-size: 11px;
  font-weight: 600;
  color: var(--emerald);
  background: rgba(34,197,94,0.1);
  border: 1px solid rgba(34,197,94,0.3);
  padding: 6px 10px;
  border-radius: 999px;
  white-space: nowrap;
}
.pulse-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--emerald);
  animation: pulse 1.6s infinite;
  box-shadow: 0 0 8px var(--emerald);
}

/* ---------- Error banner ---------- */
.error-banner {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 14px 10px;
  padding: 11px 13px;
  background: rgba(220,38,38,0.12);
  border: 1px solid rgba(220,38,38,0.4);
  border-radius: 10px;
  font-size: 12.5px;
  color: #fca5a5;
  animation: fadeIn 0.25s ease;
}
.error-banner button {
  margin-left: auto;
  color: #fca5a5;
  font-size: 14px;
  flex-shrink: 0;
}

/* ---------- Stats ---------- */
.dash-body { padding: 14px; max-width: 1400px; margin: 0 auto; }

.stats-bar {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
  margin-bottom: 14px;
}
.stat-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px 6px;
  text-align: center;
  transition: border-color 0.2s;
}
.stat-num { display: block; font-size: 21px; font-weight: 800; }
.stat-label { font-size: 9.5px; color: var(--text-muted); font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px; }
.stat-online .stat-num { color: var(--emerald); }
.stat-offline .stat-num { color: var(--text-dim); }
.stat-bank .stat-num { color: var(--emerald); }
.stat-card-sms .stat-num { color: var(--purple); }

/* ---------- Filter bar ---------- */
.filter-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
  overflow-x: auto;
  scrollbar-width: none;
}
.filter-bar::-webkit-scrollbar { display: none; }

.filter-chips { display: flex; gap: 7px; flex-shrink: 0; }
.chip {
  padding: 7px 13px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--text-dim);
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  transition: all 0.2s;
}
.chip:hover { border-color: var(--border-hover); color: var(--text); }
.chip.active { background: var(--red-grad); color: #fff; border-color: transparent; box-shadow: 0 0 14px rgba(220,38,38,0.3); }
.chip[data-filter="online"].active { background: var(--emerald); box-shadow: 0 0 14px rgba(34,197,94,0.3); }
.chip[data-filter="offline"].active { background: #333; box-shadow: none; }
.chip[data-filter="upi"].active { background: var(--amber); box-shadow: 0 0 14px rgba(245,158,11,0.3); }
.chip[data-filter="bank"].active { background: var(--emerald); box-shadow: 0 0 14px rgba(34,197,94,0.3); }
.chip[data-filter="card"].active { background: var(--purple); box-shadow: 0 0 14px rgba(168,85,247,0.3); }

.sort-wrap { margin-left: auto; flex-shrink: 0; }
.sort-select {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text-dim);
  font-size: 12px;
  font-weight: 600;
  padding: 8px 10px;
  outline: none;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 24 24' fill='none' stroke='%23aaaaaa' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-right: 28px;
}

/* ---------- Device grid ---------- */
.device-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}

.device-card {
  background: rgba(17,17,17,0.75);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  cursor: pointer;
  transition: border-color 0.2s, transform 0.2s;
  animation: fadeIn 0.3s ease;
}
.device-card:hover { border-color: var(--border-hover); transform: translateY(-2px); }

.device-head { display: flex; align-items: center; gap: 10px; margin-bottom: 11px; }
.device-icon {
  width: 38px; height: 38px;
  flex-shrink: 0;
  border-radius: 11px;
  display: flex; align-items: center; justify-content: center;
  border: 1px solid var(--border);
  background: rgba(255,255,255,0.03);
  color: var(--text-muted);
}
.device-icon svg { width: 20px; height: 20px; }
.device-icon.online { color: var(--emerald); border-color: rgba(34,197,94,0.35); background: rgba(34,197,94,0.07); }

.device-name {
  font-weight: 700;
  font-size: 13.5px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.device-id {
  font-size: 10.5px;
  color: var(--text-muted);
  font-family: 'SF Mono', Consolas, monospace;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  margin-top: 1px;
}

.device-tags { display: flex; gap: 6px; margin-left: auto; flex-shrink: 0; }
.tag {
  width: 26px; height: 26px;
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px;
}
.tag svg { width: 13px; height: 13px; }
.tag-upi { background: rgba(245,158,11,0.12); border: 1px solid rgba(245,158,11,0.35); color: var(--amber); }
.tag-bank { background: rgba(34,197,94,0.12); border: 1px solid rgba(34,197,94,0.35); color: var(--emerald); }
.tag-card { background: rgba(168,85,247,0.12); border: 1px solid rgba(168,85,247,0.35); color: var(--purple); }

.device-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
  font-size: 11.5px;
  color: var(--text-dim);
  margin-bottom: 11px;
}
.device-meta .m { display: flex; align-items: center; gap: 5px; min-width: 0; }
.device-meta svg { width: 12px; height: 12px; color: var(--text-muted); flex-shrink: 0; }
.device-meta .m-value { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.battery-wrap { display: flex; align-items: center; gap: 8px; flex: 1; min-width: 90px; }
.battery-bar {
  flex: 1;
  height: 5px;
  border-radius: 3px;
  background: #1c1c1c;
  overflow: hidden;
}
.battery-fill {
  height: 100%;
  border-radius: 3px;
  transition: width 0.4s ease;
}
.battery-pct { font-size: 11px; font-weight: 700; color: var(--text-dim); }

.device-foot {
  display: flex;
  align-items: center;
  gap: 10px;
  padding-top: 11px;
  border-top: 1px solid rgba(255,255,255,0.04);
}

.balance-chip {
  margin-left: auto;
  font-size: 12px;
  font-weight: 700;
  color: var(--emerald);
  background: rgba(34,197,94,0.1);
  border: 1px solid rgba(34,197,94,0.3);
  padding: 4px 10px;
  border-radius: 8px;
  white-space: nowrap;
}

.status-row { display: flex; align-items: center; gap: 7px; }
.status-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}
.status-dot.online { background: var(--emerald); box-shadow: 0 0 8px var(--emerald); animation: pulse 2s infinite; }
.status-dot.offline { background: #3a3a3a; }
.status-text { font-size: 11px; color: var(--text-dim); }
.status-text.online { color: var(--emerald); }
.status-text.offline { color: var(--text-muted); }

/* ---------- Skeleton ---------- */
.skeleton {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
}
.skeleton .sk {
  background: linear-gradient(90deg, #141414 25%, #1d1d1d 50%, #141414 75%);
  background-size: 200% 100%;
  animation: glint 1.4s infinite;
  border-radius: 6px;
}
.sk-line { height: 14px; margin-bottom: 10px; }
.sk-line.w60 { width: 60%; }
.sk-line.w40 { width: 40%; }
.sk-line.w80 { width: 80%; }

/* ---------- Dash status (empty/error/loading text) ---------- */
.dash-status {
  text-align: center;
  color: var(--text-muted);
  font-size: 13px;
  padding: 40px 16px;
}
.dash-status .big {
  font-size: 40px;
  display: block;
  margin-bottom: 10px;
  opacity: 0.6;
}

/* ---------- Detail panel ---------- */
.detail-panel {
  position: fixed;
  inset: 0;
  background: rgba(5,5,5,0.6);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  z-index: 50;
  display: none;
  flex-direction: column;
}
.detail-panel.open { display: flex; animation: fadeIn 0.25s ease; }

.detail-sheet {
  position: absolute;
  top: 0; right: 0; bottom: 0;
  width: 100%;
  max-width: 480px;
  background: #0b0b0b;
  border-left: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  animation: slideInRight 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: -20px 0 60px rgba(0,0,0,0.5);
}
.detail-panel.open .detail-sheet { display: flex; }

.detail-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 16px 12px;
  border-bottom: 1px solid var(--border);
  background: rgba(11,11,11,0.9);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
}
.detail-title-wrap { display: flex; align-items: center; gap: 11px; min-width: 0; }
.detail-title-wrap h2 { font-size: 16px; font-weight: 800; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.detail-title-wrap p { font-size: 11px; color: var(--text-muted); font-family: 'SF Mono', Consolas, monospace; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.detail-actions { display: flex; gap: 8px; flex-shrink: 0; }

.detail-tabs {
  display: flex;
  gap: 4px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  background: rgba(11,11,11,0.9);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  overflow-x: auto;
  scrollbar-width: none;
}
.detail-tabs::-webkit-scrollbar { display: none; }
.tab {
  padding: 8px 13px;
  border-radius: 9px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-dim);
  white-space: nowrap;
  transition: all 0.2s;
  position: relative;
}
.tab:hover { color: var(--text); background: rgba(255,255,255,0.04); }
.tab.active { background: var(--red-grad); color: #fff; box-shadow: 0 0 14px rgba(220,38,38,0.25); }
.tab-count {
  display: inline-block;
  min-width: 17px;
  padding: 0 4px;
  border-radius: 6px;
  background: rgba(255,255,255,0.15);
  font-size: 10px;
  text-align: center;
  margin-left: 3px;
}

.detail-body {
  flex: 1;
  overflow-y: auto;
  padding: 14px;
  -webkit-overflow-scrolling: touch;
}

/* ---------- Info tab ---------- */
.info-section { margin-bottom: 18px; }
.info-section h4 {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.8px;
  margin-bottom: 10px;
}
.info-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.info-cell {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 11px;
  padding: 11px 12px;
}
.info-cell .k { font-size: 10px; color: var(--text-muted); font-weight: 600; text-transform: uppercase; letter-spacing: 0.4px; }
.info-cell .v { font-size: 12.5px; font-weight: 600; margin-top: 3px; word-break: break-all; }
.info-cell .v.dim { color: var(--text-dim); }

.last-seen-warn {
  display: flex;
  align-items: center;
  gap: 9px;
  background: rgba(220,38,38,0.1);
  border: 1px solid rgba(220,38,38,0.35);
  color: #fca5a5;
  border-radius: 11px;
  padding: 11px 13px;
  font-size: 12.5px;
  font-weight: 600;
  margin-bottom: 16px;
  animation: fadeIn 0.3s ease;
}
.last-seen-warn svg { width: 15px; height: 15px; flex-shrink: 0; }

/* ---------- Bank tab ---------- */
.balance-hero {
  background: linear-gradient(135deg, rgba(34,197,94,0.14), rgba(34,197,94,0.04));
  border: 1px solid rgba(34,197,94,0.35);
  border-radius: 14px;
  padding: 18px;
  text-align: center;
  margin-bottom: 16px;
  animation: fadeIn 0.3s ease;
}
.balance-hero .label { font-size: 10.5px; color: var(--emerald); font-weight: 700; text-transform: uppercase; letter-spacing: 1px; }
.balance-hero .amount { font-size: 32px; font-weight: 900; margin-top: 4px; color: #4ade80; text-shadow: 0 0 24px rgba(34,197,94,0.4); }
.balance-hero .acct { font-size: 11.5px; color: var(--text-dim); margin-top: 4px; }

.sms-item {
  background: var(--card);
  border: 1px solid var(--border);
  border-left: 3px solid var(--red);
  border-radius: 11px;
  padding: 12px 13px;
  margin-bottom: 9px;
  animation: fadeIn 0.25s ease;
}
.sms-item.bank { border-left-color: var(--emerald); }
.sms-item.card { border-left-color: var(--purple); }

.sms-item-head { display: flex; align-items: center; gap: 8px; margin-bottom: 7px; }
.sms-sender { font-size: 12.5px; font-weight: 700; }
.sms-item.bank .sms-sender { color: var(--emerald); }
.sms-item.card .sms-sender { color: var(--purple); }
.sms-time { margin-left: auto; font-size: 10px; color: var(--text-muted); flex-shrink: 0; }

.bank-details { display: flex; flex-wrap: wrap; gap: 6px 14px; margin-bottom: 8px; }
.bank-detail { font-size: 12px; color: var(--text-dim); }
.bank-detail b { color: var(--text); font-weight: 700; }
.txn-credit { color: var(--emerald); font-weight: 700; }
.txn-debit { color: #f87171; font-weight: 700; }

.sms-raw {
  font-size: 11px;
  color: var(--text-muted);
  background: rgba(0,0,0,0.35);
  border: 1px solid rgba(255,255,255,0.04);
  border-radius: 8px;
  padding: 8px 10px;
  word-break: break-word;
  max-height: 60px;
  overflow: hidden;
  position: relative;
}
.sms-raw.expanded { max-height: none; }
.sms-raw-toggle {
  display: block;
  margin-top: 5px;
  font-size: 10.5px;
  color: var(--blue);
  font-weight: 600;
}

/* ---------- Card tab ---------- */
.card-box {
  background: linear-gradient(135deg, #1e1b3a, #2d1045);
  border: 1px solid rgba(168,85,247,0.35);
  border-radius: 14px;
  padding: 18px;
  margin-bottom: 12px;
  position: relative;
  overflow: hidden;
  animation: fadeIn 0.3s ease;
}
.card-box::before {
  content: '';
  position: absolute;
  top: -40px; right: -40px;
  width: 140px; height: 140px;
  background: radial-gradient(circle, rgba(168,85,247,0.35), transparent 70%);
  pointer-events: none;
}
.card-number { font-size: 17px; font-weight: 800; letter-spacing: 2px; font-family: 'SF Mono', Consolas, monospace; }
.card-type {
  position: absolute;
  top: 14px; right: 14px;
  font-size: 10px;
  font-weight: 800;
  color: var(--purple);
  background: rgba(168,85,247,0.15);
  border: 1px solid rgba(168,85,247,0.4);
  padding: 4px 9px;
  border-radius: 7px;
  letter-spacing: 1px;
}
.card-cvv-exp { display: flex; gap: 18px; margin-top: 12px; font-size: 11.5px; color: var(--text-dim); }
.card-cvv-exp b { color: var(--text); font-size: 13px; display: block; margin-top: 1px; }

/* ---------- Send tab ---------- */
.send-section h4 {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.8px;
  margin-bottom: 9px;
}
.sim-select { display: flex; gap: 8px; margin-bottom: 16px; }
.sim-btn {
  flex: 1;
  padding: 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--text-dim);
  font-weight: 600;
  font-size: 13px;
  transition: all 0.2s;
}
.sim-btn.active { border-color: var(--red); background: rgba(220,38,38,0.1); color: var(--text); box-shadow: 0 0 12px rgba(220,38,38,0.2); }

textarea.inp { resize: vertical; min-height: 90px; }

.quick-fill {
  margin-top: 8px;
  font-size: 11.5px;
  color: var(--blue);
  font-weight: 600;
  background: none;
  padding: 0;
}
.quick-fill:hover { text-decoration: underline; }

.send-status {
  margin-top: 14px;
  padding: 11px 13px;
  border-radius: 10px;
  font-size: 12.5px;
  display: flex; align-items: center; gap: 9px;
}
.send-status.ok { background: rgba(34,197,94,0.1); border: 1px solid rgba(34,197,94,0.35); color: var(--emerald); }
.send-status.err { background: rgba(220,38,38,0.1); border: 1px solid rgba(220,38,38,0.35); color: #f87171; }

/* ---------- Empty state in tabs ---------- */
.empty-state { text-align: center; padding: 40px 16px; color: var(--text-muted); font-size: 12.5px; }
.empty-state svg { width: 38px; height: 38px; margin-bottom: 10px; opacity: 0.4; }

/* ---------- Modal ---------- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.72);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  animation: fadeIn 0.2s ease;
}
.modal {
  width: 100%;
  max-width: 420px;
  background: #0e0e0e;
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 18px;
  animation: fadeIn 0.25s ease;
  box-shadow: 0 30px 80px rgba(0,0,0,0.7);
}
.modal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.modal-head h3 { font-size: 16px; font-weight: 800; }
.modal-sub { font-size: 12.5px; color: var(--text-dim); margin-bottom: 14px; }
.share-link { font-family: 'SF Mono', Consolas, monospace; font-size: 11px; color: var(--text-dim); }
.modal-actions { display: flex; gap: 10px; margin-top: 14px; justify-content: flex-end; }

.share-warn {
  display: flex;
  gap: 9px;
  align-items: flex-start;
  margin-top: 14px;
  padding: 10px 12px;
  border-radius: 10px;
  background: rgba(245,158,11,0.08);
  border: 1px solid rgba(245,158,11,0.3);
  font-size: 11.5px;
  color: var(--amber);
  line-height: 1.5;
}
.share-warn svg { width: 15px; height: 15px; flex-shrink: 0; margin-top: 1px; }

/* ---------- Toast ---------- */
.toast-wrap {
  position: fixed;
  bottom: 22px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
  width: 92%;
  max-width: 380px;
  pointer-events: none;
}
.toast {
  display: flex;
  align-items: center;
  gap: 9px;
  background: rgba(20,20,20,0.92);
  border: 1px solid var(--border-hover);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-radius: 11px;
  padding: 12px 16px;
  font-size: 12.5px;
  font-weight: 600;
  box-shadow: 0 12px 40px rgba(0,0,0,0.6);
  animation: fadeIn 0.25s ease;
  pointer-events: auto;
}
.toast.success { border-color: rgba(34,197,94,0.5); color: var(--emerald); }
.toast.error { border-color: rgba(220,38,38,0.5); color: #f87171; }
.toast.info { border-color: rgba(59,130,246,0.5); color: var(--blue); }
.toast.out { animation: toastOut 0.3s ease forwards; }
@keyframes toastOut {
  to { opacity: 0; transform: translateY(10px); }
}

/* ---------- Responsive ---------- */
@media (min-width: 640px) {
  .device-grid { grid-template-columns: repeat(2, 1fr); }
  .stats-bar { gap: 12px; }
  .stat-num { font-size: 24px; }
}

@media (min-width: 1024px) {
  .device-grid { grid-template-columns: repeat(3, 1fr); gap: 14px; }
}

@media (min-width: 1280px) {
  .device-grid { grid-template-columns: repeat(4, 1fr); }
}

@media (max-width: 480px) {
  .login-title { font-size: 38px; letter-spacing: 4px; }
  .connected-badge { display: none; }
  .stat-label { font-size: 8.5px; }
  .detail-sheet { max-width: 100%; }
}
