* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: Inter, "Segoe UI", Arial, sans-serif;
  color: #0f172a;
  background: #f5f7fb;
}

.brand-wordmark {
  margin: 0 0 6px;
  font-size: 1.8rem;
  font-weight: 800;
  letter-spacing: -0.04em;
  line-height: 1.15;
  color: #123f5c;
  background: linear-gradient(105deg, #123f5c 0%, #0f766e 55%, #14b8a6 100%);
  -webkit-background-clip: text;
  background-clip: text;
}

@supports ((-webkit-background-clip: text) or (background-clip: text)) {
  .brand-wordmark {
    color: transparent;
  }
}

.brand-wordmark--topbar {
  margin: 0;
  font-size: 1.28rem;
}

.login-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.login-card {
  width: min(500px, 100%);
  background: #fff;
  border-radius: 14px;
  padding: 28px;
  box-shadow: 0 10px 30px rgba(15, 23, 42, 0.12);
}

.login-card h1 {
  margin: 16px 0 8px;
}

.google-signin {
  margin-top: 20px;
}

.error-msg {
  color: #b91c1c;
  min-height: 24px;
  margin-top: 16px;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 20px;
  background: #fff;
  border-bottom: 1px solid #dbe2ef;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.env-badge {
  text-transform: uppercase;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: #0f766e;
  background: #ccfbf1;
  border: 1px solid #99f6e4;
  padding: 3px 8px;
  border-radius: 999px;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.user-pill {
  background: #eef2ff;
  color: #312e81;
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 0.9rem;
}

/* ---- Tab bar ---- */
.tabbar {
  position: sticky;
  top: 53px;
  z-index: 9;
  display: flex;
  gap: 6px;
  padding: 0 20px;
  background: #fff;
  border-bottom: 1px solid #dbe2ef;
}

.tab-btn {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  padding: 12px 18px 14px;
  border: none;
  border-bottom: 3px solid transparent;
  background: transparent;
  cursor: pointer;
  color: #64748b;
  transition: color 0.15s ease, border-color 0.15s ease;
}

.tab-btn:hover {
  color: #123f5c;
}

.tab-btn.is-active {
  color: #0f766e;
  border-bottom-color: #14b8a6;
}

.tab-title {
  font-size: 1rem;
  font-weight: 700;
}

.tab-sub {
  font-size: 0.76rem;
  color: #94a3b8;
}

.tab-btn.is-active .tab-sub {
  color: #5eead4;
}

.tab-panel {
  display: none;
}

.tab-panel.is-active {
  display: block;
  animation: fadeIn 0.18s ease;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

.page {
  padding: 20px;
  max-width: 100%;
}

.panel-caption {
  margin: 4px 0 0;
  font-size: 0.86rem;
  color: #64748b;
}

.panel-caption code,
.muted code {
  background: #eef2ff;
  padding: 1px 5px;
  border-radius: 4px;
  font-size: 0.82rem;
}

.panel {
  background: #fff;
  border: 1px solid #dbe2ef;
  border-radius: 12px;
  padding: 16px 18px;
  margin-bottom: 16px;
}

.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.panel-header h2 {
  margin: 0;
  font-size: 1.1rem;
}

.panel-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.summary-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
}

.summary-card {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 12px 14px;
}

.summary-label {
  display: block;
  font-size: 0.82rem;
  color: #64748b;
  margin-bottom: 4px;
}

.summary-value {
  font-size: 1.4rem;
  font-weight: 700;
  color: #123f5c;
}

.muted {
  color: #64748b;
  font-size: 0.9rem;
}

.primary-btn,
.secondary-btn,
.row-call-btn {
  border: none;
  border-radius: 8px;
  padding: 8px 14px;
  font-weight: 600;
  cursor: pointer;
}

.primary-btn {
  background: linear-gradient(135deg, #6366f1, #312e81);
  color: #fff;
}

.primary-btn:disabled,
.secondary-btn:disabled,
.row-call-btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.secondary-btn,
.row-call-btn {
  background: #fff;
  color: #312e81;
  border: 1px solid #c7d2fe;
}

.field-label {
  display: block;
  font-weight: 600;
  margin-bottom: 6px;
}

.text-input {
  width: min(360px, 100%);
  padding: 8px 10px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  font-size: 1rem;
}

.text-input:focus {
  outline: none;
  border-color: #14b8a6;
  box-shadow: 0 0 0 3px rgba(20, 184, 166, 0.18);
}

/* ---- Visa form ---- */
.panel-form {
  max-width: 620px;
}

.stacked-form {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.form-row {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.form-row .muted {
  margin: 2px 0 0;
}

.req {
  color: #dc2626;
}

.optional {
  color: #94a3b8;
  font-weight: 400;
  font-size: 0.82rem;
}

.form-actions {
  margin-top: 4px;
}

.form-actions .primary-btn {
  padding: 10px 20px;
  font-size: 0.95rem;
}

.result-card {
  margin-top: 18px;
  padding: 14px 16px;
  border-radius: 10px;
  background: #ecfdf5;
  border: 1px solid #a7f3d0;
  color: #065f46;
  font-size: 0.9rem;
}

.result-card.error {
  background: #fef2f2;
  border-color: #fecaca;
  color: #991b1b;
}

.result-card.hidden {
  display: none;
}

.result-grid {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 4px 14px;
  margin: 10px 0 0;
}

.result-grid dt {
  font-weight: 600;
  color: #047857;
}

.result-grid dd {
  margin: 0;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  word-break: break-all;
}

.panel-table {
  padding: 0;
  overflow: hidden;
}

.table-wrap {
  overflow: auto;
  max-height: 70vh;
}

table {
  border-collapse: collapse;
  width: max-content;
  min-width: 100%;
}

thead th {
  position: sticky;
  top: 0;
  background: #eef2ff;
  color: #1e1b4b;
  text-align: left;
  padding: 10px 12px;
  border-bottom: 1px solid #c7d2fe;
  white-space: nowrap;
  font-size: 0.85rem;
}

tbody td {
  padding: 10px 12px;
  border-bottom: 1px solid #e2e8f0;
  vertical-align: top;
  font-size: 0.88rem;
  max-width: 420px;
  white-space: nowrap;
}

tbody tr:nth-child(even) {
  background: #fafbff;
}

tbody tr.selected {
  background: #ecfeff;
}

.json-cell pre {
  margin: 0;
  white-space: pre-wrap;
  word-break: break-word;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.78rem;
  max-width: 380px;
  max-height: 200px;
  overflow: auto;
  background: #f1f5f9;
  padding: 8px;
  border-radius: 6px;
}

.toast {
  position: fixed;
  right: 20px;
  bottom: 20px;
  background: #1e293b;
  color: #f8fafc;
  padding: 12px 16px;
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.25);
  max-width: min(420px, 90vw);
  z-index: 100;
}

.toast.hidden {
  display: none;
}

.toast.error {
  background: #991b1b;
}

.spinner-inline::after {
  content: " …";
  animation: pulse 1s infinite;
}

@keyframes pulse {
  50% { opacity: 0.4; }
}
