* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  background: #f4f6fa;
  color: #1f2937;
}
header {
  background: #1e293b;
  color: #fff;
  padding: 14px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}
header h1 { font-size: 18px; margin: 0; }
.apikey { display: flex; align-items: center; gap: 8px; }
.apikey input { width: 320px; padding: 7px 10px; border-radius: 6px; border: none; }
.muted { color: #94a3b8; font-size: 13px; }

.tabs { display: flex; gap: 4px; background: #fff; padding: 0 24px; border-bottom: 1px solid #e5e7eb; }
.tab {
  background: none; border: none; padding: 14px 16px; cursor: pointer;
  font-size: 14px; color: #6b7280; border-bottom: 2px solid transparent;
}
.tab.active { color: #2563eb; border-bottom-color: #2563eb; font-weight: 600; }

main { padding: 24px; }
.panel { display: none; }
.panel.active { display: block; }

.toolbar { display: flex; gap: 8px; margin-bottom: 14px; flex-wrap: wrap; }
input, select, textarea, button {
  font-size: 14px; padding: 8px 11px; border-radius: 6px; border: 1px solid #d1d5db;
}
button {
  background: #2563eb; color: #fff; border: none; cursor: pointer; font-weight: 500;
}
button:hover { background: #1d4ed8; }

table { width: 100%; border-collapse: collapse; background: #fff; border-radius: 8px; overflow: hidden; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid #eef2f7; font-size: 14px; }
th { background: #f8fafc; color: #475569; font-weight: 600; }
tr:hover td { background: #f9fafb; }

.badge { padding: 2px 8px; border-radius: 999px; font-size: 12px; font-weight: 600; }
.badge.out { background: #dbeafe; color: #1e40af; }
.badge.in { background: #dcfce7; color: #166534; }
.badge.missed { background: #fee2e2; color: #991b1b; }
.badge.pending { background: #fef9c3; color: #854d0e; }
.badge.sent { background: #e0e7ff; color: #3730a3; }
.badge.done { background: #dcfce7; color: #166534; }
.badge.failed { background: #fee2e2; color: #991b1b; }

.cards { display: flex; gap: 20px; flex-wrap: wrap; }
.card {
  background: #fff; border-radius: 10px; padding: 20px; width: 360px;
  box-shadow: 0 1px 3px rgba(0,0,0,.08); display: flex; flex-direction: column; gap: 8px;
}
.card h3 { margin: 0 0 6px; }
.card label { font-size: 13px; color: #6b7280; margin-top: 4px; }
.result { font-size: 13px; margin-top: 6px; min-height: 18px; }
.result.ok { color: #166534; }
.result.err { color: #991b1b; }

.codebox { margin-top: 12px; display: flex; flex-direction: column; gap: 8px; }
.codebox textarea {
  font-family: monospace; font-size: 13px; word-break: break-all;
  background: #f1f5f9; border: 1px dashed #94a3b8; resize: vertical;
}
button.secondary { background: #475569; }
button.secondary:hover { background: #334155; }
button.link {
  background: none; color: #2563eb; padding: 4px 6px; font-size: 13px; font-weight: 500;
}
button.link:hover { background: #eff6ff; }
button.link.danger { color: #dc2626; }
button.link.danger:hover { background: #fef2f2; }
.howto { margin: 6px 0 0; padding-left: 20px; font-size: 14px; line-height: 1.8; color: #475569; }

.statcards { display: flex; gap: 14px; flex-wrap: wrap; }
.statcard {
  background: #fff; border-radius: 10px; padding: 16px 22px; min-width: 130px;
  box-shadow: 0 1px 3px rgba(0,0,0,.06);
}
.statcard .sv { font-size: 26px; font-weight: 700; color: #1e293b; }
.statcard .sv.in { color: #166534; }
.statcard .sv.out { color: #1e40af; }
.statcard .sv.missed { color: #991b1b; }
.statcard .sl { font-size: 13px; color: #64748b; margin-top: 4px; }

.chart { display: flex; align-items: flex-end; gap: 6px; height: 190px; padding: 10px 0 30px; }
.bar-col { flex: 1; display: flex; flex-direction: column; align-items: center; height: 100%; justify-content: flex-end; }
.bar { width: 70%; background: #2563eb; border-radius: 4px 4px 0 0; min-height: 2px; transition: height .3s; }
.bar:hover { background: #1d4ed8; }
.bar-lbl { font-size: 10px; color: #94a3b8; margin-top: 6px; }
