@import url('https://fonts.googleapis.com/css2?family=Estedad:wght@400;500;600;700;800;900&display=swap');
@import url('https://cdn.jsdelivr.net/gh/rastikerdar/vazirmatn@v33.003/Vazirmatn-font-face.css');

@font-face { font-family: 'IRANSans'; src: url('../fonts/IRANSans_UltraLight.ttf') format('truetype'); font-weight: 200; font-display: swap; }
@font-face { font-family: 'IRANSans'; src: url('../fonts/IRANSans_Light.ttf') format('truetype'); font-weight: 300; font-display: swap; }
@font-face { font-family: 'IRANSans'; src: url('../fonts/IRANSans.ttf') format('truetype'); font-weight: 400; font-display: swap; }
@font-face { font-family: 'IRANSans'; src: url('../fonts/IRANSans_Medium.ttf') format('truetype'); font-weight: 500; font-display: swap; }
@font-face { font-family: 'IRANSans'; src: url('../fonts/IRANSans_Medium.ttf') format('truetype'); font-weight: 600; font-display: swap; }
@font-face { font-family: 'IRANSans'; src: url('../fonts/IRANSans_Bold.ttf') format('truetype'); font-weight: 700; font-display: swap; }
@font-face { font-family: 'IRANSans'; src: url('../fonts/IRANSans_Black.ttf') format('truetype'); font-weight: 800; font-display: swap; }
@font-face { font-family: 'IRANSans'; src: url('../fonts/IRANSans_Black.ttf') format('truetype'); font-weight: 900; font-display: swap; }

:root {
  --bg: #E9EBF4;
  --surface: #ECEEF6;
  --surface-2: #E2E5F0;
  --border: rgba(255, 255, 255, 0.7);
  --border-2: rgba(163, 170, 199, 0.35);
  --ink: #2E3150;
  --ink-2: #5B5F7B;
  --ink-3: #9CA0B8;
  --accent: #6C5DD3;
  --accent-2: #8E7EF2;
  --accent-soft: #E2DFF7;
  --accent-dark: #5040B5;
  --green: #3FAE8E;
  --green-soft: #DCEFE9;
  --green-dark: #2C8169;
  --red: #E8785F;
  --red-soft: #F9E2DB;
  --red-dark: #C05138;
  --amber: #E9A13B;
  --amber-soft: #F7ECD8;
  --amber-dark: #A87317;
  --sky: #5B8DEF;
  --sky-soft: #DFE8FA;
  --sky-dark: #3A66C4;
  --pink: #D96BA8;
  --pink-soft: #F3DFEA;
  --pink-dark: #B14A87;
  --cyan: #3AB6D8;
  --cyan-soft: #DCEFF7;
  --cyan-dark: #1E86A6;
  --radius: 16px;
  --radius-lg: 22px;
  --nm-dark: rgba(163, 170, 199, 0.62);
  --nm-light: rgba(255, 255, 255, 0.95);
  --nm-out: 9px 9px 20px var(--nm-dark), -9px -9px 20px var(--nm-light);
  --nm-out-sm: 4px 4px 10px rgba(163, 170, 199, 0.55), -4px -4px 10px var(--nm-light);
  --nm-in: inset 5px 5px 11px rgba(163, 170, 199, 0.55), inset -5px -5px 11px var(--nm-light);
  --nm-in-sm: inset 3px 3px 7px rgba(163, 170, 199, 0.5), inset -3px -3px 7px var(--nm-light);
  --shadow-sm: var(--nm-out-sm);
  --shadow-md: var(--nm-out);
  --shadow-lg: 0 24px 60px rgba(80, 86, 120, 0.32);

  --indigo: var(--accent);
  --indigo-soft: var(--accent-soft);
  --indigo-dark: var(--accent-dark);
  --sage: var(--green);
  --sage-soft: var(--green-soft);
  --sage-dark: var(--green-dark);
  --coral: var(--red);
  --coral-soft: var(--red-soft);
  --coral-dark: var(--red-dark);
  --text: var(--ink);
  --text-2: var(--ink-2);
  --text-3: var(--ink-3);
}

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

html { scroll-behavior: smooth; }

body {
  font-family: 'IRANSans', 'Vazirmatn', 'Segoe UI', Tahoma, sans-serif;
  background: linear-gradient(160deg, #EEF0F9 0%, var(--bg) 45%, #E3E6F1 100%) fixed;
  color: var(--ink);
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
}

::selection { background: var(--accent-soft); color: var(--accent-dark); }

input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
input[type="number"] { -moz-appearance: textfield; appearance: textfield; }

.layout { display: flex; min-height: 100vh; }

.sidebar {
  width: 248px;
  flex-shrink: 0;
  position: sticky;
  top: 18px;
  height: calc(100vh - 36px);
  margin: 18px 18px 18px 0;
  margin-inline-start: 18px;
  margin-inline-end: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 26px;
  box-shadow: var(--nm-out);
  display: flex;
  flex-direction: column;
  padding: 20px 16px 16px;
  z-index: 20;
  overflow: hidden;
}

.sidebar-nav { flex: 1; display: flex; flex-direction: column; gap: 8px; overflow-y: auto; padding: 4px 2px; }

.nav-section-label {
  font-size: 10.5px;
  font-weight: 700;
  color: var(--ink-3);
  letter-spacing: 2px;
  padding: 4px 14px 8px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 15px;
  border: 1px solid transparent;
  border-radius: 14px;
  color: var(--ink-2);
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  transition: color 0.18s, box-shadow 0.18s, background 0.18s;
  position: relative;
}

.nav-item:hover { color: var(--accent-dark); background: rgba(255, 255, 255, 0.55); }

.nav-item.active {
  background: var(--surface);
  color: var(--accent);
  font-weight: 800;
  border-color: var(--border);
  box-shadow: var(--nm-out-sm);
}

.nav-item.active::before {
  content: '';
  position: absolute;
  inset-inline-start: 5px;
  top: 50%;
  transform: translateY(-50%);
  width: 4px;
  height: 18px;
  border-radius: 99px;
  background: linear-gradient(180deg, var(--accent-2), var(--accent));
  box-shadow: 0 2px 6px rgba(108, 93, 211, 0.5);
}

.nav-icon { width: 16px; height: 16px; flex-shrink: 0; }

.sidebar-header { border-bottom: 1px solid var(--border-2); padding-bottom: 12px; margin-bottom: 12px; }

.sidebar-footer { border-top: 1px solid var(--border-2); padding-top: 14px; margin-top: 14px; }

.user-info-bar { display: flex; align-items: center; gap: 10px; padding: 6px 8px; }

.user-avatar {
  width: 36px;
  height: 36px;
  border-radius: 38%;
  overflow: hidden;
  flex-shrink: 0;
  background: var(--surface-2);
  box-shadow: 3px 3px 8px rgba(163, 170, 199, 0.6), -3px -3px 8px var(--nm-light), 0 4px 10px rgba(108, 93, 211, 0.35);
}

.avatar-letter { width: 100%; height: 100%; position: relative; display: flex; align-items: center; justify-content: center; color: #fff; font-weight: 800; font-size: 14px; }
.avatar-letter::before { content: ''; position: absolute; inset: 0; background: radial-gradient(circle at 30% 20%, rgba(255, 255, 255, 0.38), transparent 55%); }
.avatar-letter i { font-style: normal; position: relative; text-shadow: 0 1px 3px rgba(0, 0, 0, 0.3); }
.user-avatar.avatar-sm .avatar-letter { font-size: 11px; }

.user-avatar.avatar-sm { width: 28px; height: 28px; border-radius: 34%; }

.user-name { font-size: 13px; font-weight: 700; }
.user-role { font-size: 11px; color: var(--ink-3); }

.main-content { flex: 1; min-width: 0; padding: 22px 30px 48px; }

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 0 4px;
  margin-bottom: 26px;
}

.topbar-title { font-size: 25px; font-weight: 800; letter-spacing: -0.5px; }
.topbar-actions { display: flex; align-items: center; gap: 10px; }

.page-content { animation: page-in 0.35s cubic-bezier(0.22, 1, 0.36, 1); }

@keyframes page-in {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.section-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  margin-bottom: 18px;
  gap: 12px;
  flex-wrap: wrap;
}

.section-title { font-size: 17px; font-weight: 800; }
.section-sub { font-size: 12.5px; color: var(--ink-3); margin-top: 3px; }

.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 18px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 18px; }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--nm-out);
  transition: box-shadow 0.2s, transform 0.2s;
}

.card:hover { box-shadow: 11px 11px 24px var(--nm-dark), -11px -11px 24px var(--nm-light); }

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid rgba(163, 170, 199, 0.3);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.75);
}

.card-title { font-size: 14px; font-weight: 800; }
.card-body { padding: 20px; }

.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px 20px 16px;
  position: relative;
  box-shadow: var(--nm-out);
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: 10px 10px 22px var(--nm-dark), -10px -10px 22px var(--nm-light);
}

.stat-icon {
  position: absolute;
  inset-inline-end: 16px;
  top: 16px;
  width: 40px;
  height: 40px;
  border-radius: 13px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.stat-label {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 12px;
  color: var(--ink-3);
  font-weight: 700;
  padding-inline-end: 52px;
}

.stat-label::before {
  content: '';
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
  background: var(--card-accent, var(--accent));
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--card-accent, var(--accent)) 16%, transparent);
  animation: dotPulse 2.6s ease-in-out infinite;
}

.stat-value { font-size: 27px; font-weight: 800; letter-spacing: -0.5px; margin-top: 9px; font-variant-numeric: tabular-nums; }
.stat-sub { font-size: 11.5px; color: var(--ink-3); margin-top: 3px; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  border: 1px solid var(--border);
  border-radius: 14px;
  font-family: inherit;
  font-size: 13px;
  font-weight: 700;
  padding: 10px 18px;
  cursor: pointer;
  transition: background 0.18s, color 0.18s, transform 0.18s, box-shadow 0.18s;
  white-space: nowrap;
}

.btn:active { transform: scale(0.97); box-shadow: var(--nm-in-sm); }

.btn-primary {
  background: linear-gradient(135deg, var(--accent-2), var(--accent));
  color: #fff;
  border-color: transparent;
  box-shadow: 5px 5px 12px rgba(163, 170, 199, 0.65), -5px -5px 12px var(--nm-light), 0 6px 16px rgba(108, 93, 211, 0.35);
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 6px 6px 14px rgba(163, 170, 199, 0.7), -6px -6px 14px var(--nm-light), 0 10px 22px rgba(108, 93, 211, 0.45);
}

.btn-primary:active { box-shadow: inset 4px 4px 9px rgba(64, 50, 150, 0.5), inset -4px -4px 9px rgba(158, 143, 255, 0.5); }

.btn-secondary { background: var(--surface); color: var(--ink); box-shadow: var(--nm-out-sm); }
.btn-secondary:hover { color: var(--accent); transform: translateY(-1px); }

.btn-danger { background: var(--surface); color: var(--red-dark); box-shadow: var(--nm-out-sm); }
.btn-danger:hover { background: var(--red); color: #fff; border-color: transparent; transform: translateY(-1px); box-shadow: 4px 4px 10px rgba(163, 170, 199, 0.55), -4px -4px 10px var(--nm-light), 0 6px 14px rgba(232, 120, 95, 0.4); }

.btn-ghost { background: transparent; border-color: transparent; color: var(--ink-2); }
.btn-ghost:hover { color: var(--accent); background: rgba(255, 255, 255, 0.55); }

.btn-sm { padding: 7px 13px; font-size: 12px; border-radius: 12px; }

.btn:disabled { opacity: 0.55; cursor: not-allowed; transform: none; }

.btn-icon {
  width: 32px;
  height: 32px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--ink-2);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: var(--nm-out-sm);
  transition: all 0.16s;
}

.btn-icon:hover { color: var(--accent); transform: translateY(-1px); }
.btn-icon:active { box-shadow: var(--nm-in-sm); transform: none; }

.actions { display: flex; gap: 6px; }

.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 11px;
  border-radius: 99px;
  font-size: 11px;
  font-weight: 700;
  border: 1px solid rgba(255, 255, 255, 0.6);
  box-shadow: 2px 2px 5px rgba(163, 170, 199, 0.4), -2px -2px 5px var(--nm-light);
}

.badge-indigo { background: var(--accent-soft); color: var(--accent-dark); }
.badge-sage { background: var(--green-soft); color: var(--green-dark); }
.badge-coral { background: var(--red-soft); color: var(--red-dark); }
.badge-amber { background: var(--amber-soft); color: var(--amber-dark); }
.badge-sky { background: var(--sky-soft); color: var(--sky-dark); }
.badge-gray { background: var(--surface-2); color: var(--ink-3); }
.badge-ink { background: linear-gradient(135deg, var(--accent-2), var(--accent)); color: #fff; border-color: transparent; }

.table-wrap {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--nm-out);
}

.table { width: 100%; border-collapse: collapse; }

.table th {
  text-align: right;
  font-size: 11px;
  font-weight: 700;
  color: var(--ink-3);
  letter-spacing: 0.8px;
  padding: 15px 20px 11px;
  background: transparent;
  border-bottom: 1px solid var(--border-2);
}

.table td {
  padding: 13px 20px;
  border-bottom: 1px solid var(--border-2);
  font-size: 13.5px;
  vertical-align: middle;
}

.table tbody tr { transition: background 0.14s; }
.table tbody tr:hover { background: rgba(255, 255, 255, 0.5); }
.table tbody tr:last-child td { border-bottom: none; }

.form-group { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }

.form-label { font-size: 12.5px; font-weight: 700; color: var(--ink-2); }

.form-input {
  width: 100%;
  padding: 11px 15px;
  border-radius: 14px;
  border: none;
  background: var(--bg);
  box-shadow: var(--nm-in-sm);
  font-family: inherit;
  font-size: 13.5px;
  color: var(--ink);
  transition: box-shadow 0.18s;
  resize: vertical;
}

.form-input::placeholder { color: var(--ink-3); }

.form-input:focus {
  outline: none;
  box-shadow: var(--nm-in-sm), 0 0 0 4px rgba(108, 93, 211, 0.15);
}

.mono { font-family: 'SF Mono', 'Fira Code', Consolas, monospace; letter-spacing: 0.3px; direction: ltr; text-align: left; }

.form-input-icon-wrap { position: relative; }

.form-input-icon-wrap .form-input { padding-inline-start: 40px; }

.input-icon {
  position: absolute;
  inset-inline-start: 13px;
  top: 50%;
  transform: translateY(-50%);
  width: 16px;
  height: 16px;
  color: var(--ink-3);
  pointer-events: none;
}

.input-icon-btn {
  position: absolute;
  inset-inline-end: 8px;
  top: 50%;
  transform: translateY(-50%);
  width: 30px;
  height: 30px;
  border: none;
  background: transparent;
  color: var(--ink-3);
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
}

.input-icon-btn:hover { color: var(--accent); }

.toggle { display: inline-flex; align-items: center; gap: 9px; cursor: pointer; }
.toggle input { display: none; }

.toggle-track {
  width: 42px;
  height: 24px;
  border-radius: 99px;
  background: var(--bg);
  box-shadow: var(--nm-in-sm);
  position: relative;
  transition: background 0.2s;
  flex-shrink: 0;
}

.toggle-thumb {
  position: absolute;
  top: 3px;
  inset-inline-start: 3px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #FDFDFF;
  box-shadow: 2px 2px 5px rgba(120, 126, 158, 0.5), -1px -1px 3px #fff;
  transition: transform 0.22s cubic-bezier(0.22, 1, 0.36, 1), background 0.2s;
}

.toggle input:checked + .toggle-track { background: linear-gradient(135deg, var(--accent-2), var(--accent)); box-shadow: inset 3px 3px 6px rgba(64, 50, 150, 0.45), inset -3px -3px 6px rgba(158, 143, 255, 0.4); }
.toggle input:checked + .toggle-track .toggle-thumb { transform: translateX(-18px); }

.toggle-label { font-size: 13px; font-weight: 600; }

.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 2px;
  border-bottom: 1px solid var(--border-2);
}

.toggle-row:last-child { border-bottom: none; }
.toggle-row > label:first-child { font-size: 13.5px; font-weight: 600; color: var(--ink-2); }

.feature-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }

.feature-check {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 12px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--surface);
  box-shadow: var(--nm-out-sm);
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ink-2);
  cursor: pointer;
  transition: all 0.16s;
  user-select: none;
}

.feature-check:hover { color: var(--accent-dark); transform: translateY(-1px); }

.feature-check.checked {
  background: var(--bg);
  color: var(--accent);
  font-weight: 800;
  box-shadow: var(--nm-in-sm);
  transform: none;
}

.feature-check.disabled { opacity: 0.45; cursor: not-allowed; transform: none; }

.check-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--border-2);
  transition: background 0.16s, box-shadow 0.16s;
  flex-shrink: 0;
}

.feature-check.checked .check-dot { background: var(--accent); box-shadow: 0 0 8px rgba(108, 93, 211, 0.7); }

.feature-group { margin-bottom: 14px; }
.feature-group:last-child { margin-bottom: 0; }

.feature-group-title {
  font-size: 11.5px;
  font-weight: 800;
  color: var(--ink-3);
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.feature-group-title::before {
  content: '';
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--accent);
}

.chip-group { display: flex; flex-wrap: wrap; gap: 8px; }

.chip {
  display: inline-flex;
  align-items: center;
  padding: 6px 14px;
  border-radius: 99px;
  border: none;
  background: var(--bg);
  box-shadow: var(--nm-in-sm);
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-2);
}

.sep { height: 0; border-top: 1px solid rgba(163, 170, 199, 0.32); border-bottom: 1px solid rgba(255, 255, 255, 0.85); margin: 18px 0; background: none; }

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(46, 49, 80, 0.35);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 24px;
}

.modal-backdrop.open { display: flex; animation: backdrop-in 0.2s ease; }

@keyframes backdrop-in { from { opacity: 0; } to { opacity: 1; } }

.modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 26px;
  width: 100%;
  max-width: 720px;
  max-height: 88vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  animation: modal-in 0.28s cubic-bezier(0.22, 1, 0.36, 1);
}

@keyframes modal-in {
  from { opacity: 0; transform: translateY(16px) scale(0.97); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 22px;
  border-bottom: 1px solid var(--border-2);
  position: sticky;
  top: 0;
  background: var(--surface);
  z-index: 2;
}

.modal-title { font-size: 15px; font-weight: 800; }

.modal-close {
  width: 32px;
  height: 32px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  box-shadow: var(--nm-out-sm);
  color: var(--ink-2);
  font-size: 17px;
  cursor: pointer;
  transition: all 0.15s;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-close:hover { color: var(--red-dark); transform: rotate(90deg); }

.modal-body { padding: 20px 22px; }

.modal-footer {
  display: flex;
  gap: 10px;
  padding: 16px 22px;
  border-top: 1px solid var(--border-2);
  position: sticky;
  bottom: 0;
  background: var(--surface);
}

.empty-state { text-align: center; padding: 48px 20px; }
.empty-icon { font-size: 34px; margin-bottom: 10px; opacity: 0.8; }
.empty-title { font-size: 14px; font-weight: 700; color: var(--ink-2); }
.empty-sub { font-size: 12.5px; color: var(--ink-3); margin-top: 4px; }

#toast-container {
  position: fixed;
  bottom: 26px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  z-index: 1000;
}

.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--surface);
  color: var(--ink);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 12px 18px;
  font-size: 13.5px;
  font-weight: 600;
  box-shadow: var(--shadow-lg);
  direction: rtl;
  animation: toast-in 0.3s cubic-bezier(0.22, 1, 0.36, 1);
  max-width: 90vw;
}

.toast svg { flex-shrink: 0; }

.toast-success { border-inline-start: 4px solid var(--green); }
.toast-error { border-inline-start: 4px solid var(--red); }
.toast-info { border-inline-start: 4px solid var(--sky); }

.toast.hide { opacity: 0; transform: translateY(10px); transition: 0.3s; }

@keyframes toast-in {
  from { opacity: 0; transform: translateY(14px) scale(0.96); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.tabs {
  display: inline-flex;
  gap: 5px;
  background: var(--bg);
  border: none;
  border-radius: 16px;
  padding: 5px;
  box-shadow: var(--nm-in-sm);
}

.tab-btn {
  border: none;
  background: transparent;
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 700;
  color: var(--ink-2);
  padding: 8px 16px;
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.18s;
}

.tab-btn:hover { color: var(--accent-dark); }
.tab-btn.active {
  background: var(--surface);
  color: var(--accent);
  box-shadow: 3px 3px 7px rgba(163, 170, 199, 0.55), -3px -3px 7px var(--nm-light);
}

.channel-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px;
  cursor: pointer;
  box-shadow: var(--nm-out);
  transition: transform 0.22s cubic-bezier(0.22, 1, 0.36, 1), box-shadow 0.22s;
  position: relative;
  overflow: hidden;
}

.channel-card::before {
  content: '';
  position: absolute;
  top: 0;
  inset-inline-start: 0;
  inset-inline-end: 0;
  height: 4px;
  background: linear-gradient(90deg, var(--accent-2), var(--accent), var(--red));
  opacity: 0;
  transition: opacity 0.22s;
}

.channel-card:hover {
  transform: translateY(-4px);
  box-shadow: 12px 12px 26px var(--nm-dark), -12px -12px 26px var(--nm-light);
}

.channel-card:hover::before { opacity: 1; }

.channel-card.inactive { opacity: 0.6; }

.channel-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.channel-name { font-size: 14.5px; font-weight: 800; }
.channel-meta { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; }

.channel-id-badge {
  font-family: 'SF Mono', 'Fira Code', Consolas, monospace;
  font-size: 11px;
  background: var(--bg);
  border: none;
  box-shadow: var(--nm-in-sm);
  color: var(--ink-2);
  padding: 4px 9px;
  border-radius: 9px;
  direction: ltr;
}

.report-item { padding: 14px 0; border-bottom: 1px solid var(--border-2); }
.report-item:last-child { border-bottom: none; }

.adv-section {
  background: var(--bg);
  border: none;
  box-shadow: var(--nm-in-sm);
  border-radius: 16px;
  padding: 14px 16px 4px;
  margin-bottom: 12px;
  animation: page-in 0.3s cubic-bezier(0.22, 1, 0.36, 1);
}

.adv-section-title {
  font-size: 12px;
  font-weight: 800;
  color: var(--accent-dark);
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.adv-section-title::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
}

.spinner {
  width: 15px;
  height: 15px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

.login-page { display: flex; min-height: 100vh; background: var(--bg); }

.login-side {
  flex: 0 0 40%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px;
}

.login-visual {
  flex: 1;
  position: relative;
  margin: 0;
  border-radius: 0;
  overflow: hidden;
  background: #14131A;
  box-shadow: none;
}

.login-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  cursor: default;
}

.login-visual-overlay {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(ellipse at center, transparent 55%, rgba(20, 19, 26, 0.5));
}

.login-orbs { position: absolute; inset: 0; pointer-events: none; }
.login-orbs .orb { position: absolute; border-radius: 50%; filter: blur(70px); opacity: 0.3; animation: orb-drift 26s ease-in-out infinite alternate; }
.login-orbs .orb-1 { width: 420px; height: 420px; top: -90px; inset-inline-start: -70px; background: radial-gradient(circle, #6C5DD3, transparent 70%); }
.login-orbs .orb-2 { width: 380px; height: 380px; bottom: -100px; inset-inline-end: -60px; background: radial-gradient(circle, #3E7BD6, transparent 70%); opacity: 0.24; animation-duration: 34s; animation-delay: -12s; }
.login-orbs .orb-3 { width: 300px; height: 300px; top: 42%; inset-inline-start: 46%; background: radial-gradient(circle, #B65DD3, transparent 70%); opacity: 0.18; animation-duration: 40s; animation-delay: -22s; }

@keyframes orb-drift {
  from { transform: translate3d(0, 0, 0) scale(1); }
  to { transform: translate3d(-70px, 50px, 0) scale(1.18); }
}

@media (prefers-reduced-motion: reduce) {
  .login-orbs .orb { animation: none; }
}


.login-box {
  width: 100%;
  max-width: 384px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 30px;
  box-shadow: var(--nm-out);
  padding: 38px 34px 34px;
  animation: page-in 0.5s cubic-bezier(0.22, 1, 0.36, 1);
}

.login-header { margin-bottom: 28px; }

.brand { display: inline-flex; align-items: center; gap: 10px; user-select: none; }
.brand .brand-mark { display: flex; flex-shrink: 0; filter: drop-shadow(0 5px 12px rgba(108, 93, 211, 0.4)); }
.brand .brand-mark svg { width: 100%; height: 100%; display: block; }
.brand .brand-mark svg path { animation: brand-wave 2.6s ease-in-out infinite; }
.brand .brand-mark svg path + path { animation-delay: 0.35s; }

@keyframes brand-wave {
  0%, 10% { opacity: 0.15; }
  35%, 55% { opacity: 0.95; }
  80%, 100% { opacity: 0.15; }
}

@media (prefers-reduced-motion: reduce) {
  .brand .brand-mark svg path { animation: none; }
}

.brand .brand-fa {
  font-family: 'Estedad', 'IRANSans', 'Vazirmatn', sans-serif;
  font-weight: 900;
  letter-spacing: -0.5px;
  line-height: 1.5;
  background: linear-gradient(135deg, var(--ink) 20%, var(--accent) 160%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.login-logo { gap: 12px; }
.login-logo .brand-mark { width: 44px; height: 44px; }
.login-logo .brand-fa { font-size: 29px; }

.login-form .form-input { padding-top: 12px; padding-bottom: 12px; border-radius: 14px; }

.login-btn {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 13px;
  border: none;
  border-radius: 15px;
  background: linear-gradient(135deg, var(--accent-2), var(--accent));
  color: #fff;
  font-family: inherit;
  font-size: 14px;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 5px 5px 12px rgba(163, 170, 199, 0.65), -5px -5px 12px var(--nm-light), 0 8px 20px rgba(108, 93, 211, 0.35);
  transition: all 0.2s;
  margin-top: 6px;
}

.login-btn:hover {
  transform: translateY(-1px);
  box-shadow: 6px 6px 14px rgba(163, 170, 199, 0.7), -6px -6px 14px var(--nm-light), 0 12px 26px rgba(108, 93, 211, 0.45);
}

.login-btn:active { box-shadow: inset 4px 4px 9px rgba(64, 50, 150, 0.5), inset -4px -4px 9px rgba(158, 143, 255, 0.5); }

.login-btn:disabled { opacity: 0.6; cursor: not-allowed; transform: none; }

.login-error {
  display: none;
  background: var(--red-soft);
  color: var(--red-dark);
  border: 1px solid rgba(255, 255, 255, 0.6);
  box-shadow: var(--nm-in-sm);
  border-radius: 14px;
  padding: 11px 14px;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 16px;
}

.login-error.show { display: block; animation: page-in 0.25s ease; }

.stats-channel-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); gap: 18px; }
.stats-channel-card { cursor: pointer; }
.stats-channel-card:hover { transform: translateY(-3px); }
.stats-mini-row { display: flex; gap: 14px; font-size: 12px; color: var(--ink-3); margin-bottom: 12px; }
.stats-mini-row b { color: var(--ink-2); font-weight: 800; }
.stats-open-hint { display: flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 700; color: var(--accent); }
.stats-cards-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }

@media (max-width: 1100px) {
  .stats-cards-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 640px) {
  .stats-cards-grid { grid-template-columns: 1fr; }
}

@media (max-width: 1100px) {
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
  .grid-3 { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 900px) {
  .login-visual { display: none; }
  .login-side { flex: 1; }
}

@media (max-width: 820px) {
  .layout { flex-direction: column; }
  .sidebar {
    position: static;
    width: auto;
    height: auto;
    margin: 12px;
    flex-direction: row;
    align-items: center;
    padding: 10px;
    overflow-x: auto;
  }
  .sidebar-nav { flex-direction: row; align-items: center; }
  .nav-section-label { display: none; }
  .nav-item.active::before { display: none; }
  .sidebar-header { border-bottom: none; padding-bottom: 0; margin-bottom: 0; border-inline-end: 1px solid var(--border-2); padding-inline-end: 10px; margin-inline-end: 10px; display: flex; align-items: center; }
  .sidebar-footer { border-top: none; border-inline-start: 1px solid var(--border-2); padding-top: 0; margin-top: 0; padding-inline-start: 10px; margin-inline-start: 10px; display: flex; align-items: center; gap: 6px; }
  .main-content { padding: 8px 16px 40px; }
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
}

.topbar-brand { line-height: 1.2; gap: 8px; }
.topbar-brand .brand-mark { width: 30px; height: 30px; }
.topbar-brand .brand-fa { font-size: 19px; }

.neuro-link { display: flex; align-items: flex-end; gap: 14px; margin: 6px 0 18px; padding: 8px 4px 2px; }
.neuro-node { display: flex; flex-direction: column; align-items: center; gap: 7px; flex-shrink: 0; }
.neuro-label { font-size: 11px; font-weight: 800; color: var(--ink-3); letter-spacing: 0.3px; }
.neuro-id { font-size: 12px; font-weight: 600; color: var(--ink-2); background: var(--bg); box-shadow: var(--nm-in-sm); border-radius: 10px; padding: 6px 12px; }
.neuro-wire { position: relative; flex: 1; height: 3px; border-radius: 99px; margin-bottom: 13px; background: linear-gradient(90deg, rgba(139, 124, 240, 0.18), rgba(139, 124, 240, 0.7), rgba(139, 124, 240, 0.18)); }
.neuro-wire::before, .neuro-wire::after { content: ''; position: absolute; top: 50%; width: 9px; height: 9px; border-radius: 50%; transform: translateY(-50%); background: #8B7CF0; box-shadow: 0 0 10px rgba(139, 124, 240, 0.9); }
.neuro-wire::before { right: -4px; }
.neuro-wire::after { left: -4px; }
.neuro-dot { position: absolute; top: 50%; transform: translate(50%, -50%); width: 6px; height: 6px; border-radius: 50%; background: #8B7CF0; opacity: 0.85; box-shadow: 0 0 8px rgba(139, 124, 240, 0.8); }
.neuro-dot.d1 { right: 22%; }
.neuro-dot.d2 { right: 50%; width: 8px; height: 8px; }
.neuro-dot.d3 { right: 78%; }
.neuro-pulse { position: absolute; top: 50%; right: 0; width: 11px; height: 11px; border-radius: 50%; transform: translate(50%, -50%); background: #FDFDFF; box-shadow: 0 0 12px 4px rgba(139, 124, 240, 0.95); animation: neuro-pulse 2.8s ease-in-out infinite; }
@keyframes neuro-pulse {
  0% { right: 0%; opacity: 0; }
  10% { opacity: 1; }
  90% { opacity: 1; }
  100% { right: 100%; opacity: 0; }
}

.test-check { display: flex; align-items: flex-start; gap: 10px; padding: 10px 14px; border-radius: 12px; margin-bottom: 8px; background: var(--bg); box-shadow: var(--nm-in-sm); }
.test-check-icon { flex: 0 0 auto; width: 22px; height: 22px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 900; color: #fff; margin-top: 1px; }
.test-check.ok .test-check-icon { background: var(--green); }
.test-check.fail .test-check-icon { background: var(--red); }
.test-check-label { font-size: 12.5px; font-weight: 800; color: var(--ink); }
.test-check-detail { font-size: 12px; color: var(--ink-2); margin-top: 2px; line-height: 1.7; }
.test-check.fail .test-check-detail { color: var(--red-dark); }

.route-box {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
  padding: 12px 14px;
  border-radius: 14px;
  background: var(--bg);
  box-shadow: var(--nm-in-sm);
}
.route-cell {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  min-width: 0;
}
.route-label {
  font-size: 10.5px;
  font-weight: 800;
  color: var(--ink-3);
  letter-spacing: 0.4px;
}
.route-id {
  font-family: 'SF Mono', 'Cascadia Code', 'JetBrains Mono', Consolas, 'Courier New', monospace;
  direction: ltr;
  unicode-bidi: embed;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.3px;
  color: var(--ink);
  white-space: nowrap;
}
.route-arrow {
  display: flex;
  color: var(--accent);
  opacity: 0.8;
  flex-shrink: 0;
}

.test-check.warn .test-check-icon { background: var(--amber); }
.test-check.warn .test-check-detail { color: var(--amber-dark); }

.stat-sub-inline {
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-3);
  margin-inline-start: 6px;
}

.feed-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border-2);
}
.feed-row:last-child { border-bottom: none; }
.feed-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  flex-shrink: 0;
}
.feed-dot.sent { background: var(--green); box-shadow: 0 0 6px rgba(63, 174, 142, 0.7); }
.feed-dot.duplicate { background: var(--amber); box-shadow: 0 0 6px rgba(233, 161, 59, 0.7); }
.feed-dot.error { background: var(--red); box-shadow: 0 0 6px rgba(232, 120, 95, 0.7); }
.feed-dot.skipped { background: var(--ink-3); }
.feed-main { flex: 1; min-width: 0; }
.feed-title {
  font-size: 13px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
}
.feed-text {
  font-size: 12px;
  color: var(--ink-2);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  margin-top: 2px;
}
.feed-time { font-size: 11px; color: var(--ink-3); flex-shrink: 0; }
.feed-empty { text-align: center; color: var(--ink-3); padding: 24px; font-size: 13px; }
.chan-mini-stat { font-size: 11.5px; color: var(--ink-2); flex-shrink: 0; }

.msg-filters {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 10px;
  margin-bottom: 20px;
}
.msg-filters > select.form-input {
  width: auto;
  min-width: 0;
  flex: 0 0 auto;
  cursor: pointer;
}
.msg-search-wrap { position: relative; flex: 1 1 auto; min-width: 140px; }
.msg-search-wrap svg {
  position: absolute;
  top: 50%;
  inset-inline-start: 13px;
  transform: translateY(-50%);
  color: var(--ink-3);
  pointer-events: none;
}
.msg-search-wrap .form-input { padding-inline-start: 38px; }
.msg-select { width: auto; min-width: 150px; cursor: pointer; }
.msg-status-chips,
.msg-chips { display: flex; gap: 8px; flex: 0 0 auto; }
.msg-chip {
  border: none;
  cursor: pointer;
  font-family: inherit;
  font-size: 12px;
  font-weight: 700;
  color: var(--ink-2);
  background: var(--bg);
  box-shadow: var(--nm-out-sm);
  border-radius: 99px;
  padding: 9px 16px;
  transition: all 0.18s ease;
}
.msg-chip:hover { color: var(--ink); }
.msg-chip.active {
  color: #fff;
  background: linear-gradient(135deg, var(--accent-2), var(--accent));
  box-shadow: 4px 4px 10px rgba(108, 93, 211, 0.35), -2px -2px 8px var(--nm-light);
}

.msg-loading {
  text-align: center;
  color: var(--ink-3);
  padding: 40px;
  font-size: 13px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}
.msg-spinner {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 2px solid var(--accent-soft);
  border-top-color: var(--accent);
  animation: msg-spin 0.8s linear infinite;
}
@keyframes msg-spin { to { transform: rotate(360deg); } }

.msg-card {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--nm-out-sm);
  padding: 16px 18px;
  margin-bottom: 14px;
  position: relative;
  overflow: hidden;
  transition: box-shadow 0.2s ease;
}
.msg-card::before {
  content: '';
  position: absolute;
  top: 0;
  bottom: 0;
  inset-inline-start: 0;
  width: 4px;
  border-radius: 99px;
  background: var(--ink-3);
  opacity: 0.5;
}
.msg-card.status-sent::before { background: var(--green); opacity: 1; }
.msg-card.status-duplicate::before { background: var(--amber); opacity: 1; }
.msg-card.status-error::before { background: var(--red); opacity: 1; }
.msg-card:hover { box-shadow: var(--nm-out); }
.msg-head { display: flex; align-items: center; gap: 10px; cursor: pointer; flex-wrap: wrap; }
.msg-status-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.msg-status-dot.sent { background: var(--green); box-shadow: 0 0 7px rgba(63, 174, 142, 0.8); }
.msg-status-dot.duplicate { background: var(--amber); box-shadow: 0 0 7px rgba(233, 161, 59, 0.8); }
.msg-status-dot.error { background: var(--red); box-shadow: 0 0 7px rgba(232, 120, 95, 0.8); }
.msg-status-dot.skipped { background: var(--ink-3); }
.msg-channel { font-size: 13.5px; font-weight: 800; }
.msg-badge {
  font-size: 10.5px;
  font-weight: 800;
  border-radius: 99px;
  padding: 3px 10px;
}
.msg-badge-sent { color: var(--green-dark); background: var(--green-soft); }
.msg-badge-duplicate { color: var(--amber-dark); background: var(--amber-soft); }
.msg-badge-error { color: var(--red-dark); background: var(--red-soft); }
.msg-badge-skipped { color: var(--ink-2); background: var(--surface-2); }
.msg-media-chip {
  font-size: 10.5px;
  font-weight: 700;
  color: var(--sky-dark);
  background: var(--sky-soft);
  border-radius: 99px;
  padding: 3px 9px;
}
.msg-time { font-size: 11.5px; color: var(--ink-3); margin-inline-start: auto; flex-shrink: 0; }
.msg-caret { display: flex; color: var(--ink-3); transition: transform 0.25s ease; }
.msg-card.expanded .msg-caret { transform: rotate(180deg); }
.msg-text { font-size: 13px; color: var(--ink-2); line-height: 1.9; margin: 10px 2px 0; }
.msg-no-text { color: var(--ink-3); }
.msg-pipe { display: none; }
.msg-card.expanded .msg-pipe { display: block; animation: page-in 0.3s cubic-bezier(0.22, 1, 0.36, 1); }

.pipe-snake {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 18px 6px 6px;
  padding: 20px 16px;
  border-radius: 14px;
  background: var(--bg);
  box-shadow: var(--nm-in-sm);
  overflow: hidden;
}
.pipe-snake::before {
  content: '';
  position: absolute;
  top: 22px;
  bottom: 22px;
  right: 50%;
  width: 3px;
  margin-right: -1.5px;
  border-radius: 99px;
  background: repeating-linear-gradient(180deg, rgba(142, 126, 242, 0.55) 0 6px, rgba(142, 126, 242, 0.12) 6px 12px);
  animation: pipe-fall 1.1s linear infinite;
}
@keyframes pipe-fall { to { background-position: 0 12px; } }
.pipe-node {
  position: relative;
  z-index: 1;
  width: calc(50% - 30px);
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 9px 12px;
  border-radius: 12px;
  background: var(--surface);
  box-shadow: var(--nm-out-sm);
  transition: transform 0.22s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.pipe-node:hover { transform: translateY(-2px); }
.pipe-node.right { align-self: flex-start; }
.pipe-node.left { align-self: flex-end; }
.pipe-node::after {
  content: '';
  position: absolute;
  top: 22px;
  width: 30px;
  height: 2px;
  background: repeating-linear-gradient(90deg, rgba(142, 126, 242, 0.45) 0 5px, transparent 5px 9px);
}
.pipe-node.right::after { left: -30px; }
.pipe-node.left::after { right: -30px; }
.pipe-node::before {
  content: '';
  position: absolute;
  top: 19px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: rgba(142, 126, 242, 0.8);
  box-shadow: 0 0 8px rgba(142, 126, 242, 0.55);
}
.pipe-node.right::before { left: -34px; }
.pipe-node.left::before { right: -34px; }
.pipe-node.error::before { background: var(--red); box-shadow: 0 0 8px rgba(232, 120, 95, 0.6); }
.pipe-node.duplicate::before { background: var(--amber); box-shadow: 0 0 8px rgba(233, 161, 59, 0.6); }
.pipe-icon {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  background: var(--bg);
  box-shadow: var(--nm-out-sm);
  color: var(--accent);
  transition: transform 0.22s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.pipe-node:hover .pipe-icon { transform: scale(1.12); }
.pipe-icon svg { width: 15px; height: 15px; }
.pipe-node.error .pipe-icon { color: var(--red); box-shadow: var(--nm-out-sm), 0 0 10px rgba(232, 120, 95, 0.4); }
.pipe-node.duplicate .pipe-icon { color: var(--amber); box-shadow: var(--nm-out-sm), 0 0 10px rgba(233, 161, 59, 0.45); }
.pipe-node.final .pipe-icon { color: #fff; }
.pipe-node.final.ok .pipe-icon { background: linear-gradient(135deg, var(--green), var(--green-dark)); }
.pipe-node.final.duplicate .pipe-icon { background: linear-gradient(135deg, var(--amber), var(--amber-dark)); }
.pipe-node.final.error .pipe-icon { background: linear-gradient(135deg, var(--red), var(--red-dark)); }
.pipe-body { flex: 1; min-width: 0; }
.pipe-head-row { display: flex; align-items: center; gap: 8px; }
.pipe-label { font-size: 11px; font-weight: 800; line-height: 1.7; }
.pipe-node.error .pipe-label { color: var(--red-dark); }
.pipe-node.duplicate .pipe-label { color: var(--amber-dark); }
.pipe-ms {
  font-size: 9.5px;
  font-weight: 700;
  color: var(--ink-3);
  background: var(--surface-2);
  border-radius: 99px;
  padding: 1px 8px;
  margin-inline-start: auto;
  flex-shrink: 0;
  direction: ltr;
}
.pipe-detail { font-size: 10.5px; color: var(--ink-2); margin-top: 4px; line-height: 1.8; word-break: break-word; }
.pipe-detail a { color: var(--accent); font-weight: 700; text-decoration: none; }
@media (max-width: 720px) {
  .pipe-snake::before { right: 19px; }
  .pipe-node { width: calc(100% - 34px); align-self: flex-end !important; }
  .pipe-node::after { right: -20px !important; left: auto !important; width: 16px; }
  .pipe-node::before { right: -24px !important; left: auto !important; }
}
.pipe-total {
  font-size: 11.5px;
  color: var(--ink-3);
  text-align: start;
  margin-top: 8px;
  padding-inline-start: 4px;
}

.channel-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
  gap: 20px;
}

.channel-card.big .card-body {
  padding: 22px;
  display: flex;
  flex-direction: column;
}

.channel-card.big {
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.channel-card.big:hover {
  transform: translateY(-3px);
}

.ch-card-head {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}

.ch-avatar {
  width: 48px;
  height: 48px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  font-weight: 800;
  color: #fff;
  background: linear-gradient(135deg, var(--accent-2), var(--accent));
  box-shadow: var(--nm-out-sm);
  flex-shrink: 0;
}

.ch-title-box {
  flex: 1;
  min-width: 0;
}

.ch-title {
  font-size: 15.5px;
  font-weight: 800;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ch-sub {
  font-size: 11.5px;
  color: var(--ink-3);
  font-weight: 600;
  margin-top: 3px;
}

.ch-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 16px 0;
  min-height: 24px;
}

.ch-feature-chip {
  font-size: 10.5px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-dark);
}

.ch-feature-chip.more {
  background: var(--surface-2);
  color: var(--ink-2);
}

.ch-feature-chip.muted {
  background: var(--surface-2);
  color: var(--ink-3);
}

.ch-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: auto;
}

.ch-actions .btn {
  flex: 1;
  justify-content: center;
}

.kpi-filter-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 20px;
}

.kpi-date-inputs {
  display: flex;
  gap: 8px;
  align-items: center;
}

.kpi-date-inputs .form-input {
  width: 132px;
  direction: ltr;
  text-align: center;
}

.kpi-hint {
  background: var(--amber-soft);
  color: var(--amber-dark);
  font-size: 12.5px;
  font-weight: 600;
  padding: 12px 18px;
  border-radius: 12px;
  margin-bottom: 20px;
  line-height: 2;
}

.report-card {
  padding: 18px 0;
  border-bottom: 1px solid var(--border-2);
}

.report-card:last-child {
  border-bottom: none;
}

.report-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

.report-op {
  font-weight: 800;
  font-size: 13.5px;
}

.report-date {
  font-size: 11.5px;
  color: var(--ink-3);
  font-weight: 600;
}

.report-summary {
  background: var(--sky-soft);
  color: var(--sky-dark);
  font-size: 12.5px;
  padding: 10px 14px;
  border-radius: 10px;
  margin-bottom: 10px;
  line-height: 2;
}

.report-text {
  font-size: 13px;
  color: var(--ink-2);
  white-space: pre-wrap;
  line-height: 2;
}

.report-text.collapsed {
  max-height: 96px;
  overflow: hidden;
  position: relative;
}

.report-text.collapsed::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 40px;
  background: linear-gradient(transparent, var(--surface));
}

.report-toggle {
  background: none;
  border: none;
  color: var(--accent);
  font-weight: 700;
  font-size: 12px;
  cursor: pointer;
  padding: 8px 0 0;
  font-family: inherit;
}

.toast-info {
  border-inline-start: 4px solid var(--sky);
}

.toast-info svg {
  color: var(--sky);
}

:focus-visible {
  outline: 2px solid var(--accent-2);
  outline-offset: 2px;
  border-radius: 6px;
}

::selection {
  background: var(--accent-soft);
  color: var(--accent-dark);
}

::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--border-2);
  border-radius: 999px;
  border: 2px solid var(--bg);
}

::-webkit-scrollbar-thumb:hover {
  background: var(--ink-3);
}

.table tbody tr {
  transition: background 0.15s;
}

.table tbody tr:hover {
  background: rgba(108, 93, 211, 0.04);
}

.btn:active {
  transform: scale(0.97);
}

.kpi-legend {
  font-size: 11px;
  color: var(--ink-3);
}

@media (max-width: 720px) {
  .channel-grid {
    grid-template-columns: 1fr;
  }

  .kpi-filter-bar {
    flex-direction: column;
    align-items: stretch;
  }

  .kpi-date-inputs .form-input {
    width: 100%;
  }
}

.channel-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(360px, 1fr)); gap: 20px; }
.channel-card.big .card-body { padding: 20px; }
.ch-card-head { display: flex; align-items: center; gap: 14px; margin-bottom: 14px; }
.ch-avatar { width: 46px; height: 46px; border-radius: 14px; display: flex; align-items: center; justify-content: center; font-size: 20px; font-weight: 800; color: #fff; background: linear-gradient(135deg, var(--accent-2), var(--accent)); box-shadow: var(--nm-out-sm); flex-shrink: 0; }
.ch-title-box { flex: 1; min-width: 0; }
.ch-title { font-size: 16px; font-weight: 800; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ch-sub { font-size: 12px; color: var(--ink-3); margin-top: 3px; direction: ltr; text-align: right; }
.ch-chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 12px 0; }
.ch-feature-chip { font-size: 11.5px; font-weight: 700; padding: 4px 10px; border-radius: 20px; background: var(--accent-soft); color: var(--accent-dark); }
.ch-feature-chip.more { background: var(--surface-2); color: var(--ink-2); }
.ch-feature-chip.muted { background: var(--surface-2); color: var(--ink-3); }
.ch-actions { display: flex; gap: 8px; margin-top: 14px; }

.kpi-filter-bar { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px; margin-bottom: 20px; }
.kpi-date-inputs { display: flex; align-items: center; gap: 8px; }
.kpi-date-inputs .form-input { width: 130px; direction: ltr; text-align: center; }
.kpi-hint { background: var(--amber-soft); color: var(--amber-dark); border-radius: var(--radius); padding: 14px 18px; font-size: 13.5px; font-weight: 600; margin-bottom: 20px; line-height: 2; }

.report-card { background: var(--surface); border-radius: var(--radius); box-shadow: var(--nm-out-sm); padding: 18px 20px; margin-bottom: 14px; }
.report-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.report-op { font-weight: 800; color: var(--ink); font-size: 14.5px; }
.report-date { font-size: 12px; color: var(--ink-3); }
.report-summary { background: var(--sky-soft); color: var(--sky-dark); border-radius: 10px; padding: 10px 14px; font-size: 13px; margin-bottom: 10px; line-height: 1.9; }
.report-text { font-size: 13.5px; color: var(--ink-2); line-height: 2; white-space: pre-wrap; position: relative; }
.report-text.collapsed { max-height: 96px; overflow: hidden; }
.report-text.collapsed::after { content: ''; position: absolute; bottom: 0; right: 0; left: 0; height: 40px; background: linear-gradient(transparent, var(--surface)); }
.report-toggle { margin-top: 8px; }

:focus-visible { outline: 2px solid var(--accent-2); outline-offset: 2px; }
::selection { background: var(--accent-soft); }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #CBD0E2; border-radius: 20px; border: 3px solid var(--bg); }
::-webkit-scrollbar-thumb:hover { background: var(--ink-3); }
.table tbody tr { transition: background 0.15s; }
.table tbody tr:hover { background: var(--surface-2); }
.btn:active { transform: scale(0.98); }
.toast-info { background: var(--sky-soft); color: var(--sky-dark); }

@media (max-width: 720px) {
  .channel-grid { grid-template-columns: 1fr; }
  .kpi-filter-bar { flex-direction: column; align-items: stretch; }
  .kpi-date-inputs { flex-wrap: wrap; }
}

:root {
  --err: #D64550;
  --err-soft: #F8DCE0;
  --err-dark: #A82834;
  --yellow: #E9C433;
  --yellow-soft: #F8F0CC;
  --yellow-dark: #93770A;
}

.msg-status-dot.error { background: var(--err); box-shadow: 0 0 7px rgba(214, 69, 80, 0.8); }
.msg-status-dot.duplicate { background: var(--yellow); box-shadow: 0 0 7px rgba(233, 196, 51, 0.8); }
.msg-badge-error { color: var(--err-dark); background: var(--err-soft); }
.msg-badge-duplicate { color: var(--yellow-dark); background: var(--yellow-soft); }
.msg-card.status-error::before { background: var(--err); }
.msg-card.status-duplicate::before { background: var(--yellow); }
.feed-dot.error { background: var(--err); box-shadow: 0 0 6px rgba(214, 69, 80, 0.7); }
.feed-dot.duplicate { background: var(--yellow); box-shadow: 0 0 6px rgba(233, 196, 51, 0.7); }
.pipe-node.error .pipe-icon { color: var(--err); box-shadow: var(--nm-out-sm), 0 0 10px rgba(214, 69, 80, 0.4); }
.pipe-node.duplicate .pipe-icon { color: var(--yellow-dark); box-shadow: var(--nm-out-sm), 0 0 10px rgba(233, 196, 51, 0.45); }

.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
@media (max-width: 1100px) { .grid-4 { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 620px) { .grid-4 { grid-template-columns: 1fr; } }

.notif-wrap { position: relative; }
.notif-btn {
  position: relative;
  width: 40px;
  height: 40px;
  border: none;
  border-radius: 50%;
  background: var(--surface);
  box-shadow: var(--nm-out-sm);
  color: var(--ink-2);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.18s ease;
}
.notif-btn:hover { color: var(--accent); transform: translateY(-1px); }
.notif-btn.has-alerts { color: var(--accent); }
.notif-badge {
  position: absolute;
  top: -3px;
  inset-inline-end: -3px;
  min-width: 17px;
  height: 17px;
  border-radius: 99px;
  background: var(--err);
  color: #fff;
  font-size: 10px;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
  box-shadow: 0 2px 6px rgba(214, 69, 80, 0.5);
}
.notif-panel {
  position: absolute;
  top: calc(100% + 10px);
  inset-inline-end: 0;
  width: 330px;
  max-height: 380px;
  overflow-y: auto;
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--nm-out), 0 18px 40px rgba(46, 49, 80, 0.18);
  padding: 10px;
  display: none;
  z-index: 80;
}
.notif-panel.open { display: block; animation: page-in 0.22s cubic-bezier(0.22, 1, 0.36, 1); }
.notif-empty {
  text-align: center;
  color: var(--ink-3);
  font-size: 12.5px;
  padding: 26px 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
}
.notif-item {
  border-inline-start: 3px solid var(--amber);
  background: var(--bg);
  border-radius: 12px;
  padding: 10px 12px;
  margin-bottom: 8px;
  text-align: right;
}
.notif-item:last-child { margin-bottom: 0; }
.notif-item.critical { border-inline-start-color: var(--err); }
.notif-item-title { font-size: 12.5px; font-weight: 800; margin-bottom: 3px; }
.notif-item-body { font-size: 11.5px; color: var(--ink-2); line-height: 1.8; }

.kpi-filter-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}
.kpi-date-inputs { display: flex; align-items: center; gap: 8px; }
.kpi-hint {
  background: var(--bg);
  box-shadow: var(--nm-in-sm);
  border-radius: 12px;
  padding: 12px 16px;
  font-size: 12.5px;
  color: var(--ink-2);
  line-height: 2;
  margin-bottom: 18px;
}
.kpi-hero { margin-bottom: 20px; }
.kpi-delay-card {
  display: flex;
  align-items: center;
  gap: 18px;
  background: linear-gradient(135deg, var(--accent-2), var(--accent));
  color: #fff;
  border-radius: var(--radius);
  padding: 22px 26px;
  box-shadow: 6px 6px 16px rgba(108, 93, 211, 0.35), -4px -4px 12px var(--nm-light);
}
.kpi-delay-card .stat-label { color: rgba(255, 255, 255, 0.78); }
.kpi-delay-icon {
  width: 54px;
  height: 54px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.16);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.kpi-delay-value { font-size: 22px; font-weight: 900; margin: 2px 0; }
.kpi-delay-sub { font-size: 12px; color: rgba(255, 255, 255, 0.82); }
.kpi-chart-hint { font-size: 11.5px; color: var(--ink-3); margin-bottom: 10px; }
.kpi-sub-title { font-size: 13px; font-weight: 800; margin-bottom: 10px; color: var(--ink-2); }
.kpi-point-info {
  margin-top: 14px;
  background: var(--bg);
  border-radius: 14px;
  box-shadow: var(--nm-in-sm);
  padding: 14px 16px;
  animation: page-in 0.25s cubic-bezier(0.22, 1, 0.36, 1);
}
.kpi-point-row {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  font-size: 13px;
  margin-bottom: 10px;
}
.kpi-point-row span { color: var(--ink-2); font-size: 12.5px; }
.kpi-point-tag {
  font-size: 10.5px;
  font-weight: 800;
  border-radius: 99px;
  padding: 3px 10px;
}
.kpi-point-tag.dup { color: var(--yellow-dark); background: var(--yellow-soft); }
.kpi-point-tag.manual { color: var(--ink-2); background: var(--surface-2); }
.kpi-point-links { display: flex; gap: 10px; flex-wrap: wrap; }
.kpi-point-nolink { color: var(--ink-3); font-size: 12px; }
.kpi-report-item {
  background: var(--bg);
  box-shadow: var(--nm-in-sm);
  border-radius: 12px;
  padding: 12px 14px;
  margin-bottom: 10px;
}
.kpi-report-item:last-child { margin-bottom: 0; }
.kpi-report-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12.5px;
  margin-bottom: 6px;
}
.kpi-report-head span { color: var(--ink-3); font-size: 11.5px; }
.kpi-report-summary {
  font-size: 12px;
  color: var(--accent);
  font-weight: 700;
  margin-bottom: 6px;
}
.kpi-report-text {
  font-size: 12.5px;
  color: var(--ink-2);
  line-height: 2;
  white-space: pre-wrap;
  max-height: 130px;
  overflow-y: auto;
}

.topbar-actions { gap: 16px; }
.topbar-sep { width: 1px; height: 22px; background: rgba(46, 49, 80, 0.14); }
.notif-btn {
  width: 32px;
  height: 32px;
  border-radius: 10px;
  background: transparent;
  box-shadow: none;
  color: var(--ink-3);
}
.notif-btn:hover { background: rgba(46, 49, 80, 0.06); color: var(--ink-1); transform: none; }
.notif-btn svg { width: 16px; height: 16px; }
.notif-badge { top: 1px; inset-inline-end: 1px; min-width: 14px; height: 14px; font-size: 9px; padding: 0 3px; }
.notif-item.warning { border-inline-start-color: var(--amber); }
.notif-item.info { border-inline-start-color: var(--sky); }
.report-reply { background: var(--sky-soft); border-radius: 10px; padding: 10px 12px; font-size: 12.5px; line-height: 1.9; margin-top: 12px; color: var(--ink-2); }
.report-reply b { color: var(--ink-1); }
.report-reply-box { margin-top: 12px; }
.report-reply-box textarea { width: 100%; margin-bottom: 8px; resize: vertical; font-family: inherit; }
.report-reply-actions { display: flex; gap: 8px; }
.jdp-pop { position: absolute; z-index: 120; width: 252px; background: var(--surface); border-radius: 14px; box-shadow: var(--nm-out), 0 18px 40px rgba(46, 49, 80, 0.18); padding: 12px; user-select: none; }
.jdp-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.jdp-title { font-size: 13px; font-weight: 800; color: var(--ink-1); }
.jdp-nav { display: flex; gap: 2px; }
.jdp-nav button { border: none; background: transparent; width: 26px; height: 26px; border-radius: 8px; cursor: pointer; color: var(--ink-2); font-size: 13px; font-family: inherit; }
.jdp-nav button:hover { background: rgba(46, 49, 80, 0.07); }
.jdp-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; }
.jdp-wd { text-align: center; font-size: 10.5px; color: var(--ink-3); font-weight: 700; padding: 4px 0; }
.jdp-day { border: none; background: transparent; border-radius: 8px; height: 28px; font-size: 12px; cursor: pointer; color: var(--ink-2); font-family: inherit; }
.jdp-day:hover { background: rgba(108, 93, 211, 0.12); }
.jdp-day.today { color: var(--accent); font-weight: 800; }
.jdp-day.selected { background: var(--accent); color: #fff; font-weight: 800; }
.jdp-day.empty { visibility: hidden; }

.notif-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 2px 4px 10px;
  margin-bottom: 10px;
  border-bottom: 1px solid rgba(46, 49, 80, 0.08);
}
.notif-head-title { font-size: 12.5px; font-weight: 800; color: var(--ink-1); }
.notif-head-count { font-size: 10px; font-weight: 700; color: var(--accent); }
.notif-read-btn {
  border: none;
  background: rgba(108, 93, 211, 0.1);
  color: var(--accent);
  font-family: inherit;
  font-size: 11px;
  font-weight: 800;
  border-radius: 99px;
  padding: 4px 12px;
  cursor: pointer;
  transition: background 0.15s ease;
}
.notif-read-btn:hover { background: rgba(108, 93, 211, 0.2); }
.notif-item.read { opacity: 0.55; }
a.notif-item { display: block; text-decoration: none; color: inherit; cursor: pointer; }
a.notif-item:hover { background: rgba(108, 93, 211, 0.06); }
.report-card.flash { animation: report-flash 1.3s ease 2; }
@keyframes report-flash {
  0%, 100% { box-shadow: var(--nm-out-sm); }
  50% { box-shadow: 0 0 0 3px rgba(108, 93, 211, 0.35), var(--nm-out-sm); }
}

.stats-range-bar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  padding: 12px 14px;
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--nm-out-sm);
}

.range-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
  font-weight: 800;
  color: var(--ink-2);
  margin-inline-end: 4px;
}

.range-chip {
  border: none;
  cursor: pointer;
  font-family: inherit;
  font-size: 12px;
  font-weight: 700;
  color: var(--ink-2);
  background: var(--surface);
  padding: 7px 14px;
  border-radius: 999px;
  box-shadow: var(--nm-out-sm);
  transition: all 0.18s ease;
}

.range-chip:hover {
  color: var(--accent);
}

.range-chip.active {
  color: #fff;
  background: var(--accent);
  box-shadow: var(--nm-in-sm);
}

.range-divider {
  width: 1px;
  height: 22px;
  background: var(--border);
  margin: 0 4px;
}

.range-date {
  width: 118px;
  padding: 7px 12px;
  font-size: 12px;
  text-align: center;
  cursor: pointer;
}

.range-to {
  font-size: 12px;
  color: var(--ink-3);
}

.jdp {
  position: absolute;
  z-index: 300;
  width: 272px;
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: 0 14px 38px rgba(37, 40, 66, 0.18);
  border: 1px solid var(--border);
  padding: 12px;
  direction: rtl;
}

.jdp-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.jdp-title {
  font-size: 13px;
  font-weight: 800;
  color: var(--ink-1);
}

.jdp-nav {
  border: none;
  cursor: pointer;
  width: 28px;
  height: 28px;
  border-radius: 9px;
  font-size: 16px;
  color: var(--ink-2);
  background: var(--surface);
  box-shadow: var(--nm-out-sm);
  transition: color 0.15s ease;
}

.jdp-nav:hover {
  color: var(--accent);
}

.jdp-week {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 2px;
  margin-bottom: 4px;
}

.jdp-week span {
  text-align: center;
  font-size: 10.5px;
  font-weight: 800;
  color: var(--ink-3);
  padding: 4px 0;
}

.jdp-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 2px;
}

.jdp-day {
  border: none;
  cursor: pointer;
  font-family: inherit;
  font-size: 12px;
  font-weight: 700;
  color: var(--ink-2);
  background: transparent;
  border-radius: 9px;
  padding: 7px 0;
  transition: all 0.15s ease;
}

.jdp-day.empty {
  cursor: default;
}

.jdp-day:not(.empty):hover {
  background: var(--accent-soft);
  color: var(--accent);
}

.jdp-day.today {
  background: var(--accent);
  color: #fff;
}

.np-hero {
  position: relative;
  overflow: hidden;
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--nm-out);
  margin-bottom: 20px;
  min-height: 150px;
}

.np-hero-inner {
  position: relative;
  z-index: 1;
  padding: 34px 30px;
  pointer-events: none;
}

.np-hero-title {
  font-size: 20px;
  font-weight: 900;
  color: var(--ink-1);
  margin-bottom: 6px;
}

.np-hero-sub {
  font-size: 13px;
  color: var(--ink-2);
  max-width: 520px;
  line-height: 1.9;
}

.np-lib-card {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 22px;
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--nm-out);
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.np-lib-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 12px 30px rgba(108, 93, 211, 0.16);
}

.np-lib-icon {
  width: 52px;
  height: 52px;
  border-radius: 16px;
  background: var(--accent-soft);
  color: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.np-lib-name {
  font-size: 14.5px;
  font-weight: 800;
  color: var(--ink-1);
  margin-bottom: 4px;
}

.np-lib-count {
  font-size: 12px;
  color: var(--ink-2);
}

.np-count-sep {
  margin: 0 6px;
  color: var(--ink-3);
}

.np-lib-hint {
  margin-inline-start: auto;
  color: var(--ink-3);
  display: flex;
  align-items: center;
}

#np-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
  gap: 16px;
}

.np-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 18px;
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--nm-out-sm);
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.np-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 24px rgba(108, 93, 211, 0.14);
}

.np-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.np-card-name {
  font-size: 13.5px;
  font-weight: 800;
  color: var(--ink-1);
}

.np-tag {
  font-family: 'Courier New', monospace;
  font-size: 10.5px;
  font-weight: 700;
  color: var(--accent);
  background: var(--accent-soft);
  padding: 3px 8px;
  border-radius: 999px;
  white-space: nowrap;
}

.np-card-text {
  font-size: 12px;
  color: var(--ink-2);
  line-height: 1.9;
  min-height: 44px;
}

.np-card-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-top: 1px solid var(--border);
  padding-top: 10px;
}

.np-usage {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 700;
  color: var(--ink-3);
}

.np-usage-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--ink-3);
}

.np-usage.on {
  color: var(--green-dark);
}

.np-usage.on .np-usage-dot {
  background: var(--green);
  box-shadow: 0 0 0 3px var(--green-soft);
  animation: np-pulse 2s ease infinite;
}

@keyframes np-pulse {
  0%, 100% { box-shadow: 0 0 0 3px var(--green-soft); }
  50% { box-shadow: 0 0 0 6px rgba(126, 190, 137, 0.12); }
}

.np-card-foot .actions {
  display: flex;
  gap: 4px;
}


.usage-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.usage-grid.cols-1 { grid-template-columns: minmax(0, 1fr); }
.usage-grid.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.usage-grid.cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }

@media (max-width: 1350px) {
  .usage-grid.cols-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .usage-grid.cols-4 .usage-item:last-child:nth-child(odd) { grid-column: 1 / -1; }
}

@media (max-width: 1100px) {
  .usage-grid.cols-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .usage-grid.cols-3 .usage-item:last-child:nth-child(odd) { grid-column: 1 / -1; }
}

@media (max-width: 640px) {
  .usage-grid, .usage-grid.cols-3, .usage-grid.cols-4 { grid-template-columns: minmax(0, 1fr); }
  .usage-grid.cols-3 .usage-item:last-child:nth-child(odd),
  .usage-grid.cols-4 .usage-item:last-child:nth-child(odd) { grid-column: auto; }
}

.usage-item {
  position: relative;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px 18px;
  border-radius: var(--radius);
  background: var(--bg);
  box-shadow: var(--nm-in-sm);
  overflow: hidden;
}

.usage-item.ok { --usage-color: var(--accent); --usage-dark: var(--accent-dark); --usage-soft: var(--accent-soft); }
.usage-item.warn { --usage-color: var(--amber); --usage-dark: var(--amber-dark); --usage-soft: var(--amber-soft); }
.usage-item.danger { --usage-color: var(--red); --usage-dark: var(--red-dark); --usage-soft: var(--red-soft); }

.usage-ring { position: relative; width: 68px; height: 68px; flex-shrink: 0; }
.usage-ring svg { width: 100%; height: 100%; transform: rotate(-90deg); display: block; }
.usage-ring-track { fill: none; stroke: var(--border-2); stroke-width: 7; }
.usage-ring-fill { fill: none; stroke: var(--usage-color); stroke-width: 7; stroke-linecap: round; transition: stroke-dashoffset 0.9s cubic-bezier(0.22, 1, 0.36, 1); }
.usage-pct { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: 13.5px; font-weight: 800; color: var(--usage-dark); }

.usage-info { position: relative; flex: 1; min-width: 0; }
.usage-head { display: flex; align-items: center; gap: 8px; margin-bottom: 5px; }
.usage-icon { width: 26px; height: 26px; border-radius: 9px; background: var(--usage-soft); color: var(--usage-dark); display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.usage-label { font-size: 13px; font-weight: 800; color: var(--ink); }
.usage-nums { font-size: 12px; font-weight: 700; color: var(--ink-2); }
.usage-nums span { font-weight: 400; color: var(--ink-3); }
.usage-foot { display: flex; align-items: center; gap: 8px; margin-top: 8px; flex-wrap: wrap; }
.usage-pill { font-size: 10.5px; font-weight: 800; padding: 3px 10px; border-radius: 99px; background: var(--usage-soft); color: var(--usage-dark); }

html[data-theme="dark"] .usage-item { background: #141726; }
html[data-theme="dark"] .usage-ring-track { stroke: rgba(147, 161, 227, 0.16); }

#pa-list { max-height: 280px; overflow-y: auto; display: flex; flex-direction: column; gap: 8px; }
#pa-list .feature-check { width: 100%; }
.adv-slot .adv-section { margin-top: 12px; }

.info-tip {
  display: inline-block;
  width: 15px;
  height: 15px;
  margin-inline-start: 4px;
  font-size: 0;
  color: transparent;
  overflow: hidden;
  vertical-align: -2.5px;
  cursor: help;
  flex-shrink: 0;
  user-select: none;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none'%3E%3Ccircle cx='12' cy='12' r='10' stroke='%236C5DD3' stroke-width='2'/%3E%3Cpath d='M12 11v5.5' stroke='%236C5DD3' stroke-width='2.2' stroke-linecap='round'/%3E%3Ccircle cx='12' cy='7.5' r='1.4' fill='%236C5DD3'/%3E%3C/svg%3E") center / contain no-repeat;
  opacity: 0.5;
  transition: opacity 0.15s ease;
}

.info-tip:hover {
  opacity: 1;
}

.tip-pop {
  position: fixed;
  z-index: 4000;
  background: #2E3150;
  color: #fff;
  font-size: 12.5px;
  font-weight: 500;
  line-height: 2;
  padding: 10px 14px;
  border-radius: 12px;
  max-width: 280px;
  text-align: right;
  direction: rtl;
  box-shadow: 0 14px 34px rgba(46, 49, 80, 0.35);
  pointer-events: none;
  opacity: 0;
  transform: translateY(4px);
  transition: opacity 0.15s ease, transform 0.15s ease;
}

.tip-pop.show {
  opacity: 1;
  transform: translateY(0);
}

.tip-pop::after {
  content: '';
  position: absolute;
  top: 100%;
  right: var(--tip-arrow, 50%);
  transform: translateX(50%);
  border: 6px solid transparent;
  border-top-color: #2E3150;
}

.tip-pop.below::after {
  top: auto;
  bottom: 100%;
  border-top-color: transparent;
  border-bottom-color: #2E3150;
}

.kpi-choice-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px;
}

.kpi-choice-card {
  display: flex;
  align-items: flex-start;
  gap: 18px;
  padding: 30px 26px;
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--nm-out);
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.kpi-choice-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 12px 30px rgba(108, 93, 211, 0.16);
}

.kpi-choice-icon {
  width: 54px;
  height: 54px;
  border-radius: 16px;
  background: var(--accent-soft);
  color: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.kpi-choice-card.sky .kpi-choice-icon {
  background: var(--sky-soft);
  color: var(--sky);
}

.kpi-choice-card.sky .kpi-choice-hint { color: var(--sky-dark); }

.kpi-choice-name {
  font-size: 16.5px;
  font-weight: 800;
  margin-bottom: 7px;
}

.kpi-choice-desc {
  font-size: 12.8px;
  color: var(--ink-2);
  line-height: 2;
}

.kpi-choice-hint {
  margin-top: 12px;
  font-size: 12.5px;
  font-weight: 700;
  color: var(--accent);
  display: flex;
  align-items: center;
  gap: 6px;
}

.kpi-view-head {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}

@media (max-width: 820px) {
  .kpi-choice-grid { grid-template-columns: 1fr; }
}

.kpi-hm-scroll {
  overflow-x: auto;
}

.kpi-heatmap {
  display: grid;
  grid-template-columns: 58px repeat(24, minmax(10px, 1fr));
  gap: 3px;
  direction: rtl;
  min-width: 560px;
}

.kpi-hm-hour {
  font-size: 9.5px;
  color: var(--ink-3);
  text-align: center;
}

.kpi-hm-day {
  font-size: 11px;
  color: var(--ink-2);
  display: flex;
  align-items: center;
  padding-inline-end: 4px;
  white-space: nowrap;
}

.kpi-hm-cell {
  height: 24px;
  border-radius: 4px;
}

.kpi-hm-legend {
  display: flex;
  align-items: center;
  gap: 5px;
  justify-content: flex-end;
  margin-top: 10px;
  font-size: 11px;
  color: var(--ink-3);
}

.kpi-hm-legend i {
  width: 14px;
  height: 14px;
  border-radius: 4px;
  display: inline-block;
}

.kpi-op-row-active td {
  background: rgba(108, 93, 211, 0.07);
}

@media (max-width: 800px) {
  .msg-filters { flex-wrap: wrap; }
}

.channel-grid { grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); }
.route-box.route-vertical { flex-direction: column; align-items: stretch; gap: 8px; }
.route-box.route-vertical .route-cell { justify-content: space-between; }
.route-arrow-down { display: flex; align-items: center; justify-content: center; color: var(--accent); }
.channel-card.big .ch-actions { justify-content: center; gap: 10px; margin-top: 16px; }
.ch-action { width: 36px; height: 36px; border-radius: 11px; display: inline-flex; align-items: center; justify-content: center; flex: 0 0 auto; }
.ch-action-danger { color: var(--red); }
.msg-card.status-pending::before { background: var(--sky); opacity: 1; }
.msg-status-dot.pending { background: var(--sky); box-shadow: 0 0 7px rgba(91, 141, 239, 0.8); }
.msg-badge-pending { color: var(--sky-dark); background: var(--sky-soft); }
.msg-card.status-rejected::before { background: var(--ink-3); opacity: 1; }
.msg-status-dot.rejected { background: var(--ink-3); }
.msg-badge-rejected { color: var(--ink-2); background: var(--surface-2); }
.kpi-delta { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 800; padding: 3px 10px; border-radius: 999px; margin-inline-start: 10px; vertical-align: middle; }
.kpi-delta.good { color: var(--green-dark); background: var(--green-soft); }
.kpi-delta.bad { color: var(--red-dark); background: var(--red-soft); }
.kpi-delta.flat { color: var(--ink-2); background: var(--surface-2); }
.kpi-delta-slot { display: inline-flex; }
.msg-sem-chip { background: var(--accent-soft); color: var(--accent-dark); }

.ap-always {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 13px 16px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: var(--surface);
  box-shadow: var(--nm-out-sm);
  cursor: pointer;
  margin-bottom: 10px;
  user-select: none;
  transition: all 0.18s ease;
}

.ap-always:hover { transform: translateY(-1px); }

.ap-always.checked { background: var(--bg); box-shadow: var(--nm-in-sm); transform: none; }

.ap-always-title { font-size: 13.5px; font-weight: 800; color: var(--ink); }

.ap-always.checked .ap-always-title { color: var(--accent); }

.ap-always-sub { font-size: 11.5px; color: var(--ink-3); margin-top: 3px; }

.ap-switch {
  position: relative;
  flex-shrink: 0;
  width: 44px;
  height: 24px;
  border-radius: 999px;
  background: var(--surface-2);
  box-shadow: var(--nm-in-sm);
  transition: background 0.2s ease;
}

.ap-knob {
  position: absolute;
  top: 3px;
  right: 3px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--surface);
  box-shadow: 0 2px 5px rgba(46, 49, 80, 0.25);
  transition: transform 0.2s ease;
}

.ap-always.checked .ap-switch { background: linear-gradient(135deg, var(--accent-2), var(--accent)); }

.ap-always.checked .ap-knob { transform: translateX(-20px); }

.ap-or { font-size: 12px; font-weight: 700; color: var(--ink-3); margin: 2px 2px 8px; }

.powered-by { margin-top: 10px; text-align: center; font-size: 11px; color: var(--ink-3); letter-spacing: 0.2px; }

.powered-by a { color: var(--accent); font-weight: 700; text-decoration: none; }

.powered-by a:hover { color: var(--accent-dark); }

.platform-section { border-right: 3px solid var(--accent-soft); }
.platform-head { display: flex; align-items: center; gap: 9px; margin-bottom: 12px; }
.platform-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.dot-bale { background: #3BBE8E; box-shadow: 0 0 0 4px rgba(59, 190, 142, .16); }
.dot-rubika { background: #3BBE8E; box-shadow: 0 0 0 4px rgba(59, 190, 142, .16); }
.platform-id-row { display: flex; gap: 8px; align-items: stretch; }
.platform-id-row .form-input { flex: 1; min-width: 0; }
.platform-id-row .btn { white-space: nowrap; align-self: center; }
.platform-note { font-size: 11.5px; color: var(--ink-3); margin-top: 6px; }
.platform-results { margin-top: 10px; }
.platform-chat-pick { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 9px 12px; border-radius: 12px; background: var(--surface-2); box-shadow: var(--nm-in-sm); cursor: pointer; margin-bottom: 6px; transition: box-shadow .15s ease; }
.platform-chat-pick:hover { box-shadow: var(--nm-out-sm); }
.platform-chat-title { font-size: 12.5px; font-weight: 700; color: var(--ink); }
.platform-chat-id { font-size: 11.5px; color: var(--ink-3); direction: ltr; }

.wiz-steps { display: flex; align-items: center; gap: 10px; margin-bottom: 20px; }
.wiz-step-tab { display: flex; align-items: center; gap: 9px; padding: 8px 16px; border-radius: 999px; cursor: pointer; color: var(--ink-3); background: var(--surface-2); font-size: 12.5px; font-weight: 700; transition: all 0.3s ease; user-select: none; }
.wiz-step-num { width: 22px; height: 22px; border-radius: 50%; display: flex; align-items: center; justify-content: center; background: var(--bg); color: var(--ink-3); font-size: 11.5px; font-weight: 800; transition: all 0.3s ease; }
.wiz-step-tab.active { color: var(--accent-dark); background: var(--accent-soft); box-shadow: 0 4px 14px rgba(108, 93, 211, 0.22); }
.wiz-step-tab.active .wiz-step-num { background: var(--accent); color: #fff; box-shadow: 0 0 10px rgba(108, 93, 211, 0.6); }
.wiz-step-tab.done { color: var(--green-dark); }
.wiz-step-tab.done .wiz-step-num { background: var(--green); color: #fff; }
.wiz-step-line { flex: 1; height: 2px; border-radius: 2px; background: var(--border-2); opacity: 0.6; }
.wiz-col-title { font-size: 13px; font-weight: 800; }
.wiz-col-sub { font-size: 11.5px; color: var(--ink-3); margin-top: 3px; line-height: 1.8; }
.wiz-col-head { margin-bottom: 12px; }
.wiz-build { display: grid; grid-template-columns: 0.9fr 1.1fr; gap: 18px; align-items: start; }
#wiz-palette { display: flex; flex-direction: column; gap: 10px; max-height: 430px; overflow-y: auto; padding: 2px; }
.wiz-chip { display: flex; align-items: center; gap: 11px; padding: 11px 13px; border-radius: 14px; background: var(--surface); border: 1px solid var(--border); box-shadow: 4px 4px 10px var(--nm-dark), -4px -4px 10px rgba(255, 255, 255, 0.85); cursor: grab; transition: transform 0.25s ease, box-shadow 0.25s ease; }
.wiz-chip:hover { transform: translateY(-2px); box-shadow: 6px 6px 14px var(--nm-dark), -6px -6px 14px rgba(255, 255, 255, 0.9), 0 0 14px rgba(108, 93, 211, 0.25); }
.wiz-chip:active { cursor: grabbing; }
.wiz-chip.dragging { opacity: 0.45; transform: scale(0.97); }
.wiz-chip-icon { width: 32px; height: 32px; border-radius: 10px; flex-shrink: 0; display: flex; align-items: center; justify-content: center; background: var(--accent-soft); color: var(--accent-dark); }
.wiz-chip-icon svg { width: 16px; height: 16px; }
.wiz-chip-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1; }
.wiz-chip-label { font-size: 12.5px; font-weight: 800; color: var(--ink); }
.wiz-chip-desc { font-size: 11px; color: var(--ink-3); line-height: 1.7; }
.wiz-chip-add { width: 22px; height: 22px; border-radius: 50%; flex-shrink: 0; display: flex; align-items: center; justify-content: center; background: var(--surface-2); color: var(--accent-dark); font-weight: 800; font-size: 14px; transition: all 0.25s ease; }
.wiz-chip:hover .wiz-chip-add { background: var(--accent); color: #fff; box-shadow: 0 0 10px rgba(108, 93, 211, 0.55); }
.wiz-palette-empty { font-size: 12px; color: var(--ink-3); padding: 16px; text-align: center; border: 1.5px dashed var(--border-2); border-radius: 14px; line-height: 1.9; }
.wiz-pipe { position: relative; border-radius: 18px; padding: 16px 14px; min-height: 360px; background-color: var(--surface-2); background-image: radial-gradient(rgba(108, 93, 211, 0.12) 1px, transparent 1.5px); background-size: 18px 18px; border: 1.5px dashed transparent; box-shadow: inset 5px 5px 12px var(--nm-dark), inset -5px -5px 12px rgba(255, 255, 255, 0.75); transition: border-color 0.25s ease, box-shadow 0.25s ease; }
.wiz-pipe.drop-ready { border-color: rgba(108, 93, 211, 0.5); }
.wiz-pipe.drag-over { border-color: var(--accent); box-shadow: inset 5px 5px 12px var(--nm-dark), inset -5px -5px 12px rgba(255, 255, 255, 0.75), 0 0 22px rgba(108, 93, 211, 0.35); }
.wiz-pipe-item { position: relative; display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 13px; background: var(--surface); border: 1px solid var(--border); box-shadow: 4px 4px 9px var(--nm-dark), -4px -4px 9px rgba(255, 255, 255, 0.85); }
.wiz-pipe-icon { width: 28px; height: 28px; border-radius: 9px; flex-shrink: 0; display: flex; align-items: center; justify-content: center; background: var(--accent-soft); color: var(--accent-dark); }
.wiz-pipe-icon svg { width: 15px; height: 15px; }
.wiz-pipe-label { font-size: 12.5px; font-weight: 700; flex: 1; }
.wiz-pipe-fixed { background: linear-gradient(135deg, var(--accent), var(--accent-2)); border: none; }
.wiz-pipe-fixed .wiz-pipe-label { color: #fff; }
.wiz-pipe-fixed .wiz-pipe-icon { background: rgba(255, 255, 255, 0.2); color: #fff; }
.wiz-pipe-actions { display: flex; gap: 6px; }
.wiz-pipe-btn { width: 26px; height: 26px; border: none; border-radius: 8px; display: flex; align-items: center; justify-content: center; cursor: pointer; background: var(--surface-2); color: var(--ink-2); font-size: 12px; transition: all 0.2s ease; }
.wiz-pipe-btn svg { width: 13px; height: 13px; }
.wiz-pipe-btn:hover { color: var(--accent-dark); background: var(--accent-soft); }
.wiz-pipe-btn.wiz-pipe-remove:hover { color: var(--red-dark); background: var(--red-soft); }
.wiz-pipe-link { width: 2px; height: 20px; margin: 2px auto; position: relative; background: linear-gradient(180deg, rgba(108, 93, 211, 0.55), rgba(142, 126, 242, 0.25)); border-radius: 2px; }
.wiz-pipe-link::after { content: ''; position: absolute; right: -2px; top: 0; width: 6px; height: 6px; border-radius: 50%; background: var(--accent-2); box-shadow: 0 0 8px rgba(108, 93, 211, 0.9); animation: wizSynapse 1.6s linear infinite; }
@keyframes wizSynapse { 0% { top: -2px; opacity: 0; } 20% { opacity: 1; } 80% { opacity: 1; } 100% { top: 18px; opacity: 0; } }
.wiz-pipe-hint { border: 1.5px dashed rgba(108, 93, 211, 0.45); border-radius: 13px; padding: 18px; margin-top: 10px; text-align: center; font-size: 12px; color: var(--ink-3); }
.wiz-drop-anim { animation: wizDropIn 0.7s cubic-bezier(0.2, 1.4, 0.35, 1); }
@keyframes wizDropIn { 0% { opacity: 0; transform: translateY(-22px) scale(0.82); } 55% { opacity: 1; transform: translateY(3px) scale(1.04); } 100% { opacity: 1; transform: translateY(0) scale(1); } }
.wiz-drop-anim::after { content: ''; position: absolute; inset: 0; border-radius: 13px; pointer-events: none; animation: wizRing 0.9s ease-out forwards; }
@keyframes wizRing { 0% { box-shadow: 0 0 0 0 rgba(108, 93, 211, 0.5), 0 0 18px rgba(108, 93, 211, 0.5); } 100% { box-shadow: 0 0 0 22px rgba(108, 93, 211, 0), 0 0 4px rgba(108, 93, 211, 0); } }
.wiz-config { position: fixed; inset: 0; z-index: 300; display: flex; align-items: center; justify-content: center; background: rgba(46, 49, 80, 0.35); backdrop-filter: blur(4px); }
.wiz-config-card { width: min(560px, 92vw); max-height: 82vh; overflow-y: auto; background: var(--surface); border-radius: var(--radius-lg); padding: 22px; box-shadow: 0 24px 60px rgba(46, 49, 80, 0.35); animation: wizDropIn 0.45s cubic-bezier(0.2, 1.4, 0.35, 1); }
.wiz-config-title { display: flex; align-items: center; gap: 9px; font-size: 14px; font-weight: 800; margin-bottom: 14px; }
.wiz-config-title .wiz-pipe-icon { width: 30px; height: 30px; }
#wiz-config-body .adv-section { margin: 0; }
.wiz-config-actions { display: flex; gap: 10px; margin-top: 16px; }
.wiz-platform-card { border-radius: 16px; background: var(--surface); border: 1px solid var(--border); box-shadow: 4px 4px 10px var(--nm-dark), -4px -4px 10px rgba(255, 255, 255, 0.85); margin-bottom: 14px; overflow: hidden; transition: box-shadow 0.3s ease; }
.wiz-platform-card.active { box-shadow: 4px 4px 10px var(--nm-dark), -4px -4px 10px rgba(255, 255, 255, 0.85), 0 0 18px rgba(108, 93, 211, 0.3); }
.wiz-platform-head { display: flex; align-items: center; gap: 12px; padding: 14px 16px; cursor: pointer; user-select: none; }
.wiz-platform-icon { width: 38px; height: 38px; border-radius: 12px; flex-shrink: 0; display: flex; align-items: center; justify-content: center; background: var(--accent-soft); color: var(--accent-dark); transition: all 0.3s ease; }
.wiz-platform-icon svg { width: 19px; height: 19px; }
.wiz-platform-card.active .wiz-platform-icon { background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: #fff; box-shadow: 0 0 14px rgba(108, 93, 211, 0.5); }
.wiz-switch { width: 40px; height: 22px; border-radius: 999px; background: var(--surface-2); box-shadow: inset 2px 2px 5px var(--nm-dark); position: relative; flex-shrink: 0; transition: background 0.25s ease; }
.wiz-switch::after { content: ''; position: absolute; top: 3px; right: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: 0 1px 4px rgba(0, 0, 0, 0.25); transition: transform 0.25s ease; }
.wiz-platform-card.active .wiz-switch { background: var(--accent); }
.wiz-platform-card.active .wiz-switch::after { transform: translateX(-18px); }
.wiz-platform-body { padding: 0 16px 4px; }
.wiz-platform-body .adv-section { margin-top: 0; }
@media (max-width: 820px) { .wiz-build { grid-template-columns: 1fr; } .wiz-step-name { display: none; } }

.nav-item.locked { opacity: 0.55; cursor: not-allowed; }
.btn.locked { opacity: 0.55; cursor: not-allowed; }
.lock-badge { display: inline-flex; align-items: center; justify-content: center; width: 20px; height: 20px; border-radius: 7px; background: var(--surface-2); color: var(--ink-3); box-shadow: var(--nm-in-sm); margin-inline-start: auto; flex-shrink: 0; }
.lock-badge svg { width: 11px; height: 11px; }
.np-lib-card.locked { position: relative; opacity: 0.6; cursor: not-allowed; filter: grayscale(0.5); }
.np-lib-card.locked .lock-badge { position: absolute; top: 14px; inset-inline-start: 14px; width: 28px; height: 28px; border-radius: 10px; margin: 0; }
.np-lib-card.locked .lock-badge svg { width: 14px; height: 14px; }
.wiz-chip-locked { opacity: 0.6; cursor: not-allowed; filter: grayscale(0.45); }
.wiz-chip-lock { width: 22px; height: 22px; border-radius: 50%; flex-shrink: 0; display: flex; align-items: center; justify-content: center; background: var(--surface-2); color: var(--ink-3); box-shadow: var(--nm-in-sm); }
.wiz-chip-lock svg { width: 12px; height: 12px; }
.wiz-platform-card.locked { opacity: 0.6; filter: grayscale(0.45); }
.wiz-platform-card.locked .wiz-platform-head { cursor: not-allowed; }
.wiz-platform-lock { width: 28px; height: 28px; border-radius: 10px; flex-shrink: 0; display: flex; align-items: center; justify-content: center; background: var(--surface-2); color: var(--ink-3); box-shadow: var(--nm-in-sm); }
.wiz-platform-lock svg { width: 14px; height: 14px; }

.admin-usage-row { padding: 16px 20px; border-bottom: 1px solid var(--border); }
.admin-usage-row:last-child { border-bottom: none; }
.admin-usage-user { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.admin-usage-user .badge { margin-inline-start: auto; }

.wmp-open-btn { display: flex; align-items: center; gap: 12px; width: 100%; padding: 10px 12px; border-radius: 14px; border: 1px solid var(--border); background: var(--surface); box-shadow: var(--nm-out-sm); cursor: pointer; font-family: inherit; transition: all 0.2s ease; }
.wmp-open-btn:hover { border-color: rgba(108, 93, 211, 0.5); box-shadow: 0 0 14px rgba(108, 93, 211, 0.25); }
.wmp-mini { display: grid; grid-template-columns: repeat(5, 1fr); gap: 2px; width: 54px; height: 44px; padding: 4px; border-radius: 9px; background: linear-gradient(135deg, var(--accent-soft), rgba(108, 93, 211, 0.25)); flex-shrink: 0; }
.wmp-mini-dot { border-radius: 3px; background: rgba(108, 93, 211, 0.25); transition: all 0.2s ease; }
.wmp-mini-dot.active { background: var(--accent); box-shadow: 0 0 6px rgba(108, 93, 211, 0.8); }
.wmp-open-text { display: flex; flex-direction: column; gap: 2px; flex: 1; text-align: start; }
.wmp-open-title { font-size: 11px; color: var(--ink-3); font-weight: 700; }
.wmp-open-value { font-size: 13px; font-weight: 800; color: var(--accent-dark); }
.wmp-open-arrow { color: var(--ink-3); font-size: 16px; }
.wmp-overlay { position: fixed; inset: 0; z-index: 400; display: none; align-items: center; justify-content: center; background: rgba(46, 49, 80, 0.45); backdrop-filter: blur(6px); padding: 16px; }
.wmp-overlay.open { display: flex; animation: backdrop-in 0.2s ease; }
.wmp-card { width: min(460px, 94vw); max-height: calc(100vh - 32px); max-height: calc(100dvh - 32px); overflow-y: auto; overscroll-behavior: contain; background: var(--surface); border: 1px solid var(--border); border-radius: 26px; padding: 22px; box-shadow: 0 24px 60px rgba(46, 49, 80, 0.35); animation: modal-in 0.28s cubic-bezier(0.22, 1, 0.36, 1); }
.wmp-head { margin-bottom: 16px; }
.wmp-title { font-size: 15px; font-weight: 800; margin-bottom: 6px; }
.wmp-sub { font-size: 12px; color: var(--ink-3); line-height: 1.9; }
.wmp-stage { position: relative; width: 100%; aspect-ratio: 1 / 1; border-radius: 18px; overflow: hidden; background: linear-gradient(180deg, #8E7EF2 0%, #B7A8F7 45%, #6C5DD3 100%); box-shadow: inset 0 0 40px rgba(46, 49, 80, 0.25); }
.wmp-sun { position: absolute; top: 12%; left: 66%; width: 18%; aspect-ratio: 1; border-radius: 50%; background: radial-gradient(circle at 35% 35%, #FFF3D6, #F5C56B); box-shadow: 0 0 34px rgba(245, 197, 107, 0.85); }
.wmp-hill { position: absolute; bottom: -22%; width: 90%; aspect-ratio: 2 / 1; border-radius: 50%; }
.wmp-hill-1 { left: -25%; background: rgba(46, 49, 80, 0.35); }
.wmp-hill-2 { right: -30%; bottom: -28%; background: rgba(46, 49, 80, 0.5); }
.wmp-grid { position: absolute; inset: 0; display: grid; grid-template-columns: repeat(5, 1fr); grid-template-rows: repeat(5, 1fr); gap: 4px; padding: 10px; }
.wmp-cell { position: relative; border: 1.5px dashed rgba(255, 255, 255, 0.35); border-radius: 12px; background: rgba(255, 255, 255, 0.06); cursor: pointer; display: flex; align-items: center; justify-content: center; font-family: inherit; transition: all 0.22s ease; animation: wmp-cell-in 0.45s cubic-bezier(0.2, 1.4, 0.35, 1) both; animation-delay: var(--wmp-delay, 0ms); }
@keyframes wmp-cell-in { 0% { opacity: 0; transform: scale(0.7); } 100% { opacity: 1; transform: scale(1); } }
.wmp-cell:hover { background: rgba(255, 255, 255, 0.18); border-color: rgba(255, 255, 255, 0.75); box-shadow: 0 0 18px rgba(255, 255, 255, 0.3); }
.wmp-cell-dot { width: 8px; height: 8px; border-radius: 50%; background: rgba(255, 255, 255, 0.75); transition: all 0.22s ease; }
.wmp-cell-logo { position: absolute; inset: 0; display: none; align-items: center; justify-content: center; color: #fff; }
.wmp-cell-logo svg { width: 18px; height: 18px; filter: drop-shadow(0 2px 8px rgba(46, 49, 80, 0.55)); }
.wmp-cell.selected { border-style: solid; border-color: #fff; background: rgba(255, 255, 255, 0.22); animation: wmp-selected-pulse 2.2s ease infinite; }
@keyframes wmp-selected-pulse { 0%, 100% { box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.25), 0 0 22px rgba(255, 255, 255, 0.35); } 50% { box-shadow: 0 0 0 5px rgba(255, 255, 255, 0.35), 0 0 34px rgba(255, 255, 255, 0.6); } }
.wmp-cell.selected .wmp-cell-dot { display: none; }
.wmp-cell.selected .wmp-cell-logo { display: flex; animation: wmp-logo-in 0.35s cubic-bezier(0.2, 1.4, 0.35, 1); }
@keyframes wmp-logo-in { 0% { opacity: 0; transform: scale(0.4) rotate(-8deg); } 100% { opacity: 1; transform: scale(1) rotate(0); } }
.wmp-current { margin: 14px 2px 0; font-size: 12.5px; color: var(--ink-2); }
.wmp-current b { color: var(--accent-dark); }
.wmp-actions { display: flex; justify-content: flex-end; margin-top: 14px; }

.wmp-opacity { margin: 14px 0 4px; padding: 12px 14px; border-radius: 14px; background: var(--surface-2); border: 1px solid var(--border); }
.wmp-opacity-head { display: flex; align-items: center; justify-content: space-between; font-size: 12px; font-weight: 700; color: var(--ink-2); margin-bottom: 10px; }
.wmp-opacity-head b { color: var(--accent-dark); font-size: 13px; }
.wmp-opacity input[type="range"] { width: 100%; accent-color: var(--accent); cursor: pointer; }
.avalai-row-cost { font-weight: 800; color: var(--accent-dark); font-size: 13px; }
.avalai-row-meta { font-size: 11px; color: var(--ink-3); margin-top: 3px; }
.avalai-row-err { font-size: 11px; color: var(--red, #c0392b); }

.ap-timeout { margin-top: 14px; }
.ap-timeout .ap-always { margin-top: 0; }
.ap-timeout-body { display: none; margin-top: 12px; }
.ap-timeout-body.open { display: block; animation: apTimeoutIn 0.25s ease; }
@keyframes apTimeoutIn {
  from { opacity: 0; transform: translateY(-6px); }
  to { opacity: 1; transform: translateY(0); }
}
.ap-timeout-row { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.ap-timeout-label { font-size: 12.5px; font-weight: 700; color: var(--ink-2); }
.ap-timeout-row .form-input { width: 110px; text-align: center; font-weight: 700; }
.ap-timeout-unit { font-size: 12px; color: var(--ink-3); }
.ap-timeout-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.ap-timeout-opt {
  border-radius: 14px;
  padding: 12px 14px;
  cursor: pointer;
  box-shadow: var(--nm-out-sm);
  border: 2px solid transparent;
  transition: all 0.2s ease;
}
.ap-timeout-opt:hover { transform: translateY(-1px); }
.ap-timeout-opt.checked { border-color: var(--accent); background: var(--accent-soft); }
.ap-timeout-opt-title { font-size: 12.5px; font-weight: 800; margin-bottom: 3px; }
.ap-timeout-opt.checked .ap-timeout-opt-title { color: var(--accent-dark); }
.ap-timeout-opt-sub { font-size: 11px; color: var(--ink-3); line-height: 1.7; }

.notif-item.notif-install { border-inline-start-color: var(--accent); }
.notif-install-btn {
  margin-top: 8px;
  border: none;
  cursor: pointer;
  font-family: inherit;
  background: linear-gradient(135deg, var(--accent-2), var(--accent));
  color: #fff;
  padding: 7px 18px;
  border-radius: 10px;
  font-size: 12px;
  font-weight: 700;
  box-shadow: var(--nm-out-sm);
  transition: all 0.2s ease;
}
.notif-install-btn:hover { transform: translateY(-1px); filter: brightness(1.05); }

.pipe-node.final.error .pipe-icon { color: #fff; }

.pro-emoji-guide { margin-top: 10px; font-size: 12.5px; line-height: 2.1; color: var(--ink-2); border: 1px solid var(--border); border-radius: 12px; padding: 12px 14px; }

.route-inline { flex-direction: row; align-items: center; justify-content: center; gap: 12px; }
.route-inline .route-id { flex: 0 1 auto; overflow: hidden; text-overflow: ellipsis; max-width: 45%; }

.ov-name { font-weight: 800; font-size: 13px; }
.ov-sub { font-size: 11.5px; color: var(--ink-3); line-height: 1.9; }
.ov-cell { font-size: 12.5px; font-weight: 700; }
.ov-bar { width: 90px; height: 5px; border-radius: 99px; background: var(--border-2); overflow: hidden; margin-top: 5px; }
.ov-fill { height: 100%; border-radius: 99px; }
.ov-loading { display: inline-flex; align-items: center; gap: 8px; color: var(--ink-3); font-size: 12px; }
.spinner-ink { border-color: rgba(108, 93, 211, 0.25); border-top-color: var(--accent); }

.sidebar { transition: width 0.22s ease, padding 0.22s ease; }
.sidebar-collapse-btn { position: absolute; top: 16px; inset-inline-end: 12px; width: 28px; height: 28px; display: flex; align-items: center; justify-content: center; border: none; border-radius: 10px; background: var(--surface); box-shadow: var(--nm-out-sm); color: var(--ink-3); cursor: pointer; transition: color 0.15s ease, box-shadow 0.15s ease; z-index: 2; }
.sidebar-collapse-btn:hover { color: var(--accent); }
.sidebar-collapse-btn svg { transition: transform 0.25s ease; }
.sidebar.collapsed { width: 88px; padding: 20px 10px 14px; }
.sidebar.collapsed .sidebar-collapse-btn { position: static; margin: 0 auto 12px; }
.sidebar.collapsed .sidebar-collapse-btn svg { transform: rotate(180deg); }
.sidebar.collapsed .user-info-bar { justify-content: center; }
.sidebar.collapsed .user-info-bar > div:not(.user-avatar) { display: none; }
.sidebar.collapsed .nav-item { justify-content: center; gap: 0; padding: 12px 0; font-size: 0; }
.sidebar.collapsed .nav-item .nav-icon { width: 17px; height: 17px; }
.sidebar.collapsed .powered-by { display: none; }
@media (max-width: 820px) {
  .sidebar-collapse-btn { display: none; }
  .sidebar.collapsed { width: auto; padding: 14px; }
  .sidebar.collapsed .nav-item { justify-content: flex-start; gap: 10px; padding: 11px 15px; font-size: 13.5px; }
  .sidebar.collapsed .user-info-bar > div:not(.user-avatar) { display: block; }
  .sidebar.collapsed .powered-by { display: block; }
}
select.form-input { appearance: none; -webkit-appearance: none; cursor: pointer; background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="%235B5F7B" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round"><polyline points="6 9 12 15 18 9"/></svg>'); background-repeat: no-repeat; background-position: left 12px center; padding-inline-end: 34px; }
select.form-input:focus { background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="%236C5DD3" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round"><polyline points="6 9 12 15 18 9"/></svg>'); }
select.form-input { color-scheme: light; }
select.form-input option { background-color: var(--surface); color: var(--ink); padding: 8px 12px; font-family: inherit; }
select.form-input option:checked { background: linear-gradient(var(--accent), var(--accent)); background-color: var(--accent); color: #fff; }
.glow-strip {
  height: 4px;
  border-radius: 999px;
  margin: 4px 2px 18px;
  background: linear-gradient(90deg, var(--accent-2), var(--accent), var(--red), var(--amber), var(--green), var(--accent), var(--accent-2));
  background-size: 300% 100%;
  animation: glowStripFlow 6s ease-in-out infinite alternate;
}
@keyframes glowStripFlow {
  from { background-position: 0% 50%; }
  to { background-position: 100% 50%; }
}
@media (max-width: 820px) { .glow-strip { margin-bottom: 14px; } }
#kpi-settings-body { width: 100%; }
.kpi-locked-badge { display: inline-flex; align-items: center; margin-inline-start: 8px; padding: 2px 8px; border-radius: 999px; background: rgba(233, 196, 51, 0.18); color: #8a6d1a; font-size: 10.5px; }
input.form-input:disabled { opacity: 0.55; cursor: not-allowed; }
.msg-date-range { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.msg-date-range .form-input { width: 132px; }

.msg-pager { display: flex; align-items: center; justify-content: center; gap: 10px; flex-wrap: wrap; }
.msg-page-info { font-size: 12.5px; font-weight: 700; color: var(--ink-2); padding: 0 8px; }
.msg-pager .btn:disabled { opacity: 0.45; cursor: default; pointer-events: none; }
.import-row { display: flex; align-items: center; gap: 8px; margin-bottom: 14px; }
.kpi-delay-card .stat-label { padding-inline-end: 0; }
.kpi-delay-card .stat-label::before { display: none; }

.kpi-set { display: flex; flex-direction: column; }
.kpi-set-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.kpi-set-item { display: flex; flex-direction: column; justify-content: space-between; gap: 12px; padding: 16px 18px; border-radius: 16px; background: var(--bg); box-shadow: inset 2px 2px 6px var(--nm-dark), inset -2px -2px 6px var(--nm-light); }
.kpi-set-title { display: flex; align-items: center; gap: 8px; font-weight: 800; font-size: 13.5px; }
.kpi-set-ctrl { display: flex; align-items: center; justify-content: flex-start; gap: 10px; flex-wrap: wrap; }
.kpi-set-ctrl > .form-input { max-width: 240px; }
.kpi-seg { display: inline-flex; padding: 3px; border-radius: 12px; background: var(--bg); box-shadow: inset 2px 2px 5px var(--nm-dark), inset -2px -2px 5px var(--nm-light); }
.kpi-seg-btn { border: 0; background: transparent; color: var(--ink-3); font-family: inherit; font-size: 12px; font-weight: 700; padding: 7px 18px; border-radius: 10px; cursor: pointer; transition: color 0.16s ease, background 0.16s ease, box-shadow 0.16s ease; }
.kpi-seg-btn.active { background: var(--surface); color: var(--accent); box-shadow: 2px 2px 6px var(--nm-dark), -2px -2px 6px var(--nm-light); }
.kpi-unit-input { display: flex; align-items: center; gap: 8px; }
.kpi-unit-input .form-input { max-width: 110px; text-align: center; }
.kpi-unit-input .kpi-unit { font-size: 11.5px; font-weight: 600; color: var(--ink-3); }
.kpi-set-foot { display: flex; justify-content: flex-end; padding-top: 18px; }
@media (max-width: 760px) { .kpi-set-grid { grid-template-columns: 1fr; } }
.import-format { direction: ltr; unicode-bidi: isolate; font-size: 11px; color: var(--ink-3); background: var(--bg); border: 1px solid var(--border); border-radius: 8px; padding: 4px 10px; white-space: nowrap; }
.sidebar-logout { width: 100%; display: flex; align-items: center; justify-content: center; gap: 8px; margin-bottom: 10px; }
.sidebar-logout:hover { color: var(--red-dark); }
.sidebar.collapsed .sidebar-logout span { display: none; }

.msg-page-jump { display: inline-flex; align-items: center; gap: 6px; margin-inline-start: 8px; }
.msg-page-jump .form-input { width: 62px; padding: 8px 10px; text-align: center; font-size: 12.5px; }

@media (max-width: 820px) { .sidebar-logout { width: auto; margin-bottom: 0; } }

.modal-close:active, .sidebar-collapse-btn:active { box-shadow: var(--nm-in-sm); }

.modal-header { border-bottom-color: rgba(163, 170, 199, 0.3); box-shadow: 0 1px 0 rgba(255, 255, 255, 0.75); }

.modal-footer { border-top-color: rgba(163, 170, 199, 0.3); }

.sidebar-header { border-bottom-color: rgba(163, 170, 199, 0.3); box-shadow: 0 1px 0 rgba(255, 255, 255, 0.75); }

.table th { box-shadow: 0 1px 0 rgba(255, 255, 255, 0.7); }

.form-input:disabled { opacity: 0.55; }

@keyframes dotPulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.45); }
}
.stat-card:nth-child(2) .stat-label::before { animation-delay: -0.7s; }
.stat-card:nth-child(3) .stat-label::before { animation-delay: -1.4s; }
.stat-card:nth-child(4) .stat-label::before { animation-delay: -2.1s; }

@media (min-width: 1700px) { .main-content { padding: 28px 48px 56px; } }

.wmp-stage .wmp-grid { transition: opacity 0.3s ease; }
.wmp-preview-logo { position: absolute; display: none; pointer-events: none; filter: drop-shadow(0 4px 14px rgba(46, 49, 80, 0.35)); transition: width 0.18s ease, left 0.18s ease, top 0.18s ease, opacity 0.18s ease; }
.wmp-stage.wmp-testing .wmp-grid { opacity: 0; pointer-events: none; }
.wmp-stage.wmp-testing .wmp-preview-logo { display: block; animation: wmp-logo-in 0.35s cubic-bezier(0.2, 1.4, 0.35, 1); }
.wmp-test-btn { display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%; margin-top: 14px; padding: 10px 14px; border-radius: 14px; border: 1px solid var(--border); background: var(--surface); box-shadow: var(--nm-out-sm); color: var(--accent-dark); font-family: inherit; font-size: 12.5px; font-weight: 800; cursor: pointer; transition: all 0.2s ease; }
.wmp-test-btn:hover { border-color: rgba(108, 93, 211, 0.5); box-shadow: 0 0 14px rgba(108, 93, 211, 0.25); }
.wmp-test-btn.active { box-shadow: var(--nm-in-sm); background: linear-gradient(135deg, rgba(108, 93, 211, 0.14), rgba(142, 126, 242, 0.18)); }

@media (max-height: 800px) {
  .wmp-card { padding: 16px; border-radius: 22px; }
  .wmp-head { margin-bottom: 10px; }
  .wmp-stage { aspect-ratio: 4 / 3; }
  .wmp-test-btn { margin-top: 10px; padding: 8px 12px; }
  .wmp-opacity { margin: 10px 0 2px; padding: 9px 12px; }
  .wmp-opacity-head { margin-bottom: 6px; }
  .wmp-actions { margin-top: 10px; }
}
@media (max-height: 640px) {
  .wmp-stage { aspect-ratio: 16 / 9; }
  .wmp-grid { padding: 8px; gap: 3px; }
}

.wm-color-row { display: flex; gap: 10px; margin-top: 12px; align-items: center; flex-wrap: wrap; }
.wm-swatch { width: 30px; height: 30px; border-radius: 10px; border: none; cursor: pointer; box-shadow: var(--nm-out-sm); position: relative; padding: 0; }
.wm-swatch.active::after { content: ''; position: absolute; inset: -5px; border-radius: 14px; border: 2px solid var(--accent); }
.wm-swatch-custom { overflow: hidden; background: conic-gradient(#E74C3C, #E9A13B, #3BAE8E, #4C97FF, #6C5DD3, #E74C3C); display: inline-block; }
.wm-swatch-custom input { opacity: 0; width: 100%; height: 100%; cursor: pointer; }
.wiz-pipe-rule { position: relative; }
.wiz-pipe-rule.has-rule { color: var(--accent); }
.rule-badge { position: absolute; top: -5px; left: -5px; background: #E74C3C; color: #fff; font-size: 10px; min-width: 15px; height: 15px; border-radius: 8px; display: flex; align-items: center; justify-content: center; padding: 0 3px; }
.rule-card { width: min(560px, 94vw); }
.rule-hat { background: linear-gradient(135deg, #6C5DD3, #8A7BF0); color: #fff; border-radius: 20px 20px 8px 8px; padding: 14px 18px; font-weight: 800; display: flex; gap: 10px; align-items: center; margin: 4px 0 10px; box-shadow: 0 8px 18px rgba(108, 93, 211, .3); }
.rule-hat-icon { font-size: 18px; }
.rule-mode-row { display: flex; flex-direction: column; gap: 8px; margin-bottom: 6px; }
.rule-mode-row .rule-sel { width: 100%; background: var(--surface); box-shadow: var(--nm-in-sm); border: none; border-radius: 12px; padding: 10px 14px; font-family: inherit; font-size: 13.5px; font-weight: 700; color: var(--ink); outline: none; }
.rule-blocks { display: flex; flex-direction: column; }
.rule-block { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; padding: 14px 14px 12px; border-radius: 8px 16px 16px 16px; margin: 10px 24px 2px 0; position: relative; color: #fff; }
.rule-block::before { content: ''; position: absolute; top: -7px; right: 22px; width: 36px; height: 9px; background: inherit; border-radius: 7px 7px 0 0; }
.rule-cat-text { background: linear-gradient(135deg, #4C97FF, #3373CC); }
.rule-cat-media { background: linear-gradient(135deg, #FFAB19, #EC9C13); }
.rule-cat-msg { background: linear-gradient(135deg, #40BF4A, #2E9A3A); }
.rule-block-if { font-weight: 800; font-size: 14px; }
.rule-block .rule-sel, .rule-block .rule-val { background: rgba(255, 255, 255, .22); border: none; border-radius: 999px; color: #fff; padding: 7px 12px; font-family: inherit; font-size: 12.5px; font-weight: 700; outline: none; }
.rule-block .rule-sel option { color: #333; }
.rule-block .rule-val { width: 104px; text-align: center; }
.rule-block .rule-val::placeholder { color: rgba(255, 255, 255, .75); }
.rule-del { margin-right: auto; background: rgba(255, 255, 255, .25); border: none; color: #fff; width: 26px; height: 26px; border-radius: 50%; cursor: pointer; font-family: inherit; }
.rule-add { display: block; margin: 14px auto 2px; background: var(--surface); box-shadow: var(--nm-out-sm); border: none; border-radius: 999px; padding: 10px 24px; font-family: inherit; font-size: 13px; font-weight: 800; color: var(--accent); cursor: pointer; }
.rule-add:active { box-shadow: var(--nm-in-sm); }
.rule-actions { display: flex; justify-content: space-between; gap: 10px; margin-top: 16px; }
.pipe-icon.has-diff { cursor: pointer; box-shadow: var(--nm-out-sm), 0 0 0 2px rgba(108, 93, 211, .35); }
.pipe-icon.has-diff:hover { box-shadow: var(--nm-out-sm), 0 0 0 3px rgba(108, 93, 211, .6); }
.pipe-diff-link { color: var(--accent); font-weight: 700; }
.pipe-diff { display: none; margin-top: 8px; background: var(--surface-2); border-radius: 12px; padding: 10px 12px; font-size: 12.5px; line-height: 2.1; box-shadow: var(--nm-in-sm); word-break: break-word; }
.pipe-diff.open { display: block; }
.pipe-diff ins { background: rgba(46, 196, 134, .2); color: #1D7A53; text-decoration: none; border-radius: 5px; padding: 1px 4px; }
.pipe-diff del { background: rgba(231, 76, 60, .16); color: #B03A2E; border-radius: 5px; padding: 1px 4px; }
.pipe-diff .diff-old { background: rgba(231, 76, 60, .1); border-radius: 8px; padding: 6px 9px; margin-bottom: 6px; color: #B03A2E; }
.pipe-diff .diff-new { background: rgba(46, 196, 134, .12); border-radius: 8px; padding: 6px 9px; color: #1D7A53; }

.pipe-info { font-size: 11px; color: var(--ink-2); line-height: 2.1; font-weight: 600; }
.pipe-info + .pipe-diff-body { display: block; margin-top: 8px; padding-top: 8px; border-top: 1px dashed rgba(0, 0, 0, .12); }

:root {
  --ink-rgb: 46, 49, 80;
  --accent-rgb: 108, 93, 211;
  color-scheme: light;
}

.theme-toggle { position: relative; }

.theme-toggle .tt-icon {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity .28s ease, transform .5s cubic-bezier(.34, 1.56, .4, 1);
}

.theme-toggle .tt-moon { opacity: 1; transform: rotate(0deg) scale(1); }
.theme-toggle .tt-sun { opacity: 0; transform: rotate(100deg) scale(.35); }
.theme-toggle:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

html[data-theme="dark"] .theme-toggle .tt-moon { opacity: 0; transform: rotate(-100deg) scale(.35); }
html[data-theme="dark"] .theme-toggle .tt-sun { opacity: 1; transform: rotate(0deg) scale(1); }

.theme-toggle-floating {
  position: fixed;
  top: 18px;
  inset-inline-start: 18px;
  z-index: 60;
  width: 40px;
  height: 40px;
  border: none;
  border-radius: 50%;
  background: var(--surface);
  box-shadow: var(--nm-out-sm);
  color: var(--ink-2);
  cursor: pointer;
}

html[data-theme="dark"] {
  color-scheme: dark;
  --ink-rgb: 233, 236, 250;
  --accent-rgb: 142, 126, 242;
  --bg: #121421;
  --surface: #1C1F2D;
  --surface-2: #242A3D;
  --border: rgba(255, 255, 255, 0.06);
  --border-2: rgba(130, 140, 185, 0.26);
  --ink: #E9ECFA;
  --ink-2: #ACB3D2;
  --ink-3: #7C84AC;
  --accent: #8E7EF2;
  --accent-2: #A99BFF;
  --accent-soft: rgba(142, 126, 242, 0.17);
  --accent-dark: #C8BFFF;
  --green: #45C39D;
  --green-soft: rgba(69, 195, 157, 0.15);
  --green-dark: #8FE8CD;
  --red: #F0836B;
  --red-soft: rgba(240, 131, 107, 0.15);
  --red-dark: #FFB4A3;
  --amber: #EFB454;
  --amber-soft: rgba(239, 180, 84, 0.14);
  --amber-dark: #FFD98F;
  --sky: #6E9BFF;
  --sky-soft: rgba(110, 155, 255, 0.15);
  --sky-dark: #A9C3FF;
  --pink: #E27FBB;
  --pink-soft: rgba(226, 127, 187, 0.15);
  --pink-dark: #F5B5DC;
  --cyan: #4CC4E0;
  --cyan-soft: rgba(76, 196, 224, 0.15);
  --cyan-dark: #9FE2F2;
  --nm-dark: rgba(5, 7, 13, 0.7);
  --nm-light: rgba(147, 161, 227, 0.085);
  --nm-out: 9px 9px 20px var(--nm-dark), -9px -9px 20px var(--nm-light), inset 0 1px 0 rgba(255, 255, 255, 0.04);
  --nm-out-sm: 4px 4px 10px rgba(5, 7, 13, 0.62), -4px -4px 10px var(--nm-light), inset 0 1px 0 rgba(255, 255, 255, 0.045);
  --nm-in: inset 5px 5px 11px rgba(5, 7, 13, 0.66), inset -5px -5px 11px rgba(147, 161, 227, 0.07);
  --nm-in-sm: inset 3px 3px 7px rgba(5, 7, 13, 0.6), inset -3px -3px 7px rgba(147, 161, 227, 0.07);
  --shadow-lg: 0 24px 60px rgba(0, 0, 0, 0.65);
  --err: #F06A76;
  --err-soft: rgba(240, 106, 118, 0.16);
  --err-dark: #FFA6AF;
  --yellow: #E9C433;
  --yellow-soft: rgba(233, 196, 51, 0.14);
  --yellow-dark: #F2DC86;
}

html[data-theme="dark"] body {
  background: linear-gradient(160deg, #1A1D2E 0%, var(--bg) 45%, #0E1019 100%) fixed;
}

html[data-theme="dark"] ::selection { background: rgba(142, 126, 242, 0.35); color: #F2F0FF; }

html[data-theme="dark"] ::placeholder { color: #7C84AC; opacity: 1; }
html[data-theme="dark"] .form-input::placeholder { color: #7C84AC; opacity: 1; }

html[data-theme="dark"] .form-input {
  background: #10121D;
  box-shadow: var(--nm-in-sm), inset 0 -1px 0 rgba(147, 161, 227, 0.06);
}

html[data-theme="dark"] .form-input:focus {
  box-shadow: var(--nm-in-sm), 0 0 0 4px rgba(142, 126, 242, 0.26), 0 0 18px rgba(142, 126, 242, 0.16);
}

html[data-theme="dark"] input:-webkit-autofill,
html[data-theme="dark"] input:-webkit-autofill:hover,
html[data-theme="dark"] input:-webkit-autofill:focus {
  -webkit-box-shadow: var(--nm-in-sm), inset 0 0 0 1000px #10121D;
  -webkit-text-fill-color: var(--ink);
  caret-color: var(--ink);
}

html[data-theme="dark"] ::-webkit-scrollbar-thumb { background: #333B5C; border-radius: 99px; }
html[data-theme="dark"] ::-webkit-scrollbar-thumb:hover { background: #414B78; }
html[data-theme="dark"] ::-webkit-scrollbar-track { background: transparent; }

html[data-theme="dark"] .nav-item:hover,
html[data-theme="dark"] .btn-ghost:hover { background: rgba(147, 161, 227, 0.07); }

html[data-theme="dark"] .user-avatar { box-shadow: 3px 3px 8px rgba(5, 7, 13, 0.65), -3px -3px 8px var(--nm-light), 0 4px 12px rgba(142, 126, 242, 0.45); }

html[data-theme="dark"] .card-header,
html[data-theme="dark"] .modal-header,
html[data-theme="dark"] .sidebar-header {
  border-bottom-color: rgba(255, 255, 255, 0.06);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.03);
}

html[data-theme="dark"] .modal-footer { border-top-color: rgba(255, 255, 255, 0.06); }
html[data-theme="dark"] .table th { box-shadow: 0 1px 0 rgba(255, 255, 255, 0.05); }

html[data-theme="dark"] .sep {
  border-top-color: rgba(255, 255, 255, 0.06);
  border-bottom-color: rgba(0, 0, 0, 0.4);
}

html[data-theme="dark"] .btn-primary { box-shadow: 5px 5px 12px rgba(5, 7, 13, 0.68), -5px -5px 12px var(--nm-light), 0 6px 18px rgba(120, 103, 230, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.12); }
html[data-theme="dark"] .btn-primary:hover { box-shadow: 6px 6px 14px rgba(5, 7, 13, 0.72), -6px -6px 14px var(--nm-light), 0 10px 26px rgba(120, 103, 230, 0.55), inset 0 1px 0 rgba(255, 255, 255, 0.12); }
html[data-theme="dark"] .btn-danger:hover { box-shadow: 4px 4px 10px rgba(5, 7, 13, 0.62), -4px -4px 10px var(--nm-light), 0 6px 16px rgba(240, 131, 107, 0.38); }

html[data-theme="dark"] .badge {
  border-color: rgba(255, 255, 255, 0.07);
  box-shadow: 2px 2px 5px rgba(5, 7, 13, 0.55), -2px -2px 5px var(--nm-light);
}

html[data-theme="dark"] .badge-ink { color: #181B28; }

html[data-theme="dark"] .table tbody tr:hover { background: rgba(147, 161, 227, 0.055); }

html[data-theme="dark"] .toggle-track { background: #10121D; }
html[data-theme="dark"] .toggle-thumb {
  background: #2E3448;
  box-shadow: 2px 2px 5px rgba(5, 7, 13, 0.75), -1px -1px 3px rgba(147, 161, 227, 0.2), inset 0 1px 0 rgba(255, 255, 255, 0.07);
}

html[data-theme="dark"] .modal-backdrop,
html[data-theme="dark"] .wiz-config,
html[data-theme="dark"] .wmp-overlay {
  background: rgba(3, 5, 10, 0.66);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

html[data-theme="dark"] .tab-btn.active { box-shadow: 3px 3px 7px rgba(5, 7, 13, 0.62), -3px -3px 7px var(--nm-light), inset 0 1px 0 rgba(255, 255, 255, 0.05); }
html[data-theme="dark"] .login-btn { box-shadow: 5px 5px 12px rgba(5, 7, 13, 0.68), -5px -5px 12px var(--nm-light), 0 8px 22px rgba(120, 103, 230, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.12); }
html[data-theme="dark"] .login-btn:hover { box-shadow: 6px 6px 14px rgba(5, 7, 13, 0.72), -6px -6px 14px var(--nm-light), 0 12px 28px rgba(120, 103, 230, 0.55), inset 0 1px 0 rgba(255, 255, 255, 0.12); }
html[data-theme="dark"] .login-error { border-color: rgba(255, 255, 255, 0.07); }
html[data-theme="dark"] .login-visual { background: #0B0C13; }

html[data-theme="dark"] .tip-pop {
  background: #2A3050;
  color: var(--ink);
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.6), inset 0 1px 0 rgba(255, 255, 255, 0.06);
}
html[data-theme="dark"] .tip-pop::after { border-top-color: #2A3050; }
html[data-theme="dark"] .tip-pop.below::after { border-bottom-color: #2A3050; }

html[data-theme="dark"] .notif-panel,
html[data-theme="dark"] .jdp-pop { box-shadow: var(--nm-out), 0 18px 44px rgba(0, 0, 0, 0.6); }
html[data-theme="dark"] .jdp { box-shadow: 0 14px 38px rgba(0, 0, 0, 0.6); }
html[data-theme="dark"] .topbar-sep { background: rgba(255, 255, 255, 0.1); }
html[data-theme="dark"] .notif-btn:hover,
html[data-theme="dark"] .jdp-nav button:hover { background: rgba(147, 161, 227, 0.09); color: var(--ink); }
html[data-theme="dark"] .notif-head { border-bottom-color: rgba(255, 255, 255, 0.06); }
html[data-theme="dark"] a.notif-item:hover { background: rgba(142, 126, 242, 0.11); }
html[data-theme="dark"] .jdp-day:hover { background: rgba(142, 126, 242, 0.22); }
html[data-theme="dark"] .kpi-op-row-active td { background: rgba(142, 126, 242, 0.14); }
html[data-theme="dark"] .kpi-locked-badge { color: var(--yellow-dark); }

html[data-theme="dark"] .wiz-chip { box-shadow: 4px 4px 10px var(--nm-dark), -4px -4px 10px var(--nm-light), inset 0 1px 0 rgba(255, 255, 255, 0.045); }
html[data-theme="dark"] .wiz-chip:hover { box-shadow: 6px 6px 14px var(--nm-dark), -6px -6px 14px var(--nm-light), 0 0 16px rgba(142, 126, 242, 0.4); }
html[data-theme="dark"] .wiz-pipe { box-shadow: inset 5px 5px 12px var(--nm-dark), inset -5px -5px 12px var(--nm-light); background-color: #171A28; }
html[data-theme="dark"] .wiz-pipe.drag-over { box-shadow: inset 5px 5px 12px var(--nm-dark), inset -5px -5px 12px var(--nm-light), 0 0 24px rgba(142, 126, 242, 0.4); }
html[data-theme="dark"] .wiz-pipe-item,
html[data-theme="dark"] .wiz-platform-card { box-shadow: 4px 4px 9px var(--nm-dark), -4px -4px 9px var(--nm-light), inset 0 1px 0 rgba(255, 255, 255, 0.045); }
html[data-theme="dark"] .wiz-platform-card.active { box-shadow: 4px 4px 10px var(--nm-dark), -4px -4px 10px var(--nm-light), 0 0 20px rgba(142, 126, 242, 0.45); }
html[data-theme="dark"] .wiz-config-card,
html[data-theme="dark"] .wmp-card { box-shadow: 0 24px 60px rgba(0, 0, 0, 0.7), inset 0 1px 0 rgba(255, 255, 255, 0.05); }

html[data-theme="dark"] .msg-chip.active { box-shadow: 4px 4px 10px rgba(5, 7, 13, 0.6), -2px -2px 8px var(--nm-light), 0 0 16px rgba(142, 126, 242, 0.4); }

html[data-theme="dark"] .pipe-diff ins { background: rgba(69, 195, 157, 0.17); color: #86E4BE; }
html[data-theme="dark"] .pipe-diff del { background: rgba(240, 106, 118, 0.17); color: #FFABA5; }
html[data-theme="dark"] .pipe-diff .diff-old { background: rgba(240, 106, 118, 0.1); color: #FFABA5; }
html[data-theme="dark"] .pipe-diff .diff-new { background: rgba(69, 195, 157, 0.1); color: #86E4BE; }
html[data-theme="dark"] .pipe-info + .pipe-diff-body { border-top-color: rgba(255, 255, 255, 0.14); }

html[data-theme="dark"] .rule-block .rule-sel option { color: var(--ink); background: var(--surface-2); }
html[data-theme="dark"] select.form-input option { color: var(--ink); background: var(--surface-2); }


#page-ai { --ai-g1: #6C5DD3; --ai-g2: #5B8DEF; }

@keyframes ai-breathe {
  0%, 100% { opacity: .75; transform: scale(1); }
  50% { opacity: 1; transform: scale(1.12); }
}

#ai-nav-spark { display: inline-flex; }
#ai-nav-spark svg { animation: ai-breathe 3s ease-in-out infinite; transform-origin: center; }

.ai-hero {
  position: relative;
  overflow: hidden;
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--nm-out);
  margin-bottom: 20px;
  min-height: 150px;
}

.ai-hero canvas {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  width: 44%;
  height: 100%;
  -webkit-mask-image: linear-gradient(to right, #000 72%, transparent);
  mask-image: linear-gradient(to right, #000 72%, transparent);
}

.ai-hero-inner { position: relative; z-index: 1; padding: 34px 30px; pointer-events: none; }

.ai-hero-title {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 22px;
  font-weight: 800;
}

.ai-hero-sub { margin-top: 10px; font-size: 13px; color: var(--ink-2); }

.ai-card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--nm-out);
  padding: 20px 24px;
  margin-bottom: 16px;
}

.ai-glow { box-shadow: var(--nm-out), 0 0 0 1px rgba(108, 93, 211, .12), 0 4px 32px rgba(108, 93, 211, .1); }

.ai-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
}

.ai-card-title { font-size: 15px; font-weight: 800; }

.ai-card-controls { display: flex; align-items: center; gap: 10px; }

.ai-empty-state { text-align: center; padding: 48px 0; color: var(--ink-3); font-size: 13px; }

.ai-empty-icon {
  width: 68px;
  height: 68px;
  margin: 0 auto 16px;
  border-radius: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--surface-2);
  box-shadow: var(--nm-in);
  color: var(--accent);
}

.ai-empty-icon svg { width: 30px; height: 30px; }

.ai-empty-msg { text-align: center; padding: 32px 0; color: var(--red-dark); font-size: 13px; font-weight: 600; }

.ai-scan { text-align: center; padding: 44px 0; color: var(--ink-2); font-size: 13px; }

.ai-scan-net { width: 150px; height: 86px; margin: 0 auto 16px; overflow: visible; }

.ai-net-e {
  stroke: rgba(108, 93, 211, 0.35);
  stroke-width: 1.4;
  stroke-dasharray: 6 5;
  animation: ai-net-flow 1.3s linear infinite;
}

.ai-net-e:nth-of-type(2n) { animation-duration: 1.8s; animation-direction: reverse; }

@keyframes ai-net-flow { to { stroke-dashoffset: -22; } }

.ai-net-n {
  fill: var(--accent);
  transform-box: fill-box;
  transform-origin: center;
  animation: ai-net-pulse 1.6s ease-in-out infinite;
  filter: drop-shadow(0 0 6px rgba(108, 93, 211, 0.55));
}

.ai-net-n:nth-of-type(2) { animation-delay: 0.2s; }
.ai-net-n:nth-of-type(3) { animation-delay: 0.45s; }
.ai-net-n:nth-of-type(4) { animation-delay: 0.7s; }
.ai-net-n:nth-of-type(5) { animation-delay: 0.95s; }

@keyframes ai-net-pulse {
  0%, 100% { transform: scale(0.7); opacity: 0.5; }
  50% { transform: scale(1.3); opacity: 1; }
}

.ai-bubble-stage {
  position: relative;
  border-radius: var(--radius-lg);
  box-shadow: var(--nm-in);
  margin-bottom: 20px;
  background:
    radial-gradient(circle at 18% 22%, rgba(108, 93, 211, .07), transparent 45%),
    radial-gradient(circle at 82% 78%, rgba(91, 141, 239, .07), transparent 45%),
    radial-gradient(var(--border) 1px, transparent 1px) 0 0 / 22px 22px,
    var(--surface-2);
}

@keyframes ai-cloud-in {
  from { scale: .3; opacity: 0; }
  to { scale: 1; opacity: 1; }
}
@keyframes ai-cloud-sway {
  0%, 100% { translate: 0 0; rotate: 0deg; }
  30% { translate: 2px -6px; rotate: .8deg; }
  60% { translate: -2px -3px; rotate: -.6deg; }
}
@keyframes ai-cloud-morph {
  0%, 100% { border-radius: 47% 53% 51% 49% / 53% 47% 53% 47%; }
  33% { border-radius: 53% 47% 46% 54% / 47% 55% 45% 53%; }
  66% { border-radius: 49% 51% 55% 45% / 52% 46% 54% 48%; }
}

.ai-bubble {
  position: absolute;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  border: none;
  padding: 0;
  font-family: inherit;
  color: var(--bub-ink);
  background: linear-gradient(150deg, var(--bub-soft), transparent 68%), var(--surface);
  border-radius: 47% 53% 51% 49% / 53% 47% 53% 47%;
  box-shadow: var(--nm-out);
  animation:
    ai-cloud-in .5s cubic-bezier(.3, 1.4, .5, 1) backwards,
    ai-cloud-sway var(--ai-float, 9s) ease-in-out infinite,
    ai-cloud-morph 13s ease-in-out infinite;
  transition: box-shadow .2s ease;
}

.ai-bubble:hover {
  box-shadow: 11px 11px 24px var(--nm-dark), -11px -11px 24px var(--nm-light);
  z-index: 10;
}

.ai-bubble-core {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: .35em;
  padding: 0 .7em;
  position: relative;
  z-index: 1;
}

.ai-bubble-label {
  font-size: 1em;
  font-weight: 800;
  line-height: 1.35;
  text-align: center;
  color: inherit;
}

.ai-bubble-pct {
  font-size: .72em;
  font-weight: 700;
  padding: .2em .8em;
  border-radius: 999px;
  background: var(--bub-soft);
  color: inherit;
}

.ai-c0 { --bub-ink: #5040B5; --bub-1: #9A8EE8; --bub-2: #7A6BD9; --bub-soft: rgba(108, 93, 211, .13); }
.ai-c1 { --bub-ink: #3A66C4; --bub-1: #93B4EE; --bub-2: #6E96DF; --bub-soft: rgba(91, 141, 239, .13); }
.ai-c2 { --bub-ink: #C05138; --bub-1: #F0B0A0; --bub-2: #E08D77; --bub-soft: rgba(232, 120, 95, .12); }
.ai-c3 { --bub-ink: #2C8169; --bub-1: #93D2BE; --bub-2: #68B79D; --bub-soft: rgba(63, 174, 142, .12); }
.ai-c4 { --bub-ink: #A87317; --bub-1: #EFC98D; --bub-2: #DFAE5E; --bub-soft: rgba(233, 161, 59, .13); }
.ai-c5 { --bub-ink: #B14A87; --bub-1: #EBAED2; --bub-2: #DC8BBB; --bub-soft: rgba(217, 107, 168, .12); }
.ai-c6 { --bub-ink: #31858B; --bub-1: #94D2D6; --bub-2: #67B7BD; --bub-soft: rgba(72, 194, 201, .12); }
.ai-c7 { --bub-ink: #7B48CC; --bub-1: #C7ABEC; --bub-2: #AB84DC; --bub-soft: rgba(168, 120, 242, .12); }

.ai-bars { margin-top: 4px; }

.ai-bars-title { font-size: 12.5px; font-weight: 800; color: var(--ink-2); margin-bottom: 12px; }

.ai-bar-row {
  display: grid;
  grid-template-columns: 12px minmax(90px, auto) 1fr 40px;
  align-items: center;
  gap: 10px;
  padding: 7px 8px;
  border-radius: 10px;
  cursor: pointer;
  transition: background .15s ease;
}

.ai-bar-row:hover { background: var(--surface-2); }

.ai-bar-dot {
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: linear-gradient(145deg, var(--bub-1), var(--bub-2));
}

.ai-bar-label { font-size: 12.5px; font-weight: 700; }

.ai-bar-track {
  height: 9px;
  border-radius: 999px;
  background: var(--surface-2);
  box-shadow: var(--nm-in-sm);
  overflow: hidden;
}

.ai-bar-fill { height: 100%; border-radius: 999px; background: linear-gradient(90deg, var(--bub-1), var(--bub-2)); }

.ai-bar-pct { font-size: 11.5px; font-weight: 700; color: var(--ink-3); text-align: left; }

.ai-topic-detail {
  margin-top: 16px;
  border-radius: var(--radius-lg);
  background: var(--surface-2);
  box-shadow: var(--nm-in);
  padding: 18px 20px;
}

.ai-detail-head { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }

.ai-detail-dot {
  width: 13px;
  height: 13px;
  border-radius: 50%;
  background: linear-gradient(145deg, var(--bub-1), var(--bub-2));
  flex-shrink: 0;
}

.ai-detail-title { font-size: 14px; font-weight: 800; }

.ai-detail-meta { font-size: 11.5px; color: var(--ink-3); font-weight: 600; }

.ai-detail-close {
  margin-inline-start: auto;
  border: none;
  background: var(--surface);
  box-shadow: var(--nm-out-sm);
  width: 26px;
  height: 26px;
  border-radius: 9px;
  cursor: pointer;
  color: var(--ink-2);
  font-size: 14px;
  line-height: 1;
  font-family: inherit;
}

.ai-samples { display: flex; flex-direction: column; gap: 10px; }

.ai-sample {
  background: var(--surface);
  border-radius: 12px;
  box-shadow: var(--nm-out-sm);
  padding: 12px 14px;
}

.ai-sample p { font-size: 12.5px; line-height: 1.8; color: var(--ink-2); margin-bottom: 6px; }

.ai-sample a { font-size: 11.5px; font-weight: 700; color: var(--accent); text-decoration: none; }

.ai-sample a:hover { color: var(--accent-dark); }

.ai-chat-card { display: flex; flex-direction: column; height: 560px; }

.ai-chat-log {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 4px 2px;
}

.ai-chat-welcome { margin: auto; text-align: center; color: var(--ink-2); font-size: 13.5px; }

.ai-msg { display: flex; align-items: flex-end; gap: 10px; }

.ai-msg-user { flex-direction: row-reverse; }

.ai-msg-avatar {
  width: 28px;
  height: 28px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--ai-g1), var(--ai-g2));
  color: #fff;
  flex-shrink: 0;
}

.ai-msg-avatar svg { width: 14px; height: 14px; }

.ai-msg-bubble {
  max-width: 76%;
  padding: 10px 15px;
  border-radius: 16px;
  border-end-start-radius: 5px;
  font-size: 13px;
  line-height: 1.7;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--ink);
}

.ai-msg-user .ai-msg-bubble {
  background: linear-gradient(135deg, var(--ai-g1), var(--ai-g2));
  color: #fff;
  border: none;
  border-radius: 16px;
  border-end-end-radius: 5px;
  box-shadow: 0 8px 20px rgba(108, 93, 211, .3);
}

.ai-msg-error .ai-msg-bubble {
  background: var(--red-soft) !important;
  color: var(--red-dark) !important;
  border-color: transparent !important;
}

@keyframes ai-dot {
  0%, 80%, 100% { transform: translateY(0); opacity: .4; }
  40% { transform: translateY(-4px); opacity: 1; }
}

.ai-dots { display: inline-flex; gap: 4px; padding: 3px 2px; }
.ai-dots span { width: 6px; height: 6px; border-radius: 50%; background: var(--accent); animation: ai-dot 1.2s ease-in-out infinite; }
.ai-dots span:nth-child(2) { animation-delay: .15s; }
.ai-dots span:nth-child(3) { animation-delay: .3s; }

@keyframes ai-caret-blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0; }
}

.ai-typing::after {
  content: '\258F';
  color: var(--accent);
  animation: ai-caret-blink .8s step-end infinite;
}

.ai-src-list { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 9px; }

.ai-src {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--surface);
  box-shadow: var(--nm-out-sm);
  font-size: 10.5px;
  font-weight: 700;
  color: var(--accent-dark);
  text-decoration: none;
}

.ai-src svg { width: 11px; height: 11px; flex-shrink: 0; }

.ai-src span { max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.ai-chat-inputbar {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 14px;
  padding: 6px;
  border-radius: 999px;
  background: var(--surface-2);
  box-shadow: var(--nm-in);
}

.ai-chat-inputbar .form-input {
  flex: 1;
  border: none;
  background: transparent;
  box-shadow: none;
  padding: 9px 14px;
}

.ai-chat-inputbar .form-input:focus { box-shadow: none; outline: none; }

.ai-chat-send {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--ai-g1), var(--ai-g2));
  color: #fff;
  cursor: pointer;
  box-shadow: 0 8px 18px rgba(108, 93, 211, .35);
  transition: transform .15s ease;
  flex-shrink: 0;
}

.ai-chat-send svg { transform: scaleX(-1); }

.ai-chat-send:hover { transform: translateY(-1px); }
.ai-chat-send:active { transform: scale(.95); }
.ai-chat-send:disabled { opacity: .6; cursor: default; }

.ai-report { display: flex; flex-direction: column; gap: 16px; animation: page-in 0.35s cubic-bezier(0.22, 1, 0.36, 1); }

.ai-report-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(175px, 1fr));
  gap: 14px;
}

.ai-report-stats .stat-icon svg { width: 20px; height: 20px; }

.ai-report-stats .stat-value.ai-up { color: var(--green-dark); }
.ai-report-stats .stat-value.ai-down { color: var(--red-dark); }

.ai-report .card { margin: 0; }

.ai-report-cols {
  display: grid;
  grid-template-columns: 1.15fr .85fr;
  gap: 16px;
  align-items: stretch;
}

.ai-report-overview {
  font-size: 13.5px;
  line-height: 1.9;
  color: var(--ink-2);
  padding: 14px 16px;
  border-radius: 12px;
  background: var(--surface-2);
  box-shadow: var(--nm-in-sm);
}

.ai-week-chart {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  height: 130px;
  padding: 14px 12px 10px;
  border-radius: 12px;
  background: var(--surface-2);
  box-shadow: var(--nm-in-sm);
}

.ai-week-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  gap: 5px;
  height: 100%;
}

.ai-week-val { font-size: 10px; font-weight: 700; color: var(--ink-3); }

.ai-week-bar {
  width: 100%;
  max-width: 30px;
  min-height: 4px;
  border-radius: 8px 8px 4px 4px;
  background: linear-gradient(180deg, var(--ai-g2), var(--ai-g1));
  box-shadow: 0 6px 14px rgba(108, 93, 211, 0.22);
  transition: filter 0.15s ease;
}

.ai-week-col:hover .ai-week-bar { filter: brightness(1.12); }

.ai-week-day { font-size: 10.5px; font-weight: 700; color: var(--ink-3); font-family: 'IRANSans', sans-serif; direction: rtl; }

.ai-hot-topics {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 10px;
}

.ai-hot-topic {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 14px;
  border-radius: 12px;
  background: var(--surface-2);
  box-shadow: var(--nm-in-sm);
}

.ai-hot-rank {
  width: 26px;
  height: 26px;
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--ai-g1), var(--ai-g2));
  color: #fff;
  font-size: 12px;
  font-weight: 800;
  flex-shrink: 0;
  box-shadow: 0 6px 14px rgba(108, 93, 211, 0.28);
}

.ai-hot-body { display: flex; flex-direction: column; gap: 3px; }

.ai-hot-name { font-size: 13px; font-weight: 800; }

.ai-hot-detail { font-size: 11.5px; color: var(--ink-2); line-height: 1.7; }

.ai-insight-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 10px;
}

.ai-insight {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 14px;
  border-radius: 12px;
  background: var(--surface-2);
  box-shadow: var(--nm-in-sm);
}

.ai-insight-ic {
  width: 30px;
  height: 30px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--accent-soft);
  color: var(--accent-dark);
  flex-shrink: 0;
}

.ai-insight-ic svg { width: 15px; height: 15px; }

.ai-insight-body { display: flex; flex-direction: column; gap: 3px; }

.ai-insight-title { font-size: 12px; font-weight: 800; }

.ai-insight p { font-size: 11.5px; color: var(--ink-2); line-height: 1.7; }

.ai-recs { display: flex; flex-direction: column; gap: 9px; }

.ai-rec {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 11px 14px;
  border-radius: 12px;
  background: var(--surface-2);
  box-shadow: var(--nm-in-sm);
}

.ai-rec-num {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--ai-g1), var(--ai-g2));
  color: #fff;
  font-size: 11px;
  font-weight: 800;
  flex-shrink: 0;
  margin-top: 1px;
}

.ai-rec p { font-size: 12.5px; line-height: 1.8; color: var(--ink); }

.ai-hot-topic,
.ai-insight,
.ai-rec { transition: transform 0.15s ease; }

.ai-hot-topic:hover,
.ai-insight:hover,
.ai-rec:hover { transform: translateY(-2px); }

.ai-report-block-title { display: flex; align-items: center; gap: 8px; }

.ai-report-block-ic {
  width: 26px;
  height: 26px;
  border-radius: 9px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--ai-g1), var(--ai-g2));
  color: #fff;
  flex-shrink: 0;
  box-shadow: 0 6px 14px rgba(108, 93, 211, 0.28);
}

.ai-report-block-ic svg { width: 14px; height: 14px; }

html[data-theme="dark"] .ai-bubble-stage {
  background:
    radial-gradient(circle at 18% 22%, rgba(142, 126, 242, .1), transparent 45%),
    radial-gradient(circle at 82% 78%, rgba(91, 141, 239, .1), transparent 45%),
    radial-gradient(var(--border) 1px, transparent 1px) 0 0 / 22px 22px,
    var(--surface-2);
}

html[data-theme="dark"] .ai-c0 { --bub-ink: #B0A5F5; }
html[data-theme="dark"] .ai-c1 { --bub-ink: #9FBEF5; }
html[data-theme="dark"] .ai-c2 { --bub-ink: #F2A891; }
html[data-theme="dark"] .ai-c3 { --bub-ink: #8FD6BE; }
html[data-theme="dark"] .ai-c4 { --bub-ink: #EFC482; }
html[data-theme="dark"] .ai-c5 { --bub-ink: #EBA6CE; }
html[data-theme="dark"] .ai-c6 { --bub-ink: #8FD3D8; }
html[data-theme="dark"] .ai-c7 { --bub-ink: #C9ACEE; }

html[data-theme="dark"] .ai-msg-user .ai-msg-bubble { box-shadow: 0 8px 20px rgba(108, 93, 211, .5); }

@media (prefers-reduced-motion: reduce) {
  .ai-bubble,
  #ai-nav-spark svg { animation: none; }
}

@media (max-width: 760px) {
  .ai-report-cols { grid-template-columns: 1fr; }
}

@media (max-width: 560px) {
      .ai-card-head { flex-direction: column; align-items: flex-start; }
  .ai-report-stats { grid-template-columns: repeat(2, 1fr); }
}


/* ============================================================
   ROUND 7 · انفجار جستجوی معنایی، قفسه کتابخانه، مسیر عمودی کانال، صفحه‌بندی مینیمال
   ============================================================ */

/* --- Semantic search burst --- */
.sem-burst-char {
  position: fixed;
  z-index: 3000;
  pointer-events: none;
  font-weight: 800;
  line-height: 1;
  will-change: transform, opacity;
  text-shadow: 0 0 14px currentColor;
  animation: sem-burst var(--bdur, 0.9s) cubic-bezier(0.16, 0.84, 0.32, 1) forwards;
}
@keyframes sem-burst {
  0%   { transform: translate(-50%, -50%) scale(0.2) rotate(0deg); opacity: 0; }
  10%  { transform: translate(-50%, -50%) scale(1.5) rotate(0deg); opacity: 1; }
  60%  { opacity: 1; }
  100% { transform: translate(calc(-50% + var(--bx)), calc(-50% + var(--by))) scale(0.75) rotate(var(--brot)); opacity: 0; }
}
.sem-burst-ring {
  position: fixed;
  z-index: 2999;
  pointer-events: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 2px solid var(--accent);
  box-shadow: 0 0 26px rgba(124, 92, 252, 0.5), inset 0 0 10px rgba(124, 92, 252, 0.3);
  animation: sem-ring 1s ease-out forwards;
}
@keyframes sem-ring {
  0%   { transform: translate(-50%, -50%) scale(0.4); opacity: 0.95; }
  100% { transform: translate(-50%, -50%) scale(9); opacity: 0; border-width: 1px; }
}

/* --- Prompt library animated bookshelf --- */
.np-hero { min-height: 176px; }
.np-shelf {
  position: absolute;
  inset-inline-end: 46px;
  bottom: 26px;
  width: 200px;
  height: 122px;
}
.np-spark {
  position: absolute;
  color: #8e7ef2;
  text-shadow: 0 0 8px rgba(142, 126, 242, 0.8);
  animation: np-sparkle 3.2s ease-in-out infinite;
  pointer-events: none;
}
.np-spark-1 { top: -4px; inset-inline-start: 10px; font-size: 11px; }
.np-spark-2 { top: 20px; inset-inline-end: -8px; font-size: 9px; animation-delay: 1.1s; }
.np-spark-3 { top: -14px; inset-inline-end: 44px; font-size: 8px; animation-delay: 2.2s; }
@keyframes np-sparkle {
  0%, 100% { opacity: 0.15; transform: scale(0.7); }
  50% { opacity: 1; transform: scale(1.15); }
}
.np-shelf-glow {
  position: absolute;
  inset-inline: 8px;
  bottom: -4px;
  height: 30px;
  border-radius: 50%;
  background: radial-gradient(ellipse at center, rgba(108, 93, 211, 0.4), transparent 70%);
  filter: blur(8px);
}
.np-shelf-books {
  position: absolute;
  inset-inline: 14px;
  bottom: 13px;
  height: 74px;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 5px;
}
.np-book {
  width: 17px;
  border-radius: 4px 4px 2px 2px;
  box-shadow: inset 0 6px 0 rgba(255, 255, 255, 0.22), inset 0 -5px 0 rgba(0, 0, 0, 0.14), 0 3px 6px rgba(31, 34, 51, 0.18);
  transform-origin: bottom center;
}
.np-b1 { height: 62px; background: linear-gradient(180deg, #8e7ef2, #6c5dd3); animation: np-sway 5s ease-in-out infinite; }
.np-b2 { height: 54px; background: linear-gradient(180deg, #5bb7f7, #3a8fd9); }
.np-b3 { height: 66px; background: linear-gradient(180deg, #f7a15b, #e0823a); }
.np-b4 { height: 58px; background: linear-gradient(180deg, #b464ff, #8b3ce0); box-shadow: inset 0 6px 0 rgba(255, 255, 255, 0.22), inset 0 -5px 0 rgba(0, 0, 0, 0.14), 0 0 14px rgba(180, 100, 255, 0.4); }
.np-b5 { height: 50px; background: linear-gradient(180deg, #3cd282, #26a862); }
.np-b6 { height: 60px; background: linear-gradient(180deg, #dc3c96, #b02578); animation: np-sway 6s 1s ease-in-out infinite; }
@keyframes np-sway {
  0%, 100% { transform: rotate(0deg); }
  50% { transform: rotate(-4deg); }
}
.np-book.np-pop { animation: np-pop-out 0.95s cubic-bezier(0.5, -0.3, 0.6, 1) forwards; }
@keyframes np-pop-out {
  0% { transform: translateY(0) rotate(0deg) scale(1); opacity: 1; }
  45% { transform: translateY(-34px) rotate(-6deg) scale(1.06); opacity: 1; }
  100% { transform: translateY(-54px) rotate(-14deg) scale(0.9); opacity: 0; }
}
.np-book.np-return { animation: np-pop-back 0.55s ease-out; }
@keyframes np-pop-back {
  0% { transform: translateY(-54px) rotate(-14deg) scale(0.9); opacity: 0; }
  100% { transform: translateY(0) rotate(0deg) scale(1); opacity: 1; }
}
.np-shelf-board {
  position: absolute;
  inset-inline: 4px;
  bottom: 4px;
  height: 9px;
  border-radius: 5px;
  background: var(--surface);
  box-shadow: var(--nm-out);
}
.np-openbook {
  position: absolute;
  left: 50%;
  bottom: -2px;
  width: 180px;
  height: 94px;
  z-index: 3;
  opacity: 0;
  transform: translate(-50%, 18px) scale(0.35);
  transition: transform 0.5s cubic-bezier(0.34, 1.45, 0.5, 1), opacity 0.35s ease;
  filter: drop-shadow(0 12px 22px rgba(108, 93, 211, 0.4));
  perspective: 320px;
  pointer-events: none;
}
.np-openbook.np-show { opacity: 1; transform: translate(-50%, 0) scale(1); }
.np-ob-cover {
  position: absolute;
  bottom: 0;
  width: 88px;
  height: 78px;
  background: linear-gradient(180deg, var(--ob-c1, #8e7ef2), var(--ob-c2, #6c5dd3));
}
.np-ob-cover-l { left: 0; border-radius: 12px 4px 6px 14px; transform: skewY(7deg); }
.np-ob-cover-r { right: 0; border-radius: 4px 12px 14px 6px; transform: skewY(-7deg); }
.np-ob-page {
  position: absolute;
  bottom: 5px;
  width: 80px;
  height: 70px;
  background: linear-gradient(180deg, #ffffff, #eef0f8);
}
html[data-theme="dark"] .np-ob-page { background: linear-gradient(180deg, #e8e9f2, #cfd2e4); }
.np-ob-page-l { left: 5px; border-radius: 10px 3px 3px 10px; transform: skewY(7deg); box-shadow: inset -8px 0 12px rgba(31, 34, 51, 0.08); }
.np-ob-page-r { right: 5px; border-radius: 3px 10px 10px 3px; transform: skewY(-7deg); box-shadow: inset 8px 0 12px rgba(31, 34, 51, 0.08); overflow: hidden; }
.np-openbook.np-show .np-ob-page-r { animation: np-ob-flip 0.75s 0.3s cubic-bezier(0.3, 0.7, 0.35, 1) both; transform-origin: left center; }
@keyframes np-ob-flip {
  0% { transform: skewY(-7deg) rotateY(-130deg); }
  100% { transform: skewY(-7deg) rotateY(0deg); }
}
.np-ob-spine {
  position: absolute;
  left: 50%;
  bottom: 2px;
  width: 6px;
  height: 76px;
  transform: translateX(-50%);
  border-radius: 3px;
  background: linear-gradient(180deg, var(--ob-c2, #6c5dd3), var(--ob-c1, #8e7ef2));
}
.np-ob-neuro {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
  pointer-events: none;
}
.np-nu-e {
  stroke: var(--ob-c2, #6c5dd3);
  stroke-width: 1.4;
  stroke-linecap: round;
  stroke-dasharray: 60;
  stroke-dashoffset: 60;
  opacity: 0;
}
.np-nu-n {
  fill: var(--ob-c1, #8e7ef2);
  opacity: 0;
  transform-box: fill-box;
  transform-origin: center;
  filter: drop-shadow(0 0 4px rgba(142, 126, 242, 0.7));
}
.np-openbook.np-show .np-nu-e { animation: np-nu-edge 4s 1.05s ease-in-out forwards; }
.np-openbook.np-show .np-nu-n { animation: np-nu-node 4.2s 1.05s ease-in-out forwards; }
@keyframes np-nu-edge {
  0% { opacity: 0; stroke-dashoffset: 60; }
  18% { opacity: 0.9; stroke-dashoffset: 0; }
  45% { opacity: 0.35; }
  65% { opacity: 0.9; }
  82% { opacity: 0.45; }
  100% { opacity: 0; stroke-dashoffset: 0; }
}
@keyframes np-nu-node {
  0% { opacity: 0; transform: scale(0.3); }
  12% { opacity: 1; transform: scale(1.2); }
  32% { opacity: 0.7; transform: scale(0.9); }
  52% { opacity: 1; transform: scale(1.12); }
  72% { opacity: 0.75; transform: scale(0.92); }
  88% { opacity: 1; transform: scale(1.05); }
  100% { opacity: 0; transform: scale(0.4); }
}

/* --- Vertical channel route --- */
.route-box.route-stack {
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 16px 14px;
  text-align: center;
}
.route-stack .route-id {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
}
.route-arrow-stack { justify-content: center; }
.channel-card.big .card-body { padding: 24px 20px 20px; }
.channel-card.big .route-box.route-stack { margin: 16px 0; }
.channel-card.big .ch-card-head { margin-bottom: 18px; }

/* --- Minimal pager with inline page input --- */
.msg-page-info { display: inline-flex; align-items: center; gap: 6px; }
.msg-page-cur {
  width: 42px;
  padding: 5px 4px;
  text-align: center;
  font-size: 12.5px;
  font-weight: 700;
  font-family: inherit;
  color: var(--ink);
  background: var(--surface-2);
  border: none;
  border-radius: 8px;
  box-shadow: var(--nm-in);
}
.msg-page-cur:focus {
  outline: none;
  box-shadow: var(--nm-in), 0 0 0 2px rgba(124, 92, 252, 0.35);
}
html[data-theme="dark"] .msg-page-cur:focus { box-shadow: var(--nm-in), 0 0 0 2px rgba(142, 126, 242, 0.45); }

@media (max-width: 700px) {
  .np-shelf { display: none; }
  .np-hero { min-height: 150px; }
  .kpi-viz { display: none; }
  .kpi-hero { min-height: 132px; }
}
@media (prefers-reduced-motion: reduce) {
  .np-b1, .np-b6, .np-spark, .np-nu-e, .np-nu-n, .np-book.np-pop, .np-book.np-return, .sem-burst-char, .sem-burst-ring, .ai-net-e, .ai-net-n, .kpi-viz-bars span, .kpi-line-path, .kpi-line-dot, .kpi-donut-arc, .ai-idea-card, .ai-senti-col, .ai-senti-stack { animation: none; }
}

/* --- KPI hero + AI feature cards --- */
.kpi-hero {
  position: relative;
  overflow: hidden;
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--nm-out);
  margin-bottom: 20px;
  min-height: 168px;
}
.kpi-viz {
  position: absolute;
  inset-inline-end: 44px;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  align-items: center;
  gap: 26px;
  pointer-events: none;
}
.kpi-viz-bars {
  display: flex;
  align-items: flex-end;
  gap: 7px;
  height: 78px;
}
.kpi-viz-bars span {
  width: 13px;
  border-radius: 7px 7px 3px 3px;
  animation: kpi-bar 2.8s ease-in-out infinite;
}
.kpi-viz-bars span:nth-child(1) { background: linear-gradient(180deg, #8e7ef2, #6c5dd3); box-shadow: 0 0 12px rgba(108, 93, 211, 0.35); }
.kpi-viz-bars span:nth-child(2) { background: linear-gradient(180deg, #5bb7f7, #3a8fd9); box-shadow: 0 0 12px rgba(91, 183, 247, 0.3); animation-delay: 0.35s; }
.kpi-viz-bars span:nth-child(3) { background: linear-gradient(180deg, #3cd282, #26a862); box-shadow: 0 0 12px rgba(60, 210, 130, 0.3); animation-delay: 0.7s; }
.kpi-viz-bars span:nth-child(4) { background: linear-gradient(180deg, #f7a15b, #e0823a); box-shadow: 0 0 12px rgba(247, 161, 91, 0.3); animation-delay: 1.05s; }
.kpi-viz-bars span:nth-child(5) { background: linear-gradient(180deg, #dc3c96, #b02578); box-shadow: 0 0 12px rgba(220, 60, 150, 0.3); animation-delay: 1.4s; }
@keyframes kpi-bar {
  0%, 100% { height: 34%; }
  50% { height: 100%; }
}
.kpi-viz-line { width: 122px; height: 62px; overflow: visible; }
.kpi-line-path {
  fill: none;
  stroke: #5bb7f7;
  stroke-width: 2.6;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-dasharray: 170;
  filter: drop-shadow(0 0 6px rgba(91, 183, 247, 0.45));
  animation: kpi-line 4.2s linear infinite alternate;
}
@keyframes kpi-line {
  0% { stroke-dashoffset: 170; }
  100% { stroke-dashoffset: 0; }
}
.kpi-line-dot {
  fill: #5bb7f7;
  filter: drop-shadow(0 0 6px rgba(91, 183, 247, 0.8));
  animation: kpi-dot 4.2s linear infinite alternate;
}
@keyframes kpi-dot {
  0% { transform: translate(4px, 50px); opacity: 0; }
  8% { opacity: 1; }
  20% { transform: translate(26px, 34px); }
  40% { transform: translate(48px, 42px); }
  60% { transform: translate(70px, 20px); }
  80% { transform: translate(92px, 30px); }
  100% { transform: translate(114px, 10px); opacity: 1; }
}
.kpi-viz-donut { width: 64px; height: 64px; }
.kpi-viz-donut svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.kpi-donut-track { fill: none; stroke: rgba(108, 93, 211, 0.15); stroke-width: 6; }
.kpi-donut-arc {
  fill: none;
  stroke: #b464ff;
  stroke-width: 6;
  stroke-linecap: round;
  stroke-dasharray: 113;
  filter: drop-shadow(0 0 6px rgba(180, 100, 255, 0.45));
  animation: kpi-donut 3.6s ease-in-out infinite;
}
@keyframes kpi-donut {
  0%, 100% { stroke-dashoffset: 96; }
  50% { stroke-dashoffset: 18; }
}
.ai-feature-grid { grid-template-columns: repeat(3, 1fr); margin-bottom: 22px; }
.kpi-choice-card.rose .kpi-choice-icon { background: rgba(220, 60, 150, 0.12); color: #dc3c96; }
.kpi-choice-card.rose .kpi-choice-hint { color: #b02578; }
html[data-theme="dark"] .kpi-choice-card.rose .kpi-choice-icon { background: rgba(220, 60, 150, 0.2); }
html[data-theme="dark"] .kpi-choice-card.rose .kpi-choice-hint { color: #f06cb4; }
.kpi-choice-card.amber .kpi-choice-icon { background: rgba(224, 130, 58, 0.12); color: #e0823a; }
.kpi-choice-card.amber .kpi-choice-hint { color: #c26a28; }
html[data-theme="dark"] .kpi-choice-card.amber .kpi-choice-icon { background: rgba(224, 130, 58, 0.2); }
html[data-theme="dark"] .kpi-choice-card.amber .kpi-choice-hint { color: #f7a15b; }
.kpi-choice-card.mint .kpi-choice-icon { background: rgba(38, 168, 98, 0.12); color: #26a862; }
.kpi-choice-card.mint .kpi-choice-hint { color: #1e8a50; }
html[data-theme="dark"] .kpi-choice-card.mint .kpi-choice-icon { background: rgba(38, 168, 98, 0.2); }
html[data-theme="dark"] .kpi-choice-card.mint .kpi-choice-hint { color: #3cd282; }
.kpi-choice-card.violet .kpi-choice-icon { background: rgba(139, 60, 224, 0.12); color: #8b3ce0; }
.kpi-choice-card.violet .kpi-choice-hint { color: #7a2fd0; }
html[data-theme="dark"] .kpi-choice-card.violet .kpi-choice-icon { background: rgba(139, 60, 224, 0.2); }
html[data-theme="dark"] .kpi-choice-card.violet .kpi-choice-hint { color: #b464ff; }
#ai-view-head { margin-bottom: 18px; }
@media (max-width: 1100px) {
  .ai-feature-grid { grid-template-columns: repeat(2, 1fr); }
}
.ai-style-form {
  display: flex;
  gap: 10px;
  margin-bottom: 18px;
}
.ai-style-form .form-input { flex: 1; }
.ai-ideas-meta {
  font-size: 12.5px;
  font-weight: 700;
  color: var(--ink-3);
  margin-bottom: 14px;
}
.ai-ideas-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}
.ai-idea-card {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 18px;
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--nm-out);
  animation: ai-idea-in 0.5s ease both;
}
@keyframes ai-idea-in {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: translateY(0); }
}
.ai-idea-head {
  display: flex;
  align-items: center;
  gap: 10px;
}
.ai-idea-num {
  width: 26px;
  height: 26px;
  border-radius: 9px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 13px;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.ai-idea-title {
  font-size: 13.5px;
  font-weight: 800;
}
.ai-idea-text {
  resize: vertical;
  min-height: 150px;
  font-size: 13px;
  line-height: 2;
}
.ai-idea-actions {
  display: flex;
  justify-content: flex-end;
}
.ai-senti {
  display: flex;
  flex-direction: column;
  gap: 18px;
}
.ai-senti-totals {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}
.ai-senti-total {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 14px;
  border-radius: var(--radius-lg);
  box-shadow: var(--nm-out);
  font-size: 12.5px;
  font-weight: 700;
  color: var(--ink-2);
}
.ai-senti-total-val { font-size: 22px; font-weight: 800; }
.ai-senti-total.ai-senti-pos .ai-senti-total-val { color: #26a862; }
.ai-senti-total.ai-senti-neu .ai-senti-total-val { color: var(--ink-3); }
.ai-senti-total.ai-senti-neg .ai-senti-total-val { color: #dc3c96; }
.ai-senti-chart {
  display: flex;
  gap: 8px;
  height: 190px;
  padding: 8px 4px 0;
}
.ai-senti-col {
  flex: 1;
  min-width: 0;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  gap: 7px;
  animation: ai-idea-in 0.5s ease both;
}
.ai-senti-stack {
  width: min(26px, 100%);
  display: flex;
  flex-direction: column;
  border-radius: 8px;
  overflow: hidden;
  transform-origin: bottom;
  animation: ai-senti-grow 0.9s ease both;
}
@keyframes ai-senti-grow {
  from { transform: scaleY(0); }
  to { transform: scaleY(1); }
}
.ai-senti-seg { width: 100%; }
.ai-senti-seg.ai-senti-pos { background: linear-gradient(180deg, #3cd282, #26a862); }
.ai-senti-seg.ai-senti-neu { background: linear-gradient(180deg, #b9bdd4, #9aa0bd); }
.ai-senti-seg.ai-senti-neg { background: linear-gradient(180deg, #f06cb4, #dc3c96); }
.ai-senti-day {
  font-size: 10.5px;
  font-weight: 700;
  color: var(--ink-3);
  font-family: 'IRANSans', sans-serif;
  white-space: nowrap;
}
.ai-senti-legend {
  display: flex;
  align-items: center;
  gap: 16px;
  font-size: 12px;
  font-weight: 700;
  color: var(--ink-2);
}
.ai-senti-legend span {
  display: flex;
  align-items: center;
  gap: 6px;
}
.ai-senti-legend i {
  width: 10px;
  height: 10px;
  border-radius: 3px;
  display: inline-block;
}
.ai-senti-legend i.ai-senti-pos { background: #26a862; }
.ai-senti-legend i.ai-senti-neu { background: #9aa0bd; }
.ai-senti-legend i.ai-senti-neg { background: #dc3c96; }
.ai-senti-count {
  margin-inline-start: auto;
  color: var(--ink-3);
}
.ai-senti-summary {
  font-size: 13px;
  line-height: 2.1;
  color: var(--ink-2);
  padding: 14px 16px;
  border-radius: var(--radius-lg);
  box-shadow: var(--nm-out);
  margin: 0;
}
@media (max-width: 700px) {
  .ai-feature-grid { grid-template-columns: 1fr; }
  .ai-ideas-grid { grid-template-columns: 1fr; }
  .ai-senti-chart { gap: 4px; height: 150px; }
  .ai-senti-totals { gap: 10px; }
  .ai-style-form { flex-direction: column; }
}

.ai-usage {
  grid-column: 1 / -1;
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--nm-out);
  padding: 24px 26px;
}

.ai-usage-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.ai-usage-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 15px;
  font-weight: 800;
  color: var(--ink);
}

.ai-usage-sub { font-size: 12px; font-weight: 600; color: var(--ink-3); }

.ai-usage-empty { text-align: center; padding: 18px 0; color: var(--ink-3); font-size: 13px; font-weight: 600; }

.ai-usage-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

@media (max-width: 700px) {
  .ai-usage { padding: 20px 18px; }
  .ai-usage-stats { grid-template-columns: 1fr; }
}

.ai-chat-layout {
  display: flex;
  gap: 14px;
  position: relative;
}

.ai-chat-layout .ai-chat-card {
  flex: 1;
  min-width: 0;
}

.ai-chat-side {
  width: 232px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 12px;
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--nm-out);
}

.ai-chat-new {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 12px;
  border: none;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--ai-g1), var(--ai-g2));
  color: #fff;
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 700;
  cursor: pointer;
}

.ai-chat-list {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.ai-chat-list-empty {
  color: var(--ink-3);
  font-size: 12px;
  text-align: center;
  padding: 12px 4px;
}

.ai-chat-item {
  position: relative;
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 8px 10px;
  border-radius: 12px;
  cursor: pointer;
  transition: background 0.15s ease;
}

.ai-chat-item + .ai-chat-item::before {
  content: '';
  position: absolute;
  top: -3.5px;
  right: 10px;
  left: 10px;
  height: 1px;
  background: var(--border-2);
}

.ai-chat-item:hover {
  background: var(--surface-2);
}

.ai-chat-item.active {
  background: var(--accent-soft);
}

.ai-chat-item-body {
  flex: 1;
  min-width: 0;
}

.ai-chat-item-title {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ai-chat-item-acts {
  display: flex;
  align-items: center;
  gap: 2px;
  flex-shrink: 0;
}

.ai-chat-item-btn {
  display: none;
  width: 22px;
  height: 22px;
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--ink-3);
  cursor: pointer;
}

.ai-chat-item:hover .ai-chat-item-btn {
  display: flex;
}

.ai-chat-item-btn:hover {
  color: var(--ink);
}

.ai-chat-item-del:hover {
  color: var(--coral, #e8785f);
}

.ai-chat-item-edit {
  width: 100%;
  padding: 4px 8px;
  font-size: 12.5px;
}

.ai-chat-toggle {
  display: none;
  width: 34px;
  height: 34px;
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: 10px;
  background: var(--surface-2);
  color: var(--ink-2);
  cursor: pointer;
}

@media (max-width: 700px) {
  .ai-chat-toggle {
    display: flex;
  }

  .ai-chat-side {
    position: absolute;
    top: 0;
    bottom: 0;
    right: 0;
    z-index: 30;
    width: min(78vw, 280px);
    transform: translateX(110%);
    transition: transform 0.25s ease;
  }

  .ai-chat-layout.side-open .ai-chat-side {
    transform: none;
  }
}

.us-profile { display: flex; align-items: center; gap: 14px; padding: 18px 22px; flex-wrap: wrap; }

.us-profile-avatar { width: 52px; height: 52px; flex-shrink: 0; }

.us-profile-info { display: flex; flex-direction: column; gap: 3px; }

.us-profile-name { font-size: 17px; font-weight: 800; color: var(--ink); }

.us-profile-sub { font-size: 12.5px; font-weight: 600; color: var(--ink-3); }

.us-profile-badges { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-inline-start: auto; }

.stat-sub { font-size: 11.5px; font-weight: 600; color: var(--ink-3); margin-top: 4px; }

.us-feature-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 10px; }

.us-feature-item { display: flex; align-items: center; gap: 9px; padding: 10px 14px; border: 1px solid var(--border-2); border-radius: 12px; background: var(--surface); font-size: 12.5px; font-weight: 700; color: var(--ink-2); }

.us-feature-check { width: 20px; height: 20px; border-radius: 50%; background: var(--green-soft); color: var(--green); display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; }
