html.mobile-v2-disabled .m-app,
html.mobile-v2-disabled .m-tabbar,
html.mobile-v2-disabled .m-more-page,
html.mobile-v2-disabled .m-premium-card {
  display: none !important;
}

/* ═══════════════════════════════════════════════════════════════════════════
   ASGARD CRM — APPLICATION STYLES v2.5
   Nordic Dark + Red/Blue/Gold Design System
   All variables defined in design-tokens.css — do NOT override here.
   ═══════════════════════════════════════════════════════════════════════════ */

/* ─────────────────────────────────────────────────────────────────────────────
   RESET & BASE
   ───────────────────────────────────────────────────────────────────────────── */
*, *::before, *::after {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
  font-family: var(--ff);
  font-size: 14px;
  line-height: 1.5;
  color: var(--t1);
  background: var(--bg3);
}

body {
  background: var(--bg3);
  min-height: 100vh;
}

/* Subtle top accent line */
body::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--red), var(--gold) 50%, var(--blue));
  z-index: var(--z-max);
  pointer-events: none;
}

a {
  color: var(--blue-l);
  text-decoration: none;
  transition: color var(--fast);
}
a:hover {
  color: var(--t1);
}

/* ─────────────────────────────────────────────────────────────────────────────
   LAYOUT — grid defined in layout.css via CSS variables
   ───────────────────────────────────────────────────────────────────────────── */

/* ─────────────────────────────────────────────────────────────────────────────
   SIDEBAR — structure & visual in layout.css, removed duplicates (F1 fix)
   ───────────────────────────────────────────────────────────────────────────── */

/* [FIX] Sidebar nav styles fully controlled by layout.css — removed duplicates */

.pill {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-radius: var(--r-full);
  border: 1px solid var(--brd);
  background: var(--bg3);
  font-size: 12px;
  color: var(--t2);
}

.pill.unread {
  background: var(--blue-bg);
  border-color: var(--blue);
}

.pill.read {
  opacity: 0.7;
}

.pill .who {
  color: var(--t1);
}

.pill .role {
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 700;
  color: var(--blue-l);
  padding: 2px var(--sp-sm);
  background: var(--blue-bg);
  border-radius: var(--r-sm);
}

/* [FIX] .main, .topbar, .badges, .bellbtn, .bellpop — layout.css controls these */

.badge.draft {
  background: var(--bg4);
  color: var(--t3);
  border: 1px dashed var(--brd);
  font-style: italic;
}

.xbtn {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--r-sm);
  border: 1px solid var(--brd);
  background: var(--bg3);
  cursor: pointer;
  transition: all var(--fast);
}

.xbtn:hover {
  border-color: var(--red);
  color: var(--red);
}

/* ─────────────────────────────────────────────────────────────────────────────
   BUTTONS — Кнопки
   Button base (.btn) and all variants are defined in components.css
   using design tokens. Do NOT duplicate here.
   ───────────────────────────────────────────────────────────────────────────── */

/* ─────────────────────────────────────────────────────────────────────────────
   CARDS — Карточки
   ───────────────────────────────────────────────────────────────────────────── */
.card, .panel, .widget {
  background: var(--bg2);
  border: 1px solid var(--brd);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-sm);
  position: relative;
  transition: box-shadow var(--base), border-color var(--base);
}

.card, .panel, .widget {
  overflow: hidden;
}

.card:hover, .panel:hover, .widget:hover {
  box-shadow: var(--shadow-md);
  border-color: var(--blue);
  transform: translateY(-2px);
  transition: all var(--base);
}

/* Gradient top accent bar on hover — defined in components.css */

.card {
  padding: var(--sp-lg);
}

.panel {
  padding: var(--sp-lg);
}

.card h3 {
  margin: 0 0 var(--sp-3);
  font-size: var(--text-base);
  font-weight: var(--fw-semi);
  color: var(--t1);
}

.card p {
  margin: 0;
  font-size: var(--text-sm);
  color: var(--t2);
  line-height: 1.5;
}

/* Сетка карточек */
.grid {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: var(--sp-lg);
  margin-top: var(--sp-lg);
}

.card.span-3 { grid-column: span 3; }
.card.span-4 { grid-column: span 4; }
.card.span-6 { grid-column: span 6; }
.card.span-8 { grid-column: span 8; }
.card.span-12 { grid-column: span 12; }

@media (max-width: 1200px) {
  .card.span-3, .card.span-4 { grid-column: span 6; }
}

@media (max-width: 768px) {
  .card.span-3, .card.span-4, .card.span-6 { grid-column: span 12; }
}

/* KPI карточки */
.kpi {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: var(--sp-4);
}

.kpi .v {
  font-size: var(--text-2xl);
  font-weight: var(--fw-extra);
  color: var(--t1);
}

.kpi .t {
  font-size: var(--text-xs);
  color: var(--t2);
}

.kpi .delta {
  font-size: var(--text-xs);
  font-family: var(--ff-mono);
  padding: var(--sp-1) var(--sp-2);
  border-radius: var(--r-xs);
}

.kpi .delta.up {
  color: var(--ok-t);
  background: var(--ok-bg);
}

.kpi .delta.down {
  color: var(--red);
  background: var(--red-glow);
}

/* Статус-точки */
.dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  margin-right: 8px;
}

.dot.green { background: var(--ok-t); box-shadow: 0 0 8px var(--ok-t); }
.dot.red { background: var(--red); box-shadow: 0 0 8px var(--red); }
.dot.amber { background: var(--gold); box-shadow: 0 0 8px var(--gold); }
.dot.blue { background: var(--blue); box-shadow: 0 0 8px var(--blue); }

/* ─────────────────────────────────────────────────────────────────────────────
   FORMS — Формы и поля ввода
   ───────────────────────────────────────────────────────────────────────────── */
input, select, textarea {
  width: 100%;
  padding: 12px 16px;
  border-radius: var(--r-md);
  border: 1px solid var(--brd);
  background: var(--bg2);
  color: var(--t1);
  font-size: 14px;
  font-family: var(--ff);
  transition: border-color var(--base);
}

input:hover, select:hover, textarea:hover {
  border-color: var(--blue);
}

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--blue);
  box-shadow: 0 0 0 3px var(--blue-glow);
}

input::placeholder, textarea::placeholder {
  color: var(--t3);
}

/* Стилизация select */
select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%2394a3b8' d='M6 8L2 4h8z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
  cursor: pointer;
}

/* Чекбоксы и радио */
input[type="checkbox"], input[type="radio"] {
  width: 18px;
  height: 18px;
  padding: 0;
  cursor: pointer;
  accent-color: var(--blue);
}

/* Метки */
label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--t2);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* Группы форм */
.formrow {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 20px;
}

.formgroup {
  display: flex;
  flex-direction: column;
}

/* Инпуты с иконками */
.input-icon {
  position: relative;
}

.input-icon input {
  padding-left: 44px;
}

.input-icon .icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--t3);
}

/* ─────────────────────────────────────────────────────────────────────────────
   TABLES — Таблицы
   ───────────────────────────────────────────────────────────────────────────── */
table.asg {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 13px;
}

table.asg th {
  padding: 14px 16px;
  text-align: left;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--t2);
  background: var(--bg4);
  border-bottom: 1px solid var(--brd);
  position: sticky;
  top: 0;
  z-index: 10;
}

table.asg th:first-child {
  border-radius: var(--r-md) 0 0 0;
}

table.asg th:last-child {
  border-radius: 0 var(--r-md) 0 0;
}

table.asg td {
  padding: 14px 16px;
  background: var(--bg2);
  border-bottom: 1px solid var(--brd-m);
  color: var(--t1);
  transition: background var(--fast);
}

table.asg tbody tr:hover td {
  background: var(--bg3);
}

table.asg tbody tr:last-child td {
  border-bottom: none;
}

table.asg tbody tr:last-child td:first-child {
  border-radius: 0 0 0 var(--r-md);
}

table.asg tbody tr:last-child td:last-child {
  border-radius: 0 0 var(--r-md) 0;
}

/* Таблица внутри карточки */
.card table.asg th:first-child,
.card table.asg th:last-child,
.card table.asg tbody tr:last-child td:first-child,
.card table.asg tbody tr:last-child td:last-child {
  border-radius: 0;
}

/* Статус-ячейки */
td .status {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
}

td .status.green { background: var(--ok-bg); color: var(--ok-t); }
td .status.red { background: var(--red-glow); color: var(--red); }
td .status.amber { background: var(--warn-bg); color: var(--gold); }
td .status.blue { background: var(--blue-glow); color: var(--blue); }
td .status.gold { background: var(--gold-bg); color: var(--gold); }

/* Модалки: базовые стили определены в components.css, здесь только оверрайды */

/* ─────────────────────────────────────────────────────────────────────────────
   TABS — Вкладки
   ───────────────────────────────────────────────────────────────────────────── */
.tabs {
  display: flex;
  gap: 4px;
  padding: 4px;
  background: var(--bg3);
  border-radius: var(--r-md);
  border: 1px solid var(--brd);
  margin-bottom: var(--sp-5);
}

.tab {
  flex: 1;
  padding: var(--sp-3) var(--sp-5);
  border-radius: var(--r-sm);
  border: none;
  background: transparent;
  color: var(--t2);
  font-size: var(--text-sm);
  font-weight: var(--fw-semi);
  cursor: pointer;
  transition: all var(--fast);
}

.tab:hover {
  color: var(--t1);
  background: var(--bg4);
}

.tab.active {
  background: var(--blue-bg);
  color: var(--blue-l);
  box-shadow: var(--shadow-sm);
}

/* Вертикальные табы */
.tabs-vertical {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: var(--sp-2);
  background: var(--bg3);
  border-radius: var(--r-md);
  border: 1px solid var(--brd);
}

.tabs-vertical .tab {
  text-align: left;
  padding: var(--sp-3) var(--sp-4);
}

/* Toast styles moved to components.css */

/* ─────────────────────────────────────────────────────────────────────────────
   HELP & INFO — Вспомогательные элементы
   ───────────────────────────────────────────────────────────────────────────── */
.help {
  font-size: 12px;
  color: var(--t3);
  line-height: 1.5;
}

.hr {
  height: 1px;
  margin: 24px 0;
  border: none;
  background: linear-gradient(90deg, transparent, var(--brd), transparent);
}

.runesep {
  text-align: center;
  padding: 8px 0;
  color: var(--gold);
  font-size: 12px;
  letter-spacing: 0.5em;
  opacity: 0.4;
  user-select: none;
}

.runesep::before {
  content: "ᚱ ◆ ᚨ ◆ ᚷ";
}

.credit {
  text-align: center;
  font-size: 11px;
  color: var(--t3);
  padding: 8px 0;
}

/* Пустое состояние */
.empty-state {
  text-align: center;
  padding: var(--sp-12) var(--sp-5);
  color: var(--t3);
}

.empty-state .icon {
  font-size: 48px;
  margin-bottom: var(--sp-4);
  opacity: 0.5;
}

.empty-state .title {
  font-size: var(--text-lg);
  font-weight: var(--fw-semi);
  color: var(--t2);
  margin-bottom: var(--sp-2);
}

.empty-state .desc {
  font-size: var(--text-base);
  max-width: 400px;
  margin: 0 auto;
}

/* ─────────────────────────────────────────────────────────────────────────────
   ROW & FLEX HELPERS
   ───────────────────────────────────────────────────────────────────────────── */
.row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.row.between {
  justify-content: space-between;
}

.row.wrap {
  flex-wrap: wrap;
}

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

/* ─────────────────────────────────────────────────────────────────────────────
   WELCOME PAGE — Premium Norse Design
   ───────────────────────────────────────────────────────────────────────────── */
.welcome-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
  position: relative;
  overflow: hidden;
  background: #0a0e1a;
}

/* ── Aurora Borealis Background ── */
.welcome-bg {
  position: absolute;
  inset: 0;
  overflow: hidden;
  z-index: 0;
}

.aurora {
  position: absolute;
  width: 200%;
  height: 200%;
  top: -60%;
  left: -50%;
  pointer-events: none;
}

.aurora-1 {
  background: radial-gradient(ellipse 50% 35% at 25% 30%, rgba(16,185,129,0.12), transparent 70%);
  animation: aurora1 14s ease-in-out infinite;
}

.aurora-2 {
  background: radial-gradient(ellipse 55% 30% at 65% 25%, rgba(59,130,246,0.10), transparent 70%);
  animation: aurora2 18s ease-in-out infinite;
}

.aurora-3 {
  background: radial-gradient(ellipse 40% 40% at 45% 20%, rgba(139,92,246,0.08), transparent 70%);
  animation: aurora3 22s ease-in-out infinite;
}

@keyframes aurora1 {
  0%, 100% { transform: translate(0, 0) scale(1) rotate(0deg); opacity: 0.8; }
  33% { transform: translate(8%, 4%) scale(1.1) rotate(2deg); opacity: 1; }
  66% { transform: translate(-4%, -2%) scale(0.95) rotate(-1deg); opacity: 0.7; }
}

@keyframes aurora2 {
  0%, 100% { transform: translate(0, 0) scale(1); opacity: 0.7; }
  50% { transform: translate(-6%, 3%) scale(1.08); opacity: 1; }
}

@keyframes aurora3 {
  0%, 100% { transform: translate(0, 0) scale(1) rotate(0deg); opacity: 0.6; }
  50% { transform: translate(5%, -4%) scale(1.12) rotate(3deg); opacity: 0.9; }
}

/* ── Stars ── */
.welcome-stars {
  position: absolute;
  inset: 0;
  background-image:
    radial-gradient(1px 1px at 10% 15%, rgba(255,255,255,0.5), transparent),
    radial-gradient(1.5px 1.5px at 20% 40%, rgba(255,255,255,0.3), transparent),
    radial-gradient(1px 1px at 35% 10%, rgba(255,255,255,0.6), transparent),
    radial-gradient(1px 1px at 45% 60%, rgba(255,255,255,0.3), transparent),
    radial-gradient(1.5px 1.5px at 55% 25%, rgba(255,255,255,0.4), transparent),
    radial-gradient(1px 1px at 65% 75%, rgba(255,255,255,0.5), transparent),
    radial-gradient(1px 1px at 75% 35%, rgba(255,255,255,0.3), transparent),
    radial-gradient(1.5px 1.5px at 85% 55%, rgba(255,255,255,0.4), transparent),
    radial-gradient(1px 1px at 92% 20%, rgba(255,255,255,0.6), transparent),
    radial-gradient(1px 1px at 5% 80%, rgba(255,255,255,0.3), transparent),
    radial-gradient(1px 1px at 30% 85%, rgba(255,255,255,0.4), transparent),
    radial-gradient(1.5px 1.5px at 50% 5%, rgba(255,255,255,0.5), transparent),
    radial-gradient(1px 1px at 70% 90%, rgba(255,255,255,0.3), transparent),
    radial-gradient(1px 1px at 88% 45%, rgba(255,255,255,0.4), transparent),
    radial-gradient(1.5px 1.5px at 15% 55%, rgba(255,255,255,0.3), transparent),
    radial-gradient(1px 1px at 40% 30%, rgba(255,255,255,0.5), transparent),
    radial-gradient(1px 1px at 60% 50%, rgba(255,255,255,0.3), transparent),
    radial-gradient(1.5px 1.5px at 80% 15%, rgba(255,255,255,0.4), transparent);
  animation: starTwinkle 5s ease-in-out infinite alternate;
}

@keyframes starTwinkle {
  0% { opacity: 0.5; }
  100% { opacity: 1; }
}

/* ── Floating Rune Particles ── */
.rune-particles {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  overflow: hidden;
}

.rune-particle {
  position: absolute;
  bottom: -30px;
  color: #fbbf24;
  font-size: 18px;
  opacity: 0;
  animation: floatRune 8s ease-in-out infinite;
  text-shadow: 0 0 8px rgba(251,191,36,0.4);
  user-select: none;
}

@keyframes floatRune {
  0% { transform: translateY(0) rotate(0deg) scale(0.6); opacity: 0; }
  8% { opacity: 0.25; }
  50% { opacity: 0.15; }
  92% { opacity: 0.05; }
  100% { transform: translateY(-100vh) rotate(180deg) scale(1); opacity: 0; }
}

/* ── Content Container ── */
.welcome-content {
  position: relative;
  z-index: 2;
  text-align: center;
  max-width: 600px;
  width: 100%;
}

/* ── Header with Logo ── */
.welcome-header {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 24px;
  margin-bottom: 32px;
}

.welcome-logo-wrap {
  position: relative;
  flex-shrink: 0;
}

.welcome-logo {
  width: 100px;
  height: 100px;
  border-radius: 50%;
  border: 2px solid rgba(251,191,36,0.3);
  padding: 8px;
  background: rgba(10,14,26,0.8);
  box-shadow: 0 0 30px rgba(251,191,36,0.15), 0 0 60px rgba(251,191,36,0.05);
  object-fit: contain;
  position: relative;
  z-index: 1;
}

.welcome-logo-ring {
  position: absolute;
  inset: -4px;
  border-radius: 50%;
  border: 1px solid rgba(251,191,36,0.2);
  animation: logoRingPulse 3s ease-in-out infinite;
}

@keyframes logoRingPulse {
  0%, 100% { transform: scale(1); opacity: 0.5; border-color: rgba(251,191,36,0.2); }
  50% { transform: scale(1.08); opacity: 0.8; border-color: rgba(251,191,36,0.4); }
}

.welcome-brand {
  text-align: left;
}

.welcome-title {
  font-size: 44px;
  font-weight: 900;
  background: linear-gradient(135deg, #fde68a 0%, #fbbf24 40%, #d97706 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  letter-spacing: 3px;
  line-height: 1.1;
  margin: 0;
}

.welcome-subtitle {
  font-size: 13px;
  color: rgba(251,191,36,0.6);
  letter-spacing: 2px;
  margin-top: 6px;
  font-weight: 500;
  text-transform: uppercase;
}

.welcome-runes {
  font-size: 14px;
  color: var(--t3);
  letter-spacing: 4px;
  margin-top: 4px;
  opacity: 0.5;
}

/* ── Norse Emblem (Ægishjálmur) ── */
.welcome-emblem {
  margin: 20px auto;
  max-width: 260px;
  animation: emblemFloat 6s ease-in-out infinite;
}

@keyframes emblemFloat {
  0%, 100% {
    transform: translateY(0);
    filter: drop-shadow(0 0 15px rgba(251,191,36,0.15));
  }
  50% {
    transform: translateY(-12px);
    filter: drop-shadow(0 0 30px rgba(251,191,36,0.3));
  }
}

.norse-emblem {
  width: 100%;
  height: auto;
}

/* Rotating rune ring */
.rune-ring {
  animation: runeRotate 45s linear infinite;
  transform-origin: 150px 150px;
}

@keyframes runeRotate {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

/* ── Motto & Description ── */
.welcome-motto {
  font-size: 17px;
  font-style: italic;
  color: rgba(251,191,36,0.7);
  margin-bottom: 12px;
  text-shadow: 0 0 20px rgba(251,191,36,0.1);
}

.welcome-desc {
  font-size: 13px;
  color: var(--t3);
  margin-bottom: 36px;
  display: flex;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
}

.welcome-desc-item {
  color: rgba(255,255,255,0.5);
}

.welcome-desc-sep {
  color: rgba(251,191,36,0.3);
  margin: 0 2px;
}

/* ── Login Button ── */
.welcome-actions {
  display: flex;
  justify-content: center;
  gap: 16px;
  margin-bottom: 30px;
}

.welcome-btn {
  position: relative;
  min-width: 200px;
  padding: 16px 48px;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 3px;
  text-transform: uppercase;
  background: linear-gradient(135deg, #fbbf24, #d97706);
  color: #0a0e1a;
  border: none;
  border-radius: 50px;
  cursor: pointer;
  overflow: hidden;
  box-shadow: 0 4px 20px rgba(251,191,36,0.3), 0 0 40px rgba(251,191,36,0.1);
  transition: all 0.3s ease;
}

.welcome-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 30px rgba(251,191,36,0.4), 0 0 60px rgba(251,191,36,0.15);
}

.welcome-btn:active {
  transform: translateY(0) scale(0.98);
}

.welcome-btn-text {
  position: relative;
  z-index: 1;
}

.welcome-btn-glow {
  position: absolute;
  inset: -2px;
  border-radius: 50px;
  background: linear-gradient(135deg, transparent, rgba(255,255,255,0.2), transparent);
  animation: btnGlowSweep 3s ease-in-out infinite;
}

@keyframes btnGlowSweep {
  0% { transform: translateX(-100%) rotate(20deg); }
  50% { transform: translateX(100%) rotate(20deg); }
  100% { transform: translateX(100%) rotate(20deg); }
}

/* ── Login Forms ── */
.welcome-form {
  background: rgba(13,18,33,0.9);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border: 1px solid rgba(251,191,36,0.12);
  border-radius: 20px;
  padding: 32px;
  text-align: left;
  max-width: 400px;
  margin: 0 auto;
  box-shadow: 0 8px 40px rgba(0,0,0,0.4), inset 0 1px 0 rgba(255,255,255,0.03);
}

.welcome-form-title {
  font-size: 22px;
  font-weight: 700;
  color: var(--t1);
  text-align: center;
  margin-bottom: 20px;
  background: linear-gradient(135deg, #fde68a, #fbbf24);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.welcome-form-subtitle {
  font-size: 14px;
  color: var(--t2);
  text-align: center;
}

.welcome-form h3 {
  font-size: 20px;
  font-weight: 700;
  color: var(--t1);
  margin: 0 0 24px;
  text-align: center;
}

.welcome-form .btn {
  width: 100%;
  margin-top: 8px;
}

.welcome-form-fields {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-bottom: 20px;
}

.welcome-form-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* ── Footer ── */
.welcome-footer {
  margin-top: 40px;
}

.welcome-runes-bottom {
  font-size: 12px;
  color: var(--t3);
  opacity: 0.3;
  letter-spacing: 2px;
}

/* ─────────────────────────────────────────────────────────────────────────────
   LOADING STATES
   ───────────────────────────────────────────────────────────────────────────── */

/* Полноэкранный загрузочный экран */
.loading-screen {
  position: fixed !important;
  top: 0 !important;
  left: 0 !important;
  right: 0 !important;
  bottom: 0 !important;
  width: 100vw !important;
  height: 100vh !important;
  margin: 0 !important;
  padding: 0 !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  background: var(--bg3, #0D1117);
  z-index: 99999 !important;
  animation: fadeIn 0.4s ease;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.loading-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 40px;
  max-width: 500px;
}

.loading-logo {
  margin-bottom: 32px;
  animation: floatLogo 3s ease-in-out infinite;
}

.loading-logo img {
  width: 120px;
  height: 120px;
  object-fit: contain;
  filter: drop-shadow(0 0 20px rgba(27, 79, 114, 0.3));
  border-radius: var(--r-xl);
  border: 2px solid var(--brd);
  background: var(--bg3);
  padding: 12px;
}

@keyframes floatLogo {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-10px); }
}

/* Кольцевой спиннер */
.loading-spinner {
  position: relative;
  width: 80px;
  height: 80px;
  margin-bottom: 32px;
}

.spinner-ring {
  position: absolute;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  border: 3px solid transparent;
}

.spinner-ring:nth-child(1) {
  border-top-color: var(--blue);
  animation: spinRing 1.2s cubic-bezier(0.5, 0, 0.5, 1) infinite;
}

.spinner-ring:nth-child(2) {
  border-right-color: var(--blue-l);
  animation: spinRing 1.2s cubic-bezier(0.5, 0, 0.5, 1) infinite;
  animation-delay: -0.4s;
}

.spinner-ring:nth-child(3) {
  border-bottom-color: var(--gold);
  animation: spinRing 1.2s cubic-bezier(0.5, 0, 0.5, 1) infinite;
  animation-delay: -0.8s;
}

@keyframes spinRing {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* Цитата */
.loading-quote {
  font-size: 16px;
  font-style: italic;
  color: var(--blue-l);
  max-width: 400px;
  line-height: 1.6;
  margin-bottom: 20px;
  animation: fadeInUp 0.6s ease 0.2s both;
}

@keyframes fadeInUp {
  from { 
    opacity: 0; 
    transform: translateY(20px); 
  }
  to { 
    opacity: 1; 
    transform: translateY(0); 
  }
}

/* Руны */
.loading-runes {
  font-size: 20px;
  letter-spacing: 4px;
  color: var(--t3);
  animation: runeGlow 2s ease-in-out infinite alternate;
}

@keyframes runeGlow {
  from {
    opacity: 0.4;
    text-shadow: 0 0 5px var(--blue-glow);
  }
  to {
    opacity: 0.8;
    text-shadow: 0 0 20px var(--blue), 0 0 40px var(--blue-glow);
  }
}

/* Базовый loading (для других мест) */
.loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 20px;
}

.loading-logo img {
  width: 80px;
  height: 80px;
  animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 0.6; transform: scale(1); }
  50% { opacity: 1; transform: scale(1.05); }
}

.loading-text {
  margin-top: 16px;
  font-size: 14px;
  color: var(--t2);
}

.spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--brd);
  border-top-color: var(--blue);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

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

/* ─────────────────────────────────────────────────────────────────────────────
   STAFF SCHEDULE GRID
   ───────────────────────────────────────────────────────────────────────────── */
.sched-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}

.sched-period {
  font-size: 20px;
  font-weight: 700;
  color: var(--t1);
  text-align: center;
  min-width: 200px;
}

.sched-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  padding: 12px 0;
}

.sched-legend-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--t2);
}

.sched-legend-box {
  width: 20px;
  height: 20px;
  border-radius: 4px;
  flex-shrink: 0;
}

.sched-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.sched-grid {
  min-width: fit-content;
}

.sched-head {
  display: flex;
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--bg2);
}

.sched-head .sched-name {
  font-weight: 600;
  color: var(--t2);
  background: var(--bg4);
}

.sched-name {
  width: 180px;
  min-width: 180px;
  padding: 10px 12px;
  font-size: 13px;
  color: var(--t1);
  background: var(--bg2);
  border-right: 1px solid var(--brd);
  position: sticky;
  left: 0;
  z-index: 5;
}

.sched-days {
  display: flex;
  flex: 1;
}

.sched-day {
  width: 36px;
  min-width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 600;
  color: var(--t2);
  background: var(--bg4);
  border-right: 1px solid var(--brd);
  border-bottom: 1px solid var(--brd);
}

.sched-day.weekend {
  background: var(--bg3);
  color: var(--t3);
}

.sched-day.today {
  background: var(--blue);
  color: var(--bg2);
  font-weight: 700;
}

.sched-body {
  display: flex;
  flex-direction: column;
}

.sched-row {
  display: flex;
  border-bottom: 1px solid var(--brd);
}

.sched-row:hover .sched-name {
  background: var(--bg3);
}

.sched-cells {
  display: flex;
  flex: 1;
}

.sched-cell {
  width: 36px;
  min-width: 36px;
  height: 36px;
  border: none;
  border-right: 1px solid var(--brd);
  background: var(--bg2);
  cursor: pointer;
  transition: all var(--fast) ease;
  padding: 0;
  margin: 0;
}

.sched-cell:hover {
  transform: scale(1.1);
  z-index: 2;
  box-shadow: 0 0 10px var(--blue-glow);
}

.sched-cell.weekend {
  background: repeating-linear-gradient(
    135deg,
    rgba(100, 116, 139, 0.08) 0px,
    rgba(100, 116, 139, 0.08) 4px,
    transparent 4px,
    transparent 8px
  );
}

.sched-cell.today {
  box-shadow: inset 0 0 0 2px var(--blue);
}

.sched-cell[data-locked="1"] {
  cursor: not-allowed;
  opacity: 0.7;
}

/* ─────────────────────────────────────────────────────────────────────────────
   FUNNEL PAGE (Kanban)
   ───────────────────────────────────────────────────────────────────────────── */
.funnel-stats {
  display: flex;
  gap: 24px;
  flex-wrap: wrap;
}

.funnel-stat {
  text-align: center;
  padding: 12px 20px;
  background: var(--bg4);
  border-radius: var(--r-md);
  min-width: 120px;
  border: 1px solid var(--brd);
}

.funnel-stat.won {
  background: linear-gradient(135deg, rgba(22, 163, 98, 0.15), rgba(22, 163, 98, 0.05));
  border: 1px solid rgba(22, 163, 98, 0.3);
}

.funnel-stat-value {
  font-size: 20px;
  font-weight: 700;
  color: var(--t1);
}

.funnel-stat-label {
  font-size: 12px;
  color: var(--t3);
  margin-top: 4px;
}

.funnel-board {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  padding: 16px 0;
  -webkit-overflow-scrolling: touch;
}

.funnel-column {
  flex: 0 0 260px;
  min-width: 260px;
  background: var(--bg3);
  border-radius: var(--r-lg);
  border: 1px solid var(--brd);
  display: flex;
  flex-direction: column;
  max-height: 70vh;
}

.funnel-column-header {
  padding: 14px;
  border-bottom: 3px solid var(--stage-color, var(--brd));
  position: sticky;
  top: 0;
  background: var(--bg3);
  border-radius: var(--r-lg) var(--r-lg) 0 0;
}

.funnel-column-title {
  font-weight: 700;
  font-size: 14px;
  color: var(--t1);
}

.funnel-column-stats {
  display: flex;
  gap: 12px;
  margin-top: 6px;
}

.funnel-count {
  background: var(--stage-color, var(--blue));
  color: white;
  text-shadow: 0 1px 3px rgba(0,0,0,0.4);
  padding: 2px 8px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
}

.funnel-sum {
  font-size: 12px;
  color: var(--t3);
}

.funnel-cards {
  flex: 1;
  overflow-y: auto;
  padding: var(--sp-3);
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
}

.funnel-cards.drag-over {
  background: var(--blue-glow);
}

.funnel-card {
  background: var(--bg4);
  border: 1px solid var(--brd);
  border-radius: var(--r-sm);
  padding: var(--sp-3);
  cursor: grab;
  transition: all var(--fast);
}

.funnel-card * {
  background: none;
  box-shadow: none;
}

.funnel-card:hover {
  border-color: var(--blue);
  box-shadow: var(--shadow-sm);
}

.funnel-card.dragging {
  opacity: 0.5;
  cursor: grabbing;
}

.funnel-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: var(--sp-2);
  margin-bottom: var(--sp-1);
  background: none;
  border: none;
  border-radius: 0;
  box-shadow: none;
}

.funnel-card-customer {
  font-size: var(--text-sm);
  color: var(--t1);
  font-weight: var(--fw-semi);
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  background: none;
  border: none;
  border-radius: 0;
  box-shadow: none;
}

.funnel-card-sum {
  font-size: var(--text-xs);
  font-weight: var(--fw-bold);
  color: var(--gold);
  white-space: nowrap;
  background: none;
  border: none;
  border-radius: 0;
  box-shadow: none;
}

.funnel-card-title {
  font-size: var(--text-sm);
  color: var(--t3);
  margin-bottom: var(--sp-1);
  line-height: 1.3;
  background: none;
  border: none;
  border-radius: 0;
  box-shadow: none;
}

.funnel-card-meta {
  display: flex;
  justify-content: space-between;
  font-size: var(--text-xs);
  color: var(--t3);
  background: none;
  border: none;
  border-radius: 0;
  box-shadow: none;
}

.funnel-card-meta span {
  background: none;
  border: none;
  border-radius: 0;
  box-shadow: none;
}

/* Light theme overrides for funnel cards */
html[data-theme="light"] .funnel-card {
  background: var(--bg2);
  border: 1px solid var(--brd);
}
html[data-theme="light"] .funnel-card-customer {
  color: var(--t1);
  background: none;
  border: none;
}
html[data-theme="light"] .funnel-card-sum {
  color: var(--warn);
  background: none;
  border: none;
}
html[data-theme="light"] .funnel-card-title {
  color: var(--t2);
  background: none;
  border: none;
}
html[data-theme="light"] .funnel-card-meta {
  color: var(--t2);
  background: none;
  border: none;
}

.funnel-more {
  text-align: center;
  padding: 8px;
  color: var(--t3);
  font-size: 12px;
}

@media (max-width: 768px) {
  .funnel-column {
    flex: 0 0 220px;
    min-width: 220px;
  }
  
  .funnel-stats {
    flex-direction: column;
    gap: 8px;
  }
  
  .funnel-stat {
    min-width: 100%;
  }
}

/* ─────────────────────────────────────────────────────────────────────────────
   CALENDAR PAGE
   ───────────────────────────────────────────────────────────────────────────── */
.cal-layout {
  display: grid;
  grid-template-columns: 1fr 300px;
  gap: 20px;
}

.cal-main {
  min-width: 0;
}

.cal-sidebar {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.cal-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.cal-title {
  font-size: 20px;
  font-weight: 700;
  color: var(--t1);
  min-width: 180px;
  text-align: center;
}

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

.cal-weekday {
  padding: 10px;
  text-align: center;
  font-weight: 600;
  font-size: 12px;
  color: var(--t3);
  text-transform: uppercase;
}

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

.cal-day {
  min-height: 100px;
  padding: 8px;
  background: var(--bg2);
  cursor: pointer;
  transition: background var(--fast);
}

.cal-day:hover {
  background: var(--bg3);
}

.cal-day.empty {
  background: var(--bg4);
  cursor: default;
}

.cal-day.today {
  background: var(--blue-bg);
}

.cal-day.today .cal-day-num {
  background: var(--blue);
  color: white;
  border-radius: 50%;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.cal-day.weekend {
  background: var(--bg3);
}

.cal-day-num {
  font-weight: 600;
  font-size: 14px;
  color: var(--t1);
  margin-bottom: 6px;
}

.cal-day-events {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.cal-event {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 3px 6px;
  border-radius: 4px;
  background: color-mix(in srgb, var(--event-color) 20%, transparent);
  border-left: 3px solid var(--event-color);
  font-size: 11px;
  overflow: hidden;
  cursor: pointer;
  transition: background var(--fast);
}

.cal-event:hover {
  background: color-mix(in srgb, var(--event-color) 35%, transparent);
}

.cal-event-time {
  color: var(--t3);
  flex-shrink: 0;
}

.cal-event-title {
  color: var(--t1);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cal-more {
  font-size: 11px;
  color: var(--t3);
  padding: 2px 6px;
}

/* Upcoming events */
.upcoming-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.upcoming-event {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px;
  background: var(--bg4);
  border-radius: var(--r-sm);
  cursor: pointer;
  transition: background var(--fast);
}

.upcoming-event:hover {
  background: var(--bg3);
}

.upcoming-color {
  width: 4px;
  height: 100%;
  min-height: 32px;
  border-radius: 2px;
  flex-shrink: 0;
}

.upcoming-info {
  flex: 1;
  min-width: 0;
}

.upcoming-title {
  font-weight: 500;
  color: var(--t1);
  margin-bottom: 2px;
}

.upcoming-meta {
  font-size: 12px;
  color: var(--t3);
}

/* Event types legend */
.event-types-legend {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.event-type-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--t2);
}

.event-type-color {
  width: 12px;
  height: 12px;
  border-radius: 3px;
  flex-shrink: 0;
}

@media (max-width: 768px) {
  .cal-layout {
    grid-template-columns: 1fr;
  }
  
  .cal-sidebar {
    order: -1;
  }
  
  .cal-day {
    min-height: 60px;
    padding: 4px;
  }
  
  .cal-day-num {
    font-size: 12px;
  }
  
  .cal-event {
    padding: 2px 4px;
    font-size: 10px;
  }
  
  .cal-event-time {
    display: none;
  }
}

/* ─────────────────────────────────────────────────────────────────────────────
   BIRTHDAYS PAGE
   ───────────────────────────────────────────────────────────────────────────── */
.birthday-months {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}

.birthday-month {
  padding: 16px;
}

.birthday-month-title {
  color: var(--t1);
  font-size: 18px;
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--brd);
}

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

.birthday-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 12px;
  background: var(--bg4);
  border-radius: var(--r-sm);
  transition: background var(--fast);
}

.birthday-item:hover {
  background: var(--bg3);
}

.birthday-day {
  min-width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 14px;
  color: var(--blue-l);
  background: var(--blue-bg);
  border-radius: 50%;
}

.birthday-name {
  flex: 1;
  font-weight: 500;
  color: var(--t1);
}

.birthday-role {
  font-size: 12px;
  color: var(--t3);
}

/* ─────────────────────────────────────────────────────────────────────────────
   CALENDAR & SCHEDULE STYLES
   ───────────────────────────────────────────────────────────────────────────── */
.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 2px;
  background: var(--brd);
  border-radius: var(--r-md);
  overflow: hidden;
}

.calendar-header {
  padding: 12px 8px;
  text-align: center;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--t2);
  background: var(--bg4);
}

.calendar-day {
  padding: 10px 8px;
  min-height: 80px;
  background: var(--bg2);
  transition: background var(--fast);
}

.calendar-day:hover {
  background: var(--bg3);
}

.calendar-day.today {
  background: var(--blue-bg);
  border: 1px solid var(--blue);
}

.calendar-day.weekend {
  background: var(--bg3);
}

.calendar-day .num {
  font-size: 13px;
  font-weight: 600;
  color: var(--t1);
  margin-bottom: 6px;
}

.calendar-day.other-month .num {
  color: var(--t3);
}

/* Schedule Table */
.schedule-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 2px;
}

.schedule-table th,
.schedule-table td {
  padding: 8px;
  text-align: center;
  border-radius: 4px;
}

.schedule-table th {
  background: var(--bg4);
  color: var(--t2);
  font-size: 11px;
  font-weight: 700;
}

.schedule-table td {
  background: var(--bg2);
  cursor: pointer;
  transition: all var(--fast);
}

.schedule-table td:hover {
  background: var(--bg3);
  box-shadow: inset 0 0 0 1px var(--blue);
}

.schedule-table td.booked {
  background: linear-gradient(135deg, var(--ok-bg), var(--bg2));
  color: var(--ok-t);
}

.schedule-table td.busy {
  background: linear-gradient(135deg, var(--red-glow), var(--bg2));
  color: var(--red);
}

/* ─────────────────────────────────────────────────────────────────────────────
   GANTT CHART STYLES
   ───────────────────────────────────────────────────────────────────────────── */
.gantt-container {
  overflow-x: auto;
  background: var(--bg2);
  border-radius: var(--r-md);
  border: 1px solid var(--brd);
}

.gantt-header {
  display: flex;
  background: var(--bg4);
  border-bottom: 1px solid var(--brd);
  position: sticky;
  top: 0;
  z-index: 10;
}

.gantt-header-cell {
  min-width: 40px;
  padding: 10px 4px;
  text-align: center;
  font-size: 10px;
  font-weight: 600;
  color: var(--t2);
  border-right: 1px solid var(--brd);
}

.gantt-header-cell.today {
  background: var(--blue-bg);
  color: var(--blue-l);
}

.gantt-row {
  display: flex;
  border-bottom: 1px solid var(--brd);
  min-height: 40px;
  position: relative;
}

.gantt-row:hover {
  background: var(--bg3);
}

.gantt-cell {
  min-width: 40px;
  border-right: 1px solid var(--brd);
}

.gantt-bar {
  position: absolute;
  height: 28px;
  top: 6px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  padding: 0 8px;
  font-size: 11px;
  font-weight: 600;
  color: white;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  cursor: pointer;
  transition: all var(--fast);
}

.gantt-bar:hover {
  transform: scaleY(1.1);
  box-shadow: var(--shadow-md);
}

.gantt-bar.green { background: linear-gradient(90deg, var(--ok-t), var(--ok)); }
.gantt-bar.blue { background: linear-gradient(90deg, var(--blue), var(--blue-l)); }
.gantt-bar.amber { background: linear-gradient(90deg, var(--gold), var(--warn)); }
.gantt-bar.red { background: linear-gradient(90deg, var(--red), var(--red)); }
.gantt-bar.gold { background: var(--grad-gold); }

/* ─────────────────────────────────────────────────────────────────────────────
   CHART STYLES
   ───────────────────────────────────────────────────────────────────────────── */
.chart-container {
  position: relative;
  padding: 20px;
  background: var(--bg2);
  border-radius: var(--r-md);
  border: 1px solid var(--brd);
}

.chart-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--t1);
  margin-bottom: 16px;
}

.chart-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  margin-top: 16px;
}

.chart-legend-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--t2);
}

.chart-legend-color {
  width: 12px;
  height: 12px;
  border-radius: 3px;
}

/* ─────────────────────────────────────────────────────────────────────────────
   FILTERS & SEARCH
   ───────────────────────────────────────────────────────────────────────────── */
.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 20px;
  padding: 16px;
  background: var(--bg3);
  border-radius: var(--r-md);
  border: 1px solid var(--brd);
}

.filters input,
.filters select {
  width: auto;
  min-width: 180px;
  padding: 10px 14px;
  font-size: 13px;
}

.search-box {
  position: relative;
  flex: 1;
  min-width: 250px;
}

.search-box input {
  padding-left: 40px;
}

.search-box::before {
  content: '🔍';
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 14px;
  opacity: 0.5;
}

/* ─────────────────────────────────────────────────────────────────────────────
   RESPONSIVE MOBILE
   ───────────────────────────────────────────────────────────────────────────── */

/* Viewport meta важен - проверь что в index.html есть:
   <meta name="viewport" content="width=device-width, initial-scale=1"> */

@media (max-width: 768px) {
  /* Sidebar полностью скрыт — навигация через таббар */
  .sidenav, .nav-overlay { display: none !important; }

  /* Основной контент */
  .main {
    margin-left: 0 !important;
    padding: 12px;
    padding-bottom: 72px !important;
  }

  /* Header — одна строка */
  .topbar {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    margin-bottom: 12px;
    flex-wrap: nowrap;
  }
  .mnav { display: none !important; }
  .topbar .title { flex: 1; min-width: 0; }
  .topbar h1, .topbar h1.page-title {
    font-size: 16px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .topbar .page-motto { display: none; }
  .badges { display: flex; gap: 6px; flex-shrink: 0; }
  .belltext { display: none; }
  .bellbtn { padding: 6px; gap: 4px; }
  .badges .badge:not(.bellbtn) { display: none; }

  .bellbtn .bellcount {
    font-size: 10px;
    padding: 1px 6px;
  }

  .iconbtn {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--r-md);
    border: 1px solid var(--brd);
    background: var(--glass);
    color: var(--t1);
    font-size: 20px;
    cursor: pointer;
  }
  
  /* Карточки */
  .card {
    padding: 16px;
  }
  
  .card-title {
    font-size: 16px;
  }
  
  /* Грид - все карточки в одну колонку на мобильном */
  .grid {
    grid-template-columns: 1fr !important;
    gap: 12px;
  }
  
  .card.span-3,
  .card.span-4,
  .card.span-6,
  .card.span-8,
  .card.span-12 {
    grid-column: span 1 !important;
  }
  
  /* KPI грид */
  .kpi-row {
    flex-direction: column;
    gap: 12px;
  }

  .kpi-row .k {
    flex: 1 1 100%;
  }

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

  .kpi .k {
    padding: 10px;
  }

  .kpi .k .v {
    font-size: 16px;
  }

  /* Виджеты домашней страницы */
  .home-widgets,
  .home-grid {
    display: flex !important;
    flex-direction: column;
    gap: 12px;
  }

  /* Quicklinks — горизонтальный скролл */
  .quick-links {
    display: flex;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    flex-wrap: nowrap;
    gap: 6px;
    padding-bottom: 8px;
  }

  .quick-links .btn {
    flex-shrink: 0;
    font-size: 12px;
    padding: 6px 12px;
    white-space: nowrap;
  }

  /* Мимир — над таббаром */
  .mimir-widget { bottom: 68px !important; }
  
  /* Таблицы - горизонтальный скролл */
  .tbl-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin: 0 -12px;
    padding: 0 12px;
  }
  
  .tbl {
    min-width: 0;
    font-size: 13px;
  }
  
  .tbl th, .tbl td {
    padding: 10px 8px;
    white-space: nowrap;
  }
  
  /* Формы */
  .formrow {
    grid-template-columns: 1fr !important;
    gap: 12px;
  }
  
  .field label {
    font-size: 12px;
  }
  
  .inp, input, select, textarea {
    font-size: 16px !important; /* Предотвращает зум на iOS */
    padding: 12px;
  }
  
  /* Кнопки */
  .btn {
    padding: 12px 16px;
    font-size: 14px;
    min-height: 44px; /* Минимальный размер для тач */
  }
  
  .btn.mini {
    padding: 8px 12px;
    min-height: 36px;
  }
  
  /* Группы кнопок */
  .btns, .btn-group, [style*="display:flex"][style*="gap"] {
    flex-wrap: wrap;
  }
  
  /* Фильтры */
  .filters {
    flex-direction: column;
    align-items: stretch;
  }
  
  .filters .inp,
  .filters select {
    width: 100%;
  }
  
  /* Модальные окна */
  .modal-content {
    width: 95vw !important;
    max-width: 95vw !important;
    max-height: 90vh;
    margin: 5vh auto;
    border-radius: var(--r-md);
  }
  
  .modal-header {
    padding: 16px;
  }
  
  .modal-body {
    padding: 16px;
    max-height: 60vh;
    overflow-y: auto;
  }
  
  .modal-footer {
    padding: 16px;
    flex-wrap: wrap;
    gap: 8px;
  }
  
  /* Toast styles moved to components.css */
  
  /* Welcome страница */
  .welcome-page {
    padding: 16px 12px;
    padding-bottom: env(safe-area-inset-bottom, 16px);
  }

  .welcome-header {
    flex-direction: column;
    text-align: center;
    gap: 12px;
    margin-bottom: 20px;
  }

  .welcome-brand {
    text-align: center;
  }

  .welcome-logo {
    width: 72px;
    height: 72px;
    padding: 6px;
  }

  .welcome-logo-ring {
    inset: -3px;
  }

  .welcome-title {
    font-size: 26px;
    letter-spacing: 2px;
  }

  .welcome-subtitle {
    font-size: 11px;
    letter-spacing: 1.5px;
  }

  .welcome-emblem {
    max-width: 200px;
    margin: 16px auto;
  }

  .welcome-motto {
    font-size: 14px;
  }

  .welcome-desc {
    font-size: 12px;
    margin-bottom: 24px;
  }

  .welcome-btn {
    min-width: 180px;
    padding: 14px 40px;
    font-size: 15px;
  }

  .welcome-form {
    width: 100%;
    max-width: 100%;
    padding: 20px 16px;
    border-radius: 16px;
  }

  .rune-particle {
    font-size: 14px;
  }

  /* iOS zoom prevention — inputs must be >= 16px */
  input, select, textarea {
    font-size: 16px !important;
  }

  
  /* Загрузочный экран */
  .loading-content {
    padding: 20px;
  }
  
  .loading-logo img {
    width: 80px;
    height: 80px;
  }
  
  .loading-quote {
    font-size: 14px;
    padding: 0 10px;
  }
  
  .loading-runes {
    font-size: 16px;
    letter-spacing: 2px;
  }
  
  /* Статистика / KPI блоки */
  .stats-grid, .kpi-grid {
    grid-template-columns: 1fr 1fr;
    gap: var(--sp-3);
  }

  .stat-card, .kpi-card {
    padding: var(--sp-3) var(--sp-4);
  }

  .stat-value, .kpi-value {
    font-size: var(--text-xl);
  }
  
  /* Графики */
  .chart-container {
    height: 250px;
    min-height: 200px;
  }
  
  /* Gantt */
  .gantt-wrap {
    overflow-x: auto;
  }
  
  /* Скрываем на мобильных */
  .hide-mobile {
    display: none !important;
  }
  
  /* Текст */
  .help, .hint {
    font-size: 12px;
  }
  
  /* Хлебные крошки */
  .breadcrumb {
    font-size: 12px;
    flex-wrap: wrap;
  }
}

/* Маленькие телефоны */
@media (max-width: 480px) {
  html {
    font-size: 13px;
  }
  
  .main {
    padding: 8px;
  }
  
  .topbar h1 {
    font-size: 16px;
  }
  
  .card {
    padding: 12px;
    border-radius: var(--r-sm);
  }
  
  .tbl {
    font-size: 12px;
  }
  
  .tbl th, .tbl td {
    padding: 8px 6px;
  }
  
  .stats-grid, .kpi-grid {
    grid-template-columns: 1fr;
  }
  
  .badge {
    font-size: 11px;
    padding: 4px 8px;
  }
  
  .modal-content {
    margin: 2vh auto;
    max-height: 96vh;
  }
  
  .welcome-title {
    font-size: 22px;
  }

  .welcome-subtitle {
    font-size: 10px;
  }

  .welcome-runes {
    font-size: 11px;
  }

  .welcome-emblem {
    max-width: 160px;
    margin: 12px auto;
  }

  .welcome-motto {
    font-size: 13px;
  }
}

@media (min-width: 769px) {
  .mnav {
    display: none;
  }

  .nav-overlay {
    display: none;
  }
  
  .show-mobile {
    display: none !important;
  }
}

/* ─────────────────────────────────────────────────────────────────────────────
   CONTENT OVERFLOW PROTECTION
   ───────────────────────────────────────────────────────────────────────────── */
.tbl-wrap {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.formrow {
  max-width: 100%;
}

.inp, select, textarea {
  max-width: 100%;
  box-sizing: border-box;
}

.modal, .modal-content {
  max-width: calc(100vw - 32px);
  max-height: calc(100vh - 32px);
  box-sizing: border-box;
}

/* ─────────────────────────────────────────────────────────────────────────────
   UTILITY BADGE CLASSES
   ───────────────────────────────────────────────────────────────────────────── */
.badge-green, .badge-success { background: var(--ok-bg); color: var(--ok-t); border-color: rgba(34, 197, 94, 0.3); }
.badge-red, .badge-danger { background: var(--err-bg); color: var(--err-t); border-color: rgba(239, 68, 68, 0.3); }
.badge-amber, .badge-warning { background: var(--warn-bg); color: var(--warn); border-color: rgba(245, 158, 11, 0.3); }
.badge-blue, .badge-info { background: var(--info-bg); color: var(--info); border-color: rgba(59, 130, 246, 0.3); }

/* ─────────────────────────────────────────────────────────────────────────────
   MIMIR AI CHAT — MOBILE
   ───────────────────────────────────────────────────────────────────────────── */
@media (max-width: 768px) {
  .mimir-fab,
  .mimir-widget {
    bottom: 10px;
    right: 10px;
    width: 50px;
    height: 50px;
  }

  .mimir-chat {
    position: fixed;
    inset: 0;
    width: 100vw;
    height: 100vh;
    max-width: none;
    border-radius: 0;
    z-index: var(--z-modal);
  }
}

/* ═══════════════════════════════════════════════════════════════════════════════
   UNIFIED FORM STYLES
   ═══════════════════════════════════════════════════════════════════════════════ */

/* Formrow grid */
.formrow {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 16px;
}

.formrow label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--t3);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

/* Все инпуты */
.inp,
.modal input,
.modal select,
.modal textarea,
.modal-content input,
.modal-content select,
.modal-content textarea,
.formrow input,
.formrow select,
.formrow textarea {
  width: 100%;
  padding: 10px 14px;
  font-family: var(--ff);
  font-size: 13px;
  color: var(--t1);
  background: var(--bg3);
  border: 1px solid var(--brd);
  border-radius: 6px;
  transition: border-color var(--base), box-shadow var(--base);
  box-sizing: border-box;
}

.inp:focus,
.modal input:focus,
.modal select:focus,
.modal textarea:focus,
.modal-content input:focus,
.modal-content select:focus,
.modal-content textarea:focus,
.formrow input:focus,
.formrow select:focus,
.formrow textarea:focus {
  border-color: var(--blue);
  outline: none;
  box-shadow: 0 0 0 3px var(--blue-glow);
}

.inp::placeholder,
.modal input::placeholder,
.modal-content input::placeholder {
  color: var(--t3);
}

/* Textarea */
textarea.inp,
.modal textarea,
.modal-content textarea {
  min-height: 80px;
  resize: vertical;
}

/* Select */
select.inp,
.modal select,
.modal-content select {
  cursor: pointer;
  appearance: auto;
}

/* Disabled */
.inp:disabled,
.modal input:disabled,
.modal select:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* Form buttons row */
.form-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  margin-top: 16px;
}

/* ─────────────────────────────────────────────────────────────────────────────
   LIGHT THEME — All variables defined in design-tokens.css
   Only page-specific component overrides below.
   ───────────────────────────────────────────────────────────────────────────── */

/* Body background */
html[data-theme="light"] body {
  background: var(--bg3);
  color: var(--t1);
}

html[data-theme="light"] body::before {
  background: linear-gradient(90deg, var(--blue), var(--gold), var(--blue));
}

/* Sidenav — light theme handled by design-tokens.css */

/* Header — light theme handled by design-tokens.css */

/* Cards */
html[data-theme="light"] .card,
html[data-theme="light"] .panel {
  background: var(--bg2);
  border: 1px solid var(--brd);
  box-shadow: var(--shadow-sm);
}

html[data-theme="light"] .card:hover,
html[data-theme="light"] .panel:hover {
  border-color: var(--blue);
  box-shadow: var(--shadow-md);
}

/* Buttons — light theme handled by design-tokens.css + components.css */

/* Inputs */
html[data-theme="light"] input,
html[data-theme="light"] select,
html[data-theme="light"] textarea,
html[data-theme="light"] .inp {
  background: var(--bg2);
  border: 1px solid var(--brd);
  color: var(--t1);
}

html[data-theme="light"] input:focus,
html[data-theme="light"] select:focus,
html[data-theme="light"] textarea:focus,
html[data-theme="light"] .inp:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px var(--blue-glow);
  outline: none;
}

html[data-theme="light"] input::placeholder,
html[data-theme="light"] textarea::placeholder {
  color: var(--t3);
}

/* Tables */
html[data-theme="light"] .tbl,
html[data-theme="light"] table {
  background: var(--bg2);
}

html[data-theme="light"] .tbl th,
html[data-theme="light"] table th {
  background: var(--bg4);
  color: var(--t2);
  border-bottom: 2px solid var(--brd);
}

html[data-theme="light"] .tbl td,
html[data-theme="light"] table td {
  border-bottom: 1px solid var(--brd-m);
  color: var(--t1);
}

html[data-theme="light"] .tbl tr:hover,
html[data-theme="light"] table tr:hover {
  background: var(--bg3);
}

/* Badges — light theme handled by design-tokens.css */

/* KPI Cards */
html[data-theme="light"] .kpi {
  background: var(--bg2);
  border: 1px solid var(--brd);
  color: var(--t1);
}

html[data-theme="light"] .kpi .val {
  color: var(--blue);
}

html[data-theme="light"] .kpi .label {
  color: var(--t3);
}

/* Pills */
html[data-theme="light"] .pill {
  background: var(--bg3);
  border: 1px solid var(--brd);
  color: var(--t1);
}

/* Help text */
html[data-theme="light"] .help {
  color: var(--t2);
}

/* Details / Summary */
html[data-theme="light"] details {
  background: var(--bg2);
  border: 1px solid var(--brd);
}

html[data-theme="light"] summary {
  color: var(--t1);
}

html[data-theme="light"] details[open] summary {
  border-bottom: 1px solid var(--brd);
}

/* Dots */
html[data-theme="light"] .dot {
  box-shadow: 0 0 8px currentColor;
}

/* Scrollbar */
html[data-theme="light"] ::-webkit-scrollbar-track {
  background: var(--bg4);
}

html[data-theme="light"] ::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, 0.15);
}

html[data-theme="light"] ::-webkit-scrollbar-thumb:hover {
  background: rgba(0, 0, 0, 0.3);
}

/* Toast light theme moved to components.css */

/* Links */
html[data-theme="light"] a {
  color: var(--blue);
}

html[data-theme="light"] a:hover {
  color: var(--t1);
}

/* Tabs */
html[data-theme="light"] .tab-btn {
  color: var(--t3);
  border-bottom-color: transparent;
}

html[data-theme="light"] .tab-btn:hover {
  color: var(--blue);
  background: var(--blue-glow);
}

html[data-theme="light"] .tab-btn.active {
  color: var(--blue);
  border-bottom-color: var(--blue);
  background: var(--blue-bg);
}

/* Stat Cards */
html[data-theme="light"] .stat-card {
  background: var(--bg2);
  border: 1px solid var(--brd);
}

html[data-theme="light"] .stat-value {
  color: var(--blue);
}

html[data-theme="light"] .stat-label {
  color: var(--t3);
}

/* Chart containers */
html[data-theme="light"] .chart-wrap {
  background: var(--bg2);
  border: 1px solid var(--brd);
}

/* HR / Dividers */
html[data-theme="light"] hr,
html[data-theme="light"] .hr {
  border-color: var(--brd);
}

/* Form rows */
html[data-theme="light"] .formrow {
  color: var(--t1);
}

html[data-theme="light"] .formrow label {
  color: var(--t2);
}

/* Dropdown menus */
html[data-theme="light"] .dropdown-menu {
  background: var(--bg2);
  border: 1px solid var(--brd);
  box-shadow: var(--shadow-lg);
}

html[data-theme="light"] .dropdown-item {
  color: var(--t1);
}

html[data-theme="light"] .dropdown-item:hover {
  background: var(--bg3);
  color: var(--blue);
}

/* Progress bars */
html[data-theme="light"] .progress-bg {
  background: var(--bg5);
}

/* Code blocks */
html[data-theme="light"] code,
html[data-theme="light"] pre {
  background: var(--bg4);
  color: var(--t1);
  border: 1px solid var(--brd);
}

/* Alert boxes */
html[data-theme="light"] .alert {
  border-width: 1px;
  border-style: solid;
}

html[data-theme="light"] .alert-success { background: rgba(22, 163, 74, 0.1); border-color: rgba(22, 163, 74, 0.2); color: var(--ok); }
html[data-theme="light"] .alert-warning { background: rgba(217, 119, 6, 0.1); border-color: rgba(217, 119, 6, 0.2); color: var(--warn); }
html[data-theme="light"] .alert-error { background: rgba(220, 38, 38, 0.1); border-color: rgba(220, 38, 38, 0.2); color: var(--red-h); }
html[data-theme="light"] .alert-info { background: rgba(37, 99, 235, 0.1); border-color: rgba(37, 99, 235, 0.2); color: var(--blue); }

/* Widget cards */
html[data-theme="light"] .dashboard-widget {
  background: var(--bg2);
  border: 1px solid var(--brd);
}

html[data-theme="light"] .dashboard-widget:hover {
  border-color: rgba(220, 38, 38, 0.2);
}

html[data-theme="light"] .widget-header {
  background: linear-gradient(135deg, rgba(220, 38, 38, 0.05), rgba(37, 99, 235, 0.03));
  border-bottom: 1px solid var(--brd);
}

html[data-theme="light"] .widget-stat-value {
  color: var(--blue);
}

html[data-theme="light"] .widget-action-btn {
  background: linear-gradient(135deg, rgba(220, 38, 38, 0.08), rgba(37, 99, 235, 0.06));
  border: 1px solid var(--brd);
  color: var(--t1);
}

html[data-theme="light"] .widget-action-btn:hover {
  background: linear-gradient(135deg, rgba(220, 38, 38, 0.15), rgba(37, 99, 235, 0.1));
  border-color: rgba(220, 38, 38, 0.2);
}

/* Chat — Light Theme (app.css overrides) */
html[data-theme="light"] .chat-container {
  background: var(--bg2);
  border: 1px solid var(--brd);
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.06);
}

html[data-theme="light"] .chat-sidebar {
  background: var(--bg3);
  border-right: 1px solid var(--brd);
}

html[data-theme="light"] .chat-item {
  border-bottom: 1px solid rgba(0, 0, 0, 0.04);
}

html[data-theme="light"] .chat-item:hover {
  background: rgba(0, 0, 0, 0.03);
}

html[data-theme="light"] .chat-item.active {
  background: rgba(212, 175, 55, 0.08);
  border-left: 3px solid var(--gold);
}

html[data-theme="light"] .chat-message-bubble {
  background: var(--bg2);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.06);
}

html[data-theme="light"] .chat-message.own .chat-message-bubble {
  background: #dcf8c6;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.06);
}

html[data-theme="light"] .chat-main {
  background: #efeae2;
}

html[data-theme="light"] .chat-messages {
  background: #efeae2;
}

html[data-theme="light"] .chat-input {
  background: var(--bg2);
  border: 1px solid rgba(0, 0, 0, 0.12);
  color: var(--t1);
}

html[data-theme="light"] .chat-input:focus {
  border-color: var(--gold);
  background: var(--bg2);
}

html[data-theme="light"] .chat-date-divider span {
  background: rgba(255, 255, 255, 0.85);
  color: rgba(0, 0, 0, 0.5);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

html[data-theme="light"] .chat-search-input {
  background: var(--bg2);
  border-color: rgba(0, 0, 0, 0.1);
  color: var(--t1);
}

html[data-theme="light"] .chat-msg-action-btn {
  background: var(--bg2);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

/* Skeleton loading */
html[data-theme="light"] .skeleton,
html[data-theme="light"] .widget-loading {
  background: linear-gradient(90deg, var(--bg5) 25%, var(--bg4) 50%, var(--bg5) 75%);
  background-size: 200% 100%;
}

/* Selection */
html[data-theme="light"] ::selection {
  background: rgba(220, 38, 38, 0.15);
}

/* Gantt chart */
html[data-theme="light"] .gantt-bar {
  background: linear-gradient(135deg, var(--blue), var(--gold));
}

/* Calendar */
html[data-theme="light"] .cal-day {
  background: var(--bg2);
  border: 1px solid var(--brd);
  color: var(--t1);
}

html[data-theme="light"] .cal-day:hover {
  background: rgba(220, 38, 38, 0.08);
}

html[data-theme="light"] .cal-day.today {
  background: rgba(220, 38, 38, 0.1);
  border-color: var(--blue);
}

/* Table wrapper */
html[data-theme="light"] .tbl-wrap {
  background: var(--bg2);
  border: 1px solid var(--brd);
}

/* Funnel */
html[data-theme="light"] .funnel-stage {
  background: var(--bg2);
  border: 1px solid var(--brd);
}

/* Theme toggle button */
.themebtn {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  border: 1px solid var(--brd);
  background: var(--glass);
  cursor: pointer;
  transition: all var(--fast);
}

.themebtn:hover {
  border-color: var(--gold-border);
  background: var(--gold-glow);
}

.themebtn .icon {
  width: 18px;
  height: 18px;
}

.themebtn .icon-sun { display: block; }
.themebtn .icon-moon { display: none; }

html[data-theme="light"] .themebtn .icon-sun { display: none; }
html[data-theme="light"] .themebtn .icon-moon { display: block; }

html[data-theme="light"] .themebtn {
  background: var(--bg2);
  border: 1px solid rgba(0, 0, 0, 0.1);
}

html[data-theme="light"] .themebtn:hover {
  background: rgba(220, 38, 38, 0.1);
  border-color: rgba(220, 38, 38, 0.3);
}

/* ─────────────────────────────────────────────────────────────────────────────
   UTILITIES
   ───────────────────────────────────────────────────────────────────────────── */
.text-gold { color: var(--gold) !important; }
.text-red { color: var(--red) !important; }
.text-green { color: var(--ok-t) !important; }
.text-blue { color: var(--blue) !important; }
.text-amber { color: var(--gold) !important; }
.text-muted { color: var(--t3) !important; }

.bg-gold { background: var(--gold-bg) !important; }
.bg-red { background: var(--red-glow) !important; }
.bg-green { background: var(--ok-bg) !important; }
.bg-blue { background: var(--blue-glow) !important; }

.mt-0 { margin-top: 0 !important; }
.mt-1 { margin-top: 8px !important; }
.mt-2 { margin-top: 16px !important; }
.mt-3 { margin-top: 24px !important; }

.mb-0 { margin-bottom: 0 !important; }
.mb-1 { margin-bottom: 8px !important; }
.mb-2 { margin-bottom: 16px !important; }
.mb-3 { margin-bottom: 24px !important; }

.p-0 { padding: 0 !important; }
.p-1 { padding: 8px !important; }
.p-2 { padding: 16px !important; }
.p-3 { padding: 24px !important; }

.hidden { display: none !important; }
.visible { display: block !important; }

/* ─────────────────────────────────────────────────────────────────────────────
   LIGHT THEME — Дополнительные стили
   ───────────────────────────────────────────────────────────────────────────── */

/* Navitem icons — dark theme (default) */
.ico img {
  filter: invert(1) opacity(0.85) !important;
}
.navitem:hover .ico img,
.navitem.active .ico img {
  filter: invert(1) opacity(1) brightness(1.2) !important;
}

/* Navitem icons — light theme */
html[data-theme="light"] .ico img {
  filter: brightness(0) saturate(100%) invert(30%) sepia(10%) saturate(500%) hue-rotate(180deg) brightness(90%);
}

html[data-theme="light"] .navitem:hover .ico img,
html[data-theme="light"] .navitem.active .ico img {
  filter: brightness(0) saturate(100%) invert(25%) sepia(90%) saturate(2000%) hue-rotate(340deg) brightness(95%);
}

html[data-theme="light"] .ico {
  background: transparent;
  border-color: transparent;
}

html[data-theme="light"] .navitem:hover .ico,
html[data-theme="light"] .navitem.active .ico {
  background: rgba(220, 38, 38, 0.1);
  border-color: rgba(220, 38, 38, 0.2);
  box-shadow: 0 0 12px rgba(220, 38, 38, 0.15);
}

/* Brand */
html[data-theme="light"] .brand {
  background: var(--bg2);
  border: 1px solid rgba(0, 0, 0, 0.1);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

html[data-theme="light"] .brand:hover {
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
}

html[data-theme="light"] .brand .h {
  background: linear-gradient(135deg, var(--blue), var(--gold));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

html[data-theme="light"] .brand .s {
  color: var(--t2);
}

html[data-theme="light"] .brand img {
  border-color: rgba(0, 0, 0, 0.1);
  background: var(--bg3);
}

/* Navitem text */
html[data-theme="light"] .navitem {
  color: var(--t2);
}

html[data-theme="light"] .navitem:hover {
  color: var(--blue);
  background: rgba(220, 38, 38, 0.06);
  border-color: rgba(220, 38, 38, 0.1);
}

html[data-theme="light"] .navitem.active {
  color: var(--blue);
  background: rgba(220, 38, 38, 0.1);
  border-color: rgba(220, 38, 38, 0.15);
}

html[data-theme="light"] .navitem .t {
  color: inherit;
}

html[data-theme="light"] .navitem .d {
  color: var(--t3);
}

/* Group titles */
html[data-theme="light"] .group-title {
  color: var(--t3);
}

/* Topbar / Header area */
html[data-theme="light"] .topbar {
  background: rgba(255, 255, 255, 0.98);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--brd);
}

html[data-theme="light"] .topbar h1,
html[data-theme="light"] .topbar h2,
html[data-theme="light"] .topbar .title {
  color: var(--t1);
}

/* User avatar area */
html[data-theme="light"] .user-info {
  color: var(--t1);
}

html[data-theme="light"] .user-role {
  color: var(--t2);
}

/* Search input */
html[data-theme="light"] .search-input {
  background: var(--bg3);
  border: 1px solid rgba(0, 0, 0, 0.1);
  color: var(--t1);
}

html[data-theme="light"] .search-input::placeholder {
  color: var(--t3);
}

html[data-theme="light"] .search-input:focus {
  background: var(--bg2);
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.1);
}

/* Breadcrumbs */
html[data-theme="light"] .breadcrumb {
  color: var(--t2);
}

html[data-theme="light"] .breadcrumb a {
  color: var(--t2);
}

html[data-theme="light"] .breadcrumb a:hover {
  color: var(--blue);
}

/* Empty states */
html[data-theme="light"] .empty-state {
  color: var(--t2);
}

/* Pagination */
html[data-theme="light"] .pagination .page-btn {
  background: var(--bg2);
  border: 1px solid rgba(0, 0, 0, 0.1);
  color: var(--t2);
}

html[data-theme="light"] .pagination .page-btn:hover {
  background: rgba(220, 38, 38, 0.08);
  border-color: rgba(220, 38, 38, 0.2);
  color: var(--blue);
}

html[data-theme="light"] .pagination .page-btn.active {
  background: var(--blue);
  border-color: var(--blue);
  color: var(--bg0);
}

/* Filters */
html[data-theme="light"] .filter-group {
  background: var(--bg2);
  border: 1px solid var(--brd);
}

html[data-theme="light"] .filter-label {
  color: var(--t2);
}

/* Select dropdowns */
html[data-theme="light"] select option {
  background: var(--bg2);
  color: var(--t1);
}

/* Checkboxes and radios */
html[data-theme="light"] input[type="checkbox"],
html[data-theme="light"] input[type="radio"] {
  accent-color: var(--blue);
}

/* Toggle switches */
html[data-theme="light"] .toggle-switch {
  background: var(--brd);
}

html[data-theme="light"] .toggle-switch.active {
  background: var(--blue);
}

/* Tooltip */
html[data-theme="light"] .tooltip {
  background: var(--t1);
  color: var(--bg2);
}

/* Loading spinners */
html[data-theme="light"] .spinner {
  border-color: rgba(0, 0, 0, 0.1);
  border-top-color: var(--blue);
}

/* Status indicators */
html[data-theme="light"] .status-dot {
  box-shadow: 0 0 6px currentColor;
}

/* Accordion */
html[data-theme="light"] .accordion-item {
  background: var(--bg2);
  border: 1px solid var(--brd);
}

html[data-theme="light"] .accordion-header {
  color: var(--t1);
}

html[data-theme="light"] .accordion-header:hover {
  background: var(--red-bg);
}

/* Timeline */
html[data-theme="light"] .timeline-item::before {
  background: var(--bg5);
}

html[data-theme="light"] .timeline-dot {
  background: var(--bg2);
  border-color: var(--blue);
}

/* Avatar */
html[data-theme="light"] .avatar {
  background: var(--bg4);
  color: var(--t2);
  border: 2px solid var(--brd);
}

/* Notifications dropdown */
html[data-theme="light"] .notifications-panel {
  background: var(--bg2);
  border: 1px solid rgba(0, 0, 0, 0.1);
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
}

html[data-theme="light"] .notification-item {
  border-bottom: 1px solid var(--brd);
}

html[data-theme="light"] .notification-item:hover {
  background: rgba(220, 38, 38, 0.05);
}

html[data-theme="light"] .notification-item.unread {
  background: rgba(37, 99, 235, 0.05);
}

/* Quick stats */
html[data-theme="light"] .quick-stat {
  background: var(--bg2);
  border: 1px solid var(--brd);
}

html[data-theme="light"] .quick-stat-value {
  color: var(--blue);
}

html[data-theme="light"] .quick-stat-label {
  color: var(--t2);
}

/* Mimir chat widget in light theme */
html[data-theme="light"] .mimir-panel {
  background: linear-gradient(180deg, var(--bg2), var(--bg3));
  border-color: rgba(0, 0, 0, 0.15);
}

html[data-theme="light"] .mimir-header {
  background: linear-gradient(135deg, rgba(220, 38, 38, 0.08), rgba(37, 99, 235, 0.05));
  border-bottom-color: var(--brd);
}

html[data-theme="light"] .mimir-header-title {
  color: var(--blue);
}

html[data-theme="light"] .mimir-header-status {
  color: var(--t2);
}

html[data-theme="light"] .mimir-message.assistant {
  background: var(--bg4);
  color: var(--t1);
  border-color: var(--brd);
}

html[data-theme="light"] .mimir-message.user {
  background: linear-gradient(135deg, var(--blue), var(--blue-h));
  color: var(--bg0);
}

html[data-theme="light"] .mimir-input {
  background: var(--bg2);
  border-color: rgba(0, 0, 0, 0.15);
  color: var(--t1);
}

html[data-theme="light"] .mimir-input::placeholder {
  color: var(--t3);
}

html[data-theme="light"] .mimir-suggestion {
  background: var(--bg3);
  border-color: rgba(0, 0, 0, 0.1);
  color: var(--t2);
}

html[data-theme="light"] .mimir-suggestion:hover {
  background: rgba(220, 38, 38, 0.1);
  color: var(--blue);
}

html[data-theme="light"] .mimir-wisdom {
  color: var(--t3);
  border-top-color: var(--brd);
}

/* Scanner modal */
html[data-theme="light"] .scanner-container {
  background: var(--bg2);
}

html[data-theme="light"] .scanner-header {
  border-bottom-color: var(--brd);
}

html[data-theme="light"] .scanner-ocr {
  background: var(--bg3);
}

/* Row hover */
html[data-theme="light"] tr:hover td {
  background: rgba(220, 38, 38, 0.03);
}

/* Action buttons in tables */
html[data-theme="light"] .row-actions .btn {
  background: var(--bg3);
  border-color: rgba(0, 0, 0, 0.1);
  color: var(--t2);
}

html[data-theme="light"] .row-actions .btn:hover {
  background: rgba(220, 38, 38, 0.1);
  color: var(--blue);
}

/* Form field labels */
html[data-theme="light"] label {
  color: var(--t2);
}

/* Fieldsets */
html[data-theme="light"] fieldset {
  border-color: rgba(0, 0, 0, 0.1);
}

html[data-theme="light"] legend {
  color: var(--t1);
}

/* List items */
html[data-theme="light"] .list-item {
  background: var(--bg2);
  border-bottom: 1px solid var(--brd);
}

html[data-theme="light"] .list-item:hover {
  background: rgba(220, 38, 38, 0.03);
}

/* Stats grid */
html[data-theme="light"] .stats-grid .stat {
  background: var(--bg2);
  border: 1px solid var(--brd);
}

/* Info boxes */
html[data-theme="light"] .info-box {
  background: rgba(37, 99, 235, 0.06);
  border: 1px solid rgba(37, 99, 235, 0.15);
  color: var(--blue);
}

/* Warning boxes */
html[data-theme="light"] .warning-box {
  background: rgba(217, 119, 6, 0.08);
  border: 1px solid rgba(217, 119, 6, 0.2);
  color: var(--warn);
}

/* Success boxes */
html[data-theme="light"] .success-box {
  background: rgba(22, 163, 74, 0.08);
  border: 1px solid rgba(22, 163, 74, 0.2);
  color: var(--ok);
}

/* Main content area */
html[data-theme="light"] main,
html[data-theme="light"] .main-content {
  background: transparent;
  color: var(--t1);
}

/* Offline banner */
html[data-theme="light"] .offline-banner {
  background: var(--grad-gold);
}

/* Bottom bar / footer */
html[data-theme="light"] footer,
html[data-theme="light"] .footer {
  background: var(--bg2);
  border-top: 1px solid var(--brd);
  color: var(--t2);
}

/* Watermark - make it subtle in light theme */
html[data-theme="light"] .watermark {
  opacity: 0.03;
}



/* ═══════════════════════════════════════════════════════════════════════════════
   VIKING GREETING STYLES
   ═══════════════════════════════════════════════════════════════════════════════ */
.viking-greeting {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 20px;
  background: linear-gradient(135deg, var(--blue-glow), var(--gold-glow));
  border: 1px solid var(--blue);
  border-radius: 6px;
  margin-bottom: 8px;
}

.viking-greeting .rune-icon {
  font-size: 28px;
  color: var(--gold);
  text-shadow: 0 0 12px var(--gold-glow);
  animation: rune-pulse 3s ease-in-out infinite;
}

@keyframes rune-pulse {
  0%, 100% { opacity: 0.8; transform: scale(1); }
  50% { opacity: 1; transform: scale(1.1); }
}

.viking-greeting .greeting-text {
  font-size: 16px;
  font-weight: 600;
  color: var(--t1);
}

.saga-line {
  display: flex;
  align-items: center;
  gap: 10px;
}

.saga-badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  background: linear-gradient(135deg, var(--gold-glow), var(--gold-glow));
  border: 1px solid var(--gold-border);
  border-radius: 6px;
  font-size: 11px;
  font-weight: 700;
  color: var(--gold);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* Light theme Viking greeting */
html[data-theme="light"] .viking-greeting {
  background: linear-gradient(135deg, rgba(220, 38, 38, 0.08), rgba(37, 99, 235, 0.06));
  border-color: rgba(220, 38, 38, 0.2);
}

html[data-theme="light"] .viking-greeting .rune-icon {
  color: var(--blue);
  text-shadow: 0 0 8px rgba(220, 38, 38, 0.3);
}

html[data-theme="light"] .viking-greeting .greeting-text {
  color: var(--t1);
}

html[data-theme="light"] .saga-badge {
  background: rgba(220, 38, 38, 0.1);
  border-color: rgba(220, 38, 38, 0.2);
  color: var(--blue);
}

/* ═══════════════════════════════════════════════════════════════════════════════
   UNIFIED STATUS BADGE STYLES
   ═══════════════════════════════════════════════════════════════════════════════ */
.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  transition: all var(--fast);
}

/* Status types */
.status-badge.new,
.status-badge.pending {
  background: rgba(37, 99, 235, 0.15);
  color: var(--info);
  border: 1px solid rgba(37, 99, 235, 0.25);
}

.status-badge.in-progress,
.status-badge.working {
  background: rgba(245, 158, 11, 0.15);
  color: var(--warn);
  border: 1px solid rgba(245, 158, 11, 0.25);
}

.status-badge.approved,
.status-badge.success,
.status-badge.done,
.status-badge.completed {
  background: rgba(34, 197, 94, 0.15);
  color: var(--ok-t);
  border: 1px solid rgba(34, 197, 94, 0.25);
}

.status-badge.rejected,
.status-badge.error,
.status-badge.problem,
.status-badge.failed {
  background: rgba(220, 38, 38, 0.15);
  color: var(--err-t);
  border: 1px solid rgba(220, 38, 38, 0.25);
}

.status-badge.draft {
  background: rgba(100, 116, 139, 0.15);
  color: var(--t2);
  border: 1px solid rgba(100, 116, 139, 0.25);
}

.status-badge.urgent,
.status-badge.critical {
  background: rgba(220, 38, 38, 0.2);
  color: var(--err-t);
  border: 1px solid rgba(220, 38, 38, 0.35);
  animation: urgent-pulse 2s ease-in-out infinite;
}

@keyframes urgent-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(220, 38, 38, 0.4); }
  50% { box-shadow: 0 0 0 6px rgba(220, 38, 38, 0); }
}

/* Status dot before text */
.status-badge::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}

/* Light theme status badges */
html[data-theme="light"] .status-badge.new,
html[data-theme="light"] .status-badge.pending {
  background: rgba(37, 99, 235, 0.12);
  color: var(--blue);
}

html[data-theme="light"] .status-badge.in-progress,
html[data-theme="light"] .status-badge.working {
  background: rgba(217, 119, 6, 0.12);
  color: var(--warn);
}

html[data-theme="light"] .status-badge.approved,
html[data-theme="light"] .status-badge.success,
html[data-theme="light"] .status-badge.done,
html[data-theme="light"] .status-badge.completed {
  background: rgba(22, 163, 74, 0.12);
  color: var(--ok);
}

html[data-theme="light"] .status-badge.rejected,
html[data-theme="light"] .status-badge.error,
html[data-theme="light"] .status-badge.problem,
html[data-theme="light"] .status-badge.failed {
  background: rgba(220, 38, 38, 0.12);
  color: var(--red-h);
}

/* ═══════════════════════════════════════════════════════════════════════════════
   LIGHT THEME IMPROVEMENTS — Softer, Rounded, Better Spacing
   ═══════════════════════════════════════════════════════════════════════════════ */

/* Softer background gradient */
html[data-theme="light"] body {
  background:
    linear-gradient(180deg, var(--bg2) 0%, var(--bg3) 50%, var(--bg4) 100%);
  background-attachment: fixed;
}

/* Increase border radius globally */
html[data-theme="light"] .card,
html[data-theme="light"] .panel {
  border-radius: 6px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04), 0 4px 16px rgba(0, 0, 0, 0.02);
}

html[data-theme="light"] .btn {
  border-radius: 6px;
}

html[data-theme="light"] input,
html[data-theme="light"] select,
html[data-theme="light"] textarea,
html[data-theme="light"] .inp {
  border-radius: 6px;
  padding: 10px 14px;
}

/* Fix border spacing issues */
html[data-theme="light"] table.asg td {
  padding: 12px 14px;
  background: var(--bg2);
  border: none;
}

html[data-theme="light"] table.asg tr td:first-child {
  border-top-left-radius: 12px;
  border-bottom-left-radius: 12px;
  border-left: 3px solid transparent;
}

html[data-theme="light"] table.asg tr td:last-child {
  border-top-right-radius: 12px;
  border-bottom-right-radius: 12px;
}

/* Softer KPI cards */
html[data-theme="light"] .kpi .k {
  background: var(--bg2);
  border: none;
  border-radius: 6px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}

html[data-theme="light"] .kpi .k .t {
  color: var(--t2);
}

html[data-theme="light"] .kpi .k .v {
  color: var(--blue);
}

html[data-theme="light"] .kpi .k .s {
  color: var(--t3);
}

/* Better sidebar for light theme */
html[data-theme="light"] .sidenav {
  background: linear-gradient(180deg, var(--bg2), var(--bg3));
  border-right: 1px solid var(--brd);
}

html[data-theme="light"] .sidenav::before {
  background: none;
}

/* Better navitem styling */
html[data-theme="light"] .navitem {
  border-radius: 6px;
}

html[data-theme="light"] .navitem .lbl .name {
  color: var(--t1);
}

html[data-theme="light"] .navitem .lbl .desc {
  color: var(--t3);
}

html[data-theme="light"] .navitem:hover .lbl .name,
html[data-theme="light"] .navitem.active .lbl .name {
  color: var(--blue);
}

/* Better pill styling */
html[data-theme="light"] .pill {
  border-radius: 6px;
  border: 1px solid var(--brd);
  background: var(--bg3);
}

html[data-theme="light"] .pill .who {
  color: var(--t1);
}

html[data-theme="light"] .pill .role {
  background: rgba(220, 38, 38, 0.1);
  color: var(--blue);
}

/* Better buttons */
html[data-theme="light"] .btn.red {
  background: linear-gradient(135deg, var(--blue), var(--blue-h));
  color: var(--bg0);
  border: none;
  box-shadow: 0 2px 8px rgba(220, 38, 38, 0.25);
}

html[data-theme="light"] .btn.red:hover {
  box-shadow: 0 4px 16px rgba(220, 38, 38, 0.35);
  transform: translateY(-1px);
}

/* Bell button */
html[data-theme="light"] .bellbtn {
  background: var(--bg2);
  border: 1px solid var(--brd);
  color: var(--t2);
  border-radius: 6px;
}

html[data-theme="light"] .bellbtn:hover {
  background: rgba(220, 38, 38, 0.06);
  border-color: rgba(220, 38, 38, 0.2);
}

html[data-theme="light"] .bellcount {
  background: var(--blue);
  color: var(--bg0);
}

/* Bell popup */
html[data-theme="light"] .bellpop {
  background: var(--bg2);
  border: 1px solid rgba(0, 0, 0, 0.1);
  border-radius: 6px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.12);
}

html[data-theme="light"] .bellpop-head {
  background: linear-gradient(135deg, rgba(220, 38, 38, 0.04), rgba(37, 99, 235, 0.02));
  border-bottom: 1px solid var(--brd);
  color: var(--t1);
}

html[data-theme="light"] .bellitem {
  border-bottom: 1px solid rgba(0, 0, 0, 0.04);
  color: var(--t1);
}

html[data-theme="light"] .bellitem:hover {
  background: rgba(220, 38, 38, 0.04);
}

/* Better tools/filters area */
html[data-theme="light"] .tools {
  background: var(--bg3);
  padding: 16px;
  border-radius: 6px;
  border: 1px solid rgba(0, 0, 0, 0.04);
}

/* Chart areas */
html[data-theme="light"] .chart {
  background: var(--bg2);
  border: 1px solid var(--brd);
  border-radius: 6px;
}

/* Grid cards */
html[data-theme="light"] .grid .card {
  background: var(--bg2);
  border: 1px solid var(--brd);
  border-radius: 6px;
}

html[data-theme="light"] .grid .card h3 {
  color: var(--t1);
}

html[data-theme="light"] .grid .card p {
  color: var(--t2);
}

/* Main content area */
html[data-theme="light"] .main::before {
  background: radial-gradient(ellipse at 80% 0%, rgba(220, 38, 38, 0.03), transparent 60%);
}

/* Form labels */
html[data-theme="light"] label {
  color: var(--t2);
}

html[data-theme="light"] .field label {
  color: var(--t2);
  font-weight: 600;
}

/* ═══════════════════════════════════════════════════════════════════════════════
   CALENDAR FILTER AND POLISH
   ═══════════════════════════════════════════════════════════════════════════════ */
.cal-header {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.cal-filter {
  margin-left: auto;
}

.cal-filter select {
  padding: 8px 12px;
  border-radius: 6px;
  border: 1px solid var(--brd);
  background: var(--glass);
  color: var(--t1);
  font-size: 13px;
}

html[data-theme="light"] .cal-filter select {
  background: var(--bg2);
  border: 1px solid rgba(0, 0, 0, 0.1);
  color: var(--t1);
}

/* Calendar day events improvements */
.cal-day-events {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-top: 4px;
  overflow: hidden;
}

.cal-event {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 2px 6px;
  background: color-mix(in srgb, var(--event-color) 20%, transparent);
  border-left: 3px solid var(--event-color);
  border-radius: 4px;
  font-size: 11px;
  cursor: pointer;
  transition: all var(--fast);
  overflow: hidden;
}

.cal-event:hover {
  background: color-mix(in srgb, var(--event-color) 30%, transparent);
  transform: translateX(2px);
}

.cal-event-time {
  font-weight: 600;
  color: var(--event-color);
  flex-shrink: 0;
}

.cal-event-title {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cal-more {
  font-size: 10px;
  color: var(--t3);
  padding: 2px 6px;
}

/* ═══════════════════════════════════════════════════════════════════════════════
   FINAL UI POLISH — Micro-improvements
   ═══════════════════════════════════════════════════════════════════════════════ */

/* Better focus states */
input:focus,
select:focus,
textarea:focus,
.inp:focus {
  outline: none;
  border-color: var(--gold);
  box-shadow: 0 0 0 3px var(--gold-glow);
}

html[data-theme="light"] input:focus,
html[data-theme="light"] select:focus,
html[data-theme="light"] textarea:focus,
html[data-theme="light"] .inp:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.1);
}

/* Smoother button hover */
.btn {
  transition: all var(--base);
}

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

/* Better card hover effect */
.card {
  transition: all var(--base);
}

.card:hover {
  box-shadow: var(--shadow-md);
}

html[data-theme="light"] .card:hover {
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
}

/* Improved table row hover */
table.asg tr:hover td {
  background: var(--bg3);
}

html[data-theme="light"] table.asg tr:hover td {
  background: rgba(220, 38, 38, 0.04);
}

/* Better scrollbar styling */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

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

::-webkit-scrollbar-thumb {
  background: var(--brd);
  border-radius: 3px;
}

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

/* ═══════════════════════════════════════════════════════════════════════════════
   SELECTION COLOR
   ═══════════════════════════════════════════════════════════════════════════════ */
::selection {
  background: var(--gold-glow);
  color: var(--t1);
}

/* ═══════════════════════════════════════════════════════════════════════════════
   FOCUS-VISIBLE — Keyboard navigation
   ═══════════════════════════════════════════════════════════════════════════════ */
*:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
}

html[data-theme="light"] *:focus-visible {
  outline-color: var(--blue);
}

/* Remove focus outline for mouse clicks */
*:focus:not(:focus-visible) {
  outline: none;
}

/* Smooth page transitions */
.main {
  animation: pageEnter 0.3s ease-out;
}

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

/* Better empty state styling */
.empty-state,
.muted {
  text-align: center;
  padding: var(--sp-6);
  color: var(--t3);
  font-style: italic;
}

/* Improved pill/badge spacing */
.pill, .badge {
  transition: all var(--fast);
}

.pill:hover, .badge:hover {
  transform: translateY(-1px);
}

/* ═══════════════════════════════════════════════════════════════════════════════
   ASGARD CRM — MODERN UI POLISH v2.5
   ═══════════════════════════════════════════════════════════════════════════════ */

/* ─────────────────────────────────────────────────────────────────────────────
   ANIMATED MESH GRADIENT BACKGROUND
   ───────────────────────────────────────────────────────────────────────────── */
body::after {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background:
    radial-gradient(ellipse 80% 50% at 20% 30%, rgba(220, 38, 38, 0.08), transparent 50%),
    radial-gradient(ellipse 60% 40% at 80% 20%, rgba(37, 99, 235, 0.1), transparent 50%),
    radial-gradient(ellipse 50% 30% at 50% 80%, rgba(139, 92, 246, 0.06), transparent 50%);
  pointer-events: none;
  z-index: -1;
  animation: meshFloat 20s ease-in-out infinite;
}

@keyframes meshFloat {
  0%, 100% {
    background-position: 0% 0%, 100% 0%, 50% 100%;
    opacity: 1;
  }
  33% {
    background-position: 30% 20%, 70% 30%, 40% 80%;
    opacity: 0.8;
  }
  66% {
    background-position: 10% 40%, 90% 10%, 60% 90%;
    opacity: 0.9;
  }
}

/* ─────────────────────────────────────────────────────────────────────────────
   ENHANCED GLASSMORPHISM CARDS
   ───────────────────────────────────────────────────────────────────────────── */
.card, .panel {
  background: linear-gradient(
    135deg,
    rgba(14, 31, 61, 0.9) 0%,
    rgba(10, 22, 40, 0.95) 100%
  );
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: none;
  border-radius: var(--r-xl);
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.3);
  position: relative;
  overflow: hidden;
}

.card::before, .panel::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(
    90deg,
    transparent 0%,
    rgba(255, 255, 255, 0.1) 50%,
    transparent 100%
  );
  pointer-events: none;
}

.card:hover, .panel:hover {
  box-shadow:
    0 8px 40px rgba(0, 0, 0, 0.4),
    0 0 30px rgba(220, 38, 38, 0.05);
  transform: translateY(-2px);
}

/* ─────────────────────────────────────────────────────────────────────────────
   MODERN BUTTONS WITH GLOW
   ───────────────────────────────────────────────────────────────────────────── */
.btn {
  position: relative;
  padding: 10px 20px;
  font-weight: 600;
  font-size: 13px;
  letter-spacing: 0.3px;
  border-radius: var(--r-md);
  border: 1px solid transparent;
  cursor: pointer;
  overflow: hidden;
  isolation: isolate;
}

.btn::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(
    135deg,
    rgba(255, 255, 255, 0.1) 0%,
    transparent 50%
  );
  opacity: 0;
  transition: opacity var(--fast);
}

.btn:hover::before {
  opacity: 1;
}

.btn.primary, .btn.red {
  background: linear-gradient(135deg, var(--blue) 0%, var(--blue-h) 100%);
  color: white;
  box-shadow:
    0 4px 15px rgba(220, 38, 38, 0.3),
    0 1px 0 rgba(255, 255, 255, 0.1) inset;
}

.btn.primary:hover, .btn.red:hover {
  box-shadow:
    0 6px 25px rgba(220, 38, 38, 0.4),
    0 0 40px rgba(220, 38, 38, 0.2),
    0 1px 0 rgba(255, 255, 255, 0.15) inset;
  transform: translateY(-2px);
}

.btn.primary:active, .btn.red:active {
  transform: translateY(0) scale(0.98);
  box-shadow:
    0 2px 10px rgba(220, 38, 38, 0.3),
    0 1px 0 rgba(255, 255, 255, 0.1) inset;
}

/* Secondary button with border glow */
.btn.ghost {
  background: transparent;
  border: 1px solid var(--brd);
  color: var(--t1);
  position: relative;
}

.btn.ghost::after {
  content: '';
  position: absolute;
  inset: -1px;
  border-radius: inherit;
  background: linear-gradient(135deg, var(--blue), var(--gold));
  z-index: -1;
  opacity: 0;
  transition: opacity var(--base);
}

.btn.ghost:hover {
  border-color: transparent;
  color: var(--blue-l);
}

.btn.ghost:hover::after {
  opacity: 1;
}

/* ─────────────────────────────────────────────────────────────────────────────
   MODERN INPUT FIELDS
   ───────────────────────────────────────────────────────────────────────────── */
input, select, textarea, .inp {
  background: rgba(10, 22, 40, 0.6);
  border: 1px solid rgba(59, 130, 246, 0.15);
  border-radius: var(--r-md);
  padding: 12px 16px;
  color: var(--t1);
  font-size: 14px;
  transition: all var(--base);
  outline: none;
}

input::placeholder, textarea::placeholder {
  color: var(--t3);
}

input:hover, select:hover, textarea:hover, .inp:hover {
  border-color: rgba(59, 130, 246, 0.3);
  background: rgba(10, 22, 40, 0.8);
}

input:focus, select:focus, textarea:focus, .inp:focus {
  border-color: var(--gold);
  background: rgba(10, 22, 40, 0.9);
  box-shadow:
    0 0 0 3px rgba(37, 99, 235, 0.15),
    0 0 20px rgba(37, 99, 235, 0.1);
}

/* Floating label effect */
.field-float {
  position: relative;
}

.field-float input,
.field-float textarea {
  padding-top: 20px;
  padding-bottom: 8px;
}

.field-float label {
  position: absolute;
  left: 16px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--t3);
  font-size: 14px;
  pointer-events: none;
  transition: all var(--fast);
}

.field-float input:focus + label,
.field-float input:not(:placeholder-shown) + label,
.field-float textarea:focus + label,
.field-float textarea:not(:placeholder-shown) + label {
  top: 12px;
  font-size: 10px;
  color: var(--gold);
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

/* ─────────────────────────────────────────────────────────────────────────────
   SKELETON LOADING STATES
   ───────────────────────────────────────────────────────────────────────────── */
.skeleton {
  background: linear-gradient(
    90deg,
    var(--bg3) 0%,
    var(--blue-bg) 25%,
    var(--bg3) 50%,
    var(--gold-bg) 75%,
    var(--bg3) 100%
  );
  background-size: 400% 100%;
  animation: skeletonShimmer 1.5s ease-in-out infinite;
  border-radius: var(--r-sm);
}

.skeleton-text {
  height: 14px;
  margin: var(--sp-2) 0;
}

.skeleton-title {
  height: 24px;
  width: 60%;
  margin-bottom: var(--sp-4);
}

.skeleton-avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
}

.skeleton-card {
  height: 120px;
  border-radius: var(--r-lg);
}

@keyframes skeletonShimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ─────────────────────────────────────────────────────────────────────────────
   ENHANCED SIDEBAR NAVIGATION — .sidenav moved to layout.css (F1 fix)
   ───────────────────────────────────────────────────────────────────────────── */

.navitem {
  position: relative;
  margin: 4px 0;
}

.navitem::after {
  content: '';
  position: absolute;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 0;
  background: linear-gradient(180deg, var(--blue), var(--gold));
  border-radius: 3px 0 0 3px;
  transition: height var(--base);
}

.navitem:hover::after {
  height: 30%;
}

.navitem.active::after {
  height: 60%;
  box-shadow: 0 0 15px rgba(220, 38, 38, 0.5);
}

.navitem.active {
  background: linear-gradient(
    90deg,
    rgba(220, 38, 38, 0.1) 0%,
    rgba(37, 99, 235, 0.05) 100%
  );
}

/* Animated icon on hover */
.navitem .ico {
  transition: all var(--base);
}

.navitem:hover .ico {
  transform: scale(1.1);
  box-shadow: 0 0 20px rgba(37, 99, 235, 0.3);
}

/* ─────────────────────────────────────────────────────────────────────────────
   MODERN NOTIFICATION BADGES
   ───────────────────────────────────────────────────────────────────────────── */
.notification-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  background: linear-gradient(135deg, var(--blue), var(--blue-h));
  color: white;
  font-size: 10px;
  font-weight: 700;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 8px rgba(220, 38, 38, 0.4);
  animation: badgePulse 2s ease-in-out infinite;
}

/* bellcount — НЕ absolute, остаётся в потоке flex-контейнера .bellbtn */
.bellcount {
  min-width: 18px;
  height: 18px;
  padding: 0 6px;
  background: var(--red);
  color: white;
  font-size: 10px;
  font-weight: 700;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

@keyframes badgePulse {
  0%, 100% {
    transform: scale(1);
    box-shadow: 0 2px 8px rgba(220, 38, 38, 0.4);
  }
  50% {
    transform: scale(1.1);
    box-shadow: 0 2px 12px rgba(220, 38, 38, 0.6), 0 0 20px rgba(220, 38, 38, 0.3);
  }
}

/* ─────────────────────────────────────────────────────────────────────────────
   MODERN TABLE STYLING
   ───────────────────────────────────────────────────────────────────────────── */
table.asg {
  border-collapse: separate;
  border-spacing: 0 8px;
}

table.asg th {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--t3);
  padding: 12px 16px;
  background: transparent;
  border-bottom: 1px solid var(--brd);
}

table.asg td {
  padding: 16px;
  background: rgba(14, 31, 61, 0.5);
  backdrop-filter: blur(10px);
  border: none;
  transition: all var(--fast);
}

table.asg tr td:first-child {
  border-radius: var(--r-lg) 0 0 var(--r-lg);
  border-left: 3px solid transparent;
}

table.asg tr td:last-child {
  border-radius: 0 var(--r-lg) var(--r-lg) 0;
}

table.asg tr:hover td {
  background: rgba(14, 31, 61, 0.8);
}

table.asg tr:hover td:first-child {
  border-left-color: var(--blue);
}

/* ─────────────────────────────────────────────────────────────────────────────
   MODERN TOOLTIPS
   ───────────────────────────────────────────────────────────────────────────── */
[data-tooltip] {
  position: relative;
}

[data-tooltip]::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%) translateY(4px);
  padding: var(--sp-2) var(--sp-3);
  background: var(--bg0);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(59, 130, 246, 0.2);
  border-radius: var(--r-sm);
  font-size: var(--text-xs);
  color: var(--t1);
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: all var(--fast);
  z-index: var(--z-tooltip);
  box-shadow: var(--shadow-lg);
}

[data-tooltip]::before {
  content: '';
  position: absolute;
  bottom: calc(100% + 4px);
  left: 50%;
  transform: translateX(-50%);
  border: 6px solid transparent;
  border-top-color: var(--bg0);
  opacity: 0;
  transition: all var(--fast);
  z-index: var(--z-tooltip);
}

[data-tooltip]:hover::after,
[data-tooltip]:hover::before {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ─────────────────────────────────────────────────────────────────────────────
   MODERN TOGGLE SWITCH
   ───────────────────────────────────────────────────────────────────────────── */
.toggle {
  position: relative;
  width: 52px;
  height: 28px;
  background: rgba(100, 116, 139, 0.3);
  border-radius: 6px;
  cursor: pointer;
  transition: all var(--base);
  border: 1px solid rgba(100, 116, 139, 0.2);
}

.toggle::after {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 20px;
  height: 20px;
  background: white;
  border-radius: 50%;
  transition: all var(--base);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.toggle.active {
  background: linear-gradient(135deg, var(--blue), var(--gold));
  border-color: var(--blue);
}

.toggle.active::after {
  left: calc(100% - 23px);
  box-shadow: 0 2px 8px rgba(220, 38, 38, 0.4);
}

/* ─────────────────────────────────────────────────────────────────────────────
   ANIMATED PROGRESS BARS
   ───────────────────────────────────────────────────────────────────────────── */
.progress {
  height: 8px;
  background: var(--bg3);
  border-radius: var(--r-sm);
  overflow: hidden;
  position: relative;
}

.progress-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--blue), var(--gold));
  border-radius: var(--r-sm);
  position: relative;
  transition: width var(--slow);
}

.progress-bar::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(
    90deg,
    transparent 0%,
    rgba(255, 255, 255, 0.3) 50%,
    transparent 100%
  );
  animation: progressShine 2s ease-in-out infinite;
}

@keyframes progressShine {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(200%); }
}

/* ─────────────────────────────────────────────────────────────────────────────
   MODERN MODAL STYLING (modalback handled by components.css)
   ───────────────────────────────────────────────────────────────────────────── */

.modal {
  background: var(--bg2);
  backdrop-filter: blur(30px);
  -webkit-backdrop-filter: blur(30px);
  border: 1px solid var(--brd);
  border-radius: var(--r-xl);
  box-shadow:
    0 25px 80px rgba(0, 0, 0, 0.5),
    var(--blue-glow),
    0 1px 0 rgba(255, 255, 255, 0.05) inset;
  animation: modalEnter var(--base);
}

@keyframes modalEnter {
  from {
    opacity: 0;
    transform: scale(0.95) translateY(20px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

.modal .mh {
  background: linear-gradient(
    90deg,
    rgba(220, 38, 38, 0.05) 0%,
    rgba(37, 99, 235, 0.05) 100%
  );
  border-bottom: none;
  padding: 20px 24px;
}

.modal .mh .h {
  font-size: 18px;
  font-weight: 700;
  background: linear-gradient(135deg, var(--t1), var(--gold-l));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* ─────────────────────────────────────────────────────────────────────────────
   KPI CARDS ENHANCEMENT
   ───────────────────────────────────────────────────────────────────────────── */
.kpi .k {
  background: linear-gradient(
    135deg,
    rgba(14, 31, 61, 0.8) 0%,
    rgba(10, 22, 40, 0.9) 100%
  );
  backdrop-filter: blur(15px);
  border: none;
  border-radius: var(--r-lg);
  padding: 20px;
  position: relative;
  overflow: hidden;
  transition: all var(--base);
}

.kpi .k::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 4px;
  height: 100%;
  background: linear-gradient(180deg, var(--blue), var(--gold));
  opacity: 0;
  transition: opacity var(--base);
}

.kpi .k:hover {
  transform: translateY(-4px);
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
}

.kpi .k:hover::before {
  opacity: 1;
}

.kpi .k .v {
  font-size: 28px;
  font-weight: 800;
  background: linear-gradient(135deg, var(--blue-l), var(--gold));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* ─────────────────────────────────────────────────────────────────────────────
   ANIMATED COUNTERS
   ───────────────────────────────────────────────────────────────────────────── */
.counter {
  display: inline-block;
  font-variant-numeric: tabular-nums;
  transition: all var(--slow) ease;
}

.counter.counting {
  animation: counterPop 0.3s ease;
}

@keyframes counterPop {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.1); }
}

/* ─────────────────────────────────────────────────────────────────────────────
   MODERN BREADCRUMBS
   ───────────────────────────────────────────────────────────────────────────── */
.breadcrumbs {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  font-size: var(--text-sm);
  color: var(--t3);
}

.breadcrumbs a {
  color: var(--t2);
  transition: color var(--fast);
}

.breadcrumbs a:hover {
  color: var(--blue-l);
}

.breadcrumbs .sep {
  color: var(--t3);
  opacity: 0.5;
}

.breadcrumbs .current {
  color: var(--t1);
  font-weight: var(--fw-semi);
}

/* ─────────────────────────────────────────────────────────────────────────────
   ENHANCED PAGE HEADER
   ───────────────────────────────────────────────────────────────────────────── */
.page-head {
  margin-bottom: 24px;
}

.page-head h1 {
  font-size: 28px;
  font-weight: 800;
  background: linear-gradient(135deg, var(--t1) 0%, var(--gold-l) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin: 0 0 8px 0;
}

.page-head .motto {
  font-size: 14px;
  color: var(--t3);
  font-style: italic;
}

/* ─────────────────────────────────────────────────────────────────────────────
   LIGHT THEME MODERN OVERRIDES
   ───────────────────────────────────────────────────────────────────────────── */
html[data-theme="light"] body::after {
  background:
    radial-gradient(ellipse 80% 50% at 20% 30%, rgba(220, 38, 38, 0.04), transparent 50%),
    radial-gradient(ellipse 60% 40% at 80% 20%, rgba(37, 99, 235, 0.05), transparent 50%),
    radial-gradient(ellipse 50% 30% at 50% 80%, rgba(139, 92, 246, 0.03), transparent 50%);
}

html[data-theme="light"] .card,
html[data-theme="light"] .panel {
  background: linear-gradient(
    135deg,
    rgba(255, 255, 255, 0.95) 0%,
    rgba(248, 250, 252, 0.98) 100%
  );
  border: 1px solid var(--brd);
  box-shadow:
    0 4px 24px rgba(0, 0, 0, 0.06),
    0 1px 0 rgba(255, 255, 255, 0.8) inset;
}

html[data-theme="light"] .card::before,
html[data-theme="light"] .panel::before {
  background: linear-gradient(
    90deg,
    transparent 0%,
    rgba(255, 255, 255, 0.5) 50%,
    transparent 100%
  );
}

html[data-theme="light"] .card:hover,
html[data-theme="light"] .panel:hover {
  border-color: rgba(220, 38, 38, 0.15);
  box-shadow:
    0 8px 40px rgba(0, 0, 0, 0.08),
    0 0 30px rgba(220, 38, 38, 0.03);
}

html[data-theme="light"] input,
html[data-theme="light"] select,
html[data-theme="light"] textarea,
html[data-theme="light"] .inp {
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid rgba(0, 0, 0, 0.1);
}

html[data-theme="light"] input:focus,
html[data-theme="light"] select:focus,
html[data-theme="light"] textarea:focus,
html[data-theme="light"] .inp:focus {
  border-color: var(--blue);
  box-shadow:
    0 0 0 3px rgba(220, 38, 38, 0.1),
    0 0 20px rgba(220, 38, 38, 0.05);
}

html[data-theme="light"] .skeleton {
  background: linear-gradient(
    90deg,
    var(--bg3) 0%,
    var(--bg4) 50%,
    var(--bg3) 100%
  );
  background-size: 200% 100%;
}

html[data-theme="light"] table.asg td {
  background: rgba(255, 255, 255, 0.8);
  border: 1px solid rgba(0, 0, 0, 0.04);
}

html[data-theme="light"] table.asg tr:hover td {
  background: rgba(220, 38, 38, 0.03);
}


html[data-theme="light"] .kpi .k {
  background: linear-gradient(
    135deg,
    rgba(255, 255, 255, 0.95) 0%,
    rgba(248, 250, 252, 0.98) 100%
  );
  border: 1px solid var(--brd);
}

html[data-theme="light"] .kpi .k .v {
  background: linear-gradient(135deg, var(--blue), var(--blue-h));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

html[data-theme="light"] .page-head h1 {
  background: linear-gradient(135deg, var(--t1) 0%, var(--blue) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

html[data-theme="light"] .toggle {
  background: rgba(0, 0, 0, 0.1);
  border-color: rgba(0, 0, 0, 0.1);
}

html[data-theme="light"] [data-tooltip]::after {
  background: var(--bg2);
  border: 1px solid var(--brd);
  color: var(--t1);
  box-shadow: var(--shadow-lg);
}

html[data-theme="light"] [data-tooltip]::before {
  border-top-color: var(--bg2);
}

/* ═══════════════════════════════════════════════════════════════════════════════
   NAVIGATION GROUPS — Business Viking 2026 Design System
   Группируемая навигация с раскрывающимися секциями
   ═══════════════════════════════════════════════════════════════════════════════ */

/* Sidebar header with toggle */
.sidebar-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px;
  margin-bottom: 8px;
  position: relative;
  z-index: 2;
}

/* [FIX] .sidebar-header .brand removed — layout.css controls icon-rail brand */

.sidebar-header .brand-text {
  overflow: hidden;
  transition: opacity var(--base), width var(--base);
}

.sidebar-toggle {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--r-sm);
  border: 1px solid var(--brd);
  background: var(--glass);
  color: var(--t3);
  cursor: pointer;
  transition: all var(--fast);
  flex-shrink: 0;
}

.sidebar-toggle:hover {
  border-color: var(--gold-border);
  background: var(--gold-glow);
  color: var(--gold);
}

.sidebar-toggle .toggle-icon {
  font-size: 12px;
  transition: transform var(--base);
}

/* Navigation group styles — moved to layout.css (F1 fix) */

.nav-group .navitem .ico {
  width: 32px;
  height: 32px;
}

.nav-group .navitem .ico img {
  width: 16px;
  height: 16px;
}

.nav-group .navitem .lbl .name {
  font-size: 12px;
}

.nav-group .navitem .lbl .desc {
  font-size: 10px;
}

/* ═══════════════════════════════════════════════════════════════════════════════
   SIDEBAR COLLAPSED STATE
   Свёрнутый режим сайдбара (только иконки)
   ═══════════════════════════════════════════════════════════════════════════════ */

/* Collapsed sidebar — grid defined in layout.css */

.app.sidebar-collapsed .sidenav {
  width: var(--sidebar-collapsed);
}

/* Hide text in collapsed mode */
.app.sidebar-collapsed .brand-text,
.app.sidebar-collapsed .nav-group-label,
.app.sidebar-collapsed .nav-group-count,
.app.sidebar-collapsed .nav-group-chevron,
.app.sidebar-collapsed .navitem .lbl,
.app.sidebar-collapsed .sidefoot .btn-text,
.app.sidebar-collapsed .pill .who,
.app.sidebar-collapsed .pill .role {
  display: none;
}

/* Adjust toggle icon */
.app.sidebar-collapsed .sidebar-toggle .toggle-icon {
  transform: rotate(180deg);
}

/* Adjust sidebar header */
.app.sidebar-collapsed .sidebar-header {
  flex-direction: column;
  gap: 8px;
  padding: 12px 8px;
}

.app.sidebar-collapsed .sidebar-header .brand {
  padding: 8px;
}

.app.sidebar-collapsed .sidebar-header .brand img {
  width: 40px;
  height: 40px;
}

/* Collapsed mode — компактные группы */
.app.sidebar-collapsed .nav-group {
  margin-bottom: 0;
}

.app.sidebar-collapsed .nav-group-header {
  justify-content: center;
  padding: 8px 0;
}

/* [FIX] .nav-group-items display:none removed — flyout works via hover in icon rail */

.app.sidebar-collapsed .nav-group-icon {
  font-size: 20px;
}

/* Adjust navitems */
.app.sidebar-collapsed .navitem {
  justify-content: center;
  padding: 10px 8px;
}

.app.sidebar-collapsed .navitem .ico {
  width: 36px;
  height: 36px;
}

/* Footer adjustments */
.app.sidebar-collapsed .sidefoot {
  padding: 12px 8px;
}

.app.sidebar-collapsed .sidefoot .btn {
  padding: 10px;
  justify-content: center;
}

.app.sidebar-collapsed .sidefoot .btn-icon {
  font-size: 18px;
}

.app.sidebar-collapsed .pill {
  padding: 8px;
  justify-content: center;
}

/* Tooltip on hover in collapsed mode */
.app.sidebar-collapsed .nav-group-header,
.app.sidebar-collapsed .navitem {
  position: relative;
}

.app.sidebar-collapsed .nav-group-header::after,
.app.sidebar-collapsed .navitem::after {
  content: attr(title);
  position: absolute;
  left: 100%;
  top: 50%;
  transform: translateY(-50%);
  padding: 8px 12px;
  margin-left: 8px;
  border-radius: var(--r-sm);
  background: var(--bg4);
  border: 1px solid var(--brd);
  box-shadow: var(--shadow-md);
  font-size: 12px;
  font-weight: 500;
  color: var(--t1);
  white-space: nowrap;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: all var(--fast);
  z-index: var(--z-dropdown);
}

.app.sidebar-collapsed .nav-group-header:hover::after,
.app.sidebar-collapsed .navitem:hover::after {
  opacity: 1;
  visibility: visible;
}

/* Grid update for collapsed sidebar — handled by layout.css */

/* ═══════════════════════════════════════════════════════════════════════════════
   LIGHT THEME — Navigation Groups
   ═══════════════════════════════════════════════════════════════════════════════ */

html[data-theme="light"] .nav-group-header {
  color: var(--t2);
}

html[data-theme="light"] .nav-group-header:hover {
  background: rgba(220, 38, 38, 0.08);
  color: var(--t1);
}

html[data-theme="light"] .nav-group.expanded .nav-group-header {
  color: var(--blue);
}

html[data-theme="light"] .nav-group-count {
  background: var(--bg3);
  border-color: rgba(0, 0, 0, 0.1);
  color: var(--t2);
}

html[data-theme="light"] .nav-group.expanded .nav-group-count {
  background: rgba(220, 38, 38, 0.1);
  border-color: rgba(220, 38, 38, 0.2);
  color: var(--blue);
}

html[data-theme="light"] .sidebar-toggle {
  background: var(--bg2);
  border-color: rgba(0, 0, 0, 0.1);
  color: var(--t2);
}

html[data-theme="light"] .sidebar-toggle:hover {
  background: rgba(220, 38, 38, 0.1);
  border-color: rgba(220, 38, 38, 0.2);
  color: var(--blue);
}

html[data-theme="light"] .app.sidebar-collapsed .nav-group-header::after,
html[data-theme="light"] .app.sidebar-collapsed .navitem::after {
  background: var(--bg2);
  border-color: rgba(0, 0, 0, 0.1);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  color: var(--t1);
}

/* ─────────────────────────────────────────────────────────────────────────────
   BUG-7: Overflow fixes
   ───────────────────────────────────────────────────────────────────────────── */
.card { min-width: 0; }
td, th { word-break: break-word; }
.main, .asg-main-wrap { overflow-x: hidden; }

/* ─────────────────────────────────────────────────────────────────────────────
   BUG-8: Mobile modal adaptation
   ───────────────────────────────────────────────────────────────────────────── */
@media (max-width: 768px) {
  .modalback, .modal-overlay { padding: 0; align-items: flex-end; }
  .modal, .modal-content {
    width: 100% !important; max-width: 100% !important;
    max-height: 92vh !important;
    border-radius: 20px 20px 0 0 !important;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    margin: 0 !important;
    animation: m-slide-up 0.3s ease-out !important;
  }
  @keyframes m-slide-up {
    from { transform: translateY(100%); opacity: 0.5; }
    to { transform: translateY(0); opacity: 1; }
  }
  .modal::before, .modal-content::before {
    content: '' !important;
    display: block !important;
    width: 40px !important;
    height: 4px !important;
    background: rgba(255,255,255,0.2) !important;
    border-radius: 2px !important;
    margin: 10px auto 6px !important;
    position: static !important;
    flex-shrink: 0;
  }
  .tasks-page { grid-template-columns: 1fr !important; }
}

/* ═══════════════════════════════════════════════════════════════════════════════
   LIGHT THEME — Modals & Forms (unified)
   ═══════════════════════════════════════════════════════════════════════════════ */

/* Modal overlay */
html[data-theme="light"] .modalback,
html[data-theme="light"] .modal-overlay {
  background: rgba(0, 0, 0, 0.3);
  backdrop-filter: blur(8px);
}

/* Modal box */
html[data-theme="light"] .modal,
html[data-theme="light"] .modal-content {
  background: var(--bg2);
  border: 1px solid var(--brd);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.12);
}

/* Modal header */
html[data-theme="light"] .mh,
html[data-theme="light"] .modal-header {
  background: linear-gradient(135deg, rgba(220, 38, 38, 0.04), rgba(37, 99, 235, 0.03));
  border-bottom: 1px solid var(--brd);
}

html[data-theme="light"] .mh .h,
html[data-theme="light"] .mh .ttl,
html[data-theme="light"] .modal-header h2,
html[data-theme="light"] .modal-header h3 {
  color: var(--t1);
}

/* Modal body */
html[data-theme="light"] .mc,
html[data-theme="light"] .modal-body {
  color: var(--t1);
}

/* Modal footer */
html[data-theme="light"] .mf,
html[data-theme="light"] .modal-footer {
  background: var(--bg3);
  border-top: 1px solid var(--brd);
}

/* Form inputs */
html[data-theme="light"] .inp,
html[data-theme="light"] .modal input,
html[data-theme="light"] .modal select,
html[data-theme="light"] .modal textarea,
html[data-theme="light"] .modal-content input,
html[data-theme="light"] .modal-content select,
html[data-theme="light"] .modal-content textarea,
html[data-theme="light"] .formrow input,
html[data-theme="light"] .formrow select,
html[data-theme="light"] .formrow textarea {
  background: var(--bg3);
  border: 1px solid rgba(0, 0, 0, 0.12);
  color: var(--t1);
}

html[data-theme="light"] .inp:focus,
html[data-theme="light"] .modal input:focus,
html[data-theme="light"] .modal select:focus,
html[data-theme="light"] .modal-content input:focus,
html[data-theme="light"] .modal-content select:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.1);
}

html[data-theme="light"] .inp::placeholder,
html[data-theme="light"] input::placeholder {
  color: var(--t3);
}

/* Form labels */
html[data-theme="light"] .formrow label,
html[data-theme="light"] label {
  color: var(--t2);
}

/* Badges in light theme — semi-transparent */
html[data-theme="light"] .badge[style*="background"] {
  border-radius: 999px !important;
}

/* ═══════════════════════════════════════════════════════════════════════════════
   COMMAND PALETTE (Ctrl+K) — Spotlight-style search
   ═══════════════════════════════════════════════════════════════════════════════ */
.search-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  z-index: var(--z-modal);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: 15vh;
  animation: cp-fade-in 150ms ease;
}

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

.search-modal {
  width: min(600px, 90vw);
  background: var(--bg2);
  border: 1px solid var(--brd);
  border-radius: 6px;
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.5);
  overflow: hidden;
  animation: search-slide-in 200ms ease;
}

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

.search-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--brd);
}

.search-input-wrap {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 8px;
}

.search-icon {
  font-size: 18px;
  color: var(--t3);
  flex-shrink: 0;
}

.search-input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  font-size: 16px;
  font-family: var(--ff);
  color: var(--t1);
  padding: 4px 0;
}

.search-input::placeholder {
  color: var(--t3);
}

.search-type {
  padding: 4px 8px;
  border-radius: 6px;
  border: 1px solid var(--brd);
  background: var(--bg3);
  color: var(--t2);
  font-size: 12px;
  font-family: var(--ff);
}

.search-results {
  max-height: 50vh;
  overflow-y: auto;
  padding: 8px;
}

.search-section {
  margin-bottom: 8px;
}

.search-section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--t3);
  padding: 6px 12px;
}

.search-result-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-radius: 6px;
  cursor: pointer;
  transition: background var(--fast);
}

.search-result-item:hover,
.search-result-item.selected {
  background: var(--gold-glow);
}

.search-result-icon {
  font-size: 16px;
  flex-shrink: 0;
  width: 24px;
  text-align: center;
}

.search-result-content { flex: 1; min-width: 0; }

.search-result-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--t1);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.search-result-title mark {
  background: var(--gold-glow);
  color: var(--gold);
  border-radius: 2px;
  padding: 0 2px;
}

.search-result-subtitle {
  font-size: 11px;
  color: var(--t3);
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.search-empty {
  text-align: center;
  padding: 32px 16px;
  color: var(--t3);
  font-size: 13px;
}

.search-footer {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 8px 16px;
  border-top: 1px solid var(--brd);
  font-size: 11px;
  color: var(--t3);
}

.search-footer kbd {
  display: inline-block;
  padding: 2px 6px;
  border-radius: 4px;
  border: 1px solid var(--brd);
  background: var(--bg3);
  font-size: 10px;
  font-family: var(--ff-mono);
  color: var(--t2);
}

.search-more {
  text-align: center;
  padding: 4px;
  font-size: 11px;
  color: var(--gold);
  cursor: pointer;
}

/* Light theme — Command Palette */
html[data-theme="light"] .search-overlay {
  background: rgba(0, 0, 0, 0.3);
}

html[data-theme="light"] .search-modal {
  background: var(--bg2);
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.15);
}

/* ═══════════════════════════════════════════════════════════════════════════════
   LIGHT THEME — FLYOUT NAVIGATION
   ═══════════════════════════════════════════════════════════════════════════════ */
html[data-theme="light"] .nav-group-items {
  background: var(--bg2);
  border-color: var(--brd);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.12);
}

html[data-theme="light"] .nav-group .navitem:hover {
  background: var(--bg4);
}

html[data-theme="light"] .nav-group .navitem.active {
  background: rgba(220, 38, 38, 0.06);
  border-color: rgba(220, 38, 38, 0.15);
}

html[data-theme="light"] .nav-group.has-active > .nav-group-header {
  background: rgba(220, 38, 38, 0.06);
  border-color: rgba(220, 38, 38, 0.15);
  color: var(--blue);
}

html[data-theme="light"] .nav-group.has-active > .nav-group-header::after {
  background: var(--blue);
}

html[data-theme="light"] .sidenav {
  background: var(--bg2);
  border-right-color: var(--brd);
}

html[data-theme="light"] .sidebar-search-btn:hover {
  background: rgba(220, 38, 38, 0.06);
  border-color: rgba(220, 38, 38, 0.15);
  color: var(--blue);
}
/* ═══════════════════════════════════════════════════════════════════════════════
   MOBILE FAB — Floating Action Button
   Shows on mobile for quick create actions
   ═══════════════════════════════════════════════════════════════════════════════ */
.fab,
.fab-menu {
  display: none;
}

@media (max-width: 768px) {
  .fab {
    display: flex;
    position: fixed;
    right: 16px;
    bottom: 80px;
    width: 52px;
    height: 52px;
    border-radius: 50%;
    background: var(--accent, var(--blue));
    color: white;
    border: none;
    box-shadow: 0 4px 16px rgba(198, 40, 40, 0.4);
    align-items: center;
    justify-content: center;
    font-size: 24px;
    cursor: pointer;
    z-index: 200;
    transition: transform var(--fast), box-shadow var(--fast);
  }

  .fab:active {
    transform: scale(0.9);
  }

  /* FAB menu (expands upward) */
  .fab-menu {
    position: fixed;
    right: 16px;
    bottom: 140px;
    display: flex;
    flex-direction: column-reverse;
    gap: 8px;
    z-index: 199;
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px);
    transition: all var(--base) ease;
  }

  .fab-menu.open {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
  }

  .fab-menu-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 14px;
    border-radius: 6px;
    background: var(--bg2);
    border: 1px solid var(--brd);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    font-size: 13px;
    font-weight: 600;
    color: var(--t1);
    text-decoration: none;
    white-space: nowrap;
    cursor: pointer;
  }

  .fab-menu-item:hover {
    border-color: var(--gold-border);
  }

  .fab-menu-item .fab-icon {
    font-size: 16px;
  }

  /* Light theme */
  html[data-theme="light"] .fab {
    background: var(--accent, var(--red));
    box-shadow: 0 4px 16px rgba(220, 38, 38, 0.3);
  }

  html[data-theme="light"] .fab-menu-item {
    background: var(--bg2);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
  }
}

/* ═══════════════════════════════════════════════════════════════════════════════
   OBJECT MAP PAGE
   ═══════════════════════════════════════════════════════════════════════════════ */
.map-page {
  display: flex;
  flex-direction: column;
  height: calc(100vh - var(--topbar-h) - 32px);
  gap: 12px;
}

.map-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.map-filters {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}

.map-filter {
  padding: 6px 12px;
  font-size: 12px;
  border-radius: 6px;
  border: 1px solid var(--brd);
  transition: all var(--fast);
}

.map-filter.active {
  background: var(--gold-glow);
  border-color: var(--gold-border);
  color: var(--gold);
}

.map-actions {
  display: flex;
  gap: 8px;
}

.map-stats {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.stat-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  border-radius: 6px;
  background: var(--gold-glow);
  border: 1px solid var(--brd);
  font-size: 12px;
  color: var(--t2);
}

.stat-chip .stat-num { font-weight: 700; color: var(--t1); }
.stat-chip.green { background: rgba(34,197,94,0.1); border-color: rgba(34,197,94,0.25); }
.stat-chip.green .stat-num { color: var(--ok-t); }
.stat-chip.yellow { background: rgba(245,158,11,0.1); border-color: rgba(245,158,11,0.25); }
.stat-chip.yellow .stat-num { color: var(--warn); }
.stat-chip.red { background: rgba(239,68,68,0.1); border-color: rgba(239,68,68,0.25); }
.stat-chip.red .stat-num { color: var(--err-t); }

.map-container {
  flex: 1;
  min-height: 400px;
  border-radius: 6px;
  overflow: hidden;
  border: 1px solid var(--brd);
  position: relative;
}

/* ─── Site Drawer ─── */
.site-card {
  background: var(--bg3);
  border-radius: 6px;
  padding: 16px;
  margin-bottom: 16px;
  border: 1px solid var(--brd);
}

.site-card-status {
  font-size: 12px;
  font-weight: 600;
  margin-bottom: 6px;
}

.site-card-name {
  font-size: 18px;
  font-weight: 700;
  color: var(--t1);
}

.site-card-customer {
  font-size: 13px;
  color: var(--t2);
  margin-top: 4px;
}

.site-card-region,
.site-card-address {
  font-size: 12px;
  color: var(--t3);
  margin-top: 4px;
}

.site-summary {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-bottom: 20px;
}

.site-summary-item {
  text-align: center;
  padding: 10px 4px;
  border-radius: 6px;
  background: var(--bg3);
  border: 1px solid var(--brd);
}

.ssi-val {
  font-size: 18px;
  font-weight: 700;
  color: var(--gold);
}

.ssi-label {
  font-size: 10px;
  color: var(--t3);
  margin-top: 2px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

/* ─── Work card in drawer ─── */
.site-work-card {
  padding: 10px 12px;
  border-radius: 6px;
  border: 1px solid var(--brd);
  margin-bottom: 6px;
  transition: all var(--fast);
}

.site-work-card:hover {
  border-color: var(--gold-border);
  background: var(--gold-glow);
}

.swc-header {
  display: flex;
  align-items: center;
  gap: 8px;
}

.swc-icon { font-size: 16px; }

.swc-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--t1);
  flex: 1;
}

.swc-meta {
  display: flex;
  gap: 8px;
  margin-top: 4px;
  font-size: 12px;
  color: var(--t3);
}

.swc-money {
  font-weight: 600;
  color: var(--gold);
}

.swc-pm, .swc-dates {
  font-size: 11px;
  color: var(--t3);
  margin-top: 2px;
}

/* ─── Geocode warning ─── */
.site-geocode-warning {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-radius: 6px;
  background: rgba(239, 68, 68, 0.08);
  border: 1px solid rgba(239, 68, 68, 0.2);
  margin-bottom: 16px;
  font-size: 13px;
}

.site-geocode-warning span:first-child {
  font-size: 24px;
}

/* ─── List view ─── */
.site-list-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 6px;
  border: 1px solid transparent;
  transition: all var(--fast);
}

.site-list-item:hover {
  background: var(--gold-glow);
  border-color: var(--brd);
}

.sli-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

.sli-info { flex: 1; min-width: 0; }

.sli-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--t1);
}

.sli-meta {
  font-size: 11px;
  color: var(--t3);
  margin-top: 2px;
}

.sli-stats {
  display: flex;
  gap: 4px;
  flex-shrink: 0;
}

.sli-badge {
  padding: 2px 8px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 600;
  background: var(--gold-glow);
  color: var(--t2);
}

.sli-badge.green {
  background: rgba(34,197,94,0.12);
  color: var(--ok-t);
}

/* ─── Mobile ─── */
@media (max-width: 768px) {
  .map-page { height: calc(100vh - 60px - 60px - 68px) !important; padding-bottom: 0 !important; }
  .map-toolbar { flex-direction: column; align-items: stretch; }
  .map-filters { overflow-x: auto; flex-wrap: nowrap; }
  .site-summary { grid-template-columns: repeat(2, 1fr); }
  .map-container { height: calc(100vh - 130px - 68px) !important; min-height: 300px; }
}

/* ─── Light theme ─── */
html[data-theme="light"] .map-container {
  border-color: rgba(0,0,0,0.08);
}

html[data-theme="light"] .site-card {
  background: var(--bg3);
}

html[data-theme="light"] #yaMap {
  filter: none !important;
}

/* ─── Leaflet Map ─── */
.map-container { position: relative; width: 100%; height: calc(100vh - 200px); min-height: 400px; border-radius: 6px; overflow: hidden; }
#yaMap { width: 100%; height: 100%; z-index: 1; }
[data-theme="dark"] .leaflet-control-zoom a,
[data-theme="dark"] .leaflet-control-layers { background: var(--bg2); color: var(--t1); border-color: var(--brd); }
[data-theme="dark"] .marker-cluster div { background-color: rgba(59, 130, 246, 0.6); color: var(--bg2); }
[data-theme="dark"] .marker-cluster { background-color: rgba(59, 130, 246, 0.3); }
[data-theme="dark"] .leaflet-popup-content-wrapper,
[data-theme="dark"] .leaflet-popup-tip { background: var(--bg2); color: var(--t1); }

/* ═══════════════════════════════════════════════════════════════════════════════
   GLOBAL VISUAL POLISH — ASGARD CRM
   Viking-themed typography, unified spacing, status badges, modals, file inputs
   ═══════════════════════════════════════════════════════════════════════════════ */

/* ─── Viking Heading Font ─── */
h1, h2, h3, h4, h5, h6,
.page-header h1,
.page-title,
.mh .ttl,
.mh .h,
.modal-header h2,
.modal-header .title,
.modal-header h5,
.modal-header .modal-title,
.drawer-title,
.chart h3,
.panel h3 {
  font-family: var(--ff-head);
  letter-spacing: 0.01em;
}

.page-header h1,
h1 {
  font-family: var(--ff-head);
  font-size: var(--text-2xl);
  font-weight: 700;
  color: var(--t1);
  margin: 0 0 4px 0;
}

.page-header p,
.page-header .text-muted {
  font-size: var(--text-sm);
  color: var(--t3);
  margin: 0;
}

.page-header {
  margin-bottom: var(--sp-6);
}

/* ─── File Input Styling ─── */
input[type="file"] {
  display: block;
  width: 100%;
  padding: var(--sp-3) var(--sp-4);
  font-family: var(--ff);
  font-size: var(--text-sm);
  color: var(--t1);
  background: var(--bg2);
  border: 1px dashed var(--t3);
  border-radius: var(--r-md);
  cursor: pointer;
  transition: all var(--fast);
}

input[type="file"]:hover {
  border-color: var(--gold);
  background: var(--gold-glow);
}

input[type="file"]:focus {
  outline: none;
  border-color: var(--gold);
  box-shadow: 0 0 0 3px var(--gold-glow);
}

input[type="file"]::file-selector-button {
  padding: 6px 16px;
  margin-right: 12px;
  font-family: var(--ff);
  font-size: var(--text-sm);
  font-weight: var(--fw-semi);
  color: var(--bg0);
  background: var(--gradient-gold);
  border: none;
  border-radius: var(--r-sm);
  cursor: pointer;
  transition: all var(--fast);
}

input[type="file"]::file-selector-button:hover {
  filter: brightness(1.1);
}

/* ─── Cash & Cash-Admin Page Styles ─── */
.cash-page,
.cash-admin-page {
  padding: 0;
}

.cash-balance-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: var(--sp-4);
  margin-bottom: var(--sp-6);
}

.cash-balance-card {
  background: var(--bg2);
  border: none;
  border-radius: var(--r-lg);
  padding: var(--sp-5);
  text-align: center;
  position: relative;
  overflow: hidden;
  transition: all var(--fast);
}

.cash-balance-card:hover {
  box-shadow: var(--shadow-md);
}

.cash-balance-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
}

.cash-balance-card.info::before { background: var(--info); }
.cash-balance-card.warning::before { background: var(--warn-t); }
.cash-balance-card.success::before { background: var(--ok-t); }
.cash-balance-card.danger::before { background: var(--err-t); }
.cash-balance-card.secondary::before { background: var(--t3); }

.cash-balance-card .balance-value {
  font-family: var(--ff-head);
  font-size: var(--text-xl);
  font-weight: 700;
  color: var(--t1);
  margin-bottom: 4px;
}

.cash-balance-card .balance-label {
  font-size: var(--text-xs);
  color: var(--t3);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* Cash page tabs */
.cash-tabs {
  display: flex;
  gap: 4px;
  padding: 4px;
  background: var(--bg3);
  border-radius: var(--r-md);
  border: none;
  margin-bottom: var(--sp-6);
}

.cash-tab {
  flex: 1;
  padding: var(--sp-3) var(--sp-5);
  border-radius: var(--r-sm);
  border: none;
  background: transparent;
  color: var(--t2);
  font-family: var(--ff);
  font-size: var(--text-sm);
  font-weight: var(--fw-semi);
  cursor: pointer;
  transition: all var(--fast);
  white-space: nowrap;
  text-align: center;
}

.cash-tab:hover {
  color: var(--t1);
  background: var(--gold-glow);
}

.cash-tab.active {
  background: var(--gold-glow);
  color: var(--gold);
  box-shadow: var(--shadow-sm);
}

/* Cash page card wrapper */
.cash-card {
  background: var(--bg2);
  border: none;
  border-radius: var(--r-lg);
  overflow: hidden;
  margin-bottom: var(--sp-6);
}

.cash-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-4);
  padding: var(--sp-4) var(--sp-6);
  background: var(--bg3);
  border-bottom: none;
  flex-wrap: wrap;
}

.cash-card-header .card-title {
  font-family: var(--ff-head);
  font-size: var(--text-lg);
  font-weight: var(--fw-bold);
  color: var(--t1);
}

.cash-card-body {
  padding: 0;
}

/* Cash detail sections */
.cash-detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--sp-6);
  margin-bottom: var(--sp-6);
}

@media (max-width: 768px) {
  .cash-detail-grid {
    grid-template-columns: 1fr;
  }
}

.cash-detail-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.cash-detail-item .label {
  font-size: var(--text-xs);
  color: var(--t3);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.cash-detail-item .value {
  font-size: var(--text-base);
  color: var(--t1);
  font-weight: var(--fw-med);
}

/* Cash alert box */
.cash-alert {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-4);
  border-radius: var(--r-md);
  border: 1px solid;
  margin-bottom: var(--sp-4);
  font-size: var(--text-sm);
}

.cash-alert.info {
  background: var(--info-bg);
  border-color: var(--info-border);
  color: var(--info-text);
}

.cash-alert.warning {
  background: var(--warn-bg);
  border-color: var(--warn-t);
  color: var(--warn-t);
}

.cash-alert.success {
  background: var(--ok-bg);
  border-color: var(--ok-t);
  color: var(--ok-t);
}

.cash-alert.danger {
  background: var(--err-bg);
  border-color: var(--err-t);
  color: var(--err-t);
}

/* Cash actions bar */
.cash-actions {
  display: flex;
  gap: var(--sp-3);
  flex-wrap: wrap;
  margin-bottom: var(--sp-6);
}

/* Cash section title */
.cash-section-title {
  font-family: var(--ff-head);
  font-size: var(--text-base);
  font-weight: 700;
  color: var(--gold);
  margin: var(--sp-6) 0 var(--sp-3) 0;
  padding-bottom: var(--sp-2);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

/* Cash messages list */
.cash-messages {
  max-height: 200px;
  overflow-y: auto;
  padding: var(--sp-3);
  background: var(--bg2);
  border-radius: var(--r-md);
  border: 1px solid var(--brd);
  margin-bottom: var(--sp-4);
}

.cash-message {
  padding: var(--sp-2) 0;
  border-bottom: 1px solid var(--brd-m);
}

.cash-message:last-child {
  border-bottom: none;
}

.cash-message .meta {
  font-size: var(--text-xs);
  color: var(--t3);
  margin-bottom: 2px;
}

.cash-message .text {
  font-size: var(--text-sm);
  color: var(--t1);
}

/* Cash filter bar */
.cash-filter-bar {
  display: flex;
  gap: var(--sp-3);
  align-items: center;
  flex-wrap: wrap;
}

/* ─── Cash Cards Grid (new card view) ─── */
.cash-cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

/* Request card */
.cash-req-card {
  background: var(--bg2);
  border: 1px solid var(--brd);
  border-radius: var(--r-md);
  padding: 20px;
  cursor: pointer;
  transition: all var(--fast);
  position: relative;
  overflow: hidden;
}

.cash-req-card:hover {
  border-color: var(--t3);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.cash-req-card.rejected {
  border-color: rgba(239, 68, 68, 0.3);
  opacity: 0.8;
}

.cash-req-card.question {
  border-color: rgba(245, 158, 11, 0.4);
  box-shadow: 0 0 10px rgba(245, 158, 11, 0.08);
}

/* Card top row */
.cash-card-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 8px;
}

.cash-card-type {
  font-weight: 600;
  font-size: var(--text-sm);
}

.cash-card-date {
  font-size: var(--text-xs);
  color: var(--t3);
  white-space: nowrap;
}

.cash-card-project {
  font-size: var(--text-sm);
  color: var(--t2);
  margin-bottom: 8px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cash-card-amount {
  font-size: 22px;
  font-weight: 800;
  color: var(--t1);
  margin-bottom: 12px;
  font-family: var(--ff-head);
}

/* Rejected / Question banners on cards */
.cash-card-rejected {
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.25);
  border-radius: var(--r-sm);
  padding: 8px 12px;
  font-size: var(--text-sm);
  color: #fca5a5;
  margin-bottom: 8px;
}

.cash-card-question {
  background: rgba(245, 158, 11, 0.1);
  border: 1px solid rgba(245, 158, 11, 0.25);
  border-radius: var(--r-sm);
  padding: 8px 12px;
  font-size: var(--text-sm);
  color: #fcd34d;
  margin-bottom: 8px;
}

/* ─── Progress Steps ─── */
.cash-steps {
  display: flex;
  align-items: flex-start;
  gap: 0;
  margin-bottom: 12px;
  position: relative;
}

.cash-step {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative;
  z-index: 1;
}

/* Connecting line between steps */
.cash-step:not(:last-child)::after {
  content: '';
  position: absolute;
  top: 7px;
  left: calc(50% + 8px);
  width: calc(100% - 16px);
  height: 2px;
  background: var(--brd);
  z-index: 0;
}

.cash-step.done:not(:last-child)::after {
  background: var(--ok-t);
}

.cash-step.active:not(:last-child)::after {
  background: linear-gradient(90deg, var(--gold) 0%, var(--brd) 100%);
}

.cash-step-dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--bg4);
  border: 2px solid var(--brd);
  margin-bottom: 4px;
  position: relative;
  z-index: 2;
  transition: all var(--fast);
}

.cash-step.done .cash-step-dot {
  background: var(--ok-t);
  border-color: var(--ok-t);
  box-shadow: 0 0 6px rgba(34, 197, 94, 0.3);
}

.cash-step.active .cash-step-dot {
  background: var(--gold);
  border-color: var(--gold);
  box-shadow: 0 0 8px rgba(37, 99, 235, 0.4);
  animation: cash-step-pulse 2s ease-in-out infinite;
}

.cash-step.rejected .cash-step-dot {
  background: var(--red);
  border-color: var(--red);
  opacity: 0.5;
}

@keyframes cash-step-pulse {
  0%, 100% { box-shadow: 0 0 8px rgba(37, 99, 235, 0.4); }
  50% { box-shadow: 0 0 14px rgba(37, 99, 235, 0.6); }
}

.cash-step-label {
  font-size: 10px;
  color: var(--t3);
  text-align: center;
  line-height: 1.2;
  white-space: nowrap;
}

.cash-step.done .cash-step-label {
  color: var(--ok-t);
}

.cash-step.active .cash-step-label {
  color: var(--gold-l);
  font-weight: 600;
}

.cash-step.rejected .cash-step-label {
  color: var(--red);
  opacity: 0.6;
}

/* ─── Balance bar on cards ─── */
.cash-card-balance {
  margin-top: 8px;
}

.cash-card-balance-bar {
  width: 100%;
  height: 6px;
  background: rgba(255, 255, 255, 0.06);
  border-radius: 3px;
  overflow: hidden;
  margin-bottom: 4px;
}

.cash-card-balance-fill {
  height: 100%;
  background: var(--grad-corp);
  border-radius: 3px;
  transition: width var(--slow) ease;
}

.cash-card-balance-info {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: var(--t3);
}

/* ─── Quick actions on cards ─── */
.cash-card-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--brd);
}

/* ─── Category badges ─── */
.cash-cat-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  background: var(--bg4);
  border: 1px solid var(--brd);
  border-radius: 20px;
  font-size: 12px;
  color: var(--t2);
  white-space: nowrap;
}

.cash-cat-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
}

/* ─── Mobile responsive for cash cards ─── */
@media (max-width: 768px) {
  .cash-cards-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .cash-req-card {
    padding: 16px;
  }

  .cash-card-amount {
    font-size: 20px;
  }

  .cash-step-label {
    font-size: 9px;
  }

  .cash-step-dot {
    width: 12px;
    height: 12px;
  }

  .cash-step:not(:last-child)::after {
    top: 6px;
    left: calc(50% + 6px);
    width: calc(100% - 12px);
  }
}

/* ─── KPI Works Page ─── */
.kpi-works-page .panel {
  padding: var(--sp-4);
}

.kpi-works-page .help {
  font-size: var(--text-xs);
  color: var(--t3);
  margin-bottom: var(--sp-3);
  font-style: italic;
}

.kpi-works-page .hr {
  border: none;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  margin: var(--sp-6) 0;
}

.kpi-works-page .tools {
  display: flex;
  gap: var(--sp-4);
  align-items: flex-end;
  flex-wrap: wrap;
  margin-bottom: var(--sp-4);
}

.kpi-works-page .tools .field {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.kpi-works-page .tools .field label {
  font-size: var(--text-xs);
  color: var(--t3);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.kpi-works-page .tools select {
  padding: 8px 12px;
  background: var(--bg2);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--r-sm);
  color: var(--t1);
  font-family: var(--ff);
  font-size: var(--text-sm);
  min-width: 150px;
}

.kpi-works-page .tools select:focus {
  outline: none;
  border-color: var(--gold);
  box-shadow: 0 0 0 3px var(--gold-glow);
}

.kpi-works-page .kpi {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: var(--sp-4);
  margin-bottom: var(--sp-6);
}

.kpi-works-page .kpi .k {
  background: var(--bg2);
  border: none;
  border-radius: var(--r-md);
  padding: var(--sp-4);
  text-align: center;
  transition: all var(--fast);
}

.kpi-works-page .kpi .k:hover {
  box-shadow: var(--gold-glow);
}

.kpi-works-page .kpi .k .t {
  font-size: var(--text-xs);
  color: var(--t3);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 4px;
}

.kpi-works-page .kpi .k .v {
  font-family: var(--ff-head);
  font-size: var(--text-xl);
  font-weight: 700;
  color: var(--gold);
  margin-bottom: 2px;
}

.kpi-works-page .kpi .k .s {
  font-size: 10px;
  color: var(--t3);
}

.kpi-works-page .chart {
  background: var(--bg2);
  border: none;
  border-radius: var(--r-lg);
  padding: var(--sp-6);
  margin-bottom: var(--sp-6);
}

.kpi-works-page .chart h3 {
  font-family: var(--ff-head);
  font-size: var(--text-lg);
  font-weight: 700;
  color: var(--t1);
  margin: 0 0 var(--sp-2) 0;
}

.kpi-works-page .pill {
  background: var(--bg2);
  border: none;
  border-radius: var(--r-md);
  transition: all var(--fast);
}

.kpi-works-page .pill:hover {
  box-shadow: var(--shadow-sm);
}

.kpi-works-page .pill .who b {
  font-family: var(--ff-head);
  color: var(--t1);
}

/* ─── Unified Status Badges (for pages using inline styles) ─── */
.status-unified {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  line-height: 1.3;
  white-space: nowrap;
}

.status-unified.warning {
  background: var(--warn-bg);
  color: var(--warn-t);
  border: 1px solid var(--warn-t);
}

.status-unified.success {
  background: var(--ok-bg);
  color: var(--ok-t);
  border: 1px solid var(--ok-t);
}

.status-unified.info {
  background: var(--info-bg);
  color: var(--info-text);
  border: 1px solid var(--info-border);
}

.status-unified.danger {
  background: var(--err-bg);
  color: var(--err-t);
  border: 1px solid var(--err-t);
}

.status-unified.secondary {
  background: rgba(100, 116, 139, 0.12);
  color: var(--t3);
  border: 1px solid rgba(100, 116, 139, 0.25);
}

/* ─── Modal form styling (for modals generated by JS pages) ─── */
.asg-form-group {
  margin-bottom: var(--sp-4);
}

.asg-form-group label {
  display: block;
  font-size: var(--text-xs);
  font-weight: var(--fw-semi);
  color: var(--t3);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 6px;
}

.asg-form-group input,
.asg-form-group select,
.asg-form-group textarea {
  width: 100%;
  padding: 10px 14px;
  background: var(--bg3);
  border: 1px solid var(--brd);
  border-radius: var(--r-md);
  color: var(--t1);
  font-family: var(--ff);
  font-size: var(--text-sm);
  transition: all var(--fast);
}

.asg-form-group input:focus,
.asg-form-group select:focus,
.asg-form-group textarea:focus {
  outline: none;
  border-color: var(--gold);
  box-shadow: 0 0 0 3px var(--gold-glow);
}

.asg-form-group textarea {
  resize: vertical;
  min-height: 60px;
}

.asg-form-actions {
  display: flex;
  gap: var(--sp-3);
  justify-content: flex-end;
  padding-top: var(--sp-4);
  border-top: 1px solid var(--brd);
  margin-top: var(--sp-4);
}

/* ─── Modal styling enhancements ─── */
.mh .h {
  font-family: var(--ff-head);
  font-size: var(--text-lg);
  font-weight: 700;
  color: var(--gold);
}

/* ─── Light theme overrides for cash & kpi ─── */
html[data-theme="light"] .cash-balance-card {
  background: var(--bg2);
  border-color: rgba(0,0,0,0.08);
}

html[data-theme="light"] .cash-card {
  background: var(--bg2);
  border-color: rgba(0,0,0,0.08);
}

html[data-theme="light"] .cash-card-header {
  background: var(--bg3);
}

html[data-theme="light"] .kpi-works-page .kpi .k {
  background: var(--bg2);
  border-color: rgba(0,0,0,0.08);
}

html[data-theme="light"] .kpi-works-page .chart {
  background: var(--bg2);
  border-color: rgba(0,0,0,0.08);
}

html[data-theme="light"] .kpi-works-page .pill {
  background: var(--bg2);
  border-color: rgba(0,0,0,0.08);
}

html[data-theme="light"] .kpi-works-page .kpi .k .v {
  color: var(--gold-h);
}

html[data-theme="light"] input[type="file"] {
  background: var(--bg3);
  border-color: rgba(0,0,0,0.15);
}

html[data-theme="light"] input[type="file"]:hover {
  background: rgba(184, 154, 48, 0.06);
}

html[data-theme="light"] .cash-messages {
  background: var(--bg3);
}

html[data-theme="light"] .cash-req-card {
  background: var(--bg2);
  border-color: rgba(0,0,0,0.1);
}

html[data-theme="light"] .cash-req-card:hover {
  border-color: rgba(0,0,0,0.2);
  box-shadow: 0 4px 16px rgba(0,0,0,0.08);
}

html[data-theme="light"] .cash-req-card.rejected {
  border-color: rgba(239, 68, 68, 0.25);
}

html[data-theme="light"] .cash-req-card.question {
  border-color: rgba(245, 158, 11, 0.3);
}

html[data-theme="light"] .cash-card-rejected {
  background: rgba(239, 68, 68, 0.06);
  color: var(--red);
}

html[data-theme="light"] .cash-card-question {
  background: rgba(245, 158, 11, 0.06);
  color: var(--warn);
}

html[data-theme="light"] .cash-step-dot {
  background: var(--bg4);
  border-color: var(--brd);
}

html[data-theme="light"] .cash-card-balance-bar {
  background: rgba(0, 0, 0, 0.06);
}

html[data-theme="light"] .cash-cat-badge {
  background: var(--bg4);
  border-color: var(--bg5);
  color: var(--t2);
}

html[data-theme="light"] .status-unified.secondary {
  background: rgba(100, 116, 139, 0.08);
  color: var(--t2);
}

/* ═══════════════════════════════════════════════════════════════════════════════
   BOOTSTRAP-COMPATIBILITY CLASSES
   For pages still using Bootstrap class names (cards, modals, tables, alerts)
   ═══════════════════════════════════════════════════════════════════════════════ */

/* Cards */
.card {
  background: var(--bg2);
  border: none;
  border-radius: var(--r-lg);
  overflow: hidden;
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-3);
  padding: var(--sp-4) var(--sp-5);
  background: transparent;
  border-bottom: none;
  font-family: var(--ff-head);
  font-weight: var(--fw-bold);
  color: var(--t1);
}

.card-body {
  padding: var(--sp-4) var(--sp-5);
}

.card-body.p-0 {
  padding: 0;
}

.card-footer {
  padding: var(--sp-3) var(--sp-5);
  border-top: none;
  background: transparent;
}

/* Alerts */
.alert {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-3) var(--sp-4);
  border-radius: var(--r-md);
  border: 1px solid;
  font-size: var(--text-sm);
  margin-bottom: var(--sp-4);
}

.alert-info {
  background: var(--info-bg);
  border-color: var(--info-border);
  color: var(--info-text);
}

.alert-warning {
  background: var(--warn-bg);
  border-color: var(--warn-t);
  color: var(--warn-t);
}

.alert-success {
  background: var(--ok-bg);
  border-color: var(--ok-t);
  color: var(--ok-t);
}

.alert-danger {
  background: var(--err-bg);
  border-color: var(--err-t);
  color: var(--err-t);
}

/* Bootstrap-style form controls */
.form-control,
.form-select {
  width: 100%;
  padding: 10px 14px;
  background: var(--bg3);
  border: 1px solid var(--brd);
  border-radius: var(--r-md);
  color: var(--t1);
  font-family: var(--ff);
  font-size: var(--text-sm);
  transition: all var(--fast);
}

.form-control:focus,
.form-select:focus {
  outline: none;
  border-color: var(--gold);
  box-shadow: 0 0 0 3px var(--gold-glow);
}

.form-label {
  display: block;
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--t3);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 6px;
}

/* Bootstrap grid basics */
.row { display: flex; flex-wrap: wrap; margin: 0 -8px; }
.row > [class*="col-"] { padding: 0 8px; }
.col-md-3 { flex: 0 0 25%; max-width: 25%; }
.col-md-4 { flex: 0 0 33.333%; max-width: 33.333%; }
.col-md-6 { flex: 0 0 50%; max-width: 50%; }
.col-md-12 { flex: 0 0 100%; max-width: 100%; }

@media (max-width: 768px) {
  .col-md-3, .col-md-4, .col-md-6 { flex: 0 0 100%; max-width: 100%; }
}

/* Spacing */
.mb-3 { margin-bottom: 12px; }
.mb-4 { margin-bottom: 16px; }
.p-0 { padding: 0; }
.p-2 { padding: 8px; }
.p-4 { padding: 16px; }
.g-3 { gap: 12px; }
.me-2 { margin-right: 8px; }

/* Display utilities */
.d-flex { display: flex; }
.justify-content-between { justify-content: space-between; }
.align-items-center { align-items: center; }

/* Table */
.table {
  width: 100%;
  border-collapse: collapse;
  color: var(--t1);
}

.table th {
  padding: 10px 12px;
  text-align: left;
  font-size: var(--text-xs);
  font-weight: 700;
  color: var(--t3);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  background: var(--bg3);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.table td {
  padding: 10px 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  font-size: var(--text-sm);
}

.table-hover tbody tr:hover {
  background: var(--gold-glow);
}

.table-responsive {
  overflow-x: auto;
}

.table-sm th, .table-sm td {
  padding: 6px 8px;
}

/* Buttons */
.btn-primary {
  background: var(--blue);
  color: white;
  border: none;
  padding: 8px 16px;
  border-radius: var(--r-sm);
  font-family: var(--ff);
  font-size: var(--text-sm);
  font-weight: 600;
  cursor: pointer;
}

.btn-secondary {
  background: var(--gold);
  color: white;
  border: none;
  padding: 8px 16px;
  border-radius: var(--r-sm);
  font-family: var(--ff);
  font-size: var(--text-sm);
  font-weight: 600;
  cursor: pointer;
}

.btn-success {
  background: var(--ok-t);
  color: white;
  border: none;
  padding: 8px 16px;
  border-radius: var(--r-sm);
  font-family: var(--ff);
  font-size: var(--text-sm);
  font-weight: 600;
  cursor: pointer;
}

.btn-danger {
  background: var(--err-t);
  color: white;
  border: none;
  padding: 8px 16px;
  border-radius: var(--r-sm);
  font-family: var(--ff);
  font-size: var(--text-sm);
  font-weight: 600;
  cursor: pointer;
}

.btn-info {
  background: var(--info);
  color: white;
  border: none;
  padding: 8px 16px;
  border-radius: var(--r-sm);
  font-family: var(--ff);
  font-size: var(--text-sm);
  font-weight: 600;
  cursor: pointer;
}

.btn-warning {
  background: var(--warn-t);
  color: var(--bg0);
  border: none;
  padding: 8px 16px;
  border-radius: var(--r-sm);
  font-family: var(--ff);
  font-size: var(--text-sm);
  font-weight: 600;
  cursor: pointer;
}

.btn-outline-primary {
  background: transparent;
  color: var(--blue);
  border: 1px solid var(--blue);
  padding: 6px 12px;
  border-radius: var(--r-sm);
  font-family: var(--ff);
  font-size: var(--text-sm);
  font-weight: 600;
  cursor: pointer;
  transition: all var(--fast);
}

.btn-outline-primary:hover {
  background: var(--blue);
  color: white;
}

.btn-outline-danger {
  background: transparent;
  color: var(--err-t);
  border: 1px solid var(--err-t);
  padding: 6px 12px;
  border-radius: var(--r-sm);
  font-family: var(--ff);
  font-size: var(--text-sm);
  font-weight: 600;
  cursor: pointer;
  transition: all var(--fast);
}

.btn-outline-danger:hover {
  background: var(--err-t);
  color: white;
}

.btn-sm {
  padding: 4px 10px;
  font-size: 12px;
}

.btn-close {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--r-sm);
  border: 1px solid var(--brd);
  background: transparent;
  color: var(--t3);
  cursor: pointer;
  font-size: 14px;
}

.btn-close:hover {
  border-color: var(--err-t);
  color: var(--err-t);
  background: var(--err-bg);
}

/* Text utilities */
.text-center { text-align: center; }
.text-muted { color: var(--t3); }
.text-danger { color: var(--err-t); }
.text-success { color: var(--ok-t); }
.text-white { color: var(--t1); }
.text-dark { color: var(--t1); }

/* Light theme overrides for Bootstrap compat */
html[data-theme="light"] .card {
  background: var(--bg2);
  border-color: rgba(0,0,0,0.08);
}

html[data-theme="light"] .card-header {
  background: var(--bg3);
}

html[data-theme="light"] .form-control,
html[data-theme="light"] .form-select {
  background: var(--bg2);
  border-color: rgba(0,0,0,0.15);
}

/* ═══════════════════════════════════════════════════════════════════════════════
   GLOBAL VISUAL POLISH — убираем рамки, смягчаем фоны
   Этот блок в конце файла перекрывает все предыдущие border-правила
   ═══════════════════════════════════════════════════════════════════════════════ */

/* --- Карточки, панели, виджеты — без рамок --- */
.card, .panel, .widget,
[class*="-card"],
.cash-card, .cash-balance-card, .cash-tabs,
.kpi-works-page .kpi .k,
.kpi-works-page .chart,
.kpi-works-page .pill,
.kpi-works-page .panel {
  border: none;
}

/* --- Заголовки карточек — мягче фон, без нижней рамки --- */
.card-header,
.cash-card-header,
.mh,
.modal-header {
  border-bottom: none;
}

/* --- Подвалы карточек — без верхней рамки --- */
.card-footer {
  border-top: none;
}

/* --- Таблицы — ячейки без рамок, тонкий разделитель --- */
table.asg td,
table td,
.tbl td,
.table td {
  border-bottom: 1px solid var(--brd-m);
}

table.asg th,
table th,
.tbl th,
.table th {
  border-bottom: 1px solid var(--brd);
}

/* --- Обёртки таблиц — без внешних рамок --- */
.table-wrap,
.tablewrap {
  border: none;
}

/* --- Секции кассы --- */
.cash-section-title {
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

/* --- Модальные окна — без рамок --- */
.modal,
.modal-content {
  border: none;
}

/* --- Формы — разделитель действий мягче --- */
.asg-form-actions {
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}

/* --- KPI карточки на всех страницах --- */
.kpi .k {
  border: none;
}

/* --- Разделители .hr --- */
.kpi-works-page .hr {
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}

/* --- Селекты/инпуты в фильтрах --- */
.kpi-works-page .tools select {
  border-color: rgba(255, 255, 255, 0.08);
}

/* --- Горизонтальные линии --- */
hr, .divider {
  border-color: rgba(255, 255, 255, 0.06);
}

/* --- Light-тема: вернуть видимые но мягкие рамки --- */
html[data-theme="light"] .card,
html[data-theme="light"] .panel,
html[data-theme="light"] [class*="-card"],
html[data-theme="light"] .cash-card,
html[data-theme="light"] .cash-balance-card {
  border: 1px solid var(--brd);
}

html[data-theme="light"] table td,
html[data-theme="light"] table.asg td,
html[data-theme="light"] .tbl td,
html[data-theme="light"] .table td {
  border-bottom: 1px solid var(--brd);
}

html[data-theme="light"] .modal,
html[data-theme="light"] .modal-content {
  border: 1px solid var(--brd);
}

/* ═══════════════════════════════════════════════════════════════════════════════
   NUCLEAR OVERRIDES — !important для гарантии отсутствия рамок/матрёшек
   Этот блок в самом конце файла перебивает ВСЕ inline-стили
   ═══════════════════════════════════════════════════════════════════════════════ */

/* --- Все карточки, панели, KPI — без рамок (перебиваем inline style) --- */
.card,
.panel,
.kpi .k,
.kpi-card,
.chart,
.pill,
.pm-card,
.se-card,
.otp-card,
.payroll-card,
.payroll-kpi .k,
.task-card,
.stats-row > div,
.csec,
[class*="calc-tabs"] .tab {
  border: 1px solid rgba(212, 168, 67, 0.15) !important;
}

/* Исключения: кнопки, инпуты, alertы, director-comment сохраняют рамки */
.btn,
input,
select,
textarea,
.inp,
.cash-alert,
.payroll-director-comment,
.payroll-inline-input,
.status-unified {
  /* не перебиваем */
}

/* --- Единый шрифт по всей CRM --- */
body,
.card,
.panel,
.kpi .k,
.kpi-card,
.chart,
table,
th,
td,
div,
span,
p,
label,
button,
select,
h1, h2, h3, h4, h5, h6 {
  font-family: var(--ff);
}

/* --- Заголовки используют heading шрифт --- */
h1, h2, h3,
.card h3,
.panel h3,
.chart h3 {
  font-family: var(--ff-head);
}

/* --- Light тема: исключения для карточек --- */
html[data-theme="light"] .card,
html[data-theme="light"] .panel,
html[data-theme="light"] .kpi .k,
html[data-theme="light"] .kpi-card,
html[data-theme="light"] .chart {
  border: 1px solid var(--brd) !important;
}

/* ═══════════════════════════════════════════════════════════════════════════════
   UNIFIED VIKING THEME v3.0
   Единый стиль для ВСЕХ модулей CRM на основе модуля Касса.
   Цвета: Синий (#1E4D8C), Красный (#C8293B), Золотой (#D4A843) + градиенты
   ═══════════════════════════════════════════════════════════════════════════════ */

/* ─────────────────────────────────────────────────────────────────────────────
   1. ГЛОБАЛЬНЫЕ КАРТОЧКИ — Viking style (как в Кассе)
   Все .card, .panel — единый вид с золотой верхней полоской
   ───────────────────────────────────────────────────────────────────────────── */
.card,
.panel,
.widget,
.cash-card,
.cash-balance-card,
.cash-req-card,
.funnel-stat,
.funnel-column,
.birthday-month,
.stat-card,
.upcoming-event,
.sched-wrap,
[class*="kpi"] .k {
  background: var(--bg2) !important;
  border: 1px solid rgba(212, 168, 67, 0.15) !important;
  border-radius: var(--r-lg) !important;
  box-shadow: var(--shadow-sm) !important;
  position: relative;
  overflow: hidden;
  transition: all var(--base) !important;
}

/* Золотая верхняя полоска (как в Кассе) */
.card::before,
.panel::before,
.widget::before,
.stat-card::before,
.funnel-stat::before,
.birthday-month::before,
[class*="kpi"] .k::before {
  content: '' !important;
  position: absolute !important;
  top: 0 !important;
  left: 0 !important;
  right: 0 !important;
  height: 3px !important;
  background: var(--grad-gold) !important;
  opacity: 0.7 !important;
  z-index: 1 !important;
}

/* Hover эффект для всех карточек */
.card:hover,
.panel:hover,
.widget:hover,
.stat-card:hover,
.funnel-stat:hover,
.birthday-month:hover,
[class*="kpi"] .k:hover {
  box-shadow: var(--shadow-md), 0 0 20px rgba(212, 168, 67, 0.08) !important;
  transform: translateY(-2px);
}

/* ─────────────────────────────────────────────────────────────────────────────
   2. ЗАГОЛОВКИ СТРАНИЦ — Viking heading style
   ───────────────────────────────────────────────────────────────────────────── */
.page-title,
.title h1 {
  background: var(--grad-corp);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  font-weight: 800 !important;
  letter-spacing: 0.02em;
}

/* ─────────────────────────────────────────────────────────────────────────────
   3. SECTION TITLES — Золотой стиль (как .cash-section-title)
   ───────────────────────────────────────────────────────────────────────────── */
.card h3,
.panel h3,
.chart h3,
.section-title,
.form-section,
.cash-section-title,
.birthday-month-title,
.funnel-column-title,
.cal-title,
.sched-period {
  font-family: var(--ff-head) !important;
  font-weight: 700 !important;
  color: var(--gold) !important;
}

/* Subheaders */
.card-header .card-title,
.cash-card-header .card-title {
  font-family: var(--ff-head) !important;
  color: var(--t1) !important;
}

/* ─────────────────────────────────────────────────────────────────────────────
   4. CARD HEADERS — Viking gradient background (как в Кассе)
   ───────────────────────────────────────────────────────────────────────────── */
.card-header,
.cash-card-header,
.mh,
.modal-header,
.funnel-column-header {
  background: transparent !important;
  border-bottom: 1px solid rgba(212, 168, 67, 0.12) !important;
}

/* ─────────────────────────────────────────────────────────────────────────────
   5. КНОПКИ — Viking color scheme
   ───────────────────────────────────────────────────────────────────────────── */
.btn.primary {
  background: linear-gradient(135deg, var(--blue), var(--blue-h)) !important;
  border: 1px solid rgba(212, 168, 67, 0.15) !important;
  box-shadow: var(--blue-glow) !important;
}

.btn.primary:hover {
  background: linear-gradient(135deg, var(--blue-h), var(--blue)) !important;
  box-shadow: 0 0 24px rgba(30, 77, 140, 0.4) !important;
}

.btn.gold,
.btn.secondary.gold {
  background: var(--grad-gold) !important;
  border: 1px solid rgba(212, 168, 67, 0.15) !important;
  color: var(--bg0) !important;
  box-shadow: var(--gold-glow) !important;
}

.btn.red,
.btn.danger {
  background: linear-gradient(135deg, var(--red), var(--red-h)) !important;
  border: 1px solid rgba(212, 168, 67, 0.15) !important;
  box-shadow: var(--red-glow) !important;
}

/* ─────────────────────────────────────────────────────────────────────────────
   6. TABS — Viking gold accent (как .cash-tabs)
   ───────────────────────────────────────────────────────────────────────────── */
.tabs,
.cash-tabs {
  background: var(--bg3) !important;
  border: 1px solid rgba(212, 168, 67, 0.15) !important;
  border-radius: var(--r-md) !important;
  padding: 4px !important;
}

.tab.active,
.tab-btn.active,
.cash-tab.active {
  background: linear-gradient(135deg, rgba(30, 77, 140, 0.15), rgba(200, 41, 59, 0.08)) !important;
  color: var(--gold) !important;
  box-shadow: var(--shadow-sm) !important;
  border: 1px solid rgba(212, 168, 67, 0.15) !important;
}

.tab.active::after,
.tab-btn.active::after {
  background: var(--grad-corp) !important;
}

.tab:hover,
.tab-btn:hover,
.cash-tab:hover {
  background: rgba(212, 168, 67, 0.06) !important;
  color: var(--t1) !important;
}

/* ─────────────────────────────────────────────────────────────────────────────
   7. ТАБЛИЦЫ — Viking clean style
   ───────────────────────────────────────────────────────────────────────────── */
table th,
.tbl th,
table.asg th {
  background: linear-gradient(135deg, rgba(30, 77, 140, 0.1), rgba(200, 41, 59, 0.04)) !important;
  color: var(--gold) !important;
  font-weight: 700 !important;
  text-transform: uppercase !important;
  letter-spacing: 0.06em !important;
  border-bottom: 2px solid rgba(212, 168, 67, 0.15) !important;
}

table tbody tr:nth-child(odd) td,.tbl tbody tr:nth-child(odd) td,table.asg tbody tr:nth-child(odd) td {  background: rgba(30,77,140,0.03) !important;}
table tbody tr:hover td,
.tbl tbody tr:hover td,
table.asg tbody tr:hover td {
  background: rgba(30, 77, 140, 0.05) !important;
}

/* ─────────────────────────────────────────────────────────────────────────────
   8. BADGES & STATUS — Viking colors
   ───────────────────────────────────────────────────────────────────────────── */
.badge.gold,
.saga-badge {
  background: linear-gradient(135deg, rgba(212, 168, 67, 0.15), rgba(212, 168, 67, 0.08)) !important;
  border: 1px solid rgba(212, 168, 67, 0.3) !important;
  color: var(--gold) !important;
}

/* ─────────────────────────────────────────────────────────────────────────────
   9. KPI CARDS — Viking KPI (единый стиль)
   ───────────────────────────────────────────────────────────────────────────── */
.kpi .k,
.kpi-card,
.stat-card {
  background: var(--bg2) !important;
  border: 1px solid rgba(212, 168, 67, 0.15) !important;
  border-radius: var(--r-lg) !important;
  padding: var(--sp-5) !important;
  position: relative !important;
  overflow: hidden !important;
}

.kpi .k .v,
.kpi-card .v,
.stat-card .stat-value {
  font-family: var(--ff-head) !important;
  font-weight: 900 !important;
  background: var(--grad-corp) !important;
  -webkit-background-clip: text !important;
  -webkit-text-fill-color: transparent !important;
  background-clip: text !important;
}

.kpi .k .t,
.kpi-card .t,
.stat-card .stat-label {
  font-size: var(--text-xs) !important;
  color: var(--gold) !important;
  text-transform: uppercase !important;
  letter-spacing: 0.08em !important;
  font-weight: 700 !important;
}

/* ─────────────────────────────────────────────────────────────────────────────
   10. PROGRESS BARS — Viking gradient
   ───────────────────────────────────────────────────────────────────────────── */
.progress-bar,
.cash-card-balance-fill {
  background: var(--grad-corp) !important;
}

.progress,
.progress-bg,
.cash-card-balance-bar {
  background: rgba(255, 255, 255, 0.06) !important;
  border-radius: var(--r-full) !important;
}

/* ─────────────────────────────────────────────────────────────────────────────
   11. МОДАЛКИ — Viking modal style
   ───────────────────────────────────────────────────────────────────────────── */
.modal,
.modal-content {
  border: 1px solid rgba(212, 168, 67, 0.15) !important;
  border-radius: var(--r-xl) !important;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5), 0 0 40px rgba(30, 77, 140, 0.1) !important;
  overflow: hidden !important;
}

.modal::before,
.modal-content::before {
  content: '' !important;
  position: absolute !important;
  top: 0 !important;
  left: 0 !important;
  right: 0 !important;
  height: 3px !important;
  background: var(--grad-corp) !important;
  z-index: 10 !important;
}

.mh,
.modal-header {
  background: transparent !important;
  border-bottom: 1px solid rgba(212, 168, 67, 0.12) !important;
}

.mh .ttl,
.modal-header h2,
.modal-header .title {
  font-family: var(--ff-head) !important;
  color: var(--t1) !important;
  font-weight: 700 !important;
}

/* ─────────────────────────────────────────────────────────────────────────────
   12. ФОРМЫ — Viking input style
   ───────────────────────────────────────────────────────────────────────────── */
input:focus,
select:focus,
textarea:focus,
.inp:focus {
  border-color: var(--blue) !important;
  box-shadow: 0 0 0 3px rgba(30, 77, 140, 0.15), 0 0 12px rgba(30, 77, 140, 0.1) !important;
}

label {
  color: var(--gold-dim) !important;
  font-weight: 600 !important;
  text-transform: uppercase !important;
  letter-spacing: 0.06em !important;
  font-size: 11px !important;
}

/* ─────────────────────────────────────────────────────────────────────────────
   13. SIDEBAR — Viking navigation accent
   ───────────────────────────────────────────────────────────────────────────── */
.sidenav {
  background: linear-gradient(180deg, var(--bg2) 0%, rgba(13, 17, 23, 0.98) 100%) !important;
  border-right: 1px solid rgba(212, 168, 67, 0.08) !important;
}

.nav-group.has-active > .nav-group-header {
  background: linear-gradient(135deg, rgba(30, 77, 140, 0.15), rgba(200, 41, 59, 0.08)) !important;
  border-color: var(--blue) !important;
}

.nav-group.has-active > .nav-group-header::after {
  background: var(--grad-corp) !important;
}

/* ─────────────────────────────────────────────────────────────────────────────
   14. TOPBAR — Viking gradient accent
   ───────────────────────────────────────────────────────────────────────────── */
.topbar,
.asg-header {
  background: linear-gradient(135deg, var(--bg2) 0%, rgba(30, 77, 140, 0.03) 100%) !important;
  border-bottom: 1px solid rgba(212, 168, 67, 0.1) !important;
}

/* ─────────────────────────────────────────────────────────────────────────────
   15. RUNE SEPARATORS — Viking ornaments
   ───────────────────────────────────────────────────────────────────────────── */
.hr {
  background: linear-gradient(90deg, transparent, rgba(212, 168, 67, 0.3), transparent) !important;
}

.runesep {
  color: var(--gold) !important;
  opacity: 0.4;
}

/* ─────────────────────────────────────────────────────────────────────────────
   16. EMPTY STATE — Viking style
   ───────────────────────────────────────────────────────────────────────────── */
.empty-state .icon {
  color: var(--gold) !important;
  text-shadow: 0 0 20px rgba(212, 168, 67, 0.3);
}

.empty-state .title {
  color: var(--gold) !important;
}

/* ─────────────────────────────────────────────────────────────────────────────
   17. FUNNEL / KANBAN — Viking style
   ───────────────────────────────────────────────────────────────────────────── */
.funnel-column {
  background: var(--bg1) !important;
  border: 1px solid rgba(212, 168, 67, 0.15) !important;
  border-radius: var(--r-lg) !important;
  box-shadow: var(--shadow-sm) !important;
}

.funnel-column-header {
  background: transparent !important;
  border-bottom: 3px solid var(--stage-color, var(--gold)) !important;
}

.funnel-card {
  background: var(--bg3) !important;
  border: 1px solid rgba(212, 168, 67, 0.15) !important;
  box-shadow: var(--shadow-sm) !important;
}

.funnel-card:hover {
  background: var(--bg4) !important;
  box-shadow: var(--shadow-md) !important;
  transform: translateY(-1px);
}

/* ─────────────────────────────────────────────────────────────────────────────
   18. CALENDAR — Viking style
   ───────────────────────────────────────────────────────────────────────────── */
.cal-weekday,
.calendar-header {
  color: var(--gold) !important;
  font-weight: 700 !important;
  text-transform: uppercase !important;
}

.cal-day.today,
.calendar-day.today {
  background: linear-gradient(135deg, rgba(30, 77, 140, 0.12), rgba(200, 41, 59, 0.06)) !important;
  border: 1px solid var(--blue) !important;
}

/* ─────────────────────────────────────────────────────────────────────────────
   19. ALERTS — Viking alert style (как .cash-alert)
   ───────────────────────────────────────────────────────────────────────────── */
.alert,
.cash-alert {
  border-radius: var(--r-md) !important;
  font-size: var(--text-sm) !important;
}

/* ─────────────────────────────────────────────────────────────────────────────
   20. SCHEDULE GRID — Viking style
   ───────────────────────────────────────────────────────────────────────────── */
.sched-head .sched-name {
  background: linear-gradient(135deg, rgba(30, 77, 140, 0.1), rgba(200, 41, 59, 0.04)) !important;
  color: var(--gold) !important;
}

.sched-day {
  background: var(--bg3) !important;
}

.sched-day.today {
  background: var(--blue) !important;
  color: white !important;
  font-weight: 700 !important;
}

/* ─────────────────────────────────────────────────────────────────────────────
   21. DROPDOWN MENUS — Viking style
   ───────────────────────────────────────────────────────────────────────────── */
.dropdown-menu {
  background: var(--bg2) !important;
  border: 1px solid rgba(212, 168, 67, 0.1) !important;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.4), 0 0 20px rgba(30, 77, 140, 0.05) !important;
}

.dropdown-item:hover {
  background: rgba(30,77,140,0.1) !important;
  color: var(--t1) !important;
}

/* ─────────────────────────────────────────────────────────────────────────────
   22. TOAST — Viking accent
   ───────────────────────────────────────────────────────────────────────────── */
.toast {
  border: 1px solid rgba(212, 168, 67, 0.15) !important;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.4), 0 0 1px rgba(212, 168, 67, 0.2) !important;
}

/* ─────────────────────────────────────────────────────────────────────────────
   23. ЧАТЫ — Viking style
   ───────────────────────────────────────────────────────────────────────────── */
.chat-container {
  border: 1px solid rgba(212, 168, 67, 0.15) !important;
  box-shadow: var(--shadow-md) !important;
  border-radius: var(--r-lg) !important;
}

.chat-sidebar {
  background: var(--bg2) !important;
  border-right: 1px solid rgba(212, 168, 67, 0.08) !important;
}

.chat-header {
  background: transparent !important;
  border-bottom: 1px solid rgba(212, 168, 67, 0.1) !important;
}

/* ─────────────────────────────────────────────────────────────────────────────
   24. BODY ACCENT LINE — Viking gradient (top of page)
   ───────────────────────────────────────────────────────────────────────────── */
body::before {
  height: 3px !important;
  background: linear-gradient(90deg, var(--red), var(--gold), var(--blue)) !important;
}

/* ─────────────────────────────────────────────────────────────────────────────
   25. SCROLLBAR — Viking accent
   ───────────────────────────────────────────────────────────────────────────── */
::-webkit-scrollbar-thumb {
  background: rgba(30, 77, 140, 0.3) !important;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(212, 168, 67, 0.4) !important;
}

/* ─────────────────────────────────────────────────────────────────────────────
   26. GENERIC PAGE CONTAINERS — единый отступ
   ───────────────────────────────────────────────────────────────────────────── */
.cash-page,
.cash-admin-page,
.kpi-works-page,
.map-page {
  padding: 0 !important;
}

/* ─────────────────────────────────────────────────────────────────────────────
   27. SELECTION — Viking blue
   ───────────────────────────────────────────────────────────────────────────── */
::selection {
  background: rgba(30, 77, 140, 0.35) !important;
  color: var(--t1) !important;
}

/* ─────────────────────────────────────────────────────────────────────────────
   28. LIGHT THEME — Viking light overrides
   ───────────────────────────────────────────────────────────────────────────── */
html[data-theme="light"] .card,
html[data-theme="light"] .panel,
html[data-theme="light"] .widget,
html[data-theme="light"] .stat-card,
html[data-theme="light"] [class*="kpi"] .k {
  border: 1px solid var(--brd) !important;
  box-shadow: var(--shadow-sm) !important;
}

html[data-theme="light"] .card::before,
html[data-theme="light"] .panel::before,
html[data-theme="light"] .widget::before,
html[data-theme="light"] .stat-card::before,
html[data-theme="light"] [class*="kpi"] .k::before {
  opacity: 0.5 !important;
}

html[data-theme="light"] table th,
html[data-theme="light"] .tbl th {
  background: linear-gradient(135deg, rgba(30, 77, 140, 0.06), rgba(200, 41, 59, 0.02)) !important;
  color: var(--blue) !important;
}

html[data-theme="light"] label {
  color: var(--blue) !important;
}

html[data-theme="light"] body::before {
  background: linear-gradient(90deg, var(--red), var(--gold), var(--blue)) !important;
}

/* ═══════════════════════════════════════════════════════════════════════════════
   NUCLEAR FIX: Override inline style="background:transparent" in JS modules
   Many JS modules set background:transparent inline, making cards invisible.
   These rules use !important to force Viking-style backgrounds.
   ═══════════════════════════════════════════════════════════════════════════════ */

/* Fix all JS-rendered card-like elements with transparent backgrounds */
.asg-content [style*="background: transparent"],
.asg-content [style*="background:transparent"],
#layout [style*="background: transparent"],
#layout [style*="background:transparent"] {
  background: var(--bg2) !important;
  border-radius: var(--r-lg) !important;
  box-shadow: var(--shadow-sm) !important;
}

/* Exclude inner elements that should remain transparent */
.asg-content [style*="background: transparent"] [style*="background: transparent"],
.asg-content [style*="background:transparent"] [style*="background:transparent"],
.asg-content [style*="background: transparent"] span,
.asg-content [style*="background: transparent"] div:not([class]),
#layout [style*="background: transparent"] [style*="background: transparent"],
#layout [style*="background:transparent"] [style*="background:transparent"] {
  background: transparent !important;
  box-shadow: none !important;
}

/* Fix all card-like divs inside page content that are invisible */
.asg-content > .panel,
#layout > .panel,
.asg-content > .card,
#layout > .card {
  background: var(--bg2) !important;
}

/* ═══════════════════════════════════════════════════════════════════════════════
   JS MODULE SPECIFIC FIXES
   Override styles commonly set inline by JS modules
   ═══════════════════════════════════════════════════════════════════════════════ */

/* Generic module card containers */
.pm-card,
.se-card,
.otp-card,
.payroll-card,
.task-card,
.calc-card,
.tkp-card,
.permit-card,
.req-card,
.travel-card,
.inv-card,
.act-card,
.exp-card,
.pm-card,.se-card,.otp-card,.payroll-card,.task-card,.calc-card,.tkp-card,.permit-card,.req-card,.travel-card,.inv-card,.act-card,.exp-card {
  background: var(--bg2) !important;
  border: 1px solid rgba(212, 168, 67, 0.15) !important;
  border-radius: var(--r-lg) !important;
  box-shadow: var(--shadow-sm) !important;
  overflow: hidden;
  position: relative;
}

/* Card-header pattern across modules */

/* removed wildcard -header rule */ .placeholder-no-match {
  background: inherit !important;
}

/* Section titles across all modules */
[class*="-section-title"],
[class*="section-title"],
.csec h3,
.section h3,
.card h3,
.panel h3 {
  color: var(--gold) !important;
  font-family: var(--ff-head) !important;
  font-weight: 700 !important;
}

/* Stats rows (used in many modules) */
.stats-row,
.stats-grid,
.summary-row,
.summary-grid,
.kpi-row {
  gap: 16px !important;
}

.stats-row > div,
.stats-grid > div,
.summary-row > div,
.summary-grid > div {
  background: var(--bg2) !important;
  border-radius: var(--r-lg) !important;
  box-shadow: var(--shadow-sm) !important;
  position: relative;
  overflow: hidden;
}

/* Ensure card-body has no background issues */

/* removed wildcard -body rule */ .card-body, .panel-body {
  background: transparent !important;
}

/* Viking gold accent for all module section titles */
.csec .ttl,
.csec > h3,
.section > h3,
h3[class*="title"] {
  color: var(--gold) !important;
}

/* Fix filter bars across all modules */
[class*="filter-bar"],
[class*="toolbar"],
.filter-row,
.tools-row {
  background: transparent !important;
  padding: var(--sp-3) 0 !important;
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-3);
  align-items: center;
}

/* ═══════════════════════════════════════════════════════════════════════════════
   PAGE-SPECIFIC VIKING OVERRIDES
   Ensure every page gets the Viking treatment
   ═══════════════════════════════════════════════════════════════════════════════ */

/* Personnel page */
.employee-card,
.employee-detail {
  background: var(--bg2) !important;
  border: 1px solid rgba(212, 168, 67, 0.15) !important;
  border-radius: var(--r-lg) !important;
}

/* Equipment page */
.eq-card,
.equipment-card {
  background: var(--bg2) !important;
  border: 1px solid rgba(212, 168, 67, 0.15) !important;
  border-radius: var(--r-lg) !important;
}

/* Meetings page */
.meeting-card {
  background: var(--bg2) !important;
  border: 1px solid rgba(212, 168, 67, 0.15) !important;
  border-radius: var(--r-lg) !important;
}

/* Gantt chart */
.gantt-container {
  background: var(--bg2) !important;
  border: 1px solid rgba(212, 168, 67, 0.15) !important;
  border-radius: var(--r-lg) !important;
}

.gantt-bar {
  background: var(--grad-corp) !important;
  border-radius: var(--r-sm) !important;
}

/* Warehouse */
.warehouse-card,
.wh-card {
  background: var(--bg2) !important;
  border: 1px solid rgba(212, 168, 67, 0.15) !important;
  border-radius: var(--r-lg) !important;
}

/* Contracts & Seals */
.contract-card,
.seal-card,
.proxy-card {
  background: var(--bg2) !important;
  border: 1px solid rgba(212, 168, 67, 0.15) !important;
  border-radius: var(--r-lg) !important;
}

/* Settings page */
.settings-section,
.settings-card {
  background: var(--bg2) !important;
  border: 1px solid rgba(212, 168, 67, 0.15) !important;
  border-radius: var(--r-lg) !important;
}

/* Approvals page */
.approval-card {
  background: var(--bg2) !important;
  border: 1px solid rgba(212, 168, 67, 0.15) !important;
  border-radius: var(--r-lg) !important;
}

/* Travel / Housing page */
.travel-card,
.housing-card {
  background: var(--bg2) !important;
  border: 1px solid rgba(212, 168, 67, 0.15) !important;
  border-radius: var(--r-lg) !important;
}

/* ═══════════════════════════════════════════════════════════════════════════════
   CONSISTENT GRID GAPS
   All grids should use the same spacing as Касса module
   ═══════════════════════════════════════════════════════════════════════════════ */
.grid,
.card-grid,
.cards-grid,
[class*="-grid"]:not(.cal-grid):not(.calendar-grid):not(.sched-grid):not(.bs-kpi):not(.dash-grid):not(.cash-balance-grid):not(.cash-detail-grid):not(.cash-cards-grid):not(.form-grid) {
  gap: 20px !important;
}

/* ═══════════════════════════════════════════════════════════════════════════════
   VIKING RUNE ANIMATION (for decoration)
   ═══════════════════════════════════════════════════════════════════════════════ */
@keyframes rune-pulse {
  0%, 100% { opacity: 0.6; text-shadow: 0 0 8px rgba(212, 168, 67, 0.3); }
  50% { opacity: 1; text-shadow: 0 0 20px rgba(212, 168, 67, 0.6); }
}

/* ═══════════════════════════════════════════════════════════════════════════════
   ASGARD CRM — FULL REDESIGN v4.0
   Deep Navy + Red/Blue/Gold Premium Corporate Theme
   Appended to END of app.css — overrides everything above.
   ═══════════════════════════════════════════════════════════════════════════════ */


/* ══════════════════════════════════════
   1. GLOBAL — Deep navy base
   ══════════════════════════════════════ */

body {
  background: #0B0F19 !important;
  color: rgba(255,255,255,0.92) !important;
}

body::before {
  content: '' !important;
  position: fixed !important;
  top: 0 !important;
  left: 0 !important;
  right: 0 !important;
  height: 2px !important;
  background: linear-gradient(90deg, var(--red, #C8293B), var(--gold, #D4A843) 50%, var(--blue, #1E4D8C)) !important;
  z-index: 9999 !important;
  pointer-events: none !important;
}

::selection {
  background: rgba(30,77,140,0.4) !important;
  color: #fff !important;
}

a { color: var(--blue-l, #4A90D9); }


/* ══════════════════════════════════════
   2. SIDEBAR — dark navy, blue accents
   ══════════════════════════════════════ */

.sidenav {
  background: linear-gradient(180deg, #0A1025 0%, #070D1A 100%) !important;
  border-right: 1px solid rgba(30,77,140,0.15) !important;
  box-shadow: 4px 0 20px rgba(0,0,0,0.25) !important;
}

.sidebar-header {
  border-bottom: 1px solid rgba(30,77,140,0.1) !important;
}

.brand {
  border: 1px solid rgba(200,41,59,0.25) !important;
  background: linear-gradient(135deg, rgba(200,41,59,0.06), rgba(30,77,140,0.06)) !important;
}

.brand:hover {
  border-color: rgba(200,41,59,0.5) !important;
  box-shadow: 0 0 24px rgba(200,41,59,0.15) !important;
}

.nav-group-header {
  color: rgba(255,255,255,0.45) !important;
}

.nav-group-header:hover {
  background: rgba(30,77,140,0.1) !important;
  color: rgba(255,255,255,0.85) !important;
}

.nav-group.has-active > .nav-group-header {
  background: rgba(30,77,140,0.15) !important;
  border-color: rgba(30,77,140,0.4) !important;
  color: var(--blue-l, #4A90D9) !important;
  box-shadow: 0 0 12px rgba(30,77,140,0.15) !important;
}

.nav-group.has-active > .nav-group-header::after {
  background: linear-gradient(180deg, var(--red, #C8293B), var(--blue, #1E4D8C)) !important;
  width: 3px !important;
}

.sidefoot {
  border-top: 1px solid rgba(30,77,140,0.12) !important;
}

/* Logout button — ghost outline style, NOT solid red */
.sidefoot .btn.red,
.sidefoot #btnLogout {
  background: transparent !important;
  border: 1px solid rgba(200,41,59,0.3) !important;
  color: rgba(200,41,59,0.8) !important;
  font-size: 0 !important;
  padding: 0 !important;
}

.sidefoot .btn.red:hover,
.sidefoot #btnLogout:hover {
  background: rgba(200,41,59,0.08) !important;
  border-color: rgba(200,41,59,0.6) !important;
  color: var(--red, #C8293B) !important;
  box-shadow: 0 0 12px rgba(200,41,59,0.15) !important;
}


/* ══════════════════════════════════════
   3. MAIN AREA — margin from sidebar + padding
   ══════════════════════════════════════ */

.main,
.asg-main-wrap {
  margin-left: var(--sidebar-w, 64px) !important;
  width: calc(100% - var(--sidebar-w, 64px)) !important;
  max-width: calc(100% - var(--sidebar-w, 64px)) !important;
  overflow-x: hidden !important;
  background: #0B0F19 !important;
  min-height: 100vh !important;
}

/* Fallback: if margin-left doesn't work, use padding */
.main {
  padding-left: 0 !important;
}


/* ══════════════════════════════════════
   4. TOPBAR — navy glass + gold gradient line
   ══════════════════════════════════════ */

.topbar,
.asg-header {
  padding: 0 32px !important;
  min-height: var(--topbar-h, 56px) !important;
  width: 100% !important;
  box-sizing: border-box !important;
  background: linear-gradient(135deg, #0D1320 0%, rgba(30,77,140,0.04) 100%) !important;
  border-bottom: none !important;
  box-shadow: 0 1px 0 rgba(30,77,140,0.12), 0 4px 16px rgba(0,0,0,0.15) !important;
  position: relative !important;
}

/* Gold gradient line under topbar */
.topbar::after,
.asg-header::after {
  content: '' !important;
  position: absolute !important;
  bottom: 0 !important;
  left: 0 !important;
  right: 0 !important;
  height: 1px !important;
  background: linear-gradient(90deg, transparent 10%, rgba(212,168,67,0.25) 50%, transparent 90%) !important;
  pointer-events: none !important;
}

/* Page title */
.topbar .title h1,
.topbar .page-title,
.topbar h1.page-title,
h1.page-title {
  color: rgba(255,255,255,0.95) !important;
  font-weight: 700 !important;
  letter-spacing: 0.04em !important;
  text-transform: uppercase !important;
  font-size: 16px !important;
  white-space: nowrap !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
}

/* Breadcrumbs */
.breadcrumbs { font-size: 11px !important; }
.breadcrumbs a { color: rgba(255,255,255,0.4) !important; }
.bc-sep { color: rgba(255,255,255,0.2) !important; }
.bc-current { color: rgba(255,255,255,0.5) !important; }


/* ══════════════════════════════════════
   5. CONTENT AREA — proper padding
   ══════════════════════════════════════ */

#layout,
.asg-content {
  padding: 24px 32px !important;
  width: 100% !important;
  max-width: 100% !important;
  overflow-x: hidden !important;
  box-sizing: border-box !important;
}


/* ══════════════════════════════════════
   6. CARDS & PANELS — blue-tinted glass
   ══════════════════════════════════════ */

.card,
.panel,
.widget {
  background: #131929 !important;
  border: 1px solid rgba(30,77,140,0.1) !important;
  border-radius: 12px !important;
  box-shadow: 0 2px 8px rgba(0,0,0,0.15) !important;
  position: relative !important;
  overflow: hidden !important;
  transition: border-color 0.25s ease, box-shadow 0.25s ease, transform 0.25s ease !important;
}

.card:hover,
.panel:hover,
.widget:hover {
  border-color: rgba(30,77,140,0.25) !important;
  box-shadow: 0 8px 24px rgba(0,0,0,0.25), 0 0 16px rgba(30,77,140,0.05) !important;
  transform: translateY(-2px) !important;
}

/* Accent bar on hover */
.card::before,
.panel::before {
  content: '' !important;
  position: absolute !important;
  top: 0 !important; left: 0 !important; right: 0 !important;
  height: 2px !important;
  background: linear-gradient(90deg, var(--red, #C8293B), var(--blue, #1E4D8C)) !important;
  opacity: 0 !important;
  transition: opacity 0.25s ease !important;
  z-index: 1 !important;
}

.card:hover::before,
.panel:hover::before {
  opacity: 0.5 !important;
}

/* Card/panel headings — gold section labels */
.card h3,
.panel h3,
.form-section,
.section-title {
  color: var(--gold, #D4A843) !important;
  font-weight: 700 !important;
  letter-spacing: 0.04em !important;
  text-transform: uppercase !important;
  font-size: 12px !important;
}


/* ══════════════════════════════════════
   7. KPI CARDS — individually colored
   ══════════════════════════════════════ */

.kpi .k {
  border-radius: 12px !important;
  position: relative !important;
  overflow: hidden !important;
  transition: transform 0.25s ease, box-shadow 0.25s ease !important;
  padding: 16px 18px !important;
}

.kpi .k:hover {
  transform: translateY(-3px) !important;
  box-shadow: 0 8px 24px rgba(0,0,0,0.25) !important;
}

.kpi .k::before {
  content: '' !important;
  position: absolute !important;
  top: 0 !important; left: 0 !important; right: 0 !important;
  height: 3px !important;
}

.kpi .k:nth-child(1) {
  background: linear-gradient(145deg, rgba(200,41,59,0.08), #131929) !important;
  border: 1px solid rgba(200,41,59,0.15) !important;
}
.kpi .k:nth-child(1)::before { background: var(--red, #C8293B) !important; }

.kpi .k:nth-child(2) {
  background: linear-gradient(145deg, rgba(30,77,140,0.08), #131929) !important;
  border: 1px solid rgba(30,77,140,0.25) !important;
}
.kpi .k:nth-child(2)::before { background: var(--blue, #1E4D8C) !important; }

.kpi .k:nth-child(3) {
  background: linear-gradient(145deg, rgba(212,168,67,0.08), #131929) !important;
  border: 1px solid rgba(212,168,67,0.15) !important;
}
.kpi .k:nth-child(3)::before { background: var(--gold, #D4A843) !important; }

.kpi .k:nth-child(4) {
  background: linear-gradient(145deg, rgba(45,134,89,0.08), #131929) !important;
  border: 1px solid rgba(45,134,89,0.15) !important;
}
.kpi .k:nth-child(4)::before { background: #2D8659 !important; }

.kpi .k:nth-child(5) {
  background: linear-gradient(145deg, rgba(139,92,246,0.06), #131929) !important;
  border: 1px solid rgba(139,92,246,0.12) !important;
}
.kpi .k:nth-child(5)::before { background: #8B5CF6 !important; }

.kpi .k:nth-child(6) {
  background: linear-gradient(145deg, rgba(6,182,212,0.06), #131929) !important;
  border: 1px solid rgba(6,182,212,0.12) !important;
}
.kpi .k:nth-child(6)::before { background: #06B6D4 !important; }

.kpi .v,
.kpi .k .v,
.stat-value {
  font-family: var(--ff-mono, 'JetBrains Mono', monospace) !important;
  font-variant-numeric: tabular-nums !important;
  color: rgba(255,255,255,0.95) !important;
}

.kpi .t,
.kpi .k .t {
  color: rgba(255,255,255,0.45) !important;
  text-transform: uppercase !important;
  letter-spacing: 0.06em !important;
  font-size: 10px !important;
  font-weight: 700 !important;
}


/* ══════════════════════════════════════
   8. DASHBOARD WIDGETS
   ══════════════════════════════════════ */

.dash-widget {
  background: #131929 !important;
  border: 1px solid rgba(30,77,140,0.08) !important;
}

.dash-widget::before {
  background: linear-gradient(90deg, var(--red, #C8293B), var(--gold, #D4A843) 50%, var(--blue, #1E4D8C)) !important;
  opacity: 0.6 !important;
}

.dash-widget:hover {
  border-color: rgba(30,77,140,0.2) !important;
}

.dash-widget:hover::before {
  opacity: 1 !important;
}

.dash-widget-header {
  color: var(--gold, #D4A843) !important;
  font-weight: 700 !important;
  text-transform: uppercase !important;
  letter-spacing: 0.04em !important;
  font-size: 11px !important;
}


/* ══════════════════════════════════════
   9. TABLES — navy with blue accents
   ══════════════════════════════════════ */

table th,
.tbl th,
table.asg th {
  background: rgba(30,77,140,0.08) !important;
  color: rgba(255,255,255,0.55) !important;
  border-bottom: 1px solid rgba(30,77,140,0.15) !important;
  font-size: 11px !important;
  font-weight: 700 !important;
  text-transform: uppercase !important;
  letter-spacing: 0.05em !important;
}

table td,
.tbl td,
table.asg td {
  background: var(--bg2) !important;
  border-bottom: 1px solid rgba(30,77,140,0.05) !important;
  color: rgba(255,255,255,0.85) !important;
}

table tbody tr:nth-child(odd) td,.tbl tbody tr:nth-child(odd) td,table.asg tbody tr:nth-child(odd) td {  background: rgba(30,77,140,0.03) !important;}
table tbody tr:hover td,
.tbl tbody tr:hover td,
table.asg tbody tr:hover td {
  background: rgba(30,77,140,0.05) !important;
}

table.asg tbody tr:hover td:first-child,
.tbl tbody tr:hover td:first-child {
  box-shadow: inset 3px 0 0 var(--blue, #1E4D8C) !important;
}

.tbl-wrap,
.table-wrap,
.tablewrap {
  border-radius: 12px !important;
  border: 1px solid rgba(30,77,140,0.08) !important;
  background: rgba(19,25,41,0.5) !important;
  overflow: hidden !important;
}


/* ══════════════════════════════════════
   10. MODALS — premium glass, above sidebar
   ══════════════════════════════════════ */

.modalback,
.modal-overlay {
  z-index: 1000 !important;
  background: rgba(6,8,16,0.8) !important;
  backdrop-filter: blur(6px) !important;
}

.modal,
.modal-content {
  z-index: 1001 !important;
  background: #131929 !important;
  border: 1px solid rgba(30,77,140,0.25) !important;
  border-radius: 16px !important;
  box-shadow: 0 24px 64px rgba(0,0,0,0.4) !important;
}

.modal::before,
.modal-content::before {
  content: '' !important;
  position: absolute !important;
  top: 0 !important; left: 0 !important; right: 0 !important;
  height: 3px !important;
  background: linear-gradient(90deg, var(--red, #C8293B), var(--gold, #D4A843) 50%, var(--blue, #1E4D8C)) !important;
  z-index: 1 !important;
  border-radius: 16px 16px 0 0 !important;
}

.mh,
.modal-header {
  background: rgba(30,77,140,0.05) !important;
  border-bottom: 1px solid rgba(30,77,140,0.1) !important;
}

.mh .ttl,
.modal-header h2,
.modal-header .title {
  color: rgba(255,255,255,0.95) !important;
  font-weight: 700 !important;
  letter-spacing: 0.03em !important;
  text-transform: uppercase !important;
}

.mf,
.modal-footer {
  background: rgba(30,77,140,0.03) !important;
  border-top: 1px solid rgba(30,77,140,0.08) !important;
}


/* ══════════════════════════════════════
   11. FORM INPUTS — dark glass with blue focus
   ══════════════════════════════════════ */

input:not([type="checkbox"]):not([type="radio"]):not([type="file"]):not([type="hidden"]):not(.chat-search-input),
select,
textarea,
.inp {
  background: #1C2130 !important;
  border: 1px solid rgba(30,77,140,0.12) !important;
  color: rgba(255,255,255,0.9) !important;
  border-radius: 8px !important;
}

input:not([type="checkbox"]):not([type="radio"]):not([type="file"]):not([type="hidden"]):hover,
select:hover,
textarea:hover,
.inp:hover {
  border-color: rgba(30,77,140,0.25) !important;
}

input:not([type="checkbox"]):not([type="radio"]):not([type="file"]):not([type="hidden"]):focus,
select:focus,
textarea:focus,
.inp:focus {
  border-color: var(--blue, #1E4D8C) !important;
  box-shadow: 0 0 0 3px rgba(30,77,140,0.12) !important;
  outline: none !important;
}

label {
  color: rgba(255,255,255,0.45) !important;
  font-weight: 600 !important;
  text-transform: uppercase !important;
  letter-spacing: 0.05em !important;
  font-size: 11px !important;
}


/* ══════════════════════════════════════
   12. TOASTS — color-coded left border
   ══════════════════════════════════════ */

.toast {
  background: #131929 !important;
  border: 1px solid rgba(30,77,140,0.12) !important;
  border-left: 4px solid rgba(30,77,140,0.3) !important;
  box-shadow: 0 8px 32px rgba(0,0,0,0.3) !important;
}

.toast.toast-success,
.toast-success { border-left-color: #2D8659 !important; }
.toast.toast-error,
.toast-error   { border-left-color: var(--red, #C8293B) !important; }
.toast.toast-warning,
.toast-warning { border-left-color: var(--gold, #D4A843) !important; }
.toast.toast-info,
.toast-info    { border-left-color: var(--blue, #1E4D8C) !important; }


/* ══════════════════════════════════════
   13. BUTTONS — proper styling
   ══════════════════════════════════════ */

.btn {
  border-radius: 8px !important;
  transition: all 0.2s ease !important;
}

.btn.primary {
  background: linear-gradient(135deg, #1E4D8C, #2563A8) !important;
  border-color: rgba(30,77,140,0.5) !important;
  box-shadow: 0 2px 8px rgba(30,77,140,0.15) !important;
  color: #fff !important;
}

.btn.primary:hover {
  background: linear-gradient(135deg, #2563A8, #3B82F6) !important;
  box-shadow: 0 4px 20px rgba(30,77,140,0.35) !important;
  transform: translateY(-1px) !important;
}

.btn.red:not(#btnLogout):hover,
.btn.danger:hover {
  box-shadow: 0 4px 20px rgba(200,41,59,0.35) !important;
}

.btn.gold:hover {
  box-shadow: 0 4px 20px rgba(212,168,67,0.35) !important;
}

.btn.ghost {
  background: transparent !important;
  border-color: rgba(255,255,255,0.1) !important;
}

.btn.ghost:hover {
  background: rgba(255,255,255,0.04) !important;
  border-color: rgba(255,255,255,0.2) !important;
}


/* ══════════════════════════════════════
   14. CHAT — Huginn Messenger (FULL FIX)
   ══════════════════════════════════════ */

/* Container — the grid wrapper */
.chat-container {
  height: calc(100vh - var(--topbar-h, 56px) - 120px) !important;
  max-height: calc(100vh - 180px) !important;
  background: #0D1320 !important;
  border: 1px solid rgba(30,77,140,0.12) !important;
  border-radius: 12px !important;
  overflow: hidden !important;
}
/* Desktop only: force grid row to container height */
@media (min-width: 769px) {
  .chat-container {
    grid-template-rows: minmax(0, 1fr) !important;
  }
}

/* Sidebar (chat list) */
.chat-sidebar {
  background: #0F1525 !important;
  border-right: 1px solid rgba(30,77,140,0.1) !important;
}

.chat-sidebar-header {
  background: rgba(30,77,140,0.04) !important;
  border-bottom: 1px solid rgba(30,77,140,0.08) !important;
}

.chat-search-input {
  background: #1C2130 !important;
  border: 1px solid rgba(30,77,140,0.1) !important;
  border-radius: 8px !important;
  color: rgba(255,255,255,0.9) !important;
}

.chat-list {
  overflow-y: auto !important;
}

.chat-item:hover {
  background: var(--bg3) !important;
}

.chat-item.active {
  background: rgba(30,77,140,0.12) !important;
}

.chat-item-unread {
  background: var(--red, #C8293B) !important;
}

/* Main chat area — desktop: CSS Grid for guaranteed input visibility */
@media (min-width: 769px) {
  .chat-main {
    display: grid !important;
    grid-template-rows: auto minmax(0, 1fr) auto auto !important;
    min-height: 0 !important;
    max-height: 100% !important;
    overflow: hidden !important;
    height: 100% !important;
    align-self: stretch !important;
    background: #0B0F19 !important;
  }
}
/* Mobile: flex column (responsive.css handles display:none/flex toggle) */
@media (max-width: 768px) {
  .chat-main {
    display: none;
    flex-direction: column !important;
    background: #0B0F19 !important;
  }
  .chat-main.chat-visible-mobile {
    display: flex !important;
  }
  /* When chat is open fullscreen — hide tabbar, FAB, and mobile header */
  body:has(.chat-visible-mobile) .m-tabbar,
  body:has(.chat-visible-mobile) .m-fab {
    display: none !important;
  }
  /* Disable pinch-zoom inside chat */
  .chat-main {
    touch-action: pan-y !important;
  }
  /* Input area — safe area padding for iPhone home indicator */
  .chat-main .chat-input-area {
    padding-bottom: calc(10px + env(safe-area-inset-bottom, 0px)) !important;
  }
}

/* Chat header */
.chat-header {
  flex-shrink: 0 !important;
  background: #0F1525 !important;
  border-bottom: 1px solid rgba(30,77,140,0.1) !important;
}

/* Messages area — scrollable, takes remaining space */
.chat-messages,
#chat-messages-container {
  flex: 1 1 0% !important;
  min-height: 0 !important;
  overflow-y: auto !important;
  background: #0B0F19 !important;
}

/* INPUT AREA — MUST be visible, pinned to bottom */
.chat-input-area {
  flex-shrink: 0 !important;
  display: flex !important;
  align-items: flex-end !important;
  gap: 8px !important;
  padding: 12px 16px !important;
  border-top: 1px solid rgba(30,77,140,0.12) !important;
  background: #0F1525 !important;
  min-height: 60px !important;
  z-index: 2 !important;
}

/* Chat textarea input */
.chat-input,
#chat-message-input {
  flex: 1 !important;
  min-height: 40px !important;
  max-height: 120px !important;
  padding: 10px 16px !important;
  background: var(--bg3) !important;
  border: 1px solid rgba(30,77,140,0.25) !important;
  border-radius: 20px !important;
  color: rgba(255,255,255,0.9) !important;
  font-size: 14px !important;
  resize: none !important;
}

.chat-input:focus,
#chat-message-input:focus {
  border-color: var(--blue, #1E4D8C) !important;
  box-shadow: 0 0 0 2px rgba(30,77,140,0.1) !important;
  outline: none !important;
}

/* Chat send button */
.chat-send-btn {
  background: linear-gradient(135deg, var(--blue, #1E4D8C), #2563A8) !important;
  color: #fff !important;
  box-shadow: 0 2px 8px rgba(30,77,140,0.25) !important;
}

.chat-send-btn:hover {
  box-shadow: 0 4px 16px rgba(30,77,140,0.4) !important;
}

/* Reply bar */
.chat-reply-bar {
  flex-shrink: 0 !important;
  border-left-color: var(--gold, #D4A843) !important;
  background: #0F1525 !important;
}

/* Chat welcome screen */
.chat-welcome {
  display: flex !important;
  flex-direction: column !important;
  align-items: center !important;
  justify-content: center !important;
  flex: 1 !important;
  min-height: 200px !important;
}

/* Chat date divider */
.chat-date-divider span {
  background: #131929 !important;
  color: rgba(255,255,255,0.4) !important;
}

/* Also fix the MODAL chat (chat.js) which uses inline styles */
.modal .chat-container {
  height: 450px !important;
  display: flex !important;
  flex-direction: column !important;
  grid-template-columns: none !important;
}


/* ══════════════════════════════════════
   15. BADGES & TAGS
   ══════════════════════════════════════ */

.badge,
.tag {
  border-radius: 20px !important;
  font-weight: 600 !important;
}


/* ══════════════════════════════════════
   16. TABS
   ══════════════════════════════════════ */

.tabs {
  background: rgba(19,25,41,0.6) !important;
  border: 1px solid rgba(30,77,140,0.08) !important;
}

.tab.active,
.tab-btn.active {
  background: rgba(30,77,140,0.15) !important;
  color: var(--blue-l, #4A90D9) !important;
  box-shadow: 0 2px 8px rgba(30,77,140,0.1) !important;
}


/* ══════════════════════════════════════
   17. SCROLLBARS — subtle blue
   ══════════════════════════════════════ */

::-webkit-scrollbar {
  width: 6px !important;
  height: 6px !important;
}

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

::-webkit-scrollbar-thumb {
  background: rgba(30,77,140,0.2) !important;
  border-radius: 3px !important;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(30,77,140,0.35) !important;
}


/* ══════════════════════════════════════
   18. RUNIC ELEMENTS — gold accent (subtle)
   ══════════════════════════════════════ */

.runesep,
.rune-divider {
  color: var(--gold, #D4A843) !important;
  opacity: 0.3 !important;
}

.hr {
  background: linear-gradient(90deg, transparent, rgba(212,168,67,0.2), transparent) !important;
}


/* ══════════════════════════════════════
   19. STATUS DOTS
   ══════════════════════════════════════ */

.dot.green { box-shadow: 0 0 8px rgba(45,134,89,0.5) !important; }
.dot.red   { box-shadow: 0 0 8px rgba(200,41,59,0.5) !important; }
.dot.amber { box-shadow: 0 0 8px rgba(212,168,67,0.5) !important; }
.dot.blue  { box-shadow: 0 0 8px rgba(30,77,140,0.5) !important; }


/* ══════════════════════════════════════
   20. NOTIFICATIONS (bellpop)
   ══════════════════════════════════════ */

.bellpop {
  background: #131929 !important;
  border: 1px solid rgba(30,77,140,0.25) !important;
  box-shadow: 0 16px 48px rgba(0,0,0,0.4) !important;
  border-radius: 12px !important;
}

.bellpop-head {
  background: rgba(30,77,140,0.05) !important;
  border-bottom: 1px solid rgba(30,77,140,0.1) !important;
}

.bellitem:hover {
  background: rgba(30,77,140,0.05) !important;
}

.bellitem.unread {
  background: var(--bg3) !important;
  border-left: 2px solid var(--blue, #1E4D8C) !important;
}


/* ══════════════════════════════════════
   21. EMPTY STATES
   ══════════════════════════════════════ */

.empty-state .icon {
  color: rgba(30,77,140,0.4) !important;
}

.empty-state .title {
  color: rgba(255,255,255,0.6) !important;
}


/* ══════════════════════════════════════
   22. WELCOME / AUTH PAGE
   ══════════════════════════════════════ */

.welcome-page {
  background: #0a0e1a !important;
}

.welcome-form {
  background: rgba(13,18,33,0.9) !important;
  backdrop-filter: blur(24px) !important;
  -webkit-backdrop-filter: blur(24px) !important;
  border: 1px solid rgba(251,191,36,0.12) !important;
  border-radius: 20px !important;
}


/* ══════════════════════════════════════
   23. KANBAN / FUNNEL
   ══════════════════════════════════════ */

.kanban-column,
.funnel-column {
  background: rgba(19,25,41,0.6) !important;
  border: 1px solid rgba(30,77,140,0.08) !important;
  border-radius: 12px !important;
}


/* ══════════════════════════════════════
   24. SEARCH / COMMAND PALETTE
   ══════════════════════════════════════ */

.search-modal {
  background: #131929 !important;
  border: 1px solid rgba(30,77,140,0.25) !important;
  border-radius: 12px !important;
}


/* ══════════════════════════════════════
   25. DROPDOWNS & FLYOUT MENUS
   ══════════════════════════════════════ */

.dropdown-menu,
.nav-group-items {
  background: #131929 !important;
  border: 1px solid rgba(30,77,140,0.25) !important;
  box-shadow: 0 12px 36px rgba(0,0,0,0.4) !important;
  border-radius: 8px !important;
}


/* ══════════════════════════════════════
   26. PILL (user info in sidefoot)
   ══════════════════════════════════════ */

.pill {
  background: var(--bg3) !important;
  border: 1px solid rgba(30,77,140,0.1) !important;
  border-radius: 8px !important;
}

.pill .who {
  color: rgba(255,255,255,0.85) !important;
}

.pill .role {
  color: rgba(255,255,255,0.4) !important;
  font-size: 10px !important;
}


/* ══════════════════════════════════════
   27. HEADER SECTION OVERRIDES
   — Fix the wildcard [class*="-header"] selector
   ══════════════════════════════════════ */

/* removed wildcard -header rule */ .placeholder-no-match {
  color: var(--gold, #D4A843) !important;
  font-size: 12px !important;
  font-weight: 700 !important;
  text-transform: uppercase !important;
  letter-spacing: 0.04em !important;
}


/* ══════════════════════════════════════
   28. NUCLEAR FIX for inline styles
   — Override inline background: transparent
   ══════════════════════════════════════ */

#layout [style*="background: transparent"],
#layout [style*="background:transparent"] {
  background: transparent !important;
}

/* Cards inside #layout with inline transparent */
#layout [style*="background: transparent"] .card,
#layout [style*="background:transparent"] .card {
  background: #131929 !important;
}


/* ══════════════════════════════════════
   29. LIGHT THEME — clean overrides
   ══════════════════════════════════════ */

html[data-theme="light"] body {
  background: #F0F3F8 !important;
  color: #1a1a2e !important;
}

html[data-theme="light"] .sidenav {
  background: linear-gradient(180deg, #FFFFFF, #F8FAFC) !important;
  border-right: 1px solid rgba(30,77,140,0.1) !important;
}

html[data-theme="light"] .topbar {
  background: #FFFFFF !important;
  box-shadow: 0 1px 0 rgba(30,77,140,0.06), 0 2px 8px rgba(0,0,0,0.03) !important;
}

html[data-theme="light"] .card,
html[data-theme="light"] .panel {
  background: #FFFFFF !important;
  border-color: rgba(30,77,140,0.06) !important;
}

html[data-theme="light"] .modal,
html[data-theme="light"] .modal-content {
  background: #FFFFFF !important;
}

html[data-theme="light"] input:not([type="checkbox"]):not([type="radio"]):not([type="file"]):not([type="hidden"]),
html[data-theme="light"] select,
html[data-theme="light"] textarea,
html[data-theme="light"] .inp {
  background: #F8FAFC !important;
  border-color: rgba(30,77,140,0.1) !important;
  color: #1a1a2e !important;
}

html[data-theme="light"] label {
  color: rgba(0,0,0,0.5) !important;
}

html[data-theme="light"] .chat-container {
  background: #FFFFFF !important;
}

html[data-theme="light"] .chat-main,
html[data-theme="light"] .chat-messages {
  background: #F8FAFC !important;
}

html[data-theme="light"] .chat-sidebar,
html[data-theme="light"] .chat-input-area,
html[data-theme="light"] .chat-header {
  background: #FFFFFF !important;
}


/* ══════════════════════════════════════
   30. CREDIT / FOOTER
   ══════════════════════════════════════ */

.credit {
  color: rgba(212,168,67,0.25) !important;
  font-size: 11px !important;
  letter-spacing: 0.05em !important;
}

.help {
  color: rgba(255,255,255,0.25) !important;
  font-size: 12px !important;
}

/* ══════════════════════════════════════
   31. TELEPHONY MODULE
   — Call popup, journal, player, stats
   ══════════════════════════════════════ */

/* ── Call Popup (Incoming) ── */

#telephony-popup-container {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 10000;
  pointer-events: none;
}

.call-popup {
  position: relative;
  width: 360px;
  background: var(--bg2);
  border: 1px solid var(--brd);
  border-radius: var(--r-lg, 12px);
  box-shadow: 0 20px 60px rgba(0,0,0,0.5), 0 0 0 1px rgba(255,255,255,0.05);
  overflow: hidden;
  pointer-events: all;
  opacity: 0;
  transform: translateY(-20px) scale(0.95);
  transition: opacity 0.3s ease, transform 0.3s ease;
}

.call-popup--visible {
  opacity: 1;
  transform: translateY(0) scale(1);
}

.call-popup--ringing {
  border-color: var(--ok);
  box-shadow: 0 20px 60px rgba(0,0,0,0.5), 0 0 30px rgba(45,134,89,0.15);
}

.call-popup--connected {
  border-color: var(--blue);
  box-shadow: 0 20px 60px rgba(0,0,0,0.5), 0 0 30px rgba(30,77,140,0.15);
}

/* Pulsing ring indicator */
.call-popup-pulse {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--ok), var(--ok-t));
  animation: callPulse 1.5s ease-in-out infinite;
}

@keyframes callPulse {
  0%, 100% { opacity: 0.4; }
  50% { opacity: 1; }
}

.call-popup-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px;
}

.call-popup-avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--bg4);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  flex-shrink: 0;
  border: 2px solid var(--brd);
}

.call-popup-avatar--known {
  border-color: var(--gold);
  background: var(--gold-bg);
}

.call-popup-info {
  flex: 1;
  min-width: 0;
}

.call-popup-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ok-t);
  margin-bottom: 2px;
}

.call-popup--connected .call-popup-label {
  color: var(--blue-l);
}

.call-popup-name {
  font-size: 16px;
  font-weight: 600;
  color: var(--t1);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.call-popup-company {
  font-size: 12px;
  color: var(--t2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.call-popup-number {
  font-size: 12px;
  font-family: var(--mono, monospace);
  color: var(--t3);
  margin-top: 2px;
}

.call-popup-timer {
  font-size: 14px;
  font-family: var(--mono, monospace);
  font-weight: 600;
  color: var(--t2);
  white-space: nowrap;
}

.call-popup--ringing .call-popup-timer {
  color: var(--ok-t);
}

.call-popup--connected .call-popup-timer {
  color: var(--blue-l);
}

.call-popup-actions {
  display: flex;
  gap: 8px;
  padding: 0 16px 16px;
}

.call-popup-btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 12px;
  border: 1px solid var(--brd);
  border-radius: var(--r-md, 8px);
  background: var(--bg4);
  color: var(--t2);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
}

.call-popup-btn:hover {
  background: var(--bg5);
  color: var(--t1);
}

.call-popup-btn--accept {
  background: var(--ok);
  border-color: var(--ok);
  color: #fff;
}

.call-popup-btn--accept:hover {
  background: #35A06A;
  color: #fff;
}

.call-popup-btn--transfer {
  background: var(--blue-bg);
  border-color: var(--blue);
  color: var(--blue-l);
}

.call-popup-btn--transfer:hover {
  background: var(--blue);
  color: #fff;
}

.call-popup-btn--reject {
  flex: 0 0 44px;
  background: var(--red-bg);
  border-color: var(--red);
  color: var(--red-l);
}

.call-popup-btn--reject:hover {
  background: var(--red);
  color: #fff;
}

/* Transfer menu inside popup */
.call-popup-transfer-menu {
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-height: 180px;
  overflow-y: auto;
  margin-bottom: 8px;
}

.call-popup-transfer-item {
  display: block;
  width: 100%;
  text-align: left;
  padding: 8px 12px;
  border: 1px solid var(--brd);
  border-radius: var(--r-sm, 6px);
  background: var(--bg3);
  color: var(--t2);
  font-size: 13px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.call-popup-transfer-item:hover {
  background: var(--blue-bg);
  border-color: var(--blue);
  color: var(--t1);
}


/* ── Telephony Page ── */

.telephony-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 20px;
  background: var(--bg3);
  border-radius: var(--r-md, 8px);
  padding: 4px;
  border: 1px solid rgba(212, 168, 67, 0.15);
}

.telephony-tab {
  flex: 1;
  padding: 10px 16px;
  border: none;
  border-radius: var(--r-sm, 6px);
  background: transparent;
  color: var(--t3);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  text-align: center;
  position: relative;
}

.telephony-tab:hover {
  color: var(--t1);
  background: rgba(212, 168, 67, 0.06);
}

.telephony-tab--active {
  background: linear-gradient(135deg, rgba(30,77,140,0.15), rgba(200,41,59,0.08));
  color: var(--gold, #D4A843);
  box-shadow: 0 2px 8px rgba(30,77,140,0.1);
  border: 1px solid rgba(212, 168, 67, 0.15);
}

.telephony-tab--active::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 20%;
  right: 20%;
  height: 2px;
  background: linear-gradient(135deg, #C8293B, #1E4D8C);
  border-radius: 2px;
}

.telephony-tab-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 9px;
  background: var(--red);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  margin-left: 6px;
  vertical-align: middle;
}


/* ── Call Log Filters ── */

.telephony-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 16px;
  padding: 14px;
  background: var(--bg3);
  border-radius: var(--r-md, 8px);
  border: 1px solid var(--brd);
}

.telephony-filters select,
.telephony-filters input {
  padding: 8px 12px;
  border: 1px solid var(--brd);
  border-radius: var(--r-sm, 6px);
  background: var(--bg2);
  color: var(--t1);
  font-size: 13px;
  min-width: 140px;
}

.telephony-filters select:focus,
.telephony-filters input:focus {
  outline: none;
  border-color: var(--blue);
  box-shadow: 0 0 0 2px var(--blue-bg);
}


/* ── Call Log Table ── */

.call-log-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
}

.call-log-table thead th {
  padding: 10px 12px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--t3);
  background: var(--bg4);
  border-bottom: 1px solid var(--brd);
  text-align: left;
  white-space: nowrap;
  position: sticky;
  top: 0;
  z-index: 1;
}

.call-log-table thead th:first-child {
  border-radius: var(--r-sm, 6px) 0 0 0;
}

.call-log-table thead th:last-child {
  border-radius: 0 var(--r-sm, 6px) 0 0;
}

.call-log-table tbody tr {
  cursor: pointer;
  transition: background 0.12s ease;
}

.call-log-table tbody tr:hover {
  background: rgba(255,255,255,0.02);
}

.call-log-table tbody tr.call-row--missed {
  border-left: 3px solid var(--red);
}

.call-log-table tbody td {
  padding: 10px 12px;
  font-size: 13px;
  color: var(--t2);
  border-bottom: 1px solid var(--brd-m);
  vertical-align: middle;
}

.call-log-table tbody td:first-child {
  color: var(--t3);
  font-family: var(--mono, monospace);
  font-size: 12px;
  white-space: nowrap;
}


/* ── Direction Icons ── */

.call-dir {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  font-size: 14px;
  font-weight: 600;
}

.call-dir--inbound {
  background: var(--ok-bg);
  color: var(--ok-t);
}

.call-dir--outbound {
  background: var(--blue-bg);
  color: var(--blue-l);
}

.call-dir--missed {
  background: var(--red-bg);
  color: var(--red-l);
}

.call-dir--internal {
  background: var(--gold-bg);
  color: var(--gold-l);
}


/* ── Call Detail Panel (Slide-in) ── */

.call-detail-panel {
  position: fixed;
  top: 0;
  right: 0;
  width: 520px;
  height: 100vh;
  background: var(--bg2);
  border-left: 1px solid var(--brd);
  box-shadow: -10px 0 40px rgba(0,0,0,0.4);
  z-index: 5000;
  overflow-y: auto;
  transform: translateX(100%);
  transition: transform 0.3s ease;
}

.call-detail-panel--open {
  transform: translateX(0);
}

.call-detail-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  z-index: 4999;
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: none;
}

.call-detail-overlay--visible {
  opacity: 1;
  pointer-events: all;
}

.call-detail-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px;
  border-bottom: 1px solid var(--brd);
  background: var(--bg3);
}

.call-detail-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--t1);
}

.call-detail-close {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--brd);
  border-radius: 50%;
  background: var(--bg4);
  color: var(--t3);
  font-size: 18px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.call-detail-close:hover {
  background: var(--red-bg);
  color: var(--red-l);
  border-color: var(--red);
}

.call-detail-body {
  padding: 20px;
}

.call-detail-section {
  margin-bottom: 20px;
}

.call-detail-section-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--t3);
  margin-bottom: 10px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--brd-m);
}

.call-detail-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 6px 0;
}

.call-detail-label {
  font-size: 12px;
  color: var(--t3);
}

.call-detail-value {
  font-size: 13px;
  color: var(--t1);
  text-align: right;
  max-width: 300px;
  word-break: break-word;
}


/* ── Audio Player ── */

.audio-player {
  background: var(--bg3);
  border: 1px solid var(--brd);
  border-radius: var(--r-md, 8px);
  padding: 14px 16px;
}

.audio-player-controls {
  display: flex;
  align-items: center;
  gap: 12px;
}

.audio-player-play {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--blue);
  border: none;
  color: #fff;
  font-size: 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
  flex-shrink: 0;
}

.audio-player-play:hover {
  background: var(--blue-l);
  box-shadow: var(--blue-glow);
}

.audio-player-progress-wrap {
  flex: 1;
  height: 6px;
  background: var(--bg5);
  border-radius: 3px;
  cursor: pointer;
  position: relative;
  overflow: hidden;
}

.audio-player-progress-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--blue), var(--blue-l));
  border-radius: 3px;
  width: 0%;
  transition: width 0.1s linear;
}

.audio-player-time {
  font-size: 12px;
  font-family: var(--mono, monospace);
  color: var(--t3);
  white-space: nowrap;
  min-width: 70px;
  text-align: center;
}

.audio-player-speed {
  padding: 4px 10px;
  border: 1px solid var(--brd);
  border-radius: var(--r-sm, 6px);
  background: var(--bg4);
  color: var(--t2);
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}

.audio-player-speed:hover {
  background: var(--bg5);
  color: var(--t1);
}

.audio-player-download {
  width: 32px;
  height: 32px;
  border-radius: var(--r-sm, 6px);
  background: transparent;
  border: 1px solid var(--brd);
  color: var(--t3);
  font-size: 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
}

.audio-player-download:hover {
  background: var(--bg4);
  color: var(--t1);
}


/* ── Transcript Viewer ── */

.transcript-viewer {
  background: var(--bg3);
  border: 1px solid var(--brd);
  border-radius: var(--r-md, 8px);
  max-height: 400px;
  overflow-y: auto;
  padding: 4px;
}

.transcript-segment {
  display: flex;
  gap: 10px;
  padding: 8px 12px;
  border-radius: var(--r-sm, 6px);
  transition: background 0.15s ease;
}

.transcript-segment:hover {
  background: rgba(255,255,255,0.02);
}

.transcript-segment--active {
  background: var(--blue-bg) !important;
}

.transcript-segment-time {
  font-size: 11px;
  font-family: var(--mono, monospace);
  color: var(--t3);
  white-space: nowrap;
  min-width: 40px;
  padding-top: 2px;
  cursor: pointer;
}

.transcript-segment-time:hover {
  color: var(--blue-l);
}

.transcript-segment-speaker {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  min-width: 60px;
  padding-top: 2px;
}

.transcript-segment-speaker--0 {
  color: var(--blue-l);
}

.transcript-segment-speaker--1 {
  color: var(--gold-l);
}

.transcript-segment-text {
  font-size: 13px;
  color: var(--t1);
  line-height: 1.5;
  flex: 1;
}


/* ── AI Summary Card ── */

.ai-summary-card {
  background: linear-gradient(135deg, var(--bg3), var(--bg4));
  border: 1px solid var(--gold-bg);
  border-radius: var(--r-md, 8px);
  padding: 16px;
  position: relative;
  overflow: hidden;
}

.ai-summary-card::before {
  content: '🤖';
  position: absolute;
  top: 10px;
  right: 14px;
  font-size: 20px;
  opacity: 0.2;
}

.ai-summary-text {
  font-size: 13px;
  color: var(--t1);
  line-height: 1.6;
  margin-bottom: 10px;
}

.ai-summary-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.ai-summary-tag {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: var(--r-full, 20px);
  font-size: 11px;
  font-weight: 600;
}

.ai-summary-tag--target {
  background: var(--ok-bg);
  color: var(--ok-t);
  border: 1px solid rgba(45,134,89,0.2);
}

.ai-summary-tag--nontarget {
  background: var(--bg4);
  color: var(--t3);
  border: 1px solid var(--brd);
}

.ai-summary-tag--positive {
  background: var(--ok-bg);
  color: var(--ok-t);
}

.ai-summary-tag--negative {
  background: var(--red-bg);
  color: var(--red-l);
}

.ai-summary-tag--neutral {
  background: var(--blue-bg);
  color: var(--blue-l);
}


/* ── Missed Calls ── */

.missed-call-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  background: var(--bg3);
  border: 1px solid var(--brd);
  border-left: 3px solid var(--red);
  border-radius: var(--r-md, 8px);
  margin-bottom: 8px;
  transition: all 0.15s ease;
}

.missed-call-card:hover {
  background: var(--bg4);
  border-color: var(--red);
}

.missed-call-card--ack {
  border-left-color: var(--ok);
  opacity: 0.65;
}

.missed-call-icon {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--red-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
}

.missed-call-card--ack .missed-call-icon {
  background: var(--ok-bg);
}

.missed-call-info {
  flex: 1;
  min-width: 0;
}

.missed-call-number {
  font-size: 15px;
  font-weight: 600;
  color: var(--t1);
  font-family: var(--mono, monospace);
}

.missed-call-meta {
  font-size: 12px;
  color: var(--t3);
  margin-top: 2px;
}

.missed-call-actions {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}

.missed-call-btn {
  padding: 8px 14px;
  border: 1px solid var(--brd);
  border-radius: var(--r-sm, 6px);
  background: var(--bg4);
  color: var(--t2);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
}

.missed-call-btn:hover {
  background: var(--bg5);
  color: var(--t1);
}

.missed-call-btn--callback {
  background: var(--ok);
  border-color: var(--ok);
  color: #fff;
}

.missed-call-btn--callback:hover {
  background: #35A06A;
}


/* ── Stats Dashboard ── */

.telephony-dashboard {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}

.telephony-kpi {
  background: var(--bg3);
  border: 1px solid var(--brd);
  border-radius: var(--r-md, 8px);
  padding: 18px;
  text-align: center;
  transition: all 0.2s ease;
}

.telephony-kpi:hover {
  background: var(--bg4);
  border-color: rgba(255,255,255,0.1);
}

.telephony-kpi-icon {
  font-size: 24px;
  margin-bottom: 8px;
  opacity: 0.7;
}

.telephony-kpi-value {
  font-size: 28px;
  font-weight: 700;
  color: var(--t1);
  line-height: 1.2;
}

.telephony-kpi-label {
  font-size: 11px;
  color: var(--t3);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-top: 4px;
}

.telephony-chart-wrap {
  background: var(--bg3);
  border: 1px solid var(--brd);
  border-radius: var(--r-md, 8px);
  padding: 20px;
  margin-bottom: 20px;
}

.telephony-chart-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--t1);
  margin-bottom: 16px;
}


/* ── Routing Rules Editor ── */

.routing-rule-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  background: var(--bg3);
  border: 1px solid var(--brd);
  border-radius: var(--r-md, 8px);
  margin-bottom: 8px;
  transition: all 0.15s ease;
}

.routing-rule-card:hover {
  background: var(--bg4);
}

.routing-rule-priority {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--blue-bg);
  color: var(--blue-l);
  font-size: 13px;
  font-weight: 700;
  flex-shrink: 0;
}

.routing-rule-info {
  flex: 1;
  min-width: 0;
}

.routing-rule-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--t1);
}

.routing-rule-condition {
  font-size: 12px;
  color: var(--t3);
  margin-top: 2px;
}

.routing-rule-actions {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}

.routing-rule-toggle {
  position: relative;
  width: 40px;
  height: 22px;
  border-radius: 11px;
  border: none;
  cursor: pointer;
  transition: background 0.2s ease;
  background: var(--bg5);
}

.routing-rule-toggle::after {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #fff;
  transition: transform 0.2s ease;
}

.routing-rule-toggle--active {
  background: var(--ok);
}

.routing-rule-toggle--active::after {
  transform: translateX(18px);
}

.routing-rule-delete {
  width: 32px;
  height: 32px;
  border-radius: var(--r-sm, 6px);
  background: transparent;
  border: 1px solid var(--brd);
  color: var(--t3);
  font-size: 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
}

.routing-rule-delete:hover {
  background: var(--red-bg);
  color: var(--red-l);
  border-color: var(--red);
}


/* ── Managers Stats Table ── */

.managers-stats-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  background: var(--bg3);
  border: 1px solid var(--brd);
  border-radius: var(--r-md, 8px);
  overflow: hidden;
}

.managers-stats-table th {
  padding: 10px 14px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--t3);
  background: var(--bg4);
  text-align: left;
  border-bottom: 1px solid var(--brd);
}

.managers-stats-table td {
  padding: 10px 14px;
  font-size: 13px;
  color: var(--t2);
  border-bottom: 1px solid var(--brd-m);
}

.managers-stats-table tr:last-child td {
  border-bottom: none;
}

.managers-stats-table tr:hover td {
  background: rgba(255,255,255,0.02);
}


/* ── Pagination (reuse pattern) ── */

.telephony-pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 16px 0;
}

.telephony-pagination button {
  padding: 6px 12px;
  border: 1px solid var(--brd);
  border-radius: var(--r-sm, 6px);
  background: var(--bg3);
  color: var(--t2);
  font-size: 13px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.telephony-pagination button:hover {
  background: var(--bg4);
  color: var(--t1);
}

.telephony-pagination button:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.telephony-pagination .page-info {
  font-size: 12px;
  color: var(--t3);
  padding: 0 8px;
}


/* ── Telephony Badge in sidebar ── */

.nav-telephony-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 9px;
  background: var(--red);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  margin-left: auto;
  animation: badgePulse 2s ease-in-out infinite;
}

@keyframes badgePulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(200,41,59,0.3); }
  50% { box-shadow: 0 0 0 4px rgba(200,41,59,0); }
}


/* ── Empty states ── */

.telephony-empty {
  text-align: center;
  padding: 60px 20px;
  color: var(--t3);
}

.telephony-empty-icon {
  font-size: 48px;
  margin-bottom: 16px;
  opacity: 0.3;
}

.telephony-empty-text {
  font-size: 14px;
  line-height: 1.6;
}


/* ── Status badges ── */

.call-status-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: var(--r-full, 20px);
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}

.call-status-badge--done {
  background: var(--ok-bg);
  color: var(--ok-t);
}

.call-status-badge--processing {
  background: var(--warn-bg);
  color: var(--warn-t);
}

.call-status-badge--error {
  background: var(--red-bg);
  color: var(--red-l);
}

.call-status-badge--none {
  background: var(--bg4);
  color: var(--t3);
}


/* ── Sentiment indicator ── */

.sentiment-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-right: 4px;
}

.sentiment-dot--positive { background: var(--ok-t); }
.sentiment-dot--negative { background: var(--red-l); }
.sentiment-dot--neutral { background: var(--blue-l); }


/* ==========================================================================
 *  TELEPHONY PREMIUM CSS v2.0
 *  Skeleton loaders, tooltips, animations, dark theme, drag-and-drop
 * ========================================================================== */

/* -- Skeleton Loaders --------------------------------------------------- */
.skeleton {
  background: linear-gradient(90deg,
    var(--bg3, #f0f0f0) 25%,
    var(--bg4, #e0e0e0) 50%,
    var(--bg3, #f0f0f0) 75%);
  background-size: 200% 100%;
  animation: skeleton-shimmer 1.5s ease-in-out infinite;
  border-radius: 4px;
  color: transparent !important;
  user-select: none;
  pointer-events: none;
}
.skeleton * { visibility: hidden; }

@keyframes skeleton-shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

.skeleton-row {
  display: flex;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--brd, #e5e7eb);
}

.skeleton-bar {
  height: 14px;
  border-radius: 4px;
  background: linear-gradient(90deg,
    var(--bg3, #f0f0f0) 25%,
    var(--bg4, #e0e0e0) 50%,
    var(--bg3, #f0f0f0) 75%);
  background-size: 200% 100%;
  animation: skeleton-shimmer 1.5s ease-in-out infinite;
}
.skeleton-bar--sm  { width: 60px; }
.skeleton-bar--md  { width: 120px; }
.skeleton-bar--lg  { width: 200px; }
.skeleton-bar--xl  { width: 280px; }
.skeleton-bar--icon { width: 24px; height: 24px; border-radius: 50%; }

.skeleton-kpi {
  height: 90px;
  border-radius: 12px;
  background: linear-gradient(90deg,
    var(--bg3, #f0f0f0) 25%,
    var(--bg4, #e0e0e0) 50%,
    var(--bg3, #f0f0f0) 75%);
  background-size: 200% 100%;
  animation: skeleton-shimmer 1.5s ease-in-out infinite;
}

.skeleton-chart {
  height: 260px;
  border-radius: 12px;
  margin-top: 16px;
  background: linear-gradient(90deg,
    var(--bg3, #f0f0f0) 25%,
    var(--bg4, #e0e0e0) 50%,
    var(--bg3, #f0f0f0) 75%);
  background-size: 200% 100%;
  animation: skeleton-shimmer 1.5s ease-in-out infinite;
}

.skeleton-card {
  height: 72px;
  border-radius: 10px;
  margin-bottom: 8px;
  background: linear-gradient(90deg,
    var(--bg3, #f0f0f0) 25%,
    var(--bg4, #e0e0e0) 50%,
    var(--bg3, #f0f0f0) 75%);
  background-size: 200% 100%;
  animation: skeleton-shimmer 1.5s ease-in-out infinite;
}

/* -- CSS-Only Tooltips --------------------------------------------------- */
[data-tooltip] {
  position: relative;
  cursor: default;
}

[data-tooltip]::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%) scale(0.92);
  padding: 5px 12px;
  background: var(--bg1, #1e1e2e);
  color: #fff;
  font-size: 11.5px;
  font-weight: 500;
  letter-spacing: 0.01em;
  line-height: 1.4;
  border-radius: 6px;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.18s ease, transform 0.18s ease;
  z-index: 9999;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

[data-tooltip]::before {
  content: "";
  position: absolute;
  bottom: calc(100% + 2px);
  left: 50%;
  transform: translateX(-50%);
  border: 5px solid transparent;
  border-top-color: var(--bg1, #1e1e2e);
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.18s ease;
  z-index: 9999;
}

[data-tooltip]:hover::after,
[data-tooltip]:hover::before {
  opacity: 1;
  transform: translateX(-50%) scale(1);
}
[data-tooltip]:hover::before {
  transform: translateX(-50%);
}

[data-tooltip-pos="bottom"]::after {
  bottom: auto;
  top: calc(100% + 8px);
}
[data-tooltip-pos="bottom"]::before {
  bottom: auto;
  top: calc(100% + 2px);
  border-top-color: transparent;
  border-bottom-color: var(--bg1, #1e1e2e);
}

/* -- Tab Transition Animations ------------------------------------------- */
#telContent {
  transition: opacity 0.18s ease, transform 0.12s ease;
  will-change: opacity, transform;
}
#telContent.tab-fade-out {
  opacity: 0;
  transform: translateY(6px);
}
#telContent.tab-fade-in {
  opacity: 1;
  transform: translateY(0);
}

/* -- Chart Tooltip (floating) -------------------------------------------- */
.chart-tooltip {
  position: fixed;
  z-index: 9999;
  pointer-events: none;
  background: var(--bg1, #1e1e2e);
  color: #fff;
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 12px;
  line-height: 1.6;
  box-shadow: 0 8px 24px rgba(0,0,0,0.18);
  white-space: nowrap;
  opacity: 0;
  transition: opacity 0.12s ease;
}
.chart-tooltip.visible { opacity: 1; }
.chart-tooltip-title {
  font-weight: 600;
  margin-bottom: 4px;
  color: rgba(255,255,255,0.7);
  font-size: 11px;
}
.chart-tooltip-row {
  display: flex;
  align-items: center;
  gap: 8px;
}
.chart-tooltip-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}
.chart-tooltip-value {
  font-weight: 600;
  margin-left: auto;
  padding-left: 12px;
}

/* -- Chart Legend --------------------------------------------------------- */
.chart-legend {
  display: flex;
  gap: 20px;
  justify-content: center;
  margin-bottom: 12px;
  flex-wrap: wrap;
}
.chart-legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--t2, #6b7280);
  cursor: default;
}
.chart-legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

/* -- Drag-and-Drop Routing ----------------------------------------------- */
.routing-rule-card {
  cursor: grab;
  transition: transform 0.2s ease, box-shadow 0.2s ease, opacity 0.2s ease;
}
.routing-rule-card:active { cursor: grabbing; }
.routing-rule-card--dragging {
  opacity: 0.4;
  transform: scale(0.97);
  box-shadow: none !important;
}
.routing-rule-card--drag-above {
  border-top: 3px solid var(--blue, #3b82f6) !important;
  padding-top: 9px;
}
.routing-rule-card--drag-below {
  border-bottom: 3px solid var(--blue, #3b82f6) !important;
  padding-bottom: 9px;
}
.routing-drag-handle {
  display: flex;
  align-items: center;
  padding: 0 8px;
  color: var(--t2, #6b7280);
  cursor: grab;
  user-select: none;
  font-size: 16px;
  letter-spacing: 2px;
  opacity: 0.4;
  transition: opacity 0.15s;
}
.routing-rule-card:hover .routing-drag-handle { opacity: 1; }

/* -- Enhanced Transcript Viewer ------------------------------------------ */
.transcript-viewer {
  max-height: 400px;
  overflow-y: auto;
  border-radius: 8px;
  border: 1px solid var(--brd, #e5e7eb);
  background: var(--bg2, #fafafa);
}
.transcript-text {
  white-space: pre-wrap;
  word-break: break-word;
  font-family: "JetBrains Mono", "Fira Code", "Consolas", monospace;
  font-size: 13px;
  line-height: 1.7;
  color: var(--t1, #1f2937);
  padding: 16px;
  margin: 0;
}
.transcript-line {
  padding: 6px 16px;
  border-bottom: 1px solid var(--brd, #f0f0f0);
  display: flex;
  gap: 10px;
  align-items: flex-start;
  transition: background 0.15s;
}
.transcript-line:hover { background: var(--bg3, #f5f5f5); }
.transcript-line:last-child { border-bottom: none; }
.transcript-speaker {
  font-weight: 600;
  font-size: 12px;
  padding: 2px 8px;
  border-radius: 4px;
  white-space: nowrap;
  flex-shrink: 0;
  min-width: 80px;
  text-align: center;
}
.transcript-speaker--client {
  background: rgba(59, 130, 246, 0.1);
  color: var(--blue, #3b82f6);
}
.transcript-speaker--manager {
  background: rgba(34, 197, 94, 0.1);
  color: var(--green, #22c55e);
}
.transcript-copy-btn {
  margin-left: 8px;
  padding: 2px 8px !important;
  font-size: 12px !important;
  opacity: 0.6;
  transition: opacity 0.15s;
}
.transcript-copy-btn:hover { opacity: 1; }

/* -- Enhanced Missed Call Cards ------------------------------------------- */
.missed-call-card--new {
  border-left: 3px solid var(--red, #ef4444);
  animation: missed-pulse 2s ease-in-out 3;
}
@keyframes missed-pulse {
  0%, 100% { background: var(--bg2, #fff); }
  50% { background: rgba(239, 68, 68, 0.04); }
}
.missed-call-btn--callback {
  background: var(--green, #22c55e) !important;
  color: #fff !important;
  border: none !important;
  transition: background 0.2s, transform 0.1s !important;
}
.missed-call-btn--callback:hover {
  background: var(--green-d, #16a34a) !important;
  transform: scale(1.03);
}
.missed-call-btn--callback:active { transform: scale(0.98); }

/* -- Status Badge animation ---------------------------------------------- */
.call-status-badge--processing {
  position: relative;
  overflow: hidden;
}
.call-status-badge--processing::after {
  content: "";
  position: absolute;
  top: 0; left: -100%;
  width: 100%; height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3), transparent);
  animation: status-processing-shimmer 2s infinite;
}
@keyframes status-processing-shimmer {
  0%   { left: -100%; }
  100% { left: 100%; }
}

/* -- Pagination Buttons -------------------------------------------------- */
.pagination-btn {
  min-width: 36px;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--brd, #e5e7eb);
  background: var(--bg2, #fff);
  color: var(--t1, #374151);
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  margin: 0 2px;
  transition: all 0.15s ease;
}
.pagination-btn:hover {
  background: var(--bg3, #f3f4f6);
  border-color: var(--blue, #3b82f6);
  color: var(--blue, #3b82f6);
}
.pagination-btn--active {
  background: var(--blue, #3b82f6);
  color: #fff;
  border-color: var(--blue, #3b82f6);
}
.telephony-pagination {
  display: flex;
  justify-content: center;
  gap: 4px;
  padding: 16px 0;
}

/* -- Detail Info Table --------------------------------------------------- */
.detail-info-table {
  width: 100%;
  border-collapse: collapse;
}
.detail-info-table td {
  padding: 8px 12px;
  border-bottom: 1px solid var(--brd, #f0f0f0);
  font-size: 13.5px;
}
.detail-info-table td:first-child {
  color: var(--t2, #6b7280);
  font-weight: 500;
  width: 140px;
  white-space: nowrap;
}
.detail-info-table tr:last-child td { border-bottom: none; }

/* -- Enhanced Audio Player ----------------------------------------------- */
.audio-player {
  border-radius: 12px;
  overflow: hidden;
  background: var(--bg2, #f9fafb);
  border: 1px solid var(--brd, #e5e7eb);
}
.audio-player-controls {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
}
#apPlay {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: none;
  background: var(--blue, #3b82f6);
  color: #fff;
  font-size: 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s, transform 0.1s;
  flex-shrink: 0;
}
#apPlay:hover { background: var(--blue-d, #2563eb); transform: scale(1.05); }
#apPlay:active { transform: scale(0.95); }
#apPlay:disabled { background: var(--bg4, #d1d5db); cursor: not-allowed; transform: none; }
#apTime {
  font-size: 13px;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  color: var(--t1, #374151);
  min-width: 100px;
}
#apSpeed, #apDownload {
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 600;
  border-radius: 6px;
  border: 1px solid var(--brd, #e5e7eb);
  background: var(--bg2, #fff);
  color: var(--t1, #374151);
  cursor: pointer;
  transition: all 0.15s;
}
#apSpeed:hover, #apDownload:hover {
  background: var(--bg3, #f3f4f6);
  border-color: var(--blue, #3b82f6);
  color: var(--blue, #3b82f6);
}

/* -- Micro-interactions -------------------------------------------------- */
.telephony-tab { transition: all 0.2s ease; }
.telephony-tab:active { transform: scale(0.97); }
.telephony-tab--active { transform: translateY(-1px); }
.telephony-kpi { transition: transform 0.2s ease, box-shadow 0.2s ease; }
.telephony-kpi:hover { transform: translateY(-2px); box-shadow: 0 8px 24px rgba(0,0,0,0.08); }
.telephony-filters .btn--primary { transition: background 0.2s, transform 0.1s; }
.telephony-filters .btn--primary:active { transform: scale(0.97); }

/* -- Smooth scrollbar ---------------------------------------------------- */
.transcript-viewer::-webkit-scrollbar { width: 6px; }
.transcript-viewer::-webkit-scrollbar-track { background: transparent; }
.transcript-viewer::-webkit-scrollbar-thumb { background: var(--brd, #d1d5db); border-radius: 3px; }
.transcript-viewer::-webkit-scrollbar-thumb:hover { background: var(--t2, #9ca3af); }

/* -- Dark Theme Support -------------------------------------------------- */
@media (prefers-color-scheme: dark) {
  .skeleton, .skeleton-bar, .skeleton-kpi, .skeleton-chart, .skeleton-card {
    background: linear-gradient(90deg, var(--bg3,#2a2a3a) 25%, var(--bg4,#3a3a4a) 50%, var(--bg3,#2a2a3a) 75%);
    background-size: 200% 100%;
  }
  [data-tooltip]::after { background: var(--bg2,#2a2a3a); box-shadow: 0 4px 12px rgba(0,0,0,0.4); }
  [data-tooltip]::before { border-top-color: var(--bg2,#2a2a3a); }
  .chart-tooltip { background: var(--bg2,#2a2a3a); box-shadow: 0 8px 24px rgba(0,0,0,0.4); }
  .call-log-table tbody tr:hover { background: rgba(255,255,255,0.04); }
  .transcript-line:hover { background: rgba(255,255,255,0.04); }
  .transcript-text { color: var(--t1,#e0e0e0); }
}

[data-theme="dark"] .skeleton, [data-theme="dark"] .skeleton-bar,
[data-theme="dark"] .skeleton-kpi, [data-theme="dark"] .skeleton-chart,
[data-theme="dark"] .skeleton-card {
  background: linear-gradient(90deg, var(--bg3,#2a2a3a) 25%, var(--bg4,#3a3a4a) 50%, var(--bg3,#2a2a3a) 75%);
  background-size: 200% 100%;
}
[data-theme="dark"] [data-tooltip]::after { background: var(--bg2,#2a2a3a); }
[data-theme="dark"] [data-tooltip]::before { border-top-color: var(--bg2,#2a2a3a); }

/* -- Responsive premium -------------------------------------------------- */
@media (max-width: 768px) {
  .chart-legend { gap: 12px; font-size: 11px; }
  .chart-tooltip { font-size: 11px; padding: 8px 10px; }
  [data-tooltip]::after { font-size: 10px; padding: 3px 8px; }
  .transcript-line { flex-direction: column; gap: 4px; }
  .transcript-speaker { align-self: flex-start; }
  .routing-drag-handle { display: none; }
  .telephony-pagination { flex-wrap: wrap; }
}

/* ─── Audit v2: Missing CSS classes ─── */

/* responsive-cards — mobile card view for tables (ui.js makeResponsiveTable) */
@media (max-width: 768px) {
  table.responsive-cards thead { display: none; }
  table.responsive-cards tbody tr {
    display: block; margin-bottom: 12px; padding: 12px;
    border: 1px solid var(--brd); border-radius: var(--r-md); background: var(--bg2);
  }
  table.responsive-cards tbody td {
    display: flex; justify-content: space-between; padding: 4px 0;
    border: none; font-size: 13px;
  }
  table.responsive-cards tbody td::before {
    content: attr(data-label); font-weight: 700; color: var(--t2); margin-right: 8px;
  }
}

/* shake — PIN error animation (session-guard.js) */
.shake { animation: shake-x 0.4s ease-in-out; }
@keyframes shake-x {
  0%, 100% { transform: translateX(0); }
  20%, 60% { transform: translateX(-8px); }
  40%, 80% { transform: translateX(8px); }
}

/* hiding — overlay fade-out (offline-guard.js) */
.hiding {
  opacity: 0;
  transition: opacity 0.3s ease-out;
  pointer-events: none;
}

/* is-open — Mimir FAB active state (mimir.js) */
#mimirFab.is-open {
  transform: rotate(45deg);
  background: var(--bg3);
}
