:root {
  --brand: #0071e3;
  --brand-strong: #005bbf;
  --brand-light: rgba(0, 113, 227, 0.12);
  --ink: #1d1d1f;
  --muted: #6e6e73;
  --panel: rgba(255, 255, 255, 0.78);
  --panel-solid: #ffffff;
  --line: rgba(0, 0, 0, 0.08);
  --soft: #f5f5f7;
  --good: #16833a;
  --bad: #c7352f;
  --warn: #a36300;
  --shadow: 0 24px 70px rgba(0, 0, 0, 0.08);
  --radius: 0;
  --transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}



* {
  box-sizing: border-box;
}

body {
  min-height: 100vh;
  margin: 0;
  padding: 32px;
  color: var(--ink);
  background: #ffffff;
  background-attachment: fixed;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  transition: var(--transition);
}

button, input, textarea {
  font-family: inherit;
  font-size: 0.95rem;
}

h1, h2, h3, h4, h5, h6 {
  margin-top: 0;
}

/* Auth Overlay */
.overlay {
  position: fixed;
  top: 0; left: 0; width: 100%; height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  background: rgba(0,0,0,0.2);
}

.auth-panel {
  width: 100%;
  max-width: 400px;
  padding: 40px;
  text-align: center;
  animation: slideUp 0.5s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.auth-panel h2 {
  margin-bottom: 8px;
  font-weight: 700;
}

.auth-panel p {
  color: var(--muted);
  margin-bottom: 24px;
}

.auth-panel input {
  width: 100%;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255,255,255,0.5);
  color: var(--ink);
  margin-bottom: 16px;
  transition: var(--transition);
  outline: none;
}

[data-theme="dark"] .auth-panel input {
  background: rgba(0,0,0,0.2);
}

.auth-panel input:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-light);
}

.error-msg {
  color: var(--bad);
  font-size: 0.85rem;
  margin-top: 12px;
  min-height: 20px;
}

@keyframes slideUp {
  0% { opacity: 0; transform: translateY(20px); }
  100% { opacity: 1; transform: translateY(0); }
}

/* Bottom Left Bar */
.bottom-left-bar {
  position: fixed;
  bottom: 24px;
  left: 24px;
  display: flex;
  align-items: center;
  gap: 24px;
  z-index: 50;
}

.capacity-badge {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}

.capacity-label {
  color: var(--muted);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 4px;
  font-weight: 600;
}

.capacity-value {
  font-size: 1.25rem;
  color: var(--brand);
  font-weight: 600;
}

.capacity-slash {
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 500;
}

.logout-btn {
  height: 44px;
  padding: 0 20px;
  border-radius: 0;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--ink);
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
}

.logout-btn:hover {
  background: var(--soft);
}

/* Main Container */
.container {
  width: min(1180px, 100%);
  margin: 0 auto;
}

.shell {
  display: grid;
  gap: 24px;
}

.header {
  display: grid;
  gap: 10px;
  padding: 42px 0 16px;
  text-align: center;
  animation: fadeIn 0.8s ease forwards;
}

.eyebrow {
  color: var(--brand);
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.header h1 {
  margin: 0;
  font-size: clamp(2.25rem, 6vw, 4rem);
  line-height: 1.1;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.header p {
  width: min(720px, 100%);
  margin: 0 auto;
  color: var(--muted);
  font-size: 1.1rem;
}

/* Tabs */
.tabs {
  display: flex;
  width: fit-content;
  gap: 4px;
  margin: 0 auto 12px;
  padding: 5px;
  border: 1px solid var(--line);
  background: var(--panel);
  border-radius: 0;
  backdrop-filter: blur(22px);
  -webkit-backdrop-filter: blur(22px);
  animation: slideUp 0.5s 0.2s backwards;
}

.tab {
  margin: 0;
  min-width: 120px;
  padding: 10px 20px;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--muted);
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
}

.tab:hover {
  color: var(--ink);
}

.tab.active {
  background: var(--ink);
  color: var(--panel-solid);
}

.tab-content { display: none; animation: fadeIn 0.4s ease forwards; }
.tab-content.active { display: block; }

/* Panels */
.glass-panel {
  border: none;
  border-radius: 0;
  background: transparent;
}

.checker-layout {
  display: grid;
  grid-template-columns: minmax(0, 800px);
  justify-content: center;
  gap: 24px;
  align-items: stretch;
  height: calc(100vh - 64px);
  transition: all 0.4s cubic-bezier(0.25, 0.8, 0.25, 1);
}

.checker-layout.checking {
  grid-template-columns: minmax(0, 1.2fr) minmax(340px, 0.8fr);
  justify-content: stretch;
}

.input-panel,
.history-panel {
  padding: 0;
  display: flex;
  flex-direction: column;
}

.results-panel {
  padding: 0;
  display: none;
  flex-direction: column;
}

.checker-layout.checking .results-panel {
  display: flex;
}

.section-title {
  margin: 0 0 20px;
  font-size: 1.25rem;
  font-weight: 600;
  letter-spacing: -0.01em;
}

/* Forms */
.field-stack {
  display: flex;
  flex-direction: column;
  flex-grow: 1;
  gap: 8px;
}

.label-count {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
  font-weight: 600;
  color: var(--ink);
}

.badge {
  display: inline-flex;
  min-width: 2.5rem;
  justify-content: center;
  background: transparent;
  color: var(--brand);
  border-radius: 0;
  padding: 0;
  font-size: 0.8rem;
  font-weight: 700;
}

.editor, input[type="text"], input[type="number"], input {
  width: 100%;
  padding: 14px 0;
  border: none;
  border-bottom: 2px solid var(--line);
  border-radius: 0;
  background: transparent;
  color: var(--ink);
  outline: none;
  transition: var(--transition);
}



.editor:focus, input:focus {
  border-color: var(--brand);
}

.editor {
  resize: none;
  flex-grow: 1;
  min-height: 0;
  font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
  font-size: 0.85rem;
  line-height: 1.6;
  white-space: pre;
  overflow-x: auto;
  background: var(--soft);
  padding: 16px;
  border: 1px solid var(--line);
}

.grid-three {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}

.grid-three label {
  display: block;
  font-weight: 600;
  margin-bottom: 8px;
  font-size: 0.9rem;
}

/* Buttons */
.primary-action {
  width: 100%;
  padding: 16px;
  margin: 8px 0 0;
  border: 0;
  border-radius: var(--radius);
  background: var(--brand);
  color: #fff;
  font-weight: 600;
  font-size: 1rem;
  cursor: pointer;
  transition: var(--transition);
}

.primary-action:hover:not(:disabled) {
  background: var(--brand-strong);
}

.primary-action:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.secondary {
  padding: 12px 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255,255,255,0.4);
  color: var(--ink);
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
}

.secondary:hover {
  background: rgba(255,255,255,0.8);
  border-color: var(--muted);
}

.actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 20px;
}

/* Results Strip */
.status-strip {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 20px;
}

.metric {
  padding: 0;
  border: none;
  border-radius: 0;
  background: transparent;
  text-align: left;
  transition: var(--transition);
}



.metric:hover {
  background: var(--panel-solid);
}

.metric span {
  display: block;
  color: var(--muted);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 600;
}

.metric strong {
  display: block;
  margin-top: 4px;
  font-size: 1.5rem;
  font-weight: 700;
}

/* Progress */
.run-status {
  min-height: 24px;
  margin: 0 0 12px;
  color: var(--brand);
  font-size: 0.95rem;
  font-weight: 500;
}

.progress-container { display: none; margin: 0 0 20px; }

.progress-bar {
  height: 8px;
  background: var(--line);
  border-radius: 0;
  overflow: hidden;
}

.progress-fill {
  width: 0%;
  height: 100%;
  background: linear-gradient(90deg, var(--brand), #34c759);
  transition: width 0.3s ease;
}

/* Results Box */
.results-box {
  display: none;
  flex-direction: column;
  padding: 8px 0;
  flex-grow: 1;
  min-height: 0;
  overflow-y: auto;
  font-family: 'SFMono-Regular', Consolas, monospace;
  font-size: 0.85rem;
  line-height: 1.5;
  border: none;
  border-top: 1px solid var(--line);
  border-radius: 0;
  background: transparent;
}


.results-box.active { display: flex; }

.result-line {
  padding: 2px 16px;
  line-height: 1.4;
  animation: fadeIn 0.3s ease;
}



.result-line.active-status { color: var(--good); font-weight: 600; }
.result-line.redeemed { color: var(--bad); }
.result-line.invalid, .result-line.notfound, .result-line.ratelimit, .result-line.unauthorized, .result-line.waiting, .result-line.batch { color: var(--warn); }
.result-line.error, .result-line.fatal { color: var(--bad); font-weight: 600; }
.result-line.summary {
  color: var(--brand);
  font-weight: 700;
  border-bottom: 0;
  background: var(--brand-light);
  border-radius: 0;
  margin-top: 8px;
}

.product-info {
  color: var(--muted);
  font-size: 0.8rem;
  margin-top: 4px;
}

/* History Tables */
.stat-card {
  margin-bottom: 32px;
}
.stat-card h3 {
  margin-bottom: 16px;
  font-size: 1.1rem;
}

.table-responsive {
  overflow-x: auto;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: rgba(255,255,255,0.4);
}


table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.9rem;
}

th, td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
}

th {
  background: rgba(0,0,0,0.02);
  font-weight: 600;
  text-transform: uppercase;
  font-size: 0.75rem;
  letter-spacing: 0.05em;
  color: var(--muted);
  white-space: nowrap;
}
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: rgba(0,0,0,0.01); }

/* Toasts */
#toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 200;
}

.toast {
  background: var(--ink);
  color: var(--panel-solid);
  padding: 12px 20px;
  border-radius: 0;
  box-shadow: 0 10px 30px rgba(0,0,0,0.2);
  font-weight: 500;
  font-size: 0.9rem;
  animation: slideLeft 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.hidden { display: none !important; }

@keyframes fadeIn {
  0% { opacity: 0; }
  100% { opacity: 1; }
}

@keyframes slideLeft {
  0% { opacity: 0; transform: translateX(50px); }
  100% { opacity: 1; transform: translateX(0); }
}

@media (max-width: 920px) {
  .checker-layout { grid-template-columns: 1fr; }
}

@media (max-width: 760px) {
  body { padding: 16px; }
  .grid-three { grid-template-columns: 1fr; }
  .status-strip { grid-template-columns: repeat(2, 1fr); }
  .actions { grid-template-columns: 1fr; }
  .header { padding-top: 60px; }
}
