:root {
  --bg:       #0a0e14;
  --bg2:      #111620;
  --bg3:      #1a2030;
  --bg4:      #20283a;
  --border:   #2a3348;
  --border2:  #374057;
  --text:     #e2e8f4;
  --text2:    #7a8aa8;
  --text3:    #4a5a78;
  --accent:   #00d4ff;
  --accent2:  #0099cc;
  --accentbg: rgba(0,212,255,.08);
  --green:    #3fb950;
  --red:      #f85149;
  --orange:   #d29922;
  --radius:   8px;
  --font:     -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

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

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  height: 100vh;
  overflow: hidden;
}

/* ─── LOGIN ─── */
#login-screen {
  position: fixed; inset: 0;
  background: radial-gradient(ellipse at 50% 40%, #0a1628 0%, var(--bg) 70%);
  display: flex; align-items: center; justify-content: center;
  z-index: 1000;
}
.login-box {
  background: var(--bg2);
  border: 1px solid var(--border2);
  border-radius: 14px;
  padding: 44px 40px;
  width: 380px;
  text-align: center;
  box-shadow: 0 0 60px rgba(0,212,255,.06), 0 24px 48px rgba(0,0,0,.4);
}
.login-logo { margin-bottom: 18px; }
.login-box h1 { font-size: 24px; font-weight: 700; color: var(--accent); letter-spacing: -.3px; }
.login-sub { color: var(--text2); font-size: 13px; margin: 6px 0 28px; }
.login-err { color: var(--red); font-size: 13px; min-height: 20px; margin-bottom: 10px; }
.full-width { width: 100%; }
.apk-link { color: var(--accent); text-decoration: none; }
.apk-link:hover { text-decoration: underline; }

/* ─── FORM ─── */
.form-group { margin-bottom: 14px; text-align: left; }
.form-group label { display: block; font-size: 11px; font-weight: 600; color: var(--text2); margin-bottom: 5px; text-transform: uppercase; letter-spacing: .4px; }
.form-group input, .form-group select {
  width: 100%;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  padding: 10px 12px;
  font-size: 14px;
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.form-group input:focus, .form-group select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(0,212,255,.1);
}
.form-group select option { background: var(--bg3); }

/* ─── BUTTONS ─── */
.btn-primary {
  background: var(--accent);
  color: #000;
  border: none;
  border-radius: var(--radius);
  padding: 10px 20px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: background .15s, transform .1s;
  letter-spacing: .2px;
}
.btn-primary:hover { background: #00bbee; }
.btn-primary:active { transform: scale(.97); }
.btn-ghost {
  background: transparent;
  color: var(--text2);
  border: 1px solid var(--border2);
  border-radius: var(--radius);
  padding: 9px 16px;
  font-size: 13px;
  cursor: pointer;
  transition: color .15s, border-color .15s, background .15s;
}
.btn-ghost:hover { color: var(--text); border-color: var(--text2); background: var(--bg3); }
.btn-sm {
  background: var(--bg3);
  border: 1px solid var(--border);
  color: var(--text2);
  border-radius: 6px;
  padding: 5px 11px;
  font-size: 12px;
  cursor: pointer;
  transition: all .12s;
}
.btn-sm:hover { color: var(--text); border-color: var(--border2); }
.btn-icon {
  background: none; border: none; color: var(--text2);
  cursor: pointer; font-size: 16px; padding: 4px 7px;
  border-radius: 6px; transition: background .15s, color .15s;
}
.btn-icon:hover { background: var(--bg3); color: var(--text); }

/* ─── TOP BAR ─── */
.topbar {
  height: 50px;
  background: var(--bg2);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  flex-shrink: 0;
  position: relative; z-index: 10;
}
.topbar-left { display: flex; align-items: center; gap: 4px; }
.topbar-brand { font-weight: 700; font-size: 15px; color: var(--accent); margin: 0 12px 0 8px; letter-spacing: -.2px; }
.topbar-tab {
  font-size: 13px; color: var(--text2);
  padding: 6px 13px; border-radius: 6px;
  cursor: pointer; transition: background .15s, color .15s;
  font-weight: 500;
}
.topbar-tab:hover { background: var(--bg3); color: var(--text); }
.topbar-tab.active { color: var(--text); background: var(--bg3); }
.topbar-right { display: flex; align-items: center; gap: 12px; }
.user-badge { font-size: 13px; color: var(--text2); }
.role-chip {
  font-size: 10px; font-weight: 700; padding: 2px 7px;
  border-radius: 4px; background: var(--accentbg); color: var(--accent);
  text-transform: uppercase; letter-spacing: .5px;
  border: 1px solid rgba(0,212,255,.2);
}

/* ─── LAYOUT ─── */
#app {
  display: flex; flex-direction: column;
  height: 100vh;
}
.view {
  display: none; flex: 1; overflow: hidden;
}
.view.active { display: flex; }

/* ─── SIDEBAR ─── */
.sidebar {
  width: 234px; flex-shrink: 0;
  background: var(--bg2);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  overflow: hidden;
}
.sidebar-header {
  padding: 11px 14px;
  font-size: 10px; font-weight: 700;
  color: var(--text3); text-transform: uppercase; letter-spacing: 1px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
}
.device-list { overflow-y: auto; flex: 1; padding: 4px; }
.device-item {
  padding: 10px 12px;
  border-radius: 8px;
  cursor: pointer;
  transition: background .12s;
  display: flex; align-items: center; gap: 10px;
  margin-bottom: 2px;
}
.device-item:hover { background: var(--bg3); }
.device-item.selected { background: var(--bg3); outline: 1px solid var(--border2); }
.device-dot {
  width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0;
}
.device-dot.online {
  background: var(--green);
  animation: dot-pulse 2.4s ease-in-out infinite;
}
.device-dot.offline { background: var(--text3); }
@keyframes dot-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(63,185,80,.5); }
  50%       { box-shadow: 0 0 0 4px rgba(63,185,80,.0); }
}
.device-item-info { overflow: hidden; flex: 1; }
.device-item-name { font-size: 13px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.device-item-sub  { font-size: 11px; color: var(--text2); margin-top: 1px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.device-item-badge {
  font-size: 10px; padding: 1px 5px; border-radius: 4px;
  background: var(--accentbg); color: var(--accent); flex-shrink: 0;
  border: 1px solid rgba(0,212,255,.2);
}
.device-item-time {
  font-size: 10px; color: var(--text3); flex-shrink: 0;
}
.device-dot.uninstalled { background: var(--red); opacity: .5; }
.device-item-pin { font-size: 11px; flex-shrink: 0; opacity: .7; }
/* ─── UNINSTALLED SECTION ─── */
.sidebar-section-title {
  font-size: 10px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase;
  color: var(--text3); padding: 10px 12px 4px; display: flex; align-items: center;
  justify-content: space-between;
}
.device-item.uninstalled-item { opacity: .55; }
.device-item.uninstalled-item:hover { opacity: 1; }
/* ─── DEVICE CONTEXT MENU ─── */
.device-ctx-menu {
  position: fixed; z-index: 9999;
  background: var(--bg2); border: 1px solid var(--border2);
  border-radius: 8px; padding: 4px 0;
  min-width: 160px;
  box-shadow: 0 8px 24px rgba(0,0,0,.5);
  font-size: 13px;
}
.device-ctx-menu div {
  padding: 7px 14px; cursor: pointer; display: flex; align-items: center; gap: 8px;
}
.device-ctx-menu div:hover { background: var(--bg3); }
.device-ctx-menu .ctx-danger { color: var(--red); }
.device-ctx-sep { height: 1px; background: var(--border); margin: 3px 0; }

/* ─── MAIN PANEL ─── */
.main-panel {
  flex: 1; overflow: hidden; position: relative;
  background: var(--bg);
  display: flex;
}
.empty-state {
  position: absolute; inset: 0;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  color: var(--text2); gap: 12px;
  pointer-events: none;
}
.empty-state a { pointer-events: auto; }

/* ─── DEVICE PANEL BODY ─── */
.win-body {
  display: flex; flex: 1; overflow: hidden; min-height: 0;
}
.win-tab-content {
  flex: 1; display: flex; flex-direction: column;
  overflow: hidden; min-height: 0;
}

/* Right vertical tab nav */
.tab-nav-right {
  width: 54px; flex-shrink: 0;
  background: var(--bg3); border-left: 1px solid var(--border);
  display: flex; flex-direction: column;
  padding: 5px 3px; gap: 2px; overflow-y: auto;
}
.tab-btn-r {
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  background: none; border: none; border-radius: 7px;
  padding: 8px 2px; cursor: pointer;
  color: var(--text2); font-size: 8px; font-weight: 600;
  white-space: nowrap; transition: background .12s, color .12s;
  width: 100%; letter-spacing: .2px;
}
.tab-btn-r .svg-icon { width: 15px; height: 15px; flex-shrink: 0; }
.tab-btn-r:hover { background: var(--bg4); color: var(--text); }
.tab-btn-r.active { background: var(--bg4); color: var(--accent); }
.empty-icon { font-size: 52px; opacity: .3; }
.empty-title { font-size: 16px; font-weight: 600; color: var(--text2); }
.empty-sub { font-size: 13px; text-align: center; line-height: 1.7; color: var(--text3); max-width: 260px; }

/* ─── DEVICE PANEL ─── */
#device-panel {
  flex: 1; min-height: 0; overflow: hidden;
  display: flex; flex-direction: column;
}

/* ─── DEVICE HEADER ─── */
.device-header {
  padding: 10px 16px;
  background: var(--bg2);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  flex-shrink: 0; gap: 10px;
}
.device-header-left { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; min-width: 0; }
.device-alias, .dh-alias {
  font-size: 14px; font-weight: 600;
  border-bottom: 1px dashed transparent;
  outline: none; cursor: text; white-space: nowrap;
}
.device-alias:hover, .dh-alias:hover { border-bottom-color: var(--border2); }
.device-alias:focus, .dh-alias:focus { border-bottom-color: var(--accent); }
.status-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.status-dot.online  { background: var(--green); animation: dot-pulse 2.4s ease-in-out infinite; }
.status-dot.offline { background: var(--red); }
.device-meta, .dh-meta { font-size: 12px; color: var(--text2); white-space: nowrap; }
.device-meta.muted, .dh-meta.muted { color: var(--text3); font-family: monospace; font-size: 11px; }
.device-header-right { display: flex; gap: 5px; flex-shrink: 0; }
.ctrl-btn {
  background: var(--bg3); border: 1px solid var(--border);
  border-radius: 7px; padding: 6px 11px; cursor: pointer;
  font-size: 13px; transition: background .15s, border-color .15s;
  color: var(--text2);
}
.ctrl-btn:hover { background: var(--bg4); border-color: var(--border2); color: var(--text); }
.ctrl-btn.active { background: var(--accentbg); border-color: rgba(0,212,255,.4); color: var(--accent); }

/* ─── TABS ─── */
.tab-nav {
  display: flex; gap: 2px; padding: 6px 10px;
  background: var(--bg2); border-bottom: 1px solid var(--border);
  flex-shrink: 0; overflow-x: auto;
}
.tab-btn {
  background: none; border: none; color: var(--text2);
  padding: 6px 13px; border-radius: 7px; cursor: pointer;
  font-size: 12px; font-weight: 500; white-space: nowrap;
  transition: background .12s, color .12s;
}
.tab-btn:hover { background: var(--bg3); color: var(--text); }
.tab-btn.active { background: var(--bg3); color: var(--accent); }
.tab-pane { display: none; flex: 1; overflow: hidden; flex-direction: column; min-height: 0; }
.tab-pane.active { display: flex; }

/* ─── SCREEN TAB ─── */
.screen-layout {
  flex: 1; display: flex; overflow: hidden; min-height: 0;
}

/* Left control sidebar */
.screen-side {
  width: 126px; flex-shrink: 0;
  background: var(--bg2); border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  padding: 8px 7px; gap: 3px;
  overflow-y: auto;
}
.side-group-label {
  font-size: 9px; font-weight: 700; text-transform: uppercase; letter-spacing: 1px;
  color: var(--text3); padding: 5px 4px 3px; margin-top: 4px;
}
.side-group-label:first-child { margin-top: 0; }
.nav-btn {
  display: flex; align-items: center; gap: 7px;
  background: var(--bg3); border: 1px solid var(--border);
  border-radius: 7px; padding: 8px 9px; cursor: pointer;
  font-size: 12px; color: var(--text2); width: 100%;
  text-align: left; transition: all .12s;
}
.nav-btn:hover { color: var(--text); border-color: var(--border2); background: var(--bg4); }
.nav-btn.active { background: var(--accentbg); border-color: rgba(0,212,255,.35); color: var(--accent); }
.nav-btn .ni { font-size: 12px; flex-shrink: 0; }

/* Canvas area */
.screen-canvas-wrap {
  flex: 1; display: flex; flex-direction: column; overflow: hidden; min-height: 0;
}
.screen-statusbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 5px 12px; background: var(--bg2); border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.screen-statusbar-left { display: flex; align-items: center; gap: 10px; }
.screen-device-name { font-size: 12px; font-weight: 600; }
.screen-device-res  { font-size: 11px; color: var(--text2); font-family: monospace; }
.screen-live-badge  {
  font-size: 10px; font-weight: 700; padding: 2px 7px; border-radius: 4px;
  background: rgba(63,185,80,.12); color: var(--green); border: 1px solid rgba(63,185,80,.25);
  animation: blink-live 2s ease-in-out infinite;
}
@keyframes blink-live { 50% { opacity: .6; } }
.screen-wrap {
  flex: 1; min-height: 0; min-width: 0;
  background: #050911; position: relative;
  overflow: hidden;
}
#screen-blank-banner {
  position: absolute; top: 0; left: 0; right: 0;
  background: rgba(200,0,0,.85); color: #fff;
  text-align: center; padding: 6px; font-size: 13px;
  z-index: 5; pointer-events: none;
}
#stream-canvas {
  display: block;
  position: absolute;
  cursor: default;
}
.screen-hint {
  position: absolute; bottom: 8px; right: 10px; z-index: 2;
  font-size: 10px; color: rgba(255,255,255,.2);
  pointer-events: none;
}

/* Text injection row */
.type-row {
  display: flex; gap: 8px; padding: 8px 10px;
  background: var(--bg2); border-top: 1px solid var(--border);
  flex-shrink: 0;
}
.type-field {
  flex: 1; background: var(--bg3); border: 1px solid var(--border);
  border-radius: 7px; color: var(--text); padding: 8px 12px; font-size: 13px; outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.type-field:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(0,212,255,.08); }

/* ─── FILES TAB ─── */
.path-bar {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 12px; background: var(--bg2); border-bottom: 1px solid var(--border);
  flex-shrink: 0; font-size: 12px; color: var(--text2);
  font-family: monospace;
}
.file-list { flex: 1; overflow-y: auto; padding: 4px; }
.file-row {
  display: flex; align-items: center; gap: 8px;
  padding: 7px 10px; border-radius: 7px; cursor: pointer;
  transition: background .1s;
}
.file-row:hover { background: var(--bg3); }
.file-icon { font-size: 15px; width: 20px; text-align: center; flex-shrink: 0; }
.file-name { flex: 1; font-size: 13px; }
.file-size { font-size: 11px; color: var(--text2); }
.file-content { flex: 1; display: flex; flex-direction: column; overflow: hidden; }
.file-content-bar {
  display: flex; justify-content: space-between; align-items: center;
  padding: 7px 12px; background: var(--bg2); border-bottom: 1px solid var(--border);
  font-size: 13px;
}
#file-content-text {
  flex: 1; overflow: auto; padding: 12px; font-family: monospace;
  font-size: 12px; line-height: 1.5; white-space: pre-wrap; word-break: break-all;
  color: var(--text2);
}

/* ─── DATA TAB ─── */
.data-toolbar {
  display: flex; gap: 6px; padding: 9px 12px;
  background: var(--bg2); border-bottom: 1px solid var(--border); flex-shrink: 0;
  flex-wrap: wrap;
}
.data-btn {
  background: var(--bg3); border: 1px solid var(--border);
  border-radius: 7px; padding: 6px 14px; cursor: pointer;
  font-size: 12px; color: var(--text2); transition: all .12s;
  font-weight: 500;
}
.data-btn:hover { color: var(--text); border-color: var(--border2); }
.data-btn.active { color: var(--accent); border-color: rgba(0,212,255,.4); background: var(--accentbg); }
.data-output { flex: 1; overflow-y: auto; padding: 8px 12px; }
.data-card {
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: 9px; padding: 12px 14px; margin-bottom: 8px;
}
.data-card-title { font-size: 13px; font-weight: 600; margin-bottom: 6px; }
.data-card-body { font-size: 12px; color: var(--text2); line-height: 1.6; }

/* ─── CAMERA TAB ─── */
.camera-controls { padding: 12px; display: flex; gap: 10px; flex-shrink: 0; }
.camera-output { flex: 1; overflow-y: auto; padding: 8px 12px; display: flex; flex-wrap: wrap; gap: 10px; align-content: flex-start; }
.camera-output img { max-width: 100%; max-height: 300px; border-radius: 8px; border: 1px solid var(--border); }

/* ─── AUDIO TAB ─── */
.audio-controls { padding: 16px 12px; display: flex; align-items: center; gap: 14px; flex-shrink: 0; }
.audio-status { font-size: 13px; color: var(--text2); }
.audio-status.recording { color: var(--red); animation: blink 1s infinite; }
@keyframes blink { 50% { opacity: .4; } }
.audio-output { flex: 1; overflow-y: auto; padding: 8px 12px; display: flex; flex-direction: column; gap: 8px; }
.audio-output audio { width: 100%; }

/* ─── SHELL TAB ─── */
.shell-output {
  flex: 1; overflow-y: auto; padding: 10px 14px;
  font-family: 'Consolas', 'Courier New', monospace;
  font-size: 12px; line-height: 1.6;
  background: #050911;
}
.shell-line { margin-bottom: 10px; }
.shell-cmd  { color: var(--accent); }
.shell-out  { color: var(--text2); white-space: pre-wrap; word-break: break-all; }
.shell-err  { color: var(--red); white-space: pre-wrap; }
.shell-input-row {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 12px; background: var(--bg2); border-top: 1px solid var(--border);
  flex-shrink: 0;
}
.shell-prompt { color: var(--accent); font-family: monospace; font-size: 14px; }
.shell-input {
  flex: 1; background: transparent; border: none; outline: none;
  color: var(--text); font-family: monospace; font-size: 13px;
}

/* ─── APPS TAB ─── */
.apps-toolbar {
  display: flex; gap: 8px; padding: 10px 12px;
  background: var(--bg2); border-bottom: 1px solid var(--border); flex-shrink: 0;
}
.search-input {
  flex: 1; background: var(--bg3); border: 1px solid var(--border);
  border-radius: 7px; color: var(--text); padding: 8px 12px; font-size: 13px; outline: none;
  transition: border-color .15s;
}
.search-input:focus { border-color: var(--accent); }
.apps-list { flex: 1; overflow-y: auto; padding: 4px; }
.app-row {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px; border-radius: 7px;
  transition: background .1s;
}
.app-row:hover { background: var(--bg3); }
.app-name { font-size: 13px; font-weight: 500; }
.app-pkg  { font-size: 11px; color: var(--text2); font-family: monospace; margin-top: 1px; }
.app-sys  { font-size: 10px; padding: 1px 6px; border-radius: 4px; background: var(--bg4); color: var(--text3); border: 1px solid var(--border); }

/* ─── INFO TAB ─── */
.info-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 10px; padding: 14px; overflow-y: auto;
}
.info-card {
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: 9px; padding: 14px 16px;
}
.info-card-label { font-size: 10px; color: var(--text3); text-transform: uppercase; letter-spacing: .6px; margin-bottom: 6px; font-weight: 700; }
.info-card-value { font-size: 15px; font-weight: 600; }

/* ─── ADMIN VIEW ─── */
#view-admin { display: none; padding: 24px; overflow-y: auto; }
#view-admin.active { display: block; }
.admin-panel { max-width: 900px; margin: 0 auto; }
.admin-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; }
.admin-header h2 { font-size: 18px; font-weight: 700; }
.accounts-table { width: 100%; border-collapse: collapse; }
.accounts-table th {
  text-align: left; padding: 10px 14px; font-size: 10px;
  text-transform: uppercase; letter-spacing: .6px; color: var(--text3); font-weight: 700;
  background: var(--bg2); border-bottom: 1px solid var(--border);
}
.accounts-table td { padding: 12px 14px; border-bottom: 1px solid var(--border); font-size: 13px; }
.accounts-table tr:hover td { background: var(--bg2)44; }
.ak-mono { font-family: monospace; font-size: 11px; color: var(--text2); }
.expires-badge { font-size: 11px; padding: 2px 8px; border-radius: 5px; font-weight: 600; }
.expires-badge.ok      { background: rgba(63,185,80,.1); color: var(--green); border: 1px solid rgba(63,185,80,.2); }
.expires-badge.soon    { background: rgba(210,153,34,.1); color: var(--orange); border: 1px solid rgba(210,153,34,.2); }
.expires-badge.expired { background: rgba(248,81,73,.1); color: var(--red); border: 1px solid rgba(248,81,73,.2); }
.expires-badge.never   { background: var(--bg4); color: var(--text2); border: 1px solid var(--border); }

/* ─── MODAL ─── */
.modal {
  position: fixed; inset: 0; background: rgba(0,0,0,.6);
  display: flex; align-items: center; justify-content: center; z-index: 500;
  backdrop-filter: blur(4px);
}
.modal-box {
  background: var(--bg2); border: 1px solid var(--border2);
  border-radius: 14px; padding: 26px; width: 420px;
  box-shadow: 0 24px 48px rgba(0,0,0,.5);
}
.modal-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; }
.modal-header h3 { font-size: 16px; font-weight: 700; }
.modal-footer { display: flex; justify-content: flex-end; gap: 10px; margin-top: 22px; }

/* ─── CONTEXT MENU ─── */
.ctx-menu {
  position: fixed; background: var(--bg2); border: 1px solid var(--border2);
  border-radius: 9px; padding: 6px; z-index: 200; min-width: 130px;
  box-shadow: 0 10px 30px rgba(0,0,0,.5);
}
.ctx-menu div {
  padding: 8px 14px; border-radius: 6px; cursor: pointer; font-size: 13px;
  transition: background .1s;
}
.ctx-menu div:hover { background: var(--bg3); }

/* ─── SETTINGS / APK / ALERTS PAGES ─── */
#view-apklink, #view-alerts { display: none; overflow-y: auto; }
#view-apklink.active, #view-alerts.active { display: block; }
.settings-panel { max-width: 660px; margin: 0 auto; padding: 32px 24px; }
.settings-header { margin-bottom: 28px; }
.settings-header h2 { font-size: 22px; font-weight: 700; margin-bottom: 8px; }
.settings-sub { color: var(--text2); font-size: 14px; line-height: 1.7; }

/* APK link card */
.apk-link-card {
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: 12px; padding: 16px 18px;
  display: flex; align-items: center; gap: 16px;
}
.apk-link-icon {
  width: 52px; height: 52px; border-radius: 12px; flex-shrink: 0;
  background: var(--bg3); border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center; overflow: hidden;
}
.apk-link-icon img { width: 100%; height: 100%; object-fit: cover; border-radius: 11px; }
.apk-link-info { flex: 1; min-width: 0; }
.apk-link-name { font-size: 14px; font-weight: 600; margin-bottom: 3px; }
.apk-link-appname { font-size: 12px; color: var(--text2); margin-bottom: 7px; }
.apk-link-url {
  font-family: monospace; font-size: 11px; color: var(--accent);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  max-width: 100%;
}
.apk-link-actions { display: flex; gap: 6px; flex-shrink: 0; }
.copy-msg { font-size: 13px; color: var(--green); margin-top: 8px; min-height: 20px; }
.link { color: var(--accent); text-decoration: none; }
.link:hover { text-decoration: underline; }
/* Modal overlay (generic, used for create-link modal) */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,.65);
  display: flex; align-items: center; justify-content: center; z-index: 500;
  backdrop-filter: blur(4px);
}
.modal-box {
  background: var(--bg2); border: 1px solid var(--border2);
  border-radius: 14px; width: 440px; max-width: calc(100vw - 32px);
  box-shadow: 0 24px 60px rgba(0,0,0,.6);
}
.modal-header {
  display: flex; justify-content: space-between; align-items: center;
  padding: 20px 22px 0;
}
.modal-title { font-size: 15px; font-weight: 700; }
.modal-body { padding: 18px 22px; display: flex; flex-direction: column; gap: 16px; }
.modal-footer { display: flex; justify-content: flex-end; gap: 8px; padding: 0 22px 20px; }
.form-label { display: block; font-size: 12px; font-weight: 600; color: var(--text2); margin-bottom: 6px; text-transform: uppercase; letter-spacing: .4px; }
.form-input {
  width: 100%; background: var(--bg3); border: 1px solid var(--border);
  border-radius: 8px; color: var(--text); padding: 9px 12px; font-size: 13px;
  outline: none; transition: border-color .15s; box-sizing: border-box;
}
.form-input:focus { border-color: rgba(0,212,255,.4); }
.icon-upload-area {
  width: 90px; height: 90px; border-radius: 14px; border: 2px dashed var(--border2);
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  flex-direction: column; transition: border-color .15s; position: relative;
}
.icon-upload-area:hover { border-color: var(--accent); }

/* QR code */
.apk-qr-wrap { margin-bottom: 26px; }
.apk-qr-label { font-size: 13px; color: var(--text2); margin-bottom: 12px; }
.apk-qr {
  background: #fff; border-radius: 10px; padding: 12px;
  display: inline-block;
}
.apk-qr canvas, .apk-qr img { display: block; }

/* Instructions */
.apk-instructions {
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: 11px; padding: 20px;
}
.apk-instructions h3 { font-size: 11px; font-weight: 700; margin-bottom: 14px; color: var(--text3); text-transform: uppercase; letter-spacing: .6px; }
.apk-instructions ol { padding-left: 20px; }
.apk-instructions li { margin-bottom: 10px; color: var(--text2); font-size: 14px; line-height: 1.6; }
.apk-instructions li b { color: var(--text); }

/* Alerts setup */
.alert-setup-card {
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: 11px; padding: 20px; margin-bottom: 22px;
  display: flex; flex-direction: column; gap: 18px;
}
.alert-step { display: flex; gap: 14px; align-items: flex-start; }
.step-num {
  width: 28px; height: 28px; border-radius: 50%; background: var(--accentbg);
  color: var(--accent); font-size: 13px; font-weight: 700;
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
  border: 1px solid rgba(0,212,255,.25);
}
.step-title { font-size: 14px; font-weight: 600; margin-bottom: 4px; }
.step-body { font-size: 13px; color: var(--text2); line-height: 1.6; }
.step-body code { background: var(--bg3); border-radius: 4px; padding: 1px 6px; font-size: 12px; color: var(--accent); word-break: break-all; border: 1px solid var(--border); }

.alert-events-title { font-size: 11px; color: var(--text3); text-transform: uppercase; letter-spacing: .6px; font-weight: 700; margin: 24px 0 10px; }
.alert-events { display: flex; flex-direction: column; gap: 8px; }
.alert-event {
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: 9px; padding: 12px 16px; font-size: 14px; color: var(--text2);
}

/* ─── SVG ICONS ─── */
.svg-icon {
  width: 14px; height: 14px;
  display: inline-block; flex-shrink: 0;
}
.tab-btn .svg-icon  { width: 13px; height: 13px; vertical-align: -2px; }
.nav-btn .svg-icon  { width: 13px; height: 13px; flex-shrink: 0; }
.topbar-tab .svg-icon { width: 13px; height: 13px; }
.btn-icon .svg-icon { width: 15px; height: 15px; }
.data-btn .svg-icon { width: 12px; height: 12px; }
.path-bar .svg-icon { width: 14px; height: 14px; vertical-align: -2px; }

/* ─── SCROLLBAR ─── */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border2); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text3); }
