/* Основные стили */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  min-height: 100vh;
  color: #333;
  font-size: var(--fs-md);
}

:root {
  --fs-xxs: clamp(11px, 0.65vw, 12px);
  --fs-xs: clamp(12px, 0.75vw, 14px);
  --fs-sm: clamp(13px, 0.85vw, 15px);
  --fs-md: clamp(15px, 1vw, 17px);
  --fs-lg: clamp(14px, 0.9vw, 16px);
  --fs-xl: clamp(22px, 1.6vw, 26px);
  --fs-2xl: clamp(20px, 1.2vw, 24px);
  --fs-3xl: clamp(32px, 2.5vw, 40px);
}

/* Контейнеры */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 20px;
}

/* Хедер */
.header {
  background: rgba(255, 255, 255, 0.98);
  backdrop-filter: blur(10px);
  box-shadow: 0 2px 20px rgba(0, 0, 0, 0.1);
  padding: 15px 30px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-radius: 15px;
  margin-bottom: 30px;
  position: relative;
  z-index: 4100;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 20px;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 6px;
  position: relative;
  z-index: 4101;
}

.user-info {
  font-size: var(--fs-md);
  color: #555;
  font-weight: 500;
}

.user-info .username {
  color: #667eea;
  font-weight: 600;
}

/* Кнопки */
.btn {
  padding: 10px 20px;
  border: none;
  border-radius: 8px;
  font-size: var(--fs-sm);
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.btn-primary {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
}

.btn-secondary {
  background: white;
  color: #667eea;
  border: 2px solid #667eea;
}

.btn-secondary:hover {
  background: #667eea;
  color: white;
  transform: translateY(-2px);
}

.btn-danger {
  background: #ef4444;
  color: white;
}

.btn-danger:hover {
  background: #dc2626;
  transform: translateY(-2px);
  box-shadow: 0 5px 15px rgba(239, 68, 68, 0.4);
}

.btn-success {
  background: #10b981;
  color: white;
}

.btn-success:hover {
  background: #059669;
  transform: translateY(-2px);
}

.btn-logout {
  background: #f3f4f6;
  color: #6b7280;
}

.btn-logout:hover {
  background: #e5e7eb;
  color: #4b5563;
}

.btn-admin {
  background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
  color: white;
}

.btn-admin:hover {
  transform: translateY(-2px);
  box-shadow: 0 5px 15px rgba(240, 147, 251, 0.4);
}

/* Support chat */
.support-widget {
  position: fixed;
  right: 28px;
  bottom: 28px;
  z-index: 3000;
  font-size: 14px;
}

.support-fab {
  position: absolute;
  right: 0;
  bottom: 0;
  width: 64px;
  height: 64px;
  border: 0;
  border-radius: 50%;
  background: linear-gradient(135deg, #5b4ee6 0%, #4328b7 100%);
  color: #fff;
  box-shadow: 0 16px 34px rgba(67, 40, 183, 0.35);
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.support-fab:hover {
  transform: translateY(-2px);
  box-shadow: 0 18px 40px rgba(67, 40, 183, 0.42);
}

.support-widget.is-open .support-fab {
  display: none;
}

.support-widget.is-open .support-panel {
  bottom: 0;
}

.support-fab-icon {
  font-size: 28px;
  line-height: 1;
}

.support-fab-badge {
  position: absolute;
  top: 2px;
  right: 2px;
  min-width: 22px;
  height: 22px;
  padding: 0 6px;
  border-radius: 999px;
  background: #ef4444;
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 2px solid #fff;
}

.support-panel {
  position: absolute;
  right: 0;
  bottom: 78px;
  width: min(430px, calc(100vw - 32px));
  height: min(640px, calc(100vh - 118px));
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border-radius: 18px;
  background: #fff;
  border: 1px solid rgba(107, 114, 128, 0.18);
  box-shadow: 0 24px 70px rgba(15, 23, 42, 0.24);
}

.support-panel[hidden],
.support-fab-badge[hidden],
.support-quick[hidden],
.support-context[hidden],
.support-thread-list[hidden],
.support-history-tools[hidden],
.support-ai-escalation-slot[hidden] {
  display: none !important;
}

.support-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 18px;
  background: linear-gradient(135deg, #4f46d8 0%, #35199f 100%);
  color: #fff;
}

.support-title {
  font-weight: 800;
  font-size: 18px;
}

.support-subtitle {
  margin-top: 2px;
  font-size: 12px;
  opacity: 0.84;
}

.support-header-actions {
  display: inline-flex;
  gap: 8px;
}

.support-icon-button {
  width: 30px;
  height: 30px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: #fff;
  font-size: 26px;
  line-height: 1;
  cursor: pointer;
}

.support-close-button {
  font-size: 0;
}

.support-new-button {
  font-size: 0;
}

.support-new-icon,
.support-close-icon {
  width: 22px;
  height: 22px;
  display: block;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.support-close-icon {
  width: 24px;
  height: 24px;
  stroke-width: 2.4;
}

.support-tabs {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(0, 1fr));
  border-bottom: 1px solid #e5e7eb;
  background: #fff;
}

.support-tab {
  padding: 18px 12px 16px;
  border: 0;
  border-bottom: 3px solid transparent;
  background: transparent;
  color: #6b7280;
  font-weight: 700;
  font-size: 16px;
  cursor: pointer;
}

.support-tab.is-active {
  border-bottom-color: #4f46d8;
  color: #4f46d8;
}

.support-body {
  min-height: 0;
  flex: 1;
  display: flex;
  flex-direction: column;
  background: #fff;
  overflow: hidden;
}

.support-history-tools {
  display: grid;
  grid-template-columns: 1fr;
  padding: 18px 20px 12px;
}

.support-history-tools > button,
.support-filter-button {
  display: none !important;
}

.support-search {
  height: 52px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 16px;
  border: 1px solid #e5e7eb;
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 3px 10px rgba(15, 23, 42, 0.03);
}

.support-search-icon {
  color: #6b7280;
  font-size: 24px;
  line-height: 1;
}

.support-search-input {
  min-width: 0;
  flex: 1;
  border: 0;
  outline: 0;
  color: #1f2937;
  font: inherit;
  font-weight: 600;
}

.support-search-input::placeholder {
  color: #7c7f9a;
}

.support-thread-list {
  width: 100%;
  min-height: 0;
  flex: 1;
  overflow-y: auto;
  border-right: 0;
  background: #fff;
  padding: 8px 20px 22px;
}

.support-widget.support-tab-chat .support-thread-list {
  display: none;
}

.support-thread-item {
  position: relative;
  width: 100%;
  display: grid;
  gap: 9px;
  padding: 18px 44px 18px 18px;
  margin-bottom: 14px;
  border: 1px solid #e5e7eb;
  border-radius: 16px;
  background: #fff;
  text-align: left;
  cursor: pointer;
  box-shadow: 0 8px 18px rgba(15, 23, 42, 0.03);
}

.support-thread-item:hover,
.support-thread-item.is-active {
  border-color: #c4b5fd;
  background: #fbfaff;
}

.support-thread-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.support-thread-status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: #4f46d8;
  font-weight: 800;
  font-size: 13px;
}

.support-thread-status::before {
  content: "";
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #2563eb;
}

.support-thread-item.status-in_progress .support-thread-status {
  color: #f59e0b;
}

.support-thread-item.status-in_progress .support-thread-status::before {
  background: #f59e0b;
}

.support-thread-item.status-closed .support-thread-status {
  color: #6b7280;
}

.support-thread-item.status-closed .support-thread-status::before {
  background: #9ca3af;
}

.support-thread-time {
  color: #696d8d;
  font-weight: 700;
  font-size: 13px;
}

.support-thread-title {
  color: #111827;
  font-weight: 800;
  font-size: 16px;
  line-height: 1.25;
}

.support-thread-meta,
.support-thread-preview,
.support-thread-empty {
  color: #6b7280;
  font-size: 14px;
  line-height: 1.35;
}

.support-thread-meta {
  font-weight: 700;
}

.support-thread-preview {
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.support-thread-arrow {
  position: absolute;
  right: 18px;
  top: 50%;
  transform: translateY(-50%);
  color: #4b5563;
  font-size: 34px;
  line-height: 1;
}

.support-chat-area {
  min-width: 0;
  min-height: 0;
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.support-widget.support-tab-history .support-chat-area,
.support-widget.support-tab-history .support-ai-escalation-slot,
.support-widget.support-tab-history .support-compose,
.support-widget.support-tab-history .support-footer {
  display: none;
}

.support-quick {
  display: grid;
  gap: 8px;
  padding: 16px 18px 12px;
  border-bottom: 1px solid #eef2f7;
}

.support-greeting {
  display: grid;
  gap: 4px;
  width: fit-content;
  max-width: 82%;
  padding: 12px 14px;
  border-radius: 14px;
  background: #f1efff;
  color: #374151;
  line-height: 1.35;
}

.support-quick-action {
  width: 100%;
  min-height: 42px;
  padding: 9px 12px;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  background: #fff;
  color: #4f46d8;
  font-weight: 700;
  text-align: left;
  cursor: pointer;
}

.support-quick-action:hover {
  border-color: #b8acf6;
  background: #fbfaff;
}

.support-context {
  margin: 10px 18px 0;
  padding: 22px 0 4px;
  border-top: 1px solid #e5e7eb;
  border-bottom: 1px solid #e5e7eb;
  position: relative;
}

.support-context::before {
  content: "Контекст обращения";
  position: absolute;
  left: 50%;
  top: -9px;
  transform: translateX(-50%);
  padding: 0 14px;
  background: #fff;
  color: #6b7280;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.support-context-row {
  display: grid;
  grid-template-columns: 118px 1fr;
  gap: 8px;
  padding: 0 0 10px;
  color: #6b7280;
  font-size: 12px;
}

.support-context-row strong {
  min-width: 0;
  color: #1f2937;
  font-size: 13px;
  overflow-wrap: anywhere;
}

.support-messages {
  min-height: 0;
  flex: 1;
  overflow-y: auto;
  overscroll-behavior: contain;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 14px 18px 10px;
}

.support-dialog-summary {
  display: grid;
  gap: 10px;
  padding: 4px 4px 18px;
  border-bottom: 0;
}

.support-dialog-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.support-dialog-heading h3 {
  margin: 0;
  color: #111827;
  font-size: 18px;
  line-height: 1.25;
}

.support-dialog-status {
  flex: 0 0 auto;
  padding: 8px 13px;
  border-radius: 999px;
  border: 0;
  background: #f5f3ff;
  color: #4f46d8;
  font-weight: 800;
  font-size: 13px;
}

.support-dialog-actions {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.support-thread-close {
  padding: 8px 13px;
  border: 1px solid #e5e7eb;
  border-radius: 999px;
  background: #fff;
  color: #6b7280;
  font-weight: 800;
  font-size: 13px;
  cursor: pointer;
}

.support-thread-close:hover {
  border-color: #c4b5fd;
  color: #4f46d8;
  background: #fbfaff;
}

.support-dialog-status-select {
  max-width: 180px;
  padding-right: 28px;
  cursor: pointer;
  appearance: none;
  background-image:
    linear-gradient(45deg, transparent 50%, currentColor 50%),
    linear-gradient(135deg, currentColor 50%, transparent 50%);
  background-position:
    calc(100% - 16px) calc(50% - 2px),
    calc(100% - 11px) calc(50% - 2px);
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
}

.support-dialog-status-select:focus {
  outline: none;
  box-shadow: 0 0 0 3px rgba(79, 70, 216, 0.12);
}

.support-dialog-summary.status-in_progress .support-dialog-status {
  background: #fef3c7;
  color: #f59e0b;
}

.support-dialog-summary.status-closed .support-dialog-status {
  background: #f3f4f6;
  color: #6b7280;
}

.support-dialog-meta,
.support-dialog-created {
  color: #686b8a;
  font-weight: 700;
  font-size: 13px;
  line-height: 1.4;
}

.support-date-divider {
  display: flex;
  align-items: center;
  gap: 18px;
  margin: 2px 0 8px;
  color: #686b8a;
  font-weight: 800;
  font-size: 13px;
}

.support-date-divider::before,
.support-date-divider::after {
  content: "";
  height: 1px;
  flex: 1;
  background: #e5e7eb;
}

.support-message {
  position: relative;
  max-width: 88%;
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding: 0 38px;
}

.support-message.is-user {
  align-self: flex-end;
}

.support-message.is-support,
.support-message.is-assistant {
  align-self: flex-start;
}

.support-message-avatar {
  position: absolute;
  bottom: 12px;
  width: 28px;
  height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: #fff;
  color: #4f46d8;
  font-size: 14px;
  line-height: 1;
  overflow: hidden;
  background-position: center;
  background-repeat: no-repeat;
  background-size: cover;
}

.support-message.is-grouped {
  margin-top: -4px;
}

.support-message.is-grouped .support-message-avatar {
  display: none;
}

.support-message.is-user.is-grouped {
  padding-right: 38px;
}

.support-message.is-support.is-grouped,
.support-message.is-assistant.is-grouped {
  padding-left: 38px;
}

.support-message.is-user .support-message-avatar {
  right: 0;
}

.support-message.is-support .support-message-avatar,
.support-message.is-assistant .support-message-avatar {
  left: 0;
}

.support-message-avatar-fallback {
  position: absolute;
  inset: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  line-height: 1;
}

.support-message-avatar.is-loaded .support-message-avatar-fallback {
  display: none;
}

.support-message-avatar.has-fallback {
  background: #fff;
}

.support-message-author {
  min-width: 0;
  color: #4f46d8;
  font-weight: 800;
  font-size: 14px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.support-message-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: baseline;
  gap: 14px;
  min-width: 180px;
}

.support-message.is-user .support-message-head {
  grid-template-columns: minmax(0, 1fr) auto;
}

.support-message-text {
  padding: 14px 16px;
  border-radius: 14px;
  line-height: 1.45;
  overflow-wrap: anywhere;
  font-size: 15px;
  white-space: pre-wrap;
}

.support-message.is-user .support-message-text {
  background: #ede9fe;
  color: #111827;
  border-bottom-right-radius: 5px;
}

.support-message.is-support .support-message-text,
.support-message.is-assistant .support-message-text {
  background: #f3f4f6;
  color: #111827;
  border-bottom-left-radius: 5px;
}

.support-message-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: fit-content;
  max-width: 100%;
  min-height: 38px;
  margin-top: 12px;
  padding: 9px 13px;
  border-radius: 9px;
  background: #4f46d8;
  color: #fff;
  font-size: 14px;
  font-weight: 800;
  line-height: 1.2;
  text-align: center;
  text-decoration: none;
  white-space: normal;
}

.support-message-action:hover {
  background: #4338ca;
  color: #fff;
  text-decoration: none;
}

.support-message-meta {
  color: #686b8a;
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
}

.support-message.is-user .support-message-meta {
  text-align: right;
}

.support-read-indicator {
  display: inline-flex;
  align-items: center;
  width: 22px;
  height: 12px;
  margin-left: 2px;
  color: #a1a1aa;
  vertical-align: -1px;
}

.support-read-indicator.is-read {
  color: #4f46d8;
}

.support-check {
  display: block;
  width: 9px;
  height: 5px;
  border-left: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(-45deg);
}

.support-check + .support-check {
  margin-left: -4px;
}

.support-ai-escalation-slot {
  flex: 0 0 auto;
  padding: 8px 18px 0;
  background: #fff;
}

.support-ai-escalation {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  margin: 0;
  padding: 12px;
  border: 1px solid #e5e7eb;
  border-radius: 14px;
  background: #fff;
}

.support-ai-escalation-icon {
  width: 34px;
  height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: #4f46d8;
  color: #fff;
  font-size: 15px;
}

.support-ai-escalation-copy {
  min-width: 0;
  display: grid;
  color: #686b8a;
  line-height: 1.35;
}

.support-ai-escalation-copy strong {
  color: #111827;
}

.support-ai-escalation-button {
  min-height: 40px;
  padding: 9px 14px;
  border: 0;
  border-radius: 10px;
  background: #4f46d8;
  color: #fff;
  font-weight: 800;
  font-size: 13px;
  cursor: pointer;
  white-space: nowrap;
}

.support-ai-escalation-button:hover {
  background: #4338ca;
}

.support-compose {
  position: relative;
  z-index: 2;
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 4px 18px 8px;
  padding: 12px;
  border-top: 1px solid #e5e7eb;
  border: 1px solid #e5e7eb;
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 8px 18px rgba(15, 23, 42, 0.08);
}

.support-compose.is-disabled {
  opacity: 0.72;
}

.support-input {
  min-width: 0;
  flex: 1;
  height: 42px;
  padding: 0 14px;
  border: 0;
  border-radius: 0;
  font: inherit;
}

.support-input:focus {
  outline: none;
  box-shadow: none;
}

.support-send {
  width: 42px;
  height: 42px;
  flex: 0 0 42px;
  border: 0;
  border-radius: 50%;
  background: #4f46d8;
  color: #fff;
  font-size: 28px;
  line-height: 1;
  cursor: pointer;
}

.support-input:disabled,
.support-send:disabled {
  cursor: not-allowed;
}

.support-send:disabled {
  background: #c7c9d8;
}

.support-footer {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 0 18px 14px;
  color: #6b7280;
  font-size: 12px;
  background: #fff;
}

.support-online-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #22c55e;
}

.support-empty {
  margin: auto;
  max-width: 260px;
  color: #6b7280;
  text-align: center;
  line-height: 1.4;
}

:root[data-theme="dark"] .support-panel,
:root[data-theme="dark"] .support-body,
:root[data-theme="dark"] .support-tabs,
:root[data-theme="dark"] .support-thread-list,
:root[data-theme="dark"] .support-chat-area,
:root[data-theme="dark"] .support-quick,
:root[data-theme="dark"] .support-ai-escalation-slot,
:root[data-theme="dark"] .support-footer {
  background: #111827;
  color: #edf3ff;
  border-color: rgba(148, 163, 184, 0.2);
}

:root[data-theme="dark"] .support-panel {
  border-color: rgba(148, 163, 184, 0.22);
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.58);
}

:root[data-theme="dark"] .support-tabs,
:root[data-theme="dark"] .support-quick,
:root[data-theme="dark"] .support-status-button,
:root[data-theme="dark"] .support-compose {
  border-color: rgba(148, 163, 184, 0.18);
}

:root[data-theme="dark"] .support-tab {
  color: #9fb0c8;
  background: transparent;
}

:root[data-theme="dark"] .support-tab.is-active {
  color: #b7a6ff;
  border-bottom-color: #8b5cf6;
}

:root[data-theme="dark"] .support-search,
:root[data-theme="dark"] .support-thread-item,
:root[data-theme="dark"] .support-compose,
:root[data-theme="dark"] .support-thread-close {
  background: #0f172a;
  border-color: rgba(148, 163, 184, 0.24);
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.26);
}

:root[data-theme="dark"] .support-thread-close {
  color: #9fb0c8;
}

:root[data-theme="dark"] .support-thread-close:hover {
  background: #151f34;
  color: #b7a6ff;
  border-color: rgba(139, 92, 246, 0.7);
}

:root[data-theme="dark"] .support-thread-item:hover,
:root[data-theme="dark"] .support-thread-item.is-active {
  background: #151f34;
  border-color: rgba(139, 92, 246, 0.7);
}

:root[data-theme="dark"] .support-search-input,
:root[data-theme="dark"] .support-input {
  background: transparent;
  color: #edf3ff;
}

:root[data-theme="dark"] .support-search-input::placeholder,
:root[data-theme="dark"] .support-input::placeholder {
  color: #7f8da6;
}

:root[data-theme="dark"] .support-greeting,
:root[data-theme="dark"] .support-quick-action,
:root[data-theme="dark"] .support-message.is-support .support-message-text,
:root[data-theme="dark"] .support-message.is-assistant .support-message-text,
:root[data-theme="dark"] .support-ai-escalation {
  background: #1f2937;
  border-color: rgba(148, 163, 184, 0.22);
  color: #edf3ff;
}

:root[data-theme="dark"] .support-quick-action {
  color: #b7a6ff;
}

:root[data-theme="dark"] .support-quick-action:hover {
  background: #263247;
  border-color: rgba(139, 92, 246, 0.7);
}

:root[data-theme="dark"] .support-message.is-user .support-message-text {
  background: #312e81;
  color: #f8fafc;
}

:root[data-theme="dark"] .support-message-action {
  background: #6366f1;
  color: #fff;
}

:root[data-theme="dark"] .support-message-action:hover {
  background: #818cf8;
}

:root[data-theme="dark"] .support-dialog-heading h3,
:root[data-theme="dark"] .support-thread-title,
:root[data-theme="dark"] .support-context-row strong,
:root[data-theme="dark"] .support-ai-escalation-copy strong {
  color: #f8fafc;
}

:root[data-theme="dark"] .support-dialog-meta,
:root[data-theme="dark"] .support-dialog-created,
:root[data-theme="dark"] .support-date-divider,
:root[data-theme="dark"] .support-thread-meta,
:root[data-theme="dark"] .support-thread-preview,
:root[data-theme="dark"] .support-thread-time,
:root[data-theme="dark"] .support-message-meta,
:root[data-theme="dark"] .support-read-indicator,
:root[data-theme="dark"] .support-context-row,
:root[data-theme="dark"] .support-ai-escalation-copy,
:root[data-theme="dark"] .support-footer,
:root[data-theme="dark"] .support-empty {
  color: #9fb0c8;
}

:root[data-theme="dark"] .support-read-indicator.is-read {
  color: #b8acf6;
}

:root[data-theme="dark"] .support-context,
:root[data-theme="dark"] .support-date-divider::before,
:root[data-theme="dark"] .support-date-divider::after {
  border-color: rgba(148, 163, 184, 0.2);
  background-color: rgba(148, 163, 184, 0.2);
}

:root[data-theme="dark"] .support-context {
  background-color: transparent;
}

:root[data-theme="dark"] .support-context::before {
  background: #111827;
  color: #9fb0c8;
}

:root[data-theme="dark"] .support-dialog-status {
  background: #312e81;
  color: #ddd6fe;
}

:root[data-theme="dark"] .support-dialog-summary.status-in_progress .support-dialog-status {
  background: rgba(245, 158, 11, 0.18);
  color: #fbbf24;
}

:root[data-theme="dark"] .support-dialog-summary.status-closed .support-dialog-status {
  background: #1f2937;
  color: #cbd5e1;
}

@media screen and (max-width: 560px) {
  .support-ai-escalation {
    grid-template-columns: auto minmax(0, 1fr);
  }

  .support-ai-escalation-button {
    grid-column: 1 / -1;
    width: 100%;
  }
}

@media screen and (max-width: 720px) {
  .support-widget {
    right: 16px;
    bottom: 16px;
  }

  .support-panel,
  .support-widget.support-tab-history .support-panel {
    right: -2px;
    bottom: 0;
    width: calc(100vw - 28px);
    height: min(620px, calc(100vh - 100px));
  }

  .support-thread-list {
    width: 100%;
    flex-basis: auto;
  }
}

/* Страница входа */
.login-page {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  padding: 20px;
}

.login-container {
  background: white;
  padding: 40px;
  border-radius: 20px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
  width: 100%;
  max-width: 400px;
  text-align: center;
}

.logo-container {
  margin-bottom: 30px;
}

.logo {
  width: 120px;
  height: 120px;
  object-fit: cover;
  border-radius: 20px;
}

.login-title {
  font-size: var(--fs-2xl);
  font-weight: 700;
  color: #333;
  margin-bottom: 10px;
}

.login-subtitle {
  font-size: var(--fs-sm);
  color: #888;
  margin-bottom: 30px;
}

.form-group {
  margin-bottom: 20px;
  text-align: left;
}

.form-label {
  display: block;
  margin-bottom: 8px;
  font-size: var(--fs-sm);
  font-weight: 600;
  color: #555;
}

.form-input {
  width: 100%;
  padding: 12px 16px;
  border: 2px solid #e5e7eb;
  border-radius: 10px;
  font-size: var(--fs-md);
  transition: all 0.3s ease;
}

.form-input:focus,
.form-select:focus {
  outline: none;
  border-color: #667eea;
  box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.form-select {
  background-color: #fff;
  padding-right: 42px !important;
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, #6b7280 50%), linear-gradient(135deg, #6b7280 50%, transparent 50%);
  background-position: calc(100% - 20px) calc(50% - 3px), calc(100% - 14px) calc(50% - 3px);
  background-size: 6px 6px, 6px 6px;
  background-repeat: no-repeat;
}

.error-message {
  background: #fef2f2;
  color: #dc2626;
  padding: 12px;
  border-radius: 8px;
  margin-bottom: 20px;
  font-size: var(--fs-sm);
  border: 1px solid #fecaca;
}

.btn-login {
  width: 100%;
  padding: 14px;
  font-size: var(--fs-md);
  margin-top: 10px;
}

/* Список дашбордов */
.dashboard-page {
  background: white;
  border-radius: 20px;
  padding: 30px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1);
}

.page-title {
  font-size: var(--fs-2xl);
  font-weight: 700;
  color: #333;
  margin-bottom: 30px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.city-section {
  margin-bottom: 35px;
  background: #f9fafb;
  padding: 20px;
  border-radius: 15px;
  border: 1px solid #e5e7eb;
  overflow: visible;
}

.city-title {
  font-size: var(--fs-lg);
  font-weight: 600;
  color: #667eea;
  margin-bottom: 15px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 15px;
  margin-top: 3px;
  overflow: visible;
}

.dashboard-card {
  background: white;
  padding: 20px;
  border-radius: 12px;
  border: 2px solid #e5e7eb;
  transition: all 0.3s ease;
  text-decoration: none;
  color: inherit;
  display: block;
}

.dashboard-card:hover {
  border-color: #667eea;
  transform: translateY(-3px);
  box-shadow: 0 10px 25px rgba(102, 126, 234, 0.15);
}

.dashboard-name {
  font-size: var(--fs-md);
  font-weight: 600;
  color: #333;
  margin-bottom: 8px;
}

.dashboard-type {
  font-size: var(--fs-xs);
  color: #888;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding-right: 56px;
}

/* Админ панель */
.admin-page {
  background: white;
  border-radius: 20px;
  padding: 30px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1);
}

.admin-section {
  margin-bottom: 40px;
  padding-bottom: 30px;
  border-bottom: 2px solid #f3f4f6;
}

.admin-section:last-child {
  border-bottom: none;
}

.section-title {
  font-size: var(--fs-xl);
  font-weight: 600;
  color: #333;
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  gap: 10px;
}

/* Форма создания пользователя */
.create-user-form {
  background: #f9fafb;
  padding: 25px;
  border-radius: 15px;
  display: flex;
  gap: 15px;
  align-items: flex-end;
  flex-wrap: wrap;
}

.form-group-inline {
  flex: 1;
  min-width: 200px;
}

.create-user-form .btn {
  min-height: 46px;
  padding-top: 0;
  padding-bottom: 0;
}

.checkbox-group {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 0;
}

.checkbox-group input[type="checkbox"] {
  width: 20px;
  height: 20px;
  cursor: pointer;
}

.checkbox-group label {
  cursor: pointer;
  font-size: 14px;
  color: #555;
}

/* Таблица пользователей */
.credential-trap {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  overflow: hidden;
  opacity: 0;
  pointer-events: none;
}

.users-table-wrap {
  width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
}

.users-table {
  width: 100%;
  min-width: 1280px;
  table-layout: fixed;
  border-collapse: collapse;
  background: white;
  border-radius: 15px;
  overflow: hidden;
  border: 1px solid #e5e7eb;
}

.admin-users-table {
  min-width: 0;
}

.companies-table {
  min-width: 0;
}

.tech-admin-dashboards-table,
.tech-admin-links-table {
  min-width: 0;
}

.companies-table td:last-child,
.companies-table th:last-child {
  width: 1%;
}

.tech-admin-dashboards-table td:last-child,
.tech-admin-dashboards-table th:last-child,
.tech-admin-links-table td:last-child,
.tech-admin-links-table th:last-child {
  width: 1%;
}

.companies-table-action-form {
  display: block;
  width: 100%;
}

.companies-table-action-btn {
  display: flex !important;
  width: 100% !important;
  justify-content: center;
  align-items: center;
  white-space: nowrap;
}

.admin-users-table th {
  padding: 12px 10px;
  font-size: 13px;
  line-height: 1.15;
  white-space: normal;
}

.admin-users-table td {
  padding: 12px 10px;
}

.users-table thead {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
}

.users-table th {
  padding: 15px;
  text-align: left;
  font-weight: 600;
  font-size: 14px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.users-table th + th {
  border-left: 2px solid rgba(255, 255, 255, 0.55);
}

.users-table td {
  padding: 15px;
  border-top: 1px solid #f3f4f6;
  font-size: 14px;
  vertical-align: top;
  overflow-wrap: anywhere;
}

.users-table tbody tr:hover {
  background: #f9fafb;
}

:root {
  --access-list-max-height: 300px;
  --access-secondary-gap: 42px;
  --access-save-block-height: 52px;
}

.role-badge {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
}

.role-admin {
  background: #ddd6fe;
  color: #7c3aed;
}

.role-user {
  background: #e0e7ff;
  color: #4f46e5;
}

.role-tech-admin {
  background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
  color: white;
  white-space: nowrap;
  max-width: 100%;
  box-sizing: border-box;
}

/* Доступ к дашбордам */
.access-list {
  width: 100%;
  max-width: none;
  min-width: 0;
  box-sizing: border-box;
  max-height: var(--access-list-max-height);
  overflow-y: auto;
  border: 2px solid #e5e7eb;
  border-radius: 10px;
  padding: 15px;
  background: #f9fafb;
}

.access-summary {
  width: 100%;
  max-width: 190px;
  box-sizing: border-box;
  min-height: var(--access-list-max-height);
  max-height: calc(
    var(--access-list-max-height) * 2 +
    var(--access-secondary-gap) +
    var(--access-save-block-height)
  );
  overflow-y: auto;
  border: 2px solid #e5e7eb;
  border-radius: 10px;
  padding: 18px;
  background: #f9fafb;
}

.access-summary > div {
  margin-bottom: 10px !important;
}

.access-summary strong {
  display: inline-block;
  margin-bottom: 8px;
}

.access-summary ul {
  margin: 0 !important;
  padding-left: 22px !important;
}

.access-summary li {
  font-size: 14px !important;
  line-height: 1.35;
  margin: 6px 0;
}

.access-city {
  font-weight: 600;
  color: #667eea;
  margin-top: 15px;
  margin-bottom: 10px;
}

.access-city:first-child {
  margin-top: 0;
}

.access-item {
  display: flex;
  align-items: center;
  padding: 8px 10px;
  margin: 5px 0;
  background: white;
  border-radius: 8px;
  transition: all 0.2s ease;
}

.access-item:hover {
  background: #f3f4f6;
}

.access-item input[type="checkbox"] {
  margin-right: 10px;
  width: 18px;
  height: 18px;
  cursor: pointer;
}

.access-readonly-toggle {
  flex: 0 0 auto !important;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  margin-right: 8px;
  padding: 3px 6px;
  border: 1px solid #e5e7eb;
  border-radius: 7px;
  background: #f8fafc;
  color: #475569 !important;
  cursor: pointer;
  font-size: 13px !important;
  line-height: 1;
}

.access-readonly-toggle input[type="checkbox"] {
  width: 14px;
  height: 14px;
  margin-right: 0;
}

.access-readonly-toggle:has(input[type="checkbox"]:checked) {
  border-color: #667eea;
  background: #eef2ff;
  color: #4f46e5 !important;
}

.access-readonly-toggle:has(input[type="checkbox"]:disabled) {
  opacity: 0.5;
  cursor: not-allowed;
}

:root[data-theme="dark"] .access-readonly-toggle {
  border-color: rgba(148, 163, 184, 0.26);
  background: rgba(15, 23, 42, 0.74);
  color: #cbd5e1 !important;
}

:root[data-theme="dark"] .access-readonly-toggle:has(input[type="checkbox"]:checked) {
  border-color: #818cf8;
  background: rgba(79, 70, 229, 0.22);
  color: #c7d2fe !important;
}

.access-item label {
  cursor: pointer;
  font-size: 14px;
  color: #555;
  flex: 1;
  min-width: 0;
}

.access-summary-cell {
  width: 260px;
}

.access-controls-cell {
  width: 290px;
  min-width: 0;
}

.admin-users-table .access-summary-cell {
  width: auto;
}

.admin-users-table .access-summary {
  max-width: none;
}

.admin-users-table .access-controls-cell {
  width: auto;
}

.access-controls-form {
  display: block;
  width: 100%;
  min-width: 0;
}

.access-save-button-wrap {
  display: block;
  width: 100%;
  margin-top: 15px;
}

.access-save-button {
  display: flex !important;
  width: 100% !important;
  justify-content: center;
  align-items: center;
  box-sizing: border-box;
}

.access-save-status {
  min-height: 18px;
  margin-top: 8px;
  font-size: 12px;
  line-height: 1.4;
  color: #6b7280;
}

.access-save-status.is-success {
  color: #059669;
}

.access-save-status.is-error {
  color: #dc2626;
}

.admin-users-table th:last-child,
.admin-users-table td:last-child {
  width: auto;
  min-width: 96px;
}

.access-item input[type="checkbox"]:disabled + label {
  opacity: 0.5;
  cursor: not-allowed;
}

.access-item input[type="checkbox"]:disabled + .access-readonly-toggle + label {
  opacity: 0.5;
  cursor: not-allowed;
}

.action-buttons {
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: stretch;
  width: 100%;
}

.action-buttons form {
  width: 100%;
}

.action-buttons .btn {
  width: 100%;
  justify-content: center;
  text-align: center;
  white-space: nowrap;
}

.action-buttons .btn-small {
  padding: 8px 8px;
  font-size: 11px;
}

.btn-small {
  padding: 8px 12px;
  font-size: 13px;
}

/* Детальная страница дашборда */
.dashboard-detail-header {
  --dashboard-safe-top: env(safe-area-inset-top, 0px);
  background: #1f2937;
  color: white;
  padding: calc(15px + var(--dashboard-safe-top)) 30px 15px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 4100;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
}

.dashboard-detail-left {
  display: flex;
  align-items: center;
  gap: 15px;
  min-width: 0;
}

.dashboard-detail-logo {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  object-fit: cover;
}

.dashboard-detail-name {
  font-size: 18px;
  font-weight: 600;
}

.dashboard-detail-info {
  min-width: 0;
}

.dashboard-detail-subtitle {
  font-size: 12px;
  opacity: 0.8;
}

.dashboard-detail-updated-at {
  font-size: 11px;
  opacity: 0.7;
  margin-top: 1px;
}

.dashboard-detail-nav {
  display: flex;
  gap: 20px;
  align-items: center;
}

.dashboard-detail-nav a {
  color: white;
  text-decoration: none;
  font-size: 14px;
  padding: 8px 16px;
  border-radius: 8px;
  transition: background 0.3s ease;
}

.dashboard-detail-nav a:hover {
  background: rgba(255, 255, 255, 0.1);
}

.dashboard-frame {
  position: fixed;
  top: var(--dashboard-header-height, 70px);
  left: 0;
  width: 100%;
  height: calc(var(--dashboard-viewport-height, 100dvh) - var(--dashboard-header-height, 70px));
  border: none;
  background: #f9fafb;
}

.dashboard-toast {
  position: fixed;
  top: calc(var(--dashboard-header-height, 70px) + 12px);
  right: 24px;
  z-index: 2100;
  max-width: min(520px, calc(100vw - 48px));
  border-radius: 12px;
  padding: 12px 16px;
  font-weight: 700;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.14);
}

.dashboard-toast-success {
  background: #ecfdf5;
  color: #065f46;
  border: 1px solid #a7f3d0;
}

.dashboard-toast-error {
  background: #fef2f2;
  color: #991b1b;
  border: 1px solid #fecaca;
}

.dashboard-payment-warning {
  position: fixed;
  top: var(--dashboard-header-height, 70px);
  left: 0;
  right: 0;
  z-index: 2050;
  display: flex;
  align-items: center;
  min-height: 44px;
  width: auto;
  padding: 8px 24px;
  border-radius: 0;
  background: #fff7ed;
  color: #7c2d12;
  border: 0;
  border-bottom: 1px solid #fed7aa;
  box-shadow: 0 8px 18px rgba(124, 45, 18, 0.10);
}

.dashboard-payment-warning-title {
  font-size: 14px;
  font-weight: 800;
  line-height: 1.25;
}

.dashboard-payment-warning-text {
  margin-top: 4px;
  font-size: 13px;
  line-height: 1.45;
}

.dashboard-payment-admin-note {
  display: block;
  margin-top: 5px;
  font-size: 11px;
  font-weight: 700;
}

body.dashboard-has-payment-warning .dashboard-frame {
  top: calc(var(--dashboard-header-height, 70px) + 44px);
  height: calc(var(--dashboard-viewport-height, 100dvh) - var(--dashboard-header-height, 70px) - 44px);
}

.tech-admin-payment-alert {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-left: 6px;
  padding: 3px 8px;
  border-radius: 999px;
  background: #fee2e2;
  color: #991b1b;
  border: 1px solid #fecaca;
  font-size: 11px;
  font-weight: 800;
  white-space: nowrap;
}

/* Адаптация для мобильных устройств Safari */
@media only screen and (max-width: 768px) {
  .dashboard-frame {
    /* Добавляем отступ снизу для Safari на iOS */
    height: calc(var(--dashboard-viewport-height, 100dvh) - var(--dashboard-header-height, 70px));
    padding-bottom: env(safe-area-inset-bottom, 0px);
  }

  .dashboard-toast,
  .dashboard-payment-warning {
    left: 12px;
    right: 12px;
    width: auto;
    max-width: none;
  }

  .dashboard-toast {
    top: calc(var(--dashboard-header-height, 70px) + 10px);
  }

  .dashboard-payment-warning {
    top: var(--dashboard-header-height, 70px);
    left: 0;
    right: 0;
    min-height: 40px;
    padding: 7px 12px;
  }

  body.dashboard-has-payment-warning .dashboard-frame {
    top: calc(var(--dashboard-header-height, 70px) + 40px);
    height: calc(var(--dashboard-viewport-height, 100dvh) - var(--dashboard-header-height, 70px) - 40px);
  }
}

/* Анимации загрузки */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.fade-in {
  animation: fadeIn 0.5s ease;
}

/* Выпадающее меню пользователя */
.user-dropdown {
  position: relative;
  display: inline-block;
  z-index: 4102;
}

.user-menu-btn {
  background: white;
  color: #667eea;
  border: 2px solid #667eea;
  padding: 10px 20px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: all 0.3s ease;
}

.user-menu-btn:hover {
  background: #667eea;
  color: white;
  transform: translateY(-2px);
}

.dropdown-content {
  display: none;
  position: absolute;
  right: 0;
  background: #fff;
  min-width: 250px;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.15);
  border-radius: 12px;
  z-index: 4103;
  margin-top: 10px;
  overflow: hidden;
  border: 1px solid #e5e7eb;
}

.dropdown-content.show {
  display: block;
  animation: slideDown 0.3s ease;
}

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

.dropdown-item {
  color: #333;
  padding: 12px 20px;
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 10px;
  transition: background 0.2s ease;
  font-size: 14px;
  border: none;
  width: 100%;
  text-align: left;
  background: #fff;
  cursor: pointer;
  white-space: nowrap;
}

.dropdown-item:hover {
  background: #f3f4f6;
}

.dropdown-divider {
  height: 1px;
  background: #e5e7eb;
  margin: 0;
}

.dropdown-header {
  padding: 12px 20px;
  background: #f9fafb;
  font-size: 12px;
  color: #888;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* Страница смены пароля */
.password-change-container {
  max-width: 500px;
  margin: 50px auto;
  background: white;
  padding: 40px;
  border-radius: 20px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1);
}

.password-title {
  font-size: 24px;
  font-weight: 700;
  color: #333;
  margin-bottom: 30px;
  text-align: center;
}

.success-message {
  background: #d1fae5;
  color: #065f46;
  padding: 12px;
  border-radius: 8px;
  margin-bottom: 20px;
  font-size: 14px;
  border: 1px solid #a7f3d0;
  display: flex;
  align-items: center;
  gap: 8px;
}

:root[data-theme="dark"] .success-message {
  background: rgba(34, 197, 94, 0.14) !important;
  color: #bbf7d0 !important;
  border-color: rgba(34, 197, 94, 0.34) !important;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.22) !important;
}

:root[data-theme="dark"] .error-message {
  background: rgba(239, 68, 68, 0.14) !important;
  color: #fecaca !important;
  border-color: rgba(239, 68, 68, 0.34) !important;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.22) !important;
}

.password-requirements {
  background: #f3f4f6;
  padding: 15px;
  border-radius: 8px;
  margin-top: 20px;
  font-size: 13px;
  color: #6b7280;
}

.password-requirements ul {
  margin: 10px 0 0 20px;
  padding: 0;
}

.password-requirements li {
  margin: 5px 0;
}

/* Чекбокс "Запомнить меня" */
.remember-me {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 20px 0;
  font-size: 14px;
  color: #555;
}

.remember-me input[type="checkbox"] {
  width: 18px;
  height: 18px;
  cursor: pointer;
}

.remember-me label {
  cursor: pointer;
}

/* Иконки */
.icon {
  display: inline-block;
  width: 20px;
  height: 20px;
  margin-right: 8px;
  vertical-align: middle;
}

/* Адаптивность */
@media (max-width: 768px) {
  .header {
    flex-direction: column;
    gap: 15px;
    text-align: center;
  }
  
  .dashboard-grid {
    grid-template-columns: 1fr;
  }
  
  .create-user-form {
    flex-direction: column;
    align-items: stretch;
  }

  .admin-page {
    padding: 18px;
  }

  .admin-section {
    padding-bottom: 24px;
  }

  .admin-filter-grid {
    grid-template-columns: 1fr !important;
    gap: 14px !important;
    align-items: stretch !important;
  }

  .admin-filter-grid > div,
  .admin-filter-grid input,
  .admin-filter-grid select {
    min-width: 0;
    width: 100%;
  }

  .admin-filter-actions {
    display: grid !important;
    grid-template-columns: 1fr;
    gap: 10px !important;
    width: 100%;
  }

  .admin-filter-actions .btn {
    width: 100%;
    min-height: 46px;
    justify-content: center;
    text-align: center;
    white-space: nowrap;
    padding-left: 14px;
    padding-right: 14px;
  }

  .users-table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  
  .users-table {
    min-width: 760px;
  }

  .admin-users-table th {
    padding: 10px 8px;
    font-size: 12px;
    letter-spacing: 0;
  }

  .admin-users-table td {
    padding: 10px 8px;
  }
  
  .dashboard-detail-header {
    padding: 10px 15px;
    padding-top: calc(10px + env(safe-area-inset-top, 0px));
    align-items: stretch;
    flex-direction: column;
    gap: 12px;
  }
  
  .dashboard-detail-name {
    font-size: 14px;
    line-height: 1.25;
    word-break: normal;
    overflow-wrap: anywhere;
  }

  .dashboard-detail-left {
    width: 100%;
    gap: 10px;
    align-items: flex-start;
  }

  .dashboard-detail-logo {
    width: 36px;
    height: 36px;
  }

  .dashboard-detail-info {
    min-width: 0;
  }

  .dashboard-detail-subtitle,
  .dashboard-detail-updated-at {
    line-height: 1.35;
    word-break: normal;
    overflow-wrap: anywhere;
  }

  .dashboard-detail-nav {
    width: 100%;
    gap: 10px;
    align-items: center;
    justify-content: space-between;
  }

  .dashboard-detail-nav a {
    padding: 6px 10px;
    font-size: 13px;
  }

  .user-dropdown {
    margin-left: auto;
  }

  .user-menu-btn {
    padding: 8px 12px;
    font-size: 13px;
    gap: 6px;
  }
}

/* Публичные дашборды */
.dashboard-card.public {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  border: 2px solid #059669;
  color: white;
}

.dashboard-card.public:hover {
  border-color: #047857;
  box-shadow: 0 10px 25px rgba(16, 185, 129, 0.3);
  transform: translateY(-3px);
}

.dashboard-card.public .dashboard-name {
  color: white;
  font-weight: 600;
}

.dashboard-card.public .dashboard-type {
  color: #d1fae5;
  font-weight: 500;
}

/* Скрытые дашборды */
.dashboard-card.hidden {
  background: linear-gradient(135deg, #1f2937 0%, #374151 100%);
  border: 2px solid #6b7280;
  color: white;
}

.dashboard-card.hidden:hover {
  border-color: #ef4444;
  box-shadow: 0 10px 25px rgba(239, 68, 68, 0.2);
}

.dashboard-card.hidden .dashboard-name {
  color: white;
}

.dashboard-card.hidden .dashboard-type {
  color: #fbbf24;
}

.dashboard-card.payment-soon {
  background: linear-gradient(135deg, #fed7aa 0%, #fb923c 100%);
  border: 2px solid #ea580c;
  color: #7c2d12;
}

.dashboard-card.payment-soon:hover {
  border-color: #c2410c;
  box-shadow: 0 10px 25px rgba(249, 115, 22, 0.25);
}

.dashboard-card.payment-expired {
  background: linear-gradient(135deg, #fecaca 0%, #ef4444 100%);
  border: 2px solid #dc2626;
  color: #7f1d1d;
}

.dashboard-card.payment-expired:hover {
  border-color: #b91c1c;
  box-shadow: 0 10px 25px rgba(239, 68, 68, 0.25);
}

.dashboard-card.payment-soon .dashboard-name,
.dashboard-card.payment-expired .dashboard-name,
.dashboard-card.payment-soon .dashboard-type,
.dashboard-card.payment-expired .dashboard-type {
  color: inherit;
}

.dashboard-card.payment-locked {
  cursor: not-allowed;
  opacity: 0.9;
}

.hidden-indicator {
  display: inline-block;
  background: #dc2626;
  color: white;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 10px;
  margin-left: 8px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* Tooltip */
.tooltip {
  position: relative;
}

.tooltip-text {
  visibility: hidden;
  background-color: #333;
  color: white;
  text-align: center;
  border-radius: 6px;
  padding: 5px 10px;
  position: absolute;
  z-index: 1;
  bottom: 125%;
  left: 50%;
  margin-left: -60px;
  opacity: 0;
  transition: opacity 0.3s;
  font-size: 12px;
  white-space: nowrap;
}

.tooltip:hover .tooltip-text {
  visibility: visible;
  opacity: 1;
}

/* Скроллбар */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: #f1f1f1;
  border-radius: 4px;
}

::-webkit-scrollbar-thumb {
  background: #888;
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: #555;
}

.banners-container {
    margin-bottom: 20px;
}

.banner {
    padding: 15px 20px;
    border-radius: 12px;
    margin-bottom: 15px;
    display: flex;
    align-items: flex-start;
    gap: 15px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    animation: slideDown 0.3s ease;
}

.banner-icon {
    font-size: 24px;
    flex-shrink: 0;
}

.banner-content {
    flex: 1;
}

.banner-title {
    display: block;
    font-size: 16px;
    margin-bottom: 5px;
    font-weight: 600;
}

.banner-message {
    margin: 0;
    font-size: 14px;
    line-height: 1.5;
}

/* Типы баннеров */
.banner-info {
    background: #e0f2fe;
    border-left: 4px solid #0284c7;
    color: #075985;
}

.banner-warning {
    background: #fef3c7;
    border-left: 4px solid #f59e0b;
    color: #92400e;
}

.banner-error {
    background: #fee2e2;
    border-left: 4px solid #ef4444;
    color: #991b1b;
}

.banner-success {
    background: #d1fae5;
    border-left: 4px solid #10b981;
    color: #065f46;
}

/* Стили для новых ролей */
.role-tech-admin {
    background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
    color: white;
}

.role-superadmin {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    color: white;
}

.role-hidden {
    background: #1f2937;
    color: white;
}

/* Кнопка для управления баннерами */
.btn-warning {
    background: linear-gradient(135deg, #fbbf24 0%, #f59e0b 100%);
    color: white;
}

.btn-warning:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(251, 191, 36, 0.4);
}

/* Опции входа */
.login-options {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin: 20px 0;
}

.saved-logins-hint {
    text-align: center;
    margin-top: 15px;
    color: #888;
}

/* Страница управления баннерами */
.banner-form {
    background: #f9fafb;
    padding: 25px;
    border-radius: 15px;
}

.form-row {
    display: flex;
    gap: 15px;
    margin-bottom: 15px;
}

.form-textarea {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #e5e7eb;
    border-radius: 10px;
    font-size: 15px;
    font-family: inherit;
    transition: all 0.3s ease;
    resize: vertical;
}

.form-textarea:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.checkbox-row {
    display: flex;
    gap: 20px;
    margin: 15px 0;
}

/* Список баннеров */
.banners-list {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.banner-item {
    background: white;
    border: 2px solid #e5e7eb;
    border-radius: 15px;
    padding: 20px;
    transition: all 0.3s ease;
}

.banner-item.inactive {
    opacity: 0.6;
}

.banner-item:hover {
    border-color: #667eea;
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.1);
}

.banner-preview {
    margin-bottom: 15px;
}

.banner-meta {
    display: flex;
    align-items: center;
    gap: 15px;
    flex-wrap: wrap;
    margin-bottom: 15px;
    padding: 10px 0;
    border-top: 1px solid #e5e7eb;
    border-bottom: 1px solid #e5e7eb;
}

.banner-locations {
    display: flex;
    gap: 8px;
}

.location-badge {
    background: #e0e7ff;
    color: #4f46e5;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
}

.status-badge {
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
}

.status-badge.active {
    background: #d1fae5;
    color: #065f46;
}

.status-badge.inactive {
    background: #f3f4f6;
    color: #6b7280;
}

.banner-date {
    color: #888;
    font-size: 12px;
    margin-left: auto;
}

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

/* Модальное окно */
.modal {
    display: none;
    position: fixed;
    z-index: 2000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.5);
    animation: fadeIn 0.3s ease;
}

.dashboard-settings-modal {
    z-index: 5000;
}

.modal.show {
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-content {
    background-color: white;
    margin: 5% auto;
    padding: 30px;
    border-radius: 20px;
    width: 90%;
    max-width: 600px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: slideUp 0.3s ease;
}

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

.close {
    color: #aaa;
    float: right;
    font-size: 32px;
    font-weight: bold;
    line-height: 20px;
    cursor: pointer;
    transition: color 0.3s ease;
}

.close:hover,
.close:focus {
    color: #667eea;
}

/* Datalist для сохраненных логинов */
#login::-webkit-calendar-picker-indicator {
    cursor: pointer;
}

/* Улучшения для чекбокса суперадмина */
.checkbox-group.superadmin-checkbox {
    background: #fef3c7;
    padding: 10px 15px;
    border-radius: 8px;
    border: 2px solid #f59e0b;
}

.checkbox-group.superadmin-checkbox label {
    color: #92400e;
    font-weight: 600;
}

/* Адаптивность для баннеров */
@media (max-width: 768px) {
    .banner {
        flex-direction: column;
        gap: 10px;
    }
    
    .banner-icon {
        font-size: 20px;
    }
    
    .form-row {
        flex-direction: column;
    }
    
    .checkbox-row {
        flex-direction: column;
        gap: 10px;
    }
    
    .banner-meta {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .banner-date {
        margin-left: 0;
    }
    
    .banner-actions {
        width: 100%;
    }
    
    .banner-actions button,
    .banner-actions form {
        flex: 1;
    }
    
}

/* Стили для формы выхода */
.logout-form {
    margin: 0;
    padding: 0;
    display: block;
    width: 100%;
    background: #fff;
    position: relative;
    z-index: 1;
}

.logout-form .dropdown-item {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 10px;
    width: 100%;
    padding: 12px 20px;
    text-align: left;
    background: white;
    border: none;
    border-radius: 0;
    cursor: pointer;
    font: inherit;
    color: #333;
    text-decoration: none;
    line-height: 1.2;
    min-height: 48px;
    white-space: nowrap;
    appearance: none;
    -webkit-appearance: none;
    background-image: none;
    background-repeat: no-repeat;
    box-shadow: none;
    outline: none;
}

.logout-form .dropdown-item:hover {
    background-color: #f3f4f6;
}

.logout-form .dropdown-item::before,
.logout-form .dropdown-item::after {
    content: none;
}


/* ======================================================================
   FitBase Analytics — cleaned modern theme layer
   Подключать после базовых стилей. Не меняет DOM, API, БД и iframe-content.
   Theme switch: set data-theme="dark" on <html> or :root.
   ====================================================================== */

:root {
  color-scheme: light;

  --fb-bg: #f2effb;
  --fb-bg-2: #ece9f8;
  --fb-surface: rgba(255, 255, 255, 0.88);
  --fb-surface-strong: rgba(255, 255, 255, 0.94);
  --fb-surface-muted: rgba(239, 236, 250, 0.84);
  --fb-text: #111827;
  --fb-muted: #667085;
  --fb-border: rgba(86, 73, 143, 0.15);

  --fb-primary: #5b4bd6;
  --fb-primary-strong: #3f35a8;
  --fb-secondary: #7dd3fc;
  --fb-success: #10b981;
  --fb-danger: #ef4444;
  --fb-warning: #f59e0b;

  --fb-radius-lg: 22px;
  --fb-radius-md: 16px;
  --fb-radius-sm: 12px;
  --fb-shadow-shell: 0 18px 50px rgba(52, 43, 115, 0.12);
  --fb-shadow-card: 0 10px 28px rgba(52, 43, 115, 0.08);
  --fb-shadow-hover: 0 18px 44px rgba(79, 70, 229, 0.16);

  --fb-max-width: 1320px;
  --fb-page-gap: 14px;
}

:root[data-theme="dark"] {
  color-scheme: dark;

  --fb-bg: #0b0f1a;
  --fb-bg-2: #101424;
  --fb-surface: rgba(16, 24, 39, 0.76);
  --fb-surface-strong: rgba(17, 24, 39, 0.90);
  --fb-surface-muted: rgba(35, 42, 70, 0.72);
  --fb-text: #edf3ff;
  --fb-muted: #9fb0c8;
  --fb-border: rgba(148, 163, 184, 0.18);

  --fb-primary: #9b7cff;
  --fb-primary-strong: #7dd3fc;
  --fb-secondary: #22d3ee;
  --fb-shadow-shell: 0 24px 70px rgba(0, 0, 0, 0.42);
  --fb-shadow-card: 0 18px 45px rgba(0, 0, 0, 0.32);
  --fb-shadow-hover: 0 18px 48px rgba(56, 189, 248, 0.18), 0 0 0 1px rgba(139, 92, 246, 0.24);
}

html {
  min-height: 100%;
}

body {
  min-height: 100vh;
  color: var(--fb-text);
  background:
    radial-gradient(circle at 8% 0%, rgba(127, 91, 213, 0.22), transparent 28%),
    radial-gradient(circle at 92% 4%, rgba(96, 165, 250, 0.16), transparent 30%),
    linear-gradient(180deg, #f7f4ff 0%, var(--fb-bg) 100%);
  letter-spacing: 0;
}

:root[data-theme="dark"] body {
  background:
    radial-gradient(circle at 16% 8%, rgba(139, 92, 246, 0.20), transparent 28%),
    radial-gradient(circle at 86% 0%, rgba(34, 211, 238, 0.16), transparent 30%),
    linear-gradient(180deg, #0b0f1a 0%, var(--fb-bg-2) 100%);
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -2;
  pointer-events: none;
  opacity: 0.46;
  background-image: url("data:image/svg+xml,%3Csvg width='900' height='900' viewBox='0 0 900 900' xmlns='http://www.w3.org/2000/svg'%3E%3Crect width='900' height='900' fill='none'/%3E%3Cpolygon points='0,0 190,0 80,330' fill='%238d73d4' opacity='.22'/%3E%3Cpolygon points='190,0 410,0 270,290' fill='%23594ac4' opacity='.16'/%3E%3Cpolygon points='410,0 900,0 650,360' fill='%237b61d1' opacity='.12'/%3E%3Cpolygon points='0,260 220,130 130,540' fill='%23a45cc2' opacity='.18'/%3E%3Cpolygon points='130,540 270,290 370,900 0,900' fill='%23866bd7' opacity='.18'/%3E%3Cpolygon points='270,290 650,360 370,900' fill='%236a54bf' opacity='.11'/%3E%3Cpolygon points='650,360 900,190 900,900 370,900' fill='%235b4bd6' opacity='.1'/%3E%3C/svg%3E");
  background-size: cover;
  background-position: center top;
}

:root[data-theme="dark"] body::before {
  opacity: 0.34;
  background-image: url("data:image/svg+xml,%3Csvg width='900' height='900' viewBox='0 0 900 900' xmlns='http://www.w3.org/2000/svg'%3E%3Cpolygon points='0,0 220,0 90,360' fill='%238b5cf6' opacity='.24'/%3E%3Cpolygon points='220,0 520,0 330,320' fill='%2338bdf8' opacity='.12'/%3E%3Cpolygon points='520,0 900,0 650,430' fill='%237c3aed' opacity='.18'/%3E%3Cpolygon points='0,320 300,160 180,640' fill='%23a855f7' opacity='.16'/%3E%3Cpolygon points='180,640 330,320 430,900 0,900' fill='%236d28d9' opacity='.22'/%3E%3Cpolygon points='330,320 650,430 430,900' fill='%2322d3ee' opacity='.1'/%3E%3Cpolygon points='650,430 900,240 900,900 430,900' fill='%234f46e5' opacity='.18'/%3E%3C/svg%3E");
}

body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  opacity: 0.12;
  background-image: radial-gradient(rgba(15, 23, 42, 0.18) 0.7px, transparent 0.7px);
  background-size: 4px 4px;
}

:root[data-theme="dark"] body::after {
  opacity: 0.16;
  background-image: radial-gradient(rgba(255, 255, 255, 0.22) 0.7px, transparent 0.7px);
}

/* Layout */
.app-shell,
.container {
  width: min(var(--fb-max-width), calc(100% - 28px));
  max-width: none;
  margin: 0 auto;
  padding: 14px 0 24px;
}

.app-shell {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 0;
}

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

.header,
.dashboard-page,
.admin-page,
.password-change-container,
.login-container,
.modal-content {
  border: 1px solid var(--fb-border) !important;
  background: var(--fb-surface) !important;
  color: var(--fb-text) !important;
  box-shadow: var(--fb-shadow-shell) !important;
  backdrop-filter: blur(18px);
}

.header {
  margin-bottom: 16px;
  padding: 12px 14px;
  min-height: 68px;
  border-radius: var(--fb-radius-lg);
}

.header-left {
  gap: 12px;
}

.header-left > a:first-child,
.dashboard-detail-left > a:first-child,
.dashboard-detail-brand,
.logo-container {
  width: 54px !important;
  height: 54px !important;
  display: inline-grid !important;
  place-items: center !important;
  flex: 0 0 54px;
  border-radius: 50% !important;
  overflow: hidden !important;
  background: transparent !important;
  border: 0 !important;
  text-decoration: none !important;
  box-shadow: none !important;
}

.login-container .logo-container {
  margin: 0 auto 30px !important;
}

.header-left > a img,
.header-left img,
.dashboard-detail-logo,
.logo {
  width: 54px !important;
  height: 54px !important;
  border-radius: 50% !important;
  object-fit: cover;
  clip-path: circle(50%);
  background: transparent !important;
  box-shadow: 0 10px 24px rgba(0, 82, 145, 0.22);
}

.header-right {
  gap: 8px;
}

.user-info,
.user-info .username,
.dashboard-name,
.section-title,
.page-title,
.tech-admin-card-title,
.password-title {
  color: var(--fb-text) !important;
}

.user-info {
  font-size: 14px;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px 8px;
}

.user-info .username {
  font-weight: 750;
}

.dashboard-page,
.admin-page {
  padding: 24px;
  border-radius: var(--fb-radius-lg);
}

.page-kicker {
  color: var(--fb-muted);
  font-size: 13px;
  font-weight: 800;
  text-transform: uppercase;
  margin-bottom: 6px;
  letter-spacing: .03em;
}

.page-title {
  margin-bottom: 18px;
  font-size: 26px;
  line-height: 1.08;
  font-weight: 850;
  letter-spacing: 0;
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 8px 14px;
}

.page-title > span {
  flex: 1 1 260px;
  min-width: 0;
  color: var(--fb-muted) !important;
  font-size: 15px !important;
  line-height: 1.25;
  font-weight: 600 !important;
  letter-spacing: 0;
}

.page-subtitle {
  color: var(--fb-muted) !important;
  margin: 5px 0 0;
  font-size: 14px;
  line-height: 1.45;
  font-weight: 500;
}

.log-page-title {
  margin: 0;
  font-size: 26px !important;
}

/* KPI */
.kpi-grid,
.stats-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
  margin: 0 0 22px;
}

.kpi-card,
.stat-card {
  position: relative;
  overflow: hidden;
  min-height: 108px;
  padding: 18px !important;
  border: 1px solid var(--fb-border) !important;
  border-radius: var(--fb-radius-md) !important;
  background:
    linear-gradient(135deg, rgba(91, 75, 214, 0.09), rgba(125, 211, 252, 0.07)),
    var(--fb-surface-strong) !important;
  color: var(--fb-text) !important;
  box-shadow: var(--fb-shadow-card) !important;
}

.kpi-card::after,
.stat-card::after {
  display: none;
}

.kpi-icon {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  margin-bottom: 14px;
  color: #fff;
  background: linear-gradient(135deg, var(--fb-primary), var(--fb-secondary));
  box-shadow: 0 10px 22px rgba(79, 70, 229, 0.24);
}

.kpi-value,
.stat-value {
  font-size: 28px;
  font-weight: 850;
  line-height: 1;
  margin-bottom: 8px;
}

.kpi-label,
.stat-label,
.dashboard-type,
.tech-admin-card-description,
.access-item label,
.access-save-status,
.form-label,
.login-subtitle,
.banner-date {
  color: var(--fb-muted) !important;
}

/* Sections and cards */
.city-section,
.create-user-form,
.filter-form,
.access-list,
.access-summary,
.banner-form,
.banner-item {
  border: 1px solid var(--fb-border) !important;
  background: var(--fb-surface-strong) !important;
  color: var(--fb-text) !important;
  box-shadow: var(--fb-shadow-card);
}

.city-section {
  padding: 18px;
  margin-bottom: 20px;
  border-radius: var(--fb-radius-md);
  overflow: visible;
}

.city-title,
.access-city {
  color: var(--fb-primary-strong) !important;
  font-size: var(--fs-lg);
}

.dashboard-grid,
.tech-admin-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 14px;
}

.dashboard-card,
.tech-admin-card,
.access-item {
  position: relative;
  overflow: visible;
  border: 1px solid var(--fb-border) !important;
  border-radius: var(--fb-radius-md) !important;
  background: var(--fb-surface-strong) !important;
  color: var(--fb-text) !important;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.42) inset;
  transition: transform 180ms ease, box-shadow 180ms ease, border-color 180ms ease, background 180ms ease;
}

.dashboard-card,
.tech-admin-card {
  min-height: 118px;
  padding: 18px !important;
}

.dashboard-card::before,
.tech-admin-card::before {
  content: "";
  position: absolute;
  right: 0;
  top: 0;
  width: 82px;
  height: 82px;
  background: linear-gradient(135deg, rgba(91, 75, 214, 0.18), rgba(125, 211, 252, 0.16));
  border-top-right-radius: inherit;
  clip-path: polygon(36% 0, 100% 0, 100% 74%, 66% 100%, 18% 78%, 0 18%);
  pointer-events: none;
  z-index: 0;
}

.dashboard-card::after,
.tech-admin-card::after {
  content: "→";
  position: absolute;
  right: 18px;
  bottom: 16px;
  color: var(--fb-primary-strong);
  font-weight: 900;
  transition: transform 180ms ease;
  pointer-events: none;
  z-index: 2;
}

.dashboard-card > *,
.tech-admin-card > * {
  position: relative;
  z-index: 1;
}

.dashboard-card:hover,
.tech-admin-card:hover,
.banner-item:hover {
  border-color: color-mix(in srgb, var(--fb-primary) 45%, transparent) !important;
  transform: translateY(-4px);
  box-shadow: var(--fb-shadow-hover) !important;
}

.dashboard-card:hover::after,
.tech-admin-card:hover::after {
  transform: translateX(4px);
}

.dashboard-card.external-link {
  cursor: pointer;
  background:
    linear-gradient(135deg, rgba(6, 182, 212, 0.12), rgba(91, 75, 214, 0.10)),
    var(--fb-surface-strong) !important;
}

.dashboard-card.internal-table-card {
  background:
    linear-gradient(135deg, rgba(16, 185, 129, 0.16), rgba(34, 197, 94, 0.08)),
    var(--fb-surface-strong) !important;
  border-color: color-mix(in srgb, #10b981 34%, var(--fb-border)) !important;
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.42) inset,
    0 10px 26px rgba(16, 185, 129, 0.10) !important;
}

.dashboard-card.internal-table-card::before {
  background:
    linear-gradient(135deg, rgba(16, 185, 129, 0.28), rgba(34, 197, 94, 0.16)) !important;
}

.dashboard-card.internal-table-card::after {
  color: #059669;
}

.dashboard-card.internal-table-card:hover {
  border-color: color-mix(in srgb, #10b981 58%, var(--fb-border)) !important;
  box-shadow:
    0 18px 44px rgba(16, 185, 129, 0.18),
    0 0 0 1px rgba(16, 185, 129, 0.18) !important;
}

:root[data-theme="dark"] .dashboard-card.internal-table-card {
  background:
    linear-gradient(135deg, rgba(16, 185, 129, 0.20), rgba(34, 197, 94, 0.08)),
    var(--fb-surface-strong) !important;
  border-color: color-mix(in srgb, #34d399 34%, var(--fb-border)) !important;
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.08) inset,
    0 18px 45px rgba(0, 0, 0, 0.32) !important;
}

:root[data-theme="dark"] .dashboard-card.internal-table-card::before {
  background:
    linear-gradient(135deg, rgba(52, 211, 153, 0.24), rgba(16, 185, 129, 0.14)) !important;
}

:root[data-theme="dark"] .dashboard-card.internal-table-card::after {
  color: #6ee7b7;
}

/* Avoid old heavy status gradients on cards */
.dashboard-card.public,
.dashboard-card.hidden,
.dashboard-card.payment-soon,
.dashboard-card.payment-expired {
  background: var(--fb-surface-strong) !important;
  color: var(--fb-text) !important;
}

.dashboard-card.hidden {
  background:
    linear-gradient(135deg, rgba(71, 85, 105, 0.12), rgba(15, 23, 42, 0.05)),
    var(--fb-surface-strong) !important;
}

.dashboard-card.payment-soon {
  background:
    linear-gradient(135deg, rgba(255, 122, 0, 0.12), rgba(255, 213, 0, 0.08)),
    var(--fb-surface-strong) !important;
  border-color: rgba(255, 122, 0, 0.22) !important;
}

.dashboard-card.payment-expired {
  background:
    linear-gradient(135deg, rgba(255, 0, 0, 0.12), rgba(255, 45, 85, 0.08)),
    var(--fb-surface-strong) !important;
  border-color: rgba(255, 0, 0, 0.22) !important;
}

.dashboard-card.public::before { background: linear-gradient(135deg, rgba(16,185,129,.30), rgba(91,75,214,.16)); }
.dashboard-card.hidden::before { background: linear-gradient(135deg, rgba(15,23,42,.46), rgba(71,85,105,.28)); }
.dashboard-card.payment-soon::before { background: linear-gradient(135deg, rgba(255,92,0,.92), rgba(255,213,0,.58)); }
.dashboard-card.payment-expired::before { background: linear-gradient(135deg, rgba(255,0,0,.94), rgba(255,45,85,.60)); }

:root[data-theme="dark"] .dashboard-card.public::before {
  background: linear-gradient(135deg, rgba(52,211,153,.38), rgba(45,212,191,.18));
}

:root[data-theme="dark"] .dashboard-card.hidden::before {
  background: linear-gradient(135deg, rgba(2,6,23,.72), rgba(71,85,105,.42));
}

:root[data-theme="dark"] .dashboard-card.payment-soon::before {
  background: linear-gradient(135deg, rgba(255,92,0,.98), rgba(255,229,0,.62));
}

:root[data-theme="dark"] .dashboard-card.payment-expired::before {
  background: linear-gradient(135deg, rgba(255,0,0,.98), rgba(255,45,85,.68));
}

:root[data-theme="dark"] .dashboard-card.hidden {
  background:
    linear-gradient(135deg, rgba(2, 6, 23, 0.42), rgba(71, 85, 105, 0.24)),
    linear-gradient(135deg, rgba(30, 41, 70, 0.92), rgba(15, 23, 42, 0.96)) !important;
  border-color: rgba(148, 163, 184, 0.22) !important;
}

:root[data-theme="dark"] .dashboard-card.payment-soon {
  background:
    linear-gradient(135deg, rgba(255, 92, 0, 0.18), rgba(255, 229, 0, 0.10)),
    linear-gradient(135deg, rgba(30, 41, 70, 0.92), rgba(15, 23, 42, 0.96)) !important;
  border-color: rgba(255, 136, 0, 0.34) !important;
}

:root[data-theme="dark"] .dashboard-card.payment-expired {
  background:
    linear-gradient(135deg, rgba(255, 0, 0, 0.20), rgba(255, 45, 85, 0.12)),
    linear-gradient(135deg, rgba(30, 41, 70, 0.92), rgba(15, 23, 42, 0.96)) !important;
  border-color: rgba(255, 45, 85, 0.36) !important;
}


/* Dashboard cards: lift above section surface with stronger own shadow */
.dashboard-grid {
  position: relative;
  z-index: 2;
  overflow: visible;
}

.dashboard-card {
  isolation: isolate;
  z-index: 3;
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--fb-surface-strong) 92%, var(--fb-primary) 8%), var(--fb-surface-strong)) !important;
  box-shadow:
    0 18px 38px rgba(15, 23, 42, 0.16),
    0 6px 14px rgba(15, 23, 42, 0.10),
    0 1px 0 rgba(255, 255, 255, 0.42) inset !important;
}

.dashboard-card:hover {
  z-index: 10;
  box-shadow:
    0 24px 56px rgba(79, 70, 229, 0.24),
    0 10px 24px rgba(15, 23, 42, 0.16),
    0 0 0 1px color-mix(in srgb, var(--fb-primary) 45%, transparent) !important;
}

:root[data-theme="dark"] .dashboard-card {
  background:
    linear-gradient(135deg, rgba(30, 41, 70, 0.92), rgba(15, 23, 42, 0.96)) !important;
  box-shadow:
    0 20px 52px rgba(0, 0, 0, 0.42),
    0 8px 20px rgba(0, 0, 0, 0.26),
    0 1px 0 rgba(255, 255, 255, 0.08) inset !important;
}

:root[data-theme="dark"] .dashboard-card:hover {
  box-shadow:
    0 24px 62px rgba(56, 189, 248, 0.20),
    0 14px 34px rgba(0, 0, 0, 0.38),
    0 0 0 1px rgba(125, 211, 252, 0.34) !important;
}

/* Forms */
.form-input,
.form-select,
.form-textarea,
input[type="text"],
input[type="password"],
input[type="url"],
input[type="date"],
textarea,
select {
  border: 1px solid var(--fb-border) !important;
  border-radius: var(--fb-radius-sm) !important;
  background-color: var(--fb-surface-strong) !important;
  color: var(--fb-text) !important;
  box-shadow: none !important;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus,
input:focus,
textarea:focus,
select:focus {
  outline: none !important;
  border-color: var(--fb-primary) !important;
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--fb-primary) 15%, transparent) !important;
}

.form-input.is-readonly-field,
.form-input[readonly].is-readonly-field {
  background: var(--fb-surface-muted) !important;
  color: var(--fb-muted) !important;
  cursor: not-allowed;
  opacity: 0.78;
}

.form-input.is-readonly-field:focus,
.form-input[readonly].is-readonly-field:focus {
  border-color: var(--fb-border) !important;
  box-shadow: none !important;
}

.create-user-form {
  padding: 18px;
  gap: 12px;
}

.form-group {
  margin-bottom: 14px;
  z-index: 3;
}

/* Buttons */
.btn,
.user-menu-btn {
  position: relative;
  z-index: 2;
  min-height: 40px;
  border-radius: var(--fb-radius-sm) !important;
  border: 1px solid transparent;
  font-weight: 750;
  transition: transform 180ms ease, box-shadow 180ms ease, background 180ms ease, color 180ms ease, border-color 180ms ease;
}

.btn:hover,
.user-menu-btn:hover {
  transform: translateY(-1px);
  z-index: 1104;
}

.btn-primary,
.btn-admin {
  background: var(--fb-primary) !important;
  color: #fff !important;
  box-shadow: 0 10px 24px rgba(79, 70, 229, 0.24) !important;
}

.btn-primary:hover,
.btn-admin:hover {
  background: var(--fb-primary-strong) !important;
}

.btn-secondary,
.btn-logout,
.user-menu-btn {
  background: var(--fb-surface-strong) !important;
  color: var(--fb-text) !important;
  border-color: var(--fb-border) !important;
}

.btn-secondary:hover,
.btn-logout:hover,
.user-menu-btn:hover {
  color: var(--fb-primary-strong) !important;
  background: var(--fb-surface-muted) !important;
  border-color: color-mix(in srgb, var(--fb-primary) 32%, var(--fb-border)) !important;
}

.btn-back {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-width: 112px;
  white-space: nowrap;
}

.btn-success { background: var(--fb-success) !important; color: #fff !important; }
.btn-danger { background: var(--fb-danger) !important; color: #fff !important; }
.btn-warning { background: var(--fb-warning) !important; color: #fff !important; }
.btn-reset {
  background: var(--fb-muted) !important;
  color: #fff !important;
}

.btn-reset:hover {
  background: color-mix(in srgb, var(--fb-muted) 78%, #111827) !important;
}

.btn:disabled,
.btn[disabled] {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none !important;
  box-shadow: none !important;
}

:root[data-theme="dark"] .btn-success {
  background:
    linear-gradient(135deg, rgba(16, 185, 129, 0.94), rgba(5, 150, 105, 0.88)) !important;
  color: #ecfdf5 !important;
  border: 1px solid rgba(52, 211, 153, 0.28) !important;
  box-shadow: 0 12px 28px rgba(16, 185, 129, 0.18) !important;
}

:root[data-theme="dark"] .btn-success:hover {
  background:
    linear-gradient(135deg, rgba(52, 211, 153, 0.98), rgba(16, 185, 129, 0.92)) !important;
  box-shadow: 0 16px 34px rgba(16, 185, 129, 0.24) !important;
}

:root[data-theme="dark"] .btn-danger {
  background:
    linear-gradient(135deg, rgba(248, 113, 113, 0.96), rgba(220, 38, 38, 0.90)) !important;
  color: #fff7f7 !important;
  border: 1px solid rgba(252, 165, 165, 0.30) !important;
  box-shadow: 0 12px 28px rgba(239, 68, 68, 0.18) !important;
}

:root[data-theme="dark"] .btn-danger:hover {
  background:
    linear-gradient(135deg, rgba(252, 165, 165, 0.98), rgba(239, 68, 68, 0.94)) !important;
  box-shadow: 0 16px 34px rgba(239, 68, 68, 0.26) !important;
}

:root[data-theme="dark"] .btn-primary,
:root[data-theme="dark"] .btn-admin {
  background:
    linear-gradient(135deg, rgba(155, 124, 255, 0.92), rgba(79, 70, 229, 0.86)) !important;
  color: #ffffff !important;
  border: 1px solid rgba(196, 181, 253, 0.26) !important;
  box-shadow: 0 12px 28px rgba(91, 75, 214, 0.22) !important;
}

:root[data-theme="dark"] .btn-primary:hover,
:root[data-theme="dark"] .btn-admin:hover {
  background:
    linear-gradient(135deg, rgba(125, 211, 252, 0.86), rgba(155, 124, 255, 0.92)) !important;
  box-shadow: 0 16px 34px rgba(56, 189, 248, 0.22) !important;
}

:root[data-theme="dark"] .btn-warning {
  background:
    linear-gradient(135deg, rgba(245, 158, 11, 0.94), rgba(217, 119, 6, 0.88)) !important;
  color: #fff7ed !important;
  border: 1px solid rgba(251, 191, 36, 0.30) !important;
  box-shadow: 0 12px 28px rgba(245, 158, 11, 0.18) !important;
}

:root[data-theme="dark"] .btn-warning:hover {
  background:
    linear-gradient(135deg, rgba(251, 191, 36, 0.98), rgba(245, 158, 11, 0.92)) !important;
  box-shadow: 0 16px 34px rgba(245, 158, 11, 0.24) !important;
}

:root[data-theme="dark"] .btn-reset {
  background: var(--fb-surface-muted) !important;
  color: var(--fb-text) !important;
  border: 1px solid var(--fb-border) !important;
}

:root[data-theme="dark"] .btn-reset:hover {
  background: color-mix(in srgb, var(--fb-surface-muted) 72%, var(--fb-primary) 28%) !important;
  color: #ffffff !important;
  border-color: color-mix(in srgb, var(--fb-primary) 42%, var(--fb-border)) !important;
}

:root[data-theme="dark"] .btn-small {
  min-height: 38px;
  border-radius: 12px;
}

:root[data-theme="dark"] .access-save-button {
  background:
    linear-gradient(135deg, rgba(125, 211, 252, 0.22), rgba(155, 124, 255, 0.26)) !important;
  color: #dff7ff !important;
  border: 1px solid rgba(125, 211, 252, 0.34) !important;
  box-shadow:
    0 10px 24px rgba(56, 189, 248, 0.12),
    0 1px 0 rgba(255, 255, 255, 0.08) inset !important;
}

:root[data-theme="dark"] .access-save-button:hover {
  background:
    linear-gradient(135deg, rgba(125, 211, 252, 0.32), rgba(155, 124, 255, 0.36)) !important;
  border-color: rgba(125, 211, 252, 0.52) !important;
}

:root[data-theme="dark"] .role-badge {
  border: 1px solid rgba(148, 163, 184, 0.20);
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.16);
}

:root[data-theme="dark"] .role-user {
  background: rgba(99, 102, 241, 0.18) !important;
  color: #c7d2fe !important;
  border-color: rgba(129, 140, 248, 0.34);
}

:root[data-theme="dark"] .role-admin {
  background: rgba(168, 85, 247, 0.18) !important;
  color: #e9d5ff !important;
  border-color: rgba(192, 132, 252, 0.34);
}

:root[data-theme="dark"] .role-tech-admin,
:root[data-theme="dark"] .role-superadmin {
  background:
    linear-gradient(135deg, rgba(236, 72, 153, 0.34), rgba(124, 58, 237, 0.30)) !important;
  color: #fde7ff !important;
  border-color: rgba(244, 114, 182, 0.36);
}

:root[data-theme="dark"] .role-hidden,
:root[data-theme="dark"] .role-badge[style*="1f2937"] {
  background: rgba(51, 65, 85, 0.72) !important;
  color: #e2e8f0 !important;
  border-color: rgba(148, 163, 184, 0.30);
}

:root[data-theme="dark"] .role-badge[style*="667eea"],
:root[data-theme="dark"] .role-badge[style*="764ba2"] {
  background:
    linear-gradient(135deg, rgba(139, 92, 246, 0.26), rgba(56, 189, 248, 0.18)) !important;
  color: #e0f2fe !important;
  border-color: rgba(125, 211, 252, 0.30);
}

:root[data-theme="dark"] .role-badge[style*="f093fb"],
:root[data-theme="dark"] .role-badge[style*="f5576c"] {
  background:
    linear-gradient(135deg, rgba(236, 72, 153, 0.34), rgba(248, 113, 113, 0.24)) !important;
  color: #ffe4f4 !important;
  border-color: rgba(244, 114, 182, 0.36);
}

:root[data-theme="dark"] .role-badge[style*="ea580c"] {
  background: rgba(234, 88, 12, 0.22) !important;
  color: #fed7aa !important;
  border-color: rgba(251, 146, 60, 0.34);
}

:root[data-theme="dark"] .role-badge[style*="0f766e"] {
  background: rgba(20, 184, 166, 0.18) !important;
  color: #99f6e4 !important;
  border-color: rgba(45, 212, 191, 0.32);
}

.theme-toggle {
  width: 42px;
  height: 42px;
  justify-content: center;
  padding: 0 !important;
}

.header-right .btn:not(.theme-toggle) {
  white-space: nowrap;
  min-width: max-content;
}

/* Tables */
.users-table {
  border: 1px solid var(--fb-border) !important;
  border-radius: var(--fb-radius-md) !important;
  background: var(--fb-surface-strong) !important;
  color: var(--fb-text) !important;
}

.users-table thead {
  background: var(--fb-surface-muted) !important;
  color: var(--fb-text) !important;
}

.users-table th {
  font-size: 12px;
  color: var(--fb-muted) !important;
  letter-spacing: 0;
}

.users-table td,
.users-table th + th {
  border-color: var(--fb-border) !important;
}

.users-table tbody tr:nth-child(even) {
  background: color-mix(in srgb, var(--fb-surface-muted) 45%, transparent);
}

.users-table tbody tr:hover {
  background: color-mix(in srgb, var(--fb-primary) 9%, transparent) !important;
}

/* Dropdowns and modals */
.dropdown-content {
  border: 1px solid var(--fb-border) !important;
  background: var(--fb-surface-strong) !important;
  box-shadow: var(--fb-shadow-shell) !important;
}

.dropdown-header,
.dropdown-item,
.logout-form,
.logout-form .dropdown-item {
  background: var(--fb-surface-strong) !important;
  color: var(--fb-text) !important;
}

.dropdown-item:hover,
.logout-form .dropdown-item:hover {
  background: var(--fb-surface-muted) !important;
}

.dropdown-divider {
  background: var(--fb-border) !important;
}

#resetPasswordModal > div,
#editRolesModal > div,
#transferModal > div {
  background: var(--fb-surface-strong) !important;
  color: var(--fb-text) !important;
  border: 1px solid var(--fb-border) !important;
  box-shadow: var(--fb-shadow-shell) !important;
}

.reset-password-modal {
  display: none;
  position: fixed;
  z-index: 1000;
  inset: 0;
  width: 100%;
  height: 100%;
  padding: 24px;
  overflow: auto;
  background: rgba(15, 23, 42, 0.52);
  backdrop-filter: blur(8px);
}

.reset-password-dialog {
  width: min(100%, 520px);
  margin: 8vh auto;
  padding: 28px;
  border-radius: var(--fb-radius-lg);
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--fb-surface-strong) 94%, var(--fb-primary) 6%), var(--fb-surface-strong)) !important;
  box-shadow:
    0 28px 72px rgba(15, 23, 42, 0.24),
    0 1px 0 rgba(255, 255, 255, 0.5) inset !important;
}

.reset-password-close {
  float: right;
  width: 36px;
  height: 36px;
  border: 1px solid var(--fb-border);
  border-radius: 10px;
  background: var(--fb-surface);
  color: var(--fb-muted);
  font-size: 24px;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
}

.reset-password-heading {
  display: flex;
  gap: 14px;
  align-items: center;
  margin-bottom: 22px;
  padding-right: 44px;
}

.reset-password-heading h2 {
  margin: 0;
  font-size: 24px;
  line-height: 1.15;
  letter-spacing: 0;
}

.reset-password-heading p {
  margin: 6px 0 0;
  color: var(--fb-muted);
  font-size: 14px;
}

.reset-password-icon {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border-radius: 14px;
  background: color-mix(in srgb, var(--fb-primary) 14%, transparent);
  box-shadow: 0 10px 26px rgba(91, 75, 214, 0.16);
  font-size: 22px;
  flex: 0 0 auto;
}

.reset-password-hint {
  margin: 8px 0 0;
  color: var(--fb-muted);
  font-size: 13px;
  line-height: 1.4;
}

.reset-password-option {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  margin: 18px 0 22px;
  padding: 14px;
  border: 1px solid var(--fb-border);
  border-radius: var(--fb-radius-sm);
  background: color-mix(in srgb, var(--fb-surface-muted) 60%, transparent);
}

.reset-password-option input {
  width: 20px;
  height: 20px;
  margin-top: 2px;
  flex: 0 0 auto;
}

.reset-password-option label {
  display: grid;
  gap: 4px;
  color: var(--fb-text);
  cursor: pointer;
}

.reset-password-option span {
  color: var(--fb-muted);
  font-size: 13px;
  line-height: 1.4;
}

.reset-password-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

@media (max-width: 560px) {
  .reset-password-modal {
    padding: 14px;
  }

  .reset-password-dialog {
    margin: 4vh auto;
    padding: 22px;
  }

  .reset-password-heading {
    align-items: flex-start;
  }

  .reset-password-actions {
    grid-template-columns: 1fr;
  }
}

.role-badge,
.location-badge,
.status-badge,
.hidden-indicator {
  border-radius: 999px;
}

/* Dashboard iframe wrapper: iframe content remains untouched */
.dashboard-detail-header {
  background: var(--fb-surface) !important;
  color: var(--fb-text) !important;
  border-bottom: 1px solid var(--fb-border);
  box-shadow: var(--fb-shadow-shell);
  backdrop-filter: blur(18px);
}

.dashboard-detail-nav a {
  color: var(--fb-text) !important;
  background: var(--fb-surface-muted);
}

#dashboardSettingsButton,
#userMenuButton {
  background: var(--fb-surface-strong) !important;
  color: var(--fb-text) !important;
  border-color: var(--fb-border) !important;
}

.dashboard-detail-nav a:hover {
  background: color-mix(in srgb, var(--fb-primary) 14%, var(--fb-surface-muted));
}

.dashboard-frame {
  top: var(--dashboard-header-height, 70px);
  left: 0;
  width: 100%;
  height: calc(var(--dashboard-viewport-height, 100dvh) - var(--dashboard-header-height, 70px));
  border: none;
  border-radius: 0;
  box-shadow: none;
  background: transparent;
  padding: 0;
}

#snow {
  display: none !important;
}

@media (max-width: 768px) {
  .app-shell,
  .container {
    width: min(100% - 20px, var(--fb-max-width));
    padding-top: 12px;
  }

  .dashboard-page,
  .admin-page {
    padding: 18px;
  }

  .page-title {
    font-size: 28px;
  }

  .page-title > span {
    flex-basis: 100%;
  }

  .header {
    align-items: stretch;
  }

  .header-right {
    justify-content: center;
    flex-wrap: wrap;
  }

  .dashboard-frame {
    left: 0;
    width: 100%;
    height: calc(var(--dashboard-viewport-height, 100dvh) - var(--dashboard-header-height, 70px));
    padding: 0;
  }
}

/* ======================================================================
   Fix: compact page headings + visible dashboard-card shadows
   ====================================================================== */

.page-title {
  margin-bottom: 18px !important;
  font-size: 26px !important;
  line-height: 1.08 !important;
  letter-spacing: 0 !important;
  font-weight: 800 !important;
  gap: 6px 12px !important;
}

.page-title > span {
  font-size: 14px !important;
  line-height: 1.25 !important;
  font-weight: 600 !important;
  letter-spacing: 0 !important;
}

.city-title {
  font-size: 14px !important;
  line-height: 1.25 !important;
  margin-bottom: 16px !important;
}

.dashboard-page,
.admin-page,
.city-section,
.dashboard-grid,
.tech-admin-grid {
  overflow: visible !important;
}

.admin-page {
  border-color: color-mix(in srgb, var(--fb-border) 45%, transparent) !important;
  background: color-mix(in srgb, var(--fb-surface) 82%, transparent) !important;
}

.admin-section {
  border-bottom: 0 !important;
  padding-bottom: 0 !important;
}

.city-section {
  position: relative !important;
  z-index: 2;
  padding: 20px !important;
  margin-bottom: 34px !important;
  overflow: visible !important;
}

.dashboard-grid {
  position: relative;
  z-index: 3;
  grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
  padding: 10px !important;
  margin: 0 !important;
  gap: 18px !important;
  isolation: auto;
}

.tech-admin-grid {
  position: relative;
  z-index: 3;
  grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
  padding: 10px !important;
  margin: 0 !important;
  gap: 18px !important;
  isolation: auto;
}

.dashboard-card,
.tech-admin-card {
  position: relative !important;
  z-index: 1 !important;
  overflow: visible !important;
  isolation: isolate;
  box-shadow:
    0 18px 38px rgba(52, 43, 115, 0.14),
    0 1px 0 rgba(255, 255, 255, 0.45) inset !important;
}

:root[data-theme="dark"] .dashboard-card,
:root[data-theme="dark"] .tech-admin-card {
  box-shadow:
    0 18px 42px rgba(0, 0, 0, 0.36),
    0 0 0 1px rgba(148, 163, 184, 0.08),
    0 1px 0 rgba(255, 255, 255, 0.06) inset !important;
}

.dashboard-card:hover,
.tech-admin-card:hover {
  z-index: 50 !important;
  box-shadow:
    0 24px 56px rgba(79, 70, 229, 0.22),
    0 0 0 1px rgba(91, 75, 214, 0.24),
    0 1px 0 rgba(255, 255, 255, 0.5) inset !important;
}

:root[data-theme="dark"] .dashboard-card:hover,
:root[data-theme="dark"] .tech-admin-card:hover {
  box-shadow:
    0 26px 64px rgba(0, 0, 0, 0.48),
    0 0 0 1px rgba(139, 92, 246, 0.32),
    0 0 28px rgba(56, 189, 248, 0.14) !important;
}

@media (max-width: 768px) {
  .page-title {
    font-size: 26px !important;
  }

  .dashboard-grid,
  .tech-admin-grid {
    padding: 6px !important;
    margin: 0 !important;
    gap: 14px !important;
  }

  .dashboard-grid,
  .tech-admin-grid {
    grid-template-columns: 1fr !important;
  }
}

@media (min-width: 769px) and (max-width: 1180px) {
  .dashboard-grid,
  .tech-admin-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }
}


/* === OVERRIDE: Enhanced Purple Geometric Background === */

body {
  min-height: 100vh;
  color: var(--fb-text);
  background:
    radial-gradient(circle at 5% 5%, rgba(124, 58, 237, 0.35), transparent 30%),
    radial-gradient(circle at 85% 8%, rgba(168, 85, 247, 0.28), transparent 32%),
    radial-gradient(circle at 50% 95%, rgba(91, 75, 214, 0.22), transparent 36%),
    radial-gradient(circle at 95% 80%, rgba(139, 92, 246, 0.18), transparent 30%),
    linear-gradient(180deg, #faf7ff 0%, var(--fb-bg) 100%) !important;
}

:root[data-theme="dark"] body {
  background:
    radial-gradient(circle at 10% 10%, rgba(139, 92, 246, 0.35), transparent 30%),
    radial-gradient(circle at 90% 5%, rgba(168, 85, 247, 0.26), transparent 34%),
    radial-gradient(circle at 60% 95%, rgba(34, 211, 238, 0.12), transparent 38%),
    radial-gradient(circle at 0% 80%, rgba(124, 58, 237, 0.20), transparent 30%),
    linear-gradient(180deg, #070a14 0%, var(--fb-bg-2) 100%) !important;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -2;
  pointer-events: none;
  opacity: 0.75;
  background-image: url("data:image/svg+xml,%3Csvg width='1400' height='1000' viewBox='0 0 1400 1000' xmlns='http://www.w3.org/2000/svg'%3E%3Cpolygon points='0,0 200,0 80,300' fill='%237c3aed' opacity='.30'/%3E%3Cpolygon points='200,0 500,0 300,350' fill='%238b5cf6' opacity='.24'/%3E%3Cpolygon points='500,0 900,0 700,380' fill='%23a855f7' opacity='.20'/%3E%3Cpolygon points='900,0 1400,0 1100,320' fill='%236d28d9' opacity='.22'/%3E%3Cpolygon points='0,300 300,150 180,650' fill='%23c084fc' opacity='.22'/%3E%3Cpolygon points='300,150 700,380 450,800' fill='%237c3aed' opacity='.18'/%3E%3Cpolygon points='700,380 1100,320 900,850' fill='%238b5cf6' opacity='.18'/%3E%3Cpolygon points='1100,320 1400,200 1400,900 900,850' fill='%235b4bd6' opacity='.16'/%3E%3C/svg%3E");
  background-size: cover;
  background-position: center top;
}

:root[data-theme="dark"] body::before {
  opacity: 0.55;
  background-image: url("data:image/svg+xml,%3Csvg width='1400' height='1000' viewBox='0 0 1400 1000' xmlns='http://www.w3.org/2000/svg'%3E%3Cpolygon points='0,0 240,0 100,360' fill='%238b5cf6' opacity='.35'/%3E%3Cpolygon points='240,0 600,0 350,360' fill='%237c3aed' opacity='.22'/%3E%3Cpolygon points='600,0 1000,0 760,420' fill='%2338bdf8' opacity='.14'/%3E%3Cpolygon points='1000,0 1400,0 1100,380' fill='%236d28d9' opacity='.26'/%3E%3Cpolygon points='0,350 350,200 200,700' fill='%23a855f7' opacity='.22'/%3E%3Cpolygon points='350,200 760,420 480,900' fill='%237c3aed' opacity='.20'/%3E%3Cpolygon points='760,420 1100,380 900,900' fill='%238b5cf6' opacity='.18'/%3E%3Cpolygon points='1100,380 1400,220 1400,900 900,900' fill='%234f46e5' opacity='.20'/%3E%3C/svg%3E");
}

/* === OVERRIDE: Dark theme coverage for template-local light surfaces === */
:root[data-theme="dark"] .admin-section,
:root[data-theme="dark"] .banner-form,
:root[data-theme="dark"] .location-checkboxes,
:root[data-theme="dark"] .filter-bar,
:root[data-theme="dark"] .dashboard-type-selector,
:root[data-theme="dark"] .dashboard-type-selector label,
:root[data-theme="dark"] .table-container,
:root[data-theme="dark"] .table-container table,
:root[data-theme="dark"] body > .container table,
:root[data-theme="dark"] body > .container tbody tr,
:root[data-theme="dark"] .banner-table,
:root[data-theme="dark"] .error-container,
:root[data-theme="dark"] .payment-blocked-card,
:root[data-theme="dark"] .payment-settings-content,
:root[data-theme="dark"] .dashboard-page [style*="background: #f9fafb"],
:root[data-theme="dark"] .dashboard-page [style*="background:#f9fafb"],
:root[data-theme="dark"] .dashboard-page [style*="background: white"],
:root[data-theme="dark"] .dashboard-page [style*="background:white"],
:root[data-theme="dark"] .dashboard-page [style*="background: #fff"],
:root[data-theme="dark"] .dashboard-page [style*="background:#fff"],
:root[data-theme="dark"] .admin-page table,
:root[data-theme="dark"] .admin-page tbody tr,
:root[data-theme="dark"] .admin-page [style*="background: #f9fafb"],
:root[data-theme="dark"] .admin-page [style*="background:#f9fafb"],
:root[data-theme="dark"] .admin-page [style*="background: white"],
:root[data-theme="dark"] .admin-page [style*="background:white"],
:root[data-theme="dark"] .admin-page [style*="background: #fff"],
:root[data-theme="dark"] .admin-page [style*="background:#fff"],
:root[data-theme="dark"] .users-table tbody tr[style*="background"] {
  background: var(--fb-surface-strong) !important;
  color: var(--fb-text) !important;
  border-color: var(--fb-border) !important;
}

:root[data-theme="dark"] .location-checkboxes,
:root[data-theme="dark"] .filter-bar,
:root[data-theme="dark"] .dashboard-type-selector,
:root[data-theme="dark"] .dashboard-type-selector label,
:root[data-theme="dark"] .table-container,
:root[data-theme="dark"] .banner-table,
:root[data-theme="dark"] .error-container,
:root[data-theme="dark"] .payment-blocked-card,
:root[data-theme="dark"] .payment-settings-content {
  border: 1px solid var(--fb-border) !important;
  box-shadow: var(--fb-shadow-card) !important;
}

:root[data-theme="dark"] .location-title,
:root[data-theme="dark"] .checkbox-item label,
:root[data-theme="dark"] .form-field label,
:root[data-theme="dark"] .filter-group label,
:root[data-theme="dark"] .admin-page td,
:root[data-theme="dark"] body > .container td,
:root[data-theme="dark"] .admin-page td strong,
:root[data-theme="dark"] body > .container td strong,
:root[data-theme="dark"] .admin-page [style*="color: #888"],
:root[data-theme="dark"] .admin-page [style*="color:#888"],
:root[data-theme="dark"] .admin-page [style*="color: #999"],
:root[data-theme="dark"] .admin-page [style*="color:#999"],
:root[data-theme="dark"] .dashboard-page [style*="color: #888"],
:root[data-theme="dark"] .dashboard-page [style*="color:#888"],
:root[data-theme="dark"] .dashboard-page [style*="color: #999"],
:root[data-theme="dark"] .dashboard-page [style*="color:#999"],
:root[data-theme="dark"] .dashboard-type-selector label,
:root[data-theme="dark"] .error-title,
:root[data-theme="dark"] .error-message,
:root[data-theme="dark"] .login-title,
:root[data-theme="dark"] .login-container .form-label,
:root[data-theme="dark"] .remember-me,
:root[data-theme="dark"] .remember-me label,
:root[data-theme="dark"] .payment-blocked-title,
:root[data-theme="dark"] .payment-blocked-text,
:root[data-theme="dark"] .payment-blocked-secondary {
  color: var(--fb-text) !important;
}

:root[data-theme="dark"] .login-subtitle,
:root[data-theme="dark"] .saved-logins-hint {
  color: var(--fb-muted) !important;
}

:root[data-theme="dark"] .error-page,
:root[data-theme="dark"] .payment-blocked-page {
  background:
    radial-gradient(circle at 15% 10%, rgba(139, 92, 246, 0.30), transparent 30%),
    radial-gradient(circle at 88% 8%, rgba(34, 211, 238, 0.16), transparent 32%),
    linear-gradient(180deg, #070a14 0%, var(--fb-bg-2) 100%) !important;
}

:root[data-theme="dark"] .payment-blocked-date {
  background: color-mix(in srgb, var(--fb-danger) 22%, var(--fb-surface-strong)) !important;
  color: #fecaca !important;
  border: 1px solid color-mix(in srgb, var(--fb-danger) 34%, var(--fb-border)) !important;
}

:root[data-theme="dark"] .tech-admin-card-title,
:root[data-theme="dark"] .banner-date,
:root[data-theme="dark"] .banner-table td,
:root[data-theme="dark"] .admin-page td::before,
:root[data-theme="dark"] .pagination a,
:root[data-theme="dark"] .pagination span {
  color: var(--fb-muted) !important;
}

:root[data-theme="dark"] .admin-page thead,
:root[data-theme="dark"] .admin-page th,
:root[data-theme="dark"] body > .container thead,
:root[data-theme="dark"] body > .container th,
:root[data-theme="dark"] .banner-table thead {
  background: var(--fb-surface-muted) !important;
  color: var(--fb-muted) !important;
  border-color: var(--fb-border) !important;
}

:root[data-theme="dark"] .admin-page td,
:root[data-theme="dark"] .admin-page th,
:root[data-theme="dark"] body > .container td,
:root[data-theme="dark"] body > .container th,
:root[data-theme="dark"] .banner-table td {
  border-color: var(--fb-border) !important;
}

:root[data-theme="dark"] .admin-page tbody tr:hover,
:root[data-theme="dark"] body > .container tbody tr:hover,
:root[data-theme="dark"] .banner-table tbody tr:hover {
  background: color-mix(in srgb, var(--fb-primary) 12%, var(--fb-surface-strong)) !important;
}

:root[data-theme="dark"] .pagination a,
:root[data-theme="dark"] .pagination span {
  background: var(--fb-surface-strong) !important;
  border-color: var(--fb-border) !important;
}

:root[data-theme="dark"] .pagination a:hover,
:root[data-theme="dark"] .pagination .current {
  background: var(--fb-primary) !important;
  border-color: var(--fb-primary) !important;
  color: #fff !important;
}

:root[data-theme="dark"] .dashboard-type-selector label:has(input:checked) {
  background: color-mix(in srgb, var(--fb-primary) 18%, var(--fb-surface-strong)) !important;
  border-color: var(--fb-primary) !important;
}

:root[data-theme="dark"] .dashboard-type-selector input[type="radio"]:checked + span {
  color: var(--fb-primary-strong) !important;
}

:root[data-theme="dark"] .banner {
  box-shadow: var(--fb-shadow-card) !important;
}

:root[data-theme="dark"] .login-banner {
  box-shadow: var(--fb-shadow-card) !important;
}

:root[data-theme="dark"] .login-banner-info,
:root[data-theme="dark"] .banner-info {
  background: color-mix(in srgb, #3b82f6 24%, var(--fb-surface-strong)) !important;
  color: #dbeafe !important;
}

:root[data-theme="dark"] .login-banner-success,
:root[data-theme="dark"] .banner-success {
  background: color-mix(in srgb, #10b981 22%, var(--fb-surface-strong)) !important;
  color: #d1fae5 !important;
}

:root[data-theme="dark"] .login-banner-warning,
:root[data-theme="dark"] .banner-warning {
  background: color-mix(in srgb, #f59e0b 22%, var(--fb-surface-strong)) !important;
  color: #fef3c7 !important;
}

:root[data-theme="dark"] .login-banner-error,
:root[data-theme="dark"] .banner-error {
  background: color-mix(in srgb, #ef4444 22%, var(--fb-surface-strong)) !important;
  color: #fee2e2 !important;
}

:root[data-theme="dark"] .dashboard-toast {
  box-shadow: var(--fb-shadow-card) !important;
}

:root[data-theme="dark"] .dashboard-toast-success {
  background: color-mix(in srgb, #10b981 22%, var(--fb-surface-strong)) !important;
  color: #d1fae5 !important;
  border-color: color-mix(in srgb, #10b981 42%, var(--fb-border)) !important;
}

:root[data-theme="dark"] .dashboard-toast-error {
  background: color-mix(in srgb, #ef4444 22%, var(--fb-surface-strong)) !important;
  color: #fee2e2 !important;
  border-color: color-mix(in srgb, #ef4444 42%, var(--fb-border)) !important;
}

:root[data-theme="dark"] .dashboard-payment-warning {
  background: color-mix(in srgb, #f59e0b 20%, var(--fb-surface-strong)) !important;
  color: #fef3c7 !important;
  border-color: color-mix(in srgb, #f59e0b 44%, var(--fb-border)) !important;
  box-shadow: var(--fb-shadow-card) !important;
}

:root[data-theme="dark"] .tech-admin-payment-alert {
  background: color-mix(in srgb, #ef4444 20%, var(--fb-surface-strong)) !important;
  color: #fee2e2 !important;
  border-color: color-mix(in srgb, #ef4444 42%, var(--fb-border)) !important;
}

:root[data-theme="dark"] .badge,
:root[data-theme="dark"] .location-badge,
:root[data-theme="dark"] .status-badge {
  border: 1px solid rgba(148, 163, 184, 0.22) !important;
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.14);
}

:root[data-theme="dark"] .badge-info,
:root[data-theme="dark"] .location-badge {
  background: color-mix(in srgb, #3b82f6 22%, var(--fb-surface-strong)) !important;
  color: #dbeafe !important;
  border-color: color-mix(in srgb, #3b82f6 40%, var(--fb-border)) !important;
}

:root[data-theme="dark"] .badge-success,
:root[data-theme="dark"] .status-badge.active {
  background: color-mix(in srgb, #10b981 22%, var(--fb-surface-strong)) !important;
  color: #d1fae5 !important;
  border-color: color-mix(in srgb, #10b981 40%, var(--fb-border)) !important;
}

:root[data-theme="dark"] .badge-warning {
  background: color-mix(in srgb, #f59e0b 22%, var(--fb-surface-strong)) !important;
  color: #fef3c7 !important;
  border-color: color-mix(in srgb, #f59e0b 40%, var(--fb-border)) !important;
}

:root[data-theme="dark"] .badge-error,
:root[data-theme="dark"] .status-badge.inactive {
  background: color-mix(in srgb, #ef4444 20%, var(--fb-surface-strong)) !important;
  color: #fee2e2 !important;
  border-color: color-mix(in srgb, #ef4444 40%, var(--fb-border)) !important;
}

:root[data-theme="dark"] .user-agent-full {
  background: var(--fb-surface-strong) !important;
  color: var(--fb-text) !important;
  border-color: var(--fb-border) !important;
  box-shadow: var(--fb-shadow-shell) !important;
}

/* Dark admin/profile polish */
:root[data-theme="dark"] .btn-admin {
  background:
    linear-gradient(135deg, rgba(125, 211, 252, 0.24), rgba(155, 124, 255, 0.34)) !important;
  color: #eef6ff !important;
  border: 1px solid rgba(155, 124, 255, 0.42) !important;
  box-shadow:
    0 12px 28px rgba(91, 75, 214, 0.20),
    0 1px 0 rgba(255, 255, 255, 0.08) inset !important;
}

:root[data-theme="dark"] .btn-admin:hover {
  background:
    linear-gradient(135deg, rgba(125, 211, 252, 0.32), rgba(155, 124, 255, 0.44)) !important;
  border-color: rgba(125, 211, 252, 0.46) !important;
  color: #ffffff !important;
}

:root[data-theme="dark"] .password-requirements {
  background:
    linear-gradient(135deg, rgba(35, 42, 70, 0.82), rgba(17, 24, 39, 0.88)) !important;
  color: var(--fb-text) !important;
  border: 1px solid rgba(148, 163, 184, 0.22) !important;
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.24) !important;
}

:root[data-theme="dark"] .password-requirements li,
:root[data-theme="dark"] .password-requirements strong {
  color: var(--fb-text) !important;
}

:root[data-theme="dark"] .admin-section {
  padding: 24px !important;
  border: 1px solid rgba(148, 163, 184, 0.16) !important;
  border-radius: var(--fb-radius-md) !important;
  background:
    linear-gradient(135deg, rgba(17, 24, 39, 0.62), rgba(15, 23, 42, 0.44)) !important;
  box-shadow:
    0 18px 44px rgba(0, 0, 0, 0.22),
    0 1px 0 rgba(255, 255, 255, 0.04) inset !important;
}

:root[data-theme="dark"] .admin-section + .admin-section {
  margin-top: 28px;
}

:root[data-theme="dark"] .create-user-form,
:root[data-theme="dark"] .filter-form,
:root[data-theme="dark"] .access-list,
:root[data-theme="dark"] .access-summary {
  background:
    linear-gradient(135deg, rgba(35, 42, 70, 0.46), rgba(17, 24, 39, 0.58)) !important;
  border-color: rgba(148, 163, 184, 0.20) !important;
}

.login-container .logo-container {
  width: 96px !important;
  height: 96px !important;
  margin: 0 auto 28px !important;
}

.login-container .logo {
  width: 96px !important;
  height: 96px !important;
  border-radius: 50% !important;
}

:root[data-theme="dark"] .checkbox-group label {
  color: var(--fb-text) !important;
}

:root[data-theme="dark"] .checkbox-group input[type="checkbox"] {
  border-color: rgba(203, 213, 225, 0.54);
  accent-color: var(--fb-primary-strong);
}

.banner-form > .form-field {
  margin-bottom: 22px;
}

.banner-form > .form-field + .form-field {
  margin-top: 6px;
}

@media screen and (max-width: 768px) {
  :root[data-theme="dark"] .admin-page tbody tr {
    background: var(--fb-surface-strong) !important;
    border-color: var(--fb-border) !important;
    box-shadow: var(--fb-shadow-card) !important;
  }

  :root[data-theme="dark"] .admin-page tbody tr:hover {
    background: color-mix(in srgb, var(--fb-primary) 12%, var(--fb-surface-strong)) !important;
  }
}
