@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: #ECEDF6;
  --surface: #ECEDF6;
  --surface-2: #F3F4FB;
  --border: transparent;
  --border-2: rgba(46, 49, 80, 0.09);
  --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-sm: 12px;
  --radius: 16px;
  --radius-lg: 24px;
  --radius-pill: 999px;
  --nm-dark: rgba(158, 162, 202, 0.46);
  --nm-light: rgba(255, 255, 255, 0.92);
  --nm-out: 5px 5px 14px var(--nm-dark), -5px -5px 14px var(--nm-light);
  --nm-out-sm: 3px 3px 8px var(--nm-dark), -3px -3px 8px var(--nm-light);
  --nm-in: inset 3px 3px 7px var(--nm-dark), inset -3px -3px 7px var(--nm-light);
  --nm-in-sm: inset 2px 2px 5px var(--nm-dark), inset -2px -2px 5px var(--nm-light);
  --shadow-sm: var(--nm-out-sm);
  --shadow-md: var(--nm-out);
  --shadow-lg: 0 18px 42px rgba(46, 49, 80, 0.22);
  --track: rgba(158, 162, 202, 0.42);
  --toggle-off: #7C879D;
  --toggle-border: #7C879D;
  --toggle-on: #6C5DD3;
  --toggle-on-border: var(--toggle-on);
  --toggle-knob: #FFFFFF;
  --ease: cubic-bezier(0.4, 0.14, 0.3, 1);
  --glow-1: #3AB6D8;
  --glow-2: #5B8DEF;
  --glow-3: #6C5DD3;
  --glow-4: #D96BA8;
  --glow-shadow: rgba(108, 93, 211, 0.3);

  --bg-2: var(--surface-2);
  --line: var(--border-2);
  --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: var(--bg);
  color: var(--ink);
  font-size: 14px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  transition: background 0.3s var(--ease), color 0.3s var(--ease);
}

::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: 244px;
  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(--bg);
  border: none;
  border-radius: var(--radius-lg);
  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: 10px; overflow-y: auto; padding: 4px 3px; margin: -2px -3px; scrollbar-width: none; -ms-overflow-style: none; }
.sidebar-nav::-webkit-scrollbar { display: none; }

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 15px;
  border: none;
  border-radius: var(--radius);
  background: var(--bg);
  box-shadow: var(--nm-out-sm);
  color: var(--ink-2);
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  transition: color 0.2s var(--ease), box-shadow 0.2s var(--ease), transform 0.2s var(--ease);
  position: relative;
}

.nav-item:hover { color: var(--ink); transform: translateY(-1px); }

.nav-item.active {
  background: var(--bg);
  color: var(--accent);
  font-weight: 800;
  box-shadow: var(--nm-in-sm);
  transform: none;
}

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

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

.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: 50%;
  overflow: hidden;
  flex-shrink: 0;
  background: var(--surface-2);
  box-shadow: var(--nm-out-sm);
}

.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 i { font-style: normal; position: relative; }
.user-avatar.avatar-sm .avatar-letter { font-size: 11px; }

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

.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;
  gap: 14px;
  padding: 14px 0 4px;
  margin-bottom: 22px;
}

.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(4px); }
  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(--bg);
  border: none;
  border-radius: var(--radius-lg);
  box-shadow: var(--nm-out);
  transition: box-shadow 0.22s var(--ease);
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding: 18px 22px 14px;
  border-bottom: 1px solid var(--border-2);
}

.card-title { font-size: 14.5px; font-weight: 800; }
.card-body { padding: 20px 22px 22px; }
.card-stack > .card + .card { margin-top: 20px; }

.stat-card {
  background: var(--bg);
  border: none;
  border-radius: var(--radius-lg);
  padding: 20px 22px 18px;
  position: relative;
  box-shadow: var(--nm-out);
  transition: transform 0.25s var(--ease), box-shadow 0.25s var(--ease);
}

.stat-card:hover { transform: translateY(-2px); }

.stat-icon {
  position: absolute;
  inset-inline-end: 18px;
  top: 18px;
  width: 42px;
  height: 42px;
  border-radius: var(--radius);
  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));
}

.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; }
.stat-sub-inline, .kpi-delay-badge, .kpi-delay-seg-num, .kpi-delay-stat-num { font-variant-numeric: tabular-nums; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: none;
  border-radius: var(--radius-pill);
  font-family: inherit;
  font-size: 13px;
  font-weight: 700;
  padding: 11px 20px;
  background: var(--bg);
  color: var(--ink-2);
  box-shadow: var(--nm-out-sm);
  cursor: pointer;
  transition: color 0.2s var(--ease), transform 0.2s var(--ease), box-shadow 0.2s var(--ease);
  white-space: nowrap;
}

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

.btn-primary {
  background: linear-gradient(140deg, var(--accent-2), var(--accent));
  color: #fff;
  box-shadow: var(--nm-out-sm);
}

.btn-primary:hover { color: #fff; }

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

.btn-secondary { color: var(--ink); }
.btn-secondary:hover { color: var(--accent); }

.btn-danger { color: var(--red-dark); }
.btn-danger:hover { color: var(--red-dark); }

.btn-ghost { background: transparent; box-shadow: none; color: var(--ink-2); }
.btn-ghost:hover { color: var(--accent); background: var(--surface-2); transform: none; }
.btn-ghost:active { box-shadow: none; }

.btn-sm { padding: 8px 15px; font-size: 12px; }

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

.btn-icon {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: none;
  background: var(--bg);
  color: var(--ink-2);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: var(--nm-out-sm);
  transition: color 0.2s var(--ease), box-shadow 0.2s var(--ease), transform 0.2s var(--ease);
}

.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 12px;
  border-radius: var(--radius-pill);
  font-size: 11px;
  font-weight: 700;
  border: none;
}

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

.table-wrap {
  background: transparent;
  border: none;
  border-radius: var(--radius-lg);
  overflow-x: auto;
  padding: 5px;
  margin: -5px;
  box-shadow: none;
}

.table { width: 100%; border-collapse: separate; border-spacing: 0 10px; }

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

.table td {
  padding: 14px 20px;
  border-bottom: none;
  background: var(--bg);
  font-size: 13.5px;
  vertical-align: middle;
}

.table tbody tr { box-shadow: var(--nm-out-sm); border-radius: var(--radius); }
.table tbody tr td:first-child { border-start-start-radius: var(--radius); border-end-start-radius: var(--radius); }
.table tbody tr td:last-child { border-start-end-radius: var(--radius); border-end-end-radius: var(--radius); }
.table tbody tr td { transition: background 0.16s var(--ease); }
.table tbody tr:hover td { background: var(--surface-2); }

.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: 12px 16px;
  border-radius: var(--radius);
  border: 1px solid var(--border-2);
  background: var(--surface-2);
  box-shadow: none;
  font-family: inherit;
  font-size: 13.5px;
  color: var(--ink);
  transition: border-color 0.2s var(--ease), box-shadow 0.2s var(--ease);
  resize: vertical;
}

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

.form-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

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

.time-chip {
  display: inline-block;
  direction: ltr;
  unicode-bidi: isolate;
  font-family: 'SF Mono', 'Fira Code', Consolas, monospace;
  font-size: 12.5px;
  font-weight: 700;
  letter-spacing: 0.6px;
  color: var(--ink);
  background: var(--surface-2);
  box-shadow: var(--nm-in-sm);
  border-radius: 9px;
  padding: 4px 10px;
  min-width: 58px;
  text-align: center;
}
.time-chip.empty { color: var(--ink-3); font-weight: 600; box-shadow: none; background: transparent; }

.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: 28px;
  height: 28px;
  border: none;
  background: var(--track);
  color: var(--ink-3);
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.2s var(--ease), background 0.2s var(--ease);
}

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

.toggle { display: inline-flex; align-items: center; gap: 9px; cursor: pointer; position: relative; }
.toggle input {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  border: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.toggle-track,
.ap-switch {
  position: relative;
  flex-shrink: 0;
  border-radius: var(--radius-pill);
  background: var(--toggle-off);
  box-shadow: inset 0 0 0 1px var(--toggle-border);
  transition: background 0.2s var(--ease), box-shadow 0.2s var(--ease);
}

.toggle-track { width: 44px; height: 24px; }

.toggle-thumb,
.ap-knob {
  position: absolute;
  border-radius: 50%;
  background: var(--toggle-knob);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
  transition: inset-inline-start 0.18s var(--ease);
}

.toggle-thumb {
  top: 3px;
  inset-inline-start: 3px;
  width: 18px;
  height: 18px;
}

.toggle input:is(:checked, :indeterminate) + .toggle-track,
.ap-always.checked .ap-switch {
  background: var(--toggle-on);
  box-shadow: inset 0 0 0 1px var(--toggle-on-border);
}

.toggle input:checked + .toggle-track .toggle-thumb { inset-inline-start: calc(100% - 21px); }
.toggle input:indeterminate + .toggle-track .toggle-thumb { inset-inline-start: calc(50% - 9px); }
.toggle input:indeterminate + .toggle-track .toggle-thumb::after {
  content: '';
  position: absolute;
  width: 9px;
  height: 2px;
  top: 8px;
  left: 4.5px;
  border-radius: 1px;
  background: var(--toggle-on);
}
.toggle input:focus-visible + .toggle-track { outline: 2px solid var(--accent); outline-offset: 3px; }
.toggle:has(input:disabled) { cursor: not-allowed; }
.toggle input:disabled + .toggle-track { opacity: 0.55; }

@media (prefers-reduced-motion: reduce) {
  .toggle-track, .toggle-thumb, .ap-switch, .ap-knob { transition: none; }
}

.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-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 12px; align-items: stretch; }
.toggle-grid > .toggle-row {
  border-bottom: none;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 14px;
  background: var(--surface-2);
  box-shadow: var(--nm-in-sm);
  align-items: center;
}
.toggle-grid > .toggle-row > label:first-child { flex: 1; min-width: 0; }
.toggle-grid > .toggle-row > .toggle { flex-shrink: 0; }
.toggle-row > label:first-child {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--ink-2);
  line-height: 1.6;
}

.prompt-hint {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 8px;
  font-size: 12px;
  color: var(--ink-3);
}

.prompt-new-btn {
  padding: 4px 12px;
  font-size: 12px;
  white-space: nowrap;
}

.toggle-cards {
  display: flex;
  align-items: stretch;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 14px;
}

.toggle-card {
  flex: 1 1 240px;
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 11px 14px;
  border-radius: 14px;
  background: var(--surface);
  box-shadow: var(--nm-out-sm);
  transition: box-shadow 0.2s;
}

.toggle-card > .toggle { flex: 1; min-width: 0; }
.toggle-card .toggle-label { color: var(--ink-2); }
.toggle-card:has(input:checked) .toggle-label { color: var(--ink); }

.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: 10px 14px;
  border-radius: var(--radius);
  border: none;
  background: var(--bg);
  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); }

.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); }

.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);
}

.sep { height: 0; border-top: 1px solid var(--border-2); margin: 18px 0; background: none; }

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(28, 30, 48, 0.42);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
  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(--bg);
  border: none;
  border-radius: var(--radius-lg);
  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(8px); }
  to { opacity: 1; transform: translateY(0); }
}

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

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

.modal-close {
  width: 34px;
  height: 34px;
  border: none;
  border-radius: 50%;
  background: var(--bg);
  box-shadow: var(--nm-out-sm);
  color: var(--ink-2);
  font-size: 17px;
  cursor: pointer;
  transition: color 0.2s var(--ease), box-shadow 0.2s var(--ease);
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-close:hover { color: var(--red); }
.modal-close:active { box-shadow: var(--nm-in-sm); }

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

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

.empty-state { display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center; padding: 44px 20px; }
.empty-icon {
  display: grid;
  place-items: center;
  width: 62px;
  height: 62px;
  margin-bottom: 8px;
  border-radius: 50%;
  background: var(--bg);
  box-shadow: var(--nm-in-sm);
  color: var(--ink-3);
  font-size: 26px;
  opacity: 1;
}
.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(--bg);
  color: var(--ink);
  border: none;
  border-radius: var(--radius);
  padding: 13px 20px;
  font-size: 13.5px;
  font-weight: 700;
  box-shadow: var(--nm-out);
  direction: rtl;
  animation: toast-in 0.3s var(--ease);
  max-width: 90vw;
}

.toast svg { flex-shrink: 0; }

.toast-success { color: var(--green-dark); }
.toast-error { color: var(--red-dark); }
.toast-info { color: var(--sky-dark); }

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

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

.tabs {
  display: inline-flex;
  gap: 6px;
  background: var(--bg);
  border: none;
  border-radius: var(--radius-pill);
  padding: 6px;
  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 17px;
  border-radius: var(--radius-pill);
  cursor: pointer;
  transition: color 0.2s var(--ease), box-shadow 0.2s var(--ease);
}

.tab-btn:hover { color: var(--accent-dark); }
.tab-btn.active {
  background: var(--bg);
  color: var(--accent);
  box-shadow: var(--nm-out-sm);
}

.channel-card {
  background: var(--bg);
  border: none;
  border-radius: var(--radius-lg);
  padding: 20px;
  cursor: pointer;
  box-shadow: var(--nm-out);
  transition: transform 0.25s var(--ease), box-shadow 0.25s var(--ease);
  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(-2px);
  box-shadow: var(--nm-out);
}

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

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

.adv-section {
  background: var(--bg);
  border: none;
  box-shadow: var(--nm-in-sm);
  border-radius: var(--radius);
  padding: 16px 18px 6px;
  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; min-height: 100dvh; 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; }
.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; }

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

.login-box {
  width: 100%;
  max-width: 404px;
  background: var(--bg);
  border: none;
  border-radius: var(--radius-lg);
  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 { }
.brand .brand-mark svg path + path { animation-delay: 0.35s; }

@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: 13px; padding-bottom: 13px; border-radius: var(--radius); }

.login-btn {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 14px;
  border: none;
  border-radius: var(--radius-pill);
  background: linear-gradient(140deg, var(--accent-2), var(--accent));
  color: #fff;
  font-family: inherit;
  font-size: 14px;
  font-weight: 800;
  cursor: pointer;
  box-shadow: var(--nm-out-sm);
  transition: transform 0.2s var(--ease), box-shadow 0.2s var(--ease);
  margin-top: 6px;
}

.login-btn:hover {
  transform: translateY(-1px);
  box-shadow: var(--nm-out-sm);
}

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

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

.login-error {
  display: none;
  background: var(--red-soft);
  color: var(--red-dark);
  border: none;
  box-shadow: none;
  border-radius: var(--radius);
  padding: 12px 15px;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 16px;
}

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

@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-page { height: 100vh; height: 100dvh; }
  .login-side { flex: 1; overflow-y: auto; }
}

@media (max-width: 820px) {
  .layout { flex-direction: column; }
  .main-content { padding: 8px 16px 40px; }
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .toggle-grid { grid-template-columns: 1fr; gap: 10px; }
}
.topbar-start { display: flex; align-items: center; gap: 10px; min-width: 0; }
.menu-btn { display: none; width: 42px; height: 42px; border: none; border-radius: 50%; background: var(--bg); box-shadow: var(--nm-out-sm); color: var(--ink-2); cursor: pointer; align-items: center; justify-content: center; flex-shrink: 0; transition: color 0.2s var(--ease), box-shadow 0.2s var(--ease); }
.menu-btn:hover { color: var(--accent); }
.menu-btn:active { box-shadow: var(--nm-in-sm); }
.sidebar-backdrop { display: none; position: fixed; inset: 0; z-index: 130; background: rgba(28, 30, 48, 0.42); opacity: 0; pointer-events: none; transition: opacity 0.25s ease; }
.sidebar-backdrop.open { opacity: 1; pointer-events: auto; }

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

.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-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); }
.feed-dot.duplicate { background: var(--amber); }
.feed-dot.error { background: var(--red); }
.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; }
.chan-activity-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 18px; }
.chan-activity-grid .feed-row { min-width: 0; }
.chan-activity-grid .feed-row:nth-last-child(2):nth-child(odd) { border-bottom: none; }

.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 { 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: 14px;
  padding: 9px 16px;
  transition: all 0.18s ease;
}
.msg-chip:hover { color: var(--ink); }
.msg-chip.active {
  color: #fff;
  background: var(--accent);
  box-shadow: var(--nm-out-sm);
}

.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: 14px;
  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); }
.msg-status-dot.duplicate { background: var(--amber); }
.msg-status-dot.error { background: var(--red); }
.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: 14px;
  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: 14px;
  padding: 3px 9px;
}
.msg-time { font-size: 11.5px; color: var(--ink-3); margin-inline-start: auto; flex-shrink: 0; }
.time-stamp { display: inline-flex; flex-direction: column; align-items: flex-end; gap: 1px; line-height: 1.35; }
.time-clock { font-size: 12px; font-weight: 800; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.time-date { font-size: 10px; font-weight: 600; color: var(--ink-3); }
.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: 14px;
  background: repeating-linear-gradient(180deg, rgba(142, 126, 242, 0.55) 0 6px, rgba(142, 126, 242, 0.12) 6px 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 { }
.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: var(--nm-out-sm);
}
.pipe-node.right::before { left: -34px; }
.pipe-node.left::before { right: -34px; }
.pipe-node.error::before { background: var(--red); }
.pipe-node.duplicate::before { background: var(--amber); }
.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 { }
.pipe-icon svg { width: 15px; height: 15px; }
.pipe-logo { max-width: 100%; max-height: 100%; object-fit: contain; }
.pipe-icon .pipe-logo { width: 20px; height: 20px; object-fit: contain; }
.pipe-node.error .pipe-icon { color: var(--red); box-shadow: var(--nm-out-sm); }
.pipe-node.duplicate .pipe-icon { color: var(--amber); box-shadow: var(--nm-out-sm); }
.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: 14px;
  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 { }

.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: 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-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;
  flex-wrap: wrap;
  max-width: 100%;
  gap: 8px;
  align-items: center;
}

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

.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: 14px;
  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);
}

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

  .kpi-filter-bar {
    display: grid;
    grid-template-columns: 1fr;
    align-items: stretch;
  }

  .kpi-filter-bar .msg-status-chips {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
  }

  .kpi-date-inputs {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
  }

  .kpi-date-inputs .form-input,
  .kpi-date-inputs .btn {
    width: 100%;
    max-width: none;
  }

  .msg-filters {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
  }

  .msg-filters .msg-search-wrap,
  .msg-filters .msg-date-range {
    grid-column: 1 / -1;
  }

  .msg-filters .msg-select,
  .msg-filters .msg-chip {
    width: 100%;
    min-width: 0;
  }

  .msg-date-range {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
  }

  .msg-date-range .form-input {
    width: 100%;
  }

  .msg-date-range .btn {
    grid-column: 1 / -1;
  }

  .section-header > div {
    width: 100%;
    max-width: none;
  }

  .section-header > div > .btn {
    flex: 1 1 auto;
    justify-content: center;
  }

  .msg-chip {
    text-align: center;
  }
}

.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: 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-actions { display: flex; gap: 8px; margin-top: 14px; }

.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: var(--track); border-radius: var(--radius-pill); border: 3px solid var(--bg); }
::-webkit-scrollbar-thumb:hover { background: var(--ink-3); }
.table tbody tr:hover td { background: var(--surface-2); }
.btn:active { transform: none; }
.toast-info { color: var(--sky-dark); }

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

.msg-status-dot.error { background: var(--err); }
.msg-status-dot.duplicate { background: var(--yellow); }
.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); }
.feed-dot.duplicate { background: var(--yellow); }
.pipe-node.error .pipe-icon { color: var(--err); box-shadow: var(--nm-out-sm); }
.pipe-node.duplicate .pipe-icon { color: var(--yellow-dark); box-shadow: var(--nm-out-sm); }
.pipe-node.final.duplicate .pipe-icon { color: #fff; }
.pipe-node.final.error .pipe-icon { color: #fff; }

.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: 44px;
  height: 44px;
  border: none;
  border-radius: 50%;
  background: var(--bg);
  box-shadow: var(--nm-out-sm);
  color: var(--ink-2);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.2s var(--ease), box-shadow 0.2s var(--ease);
}
.notif-btn:hover { color: var(--accent); }
.notif-btn:active, .notif-btn.open { color: var(--accent); box-shadow: var(--nm-in-sm); }
.notif-btn.has-alerts { color: var(--accent); }
.notif-badge {
  position: absolute;
  top: -3px;
  inset-inline-end: -3px;
  min-width: 17px;
  height: 17px;
  border-radius: 14px;
  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(46, 49, 80, 0.22);
}
.notif-panel {
  position: absolute;
  top: calc(100% + 10px);
  inset-inline-end: 0;
  width: 330px;
  max-height: 380px;
  overflow-y: auto;
  background: var(--bg);
  border-radius: var(--radius-lg);
  box-shadow: var(--nm-out);
  padding: 12px;
  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: var(--radius);
  box-shadow: var(--nm-out-sm);
  padding: 11px 13px;
  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-delay-hero { margin-bottom: 18px; }
.kpi-delay-card { display: inline-flex; align-items: center; gap: 12px; max-width: 100%; padding: 12px 16px; border-radius: 16px; background: var(--surface); box-shadow: var(--nm-out-sm); }
.kpi-delay-icon { display: inline-flex; align-items: center; justify-content: center; flex: 0 0 36px; width: 36px; height: 36px; border-radius: 11px; background: var(--accent-soft); color: var(--accent); }
.kpi-delay-content { min-width: 0; }
.kpi-delay-title { font-size: 13px; font-weight: 700; color: var(--ink-2); line-height: 1.7; }
.kpi-delay-value { display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 12px; margin-top: 2px; }
.kpi-delay-seg { display: inline-flex; align-items: baseline; gap: 5px; }
.kpi-delay-seg-num { font-size: 23px; font-weight: 800; line-height: 1.4; color: var(--accent); font-variant-numeric: tabular-nums; }
.kpi-delay-seg-unit { font-size: 13px; font-weight: 600; color: var(--ink-2); white-space: nowrap; }
.kpi-delay-empty { font-size: 13px; font-weight: 600; color: var(--ink-2); line-height: 1.8; }
@media (max-width: 480px) {
  .kpi-delay-card { gap: 10px; padding: 10px 14px; }
  .kpi-delay-value { column-gap: 10px; }
}

.kpi-chart-hint { font-size: 11.5px; color: var(--ink-3); margin-bottom: 10px; }
.kpi-card-tools { display: flex; align-items: center; gap: 8px; }
.kpi-expand-btn { width: 34px; height: 34px; border: 0; border-radius: 11px; display: inline-flex; align-items: center; justify-content: center; background: var(--surface-2); color: var(--ink-2); box-shadow: var(--nm-out-sm); cursor: pointer; transition: color 0.2s ease, transform 0.2s ease; }
.kpi-expand-btn:hover { color: var(--accent); }
.kpi-expand-btn:active { transform: scale(0.97); box-shadow: var(--nm-in-sm); }
.kpi-chart-box { position: relative; }
.kpi-fullscreen-backdrop { position: fixed; inset: 0; z-index: 900; background: rgba(46, 49, 80, 0.45); backdrop-filter: blur(3px); opacity: 0; pointer-events: none; transition: opacity 0.2s ease; }
.kpi-fullscreen-backdrop.open { opacity: 1; pointer-events: auto; }
body.kpi-fullscreen-open { overflow: hidden; }
.card.kpi-fullscreen { position: fixed; inset: 18px; z-index: 901; margin: 0 !important; display: flex; flex-direction: column; overflow: hidden; }
.card.kpi-fullscreen .card-body { flex: 1; min-height: 0; display: flex; flex-direction: column; overflow: auto; }
.card.kpi-fullscreen .kpi-chart-box { flex: 1; height: auto !important; min-height: 260px; }
.kpi-chart-more { display: flex; justify-content: center; margin-top: 12px; }
.kpi-more-btn { display: inline-flex; align-items: center; gap: 8px; padding: 8px 16px; border: 0; border-radius: 14px; font-family: inherit; font-size: 12px; font-weight: 700; background: var(--surface-2); color: var(--ink-2); box-shadow: var(--nm-out-sm); cursor: pointer; transition: color 0.2s ease, transform 0.2s ease; }
.kpi-more-btn:hover { color: var(--accent); }
.kpi-more-btn:active { transform: scale(0.97); box-shadow: var(--nm-in-sm); }
.kpi-more-btn.open { color: var(--accent); }
.admins-empty { grid-column: 1 / -1; text-align: center; color: var(--ink-3); font-size: 13px; font-weight: 600; padding: 30px; }
.admin-meta { display: flex; flex-direction: column; gap: 10px; margin-top: 14px; padding: 12px 14px; border-radius: 14px; background: var(--bg); box-shadow: var(--nm-in-sm); }
.admin-meta-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; font-size: 12px; }
.admin-meta-label { color: var(--ink-3); font-weight: 700; }
.admin-meta-value { color: var(--ink-2); font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (max-width: 720px) { .card.kpi-fullscreen { inset: 8px; } }
.kpi-point-info {
  margin-top: 14px;
  background: var(--bg);
  border-radius: 14px;
  box-shadow: var(--nm-in-sm);
  padding: 14px 16px;
}
.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: 14px;
  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-marker-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 16px;
  padding: 10px 14px;
  border-radius: 12px;
  background: var(--bg);
  box-shadow: var(--nm-in-sm);
  font-size: 13px;
}
#kpi-marker-modal [hidden] { display: none; }
.kpi-marker-meta span { color: var(--ink-2); font-size: 12.5px; }
.kpi-marker-empty { color: var(--ink-3); font-size: 12.5px; line-height: 1.9; }
.kpi-point-links { display: flex; gap: 10px; flex-wrap: wrap; }
.kpi-point-nolink { color: var(--ink-3); font-size: 12px; }

.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); 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: 14px;
  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 { }

.jdp {
  position: absolute;
  z-index: 300;
  width: 272px;
  background: var(--bg);
  border-radius: var(--radius-lg);
  box-shadow: var(--nm-out);
  border: none;
  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-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 {
  box-shadow: var(--nm-out-sm);
}

.np-lib-icon {
  width: 52px;
  height: 52px;
  border-radius: 12px;
  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-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 {
  box-shadow: var(--nm-out-sm);
}

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

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

.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: 14px;
  white-space: nowrap;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
}

.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-2);
  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: var(--nm-out-sm);
}

.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: 14px; 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); }

.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: var(--nm-out-sm);
  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 {
  box-shadow: var(--nm-out-sm);
}

.kpi-choice-icon {
  width: 54px;
  height: 54px;
  border-radius: 12px;
  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;
}

.nav-count {
  margin-inline-start: auto;
  min-width: 22px;
  padding: 2px 7px;
  border-radius: 12px;
  background: var(--red-soft);
  color: var(--red-dark);
  font-size: 11px;
  font-weight: 800;
  text-align: center;
}

.er-toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.er-filter { width: auto; min-width: 150px; }

.er-search { flex: 1; min-width: 200px; }

.er-list { display: flex; flex-direction: column; gap: 14px; }

.er-card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--nm-out);
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.er-card.resolved { opacity: 0.66; }

.er-head {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.er-chip {
  padding: 3px 10px;
  border-radius: 14px;
  font-size: 10.5px;
  font-weight: 700;
}

.er-chip.error { color: var(--red-dark); background: var(--red-soft); }

.er-chip.warning { color: var(--amber-dark); background: var(--amber-soft); }

.er-chip.plain { color: var(--ink-2); background: var(--bg); }

.er-user { font-size: 12.5px; font-weight: 800; color: var(--accent); }

.er-time { margin-inline-start: auto; font-size: 11.5px; color: var(--ink-3); }

.er-message {
  font-size: 13px;
  line-height: 1.9;
  color: var(--ink);
  word-break: break-word;
}

.er-meta { display: flex; gap: 14px; flex-wrap: wrap; font-size: 11.5px; color: var(--ink-3); }

.er-details {
  margin: 0;
  padding: 12px 14px;
  border-radius: var(--radius);
  background: var(--bg);
  box-shadow: var(--nm-in-sm);
  font-family: 'SF Mono', 'Fira Code', Consolas, monospace;
  font-size: 11.5px;
  line-height: 1.8;
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 260px;
  overflow: auto;
  direction: ltr;
  text-align: left;
}

.er-actions { display: flex; gap: 10px; flex-wrap: wrap; }

.er-empty {
  padding: 40px 20px;
  text-align: center;
  font-size: 13px;
  color: var(--ink-3);
}

.er-more { display: flex; justify-content: center; margin-top: 18px; }

.settings-hub {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr));
  grid-auto-rows: 1fr;
  gap: 16px;
}

.settings-hub[hidden] { display: none; }

.settings-hub-card {
  height: 100%;
  min-height: 132px;
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  padding: 20px 22px;
  border: none;
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--nm-out);
  font-family: inherit;
  color: var(--ink);
  text-align: start;
  cursor: pointer;
  transition: transform 0.18s, box-shadow 0.18s;
}

.settings-hub-card:hover {
  transform: translateY(-2px);
  box-shadow: inset 0 0 0 1px var(--accent-soft), var(--nm-out);
}

.settings-hub-card:focus-visible {
  outline: none;
  box-shadow: inset 0 0 0 1px var(--accent), 0 0 0 3px var(--accent-soft);
}

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

.settings-hub-body {
  display: flex;
  flex-direction: column;
  gap: 5px;
  flex: 1;
  min-width: 0;
}

.settings-hub-name { font-size: 14.5px; font-weight: 800; }

.settings-hub-desc { font-size: 12px; color: var(--ink-2); line-height: 1.85; }

.settings-hub-arrow { flex-shrink: 0; color: var(--ink-3); display: flex; }

.settings-section[hidden] { display: none; }

.settings-section-head {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}

.settings-back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 14px;
  border: none;
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--nm-out-sm);
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 700;
  color: var(--ink-2);
  cursor: pointer;
  transition: color 0.18s, box-shadow 0.18s;
}

.settings-back:hover { color: var(--accent); }

.settings-back:focus-visible {
  outline: none;
  box-shadow: inset 0 0 0 1px var(--accent), 0 0 0 3px var(--accent-soft);
}

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

.settings-section-title svg { color: var(--accent); }

.kpi-scope-panel {
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--nm-out);
  padding: 20px 22px;
  margin-bottom: 20px;
}

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

.kpi-scope-modes-single { grid-template-columns: minmax(0, 1fr); }

.kpi-scope-mode {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  width: 100%;
  padding: 16px 18px;
  border: none;
  border-radius: var(--radius-lg);
  background: var(--bg);
  box-shadow: var(--nm-in-sm);
  font-family: inherit;
  color: var(--ink);
  text-align: start;
  cursor: pointer;
  transition: transform 0.18s, box-shadow 0.18s;
}

.kpi-scope-mode:hover:not(:disabled):not(.active) {
  transform: translateY(-1px);
  box-shadow: inset 0 0 0 1px var(--accent-soft), var(--nm-out-sm);
}

.kpi-scope-mode:focus-visible {
  outline: none;
  box-shadow: inset 0 0 0 1px var(--accent), 0 0 0 3px var(--accent-soft);
}

.kpi-scope-mode:disabled { cursor: not-allowed; opacity: 0.55; }

.kpi-scope-mode-static { cursor: default; }

.kpi-scope-mode.active {
  background: var(--surface);
  box-shadow: inset 0 0 0 1.5px var(--accent), var(--nm-out-sm);
}

.kpi-scope-mode-icon {
  width: 42px;
  height: 42px;
  flex-shrink: 0;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--surface-2);
  color: var(--ink-3);
  transition: background 0.18s, color 0.18s;
}

.kpi-scope-mode.active .kpi-scope-mode-icon { background: var(--accent-soft); color: var(--accent); }

.kpi-scope-mode-body {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
  min-width: 0;
}

.kpi-scope-mode-name { font-size: 14px; font-weight: 800; }

.kpi-scope-mode.active .kpi-scope-mode-name { color: var(--accent-dark); }

.kpi-scope-mode-desc { font-size: 12px; color: var(--ink-2); line-height: 1.85; }

@media (max-width: 560px) { .kpi-scope-panel { padding: 16px; } }

.kpi-scope-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 24px; flex-wrap: wrap; }
.kpi-scope-heading { min-width: 0; }
.kpi-scope-title { font-size: 16px; font-weight: 800; }
.kpi-scope-description { margin-top: 5px; font-size: 13px; color: var(--ink-2); line-height: 1.8; }
.kpi-scope-field { flex: 0 1 280px; min-width: 200px; max-width: 100%; }
.kpi-scope-field label { display: block; margin-bottom: 7px; font-size: 13px; font-weight: 700; color: var(--ink-2); }
.kpi-scope-select-wrap { position: relative; }
.form-input.kpi-scope-select { width: 100%; min-height: 44px; padding: 8px 14px; padding-inline-end: 38px; appearance: none; font-size: 14px; font-weight: 700; line-height: 1.6; color: var(--ink); border: 1px solid var(--accent); background: var(--bg); }
select.form-input.kpi-scope-select, select.form-input.kpi-scope-select:focus { background-image: none; }
.kpi-scope-chevron { position: absolute; inset-inline-end: 16px; top: 50%; transform: translateY(-50%); display: flex; color: var(--accent); pointer-events: none; }
.kpi-results { position: relative; min-height: 260px; }
.kpi-result-status { position: absolute; inset: 0 0 auto; padding: 24px; border-radius: var(--radius-lg); background: var(--surface); border: 1px solid var(--border-2); }
.kpi-result-status[hidden], .kpi-result-status button[hidden] { display: none; }
.kpi-result-message { font-size: 14px; font-weight: 700; color: var(--ink-2); line-height: 1.9; }
.kpi-result-skeleton { display: grid; gap: 14px; margin-top: 20px; }
.kpi-result-skeleton span { display: block; height: 18px; border-radius: 8px; background: var(--surface-2); }
.kpi-result-skeleton span:nth-child(1) { width: 38%; }
.kpi-result-skeleton span:nth-child(2) { height: 96px; }
.kpi-result-skeleton span:nth-child(3) { width: 64%; }
.kpi-results.is-loading > .kpi-result-content, .kpi-results.is-error > .kpi-result-content { visibility: hidden; }
.kpi-results.is-error .kpi-result-skeleton { display: none; }
.kpi-result-status .btn { margin-top: 16px; }
@media (prefers-reduced-motion: no-preference) {
  .kpi-results.is-loading .kpi-result-skeleton { animation: kpi-loading-pulse 1.4s ease-in-out infinite alternate; }
}
@keyframes kpi-loading-pulse { from { opacity: 0.45; } to { opacity: 1; } }
@media (max-width: 560px) {
  .kpi-scope-toolbar { gap: 16px; }
  .kpi-scope-field { flex-basis: 100%; min-width: 0; }
  .kpi-result-status { padding: 20px 16px; }
}

.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-admin-table-wrap { overflow-x: auto; }
.kpi-admin-sort {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 0;
  border: none;
  border-radius: 4px;
  background: transparent;
  color: inherit;
  font: inherit;
  white-space: nowrap;
  cursor: pointer;
}
.kpi-admin-sort svg { flex-shrink: 0; }
.kpi-admin-sort:hover { color: var(--accent); }
.kpi-admin-sort:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.kpi-admin-table-wrap th[aria-sort="ascending"],
.kpi-admin-table-wrap th[aria-sort="descending"] { color: var(--accent); }
.kpi-admin-table-wrap th[aria-sort="ascending"] .kpi-sort-desc,
.kpi-admin-table-wrap th[aria-sort="descending"] .kpi-sort-asc { opacity: 0.25; }

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

.channel-grid { grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); }
.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); }
.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); }
.msg-card.status-direct::before { background: var(--sky); opacity: 1; }
.msg-status-dot.direct { background: var(--sky); }
.msg-badge-direct { color: var(--sky-dark); background: var(--sky-soft); }
.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 { }

.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 { width: 44px; height: 24px; }

.ap-knob {
  top: 3px;
  inset-inline-start: 3px;
  width: 18px;
  height: 18px;
}

.ap-always.checked .ap-knob { inset-inline-start: calc(100% - 21px); }

.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-head { display: flex; align-items: center; gap: 9px; margin-bottom: 12px; }
.platform-note { font-size: 11.5px; color: var(--ink-3); margin-top: 6px; }

.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: 14px; 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: var(--nm-out-sm); }
.wiz-step-tab.active .wiz-step-num { background: var(--accent); color: #fff; box-shadow: var(--nm-out-sm); }
.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: var(--nm-out-sm); cursor: grab; transition: transform 0.25s ease, box-shadow 0.25s ease; }
.wiz-chip:hover { border-color: var(--accent); }
.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-icon .pipe-logo { width: 20px; height: 20px; border-radius: 6px; object-fit: contain; }
.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: var(--nm-out-sm); }
.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: 14px; 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: var(--nm-in-sm); 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: var(--nm-in-sm); }
.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: var(--nm-out-sm); }
.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-icon .pipe-logo { width: 18px; height: 18px; border-radius: 6px; object-fit: contain; }
.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); }

.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; }

.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: var(--nm-out-sm); 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; }

@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; }
.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: var(--nm-out-sm); }
.wmp-mini { position: relative; 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 { position: absolute; width: 9px; height: 9px; border-radius: 50%; background: var(--accent); transform: translate(-50%, -50%); transition: left 0.18s ease, top 0.18s ease; }
.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-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: 14px; padding: 22px; box-shadow: var(--nm-out-sm); 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-stage { position: relative; width: 100%; aspect-ratio: 1 / 1; border-radius: 14px; overflow: hidden; background: linear-gradient(180deg, #8E7EF2 0%, #B7A8F7 45%, #6C5DD3 100%); box-shadow: var(--nm-in-sm); }
.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: var(--nm-out-sm); }
.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-place { display: grid; grid-template-columns: 34px 1fr; grid-template-rows: auto 34px; gap: 8px; }
.wmp-place .wmp-stage { grid-column: 2; grid-row: 1; }
.wmp-axis { display: flex; align-items: center; justify-content: center; }
.wmp-axis-y { grid-column: 1; grid-row: 1; position: relative; align-self: stretch; }
.wmp-axis-x { grid-column: 2; grid-row: 2; width: 100%; }
.wmp-axis input[type="range"] { -webkit-appearance: none; appearance: none; width: 100%; height: 6px; border-radius: 14px; background: linear-gradient(90deg, var(--accent-soft), rgba(108, 93, 211, 0.45)); box-shadow: var(--nm-in-sm); outline: none; cursor: pointer; }
.wmp-axis-y input[type="range"] { position: absolute; top: 0; left: 50%; transform: translateX(-50%); margin: 0; writing-mode: vertical-lr; direction: ltr; width: 6px; height: 100%; background: linear-gradient(0deg, var(--accent-soft), rgba(108, 93, 211, 0.45)); }
.wmp-axis input[type="range"]::-webkit-slider-thumb { -webkit-appearance: none; appearance: none; width: 20px; height: 20px; border-radius: 50%; background: var(--accent); border: 2px solid #fff; box-shadow: var(--nm-out-sm); cursor: grab; }
.wmp-axis input[type="range"]::-webkit-slider-thumb:active { cursor: grabbing; transform: scale(1.1); }
.wmp-axis input[type="range"]::-moz-range-thumb { width: 20px; height: 20px; border-radius: 50%; background: var(--accent); border: 2px solid #fff; box-shadow: var(--nm-out-sm); cursor: grab; }
.wmp-axis-values { display: flex; justify-content: space-between; gap: 10px; margin-top: 10px; font-size: 12px; font-weight: 700; color: var(--ink-2); }
.wmp-axis-values 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; }
.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 { }
.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: 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 { filter: brightness(1.05); }

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

.channel-access-guide { margin-top: 10px; font-size: 12.5px; line-height: 2.1; color: var(--ink-2); border: none; border-radius: var(--radius); background: var(--bg); box-shadow: var(--nm-in-sm); padding: 14px 16px; }

.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: 14px; background: var(--border-2); overflow: hidden; margin-top: 5px; }
.ov-fill { height: 100%; border-radius: 14px; }

.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: 50%; background: var(--bg); box-shadow: var(--nm-out-sm); color: var(--ink-3); cursor: pointer; transition: color 0.2s var(--ease), box-shadow 0.2s var(--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 .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 .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: var(--accent); background-color: var(--accent); color: #fff; }
.glow-strip {
  height: 4px;
  border-radius: var(--radius-pill);
  margin: 2px 2px 20px;
  background: linear-gradient(
    90deg,
    var(--glow-1),
    var(--glow-2),
    var(--glow-3),
    var(--glow-4),
    var(--glow-3),
    var(--glow-2),
    var(--glow-1)
  );
  background-size: 300% 100%;
  box-shadow: 0 2px 12px var(--glow-shadow);
  animation: glow-flow 6s ease-in-out infinite alternate;
}

@keyframes glow-flow {
  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: 14px; 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; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.llm-count { font-size: 11.5px; font-weight: 700; color: var(--ink-3); }
.llm-add { display: flex; align-items: center; gap: 10px; margin-bottom: 18px; }
.llm-add-input { flex: 1; min-width: 0; padding: 12px 16px; border: 1px solid var(--border-2); border-radius: var(--radius); background: var(--surface-2); color: var(--ink); font-family: 'SF Mono', 'Fira Code', Consolas, monospace; font-size: 12.5px; direction: ltr; text-align: left; outline: none; transition: border-color 0.2s var(--ease), box-shadow 0.2s var(--ease); }
.llm-add-input::placeholder { color: var(--ink-3); }
.llm-add-input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.llm-add .btn { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.llm-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 18px; }
.llm-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--nm-out); padding: 18px; position: relative; overflow: hidden; transition: transform 0.22s cubic-bezier(0.22, 1, 0.36, 1), box-shadow 0.22s; }
.llm-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; }
.llm-card:hover::before { opacity: 1; }
.llm-card-head { display: flex; align-items: center; gap: 11px; margin-bottom: 15px; }
.llm-avatar { width: 38px; height: 38px; flex-shrink: 0; border-radius: 12px; display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 800; letter-spacing: 0.02em; background: var(--surface-2); color: var(--ink-2); box-shadow: var(--nm-out-sm); }
.llm-avatar.openai { background: var(--green-soft); color: var(--green-dark); }
.llm-avatar.google { background: var(--accent-soft); color: var(--accent-dark); }
.llm-avatar.anthropic { background: var(--amber-soft); color: var(--amber-dark); }
.llm-avatar.meta { background: var(--red-soft); color: var(--red-dark); }
.llm-title-box { flex: 1; min-width: 0; }
.llm-title { font-family: 'SF Mono', 'Fira Code', Consolas, monospace; font-size: 13px; font-weight: 700; color: var(--ink); direction: ltr; text-align: start; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.llm-sub { font-size: 11px; font-weight: 600; color: var(--ink-3); margin-top: 3px; }
.llm-price { display: flex; align-items: stretch; background: var(--bg); border-radius: 14px; box-shadow: var(--nm-in-sm); padding: 11px 6px; }
.llm-price-cell { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px; min-width: 0; }
.llm-price-sep { width: 1px; align-self: stretch; background: var(--border-2); }
.llm-price-label { font-size: 10.5px; font-weight: 700; color: var(--ink-3); }
.llm-price-val { font-family: 'SF Mono', 'Fira Code', Consolas, monospace; font-size: 14px; font-weight: 800; color: var(--ink); direction: ltr; }
.llm-price-unit { font-size: 9.5px; font-weight: 600; color: var(--ink-3); }
.llm-price.unknown { justify-content: center; padding: 15px 6px; }
.llm-price-none { font-size: 11.5px; font-weight: 600; color: var(--ink-3); }
.llm-card-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 14px; }
.llm-users { font-size: 11px; font-weight: 700; color: var(--ink-3); }
.llm-actions { display: flex; align-items: center; gap: 7px; }
.llm-act { width: 30px; height: 30px; display: inline-flex; align-items: center; justify-content: center; border: none; border-radius: 10px; background: var(--surface-2); color: var(--ink-2); box-shadow: var(--nm-out-sm); cursor: pointer; text-decoration: none; transition: color 0.16s ease, background 0.16s ease; }
.llm-act:hover { background: var(--accent-soft); color: var(--accent-dark); }
.llm-act.danger:hover { background: var(--red-soft); color: var(--red-dark); }
.llm-empty { grid-column: 1 / -1; text-align: center; padding: 26px 0; font-size: 12.5px; font-weight: 600; color: var(--ink-3); }
@media (max-width: 560px) {
  .llm-grid { grid-template-columns: 1fr; }
  .llm-add { flex-direction: column; align-items: stretch; }
}

.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: 12px; background: var(--bg); box-shadow: var(--nm-in-sm); }
.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: var(--nm-in-sm); }
.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: var(--nm-out-sm); }
.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; align-items: center; justify-content: flex-end; gap: 10px; padding-top: 18px; }
.kpi-set-actions { display: flex; align-items: center; justify-content: flex-end; gap: 10px; padding-top: 16px; }
.kpi-set-test { margin-top: 14px; }
.kpi-set-section { margin-top: 22px; padding-top: 20px; border-top: 1px solid var(--border-2); display: flex; flex-direction: column; gap: 16px; }
.kpi-set-section-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.kpi-set-section-heading { flex: 1 1 280px; min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.kpi-set-section-title { font-size: 14.5px; font-weight: 900; color: var(--ink); }
.kpi-set-section-sub { font-size: 12px; font-weight: 600; line-height: 1.9; color: var(--ink-3); max-width: 62ch; }
.kpi-points-sum {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 3px;
  padding: 10px 16px;
  border-radius: 14px;
  background: var(--bg);
  box-shadow: var(--nm-in-sm);
}
.kpi-points-sum span { font-size: 10.5px; font-weight: 700; color: var(--ink-3); }
.kpi-points-sum b { font-size: 13px; font-weight: 800; color: var(--ink-2); }
.kpi-points-sum b i { font-style: normal; font-size: 16px; font-weight: 900; color: var(--green); font-variant-numeric: tabular-nums; }
.kpi-points-sum.bad b i { color: var(--red); }
.kpi-points-grid .kpi-set-item { gap: 14px; }
.kpi-points-grid .kpi-set-title { align-items: flex-start; line-height: 1.8; }
.kpi-points-grid .kpi-set-ctrl { justify-content: flex-start; }
.kpi-points-grid .kpi-unit-input .form-input { max-width: 88px; }
@media (max-width: 760px) {
  .kpi-set-grid { grid-template-columns: 1fr; }
  .kpi-points-sum { width: 100%; }
}
.profile-menu-wrap { position: relative; }
.profile-trigger { width: 100%; border: none; border-radius: 12px; background: transparent; font-family: inherit; color: var(--ink); text-align: start; cursor: pointer; min-height: 48px; }
.profile-trigger:hover, .profile-trigger[aria-expanded="true"] { background: var(--surface-2); }
.profile-trigger:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.user-identity { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.user-identity .user-name, .user-identity .user-role { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.profile-menu { position: fixed; z-index: 60; width: 220px; padding: 8px; border: 1px solid var(--border-2); border-radius: 14px; background: var(--surface); box-shadow: var(--nm-out); }
.profile-menu[hidden] { display: none; }
.profile-logout { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 44px; padding: 10px 12px; border: none; border-radius: 10px; background: transparent; font-family: inherit; font-size: 14px; font-weight: 700; color: var(--red-dark); cursor: pointer; }
.profile-logout:hover { background: var(--red-soft); }
.profile-logout:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.sidebar.collapsed .user-identity { display: none; }
@media (max-width: 820px) {
  .sidebar.collapsed .user-identity { display: flex; }
  .profile-menu { z-index: 150; }
}

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

.modal-header { border-bottom-color: var(--border-2); box-shadow: none; }

.modal-footer { border-top-color: var(--border-2); }

.sidebar-header { border-bottom-color: var(--border-2); box-shadow: none; }

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

.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-preview-logo { position: absolute; display: block; 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; }

@media (max-height: 800px) {
  .wmp-card { padding: 16px; border-radius: 14px; }
  .wmp-head { margin-bottom: 10px; }
  .wmp-stage { aspect-ratio: 4 / 3; }
  .wmp-place { grid-template-columns: 28px 1fr; grid-template-rows: auto 28px; gap: 6px; }
  .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-axis-values { font-size: 11.5px; }
}

.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: var(--red); 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: var(--surface); box-shadow: var(--nm-in-sm); border-radius: 14px; padding: 12px 16px; font-size: 13.5px; font-weight: 800; color: var(--ink-2); display: flex; gap: 8px; align-items: center; margin: 4px 0 12px; }
.rule-hat b { color: var(--accent); }
.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: 12px 14px; border-radius: 14px; margin: 10px 0 2px; background: var(--surface); box-shadow: var(--nm-out-sm); border-right: 3px solid var(--accent); }
.rule-block-if { font-weight: 800; font-size: 13px; color: var(--ink-3); }
.rule-block .rule-sel, .rule-block .rule-val { background: var(--surface); box-shadow: var(--nm-in-sm); border: none; border-radius: 10px; color: var(--ink); padding: 8px 12px; font-family: inherit; font-size: 12.5px; font-weight: 700; outline: none; }
.rule-block .rule-val { width: 104px; text-align: center; }
.rule-block .rule-val::placeholder { color: var(--ink-3); }
.rule-del { margin-right: auto; background: var(--surface); box-shadow: var(--nm-out-sm); border: none; color: var(--red); width: 26px; height: 26px; border-radius: 50%; cursor: pointer; font-family: inherit; }
.rule-del:active { box-shadow: var(--nm-in-sm); }
.rule-add { display: block; margin: 14px auto 2px; background: var(--surface); box-shadow: var(--nm-out-sm); border: none; border-radius: 14px; 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); }
.pipe-icon.has-diff:hover { box-shadow: var(--nm-out-sm); }
.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); }
.pipe-dup { margin-top: 8px; padding-top: 8px; border-top: 1px dashed rgba(0, 0, 0, .12); }
.dup-title { font-size: 11px; font-weight: 800; color: var(--accent-dark); margin-bottom: 6px; }
.dup-text { background: var(--surface-2); border-radius: 10px; padding: 8px 10px; font-size: 12px; line-height: 2; color: var(--ink-2); white-space: pre-wrap; word-break: break-word; max-height: 190px; overflow-y: auto; }
.dup-text.empty { color: var(--ink-3); font-style: italic; }
.dup-meta { font-size: 10.5px; font-weight: 600; color: var(--ink-3); margin-top: 5px; }
.dup-meta a { color: var(--accent); font-weight: 700; text-decoration: none; }
.dup-reason { margin-top: 7px; background: var(--accent-soft); border-radius: 10px; padding: 8px 10px; font-size: 11.5px; line-height: 1.95; color: var(--ink-2); }
.dup-reason-title { display: block; font-size: 10.5px; font-weight: 800; color: var(--accent-dark); margin-bottom: 3px; }

: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: 44px;
  height: 44px;
  border: none;
  border-radius: 50%;
  background: var(--bg);
  box-shadow: var(--nm-out-sm);
  color: var(--ink-2);
  cursor: pointer;
  transition: color 0.2s var(--ease), box-shadow 0.2s var(--ease);
}

.theme-toggle-floating:hover { color: var(--accent); }
.theme-toggle-floating:active { box-shadow: var(--nm-in-sm); }

html[data-theme="dark"] {
  color-scheme: dark;
  --ink-rgb: 233, 236, 250;
  --accent-rgb: 142, 126, 242;
  --bg: #23252F;
  --surface: #23252F;
  --surface-2: #292C38;
  --border: transparent;
  --border-2: rgba(255, 255, 255, 0.08);
  --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(0, 0, 0, 0.44);
  --nm-light: rgba(255, 255, 255, 0.045);
  --nm-out: 5px 5px 14px var(--nm-dark), -5px -5px 14px var(--nm-light);
  --nm-out-sm: 3px 3px 8px var(--nm-dark), -3px -3px 8px var(--nm-light);
  --nm-in: inset 3px 3px 7px var(--nm-dark), inset -3px -3px 7px var(--nm-light);
  --nm-in-sm: inset 2px 2px 5px var(--nm-dark), inset -2px -2px 5px var(--nm-light);
  --shadow-lg: 0 18px 42px rgba(0, 0, 0, 0.55);
  --track: rgba(0, 0, 0, 0.38);
  --toggle-off: #4B5164;
  --toggle-border: #667189;
  --toggle-on: #7C6CE0;
  --toggle-on-border: var(--toggle-on);
  --glow-1: #4CC4E0;
  --glow-2: #6E9BFF;
  --glow-3: #8E7EF2;
  --glow-4: #E27FBB;
  --glow-shadow: rgba(142, 126, 242, 0.34);
  --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: var(--bg);
}

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: var(--surface-2);
  box-shadow: none;
}

html[data-theme="dark"] .form-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(142, 126, 242, 0.3);
}

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: inset 0 0 0 1000px var(--surface-2);
  -webkit-text-fill-color: var(--ink);
  caret-color: var(--ink);
}

html[data-theme="dark"] ::-webkit-scrollbar-thumb { background: #3A3F52; border-radius: var(--radius-pill); }
html[data-theme="dark"] ::-webkit-scrollbar-thumb:hover { background: #414B78; }
html[data-theme="dark"] ::-webkit-scrollbar-track { background: transparent; }

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

html[data-theme="dark"] .user-avatar { box-shadow: var(--nm-out-sm); }

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);
}

html[data-theme="dark"] .modal-footer { border-top-color: rgba(255, 255, 255, 0.06); }

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: var(--nm-out-sm); }
html[data-theme="dark"] .btn-primary:hover { box-shadow: var(--nm-out-sm); }
html[data-theme="dark"] .btn-danger:hover { box-shadow: var(--nm-out-sm); }

html[data-theme="dark"] .badge {
  border: none;
  box-shadow: none;
}

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

html[data-theme="dark"] .table tbody tr:hover td { background: var(--surface-2); }

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: var(--nm-out-sm); }
html[data-theme="dark"] .login-btn { box-shadow: var(--nm-out-sm); }
html[data-theme="dark"] .login-btn:hover { box-shadow: var(--nm-out-sm); }
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"] .login-error { background: var(--red-soft); }

html[data-theme="dark"] .tip-pop {
  background: #2A3050;
  color: var(--ink);
  box-shadow: var(--nm-out-sm);
}
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); }
html[data-theme="dark"] .jdp { box-shadow: var(--nm-out-sm); }
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-admin-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: var(--nm-out-sm); }
html[data-theme="dark"] .wiz-chip:hover { box-shadow: var(--nm-out-sm); }
html[data-theme="dark"] .wiz-pipe { box-shadow: var(--nm-in-sm); background-color: #171A28; }
html[data-theme="dark"] .wiz-pipe.drag-over { box-shadow: var(--nm-in-sm); }
html[data-theme="dark"] .wiz-pipe-item { box-shadow: var(--nm-out-sm); }
html[data-theme="dark"] .wiz-config-card,
html[data-theme="dark"] .wmp-card { box-shadow: var(--nm-out-sm); }

html[data-theme="dark"] .msg-chip.active { box-shadow: var(--nm-out-sm); }

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"] .pipe-dup { border-top-color: rgba(255, 255, 255, 0.14); }

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

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

#ai-nav-spark { display: inline-flex; }
#ai-nav-spark svg { transform-origin: center; }

.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); }

.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; flex-wrap: wrap; }

.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: 14px;
  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;
}

.ai-net-n {
  fill: var(--accent);
  transform-box: fill-box;
  transform-origin: center;
}

.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-2) 1px, transparent 1px) 0 0 / 22px 22px,
    var(--surface-2);
}

.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);
  transition: box-shadow .2s ease;
}

.ai-bubble:hover {
  box-shadow: var(--nm-out);
  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: 14px;
  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: 14px;
  background: var(--surface-2);
  box-shadow: var(--nm-in-sm);
  overflow: hidden;
}

.ai-bar-fill { height: 100%; border-radius: 14px; 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-date-range { display: flex; align-items: center; gap: 8px; }

.ai-date-range .form-input { width: 118px; }

.ai-date-clear {
  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;
  flex-shrink: 0;
}

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

.ai-detail-count { width: auto; }

.ai-detail-summary { margin-inline-start: auto; font-size: 11.5px; color: var(--ink-3); font-weight: 600; }

.ai-sample-foot { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }

.ai-sample-date { font-size: 11px; color: var(--ink-3); font-weight: 600; }

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

.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: 12px;
  border-end-start-radius: 5px;
  font-size: 13px;
  line-height: 1.7;
  background: var(--surface-2);
  border: 1px solid var(--border-2);
  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: 12px;
  border-end-end-radius: 5px;
  box-shadow: var(--nm-out-sm);
}

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

.ai-dots { display: inline-flex; gap: 4px; padding: 3px 2px; }
.ai-dots span { width: 6px; height: 6px; border-radius: 50%; background: var(--accent); opacity: .6; }

.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: 14px;
  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: 14px;
  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: var(--nm-out-sm);
  transition: transform .15s ease;
  flex-shrink: 0;
}

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

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

.ai-report { display: flex; flex-direction: column; gap: 16px; }

.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: var(--nm-out-sm);
  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: var(--nm-out-sm);
}

.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 { }

.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: var(--nm-out-sm);
}

.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-2) 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: var(--nm-out-sm); }

@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-card-controls { width: 100%; }
  .ai-date-range { flex: 1 1 100%; min-width: 0; }
  .ai-date-range .form-input { flex: 1; width: 0; min-width: 0; padding-inline: 10px; }
  .ai-detail-summary { margin-inline-start: 0; }
  .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;
  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: var(--nm-out-sm);
  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; }
}

/* --- 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);
}
html[data-theme="dark"] .msg-page-cur:focus { box-shadow: var(--nm-in); }

/* --- AI feature cards --- */
.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);
}
.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;
}
.ai-senti-stack {
  width: min(26px, 100%);
  display: flex;
  flex-direction: column;
  border-radius: 8px;
  overflow: hidden;
}
.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-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; }

@media (max-width: 820px) {
  html, body { max-width: 100vw; overflow-x: hidden; }
  .menu-btn { display: flex; }
  .sidebar-backdrop { display: block; }
  .sidebar,
  .sidebar.collapsed {
    position: fixed;
    top: 0;
    bottom: 0;
    right: 0;
    left: auto;
    width: min(80vw, 300px);
    height: 100%;
    height: 100dvh;
    margin: 0;
    padding: 20px 16px calc(16px + env(safe-area-inset-bottom));
    border-radius: 14px 0 0 14px;
    box-shadow: var(--nm-out-sm);
    overflow-x: hidden;
    overflow-y: auto;
    z-index: 140;
    transform: translateX(105%);
    transition: transform 0.3s cubic-bezier(0.22, 1, 0.36, 1);
  }
  .sidebar.open { transform: translateX(0); }
  .main-content { max-width: 100vw; padding: 6px 14px calc(28px + env(safe-area-inset-bottom)); }
  .main-content canvas { max-width: 100%; }
  .topbar { padding: 10px 0 4px; margin-bottom: 14px; }
  .topbar-title { font-size: 20px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .topbar-sep { display: none; }
  .topbar-brand .brand-fa { display: none; }
  .glow-strip { margin-bottom: 12px; }
  .page-content { animation: none; }
  .section-header { align-items: center; }
  .form-input,
  select.form-input { font-size: 16px; }
  .card-body { padding: 16px; }
  .stat-card:hover { transform: none; box-shadow: var(--nm-out); }
  .modal-backdrop { padding: 0; align-items: flex-end; }
  .modal {
    max-width: none;
    max-height: 92vh;
    max-height: 92dvh;
    border-radius: 14px 14px 0 0;
  }
  .modal-header { padding: 14px 16px; }
  .modal-body { padding: 16px; }
  .modal-footer { padding: 12px 16px calc(12px + env(safe-area-inset-bottom)); }
  .notif-panel {
    position: fixed;
    top: 64px;
    inset-inline: 12px;
    width: auto;
    max-height: min(420px, 60vh);
    z-index: 129;
  }
  .page-content .table,
  .modal .table {
    display: block;
    overflow-x: auto;
    white-space: nowrap;
    -webkit-overflow-scrolling: touch;
  }
  #toast-container { bottom: calc(20px + env(safe-area-inset-bottom)); width: calc(100vw - 28px); }
  .toast { max-width: 100%; }
  .login-orbs .orb { animation: none; filter: blur(48px); }
  .login-side { padding: 28px 18px; }
  #overview-extras { grid-template-columns: 1fr; }
  .chan-activity-grid { grid-template-columns: 1fr; }
  .feed-row { gap: 8px; min-width: 0; }
  .feed-main { min-width: 0; }
  .feed-title { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .feed-text { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 11.5px; }
  .feed-time,
  .chan-mini-stat { flex-shrink: 0; white-space: nowrap; font-size: 10.5px; }
}

@media (max-width: 560px) {
  .main-content { padding: 4px 10px calc(24px + env(safe-area-inset-bottom)); }
  .topbar-title { font-size: 18px; }
  .topbar-actions { gap: 8px; }
  .stat-card { padding: 16px; }
  .card-body { padding: 14px; }
  .modal { max-height: 96vh; max-height: 96dvh; }
  .empty-state { padding: 36px 14px; }
}

@media (max-width: 820px) {
  .grid-2 > *,
  .grid-3 > *,
  .grid-4 > * { min-width: 0; }
  .page-content .card { min-width: 0; max-width: 100%; }
  .feed-title { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .feed-title .msg-badge { margin-inline-start: 6px; }
}

.pro-acc-badge { font-size: 11.5px; font-weight: 800; padding: 4px 12px; border-radius: 14px; border: 1px solid var(--border-2); color: var(--ink-2); background: var(--bg-2); }
.pro-acc-badge.ok { border-color: rgba(34, 197, 94, .45); color: #16a34a; background: rgba(34, 197, 94, .1); }
.pro-acc-alert { margin-top: 14px; font-size: 12.5px; line-height: 1.9; padding: 12px 14px; border-radius: 12px; border: 1px solid rgba(239, 68, 68, .4); background: rgba(239, 68, 68, .08); color: #dc2626; }
.pro-acc-connected { display: flex; align-items: center; gap: 14px; margin-top: 16px; padding: 14px 16px; border: 1px solid var(--border-2); border-radius: 14px; background: var(--bg-2); }
.pro-acc-avatar { width: 44px; height: 44px; flex: 0 0 44px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 18px; color: #fff; background: var(--accent); }
.pro-acc-info { flex: 1; min-width: 0; }
.pro-acc-name { font-weight: 800; font-size: 14px; margin-bottom: 6px; }
.pro-acc-meta { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; font-size: 12.5px; color: var(--ink-2); }
.pro-acc-chip { font-size: 11px; font-weight: 700; padding: 3px 10px; border-radius: 14px; border: 1px solid var(--border-2); }
.pro-acc-chip.ok { border-color: rgba(34, 197, 94, .45); color: #16a34a; background: rgba(34, 197, 94, .1); }
.pro-acc-chip.warn { border-color: rgba(245, 158, 11, .45); color: #d97706; background: rgba(245, 158, 11, .1); }
.pro-acc-wizard { margin-top: 18px; }
.pro-acc-steps { display: flex; align-items: center; gap: 8px; margin-bottom: 18px; }
.pro-acc-step { display: flex; align-items: center; gap: 8px; font-size: 12.5px; font-weight: 700; color: var(--ink-3); white-space: nowrap; }
.pro-acc-step.active { color: var(--ink); }
.pro-acc-num { width: 24px; height: 24px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 12px; border: 1px solid var(--border-2); background: var(--bg-2); }
.pro-acc-step.active .pro-acc-num { border-color: transparent; color: #fff; background: var(--accent); }
.pro-acc-line { flex: 1; height: 1px; background: var(--border-2); }
.pro-acc-pane { max-width: 420px; }
.pro-acc-hint { font-size: 12.5px; line-height: 2; color: var(--ink-2); margin-bottom: 14px; padding: 12px 14px; border: 1px solid var(--border-2); border-radius: 12px; background: var(--bg-2); }
.pro-acc-actions { display: flex; align-items: center; gap: 10px; }
@media (max-width: 720px) {
  .pro-acc-steps { flex-wrap: wrap; }
  .pro-acc-line { display: none; }
  .pro-acc-connected { flex-wrap: wrap; }
}
.channel-access-warn { color: #d97706; }

.an-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 0.82fr);
  gap: 20px;
  align-items: start;
}

.an-compose .card-body {
  display: flex;
  flex-direction: column;
  gap: 13px;
}

.an-scope {
  padding: 4px 12px;
  border-radius: 14px;
  background: var(--accent-soft);
  color: var(--accent-dark);
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
}

.an-seg {
  display: flex;
  gap: 4px;
  padding: 4px;
  border-radius: 14px;
  background: var(--bg);
  box-shadow: var(--nm-in-sm);
}

.an-seg-btn {
  flex: 1;
  padding: 9px 10px;
  border: 0;
  border-radius: 11px;
  background: transparent;
  color: var(--ink-2);
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 700;
  cursor: pointer;
  transition: color 0.18s, background 0.18s, box-shadow 0.18s;
}

.an-seg-btn:hover { color: var(--ink); }

.an-seg-btn.active {
  background: var(--surface);
  color: var(--accent);
  box-shadow: var(--nm-out-sm);
}

.an-picker { display: flex; flex-direction: column; gap: 9px; }

.an-picker[hidden] { display: none; }

.an-picker-head { display: flex; align-items: center; gap: 12px; }

.an-search {
  flex: 1;
  min-width: 0;
  padding: 9px 14px;
  border: 0;
  border-radius: 12px;
  background: var(--bg);
  box-shadow: var(--nm-in-sm);
  font-family: inherit;
  font-size: 12.5px;
  color: var(--ink);
  outline: none;
}

.an-search::placeholder { color: var(--ink-3); }

.an-link {
  padding: 0;
  border: 0;
  background: none;
  font-family: inherit;
  font-size: 12px;
  font-weight: 700;
  color: var(--ink-3);
  cursor: pointer;
  white-space: nowrap;
  transition: color 0.16s;
}

.an-link:hover { color: var(--accent); }

.an-user-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
  max-height: 196px;
  overflow-y: auto;
  padding: 6px;
  border-radius: 14px;
  background: var(--bg);
  box-shadow: var(--nm-in-sm);
}

.an-user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 9px;
  border-radius: 10px;
  cursor: pointer;
  transition: background 0.15s;
}

.an-user:hover { background: var(--surface-2); }

.an-user.checked { background: var(--accent-soft); }

.an-user .check-dot {
  position: relative;
  flex: 0 0 15px;
  width: 15px;
  height: 15px;
  border-radius: 5px;
  background: var(--surface);
  box-shadow: var(--nm-in-sm);
  transition: background 0.15s;
}

.an-user.checked .check-dot { background: var(--accent); box-shadow: none; }

.an-user.checked .check-dot::after {
  content: '';
  position: absolute;
  inset: 0;
  margin: auto;
  width: 4px;
  height: 8px;
  border: solid #fff;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg) translate(-1px, -1px);
}

.an-user-meta { flex: 1; min-width: 0; }

.an-user-name {
  font-size: 12.5px;
  font-weight: 700;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.an-user-sub {
  font-size: 11px;
  color: var(--ink-3);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.an-user-state {
  flex: 0 0 6px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--green);
}

.an-user-state.off { background: var(--ink-3); opacity: 0.5; }

.an-user-empty {
  padding: 26px 0;
  text-align: center;
  font-size: 12px;
  color: var(--ink-3);
}

.an-picked-count { font-size: 11.5px; color: var(--ink-3); }

.an-input {
  width: 100%;
  padding: 12px 16px;
  border: 1px solid var(--border-2);
  border-radius: var(--radius);
  background: var(--surface-2);
  font-family: inherit;
  font-size: 13.5px;
  color: var(--ink);
  outline: none;
  transition: border-color 0.2s var(--ease), box-shadow 0.2s var(--ease);
}

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

.an-input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }

.an-textarea { min-height: 104px; resize: vertical; line-height: 1.9; }

.an-sev { display: flex; gap: 8px; flex-wrap: wrap; }

.an-dot {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 7px 14px;
  border: 0;
  border-radius: 14px;
  background: var(--bg);
  box-shadow: var(--nm-in-sm);
  color: var(--ink-3);
  font-family: inherit;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: color 0.16s, background 0.16s, box-shadow 0.16s;
}

.an-dot::before {
  content: '';
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
}

.an-dot:hover { color: var(--ink-2); }

.an-dot.info.active { background: var(--accent-soft); color: var(--accent-dark); box-shadow: none; }

.an-dot.warning.active { background: var(--amber-soft); color: var(--amber-dark); box-shadow: none; }

.an-dot.critical.active { background: var(--red-soft); color: var(--red-dark); box-shadow: none; }

.an-preview {
  display: flex;
  gap: 11px;
  padding: 12px 14px;
  border-radius: 14px;
  background: var(--bg);
  box-shadow: var(--nm-in-sm);
}

.an-preview[hidden] { display: none; }

.an-preview-bar {
  flex: 0 0 3px;
  border-radius: 14px;
  background: var(--accent);
}

.an-preview.warning .an-preview-bar { background: var(--amber); }

.an-preview.critical .an-preview-bar { background: var(--red); }

.an-preview-main { min-width: 0; }

.an-preview-title {
  font-size: 12.5px;
  font-weight: 800;
  color: var(--ink);
  margin-bottom: 3px;
}

.an-preview-body {
  font-size: 11.5px;
  line-height: 1.85;
  color: var(--ink-2);
  white-space: pre-wrap;
  word-break: break-word;
}

.an-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-top: 2px;
}

.an-counter { font-size: 11.5px; color: var(--ink-3); }

.an-sent { position: sticky; top: 20px; }

.an-sent-body {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: 552px;
  overflow-y: auto;
}

.an-history { display: flex; flex-direction: column; gap: 8px; }

.an-history-item {
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 11px 17px 11px 12px;
  border-radius: 14px;
  background: var(--bg);
  box-shadow: var(--nm-in-sm);
}

.an-history-item::before {
  content: '';
  position: absolute;
  inset-inline-start: 8px;
  top: 13px;
  bottom: 13px;
  width: 3px;
  border-radius: 14px;
  background: var(--accent);
}

.an-history-item.warning::before { background: var(--amber); }

.an-history-item.critical::before { background: var(--red); }

.an-history-main { flex: 1; min-width: 0; }

.an-history-title {
  font-size: 12.5px;
  font-weight: 800;
  color: var(--ink);
  margin-bottom: 3px;
}

.an-history-body {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  font-size: 11.5px;
  line-height: 1.8;
  color: var(--ink-2);
  word-break: break-word;
}

.an-history-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 7px;
}

.an-history-to { font-size: 11px; font-weight: 700; color: var(--ink-2); }

.an-history-date { font-size: 10.5px; color: var(--ink-3); }

.an-history-del {
  flex: 0 0 auto;
  padding: 5px;
  border: 0;
  border-radius: 9px;
  background: none;
  color: var(--ink-3);
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.16s, color 0.16s, background 0.16s;
}

.an-history-item:hover .an-history-del,
.an-history-del:focus-visible { opacity: 1; }

.an-history-del:hover { color: var(--red); background: var(--red-soft); }

.an-more-btn {
  align-self: center;
  padding: 6px 14px;
  border: 0;
  background: none;
  font-family: inherit;
  font-size: 12px;
  font-weight: 700;
  color: var(--accent);
  cursor: pointer;
}

.an-more-btn[hidden] { display: none; }

@media (max-width: 1000px) {
  .an-grid { grid-template-columns: 1fr; }
  .an-sent { position: static; }
  .an-sent-body { max-height: none; }
  .an-history-del { opacity: 1; }
}

.list-toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}

.list-toolbar .list-search {
  flex: 1;
  min-width: 0;
  margin-bottom: 0;
}

.list-toolbar .btn { white-space: nowrap; }

.modal-backdrop.modal-stacked { z-index: 110; }

.modal-narrow { max-width: 520px; }

.phrase-input {
  min-height: 132px;
  line-height: 2;
  resize: vertical;
  overflow-wrap: break-word;
}

.list-search {
  position: relative;
  display: flex;
  align-items: center;
  margin-bottom: 12px;
}

.list-search-icon {
  position: absolute;
  inset-inline-start: 13px;
  display: flex;
  align-items: center;
  color: var(--ink-3);
  pointer-events: none;
}

.list-search .form-input {
  width: 100%;
  padding-inline-start: 38px;
  padding-inline-end: 36px;
}

.list-search-clear {
  position: absolute;
  inset-inline-end: 11px;
  display: none;
  align-items: center;
  justify-content: center;
  width: 21px;
  height: 21px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: var(--surface-2);
  color: var(--ink-3);
  font-size: 15px;
  line-height: 1;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}

.list-search.has-value .list-search-clear {
  display: flex;
}

.list-search-clear:hover {
  background: var(--red-soft);
  color: var(--red);
}

.list-no-match {
  padding: 30px;
  text-align: center;
  font-size: 13px;
  color: var(--ink-3);
}

.tk-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.tk-layout {
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 18px;
  align-items: start;
}

.tk-side {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.tk-seg {
  display: flex;
  gap: 4px;
  padding: 4px;
  border-radius: 14px;
  background: var(--surface-2);
  box-shadow: var(--nm-in-sm);
}

.tk-seg-btn {
  flex: 1;
  border: none;
  cursor: pointer;
  padding: 7px 4px;
  border-radius: 14px;
  background: transparent;
  font-family: inherit;
  font-size: 11px;
  font-weight: 700;
  color: var(--ink-2);
  transition: all 0.18s ease;
}

.tk-seg-btn.active {
  background: var(--surface);
  color: var(--accent);
  box-shadow: var(--nm-out-sm);
}

.tk-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: 620px;
  overflow-y: auto;
  padding: 2px;
}

.tk-item {
  display: flex;
  flex-direction: column;
  gap: 6px;
  width: 100%;
  border: none;
  cursor: pointer;
  text-align: right;
  padding: 13px 14px;
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--nm-out-sm);
  font-family: inherit;
  transition: all 0.18s ease;
}

.tk-item:hover { }

.tk-item.active {
  box-shadow: var(--nm-in-sm);
}

.tk-item-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.tk-item-title {
  font-size: 13px;
  font-weight: 800;
  color: var(--ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tk-item-user {
  font-size: 11px;
  font-weight: 700;
  color: var(--accent);
}

.tk-item-text {
  font-size: 11.5px;
  line-height: 1.7;
  color: var(--ink-3);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tk-item-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.tk-dot {
  width: 8px;
  height: 8px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: var(--red);
}

.tk-chip {
  padding: 3px 10px;
  border-radius: 14px;
  font-size: 10.5px;
  font-weight: 700;
}

.tk-chip.open {
  color: var(--amber-dark);
  background: var(--amber-soft);
}

.tk-chip.answered {
  color: var(--green-dark);
  background: var(--green-soft);
}

.tk-chip.closed {
  color: var(--ink-2);
  background: var(--surface-2);
}

.tk-time {
  font-size: 10.5px;
  color: var(--ink-3);
}

.tk-thread {
  display: flex;
  flex-direction: column;
  min-height: 420px;
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--nm-out);
  overflow: hidden;
}

.tk-thread-empty {
  display: flex;
  flex: 1;
  align-items: center;
  justify-content: center;
  padding: 40px;
  font-size: 12.5px;
  color: var(--ink-3);
}

.tk-thread-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-2);
}

.tk-thread-title {
  font-size: 14.5px;
  font-weight: 800;
  color: var(--ink);
}

.tk-thread-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 7px;
  font-size: 11px;
  color: var(--ink-3);
}

.tk-msgs {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 12px;
  max-height: 420px;
  overflow-y: auto;
  padding: 18px 20px;
}

.tk-msg {
  max-width: 78%;
  padding: 11px 14px;
  border-radius: var(--radius);
  background: var(--surface-2);
  box-shadow: var(--nm-out-sm);
}

.tk-msg.user {
  align-self: flex-start;
}

.tk-msg.admin {
  align-self: flex-end;
  background: var(--accent-soft);
}

.tk-msg-head {
  font-size: 10.5px;
  font-weight: 800;
  color: var(--accent-dark);
}

.tk-msg-body {
  margin-top: 5px;
  font-size: 12.5px;
  line-height: 1.9;
  color: var(--ink);
  white-space: pre-wrap;
  word-break: break-word;
}

.tk-msg-time {
  margin-top: 6px;
  font-size: 10px;
  color: var(--ink-3);
}

.tk-compose {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  padding: 14px 20px 18px;
  border-top: 1px solid var(--border-2);
}

.tk-textarea {
  flex: 1;
  border: none;
  outline: none;
  resize: vertical;
  min-height: 46px;
  padding: 12px 14px;
  border-radius: var(--radius);
  background: var(--surface-2);
  box-shadow: var(--nm-in-sm);
  font-family: inherit;
  font-size: 12.5px;
  line-height: 1.8;
  color: var(--ink);
}

.tk-closed-note {
  padding: 16px 20px;
  border-top: 1px solid var(--border-2);
  font-size: 11.5px;
  color: var(--ink-3);
}

.tk-empty {
  padding: 28px 18px;
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--nm-in-sm);
  text-align: center;
}

.tk-empty-title {
  font-size: 12.5px;
  font-weight: 800;
  color: var(--ink-2);
}

.tk-empty-sub {
  margin-top: 6px;
  font-size: 11px;
  color: var(--ink-3);
}

@media (max-width: 900px) {
  .tk-layout {
    grid-template-columns: 1fr;
  }

  .tk-list {
    max-height: 320px;
  }

  .tk-msg {
    max-width: 92%;
  }
}

.tfa-desc { font-size: 12.5px; line-height: 2.1; color: var(--ink-2); margin-bottom: 14px; }
.tfa-qr {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 200px;
  padding: 12px;
  border-radius: 14px;
  background: #fff;
  box-shadow: var(--nm-in-sm);
}
.tfa-qr svg { width: 184px; height: 184px; display: block; }
.tfa-loading { font-size: 12px; color: var(--ink-3); }
.tfa-secret-label { margin-top: 14px; font-size: 11.5px; color: var(--ink-3); }
.tfa-secret {
  margin-top: 6px;
  width: 100%;
  cursor: pointer;
  font-family: inherit;
  direction: ltr;
  letter-spacing: 1.5px;
  font-size: 13px;
  font-weight: 700;
  color: var(--ink);
  background: var(--surface-2);
  border: 1px dashed var(--border-2);
  border-radius: 10px;
  padding: 10px;
  transition: all 0.2s ease;
}
.tfa-secret:hover { color: var(--accent-dark); border-color: var(--accent); }
.tfa-code-input { text-align: center; letter-spacing: 8px; font-size: 18px; font-weight: 800; }
.tfa-error { margin-top: 10px; min-height: 16px; font-size: 12px; color: var(--err); }
.tfa-hint { font-size: 12.5px; line-height: 2.1; color: var(--ink-2); margin-bottom: 6px; }
.tfa-back {
  width: 100%;
  margin-top: 10px;
  cursor: pointer;
  font-family: inherit;
  background: transparent;
  border: none;
  font-size: 12.5px;
  color: var(--ink-3);
}
.tfa-back:hover { color: var(--ink-2); }

.transfer-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 12px;
}
.transfer-box {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px;
  border-radius: var(--radius);
  background: var(--surface-2);
  box-shadow: var(--nm-out-sm);
}
.transfer-icon {
  flex: none;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  color: var(--accent);
  background: var(--accent-soft);
}
.transfer-main { flex: 1; min-width: 0; }
.transfer-title { font-size: 13.5px; font-weight: 800; margin-bottom: 4px; }
.transfer-desc { font-size: 12px; line-height: 1.9; color: var(--ink-2); }
.transfer-box .btn { flex: none; }
.transfer-note {
  margin-top: 12px;
  font-size: 12px;
  color: var(--ink-3);
  padding: 10px 12px;
  border-radius: 12px;
  background: var(--surface-2);
  box-shadow: var(--nm-in-sm);
}
.imp-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 8px;
  margin-bottom: 14px;
}
.imp-sum {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 9px 11px;
  border-radius: 12px;
  background: var(--surface-2);
  box-shadow: var(--nm-in-sm);
  font-size: 12px;
  color: var(--ink-2);
}
.imp-sum b { font-size: 12.5px; color: var(--ink); }
.imp-list, .imp-report { display: flex; flex-direction: column; gap: 8px; }
.imp-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 12px;
  border-radius: var(--radius);
  background: var(--bg);
  border: none;
  box-shadow: var(--nm-out-sm);
}
.imp-row-main { flex: 1; min-width: 0; }
.imp-row-title { font-size: 13px; font-weight: 800; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.imp-row-meta { margin-top: 4px; font-size: 11.5px; color: var(--ink-3); line-height: 1.9; }
.imp-note { margin-top: 4px; font-size: 11.5px; color: var(--amber-dark); line-height: 1.9; }
.imp-badge {
  font-size: 10.5px;
  font-weight: 800;
  padding: 2px 8px;
  border-radius: 14px;
}
.imp-policy { flex: none; width: 165px; font-size: 12px; padding: 7px 10px; }
.imp-activate {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 14px;
  font-size: 12.5px;
  color: var(--ink-2);
  cursor: pointer;
}
@media (max-width: 640px) {
  .transfer-box { flex-wrap: wrap; }
  .imp-row { flex-direction: column; align-items: stretch; }
  .imp-policy { width: 100%; }
}

.gs-note {
  font-size: 12.5px;
  color: var(--ink-3);
  line-height: 1.9;
  margin-bottom: 14px;
}
.gs-row-head input[type="checkbox"],
.gs-target-all input[type="checkbox"],
.gs-target-item input[type="checkbox"] {
  appearance: none;
  -webkit-appearance: none;
  position: relative;
  flex-shrink: 0;
  width: 19px;
  height: 19px;
  margin: 0;
  border: 1px solid var(--border-2);
  border-radius: 7px;
  background: var(--surface);
  box-shadow: var(--nm-in-sm);
  cursor: pointer;
  transition: background 0.16s ease, border-color 0.16s ease, box-shadow 0.16s ease;
}
.gs-row-head input[type="checkbox"]::after,
.gs-target-all input[type="checkbox"]::after,
.gs-target-item input[type="checkbox"]::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: #ffffff;
  clip-path: polygon(20% 52%, 32% 40%, 44% 52%, 70% 26%, 82% 38%, 44% 76%);
  opacity: 0;
  transform: scale(0.6);
  transition: opacity 0.16s ease, transform 0.16s ease;
}
.gs-row-head input[type="checkbox"]:hover,
.gs-target-all input[type="checkbox"]:hover,
.gs-target-item input[type="checkbox"]:hover { border-color: var(--accent-2); }
.gs-row-head input[type="checkbox"]:checked,
.gs-target-all input[type="checkbox"]:checked,
.gs-target-item input[type="checkbox"]:checked {
  border-color: transparent;
  background: var(--accent);
  box-shadow: var(--nm-out-sm);
}
.gs-row-head input[type="checkbox"]:checked::after,
.gs-target-all input[type="checkbox"]:checked::after,
.gs-target-item input[type="checkbox"]:checked::after { opacity: 1; transform: scale(1); }
.gs-row-head input[type="checkbox"]:focus-visible,
.gs-target-all input[type="checkbox"]:focus-visible,
.gs-target-item input[type="checkbox"]:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.gs-target-all {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 12px 0;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-2);
  cursor: pointer;
}
.gs-target-list {
  display: flex;
  flex-direction: column;
  max-height: 320px;
  overflow-y: auto;
}
.gs-target-item {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 10px 2px;
  border-bottom: 1px solid var(--line);
  font-size: 13px;
  color: var(--ink-2);
  cursor: pointer;
}
.gs-target-item:last-child { border-bottom: none; }
.gs-target-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gs-target-empty {
  padding: 18px 0;
  text-align: center;
  font-size: 12.5px;
  color: var(--ink-3);
}

.gs-summary {
  margin-bottom: 16px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--bg);
}
.gs-summary.has-items { border-color: var(--accent-soft); }
.gs-summary-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}
.gs-summary-title {
  font-size: 12.5px;
  font-weight: 700;
  color: var(--ink-2);
}
.gs-summary-count {
  min-width: 22px;
  padding: 1px 7px;
  border-radius: 10px;
  background: var(--accent-soft);
  color: var(--accent-dark);
  font-size: 11.5px;
  font-weight: 700;
  text-align: center;
}
.gs-summary-reset {
  margin-inline-start: auto;
  border: none;
  background: none;
  padding: 0;
  font: inherit;
  font-size: 11.5px;
  color: var(--ink-3);
  cursor: pointer;
}
.gs-summary-reset:hover { color: var(--accent); }
.gs-summary-body {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}
.gs-summary-empty {
  font-size: 12px;
  line-height: 1.9;
  color: var(--ink-3);
}
.gs-summary-preview { margin-bottom: 14px; }
.gs-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  border: 1px solid var(--border);
  border-radius: 11px;
  background: var(--surface);
  box-shadow: var(--nm-out-sm);
  font-size: 11.5px;
}
.gs-chip-label { color: var(--ink-2); font-weight: 600; }
.gs-chip-value { color: var(--accent-dark); unicode-bidi: plaintext; }
.gs-chip-error { border-color: #e2a0a0; }
.gs-chip-error .gs-chip-value { color: #c05353; }
.gs-row {
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}
.gs-row:last-child { border-bottom: none; }
.gs-row-head {
  display: flex;
  align-items: center;
  gap: 9px;
  cursor: pointer;
}
.gs-row-title {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-3);
  transition: color 0.16s ease;
}
.gs-row-on .gs-row-title { color: var(--ink-2); }
.gs-row-body {
  display: none;
  flex-direction: column;
  gap: 10px;
  margin-top: 12px;
  padding-inline-start: 28px;
}
.gs-row-on .gs-row-body { display: flex; }
.gs-target-count {
  margin-inline-start: auto;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--ink-3);
}

.krank { display: flex; flex-direction: column; gap: 20px; }
.krank > .kpi-results > .kpi-result-content { display: flex; flex-direction: column; gap: 20px; }
.krank-stage {
  position: relative;
  overflow: hidden;
  border-radius: var(--radius-lg);
  padding: 24px 24px 0;
  background: linear-gradient(150deg, var(--surface), var(--surface-2));
  box-shadow: var(--nm-out);
}
.krank-glow {
  position: absolute;
  width: 260px;
  height: 260px;
  border-radius: 50%;
  filter: blur(6px);
  opacity: 0.55;
  pointer-events: none;
}
.krank-glow-a { top: -120px; inset-inline-start: -80px; background: radial-gradient(circle, var(--accent-soft), transparent 68%); }
.krank-glow-b { bottom: -140px; inset-inline-end: -70px; background: radial-gradient(circle, var(--cyan-soft), transparent 70%); }

.krank-stage-head {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
}
.krank-stage-title { display: flex; align-items: center; gap: 12px; }
.krank-stage-name { font-size: 17px; font-weight: 900; color: var(--ink); }
.krank-team { position: relative; width: 104px; height: 104px; flex: 0 0 auto; }
.krank-ring { width: 100%; height: 100%; transform: rotate(-90deg); }
.krank-ring-bg { fill: none; stroke: var(--border-2); stroke-width: 9; }
.krank-ring-fg {
  fill: none;
  stroke: var(--accent);
  stroke-width: 9;
  stroke-linecap: round;
}
.krank-team-val {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
}
.krank-team-val span { font-size: 22px; font-weight: 900; color: var(--ink); font-variant-numeric: tabular-nums; }
.krank-team-val small { font-size: 9.5px; font-weight: 700; color: var(--ink-3); }
.krank-podium {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 18px;
  margin-top: 22px;
  min-height: 210px;
}
.krank-pod { display: flex; flex-direction: column; align-items: center; width: 150px; max-width: 32%; }
.krank-pod-card {
  position: relative;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  padding: 14px 12px 12px;
  border-radius: 14px 14px 0 0;
  background: var(--surface);
  box-shadow: var(--nm-out-sm);
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.krank-pod-card:hover { box-shadow: var(--nm-out); }
.krank-crown { position: absolute; top: -26px; font-size: 22px; }

.krank-pod-medal { font-size: 22px; }

.krank-avatar {
  width: 46px;
  height: 46px;
  border-radius: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  font-weight: 900;
  color: #fff;
  background: linear-gradient(140deg, hsl(var(--krank-hue) 72% 62%), hsl(var(--krank-hue) 72% 44%));
  box-shadow: var(--nm-out-sm);
}
.krank-avatar-sm { width: 38px; height: 38px; border-radius: 13px; font-size: 13px; flex: 0 0 auto; }
.krank-pod-name { font-size: 13px; font-weight: 800; color: var(--ink); text-align: center; }
.krank-pod-score {
  font-size: 26px;
  font-weight: 900;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
  background: linear-gradient(135deg, var(--accent-dark), var(--accent-2));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.krank-pod-meta { font-size: 10.5px; font-weight: 700; color: var(--ink-3); white-space: nowrap; }
.krank-pod-base {
  position: relative;
  width: 100%;
  height: 0;
  border-radius: 0 0 6px 6px;
  background: linear-gradient(180deg, var(--accent-2), var(--accent-dark));
  box-shadow: var(--nm-in-sm);
  overflow: hidden;
}
.krank-pod-2 .krank-pod-base { background: linear-gradient(180deg, var(--sky), var(--sky-dark)); }
.krank-pod-3 .krank-pod-base { background: linear-gradient(180deg, var(--amber), var(--amber-dark)); }
.krank-pod-more .krank-pod-medal { font-size: 18px; color: var(--ink-2); }
.krank-pod-more .krank-pod-base { background: linear-gradient(180deg, var(--ink-3), var(--ink-2)); }
.krank-podium-many {
  justify-content: flex-start;
  gap: 12px;
  overflow-x: auto;
  padding-bottom: 8px;
  scrollbar-width: thin;
}
.krank-podium-many .krank-pod { width: 132px; max-width: none; flex: 0 0 auto; }
.krank-podium-many .krank-pod-score { font-size: 22px; }
.krank-pod-base::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(115deg, transparent 40%, rgba(255, 255, 255, 0.45) 50%, transparent 60%);
  transform: translateX(-120%);
}

.krank-pod-rank {
  position: absolute;
  top: 10px;
  inset-inline: 0;
  text-align: center;
  font-size: 26px;
  font-weight: 900;
  color: rgba(255, 255, 255, 0.9);
}
.krank-sup-hint { font-size: 11.5px; font-weight: 700; color: var(--ink-3); }
.krank-sup-list { display: flex; flex-direction: column; gap: 10px; }
.krank-sup-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--nm-out-sm);
}
.krank-sup-name { flex: 1 1 auto; min-width: 0; font-size: 13px; font-weight: 800; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.krank-sup-row .kpi-unit-input { flex: 0 0 auto; }
.krank-sup-input { width: 82px; text-align: center; }
.krank-list { display: flex; flex-direction: column; gap: 12px; }
.krank-row {
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--nm-out-sm);
  transition: box-shadow 0.2s ease, transform 0.2s ease;
}
.krank-row:hover { box-shadow: var(--nm-out); }
.krank-row-main {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  cursor: pointer;
}
.krank-rank {
  flex: 0 0 auto;
  width: 34px;
  text-align: center;
  font-size: 15px;
  font-weight: 900;
  color: var(--ink-3);
  font-variant-numeric: tabular-nums;
}
.krank-row-id { flex: 1 1 140px; min-width: 0; }
.krank-row-name { font-size: 13.5px; font-weight: 800; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.krank-badges { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.krank-badge {
  font-size: 10px;
  font-weight: 700;
  color: var(--accent-dark);
  background: var(--accent-soft);
  border-radius: 14px;
  padding: 3px 9px;
  white-space: nowrap;
}
.krank-badge-muted { color: var(--ink-2); background: var(--bg); box-shadow: var(--nm-in-sm); }
.krank-badge-pos { color: var(--green-dark); background: var(--green-soft); }
.krank-badge-neg { color: var(--red-dark); background: var(--red-soft); }
.krank-row-bars { flex: 1 1 300px; display: flex; gap: 12px; min-width: 0; }
.krank-bar { flex: 1 1 0; min-width: 0; }
.krank-bar-top { display: flex; align-items: center; justify-content: space-between; font-size: 10.5px; font-weight: 700; color: var(--ink-3); margin-bottom: 5px; }
.krank-bar-top b { color: var(--ink-2); font-variant-numeric: tabular-nums; }
.krank-bar-track { height: 8px; border-radius: 14px; background: var(--bg); box-shadow: var(--nm-in-sm); overflow: hidden; }
.krank-bar-fill { display: block; height: 100%; width: 0; border-radius: 14px; }
.krank-fill-delay { background: linear-gradient(90deg, var(--accent), var(--accent-2)); }
.krank-fill-dup { background: linear-gradient(90deg, var(--cyan), var(--sky)); }
.krank-fill-report { background: linear-gradient(90deg, var(--green), var(--teal, var(--cyan))); }
.krank-fill-sup { background: linear-gradient(90deg, var(--purple, var(--accent-2)), var(--pink, var(--accent))); }
.krank-row-score { flex: 0 0 auto; display: flex; flex-direction: column; align-items: center; }
.krank-row-score-num { font-size: 19px; font-weight: 900; color: var(--accent); font-variant-numeric: tabular-nums; }
.krank-row-score small { font-size: 9.5px; font-weight: 700; color: var(--ink-3); }
.krank-row-chev { flex: 0 0 auto; font-size: 20px; color: var(--ink-3); transition: transform 0.25s ease; }
.krank-row.open .krank-row-chev { transform: rotate(-90deg); }
.krank-row-detail { max-height: 0; overflow: hidden; transition: max-height 0.45s cubic-bezier(0.22, 1, 0.36, 1); }
.krank-row.open .krank-row-detail { max-height: 320px; }
.krank-detail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 12px;
  padding: 4px 16px 12px;
  border-top: 1px solid var(--border-2);
  margin: 0 16px;
}
.krank-stat { display: flex; flex-direction: column; gap: 4px; padding-top: 12px; }
.krank-stat span { font-size: 10.5px; font-weight: 700; color: var(--ink-3); }
.krank-stat b { font-size: 13.5px; font-weight: 800; color: var(--ink); font-variant-numeric: tabular-nums; }
.krank-detail-formula { display: flex; flex-wrap: wrap; gap: 8px; padding: 0 16px 16px; }
.krank-chip {
  font-size: 10.5px;
  font-weight: 700;
  color: var(--ink-2);
  background: var(--bg);
  box-shadow: var(--nm-in-sm);
  border-radius: 14px;
  padding: 6px 12px;
}
.krank-empty { padding: 40px 0; text-align: center; font-size: 12.5px; font-weight: 700; color: var(--ink-3); }
@media (max-width: 860px) {
  .krank-row-bars { flex: 1 1 100%; order: 3; flex-wrap: wrap; }
  .krank-row-bars .krank-bar { flex: 1 1 44%; }
  .krank-row-main { flex-wrap: wrap; }
  .krank-sup-row { flex-wrap: wrap; }
  .krank-sup-name { flex: 1 1 100%; }
}
@media (max-width: 620px) {
  .krank-stage { padding: 18px 14px 0; }
  .krank-podium { gap: 8px; min-height: 178px; }
  .krank-podium-many .krank-pod { width: 116px; }
  .krank-pod-score { font-size: 20px; }
  .krank-pod-meta { font-size: 9.5px; }
  .krank-avatar { width: 38px; height: 38px; font-size: 13px; }
}
@media (prefers-reduced-motion: reduce) {
  .krank-row:hover,
  .krank-pod-card:hover { transform: none; }
}
.cap-builder { display: flex; flex-direction: column; gap: 12px; }
.cap-rows { display: flex; flex-direction: column; gap: 10px; }
.cap-empty { padding: 18px 14px; border: 1px dashed var(--border-2); border-radius: var(--radius); text-align: center; font-size: 12.5px; color: var(--ink-3); }
.cap-row { display: flex; flex-direction: column; gap: 8px; padding: 12px; border-radius: var(--radius); background: var(--surface-2); box-shadow: var(--nm-out-sm); }
.cap-row-link { box-shadow: var(--nm-out-sm), inset 0 0 0 1px var(--accent-soft); }
.cap-row-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.cap-row-badge { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--ink-2); }
.cap-row-badge svg { width: 14px; height: 14px; }
.cap-row-link .cap-row-badge { color: var(--accent); }
.cap-row-tools { display: flex; gap: 4px; }
.cap-tool { width: 28px; height: 28px; display: inline-flex; align-items: center; justify-content: center; padding: 0; border: none; border-radius: 8px; background: var(--surface); color: var(--ink-3); cursor: pointer; transition: color .15s ease, background .15s ease; }
.cap-tool svg { width: 15px; height: 15px; }
.cap-tool:hover { color: var(--ink); background: var(--bg); }
.cap-tool-danger:hover { color: #d9534f; }
.cap-input { width: 100%; }
.cap-input-url { text-align: left; font-size: 12.5px; }
.cap-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.cap-add { flex: 1 1 170px; padding: 10px 12px; border: 1px dashed var(--border-2); border-radius: var(--radius); background: transparent; color: var(--ink-2); font-family: inherit; font-size: 12.5px; cursor: pointer; transition: color .15s ease, border-color .15s ease, background .15s ease; }
.cap-add:hover { color: var(--ink); border-color: var(--accent); background: var(--surface-2); }
.cap-add-link { color: var(--accent); border-color: var(--accent-soft); }
.cap-add-link:hover { color: var(--accent-dark); }
.cap-preview { padding: 12px; border-radius: var(--radius); background: var(--bg); box-shadow: var(--nm-in-sm); }
.cap-preview-head { font-size: 11.5px; color: var(--ink-3); margin-bottom: 8px; }
.cap-preview-body { font-size: 13px; line-height: 1.9; color: var(--ink); white-space: pre-wrap; word-break: break-word; }
.cap-preview-empty { font-size: 12.5px; color: var(--ink-3); }
.cap-chip-link { color: var(--accent); text-decoration: underline; text-underline-offset: 3px; }
.cap-preview-note { margin-top: 8px; font-size: 11px; line-height: 1.8; color: var(--ink-3); }
@media (max-width: 560px) {
  .cap-add { flex: 1 1 100%; }
}
.kpi-filter-bar .kpi-shift-chip.active {
  color: #fff;
  background: var(--accent);
  box-shadow: var(--nm-in-sm);
}

.kpi-shift-select {
  min-width: 190px;
  font-size: 12.5px;
}

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

.kpi-date-fields[hidden] {
  display: none;
}

.kpi-shift-window {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  flex-basis: 100%;
  margin-top: -4px;
  font-size: 12.5px;
  color: var(--ink-2);
}

.kpi-shift-window[hidden] {
  display: none;
}

.kpi-shift-window-name {
  font-weight: 800;
  color: var(--ink);
}

.kpi-shift-window-hint {
  color: var(--ink-3);
}

.kpi-shift-live {
  padding: 3px 10px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 800;
  color: var(--accent-dark);
  background: var(--accent-soft);
}

@media (max-width: 720px) {
  .kpi-shift-select {
    grid-column: 1 / -1;
    width: 100%;
    min-width: 0;
  }

  .kpi-date-fields {
    display: grid;
    grid-column: 1 / -1;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    width: 100%;
  }

  .kpi-date-fields .btn {
    grid-column: span 2;
  }
}
.pch-search { margin-bottom: 12px; }
.pch-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px 12px;
  padding: 10px 4px 14px;
  margin-bottom: 4px;
  border-bottom: 1px solid var(--border-2);
}
.pch-select-all { display: inline-flex; align-items: center; gap: 9px; min-height: 28px; cursor: pointer; font-size: 13px; font-weight: 600; }
.pch-select-all input { width: 18px; height: 18px; margin: 0; accent-color: var(--accent); cursor: inherit; flex-shrink: 0; }
.pch-select-all:has(input:disabled) { cursor: default; opacity: 0.55; }
.pch-select-all input:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.pch-count { font-size: 11.5px; font-weight: 500; color: var(--ink-3); }
.pch-list { display: flex; flex-direction: column; gap: 2px; max-height: 320px; overflow-y: auto; padding: 4px; }
.pch-channel { min-height: 44px; padding: 8px 10px; border-radius: 10px; transition: background 0.15s var(--ease); }
.pch-channel:hover, .pch-channel:focus-within { background: var(--surface-2); }
.pch-channel:has(input:checked) { background: var(--accent-soft); }
.pch-channel .toggle-label { font-size: 13px; font-weight: 500; overflow-wrap: anywhere; }
.pch-empty { text-align: center; color: var(--ink-3); padding: 28px 12px; font-size: 13px; }
.pch-heading { display: flex; align-items: center; gap: 8px; min-width: 0; }
.pch-toolbar[hidden], .pch-search[hidden], .pch-channel[hidden], .pch-empty[hidden] { display: none; }

.admins-header {
  align-items: flex-start;
  gap: 12px;
}

.admins-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  flex: 1;
  min-width: 0;
}

.admins-search {
  position: relative;
  flex: 1;
  min-width: 200px;
  max-width: 340px;
}

.admins-search svg {
  position: absolute;
  top: 50%;
  right: 12px;
  transform: translateY(-50%);
  color: var(--ink-3);
  pointer-events: none;
}

.admins-search .form-input {
  width: 100%;
  padding-right: 34px;
}

.admins-search .form-input::-webkit-search-cancel-button {
  -webkit-appearance: none;
  appearance: none;
}

.admins-type-filter {
  width: auto;
  min-width: 160px;
}

@media (max-width: 560px) {
  .admins-toolbar {
    width: 100%;
  }

  .admins-search,
  .admins-type-filter {
    flex: 1 1 100%;
    max-width: none;
    min-width: 0;
    width: 100%;
  }
}

.mse-hero {
  padding: 24px;
  border: 1px solid var(--border-2);
  border-radius: 20px;
  background: var(--surface-2);
  margin-bottom: 20px;
}
.mse-heading { display: flex; align-items: center; gap: 14px; }
.mse-hero-title { font-size: 18px; font-weight: 800; color: var(--ink); margin: 0 0 5px; }
.mse-search-wrap { display: flex; flex-direction: column; gap: 8px; margin-top: 20px; }
.mse-search-wrap .form-label { margin: 0; }
.mse-query { resize: vertical; min-height: 105px; max-height: 340px; line-height: 1.95; text-align: right; box-shadow: none; border: 2px solid var(--border-2); border-radius: 12px; background: var(--surface); }
#msg-pane-edit .mse-query:focus { outline: none; border-color: var(--accent); box-shadow: none; }
.mse-search-foot { display: flex; align-items: center; justify-content: flex-end; flex-wrap: wrap; gap: 12px; }
.mse-search-btn { min-width: 200px; min-height: 42px; }
.mse-hint { font-size: 11px; color: var(--ink-2); line-height: 1.9; }
.mse-text-btn { border: none; background: transparent; color: var(--accent-dark); font: inherit; font-size: 11.5px; font-weight: 700; padding: 8px 2px; cursor: pointer; }
.mse-text-btn:hover { text-decoration: underline; }
.mse-text-btn:disabled { opacity: 0.5; cursor: default; }
.mse-toolbar { position: sticky; top: 10px; z-index: 5; display: flex; align-items: center; gap: 16px; flex-wrap: wrap; padding: 13px 16px; border: 1px solid var(--border-2); border-radius: 14px; background: var(--surface-2); box-shadow: 0 3px 12px rgba(46,49,80,0.06); margin-bottom: 16px; }
.mse-count { font-size: 11.5px; color: var(--ink-2); }
.mse-actions { display: flex; gap: 8px; margin-inline-start: auto; }
.mse-actions .btn { min-height: 40px; }
.mse-danger-outline { color: var(--red-dark); border: 1px solid var(--red); box-shadow: none; }
.mse-danger-outline:hover:not(:disabled) { background: var(--red-soft); }
.mse-results { display: flex; flex-direction: column; gap: 12px; }
.mse-loading { display: flex; flex-direction: column; align-items: center; gap: 16px; padding: 48px 16px; color: var(--ink-2); font-size: 12px; }
.mse-loading-dots { display: flex; gap: 8px; }
.mse-loading-dots span { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); animation: mse-bounce 1.1s ease-in-out infinite; }
.mse-loading-dots span:nth-child(2) { animation-delay: 0.15s; }
.mse-loading-dots span:nth-child(3) { animation-delay: 0.3s; }
@keyframes mse-bounce { 0%,80%,100% { transform: scale(0.6); opacity: 0.5; } 40% { transform: scale(1); opacity: 1; } }
.mse-card { padding: 18px 20px; border-radius: 16px; background: var(--surface-2); border: 1px solid var(--border-2); }
.mse-card.active { border-color: var(--accent); box-shadow: inset -3px 0 var(--accent); }
.mse-card.has-error { border-color: var(--red); }
.mse-card-head { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px; margin-bottom: 14px; }
.mse-check { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; min-height: 28px; min-width: 0; }
.mse-check input { width: 19px; height: 19px; flex-shrink: 0; accent-color: var(--accent); cursor: pointer; }
.mse-channel { font-size: 13px; font-weight: 800; color: var(--ink); overflow-wrap: anywhere; }
.mse-select-control { font-size: 12px; font-weight: 700; }
.mse-badges { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; }
.mse-badge,.mse-score { padding: 4px 9px; border-radius: 8px; font-size: 10.5px; white-space: nowrap; }
.mse-badge { background: var(--surface); color: var(--ink-2); }
.mse-score { background: var(--accent-soft); color: var(--accent-dark); font-weight: 700; }
.mse-text { font-size: 13px; color: var(--ink); line-height: 2.1; white-space: pre-wrap; overflow-wrap: anywhere; user-select: text; }
.mse-expand { margin-top: 4px; }
.mse-card-foot { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 10px; margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--border-2); }
.mse-stamp { font-size: 10.5px; color: var(--ink-2); }
.mse-link { font-size: 11.5px; color: var(--accent-dark); font-weight: 700; text-decoration: none; padding-block: 4px; }
.mse-link:hover { text-decoration: underline; }
.mse-modal-info { font-size: 12.5px; color: var(--ink-2); line-height: 1.95; margin-bottom: 14px; }
.mse-target-summary { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 18px; max-height: 140px; overflow-y: auto; }
.mse-target-summary span { padding: 6px 10px; border: 1px solid var(--border-2); background: var(--surface-2); border-radius: 8px; font-size: 11px; overflow-wrap: anywhere; }
.mse-target-summary b { color: var(--accent-dark); margin-inline-start: 8px; }
.mse-edit-field { line-height: 2; min-height: 150px; resize: vertical; margin-bottom: 10px; }
.mse-counter { margin-top: 8px; font-size: 11.5px; color: var(--ink-2); }
.mse-counter.over { color: var(--red-dark); font-weight: 700; }
.mse-delete-warning { padding: 14px; border-radius: 12px; color: var(--red-dark); background: var(--red-soft); font-size: 12px; line-height: 2; }
.mse-feedback { padding: 13px 16px; margin-bottom: 16px; border-radius: 12px; color: var(--green-dark); background: var(--green-soft); font-size: 12px; line-height: 1.9; }
.mse-feedback.has-error { background: var(--amber-soft); color: var(--amber-dark); }
.mse-item-error { margin-top: 12px; padding: 8px 12px; font-size: 12px; line-height: 1.9; color: var(--red-dark); background: var(--red-soft); border-radius: 8px; }
.mse-empty { display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 36px 20px; border: 1px dashed var(--border-2); border-radius: 16px; text-align: center; color: var(--ink-2); }
.mse-empty-icon { display: grid; place-items: center; width: 48px; height: 48px; border-radius: 14px; background: var(--accent-soft); color: var(--accent-dark); margin-bottom: 2px; }
.mse-empty strong { color: var(--ink); font-size: 13px; }
.mse-empty p { max-width: 420px; font-size: 12px; line-height: 1.9; }
#msg-pane-edit :focus-visible,#modal-mse-edit :focus-visible,#modal-mse-delete :focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.notif-time { display: block; font-size: 10px; color: var(--ink-2); margin-top: 7px; }
.notif-install { margin-top: 14px; padding: 14px 4px 2px; border-top: 1px solid var(--border-2); }
@media (max-width: 768px) {
  .mse-hero { padding: 18px 16px; }
  .mse-heading { align-items: flex-start; gap: 10px; }
  .mse-hero-title { font-size: 15px; }
  .mse-search-btn { width: 100%; min-width: 0; }
  .mse-toolbar { top: 6px; gap: 8px 12px; padding: 12px; }
  .mse-actions { width: 100%; margin-inline-start: 0; }
  .mse-actions .btn { flex: 1; }
  .mse-card { padding: 16px; }
  .mse-card-head { gap: 8px; }
  .mse-text { font-size: 12px; }
  #modal-mse-edit .modal-footer,#modal-mse-delete .modal-footer { flex-wrap: wrap; }
  #modal-mse-edit .modal-footer .btn,#modal-mse-delete .modal-footer .btn { flex: 1; }
}
@media (prefers-reduced-motion: reduce) { .mse-loading-dots span { animation: none; } }

.np-photo {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px;
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--nm-in-sm);
}

.np-photo-thumb {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 82px;
  height: 82px;
  overflow: hidden;
  border-radius: var(--radius-lg);
  background: var(--accent-soft);
  box-shadow: var(--nm-in-sm);
  font-size: 11px;
  color: var(--ink-3);
}

.np-photo-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.np-photo-body {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
  flex: 1 1 auto;
}

.np-photo-name {
  font-size: 12.5px;
  font-weight: 700;
  color: var(--ink-1);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.np-photo-hint {
  font-size: 11px;
  color: var(--ink-3);
}

.np-photo-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 2px;
}

.np-photo-actions .btn {
  padding: 6px 14px;
  font-size: 12px;
}

@media (max-width: 560px) {
  .np-photo {
    flex-direction: column;
    align-items: stretch;
    text-align: center;
  }

  .np-photo-thumb {
    width: 100%;
    height: 140px;
  }

  .np-photo-actions {
    justify-content: center;
  }
}

#page-logs .msg-filters {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) repeat(5, minmax(0, 1fr)) max-content;
  align-items: stretch;
}
#page-logs .msg-search-wrap { min-width: 0; }
#page-logs .msg-filters > select.form-input { width: 100%; }
#page-logs .msg-date-range { grid-column: 1 / -1; }
#log-export {
  padding: 12px 16px;
  border: 1px solid var(--border-2);
  border-radius: var(--radius);
  font-size: 13.5px;
}
@media (max-width: 1100px) {
  #page-logs .msg-filters { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  #page-logs .msg-search-wrap { grid-column: 1 / -1; }
}
@media (max-width: 720px) {
  #page-logs .msg-filters { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  #log-export { font-size: 16px; }
}
.log-summary { font-size: 12.5px; font-weight: 700; color: var(--ink-3); margin: -8px 2px 14px; }
.log-empty { text-align: center; font-size: 13px; font-weight: 700; color: var(--ink-3); padding: 40px 10px; }
.log-card {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--nm-out-sm);
  padding: 14px 16px;
  margin-bottom: 12px;
  position: relative;
  overflow: hidden;
  transition: box-shadow 0.2s ease;
}
.log-card::before {
  content: '';
  position: absolute;
  top: 0;
  bottom: 0;
  inset-inline-start: 0;
  width: 4px;
  border-radius: 14px;
  background: var(--green);
}
.log-card.failed::before { background: var(--red); }
.log-card:hover { box-shadow: var(--nm-out); }
.log-card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; cursor: pointer; flex-wrap: wrap; }
.log-actor { display: flex; align-items: center; gap: 10px; min-width: 0; }
.log-actor-meta { min-width: 0; }
.log-actor-name { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 800; }
.log-actor-badge { font-size: 10.5px; font-weight: 800; border-radius: 14px; padding: 2px 9px; color: var(--ink-2); background: var(--surface-2); }
.log-actor-badge.owner { color: var(--accent-dark); background: var(--accent-soft); }
.log-actor-badge.settings { color: var(--sky-dark); background: var(--sky-soft); }
.log-actor-badge.news { color: var(--green-dark); background: var(--green-soft); }
.log-action { font-size: 12.5px; font-weight: 700; color: var(--ink-2); margin-top: 4px; line-height: 1.8; }
.log-card-side { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
.log-status { font-size: 10.5px; font-weight: 800; border-radius: 14px; padding: 3px 10px; }
.log-status.ok { color: var(--green-dark); background: var(--green-soft); }
.log-status.bad { color: var(--red-dark); background: var(--red-soft); }
.log-card-body { display: none; }
.log-card.expanded .log-card-body { display: block; animation: page-in 0.3s cubic-bezier(0.22, 1, 0.36, 1); }
.log-meta { display: flex; flex-wrap: wrap; gap: 8px; margin: 14px 2px 0; }
.log-tag { font-size: 11px; font-weight: 700; color: var(--ink-2); background: var(--surface-2); border-radius: 12px; padding: 4px 10px; }
.log-tag.mono { font-family: 'SF Mono', 'Fira Code', Consolas, monospace; font-size: 10.5px; }
@media (max-width: 760px) {
  .log-card-head { align-items: flex-start; }
  .log-card-side { align-self: flex-end; }
}

.pa-platforms { display: flex; flex-direction: column; gap: 18px; }
.pa-platform { border: 1px solid var(--border-2); border-radius: 18px; padding: 16px; background: var(--surface); }
.pa-platform-head { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.platform-logo { width: 28px; height: 28px; border-radius: 8px; object-fit: contain; flex-shrink: 0; }
.pa-platform-main { flex: 1; min-width: 0; }
.pa-platform-title { font-size: 14px; font-weight: 800; }
.pa-platform-sub { font-size: 11.5px; font-weight: 600; color: var(--ink-3); margin-top: 3px; }
.pa-guide { background: var(--surface-2); border-radius: 14px; padding: 10px 14px; margin-bottom: 14px; }
.pa-guide > summary { cursor: pointer; font-size: 12.5px; font-weight: 800; color: var(--ink-2); list-style: none; }
.pa-guide > summary::-webkit-details-marker { display: none; }
.pa-guide > summary::after { content: '+'; margin-inline-start: 6px; font-size: 14px; font-weight: 900; color: var(--ink-3); }
.pa-guide[open] > summary { margin-bottom: 10px; }
.pa-guide[open] > summary::after { content: '−'; }
.pa-steps { margin: 0; padding-inline-start: 18px; display: flex; flex-direction: column; gap: 6px; font-size: 12.5px; color: var(--ink-2); line-height: 1.9; }
.pa-notes { margin: 10px 0 0; padding-inline-start: 18px; display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--ink-3); line-height: 1.8; }
.pa-list { display: flex; flex-direction: column; gap: 10px; }
.pa-empty { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; border: 1px dashed var(--border-2); border-radius: 14px; padding: 16px; background: var(--surface-2); }
.pa-empty-title { font-size: 12.5px; font-weight: 800; color: var(--ink-2); }
.pa-empty-desc { font-size: 11.5px; color: var(--ink-3); line-height: 1.8; }
.pa-card { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; border: 1px solid var(--border-2); border-radius: 14px; padding: 12px 14px; }
.pa-card.off { opacity: 0.68; }
.pa-card-main { flex: 1; min-width: 200px; }
.pa-card-title { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 800; }
.pa-card-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 8px; font-size: 11.5px; color: var(--ink-3); }
.pa-card-channels { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.pa-card-error { margin-top: 8px; font-size: 11.5px; color: var(--red-dark); line-height: 1.8; }
.pa-card-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.pa-when { font-size: 11px; color: var(--ink-3); }
.pa-usage { display: flex; align-items: center; gap: 8px; margin-top: 8px; }
.pa-usage-text { font-size: 11px; font-weight: 700; color: var(--ink-3); }
.pa-usage-text.full { color: var(--red-dark); }
.pa-usage-bar { flex: 1; max-width: 180px; height: 5px; border-radius: 4px; background: var(--surface-2); overflow: hidden; }
.pa-usage-fill { display: block; height: 100%; border-radius: 4px; background: var(--accent); }
.pa-usage-fill.full { background: var(--red); }
.pa-chip { font-size: 10.5px; font-weight: 800; border-radius: 14px; padding: 3px 10px; color: var(--ink-2); background: var(--surface-2); }
.pa-chip.soft { font-weight: 600; color: var(--ink-3); }
.pa-chip.ok { color: var(--green-dark); background: var(--green-soft); }
.pa-chip.warn { color: var(--accent-dark); background: var(--accent-soft); }
.pa-chip.fail { color: var(--red-dark); background: var(--red-soft); }
.pa-chip.off { color: var(--ink-3); background: var(--surface-2); }
.pa-modal-guide { background: var(--surface-2); border-radius: 14px; padding: 12px 14px; margin-bottom: 14px; }
.pa-modal-guide-title { font-size: 12.5px; font-weight: 800; color: var(--ink-2); margin-bottom: 8px; }
.pa-modal-steps { margin: 0; padding-inline-start: 18px; display: flex; flex-direction: column; gap: 6px; font-size: 12.5px; color: var(--ink-2); line-height: 1.9; }
.pa-modal-note { font-size: 11.5px; color: var(--ink-3); line-height: 1.8; }
.pa-token-row { display: flex; gap: 8px; align-items: center; }
.pa-token-row .form-input { flex: 1; }
@media (max-width: 760px) {
  .pa-card-actions { width: 100%; }
}

.ads-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
  margin-bottom: 22px;
}

.ads-toolbar .tabs { max-width: 100%; overflow-x: auto; scrollbar-width: none; }
.ads-toolbar .tabs::-webkit-scrollbar { display: none; }
.ads-toolbar .tab-btn { white-space: nowrap; }

.ads-toolbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.ads-source-badge { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

.ads-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11.5px;
  font-weight: 700;
  padding: 5px 12px;
  border-radius: var(--radius-pill);
  background: var(--bg);
  box-shadow: var(--nm-out-sm);
  color: var(--ink-2);
  white-space: nowrap;
}

.ads-badge::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
  background: currentColor;
}

.ads-badge-ok { color: var(--green-dark); }
.ads-badge-err { color: var(--red-dark); }
.ads-badge-warn { color: var(--amber-dark); }
.ads-badge-wait { color: var(--accent); }
.ads-badge-muted { color: var(--ink-3); }
.ads-badge-info { color: var(--sky-dark); }

.ads-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding: 14px 18px;
  margin-bottom: 16px;
  border-radius: var(--radius-lg);
  background: var(--bg);
  box-shadow: var(--nm-in-sm);
}

.ads-head-text { font-size: 12.5px; color: var(--ink-2); line-height: 1.8; }

.ads-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 18px;
  margin-bottom: 20px;
}

.ads-card {
  background: var(--bg);
  border: none;
  border-radius: var(--radius-lg);
  box-shadow: var(--nm-out);
  transition: transform 0.25s var(--ease), box-shadow 0.25s var(--ease);
}

.ads-card:hover { transform: translateY(-2px); }
.ads-card + .ads-card { margin-top: 18px; }

.ads-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding: 18px 22px 14px;
  border-bottom: 1px solid var(--border-2);
}

.ads-card-ident {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
  min-width: 200px;
}

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

.ads-card-icon svg { width: 20px; height: 20px; }

.ads-card-title { font-size: 14.5px; font-weight: 800; }
.ads-card-sub { font-size: 11.5px; color: var(--ink-3); margin-top: 4px; line-height: 1.7; }

.ads-card-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.ads-card-body {
  padding: 16px 22px 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.ads-section-title {
  font-size: 11px;
  font-weight: 800;
  color: var(--ink-3);
  margin-bottom: 9px;
}

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

.ads-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11.5px;
  font-weight: 700;
  color: var(--ink-2);
  background: var(--bg);
  box-shadow: var(--nm-in-sm);
  border-radius: var(--radius-pill);
  padding: 6px 12px;
}

.ads-chip::before {
  content: '';
  width: 5px;
  height: 5px;
  border-radius: 50%;
  flex-shrink: 0;
  background: var(--accent);
}

.ads-chip-muted { color: var(--ink-3); }
.ads-chip-muted::before { background: var(--ink-3); }

.ads-sch-list { display: flex; flex-direction: column; gap: 8px; }

.ads-sch-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  font-size: 12px;
  color: var(--ink-2);
  padding: 9px 14px;
  border-radius: var(--radius);
  background: var(--bg);
  box-shadow: var(--nm-in-sm);
}

.ads-sch-time {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-weight: 700;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}

.ads-sch-time svg { width: 14px; height: 14px; color: var(--ink-3); }
.ads-sch-del { font-size: 11.5px; color: var(--ink-3); }
.ads-sch-row .ads-icon-btn { margin-inline-start: auto; }
.ads-sch-error { flex-basis: 100%; font-size: 11.5px; color: var(--red-dark); }

.ads-row {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  background: var(--bg);
  border-radius: var(--radius-lg);
  box-shadow: var(--nm-out);
  padding: 14px 18px;
  transition: transform 0.25s var(--ease), box-shadow 0.25s var(--ease);
}

.ads-row:hover { transform: translateY(-2px); }
.ads-row + .ads-row { margin-top: 14px; }

.ads-row-icon {
  width: 42px;
  height: 42px;
  flex-shrink: 0;
  border-radius: var(--radius);
  background: var(--surface-2);
  box-shadow: var(--nm-in-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent);
}

.ads-row-icon svg { width: 19px; height: 19px; }

.ads-row-main { flex: 1; min-width: 170px; }
.ads-row-title { font-size: 13.5px; font-weight: 800; }
.ads-row-sub { font-size: 11.5px; color: var(--ink-3); margin-top: 4px; line-height: 1.7; }

.ads-row-side { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

.ads-row-note {
  font-size: 11px;
  font-weight: 700;
  color: var(--ink-3);
  background: var(--bg);
  box-shadow: var(--nm-in-sm);
  border-radius: var(--radius-pill);
  padding: 5px 11px;
  white-space: nowrap;
}

.ads-platform-icon {
  width: 22px;
  height: 22px;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  flex-shrink: 0;
}

.ads-platform-tg {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--accent);
}

.ads-platform-tg svg { width: 20px; height: 20px; }

.ads-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 38px 18px;
  border-radius: var(--radius-lg);
  background: var(--bg);
  box-shadow: var(--nm-in-sm);
}

.ads-empty-icon {
  width: 54px;
  height: 54px;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 12px;
}

.ads-empty-icon svg { width: 22px; height: 22px; }
.ads-empty-title { font-size: 13.5px; font-weight: 800; color: var(--ink-2); }
.ads-empty-sub { font-size: 11.5px; color: var(--ink-3); line-height: 1.9; margin-top: 5px; max-width: 320px; }
.ads-empty-sm { font-size: 12px; color: var(--ink-3); padding: 12px 4px; text-align: center; }

.ads-setting-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
  padding: 14px 0;
}

.ads-setting-row + .ads-setting-row { border-top: 1px solid var(--border-2); }
.ads-setting-title { font-weight: 800; font-size: 13.5px; }
.ads-setting-sub { font-size: 11.5px; color: var(--ink-3); margin-top: 4px; line-height: 1.8; }

.ads-inline-form { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.ads-inline-form .form-input { flex: 1; min-width: 140px; }

.ads-sign-row {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 12.5px;
  padding: 9px 14px;
  border-radius: var(--radius-pill);
  background: var(--bg);
  box-shadow: var(--nm-in-sm);
}

.ads-sign-row + .ads-sign-row { margin-top: 8px; }
.ads-sign-arrow { color: var(--ink-3); }
.ads-sign-row > span:first-child { font-weight: 700; }
.ads-sign-row .ads-icon-btn { margin-inline-start: auto; }

.ads-icon-btn {
  border: none;
  background: transparent;
  color: var(--ink-3);
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
  width: 26px;
  height: 26px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: color 0.2s var(--ease), box-shadow 0.2s var(--ease);
}

.ads-icon-btn:hover { color: var(--red-dark); box-shadow: var(--nm-out-sm); }

.ads-log-row {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  font-size: 12.5px;
  padding: 12px 18px;
  border-radius: var(--radius-lg);
  background: var(--bg);
  box-shadow: var(--nm-out-sm);
  overflow: hidden;
}

.ads-log-row + .ads-log-row { margin-top: 10px; }

.ads-log-row::before {
  content: '';
  position: absolute;
  inset-inline-start: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  background: var(--green);
}

.ads-log-row.is-error::before { background: var(--red); }
.ads-log-text { flex: 1; min-width: 180px; color: var(--ink-2); line-height: 1.8; }
.ads-log-time { font-size: 11px; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.ads-log-more { display: flex; justify-content: center; margin-top: 14px; }

.ads-picker {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.ads-picker-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 12.5px;
  font-weight: 800;
  margin-bottom: 9px;
}

.ads-msg-list,
.ads-target-box {
  max-height: 280px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 10px;
  border-radius: var(--radius-lg);
  box-shadow: var(--nm-in-sm);
}

.ads-msg,
.ads-pick {
  display: flex;
  align-items: center;
  gap: 9px;
  text-align: right;
  font-family: inherit;
  font-size: 12.5px;
  color: var(--ink);
  background: var(--bg);
  border: none;
  border-radius: var(--radius);
  box-shadow: var(--nm-out-sm);
  padding: 10px 13px;
  cursor: pointer;
  transition: color 0.2s var(--ease), box-shadow 0.2s var(--ease), transform 0.2s var(--ease);
}

.ads-msg:hover,
.ads-pick:hover { color: var(--accent-dark); }
.ads-msg { flex-direction: column; align-items: stretch; gap: 5px; }
.ads-msg.active,
.ads-pick.active { color: var(--accent); box-shadow: var(--nm-in-sm); }

.ads-msg-head { display: flex; align-items: center; gap: 6px; }
.ads-msg-id { font-weight: 800; }
.ads-msg-kind {
  font-size: 10.5px;
  font-weight: 700;
  color: var(--ink-3);
  background: var(--bg);
  box-shadow: var(--nm-in-sm);
  border-radius: var(--radius-pill);
  padding: 2px 8px;
}
.ads-msg-star { color: var(--amber-dark); margin-inline-start: auto; }
.ads-msg-text {
  font-size: 12px;
  color: var(--ink-2);
  line-height: 1.8;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.ads-msg-date { font-size: 11px; color: var(--ink-3); }
.ads-pick-sub { font-size: 11px; color: var(--ink-3); margin-inline-start: auto; }

.ads-note {
  margin-top: 14px;
  font-size: 12px;
  color: var(--ink-3);
  line-height: 1.9;
  padding: 12px 16px;
  border-radius: var(--radius-lg);
  box-shadow: var(--nm-in-sm);
}

.ads-note-warn {
  color: var(--amber-dark);
  display: grid;
  gap: 6px;
}
.ads-note-warn svg { vertical-align: -2px; }

.ads-schedule-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.ads-card-actions .btn.btn-sm,
.ads-row-side .btn.btn-sm { gap: 6px; padding: 8px 14px; }

@media (max-width: 720px) {
  .ads-picker,
  .ads-schedule-grid { grid-template-columns: 1fr; }
  .ads-toolbar .tabs { width: 100%; }
  .ads-toolbar-actions { width: 100%; justify-content: space-between; }
  .ads-card-head { padding: 16px 16px 12px; }
  .ads-card-body { padding: 14px 16px 18px; }
  .ads-card-actions { width: 100%; }
  .ads-row { padding: 14px 16px; }
}

.itr-warn { font-size: 12.5px; line-height: 1.9; padding: 12px 16px; border-radius: 14px; margin-bottom: 18px; background: var(--amber-soft); color: var(--amber-dark); }
.itr-group { margin-bottom: 26px; }
.itr-group-title { font-size: 12.5px; font-weight: 800; color: var(--ink-3); margin: 0 2px 12px; }
.itr-stat-icon { overflow: hidden; }
.itr-stat-icon img { width: 22px; height: 22px; object-fit: contain; border-radius: 7px; }
#itr-stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 18px; }
#itr-stats > .stat-card { min-width: 0; }
.itr-grid { grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr)); gap: 18px; }
.itr-card.channel-card { padding: 0; }
.itr-card.channel-card.big .card-body { padding: 18px; }
.itr-card.channel-card.big .ch-card-head { gap: 10px; margin-bottom: 12px; }
.itr-card .ch-avatar { width: 38px; height: 38px; border-radius: 12px; font-size: 17px; }
.itr-card .ch-title { font-size: 14px; }
.itr-card.channel-card.inactive { opacity: 1; }
.itr-plats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; margin: 0; }
.itr-plat { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; min-width: 0; min-height: 64px; padding: 8px 2px; border: 1px solid transparent; border-radius: 12px; background: var(--bg-2); color: var(--ink); font-family: inherit; cursor: pointer; }
.itr-plat:hover { border-color: var(--border-2); }
.itr-plat:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.itr-plat-icon { display: inline-flex; position: relative; align-items: center; justify-content: center; width: 28px; height: 28px; }
.itr-plat-logo { width: 20px; height: 20px; border-radius: 6px; flex: 0 0 20px; object-fit: contain; }
.itr-plat-icon .itr-plat-logo { width: 24px; height: 24px; flex: 0 0 24px; }
.itr-plat-name { font-size: 12.5px; font-weight: 700; color: var(--ink); }
.itr-plats .itr-plat-name { max-width: 100%; font-size: 12px; line-height: 1.5; white-space: nowrap; }
.itr-plat-mark { position: absolute; bottom: -3px; inset-inline-end: -4px; display: inline-flex; align-items: center; justify-content: center; width: 14px; height: 14px; border: 2px solid var(--bg-2); border-radius: 50%; color: #fff; }
.itr-plat-mark svg { width: 7px; height: 7px; }
.itr-plat.on .itr-plat-mark { background: var(--green); }
.itr-plat.off .itr-plat-mark { background: var(--red); }
.itr-plat.paused .itr-plat-mark, .itr-plat.locked .itr-plat-mark { background: var(--ink-3); }
.itr-card.channel-card.big .ch-actions { justify-content: flex-end; gap: 8px; margin-top: 12px; }
.itr-card .ch-action { width: 44px; height: 44px; }
@media (max-width: 820px) {
  #itr-stats { grid-template-columns: 1fr; gap: 12px; }
  #itr-stats > .stat-card { grid-column: auto; }
}
.itr-target { padding: 16px; border-radius: 16px; background: var(--bg-2); margin-bottom: 14px; }
.itr-target-head { display: flex; align-items: center; gap: 8px; margin-bottom: 14px; }
.itr-target-head img { width: 20px; height: 20px; border-radius: 6px; object-fit: contain; }
.itr-target-name { font-size: 13px; font-weight: 800; flex: 1; }
.itr-target-note { font-size: 11.5px; color: var(--ink-3); line-height: 1.8; margin-top: 6px; }
.itr-id-row { display: flex; align-items: center; gap: 8px; }
.itr-id-row .form-input { flex: 1; min-width: 0; }
.itr-id-row .btn { white-space: nowrap; }
.itr-state-row { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-radius: 14px; background: var(--bg-2); margin-bottom: 10px; }
.itr-state-info { flex: 1; min-width: 0; }
.itr-state-info .itr-target-note { margin-top: 3px; }
.itr-test-result { margin-top: 10px; display: flex; flex-direction: column; gap: 8px; }

.cov-list { display: flex; flex-direction: column; gap: 8px; margin-bottom: 10px; }
.cov-empty { font-size: 12.5px; color: var(--ink-3); text-align: center; padding: 16px 10px; background: var(--bg); border-radius: 12px; box-shadow: var(--nm-in-sm); }
.cov-row { 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; text-align: right; transition: all 0.2s ease; }
.cov-row:hover { border-color: rgba(108, 93, 211, 0.5); }
.cov-row-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.cov-row-title { font-size: 13px; font-weight: 800; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cov-row-sub { font-size: 11.5px; color: var(--ink-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cov-warn { color: var(--red-dark); font-weight: 700; }
.cov-stage { max-height: 320px; margin: 0 auto; }
.cov-actions { justify-content: space-between; }
.wmp-axis-locked { opacity: 0.4; }
.wmp-axis-locked input[type="range"] { cursor: not-allowed; }
/* cover editor – meta row */
.cov-meta-row { display: flex; gap: 10px; margin-bottom: 0; }
.cov-meta-name { flex: 1; min-width: 0; }
.cov-meta-canvas { width: 130px; flex-shrink: 0; }
/* cover editor – file upload */
.cov-file-wrap { display: flex; align-items: center; gap: 10px; }
.cov-file-btn { display: inline-flex; align-items: center; justify-content: center; padding: 7px 16px; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--border); font-size: 12.5px; font-weight: 700; color: var(--ink-2); cursor: pointer; white-space: nowrap; transition: border-color 0.18s, color 0.18s; }
.cov-file-btn:hover { border-color: var(--accent); color: var(--accent); }
.cov-file-wrap input[type="file"] { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.cov-file-status { font-size: 12px; color: var(--ink-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; min-width: 0; }
/* cover editor – scope card */
.cov-scope-card { background: var(--surface-2); border: 1px solid var(--border-2); border-radius: 12px; padding: 4px 14px; margin-top: 18px; margin-bottom: 14px; box-shadow: var(--nm-in-sm); }
.cov-scope-card .toggle-row { padding: 12px 0; border-bottom: none; }
.cov-tag-divider { height: 1px; background: var(--border-2); margin: 0 -14px 14px; }
.cov-scope-card #cov-tag-group { padding-top: 0; padding-bottom: 14px; }
.wm-scope-card { margin-top: 0; }
.wm-scope-card #wm-tag-group { padding-top: 0; padding-bottom: 14px; }
.cov-row.wm-row-active { border-color: var(--accent); box-shadow: 0 0 0 2px rgba(108, 93, 211, 0.18); }
.wm-add-btn { flex: 0 0 auto; width: 100%; }
.wm-delete-btn { width: 100%; color: var(--red-dark); }

.sso-bridge {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--bg);
  padding: 24px;
}

.sso-bridge-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  text-align: center;
}

.sso-bridge .spinner-lg {
  width: 30px;
  height: 30px;
  border-width: 3px;
  border-color: var(--border-2);
  border-top-color: var(--accent);
}

.sso-bridge-title { font-size: 15px; font-weight: 800; color: var(--ink); }
.sso-bridge-hint { font-size: 12.5px; color: var(--ink-3); }
.sso-bridge-link { font-size: 12.5px; font-weight: 700; color: var(--accent); }

.modal-backdrop, .modal-backdrop *,
.wiz-config, .wiz-config *,
.wmp-overlay, .wmp-overlay *,
.kpi-fullscreen-backdrop, .card.kpi-fullscreen, .card.kpi-fullscreen *,
.pch-list, .dup-text, .mse-target-summary, #wiz-palette {
  scrollbar-width: none;
  -ms-overflow-style: none;
}
.modal-backdrop::-webkit-scrollbar, .modal-backdrop *::-webkit-scrollbar,
.wiz-config::-webkit-scrollbar, .wiz-config *::-webkit-scrollbar,
.wmp-overlay::-webkit-scrollbar, .wmp-overlay *::-webkit-scrollbar,
.kpi-fullscreen-backdrop::-webkit-scrollbar, .card.kpi-fullscreen::-webkit-scrollbar, .card.kpi-fullscreen *::-webkit-scrollbar,
.pch-list::-webkit-scrollbar, .dup-text::-webkit-scrollbar, .mse-target-summary::-webkit-scrollbar, #wiz-palette::-webkit-scrollbar {
  display: none;
  width: 0;
  height: 0;
}

.ve-info { margin-top: 8px; font-size: 12px; color: var(--ink-3); line-height: 1.7; }
.ve-info:empty { display: none; }
.ve-preview { display: block; width: 100%; max-height: 240px; margin-top: 10px; border-radius: 12px; background: #000; }
.ve-seg { display: flex; width: fit-content; }
#adv-video_edit.ve-editor { padding: 16px; border: 1px solid var(--border-2); border-radius: 12px; box-shadow: none; background: var(--surface); }
.ve-editor [hidden] { display: none !important; }
.ve-header { position: relative; display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.ve-heading { display: flex; align-items: center; gap: 2px; min-width: 0; }
.ve-heading .adv-title { margin: 0; font-size: 16px; font-weight: 700; color: var(--ink); }
.ve-entry-count { font-size: 14px; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.ve-entry-toolbar { display: flex; align-items: center; gap: 8px; margin-bottom: 20px; }
.ve-entry-toolbar .form-input { flex: 1; min-width: 0; min-height: 44px; margin: 0; padding: 8px 12px; border: 1px solid var(--border-2); border-radius: 8px; box-shadow: none; background: var(--surface-2); font-size: 16px; color: var(--ink); }
.ve-icon-btn { display: inline-flex; align-items: center; justify-content: center; flex: 0 0 44px; width: 44px; height: 44px; padding: 10px; border: 1px solid transparent; border-radius: 8px; background: transparent; color: var(--ink-2); cursor: pointer; }
.ve-icon-btn svg { width: 20px; height: 20px; }
.ve-icon-btn:hover { background: var(--surface-2); color: var(--accent-dark); }
.ve-remove-btn:hover { color: var(--red-dark); background: var(--red-soft); }
.ve-icon-btn:disabled { opacity: .4; cursor: not-allowed; background: transparent; color: var(--ink-2); }
.ve-editor :is(button, select, summary):focus-visible, .ve-file-row:has(input:focus-visible) .cov-file-btn { outline: 2px solid var(--accent); outline-offset: 3px; }
.ve-help > summary { display: grid; place-items: center; width: 44px; height: 44px; cursor: pointer; list-style: none; border-radius: 8px; color: var(--ink-2); }
.ve-help > summary::-webkit-details-marker { display: none; }
.ve-help > summary > span { display: grid; place-items: center; width: 18px; height: 18px; border: 1.5px solid currentColor; border-radius: 50%; font: 600 13px/1 Georgia, serif; }
.ve-help[open] > summary, .ve-help > summary:hover { color: var(--accent-dark); }
.ve-help-pop { position: absolute; z-index: 20; inset-block-start: 48px; inset-inline-start: 0; width: min(320px, 100%); max-height: min(400px, 60dvh); overflow-y: auto; overscroll-behavior: contain; padding: 16px; border: 1px solid var(--border-2); border-radius: 10px; background: var(--surface-2); color: var(--ink); font-size: 14px; line-height: 1.9; box-shadow: 0 4px 16px rgba(0, 0, 0, .1); }
.ve-formats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 4px; padding: 4px; border-radius: 10px; background: var(--surface-2); }
.ve-format-btn { display: flex; justify-content: center; align-items: center; gap: 6px; min-width: 0; min-height: 44px; padding: 8px; border: 0; border-radius: 7px; background: transparent; font-family: inherit; font-size: 14px; font-weight: 500; line-height: 1.6; color: var(--ink-2); cursor: pointer; }
.ve-format-btn.active { background: var(--surface); color: var(--accent-dark); box-shadow: 0 1px 3px rgba(0, 0, 0, .06); }
.ve-tab-check { visibility: hidden; font-size: 12px; }
.ve-format-btn.has-video .ve-tab-check { visibility: visible; }
.ve-file-row { min-width: 0; gap: 4px; margin-top: 12px; }
.ve-file-row .cov-file-btn { min-height: 44px; padding: 8px 12px; border: 1px solid var(--border-2); border-radius: 8px; background: transparent; box-shadow: none; font-size: 14px; font-weight: 500; color: var(--ink); }
.ve-file-row .cov-file-status { padding-inline: 8px; font-size: 14px; color: var(--ink-2); }
.ve-editor .ve-preview { margin-top: 12px; max-height: 220px; border-radius: 8px; }
.ve-position-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--border-2); font-size: 14px; color: var(--ink-2); }
.ve-position-row .ve-seg { margin: 0; padding: 3px; border-radius: 8px; box-shadow: none; background: var(--surface-2); }
.ve-position-row .kpi-seg-btn { min-height: 44px; padding: 8px 18px; border-radius: 6px; font-size: 14px; font-weight: 500; }
.ve-position-row .kpi-seg-btn.active { color: var(--accent-dark); background: var(--surface); box-shadow: 0 1px 3px rgba(0, 0, 0, .06); }
.ve-legacy { margin-top: 16px; padding-top: 12px; border-top: 1px solid var(--border-2); }
.ve-legacy-title { font-size: 14px; color: var(--ink-2); }
.ve-legacy .ve-file-row { margin-top: 4px; }

.aw-stage { max-width: 100%; margin: 12px auto 0; }
.aw-slider { margin: 10px 0 0; }
.aw-preview { position: absolute; display: block; object-fit: fill; pointer-events: none; }

/* Mandatory authenticator enrollment must remain usable on short screens. */
.login-page { height: 100vh; height: 100dvh; }
.login-side { overflow-y: auto; min-height: 0; }
.login-box { margin-top: auto; margin-bottom: auto; }

.ch-platforms { display: flex; flex-wrap: wrap; gap: 8px; margin: 14px 0; }
.ch-platform-chip { display: inline-flex; align-items: center; gap: 6px; border-radius: 10px; background: var(--bg-2); padding: 6px 9px; font-size: 11.5px; font-weight: 700; }
.ch-platform-chip img { width: 20px; height: 20px; object-fit: contain; border-radius: 5px; }
.itr-find-btn { margin-top: 8px; }
.itr-found { font-size: 11.5px; line-height: 1.8; color: var(--ink-3); margin-top: 8px; }

.itr-schedule-tabs { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin-bottom: 20px; }
.itr-schedule-tabs .btn { min-height: 44px; min-width: 0; gap: 6px; padding: 8px 6px; font-size: 14px; }
.itr-schedule-tabs .btn.active { color: var(--accent); outline: 1px solid var(--accent); background: var(--accent-soft); }
.itr-schedule-tabs img { object-fit: contain; border-radius: 4px; }
.itr-schedule-enable { display: flex; align-items: center; justify-content: space-between; min-height: 44px; font-size: 15px; font-weight: 700; cursor: pointer; }
.itr-schedule-help { font-size: 14px; line-height: 1.9; color: var(--ink-2); margin: 10px 0 16px; }
.itr-schedule-fields { border: 0; padding: 0; margin: 0; min-width: 0; }
.itr-schedule-fields > label, .itr-schedule-times label { display: block; font-size: 14px; color: var(--ink-2); }
.itr-schedule-fields > .form-input { width: 100%; min-height: 44px; margin-top: 8px; font-size: 14px; }
.itr-schedule-fields:disabled { opacity: .55; }
.itr-schedule-times { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-top: 16px; }
.itr-schedule-times .form-input { width: 100%; min-width: 0; min-height: 44px; margin-top: 8px; font-size: 16px; color-scheme: light; }
[data-theme="dark"] .itr-schedule-times .form-input { color-scheme: dark; }
.itr-schedule-error { color: var(--red-dark); font-size: 14px; line-height: 1.8; }
#itr-schedule-summary { padding: 12px; border-radius: 12px; background: var(--surface-2); }

.itr-schedule-repeat { margin: 12px 0 20px; }
.itr-schedule-label { font-size: 14px; color: var(--ink-2); margin-bottom: 8px; }
.itr-repeat-options { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 4px; padding: 4px; border-radius: 14px; background: var(--surface-2); border: 1px solid var(--border); }
.itr-repeat-options button, .itr-weekdays button { min-height: 44px; min-width: 0; padding: 6px 4px; font: inherit; font-size: 14px; font-weight: 700; color: var(--ink-2); cursor: pointer; border: 1px solid transparent; border-radius: 10px; background: transparent; }
.itr-repeat-options button[aria-pressed="true"] { color: #fff; background: #7564de; }
.itr-weekdays { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; margin-top: 12px; }
.itr-weekdays[hidden], .itr-once-note[hidden], .itr-schedule-rearm[hidden] { display: none; }
.itr-weekdays button { border-color: var(--border); background: var(--surface-2); }
.itr-weekdays button[aria-pressed="true"] { color: var(--ink); border-color: var(--accent); background: var(--accent-soft); }
.itr-weekdays button[aria-pressed="true"]::before { content: '✓'; margin-inline-end: 4px; }
.itr-repeat-options button:focus-visible, .itr-weekdays button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.itr-repeat-options button:disabled, .itr-weekdays button:disabled { cursor: default; }
.itr-once-note { margin: 10px 0 0; font-size: 14px; line-height: 1.8; color: var(--ink-2); }
.itr-schedule-rearm { margin-top: 8px; min-height: 44px; }
@media (max-width: 360px) {
  .itr-weekdays { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

#adv-translation .translation-route { padding: 16px; margin-bottom: 16px; background: var(--bg); border-radius: var(--radius); }
#adv-translation .grid-2 { gap: 12px; }
#adv-translation .form-group { min-width: 0; margin-bottom: 0; }
#adv-translation .toggle { margin-top: 14px; }
#adv-translation .actions { flex-wrap: wrap; margin-top: 12px; }
#adv-translation .actions .btn { min-height: 44px; max-width: 100%; }
#adv-translation [data-tr-results] { overflow-wrap: anywhere; }
#translation-status { margin-top: 12px; white-space: pre-line; overflow-wrap: anywhere; }
#translation-retry[hidden] { display: none; }

.translation-branding { margin-top: 16px; }
.translation-branding summary { cursor: pointer; font-weight: 700; padding: 12px 0; }
#adv-translation .translation-branding .form-group { margin-top: 12px; }
#adv-translation [hidden] { display: none; }
.translation-watermark-fields { border: 0; padding: 12px 0; margin: 12px 0 0; min-width: 0; }
.translation-watermark-fields legend { font-weight: 700; font-size: 13px; }
