:root {
  --bg: #0b141a;
  --surface: #111b21;
  --surface-2: #1f2c34;
  --border: #2a3942;
  --text: #e9edef;
  --muted: #8696a0;
  --green: #00a884;
  --green-dark: #008069;
  --yellow: #f7c948;
  --red: #ea4335;
  --blue: #53bdeb;
  --radius: 12px;
  --shadow: 0 8px 32px rgba(0, 0, 0, 0.35);
}

* {
  box-sizing: border-box;
}

html {
  overflow-x: hidden;
}

body {
  margin: 0;
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
  background: linear-gradient(180deg, #0b141a 0%, #111b21 100%);
  color: var(--text);
  min-height: 100vh;
  overflow-x: hidden;
}

.app {
  max-width: 1200px;
  margin: 0 auto;
  padding: 24px;
  width: 100%;
}

@media (max-width: 640px) {
  .app {
    padding: 16px;
  }
}

.header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 32px;
  width: 100%;
  min-width: 0;
}

.header > div:first-child {
  min-width: 0;
  flex: 1 1 auto;
}

.header h1 {
  margin: 0 0 4px;
  font-size: 1.75rem;
}

.brand-hero {
  margin-bottom: 6px;
}

.brand-kicker {
  margin: 0 0 4px;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--green);
}

.brand-title {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 0.15em;
  margin: 0;
  font-size: clamp(2.4rem, 6vw, 3.6rem);
  font-weight: 900;
  line-height: 1;
  letter-spacing: -0.03em;
}

.brand-fervo {
  background: linear-gradient(135deg, #ffffff 0%, #d8ffe9 55%, #7dffc4 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.brand-title .brand-accent {
  color: var(--green);
  text-shadow: 0 0 28px rgba(0, 168, 132, 0.45);
}

.subtitle {
  margin: 0;
  color: var(--muted);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: flex-end;
  flex: 0 1 auto;
  min-width: 0;
}

.badge {
  display: inline-flex;
  align-items: center;
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 600;
}

.badge-muted {
  background: var(--surface-2);
  color: var(--muted);
}

.badge-ok {
  background: rgba(0, 168, 132, 0.15);
  color: var(--green);
}

.badge-error {
  background: rgba(234, 67, 53, 0.15);
  color: var(--red);
}

.badge-browser {
  font-size: 0.75rem;
  padding: 4px 10px;
}

.badge-browser-chrome {
  background: rgba(66, 133, 244, 0.15);
  color: #4285f4;
}

.badge-browser-edge {
  background: rgba(0, 120, 212, 0.15);
  color: #0078d4;
}

.badge-browser-duckduckgo {
  background: rgba(222, 105, 55, 0.15);
  color: #de6937;
}

.badge-browser-brave {
  background: rgba(251, 84, 43, 0.15);
  color: #fb542b;
}

.badge-browser-opera,
.badge-browser-opera_gx {
  background: rgba(255, 27, 45, 0.15);
  color: #ff1b2d;
}

.badge-browser-vivaldi {
  background: rgba(239, 52, 60, 0.15);
  color: #ef343c;
}

.badge-browser-chromium {
  background: rgba(120, 144, 156, 0.15);
  color: #78909c;
}

.btn {
  border: none;
  border-radius: 8px;
  padding: 10px 16px;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.15s ease, opacity 0.15s ease;
}

.btn:hover {
  transform: translateY(-1px);
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.btn-primary {
  background: var(--green);
  color: #fff;
}

.btn-primary:hover {
  background: var(--green-dark);
}

.btn-secondary {
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--border);
}

.btn-ghost {
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--border);
}

.btn-danger {
  background: rgba(234, 67, 53, 0.15);
  color: var(--red);
}

.btn-warning {
  background: rgba(251, 188, 4, 0.15);
  color: #fbbc04;
}

.sessions-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr));
  gap: 20px;
}

.session-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
}

.session-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 16px;
}

.session-name {
  margin: 0 0 4px;
  font-size: 1.1rem;
}

.session-id {
  color: var(--muted);
  font-size: 0.75rem;
  word-break: break-all;
}

.status-badge {
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  white-space: nowrap;
}

.status-idle { background: var(--surface-2); color: var(--muted); }
.status-starting { background: rgba(83, 189, 235, 0.15); color: var(--blue); }
.status-qr { background: rgba(247, 201, 72, 0.15); color: var(--yellow); }
.status-authenticated { background: rgba(83, 189, 235, 0.15); color: var(--blue); }
.status-ready { background: rgba(0, 168, 132, 0.15); color: var(--green); }
.status-disconnected { background: rgba(234, 67, 53, 0.15); color: var(--red); }
.status-error { background: rgba(234, 67, 53, 0.15); color: var(--red); }

.qr-area {
  background: #fff;
  border-radius: 10px;
  min-height: 280px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 16px;
  overflow: hidden;
}

.qr-image {
  width: 280px;
  height: 280px;
  object-fit: contain;
}

.qr-placeholder {
  text-align: center;
  padding: 24px;
}

.qr-message {
  margin: 0;
  color: #54656f;
  font-size: 0.95rem;
}

.session-meta {
  min-height: 24px;
  margin-bottom: 16px;
  font-size: 0.85rem;
}

.phone-label {
  color: var(--green);
  font-weight: 600;
}

.error-label {
  color: var(--red);
}

.session-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.empty-state {
  text-align: center;
  padding: 64px 24px;
  background: var(--surface);
  border: 1px dashed var(--border);
  border-radius: var(--radius);
}

.empty-icon {
  font-size: 3rem;
  margin-bottom: 12px;
}

.empty-state h2 {
  margin: 0 0 8px;
}

.empty-state p {
  color: var(--muted);
  margin: 0 0 20px;
}

.hidden {
  display: none !important;
}

.dialog {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  padding: 24px;
  width: min(420px, 90vw);
  box-shadow: var(--shadow);
}

.dialog::backdrop {
  background: rgba(0, 0, 0, 0.6);
}

.dialog h2 {
  margin: 0 0 16px;
}

.dialog label {
  display: block;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 0.85rem;
}

.dialog input {
  width: 100%;
  padding: 12px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  margin-bottom: 20px;
}

.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

@media (max-width: 640px) {
  .header {
    flex-direction: column;
  }

  .header-actions {
    width: 100%;
    flex-direction: column;
    align-items: stretch;
  }

  .header-actions .btn,
  .header-actions .badge,
  .header-actions a.btn {
    width: 100%;
    justify-content: center;
    text-align: center;
  }

  #userBadge {
    white-space: normal;
    text-align: center;
    line-height: 1.35;
  }

  .top-nav {
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    max-width: 100%;
    padding-bottom: 4px;
  }

  .top-nav a {
    flex-shrink: 0;
  }

  .panel-card {
    padding: 16px;
  }

  .panel-card-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .panel-card-header-stack {
    align-items: stretch;
  }

  .add-session-row {
    flex-direction: column;
  }

  .add-session-row .btn-lg {
    width: 100%;
  }

  .session-inline-card {
    flex-direction: column;
    align-items: stretch;
  }

  .session-inline-qr-wrap {
    align-self: center;
  }

  .contact-row {
    grid-template-columns: auto 1fr;
    grid-template-areas:
      "check name"
      "check phone";
  }

  .contact-phone {
    grid-column: 2;
  }

  .form-row {
    flex-direction: column;
  }

  .inline-actions {
    flex-wrap: wrap;
    width: 100%;
  }

  .inline-actions .btn {
    flex: 1 1 auto;
    min-width: 0;
  }

  .client-row {
    flex-direction: column;
    align-items: stretch;
  }

  .client-row .inline-actions {
    justify-content: stretch;
  }

  .progress-stats-inline {
    grid-template-columns: repeat(2, 1fr) !important;
  }

  .sessions-grid {
    grid-template-columns: 1fr;
  }

  .session-actions {
    flex-wrap: wrap;
  }

  .session-actions .btn {
    flex: 1 1 calc(50% - 4px);
    min-width: 120px;
  }
}

.top-nav {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
  max-width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
}

.top-nav a {
  color: var(--muted);
  text-decoration: none;
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid transparent;
  font-size: 0.85rem;
  font-weight: 600;
  flex-shrink: 0;
  white-space: nowrap;
}

.top-nav a:hover {
  color: var(--text);
  border-color: var(--border);
}

.top-nav a.active {
  color: var(--green);
  background: rgba(0, 168, 132, 0.12);
  border-color: rgba(0, 168, 132, 0.25);
}

.app-wide {
  max-width: 1400px;
}

.dispatch-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  min-width: 0;
}

.panel-card {
  min-width: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
}

.panel-card-full {
  grid-column: 1 / -1;
}

.panel-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}

.panel-card-header h2 {
  margin: 0;
  font-size: 1.1rem;
}

.hint {
  color: var(--muted);
  font-size: 0.8rem;
}

label {
  display: block;
  margin: 12px 0 8px;
  color: var(--muted);
  font-size: 0.85rem;
}

.input,
.textarea,
select.input {
  width: 100%;
  max-width: 100%;
  padding: 12px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  font: inherit;
}

.textarea {
  resize: vertical;
  min-height: 120px;
}

.input-inline {
  width: auto;
  min-width: 180px;
}

.form-row {
  display: flex;
  gap: 12px;
}

.field-grow {
  flex: 1;
}

.inline-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
  align-items: center;
}

.btn-sm {
  padding: 6px 10px;
  font-size: 0.8rem;
}

.contacts-toolbar {
  display: flex;
  gap: 12px;
  align-items: center;
  margin: 16px 0 12px;
}

.contacts-list {
  max-height: 320px;
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-2);
}

.sessions-picker {
  max-height: 200px;
  overflow: auto;
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 10px;
  padding: 4px;
  background: rgba(0, 0, 0, 0.12);
}

.contact-row {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
}

.contact-row:last-child {
  border-bottom: none;
}

.contact-row:hover {
  background: rgba(255, 255, 255, 0.03);
}

.contact-name {
  font-weight: 600;
}

.contact-phone {
  color: var(--muted);
  font-size: 0.85rem;
}

.group-row {
  cursor: default;
}

.groups-scroll-list {
  max-height: 560px;
  overflow: auto;
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 10px;
  padding: 4px;
  background: rgba(0, 0, 0, 0.15);
}

.groups-scroll-list .virtual-viewport .group-row {
  height: 68px;
  box-sizing: border-box;
  content-visibility: auto;
  contain-intrinsic-size: 68px;
}

.groups-scroll-list .group-row {
  align-items: flex-start;
}

.group-link {
  display: block;
  color: var(--muted);
  font-size: 0.75rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
  margin-top: 2px;
}

.textarea {
  min-height: 100px;
  resize: vertical;
  font-family: inherit;
}

.empty-inline {
  padding: 20px;
  text-align: center;
  color: var(--muted);
}

.progress-box {
  margin-bottom: 16px;
}

.progress-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 12px;
}

.progress-stats div {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px;
  text-align: center;
}

.progress-stats strong {
  display: block;
  font-size: 1.4rem;
  margin-bottom: 4px;
}

.progress-stats span {
  color: var(--muted);
  font-size: 0.8rem;
}

.progress-bar {
  height: 10px;
  background: var(--surface-2);
  border-radius: 999px;
  overflow: hidden;
  margin-bottom: 8px;
}

.progress-fill {
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, var(--green-dark), var(--green));
  transition: width 0.3s ease;
}

.progress-label {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.results-log {
  max-height: 280px;
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-2);
}

.result-item {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  font-size: 0.9rem;
}

.result-item:last-child {
  border-bottom: none;
}

.result-sent {
  color: var(--green);
}

.result-failed {
  color: var(--red);
}

.info-box {
  margin: 12px 0;
  padding: 12px;
  border-radius: 8px;
  background: rgba(83, 189, 235, 0.08);
  border: 1px solid rgba(83, 189, 235, 0.2);
  color: var(--muted);
  font-size: 0.9rem;
}

.theme-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 12px;
}

.theme-card {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface-2);
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.theme-card:hover {
  border-color: rgba(0, 168, 132, 0.4);
}

.theme-card:has(.theme-check:checked) {
  border-color: var(--green);
  background: rgba(0, 168, 132, 0.08);
}

.duration-options {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 16px;
}

.duration-option,
.mode-option,
.plan-option {
  border: 2px solid var(--border);
  border-radius: 10px;
  padding: 12px 10px;
  background: var(--surface-2);
  color: var(--text);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.duration-option:hover,
.mode-option:hover,
.plan-option:hover {
  border-color: var(--green);
}

.duration-option.active,
.mode-option.active,
.plan-option.active {
  border-color: var(--green);
  background: rgba(0, 168, 132, 0.12);
  color: var(--green);
}

.theme-card .theme-check {
  align-self: flex-start;
}

.theme-icon {
  font-size: 1.5rem;
}

.theme-name {
  font-weight: 700;
  font-size: 0.95rem;
}

.completion-toast {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 9999;
  max-width: min(420px, calc(100vw - 32px));
  padding: 16px 18px;
  border-radius: 12px;
  font-size: 1rem;
  font-weight: 700;
  line-height: 1.4;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.35);
  transition: opacity 0.25s ease, transform 0.25s ease;
}

.completion-toast.hidden {
  opacity: 0;
  transform: translateY(-12px);
  pointer-events: none;
}

.completion-toast-ok {
  background: rgba(0, 168, 132, 0.95);
  color: #fff;
  border: 2px solid rgba(255, 255, 255, 0.2);
}

.completion-toast-warn {
  background: rgba(234, 67, 53, 0.95);
  color: #fff;
  border: 2px solid rgba(255, 255, 255, 0.2);
}

.media-grid {
  display: grid;

.theme-count {
  color: var(--muted);
  font-size: 0.75rem;
}

.template-groups {
  display: flex;
  flex-direction: column;
  gap: 16px;
  max-height: 420px;
  overflow: auto;
}

.template-group h3 {
  margin: 0 0 8px;
  font-size: 0.95rem;
  color: var(--green);
}

.template-item {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
}

.template-item:last-child {
  border-bottom: none;
}

.template-text {
  font-size: 0.88rem;
  color: var(--text);
  line-height: 1.4;
}

.contacts-list-short {
  max-height: 220px;
}

.activity-log {
  max-height: 360px;
}

.progress-stats-inline {
  margin: 0;
}

.log-message {
  color: var(--green);
}

.log-response {
  color: var(--blue);
}

.log-error {
  color: var(--red);
}

.log-info {
  color: var(--muted);
}

.log-success {
  color: var(--green);
  font-weight: 700;
}

.highlight-panel {
  border-color: rgba(0, 168, 132, 0.35);
  background: linear-gradient(180deg, rgba(0, 168, 132, 0.06) 0%, var(--surface) 100%);
}

.btn-lg {
  padding: 12px 20px;
  font-size: 1rem;
  white-space: normal;
}

.add-session-row {
  display: flex;
  gap: 12px;
  margin-bottom: 16px;
  align-items: stretch;
}

.add-session-row .input {
  flex: 1;
  margin: 0;
}

.sessions-inline-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.session-inline-card {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface-2);
}

.session-inline-main {
  flex: 1;
  min-width: 0;
}

.session-inline-info {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}

.session-inline-error {
  margin: 0 0 8px;
  color: var(--red);
  font-size: 0.85rem;
  word-break: break-word;
}

.session-inline-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.session-inline-qr-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.session-inline-qr {
  width: 140px;
  height: 140px;
  border-radius: 8px;
  background: #fff;
  object-fit: contain;
}

.session-inline-qr-hint {
  margin: 0;
  font-size: 0.75rem;
  color: var(--muted);
}

.upload-box {
  display: block;
  padding: 24px;
  border: 2px dashed var(--border);
  border-radius: 10px;
  text-align: center;
  color: var(--muted);
  cursor: pointer;
}

.upload-box:hover {
  border-color: var(--green);
  color: var(--text);
}

.media-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 12px;
  margin-top: 12px;
}

.media-card {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 8px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-2);
}

.media-card-selectable {
  cursor: pointer;
  position: relative;
}

.media-card-selectable.selected {
  border-color: var(--green);
  box-shadow: 0 0 0 1px rgba(0, 168, 132, 0.35);
}

.media-card-selectable .media-select-check {
  position: absolute;
  top: 12px;
  left: 12px;
  z-index: 2;
  width: 18px;
  height: 18px;
  accent-color: var(--green);
}

.media-picker-toolbar {
  flex-wrap: wrap;
  margin-top: 8px;
}

.media-card img,
.media-card video {
  width: 100%;
  height: 90px;
  object-fit: cover;
  border-radius: 6px;
}

.media-card audio {
  width: 100%;
  height: 32px;
}

.media-file-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 90px;
  font-size: 2rem;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 6px;
}

.media-card span {
  font-size: 0.75rem;
  color: var(--muted);
  word-break: break-all;
}

.log-photo {
  color: var(--yellow);
}

.log-video {
  color: #7eb8ff;
}

.log-audio {
  color: #c9a0ff;
}

.log-document {
  color: #ffb366;
}

.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.login-page-hero {
  background:
    radial-gradient(circle at top, rgba(123, 44, 191, 0.28), transparent 45%),
    radial-gradient(circle at bottom right, rgba(155, 93, 229, 0.18), transparent 40%),
    var(--bg, #0f1419);
}

.login-card {
  width: 100%;
  max-width: 420px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 28px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.25);
}

.login-card-hero {
  max-width: 440px;
  padding: 32px 28px 28px;
}

.login-brand h1 {
  margin: 0 0 8px;
}

.login-brand-hero {
  text-align: center;
  margin-bottom: 8px;
}

.login-logo {
  display: block;
  width: 96px;
  height: 96px;
  margin: 0 auto 14px;
  border-radius: 24px;
  box-shadow: 0 10px 30px rgba(123, 44, 191, 0.45);
  object-fit: cover;
}

.login-logo-sm {
  width: 72px;
  height: 72px;
  border-radius: 18px;
}

.login-brand-hero .brand-title {
  justify-content: center;
  font-size: clamp(2rem, 5vw, 2.8rem);
  margin-bottom: 8px;
}

.login-brand p,
.login-hint p {
  color: var(--muted);
  margin: 0 0 8px;
}

.login-form label {
  display: block;
  margin-top: 12px;
  margin-bottom: 6px;
}

.login-error {
  color: #ff6b6b;
  margin-top: 12px;
  font-size: 0.9rem;
}

.portal-links {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin: 20px 0 8px;
}

.portal-btn {
  text-align: center;
  text-decoration: none;
  display: block;
}

.login-hint a {
  color: var(--green);
}

.client-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  margin-bottom: 10px;
  background: var(--surface-2);
}

.connection-badge {
  position: fixed;
  bottom: 16px;
  right: 16px;
  z-index: 9999;
  padding: 8px 14px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 700;
  box-shadow: var(--shadow);
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.connection-badge.online {
  background: rgba(0, 168, 132, 0.2);
  color: var(--green);
  border: 1px solid rgba(0, 168, 132, 0.4);
}

.connection-badge.offline {
  background: rgba(247, 201, 72, 0.15);
  color: var(--yellow);
  border: 1px solid rgba(247, 201, 72, 0.35);
  animation: pulse-reconnect 1.5s ease-in-out infinite;
}

@keyframes pulse-reconnect {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.55; }
}

@media (max-width: 960px) {
  .dispatch-layout {
    grid-template-columns: 1fr;
  }

  .header {
    flex-wrap: wrap;
  }

  .progress-stats {
    grid-template-columns: repeat(2, 1fr);
  }

  .theme-grid {
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  }

  .groups-scroll-list {
    max-height: min(55vh, 480px);
  }

  .group-row {
    flex-wrap: wrap;
    gap: 8px;
  }

  .inline-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .inline-actions .btn {
    width: 100%;
  }
}

@media (max-width: 640px) {
  .connection-badge {
    left: 12px;
    right: 12px;
    bottom: 12px;
    text-align: center;
  }

  .dialog {
    width: calc(100vw - 32px);
    max-width: none;
  }

  .dialog-actions {
    flex-direction: column;
  }

  .dialog-actions .btn {
    width: 100%;
  }

  .groups-scroll-list .virtual-viewport .group-row {
    height: auto;
    min-height: 68px;
    contain-intrinsic-size: auto 68px;
  }
}

@media (max-width: 480px) {
  .theme-grid {
    grid-template-columns: 1fr 1fr;
  }

  .sessions-grid {
    grid-template-columns: 1fr;
  }

  .progress-stats {
    grid-template-columns: 1fr 1fr;
  }
}
