/* Bezar — personal operations panel */
@font-face {
  font-family: "Vazirmatn";
  src: url("../fonts/Vazirmatn-Variable.woff2") format("woff2-variations"), url("../fonts/Vazirmatn-Variable.woff2") format("woff2");
  font-weight: 100 900;
  font-display: swap;
}

:root {
  --bg: #070912;
  --bg-2: #0c1020;
  --surface: rgba(20, 25, 45, .72);
  --surface-solid: #121729;
  --surface-2: rgba(255, 255, 255, .04);
  --border: rgba(148, 163, 255, .12);
  --border-strong: rgba(148, 163, 255, .22);
  --text: #e8eaf6;
  --text-2: #a3a9c7;
  --text-3: #6b7196;
  --primary: #8b5cf6;
  --primary-2: #06b6d4;
  --grad: linear-gradient(135deg, #8b5cf6 0%, #6366f1 45%, #06b6d4 100%);
  --success: #22c55e;
  --warning: #f59e0b;
  --danger: #f43f5e;
  --info: #38bdf8;
  --radius: 18px;
  --radius-sm: 12px;
  --shadow: 0 20px 50px -20px rgba(0, 0, 0, .6);
  --sidebar-w: 270px;
  color-scheme: dark;
}

:root[data-theme="light"] {
  --bg: #f3f5fb;
  --bg-2: #e9ecf7;
  --surface: rgba(255, 255, 255, .82);
  --surface-solid: #ffffff;
  --surface-2: rgba(15, 23, 42, .035);
  --border: rgba(30, 41, 99, .09);
  --border-strong: rgba(30, 41, 99, .16);
  --text: #141a33;
  --text-2: #4b5375;
  --text-3: #8890b0;
  --shadow: 0 20px 50px -24px rgba(30, 41, 99, .25);
  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: "Vazirmatn", Tahoma, sans-serif;
  font-feature-settings: "ss01";
  background: var(--bg);
  color: var(--text);
  font-size: 14.5px;
  line-height: 1.7;
  min-height: 100vh;
  overflow-x: hidden;
}
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(900px 500px at 100% -10%, rgba(139, 92, 246, .16), transparent 60%),
    radial-gradient(700px 500px at -10% 110%, rgba(6, 182, 212, .12), transparent 60%),
    var(--bg);
}
a { color: inherit; text-decoration: none; }
h1, h2, h3, h4 { margin: 0; line-height: 1.35; font-weight: 800; }
p { margin: 0; }
.ic { width: 20px; height: 20px; flex: none; display: inline-block; vertical-align: middle; }
.ic.sm { width: 16px; height: 16px; }
.ic.lg { width: 26px; height: 26px; }
.muted { color: var(--text-2); }
.faint { color: var(--text-3); }
.ltr { direction: ltr; unicode-bidi: isolate; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 13px; }
.hidden { display: none !important; }
.grad-text { background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }

/* ---------- Layout ---------- */
.app { display: flex; min-height: 100vh; }
.sidebar {
  position: fixed;
  inset-block: 0;
  inset-inline-start: 0;
  width: var(--sidebar-w);
  padding: 22px 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  background: var(--surface);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-inline-end: 1px solid var(--border);
  z-index: 40;
  transition: transform .3s ease;
}
.brand { display: flex; align-items: center; gap: 12px; padding: 4px 10px 22px; }
.brand-name { font-size: 20px; font-weight: 900; letter-spacing: -.3px; }
.brand-sub { font-size: 11.5px; color: var(--text-3); margin-top: -2px; }
.nav-label { font-size: 11.5px; color: var(--text-3); padding: 14px 14px 6px; font-weight: 600; }
.nav a, .nav .nav-soon {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-radius: 12px;
  color: var(--text-2);
  font-weight: 500;
  transition: background .2s, color .2s;
  position: relative;
}
.nav a:hover { background: var(--surface-2); color: var(--text); }
.nav a.active {
  color: var(--text);
  background: linear-gradient(90deg, rgba(139, 92, 246, .0), rgba(139, 92, 246, .18));
}
.nav a.active::before {
  content: "";
  position: absolute;
  inset-inline-start: -16px;
  top: 8px;
  bottom: 8px;
  width: 4px;
  border-radius: 0 4px 4px 0;
  background: var(--grad);
}
[dir="rtl"] .nav a.active { background: linear-gradient(270deg, rgba(139, 92, 246, .0), rgba(139, 92, 246, .18)); }
[dir="rtl"] .nav a.active::before { border-radius: 4px 0 0 4px; }
.nav a.active .ic { color: var(--primary); }
.nav .nav-soon { opacity: .5; cursor: default; }
.nav .count {
  margin-inline-start: auto;
  min-width: 22px;
  height: 22px;
  padding: 0 7px;
  border-radius: 99px;
  background: var(--danger);
  color: #fff;
  font-size: 11.5px;
  font-weight: 700;
  display: grid;
  place-items: center;
}
.nav .soon { margin-inline-start: auto; font-size: 10.5px; padding: 1px 8px; border-radius: 99px; border: 1px solid var(--border-strong); }
.sidebar-foot { margin-top: auto; }
.api-pill {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border-radius: 14px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  font-size: 12.5px;
}
.dot { display: inline-block; vertical-align: middle; width: 9px; height: 9px; min-width: 9px; border-radius: 50%; aspect-ratio: 1; background: var(--text-3); flex: none; }
.dot.on { background: var(--success); box-shadow: 0 0 0 4px rgba(34, 197, 94, .18); animation: pulse 2s infinite; }
.dot.warn { background: var(--warning); }
.dot.off { background: var(--danger); }
@keyframes pulse { 50% { box-shadow: 0 0 0 7px rgba(34, 197, 94, .05); } }

.main { flex: 1; margin-inline-start: var(--sidebar-w); min-width: 0; padding: 24px 32px 48px; }
.topbar { display: flex; align-items: center; gap: 14px; margin-bottom: 26px; }
.topbar h1 { font-size: 24px; }
.topbar .sub { color: var(--text-3); font-size: 13px; }
.topbar .spacer { flex: 1; }
.icon-btn {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-2);
  cursor: pointer;
  position: relative;
  transition: .2s;
}
.icon-btn:hover { color: var(--text); border-color: var(--border-strong); }
.icon-btn .badge-dot { position: absolute; top: 9px; inset-inline-end: 10px; width: 8px; height: 8px; background: var(--danger); border-radius: 50%; box-shadow: 0 0 0 2px var(--surface-solid); }
.menu-btn { display: none; }
.user-chip { display: flex; align-items: center; gap: 10px; padding: 5px 5px 5px 14px; border-radius: 14px; background: var(--surface); border: 1px solid var(--border); }
[dir="rtl"] .user-chip { padding: 5px 14px 5px 5px; }
.avatar { width: 34px; height: 34px; border-radius: 10px; background: var(--grad); display: grid; place-items: center; color: #fff; font-weight: 800; }
.user-chip .n { font-weight: 700; font-size: 13px; line-height: 1.2; }
.user-chip .r { font-size: 11px; color: var(--text-3); }

/* ---------- Cards / grid ---------- */
.grid { display: grid; gap: 18px; }
.g-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.g-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g-main { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
.mt { margin-top: 18px; }
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  box-shadow: var(--shadow);
  min-width: 0;
}
.card-h { display: flex; align-items: center; gap: 10px; margin-bottom: 16px; }
.card-h h3 { font-size: 15.5px; }
.card-h .spacer { flex: 1; }
.card-h a.more { font-size: 12.5px; color: var(--text-3); }
.card-h a.more:hover { color: var(--primary); }

.stat { position: relative; overflow: hidden; }
.stat .s-ic { width: 46px; height: 46px; border-radius: 14px; display: grid; place-items: center; margin-bottom: 14px; }
.stat .s-label { color: var(--text-2); font-size: 13px; }
.stat .s-val { font-size: 25px; font-weight: 900; margin-top: 2px; letter-spacing: -.3px; }
.stat .s-foot { font-size: 12px; margin-top: 8px; color: var(--text-3); display: flex; align-items: center; gap: 6px; }
.stat::after { content: ""; position: absolute; inset-inline-end: -40px; top: -40px; width: 130px; height: 130px; border-radius: 50%; opacity: .12; filter: blur(10px); }
.t-violet .s-ic { background: rgba(139, 92, 246, .15); color: #a78bfa; } .t-violet::after { background: #8b5cf6; }
.t-cyan .s-ic { background: rgba(6, 182, 212, .15); color: #22d3ee; } .t-cyan::after { background: #06b6d4; }
.t-green .s-ic { background: rgba(34, 197, 94, .15); color: #4ade80; } .t-green::after { background: #22c55e; }
.t-rose .s-ic { background: rgba(244, 63, 94, .15); color: #fb7185; } .t-rose::after { background: #f43f5e; }
.t-amber .s-ic { background: rgba(245, 158, 11, .15); color: #fbbf24; } .t-amber::after { background: #f59e0b; }
.up { color: var(--success); } .down { color: var(--danger); }

.hero {
  position: relative;
  overflow: hidden;
  padding: 26px 28px;
  border-radius: 22px;
  background: var(--grad);
  color: #fff;
  margin-bottom: 18px;
  box-shadow: 0 25px 60px -25px rgba(99, 102, 241, .7);
}
.hero::before, .hero::after { content: ""; position: absolute; border-radius: 50%; background: rgba(255, 255, 255, .12); }
.hero::before { width: 260px; height: 260px; inset-inline-end: -60px; top: -120px; }
.hero::after { width: 160px; height: 160px; inset-inline-end: 160px; bottom: -110px; }
.hero h2 { font-size: 22px; position: relative; z-index: 1; }
.hero p { opacity: .88; margin-top: 4px; position: relative; z-index: 1; }
.hero .chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; position: relative; z-index: 1; }
.hero .chip { background: rgba(255, 255, 255, .16); border: 1px solid rgba(255, 255, 255, .22); padding: 5px 12px; border-radius: 99px; font-size: 12.5px; display: inline-flex; align-items: center; gap: 6px; }

/* ---------- Lists / tables ---------- */
.list { display: flex; flex-direction: column; }
.list-item { display: flex; align-items: center; gap: 12px; padding: 12px 4px; border-bottom: 1px dashed var(--border); }
.list-item:last-child { border-bottom: 0; }
.list-item .grow { flex: 1; min-width: 0; }
.list-item .t { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list-item .m { font-size: 12px; color: var(--text-3); }
.empty { text-align: center; padding: 34px 10px; color: var(--text-3); }
.empty .ic { width: 40px; height: 40px; opacity: .5; margin-bottom: 8px; }

.table-wrap { overflow-x: auto; margin: 0 -20px; padding: 0 20px; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.tbl th { text-align: start; font-weight: 600; color: var(--text-3); font-size: 12.5px; padding: 10px 12px; border-bottom: 1px solid var(--border); white-space: nowrap; }
.tbl td { padding: 13px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl tr:hover td { background: var(--surface-2); }
.tbl .actions { display: flex; gap: 6px; justify-content: flex-end; }
.tbl .title-cell { font-weight: 600; }
.tbl .title-cell small { display: block; color: var(--text-3); font-weight: 400; }

.badge { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 99px; font-size: 12px; font-weight: 600; white-space: nowrap; border: 1px solid transparent; }
.b-critical, .b-danger, .b-down, .b-expense { background: rgba(244, 63, 94, .13); color: #fb7185; border-color: rgba(244, 63, 94, .25); }
.b-high, .b-warning { background: rgba(245, 158, 11, .13); color: #fbbf24; border-color: rgba(245, 158, 11, .25); }
.b-medium, .b-info, .b-in_progress, .b-maintenance { background: rgba(56, 189, 248, .13); color: #38bdf8; border-color: rgba(56, 189, 248, .25); }
.b-low, .b-paused, .b-neutral { background: var(--surface-2); color: var(--text-2); border-color: var(--border); }
.b-online, .b-success, .b-done, .b-income { background: rgba(34, 197, 94, .13); color: #4ade80; border-color: rgba(34, 197, 94, .25); }
.b-open { background: rgba(139, 92, 246, .13); color: #a78bfa; border-color: rgba(139, 92, 246, .25); }
:root[data-theme="light"] .b-critical, :root[data-theme="light"] .b-danger, :root[data-theme="light"] .b-down, :root[data-theme="light"] .b-expense { color: #e11d48; }
:root[data-theme="light"] .b-high, :root[data-theme="light"] .b-warning { color: #b45309; }
:root[data-theme="light"] .b-medium, :root[data-theme="light"] .b-info, :root[data-theme="light"] .b-in_progress, :root[data-theme="light"] .b-maintenance { color: #0369a1; }
:root[data-theme="light"] .b-online, :root[data-theme="light"] .b-success, :root[data-theme="light"] .b-done, :root[data-theme="light"] .b-income { color: #15803d; }
:root[data-theme="light"] .b-open { color: #6d28d9; }
.prio-bar { width: 4px; align-self: stretch; border-radius: 4px; flex: none; }
.prio-bar.critical { background: var(--danger); } .prio-bar.high { background: var(--warning); } .prio-bar.medium { background: var(--info); } .prio-bar.low { background: var(--text-3); }

.site-tile { display: flex; align-items: center; gap: 12px; padding: 12px; border-radius: 14px; background: var(--surface-2); border: 1px solid var(--border); }
.site-tile .fav { width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center; background: rgba(139, 92, 246, .14); color: #a78bfa; font-weight: 800; }

/* ---------- Forms / buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 42px;
  padding: 0 18px;
  border-radius: 12px;
  border: 1px solid var(--border-strong);
  background: var(--surface-2);
  color: var(--text);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  transition: transform .15s, box-shadow .2s, background .2s, border-color .2s;
  white-space: nowrap;
}
.btn:hover { border-color: var(--primary); }
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--grad); border: 0; color: #fff; box-shadow: 0 10px 25px -10px rgba(99, 102, 241, .8); }
.btn-primary:hover { box-shadow: 0 14px 30px -10px rgba(99, 102, 241, .95); }
.btn-danger { background: rgba(244, 63, 94, .12); border-color: rgba(244, 63, 94, .35); color: #fb7185; }
.btn-danger:hover { background: rgba(244, 63, 94, .2); border-color: var(--danger); }
.btn-success { background: rgba(34, 197, 94, .12); border-color: rgba(34, 197, 94, .35); color: #4ade80; }
.btn-sm { height: 34px; padding: 0 12px; font-size: 13px; border-radius: 10px; }
.btn-icon { width: 34px; height: 34px; padding: 0; border-radius: 10px; }
.btn-block { width: 100%; }
.btn[disabled] { opacity: .6; cursor: not-allowed; }

.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.field label { font-size: 13px; font-weight: 600; color: var(--text-2); }
.field .hint { font-size: 12px; color: var(--text-3); }
.input, select.input, textarea.input {
  width: 100%;
  height: 44px;
  padding: 0 14px;
  border-radius: 12px;
  border: 1px solid var(--border-strong);
  background: var(--surface-2);
  color: var(--text);
  font: inherit;
  outline: none;
  transition: border-color .2s, box-shadow .2s, background .2s;
}
textarea.input { height: auto; min-height: 96px; padding: 12px 14px; resize: vertical; }
.input:focus { border-color: var(--primary); box-shadow: 0 0 0 4px rgba(139, 92, 246, .16); background: transparent; }
select.input option { background: var(--surface-solid); color: var(--text); }
.input-wrap { position: relative; }
.input-wrap .ic { position: absolute; top: 50%; transform: translateY(-50%); inset-inline-start: 14px; color: var(--text-3); pointer-events: none; }
.input-wrap .input { padding-inline-start: 44px; }
.input-wrap .toggle-pass { position: absolute; top: 50%; transform: translateY(-50%); inset-inline-end: 8px; background: none; border: 0; color: var(--text-3); cursor: pointer; padding: 6px; }
.input-wrap .toggle-pass .ic { position: static; transform: none; }
.row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 14px; }
.row-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0 14px; }
.toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 16px; }
.toolbar .spacer { flex: 1; }
.toolbar .input { width: auto; min-width: 150px; height: 40px; }
.seg { display: inline-flex; padding: 4px; gap: 4px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--border); }
.seg a { padding: 5px 14px; border-radius: 9px; font-size: 13px; color: var(--text-2); }
.seg a.on { background: var(--surface-solid); color: var(--text); box-shadow: 0 2px 8px rgba(0, 0, 0, .2); }
.check { display: flex; align-items: center; gap: 10px; cursor: pointer; }
.check input { width: 18px; height: 18px; accent-color: var(--primary); }

/* Duration picker */
.dur-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.dur-grid label { position: relative; cursor: pointer; }
.dur-grid input { position: absolute; opacity: 0; inset: 0; }
.dur-grid span { display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 12px 6px; border-radius: 12px; border: 1px solid var(--border-strong); background: var(--surface-2); font-weight: 700; text-align: center; transition: .2s; min-height: 64px; }
.dur-grid span small { font-weight: 400; color: var(--text-3); font-size: 11.5px; }
.dur-grid input:checked + span { border-color: var(--primary); background: rgba(139, 92, 246, .14); box-shadow: 0 0 0 3px rgba(139, 92, 246, .15); }
.dur-grid input:focus-visible + span { outline: 2px solid var(--primary); }

/* Alerts */
.flashes { display: flex; flex-direction: column; gap: 10px; margin-bottom: 18px; }
.alert { display: flex; align-items: flex-start; gap: 10px; padding: 12px 16px; border-radius: 14px; border: 1px solid; font-size: 13.5px; transition: opacity .4s, transform .4s; }
.alert.success { background: rgba(34, 197, 94, .1); border-color: rgba(34, 197, 94, .3); color: #4ade80; }
.alert.error { background: rgba(244, 63, 94, .1); border-color: rgba(244, 63, 94, .3); color: #fb7185; }
.alert.info { background: rgba(56, 189, 248, .1); border-color: rgba(56, 189, 248, .3); color: #38bdf8; }
.alert.warning { background: rgba(245, 158, 11, .1); border-color: rgba(245, 158, 11, .3); color: #fbbf24; }
:root[data-theme="light"] .alert.success { color: #15803d; }
:root[data-theme="light"] .alert.error { color: #be123c; }
:root[data-theme="light"] .alert.info { color: #0369a1; }
:root[data-theme="light"] .alert.warning { color: #b45309; }
.alert.fade { opacity: 0; transform: translateY(-6px); }

.secret-box { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-radius: 12px; background: rgba(0, 0, 0, .3); border: 1px dashed var(--primary); word-break: break-all; }
:root[data-theme="light"] .secret-box { background: rgba(139, 92, 246, .06); }
.secret-box code { flex: 1; direction: ltr; text-align: left; }
pre.code { margin: 0; padding: 14px 16px; border-radius: 12px; background: rgba(0, 0, 0, .35); border: 1px solid var(--border); overflow-x: auto; direction: ltr; text-align: left; font-size: 12.5px; line-height: 1.65; white-space: pre-wrap; word-break: break-word; }
:root[data-theme="light"] pre.code { background: #0f1426; color: #dfe3f7; }

/* Progress */
.progress { height: 8px; border-radius: 99px; background: var(--surface-2); overflow: hidden; border: 1px solid var(--border); }
.progress > i { display: block; height: 100%; width: 0; background: var(--grad); border-radius: 99px; transition: width 1s ease; }

/* Dialog */
dialog.modal { width: min(560px, calc(100vw - 32px)); padding: 0; border: 1px solid var(--border-strong); border-radius: 22px; background: var(--surface-solid); color: var(--text); box-shadow: 0 40px 80px -20px rgba(0, 0, 0, .7); }
dialog.modal::backdrop { background: rgba(5, 7, 15, .65); backdrop-filter: blur(4px); }
dialog.modal[open] { animation: pop .22s ease; }
@keyframes pop { from { opacity: 0; transform: translateY(10px) scale(.98); } }
.modal-h { display: flex; align-items: center; padding: 18px 22px; border-bottom: 1px solid var(--border); }
.modal-h h3 { flex: 1; font-size: 16px; }
.modal-b { padding: 20px 22px 6px; max-height: 70vh; overflow-y: auto; }
.modal-f { display: flex; gap: 10px; justify-content: flex-end; padding: 14px 22px 20px; }

.chart-box { position: relative; height: 290px; }
.kv { display: flex; justify-content: space-between; gap: 10px; padding: 9px 0; border-bottom: 1px dashed var(--border); font-size: 13.5px; }
.kv:last-child { border-bottom: 0; }
.kv span:first-child { color: var(--text-2); }
.qr { background: #fff; padding: 12px; border-radius: 14px; display: inline-block; line-height: 0; }
.qr img, .qr svg { width: 180px; height: 180px; }

/* ---------- Auth pages ---------- */
.auth {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr);
}
.auth-art {
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 56px;
  background: #080b18;
  color: #fff;
}
.auth-art .blob { position: absolute; border-radius: 50%; filter: blur(60px); opacity: .7; animation: float 14s ease-in-out infinite; }
.auth-art .b1 { width: 420px; height: 420px; background: #7c3aed; top: -80px; inset-inline-start: -60px; }
.auth-art .b2 { width: 360px; height: 360px; background: #0891b2; bottom: 10%; inset-inline-end: -80px; animation-delay: -5s; }
.auth-art .b3 { width: 260px; height: 260px; background: #4f46e5; top: 40%; inset-inline-start: 30%; animation-delay: -9s; }
@keyframes float { 50% { transform: translate(30px, -40px) scale(1.08); } }
.auth-art .gridlines { position: absolute; inset: 0; background-image: linear-gradient(rgba(255, 255, 255, .05) 1px, transparent 1px), linear-gradient(90deg, rgba(255, 255, 255, .05) 1px, transparent 1px); background-size: 44px 44px; mask-image: radial-gradient(circle at 50% 40%, #000, transparent 75%); -webkit-mask-image: radial-gradient(circle at 50% 40%, #000, transparent 75%); }
.auth-art > .content { position: relative; z-index: 2; max-width: 520px; }
.auth-art h1 { font-size: 38px; font-weight: 900; line-height: 1.35; }
.auth-art p { color: rgba(255, 255, 255, .72); margin-top: 12px; font-size: 15px; }
.feature-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-top: 30px; }
.feature { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-radius: 14px; background: rgba(255, 255, 255, .06); border: 1px solid rgba(255, 255, 255, .1); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); font-size: 13.5px; }
.feature .ic { color: #a5b4fc; }
.float-card { position: absolute; z-index: 2; top: 70px; inset-inline-end: 56px; width: 250px; padding: 16px; border-radius: 18px; background: rgba(255, 255, 255, .08); border: 1px solid rgba(255, 255, 255, .14); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px); animation: float 10s ease-in-out infinite; }
.float-card .lbl { font-size: 12px; color: rgba(255, 255, 255, .6); }
.float-card .val { font-size: 22px; font-weight: 900; }
.float-card .bars { display: flex; align-items: flex-end; gap: 6px; height: 54px; margin-top: 10px; }
.float-card .bars i { flex: 1; border-radius: 5px 5px 2px 2px; background: linear-gradient(180deg, #a78bfa, #22d3ee); opacity: .85; }
.float-card .bars i:nth-child(1) { height: 35%; } .float-card .bars i:nth-child(2) { height: 55%; } .float-card .bars i:nth-child(3) { height: 42%; } .float-card .bars i:nth-child(4) { height: 70%; } .float-card .bars i:nth-child(5) { height: 62%; } .float-card .bars i:nth-child(6) { height: 92%; }

.auth-form-side { display: flex; align-items: center; justify-content: center; padding: 40px 24px; }
.auth-box { width: 100%; max-width: 410px; }
.auth-box .brand { padding: 0 0 30px; }
.auth-box h2 { font-size: 26px; }
.auth-box .lead { color: var(--text-2); margin: 6px 0 28px; }
.auth-foot { margin-top: 26px; display: flex; align-items: center; gap: 8px; color: var(--text-3); font-size: 12.5px; }
.otp-input { text-align: center; letter-spacing: 12px; font-size: 24px; font-weight: 800; height: 58px; direction: ltr; }
.theme-float { position: fixed; top: 18px; inset-inline-end: 18px; z-index: 10; }

/* Install page */
.install-wrap { max-width: 720px; margin: 0 auto; padding: 40px 16px 60px; }
.req { display: flex; align-items: center; gap: 10px; padding: 8px 0; }
.req .ok { color: var(--success); } .req .bad { color: var(--danger); }

/* ---------- Responsive ---------- */
.scrim { display: none; }
@media (max-width: 1200px) {
  .g-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .g-main { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 980px) {
  .sidebar { transform: translateX(-100%); }
  [dir="rtl"] .sidebar { transform: translateX(100%); }
  body.nav-open .sidebar { transform: none; }
  body.nav-open .scrim { display: block; position: fixed; inset: 0; background: rgba(0, 0, 0, .5); z-index: 30; }
  .main { margin-inline-start: 0; padding: 16px 16px 40px; }
  .menu-btn { display: grid; }
  .auth { grid-template-columns: minmax(0, 1fr); }
  .auth-art { display: none; }
  .g-3, .g-2 { grid-template-columns: minmax(0, 1fr); }
  .user-chip .meta { display: none; }
}
@media (max-width: 560px) {
  .g-4 { grid-template-columns: minmax(0, 1fr); }
  .row, .row-3 { grid-template-columns: minmax(0, 1fr); }
  .dur-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .topbar h1 { font-size: 20px; }
  .hero { padding: 22px; }
  .toolbar .input { min-width: 0; flex: 1; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
.input.btn-sm { height: 34px; width: auto; min-width: 130px; padding: 0 10px; font-size: 13px; }
.inline-status { margin: 0; }
a.card.stat { display: block; transition: transform .2s, border-color .2s; }
a.card.stat:hover { transform: translateY(-2px); border-color: var(--border-strong); }
.list-item .actions { display: flex; gap: 6px; flex: none; }
.list-item .actions form { margin: 0; }
.badge-btn { cursor: pointer; font: inherit; font-size: 12px; }
.field.check { flex-direction: row; align-items: center; }
.check.hint { display: flex; gap: 6px; margin-top: 4px; }
.input.ltr, .ltr .input, .mono { font-feature-settings: normal; }
.input.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 13.5px; }
.offs { display: flex; flex-wrap: wrap; gap: 8px; }
.chip-check { position: relative; cursor: pointer; }
.chip-check input { position: absolute; opacity: 0; inset: 0; }
.chip-check span { display: inline-block; padding: 6px 14px; border-radius: 99px; border: 1px solid var(--border-strong); background: var(--surface-2); font-size: 13px; transition: .15s; }
.chip-check input:checked + span { background: rgba(139, 92, 246, .18); border-color: var(--primary); color: var(--text); }
.chip-check input:focus-visible + span { outline: 2px solid var(--primary); }
.site-tile .grow { flex: 1; min-width: 0; }
.site-tile .t { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.site-tile .m { font-size: 12px; }
a.site-tile:hover { border-color: var(--border-strong); }
.acc-card { padding: 18px; border-radius: 16px; background: var(--surface-2); border: 1px solid var(--border); display: flex; flex-direction: column; gap: 8px; }
.acc-top { display: flex; justify-content: space-between; gap: 10px; align-items: flex-start; }
.acc-name { font-weight: 800; font-size: 16px; }
.acc-bal { font-size: 26px; font-weight: 900; letter-spacing: -.3px; }
.acc-meta { font-size: 12px; }
.acc-manual { display: flex; gap: 8px; margin-top: 4px; }
.acc-manual .input { flex: 1; }
ol.steps { margin: 0; padding-inline-start: 20px; display: flex; flex-direction: column; gap: 10px; color: var(--text-2); }
ol.steps b { color: var(--text); }
.acc-top .actions { display: flex; gap: 6px; flex: none; } .acc-top .actions form { margin: 0; }
.progress.bar-exp > i { background: linear-gradient(90deg, #f43f5e, #fb7185); }
.progress.bar-inc > i { background: linear-gradient(90deg, #22c55e, #4ade80); }
.kv + .progress { margin-bottom: 6px; }
.tbl.matrix td, .tbl.matrix th { text-align: center; white-space: nowrap; }
.tbl.matrix td:first-child, .tbl.matrix th:first-child { text-align: start; }
.tbl.matrix tr.sum td { border-top: 1px solid var(--border-strong); background: var(--surface-2); font-weight: 600; }
.acc-btns { display: flex; flex-wrap: wrap; gap: 6px; }
/* ---------- Live chat inbox ---------- */
.chat-app { display: grid; grid-template-columns: 330px minmax(0, 1fr) 290px; gap: 14px; height: calc(100vh - 190px); min-height: 520px; }
.chat-list, .chat-thread, .chat-info { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; display: flex; flex-direction: column; min-width: 0; }
.chat-list-h { padding: 12px; display: flex; flex-direction: column; gap: 8px; border-bottom: 1px solid var(--border); }
.chat-list-h .input.btn-sm { width: 100%; }
.seg-sm a { padding: 3px 12px; font-size: 12.5px; }
.chat-items { overflow-y: auto; flex: 1; }
.chat-item { display: flex; gap: 11px; align-items: flex-start; padding: 12px 14px; border-bottom: 1px solid var(--border); cursor: pointer; transition: background .15s; }
.chat-item:hover { background: var(--surface-2); }
.chat-item.on { background: rgba(139, 92, 246, .14); }
.chat-item.unread .ci-ex { color: var(--text); font-weight: 600; }
.ci-top { display: flex; align-items: center; gap: 8px; }
.ci-top b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ci-top .count { margin-inline-start: auto; min-width: 22px; height: 22px; border-radius: 11px; background: var(--danger); color: #fff; font-size: 11.5px; display: grid; place-items: center; padding: 0 6px; }
.ci-ex { font-size: 13px; color: var(--text-2); margin-top: 3px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ci-meta { display: flex; gap: 10px; font-size: 11.5px; color: var(--text-3); margin-top: 3px; }
.ci-page { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 170px; }
.chat-thread-h { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-bottom: 1px solid var(--border); min-height: 58px; }
.chat-thread-h .spacer { flex: 1; }
.chat-msgs { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 10px; }
.cm { max-width: 78%; display: flex; flex-direction: column; }
.cm-b { padding: 9px 13px; border-radius: 16px; overflow-wrap: anywhere; line-height: 1.75; }
.cm-t { font-size: 11px; color: var(--text-3); margin-top: 3px; padding: 0 6px; }
.cm.visitor { align-self: flex-start; }
.cm.visitor .cm-b { background: var(--surface-2); border: 1px solid var(--border); border-bottom-right-radius: 5px; }
.cm.admin { align-self: flex-end; }
.cm.admin .cm-b { background: var(--grad); color: #fff; border-bottom-left-radius: 5px; }
.cm.admin .cm-b a { color: #fff; }
.cm.admin .cm-t { text-align: left; }
.cm.system { align-self: center; max-width: 90%; }
.cm.system .cm-b { background: transparent; border: 1px dashed var(--border-strong); color: var(--text-3); font-size: 12.5px; text-align: center; }
.chat-typing { padding: 0 18px 6px; font-size: 12px; color: var(--success); }
.chat-compose { display: flex; gap: 8px; align-items: flex-end; padding: 12px; border-top: 1px solid var(--border); position: relative; }
.chat-compose textarea { min-height: 46px; max-height: 140px; resize: vertical; }
.canned-pop { position: absolute; bottom: calc(100% + 6px); inset-inline-start: 12px; width: min(420px, 90%); max-height: 300px; overflow-y: auto; background: var(--surface-solid); border: 1px solid var(--border-strong); border-radius: 14px; box-shadow: var(--shadow); padding: 6px; z-index: 5; }
.cp-item { display: block; padding: 8px 10px; border-radius: 10px; font-size: 13px; }
.cp-item:hover { background: var(--surface-2); }
.chat-info { overflow-y: auto; padding: 4px 0; }
.ci-sec { padding: 12px 16px; border-bottom: 1px solid var(--border); display: flex; flex-direction: column; gap: 8px; }
.ci-sec h4 { font-size: 13.5px; margin: 0; }
.ci-sec .input.btn-sm { width: 100%; }
.ci-sec .kv { padding: 4px 0; font-size: 12.5px; }
.ci-sec .kv a { color: var(--primary); }
.pv { display: flex; justify-content: space-between; gap: 8px; font-size: 12.5px; }
.pv a { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text-2); }
.pv a:hover { color: var(--primary); }
@media (max-width: 1200px) { .chat-app { grid-template-columns: 290px minmax(0, 1fr); } .chat-info { display: none; } }
@media (max-width: 780px) { .chat-app { grid-template-columns: minmax(0, 1fr); height: auto; } .chat-list { max-height: 320px; } .chat-thread { min-height: 480px; } }
.status-switch { display: flex; align-items: center; gap: 8px; margin: 0; }
.status-switch .seg button, .seg button { padding: 5px 14px; border-radius: 9px; font: inherit; font-size: 13px; color: var(--text-2); background: none; border: 0; cursor: pointer; }
.status-switch .seg button.on, .seg button.on { background: var(--surface-solid); color: var(--text); box-shadow: 0 2px 8px rgba(0, 0, 0, .2); }
.chat-live-box { border-bottom: 1px solid var(--border); }
.chat-live-box summary { padding: 8px 14px; cursor: pointer; font-size: 12.5px; font-weight: 700; color: var(--success); list-style: none; }
.chat-live-box summary::-webkit-details-marker { display: none; }
.chat-live { max-height: 210px; overflow-y: auto; }
.lv-item { display: block; padding: 8px 14px; border-top: 1px dashed var(--border); font-size: 13px; }
.lv-item:hover { background: var(--surface-2); }
.lv-item b { margin: 0 6px; }
.lv-empty { padding: 8px 14px 12px; font-size: 12.5px; }
.chat-sec-h { padding: 8px 14px; font-size: 12.5px; font-weight: 700; color: var(--text-2); border-bottom: 1px solid var(--border); background: var(--surface-2); }
.chat-live-box { border-top: 1px solid var(--border-strong); border-bottom: 0; background: var(--surface-2); }
.chat-live-box summary { color: var(--text-2); }
.prev-conv span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.snd-wrap { position: relative; }
.snd-pop { position: absolute; top: calc(100% + 8px); inset-inline-end: 0; width: 320px; z-index: 20; background: var(--surface-solid); border: 1px solid var(--border-strong); border-radius: 14px; box-shadow: var(--shadow); padding: 14px; }
.snd-pop input[type=range] { width: 100%; accent-color: var(--primary); }
.bz-sound-pill { position: fixed; bottom: 18px; inset-inline-start: 50%; transform: translateX(-50%); z-index: 100; border: 0; cursor: pointer; padding: 10px 18px; border-radius: 99px; background: var(--grad); color: #fff; font: inherit; font-weight: 700; box-shadow: 0 12px 30px -10px rgba(99, 102, 241, .9); animation: pillpulse 1.6s ease-in-out infinite; }
[dir="rtl"] .bz-sound-pill { transform: translateX(50%); }
@keyframes pillpulse { 50% { box-shadow: 0 12px 40px -6px rgba(99, 102, 241, 1); } }
.ai-answer { padding: 14px 16px; border-radius: 14px; background: var(--surface-2); border: 1px solid var(--border); line-height: 1.9; }
.on-sites { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.on-page a { color: var(--primary); }
.on-page small { display: block; max-width: 380px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* ---------- Phone layout + installed web app ---------- */
.chat-back, .chat-info-btn, .ci-close { display: none; }
#conv-status .cs-ic { font-style: normal; display: none; }
@media (max-width: 780px) { #conv-status .cs-ic { display: inline; } }
@media (max-width: 780px) {
  .chat-app { grid-template-columns: minmax(0, 1fr); height: calc(100dvh - 210px); min-height: 420px; }
  .chat-app .chat-list { max-height: none; }
  /* List view on phones: the page scrolls naturally (no squeezed inner scroll areas) */
  .chat-app:not(.show-thread) { height: auto; min-height: 0; }
  .chat-app:not(.show-thread) .chat-list { overflow: visible; }
  .chat-app:not(.show-thread) .chat-items { overflow: visible; flex: none; }
  .chat-live { max-height: 260px; }
  /* Thread on phones: full screen like a messenger app (header · messages · composer) */
  .chat-app.show-thread .chat-thread { position: fixed; top: 0; left: 0; right: 0; height: 100%; height: 100dvh; z-index: 55; border-radius: 0; border: 0; background: var(--bg, #0b0d17); }
  html.chat-full, html.chat-full body { overflow: hidden; }
  .chat-thread-h { flex-wrap: nowrap !important; padding: 8px 10px; padding-top: max(8px, env(safe-area-inset-top)); min-height: 56px; background: var(--surface-solid, #111322); }
  .chat-thread-h .spacer { display: none; }
  .chat-thread-h .th-who { flex: 1; min-width: 0; }
  .chat-thread-h .th-who b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: block; }
  .chat-thread-h .th-who small { flex-wrap: nowrap; overflow: hidden; white-space: nowrap; }
  .chat-thread-h .av { width: 34px; height: 34px; font-size: 14px; }
  .chat-thread-h .btn { flex: none; }
  .chat-thread-h .src-b { font-size: 10.5px; padding: 0 6px; }
  #conv-status .cs-tx { display: none; }
  .chat-msgs { padding: 12px 10px; }
  .chat-compose { padding: 8px; padding-bottom: max(8px, env(safe-area-inset-bottom)); gap: 6px; background: var(--surface-solid, #111322); }
  .cmp-row { gap: 4px; }
  .cmp-tool { width: 38px; height: 38px; }
  .cmp-row textarea { font-size: 16px; min-height: 42px; padding: 8px 14px; }
  .cmp-send { height: 42px; padding: 0 14px; }
  .chip { font-size: 12px; padding: 4px 10px; }
  .chat-app:not(.show-thread) .chat-thread, .chat-app .chat-info { display: none; }
  .chat-app.show-thread .chat-list { display: none; }
  .chat-app.show-thread .chat-thread { display: flex; min-height: 0; }
  .chat-app.show-info .chat-info { display: flex; position: fixed; inset: 0; z-index: 60; border-radius: 0; padding-top: env(safe-area-inset-top); padding-bottom: env(safe-area-inset-bottom); }
  .chat-back, .chat-info-btn { display: inline-grid; }
  .ci-close { display: flex; }
  .chat-thread-h { gap: 6px; }

  .status-switch .faint { display: none; }
  .snd-pop { width: min(320px, calc(100vw - 32px)); }
}
@media (display-mode: standalone) {
  .main { padding-top: max(16px, env(safe-area-inset-top)); }
  .sidebar { padding-top: max(22px, env(safe-area-inset-top)); }
}
.pwa-hint { position: fixed; bottom: max(14px, env(safe-area-inset-bottom)); left: 12px; right: 12px; z-index: 90; background: var(--surface-solid); border: 1px solid var(--border-strong); border-radius: 14px; padding: 12px 40px 12px 14px; box-shadow: var(--shadow); font-size: 13.5px; }
[dir="rtl"] .pwa-hint { padding: 12px 14px 12px 40px; }
.pwa-hint a { color: var(--primary); font-weight: 700; }
.pwa-hint button { position: absolute; top: 6px; inset-inline-end: 8px; background: none; border: 0; color: var(--text-3); font-size: 20px; cursor: pointer; }
[hidden] { display: none !important; }
@media (max-width: 560px) {
  .topbar { gap: 8px; margin-bottom: 16px; }
  .topbar h1 { font-size: 18px; white-space: nowrap; }
  .topbar .sub { display: none; }
  .topbar .icon-btn { width: 38px; height: 38px; }
  .user-chip { padding: 3px; gap: 4px; }
  .user-chip .avatar { width: 30px; height: 30px; }
  .seg { max-width: 100%; overflow-x: auto; flex-wrap: nowrap; scrollbar-width: none; }
  .seg::-webkit-scrollbar { display: none; }
  .seg a, .seg button { white-space: nowrap; flex: none; }
  .toolbar { gap: 8px; }
}
#push-state { white-space: normal; max-width: 60%; text-align: center; }

/* ===== Chat v2.6 — avatars, bubbles, receipts, typing, composer ===== */
.nav .count.pop { animation: badgePop .5s ease; }
@keyframes badgePop { 0% { transform: scale(.4); } 60% { transform: scale(1.25); } 100% { transform: scale(1); } }
.av { position: relative; flex: none; width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; color: #fff; font-weight: 700; font-size: 16px; background: var(--avc, #6366f1); box-shadow: inset 0 0 0 2px rgba(255,255,255,.12); }
.av-c0 { --avc: linear-gradient(135deg, #6366f1, #8b5cf6); } .av-c1 { --avc: linear-gradient(135deg, #0ea5e9, #2563eb); }
.av-c2 { --avc: linear-gradient(135deg, #10b981, #059669); } .av-c3 { --avc: linear-gradient(135deg, #f59e0b, #ea580c); }
.av-c4 { --avc: linear-gradient(135deg, #f43f5e, #e11d48); } .av-c5 { --avc: linear-gradient(135deg, #a855f7, #7c3aed); }
.av-c6 { --avc: linear-gradient(135deg, #ec4899, #db2777); } .av-c7 { --avc: linear-gradient(135deg, #14b8a6, #0d9488); }
.av-c8 { --avc: linear-gradient(135deg, #f97316, #c2410c); } .av-c9 { --avc: linear-gradient(135deg, #3b82f6, #4f46e5); }
.av { background: var(--avc); }
.av-st { position: absolute; bottom: 0; inset-inline-end: 0; width: 12px; height: 12px; border-radius: 50%; background: var(--text-3); border: 2px solid var(--surface-solid, #111); }
.av-st.on { background: var(--success); }
.ci-body { flex: 1; min-width: 0; }
.ci-top { justify-content: space-between; }
.ci-ago { font-size: 11px; color: var(--text-3); flex: none; }
.chat-item.unread .ci-ago { color: var(--primary); font-weight: 600; }
.ci-ex { display: flex; align-items: center; gap: 6px; }
.ci-ex .count { margin-inline-start: auto; flex: none; min-width: 20px; height: 20px; border-radius: 10px; background: var(--danger); color: #fff; font-size: 11px; display: grid; place-items: center; padding: 0 6px; font-weight: 700; }
.ci-me { color: var(--text-3); }
.ci-site { background: var(--surface-2); border: 1px solid var(--border); padding: 0 7px; border-radius: 8px; }
.ci-closed { color: var(--danger); }
.chat-item { border-inline-start: 3px solid transparent; }
.chat-item.on { border-inline-start-color: var(--primary); }
.src-b { display: inline-flex; align-items: center; gap: 3px; font-size: 11.5px; padding: 1px 8px; border-radius: 999px; background: rgba(14,165,233,.12); color: #38bdf8; border: 1px solid rgba(14,165,233,.25); white-space: nowrap; }
.src-ref { display: block; max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.on-srcs { margin-top: 6px; }
.lv-item { display: flex; gap: 10px; align-items: center; }
.lv-item .av { width: 32px; height: 32px; font-size: 13px; }
.th-who { display: flex; flex-direction: column; line-height: 1.4; min-width: 0; }
.th-who small { color: var(--text-3); font-size: 12px; display: flex; gap: 4px; align-items: center; flex-wrap: wrap; }
.chat-thread-h .av { width: 38px; height: 38px; }
.chat-msgs { gap: 6px; background-image: radial-gradient(rgba(139,92,246,.06) 1px, transparent 1px); background-size: 18px 18px; }
.cm { animation: cmIn .22s ease; }
@keyframes cmIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.cm-b { position: relative; padding: 8px 12px 6px; box-shadow: 0 1px 2px rgba(0,0,0,.15); }
.cm-b .cm-t { display: block; font-size: 10.5px; margin: 2px 0 0; padding: 0; opacity: .75; text-align: left; direction: ltr; white-space: nowrap; }
.cm.admin .cm-b .cm-t { color: rgba(255,255,255,.85); }
.cm.visitor .cm-b .cm-t { color: var(--text-3); }
.tick { font-style: normal; margin-inline-start: 4px; letter-spacing: -2px; }
.tick.seen { color: #7dd3fc; font-weight: 700; }
.cm.pending { opacity: .6; }
.cm-pg { font-size: 11px; color: var(--text-3); padding: 2px 6px; max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cm-day { align-self: center; margin: 8px 0 4px; }
.cm-day span { font-size: 11.5px; color: var(--text-2); background: var(--surface-2); border: 1px solid var(--border); padding: 2px 12px; border-radius: 999px; }
.cm.system .cm-b { box-shadow: none; }
.chat-typing { display: flex; align-items: center; gap: 8px; padding: 2px 18px 8px; }
.tdots { display: inline-flex; gap: 3px; align-items: center; }
.tdots i { width: 6px; height: 6px; border-radius: 50%; background: currentColor; animation: tdot 1.2s infinite ease-in-out; }
.tdots i:nth-child(2) { animation-delay: .15s; } .tdots i:nth-child(3) { animation-delay: .3s; }
.typing-txt .tdots { margin-inline-start: 4px; } .typing-txt .tdots i { width: 4px; height: 4px; }
@keyframes tdot { 0%, 80%, 100% { opacity: .25; transform: translateY(0); } 40% { opacity: 1; transform: translateY(-3px); } }
.chat-compose { flex-direction: column; align-items: stretch; gap: 8px; }
.cmp-row { display: flex; gap: 6px; align-items: flex-end; }
.cmp-row textarea { flex: 1; min-height: 44px; max-height: 160px; resize: none; border-radius: 22px; padding: 10px 16px; line-height: 1.6; }
.cmp-tool { width: 40px; height: 40px; border-radius: 50%; font-size: 18px; flex: none; }
.cmp-send { border-radius: 22px; height: 44px; padding: 0 18px; flex: none; }
.chat-chips { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; }
.chat-chips:empty { display: none; }
.chat-chips::-webkit-scrollbar { display: none; }
.chip { flex: none; font: inherit; font-size: 12.5px; padding: 5px 12px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--border); color: var(--text-2); cursor: pointer; transition: .15s; }
.chip:hover { border-color: var(--primary); color: var(--text); background: rgba(139,92,246,.12); }
.emoji-pop { position: absolute; bottom: calc(100% + 6px); inset-inline-start: 56px; display: grid; grid-template-columns: repeat(8, 36px); gap: 2px; background: var(--surface-solid); border: 1px solid var(--border-strong); border-radius: 14px; box-shadow: var(--shadow); padding: 6px; z-index: 6; }
.emo { font-size: 20px; width: 36px; height: 36px; border: 0; background: none; border-radius: 8px; cursor: pointer; }
.emo:hover { background: var(--surface-2); }
@media (max-width: 760px) { .cmp-send { padding: 0 14px; } .emoji-pop { grid-template-columns: repeat(6, 36px); inset-inline-start: 8px; } .cm { max-width: 88%; } }
@media (max-width: 380px) { .cmp-send .cs-tx2 { display: none; } .cmp-send { width: 42px; padding: 0; justify-content: center; } .cmp-tool { width: 34px; height: 34px; } }
/* ===== Smart reply (Gemini) ===== */
.ai-box { border: 1px solid rgba(139,92,246,.45); background: linear-gradient(135deg, rgba(139,92,246,.13), rgba(14,165,233,.08)); border-radius: 14px; padding: 10px 12px; display: flex; flex-direction: column; gap: 6px; animation: cmIn .2s ease; max-height: 42vh; overflow-y: auto; }
.ai-h { display: flex; align-items: center; gap: 8px; font-size: 12.5px; font-weight: 700; color: #c4b5fd; }
.ai-h .spacer { flex: 1; }
.ai-spark { display: inline-block; }
.ai-loading .ai-spark { animation: aiSpin 1.4s linear infinite; }
@keyframes aiSpin { to { transform: rotate(360deg); } }
.ai-flag { font-size: 11px; font-weight: 600; color: #fbbf24; background: rgba(251,191,36,.12); border: 1px solid rgba(251,191,36,.35); padding: 0 8px; border-radius: 999px; }
.ai-ms { font-size: 10.5px; font-weight: 400; color: var(--text-3); }
.ai-x { background: none; border: 0; color: var(--text-3); cursor: pointer; font-size: 14px; padding: 2px 6px; border-radius: 6px; }
.ai-x:hover { background: var(--surface-2); color: var(--text); }
.ai-note { font-size: 12px; color: var(--text-2); }
.ai-text { font-size: 14px; line-height: 1.85; color: var(--text); white-space: normal; overflow-wrap: anywhere; }
.ai-err { font-size: 12.5px; color: #fca5a5; }
.ai-act { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.ai-kbd { font-size: 11px; margin-inline-start: auto; }
.ai-skel { display: flex; flex-direction: column; gap: 6px; }
.ai-skel i { height: 10px; border-radius: 6px; background: linear-gradient(90deg, rgba(255,255,255,.06), rgba(255,255,255,.16), rgba(255,255,255,.06)); background-size: 200% 100%; animation: aiSk 1.2s infinite linear; }
.ai-skel i:nth-child(2) { width: 85%; } .ai-skel i:nth-child(3) { width: 55%; }
@keyframes aiSk { from { background-position: 200% 0; } to { background-position: -200% 0; } }
.ai-tool { color: #c4b5fd; }
@media (max-width: 780px) { .ai-kbd { display: none; } .ai-box { max-height: 34vh; } }
.ai-sites td { vertical-align: top; }
.ai-sites .input { width: 100%; }

.bz-visit-toast { position: fixed; bottom: max(18px, env(safe-area-inset-bottom)); inset-inline-start: 18px; z-index: 95; background: var(--surface-solid); color: var(--text-2); border: 1px solid var(--border-strong); border-radius: 999px; padding: 6px 14px; font-size: 12.5px; box-shadow: var(--shadow); opacity: 0; transform: translateY(8px); transition: .25s; pointer-events: none; }
.bz-visit-toast.on { opacity: 1; transform: none; }

.notif-hist .list-item { opacity: .78; }
.notif-hist .list-item:hover { opacity: 1; }
.notif-hist .t { font-weight: 500; }

/* ===== Chat list: unanswered marker, online/offline groups, colleagues ===== */
.ci-group { display: flex; justify-content: space-between; align-items: center; padding: 6px 14px; font-size: 11.5px; font-weight: 700; color: var(--text-3); background: var(--surface-2); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 1; }
.ci-group.g-on span:first-child { color: var(--success); }
.ci-group-w { color: #fbbf24; font-weight: 600; }
.chat-item.offline { opacity: .72; }
.chat-item.offline:hover, .chat-item.offline.on { opacity: 1; }
.chat-item.waiting { border-inline-start-color: #f59e0b; background: rgba(245, 158, 11, .06); }
.chat-item.waiting.late { border-inline-start-color: var(--danger); background: rgba(239, 68, 68, .07); }
.ci-wait { flex: none; font-size: 11px; font-weight: 700; color: #fbbf24; background: rgba(245, 158, 11, .14); border: 1px solid rgba(245, 158, 11, .35); padding: 0 7px; border-radius: 999px; white-space: nowrap; }
.chat-item.late .ci-wait { color: #fca5a5; background: rgba(239, 68, 68, .14); border-color: rgba(239, 68, 68, .4); animation: waitPulse 2s ease-in-out infinite; }
@keyframes waitPulse { 50% { box-shadow: 0 0 0 3px rgba(239, 68, 68, .15); } }
.ci-peers { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 3px; }
.ci-peer { font-size: 11px; color: #93c5fd; background: rgba(59, 130, 246, .12); border-radius: 999px; padding: 0 7px; }
.ci-peer.typing { color: #fcd34d; background: rgba(245, 158, 11, .15); }
.chat-peer { margin: 0 12px 6px; padding: 7px 12px; border-radius: 10px; font-size: 12.5px; color: #bfdbfe; background: rgba(59, 130, 246, .12); border: 1px solid rgba(59, 130, 246, .3); }
.chat-peer.typing { color: #fde68a; background: rgba(245, 158, 11, .14); border-color: rgba(245, 158, 11, .4); }
@media (prefers-reduced-motion: reduce) { .chat-item.late .ci-wait { animation: none; } }
/* Phone composer: the text box takes the whole width; tools + send in a slim row under it */
@media (max-width: 780px) {
  .cmp-row { flex-wrap: wrap; gap: 6px; }
  .cmp-row textarea { order: 1; flex: 1 1 100%; width: 100%; min-height: 46px; max-height: 38vh; border-radius: 16px; }
  .cmp-row .cmp-tool { order: 2; width: 36px; height: 36px; font-size: 17px; }
  .cmp-row .cmp-send { order: 3; margin-inline-start: auto; height: 38px; padding: 0 18px; width: auto; }
  .cmp-row .cmp-send .cs-tx2 { display: inline; }
}

.th-page { display: block; font-size: 11.5px; color: #93c5fd; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; margin-top: 1px; }
.th-page:hover { text-decoration: underline; }

.learned-item { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; padding: 6px 10px; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--border); font-size: 13px; line-height: 1.8; }
.learned-item form { flex: none; }

/* «توضیح برای هوش مصنوعی» */
.ai-hint { border: 1px dashed rgba(139,92,246,.55); background: rgba(139,92,246,.07); border-radius: 14px; padding: 8px 10px; display: flex; flex-direction: column; gap: 6px; }
.ai-hint-h { font-size: 12.5px; font-weight: 700; color: #c4b5fd; }
.ai-hint-h .faint { font-weight: 400; }
.ai-hint-row { display: flex; gap: 6px; align-items: flex-end; }
.ai-hint-row textarea { flex: 1; min-height: 40px; max-height: 120px; resize: vertical; font-size: 13.5px; border-radius: 12px; }
.ai-hint-row .btn { flex: none; white-space: nowrap; }
.cmp-tool.on { background: rgba(139,92,246,.22); border-color: rgba(139,92,246,.6); }
@media (max-width: 780px) { .ai-hint-row { flex-direction: column; align-items: stretch; } .ai-hint-row textarea { font-size: 16px; } .ai-hint-h .faint { display: none; } }

/* Accounting */
.acct .acct-row { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; padding: 9px 4px; border-bottom: 1px dashed var(--border); font-size: 14px; }
.acct .acct-row b { font-size: 16px; font-variant-numeric: tabular-nums; }
.acct .acct-row.inc b { color: var(--success); }
.acct .acct-row.exp b { color: #fb7185; }
.acct .acct-row.left { border-bottom: 0; border-top: 2px solid var(--border-strong); margin-top: 4px; font-weight: 700; }
.acct .acct-row.left b { font-size: 20px; color: #c4b5fd; }
.acct .acct-row.left.neg b { color: #fb7185; }
.acct .acct-row.cum { border-bottom: 0; font-size: 12.5px; color: var(--text-3); }
.acct .acct-row.cum b { font-size: 13.5px; color: var(--text-2); }
.acct-tbl td, .acct-tbl th { white-space: nowrap; font-variant-numeric: tabular-nums; }
.acct-tbl tr.on td { background: rgba(139,92,246,.08); }
.acct-tbl tfoot th { border-top: 2px solid var(--border-strong); }

/* Edit / delete support messages */
.cm.admin .cm-b { position: relative; }
.cm-more { position: absolute; top: 4px; inset-inline-start: -30px; width: 24px; height: 24px; border-radius: 50%; border: 1px solid var(--border); background: var(--surface-solid); color: var(--text-2); cursor: pointer; font-size: 14px; line-height: 1; opacity: 0; transition: opacity .15s; }
.cm.admin:hover .cm-more, .cm-more:focus { opacity: 1; }
@media (hover: none) { .cm-more { opacity: .75; } }
.cm-menu { position: absolute; top: 30px; inset-inline-start: -30px; z-index: 5; display: flex; flex-direction: column; min-width: 110px; background: var(--surface-solid); border: 1px solid var(--border-strong); border-radius: 10px; box-shadow: var(--shadow); overflow: hidden; }
.cm-menu button { background: none; border: 0; color: var(--text); text-align: start; padding: 8px 12px; font: inherit; font-size: 13px; cursor: pointer; }
.cm-menu button:hover { background: var(--surface-2); }
.cm-menu button[data-act=del] { color: #fca5a5; }
.cm.editing { max-width: 92%; width: 92%; }
.cm.editing .cm-b { background: var(--surface-2) !important; border: 1px solid rgba(139,92,246,.6); color: var(--text); }
.cm-edit { width: 100%; min-height: 70px; resize: vertical; font-size: 14px; }
.cm-edit-act { display: flex; gap: 6px; margin-top: 6px; }
.cm.deleted .cm-b { background: transparent !important; border: 1px dashed var(--border-strong); color: var(--text-3) !important; font-size: 12.5px; box-shadow: none; }
.cm-ed { font-style: normal; opacity: .85; }

/* Site logos in chat (which site the conversation belongs to) */
.site-logo { width: 16px; height: 16px; border-radius: 4px; object-fit: contain; vertical-align: -3px; margin-inline-end: 4px; background: rgba(255,255,255,.9); }
.ci-site { display: inline-flex; align-items: center; gap: 2px; }
.av { position: relative; }
.av .av-site { position: absolute; top: -4px; inset-inline-start: -4px; width: 20px; height: 20px; border-radius: 6px; object-fit: contain; background: #fff; border: 2px solid var(--surface-solid, #121729); box-shadow: 0 1px 3px rgba(0,0,0,.3); }
.lv-item .av .av-site { width: 16px; height: 16px; }
.th-site { display: inline-flex; align-items: center; font-weight: 600; color: var(--text-2); }

/* Accounting report */
.exp-list { max-height: 520px; overflow-y: auto; }
.exp-amt { display: inline-flex; align-items: center; gap: 6px; }
.acct-row .site-logo, .ci-sec h4 .site-logo, .acct-tbl .site-logo { margin-inline-end: 6px; }
@media print {
  .sidebar, .topbar, .no-print, .flash, .alert { display: none !important; }
  .main { margin: 0 !important; padding: 0 !important; }
  .card { break-inside: avoid; box-shadow: none !important; }
  body { background: #fff !important; color: #000 !important; }
}

.cm-auto { font-style: normal; color: #a5f3fc; }

/* ---------- Chat images ---------- */
.cm-pic .cm-b { padding: 5px; }
.cm-img { display: block; border-radius: 12px; overflow: hidden; line-height: 0; cursor: zoom-in; background: rgba(148,163,184,.15); }
.cm-img img { display: block; max-width: min(260px, 60vw); max-height: 320px; width: auto; height: auto; object-fit: cover; }
.cm-pic .cm-t { padding: 2px 6px 0; }
.cm-gone { display: inline-block; padding: 6px 10px; font-size: 12.5px; opacity: .75; }
.img-prev { display: flex; align-items: center; gap: 10px; padding: 8px; border: 1px solid var(--border); border-radius: 14px; background: var(--surface, rgba(255,255,255,.04)); flex-wrap: wrap; }
.img-prev img { width: 72px; height: 72px; object-fit: cover; border-radius: 10px; background: rgba(148,163,184,.15); }
.img-prev-t { display: flex; flex-direction: column; gap: 2px; flex: 1; min-width: 160px; font-size: 13px; }
.chat-app { position: relative; }
.chat-drop { position: absolute; inset: 0; z-index: 30; display: flex; align-items: center; justify-content: center; text-align: center; padding: 20px; font-weight: 800; font-size: 16px; color: #fff; background: rgba(79,70,229,.82); border: 3px dashed rgba(255,255,255,.8); border-radius: 16px; pointer-events: none; }
.chat-drop.hidden, .lightbox.hidden, .img-prev.hidden { display: none; }
.lightbox { position: fixed; inset: 0; z-index: 9999; background: rgba(5,8,18,.9); display: flex; align-items: center; justify-content: center; padding: 20px; cursor: zoom-out; }
.lightbox img { max-width: 100%; max-height: 100%; border-radius: 10px; box-shadow: 0 24px 70px rgba(0,0,0,.6); }
.lightbox .btn { position: absolute; top: max(14px, env(safe-area-inset-top)); inset-inline-end: 14px; }

/* ---------- Visitor visits + traffic report ---------- */
.kv.kv-col { flex-direction: column; align-items: stretch; }
.visit-log { display: flex; flex-direction: column; gap: 4px; }
.visit-log > span { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.ts-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(420px, 1fr)); gap: 14px; }
@media (max-width: 520px) { .ts-grid { grid-template-columns: 1fr; } }
.ts-kpis { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 12px; }
.ts-kpi { border: 1px solid var(--border); border-radius: 12px; padding: 10px; text-align: center; }
.ts-kpi b { display: block; font-size: 20px; }
.ts-kpi span { font-size: 12px; color: var(--text-2); }
.ts-groups { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.ts-g { border: 1px solid var(--border); border-radius: 999px; padding: 3px 10px; font-size: 12.5px; }
.ts-g b { margin-inline-start: 4px; }
.ts-g.g-search { border-color: rgba(56,189,248,.45); } .ts-g.g-ai { border-color: rgba(139,92,246,.55); } .ts-g.g-direct { border-color: rgba(148,163,184,.5); }
.ts-g.g-social { border-color: rgba(236,72,153,.5); } .ts-g.g-other { border-color: rgba(34,197,94,.45); }
progress.ts-bar { width: 100%; min-width: 60px; height: 8px; appearance: none; -webkit-appearance: none; border: 0; border-radius: 99px; background: var(--surface-2); overflow: hidden; vertical-align: middle; }
progress.ts-bar::-webkit-progress-bar { background: var(--surface-2); border-radius: 99px; }
progress.ts-bar::-webkit-progress-value { background: linear-gradient(90deg, #6366f1, #8b5cf6); border-radius: 99px; }
progress.ts-bar::-moz-progress-bar { background: linear-gradient(90deg, #6366f1, #8b5cf6); border-radius: 99px; }
.ts-land { font-size: 12.5px; }
.ts-land li { display: flex; justify-content: space-between; gap: 8px; padding: 3px 0; border-bottom: 1px dashed var(--border); }
.ts-land li a { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 80%; direction: ltr; }

/* which AI wrote the suggestion */
.ai-who { display: inline-block; margin-inline-start: 6px; padding: 1px 8px; border-radius: 999px; font-size: 11.5px; font-weight: 700; border: 1px solid var(--border); }
.ai-who.ai-gemini { color: #60a5fa; border-color: rgba(96,165,250,.45); background: rgba(96,165,250,.1); }
.ai-who.ai-chatgpt { color: #34d399; border-color: rgba(52,211,153,.45); background: rgba(52,211,153,.1); }
