body {
  margin: 0;
  font-family: Arial, sans-serif;
  background: #f5f7fb;
  color: #1f2937;
}

.container {
  max-width: 980px;
  margin: 0 auto;
  padding: 20px;
}

.topbar {
  background: #111827;
  color: #fff;
}

.topbar-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.topbar a {
  color: #fff;
  margin-left: 12px;
  text-decoration: none;
}

.global-banner-wrap {
  background: #fef3c7;
  border-bottom: 1px solid #f59e0b;
  padding: 8px 0;
  font-size: 14px;
  color: #92400e;
}

.global-banner-line {
  margin: 2px 0;
}

.global-banner-wrap--hidden {
  display: none;
}

.alert-info {
  background: #e0f2fe;
  color: #075985;
}

.card {
  background: #fff;
  border-radius: 10px;
  padding: 20px;
  box-shadow: 0 2px 14px rgba(15, 23, 42, 0.08);
}

.form-grid {
  display: grid;
  gap: 10px;
}

input, textarea, button {
  padding: 10px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
}

button, .button {
  background: #2563eb;
  color: #fff;
  border: none;
  text-decoration: none;
  display: inline-block;
  cursor: pointer;
}

.button {
  padding: 10px 14px;
  border-radius: 8px;
  line-height: 1;
}

.button.secondary {
  background: #64748b;
  margin-left: 10px;
}

.nav-button {
  vertical-align: middle;
}

.alert {
  background: #fee2e2;
  color: #991b1b;
  padding: 10px;
  border-radius: 8px;
  margin-bottom: 10px;
}

.notice {
  background: #dbeafe;
  color: #1e40af;
  padding: 10px;
  border-radius: 8px;
  margin-bottom: 10px;
}

.login-body {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
}

.login-card {
  width: 420px;
  background: #fff;
  padding: 24px;
  border-radius: 10px;
  box-shadow: 0 2px 14px rgba(15, 23, 42, 0.08);
}

.login-card h1 {
  margin: 0 0 4px;
}

.login-card .subtitle {
  margin: 0 0 16px;
  color: #64748b;
}

.login-form {
  display: grid;
  gap: 8px;
}

.password-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.password-wrap input {
  width: 100%;
  padding-right: 42px;
}

.toggle-password {
  position: absolute;
  right: 6px;
  background: transparent;
  color: #334155;
  border: none;
  padding: 4px 8px;
  cursor: pointer;
}

.message-preview {
  white-space: pre-wrap;
  background: #f8fafc;
  padding: 12px;
  border-radius: 8px;
  border: 1px solid #e2e8f0;
}

.chat-list {
  max-height: 300px;
  overflow: auto;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 8px;
  margin-bottom: 12px;
}

.chat-row {
  display: block;
  padding: 6px;
}

.chat-tools {
  display: flex;
  gap: 8px;
  align-items: center;
  margin: 8px 0;
}

.chat-status {
  margin-left: 8px;
  font-size: 12px;
}

.chat-status.active {
  color: #15803d;
}

.chat-status.inactive {
  color: #b91c1c;
}

.chat-counters {
  margin: 6px 0 14px;
}

.group-panel {
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 10px;
  margin-bottom: 10px;
}

.group-select {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.hint.groups-hint {
  display: block;
  margin: 0 0 8px;
  padding-top: 18px;
}

.chat-groups-badge {
  margin-left: 6px;
  color: #475569;
}

.group-editor {
  margin-bottom: 10px;
}

.group-action-panel {
  margin-top: 10px;
}

.group-action-body {
  margin-top: 8px;
}

.group-members-current {
  margin-top: 8px;
}

.hint {
  margin: -4px 0 8px;
  color: #475569;
  font-size: 13px;
}

.text-muted {
  color: #64748b;
}

.help-tip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  margin-left: 4px;
  border-radius: 999px;
  background: #e2e8f0;
  color: #334155;
  font-size: 11px;
  font-weight: 700;
  cursor: default;
  vertical-align: middle;
}

.per-chat-editor {
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 10px;
}

.per-chat-card {
  margin-bottom: 10px;
  padding-bottom: 8px;
  border-bottom: 1px dashed #cbd5e1;
}

.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  border-bottom: 1px solid #e2e8f0;
  padding: 8px;
  text-align: left;
}

.actions {
  display: flex;
  gap: 6px;
}

.users-table th,
.users-table td {
  text-align: center !important;
  vertical-align: middle;
}

.users-actions-cell {
  text-align: center;
}

.users-actions-cell form {
  display: inline-block;
}

.danger {
  background: #dc2626;
  color: #fff;
  border: none;
}

.inline-form {
  margin: 12px 0;
}

.google-status {
  display: inline-block;
  margin-left: 8px;
  padding: 4px 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
}

.google-status.ok {
  background: #dcfce7;
  color: #166534;
}

.google-status.bad {
  background: #fee2e2;
  color: #991b1b;
}

.tabs {
  display: flex;
  gap: 8px;
  margin-top: 8px;
  margin-bottom: 8px;
}

.tab-button {
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid #cbd5e1;
  background: #e5e7eb;
  color: #1f2937;
  cursor: pointer;
  font-size: 14px;
}

.tab-button.active {
  background: #2563eb;
  color: #fff;
  border-color: #2563eb;
}

.logs-panel {
  display: none;
  margin-top: 8px;
}

.logs-panel.active {
  display: block;
}

.logs-filters input[type="text"],
.logs-filters select {
  max-width: 220px;
}

.logs-filters .only-users,
.logs-filters .only-chats {
  display: none;
}

.logs-filters.logs-users .only-users {
  display: inline-block;
}

.logs-filters.logs-chats .only-chats {
  display: inline-block;
}

.logs-table {
  table-layout: fixed;
}

.logs-table th:nth-child(1),
.logs-table td:nth-child(1) {
  width: 140px;
}

.logs-table th:nth-child(2),
.logs-table td:nth-child(2) {
  width: 150px;
  white-space: nowrap;
}

.logs-table th:nth-child(3),
.logs-table td:nth-child(3) {
  width: 130px;
  white-space: nowrap;
}

.logs-table th:nth-child(4),
.logs-table td:nth-child(4) {
  word-break: break-word;
}

.chat-logs-table th:nth-child(1),
.chat-logs-table td:nth-child(1) {
  width: 150px;
}

.chat-logs-table th:nth-child(2),
.chat-logs-table td:nth-child(2) {
  width: 170px;
}

.chat-logs-table th:nth-child(3),
.chat-logs-table td:nth-child(3) {
  width: 140px;
}

.log-chat-inactive {
  background: #fef2f2;
}

.log-chat-inactive td {
  border-bottom-color: #fecaca;
}

.logs-sample-label {
  margin-top: 4px;
  font-size: 13px;
  color: #475569;
}

.logs-sample {
  margin-top: 2px;
  max-height: 120px;
  overflow: auto;
}

.logs-details {
  margin-top: 4px;
}

.logs-details summary {
  cursor: pointer;
  user-select: none;
}

.logs-details-body {
  max-height: 0;
  opacity: 0;
  overflow: hidden;
  transition: max-height 220ms ease, opacity 180ms ease;
}

.logs-details[open] .logs-details-body {
  max-height: 220px;
  opacity: 1;
}

.logs-chats-list {
  margin-top: 4px;
  max-height: 160px;
  overflow-y: auto;
  overflow-x: auto;
  background: #f8fafc;
  padding: 8px;
  border-radius: 6px;
  border: 1px solid #e2e8f0;
  white-space: nowrap;
  word-break: normal;
  font-size: 12px;
}

.logs-chat-line {
  display: block;
  width: max-content;
  min-width: 100%;
  padding: 2px 4px;
  border-radius: 4px;
  white-space: nowrap;
  word-break: normal;
}

.logs-chat-line-match {
  background: #fef3c7;
  color: #92400e;
  font-weight: 700;
}

.progress-wrap {
  width: 100%;
  height: 10px;
  border-radius: 999px;
  background: #e2e8f0;
  overflow: hidden;
  margin: 8px 0 14px;
}

.progress-bar {
  height: 100%;
  background: #2563eb;
  width: 0;
  transition: width 0.25s ease;
}
