* { box-sizing: border-box; }
body {
  margin: 0;
  background: #f5f5f5;
  color: #111;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
.shell { min-height: 100vh; }
.hidden { display: none !important; }
.login-view {
  min-height: 100vh;
  display: grid;
  place-items: center;
}
.panel, .content section, .sidebar {
  background: #fff;
  border: 1px solid #e8e8e8;
  border-radius: 8px;
}
.login-panel {
  width: min(420px, calc(100vw - 32px));
  padding: 32px;
}
h1, h2, h3, p { margin-top: 0; }
.hint, header span { color: #777; }
.form { display: grid; gap: 12px; }
.form.row { grid-template-columns: 180px 1fr 120px; }
.form.row.admin-form {
  grid-template-columns: minmax(120px, 1fr) minmax(120px, 1fr) 120px minmax(180px, 1.2fr) 120px;
  margin-bottom: 16px;
}
input, textarea, select, button {
  min-height: 40px;
  border-radius: 6px;
  border: 1px solid #ddd;
  padding: 0 12px;
  font: inherit;
}
textarea { min-height: 92px; padding: 10px 12px; }
select { background: #fff; }
button {
  border: 0;
  background: #19be6b;
  color: #fff;
  cursor: pointer;
}
button.danger { background: #e5484d; }
button.warn { background: #f59e0b; }
button.plain { background: #f0f9f5; color: #138a50; border: 1px solid #bce8d0; }
.app-view {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 16px;
  padding: 16px;
}
.sidebar {
  padding: 16px;
  display: grid;
  align-content: start;
  gap: 10px;
}
.sidebar button {
  background: #f4f4f4;
  color: #111;
  text-align: left;
}
.sidebar button.active { background: #19be6b; color: #fff; }
.content { display: grid; gap: 16px; }
header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #fff;
  border: 1px solid #e8e8e8;
  border-radius: 8px;
  padding: 16px 20px;
}
.operation-status {
  margin: -8px 0 0;
  padding: 10px 12px;
  border: 1px solid #bce8d0;
  border-radius: 6px;
  background: #f0f9f5;
  color: #138a50;
}
.operation-status.error {
  border-color: #ffd2cc;
  background: #fff3f0;
  color: #9f1f18;
}
.operation-status.warning {
  border-color: #f6d99a;
  background: #fff8e7;
  color: #8b5e00;
}
.section { padding: 20px; }
.section-head {
  color: #666;
  margin-bottom: 16px;
}
.toolbar {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) 160px auto;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}
.pager {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-left: 10px;
}
.pager button {
  min-height: 30px;
  padding: 0 8px;
}
button:disabled {
  cursor: not-allowed;
  opacity: .45;
}
.metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(120px, 1fr));
  gap: 12px;
}
.alert {
  border: 1px solid #ffd2cc;
  background: #fff3f0;
  color: #9f1f18;
  border-radius: 6px;
  padding: 12px 14px;
  margin-bottom: 12px;
}
.alert.warning {
  border-color: #f6d99a;
  background: #fff8e7;
  color: #8b5e00;
}
.metric { padding: 16px; background: #f8f8f8; border-radius: 6px; }
.metric strong { display: block; font-size: 26px; margin-top: 8px; }
.empty-row { color: #777; text-align: center; padding: 28px 12px; }
.data-meta { margin: 14px 0 0; color: #777; font-size: 13px; }
.message-toolbar { grid-template-columns: minmax(220px, 2fr) 130px minmax(160px, 1fr) minmax(160px, 1fr); }
.check-control { display: inline-flex; align-items: center; gap: 6px; min-height: 40px; color: #555; white-space: nowrap; }
.check-control input { min-height: auto; }
.message-content-cell { min-width: 280px; max-width: 560px; }
.message-preview { margin-top: 6px; white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.45; }
.message-attachment-note { display: block; margin-top: 4px; }
.message-participants { display: block; margin-top: 4px; white-space: normal; overflow-wrap: anywhere; }
.message-raw { margin-top: 8px; color: #666; }
.message-raw summary { cursor: pointer; color: #138a50; font-size: 13px; }
.message-raw pre { max-height: 220px; overflow: auto; padding: 10px; background: #f7f7f7; border-radius: 6px; white-space: pre-wrap; overflow-wrap: anywhere; font-size: 12px; }
.message-review-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.message-review-actions .plain { padding: 3px 8px; font-size: 12px; }
.badge.deleted { color: #7c3aed; background: #f0e9ff; }
.table-wrap { overflow: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 12px; border-bottom: 1px solid #eee; text-align: left; }
.badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  border-radius: 999px;
  padding: 0 10px;
  color: #333;
  background: #f1f1f1;
  font-size: 13px;
}
.badge.active, .badge.resolved { color: #0f7a44; background: #e7f8ef; }
.badge.muted, .badge.processing { color: #9a5b00; background: #fff4d8; }
.badge.banned, .badge.disabled, .badge.pending, .badge.failed { color: #b42318; background: #ffe9e8; }
.badge.closed { color: #666; background: #eee; }
.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.actions button {
  min-height: 32px;
  padding: 0 10px;
}
.list { display: grid; gap: 10px; margin-top: 16px; }
.item { padding: 14px; background: #f8f8f8; border-radius: 6px; }
.auth-table { margin-top: 16px; }
#sendSmsButton {
  margin-top: 12px;
  width: 140px;
}
@media (max-width: 980px) {
  .app-view { grid-template-columns: 1fr; }
  .sidebar { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .form.row,
  .form.row.admin-form {
    grid-template-columns: 1fr;
  }
  .toolbar {
    grid-template-columns: 1fr;
  }
  .message-toolbar { grid-template-columns: 1fr; }
  .pager {
    display: flex;
    margin: 8px 0 0;
  }
}

.launch-check {
  border: 1px solid #e5e7eb;
  background: #fff;
  border-radius: 8px;
  padding: 14px;
  margin-bottom: 12px;
}
.launch-check.blocked { border-color: #ffd2cc; background: #fff8f6; }
.launch-check.ready { border-color: #b7ebc6; background: #f2fff6; }
.launch-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
}
.launch-head strong { display: block; font-size: 16px; margin-bottom: 4px; }
.launch-head span { color: #666; font-size: 13px; }
.launch-items { display: grid; gap: 8px; margin-top: 12px; }
.launch-item {
  display: grid;
  grid-template-columns: 52px 1fr;
  gap: 4px 10px;
  align-items: start;
  padding: 10px;
  border-radius: 6px;
  background: #fff;
  border: 1px solid #eee;
}
.launch-item b { font-size: 12px; }
.launch-item.blocker b { color: #b42318; }
.launch-item.warning b { color: #9a5b00; }
.launch-item small { grid-column: 2; color: #777; }
.launch-action { grid-column: 2; justify-self: start; margin-top: 2px; }

.backup-panel {
  border: 1px solid #e5e7eb;
  background: #fff;
  border-radius: 8px;
  padding: 14px;
  margin-bottom: 12px;
}
.backup-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
}
.backup-head strong { display: block; font-size: 16px; margin-bottom: 4px; }
.backup-head span { color: #666; font-size: 13px; }
.backup-list {
  display: grid;
  gap: 8px;
  margin-top: 10px;
}
.backup-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 12px;
  padding: 10px;
  border-radius: 6px;
  background: #f8f8f8;
}
.backup-row span { word-break: break-all; }
.backup-row small { color: #666; white-space: nowrap; }
.backup-row-actions { display: flex; align-items: center; gap: 8px; }
.backup-section { margin-top: 14px; padding-top: 12px; border-top: 1px solid #eee; }
.backup-section h4 { margin: 0; font-size: 14px; font-weight: 600; }
.backup-section h4 small { margin-left: 8px; color: #777; font-size: 12px; font-weight: 400; }
@media (max-width: 720px) {
  .backup-head { align-items: stretch; flex-direction: column; }
  .backup-row { grid-template-columns: minmax(0, 1fr) auto; }
  .backup-row small { grid-column: 1; white-space: normal; }
  .backup-row-actions { grid-column: 2; grid-row: 1 / span 2; }
}
.admin-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}
.modal {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(17, 24, 39, 0.36);
}
.modal-card {
  width: min(420px, calc(100vw - 40px));
  padding: 20px;
  border: 1px solid #e8e8e8;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 18px 48px rgba(15, 23, 42, 0.18);
}
.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.modal-head strong { font-size: 18px; }
@media (max-width: 720px) {
  .admin-actions { align-items: flex-end; flex-direction: column; }
}
.config-panel {
  border: 1px solid #e5e7eb;
  background: #fff;
  border-radius: 8px;
  padding: 14px;
  margin-bottom: 12px;
}
.config-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
}
.config-head strong { display: block; font-size: 16px; margin-bottom: 4px; }
.config-head span { display: block; color: #666; font-size: 13px; }
.config-list {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}
.config-row {
  display: grid;
  grid-template-columns: 52px minmax(150px, 1fr) minmax(110px, auto) minmax(240px, 1.5fr);
  gap: 10px;
  align-items: center;
  padding: 10px;
  border: 1px solid #eee;
  border-radius: 6px;
  background: #fafafa;
}
.config-row b { font-size: 12px; }
.config-row.ok b { color: #12805c; }
.config-row.warning b { color: #9a5b00; }
.config-row.blocker b { color: #b42318; }
.config-row span { color: #111; }
.config-row span small { display: block; color: #777; font-size: 12px; margin-top: 2px; }
.config-row code {
  justify-self: start;
  padding: 3px 7px;
  border-radius: 5px;
  background: #f0f0f0;
  color: #333;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px;
}
.config-row em { color: #666; font-style: normal; font-size: 13px; }
@media (max-width: 980px) {
  .config-row { grid-template-columns: 52px 1fr; }
  .config-row code, .config-row em { grid-column: 2; }
}
@media (max-width: 620px) {
  .config-head { align-items: stretch; flex-direction: column; }
  .config-head button { align-self: flex-start; }
}
