:root {
  --bg: #0b1220;
  --bg-soft: #111a2e;
  --card: rgba(19, 28, 48, 0.72);
  --card-line: rgba(148, 173, 224, 0.16);
  --ink: #eef2fb;
  --ink-dim: #9fb0d0;
  --ink-faint: #6f82a6;
  --accent: #6ea8fe;
  --accent-2: #8b7bff;
  --accent-ink: #0b1220;
  --ok: #4ade80;
  --bad: #f87171;
  --radius: 18px;
  --shadow: 0 30px 80px -30px rgba(0, 0, 0, 0.7);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  min-height: 100vh;
  font-family: Inter, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

.aurora {
  position: fixed;
  inset: -20% -10% auto -10%;
  height: 70vh;
  z-index: -1;
  background:
    radial-gradient(40% 55% at 20% 20%, rgba(110, 168, 254, 0.28), transparent 70%),
    radial-gradient(45% 60% at 85% 15%, rgba(139, 123, 255, 0.24), transparent 70%),
    radial-gradient(50% 60% at 55% 60%, rgba(59, 130, 246, 0.14), transparent 70%);
  filter: blur(30px);
  pointer-events: none;
}

body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  background: linear-gradient(180deg, transparent, var(--bg) 60%);
}

.shell {
  width: min(100%, 760px);
  margin: 0 auto;
  padding: clamp(28px, 6vw, 72px) 20px 48px;
}

/* ---------------------------------------------------------------- masthead */

.masthead {
  display: flex;
  gap: 18px;
  align-items: flex-start;
  margin-bottom: 26px;
}

.mark {
  flex: 0 0 52px;
  height: 52px;
  border-radius: 14px;
  background: linear-gradient(140deg, var(--accent), var(--accent-2));
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 4px;
  padding: 13px;
  box-shadow: 0 14px 30px -12px rgba(110, 168, 254, 0.6);
}

.mark span {
  display: block;
  height: 3px;
  border-radius: 3px;
  background: rgba(11, 18, 32, 0.85);
}

.mark span:nth-child(2) { width: 72%; }
.mark span:nth-child(3) { width: 86%; }

.kicker {
  text-transform: uppercase;
  letter-spacing: 0.16em;
  font-size: 11px;
  font-weight: 700;
  color: var(--accent);
  margin-bottom: 6px;
}

.masthead h1 {
  font-family: Fraunces, Georgia, serif;
  font-size: clamp(28px, 6vw, 40px);
  line-height: 1.05;
  letter-spacing: -0.01em;
  margin-bottom: 10px;
}

.lede {
  font-size: 14px;
  line-height: 1.6;
  color: var(--ink-dim);
  max-width: 52ch;
}

/* ------------------------------------------------------------------- panel */

.panel {
  background: var(--card);
  border: 1px solid var(--card-line);
  border-radius: var(--radius);
  padding: clamp(20px, 4vw, 30px);
  box-shadow: var(--shadow);
  backdrop-filter: blur(14px);
}

.field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.field:first-child { grid-column: 1 / -1; }

.field {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.field label {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--ink-faint);
  margin-bottom: 8px;
}

.select-wrap {
  position: relative;
}

.select-wrap::after {
  content: "";
  position: absolute;
  right: 16px;
  top: 50%;
  width: 8px;
  height: 8px;
  border-right: 2px solid var(--ink-faint);
  border-bottom: 2px solid var(--ink-faint);
  transform: translateY(-65%) rotate(45deg);
  pointer-events: none;
}

.select-wrap:has(input)::after { display: none; }

select,
input[type="date"] {
  width: 100%;
  height: 50px;
  border: 1px solid var(--card-line);
  border-radius: 12px;
  padding: 0 40px 0 14px;
  font: inherit;
  font-size: 15px;
  font-weight: 500;
  color: var(--ink);
  background: var(--bg-soft);
  outline: none;
  appearance: none;
  -webkit-appearance: none;
  transition: border-color 0.18s, box-shadow 0.18s;
}

input[type="date"] { padding-right: 14px; }

select:focus,
input[type="date"]:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px rgba(110, 168, 254, 0.16);
}

select:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

select option,
select optgroup {
  background: var(--bg-soft);
  color: var(--ink);
}

select optgroup {
  font-weight: 700;
  color: var(--accent);
}

::-webkit-calendar-picker-indicator {
  filter: invert(0.8);
  cursor: pointer;
}

/* --------------------------------------------------------- divya bhaskar box */

.db-panel {
  margin-top: 18px;
  padding: 16px;
  border: 1px dashed var(--card-line);
  border-radius: 14px;
  background: rgba(139, 123, 255, 0.06);
}

.db-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
  margin-bottom: 12px;
}

.db-head h3 {
  font-size: 14px;
  margin-bottom: 4px;
}

.db-head p {
  font-size: 12px;
  line-height: 1.55;
  color: var(--ink-dim);
  max-width: 46ch;
}

.db-head a { color: var(--accent); }

.db-status {
  flex: 0 0 auto;
  font-size: 11px;
  font-weight: 600;
  padding: 5px 10px;
  border-radius: 999px;
  background: rgba(148, 173, 224, 0.12);
  color: var(--ink-dim);
  white-space: nowrap;
}

.db-status.ok { background: rgba(74, 222, 128, 0.14); color: var(--ok); }
.db-status.bad { background: rgba(248, 113, 113, 0.14); color: var(--bad); }
.db-status.checking { background: rgba(110, 168, 254, 0.14); color: var(--accent); }

#dbTokenInput {
  width: 100%;
  border: 1px solid var(--card-line);
  border-radius: 10px;
  padding: 10px 12px;
  font: 12px/1.5 ui-monospace, SFMono-Regular, Menlo, monospace;
  color: var(--ink);
  background: var(--bg-soft);
  resize: vertical;
  outline: none;
}

#dbTokenInput:focus {
  border-color: var(--accent-2);
  box-shadow: 0 0 0 4px rgba(139, 123, 255, 0.16);
}

.db-actions {
  display: flex;
  gap: 10px;
  margin-top: 10px;
}

/* ----------------------------------------------------------------- buttons */

.btn {
  height: 44px;
  border: 0;
  border-radius: 11px;
  padding: 0 18px;
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: transform 0.15s, box-shadow 0.15s, background 0.15s, opacity 0.15s;
}

.btn:disabled { opacity: 0.55; cursor: not-allowed; }

.btn-primary {
  width: 100%;
  height: 52px;
  margin-top: 20px;
  font-size: 15px;
  color: var(--accent-ink);
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  box-shadow: 0 16px 34px -14px rgba(110, 168, 254, 0.7);
}

.btn-primary:hover:not(:disabled) { transform: translateY(-2px); }

.btn-soft {
  color: var(--ink);
  background: rgba(110, 168, 254, 0.16);
}

.btn-soft:hover:not(:disabled) { background: rgba(110, 168, 254, 0.26); }

.btn-ghost {
  color: var(--ink-dim);
  background: transparent;
  border: 1px solid var(--card-line);
}

.btn-ghost:hover:not(:disabled) { color: var(--ink); }

/* -------------------------------------------------------------- status line */

.status-message {
  min-height: 0;
  margin-top: 14px;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.5;
  border-radius: 10px;
  transition: 0.2s;
}

.status-message.success,
.status-message.error {
  padding: 12px 14px;
}

.status-message.success {
  color: var(--ok);
  background: rgba(74, 222, 128, 0.1);
  border: 1px solid rgba(74, 222, 128, 0.25);
}

.status-message.error {
  color: var(--bad);
  background: rgba(248, 113, 113, 0.1);
  border: 1px solid rgba(248, 113, 113, 0.25);
}

/* --------------------------------------------------------------------- foot */

.foot {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 22px;
  font-size: 11px;
  color: var(--ink-faint);
}

/* ------------------------------------------------------------------ loading */

.loading-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 9999;
  padding: 20px;
  background: rgba(6, 10, 20, 0.8);
  backdrop-filter: blur(6px);
  align-items: center;
  justify-content: center;
}

.loading-overlay.show { display: flex; }

.loading-card {
  width: min(100%, 420px);
  display: flex;
  gap: 18px;
  align-items: center;
  padding: 22px;
  border-radius: 18px;
  background: var(--bg-soft);
  border: 1px solid var(--card-line);
  box-shadow: var(--shadow);
  animation: pop 0.22s ease;
}

@keyframes pop {
  from { opacity: 0; transform: scale(0.96) translateY(8px); }
  to { opacity: 1; transform: none; }
}

.spinner {
  flex: 0 0 34px;
  width: 34px;
  height: 34px;
  border: 3px solid rgba(110, 168, 254, 0.22);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

.loading-content { flex: 1; min-width: 0; }

.loading-content h3 { font-size: 15px; margin-bottom: 4px; }

.loading-content p {
  font-size: 12px;
  color: var(--ink-dim);
  margin-bottom: 10px;
}

.loading-track {
  height: 6px;
  border-radius: 999px;
  background: rgba(148, 173, 224, 0.16);
  overflow: hidden;
}

.loading-fill {
  height: 100%;
  width: 0;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  transition: width 0.25s ease;
}

.loading-fill.indeterminate {
  width: 40% !important;
  animation: slide 1.1s ease-in-out infinite;
}

@keyframes slide {
  0% { transform: translateX(-120%); }
  100% { transform: translateX(320%); }
}

/* --------------------------------------------------------------- responsive */

@media (max-width: 560px) {
  .field-row { grid-template-columns: 1fr; }
  .masthead { gap: 14px; }
  .db-head { flex-direction: column; }
}
