:root {
  --bg-main: #0f1012;
  --bg-panel: #181a1e;
  --bg-panel-soft: #23262c;
  --bg-elevated: #1c1e24;
  --bg-input: #1e2128;
  --text-main: #f1f3f5;
  --text-muted: #8b929e;
  --text-subtle: #6b7280;
  --line: #2d3139;
  --line-soft: #25282f;
  --accent: #f3372b;
  --accent-hover: #ff4d42;
  --accent-dark: #d91000;
  --accent-mid: #ab2416;
  --accent-glow: rgba(243, 55, 43, 0.15);
  --good: #22c55e;
  --good-soft: rgba(34, 197, 94, 0.12);
  --warn: #f59e0b;
  --warn-soft: rgba(245, 158, 11, 0.12);
  --bad: #ef4444;
  --bad-soft: rgba(239, 68, 68, 0.12);
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.25);
  --shadow-md: 0 4px 20px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.35);
}

/* Dark theme: усиленный контраст, чтобы элементы не сливались */
body.theme-dark,
body:not(.theme-light) {
  --bg-main: #0a0c0f;
  --bg-panel: #1a1d24;
  --bg-panel-soft: #232830;
  --bg-elevated: #21252d;
  --bg-input: #252a34;
  --line: #363d4a;
  --line-soft: #2d3340;
}

body.theme-light {
  --bg-main: #e8ecf2;
  --bg-panel: #ffffff;
  --bg-panel-soft: #eef2f7;
  --bg-elevated: #ffffff;
  --bg-input: #f1f5f9;
  --text-main: #1e293b;
  --text-muted: #475569;
  --text-subtle: #64748b;
  --line: #cbd5e1;
  --line-soft: #e2e8f0;
  --accent-glow: rgba(243, 55, 43, 0.12);
  --shadow-sm: 0 2px 8px rgba(30, 50, 90, 0.08);
  --shadow-md: 0 4px 20px rgba(30, 50, 90, 0.1);
  --shadow-lg: 0 8px 32px rgba(30, 50, 90, 0.12);
}

* { box-sizing: border-box; }

html { overflow-x: hidden; min-height: 100%; }
body {
  margin: 0;
  min-width: 0;
  min-height: 100vh;
  overflow-x: hidden;
  font-family: "Plus Jakarta Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 15px;
  line-height: 1.55;
  letter-spacing: -0.01em;
  background: var(--bg-main);
  color: var(--text-main);
  -webkit-font-smoothing: antialiased;
}
body.theme-dark,
body:not(.theme-light) {
  background-color: #07090b;
  background-image:
    radial-gradient(ellipse 90% 60% at 15% 15%, rgba(243, 55, 43, 0.12) 0%, transparent 45%),
    radial-gradient(ellipse 70% 50% at 85% 20%, rgba(99, 102, 241, 0.08) 0%, transparent 45%),
    radial-gradient(ellipse 100% 70% at 5% 95%, rgba(30, 58, 138, 0.06) 0%, transparent 45%),
    radial-gradient(circle at center, rgba(255, 255, 255, 0.04) 1px, transparent 1px),
    linear-gradient(175deg, #080a0d 0%, #0c0f14 25%, #0e1116 50%, #0a0c10 100%);
  background-size: 100% 100%, 100% 100%, 100% 100%, 28px 28px, 100% 100%;
  background-position: 0 0, 0 0, 0 0, 0 0, 0 0;
  background-attachment: fixed;
}
body.theme-light {
  background-color: #e2e8f0;
  background-image:
    radial-gradient(ellipse 70% 40% at 10% 5%, rgba(243, 55, 43, 0.03) 0%, transparent 45%),
    radial-gradient(ellipse 50% 35% at 95% 15%, rgba(99, 102, 241, 0.02) 0%, transparent 40%),
    radial-gradient(ellipse 80% 50% at 100% 100%, rgba(203, 213, 225, 0.5) 0%, transparent 50%),
    radial-gradient(circle at center, rgba(30, 41, 59, 0.04) 1px, transparent 1px),
    linear-gradient(165deg, #eef2f7 0%, #e8ecf2 35%, #e2e8f0 100%);
  background-size: 100% 100%, 100% 100%, 100% 100%, 24px 24px, 100% 100%;
  background-position: 0 0, 0 0, 0 0, 0 0, 0 0;
  background-attachment: fixed;
}
body::before {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background: radial-gradient(ellipse 120% 80% at 50% 50%, rgba(243, 55, 43, 0.04) 0%, transparent 55%);
  animation: bg-breathe 180s ease-in-out infinite;
  will-change: opacity;
}
body.theme-light::before {
  background: radial-gradient(ellipse 120% 80% at 50% 50%, rgba(243, 55, 43, 0.015) 0%, transparent 50%);
}
@keyframes bg-breathe {
  0%, 100% { opacity: 0.9; transform: scale(1); }
  50% { opacity: 1; transform: scale(1.02); }
}

a {
  color: var(--accent);
  text-decoration: none;
  transition: color 0.2s ease;
}
a:hover { color: var(--accent-hover); }

.app-shell {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-rows: 56px 1fr;
  grid-template-columns: auto 1fr;
  grid-template-areas: "topbar topbar" "sidebar content";
  height: 100vh;
  overflow: hidden;
}
.app-topbar { grid-area: topbar; }
.sidebar { grid-area: sidebar; }
.content { grid-area: content; }
#main-content {
  grid-area: content;
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
  /* Фон как у .content — убирает белое мигание при смене страницы/чата */
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.02) 0%, transparent 30%);
}
body.theme-light #main-content {
  background: #e8ecf2;
}
#main-content > .content,
#main-content > main.content {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  animation: mainContentFadeIn 0.15s ease-out;
}
@keyframes mainContentFadeIn {
  from { opacity: 0.6; }
  to { opacity: 1; }
}
#main-content.turbo-frame-updating {
  contain: layout;
}
.sidebar-overlay { grid-column: 1 / -1; grid-row: 1 / -1; }

/* Topbar */
.app-topbar {
  flex-shrink: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 0 20px;
  background: linear-gradient(180deg, rgba(26, 28, 35, 0.95) 0%, var(--bg-panel) 100%);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}
body.theme-light .app-topbar {
  background: #fff;
  border-bottom: 1px solid #cbd5e1;
  border-bottom-color: var(--line);
}
body.theme-light .topbar-search-input {
  background: #f8fafc;
  border-color: #cbd5e1;
}
body.theme-light .topbar-online-btn,
body.theme-light .topbar-chat-status,
body.theme-light .topbar-profile-btn {
  background: #f8fafc;
  border-color: #cbd5e1;
}
body.theme-light .topbar-online-btn:hover,
body.theme-light .topbar-chat-status:hover {
  background: #e2e8f0;
  border-color: #94a3b8;
}
body.theme-light .topbar-profile-btn:hover {
  background: #e2e8f0;
  border-color: #94a3b8;
}
body.theme-light .topbar-search-results {
  background: #fff;
  border: 1px solid #cbd5e1;
}
.topbar-left, .topbar-right { display: flex; align-items: center; gap: 12px; }
.topbar-center { flex: 1; max-width: 480px; margin: 0 16px; }
.topbar-burger {
  width: 40px; height: 40px; border: none; background: rgba(255,255,255,0.08);
  color: var(--text-main); border-radius: 10px; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}
.topbar-burger svg { width: 22px; height: 22px; }
body.theme-light .topbar-burger { background: #f1f5f9; color: #334155; }
body.theme-light .topbar-burger:hover { background: #e2e8f0; }
.topbar-brand {
  display: flex; align-items: center; gap: 8px;
  text-decoration: none; color: var(--text-main); font-weight: 600; font-size: 16px;
}
.topbar-brand-dot {
  width: 12px; height: 12px; border-radius: 6px;
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-dark) 100%);
}
.topbar-search-wrap {
  position: relative; width: 100%;
}
.topbar-search-icon {
  position: absolute; left: 14px; top: 50%; transform: translateY(-50%);
  width: 18px; height: 18px; color: var(--text-muted);
}
.topbar-search-input {
  width: 100%; padding: 10px 14px 10px 42px;
  border: 1px solid var(--line); border-radius: 10px;
  background: var(--bg-input); color: var(--text-main); font-size: 14px;
}
.topbar-search-input:focus {
  outline: none; border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-glow);
}
.topbar-search-results {
  position: fixed; top: auto; left: auto;
  min-width: 320px; max-width: 480px; max-height: 420px;
  background: linear-gradient(180deg, #23262c 0%, #1c1e24 100%);
  border: 1px solid #363c4a; border-radius: 12px;
  overflow-y: auto; display: none; box-shadow: var(--shadow-lg);
  z-index: 10002;
}
.topbar-search-results.open { display: block; }
.topbar-online-wrap { position: relative; }
.topbar-online-btn {
  display: flex; align-items: center; gap: 6px;
  padding: 8px 12px; border: 1px solid var(--line); border-radius: 10px;
  background: var(--bg-input); color: var(--text-muted); font-size: 13px;
  cursor: pointer; transition: background 0.2s, border-color 0.2s;
}
.topbar-online-btn:hover { background: var(--bg-elevated); color: var(--text-main); }
.topbar-online-dropdown {
  position: absolute; top: calc(100% + 8px); right: 0;
  min-width: 220px; max-height: 320px;
  background: var(--bg-elevated); border: 1px solid var(--line);
  border-radius: 12px; box-shadow: var(--shadow-lg);
  overflow-y: auto; display: none; z-index: 10002;
}
.topbar-online-dropdown.open { display: block; }
.topbar-online-header {
  padding: 12px 14px; font-size: 11px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-muted);
  border-bottom: 1px solid var(--line);
}
.topbar-online-list { list-style: none; margin: 0; padding: 8px; }
.topbar-online-list li a, .topbar-online-list li span {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px; border-radius: 8px;
  color: var(--text-main); text-decoration: none; font-size: 13px;
}
.topbar-online-list li a:hover { background: var(--bg-input); color: inherit; }
.topbar-online-avatar {
  width: 28px; height: 28px; border-radius: 50%; overflow: hidden; flex-shrink: 0;
  background: var(--bg-input); display: flex; align-items: center; justify-content: center;
}
.topbar-online-avatar img { width: 100%; height: 100%; object-fit: cover; }
.topbar-online-avatar span {
  font-size: 12px; font-weight: 600; color: #fff;
}
.topbar-online-avatar:not(:has(img)) {
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-dark) 100%);
}
.topbar-online-empty { padding: 16px; margin: 0; font-size: 13px; color: var(--text-muted); }
.topbar-chat-status {
  width: 40px; height: 40px; border: 1px solid var(--line); border-radius: 10px;
  background: var(--bg-input); color: var(--text-muted); cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: background 0.2s, border-color 0.2s, color 0.2s;
}
.topbar-chat-status:hover { background: var(--bg-elevated); color: var(--text-main); }
.topbar-chat-status.is-online { border-color: rgba(34,197,94,0.4); color: #4ade80; }
.topbar-chat-status svg { width: 20px; height: 20px; }
.topbar-profile-wrap { position: relative; }
.topbar-profile-btn {
  display: flex; align-items: center; gap: 10px;
  padding: 6px 12px 6px 6px; border: 1px solid var(--line); border-radius: 12px;
  background: var(--bg-input); color: var(--text-main); font-size: 14px;
  cursor: pointer; transition: background 0.2s, border-color 0.2s;
}
.topbar-profile-btn:hover { background: var(--bg-elevated); border-color: var(--line); }
.topbar-profile-avatar {
  width: 32px; height: 32px; border-radius: 50%; object-fit: cover;
}
.topbar-profile-initial {
  width: 32px; height: 32px; border-radius: 50%;
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-dark) 100%);
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; font-weight: 700; color: #fff;
}
.topbar-profile-chevron { width: 16px; height: 16px; color: var(--text-muted); transition: transform 0.2s; }
.topbar-profile-dropdown {
  position: absolute; top: calc(100% + 8px); right: 0;
  min-width: 200px; background: var(--bg-elevated); border: 1px solid var(--line);
  border-radius: 12px; box-shadow: var(--shadow-lg); padding: 8px;
  display: none; z-index: 10002;
}
.topbar-profile-dropdown.open { display: block; }
.topbar-profile-dropdown a {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; border-radius: 8px; color: var(--text-main);
  text-decoration: none; font-size: 14px; transition: background 0.2s;
}
.topbar-profile-dropdown a:hover { background: var(--bg-input); color: var(--accent); }
.topbar-profile-dropdown a svg { width: 18px; height: 18px; opacity: 0.8; }
.topbar-profile-divider { height: 1px; background: var(--line); margin: 8px 0; }
.topbar-profile-lang, .topbar-profile-theme {
  display: flex; gap: 4px; padding: 4px 0;
}
.topbar-profile-lang a, .topbar-profile-theme a {
  padding: 6px 10px; border-radius: 8px; font-size: 13px;
  color: var(--text-muted); text-decoration: none;
}
.topbar-profile-lang a.active, .topbar-profile-theme a.active { color: var(--accent); background: var(--accent-glow); }
.topbar-profile-theme a { padding: 6px 8px; }
.topbar-logout-form { margin: 0; padding: 0; }
.topbar-logout-form button {
  display: flex; align-items: center; gap: 10px; width: 100%;
  padding: 10px 12px; border: none; border-radius: 8px;
  background: transparent; color: var(--text-muted); font-size: 14px; cursor: pointer;
  transition: background 0.2s, color 0.2s;
}
.topbar-logout-form button:hover { background: var(--bad-soft); color: var(--bad); }
.topbar-logout-form button svg { width: 18px; height: 18px; }

.sidebar {
  position: relative;
  width: 260px;
  min-height: 0;
  flex-shrink: 0;
  padding: 10px 8px;
  background: linear-gradient(180deg, rgba(22, 25, 31, 0.98) 0%, var(--bg-panel) 100%);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-right: 1px solid var(--line);
  box-shadow: 4px 0 24px rgba(0, 0, 0, 0.2);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: width 0.2s ease, padding 0.2s ease;
}
.sidebar.collapsed {
  width: 80px;
  padding: 52px 10px 12px 10px;
}
.sidebar.collapsed .sidebar-toggle { top: 8px; left: 50%; right: auto; transform: translateX(-50%); }
.sidebar.collapsed .sidebar-toggle svg { transform: rotate(180deg); }
.sidebar-toggle {
  position: absolute;
  top: 12px;
  right: 8px;
  width: 40px;
  height: 40px;
  border: none;
  background: rgba(255,255,255,0.08);
  color: var(--text-muted);
  border-radius: 10px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s, color 0.2s;
}
.sidebar-toggle:hover { background: rgba(255,255,255,0.12); color: var(--text-main); }
.sidebar-toggle svg { width: 18px; height: 18px; transition: transform 0.2s; }
.sidebar.collapsed .nav-primary-label { display: none; }
.sidebar.collapsed .nav-primary-items a {
  width: 40px; height: 40px; min-width: 40px; min-height: 40px;
  padding: 0; justify-content: center;
}
.sidebar.collapsed .nav-primary-items .nav-label,
.sidebar.collapsed .nav-primary-items .nav-badge-new { max-width: 0; overflow: hidden; }
.sidebar.collapsed .nav-label,
.sidebar.collapsed .nav-group-label {
  max-width: 0;
  overflow: hidden;
  opacity: 0;
  pointer-events: none;
  padding: 0;
  margin: 0;
  border: none;
  white-space: nowrap;
}
.sidebar.collapsed .sidebar-nav { margin-top: 0; margin-right: 0; padding: 8px 10px 0 10px; align-items: center; }
.sidebar.collapsed .sidebar-nav a {
  width: 40px; height: 40px; min-width: 40px; min-height: 40px;
  padding: 0; justify-content: center; align-items: center; min-width: 0;
  box-sizing: border-box;
}
.sidebar.collapsed .sidebar-nav .nav-icon-wrap { margin: 0; flex-shrink: 0; }
.sidebar.collapsed .nav-group-collapsible { margin-bottom: 2px; }
.sidebar.collapsed .nav-group-chevron { display: none; }
.sidebar.collapsed .nav-group-toggle {
  width: 40px; height: 40px; min-width: 40px; min-height: 40px;
  padding: 0; justify-content: center; align-items: center;
  margin-top: 4px; box-sizing: border-box;
}
.sidebar.collapsed .nav-group:first-child .nav-group-toggle { margin-top: 0; }
.sidebar.collapsed .nav-group-collapsible .nav-group-items { margin-left: 0; padding-left: 0; border-left: none; }
.sidebar.collapsed .nav-group-collapsible:not(.nav-group-expanded) .nav-group-items { display: none; }
.sidebar-user-block {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  margin-bottom: 10px;
  border-radius: 12px;
  background: #1a1c23;
  border: 1px solid #2a2d38;
  text-decoration: none;
  color: inherit;
  transition: background 0.2s ease, border-color 0.2s ease;
}
.sidebar-user-block:hover {
  background: var(--bg-elevated);
  border-color: var(--line);
}
body.theme-light .sidebar-user-block {
  background: #f1f5f9;
  border: 1px solid #cbd5e1;
}
body.theme-light .sidebar-user-block:hover {
  background: #e2e8f0;
  border-color: #94a3b8;
}
.sidebar-user-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  overflow: hidden;
  flex-shrink: 0;
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-dark) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
}
.sidebar-user-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.sidebar-user-initial {
  color: #fff;
  font-size: 18px;
  font-weight: 700;
  text-transform: uppercase;
}
.sidebar-user-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.sidebar-user-name {
  font-weight: 600;
  font-size: 14px;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sidebar-user-position {
  font-size: 11px;
  color: var(--text-muted);
}
.sidebar-user-login {
  font-size: 10px;
  color: var(--text-muted);
  opacity: 0.8;
}
body.theme-light .sidebar {
  background: #fff;
  border-right: 1px solid #cbd5e1;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-right: 1px solid var(--line);
}

.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 8px 10px;
  margin-bottom: 6px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  flex-shrink: 0;
  position: relative;
  padding-right: 44px;
}
.sidebar.collapsed .brand { padding: 8px; }
body.theme-light .brand {
  border-bottom: 1px solid #e4e9f4;
}
.brand-dot {
  width: 14px;
  height: 14px;
  border-radius: 6px;
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-dark) 100%);
}
.brand h2 {
  margin: 0;
  font-size: 18px;
  letter-spacing: 0.4px;
}
.brand small {
  color: var(--text-muted);
  font-size: 11px;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 0;
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  margin-top: 48px;
  margin-right: 8px;
  padding: 6px 2px 0 2px;
}
.sidebar-nav::-webkit-scrollbar {
  width: 6px;
}
.sidebar-nav::-webkit-scrollbar-track {
  background: transparent;
}
.sidebar-nav::-webkit-scrollbar-thumb {
  background: #3a3d48;
  border-radius: 3px;
}
body.theme-light .sidebar-nav::-webkit-scrollbar-thumb {
  background: #c8d0e0;
}
/* Primary nav: обращения и чат */
.nav-primary {
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}
.nav-primary-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-subtle);
  padding: 8px 10px 6px;
}
.nav-primary-items {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.nav-primary-items a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 8px;
  color: var(--text-main);
  text-decoration: none;
  transition: background 0.2s, color 0.2s;
}
.nav-primary-items a:hover {
  background: var(--bg-elevated);
}
.nav-primary-items a.active {
  background: rgba(243, 55, 43, 0.15);
  color: #fff;
  border: 1px solid rgba(243, 55, 43, 0.4);
}
body.theme-light .nav-primary-items a.active {
  background: rgba(243, 55, 43, 0.1);
  color: var(--accent);
  border-color: rgba(243, 55, 43, 0.3);
}
.nav-primary-items .nav-icon-plus { color: var(--accent); }
.nav-primary-items a.active .nav-icon-plus { color: inherit; }
.nav-group-more { margin-top: 4px; }
.nav-more-toggle { font-size: 12px !important; text-transform: none !important; letter-spacing: 0 !important; }

.nav-group {
  margin-bottom: 2px;
}
.nav-group-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 10px 10px;
  margin-top: 2px;
  min-width: 0;
  border: 1px solid #2d3140;
  border-radius: 8px;
  background: #1f2128;
  color: #ebecf0;
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s, color 0.2s;
  text-align: left;
}
.nav-group:first-child .nav-group-toggle { margin-top: 0; }
.nav-group-toggle:hover {
  background: linear-gradient(180deg, #2a2d38, #22252f);
  border-color: #3a3f50;
  color: var(--text-main);
}
.nav-group-expanded .nav-group-toggle {
  background: linear-gradient(180deg, #322329, #291f24);
  border-color: #7a3135;
  color: #fff;
}
body.theme-light .nav-group-toggle {
  background: #f5f8ff;
  border-color: #dbe3f2;
  color: #2b3342;
}
body.theme-light .nav-group-toggle:hover {
  background: #edf3ff;
  border-color: #cfdaf0;
}
body.theme-light .nav-group-expanded .nav-group-toggle {
  background: #ffe9e8;
  border-color: #f0b3af;
  color: #8f2019;
}
.nav-group-toggle .nav-icon-wrap { flex-shrink: 0; }
.nav-group-toggle .nav-group-label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav-group-chevron {
  display: flex;
  align-items: center;
  margin-left: auto;
  flex-shrink: 0;
  transition: transform 0.2s ease;
}
.nav-group-chevron svg { width: 14px; height: 14px; }
.nav-group-collapsible:not(.nav-group-expanded) .nav-group-chevron {
  transform: rotate(-90deg);
}
.nav-group-items {
  display: grid;
  gap: 2px;
  padding: 2px 0 2px 4px;
  border-left: 2px solid rgba(255,255,255,0.08);
  margin-left: 8px;
  max-height: 500px;
  overflow: hidden;
  transition: max-height 0.25s ease, opacity 0.2s ease;
}
.nav-group-collapsible:not(.nav-group-expanded) .nav-group-items {
  max-height: 0;
  padding-top: 0;
  padding-bottom: 0;
  margin-left: 12px;
  border-left-color: transparent;
  opacity: 0;
}
body.theme-light .nav-group-items { border-left-color: rgba(0,0,0,0.08); }
.nav-icon-wrap {
  width: 22px;
  min-width: 22px;
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.nav-icon-wrap svg {
  width: 20px;
  height: 20px;
  opacity: 0.9;
}
.sidebar-nav a.active .nav-icon-wrap svg { opacity: 1; }
.nav-label {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: opacity 0.2s, width 0.2s;
}
.sidebar-nav a {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 10px;
  border-radius: 8px;
  min-width: 0;
  font-size: 14px;
  color: #ebecf0;
  background: #1f2128;
  border: 1px solid #2d3140;
  transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}
.sidebar-nav a.active {
  background: rgba(243, 55, 43, 0.12);
  border-color: rgba(243, 55, 43, 0.35);
  color: var(--accent);
}
body.theme-light .sidebar-nav a {
  color: var(--text-main);
  background: transparent;
  border: 1px solid var(--line-soft);
}
body.theme-light .sidebar-nav a.active {
  background: #e2e8f0;
  border-color: #94a3b8;
  color: var(--accent);
}
.sidebar-nav a:hover {
  background: var(--bg-elevated);
  border-color: var(--line);
}
body.theme-light .sidebar-nav a:hover {
  background: #f1f5f9;
  border-color: #cbd5e1;
}

/* Online users block */
.sidebar-chat-status { padding: 8px 14px 4px; }
.sidebar-chat-status-btn {
  display: flex; align-items: center; gap: 8px; width: 100%;
  padding: 8px 12px; border-radius: var(--radius-sm);
  background: var(--bg-input); border: 1px solid var(--line); color: var(--text-muted);
  font-size: 13px; cursor: pointer; transition: background 0.2s, border-color 0.2s, color 0.2s;
}
.sidebar-chat-status-btn:hover { background: var(--bg-elevated); color: var(--text-main); }
.sidebar-chat-status-btn.is-online { border-color: rgba(34,197,94,0.4); color: #4ade80; }
.sidebar-chat-status-dot {
  width: 8px; height: 8px; border-radius: 50%; background: var(--text-subtle); flex-shrink: 0;
}
.sidebar-chat-status-btn.is-online .sidebar-chat-status-dot { background: #4ade80; box-shadow: 0 0 8px rgba(34,197,94,0.5); }
.sidebar.collapsed .sidebar-chat-status { display: none; }

.sidebar-online {
  padding: 12px 14px;
  margin: 14px 0 16px;
  background: var(--bg-elevated);
  border-radius: var(--radius-md);
  border: 1px solid var(--line-soft);
}
.sidebar-online-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
}
.online-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--good);
  flex-shrink: 0;
  box-shadow: 0 0 0 2px var(--good-soft);
}
.sidebar-online-label { flex: 1; }
.sidebar-online-count {
  background: var(--bg-input);
  color: var(--text-subtle);
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
}
.sidebar-online-list {
  list-style: none;
  margin: 0;
  padding: 0;
  max-height: 120px;
  overflow-y: auto;
}
.sidebar-online-item { margin-bottom: 2px; }
.sidebar-online-link {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 6px;
  border-radius: 8px;
  text-decoration: none;
  color: var(--text-main);
  font-size: 13px;
  transition: background 0.2s;
}
a.sidebar-online-link:hover { background: var(--bg-input); color: inherit; }
.sidebar-online-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  overflow: hidden;
  flex-shrink: 0;
  position: relative;
  background: var(--bg-input);
}
.sidebar-online-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.sidebar-online-initial {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
}
.sidebar-online-badge {
  position: absolute;
  bottom: 0;
  right: 0;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--good);
  border: 2px solid var(--bg-elevated);
}
.sidebar-online-name {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sidebar-online-empty {
  margin: 0;
  font-size: 12px;
  color: var(--text-subtle);
}
.mobile-online-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  background: var(--bg-elevated);
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
}
.mobile-online-badge .online-dot { width: 6px; height: 6px; }
.mobile-online-badge span:last-child { color: var(--text-main); }

.sidebar-bottom {
  margin-top: auto;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-top: 12px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}
.sidebar-bottom-inner { display: flex; gap: 6px; flex-wrap: wrap; }
body.theme-light .sidebar-bottom {
  border-top-color: #e4e9f4;
}
.lang-switch {
  display: inline-flex;
  gap: 6px;
}
.lang-btn {
  background: #1d1f27;
  border: 1px solid #2f3340;
  color: #d7dcea;
  border-radius: 8px;
  padding: 6px 10px;
  font-size: 12px;
  transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}
.lang-btn:hover {
  background: #252830;
  border-color: #3a4050;
}
body.theme-light .lang-btn {
  background: #f4f6fc;
  border: 1px solid #d6deee;
  color: #2e3850;
}
body.theme-light .lang-btn:hover {
  background: #eef2fb;
  border-color: #c5cfe8;
}
.lang-btn.active {
  background: linear-gradient(180deg, var(--accent) 0%, var(--accent-dark) 100%);
  border-color: transparent;
  color: #fff;
}
.status-chip {
  background: #16181f;
  border: 1px solid #363c4a;
  color: var(--text-muted);
  border-radius: 999px;
  width: fit-content;
  padding: 7px 12px;
  font-size: 12px;
}
body.theme-light .status-chip {
  background: #f4f6fb;
  border: 1px solid #dbe2ef;
}

.content {
  position: relative;
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 28px 32px;
  display: flex;
  flex-direction: column;
  gap: 24px;
  scrollbar-width: thin;
  scrollbar-color: var(--text-subtle) transparent;
}
.content::-webkit-scrollbar {
  width: 8px;
}
.content::-webkit-scrollbar-track {
  background: transparent;
}
.content::-webkit-scrollbar-thumb {
  background: #3a3d48;
  border-radius: 4px;
}
/* Тёмная тема: контент с едва заметной поверхностью для иерархии */
body.theme-dark .content,
body:not(.theme-light) .content {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.02) 0%, transparent 30%);
  position: relative;
}
body.theme-light .content {
  background: #e8ecf2;
  scrollbar-color: #94a3b8 transparent;
}
body.theme-light .content::-webkit-scrollbar-thumb {
  background: #94a3b8;
}

.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 24px;
}
body.theme-light .page-header {
  border-bottom-color: var(--line);
}
.page-header h1 { margin-bottom: 4px; font-weight: 600; letter-spacing: -0.02em; }
.page-header p { margin: 0; color: var(--text-muted); font-size: 14px; }
.page-header-dashboard .page-header-content {
  display: flex;
  align-items: center;
  gap: 20px;
}
.hero-illustration {
  width: 160px;
  height: 100px;
  flex-shrink: 0;
  color: var(--text-muted);
  opacity: 0.85;
}
.hero-illustration svg {
  width: 100%;
  height: 100%;
  object-fit: contain;
}
.page-header-with-icon {
  display: flex;
  align-items: center;
  gap: 14px;
}
.page-title-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, rgba(243, 55, 43, 0.2) 0%, rgba(243, 55, 43, 0.08) 100%);
  border: 1px solid rgba(243, 55, 43, 0.25);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent);
  flex-shrink: 0;
}
.page-title-icon svg {
  width: 24px;
  height: 24px;
}
.page-title-icon-tickets {
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.25) 0%, rgba(79, 70, 229, 0.15) 100%);
  border-color: rgba(99, 102, 241, 0.3);
  color: #818cf8;
}
.page-title-icon-deposits {
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.25) 0%, rgba(5, 150, 105, 0.15) 100%);
  border-color: rgba(16, 185, 129, 0.3);
  color: #34d399;
}
.page-title-icon-tasks {
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.25) 0%, rgba(217, 119, 6, 0.15) 100%);
  border-color: rgba(245, 158, 11, 0.3);
  color: #fbbf24;
}
.page-title-icon-payments {
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.25) 0%, rgba(5, 150, 105, 0.15) 100%);
  border-color: rgba(16, 185, 129, 0.3);
  color: #34d399;
}
.docs-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.docs-nav a {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border-radius: 10px;
  font-size: 13px;
  background: #1f232a;
  border: 1px solid #2d3340;
  color: #d4dae6;
  transition: background 0.2s ease, border-color 0.2s ease;
}
.docs-nav a:hover {
  background: #282d38;
  border-color: #3d4554;
}
.docs-nav .nav-icon,
.docs-nav svg {
  width: 16px;
  height: 16px;
  opacity: 0.8;
}
body.theme-light .docs-nav a {
  background: #f5f8ff;
  border-color: #dbe3f2;
  color: #2e3850;
}
body.theme-light .docs-nav a:hover {
  background: #eef3ff;
  border-color: #c5d0eb;
}
.page-actions {
  display: inline-flex;
  gap: 8px;
  flex-wrap: wrap;
}
.btn-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 18px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: var(--bg-panel-soft);
  color: var(--text-main);
  font-size: 14px;
  font-weight: 500;
  transition: all 0.2s ease;
}
.btn-link:hover {
  background: var(--bg-elevated);
  border-color: var(--text-subtle);
}
body.theme-light .btn-link {
  background: #e2e8f0;
  border-color: #cbd5e1;
  color: var(--text-main);
}
body.theme-light .btn-link:hover {
  background: #cbd5e1;
  border-color: #94a3b8;
}
.btn-link.primary {
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-dark) 100%);
  border-color: transparent;
  color: #fff;
  transition: transform 0.2s ease;
}
.btn-link.primary:hover {
  background: linear-gradient(135deg, var(--accent-hover) 0%, var(--accent) 100%);
  transform: translateY(-1px);
}
.clean-list {
  margin: 0 0 16px 0;
  padding-left: 20px;
  display: grid;
  gap: 6px;
  gap: 6px;
}
.card-success { border-left-color: var(--good); }
.card-error { border-left-color: var(--bad); }

.profile-card .profile-header {
  display: flex;
  align-items: center;
  gap: 20px;
  margin-bottom: 24px;
}
.profile-avatar-wrap { flex-shrink: 0; }
.profile-avatar {
  width: 96px;
  height: 96px;
  border-radius: 50%;
  object-fit: cover;
}
.profile-avatar-placeholder {
  width: 96px;
  height: 96px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-dark) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
}
.profile-avatar-placeholder svg { width: 48px; height: 48px; }
.profile-info h2 { margin: 0 0 4px; font-size: 20px; }
.profile-position { margin: 0; font-size: 14px; color: var(--accent); }
.profile-username { margin: 0; font-size: 13px; color: var(--text-muted); }
.profile-details {
  display: grid;
  grid-template-columns: 160px 1fr;
  gap: 8px 16px;
  margin: 0;
}
.profile-details dt { color: var(--text-muted); font-weight: 500; }
.profile-details dd { margin: 0; }
.profile-services-table { margin-top: 12px; width: 100%; }
.profile-services-table th, .profile-services-table td { padding: 8px 12px; text-align: left; }
.profile-services-table th { color: var(--text-muted); font-weight: 500; }

.profile-edit-avatar {
  display: flex;
  align-items: center;
  gap: 16px;
}
.profile-avatar-preview {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  object-fit: cover;
}
.profile-avatar-placeholder.profile-avatar-preview { width: 80px; height: 80px; }
.profile-avatar-placeholder.profile-avatar-preview svg { width: 40px; height: 40px; }
.profile-avatar-placeholder.profile-avatar-initial span { font-size: 32px; font-weight: 600; line-height: 1; }
.avatar-upload-label {
  cursor: pointer;
  display: inline-block;
}
.avatar-input { display: none; }

/* Employee card — modern profile card */
.employee-card {
  background: var(--bg-panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 28px;
  box-shadow: var(--shadow-sm);
}
.employee-card-header {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 24px;
  margin-bottom: 24px;
}
.employee-card-avatar-wrap {
  position: relative;
  flex-shrink: 0;
}
.employee-card-avatar, .employee-card-avatar-placeholder {
  width: 100px;
  height: 100px;
  border-radius: 50%;
  object-fit: cover;
  display: block;
}
.employee-card-avatar-placeholder {
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-dark) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 36px;
  font-weight: 600;
}
.employee-card-status {
  position: absolute;
  bottom: 4px;
  right: 4px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 2px solid var(--bg-panel);
}
.employee-card-status--online {
  background: var(--good);
}
.employee-card-status--offline {
  background: var(--text-muted);
  opacity: 0.6;
}
.employee-card-chat-badge {
  position: absolute;
  top: -2px;
  right: -2px;
  width: 24px;
  height: 24px;
  background: var(--accent);
  color: var(--accent-fg);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}
.employee-card-chat-badge svg { width: 12px; height: 12px; }
.employee-card-meta { flex: 1; min-width: 180px; }
.employee-card-name { margin: 0 0 4px; font-size: 22px; font-weight: 600; }
.employee-card-position { margin: 0 0 8px; font-size: 15px; color: var(--accent); }
.employee-card-badges { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 6px; }
.employee-badge {
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 500;
}
.employee-badge--role { background: rgba(99, 102, 241, 0.15); color: var(--accent); }
.employee-badge--active { background: rgba(34, 197, 94, 0.15); color: var(--good); }
.employee-badge--inactive { background: rgba(239, 68, 68, 0.15); color: var(--bad); }
.employee-badge--all { background: rgba(99, 102, 241, 0.2); }
.employee-card-username { margin: 0; font-size: 13px; color: var(--text-muted); }
.employee-card-actions { margin-left: auto; }
.employee-card-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  padding: 16px 0;
  margin-bottom: 20px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}
.employee-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 72px;
  padding: 8px 14px;
  background: var(--bg-input);
  border-radius: var(--radius-md);
  text-decoration: none;
  color: inherit;
  transition: background 0.2s, transform 0.15s;
}
.employee-stat:hover { background: var(--bg-elevated); transform: translateY(-1px); }
.employee-stat-value { font-size: 20px; font-weight: 700; color: var(--text-main); }
.employee-stat-label { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.employee-stat--tasks .employee-stat-value { color: var(--accent); }
.employee-stat--closed .employee-stat-value { color: var(--good); }
.employee-stat--deposits .employee-stat-value { color: #f59e0b; }
.employee-stat--tickets .employee-stat-value { color: #06b6d4; }
.employee-card-details {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px 24px;
  margin-bottom: 24px;
}
.employee-detail {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.employee-detail-label { font-size: 12px; color: var(--text-muted); }
.employee-detail-value { font-size: 14px; }
.employee-detail-link { color: var(--accent); text-decoration: none; }
.employee-detail-link:hover { text-decoration: underline; }
.employee-card-section { margin-top: 20px; padding-top: 20px; border-top: 1px solid var(--line); }
.employee-section-title { margin: 0 0 12px; font-size: 14px; font-weight: 600; color: var(--text-muted); }
.employee-permissions { display: flex; flex-wrap: wrap; gap: 8px; }
.employee-perm-tag {
  padding: 4px 10px;
  background: var(--bg-input);
  border-radius: var(--radius-sm);
  font-size: 12px;
  color: var(--text-subtle);
}
.employee-services-grid { display: flex; flex-direction: column; gap: 12px; }
.employee-service-item {
  display: grid;
  grid-template-columns: 140px 1fr;
  gap: 12px 16px;
  align-items: start;
  padding: 12px;
  background: var(--bg-input);
  border-radius: var(--radius-md);
}
.employee-service-name { font-weight: 500; color: var(--text-main); }
.employee-service-value { font-size: 14px; }
.employee-service-notes { grid-column: 2; font-size: 12px; color: var(--text-muted); }

/* Награды за активность */
.employee-awards-section { margin-bottom: 0; }
.employee-awards-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}
.employee-award-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  background: var(--bg-input);
  border-radius: var(--radius-md);
  border-left: 3px solid var(--award-color, var(--accent));
  transition: transform 0.15s, box-shadow 0.2s;
}
.employee-award-item:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}
.employee-award-icon {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--award-color, var(--accent));
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.employee-award-icon svg { width: 16px; height: 16px; }
.employee-award-name { font-size: 14px; font-weight: 500; color: var(--text-main); }

h1, h2, h3 {
  margin-top: 0;
  color: #ffffff;
}
body.theme-light h1,
body.theme-light h2,
body.theme-light h3 {
  color: #1f2430;
}

.card {
  background: var(--bg-panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow-sm);
  margin-bottom: 20px;
  transition: box-shadow 0.25s ease, border-color 0.25s ease, transform 0.2s ease;
}
.card:hover {
  box-shadow: var(--shadow-md);
  border-color: var(--line-soft);
}
body.theme-dark .card,
body:not(.theme-light) .card {
  background: linear-gradient(180deg, rgba(28, 32, 40, 0.98) 0%, var(--bg-panel) 100%);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-color: var(--line);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.35), 0 0 0 1px rgba(255, 255, 255, 0.04) inset;
}
body.theme-light .card {
  background: #fff;
  border: 1px solid #cbd5e1;
  box-shadow: 0 2px 12px rgba(30, 50, 90, 0.06);
}
body.theme-light .card:hover {
  box-shadow: 0 4px 20px rgba(30, 50, 90, 0.1);
  border-color: #94a3b8;
}
.card h3 { margin-top: 0; margin-bottom: 10px; font-size: 16px; }
.card-section-title {
  display: flex;
  align-items: center;
  gap: 8px;
}
.card-section-title .section-icon {
  display: inline-flex;
  align-items: center;
  width: 18px;
  height: 18px;
  opacity: 0.9;
}
.card-section-title .section-icon svg { width: 18px; height: 18px; }
.section-icon-active { color: var(--warn); }
.section-icon-closed { color: var(--good); }
.card h4 { margin: 14px 0 8px; font-size: 14px; color: var(--text-muted); }
.card p { margin: 0 0 12px; line-height: 1.5; color: var(--text-muted); font-size: 14px; }
.card > a:not(.btn-link) {
  display: inline-block;
  margin-top: 4px;
  padding: 6px 12px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  transition: background 0.2s ease, color 0.2s ease;
}
.card > a:not(.btn-link):hover {
  background: rgba(243, 55, 43, 0.12);
  color: #ff8a80;
}
body.theme-light .card > a:not(.btn-link):hover {
  background: rgba(243, 55, 43, 0.08);
  color: #c62828;
}

/* Auth / Login — split layout */
.auth-page {
  min-height: 100vh;
  display: flex;
  align-items: stretch;
  overflow: hidden;
}
body.theme-dark .auth-page,
body:not(.theme-light) .auth-page {
  background: linear-gradient(135deg, #0c0d0f 0%, #141618 50%, #0f1012 100%);
}
body.theme-light .auth-page {
  background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 50%, #e2e8f0 100%);
}
.auth-split {
  display: flex;
  width: 100%;
  min-height: 100vh;
}
.auth-brand {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 48px;
  position: relative;
  overflow: hidden;
}
.auth-brand-glow {
  position: absolute;
  width: 800px;
  height: 800px;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: radial-gradient(circle, rgba(243, 55, 43, 0.06) 0%, rgba(243, 55, 43, 0.02) 40%, transparent 70%);
  pointer-events: none;
}
.auth-brand-content {
  position: relative;
  z-index: 1;
  max-width: 420px;
}
.auth-logo {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}
.auth-logo-dot {
  width: 20px;
  height: 20px;
  border-radius: 6px;
  background: linear-gradient(135deg, #f3372b 0%, #d91000 100%);
  box-shadow: 0 0 40px rgba(243, 55, 43, 0.25), 0 0 80px rgba(243, 55, 43, 0.1);
}
.auth-logo-text {
  font-size: 28px;
  font-weight: 700;
  letter-spacing: 0.05em;
  color: var(--text-main);
}
.auth-tagline {
  font-size: 16px;
  line-height: 1.6;
  color: var(--text-muted);
  margin: 0 0 40px;
  overflow-wrap: break-word;
}
.auth-illustration {
  width: 100%;
  max-width: 320px;
  opacity: 0.9;
}
.auth-illustration svg {
  width: 100%;
  height: auto;
  display: block;
}
.auth-form-wrap {
  width: 480px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 48px;
  background: var(--bg-panel);
  border-left: 1px solid var(--line);
  box-shadow: -16px 0 48px rgba(0, 0, 0, 0.15);
}
body.theme-light .auth-form-wrap {
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(20px);
  border-left-color: var(--line);
  box-shadow: -16px 0 48px rgba(0, 0, 0, 0.06);
}
.auth-form-card {
  width: 100%;
  max-width: 360px;
}
.auth-form-header {
  margin-bottom: 32px;
}
.auth-form-header h1 {
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin: 0 0 6px;
  color: var(--text-main);
}
.auth-form-header p {
  font-size: 14px;
  color: var(--text-muted);
  margin: 0;
}
.auth-mobile-notice {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 14px;
  margin-top: 16px;
  font-size: 13px;
  line-height: 1.45;
  color: var(--text-muted);
  background: rgba(99, 102, 241, 0.08);
  border: 1px solid rgba(99, 102, 241, 0.2);
  border-radius: var(--radius-md);
  overflow-wrap: break-word;
}
.auth-mobile-notice i {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  margin-top: 2px;
}
@media (min-width: 769px) {
  .auth-mobile-notice { display: none; }
}
.auth-alert {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  border-radius: var(--radius-md);
  font-size: 14px;
  margin-bottom: 20px;
}
.auth-alert i { width: 18px; height: 18px; flex-shrink: 0; }
.auth-alert-warn {
  background: var(--warn-soft);
  color: var(--warn);
  border: 1px solid rgba(245, 158, 11, 0.3);
}
.auth-alert-error {
  background: var(--bad-soft);
  color: #fca5a5;
  border: 1px solid rgba(239, 68, 68, 0.3);
}
.auth-form {
  display: flex;
  flex-direction: column;
  gap: 20px;
}
.auth-field {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.auth-field label {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
}
.auth-input-wrap {
  display: flex;
  align-items: center;
  gap: 0;
  border-radius: var(--radius-md);
  border: 1px solid var(--line);
  background: var(--bg-input);
  transition: border-color 0.2s, box-shadow 0.2s;
}
.auth-input-wrap:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-glow);
}
.auth-input-wrap i {
  flex-shrink: 0;
  width: 20px;
  height: 20px;
  margin-left: 14px;
  color: var(--text-subtle);
  pointer-events: none;
  display: flex;
  align-items: center;
  justify-content: center;
}
.auth-input-wrap i svg {
  width: 18px;
  height: 18px;
}
.auth-input-wrap input {
  flex: 1;
  min-width: 0;
  padding: 14px 16px 14px 12px;
  border: none;
  background: transparent;
  font-size: 15px;
  color: var(--text-main);
  transition: none;
}
.auth-input-wrap input::placeholder {
  color: var(--text-subtle);
}
.auth-input-wrap input:focus {
  outline: none;
}
.auth-submit {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  padding: 14px 24px;
  margin-top: 8px;
  background: linear-gradient(135deg, #f3372b 0%, #d91000 100%);
  border: none;
  border-radius: var(--radius-md);
  color: #fff;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.2s;
}
.auth-submit:hover {
  transform: translateY(-1px);
}
.auth-submit:active {
  transform: translateY(0);
}
.auth-submit i { width: 20px; height: 20px; }

/* Auth loader — анимированный релоадер входа */
.auth-loader-overlay {
  position: absolute;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(12, 13, 15, 0.92);
  backdrop-filter: blur(12px);
  border-radius: 16px;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
  pointer-events: none;
}
.auth-loader-overlay.visible {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}
.auth-form-card { position: relative; }
.auth-loader {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 24px;
}
.auth-loader-spinner {
  position: relative;
  width: 72px;
  height: 72px;
}
.auth-loader-ring {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  border: 3px solid transparent;
  border-top-color: #f3372b;
  border-right-color: rgba(243, 55, 43, 0.5);
  border-bottom-color: rgba(243, 55, 43, 0.2);
  animation: auth-loader-spin 0.85s cubic-bezier(0.5, 0, 0.5, 1) infinite;
}
.auth-loader-dot {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 12px;
  height: 12px;
  margin: -6px 0 0 -6px;
  border-radius: 50%;
  background: linear-gradient(135deg, #f3372b, #ff6b5b);
  box-shadow: 0 0 20px rgba(243, 55, 43, 0.6);
  animation: auth-loader-pulse 1.2s ease-in-out infinite;
}
.auth-loader-text {
  margin: 0;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-muted);
  letter-spacing: 0.02em;
  animation: auth-loader-fade 1.5s ease-in-out infinite;
}
body.theme-light .auth-loader-overlay {
  background: rgba(248, 250, 252, 0.95);
}
body.theme-light .auth-loader-text {
  color: var(--text-muted);
}
@keyframes auth-loader-spin {
  to { transform: rotate(360deg); }
}
@keyframes auth-loader-pulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.15); opacity: 0.85; }
}
@keyframes auth-loader-fade {
  0%, 100% { opacity: 0.6; }
  50% { opacity: 1; }
}

.auth-footer {
  margin-top: 32px;
  padding-top: 24px;
  border-top: 1px solid var(--line);
}
.auth-switchers {
  display: flex;
  justify-content: center;
  gap: 24px;
}
.auth-switcher {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: var(--bg-input);
  padding: 4px;
  border-radius: var(--radius-md);
  border: 1px solid var(--line-soft);
}
.auth-switcher a {
  padding: 6px 12px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
  border: 1px solid transparent;
  transition: color 0.2s, background 0.2s, border-color 0.2s;
}
.auth-switcher a:hover {
  color: var(--text-main);
  background: var(--bg-elevated);
}
.auth-switcher a.active {
  color: var(--accent);
  background: rgba(243, 55, 43, 0.1);
  border-color: rgba(243, 55, 43, 0.3);
}
.auth-switcher a i { width: 16px; height: 16px; }
.auth-switcher a:has(i) { padding: 8px; }
.sidebar-switchers {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}
.sidebar-switchers .auth-switcher {
  flex: 1;
  min-width: 0;
  justify-content: center;
}
@media (max-width: 900px) {
  .auth-split { flex-direction: column; }
  .auth-brand {
    padding: 32px 24px;
    min-height: auto;
  }
  .auth-illustration { display: none; }
  .auth-form-wrap {
    width: 100%;
    border-left: none;
    border-top: 1px solid var(--line);
    box-shadow: 0 -16px 48px rgba(0, 0, 0, 0.1);
  }
}
@media (max-width: 480px) {
  .auth-page {
    min-height: 100dvh;
    min-height: 100svh;
    overflow-x: hidden;
  }
  .auth-split { min-height: 100dvh; min-height: 100svh; }
  .auth-brand {
    padding: 24px 16px;
    padding-left: max(16px, env(safe-area-inset-left));
    padding-right: max(16px, env(safe-area-inset-right));
  }
  .auth-logo-text { font-size: 24px; }
  .auth-tagline {
    font-size: 14px;
    margin-bottom: 24px;
  }
  .auth-form-wrap {
    padding: 24px 16px;
    padding-left: max(16px, env(safe-area-inset-left));
    padding-right: max(16px, env(safe-area-inset-right));
    padding-bottom: max(24px, env(safe-area-inset-bottom));
  }
  .auth-form-card { max-width: none; }
  .auth-form-header {
    margin-bottom: 24px;
  }
  .auth-form-header h1 { font-size: 20px; }
  .auth-form-header p { font-size: 13px; }
  .auth-mobile-notice {
    font-size: 12px;
    padding: 10px 12px;
    margin-top: 12px;
  }
  .auth-input-wrap {
    min-height: 48px;
  }
  .auth-input-wrap input {
    min-height: 46px;
    font-size: 16px;
  }
  .auth-submit {
    min-height: 48px;
    font-size: 16px;
    padding: 14px 24px;
  }
  .auth-footer {
    margin-top: 24px;
    padding-top: 20px;
  }
  .auth-switchers {
    flex-direction: column;
    gap: 12px;
  }
  .auth-switcher {
    justify-content: center;
  }
  .auth-switcher a {
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 16px;
}
.grid-cols-2-md {
  grid-template-columns: repeat(2, 1fr);
}
@media (max-width: 640px) {
  .grid-cols-2-md { grid-template-columns: 1fr; }
}
.grid-span-2 { grid-column: 1 / -1; }
.grid-dashboard { margin-top: 4px; }

.form-section-title {
  margin: 24px 0 12px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
  font-size: 15px;
  font-weight: 600;
  color: var(--text-muted);
}
.form-card-payment .form-section-title:first-child,
.form-card-method .form-section-title:first-child {
  margin-top: 0;
  padding-top: 0;
  border-top: none;
}
.field-label { font-weight: 500; color: var(--text-main); }
.field-hint { font-size: 12px; color: var(--text-muted); margin-top: 4px; }
.checkbox-field { display: flex; align-items: center; gap: 10px; }
.checkbox-field .field-label { margin-bottom: 0; }

.form-actions-choice { display: flex; flex-direction: column; gap: 10px; }
.form-actions-choice .form-radio-label { display: flex; align-items: center; gap: 8px; font-weight: 400; cursor: pointer; }
.form-actions-choice .form-radio-label input { margin: 0; }
.form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
}
.form-actions .btn-primary { display: inline-flex; align-items: center; gap: 8px; }
.form-actions .btn-secondary { display: inline-flex; align-items: center; gap: 8px; }

.card h3:first-of-type { margin-top: 0; }
.card form h3 {
  margin: 24px 0 12px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
  font-size: 15px;
  color: var(--text-muted);
}
.card form h3:first-of-type { margin-top: 0; padding-top: 0; border-top: none; }

/* Payment system view */
.ps-view-settings { margin-bottom: 24px; }
.ps-view-meta-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 16px 24px;
}
.ps-view-meta-item { display: flex; flex-direction: column; gap: 4px; }
.ps-view-meta-item.ps-view-meta-comment { grid-column: 1 / -1; }
.ps-view-meta-label { font-size: 12px; font-weight: 500; color: var(--text-muted); }
.ps-view-methods-section { margin-bottom: 24px; }
.ps-view-methods-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}
.ps-view-methods-header .card-section-title { margin: 0; }
.ps-view-empty-methods {
  text-align: center;
  padding: 40px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}
.ps-view-empty-methods p { margin: 0; color: var(--text-muted); }
.ps-view-methods-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 20px;
}
.ps-method-card {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 20px;
}
.ps-method-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}
.ps-method-card-name {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
  line-height: 1.3;
  flex: 1;
  min-width: 0;
}
.ps-method-card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  font-size: 13px;
  color: var(--text-muted);
}
.ps-method-meta-item { display: inline-flex; align-items: center; gap: 4px; }
.ps-method-icon { width: 14px; height: 14px; flex-shrink: 0; opacity: 0.8; }
.ps-method-card-limits {
  font-size: 12px;
  color: var(--text-subtle);
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.ps-method-card-integration {
  font-size: 12px;
  padding: 4px 10px;
  background: var(--bg-elevated);
  border-radius: 6px;
  width: fit-content;
}
.ps-method-card-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: auto;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

/* Payment systems list grid */
.ps-list-empty {
  text-align: center;
  padding: 48px 24px;
}
.ps-list-empty p {
  margin: 0 0 16px;
  color: var(--text-muted);
}
.ps-list-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 20px;
}
.ps-list-card {
  display: flex;
  flex-direction: column;
  gap: 0;
  padding: 0;
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}
.ps-list-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: var(--accent);
}
.ps-list-card:hover .ps-list-card-link {
  color: var(--accent);
}
.ps-list-card-click {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 20px;
  padding-bottom: 12px;
  text-decoration: none;
  color: inherit;
  flex: 1;
  min-width: 0;
}
.ps-list-card-header {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  flex-wrap: wrap;
}
.ps-list-card-icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.2) 0%, rgba(5, 150, 105, 0.15) 100%);
  border: 1px solid rgba(16, 185, 129, 0.25);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #10b981;
  flex-shrink: 0;
}
.ps-list-card-icon svg { width: 22px; height: 22px; }
.ps-list-card-title-wrap {
  flex: 1;
  min-width: 0;
}
.ps-list-card-name {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
  color: var(--text-main);
}
.ps-list-card-code {
  display: block;
  font-size: 12px;
  color: var(--text-muted);
}
.ps-list-card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  font-size: 13px;
  color: var(--text-muted);
}
.ps-list-meta-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.ps-list-meta-icon {
  width: 14px;
  height: 14px;
  opacity: 0.7;
}
.ps-list-card-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
  color: var(--text-subtle);
}
.ps-list-provider { font-weight: 500; color: var(--text-muted); }
.ps-list-integration { text-transform: capitalize; }
.ps-list-card-actions,
.ps-list-card-click .ps-list-card-link {
  margin-top: auto;
}
.ps-list-card-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
  transition: color 0.2s ease;
}
.ps-list-arrow { width: 14px; height: 14px; }
.ps-list-card-btns {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 20px 16px;
  border-top: 1px solid var(--line);
}
.ps-list-card-btns .btn-link {
  padding: 6px;
  color: var(--text-muted);
}
.ps-list-card-btns .btn-link:hover {
  color: var(--text-main);
}
.ps-list-card-btns .ps-list-delete:hover {
  color: var(--bad);
}
.ps-list-card-btns .btn-link svg {
  width: 16px;
  height: 16px;
}

.dashboard-section-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 15px;
  margin-bottom: 14px;
  color: var(--text-muted);
}
.dashboard-section-title .section-icon { width: 18px; height: 18px; }

.dashboard-stats {
  margin-bottom: 20px;
}
.dashboard-kpi { margin-bottom: 20px; }
.dashboard-chat-stats { margin-bottom: 20px; }
.dashboard-chat-stats-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}
.dashboard-chat-stats-header .dashboard-section-title { margin-bottom: 0; }
.chat-operator-select {
  padding: 6px 10px;
  font-size: 0.9rem;
  background: var(--bg-input);
  color: var(--text-main);
  border: 1px solid var(--line);
  border-radius: 6px;
  min-width: 160px;
}
.kpi-grid-chat { margin-bottom: 8px; }
.kpi-grid { display: flex; flex-wrap: wrap; gap: 20px; margin-bottom: 12px; }
.kpi-item { display: flex; flex-direction: column; gap: 2px; }
.kpi-value { font-weight: 600; font-size: 1.25rem; color: var(--accent); }
.kpi-label { font-size: 0.85rem; color: var(--text-muted); }
.bulk-actions-bar { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; padding: 10px 12px; background: var(--bg-panel-soft); border-radius: 8px; }
.bulk-actions-bar select { padding: 6px 10px; border-radius: 6px; background: var(--bg-input); color: var(--text-main); border: 1px solid var(--line); }
.quick-status-select { padding: 4px 8px; font-size: 0.85rem; background: var(--bg-input); color: var(--text-main); border: 1px solid var(--line); border-radius: 4px; min-width: 120px; }
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 14px;
  margin-bottom: 12px;
}
.stat-card {
  background: var(--bg-panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 20px;
  display: flex;
  align-items: center;
  gap: 16px;
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}
.stat-card:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
  border-color: var(--line-soft);
}
body.theme-light .stat-card {
  background: #fff;
  border: 1px solid #cbd5e1;
  box-shadow: 0 2px 8px rgba(30, 50, 90, 0.06);
}
body.theme-light .stat-card:hover {
  box-shadow: 0 4px 16px rgba(30, 50, 90, 0.1);
  border-color: #94a3b8;
}
.stat-card .stat-icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  flex-shrink: 0;
}
.stat-card .stat-icon svg { width: 22px; height: 22px; }
.stat-card-active .stat-icon { background: linear-gradient(135deg, var(--warn) 0%, #d97706 100%); }
.stat-card-credited .stat-icon { background: linear-gradient(135deg, var(--good) 0%, #059669 100%); }
.stat-card-amount .stat-icon { background: linear-gradient(135deg, #6366f1 0%, #4f46e5 100%); }
.stat-card-period .stat-icon { background: linear-gradient(135deg, var(--accent) 0%, var(--accent-dark) 100%); }
.stat-content {
  flex: 1;
  min-width: 0;
}
.stat-value {
  display: block;
  font-size: 20px;
  font-weight: 700;
  color: var(--text-main);
  line-height: 1.2;
}
.stat-label {
  font-size: 11px;
  color: var(--text-muted);
}
.text-muted { color: var(--text-muted); }
.stat-link {
  font-size: 12px;
  color: var(--accent);
  text-decoration: none;
  flex-shrink: 0;
}
.stat-link:hover { text-decoration: underline; }
.stats-detail {
  display: flex;
  flex-wrap: wrap;
  gap: 16px 24px;
  font-size: 13px;
  color: var(--text-muted);
}
.stats-detail .stat-detail-item svg {
  width: 14px;
  height: 14px;
  vertical-align: middle;
  margin-right: 4px;
  opacity: 0.8;
}

.dashboard-widgets-row {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}
.dashboard-widget {
  padding: 16px;
}
.dashboard-widget .widget-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  margin: 0 0 12px 0;
  color: var(--text-main);
}
.dashboard-widget .widget-icon {
  width: 18px;
  height: 18px;
  color: var(--accent);
}
.widget-stats-row {
  display: flex;
  gap: 16px;
  margin-bottom: 12px;
  font-size: 13px;
  color: var(--text-muted);
}
.widget-stat-warn { color: var(--bad) !important; }
.widget-stat-new { color: var(--accent) !important; }
.widget-list {
  list-style: none;
  padding: 0;
  margin: 0 0 12px 0;
  font-size: 13px;
}
.widget-list li {
  padding: 6px 0;
  border-bottom: 1px solid var(--line);
}
.widget-list li:last-child { border-bottom: none; }
.widget-list a {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-main);
}
.widget-list a:hover { color: var(--accent); }
.priority-badge {
  display: inline-flex;
  font-size: 10px;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 4px;
  flex-shrink: 0;
}
.priority-p1 { background: var(--bad); color: #fff; }
.priority-p2 { background: var(--warn); color: #000; }
.priority-p3 { background: #6366f1; color: #fff; }
.priority-p4 { background: var(--text-muted); color: #fff; }
.priority-p2 .priority-badge { color: #fff; }
.widget-priority-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 16px;
  margin-bottom: 10px;
}
.priority-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
}
.widget-meta { font-size: 12px; color: var(--text-muted); margin: 0 0 8px 0; }
.widget-empty { color: var(--text-muted); font-size: 13px; margin: 0 0 8px 0; }
.widget-link {
  font-size: 12px;
  color: var(--accent);
  text-decoration: none;
}
.widget-link:hover { text-decoration: underline; }
.status-dot {
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  margin-left: auto;
  flex-shrink: 0;
}
.status-dot.status-new { background: var(--accent); }
.status-dot.status-in_progress { background: var(--warn); }
.status-dot.status-waiting_client,
.status-dot.status-waiting_provider { background: #6366f1; }

.status-badge {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 6px;
  background: var(--bg-panel-soft);
  color: var(--text-muted);
}
.status-badge.status-new,
.status-badge.status-sent_to_investigation { background: rgba(243, 55, 43, 0.2); color: var(--accent); }
.status-badge.status-waiting_ps { background: rgba(245, 158, 11, 0.2); color: var(--warn); }
.status-badge.status-found_ready_to_credit { background: rgba(34, 197, 94, 0.2); color: var(--good); }
.status-badge.status-credited { background: rgba(34, 197, 94, 0.15); color: var(--good); }
.status-badge.status-skypay-0 { background: rgba(99, 102, 241, 0.2); color: #818cf8; }
.status-badge.status-skypay-1 { background: rgba(245, 158, 11, 0.2); color: var(--warn); }
.status-badge.status-skypay-2 { background: rgba(34, 197, 94, 0.2); color: var(--good); }
.status-badge.status-skypay-3 { background: rgba(239, 68, 68, 0.2); color: var(--bad); }

.dashboard-attention {
  margin-bottom: 24px;
  padding: 16px;
  border-left: 4px solid var(--warn);
}
.dashboard-attention .attention-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  margin: 0 0 12px 0;
  color: var(--text-main);
}
.dashboard-attention .attention-icon {
  width: 18px;
  height: 18px;
  color: var(--warn);
}
.attention-list {
  list-style: none;
  padding: 0;
  margin: 0;
}
.attention-list li { margin-bottom: 8px; }
.attention-list li:last-child { margin-bottom: 0; }
.attention-list a {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-main);
}
.attention-list a:hover { color: var(--accent); }
.attention-list svg { width: 16px; height: 16px; flex-shrink: 0; }

.badge-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  font-size: 11px;
  font-weight: 600;
  background: var(--accent);
  color: #fff;
  border-radius: 999px;
  margin-left: 4px;
}
.nav-badge,
.nav-badge-new {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  font-size: 11px;
  font-weight: 600;
  background: var(--accent);
  color: #fff;
  border-radius: 999px;
  margin-left: 6px;
}
.card-with-icon { position: relative; }
.card-header-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 10px;
}
.card-header-row h3 { margin: 0; }
.card-icon {
  width: 40px;
  height: 40px;
  min-width: 40px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  flex-shrink: 0;
}
.card-icon svg {
  width: 22px;
  height: 22px;
}
.card-icon-deposits { background: linear-gradient(135deg, #6366f1 0%, #4f46e5 100%); }
.card-icon-investigation { background: linear-gradient(135deg, var(--accent) 0%, var(--accent-dark) 100%); }
.card-icon-payments { background: linear-gradient(135deg, #10b981 0%, #059669 100%); }
.card > a .link-arrow {
  width: 14px;
  height: 14px;
  margin-left: 6px;
  vertical-align: middle;
  opacity: 0.7;
}

label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 13px;
  color: #d4d8e2;
}
body.theme-light label {
  color: #334155;
}

input, select, textarea {
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  font-size: 14px;
  font-family: inherit;
  background: var(--bg-input);
  color: var(--text-main);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
input:hover, select:hover, textarea:hover {
  border-color: var(--text-subtle);
}
input::placeholder, textarea::placeholder {
  color: var(--text-subtle);
}
body.theme-light input,
body.theme-light select,
body.theme-light textarea {
  border: 1px solid #cbd5e1;
  background: #f8fafc;
}
body.theme-light input:hover,
body.theme-light select:hover,
body.theme-light textarea:hover {
  border-color: #94a3b8;
}

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

button,
.btn-primary {
  background: linear-gradient(135deg, #c62828 0%, #b71c1c 50%, #8b0000 100%);
  border: none;
  color: #fff;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.25);
  cursor: pointer;
  font-weight: 600;
  border-radius: 10px;
  transition: filter 0.2s ease, transform 0.15s ease;
}
button:hover,
.btn-primary:hover {
  filter: brightness(1.08);
  transform: translateY(-1px);
}
button:active,
.btn-primary:active {
  transform: translateY(0) scale(0.99);
}
.btn-icon,
button .btn-icon,
.btn-link .btn-icon {
  width: 16px;
  height: 16px;
  margin-right: 6px;
  vertical-align: middle;
  flex-shrink: 0;
}
button:has(.btn-icon),
.btn-link:has(.btn-icon) {
  display: inline-flex;
  align-items: center;
}
.btn-secondary {
  background: #2f3441;
  border: 1px solid #404656;
}
.btn-secondary:hover {
  background: #383e4d;
  border-color: #4d5568;
}
body.theme-light .btn-secondary {
  background: #e2e8f0;
  border: 1px solid #cbd5e1;
  color: #334155;
}
body.theme-light .btn-secondary:hover {
  background: #cbd5e1;
  border-color: #94a3b8;
}
.btn-sm { padding: 6px 12px; font-size: 13px; }
.btn-sm .btn-icon, .btn-sm svg { width: 14px; height: 14px; }

table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 14px;
  border-radius: var(--radius-md);
  overflow: hidden;
}
th, td {
  padding: 14px 18px;
  text-align: left;
  vertical-align: middle;
  transition: background 0.2s ease;
}
th {
  color: var(--text-muted);
  background: var(--bg-panel-soft);
  font-weight: 600;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  border-bottom: 1px solid var(--line);
}
body.theme-light th {
  background: #e2e8f0;
  color: var(--text-muted);
  border-bottom: 1px solid #cbd5e1;
}
td {
  color: var(--text-main);
  background: var(--bg-panel);
  border-bottom: 1px solid var(--line-soft);
}
body.theme-light td {
  background: #fff;
  border-bottom: 1px solid #e2e8f0;
}
tr:last-child td { border-bottom: none; }
tr:hover td {
  background: var(--bg-panel-soft);
}
body.theme-light tr:hover td {
  background: #f8fafc;
}
.table-card { overflow: hidden; border-radius: var(--radius-lg); display: flex; flex-direction: column; }
body.theme-light .table-card { background: #fff; border: 1px solid #cbd5e1; box-shadow: 0 2px 8px rgba(30, 50, 90, 0.06); }
.table-card table { border-radius: 0; }
.table-scroll-wrap {
  overflow-x: auto;
  overflow-y: auto;
  max-height: 500px;
  -webkit-overflow-scrolling: touch;
}
.table-scroll-wrap thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--bg-panel-soft);
}
.table-striped tbody tr:nth-child(even) td {
  background: rgba(255,255,255,0.02);
}
body.theme-light .table-striped tbody tr:nth-child(even) td {
  background: rgba(0,0,0,0.02);
}

/* Table badges */
.badge-status, .badge-cat, .badge-priority {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 500;
}
.badge-status-new { background: rgba(99,102,241,0.2); color: #818cf8; }
.badge-status-in_progress { background: rgba(59,130,246,0.2); color: #60a5fa; }
.badge-status-waiting_client, .badge-status-waiting_provider { background: rgba(245,158,11,0.2); color: #fbbf24; }
.badge-status-resolved { background: rgba(34,197,94,0.2); color: #22c55e; }
.badge-status-closed { background: rgba(107,114,128,0.2); color: #9ca3af; }
.badge-cat { background: var(--bg-elevated); color: var(--text-subtle); }
.badge-priority-p1 { background: rgba(239,68,68,0.2); color: #f87171; }
.badge-priority-p2 { background: rgba(245,158,11,0.2); color: #fbbf24; }
.badge-priority-p3 { background: rgba(59,130,246,0.2); color: #60a5fa; }
.badge-priority-p4 { background: rgba(107,114,128,0.2); color: #9ca3af; }

/* SLA compact indicators */
.sla-cell { white-space: nowrap; }
.sla-indicator { display: inline-flex; align-items: center; margin-right: 6px; }
.sla-icon { width: 14px; height: 14px; color: var(--text-muted); }
.sla-indicator.sla--red .sla-icon { color: #ef4444; }
.sla-indicator.sla--yellow .sla-icon { color: #eab308; }
.sla-indicator.sla--green .sla-icon { color: #22c55e; }
.ticket-row-sla-red { background: rgba(239,68,68,0.06); }
.ticket-row-sla-yellow { background: rgba(234,179,8,0.04); }

/* Breadcrumbs */
.breadcrumbs { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--text-muted); margin-bottom: 8px; }
.breadcrumbs a { color: var(--text-muted); }
.breadcrumbs a:hover { color: var(--accent); }
.breadcrumbs-sep { opacity: 0.6; }

/* Ticket add comment form */
.ticket-comment-forms { display: flex; flex-direction: column; gap: 20px; margin-bottom: 24px; }
.ticket-add-comment-form { margin-bottom: 0; }
.ticket-add-comment-form-client { padding-top: 16px; border-top: 1px solid var(--line-soft); }
.ticket-comment-form-label { display: block; font-size: 12px; color: var(--text-muted); margin-bottom: 6px; font-weight: 500; }
.ticket-comment-form-row { display: flex; flex-direction: column; gap: 10px; }
.ticket-comment-form-actions { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.ticket-template-select { padding: 8px 12px; border-radius: 8px; border: 1px solid var(--line); background: var(--bg-input); color: var(--text-main); font-size: 13px; max-width: 200px; }
.template-autocomplete-wrap { position: relative; }
.template-autocomplete-dropdown { position: absolute; left: 0; right: 0; bottom: 100%; margin-bottom: 4px; max-height: 280px; overflow-y: auto; background: var(--bg-elevated); border: 1px solid var(--line); border-radius: 8px; box-shadow: var(--shadow-md); z-index: 200; min-width: 320px; }
.template-autocomplete-dropdown .tpl-item { display: flex; flex-direction: column; gap: 2px; padding: 10px 12px; cursor: pointer; border-bottom: 1px solid var(--line-soft); transition: background 0.1s; }
.template-autocomplete-dropdown .tpl-item:last-child { border-bottom: none; }
.template-autocomplete-dropdown .tpl-item:hover, .template-autocomplete-dropdown .tpl-item.tpl-item--active { background: var(--bg-input); }
.template-autocomplete-dropdown .tpl-item-id { font-size: 11px; color: var(--text-muted); }
.template-autocomplete-dropdown .tpl-item-name { font-size: 13px; font-weight: 600; color: var(--text-main); }
.template-autocomplete-dropdown .tpl-item-preview { font-size: 12px; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.template-autocomplete-dropdown .tpl-empty { padding: 12px; font-size: 13px; color: var(--text-muted); }
.ticket-comment-textarea { width: 100%; padding: 12px; border-radius: 8px; border: 1px solid var(--line); background: var(--bg-input); color: var(--text-main); resize: vertical; min-height: 80px; }
/* Ticket timeline */
.ticket-timeline { position: relative; padding-left: 20px; border-left: 2px solid var(--line-soft); margin-left: 6px; }
.ticket-timeline-item { position: relative; padding-bottom: 16px; }
.ticket-timeline-item:last-child { padding-bottom: 0; }
.ticket-timeline-dot { position: absolute; left: -26px; top: 6px; width: 10px; height: 10px; border-radius: 50%; background: var(--accent); }
.ticket-timeline-event .ticket-timeline-dot { background: var(--text-muted); }
.ticket-timeline-comment--client .ticket-timeline-dot { background: #22c55e; }
.ticket-timeline-content { font-size: 13px; color: var(--text-main); }
.ticket-timeline-date { color: var(--text-muted); margin-right: 8px; font-size: 12px; }
.ticket-timeline-desc { color: var(--text-main); }
.ticket-timeline-user { color: var(--text-muted); font-size: 12px; margin-left: 8px; }
.ticket-timeline-empty { color: var(--text-muted); font-size: 13px; margin: 12px 0 0; }
.ticket-comment-badge { display: inline-block; padding: 2px 8px; border-radius: 6px; font-size: 11px; margin-left: 8px; }
.ticket-comment-badge--client { background: rgba(34, 197, 94, 0.2); color: #22c55e; }

.ticket-view-adjacent { color: var(--accent); margin-left: 8px; display: inline-flex; align-items: center; gap: 4px; }
.quick-category-select, .quick-priority-select, .quick-status-select {
  padding: 4px 8px; border-radius: 6px; border: 1px solid var(--line); background: var(--bg-input); color: var(--text-main); font-size: 12px;
}

pre {
  margin: 0;
  max-height: 180px;
  overflow: auto;
  white-space: pre-wrap;
  color: var(--text-main);
  font-size: 13px;
  padding: 12px;
  border-radius: var(--radius-sm);
  background: var(--bg-input);
  border: 1px solid var(--line-soft);
}
body.theme-light pre {
  color: var(--text-main);
}

.error,
.card.error {
  color: #ffe6e4;
  background: var(--bad-soft);
  border: 1px solid rgba(243, 55, 43, 0.4);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius-md);
  padding: 14px 16px;
}
body.theme-light .error,
body.theme-light .card.error {
  background: var(--bad-soft);
  border-color: rgba(243, 55, 43, 0.3);
}
.field-wrap small { color: var(--text-muted); }

.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 12px;
  line-height: 1.4;
  color: #fff;
}
.badge-active { background: linear-gradient(180deg, #29c766, #139f4a); }
.badge-inactive { background: #5f6572; }
.badge-testing { background: linear-gradient(180deg, #f6a623, #d97706); }
.badge-new {
  background: linear-gradient(180deg, #6366f1 0%, #4f46e5 100%);
  box-shadow: 0 2px 8px rgba(99, 102, 241, 0.35);
}
.badge-in_progress {
  background: linear-gradient(180deg, #3b82f6 0%, #1d4ed8 100%);
  box-shadow: 0 2px 8px rgba(59, 130, 246, 0.35);
}
.badge-closed {
  background: linear-gradient(180deg, #22c55e 0%, #15803d 100%);
  box-shadow: 0 2px 8px rgba(34, 197, 94, 0.25);
}

.urgency-badge {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 500;
}
.urgency-badge.urgency-high {
  background: rgba(239, 68, 68, 0.2);
  color: #f87171;
  border: 1px solid rgba(239, 68, 68, 0.5);
}
.urgency-badge.urgency-mid {
  background: rgba(245, 158, 11, 0.2);
  color: #fbbf24;
  border: 1px solid rgba(245, 158, 11, 0.5);
}
.urgency-badge.urgency-low {
  background: rgba(107, 114, 128, 0.2);
  color: #9ca3af;
  border: 1px solid rgba(107, 114, 128, 0.4);
}
body.theme-light .urgency-badge.urgency-high {
  background: rgba(239, 68, 68, 0.12);
  color: #dc2626;
}
body.theme-light .urgency-badge.urgency-mid {
  background: rgba(245, 158, 11, 0.12);
  color: #d97706;
}
body.theme-light .urgency-badge.urgency-low {
  background: rgba(107, 114, 128, 0.12);
  color: #6b7280;
}

.task-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 20px;
}
.task-cards-section { margin-top: 8px; }
.task-grid-trello {
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}

.task-card-trello {
  text-decoration: none;
  color: inherit;
  display: block;
  border-radius: 12px;
  overflow: hidden;
  background: var(--bg-panel);
  border: 1px solid var(--line);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3), 0 0 0 1px rgba(255, 255, 255, 0.03) inset;
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}
body.theme-dark .task-card-trello,
body:not(.theme-light) .task-card-trello {
  background: linear-gradient(180deg, rgba(30, 34, 44, 0.98) 0%, var(--bg-panel) 100%);
}
.task-card-trello:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.35);
  border-color: var(--line-soft);
}
.task-card-cover {
  height: 120px;
  background-size: cover;
  background-position: center;
  background-color: var(--bg-elevated);
}
.task-cover-presets { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.task-cover-preset-option { cursor: pointer; }
.task-cover-preset-option input { display: none; }
.task-cover-preset-option input:checked + .task-cover-preset,
.task-cover-preset-option input:checked + .task-cover-preset-none { box-shadow: 0 0 0 3px var(--accent); }
.task-cover-preset-none {
  display: inline-block;
  padding: 8px 14px;
  border-radius: 8px;
  border: 1px solid var(--line);
  font-size: 13px;
}
.task-cover-preset {
  display: block;
  width: 64px;
  height: 48px;
  border-radius: 8px;
  border: 1px solid var(--line);
}
.task-cover-gradient-red { background: linear-gradient(135deg, #ef4444 0%, #dc2626 50%, #b91c1c 100%); }
.task-cover-gradient-blue { background: linear-gradient(135deg, #3b82f6 0%, #2563eb 50%, #1d4ed8 100%); }
.task-cover-gradient-green { background: linear-gradient(135deg, #22c55e 0%, #16a34a 50%, #15803d 100%); }
.task-cover-gradient-purple { background: linear-gradient(135deg, #8b5cf6 0%, #7c3aed 50%, #6d28d9 100%); }
.task-cover-gradient-orange { background: linear-gradient(135deg, #f97316 0%, #ea580c 50%, #c2410c 100%); }
.task-cover-gradient-teal { background: linear-gradient(135deg, #14b8a6 0%, #0d9488 50%, #0f766e 100%); }
.task-card-body {
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.task-card-labels {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.task-label {
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 4px;
}
.task-label-status.status-new { background: #6366f1; color: #fff; }
.task-label-status.status-in_progress { background: #f59e0b; color: #fff; }
.task-label-status.status-closed { background: #22c55e; color: #fff; }
.task-label-priority.priority-p1 { background: #ef4444; color: #fff; }
.task-label-priority.priority-p2 { background: #f97316; color: #fff; }
.task-label-priority.priority-p3 { background: #eab308; color: #1a1a1a; }
.task-label-priority.priority-p4 { background: #94a3b8; color: #fff; }
.task-card-title {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
  line-height: 1.35;
  color: var(--text-main);
}
.task-card-desc {
  margin: 0;
  font-size: 13px;
  line-height: 1.45;
  color: var(--text-muted);
  flex: 1;
  min-height: 0;
}
.task-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 4px;
  padding-top: 8px;
  border-top: 1px solid var(--line-soft);
}
.task-card-due {
  font-size: 12px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 4px;
}
.task-card-due i { width: 14px; height: 14px; }
.task-card-assignee {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  text-transform: uppercase;
}

.task-card {
  background: linear-gradient(165deg, #252a36 0%, #1e222d 50%, #1a1e28 100%);
  border: 1px solid var(--line);
  border-left: 4px solid var(--accent);
  border-radius: 16px;
  padding: 20px;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4), 0 0 0 1px rgba(255, 255, 255, 0.03) inset;
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.task-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.45), 0 4px 16px rgba(243, 55, 43, 0.1);
  border-color: var(--line-soft);
}
body.theme-light .task-card {
  background: linear-gradient(165deg, #ffffff 0%, #f8faff 50%, #f2f5fc 100%);
  border: 1px solid #e2e8f4;
  border-left: 4px solid var(--accent);
  box-shadow: 0 4px 20px rgba(30, 50, 90, 0.1), 0 2px 8px rgba(0, 0, 0, 0.04);
}
body.theme-light .task-card:hover {
  box-shadow: 0 8px 28px rgba(30, 50, 90, 0.14), 0 4px 12px rgba(243, 55, 43, 0.06);
  border-color: #d0d9ed;
}

.task-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}
.task-head h3 {
  margin: 0;
  font-size: 17px;
  font-weight: 600;
  color: #fff;
  line-height: 1.35;
  flex: 1;
  min-width: 0;
}
body.theme-light .task-head h3 {
  color: #1a1f2e;
}
.task-card .badge {
  flex-shrink: 0;
  font-weight: 500;
  padding: 4px 12px;
}
.task-card p {
  margin: 0;
  font-size: 14px;
  line-height: 1.5;
  color: #a8b0c4;
  flex: 1;
}
body.theme-light .task-card p {
  color: #5a6478;
}
.task-meta {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 12px;
  color: var(--text-muted);
  padding-top: 4px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}
body.theme-light .task-meta {
  border-top-color: #e8ecf4;
}
.task-card .btn-link {
  margin-top: 4px;
  width: 100%;
  justify-content: center;
  padding: 10px 16px;
  font-weight: 600;
  font-size: 14px;
  border-radius: 10px;
  background: linear-gradient(180deg, rgba(243, 55, 43, 0.15) 0%, rgba(243, 55, 43, 0.08) 100%);
  border: 1px solid rgba(243, 55, 43, 0.4);
  color: #ff8a80;
  transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}
.task-card .btn-link:hover {
  background: linear-gradient(180deg, var(--accent) 0%, var(--accent-dark) 100%);
  border-color: transparent;
  color: #fff;
}
body.theme-light .task-card .btn-link {
  background: rgba(243, 55, 43, 0.08);
  border-color: rgba(243, 55, 43, 0.35);
  color: #c62828;
}
body.theme-light .task-card .btn-link:hover {
  background: linear-gradient(180deg, var(--accent) 0%, var(--accent-dark) 100%);
  border-color: transparent;
  color: #fff;
}

/* Ticket cards (active appeals) */
.tickets-section { margin-bottom: 32px; }
.tickets-section-title {
  display: flex; align-items: center; gap: 10px;
  margin: 0 0 16px; font-size: 15px; font-weight: 600; color: var(--text-muted);
}
.tickets-section-badge {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 24px; height: 24px; padding: 0 8px;
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-dark) 100%);
  color: #fff; font-size: 12px; font-weight: 600; border-radius: 8px;
}
.ticket-cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 16px;
}
.ticket-cards-grid--featured { gap: 20px; }
.ticket-card {
  display: block; text-decoration: none; color: inherit;
  background: var(--bg-panel); border: 1px solid var(--line);
  border-radius: 12px; padding: 16px 18px;
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}
.ticket-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
  border-color: var(--line-soft);
}
.ticket-card--in-progress { border-left: 4px solid var(--accent); }
.ticket-card-header {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 10px;
}
.ticket-card-id { font-size: 12px; color: var(--text-muted); font-weight: 500; }
.ticket-card-badge {
  font-size: 11px; font-weight: 600; padding: 4px 10px; border-radius: 6px;
}
.ticket-card-badge--new { background: rgba(99, 102, 241, 0.2); color: #818cf8; }
.ticket-card-badge--in_progress { background: rgba(59, 130, 246, 0.2); color: #60a5fa; }
.ticket-card-badge--waiting_client,
.ticket-card-badge--waiting_provider { background: rgba(245, 158, 11, 0.2); color: #fbbf24; }
.ticket-card-subject {
  margin: 0 0 8px; font-size: 15px; font-weight: 600; line-height: 1.35;
  color: var(--text-main); display: -webkit-box; -webkit-line-clamp: 2;
  -webkit-box-orient: vertical; overflow: hidden;
}
.ticket-card-client {
  margin: 0 0 12px; font-size: 13px; color: var(--text-muted);
  display: flex; align-items: center; gap: 6px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.ticket-card-icon { width: 14px; height: 14px; flex-shrink: 0; opacity: 0.7; }
.ticket-card-meta {
  display: flex; flex-wrap: wrap; gap: 8px 12px;
  font-size: 12px; color: var(--text-muted); margin-bottom: 12px;
}
.ticket-card-source {
  padding: 3px 8px; border-radius: 6px; font-size: 11px; font-weight: 600;
  background: var(--bg-elevated); color: var(--text-muted);
}
.ticket-card-source--telegram { background: rgba(59, 130, 246, 0.2); color: #60a5fa; }
.ticket-card-source--player_chat { background: rgba(34, 197, 94, 0.15); color: #4ade80; }
.ticket-card-source--manual { background: var(--bg-elevated); color: var(--text-muted); }
.ticket-card-cat { background: var(--bg-elevated); padding: 3px 8px; border-radius: 6px; }
.ticket-card-priority { font-weight: 600; color: var(--text-subtle); }
.ticket-card-sla { display: flex; align-items: center; gap: 4px; }
.ticket-card-sla i { width: 12px; height: 12px; opacity: 0.7; }
.ticket-card-action {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 13px; font-weight: 600; color: var(--accent);
  text-decoration: none;
}
.ticket-card-action i { width: 14px; height: 14px; transition: transform 0.2s; }
.ticket-card:hover .ticket-card-action i { transform: translateX(4px); }
.ticket-cards-empty {
  text-align: center; padding: 48px 24px;
  background: var(--bg-panel); border: 1px dashed var(--line);
  border-radius: 12px; color: var(--text-muted);
}
.ticket-cards-empty-icon { width: 48px; height: 48px; opacity: 0.4; margin-bottom: 12px; }
.ticket-cards-empty p { margin: 0 0 16px; font-size: 15px; }
.tickets-section-closed { padding-top: 24px; border-top: 1px solid var(--line); margin-top: 8px; }
.tickets-section-closed .tickets-section-title { color: var(--text-subtle); }
.tickets-closed-empty { margin: 0; padding: 16px 0; color: var(--text-muted); font-size: 14px; }
.table-closed-tickets { width: 100%; }
.table-closed-tickets th { text-align: left; padding: 10px 12px; font-size: 12px; font-weight: 600; color: var(--text-muted); border-bottom: 1px solid var(--line); }
.table-closed-tickets td { padding: 10px 12px; font-size: 13px; border-bottom: 1px solid var(--line-soft); vertical-align: middle; }
.table-closed-tickets td:last-child { text-align: right; white-space: nowrap; }
.table-closed-tickets a { color: var(--accent); }
.table-closed-tickets a:hover { text-decoration: underline; }
.table-closed-tickets .section-icon { width: 18px; height: 18px; opacity: 0.8; }

body.theme-light .ticket-card { background: #fff; border-color: #e2e8f4; }
body.theme-light .ticket-card:hover { box-shadow: 0 8px 24px rgba(30, 50, 90, 0.12); border-color: #d0d9ed; }
body.theme-light .ticket-card--in-progress { border-left-color: var(--accent); }
body.theme-light .ticket-card-subject { color: #1a1f2e; }
body.theme-light .ticket-card-cat { background: #f1f5f9; }
body.theme-light .ticket-card-source--telegram { background: rgba(59, 130, 246, 0.15); color: #2563eb; }
body.theme-light .ticket-card-source--player_chat { background: rgba(34, 197, 94, 0.12); color: #16a34a; }
body.theme-light .ticket-card-source--manual { background: #f1f5f9; color: #64748b; }
body.theme-light .ticket-cards-empty { background: #f8fafc; border-color: #e2e8f4; }

/* Task form (create) */
.task-form-card { max-width: 900px; }
.task-form-section { margin-bottom: 28px; }
.task-form-section h3 {
  margin: 0 0 14px;
  font-size: 15px;
  font-weight: 600;
  color: var(--text-muted);
}
.task-form-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px 24px;
}
.task-form-field-wide { grid-column: 1 / -1; }
.task-form-field { display: flex; flex-direction: column; gap: 6px; }
.task-form-label { font-size: 13px; font-weight: 500; color: var(--text-muted); }
.task-form-field input,
.task-form-field select,
.task-form-field textarea {
  padding: 12px 14px;
  font-size: 15px;
  min-height: 44px;
}
.task-form-field textarea {
  min-height: 120px;
  resize: vertical;
}
.task-form-attach { margin-top: 8px; }
.task-form-file-wrap input[type="file"] { padding: 8px 0; }
.task-form-file-hint { font-size: 12px; color: var(--text-subtle); }
.task-form-preview {
  margin-top: 12px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
}
.task-form-preview-img {
  max-width: 200px;
  max-height: 150px;
  border-radius: 8px;
  object-fit: cover;
  border: 1px solid var(--line);
}
.task-form-preview-name, .task-form-preview-file { font-size: 13px; color: var(--text-muted); }
.task-form-preview-file i { width: 16px; height: 16px; vertical-align: middle; }
.task-form-actions {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
}

/* Task view */
.task-view-layout {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 24px;
  align-items: start;
}
@media (max-width: 900px) {
  .task-view-layout { grid-template-columns: 1fr; }
}
.task-view-main { overflow: hidden; padding: 0; }
.task-view-cover {
  height: 200px;
  background-size: cover;
  background-position: center;
  background-color: var(--bg-elevated);
}
.task-view-cover.task-cover-gradient-red { background: linear-gradient(135deg, #ef4444 0%, #dc2626 50%, #b91c1c 100%); }
.task-view-cover.task-cover-gradient-blue { background: linear-gradient(135deg, #3b82f6 0%, #2563eb 50%, #1d4ed8 100%); }
.task-view-cover.task-cover-gradient-green { background: linear-gradient(135deg, #22c55e 0%, #16a34a 50%, #15803d 100%); }
.task-view-cover.task-cover-gradient-purple { background: linear-gradient(135deg, #8b5cf6 0%, #7c3aed 50%, #6d28d9 100%); }
.task-view-cover.task-cover-gradient-orange { background: linear-gradient(135deg, #f97316 0%, #ea580c 50%, #c2410c 100%); }
.task-view-cover.task-cover-gradient-teal { background: linear-gradient(135deg, #14b8a6 0%, #0d9488 50%, #0f766e 100%); }
.task-view-header {
  padding: 24px 28px;
  border-bottom: 1px solid var(--line);
}
.task-view-header h2 { margin: 14px 0 0; font-size: 22px; font-weight: 600; line-height: 1.35; }
.task-view-body {
  padding: 28px 28px 24px;
}
.task-view-body h4 { margin: 0 0 12px; font-size: 13px; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.03em; }
.task-view-description {
  font-size: 15px;
  line-height: 1.7;
  white-space: pre-wrap;
  color: var(--text-main);
}
.task-view-sidebar { display: flex; flex-direction: column; gap: 20px; }
.task-view-meta-card,
.task-attachments-card {
  padding: 24px;
}
.task-view-meta-card h4,
.task-attachments-card h4 {
  margin: 0 0 18px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-muted);
}
.task-meta-dl {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 8px 20px;
  font-size: 14px;
  line-height: 1.5;
}
.task-meta-dl dt { color: var(--text-muted); font-weight: 500; }
.task-meta-dl dd { margin: 0; color: var(--text-main); }
.task-status-form {
  margin-top: 20px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
}
.task-status-form label { display: block; margin-bottom: 12px; }
.task-status-form .task-form-label { display: block; margin-bottom: 6px; font-size: 13px; font-weight: 500; color: var(--text-muted); }
.task-status-form select {
  width: 100%;
  padding: 10px 14px;
  border-radius: var(--radius-md);
  border: 1px solid var(--line);
  background: var(--bg-input);
}
.task-form-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 16px;
}
.task-form-actions .btn-primary,
.task-form-actions .btn-secondary {
  padding: 10px 18px;
  font-size: 14px;
  border-radius: var(--radius-md);
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.task-form-actions .btn-icon,
.task-comment-form-actions .btn-icon { margin-right: 0; }
.task-attachments-list {
  display: grid;
  gap: 10px;
  margin-top: 16px;
}
.task-attachment {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 8px;
  background: var(--bg-elevated);
  border: 1px solid var(--line);
  text-decoration: none;
  color: inherit;
  transition: border-color 0.2s;
}
.task-attachment:hover { border-color: var(--accent); }
.task-attachment-img {
  flex-direction: column;
  align-items: stretch;
}
.task-attachment-img img {
  width: 100%;
  height: 120px;
  object-fit: cover;
  border-radius: 6px;
}
.task-attachment-img span { font-size: 12px; color: var(--text-muted); }
.task-attachment-file i { width: 20px; height: 20px; flex-shrink: 0; }
.task-attachments-empty { margin: 0; font-size: 13px; color: var(--text-muted); padding: 12px 0; }
.task-upload-form .task-form-actions { margin-top: 14px; }
.task-upload-wrap { margin-bottom: 10px; }
.task-upload-label input { display: none; }
.task-upload-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  background: var(--bg-elevated);
  border: 1px dashed var(--line);
  border-radius: var(--radius-md);
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-main);
  transition: border-color 0.2s, background 0.2s;
}
.task-upload-btn:hover { border-color: var(--accent); background: rgba(243, 55, 43, 0.06); }
.task-upload-btn i { width: 18px; height: 18px; }
.task-upload-preview { margin-top: 12px; }
.task-upload-preview-img {
  max-width: 100%;
  max-height: 150px;
  border-radius: 8px;
  object-fit: contain;
}
.task-upload-preview-name { font-size: 13px; }
.task-flash { margin-bottom: 16px; }

.task-comments-section {
  margin-top: 28px;
  padding: 24px 28px 28px;
  border-top: 1px solid var(--line);
}
.task-comments-section h4 { margin: 0 0 16px; font-size: 14px; font-weight: 600; color: var(--text-muted); }
.task-comment-form { margin-bottom: 24px; }
.task-comment-form-body { display: flex; flex-direction: column; gap: 12px; }
.task-comment-form textarea {
  width: 100%;
  padding: 14px 16px;
  min-height: 96px;
  resize: vertical;
  border-radius: var(--radius-md);
  border: 1px solid var(--line);
  background: var(--bg-input);
  color: var(--text-main);
  font-size: 14px;
  line-height: 1.5;
}
.task-comment-form-actions {
  display: flex;
  justify-content: flex-end;
  align-items: center;
}
.task-comment-form-actions .btn-primary {
  padding: 10px 20px;
  font-size: 14px;
  border-radius: var(--radius-md);
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.task-comments-list { display: flex; flex-direction: column; gap: 14px; }
.task-comment {
  padding: 16px 18px;
  background: var(--bg-elevated);
  border-radius: var(--radius-md);
  border: 1px solid var(--line);
}
.task-comment-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.task-comment-header strong { font-size: 14px; }
.task-comment-date { font-size: 12px; color: var(--text-muted); }
.task-comment-body { font-size: 14px; line-height: 1.5; }
.task-comments-empty { margin: 0; font-size: 13px; color: var(--text-muted); }

.ticket-comments-list { display: flex; flex-direction: column; gap: 14px; }
.ticket-comment { padding: 14px; background: var(--bg-elevated); border-radius: 10px; border: 1px solid var(--line); }
.ticket-comment-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.ticket-comment-header strong { font-size: 14px; }
.ticket-comment-date { font-size: 12px; color: var(--text-muted); }
.ticket-comment-body { font-size: 14px; line-height: 1.5; }
.ticket-attachments { margin: 0; padding-left: 20px; }
.ticket-attachments li { margin-bottom: 6px; }
.ticket-attachments a { color: var(--accent); }

/* Ticket view page */
.ticket-view-nav { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; font-size: 14px; }
.ticket-view-back { color: var(--accent); text-decoration: none; display: inline-flex; align-items: center; gap: 6px; }
.ticket-view-back:hover { text-decoration: underline; }
.ticket-view-sep { color: var(--text-muted); font-size: 12px; }
.ticket-view-title { margin: 0 0 16px; font-size: 22px; font-weight: 600; line-height: 1.3; color: var(--text-main); }
.ticket-view-badges { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 24px; }
.ticket-view-badge {
  display: inline-flex; align-items: center; padding: 6px 12px; border-radius: 8px;
  font-size: 13px; font-weight: 500;
}
.ticket-view-badge--id { background: var(--bg-elevated); color: var(--text-muted); }
.ticket-view-badge--status { }
.ticket-view-badge--new { background: rgba(99, 102, 241, 0.2); color: #818cf8; }
.ticket-view-badge--in_progress { background: rgba(59, 130, 246, 0.2); color: #60a5fa; }
.ticket-view-badge--waiting_client, .ticket-view-badge--waiting_provider { background: rgba(245, 158, 11, 0.2); color: #fbbf24; }
.ticket-view-badge--resolved { background: rgba(34, 197, 94, 0.2); color: #22c55e; }
.ticket-view-badge--closed { background: rgba(107, 114, 128, 0.2); color: #9ca3af; }
.ticket-view-badge--cat { background: var(--bg-elevated); color: var(--text-subtle); }
.ticket-view-badge--priority { background: var(--bg-elevated); color: var(--text-main); font-weight: 600; }
.ticket-view-layout { display: grid; grid-template-columns: 1fr 320px; gap: 24px; }
@media (max-width: 960px) { .ticket-view-layout { grid-template-columns: 1fr; } }
.ticket-view-main { display: flex; flex-direction: column; gap: 20px; min-width: 0; }
.ticket-view-sidebar { display: flex; flex-direction: column; gap: 20px; }
.ticket-view-card { }
.ticket-view-section-title {
  display: flex; align-items: center; gap: 10px; margin: 0 0 16px;
  font-size: 15px; font-weight: 600; color: var(--text-main);
}
.ticket-view-section-title .section-icon { width: 18px; height: 18px; color: var(--text-muted); }
.ticket-view-description {
  font-size: 15px; line-height: 1.6; color: var(--text-main);
  white-space: pre-wrap; word-break: break-word;
  padding: 16px; background: var(--bg-elevated); border-radius: 10px; border: 1px solid var(--line);
}
.ticket-view-attachments { margin-top: 20px; }
.ticket-view-att-title { margin: 0 0 12px; font-size: 13px; font-weight: 600; color: var(--text-muted); }
.ticket-attachment-cards { display: flex; flex-wrap: wrap; gap: 12px; }
.ticket-attachment-card {
  display: flex; align-items: center; gap: 10px; padding: 12px 16px;
  background: var(--bg-elevated); border: 1px solid var(--line); border-radius: 10px;
  color: inherit; text-decoration: none; transition: border-color 0.2s, background 0.2s;
}
.ticket-attachment-card:hover { border-color: var(--accent); background: rgba(99, 102, 241, 0.06); }
.ticket-attachment-icon { width: 20px; height: 20px; color: var(--accent); flex-shrink: 0; }
.ticket-attachment-name { font-size: 14px; font-weight: 500; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.ticket-attachment-type { font-size: 11px; color: var(--text-muted); }
.ticket-comment--view { }
.ticket-comment-author { font-weight: 600; font-size: 14px; }
.ticket-view-info-list { display: flex; flex-direction: column; gap: 14px; }
.ticket-view-info-item { display: flex; flex-direction: column; gap: 4px; }
.ticket-view-info-label { font-size: 12px; color: var(--text-muted); }
.ticket-view-info-value { font-size: 14px; color: var(--text-main); }
.ticket-view-info-link { color: var(--accent); text-decoration: none; }
.ticket-view-info-link:hover { text-decoration: underline; }
.ticket-view-form { display: flex; flex-direction: column; gap: 16px; }
.ticket-view-form-label { display: flex; flex-direction: column; gap: 6px; }
.ticket-view-form-label-text { font-size: 13px; font-weight: 500; color: var(--text-muted); }
.ticket-view-select { padding: 10px 12px; border-radius: 8px; border: 1px solid var(--line); background: var(--bg-input); color: var(--text-main); }
.ticket-view-textarea { padding: 10px 12px; border-radius: 8px; border: 1px solid var(--line); background: var(--bg-input); color: var(--text-main); resize: vertical; }
.ticket-view-submit { width: 100%; justify-content: center; }
.card--flash { margin-bottom: 20px; }

/* Toast notifications */
.toast-container {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 10000;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}
.toast {
  padding: 12px 18px;
  border-radius: 10px;
  background: #232730;
  border: 1px solid #363c4a;
  color: var(--text-main);
  font-size: 14px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.3);
  animation: toast-in 0.3s ease;
  pointer-events: auto;
}
.toast.success { border-left: 4px solid var(--good); }
.toast.error { border-left: 4px solid var(--bad); }
.toast.info { border-left: 4px solid #3b82f6; }
@keyframes toast-in {
  from { opacity: 0; transform: translateX(100%); }
  to { opacity: 1; transform: translateX(0); }
}

/* Mobile top bar - hidden on desktop */
.mobile-top-bar {
  display: none;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  background: #1a1c23;
  border-bottom: 1px solid #2c2f39;
}
.mobile-burger {
  width: 40px;
  height: 40px;
  border: none;
  background: rgba(255,255,255,0.08);
  color: var(--text-main);
  border-radius: 10px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
.mobile-burger svg { width: 22px; height: 22px; }
.global-search-wrap {
  flex: 1;
  position: relative;
}
.global-search-wrap .search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  width: 18px;
  height: 18px;
  color: var(--text-muted);
}
.global-search-input {
  width: 100%;
  padding: 10px 12px 10px 40px;
  border: 1px solid #2d3140;
  border-radius: 10px;
  background: #232730;
  color: var(--text-main);
  font-size: 14px;
}
/* Global search dropdown - above all sections, never clipped */
.global-search-results {
  position: fixed;
  min-width: 320px;
  max-width: 480px;
  background: linear-gradient(180deg, #23262c 0%, #1c1e24 100%);
  border: 1px solid #363c4a;
  border-radius: 12px;
  max-height: 420px;
  overflow-y: auto;
  overflow-x: hidden;
  display: none;
  box-shadow: 0 12px 40px rgba(0,0,0,0.5), 0 0 0 1px rgba(255,255,255,0.03) inset;
  z-index: 10001;
  animation: global-search-drop 0.2s ease;
}
@keyframes global-search-drop {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: translateY(0); }
}
.global-search-results.open { display: block; }
.global-search-results::-webkit-scrollbar { width: 8px; }
.global-search-results::-webkit-scrollbar-track { background: transparent; }
.global-search-results::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.15); border-radius: 4px; }
.global-search-results::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.25); }

.global-search-result-item {
  display: grid;
  grid-template-columns: auto 1fr;
  grid-template-rows: auto auto;
  gap: 8px 14px;
  padding: 14px 16px;
  color: inherit;
  text-decoration: none;
  border-bottom: 1px solid rgba(255,255,255,0.04);
  transition: background 0.15s;
  align-items: start;
}
.global-search-result-item:hover {
  background: rgba(255,255,255,0.05);
}
.global-search-result-item:last-child { border-bottom: none; border-radius: 0 0 12px 12px; }
.global-search-result-item:first-child:not(:only-child) { border-radius: 12px 12px 0 0; }
.global-search-result-item:only-child { border-radius: 12px; }

.global-search-result-badge {
  grid-row: 1 / -1;
  align-self: start;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: 8px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  white-space: nowrap;
  flex-shrink: 0;
}
.global-search-result-badge svg { width: 14px; height: 14px; opacity: 0.9; flex-shrink: 0; }
.global-search-badge--deposit { background: rgba(34, 197, 94, 0.18); color: #4ade80; }
.global-search-badge--ticket { background: rgba(99, 102, 241, 0.18); color: #818cf8; }
.global-search-badge--player_chat { background: rgba(59, 130, 246, 0.18); color: #60a5fa; }
.global-search-badge--task { background: rgba(245, 158, 11, 0.18); color: #fbbf24; }

.global-search-result-content {
  grid-column: 2;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.global-search-result-header {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-main);
  line-height: 1.4;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}
.global-search-result-id {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}
.global-search-result-meta {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.4;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Empty state */
.global-search-empty {
  padding: 32px 24px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}
.global-search-empty-icon {
  width: 48px;
  height: 48px;
  color: var(--text-subtle);
  opacity: 0.5;
}
.global-search-empty-text {
  font-size: 15px;
  font-weight: 500;
  color: var(--text-muted);
}
.global-search-empty-hint {
  font-size: 13px;
  color: var(--text-subtle);
  opacity: 0.8;
}
.global-search-empty--error .global-search-empty-icon { color: var(--bad); }

/* Light theme search dropdown */
body.theme-light .global-search-results {
  background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
  border-color: #e2e8f0;
  box-shadow: 0 12px 40px rgba(30,50,90,0.12), 0 0 0 1px rgba(0,0,0,0.04);
}
body.theme-light .global-search-result-item { border-bottom-color: rgba(0,0,0,0.06); }
body.theme-light .global-search-result-item:hover { background: rgba(0,0,0,0.03); }
body.theme-light .global-search-badge--deposit { background: rgba(34, 197, 94, 0.12); color: #16a34a; }
body.theme-light .global-search-badge--ticket { background: rgba(99, 102, 241, 0.12); color: #4f46e5; }
body.theme-light .global-search-badge--player_chat { background: rgba(59, 130, 246, 0.12); color: #2563eb; }
body.theme-light .global-search-badge--task { background: rgba(245, 158, 11, 0.12); color: #d97706; }

/* Desktop global search - in header area */
.desktop-search-wrap {
  position: relative;
  width: 220px;
  margin: 14px 0 16px;
}
.desktop-search-wrap .search-icon {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  width: 16px;
  height: 16px;
  color: var(--text-muted);
}
.desktop-search-wrap .global-search-input {
  padding: 8px 10px 8px 34px;
  font-size: 13px;
}

/* Chat */
.chat-container {
  display: flex;
  flex-direction: column;
  height: calc(100vh - 200px);
  min-height: 400px;
  padding: 0;
  overflow: hidden;
}
.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.chat-empty {
  color: var(--text-subtle);
  text-align: center;
  padding: 40px 20px;
  margin: 0;
}
.chat-message {
  display: flex;
  gap: 12px;
  align-items: flex-start;
}
.chat-message-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  overflow: hidden;
  flex-shrink: 0;
  background: var(--bg-input);
}
.chat-message-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.chat-message-initial {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  font-size: 16px;
  font-weight: 600;
  color: var(--text-muted);
}
.chat-message-body {
  flex: 1;
  min-width: 0;
}
.chat-message-author {
  font-weight: 600;
  font-size: 14px;
  color: var(--text-main);
  margin-right: 8px;
}
.chat-message-time {
  font-size: 12px;
  color: var(--text-subtle);
}
.chat-message-text {
  margin: 4px 0 0;
  font-size: 14px;
  line-height: 1.5;
  color: var(--text-main);
  white-space: pre-wrap;
  word-break: break-word;
}
.chat-form {
  display: flex;
  gap: 12px;
  padding: 16px 20px;
  border-top: 1px solid var(--line);
  background: var(--bg-panel-soft);
  align-items: flex-end;
}
.chat-form textarea {
  flex: 1;
  resize: none;
  min-height: 44px;
  max-height: 120px;
}
.chat-send-btn {
  flex-shrink: 0;
  width: 44px;
  height: 44px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-md);
}
.chat-send-btn svg {
  width: 20px;
  height: 20px;
}

/* Global chat panel (right side, collapsible) */
.global-chat-panel {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  z-index: 900;
  display: flex;
  align-items: stretch;
  pointer-events: none;
}
.global-chat-panel > * { pointer-events: auto; }
.global-chat-toggle {
  position: fixed;
  top: 50%;
  right: 0;
  transform: translateY(-50%) rotate(180deg);
  writing-mode: vertical-rl;
  text-orientation: mixed;
  padding: 16px 10px;
  background: var(--bg-panel);
  border: 1px solid var(--line);
  border-right: none;
  border-radius: var(--radius-md) 0 0 var(--radius-md);
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.2s, color 0.2s, top 0.2s;
  display: flex;
  align-items: center;
  gap: 8px;
  box-shadow: -4px 0 16px rgba(0,0,0,0.2);
  z-index: 900;
}
body.has-player-chat .global-chat-toggle {
  top: calc(50% - 45px);
  transform: rotate(180deg);
}
.global-chat-toggle:hover {
  background: var(--bg-elevated);
  color: var(--accent);
}
.global-chat-toggle svg { width: 20px; height: 20px; }
.global-chat-inner {
  width: 0;
  overflow: hidden;
  background: var(--bg-panel);
  border-left: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  box-shadow: -8px 0 24px rgba(0,0,0,0.25);
  transition: width 0.3s ease;
}
.global-chat-panel.open .global-chat-inner {
  width: 340px;
  min-width: 340px;
}
.global-chat-panel.open .global-chat-toggle {
  display: none !important;
}
.global-chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
  flex-shrink: 0;
}
.global-chat-header h3 {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
}
.global-chat-close {
  width: 32px;
  height: 32px;
  padding: 0;
  border: none;
  background: transparent;
  color: var(--text-muted);
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s, color 0.2s;
}
.global-chat-close:hover {
  background: var(--bg-input);
  color: var(--text-main);
}
.global-chat-close svg { width: 18px; height: 18px; }
.global-chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 0;
}
.global-chat-form {
  display: flex;
  gap: 10px;
  padding: 12px 16px;
  border-top: 1px solid var(--line);
  background: var(--bg-panel-soft);
  align-items: flex-end;
  flex-shrink: 0;
}
.global-chat-form textarea {
  flex: 1;
  resize: none;
  min-height: 40px;
  max-height: 100px;
  font-size: 14px;
}
.global-chat-send {
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
}
.global-chat-send svg { width: 18px; height: 18px; }
@media (max-width: 768px) {
  .global-chat-panel.open .global-chat-inner {
    width: 100vw;
    min-width: 100vw;
  }
  .global-chat-toggle { padding: 12px 8px; font-size: 12px; }
}

/* Confidential notice modal */
.confidential-notice-overlay {
  position: fixed;
  inset: 0;
  z-index: 2000;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.confidential-notice-overlay.hidden {
  display: none;
}
.confidential-notice {
  max-width: 480px;
  padding: 28px 32px;
  text-align: center;
}
.confidential-notice-icon {
  width: 56px;
  height: 56px;
  margin: 0 auto 20px;
  border-radius: var(--radius-xl);
  background: var(--accent-glow);
  color: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
}
.confidential-notice-icon svg {
  width: 28px;
  height: 28px;
}
.confidential-notice h2 {
  margin: 0 0 16px;
  font-size: 20px;
  font-weight: 600;
}
.confidential-notice p {
  margin: 0 0 12px;
  font-size: 15px;
  line-height: 1.6;
  color: var(--text-muted);
  text-align: left;
}
.confidential-notice p:last-of-type {
  margin-bottom: 24px;
}
.confidential-notice-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

/* Empty state */
.empty-state {
  text-align: center;
  padding: 64px 32px;
  color: var(--text-muted);
}
.empty-state-icon {
  width: 80px;
  height: 80px;
  margin: 0 auto 24px;
  padding: 20px;
  border-radius: var(--radius-xl);
  background: var(--accent-glow);
  color: var(--accent);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.empty-state-icon svg { width: 40px; height: 40px; }
.empty-state h3 { margin: 0 0 8px; font-size: 18px; font-weight: 600; color: var(--text-main); letter-spacing: -0.02em; }
.empty-state p { margin: 0 0 24px; font-size: 15px; line-height: 1.6; max-width: 360px; margin-left: auto; margin-right: auto; }
.empty-state .btn-link { margin-top: 8px; }

/* Skeleton loading */
.skeleton {
  background: linear-gradient(90deg, var(--bg-panel-soft) 25%, var(--bg-elevated) 50%, var(--bg-panel-soft) 75%);
  background-size: 200% 100%;
  animation: skeleton 1.2s ease-in-out infinite;
  border-radius: var(--radius-sm);
}
body.theme-light .skeleton {
  background: linear-gradient(90deg, var(--line-soft) 25%, var(--bg-input) 50%, var(--line-soft) 75%);
  background-size: 200% 100%;
}
@keyframes skeleton {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}
.skeleton-text { height: 14px; margin-bottom: 8px; }
.skeleton-title { height: 20px; width: 60%; margin-bottom: 12px; }
.skeleton-card { height: 120px; }
.loading-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.5);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  border-radius: inherit;
}
.pagination {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 16px;
  flex-wrap: wrap;
}
.pagination-link {
  padding: 6px 12px;
  border-radius: 8px;
  background: rgba(255,255,255,0.06);
  color: var(--text-main);
  text-decoration: none;
  font-size: 14px;
  transition: background 0.15s;
}
.pagination-link:hover { background: rgba(255,255,255,0.12); }
.pagination-info { font-size: 13px; color: var(--text-muted); }

.loading-spinner {
  width: 40px;
  height: 40px;
  border: 3px solid rgba(255,255,255,0.2);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ═══════════════════════════════════════════════════
   RESPONSIVE: Tablet + Mobile
   Galaxy Tab S8+ (~800px), iPad (~810px), phones
   ═══════════════════════════════════════════════════ */

/* --- Tablet & mobile (≤1024px): sidebar off-canvas, compact layout --- */
@media (max-width: 1024px) {
  .topbar-burger { display: flex !important; }
  .topbar-profile-name { display: none; }
  .topbar-profile-chevron { display: none; }

  .app-shell {
    grid-template-rows: 56px 1fr;
    grid-template-areas: "topbar topbar" "content content";
  }
  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    height: 100dvh;
    width: 280px;
    z-index: 1001;
    transform: translateX(-100%);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    grid-area: unset;
    padding-top: env(safe-area-inset-top, 0);
  }
  .sidebar.mobile-open {
    transform: translateX(0);
    box-shadow: 8px 0 24px rgba(0,0,0,0.4);
  }
  .sidebar-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 1000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s;
  }
  .sidebar-overlay.visible {
    opacity: 1;
    pointer-events: auto;
  }
  .sidebar-toggle { display: none; }

  .content {
    padding: 20px 16px;
    gap: 16px;
  }

  .topbar-center { max-width: 320px; margin: 0 8px; }

  .page-header { flex-direction: column; gap: 12px; align-items: flex-start; }
  .page-header-dashboard .page-header-content { flex-direction: column; align-items: flex-start; }
  .hero-illustration { display: none; }

  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .dashboard-widgets-row { grid-template-columns: 1fr; }
  .page-actions { flex-wrap: wrap; }

  .task-view-layout { grid-template-columns: 1fr; }
  .ticket-view-layout { grid-template-columns: 1fr; }

  .ps-list-grid { grid-template-columns: 1fr 1fr; }
  .ps-view-methods-grid { grid-template-columns: 1fr; }

  /* Tables: horizontal scroll for cards without explicit scroll-wrap */
  .card:has(> table) { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .table-scroll-wrap { max-height: none; }
  table { min-width: 600px; }
  .table-compact th, .table-compact td { padding: 8px 10px; }

  /* Forms: stack multi-column layouts */
  .ps-view-meta-grid { grid-template-columns: 1fr 1fr; }
  .player-chats-player-card-grid { grid-template-columns: 1fr 1fr; }

  /* Cards in grids */
  .grid { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }

  /* Topbar: compact on tablet */
  .app-topbar { padding: 0 12px; gap: 8px; }
  .topbar-search-input { font-size: 13px; padding: 8px 12px 8px 36px; }
  .topbar-search-icon { left: 10px; }
}

/* --- Phone landscape & small tablet (≤768px) --- */
@media (max-width: 768px) {
  .topbar-center { max-width: none; margin: 0 6px; flex: 1; }
  .topbar-search-input { padding: 8px 10px 8px 34px; }

  .content { padding: 16px 12px; gap: 14px; }

  .stats-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .stat-card { padding: 14px; gap: 10px; }
  .stat-card .stat-icon { width: 36px; height: 36px; }
  .stat-card .stat-value { font-size: 20px; }

  .ps-list-grid { grid-template-columns: 1fr; }

  .card { border-radius: 10px; }

  /* Header actions: full width on phone */
  .page-header { padding-bottom: 14px; margin-bottom: 16px; }
  .page-header h1 { font-size: 20px; }

  /* Reduce padding in cards */
  .card { padding: 16px; }

  /* Player chat: mobile split-view */
  .player-chats-layout { position: relative; }
  .player-chats-sidebar { width: 100%; min-width: 0; border-right: none; }
  .player-chats-main { position: absolute; inset: 0; z-index: 10; background: var(--bg-panel); }
  .player-chats-layout:not(.has-conversation) .player-chats-main { display: none; }
  .player-chats-layout.has-conversation .player-chats-sidebar { visibility: hidden; }
  .player-chats-mobile-back { display: flex !important; }

  /* Conversation header compact */
  .player-chats-conv-header { padding: 10px 12px; }
  .player-chats-conv-header-top { flex-direction: column; gap: 10px; }
  .player-chats-header-actions { flex-wrap: wrap; gap: 8px; }
  .player-chats-conv-title { font-size: 15px; }
  .player-chats-conv-meta { font-size: 12px; }
  .player-chats-conv-messages { padding: 12px; gap: 10px; }
  .player-chat-msg { max-width: 92%; padding: 10px 12px; }
  .player-chats-conv-footer { padding: 10px 12px; }
  .player-chats-reply-body textarea { min-height: 72px; padding: 10px 40px 10px 10px; font-size: 15px; }
  .player-chats-reply-actions { flex-direction: row; flex-wrap: wrap; }
  .player-chats-reply-buttons { gap: 6px; }
  .player-chats-btn-upload, .player-chats-btn-ticket { padding: 8px 10px; font-size: 12px; }

  /* Player card compact */
  .player-chats-player-card { margin-top: 8px; padding: 10px; }
  .player-chats-player-card-grid { grid-template-columns: 1fr; gap: 8px; }

  /* Tags compact */
  .player-chats-tags-row { flex-direction: column; align-items: stretch; }
  .player-chats-tags-input { max-width: none; }
  .player-chats-tags-quick { flex-wrap: wrap; }

  /* Filter tabs scroll */
  .player-chats-filter-tabs { overflow-x: auto; flex-wrap: nowrap; -webkit-overflow-scrolling: touch; scrollbar-width: none; }
  .player-chats-filter-tabs::-webkit-scrollbar { display: none; }
  .player-chats-tab { white-space: nowrap; flex-shrink: 0; }

  /* Ticket modal compact */
  .player-chat-ticket-modal-box { max-width: calc(100vw - 24px); top: 16px; left: 12px; right: 12px; transform: none; max-height: calc(100dvh - 32px); }

  /* Form layouts: stack on mobile */
  .form-actions { flex-wrap: wrap; }
  .form-actions .btn-primary, .form-actions .btn-secondary { flex: 1; min-width: 120px; justify-content: center; }

  /* Forms: full-width fields */
  .ps-view-meta-grid { grid-template-columns: 1fr; }

  /* Emoji panel: wider on mobile */
  .player-chats-emoji-panel { width: 260px; }
  .player-chats-emoji-grid { grid-template-columns: repeat(8, 1fr); }

  /* Toast: full-width on mobile */
  .toast-container { left: 8px; right: 8px; bottom: 8px; padding: 0; }
  .toast { width: 100%; max-width: none; }

  /* Scroll-to-top: smaller on mobile */
  .scroll-top-btn { bottom: 16px; right: 16px; width: 36px; height: 36px; }

  /* Search results: full-width on mobile */
  .topbar-search-results { min-width: 0; max-width: none; left: 8px !important; right: 8px; width: auto !important; }
}

/* --- Small phone (≤480px): iPhone 16 Pro Max portrait etc. --- */
@media (max-width: 480px) {
  .app-topbar { height: 48px; padding: 0 8px; gap: 6px; }
  .app-shell { grid-template-rows: 48px 1fr; }

  .topbar-brand-text { display: none; }
  .topbar-brand-dot { width: 10px; height: 10px; }
  .topbar-online-btn { padding: 6px 8px; font-size: 12px; }
  .topbar-chat-status { width: 36px; height: 36px; }
  .topbar-profile-btn { padding: 4px 6px 4px 4px; }
  .topbar-profile-initial, .topbar-profile-avatar { width: 28px; height: 28px; }
  .topbar-burger { width: 36px; height: 36px; }

  .content { padding: 12px 8px; gap: 12px; }

  .stats-grid { grid-template-columns: 1fr; gap: 8px; }
  .stat-card { padding: 12px; }

  .page-header h1 { font-size: 18px; }
  .page-header p { font-size: 13px; }

  .grid { grid-template-columns: 1fr; }

  /* All buttons touch-friendly */
  .btn-primary, .btn-secondary, .btn-link, .btn-sm { min-height: 44px; }
  select, input[type="text"], input[type="email"], input[type="password"],
  input[type="search"], input[type="number"], input[type="url"], textarea {
    min-height: 44px;
    font-size: 16px !important;
  }

  /* Player chat: ultra compact */
  .player-chats-sidebar-header { padding: 10px; }
  .player-chats-sidebar-header h2 { font-size: 16px; margin-bottom: 8px; }
  .player-chat-item { padding: 10px 12px; gap: 10px; }
  .player-chat-item-avatar { width: 36px; height: 36px; font-size: 14px; }
  .player-chat-item-name { font-size: 13px; }
  .player-chat-item-preview { font-size: 12px; }

  /* Message attachments compact */
  .player-chat-msg-attachment-img { max-width: 200px; max-height: 200px; }

  /* Sidebar wider on very small phones */
  .sidebar { width: 85vw; max-width: 300px; }

  /* Card padding reduced */
  .card { padding: 12px; }
  .card h3 { font-size: 15px; }

  /* Table font smaller */
  table { font-size: 12px; min-width: 500px; }
  table th { font-size: 10px; }
  table td, table th { padding: 8px; }

  /* Modal: nearly full screen */
  .player-chat-ticket-modal-box { top: 8px; left: 8px; right: 8px; max-height: calc(100dvh - 16px); }
  .confidential-notice { padding: 20px 16px; }
  .confidential-notice h2 { font-size: 18px; }

  /* Lightbox controls more visible */
  .chat-lightbox-close { top: 12px; right: 16px; font-size: 28px; }
  .chat-lightbox-dl { bottom: env(safe-area-inset-bottom, 16px); }

  /* Pagination compact */
  .pagination { gap: 6px; }
  .pagination-link { padding: 8px 10px; font-size: 13px; }
}

/* --- Safe areas for notched devices (iPhone) --- */
@supports (padding: env(safe-area-inset-top)) {
  .app-topbar {
    padding-left: max(12px, env(safe-area-inset-left));
    padding-right: max(12px, env(safe-area-inset-right));
  }
  @media (max-width: 1024px) {
    .content {
      padding-left: max(12px, env(safe-area-inset-left));
      padding-right: max(12px, env(safe-area-inset-right));
    }
    .player-chats-conv-footer {
      padding-bottom: max(12px, env(safe-area-inset-bottom));
    }
  }
}

/* --- Touch-friendly: larger tap targets on touch devices --- */
@media (pointer: coarse) {
  .sidebar-nav a { min-height: 44px; display: flex; align-items: center; }
  .nav-group-toggle { min-height: 44px; }
  .player-chats-tab { min-height: 36px; padding: 8px 14px; }
  .player-chat-item { min-height: 56px; }
  .topbar-online-list li a, .topbar-online-list li span { min-height: 44px; }
  .topbar-profile-dropdown a { min-height: 44px; }
  .player-chats-tag-btn { min-height: 36px; padding: 8px 14px; }
  .pagination-link { min-height: 40px; display: inline-flex; align-items: center; }
  .btn-sm { min-height: 40px; }
}

/* --- Mobile: back button for player chat (hidden on desktop) --- */
.player-chats-mobile-back {
  display: none;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  margin-right: auto;
  border: none;
  background: transparent;
  color: var(--accent);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  border-radius: 8px;
  transition: background 0.2s;
  flex-shrink: 0;
}
.player-chats-mobile-back:hover { background: var(--accent-glow); }
.player-chats-mobile-back i { width: 18px; height: 18px; }

/* --- Landscape mode optimizations --- */
@media (max-height: 500px) and (orientation: landscape) {
  .app-topbar { height: 44px; }
  .app-shell { grid-template-rows: 44px 1fr; }
  .player-chats-conv-header { padding: 8px 12px; }
  .player-chats-conv-messages { padding: 8px; gap: 6px; }
  .player-chats-conv-footer { padding: 8px 12px; }
  .player-chats-reply-body textarea { min-height: 56px; }
  .sidebar { padding-top: 8px; }
}

@media (min-width: 1025px) {
  .topbar-burger { display: none !important; }
}

/* Turbo Drive: progress bar при переходах */
.turbo-progress-bar {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 999999;
  height: 3px;
  background: var(--accent);
  transition: width 0.15s ease-out, opacity 0.15s ease-out;
}

/* ═══════════════════════════════════════════════════
   UX Improvements
   ═══════════════════════════════════════════════════ */

/* --- Clickable table rows --- */
tr[data-href] { cursor: pointer; }
tr[data-href]:hover td { background: var(--bg-panel-soft) !important; }
tr[data-href]:active td { background: var(--bg-elevated) !important; }

/* --- Better focus indicators --- */
a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* --- Button loading state --- */
.btn-loading { position: relative; pointer-events: none; opacity: 0.7; }
.btn-loading::after {
  content: '';
  position: absolute;
  width: 16px; height: 16px;
  top: 50%; right: 12px;
  margin-top: -8px;
  border: 2px solid transparent;
  border-top-color: currentColor;
  border-radius: 50%;
  animation: btn-spin 0.6s linear infinite;
}
@keyframes btn-spin { to { transform: rotate(360deg); } }

/* --- Scroll-to-top button --- */
.scroll-top-btn {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 900;
  width: 40px; height: 40px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  border: none;
  cursor: pointer;
  display: none;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-md);
  transition: transform 0.2s, opacity 0.2s;
  opacity: 0.85;
}
.scroll-top-btn:hover { transform: scale(1.1); opacity: 1; }
.scroll-top-btn.visible { display: flex; }

/* --- Breadcrumbs --- */
.breadcrumbs {
  display: flex; align-items: center; gap: 6px;
  font-size: 13px; color: var(--text-muted);
  margin-bottom: 8px; flex-wrap: wrap;
}
.breadcrumbs a { color: var(--text-muted); text-decoration: none; }
.breadcrumbs a:hover { color: var(--accent); }
.breadcrumbs-sep { opacity: 0.4; }
.breadcrumbs-current { color: var(--text-main); font-weight: 500; }

/* --- Improved card hover --- */
.card { transition: box-shadow 0.2s ease, border-color 0.2s ease; }
.card:hover { border-color: var(--line); box-shadow: var(--shadow-md); }

/* --- Compact table mode --- */
.table-compact th, .table-compact td { padding: 10px 14px; font-size: 13px; }
.table-compact th { font-size: 10px; }

/* --- Table row actions on hover --- */
.row-actions { opacity: 0; transition: opacity 0.15s; }
tr:hover .row-actions { opacity: 1; }

/* --- Quick-action bar (keyboard shortcut hints) --- */
.kbd {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 20px; height: 20px;
  padding: 0 5px;
  font-size: 11px; font-weight: 600; font-family: monospace;
  color: var(--text-muted); background: var(--bg-elevated);
  border: 1px solid var(--line); border-radius: 4px;
}

/* --- Improved badge pill --- */
.badge-pill {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 10px; border-radius: 999px;
  font-size: 12px; font-weight: 500;
  background: var(--bg-panel-soft); color: var(--text-muted);
  border: 1px solid var(--line-soft);
}
.badge-pill--accent { background: var(--accent-glow); color: var(--accent); border-color: rgba(243,55,43,0.2); }
.badge-pill--good { background: var(--good-soft); color: var(--good); border-color: rgba(34,197,94,0.2); }
.badge-pill--warn { background: var(--warn-soft); color: var(--warn); border-color: rgba(245,158,11,0.2); }

/* --- Smoother sidebar transitions --- */
.sidebar-nav a { transition: background 0.15s ease, color 0.15s ease, padding-left 0.15s ease; }
.sidebar-nav a:hover { padding-left: 16px; }
.sidebar-nav a.active { padding-left: 16px; }

/* --- Form input group --- */
.input-group {
  display: flex; align-items: stretch;
  border: 1px solid var(--line); border-radius: var(--radius-sm);
  overflow: hidden; background: var(--bg-input);
}
.input-group input, .input-group select { border: none; background: transparent; flex: 1; }
.input-group-addon {
  display: flex; align-items: center; padding: 0 12px;
  font-size: 13px; color: var(--text-muted);
  background: var(--bg-elevated); border-right: 1px solid var(--line);
}

/* --- Tooltip --- */
[data-tooltip] { position: relative; }
[data-tooltip]:hover::after {
  content: attr(data-tooltip);
  position: absolute; bottom: calc(100% + 8px); left: 50%;
  transform: translateX(-50%);
  padding: 6px 12px; border-radius: 6px;
  font-size: 12px; font-weight: 500; white-space: nowrap;
  background: #1a1d24; color: #f1f3f5;
  border: 1px solid var(--line);
  box-shadow: var(--shadow-sm);
  z-index: 999;
  pointer-events: none;
  animation: tooltip-in 0.15s ease;
}
@keyframes tooltip-in { from { opacity: 0; transform: translateX(-50%) translateY(4px); } }

/* --- Status dot (animated) --- */
.status-dot-live {
  display: inline-block; width: 8px; height: 8px;
  border-radius: 50%; background: var(--good);
  animation: status-pulse 2s ease-in-out infinite;
}
@keyframes status-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.4); }
  50% { box-shadow: 0 0 0 6px rgba(34, 197, 94, 0); }
}

/* --- Empty state improvements --- */
.empty-state { padding: 48px 24px; }
.empty-state-icon { opacity: 0.3; margin-bottom: 16px; }

/* --- Page transition (Turbo) --- */
turbo-frame[busy] { opacity: 0.6; transition: opacity 0.15s; pointer-events: none; }

/* --- Notification badge pulse --- */
.nav-badge-new {
  animation: badge-pulse 2s ease-in-out infinite;
}
@keyframes badge-pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.1); }
}
