:root {
  color-scheme: light;
  --bg: #f6f8fb;
  --card: #ffffff;
  --text: #1d2430;
  --muted: #5f6b7b;
  --border: #d8dee8;
  --accent: #0b57d0;
  --accent-hover: #0846a8;
  --error: #b42318;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Segoe UI", Tahoma, sans-serif;
  background: var(--bg);
  color: var(--text);
}

.app {
  min-height: 100dvh;
  display: grid;
  place-items: start center;
  padding: 2rem 1rem;
}

.card {
  width: min(760px, 100%);
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.25rem;
  box-shadow: 0 4px 18px rgba(12, 28, 58, 0.06);
}

h1 {
  margin: 0 0 1rem;
  font-size: 1.35rem;
}

.tabs {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 0.85rem;
}

.tab-btn {
  background: #e8edf6;
  color: #203252;
}

.tab-btn:hover {
  background: #d9e2f1;
}

.tab-btn.is-active {
  background: var(--accent);
  color: #fff;
}

.tab-pane {
  margin-top: 0.3rem;
}

.search-row label,
.selector-wrap label {
  display: block;
  font-weight: 600;
  margin-bottom: 0.4rem;
}

.input-group {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.5rem;
}

input,
textarea,
select,
button {
  font: inherit;
}

input,
textarea,
select {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.65rem 0.75rem;
  color: var(--text);
  background: #fff;
}

textarea {
  min-height: 5.25rem;
  resize: vertical;
}

button {
  border: 0;
  border-radius: 8px;
  padding: 0.65rem 1rem;
  background: var(--accent);
  color: #fff;
  font-weight: 600;
  cursor: pointer;
}

button:hover {
  background: var(--accent-hover);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.65;
}

.status,
.error {
  margin-top: 0.85rem;
  min-height: 1.2rem;
  font-size: 0.94rem;
}

.auth {
  margin-top: 0.8rem;
  padding: 0.7rem 0.85rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fbfdff;
}

.auth-user {
  margin: 0 0 0.6rem;
  color: var(--muted);
  font-size: 0.9rem;
}

.auth-actions {
  display: flex;
  gap: 0.55rem;
  flex-wrap: wrap;
}

.secondary {
  background: #e8edf6;
  color: #203252;
}

.secondary:hover {
  background: #d9e2f1;
}

.status {
  color: var(--muted);
}

.status.loading::before {
  content: "";
  width: 0.85rem;
  height: 0.85rem;
  border: 2px solid #c3d0ea;
  border-top-color: var(--accent);
  border-radius: 50%;
  display: inline-block;
  margin-right: 0.45rem;
  vertical-align: text-bottom;
  animation: spin 0.8s linear infinite;
}

.error {
  color: var(--error);
}

.selector-wrap {
  margin-top: 0.75rem;
}

.results {
  margin-top: 1rem;
  border-top: 1px solid var(--border);
  padding-top: 1rem;
}

.results-head {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  align-items: center;
}

.results-head p {
  margin: 0;
  font-weight: 600;
}

.copy-btn {
  white-space: nowrap;
}

#numbers-count {
  margin: 0.5rem 0 0.6rem;
  color: var(--muted);
}

#user-info {
  margin: 0.45rem 0 0;
  color: var(--muted);
}

.table-wrap {
  margin-top: 0.6rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: auto;
}

.results-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 520px;
}

.results-table th,
.results-table td {
  padding: 0.55rem 0.75rem;
  border-bottom: 1px solid var(--border);
  text-align: left;
}

.results-table th {
  font-size: 0.88rem;
  color: var(--muted);
  font-weight: 600;
}

.results-table tr:last-child td {
  border-bottom: 0;
}

.type-imessage {
  color: #1d4ed8;
  font-weight: 600;
}

.type-sendgreen {
  color: #15803d;
  font-weight: 600;
}

.type-unknown {
  color: #6b7280;
  font-weight: 600;
}

.numbers-list {
  margin: 0;
  padding: 0;
  list-style: none;
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
}

.numbers-list li {
  padding: 0.55rem 0.75rem;
  border-bottom: 1px solid var(--border);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.numbers-list li:last-child {
  border-bottom: 0;
}

.empty {
  margin: 0.5rem 0 0;
  color: var(--muted);
}

.hidden {
  display: none;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@media (max-width: 560px) {
  .input-group {
    grid-template-columns: 1fr;
  }
}
