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

:root {
  --bg: #09090b;
  --bg-elevated: #101014;
  --sidebar: #0c0c0f;
  --panel: #131316;
  --panel-2: #18181c;
  --input-bg: #0c0c10;
  --input-border: #27272f;
  --border: rgba(255, 255, 255, 0.07);
  --text: #f4f4f5;
  --text-dim: #a1a1aa;
  --text-muted: #71717a;
  --purple: #8b5cf6;
  --purple-2: #a78bfa;
  --purple-soft: rgba(139, 92, 246, 0.12);
  --purple-border: rgba(139, 92, 246, 0.32);
  --green: #34d399;
  --green-bg: rgba(52, 211, 153, 0.1);
  --red: #f87171;
  --red-bg: rgba(248, 113, 113, 0.1);
  --preview-bg: #1a1a22;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.35);
  --shadow-lg: 0 20px 50px rgba(0, 0, 0, 0.45);
  --glow: rgba(139, 92, 246, 0.35);
  --gap: 16px;
}

html, body { height: 100%; }

body {
  font-family: Inter, -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg);
  background-image:
    radial-gradient(ellipse 80% 50% at 50% -20%, var(--purple-soft), transparent 55%),
    radial-gradient(circle at 100% 100%, rgba(52, 211, 153, 0.04), transparent 40%);
  color: var(--text);
  font-size: 13px;
  line-height: 1.5;
  display: flex;
  overflow: hidden;
  position: relative;
}
body::before {
  content: "";
  position: fixed;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.03'/%3E%3C/svg%3E");
  pointer-events: none;
  z-index: 0;
  opacity: 0.45;
}

* { scrollbar-width: thin; scrollbar-color: #3f3f46 transparent; }
*::-webkit-scrollbar { width: 8px; height: 8px; }
*::-webkit-scrollbar-thumb { background: #3f3f46; border-radius: 99px; }
*::-webkit-scrollbar-thumb:hover { background: #52525b; }

.sidebar-backdrop {
  display: none;
}
.sidebar {
  width: 232px; min-width: 232px; background: var(--sidebar);
  border-right: 1px solid var(--border); display: flex; flex-direction: column; height: 100vh;
  position: relative; z-index: 2;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 22px 20px 20px; }
.brand-gem {
  width: 34px; height: 34px; border-radius: 8px;
  overflow: hidden;
  background: #1a1a1a;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 2px 14px rgba(0, 0, 0, 0.45);
  flex-shrink: 0;
}
.brand-gem .brand-logo {
  width: 100%; height: 100%;
  object-fit: cover;
  display: block;
}
.brand-text { font-size: 14px; font-weight: 600; color: var(--text); letter-spacing: -0.02em; }
.nav-group-label { font-size: 10px; font-weight: 600; letter-spacing: 0.1em; color: var(--text-muted); padding: 0 20px 8px; }
.nav-list { list-style: none; padding: 0 12px; margin-bottom: 4px; }
.nav-list li a {
  display: flex; align-items: center; gap: 10px; padding: 9px 12px; margin-bottom: 2px;
  border-radius: var(--radius-sm); color: var(--text-dim); text-decoration: none; font-size: 13px; font-weight: 500; cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.nav-list li a svg { width: 16px; height: 16px; stroke: currentColor; fill: none; stroke-width: 1.75; opacity: 0.7; flex-shrink: 0; }
.nav-list li a:hover { color: var(--text); background: rgba(255, 255, 255, 0.04); }
.nav-list li a.active { color: var(--text); background: var(--purple-soft); border: 1px solid var(--purple-border); }
.nav-list li a.active svg { opacity: 1; color: var(--purple-2); }
.sidebar-bottom { margin-top: auto; padding: 16px 20px 22px; font-size: 10px; color: var(--text-muted); line-height: 1.6; border-top: 1px solid var(--border); }

.main { flex: 1; display: flex; flex-direction: column; min-width: 0; height: 100vh; overflow: hidden; position: relative; z-index: 1; }
.topbar {
  height: 52px; flex-shrink: 0; display: flex; align-items: center; justify-content: space-between;
  padding: 0 28px; border-bottom: 1px solid var(--border); background: rgba(12, 12, 15, 0.85); backdrop-filter: blur(8px);
}
.topbar-left { display: flex; align-items: center; gap: 10px; min-width: 0; flex: 1; }
.tb-icon.mobile-menu-btn { display: none; flex-shrink: 0; }
.crumb { font-size: 12px; color: var(--text-muted); }
.crumb span { color: var(--text); font-weight: 500; }
.topbar-actions { display: flex; align-items: center; gap: 10px; }
.user-pill {
  display: flex; align-items: center; gap: 8px; padding: 6px 14px;
  border-radius: 999px; border: 1px solid var(--border); background: var(--panel); font-size: 12px;
}
.badge-user {
  font-size: 9px; font-weight: 700; letter-spacing: 0.04em; padding: 2px 7px; border-radius: 4px;
  background: var(--green-bg); color: var(--green); border: 1px solid rgba(52, 211, 153, 0.25);
}
.tb-icon {
  width: 36px; height: 36px; border-radius: var(--radius-sm); border: 1px solid var(--border);
  background: var(--panel); color: var(--text-dim); cursor: pointer; display: flex; align-items: center; justify-content: center; position: relative;
  transition: border-color 0.15s, color 0.15s;
}
.tb-icon:hover { border-color: var(--purple-border); color: var(--text); }
.tb-icon .dot { position: absolute; top: 7px; right: 7px; width: 7px; height: 7px; background: var(--purple); border-radius: 50%; border: 2px solid var(--panel); }

.page-scroll { flex: 1; overflow-y: auto; padding: 28px 32px 40px; min-height: 0; }
.page { display: none; }
.page.active { display: block; }
.page-header { margin-bottom: 24px; }
.page-header h1 {
  font-size: 22px; font-weight: 600; letter-spacing: -0.02em; text-transform: lowercase;
  margin-bottom: 6px; color: var(--text);
}
.page-header p { font-size: 13px; color: var(--text-dim); line-height: 1.55; max-width: 640px; }

.card {
  background: linear-gradient(160deg, rgba(255, 255, 255, 0.045) 0%, rgba(255, 255, 255, 0.015) 100%);
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: var(--radius);
  box-shadow: var(--shadow), inset 0 1px 0 rgba(255, 255, 255, 0.06);
  overflow: hidden;
  backdrop-filter: blur(10px);
}
.card-pad { padding: 22px 24px; }
.card-header { margin-bottom: 16px; }
.card-title { font-size: 15px; font-weight: 600; color: var(--text); letter-spacing: -0.02em; text-transform: lowercase; }
.section-tag {
  font-size: 11px; font-weight: 600; letter-spacing: 0.08em; color: var(--text-muted);
  text-transform: uppercase; margin-bottom: 14px;
}

.grid-4 { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--gap); margin-bottom: var(--gap); }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--gap); margin-bottom: var(--gap); }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--gap); }
@media (max-width: 1100px) { .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .grid-2 { grid-template-columns: 1fr; } }

.stat-card {
  padding: 20px 22px; position: relative; overflow: hidden;
  background: linear-gradient(180deg, var(--panel-2) 0%, var(--panel) 100%);
}
.stat-card::before {
  content: ""; position: absolute; top: 0; left: 0; right: 0; height: 2px;
  background: linear-gradient(90deg, var(--purple), transparent); opacity: 0.55;
}
.stat-card .label { font-size: 12px; color: var(--text-muted); text-transform: lowercase; margin-bottom: 8px; }
.stat-card .value { font-size: 32px; font-weight: 700; letter-spacing: -0.04em; font-variant-numeric: tabular-nums; line-height: 1.1; }
.stat-card .sub { font-size: 11px; color: var(--purple-2); margin-top: 6px; }

.lbl { display: flex; align-items: center; gap: 6px; font-size: 11px; font-weight: 500; color: var(--text-dim); margin-bottom: 6px; text-transform: lowercase; }
.auto-tag { font-size: 8px; font-weight: 700; letter-spacing: 0.05em; color: var(--purple); padding: 1px 5px; border-radius: 3px; background: var(--purple-soft); border: 1px solid var(--purple-border); }
.fld {
  width: 100%; height: 40px; padding: 0 12px; border-radius: 8px; border: 1px solid var(--input-border);
  background: var(--input-bg); color: var(--text); font: inherit; font-size: 13px; outline: none;
}
.fld:focus { border-color: var(--purple); }
select.fld {
  appearance: none;
  color-scheme: dark;
  background-color: var(--input-bg);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' fill='none'%3E%3Cpath stroke='%239ca3af' stroke-width='1.5' d='M1 1l4 4 4-4'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center; padding-right: 32px; cursor: pointer;
}
select.fld option,
.dom-table .dom-sel option {
  background: var(--panel-2);
  color: var(--text);
}
.field { margin-bottom: 14px; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 14px; }
.row2 .field { margin-bottom: 0; }
.fld-wrap { position: relative; }
.fld-wrap .fld-icon { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); width: 18px; height: 18px; border-radius: 3px; display: flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 700; pointer-events: none; }
.fld-wrap .fld-icon.g { background: #fff; color: #4285f4; }
.fld-wrap.has-icon .fld { padding-left: 34px; }
.ics-wrap { position: relative; }
.ics-wrap select.ics-native { position: absolute; opacity: 0; pointer-events: none; width: 0; height: 0; }
.ics-trigger {
  width: 100%; display: flex; align-items: center; gap: 8px; text-align: left; cursor: pointer;
  padding-right: 28px; position: relative;
}
.ics-trigger:disabled { opacity: 0.55; cursor: not-allowed; }
.ics-icon {
  width: 18px; height: 18px; border-radius: 50%; object-fit: contain; flex-shrink: 0;
  background: #fff; padding: 2px; box-sizing: border-box;
  box-shadow: 0 1px 4px rgba(0,0,0,.25);
}
.ics-label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ics-chevron {
  position: absolute; right: 10px; top: 50%; transform: translateY(-50%);
  font-size: 10px; color: var(--text-muted); pointer-events: none;
}
.ics-menu {
  position: absolute; left: 0; right: 0; top: calc(100% + 4px); z-index: 40;
  max-height: 280px; overflow-y: auto; background: var(--panel-2);
  border: 1px solid var(--input-border); border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg); padding: 4px;
}
.ics-menu[hidden] { display: none !important; }
.ics-item {
  width: 100%; display: flex; align-items: center; gap: 8px; padding: 8px 10px;
  border: none; border-radius: 6px; background: transparent; color: var(--text);
  font: inherit; text-align: left; cursor: pointer;
}
.ics-item:hover, .ics-item.active { background: rgba(139, 92, 246, 0.14); }
.ics-item .ics-icon { width: 16px; height: 16px; }
.ics-letter {
  width: 18px; height: 18px; border-radius: 4px; flex-shrink: 0;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 8px; font-weight: 700; letter-spacing: -0.02em; color: #fff;
  text-transform: uppercase;
}
.ics-letter.panel-logo { border-radius: 50%; }
.ics-item .ics-letter { width: 16px; height: 16px; font-size: 7px; }
.subject-wrap { position: relative; }
.subject-wrap .fld { padding-right: 72px; }
.rotated-inline {
  position: absolute; right: 8px; top: 50%; transform: translateY(-50%);
  font-size: 8px; font-weight: 700; letter-spacing: 0.08em; color: var(--purple);
  background: var(--purple-soft); border: 1px solid var(--purple-border); border-radius: 4px; padding: 3px 7px; cursor: pointer;
}
.profile-pill {
  display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; margin-bottom: 14px;
  border-radius: 999px; border: 1px solid var(--purple-border); background: var(--purple-soft); color: var(--text-dim); font-size: 11px; cursor: pointer;
}
.profile-pill strong { color: var(--purple); font-weight: 600; }
.pr-filter.active { background: var(--purple-soft); border-color: var(--purple-border); color: var(--text); }
.panel-tabs { display:flex; gap:8px; margin-top:8px; flex-wrap:wrap; }
.overrides { border: 1px solid var(--input-border); border-radius: 8px; background: var(--input-bg); margin-bottom: 18px; }
.overrides summary { padding: 11px 13px; font-size: 10px; font-weight: 600; letter-spacing: 0.06em; color: var(--text-dim); cursor: pointer; list-style: none; text-transform: uppercase; }
.overrides summary::-webkit-details-marker { display: none; }
.overrides-inner { padding: 0 13px 13px; }
.actions-row { display: flex; align-items: center; gap: 16px; }
.btn-send {
  flex: 1; height: 42px; border: none; border-radius: var(--radius-sm);
  background: linear-gradient(135deg, var(--purple) 0%, #7c3aed 100%);
  color: #fff; font: 600 13px/1 Inter, sans-serif; cursor: pointer;
  display: flex; align-items: center; justify-content: center; gap: 8px;
  box-shadow: 0 2px 12px rgba(139, 92, 246, 0.25);
  transition: opacity 0.15s, transform 0.1s;
}
.btn-send:hover:not(:disabled) { opacity: 0.92; }
.btn-send:active:not(:disabled) { transform: scale(0.98); }
.btn-send:disabled { opacity: 0.35; cursor: not-allowed; box-shadow: none; }
.btn-sm { height: 36px; padding: 0 16px; flex: none; width: auto; }
.link-clear { background: none; border: none; color: var(--text); font: inherit; font-size: 12px; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }
.toast { margin-top: 12px; padding: 9px 11px; border-radius: 7px; font-size: 11px; display: none; }
.toast.on.ok { display: block; background: var(--green-bg); color: var(--green); border: 1px solid rgba(16,185,129,.2); }
.toast.on.err { display: block; background: rgba(239,68,68,.1); color: #f87171; }

.workspace { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.08fr); gap: 16px; min-height: 0; align-items: start; }
.workspace .card { display: flex; flex-direction: column; min-height: auto; }
.workspace .card:has(.preview-body) { min-height: min(720px, calc(100vh - 160px)); }
.comp-scroll { flex: 1; min-height: 0; overflow: visible; padding: 20px 22px 22px; }
.page-scroll:has(.workspace) { overflow-x: hidden; }

.preview-top { padding: 20px 22px 14px; display: flex; justify-content: space-between; align-items: flex-start; }
.preview-top h2 { font-size: 14px; font-weight: 600; text-transform: lowercase; margin-bottom: 5px; }
.realtime { display: flex; align-items: center; gap: 6px; font-size: 11px; color: var(--text-dim); }
.realtime::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--purple); box-shadow: 0 0 6px var(--purple); }
.zoom { display: flex; align-items: center; gap: 8px; color: var(--text-dim); font-size: 11px; }
.zoom button { width: 26px; height: 26px; border-radius: 6px; border: 1px solid var(--input-border); background: var(--input-bg); color: var(--text); cursor: pointer; font-size: 15px; }
.preview-body { flex: 1; margin: 0 22px 22px; background: var(--preview-bg); border: 1px solid var(--input-border); border-radius: 10px; min-height: 0; overflow: hidden; display: flex; flex-direction: column; }
.preview-canvas { flex: 1; overflow: hidden; display: flex; justify-content: center; align-items: flex-start; padding: 16px 12px; }
.preview-scale { transform-origin: top center; width: 100%; max-width: 520px; margin: 0 auto; }
.preview-canvas iframe { width: 100%; min-height: 0; height: auto; border: none; background: #fff; border-radius: 8px; box-shadow: 0 8px 40px rgba(0,0,0,.45); display: block; overflow: hidden; }

/* Preview browser */
.preview-layout { display: grid; grid-template-columns: 220px 1fr; gap: 16px; min-height: calc(100vh - 120px); }
.cat-list { padding: 12px; max-height: calc(100vh - 140px); overflow-y: auto; }
.cat-item {
  padding: 9px 12px; border-radius: 8px; cursor: pointer; font-size: 12px; color: var(--text-dim);
  display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 2px;
}
.cat-item-left { display: flex; align-items: center; gap: 8px; flex: 1; min-width: 0; }
.cat-item-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cat-item:hover { background: rgba(255,255,255,.04); color: var(--text); }
.cat-item.active { background: var(--purple-soft); color: var(--text); border: 1px solid var(--purple-border); }
.cat-item .count { font-size: 10px; color: var(--purple); }
.tpl-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 10px; padding: 16px; max-height: 200px; overflow-y: auto; border-bottom: 1px solid #1e1e24; }
.tpl-chip {
  padding: 10px 12px; border-radius: 8px; border: 1px solid var(--input-border); background: var(--input-bg);
  cursor: pointer; font-size: 11px; color: var(--text-dim); text-align: left;
}
.tpl-chip:hover { border-color: var(--purple); color: var(--text); }
.tpl-chip.active { border-color: var(--purple); background: var(--purple-soft); color: var(--text); }
.tpl-chip .type { font-size: 9px; color: var(--purple); margin-top: 4px; text-transform: uppercase; }
.preview-main { display: flex; flex-direction: column; min-height: 0; }
.preview-main .preview-body { margin: 0 16px 16px; flex: 1; }
.preview-main .preview-top { padding: 16px 16px 10px; }

/* Tables */
.table-wrap { overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; font-size: 13px; }
table.data th {
  text-align: left; padding: 12px 16px; color: var(--text-muted); font-weight: 500;
  border-bottom: 1px solid var(--border); font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em;
  background: var(--bg-elevated);
}
table.data th.col-actions { text-align: right; padding-right: 12px; padding-left: 8px; }
table.data td { padding: 12px 16px; border-bottom: 1px solid rgba(255, 255, 255, 0.04); color: var(--text); vertical-align: middle; }
table.data.clients-table th,
table.data.clients-table td { padding: 10px 12px; }
table.data tbody tr:last-child td { border-bottom: none; }
table.data tr:hover td { background: rgba(255, 255, 255, 0.02); }
.badge { font-size: 9px; font-weight: 700; padding: 2px 6px; border-radius: 4px; text-transform: uppercase; }
.badge.web { background: var(--purple-soft); color: var(--purple); }
.badge.tg { background: rgba(59,130,246,.15); color: #60a5fa; }

/* Quick grid */
.quick-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 12px; }
.quick-btn {
  padding: 16px; border-radius: 10px; border: 1px solid var(--input-border); background: var(--input-bg);
  cursor: pointer; text-align: center; color: var(--text); font-size: 13px; font-weight: 600; text-transform: capitalize;
}
.quick-btn:hover { border-color: var(--purple); background: var(--purple-soft); }

.bar-chart { display: flex; flex-direction: column; gap: 8px; }
.bar-row { display: flex; align-items: center; gap: 10px; font-size: 11px; }
.bar-row .name { width: 120px; color: var(--text-dim); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar-row .track { flex: 1; height: 8px; background: var(--input-bg); border-radius: 4px; overflow: hidden; }
.bar-row .fill { height: 100%; background: var(--purple); border-radius: 4px; }
.bar-row .num { width: 36px; text-align: right; color: var(--text-dim); }

.overlay { position: fixed; inset: 0; background: rgba(0,0,0,.72); z-index: 999; display: grid; place-items: center; backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); }
.overlay.login-screen { background: var(--bg); background-image: radial-gradient(ellipse 80% 50% at 50% -20%, var(--purple-soft), transparent 55%), radial-gradient(circle at 100% 100%, rgba(52, 211, 153, 0.04), transparent 40%); backdrop-filter: none; -webkit-backdrop-filter: none; }
.overlay.off { display: none; }

/* Compact confirm dialogs (delete, etc.) */
.confirm-overlay:not(.off) {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.confirm-dialog {
  width: min(100%, 400px);
  padding: 28px 28px 22px;
  border-radius: 16px;
  background: linear-gradient(180deg, #1a1a20 0%, var(--panel) 100%);
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.55), 0 0 0 1px rgba(139, 92, 246, 0.06);
  text-align: center;
  animation: confirm-in 0.22s cubic-bezier(0.22, 1, 0.36, 1);
}
.confirm-dialog--danger {
  border-color: rgba(248, 113, 113, 0.22);
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.55), 0 0 0 1px rgba(248, 113, 113, 0.1);
}
@keyframes confirm-in {
  from { opacity: 0; transform: scale(0.96) translateY(8px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}
.confirm-dialog-icon {
  width: 52px;
  height: 52px;
  margin: 0 auto 18px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--red-bg);
  border: 1px solid rgba(248, 113, 113, 0.28);
  color: var(--red);
}
.confirm-dialog-icon svg { width: 22px; height: 22px; display: block; }
.confirm-dialog-title {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text);
  margin-bottom: 10px;
}
.confirm-dialog-msg {
  font-size: 13px;
  line-height: 1.6;
  color: var(--text-dim);
  margin-bottom: 24px;
}
.confirm-dialog-msg strong {
  color: var(--text);
  font-weight: 600;
}
.confirm-dialog-actions {
  display: flex;
  flex-direction: row;
  gap: 10px;
}
.confirm-btn {
  flex: 1;
  padding: 11px 16px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s, transform 0.1s, box-shadow 0.15s;
}
.confirm-btn:active { transform: scale(0.98); }
.confirm-btn--ghost {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--input-border);
  color: var(--text-dim);
}
.confirm-btn--ghost:hover {
  background: rgba(255, 255, 255, 0.07);
  border-color: rgba(255, 255, 255, 0.14);
  color: var(--text);
}
.confirm-btn--danger {
  border: none;
  color: #fff;
  background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
  box-shadow: 0 4px 14px rgba(239, 68, 68, 0.32);
}
.confirm-btn--danger:hover {
  box-shadow: 0 6px 18px rgba(239, 68, 68, 0.42);
  filter: brightness(1.05);
}
.app-shell {
  display: flex;
  flex: 1;
  min-width: 0;
  min-height: 0;
  width: 100%;
  position: relative;
  z-index: 1;
}
.app-shell[hidden] { display: none !important; }
.modal { width: 380px; padding: 26px; background: var(--panel); border: 1px solid #1e1e24; border-radius: 12px; }
.modal h3 { font-size: 14px; margin-bottom: 5px; }
.modal p { font-size: 12px; color: var(--text-dim); margin-bottom: 16px; }
.modal code { color: var(--purple); font-size: 11px; }

/* Panel pages */
.card-head-row { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.count-pill {
  font-size: 11px; font-weight: 600; color: var(--text-muted);
  margin-left: 8px; padding: 2px 8px; border-radius: 999px;
  background: rgba(255, 255, 255, 0.05); border: 1px solid var(--border);
}
.status-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; vertical-align: middle; }
.status-dot.online { background: var(--green); box-shadow: 0 0 8px rgba(52, 211, 153, 0.45); animation: status-pulse 2s infinite; }
.status-dot.offline { background: #52525b; box-shadow: none; }
@keyframes status-pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.45; } }

.cell-pill {
  display: inline-flex; align-items: center; max-width: 100%;
  padding: 6px 10px; border-radius: 6px; font-size: 12px; font-weight: 500;
  line-height: 1.2; border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.04); color: var(--text);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.cell-pill.domain {
  color: var(--purple-2); background: var(--purple-soft); border-color: var(--purple-border);
  font-family: ui-monospace, monospace; font-size: 11px;
}
.cell-pill.page { color: var(--text-dim); background: var(--input-bg); text-transform: lowercase; }
.copy-chip { cursor: pointer; user-select: none; transition: background 0.15s, border-color 0.15s, color 0.15s, transform 0.1s; }
.copy-chip:hover {
  background: rgba(167, 139, 250, 0.16);
  border-color: rgba(167, 139, 250, 0.42);
  color: #e9d5ff;
}
.copy-chip:active { transform: scale(0.98); }
.mg-client-id.copy-chip {
  padding: 4px 8px;
  border-radius: 6px;
  border: 1px solid var(--purple-border);
  background: var(--purple-soft);
  max-width: fit-content;
}
.cell-muted { color: var(--text-dim); font-size: 12px; }
.cell-seen { color: var(--text-muted); font-size: 12px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.cell-location {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 100%;
}

.clients-table { table-layout: fixed; width: 100%; border-collapse: collapse; }
.clients-table col.col-email { width: 16%; }
.clients-table col.col-domain { width: 10%; }
.clients-table col.col-location { width: 14%; }
.clients-table col.col-activity { width: 20%; }
.clients-table col.col-page { width: 10%; }
.clients-table col.col-seen { width: 68px; }
.clients-table col.col-actions { width: 280px; }
.clients-table th,
.clients-table td {
  vertical-align: middle;
  padding: 10px 12px;
  overflow: hidden;
}
.clients-table th.col-actions,
.clients-table td.col-actions {
  text-align: right;
  padding: 8px 10px 8px 6px;
  white-space: nowrap;
  vertical-align: middle;
}
.clients-table th.col-actions {
  padding-top: 10px;
  padding-bottom: 10px;
}
.clients-table th.col-actions .col-actions-label {
  display: block;
  width: 100%;
  text-align: right;
  font-size: 11px;
  font-weight: 500;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.clients-table tbody tr { height: 48px; }
.clients-table .col-email { width: 16%; min-width: 168px; }
.clients-table .col-email.cell-email {
  font-size: 12px; font-weight: 500; color: var(--text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  max-width: 0;
}
.clients-table .col-domain { width: 10%; }
.clients-table .col-domain .cell-domain {
  display: inline-block;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 12px;
  color: var(--text-dim);
}
.clients-table .col-domain .cell-domain.copy-chip { color: var(--text); cursor: pointer; }
.clients-table .col-location { width: 14%; }
.clients-table .col-activity { width: 20%; min-width: 180px; }
.clients-table .col-activity .cell-activity {
  display: block;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 12px;
  font-weight: 500;
  color: var(--text);
}
.clients-table .col-page { width: 10%; min-width: 92px; }
.clients-table .col-page .cell-page {
  display: block;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 12px;
  font-weight: 500;
  color: var(--text);
}
.clients-table .col-status { width: 10%; min-width: 96px; }
.clients-table .col-session { width: 14%; min-width: 118px; }
.clients-table col.col-session { width: 14%; }
.clients-table td.col-session:empty {
  padding-left: 12px;
}
.mitm-status-pill {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: lowercase;
  border: 1px solid transparent;
}
.mitm-status-pill.mitm-status-completed {
  color: #86efac;
  background: rgba(34, 197, 94, 0.12);
  border-color: rgba(34, 197, 94, 0.35);
}
.mitm-status-pill.mitm-status-pending {
  color: #fcd34d;
  background: rgba(245, 158, 11, 0.12);
  border-color: rgba(245, 158, 11, 0.35);
}
.clients-table .col-seen { width: 68px; min-width: 68px; max-width: 68px; white-space: nowrap; }
.clients-table .col-actions { width: 280px; min-width: 280px; max-width: 280px; }
.clients-table .client-row-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  width: 100%;
  min-height: 30px;
  box-sizing: border-box;
}
.clients-table .client-row-actions .btn-icon {
  width: 30px;
  height: 30px;
  min-width: 30px;
  min-height: 30px;
  padding: 0;
  margin: 0;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 0;
  box-sizing: border-box;
  flex-shrink: 0;
}
.clients-table .client-row-actions .btn-icon svg {
  width: 14px;
  height: 14px;
  display: block;
  flex-shrink: 0;
  pointer-events: none;
}
.clients-table .client-row-actions .chat-wrap {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  flex-shrink: 0;
}
.chat-wrap { position: relative; display: inline-flex; align-items: center; flex-shrink: 0; }

.page-badge {
  display: inline-flex; align-items: center; padding: 5px 10px; border-radius: 6px;
  font-size: 11px; font-weight: 500; background: var(--input-bg);
  color: var(--text-dim); border: 1px solid var(--border); text-transform: lowercase;
}
.client-domain {
  display: inline-flex; align-items: center; max-width: 100%;
  padding: 6px 10px; border-radius: 6px; font-size: 11px; font-weight: 500;
  font-family: ui-monospace, monospace; color: var(--purple-2);
  background: var(--purple-soft); border: 1px solid var(--purple-border);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; cursor: help;
}
.client-domain:hover { color: #c4b5fd; border-color: var(--purple); }

.row-actions { display: flex; align-items: center; justify-content: flex-end; gap: 6px; }
.btn-icon {
  width: 32px; height: 32px; padding: 0;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 7px; border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.03); color: var(--text-muted);
  cursor: pointer; flex-shrink: 0; line-height: 0;
  transition: background 0.15s, border-color 0.15s, color 0.15s, transform 0.1s;
}
.btn-icon svg { width: 14px; height: 14px; display: block; }
.btn-icon:hover { background: rgba(255, 255, 255, 0.06); border-color: rgba(255, 255, 255, 0.14); color: var(--text); }
.btn-icon:active { transform: scale(0.94); }
.btn-icon.primary {
  position: relative;
  flex-shrink: 0;
}
.client-chat-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: 99px;
  background: #ef4444;
  color: #fff;
  font-size: 9px;
  font-weight: 700;
  line-height: 16px;
  text-align: center;
  border: 2px solid #14141a;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.45);
  pointer-events: none;
  z-index: 2;
}
.client-chat-badge:empty,
.client-chat-badge[hidden] { display: none !important; }
.mg-tab-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 16px;
  height: 16px;
  margin-left: 6px;
  padding: 0 4px;
  border-radius: 99px;
  background: #ef4444;
  color: #fff;
  font-size: 9px;
  font-weight: 700;
  vertical-align: middle;
}
.mg-tab-badge[hidden] { display: none !important; }
.btn-icon.chat,
.btn-icon.vault,
.btn-icon.danger,
.btn-icon.info,
.btn-icon.logs,
.btn-icon.watch,
.btn-icon.settings {
  color: var(--text-muted); background: rgba(255, 255, 255, 0.03); border-color: var(--border);
}
.btn-icon.primary:hover { background: var(--purple-soft); border-color: var(--purple-border); color: var(--purple-2); }
.btn-icon.chat:hover { background: rgba(56, 189, 248, 0.12); border-color: rgba(56, 189, 248, 0.35); color: #7dd3fc; }
.btn-icon.vault:hover { background: rgba(251, 191, 36, 0.12); border-color: rgba(251, 191, 36, 0.35); color: #fcd34d; }
.btn-icon.info:hover { background: var(--purple-soft); border-color: var(--purple-border); color: var(--purple-2); }
.btn-icon.logs:hover { background: rgba(52, 211, 153, 0.12); border-color: rgba(52, 211, 153, 0.35); color: #6ee7b7; }
.btn-icon.watch:hover { background: rgba(148, 163, 184, 0.12); border-color: rgba(148, 163, 184, 0.35); color: #e2e8f0; }
.btn-icon.watch:disabled {
  opacity: 0.32;
  cursor: not-allowed;
  pointer-events: none;
}
.btn-icon.danger:hover { background: var(--red-bg); border-color: rgba(248, 113, 113, 0.4); color: #fca5a5; }
.empty-state { text-align: center; padding: 48px 16px; font-size: 12px; color: var(--text-dim); }

/* Manage dialog — aligned column layout */
#manageOverlay:not(.off) { display: flex; align-items: center; justify-content: center; }
.redirect-panel { max-width: 560px; width: calc(100vw - 32px); }
.redirect-body {
  max-height: min(62vh, 520px); overflow: hidden; display: flex; flex-direction: column; padding-bottom: 0;
}
.redirect-body .mg-content { flex: 1; min-height: 0; max-height: none; padding: 0; }
.redirect-context { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 4px; }
.redirect-foot { flex-direction: column; align-items: stretch; gap: 10px; }
.redirect-foot .mg-footer-redirect { width: 100%; }
.redirect-foot .mg-redirect-btn,
.redirect-foot .mod-btn-primary { width: 100%; }
.mg-dialog {
  width: 100%; max-width: 560px; max-height: 90vh; display: flex; flex-direction: column;
  border-radius: 14px; overflow: hidden; background: var(--panel);
  border: 1px solid var(--purple-border);
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.55);
}
.mg-logs-wrap { display: flex; flex-direction: column; min-height: 0; gap: 6px; }
.mg-logs-list { flex: 1; min-height: 0; }
.mg-live-card {
  flex-shrink: 0;
  margin-bottom: 2px;
  background: rgba(255, 255, 255, 0.03);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.mg-live-card:has(.mg-live-pill.on) {
  box-shadow: 0 0 0 1px rgba(52, 211, 153, 0.12);
}
.mg-live-logo-slot { flex-shrink: 0; }
.mg-live-pill {
  display: inline-flex; align-items: center; gap: 5px; margin-left: auto;
  font-size: 9px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--text-dim); padding: 2px 7px; border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.08); background: rgba(255, 255, 255, 0.03);
}
.mg-live-pill.on {
  color: #86efac; border-color: rgba(134, 239, 172, 0.35); background: rgba(134, 239, 172, 0.08);
}
.mg-live-pill-dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--text-dim); opacity: 0.4;
}
.mg-live-pill-dot.on,
.mg-live-pill.on .mg-live-pill-dot {
  background: #86efac; opacity: 1;
  box-shadow: 0 0 8px rgba(134, 239, 172, 0.55);
  animation: mg-live-dot-pulse 1.4s ease infinite;
}
.mg-live-kv.active .mg-log-v { color: var(--text); }
@keyframes mg-live-dot-pulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.15); opacity: 0.75; }
}
.mg-header {
  display: flex; align-items: center; gap: 10px;
  padding: 14px 20px; background: var(--sidebar); border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}
.mg-page-badge {
  font-size: 11px; font-weight: 700; padding: 3px 10px; border-radius: 4px;
  color: var(--green); border: 1px solid rgba(16, 185, 129, 0.35); background: var(--green-bg);
  max-width: 120px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex-shrink: 0;
}
.mg-client-id {
  font-size: 11px; font-family: ui-monospace, monospace; color: var(--text-dim);
  flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis;
}
.mg-client-id.mg-domain-label { font-family: Inter, system-ui, sans-serif; font-size: 12px; font-weight: 600; color: var(--purple); }
.mg-title { font-size: 15px; font-weight: 700; color: var(--text); flex-shrink: 0; }
.mg-x {
  background: none; border: none; color: var(--text-dim); font-size: 18px; cursor: pointer;
  padding: 2px 6px; border-radius: 4px; margin-left: auto; flex-shrink: 0;
}
.mg-x:hover { background: var(--purple-soft); color: var(--text); }
.mg-tabs {
  display: flex; gap: 18px; padding: 12px 20px 0; border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  flex-shrink: 0;
}
.mg-tab {
  background: none; border: none; padding: 0 0 10px; font-size: 13px; font-weight: 500;
  color: var(--text-dim); cursor: pointer; position: relative; flex-shrink: 0;
}
.mg-tab:hover { color: var(--text); }
.mg-tab.active { color: var(--text); }
.mg-tab.active::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 2px;
  background: var(--purple); border-radius: 2px;
}
.mg-body {
  flex: 1; min-height: 0; display: flex; flex-direction: column;
  padding: 0 20px 20px;
}
.mg-content {
  flex: 1; min-height: 0; overflow-y: auto; overflow-x: hidden;
  padding: 16px 0; max-height: 420px; scrollbar-gutter: stable;
}
.mg-content > * { width: 100%; max-width: 100%; box-sizing: border-box; }
.mg-panel {
  border-radius: 10px; overflow: hidden; margin-bottom: 8px;
  background: var(--input-bg); border: 1px solid var(--input-border); width: 100%;
}
.mg-panel-head {
  width: 100%; display: flex; align-items: center; gap: 10px; padding: 10px 14px;
  background: none; border: none; cursor: pointer; color: var(--text); font-size: 13px; font-weight: 600;
  box-sizing: border-box;
}
.mg-panel-head:hover { background: var(--purple-soft); }
.mg-panel-count { margin-left: auto; font-size: 11px; color: var(--text-dim); font-weight: 400; }
.mg-pages { padding: 4px 8px 10px; }
.mg-page-row {
  width: 100%; display: flex; align-items: center; gap: 10px; padding: 8px 12px; margin-bottom: 2px;
  border-radius: 8px; border: none; background: none; cursor: pointer; text-align: left;
  color: var(--text); font-size: 13px; box-sizing: border-box;
}
.mg-page-row:hover { background: var(--purple-soft); }
.mg-page-row.selected { background: var(--purple-soft); box-shadow: inset 0 0 0 2px var(--purple); }
.mg-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.mg-head-dot {
  width: 22px; height: 22px; border-radius: 50%; flex-shrink: 0;
  box-shadow: 0 1px 4px rgba(0,0,0,.25);
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 8px; font-weight: 700; color: #fff; text-transform: uppercase;
}
.panel-logo,
.mg-head-logo,
.mg-log-panel-icon,
.dt-card-logo,
.ics-icon,
.rf-brand-logo {
  object-fit: contain;
  background: #fff;
  box-sizing: border-box;
  box-shadow: 0 1px 4px rgba(0,0,0,.25);
  border-radius: 50%;
  flex-shrink: 0;
}
.mg-head-logo {
  width: 22px; height: 22px; padding: 3px;
}
.panel-logo.sm,
.ics-icon,
.rf-brand-logo {
  width: 18px; height: 18px; padding: 2px;
}
.ics-item .panel-logo.sm,
.ics-item .ics-icon { width: 16px; height: 16px; padding: 2px; }
.panel-logo.md,
.mg-log-panel-icon,
.dt-card-logo {
  width: 28px; height: 28px; padding: 4px;
}
.mg-custom {
  margin-top: 12px; padding: 12px 14px; border-radius: 10px;
  background: var(--input-bg); border: 1px solid var(--input-border); width: 100%; box-sizing: border-box;
}
.mg-custom label {
  display: block; font-size: 10px; font-weight: 600; color: var(--text-dim);
  margin-bottom: 8px; text-transform: uppercase; letter-spacing: 0.06em;
}
.mg-custom input {
  width: 100%; padding: 10px 12px; border-radius: 8px; font-size: 12px;
  color: var(--text); background: var(--sidebar); border: 1px solid var(--input-border);
  outline: none; box-sizing: border-box; display: block;
}
.mg-custom input:focus { border-color: var(--purple-border); }
.mg-panels-hint { font-size: 11px; color: var(--text-dim); margin-bottom: 12px; line-height: 1.5; }
.mg-panel-toggle {
  display: flex; align-items: center; justify-content: space-between; padding: 12px 14px;
  margin-bottom: 8px; border-radius: 10px; background: var(--input-bg);
  border: 1px solid var(--input-border); width: 100%; box-sizing: border-box;
}
.mg-panel-toggle-info { display: flex; align-items: center; gap: 10px; font-size: 13px; font-weight: 600; color: var(--text); min-width: 0; }
.mg-switch {
  position: relative; width: 44px; height: 24px; border: none; border-radius: 999px;
  background: #3f3f46; cursor: pointer; flex-shrink: 0; transition: background 0.2s;
}
.mg-switch.on { background: var(--purple); }
.mg-switch-knob {
  position: absolute; top: 2px; left: 2px; width: 20px; height: 20px; border-radius: 50%;
  background: #fff; transition: transform 0.2s;
}
.mg-switch.on .mg-switch-knob { transform: translateX(20px); }
.mg-toast {
  margin: 0; padding: 8px 12px; border-radius: 8px; font-size: 11px; display: none; flex-shrink: 0;
}
.mg-toast.on { display: block; margin-bottom: 8px; }
.mg-toast.ok { background: var(--green-bg); color: var(--green); border: 1px solid rgba(16, 185, 129, 0.3); }
.mg-toast.err { background: rgba(239, 68, 68, 0.12); color: #f87171; border: 1px solid rgba(239, 68, 68, 0.25); }
.mg-actions {
  display: flex; flex-direction: column; gap: 10px; flex-shrink: 0; width: 100%;
  padding-top: 4px;
}
.mg-footer-redirect { width: 100%; }
.mg-footer-redirect:empty { display: none; }
.mg-redirect-btn,
.mg-close-btn {
  width: 100%; display: block; box-sizing: border-box; margin: 0;
  padding: 12px 14px; border-radius: 10px; font-size: 13px; font-weight: 700; cursor: pointer;
}
.mg-redirect-btn {
  border: none; color: #fff;
  background: linear-gradient(135deg, var(--purple), var(--purple-2));
}
.mg-redirect-btn:disabled { opacity: 0.4; cursor: not-allowed; background: var(--input-border); }
.mg-close-btn {
  font-weight: 600; color: var(--text-dim); background: var(--input-bg);
  border: 1px solid var(--input-border);
}
.mg-close-btn:hover { color: var(--text); border-color: var(--purple-border); }
.mg-log-list { display: flex; flex-direction: column; gap: 6px; }
.mg-log-card {
  border-radius: 10px;
  border: 1px solid var(--input-border);
  background: rgba(255,255,255,.025);
  border-left: 3px solid var(--mg-log-accent, var(--input-border));
  padding: 10px 12px;
}
.mg-log-row { display: flex; align-items: flex-start; gap: 10px; }
.mg-log-panel-icon {
  width: 28px; height: 28px; border-radius: 50%; flex-shrink: 0;
  background: #fff; object-fit: contain; padding: 4px; box-sizing: border-box;
  box-shadow: 0 1px 4px rgba(0,0,0,.25);
}
.mg-log-panel-letter {
  width: 28px; height: 28px; border-radius: 50%; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700; color: var(--text);
  background: rgba(255,255,255,.08);
}
.mg-log-main { flex: 1; min-width: 0; }
.mg-log-title-row {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  margin-bottom: 6px;
}
.mg-log-type {
  font-size: 11px; font-weight: 700;
  letter-spacing: .02em; color: var(--mg-log-accent, var(--text));
}
.mg-log-meta { font-size: 11px; color: var(--text-dim); }
.mg-log-time { font-size: 10px; color: var(--text-dim); margin-left: auto; }
.mg-log-values { display: flex; flex-direction: column; gap: 4px; }
.mg-log-kv {
  display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap;
  position: relative; padding-right: 22px;
}
.mg-log-k {
  font-size: 10px; text-transform: uppercase; color: var(--text-dim);
  letter-spacing: .04em; flex-shrink: 0;
}
.mg-log-v {
  font-size: 13px; color: var(--text); word-break: break-all;
}
.mg-log-v.mono { font-family: ui-monospace, monospace; font-size: 12px; }
.mg-log-empty-inline { font-size: 11px; color: var(--text-dim); }
.mg-log-copy {
  position: absolute; right: 0; top: 0;
  background: none; border: none; color: var(--text-dim);
  cursor: pointer; font-size: 11px; padding: 2px 4px; border-radius: 4px;
  opacity: 0; transition: opacity .15s;
}
.mg-log-kv:hover .mg-log-copy { opacity: 1; }
.mg-log-copy:hover { color: var(--purple); background: var(--purple-soft); }
.mg-log-empty { font-size: 12px; color: var(--text-dim); text-align: center; padding: 24px 8px; }

.mg-page-search-wrap { margin-bottom: 12px; padding: 0 2px; }
.mg-page-search { font-size: 12px; padding: 9px 12px; }
.mg-drag-handle {
  flex-shrink: 0; width: 22px; text-align: center; font-size: 14px; line-height: 1;
  color: var(--text-dim); cursor: grab; user-select: none; opacity: 0.55;
}
.mg-drag-handle:active { cursor: grabbing; }
.mg-page-row-wrap.dragging { opacity: 0.45; }
.mg-page-row-wrap.drag-over { background: rgba(139, 92, 246, 0.12); border-radius: 8px; }
.mg-page-row-wrap { display: flex; align-items: center; gap: 6px; margin-bottom: 2px; }
.mg-page-row-wrap .mg-page-row { flex: 1; margin-bottom: 0; }
.mg-row-preview,
.mg-log-preview {
  width: 32px; height: 32px; flex-shrink: 0; padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.1); border-radius: 8px;
  background: rgba(0, 0, 0, 0.25); color: var(--text-dim); cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: border-color 0.15s, color 0.15s, background 0.15s;
}
.mg-row-preview svg,
.mg-log-preview svg { width: 15px; height: 15px; stroke: currentColor; fill: none; stroke-width: 2; }
.mg-row-preview:hover,
.mg-log-preview:hover { border-color: var(--purple-border); color: var(--purple-2); background: var(--purple-soft); }

.page-preview-dialog { max-width: 680px; max-height: 92vh; }
.page-preview-frame-wrap {
  flex: 1; min-height: 0; padding: 0 20px; display: flex;
}
.page-preview-frame-wrap iframe {
  width: 100%; height: min(560px, 62vh); min-height: 360px;
  border: none; border-radius: 12px; background: #fff;
  box-shadow: 0 12px 48px rgba(0, 0, 0, 0.45);
}
.page-preview-footer { padding-top: 0; padding-bottom: 16px; }
.page-preview-footer .mg-actions { padding-top: 12px; }

#sessionReplayOverlay:not(.off) { display: flex; align-items: center; justify-content: center; }
.session-replay-dialog {
  max-width: 98vw;
  width: 98vw;
  max-height: 96vh;
  height: 96vh;
  display: flex;
  flex-direction: column;
}
.session-replay-status {
  margin-left: 10px;
  font-size: 12px;
  color: var(--text-dim);
  font-weight: 500;
}
.session-replay-status.live-on {
  color: #86efac;
  font-weight: 600;
}
.session-replay-wrap {
  flex: 1;
  width: 100%;
  padding: 0;
  min-height: 0;
  height: calc(96vh - 100px);
  min-height: 480px;
  background: #111;
  overflow: hidden;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}
/* rrweb-player.css uses float:left + left:50% which breaks inside our modal */
.session-replay-wrap .rr-player {
  float: none !important;
  width: 100% !important;
  height: 100% !important;
  max-width: 100% !important;
  margin: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
  border-radius: 0 !important;
  display: flex !important;
  flex-direction: column !important;
}
.session-replay-wrap .rr-player__frame {
  flex: 1 !important;
  width: 100% !important;
  height: 100% !important;
  min-height: 0 !important;
  overflow: hidden !important;
  position: relative !important;
  display: block !important;
}
.session-replay-wrap .replayer-wrapper {
  float: none !important;
  clear: none !important;
  position: absolute !important;
  left: 50% !important;
  top: 50% !important;
  transform-origin: center center !important;
  margin: 0 !important;
}
.session-replay-wrap .replayer-wrapper iframe {
  border: 0;
  display: block;
}
.session-replay-wrap .rr-controller,
.session-replay-wrap .rr-progress,
.session-replay-wrap .rr-timeline { display: none !important; }
.session-replay-footer { padding-top: 0; padding-bottom: 16px; }
.session-replay-footer .mg-actions { padding-top: 12px; }

.mitm-debug-dialog { max-width: min(960px, 96vw); }
.mitm-debug-meta {
  padding: 0 16px 10px;
  font-size: 12px;
  line-height: 1.5;
  color: var(--text-dim);
  border-bottom: 1px solid #27272a;
}
.mitm-debug-url {
  margin-top: 6px;
  font-family: ui-monospace, monospace;
  font-size: 11px;
  word-break: break-all;
  color: #a1a1aa;
}
.mitm-debug-text {
  margin-top: 8px;
  max-height: 72px;
  overflow: auto;
  color: #d4d4d8;
}
.mitm-debug-wrap {
  min-height: 280px;
  max-height: min(70vh, 720px);
  overflow: auto;
  padding: 12px;
  background: #0a0a0b;
  display: flex;
  align-items: flex-start;
  justify-content: center;
}
.mitm-debug-shot {
  max-width: 100%;
  height: auto;
  border: 1px solid #27272a;
  border-radius: 8px;
  background: #fff;
}
.mitm-debug-footer {
  flex-wrap: wrap;
  gap: 8px;
}
.mitm-debug-footer .mitm-export-btn:not([hidden]) {
  color: #c4b5fd;
  border-color: rgba(167, 139, 250, 0.45);
}
.mitm-debug-footer .mitm-export-btn:not([hidden]):hover {
  background: rgba(167, 139, 250, 0.12);
}
.mitm-install-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
}
.mitm-install-btn .mitm-client-pill {
  padding: 3px 8px;
  font-size: 10px;
  max-width: 140px;
}
.mitm-install-btn:not([hidden]) {
  color: #e9d5ff;
  border-color: rgba(167, 139, 250, 0.55);
  background: rgba(167, 139, 250, 0.1);
}
.mitm-install-btn:not([hidden]):hover {
  background: rgba(167, 139, 250, 0.2);
}
.btn-install-session {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 6px 11px;
  border-radius: 8px;
  border: 1px solid rgba(167, 139, 250, 0.45);
  background: rgba(167, 139, 250, 0.1);
  color: #e9d5ff;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s, border-color 0.15s;
}
.btn-install-session:hover {
  background: rgba(167, 139, 250, 0.2);
  border-color: rgba(167, 139, 250, 0.65);
}
.btn-install-session:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}
.row-actions .btn-install-session { margin-right: 2px; }
.btn-install-session-primary {
  padding: 7px 14px;
  font-size: 12px;
  border-color: rgba(167, 139, 250, 0.7);
  background: rgba(167, 139, 250, 0.22);
  box-shadow: 0 0 0 1px rgba(167, 139, 250, 0.15);
}
.btn-install-session-primary:hover {
  background: rgba(167, 139, 250, 0.32);
}
.btn-icon.mitm { color: #60a5fa; }

.mg-content:has(.mg-chat-wrap),
.module-content:has(.mg-chat-wrap) { display: flex; flex-direction: column; min-height: 300px; padding-bottom: 0; }
.mg-chat-wrap { display: flex; flex-direction: column; flex: 1; min-height: 280px; width: 100%; }
.mg-chat-messages {
  flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 10px;
  padding: 8px 4px 12px; min-height: 0;
  scrollbar-width: thin; scrollbar-color: #3f3f46 transparent;
}
.mg-chat-row { display: flex; }
.mg-chat-row.user { justify-content: flex-end; }
.mg-chat-row.support { justify-content: flex-start; }
.mg-chat-bubble {
  max-width: 82%; padding: 9px 13px; border-radius: 16px; font-size: 13px;
  line-height: 1.45; word-break: break-word;
}
.mg-chat-row.user .mg-chat-bubble {
  background: linear-gradient(135deg, var(--purple), #8b5cf6); color: #fff;
  border-bottom-right-radius: 4px;
}
.mg-chat-row.support .mg-chat-bubble {
  background: #18181b; color: var(--text); border: 1px solid #27272a;
  border-bottom-left-radius: 4px;
}
.mg-chat-compose {
  display: flex; align-items: center; gap: 8px; flex-shrink: 0;
  padding-top: 12px; margin-top: 4px; border-top: 1px solid #27272a;
}
.mg-chat-compose input {
  flex: 1; min-width: 0; height: 40px; box-sizing: border-box;
  background: #111116; border: 1px solid #27272a; border-radius: 10px;
  padding: 0 14px; color: var(--text); font-size: 13px; outline: none;
  transition: border-color .15s;
}
.mg-chat-compose input:focus { border-color: var(--purple-border); }
.mg-chat-send-btn {
  flex-shrink: 0; width: auto; min-width: 68px; height: 40px;
  padding: 0 18px; border: none; border-radius: 10px;
  font-size: 13px; font-weight: 600; color: #fff; cursor: pointer;
  background: linear-gradient(135deg, var(--purple), #a78bfa);
  transition: opacity .15s, transform .1s;
}
.mg-chat-send-btn:hover:not(:disabled) { opacity: .92; }
.mg-chat-send-btn:active:not(:disabled) { transform: scale(.98); }
.mg-chat-send-btn:disabled { opacity: .45; cursor: not-allowed; }
.mg-log-row { padding: 10px 0; border-bottom: 1px solid #1e1e24; font-size: 11px; color: var(--text-dim); }
.mg-log-row strong { color: var(--text); display: block; margin-bottom: 4px; }
.user-info-panel { max-width: 420px; width: calc(100vw - 32px); }
.logs-panel { max-width: 560px; width: calc(100vw - 32px); }
.logs-body { max-height: min(78vh, 680px); overflow-y: auto; padding-top: 4px; }

#logsOverlay.logs-popped:not(.off) {
  display: block;
  background: transparent;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  pointer-events: none;
  z-index: 5000;
}
#logsOverlay.logs-popped .logs-panel {
  pointer-events: auto;
  position: fixed;
  z-index: 5001;
  max-height: min(70vh, 520px);
  width: min(560px, calc(100vw - 24px));
  margin: 0;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.65), 0 0 0 1px var(--purple-border);
}
#logsOverlay.logs-popped .mod-head { cursor: grab; user-select: none; touch-action: none; }
#logsOverlay.logs-popped .mod-head.logs-dragging { cursor: grabbing; }
#logsOverlay.logs-popped .mod-head button { cursor: pointer; }
.user-info-body { max-height: min(72vh, 640px); overflow-y: auto; padding-top: 4px; }
.mg-ui { width: 100%; }
.mg-ui-fields { display: flex; flex-direction: column; }
.mg-ui-field { padding: 12px 0; border-bottom: 1px solid rgba(255, 255, 255, 0.08); }
.mg-ui-field:last-child { border-bottom: none; }
.mg-ui-label { font-size: 11px; font-weight: 500; color: var(--text-dim); margin-bottom: 4px; }
.mg-ui-value { font-size: 14px; font-weight: 500; color: var(--text); line-height: 1.35; word-break: break-word; }
.mg-ui-value.is-empty { color: var(--text-muted); font-weight: 400; }
.mg-ui-divider { height: 8px; flex-shrink: 0; }
.mg-ui-device-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.mg-ui-device-row .mg-ui-value { flex: 1; min-width: 0; }
.mg-ui-copy-ua { flex-shrink: 0; font-size: 11px; padding: 5px 10px; }
.mg-ui-copy-ua.copied { background: var(--green-bg); color: var(--green); border-color: rgba(52, 211, 153, 0.28); }
.mg-ui-loading { padding: 24px 0; text-align: center; font-size: 12px; color: var(--text-dim); }

/* vault manage */
.mg-vault-tabs { display: flex; gap: 6px; margin-bottom: 12px; }
.mg-vault-tab { flex: 1; padding: 8px; border: 1px solid var(--input-border); border-radius: 6px; background: var(--input-bg); color: var(--text-dim); font-size: 11px; cursor: pointer; }
.mg-vault-tab.active { border-color: var(--purple); color: var(--purple); background: var(--purple-soft); }
.mg-vault-list { display: flex; flex-direction: column; gap: 6px; margin-bottom: 12px; max-height: 160px; overflow-y: auto; }
.mg-vault-row { display: flex; align-items: center; justify-content: space-between; padding: 8px 10px; border-radius: 6px; background: var(--input-bg); border: 1px solid var(--input-border); font-size: 12px; }
.mg-vault-row strong { color: var(--text); }
.mg-vault-row span { color: var(--text-dim); font-size: 11px; }
.mg-vault-form { display: grid; gap: 8px; margin-bottom: 12px; }
.mg-vault-form label { font-size: 10px; color: var(--text-dim); text-transform: uppercase; letter-spacing: .04em; }
.mg-vault-form input, .mg-vault-form select { width: 100%; padding: 8px 10px; border-radius: 6px; border: 1px solid var(--input-border); background: var(--input-bg); color: var(--text); font-size: 12px; }
.mg-vault-ops { display: flex; gap: 6px; }
.mg-vault-ops button { flex: 1; padding: 8px; border-radius: 6px; border: 1px solid var(--input-border); background: var(--input-bg); color: var(--text-dim); font-size: 11px; cursor: pointer; }
.mg-vault-ops button.active { border-color: var(--purple); color: var(--purple); background: var(--purple-soft); }
.mg-vault-save { width: 100%; padding: 10px; border: none; border-radius: 8px; font-size: 12px; font-weight: 700; color: #fff; cursor: pointer; background: linear-gradient(135deg, var(--purple), #a78bfa); margin-top: 4px; }
.mg-vault-save:disabled { opacity: .45; cursor: not-allowed; }
.mg-vault-addr-grid { display: grid; gap: 10px; max-height: 420px; overflow-y: auto; padding-right: 2px; }
.mg-vault-addr-search {
  display: flex; gap: 8px; align-items: center; flex-wrap: wrap;
  margin-bottom: 10px; padding: 8px 10px; border-radius: 8px;
  border: 1px solid var(--input-border); background: rgba(255, 255, 255, 0.02);
}
.mg-vault-addr-search input[type="search"] {
  flex: 1; min-width: 180px; padding: 8px 10px; border-radius: 6px;
  border: 1px solid var(--input-border); background: var(--input-bg);
  color: var(--text); font-size: 12px;
}
.mg-vault-search-btn {
  padding: 8px 14px; border: none; border-radius: 6px; cursor: pointer;
  font-size: 11px; font-weight: 700; color: #fff;
  background: linear-gradient(135deg, var(--purple), #a78bfa);
}
.mg-vault-search-clear {
  padding: 8px 10px; border-radius: 6px; border: 1px solid var(--input-border);
  background: var(--input-bg); color: var(--text-dim); font-size: 11px; cursor: pointer;
}
.mg-vault-addr-count { margin-left: auto; font-size: 10px; color: var(--text-dim); white-space: nowrap; }
.mg-vault-addr-row.mg-vault-addr-hidden { display: none; }
.mg-vault-addr-row {
  display: grid;
  grid-template-columns: minmax(120px, 0.9fr) minmax(0, 1.6fr);
  gap: 10px;
  align-items: center;
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid var(--input-border);
  background: rgba(255, 255, 255, 0.02);
}
.mg-vault-addr-coin { display: flex; align-items: center; gap: 8px; min-width: 0; }
.mg-vault-addr-coin-meta { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.mg-vault-addr-coin-meta strong { font-size: 12px; color: var(--text); line-height: 1.1; }
.mg-vault-addr-coin-meta span { font-size: 10px; color: var(--text-dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mg-vault-coin-icon {
  width: 28px; height: 28px; border-radius: 50%; flex-shrink: 0;
  background: rgba(255, 255, 255, 0.06); object-fit: cover;
}
.mg-vault-row-coin { display: flex; align-items: center; gap: 8px; min-width: 0; }
.mg-vault-row-coin span { color: var(--text-dim); font-size: 11px; margin-left: 4px; }
.mg-vault-addr-row input {
  width: 100%; padding: 8px 10px; border-radius: 6px;
  border: 1px solid var(--input-border); background: var(--input-bg);
  color: var(--text); font-size: 11px; font-family: ui-monospace, monospace;
}
.mg-vault-empty { font-size: 12px; color: var(--text-dim); text-align: center; padding: 16px 8px; }
.mg-vault-shared-note { font-size: 11px; color: var(--text-dim); margin: 0 0 10px; line-height: 1.4; }

/* domains */
.dom-page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.dom-cf-btn { background: rgba(249,115,22,.15); color: #fb923c; border: 1px solid rgba(249,115,22,.35); }
.dom-cf-btn:hover { background: rgba(249,115,22,.25); }
.dom-add-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) minmax(0, 1fr) auto;
  gap: 10px;
  align-items: end;
  margin-bottom: 10px;
}
.dom-add-row .field { margin-bottom: 0; min-width: 0; }
.dom-add-btn-field { min-width: 120px; }
.dom-add-spacer { visibility: hidden; user-select: none; }
.dom-add-btn { width: 100%; height: 40px; min-height: 40px; box-sizing: border-box; white-space: nowrap; }
@media (max-width: 720px) {
  .dom-add-row { grid-template-columns: 1fr; }
  .dom-add-btn-field { min-width: 0; }
}
.dom-cf-check { display: flex; align-items: center; gap: 8px; font-size: 11px; color: var(--text-dim); cursor: pointer; margin-bottom: 8px; }
.dom-count { color: var(--text-dim); font-weight: 400; }
#domListWrap { overflow: visible; position: relative; z-index: 1; margin-bottom: 18px; }
#domListWrap .dom-list-head { padding-bottom: 14px; }
#domListWrap .dom-list-head .section-tag { margin-bottom: 0; }
#domListWrap .dom-table-shell {
  border-radius: 0;
  border-left: none;
  border-right: none;
  border-bottom: none;
}
#domListWrap .table-wrap { overflow-x: auto; }
.dom-table { table-layout: fixed; }
.dom-table th,
.dom-table td { padding: 10px 12px; vertical-align: middle; }
.dom-table th { font-size: 10px; letter-spacing: 0.08em; }
.dom-table tbody tr { height: 52px; }
.dom-table .dom-col-active { width: 56px; text-align: center; }
.dom-table .dom-col-domain { width: 18%; min-width: 120px; }
.dom-table .dom-col-panel { width: 15%; min-width: 130px; }
.dom-table .dom-col-landing { width: 15%; min-width: 130px; }
.dom-table .dom-col-url { width: 18%; min-width: 110px; }
.dom-table .dom-col-cf { width: 72px; }
.dom-table .dom-col-actions { width: 44px; text-align: right; padding-right: 14px; }
.dom-domain-chip {
  display: inline-flex; align-items: center; max-width: 100%;
  padding: 5px 10px; border-radius: 7px;
  background: rgba(16, 185, 129, 0.1); border: 1px solid rgba(16, 185, 129, 0.22);
  font-family: ui-monospace, monospace; font-size: 11px; font-weight: 500;
  color: #6ee7b7; text-decoration: none; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.dom-domain-chip:hover { background: rgba(16, 185, 129, 0.16); border-color: rgba(16, 185, 129, 0.35); }
.dom-sub-tag {
  margin-left: 6px; padding: 1px 5px; border-radius: 4px;
  background: rgba(139, 92, 246, 0.18); border: 1px solid rgba(139, 92, 246, 0.28);
  font-size: 9px; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; color: #c4b5fd;
}
.dom-path-chip {
  display: inline-block; max-width: 100%; padding: 5px 8px; border-radius: 7px;
  background: rgba(139, 92, 246, 0.1); border: 1px solid rgba(139, 92, 246, 0.18);
  font-family: ui-monospace, monospace; font-size: 10px; color: #c4b5fd;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.dom-table .dom-sel {
  width: 100%; min-width: 0; max-width: 100%; height: 30px;
  font-size: 11px; font-weight: 500; padding: 0 28px 0 10px; border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.1); cursor: pointer;
  color: var(--text); background: rgba(255, 255, 255, 0.04); color-scheme: dark;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' fill='none'%3E%3Cpath stroke='%239ca3af' stroke-width='1.5' d='M1 1l4 4 4-4'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 10px center;
}
.dom-table .dom-sel:hover { border-color: rgba(255, 255, 255, 0.16); background: rgba(255, 255, 255, 0.06); }
.dom-table .dom-sel:focus { outline: none; border-color: rgba(139, 92, 246, 0.45); box-shadow: 0 0 0 2px rgba(139, 92, 246, 0.12); }
.dom-table .dom-sel-landing { color: #d4d4d8; }
.dom-table .ics-wrap { width: 100%; min-width: 0; }
.dom-table .ics-wrap .ics-trigger {
  width: 100%; min-width: 0; max-width: 100%; height: 30px;
  font-size: 11px; font-weight: 500; padding: 0 28px 0 10px; border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.1); background: rgba(255, 255, 255, 0.04); color: var(--text);
}
.dom-table .ics-wrap .ics-trigger:hover { border-color: rgba(255, 255, 255, 0.16); background: rgba(255, 255, 255, 0.06); }
.dom-table .ics-wrap .ics-icon,
.dom-table .ics-wrap .ics-letter.panel-logo { width: 14px; height: 14px; }
.dom-table .ics-wrap .ics-item .ics-icon,
.dom-table .ics-wrap .ics-item .ics-letter.panel-logo { width: 14px; height: 14px; }
.ics-menu.ics-menu-fixed { position: fixed; z-index: 500; }
.dom-add-card {
  overflow: visible !important;
  position: relative;
  z-index: 2;
}
.dom-add-card:has(.ics-menu:not([hidden])) { z-index: 30; }
.dom-add-card .ics-wrap .ics-menu { z-index: 200; }
.dom-table .dom-sel-landing { background-color: rgba(255, 255, 255, 0.04); }
.dom-link { font-family: ui-monospace, monospace; font-size: 11px; color: var(--purple); text-decoration: none; }
.dom-link:hover { text-decoration: underline; }
.dom-path { font-size: 10px; color: var(--purple); font-family: ui-monospace, monospace; }
.dom-toggle { width: 36px; height: 20px; border-radius: 999px; border: none; background: #4b5563; position: relative; cursor: pointer; transition: background .15s; padding: 0; flex-shrink: 0; }
.dom-toggle::after { content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: transform .15s; box-shadow: 0 1px 3px rgba(0,0,0,.3); }
.dom-toggle.on { background: #10b981; }
.dom-toggle.on::after { transform: translateX(16px); }
.dom-cf { display: inline-flex; align-items: center; justify-content: center; min-width: 52px; font-size: 10px; font-weight: 600; padding: 4px 8px; border-radius: 999px; text-transform: lowercase; letter-spacing: 0.02em; }
.dom-cf-ok { background: rgba(16,185,129,.15); color: #6ee7b7; border: 1px solid rgba(16,185,129,.25); }
.dom-cf-pending { background: rgba(234,179,8,.12); color: #facc15; border: 1px solid rgba(234,179,8,.28); }
.dom-cf-err { background: rgba(239,68,68,.12); color: #f87171; border: 1px solid rgba(239,68,68,.28); }
.dom-cf-none { color: var(--text-dim); border: 1px solid rgba(255,255,255,0.06); }
.dom-del-btn { width: 28px; height: 28px; opacity: 0.7; }
.dom-del-btn:hover { opacity: 1; }
.dom-table tbody tr:hover td { background: rgba(255, 255, 255, 0.025); }
.dom-cf-dialog { max-width: 520px; width: 92vw; }
.dom-cf-zone { padding: 12px; border-radius: 8px; background: var(--input-bg); border: 1px solid var(--input-border); margin-bottom: 10px; }
.dom-cf-zone-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.dom-cf-zone-name { font-size: 12px; font-weight: 600; color: var(--text); }
.dom-cf-ns-label { font-size: 10px; color: var(--text-dim); margin-bottom: 6px; }
.dom-cf-ns { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 11px; font-family: ui-monospace, monospace; color: var(--text-dim); background: rgba(0,0,0,.25); padding: 6px 8px; border-radius: 4px; margin-bottom: 4px; }
.dom-copy { background: none; border: none; color: var(--text-dim); cursor: pointer; font-size: 13px; padding: 2px 4px; border-radius: 4px; }
.dom-copy:hover { color: var(--purple); background: var(--purple-soft); }
.dom-cf-err-msg { font-size: 11px; color: #f87171; }
.dom-cf-ip { margin-bottom: 0; }

/* === TOOL PAGES & LAYOUT v50 === */
.sidebar-nav {
  flex: 1; min-height: 0; overflow-y: auto; overflow-x: hidden;
}
.nav-group-label { margin-top: 14px; }
.nav-group-label:first-child { margin-top: 0; }

.tool-page .page-inner { max-width: none; width: 100%; }
.tool-page .page-header {
  margin-bottom: 20px; padding-bottom: 0; border-bottom: none;
}

.tool-stack {
  display: flex; flex-direction: column; gap: var(--gap); margin-bottom: var(--gap);
}
.tool-stack.split-view {
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); gap: var(--gap); align-items: start;
}
@media (max-width: 1100px) { .tool-stack.split-view { grid-template-columns: 1fr; } }

.start-actions {
  display: flex; flex-wrap: wrap; align-items: center; gap: 12px;
  padding: 16px; border-radius: var(--radius-sm); background: var(--input-bg); border: 1px solid var(--border);
}

.stat-grid {
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin-bottom: 14px;
}
.stat-grid .stat-card { min-height: 80px; padding: 14px 16px; }
.stat-grid .stat-card .value { font-size: 24px; }
@media (max-width: 900px) { .stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

.wizard-flow {
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin-top: 4px;
}
@media (max-width: 900px) { .wizard-flow { grid-template-columns: 1fr; } }

.wizard-step {
  padding: 18px; border-radius: var(--radius-sm); background: var(--input-bg);
  border: 1px solid var(--border);
}
.wizard-step-head { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.wizard-step-num {
  width: 26px; height: 26px; flex-shrink: 0; border-radius: 7px;
  background: var(--purple-soft); border: 1px solid var(--purple-border);
  color: var(--purple-2); font-size: 12px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
}
.wizard-step-title { font-size: 13px; font-weight: 600; color: var(--text); }
.wizard-step-body { display: flex; flex-direction: column; gap: 10px; }
.wizard-hint { font-size: 12px; color: var(--text-dim); line-height: 1.5; margin: 0; }
.wizard-row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.wizard-file-name { font-size: 12px; color: var(--text-dim); }

.btn-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.btn-ghost {
  height: 36px; padding: 0 14px; border-radius: var(--radius-sm);
  border: 1px solid var(--border); background: var(--input-bg);
  color: var(--text-dim); font-size: 12px; font-weight: 600; cursor: pointer;
  transition: border-color 0.15s, color 0.15s, background 0.15s;
}
.btn-ghost:hover { border-color: var(--purple-border); color: var(--text); background: var(--purple-soft); }
.btn-danger-ghost { border-color: rgba(248, 113, 113, 0.35); color: var(--red); background: var(--red-bg); }
.btn-danger-ghost:hover { border-color: var(--red); color: #fca5a5; }

.live-card-header {
  display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 14px;
}
.live-card-id { font-size: 16px; font-weight: 600; letter-spacing: -0.02em; }
.live-card-meta { font-size: 12px; color: var(--text-dim); margin-top: 4px; }

.progress-track {
  height: 6px; background: var(--input-bg); border-radius: 99px; margin-bottom: 14px; overflow: hidden;
  border: 1px solid var(--border);
}
.progress-fill {
  height: 100%; width: 0; background: linear-gradient(90deg, #7c3aed, #a78bfa); transition: width 0.3s;
}

.tool-details {
  margin-top: 12px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--input-bg);
}
.tool-details summary {
  padding: 12px 16px; cursor: pointer; font-size: 12px; color: var(--text-dim); list-style: none;
}
.tool-details summary::-webkit-details-marker { display: none; }
.tool-details-inner { padding: 0 16px 16px; border-top: 1px solid var(--border); }
.tool-details textarea.fld {
  min-height: 140px; height: auto; padding: 12px 14px;
  font-family: ui-monospace, monospace; font-size: 12px; margin-top: 12px;
}

.data-table-shell {
  border: 1px solid var(--border); border-radius: var(--radius-sm); overflow: hidden; background: var(--input-bg);
}
.scroll-table { max-height: 320px; overflow: auto; }
.scroll-table .data th { position: sticky; top: 0; z-index: 1; }

.card-head-row {
  display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 16px;
}
.card-head-row .section-tag, .card-head-row .card-title { margin-bottom: 0; }

.tool-unavailable {
  margin-top: 12px; padding: 12px 14px; border-radius: var(--radius-sm);
  background: var(--red-bg); border: 1px solid rgba(248, 113, 113, 0.28);
  color: var(--red); font-size: 12px; line-height: 1.55;
}

.history-card { margin-top: 0; }
.stat-row { margin-bottom: var(--gap); }

.workspace { gap: 18px; }

@media (max-width: 1100px) {
  .page-scroll { padding: 22px 20px 32px; }
}

/* === NOTIFICATIONS, SETTINGS, VALUES v54 === */
.notif-wrap { position: relative; }
.notif-badge {
  position: absolute; top: 2px; right: 2px; min-width: 17px; height: 17px; padding: 0 5px;
  border-radius: 99px; background: #ef4444; color: #fff; font-size: 10px; font-weight: 700;
  display: flex; align-items: center; justify-content: center; border: 2px solid #1a1a22;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
}
.notif-panel {
  position: fixed; width: 360px; max-height: 420px;
  background: #1e1e28;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 14px;
  box-shadow: 0 28px 72px rgba(0, 0, 0, 0.88), 0 0 0 1px rgba(255, 255, 255, 0.06);
  z-index: 10000; overflow: hidden;
}
.notif-panel::before {
  content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.1);
}
.notif-panel.off { display: none; }
.notif-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 16px; border-bottom: 1px solid rgba(255, 255, 255, 0.12);
  font-size: 13px; font-weight: 600; color: #fff; background: rgba(255, 255, 255, 0.03);
}
.notif-list { max-height: 360px; overflow-y: auto; }
.notif-item {
  padding: 12px 16px; border-bottom: 1px solid rgba(255, 255, 255, 0.06); cursor: pointer;
  transition: background 0.12s;
}
.notif-item:hover { background: rgba(255, 255, 255, 0.05); }
.notif-item.unread { background: rgba(139, 92, 246, 0.1); }
.notif-item.kind-success.unread { background: rgba(52, 211, 153, 0.1); }
.notif-item.kind-error.unread { background: rgba(248, 113, 113, 0.1); }
.notif-item-title { font-size: 12px; font-weight: 600; margin-bottom: 3px; color: #f4f4f5; }
.notif-item.kind-success .notif-item-title { color: var(--green); }
.notif-item.kind-error .notif-item-title { color: var(--red); }
.notif-item.kind-info .notif-item-title { color: var(--purple-2); }
.notif-item-body { font-size: 12px; color: #d4d4d8; line-height: 1.45; }
.notif-item-time { font-size: 10px; color: #a1a1aa; margin-top: 5px; }
.notif-empty { padding: 28px 16px; text-align: center; font-size: 12px; color: #a1a1aa; }

.toast-stack {
  position: fixed;
  top: var(--toast-top, auto);
  right: var(--toast-right, max(20px, env(safe-area-inset-right, 0)));
  bottom: var(--toast-bottom, max(20px, env(safe-area-inset-bottom, 0)));
  left: var(--toast-left, auto);
  transform: var(--toast-stack-xform, none);
  z-index: 300;
  display: flex; flex-direction: column; align-items: var(--toast-align, flex-end);
  gap: 8px; pointer-events: none;
}
.live-toast {
  min-width: var(--toast-min-w, 240px);
  max-width: min(var(--toast-max-w, 380px), calc(100vw - 24px));
  padding: var(--toast-pad, 13px 16px); border-radius: var(--toast-radius, 14px);
  font-size: var(--toast-font, 12px); font-weight: 600; letter-spacing: -0.01em;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.02));
  color: var(--text); opacity: 0; transform: translateY(var(--toast-enter-y, 10px)) scale(0.98);
  transition: opacity 0.28s, transform 0.28s;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.55), inset 0 1px 0 rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(12px);
}
.live-toast.show { opacity: 1; transform: translateY(0) scale(1); }
.live-toast.ok {
  border-color: rgba(52, 211, 153, 0.4);
  background: linear-gradient(135deg, rgba(52, 211, 153, 0.15), rgba(52, 211, 153, 0.04));
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.5), 0 0 32px rgba(52, 211, 153, 0.12);
}
.live-toast.err {
  border-color: rgba(248, 113, 113, 0.4);
  background: linear-gradient(135deg, rgba(248, 113, 113, 0.15), rgba(248, 113, 113, 0.04));
  color: #fecaca;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.5), 0 0 32px rgba(248, 113, 113, 0.1);
}

.values-layout {
  display: grid; grid-template-columns: minmax(220px, 280px) minmax(0, 1fr); gap: var(--gap);
}
@media (max-width: 900px) { .values-layout { grid-template-columns: 1fr; } }
.profile-list { display: flex; flex-direction: column; gap: 6px; }
.profile-pick {
  width: 100%; text-align: left; padding: 10px 12px; border-radius: var(--radius-sm);
  border: 1px solid var(--border); background: var(--input-bg); color: var(--text-dim);
  font-size: 12px; cursor: pointer; display: flex; align-items: center; justify-content: space-between; gap: 8px;
}
.profile-pick:hover { border-color: var(--purple-border); color: var(--text); }
.profile-pick.active { border-color: var(--purple-border); background: var(--purple-soft); color: var(--text); }
.profile-pick.editing { box-shadow: inset 0 0 0 1px var(--purple); }
.profile-pick-tag {
  font-size: 9px; font-weight: 700; letter-spacing: 0.04em; padding: 2px 6px; border-radius: 4px;
  background: var(--green-bg); color: var(--green); border: 1px solid rgba(52, 211, 153, 0.25);
}
.profile-pick-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* === SETTINGS PAGE v55 === */
.settings-inner { max-width: 960px; }
.settings-hero {
  position: relative; margin-bottom: 28px; padding-bottom: 8px;
}
.settings-hero-orb {
  position: absolute; top: -40px; left: -20px; width: 200px; height: 120px;
  background: radial-gradient(circle, var(--purple-soft) 0%, transparent 70%);
  filter: blur(24px); pointer-events: none;
}
.settings-hero h1 {
  font-size: 26px; font-weight: 600; letter-spacing: -0.02em; text-transform: lowercase;
  line-height: 1.15; margin-bottom: 8px; color: var(--text);
}
.settings-hero p { font-size: 14px; color: var(--text-dim); max-width: 480px; line-height: 1.6; }

.settings-grid {
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; margin-bottom: 18px;
}
.settings-grid .settings-card.settings-wide { grid-column: 1 / -1; }
.settings-wide .ab-toggle-row { margin-top: 4px; }

.settings-card {
  padding: 22px 24px;
  background: linear-gradient(165deg, rgba(255, 255, 255, 0.06) 0%, rgba(255, 255, 255, 0.02) 100%);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 16px;
  box-shadow: var(--shadow-lg), inset 0 1px 0 rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(16px);
  transition: border-color 0.2s, box-shadow 0.2s;
}
.settings-card:hover {
  border-color: rgba(255, 255, 255, 0.14);
  box-shadow: var(--shadow-lg), 0 0 40px var(--purple-soft), inset 0 1px 0 rgba(255, 255, 255, 0.1);
}
.appearance-card { margin-bottom: 8px; }

.settings-card-head {
  display: flex; align-items: flex-start; gap: 14px; margin-bottom: 20px;
}
.settings-card-icon {
  width: 44px; height: 44px; border-radius: 12px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(145deg, var(--purple-soft), transparent);
  border: 1px solid var(--purple-border);
  color: var(--purple-2);
  box-shadow: 0 8px 24px var(--purple-soft);
}
.settings-card-icon svg { width: 20px; height: 20px; }
.settings-card-icon.audio { color: #67e8f9; border-color: rgba(34, 211, 238, 0.35); background: linear-gradient(145deg, rgba(34, 211, 238, 0.12), transparent); box-shadow: 0 8px 24px rgba(34, 211, 238, 0.1); }
.settings-card-icon.theme { color: #fbbf24; border-color: rgba(251, 191, 36, 0.35); background: linear-gradient(145deg, rgba(251, 191, 36, 0.12), transparent); box-shadow: 0 8px 24px rgba(251, 191, 36, 0.1); }
.settings-card-head h2 {
  font-size: 15px; font-weight: 600; letter-spacing: -0.01em; text-transform: lowercase;
  color: var(--text); margin-bottom: 2px;
}
.settings-card-head p { font-size: 12px; color: var(--text-muted); line-height: 1.4; }

.toggle-list { display: flex; flex-direction: column; gap: 8px; }
.toggle-row {
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
  padding: 12px 14px; border-radius: 12px;
  background: rgba(0, 0, 0, 0.22); border: 1px solid rgba(255, 255, 255, 0.06);
  cursor: pointer; transition: background 0.15s, border-color 0.15s, transform 0.15s;
}
.toggle-row:hover {
  background: rgba(255, 255, 255, 0.04); border-color: var(--purple-border);
  transform: translateX(2px);
}
.toggle-left { flex: 1; min-width: 0; }
.toggle-label { display: block; font-size: 13px; font-weight: 500; color: var(--text); line-height: 1.3; }
.toggle-hint { display: block; font-size: 11px; color: var(--text-muted); margin-top: 2px; }
.toggle-switch { position: relative; flex-shrink: 0; width: 48px; height: 28px; }
.toggle-input {
  position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; z-index: 2;
}
.toggle-track {
  display: block; width: 48px; height: 28px; border-radius: 99px;
  background: rgba(255, 255, 255, 0.08); border: 1px solid rgba(255, 255, 255, 0.1);
  position: relative; transition: background 0.2s, border-color 0.2s, box-shadow 0.2s;
}
.toggle-track::after {
  content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px;
  border-radius: 50%; background: #fff;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.35);
  transition: transform 0.22s cubic-bezier(0.34, 1.4, 0.64, 1);
}
.toggle-input:checked + .toggle-track {
  background: linear-gradient(135deg, var(--purple), var(--purple-2));
  border-color: transparent;
  box-shadow: 0 0 24px var(--glow);
}
.toggle-input:checked + .toggle-track::after { transform: translateX(20px); }

.compose-inline-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  height: 40px;
  padding: 0 12px;
  border-radius: 8px;
  border: 1px solid var(--input-border);
  background: var(--input-bg);
}
.compose-inline-label {
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  cursor: pointer;
  text-transform: lowercase;
}
.compose-switch-sm { width: 40px; height: 22px; }
.compose-switch-sm .toggle-track { width: 40px; height: 22px; }
.compose-switch-sm .toggle-track::after {
  top: 2px; left: 2px; width: 16px; height: 16px;
}
.compose-switch-sm .toggle-input:checked + .toggle-track::after {
  transform: translateX(18px);
}

.settings-field { margin-top: 16px; }
.settings-toast-row {
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px;
}
@media (max-width: 560px) { .settings-toast-row { grid-template-columns: 1fr; } }
.duration-wrap {
  display: flex; align-items: center; gap: 10px;
  background: rgba(0, 0, 0, 0.25); border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px; padding: 4px 14px 4px 4px;
}
.duration-fld {
  border: none; background: transparent; height: 40px;
  font-size: 18px; font-weight: 700; font-variant-numeric: tabular-nums;
  color: var(--purple-2);
}
.duration-fld:focus { outline: none; }
.duration-unit { font-size: 11px; font-weight: 600; color: var(--text-muted); letter-spacing: 0.04em; }

.settings-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 16px; }
.btn-pill {
  height: 38px; padding: 0 18px; border-radius: 99px;
  border: 1px solid var(--purple-border);
  background: linear-gradient(135deg, var(--purple-soft), rgba(0, 0, 0, 0.2));
  color: var(--text); font-size: 12px; font-weight: 600; cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s, border-color 0.15s;
}
.btn-pill:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 28px var(--glow);
  border-color: var(--purple-2);
}
.btn-pill.ghost {
  margin-top: 16px;
  background: transparent;
  color: var(--text-dim);
  border-color: rgba(255, 255, 255, 0.12);
}
.btn-pill.ghost:hover { color: var(--text); border-color: rgba(255, 255, 255, 0.22); box-shadow: none; }

.theme-preview {
  display: flex; height: 120px; border-radius: 14px; overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08), 0 12px 40px rgba(0, 0, 0, 0.35);
  margin-bottom: 20px;
}
.tp-sidebar { width: 28%; min-width: 72px; border-right: 1px solid rgba(255, 255, 255, 0.06); }
.tp-body { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.tp-topbar { height: 22%; border-bottom: 1px solid rgba(255, 255, 255, 0.06); }
.tp-content {
  flex: 1; display: flex; gap: 8px; padding: 10px; align-items: stretch;
}
.tp-stat {
  flex: 1; border-radius: 8px; border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.04);
}
.tp-stat.accent {
  border-color: var(--purple-border);
  box-shadow: 0 0 20px var(--purple-soft);
}

.preset-section { margin-bottom: 18px; }
.preset-label {
  display: block; font-size: 10px; font-weight: 700; letter-spacing: 0.1em;
  text-transform: uppercase; color: var(--text-muted); margin-bottom: 10px;
}
.preset-orbs { display: flex; flex-wrap: wrap; gap: 12px; }
.preset-orb {
  position: relative; width: 72px; height: 72px; border-radius: 16px;
  border: 2px solid rgba(255, 255, 255, 0.12); cursor: pointer; padding: 0;
  overflow: hidden; transition: transform 0.2s, box-shadow 0.2s, border-color 0.2s;
}
.preset-orb span {
  position: absolute; inset: 0; display: flex; align-items: flex-end; justify-content: center;
  padding-bottom: 8px; font-size: 10px; font-weight: 700; letter-spacing: 0.04em;
  text-transform: lowercase; color: rgba(255, 255, 255, 0.9);
  background: linear-gradient(180deg, transparent 40%, rgba(0, 0, 0, 0.55) 100%);
}
.preset-orb:hover { transform: translateY(-3px) scale(1.04); }
.preset-orb.active {
  border-color: #fff;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.5), 0 0 0 2px var(--purple-soft);
  transform: translateY(-2px);
}
.preset-orb.purple { background: linear-gradient(145deg, #a78bfa, #7c3aed); }
.preset-orb.green { background: linear-gradient(145deg, #6ee7b7, #059669); }
.preset-orb.cyan { background: linear-gradient(145deg, #67e8f9, #0891b2); }
.preset-orb.red { background: linear-gradient(145deg, #fca5a5, #dc2626); }

.swatch-grid {
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; margin-bottom: 4px;
}
@media (max-width: 700px) { .swatch-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.swatch-cell .lbl { margin-bottom: 8px; font-weight: 600; letter-spacing: 0.02em; }
.swatch-wrap {
  position: relative; height: 52px; border-radius: 12px; overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.14);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.12);
  transition: transform 0.15s, box-shadow 0.15s;
}
.swatch-wrap:hover {
  transform: scale(1.02);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.15), 0 8px 24px rgba(0, 0, 0, 0.35);
}
.swatch-input {
  width: 100%; height: 100%; border: none; padding: 0; cursor: pointer;
  background: transparent;
}
.swatch-input::-webkit-color-swatch-wrapper { padding: 0; }
.swatch-input::-webkit-color-swatch { border: none; border-radius: 0; }

/* dashboard — read-only status + queue (configure on antibot page) */
.dash-config-link { color: var(--purple-2); text-decoration: none; }
.dash-config-link:hover { text-decoration: underline; }
.dash-stat-row { margin-bottom: 14px; }
.dash-stat-card .value { font-size: 32px; font-weight: 700; letter-spacing: -0.03em; }

.dash-status-strip {
  display: flex; flex-wrap: wrap; gap: 12px; margin-bottom: 16px;
}
.dash-status-card {
  flex: 1; min-width: 140px; display: flex; align-items: center; gap: 12px;
  padding: 14px 18px; border-radius: 14px;
  background: rgba(255,255,255,.04); border: 1px solid rgba(255,255,255,.08);
  transition: border-color .15s, background .15s;
}
.dash-status-card.is-on { border-color: rgba(52,211,153,.25); background: rgba(52,211,153,.06); }
.dash-status-icon {
  width: 20px; height: 20px; display: flex; align-items: center; justify-content: center;
  color: var(--text-dim);
}
.dash-status-icon svg { width: 18px; height: 18px; }
.dash-status-card.is-on .dash-status-icon { color: #34d399; }
.dash-status-name { font-size: 14px; font-weight: 600; flex: 1; }
.dash-status-val {
  font-size: 13px; font-weight: 800; letter-spacing: .06em;
  padding: 4px 10px; border-radius: 8px;
}
.dash-status-val.on { color: #34d399; background: rgba(52,211,153,.15); }
.dash-status-val.off { color: var(--text-muted); background: rgba(255,255,255,.06); }

#ipClientsCard { margin-bottom: 16px; overflow: hidden; }
#ipMitmClientsCard { margin-bottom: 16px; overflow: hidden; border-color: rgba(96,165,250,.28); }
#ipMitmClientsCard .card-subtitle {
  width: 100%;
  margin: 4px 0 0;
  font-size: 12px;
  color: var(--text-muted);
}
#ipMitmClientsCard .count-pill-mitm { background: rgba(96,165,250,.18); color: #93c5fd; }
.clients-table-mitm .col-download { min-width: 88px; }
.clients-table-mitm tbody tr.client-row-mitm { background: rgba(96,165,250,.04); }
.clients-table-mitm .cell-detected { font-weight: 600; color: #93c5fd; text-transform: lowercase; }
.clients-table-mitm .cell-victim { font-size: 12px; opacity: .85; }
.clients-table-mitm .client-row-actions-mitm { justify-content: flex-end; gap: 6px; }
.mitm-live-dot {
  display: inline-block; width: 8px; height: 8px; margin-right: 6px; border-radius: 50%;
  background: #34d399; box-shadow: 0 0 0 2px rgba(52,211,153,.25); vertical-align: middle;
}
#ipClientsCard .card-head-row { flex-wrap: wrap; gap: 12px; margin-bottom: 0; }
#ipClientsCard .ip-clients-head { padding-bottom: 16px; }
.ip-clients-filters {
  display: flex; align-items: center; gap: 10px; margin-left: auto;
}
.ip-clients-filter-btn {
  width: 36px; height: 36px; border-radius: 10px; position: relative;
}
.ip-clients-filter-btn svg { width: 18px; height: 18px; }
.ip-clients-filter-btn.active {
  color: var(--purple-2);
  border-color: var(--purple-border);
  background: rgba(139, 92, 246, 0.12);
}
.ip-clients-filter-dot {
  position: absolute; top: 7px; right: 7px; width: 7px; height: 7px; border-radius: 50%;
  background: #fb7185; box-shadow: 0 0 8px rgba(251, 113, 133, 0.65);
}
.client-filter-dialog { width: min(640px, calc(100vw - 32px)); max-height: min(90vh, 760px); }
.client-filter-body { padding: 18px 20px; overflow-y: auto; max-height: calc(min(90vh, 760px) - 130px); }
.client-filter-section + .client-filter-section { margin-top: 18px; padding-top: 18px; border-top: 1px solid rgba(255,255,255,0.06); }
.client-filter-toggle-grid {
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-top: 12px;
}
.client-filter-toggle {
  margin: 0; padding: 10px 12px; border-radius: 12px; cursor: pointer;
  background: rgba(0,0,0,0.22); border: 1px solid rgba(255,255,255,0.06);
}
.client-filter-toggle .toggle-label { font-size: 12px; font-weight: 500; color: var(--text-muted); }
.client-filter-fields {
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-top: 12px;
}
.client-filter-field-wide { grid-column: 1 / -1; }
.client-filter-summary {
  margin: 16px 0 0; padding: 10px 12px; border-radius: 10px; font-size: 12px; color: var(--text-muted);
  background: rgba(139, 92, 246, 0.08); border: 1px solid rgba(139, 92, 246, 0.16);
}
.client-filter-hint {
  margin: 6px 0 0; font-size: 11px; line-height: 1.45; color: var(--text-dim);
}
.client-filter-actions {
  flex-direction: row !important;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 12px 20px 16px;
  border-top: 1px solid rgba(255,255,255,0.06);
}
.client-filter-actions-right { display: flex; gap: 10px; margin-left: auto; }
.client-filter-reset-btn,
.client-filter-actions-right .mg-close-btn,
.client-filter-actions-right .btn-send {
  width: auto !important;
  min-width: 96px;
  flex: 0 1 auto;
}
.toggle-coral .toggle-input:checked + .toggle-track {
  background: linear-gradient(135deg, #f87171, #fb7185);
  border-color: transparent;
  box-shadow: 0 0 18px rgba(248, 113, 113, 0.35);
}
.ip-clients-refresh {
  width: 36px; height: 36px; border-radius: 10px; font-size: 18px; line-height: 1;
}
.mg-client-email {
  display: block; font-size: 13px; font-weight: 600; color: var(--text-muted);
  margin-right: 10px; max-width: 220px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.mg-client-email.has-email { color: #e2e8f0; }
#ipClientsCard .ip-clients-table-shell {
  border-radius: 0;
  border-left: none;
  border-right: none;
  border-bottom: none;
  margin: 0;
}
#ipClientsCard .clients-empty-row td {
  padding: 48px 16px;
  text-align: center;
  font-size: 12px;
  color: var(--text-dim);
  border-bottom: none;
}

.queue-head-ref {
  display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between;
  gap: 12px; margin-bottom: 16px; padding-bottom: 14px;
  border-bottom: 1px solid rgba(255,255,255,.08);
}
.queue-head-main { flex: 1; min-width: 0; }
.queue-head-bypass {
  display: flex; flex-wrap: wrap; align-items: center; gap: 10px 12px;
  margin-top: 8px; font-size: 13px;
}
.queue-bypass-label {
  font-size: 12px; font-weight: 600; color: #c8cad4; letter-spacing: 0.02em;
}
.queue-bypass-token {
  padding: 5px 10px; border-radius: 6px; background: rgba(0,0,0,.35);
  color: #e8eaef; font-size: 12px; font-family: ui-monospace, monospace;
}
.queue-bypass-token.copy-chip:hover {
  background: rgba(167, 139, 250, 0.16);
  border: 1px solid rgba(167, 139, 250, 0.42);
  color: #e9d5ff;
}
.queue-bypass-example {
  padding: 5px 10px; border-radius: 6px;
  background: rgba(167, 139, 250, 0.1);
  border: 1px solid rgba(167, 139, 250, 0.32);
  color: #ddd6fe; font-size: 12px; font-weight: 500;
  font-family: ui-monospace, monospace; word-break: break-all;
  user-select: none;
}
.queue-bypass-link {
  color: var(--purple-2); text-decoration: none; word-break: break-all;
}
.queue-bypass-link:hover { text-decoration: underline; }

.queue-title { font-size: 16px; font-weight: 700; letter-spacing: -0.02em; }
.btn-queue-clear-red {
  font-family: inherit; font-size: 12px; font-weight: 600; padding: 8px 16px;
  border-radius: 10px; border: 1px solid rgba(239,68,68,.45);
  background: rgba(239,68,68,.15); color: #fca5a5; cursor: pointer;
}
.btn-queue-clear-red:hover { background: rgba(239,68,68,.28); border-color: #f87171; }

.queue-row-ref {
  align-items: center; padding: 8px 12px; border-radius: 8px;
  background: rgba(255,255,255,.03); border: 1px solid rgba(255,255,255,.08);
}
.queue-row-body { flex: 1; min-width: 0; }
.queue-ip-lg { font-size: 13px; font-weight: 600; letter-spacing: -0.01em; margin-bottom: 1px; }
.queue-loc-lg { font-size: 11px; color: var(--text-dim); margin-bottom: 2px; }
.queue-ua-lg {
  font-size: 10px; color: var(--text-muted); line-height: 1.35;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.queue-row-btns {
  display: flex; flex-direction: row; gap: 6px; flex-shrink: 0; align-items: center;
}
.queue-row-btns .btn-queue-approve,
.queue-row-btns .btn-queue-deny { width: auto; text-align: center; padding: 5px 10px; font-size: 11px; border-radius: 7px; }

/* panel security + lockdown queue */
.queue-card {
  margin-bottom: 16px;
  border: 1px solid rgba(255,255,255,.08);
  background: linear-gradient(145deg, rgba(255,255,255,.04), rgba(255,255,255,.02));
  box-shadow: 0 8px 32px rgba(0,0,0,.35);
}
.queue-card.has-queue { border-color: rgba(139,92,246,.35); box-shadow: 0 0 0 1px rgba(139,92,246,.15), 0 12px 40px rgba(0,0,0,.4); }
.queue-card-head { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.queue-card-desc { font-size: 12px; color: var(--text-dim); margin-top: 4px; }
.queue-card-actions { display: flex; align-items: center; gap: 10px; }
.queue-live-pill {
  font-size: 10px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase;
  padding: 5px 10px; border-radius: 999px; background: rgba(255,255,255,.06); color: var(--text-muted);
  border: 1px solid rgba(255,255,255,.08);
}
.queue-live-pill.on { background: rgba(239,68,68,.15); color: #fca5a5; border-color: rgba(239,68,68,.35); }
.queue-list { display: flex; flex-direction: column; gap: 6px; }
.queue-row {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 14px 16px; border-radius: 14px;
  background: rgba(0,0,0,.35); border: 1px solid rgba(255,255,255,.07);
  transition: border-color .15s, transform .15s;
}
.queue-row:hover { border-color: rgba(139,92,246,.25); transform: translateY(-1px); }
.queue-row-main { flex: 1; min-width: 0; }
.queue-ip { font-size: 15px; font-weight: 700; letter-spacing: -.02em; margin-bottom: 2px; }
.queue-loc { font-size: 12px; color: var(--text-dim); margin-bottom: 4px; }
.queue-ua { font-size: 11px; color: var(--text-muted); line-height: 1.4; word-break: break-all; }
.queue-row-actions { display: flex; gap: 8px; flex-shrink: 0; }
.btn-queue-approve, .btn-queue-deny, .btn-queue-nav, .btn-queue-clear {
  font-family: inherit; font-size: 12px; font-weight: 600; cursor: pointer;
  border-radius: 10px; padding: 8px 16px; border: none; transition: all .15s;
}
.btn-queue-approve {
  background: linear-gradient(135deg, #34d399, #059669);
  color: #042f1a; box-shadow: 0 4px 14px rgba(52,211,153,.25);
}
.btn-queue-approve:hover { filter: brightness(1.08); transform: translateY(-1px); }
.btn-queue-deny {
  background: rgba(239,68,68,.12); color: #fca5a5;
  border: 1px solid rgba(239,68,68,.35);
}
.btn-queue-deny:hover { background: rgba(239,68,68,.22); border-color: #f87171; }
.btn-queue-nav {
  background: rgba(255,255,255,.06); color: var(--text-dim);
  border: 1px solid rgba(255,255,255,.1);
}
.btn-queue-nav:hover:not(:disabled) { color: var(--text); border-color: rgba(255,255,255,.2); }
.btn-queue-nav:disabled { opacity: 0.35; cursor: not-allowed; }
.btn-queue-clear {
  background: transparent; color: var(--text-muted);
  border: 1px solid rgba(255,255,255,.1); padding: 6px 12px;
}
.btn-queue-clear:hover { color: var(--red); border-color: rgba(248,113,113,.35); }
.queue-pager { display: flex; align-items: center; justify-content: center; gap: 14px; margin-top: 14px; font-size: 12px; color: var(--text-dim); }

/* antibot page */
.ab-card { margin-bottom: 16px; border: 1px solid rgba(255,255,255,.07); }
.ab-toggle-row { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 12px; }
@media (max-width: 900px) { .ab-toggle-row { grid-template-columns: 1fr; } }
.ab-toggle-card {
  padding: 16px; border-radius: 14px; background: rgba(0,0,0,.25);
  border: 1px solid rgba(255,255,255,.07); display: flex; flex-direction: column; gap: 6px;
}
.ab-toggle-card.ab-toggle-lock.on-border { border-color: rgba(239,68,68,.3); }
.ab-toggle-label { font-weight: 600; font-size: 14px; }
.ab-toggle-hint { font-size: 11px; color: var(--text-muted); margin-bottom: 8px; }
.pill-toggle {
  display: inline-flex; align-items: center; gap: 10px; padding: 0; border: none;
  background: transparent; cursor: pointer; font-family: inherit;
}
.pill-track {
  width: 44px; height: 26px; border-radius: 999px; background: rgba(255,255,255,.1);
  border: 1px solid rgba(255,255,255,.12); position: relative; transition: all .2s;
}
.pill-toggle.on .pill-track { background: rgba(52,211,153,.25); border-color: rgba(52,211,153,.5); }
.pill-knob {
  position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%;
  background: #fff; transition: transform .2s; box-shadow: 0 2px 6px rgba(0,0,0,.3);
}
.pill-toggle.on .pill-knob { transform: translateX(18px); background: #34d399; }
.pill-text { font-size: 11px; font-weight: 700; letter-spacing: .06em; color: var(--text-muted); }
.pill-toggle.on .pill-text { color: #6ee7b7; }
.ab-rules-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 10px; margin: 12px 0 16px; }
@media (max-width: 700px) { .ab-rules-grid { grid-template-columns: 1fr; } }
.ab-rule {
  display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 10px;
  background: rgba(255,255,255,.03); border: 1px solid rgba(255,255,255,.06); font-size: 12px; color: var(--text-dim);
}
.ab-rule input { accent-color: var(--purple); width: 16px; height: 16px; }
.ab-fields-grid { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 12px; }
@media (max-width: 900px) { .ab-fields-grid { grid-template-columns: 1fr; } }
.ab-bypass-hint { font-size: 12px; color: var(--text-muted); margin: 8px 0 12px; }
.ab-bypass-row { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.ab-bypass-url {
  flex: 1; min-width: 200px; padding: 12px 14px; border-radius: 10px;
  background: rgba(0,0,0,.35); border: 1px solid rgba(139,92,246,.25);
  color: var(--purple-2); font-size: 12px; word-break: break-all;
}
.ab-bypass-url.copy-chip { cursor: pointer; }
.ab-bypass-url.copy-chip:hover {
  background: rgba(167, 139, 250, 0.12);
  border-color: rgba(167, 139, 250, 0.42);
  color: #e9d5ff;
}

.caller-perms { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--input-border); }
.caller-perms-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; font-size: 12px; color: var(--text-dim); }
.caller-perms-grid label { display: flex; gap: 8px; align-items: center; }

.users-inner { max-width: 1100px; }
.users-header { margin-bottom: 20px; }
.users-desc { color: var(--text-dim); font-size: 14px; max-width: 560px; line-height: 1.55; }
.users-grid {
  display: grid; grid-template-columns: minmax(280px, 360px) 1fr; gap: 18px; align-items: start;
}
@media (max-width: 900px) { .users-grid { grid-template-columns: 1fr; } }
.users-create-card { padding: 22px 24px; }
.users-card-title { font-size: 15px; font-weight: 600; margin: 0 0 16px; color: var(--text); }
.users-create-btn { width: 100%; margin-top: 4px; }
.users-lists { display: flex; flex-direction: column; gap: 16px; }
.users-list-card { padding: 20px 22px; }
.users-section-head { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; }
.users-section-head .users-card-title { margin: 0; }
.users-hint { font-size: 12px; color: var(--text-dim); margin: 0 0 14px; line-height: 1.45; }
.users-table-wrap { border-radius: 10px; border: 1px solid var(--input-border); overflow: hidden; }
.users-table td, .users-table th { font-size: 13px; }
.users-actions { white-space: nowrap; }
.users-actions .link-clear + .link-clear { margin-left: 0; }
.users-admin-row { cursor: pointer; transition: background 0.15s; }
.users-admin-row:hover td { background: rgba(167, 139, 250, 0.06); }
.users-admin-row.open td { background: rgba(167, 139, 250, 0.08); border-bottom-color: transparent; }
.users-admin-toggle {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 0; border: 0; background: none; color: inherit;
  font: inherit; cursor: pointer; text-align: left;
}
.users-admin-chev {
  width: 14px; color: var(--purple-2); font-size: 11px; flex-shrink: 0;
  transition: transform 0.15s;
}
.users-admin-name { font-weight: 600; color: var(--text); }
.users-team-count {
  font-size: 11px; font-weight: 600; padding: 2px 7px; border-radius: 999px;
  background: rgba(167, 139, 250, 0.14); color: #c4b5fd; border: 1px solid rgba(167, 139, 250, 0.28);
}
.users-admin-team-row td {
  padding: 0 !important; background: rgba(0, 0, 0, 0.22);
  border-top: none !important;
}
.users-admin-team-panel {
  padding: 12px 14px 14px 36px; border-top: 1px solid rgba(167, 139, 250, 0.14);
}
.users-admin-team-label {
  font-size: 10px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--text-dim); margin-bottom: 10px;
}
.users-team-list { display: flex; flex-direction: column; gap: 8px; }
.users-team-item {
  display: grid; grid-template-columns: minmax(100px, 1fr) minmax(120px, 1.2fr) auto;
  gap: 10px; align-items: center; padding: 10px 12px; border-radius: 10px;
  border: 1px solid var(--input-border); background: rgba(255, 255, 255, 0.02);
}
@media (max-width: 640px) {
  .users-team-item { grid-template-columns: 1fr; gap: 4px; }
}
.users-team-name { font-weight: 600; color: var(--text); }
.users-team-meta { font-size: 12px; color: var(--text-dim); }
.users-team-actions { justify-self: end; white-space: nowrap; }
.users-team-empty {
  margin: 0; padding: 10px 12px; border-radius: 10px; font-size: 12px; color: var(--text-dim);
  border: 1px dashed rgba(255, 255, 255, 0.1); background: rgba(255, 255, 255, 0.02);
}
.users-name-cell { font-weight: 600; color: var(--text); }
.users-pass-row { display: flex; gap: 8px; align-items: stretch; }
.users-pass-row .fld { flex: 1; min-width: 0; }
.users-pass-dialog { max-width: 420px; }
.users-act-group {
  display: inline-flex; flex-wrap: wrap; gap: 6px; justify-content: flex-end;
}
.users-act-btn {
  font-family: inherit; font-size: 11px; font-weight: 600; letter-spacing: 0.02em;
  padding: 6px 11px; border-radius: 999px; border: 1px solid var(--input-border);
  background: rgba(255, 255, 255, 0.03); color: var(--text-dim); cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s, transform 0.1s;
  white-space: nowrap;
}
.users-act-btn:hover {
  background: rgba(255, 255, 255, 0.07); color: var(--text); border-color: rgba(255, 255, 255, 0.14);
}
.users-act-btn:active { transform: scale(0.97); }
.users-act-btn--purple {
  border-color: rgba(139, 92, 246, 0.35); background: rgba(139, 92, 246, 0.12); color: #c4b5fd;
}
.users-act-btn--purple:hover {
  background: rgba(139, 92, 246, 0.2); border-color: rgba(167, 139, 250, 0.5); color: #e9d5ff;
}
.users-act-btn--ghost {
  border-color: rgba(255, 255, 255, 0.1); background: rgba(255, 255, 255, 0.04);
}
.users-act-btn--danger {
  border-color: rgba(248, 113, 113, 0.35); background: rgba(248, 113, 113, 0.1); color: #fca5a5;
}
.users-act-btn--danger:hover {
  background: rgba(248, 113, 113, 0.18); border-color: rgba(248, 113, 113, 0.5); color: #fecaca;
}
.users-create-card .users-act-btn { flex-shrink: 0; align-self: stretch; padding-left: 14px; padding-right: 14px; }
.users-create-btn {
  width: 100%; margin-top: 8px; padding: 13px 18px; border-radius: 999px;
  font-size: 14px; font-weight: 700; letter-spacing: 0.01em;
}
.users-table tbody tr:hover td { background: rgba(255, 255, 255, 0.02); }
.users-table td { vertical-align: middle; padding-top: 12px; padding-bottom: 12px; }

.tokens-inner { max-width: 1100px; }
.tokens-header { margin-bottom: 20px; }
.tokens-desc { color: var(--text-dim); font-size: 14px; max-width: 620px; line-height: 1.55; }
.tokens-grid {
  display: grid; grid-template-columns: minmax(300px, 380px) 1fr; gap: 18px; align-items: start;
}
@media (max-width: 900px) { .tokens-grid { grid-template-columns: 1fr; } }
.tokens-create-card { padding: 22px 24px; }
.tokens-card-title { font-size: 15px; font-weight: 600; margin: 0; color: var(--text); }
.tokens-hint { font-size: 12px; color: var(--text-dim); margin: 0 0 14px; line-height: 1.45; }
.tokens-create-btn { width: 100%; margin-top: 8px; }
.tokens-chat-row { display: flex; gap: 8px; align-items: center; }
.tokens-chat-row .fld { flex: 1; }
.tokens-discover-list { margin-top: 8px; display: flex; flex-direction: column; gap: 6px; }
.tokens-discover-item {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 8px 10px; border-radius: 8px; border: 1px solid var(--input-border);
  background: rgba(255,255,255,.02); font-size: 12px;
}
.tokens-events-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 8px;
  font-size: 12px; color: var(--text-dim); margin-bottom: 4px;
}
.tokens-events-grid label { display: flex; gap: 8px; align-items: center; }
.tokens-preview-card {
  margin-top: 16px; padding: 14px; border-radius: 10px;
  border: 1px solid rgba(139, 92, 246, 0.25); background: rgba(139, 92, 246, 0.06);
}
.tokens-preview-label { font-size: 10px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--text-dim); margin-bottom: 8px; }
.tokens-preview-body {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px; line-height: 1.55; color: var(--text); margin: 0; white-space: pre-wrap;
}
.tokens-list-card { padding: 20px 22px; }
.tokens-section-head { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; }
.tokens-cards { display: flex; flex-direction: column; gap: 12px; }
.tokens-empty { font-size: 13px; color: var(--text-dim); margin: 0; }
.token-card {
  border: 1px solid var(--input-border); border-radius: 12px; padding: 14px 16px;
  background: rgba(255,255,255,.02);
}
.token-card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
.token-card-name { font-size: 14px; font-weight: 600; color: var(--text); }
.token-card-meta { font-size: 11px; color: var(--text-dim); margin-top: 2px; }
.token-card-actions { display: flex; gap: 6px; flex-shrink: 0; }
.token-card-events { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.token-event-pill {
  font-size: 10px; padding: 3px 8px; border-radius: 999px;
  border: 1px solid var(--input-border); color: var(--text-dim); background: rgba(255,255,255,.03);
}
.token-event-pill.on { border-color: rgba(34, 197, 94, 0.35); color: #86efac; background: rgba(34, 197, 94, 0.08); }
.token-card-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; font-size: 11px; color: var(--text-dim); }
.token-toggle {
  display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--text-dim);
}
.token-status-err { color: #f87171; font-size: 11px; margin-top: 6px; }
.role-chip-row { display: flex; gap: 8px; }
.role-chip {
  flex: 1; display: flex; flex-direction: column; align-items: flex-start; gap: 2px;
  padding: 10px 12px; border-radius: 10px; border: 1px solid var(--input-border);
  background: rgba(255,255,255,.03); color: var(--text-dim); font-size: 13px; font-weight: 600;
  cursor: pointer; transition: border-color .15s, background .15s, color .15s;
}
.role-chip-sub { font-size: 10px; font-weight: 500; color: var(--text-dim); opacity: .85; }
.role-chip.active {
  border-color: rgba(139, 92, 246, .45); background: rgba(139, 92, 246, .12); color: var(--text);
}
.role-chip.active .role-chip-sub { color: var(--purple-2); }
.count-pill.muted-pill { background: rgba(255,255,255,.06); color: var(--text-dim); border-color: var(--input-border); }
.user-role-badge {
  display: inline-block; font-size: 10px; font-weight: 700; letter-spacing: .04em;
  text-transform: uppercase; padding: 2px 8px; border-radius: 999px;
}
.user-role-badge.caller { background: rgba(52, 211, 153, .12); color: var(--green); border: 1px solid rgba(52, 211, 153, .25); }
.user-role-badge.admin { background: rgba(139, 92, 246, .12); color: var(--purple-2); border: 1px solid rgba(139, 92, 246, .25); }
.user-role-badge.owner { background: rgba(251, 191, 36, .12); color: #fcd34d; border: 1px solid rgba(251, 191, 36, .25); }

.mg-page-ctx { margin-bottom: 10px; padding: 10px; border-radius: 10px; background: rgba(0,0,0,.25); border: 1px solid var(--input-border); }
.mg-page-ctx-note { font-size: 12px; color: var(--text-dim); line-height: 1.5; margin: 0; }
.mg-page-ctx-note strong { color: var(--text); }

.digits-modal { max-width: 440px; }
.digits-modal-body { padding: 16px 20px 8px; }
.digits-modal-info {
  display: flex; gap: 10px; align-items: flex-start;
  padding: 12px 14px; margin-bottom: 14px;
  border-radius: 10px; background: rgba(59, 130, 246, 0.12);
  border: 1px solid rgba(59, 130, 246, 0.35);
  color: #93c5fd; font-size: 13px; line-height: 1.45;
}
.digits-modal-info strong { color: #e0f2fe; }
.digits-modal-info-icon {
  flex-shrink: 0; width: 22px; height: 22px; border-radius: 50%;
  background: rgba(59, 130, 246, 0.25); color: #93c5fd;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700; font-style: italic;
}
.digits-modal-sub { font-size: 12px; color: var(--text-dim); margin: 0 0 12px; }
.digits-modal-field .fld { font-size: 15px; letter-spacing: 0.08em; }
.digits-modal-help { font-size: 11px; color: var(--text-dim); margin: 6px 0 0; }
.digits-modal-actions { flex-direction: row; justify-content: flex-end; padding: 12px 20px 16px; gap: 10px; }
.digits-modal-actions .mg-close-btn,
.digits-modal-actions .mg-redirect-btn { width: auto; min-width: 130px; flex: 0 1 auto; }
.digits-modal-actions .mg-close-btn { background: rgba(255, 255, 255, 0.04); border: 1px solid var(--input-border); color: var(--text-dim); }
.digits-modal-actions .mg-redirect-btn { min-width: 140px; }
.dialog-actions-row {
  flex-direction: row !important;
  justify-content: flex-end;
  gap: 10px;
  padding: 12px 20px 16px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}
.dialog-actions-row .mg-close-btn,
.dialog-actions-row .mg-redirect-btn,
.dialog-actions-row .btn-send {
  width: auto;
  min-width: 120px;
  flex: 0 1 auto;
}
.mg-ctx-field { margin-bottom: 8px; }
.mg-ctx-field:last-child { margin-bottom: 0; }

textarea.fld {
  min-height: 88px; height: auto; padding: 10px 12px; resize: vertical; line-height: 1.45;
}

.dt-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 14px;
  margin-top: 4px;
}
.dt-card {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--input-border);
  border-radius: 14px;
  padding: 14px 16px 12px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.dt-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.dt-card-title {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}
.dt-card-logo {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  object-fit: contain;
  background: #fff;
  padding: 4px;
  box-sizing: border-box;
  box-shadow: 0 1px 4px rgba(0,0,0,.25);
  flex-shrink: 0;
}
.dt-switch {
  width: 44px;
  height: 26px;
  border-radius: 999px;
  border: none;
  background: rgba(255, 255, 255, 0.12);
  position: relative;
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.2s;
}
.dt-switch.on { background: #22c55e; }
.dt-switch-knob {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #fff;
  transition: transform 0.2s;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
}
.dt-switch.on .dt-switch-knob { transform: translateX(18px); }
.dt-chat-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding-top: 10px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}
.dt-chat-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--text-dim);
}
.dt-chat-label svg {
  width: 16px;
  height: 16px;
  color: #60a5fa;
  flex-shrink: 0;
}
.dt-switch.chat.on { background: #3b82f6; }
.dt-switch.browser.on { background: #22c55e; }
.mg-chat-ts {
  font-size: 10px;
  color: var(--text-dim);
  margin-top: 4px;
  opacity: 0.75;
}
.mg-chat-row.user .mg-chat-ts { text-align: right; }
.mg-chat-row.support .mg-chat-ts { text-align: left; }

/* Redirect flows */
#rfModalOverlay:not(.off) { display: flex; align-items: center; justify-content: center; padding: 16px; }
.rf-page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.rf-hint { color: var(--text-dim); font-size: 12px; margin: 0 0 14px; }
.rf-assign-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto;
  gap: 12px;
  align-items: end;
}
.rf-assign-row .field { margin-bottom: 0; }
.rf-assign-btn-field { min-width: 108px; }
.rf-assign-spacer { visibility: hidden; user-select: none; }
.rf-assign-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  width: 100%; height: 40px; min-height: 40px; white-space: nowrap; box-sizing: border-box;
}
@media (max-width: 720px) {
  .rf-assign-row { grid-template-columns: 1fr; }
  .rf-assign-btn-field { min-width: 0; }
}
.rf-skip { display: flex; align-items: flex-start; gap: 8px; font-size: 12px; color: var(--text-dim); margin-top: 12px; line-height: 1.4; }
.rf-active-block { margin-top: 18px; padding-top: 14px; border-top: 1px solid rgba(255,255,255,0.06); }
.rf-active-title { margin-bottom: 10px; font-size: 11px; letter-spacing: 0.06em; }
.rf-active-list { display: flex; flex-direction: column; gap: 8px; }
.rf-active-empty { font-size: 12px; color: var(--text-dim); margin: 0; padding: 8px 0; }
.rf-active-row {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  padding: 10px 12px; border-radius: 10px;
  background: rgba(0,0,0,0.2); border: 1px solid rgba(255,255,255,0.06);
}
.rf-active-domain { font-size: 13px; font-weight: 600; }
.rf-active-arrow { color: var(--text-dim); font-size: 12px; }
.rf-active-flow { font-size: 13px; color: #60a5fa; font-weight: 600; }
.rf-pill {
  font-size: 10px; padding: 2px 8px; border-radius: 999px;
  background: rgba(255,255,255,0.06); color: var(--text-dim); border: 1px solid rgba(255,255,255,0.08);
}
.rf-pill.warn { background: rgba(234,179,8,0.12); color: #fbbf24; border-color: rgba(234,179,8,0.25); }
.rf-active-del { margin-left: auto; flex-shrink: 0; }
.rf-flow-list { display: flex; flex-direction: column; gap: 10px; margin-top: 14px; }
.rf-flow-row { background: var(--card); border: 1px solid rgba(255,255,255,0.06); border-radius: 10px; padding: 14px 16px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.rf-flow-meta { font-size: 12px; color: var(--text-dim); margin-top: 4px; }
.rf-flow-actions { display: flex; gap: 6px; align-items: center; }
.rf-dialog { max-width: 600px; width: 100%; max-height: min(90vh, 820px); }
.rf-modal-body { padding: 0; min-height: 0; overflow: hidden; display: flex; flex-direction: column; }
.rf-modal-scroll { flex: 1; min-height: 0; overflow-y: auto; padding: 18px 20px; max-height: calc(min(90vh, 820px) - 130px); }
.rf-modal-actions { padding: 12px 20px 16px; border-top: 1px solid rgba(255,255,255,0.06); flex-shrink: 0; }
.rf-steps-head { display: flex; align-items: center; justify-content: space-between; margin: 18px 0 8px; }
.rf-steps-head .section-tag { margin-bottom: 0; }
.rf-brand-hint { font-size: 10px; color: var(--text-dim); margin: -4px 0 10px; }
.rf-brand-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 14px; padding: 10px; border-radius: 10px; background: rgba(0,0,0,0.18); border: 1px solid rgba(255,255,255,0.06); }
.rf-brand-tag {
  font-size: 11px; padding: 5px 10px; border-radius: 999px; border: 1px solid rgba(255,255,255,0.1);
  background: rgba(255,255,255,0.03); cursor: pointer; color: var(--text-dim);
  display: inline-flex; align-items: center; transition: background 0.12s, border-color 0.12s, color 0.12s;
}
.rf-brand-tag-inner { display: inline-flex; align-items: center; gap: 6px; }
.rf-brand-logo {
  width: 18px; height: 18px; border-radius: 50%; object-fit: contain; flex-shrink: 0;
  background: #fff; padding: 2px; box-sizing: border-box;
  box-shadow: 0 1px 4px rgba(0,0,0,.25);
}
.rf-brand-letter {
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 7px; font-weight: 700; color: #fff; text-transform: uppercase;
}
.rf-brand-tag.on { background: rgba(139, 92, 246, 0.18); color: #fff; border-color: rgba(139, 92, 246, 0.4); }
.rf-steps-wrap { display: flex; flex-direction: column; gap: 10px; }
.rf-step-card {
  border: 1px solid rgba(255,255,255,0.08); border-radius: 12px; padding: 12px 14px;
  background: linear-gradient(160deg, rgba(255,255,255,0.035) 0%, rgba(0,0,0,0.14) 100%);
  cursor: pointer; transition: border-color 0.15s, box-shadow 0.15s;
}
.rf-step-card.active {
  border-color: rgba(139, 92, 246, 0.45);
  box-shadow: 0 0 0 1px rgba(139, 92, 246, 0.18);
  background: linear-gradient(160deg, rgba(139, 92, 246, 0.08) 0%, rgba(0,0,0,0.14) 100%);
}
.rf-step-head { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; }
.rf-step-title { display: flex; align-items: center; gap: 8px; flex: 1; min-width: 0; }
.rf-step-num {
  width: 22px; height: 22px; border-radius: 6px; flex-shrink: 0;
  background: rgba(139, 92, 246, 0.15); color: #c4b5fd;
  font-size: 11px; font-weight: 700; display: inline-flex; align-items: center; justify-content: center;
}
.rf-step-name { font-size: 12px; font-weight: 600; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rf-step-del { width: 28px; height: 28px; opacity: 0.55; flex-shrink: 0; }
.rf-step-del:hover:not(:disabled) { opacity: 1; }
.rf-step-del:disabled { opacity: 0.2; cursor: not-allowed; }
.rf-step-body { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; align-items: start; }
.rf-page-field { margin-bottom: 0; }
.rf-trigger-block { margin-bottom: 0; }
.rf-trigger-block > .lbl { display: block; margin-bottom: 6px; }
.rf-trigger-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 0; }
.rf-trigger-btn {
  padding: 9px 10px; border-radius: 8px; border: 1px solid rgba(255,255,255,0.08);
  background: rgba(255,255,255,0.03); font-size: 11px; font-weight: 600; cursor: pointer; color: var(--text-dim);
  transition: background 0.12s, border-color 0.12s, color 0.12s;
}
.rf-trigger-btn:hover { border-color: rgba(255,255,255,0.14); color: var(--text); }
.rf-trigger-btn.on.sub { background: rgba(37, 99, 235, 0.9); border-color: #2563eb; color: #fff; }
.rf-trigger-btn.on.timer { background: rgba(234, 88, 12, 0.9); border-color: #ea580c; color: #fff; }
.rf-timer-field { margin-top: 8px; margin-bottom: 0; }
.rf-example-url {
  font-size: 10px; color: var(--text-dim); margin-top: 6px; font-family: ui-monospace, monospace;
  padding: 5px 8px; border-radius: 6px; background: rgba(255,255,255,0.04); border: 1px solid rgba(255,255,255,0.06);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.rf-drag-handle { flex-shrink: 0; color: var(--text-dim); cursor: grab; font-size: 14px; line-height: 1; }
.rf-step-card.dragging { opacity: 0.45; }
.rf-step-card.drag-over { box-shadow: 0 0 0 1px rgba(139, 130, 246, 0.45); }
@media (max-width: 560px) {
  .rf-step-body { grid-template-columns: 1fr; }
}

/* Custom templates */
.custom-tpl-toolbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: end;
  margin-bottom: 14px;
}
.custom-tpl-toolbar .field { margin-bottom: 0; }
.custom-tpl-spacer { visibility: hidden; user-select: none; }
.custom-tpl-actions { display: flex; align-items: center; gap: 8px; height: 40px; }
.custom-tpl-actions-field { min-width: 148px; }
.custom-tpl-editor-wrap { margin-bottom: 12px; }
.custom-tpl-editor {
  min-height: 220px;
  height: auto;
  padding: 12px 14px;
  font-family: ui-monospace, monospace;
  font-size: 11px;
  line-height: 1.55;
  resize: vertical;
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.28);
  border-color: rgba(255, 255, 255, 0.1);
}
.custom-tpl-editor:focus { background: rgba(0, 0, 0, 0.34); }
.custom-tpl-upload {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}
.custom-tpl-upload-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 14px;
  height: 34px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: border-color 0.12s, background 0.12s;
}
.custom-tpl-upload-btn:hover { border-color: rgba(139, 92, 246, 0.45); background: rgba(139, 92, 246, 0.08); }
.custom-tpl-upload-btn:has(input:disabled) { opacity: 0.45; pointer-events: none; cursor: not-allowed; }
.custom-tpl-file-hint { font-size: 11px; color: var(--text-dim); }
.custom-tpl-save-row { margin-bottom: 4px; }
.custom-tpl-divider {
  height: 1px;
  background: rgba(255, 255, 255, 0.07);
  margin: 22px 0;
}
.custom-tpl-send-block .ph-block {
  margin-top: 8px;
  padding: 14px;
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.18);
  border: 1px solid rgba(255, 255, 255, 0.06);
}
.custom-tpl-send-block .ph-block .section-tag { margin-bottom: 12px; }
@media (max-width: 720px) {
  .custom-tpl-toolbar { grid-template-columns: 1fr; }
  .custom-tpl-actions-field { min-width: 0; }
  .custom-tpl-actions { height: auto; }
}

/* === MOBILE / PHONE LAYOUT === */
html, body { height: 100%; }
@supports (height: 100dvh) {
  html, body,
  .app-shell,
  .sidebar,
  .main { height: 100dvh; }
}

body.sidebar-open { overflow: hidden; }

@media (max-width: 900px) {
  .tb-icon.mobile-menu-btn { display: flex; }

  .sidebar-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 45;
    background: rgba(0, 0, 0, 0.58);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
  }
  .sidebar-backdrop.show {
    opacity: 1;
    pointer-events: auto;
  }

  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: min(288px, 88vw);
    min-width: 0;
    z-index: 50;
    transform: translateX(-105%);
    transition: transform 0.24s ease;
    box-shadow: none;
    padding-bottom: env(safe-area-inset-bottom, 0);
  }
  .sidebar.mobile-open {
    transform: translateX(0);
    box-shadow: 12px 0 48px rgba(0, 0, 0, 0.55);
  }

  .main { width: 100%; min-width: 0; }
  .topbar {
    padding: 0 12px;
    padding-left: max(12px, env(safe-area-inset-left, 0));
    padding-right: max(12px, env(safe-area-inset-right, 0));
    gap: 8px;
  }
  .topbar-left { min-width: 0; }
  .crumb {
    font-size: 11px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .topbar-actions { gap: 6px; flex-shrink: 0; }
  .user-pill {
    max-width: 108px;
    padding: 6px 10px;
    font-size: 11px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .badge-user { flex-shrink: 0; }

  .page-scroll {
    padding: 16px 14px 28px;
    padding-left: max(14px, env(safe-area-inset-left, 0));
    padding-right: max(14px, env(safe-area-inset-right, 0));
    -webkit-overflow-scrolling: touch;
  }
  .page-header h1 { font-size: 20px; }
  .page-header { margin-bottom: 18px; }

  .grid-4 { grid-template-columns: 1fr; }
  .stat-card .value { font-size: 28px; }
  .dash-status-card { min-width: 100%; }
  .dash-status-strip { gap: 8px; }

  .card-pad { padding: 18px 16px; }
  .card-head-row { flex-wrap: wrap; gap: 10px; }

  .table-wrap {
    margin: 0 -4px;
    -webkit-overflow-scrolling: touch;
  }
  .clients-table { min-width: 640px; }
  .clients-table th,
  .clients-table td { padding: 10px 10px; }
  .clients-table .col-actions { width: 280px; min-width: 280px; max-width: 280px; }
  .clients-table .client-row-actions .btn-icon,
  .clients-table .client-row-actions .chat-wrap {
    width: 30px;
    height: 30px;
    min-width: 30px;
    min-height: 30px;
  }
  .clients-table .client-row-actions .btn-icon svg { width: 14px; height: 14px; }

  .btn-send,
  .btn-ghost,
  .fld,
  select.fld {
    min-height: 44px;
    font-size: 16px;
  }
  .nav-list li a {
    min-height: 44px;
    padding: 11px 12px;
  }
  .tb-icon,
  .btn-icon {
    width: 40px;
    height: 40px;
  }
  .btn-icon svg { width: 16px; height: 16px; }

  .modal {
    width: min(100%, calc(100vw - 28px));
    max-width: 420px;
    padding: 22px 18px;
    margin: 0 14px;
  }
  .overlay.login-screen {
    padding: max(16px, env(safe-area-inset-top, 0)) 0 max(16px, env(safe-area-inset-bottom, 0));
  }

  #manageOverlay:not(.off),
  #sessionReplayOverlay:not(.off),
  #pagePreviewOverlay:not(.off),
  #digitsModalOverlay:not(.off),
  #emailModalOverlay:not(.off),
  #rfModalOverlay:not(.off) {
    padding: 0;
    align-items: stretch;
    justify-content: stretch;
  }
  #deleteConfirmOverlay:not(.off) {
    padding: max(20px, env(safe-area-inset-top, 0)) max(16px, env(safe-area-inset-right, 0)) max(20px, env(safe-area-inset-bottom, 0)) max(16px, env(safe-area-inset-left, 0));
    align-items: center;
    justify-content: center;
  }
  .confirm-dialog {
    width: min(100%, 400px);
    max-height: none;
    height: auto;
    border-radius: 16px;
  }
  .mg-dialog,
  .session-replay-dialog,
  .page-preview-dialog,
  .digits-modal,
  .rf-dialog {
    width: 100%;
    max-width: none;
    max-height: 100dvh;
    height: 100dvh;
    border-radius: 0;
    border-left: none;
    border-right: none;
  }
  .mg-header,
  .mg-actions,
  .session-replay-footer,
  .page-preview-footer,
  .digits-modal-actions,
  .rf-modal-actions {
    padding-left: max(16px, env(safe-area-inset-left, 0));
    padding-right: max(16px, env(safe-area-inset-right, 0));
  }
  .mg-tabs {
    overflow-x: auto;
    flex-wrap: nowrap;
    gap: 14px;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }
  .mg-tabs::-webkit-scrollbar { display: none; }
  .mg-tab { white-space: nowrap; flex-shrink: 0; }

  .notif-panel {
    left: 12px;
    right: 12px;
    width: auto;
    max-width: none;
    top: calc(52px + env(safe-area-inset-top, 0));
    max-height: min(420px, 58vh);
  }

  .start-actions,
  .wizard-row,
  .btn-row,
  .dom-add-row,
  .rf-assign-row,
  .rf-trigger-row {
    flex-direction: column;
    align-items: stretch;
  }
  .dom-add-row .field { min-width: 0; }
  .rf-trigger-row { grid-template-columns: 1fr; }

  .workspace { grid-template-columns: 1fr !important; }
  .workspace .card { min-height: auto; }
  .send-grid { grid-template-columns: 1fr !important; }
}

@media (max-width: 480px) {
  .user-pill { display: none; }
  .page-scroll { padding-top: 14px; }
  .stat-grid { grid-template-columns: 1fr; }
}

/* ── Vault / Chat module modals (match panel dark theme) ── */
#vaultOverlay:not(.off),
#chatOverlay:not(.off),
#logsOverlay:not(.off),
#userInfoOverlay:not(.off),
#manageOverlay:not(.off),
#userPanelsOverlay:not(.off),
.mod-sub-overlay:not(.off) {
  display: flex;
  align-items: center;
  justify-content: center;
}
.mod-sub-overlay { z-index: 1200; }

.mod-panel {
  position: relative;
  width: 100%;
  max-width: 500px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  background: var(--panel);
  color: var(--text);
  border: 1px solid var(--purple-border);
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.55);
  font-size: 13px;
  line-height: 1.5;
}
.vault-panel { max-width: 520px; }
.chat-panel { max-width: 460px; min-height: 400px; }
.mod-panel-sm { max-width: 460px; }

.mod-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 20px;
  background: var(--sidebar);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}
.mod-head-stack { align-items: flex-start; }
.mod-head-text { min-width: 0; flex: 1; }
.mod-title { margin: 0; font-size: 15px; font-weight: 700; color: var(--text); }
.mod-subtitle {
  margin: 4px 0 0;
  font-size: 11px;
  color: var(--text-dim);
  font-family: ui-monospace, monospace;
  word-break: break-all;
}
.mod-x {
  background: none;
  border: none;
  color: var(--text-dim);
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 4px;
  flex-shrink: 0;
}
.mod-x:hover { background: var(--purple-soft); color: var(--text); }

.mod-head-actions { display: flex; align-items: center; gap: 6px; flex-shrink: 0; }
.mod-pop {
  background: none;
  border: none;
  color: var(--text-dim);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.03em;
  text-transform: lowercase;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 6px;
  flex-shrink: 0;
  line-height: 1;
}
.mod-pop:hover { background: var(--purple-soft); color: var(--text); }
.mod-pop.is-popped { color: var(--purple-2); }

.mod-body { padding: 16px 20px; overflow-y: auto; flex: 1; min-height: 0; }

.mod-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 20px 16px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  background: var(--panel);
}
.mod-foot-left,
.mod-foot-right { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.mod-foot-end { justify-content: flex-end; }

.mod-chip-row { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.mod-chip {
  border: 1px solid var(--input-border);
  border-radius: 6px;
  padding: 6px 11px;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s, border-color 0.15s;
}
.mod-chip-purple { background: var(--purple-soft); color: var(--purple-2); border-color: var(--purple-border); }
.mod-chip-blue { background: rgba(56, 189, 248, 0.1); color: #7dd3fc; border-color: rgba(56, 189, 248, 0.28); }
.mod-chip-green { background: var(--green-bg); color: var(--green); border-color: rgba(52, 211, 153, 0.28); }
.mod-chip:hover { filter: brightness(1.08); }

.mod-context {
  margin-bottom: 14px;
  padding: 10px 12px;
  border-radius: 8px;
  background: var(--input-bg);
  border: 1px solid var(--input-border);
  color: var(--text-dim);
  font-size: 12px;
}
.mod-context strong { color: var(--text); font-family: ui-monospace, monospace; word-break: break-all; }

.mod-field { margin-bottom: 14px; }
.mod-field:last-child { margin-bottom: 0; }
.mod-label {
  display: block;
  margin-bottom: 6px;
  font-size: 10px;
  font-weight: 600;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.mod-panel input.mod-input,
.mod-panel select.mod-input,
.mod-panel textarea.mod-textarea {
  width: 100%;
  margin: 0;
  border: 1px solid var(--input-border);
  border-radius: 8px;
  background: var(--input-bg);
  color: var(--text);
  font: inherit;
  font-size: 13px;
  outline: none;
  appearance: none;
  -webkit-appearance: none;
}
.mod-panel input.mod-input,
.mod-panel select.mod-input { height: 40px; padding: 0 12px; }
.mod-panel select.mod-input {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2371717a' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 32px;
  cursor: pointer;
}
.mod-panel textarea.mod-textarea {
  padding: 10px 12px;
  resize: vertical;
  min-height: 120px;
  font-family: ui-monospace, monospace;
  font-size: 12px;
}
.mod-panel input.mod-input::placeholder,
.mod-panel textarea.mod-textarea::placeholder { color: var(--text-muted); }
.mod-panel input.mod-input:focus,
.mod-panel select.mod-input:focus,
.mod-panel textarea.mod-textarea:focus { border-color: var(--purple-border); }

.mod-hint { margin: 5px 0 0; font-size: 11px; color: var(--text-muted); line-height: 1.45; }
.mod-hint-block { margin-bottom: 8px; }
.mod-hint code { font-family: ui-monospace, monospace; color: var(--text-dim); }
.mod-code {
  margin: 0 0 10px;
  padding: 10px 12px;
  border-radius: 8px;
  background: var(--input-bg);
  border: 1px solid var(--input-border);
  color: var(--text-dim);
  font-family: ui-monospace, monospace;
  font-size: 11px;
  white-space: pre-wrap;
}

.mod-check {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 2px;
  font-size: 12px;
  color: var(--text);
  cursor: pointer;
  text-transform: none;
  letter-spacing: 0;
}
.mod-check input { width: 15px; height: 15px; accent-color: var(--purple); cursor: pointer; }

.mod-btn-text {
  border: none;
  background: none;
  color: var(--text-dim);
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  padding: 8px 12px;
  border-radius: 8px;
}
.mod-btn-text:hover { color: var(--text); background: rgba(255, 255, 255, 0.04); }

.mod-btn-primary {
  border: none;
  border-radius: 8px;
  padding: 9px 16px;
  font: inherit;
  font-size: 12px;
  font-weight: 700;
  color: #fff;
  background: linear-gradient(135deg, var(--green), #6ee7b7);
  cursor: pointer;
  white-space: nowrap;
}
.mod-btn-primary:hover { opacity: 0.92; }
.mod-btn-primary.mod-btn-purple { background: linear-gradient(135deg, var(--purple), #a78bfa); }
.mod-btn-primary:disabled,
.mod-chip:disabled { opacity: 0.45; cursor: not-allowed; }

.mod-loading { font-size: 12px; color: var(--text-dim); padding: 4px 0; }

.mod-toast {
  position: absolute;
  left: 20px;
  right: 20px;
  bottom: 64px;
  padding: 9px 12px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 600;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
  text-align: center;
  z-index: 2;
}
.mod-toast.on { opacity: 1; }
.mod-toast.on.ok { background: var(--green-bg); color: var(--green); border: 1px solid rgba(52, 211, 153, 0.35); }
.mod-toast.on.err { background: var(--red-bg); color: var(--red); border: 1px solid rgba(248, 113, 113, 0.35); }

.chat-panel .mod-body.mod-chat-body {
  display: flex;
  flex-direction: column;
  min-height: 340px;
  padding: 0 20px 16px;
}
.mod-chat-messages {
  flex: 1;
  min-height: 260px;
  max-height: 360px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 16px 0 12px;
  scrollbar-width: thin;
  scrollbar-color: #3f3f46 transparent;
}
.mod-chat-empty {
  margin: auto;
  text-align: center;
  color: var(--text-muted);
  font-size: 13px;
  padding: 32px 12px;
}
.mod-chat-compose {
  display: flex;
  align-items: center;
  gap: 8px;
  padding-top: 12px;
  margin-top: auto;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  flex-shrink: 0;
}
.mod-panel input.mod-chat-input { flex: 1; min-width: 0; height: 40px; border-radius: 10px; }
.mod-chat-send {
  width: 40px;
  height: 40px;
  border: 1px solid var(--input-border);
  border-radius: 10px;
  background: var(--input-bg);
  color: var(--text-dim);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  padding: 0;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.mod-chat-send:hover { background: var(--purple-soft); border-color: var(--purple-border); color: var(--purple-2); }
.mod-chat-send svg { display: block; }

.mod-chat-msg { display: flex; width: 100%; }
.mod-chat-msg-in { justify-content: flex-end; }
.mod-chat-msg-out { justify-content: flex-start; }
.mod-chat-msg-bubble {
  max-width: 82%;
  padding: 9px 13px;
  border-radius: 16px;
  font-size: 13px;
  line-height: 1.45;
  word-break: break-word;
}
.mod-chat-msg-in .mod-chat-msg-bubble {
  background: linear-gradient(135deg, var(--purple), #8b5cf6);
  color: #fff;
  border-bottom-right-radius: 4px;
}
.mod-chat-msg-out .mod-chat-msg-bubble {
  background: #18181b;
  color: var(--text);
  border: 1px solid #27272a;
  border-bottom-left-radius: 4px;
}
.mod-chat-ts { color: var(--text-muted); font-size: 10px; margin-top: 4px; }

@media (max-width: 520px) {
  .mod-foot { flex-direction: column; align-items: stretch; }
  .mod-foot-left, .mod-foot-right { justify-content: flex-end; }
  .mod-foot-left { order: 2; }
  .mod-foot-right { order: 1; }
}

.mod-vault-override {
  margin-bottom: 14px;
  padding: 14px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--input-border);
}
.mod-vault-override-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 0;
}
.mod-vault-override-body:not([hidden]) {
  margin-top: 10px;
}
.mod-vault-override-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}
.mod-check-inline {
  margin: 0;
  font-size: 12px;
  color: var(--text-dim);
  text-transform: none;
  letter-spacing: 0;
}
.mod-vault-override .mod-input { margin-bottom: 6px; }
.mod-vault-override-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}
.mod-chip-orange {
  background: rgba(251, 146, 60, 0.12);
  color: #fdba74;
  border-color: rgba(251, 146, 60, 0.28);
}
.mod-field-check { margin-bottom: 0; }
.mod-field-check .mod-check {
  font-size: 12px;
  color: var(--text-dim);
}

/* Panels user settings modal + manage grid */
.user-panels-dialog { width: min(560px, calc(100vw - 32px)); max-height: min(80vh, 720px); }
#userPanelsOverlay .mod-body { max-height: 60vh; overflow-y: auto; }
.panels-user-sub { font-size: 12px; color: var(--text-dim); margin: 0 0 14px; line-height: 1.5; }
.panels-user-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}
.panels-user-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--input-border);
  min-width: 0;
}
.panels-user-card-info {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  flex: 1;
}
.panels-user-card-info .mg-head-dot {
  width: 22px;
  height: 22px;
  min-width: 22px;
  font-size: 8px;
}
.panels-user-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.panels-user-switch {
  position: relative;
  width: 46px;
  height: 26px;
  border: none;
  border-radius: 999px;
  background: #ef4444;
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.2s;
}
.panels-user-switch.on { background: #22c55e; }
.panels-user-switch-knob {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #fff;
  transition: transform 0.2s;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.28);
}
.panels-user-switch.on .panels-user-switch-knob { transform: translateX(20px); }
@media (max-width: 640px) {
  .panels-user-grid { grid-template-columns: 1fr; }
}
.panels-user-grid-manage { grid-template-columns: 1fr; }
