* { box-sizing: border-box; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  background: #f5f7fa;
  color: #1a202c;
  margin: 0;
  font-size: 14px;
}

header {
  display: flex;
  align-items: center;
  gap: 24px;
  background: #fff;
  padding: 12px 24px;
  border-bottom: 1px solid #e2e8f0;
  position: sticky;
  top: 0;
  z-index: 10;
}
.brand { font-size: 16px; }
nav { display: flex; gap: 4px; flex: 1; }
.tab {
  padding: 8px 14px;
  border-radius: 6px;
  cursor: pointer;
  color: #4a5568;
  text-decoration: none;
  font-weight: 500;
  font-size: 13px;
}
.tab:hover { background: #edf2f7; }
.tab.active { background: #3182ce; color: #fff; }
.badge {
  display: inline-block;
  background: rgba(255,255,255,0.3);
  padding: 1px 7px;
  border-radius: 10px;
  font-size: 11px;
  margin-left: 4px;
}
.tab:not(.active) .badge { background: #e2e8f0; color: #2d3748; }
.status { font-size: 11px; color: #718096; }

main { padding: 20px 24px; max-width: 1400px; margin: 0 auto; }

.tab-panel { display: none; }
.tab-panel.active { display: block; }

.card {
  background: #fff;
  border-radius: 10px;
  padding: 18px;
  margin-bottom: 16px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}
h3 { margin: 0 0 12px; font-size: 14px; font-weight: 600; }

.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; margin-bottom: 10px; }
.row.between { justify-content: space-between; }
.row > div { flex: 1; }
label { display: block; font-size: 11px; color: #4a5568; margin-bottom: 4px; text-transform: uppercase; font-weight: 600; }

input[type=text], textarea, select {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid #cbd5e0;
  border-radius: 6px;
  font-size: 13px;
  font-family: inherit;
}
textarea { font-family: -apple-system, sans-serif; resize: vertical; }
input:focus, textarea:focus { outline: none; border-color: #3182ce; }

button {
  cursor: pointer;
  padding: 7px 13px;
  border-radius: 6px;
  border: 1px solid #cbd5e0;
  background: #fff;
  font-size: 13px;
  font-weight: 500;
}
button:hover { background: #edf2f7; }
button.primary { background: #3182ce; color: #fff; border-color: #3182ce; }
button.primary:hover { background: #2c5282; }
button.danger { background: #e53e3e; color: #fff; border-color: #e53e3e; }
button.danger:hover { background: #c53030; }
button:disabled { opacity: 0.5; cursor: not-allowed; }

.pill {
  display: inline-block;
  padding: 2px 9px;
  border-radius: 11px;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
}
.pill.green { background: #c6f6d5; color: #22543d; }
.pill.red   { background: #fed7d7; color: #742a2a; }
.pill.gray  { background: #e2e8f0; color: #2d3748; }
.pill.blue  { background: #bee3f8; color: #2a4365; }
.pill.amber { background: #feebc8; color: #7b341e; }

table { width: 100%; border-collapse: collapse; }
th, td { padding: 7px 9px; text-align: left; border-bottom: 1px solid #edf2f7; font-size: 13px; }
th { color: #718096; font-weight: 600; font-size: 11px; text-transform: uppercase; }
tr:hover { background: #f7fafc; }
code { background: #edf2f7; padding: 2px 5px; border-radius: 3px; font-size: 11px; font-family: Consolas, monospace; }

.empty { color: #a0aec0; padding: 30px; text-align: center; }
.hidden { display: none !important; }
.url-box { font-family: Consolas, monospace; font-size: 11px; word-break: break-all; padding: 6px; background: #f7fafc; border-radius: 4px; }

/* Dialogs */
.dialogs-layout {
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 16px;
  height: calc(100vh - 130px);
}
.convo-list { overflow-y: auto; padding: 12px; }
.convo-list input { margin-bottom: 12px; }
.convo {
  padding: 10px;
  border-radius: 6px;
  cursor: pointer;
  border-bottom: 1px solid #edf2f7;
}
.convo:hover { background: #f7fafc; }
.convo.active { background: #ebf8ff; }
.convo-name { font-weight: 600; font-size: 13px; }
.convo-meta { font-size: 11px; color: #718096; }
.convo-last { font-size: 12px; color: #4a5568; margin-top: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.chat-area { display: flex; flex-direction: column; padding: 0; overflow: hidden; }
.chat-header {
  padding: 14px 18px;
  border-bottom: 1px solid #e2e8f0;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.chat-body {
  flex: 1;
  overflow-y: auto;
  padding: 18px;
  background: #f7fafc;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.msg {
  max-width: 70%;
  padding: 8px 12px;
  border-radius: 12px;
  font-size: 13px;
  line-height: 1.4;
  white-space: pre-wrap;
  word-break: break-word;
}
.msg.in { background: #fff; border: 1px solid #e2e8f0; align-self: flex-start; border-bottom-left-radius: 4px; }
.msg.out { background: #3182ce; color: #fff; align-self: flex-end; border-bottom-right-radius: 4px; }
.msg-time { font-size: 10px; opacity: 0.7; margin-top: 3px; }
.chat-input {
  padding: 12px;
  border-top: 1px solid #e2e8f0;
  display: flex;
  gap: 8px;
  background: #fff;
}
.chat-input textarea { flex: 1; min-height: 40px; max-height: 200px; }
