:root {
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: #111827;
  background: #f3f4f6;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: #f3f4f6;
}

.shell {
  width: min(1180px, calc(100% - 32px));
  margin: 32px auto;
}

.topbar {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  align-items: center;
  margin-bottom: 24px;
}

h1, h2, h3 { margin: 0; }

h1 { font-size: 28px; }
h2 { font-size: 20px; }

.muted {
  color: #6b7280;
}

.auth-box {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  justify-content: flex-end;
}

.auth-hint {
  flex-basis: 100%;
  margin: 0;
  text-align: right;
}

.card {
  background: white;
  border: 1px solid #e5e7eb;
  border-radius: 14px;
  padding: 20px;
  margin-bottom: 20px;
  box-shadow: 0 2px 12px rgba(0,0,0,.04);
}

label {
  display: block;
  font-weight: 600;
  margin-bottom: 8px;
}

textarea {
  width: 100%;
  border: 1px solid #d1d5db;
  border-radius: 10px;
  padding: 12px;
  resize: vertical;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 14px;
}

textarea:focus {
  outline: 2px solid #111827;
  outline-offset: 1px;
}

.actions,
.dialog-actions {
  display: flex;
  gap: 10px;
  margin-top: 12px;
}

button {
  border: 0;
  border-radius: 9px;
  padding: 10px 14px;
  font-weight: 600;
  cursor: pointer;
}

button:disabled {
  opacity: .45;
  cursor: not-allowed;
}

.primary {
  background: #111827;
  color: white;
}

.secondary {
  background: #e5e7eb;
  color: #111827;
}

.danger {
  background: #b91c1c;
  color: white;
}

.hint {
  margin: 10px 0 0;
  font-size: 13px;
  color: #6b7280;
}

.results-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
}

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

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

th,
td {
  text-align: left;
  padding: 12px;
  border-bottom: 1px solid #e5e7eb;
  vertical-align: middle;
}

th {
  font-size: 12px;
  text-transform: uppercase;
  color: #6b7280;
  letter-spacing: .04em;
}

code {
  font-size: 12px;
}

.billing-id-cell {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
}

.billing-console-link {
  font-size: 11px;
  line-height: 1.2;
  color: transparent;
  text-decoration: none;
}

.billing-id-cell:hover .billing-console-link,
.billing-console-link:focus-visible {
  color: #2563eb;
  text-decoration: underline;
}

.badge {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 5px 9px;
  font-size: 12px;
  font-weight: 700;
  background: #e5e7eb;
}

.badge.active { background: #dcfce7; color: #166534; }
.badge.suspended { background: #fee2e2; color: #991b1b; }
.badge.pending { background: #fef3c7; color: #92400e; }
.badge.failed { background: #fee2e2; color: #991b1b; }
.badge.not-found { background: #f3f4f6; color: #6b7280; }
.badge.not-checked { background: #f9fafb; color: #9ca3af; border: 1px dashed #d1d5db; }

.results-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
}

.realtime-progress {
  font-size: 13px;
}

.realtime-hint {
  margin-top: -6px;
  margin-bottom: 14px;
}

.realtime-error {
  display: block;
  margin-top: 4px;
  font-size: 11px;
  color: #991b1b;
  max-width: 180px;
  word-break: break-word;
}

.action-cell {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
}

.projects-result {
  margin: 0;
  font-size: 12px;
  line-height: 1.5;
}

.projects-label {
  display: block;
  color: #6b7280;
  margin-bottom: 4px;
}

.projects-error {
  margin: 0;
  font-size: 12px;
  color: #991b1b;
}

.empty {
  color: #6b7280;
  text-align: center;
  padding: 28px;
}

dialog {
  border: 0;
  border-radius: 14px;
  padding: 0;
  max-width: 520px;
  width: calc(100% - 32px);
}

dialog::backdrop {
  background: rgba(17, 24, 39, .55);
}

.dialog-card {
  padding: 22px;
}

dl {
  margin: 18px 0;
}

dl > div {
  display: grid;
  grid-template-columns: 140px 1fr;
  gap: 12px;
  padding: 7px 0;
}

dt {
  color: #6b7280;
}

dd {
  margin: 0;
  word-break: break-all;
}

.warning {
  background: #fef2f2;
  border: 1px solid #fecaca;
  padding: 12px;
  border-radius: 9px;
  color: #991b1b;
}

.toast {
  position: fixed;
  right: 24px;
  bottom: 24px;
  max-width: 520px;
  padding: 14px 16px;
  border-radius: 10px;
  background: #111827;
  color: white;
  box-shadow: 0 8px 24px rgba(0,0,0,.2);
  white-space: pre-wrap;
}

.hidden { display: none !important; }

@media (max-width: 760px) {
  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .auth-box {
    flex-wrap: wrap;
  }
}
