/* ─── Hive Toolbox ─── */
:root {
  --bg: #07070e;
  --bg-panel: rgba(12, 12, 22, 0.85);
  --bg-input: #0e0e1a;
  --border: #2a1020;
  --border-hot: #e31337;
  --red: #e31337;
  --red-bright: #ff2a4d;
  --red-dim: #8b0f24;
  --yellow: #ffe14a;
  --yellow-dim: #c9a91a;
  --orange: #ff6b00;
  --text: #f5e6a8;
  --text-dim: #9a8850;
  --text-muted: #5c4e30;
  --hp: #ff2a4d;
  --hive: #ffe14a;
  --hbd: #ff8c42;
  --glow-red: 0 0 20px rgba(227, 19, 55, 0.45);
  --glow-yellow: 0 0 16px rgba(255, 225, 74, 0.35);
  --font-display: "Orbitron", system-ui, sans-serif;
  --font-script: "Great Vibes", cursive;
  --font-mono: "Share Tech Mono", ui-monospace, monospace;
  --radius: 6px;
}

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

html {
  font-size: 16px;
}

body {
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-mono);
  overflow-x: hidden;
  position: relative;
}

/* Background effects */
.bg-grid {
  position: fixed;
  inset: 0;
  background-image:
    linear-gradient(rgba(227, 19, 55, 0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(227, 19, 55, 0.04) 1px, transparent 1px);
  background-size: 48px 48px;
  pointer-events: none;
  z-index: 0;
}

.bg-glow {
  position: fixed;
  inset: 0;
  background:
    radial-gradient(ellipse 60% 40% at 20% 10%, rgba(227, 19, 55, 0.18), transparent 60%),
    radial-gradient(ellipse 50% 35% at 85% 80%, rgba(255, 107, 0, 0.1), transparent 55%),
    radial-gradient(ellipse 40% 30% at 50% 50%, rgba(255, 225, 74, 0.04), transparent 70%);
  pointer-events: none;
  z-index: 0;
}

.scanlines {
  position: fixed;
  inset: 0;
  background: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 2px,
    rgba(0, 0, 0, 0.08) 2px,
    rgba(0, 0, 0, 0.08) 4px
  );
  pointer-events: none;
  z-index: 1000;
  opacity: 0.4;
}

/* Layout */
.app {
  position: relative;
  z-index: 1;
  max-width: 960px;
  margin: 0 auto;
  padding: 2rem 1.25rem 3rem;
}

/* Header */
.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 2rem;
  flex-wrap: wrap;
}

.logo-wrap {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.hive-logo {
  width: 80px;
  height: 80px;
  flex-shrink: 0;
  display: block;
  animation: pulse-logo 3s ease-in-out infinite;
}

@keyframes pulse-logo {
  0%, 100% {
    filter:
      drop-shadow(0 0 6px rgba(255, 225, 74, 0.55))
      drop-shadow(0 0 12px rgba(227, 19, 55, 0.45));
  }
  50% {
    filter:
      drop-shadow(0 0 14px rgba(255, 225, 74, 0.95))
      drop-shadow(0 0 22px rgba(255, 42, 77, 0.7));
  }
}

.brand h1 {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(1.4rem, 4vw, 2rem);
  letter-spacing: 0.08em;
  color: var(--yellow);
  text-shadow: var(--glow-yellow);
  line-height: 1.1;
}

.brand-hive {
  font-family: var(--font-script);
  font-weight: 400;
  font-size: 1.35em;
  letter-spacing: 0.02em;
  text-transform: lowercase;
  margin-right: 0.05em;
}

.tagline {
  font-size: 0.7rem;
  letter-spacing: 0.18em;
  color: var(--text-dim);
  margin-top: 0.35rem;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.4rem 0.85rem;
  border: 1px solid var(--border-hot);
  border-radius: 999px;
  background: rgba(227, 19, 55, 0.08);
  font-size: 0.75rem;
  color: var(--yellow);
  letter-spacing: 0.06em;
}

.status-pill .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--red-bright);
  box-shadow: 0 0 8px var(--red-bright);
  animation: blink 1.6s ease-in-out infinite;
}

@keyframes blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.35; }
}

/* Panels */
.panel {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  margin-bottom: 1.25rem;
  backdrop-filter: blur(8px);
  box-shadow:
    0 0 0 1px rgba(227, 19, 55, 0.08),
    0 12px 40px rgba(0, 0, 0, 0.45);
  position: relative;
  overflow: hidden;
}

.panel::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--red-bright), var(--yellow), var(--red-bright), transparent);
  opacity: 0.85;
}

.panel-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
}

.panel-tag {
  font-family: var(--font-display);
  font-size: 0.65rem;
  font-weight: 700;
  color: var(--bg);
  background: var(--red);
  padding: 0.2rem 0.45rem;
  border-radius: 2px;
  letter-spacing: 0.1em;
}

.panel-header h2 {
  font-family: var(--font-display);
  font-size: 0.95rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  color: var(--yellow);
  text-transform: uppercase;
}

.account-badge {
  margin-left: auto;
  font-size: 0.8rem;
  color: var(--red-bright);
  border: 1px solid var(--red-dim);
  padding: 0.25rem 0.65rem;
  border-radius: 999px;
  background: rgba(227, 19, 55, 0.1);
}

/* Form */
.form {
  display: flex;
  flex-direction: column;
  gap: 1.1rem;
}

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

@media (max-width: 520px) {
  .field-row {
    grid-template-columns: 1fr;
  }
}

.field {
  position: relative;
}

.field label {
  display: block;
  font-size: 0.7rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--text-dim);
  margin-bottom: 0.4rem;
}

/* Custom required-field tooltip (replaces native browser bubble) */
.field-tooltip {
  position: absolute;
  left: 0;
  top: calc(100% + 0.45rem);
  z-index: 20;
  max-width: min(100%, 18rem);
  padding: 0.5rem 0.75rem;
  background: rgba(14, 14, 26, 0.96);
  border: 1px solid var(--red);
  border-radius: var(--radius);
  color: var(--yellow);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  letter-spacing: 0.06em;
  line-height: 1.35;
  box-shadow: var(--glow-red), 0 8px 24px rgba(0, 0, 0, 0.55);
  pointer-events: none;
  animation: field-tooltip-in 0.28s cubic-bezier(0.22, 1, 0.36, 1);
}

.field-tooltip::before {
  content: "";
  position: absolute;
  left: 1rem;
  bottom: 100%;
  border: 6px solid transparent;
  border-bottom-color: var(--red);
}

.field-tooltip::after {
  content: "";
  position: absolute;
  left: calc(1rem + 1px);
  bottom: 100%;
  border: 5px solid transparent;
  border-bottom-color: rgba(14, 14, 26, 0.96);
}

.field.is-invalid .input-wrap,
.field.is-invalid input[type="text"],
.field.is-invalid input[type="date"],
.field.is-invalid select {
  border-color: var(--red-bright);
  box-shadow: 0 0 0 1px rgba(227, 19, 55, 0.4), var(--glow-red);
}

@keyframes field-tooltip-in {
  from {
    opacity: 0;
    transform: translateY(-4px) scale(0.96);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.input-wrap {
  display: flex;
  align-items: stretch;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-input);
  overflow: hidden;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.input-wrap:focus-within {
  border-color: var(--red-bright);
  box-shadow: 0 0 0 1px rgba(227, 19, 55, 0.35), var(--glow-red);
}

.prefix {
  display: flex;
  align-items: center;
  padding: 0 0.75rem;
  color: var(--red-bright);
  font-family: var(--font-display);
  font-weight: 700;
  background: rgba(227, 19, 55, 0.12);
  border-right: 1px solid var(--border);
}

input[type="text"],
input[type="date"],
select {
  width: 100%;
  padding: 0.75rem 0.9rem;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--yellow);
  font-family: var(--font-mono);
  font-size: 1rem;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
  color-scheme: dark;
}

.input-wrap input[type="text"] {
  border: none;
  border-radius: 0;
  background: transparent;
}

input[type="text"]:focus,
input[type="date"]:focus,
select:focus {
  border-color: var(--red-bright);
  box-shadow: 0 0 0 1px rgba(227, 19, 55, 0.35), var(--glow-red);
}

input::placeholder {
  color: var(--text-muted);
}

select {
  cursor: pointer;
  appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, var(--red-bright) 50%),
    linear-gradient(135deg, var(--red-bright) 50%, transparent 50%);
  background-position: calc(100% - 18px) calc(50% - 3px), calc(100% - 12px) calc(50% - 3px);
  background-size: 6px 6px, 6px 6px;
  background-repeat: no-repeat;
  padding-right: 2rem;
}

select option {
  background: #12121e;
  color: var(--yellow);
}

/* Button */
.btn-primary {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  margin-top: 0.35rem;
  padding: 0.95rem 1.5rem;
  background: linear-gradient(135deg, #c4102e 0%, var(--red) 40%, #ff2a4d 100%);
  border: 1px solid var(--red-bright);
  border-radius: var(--radius);
  color: #fff;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.85rem;
  letter-spacing: 0.2em;
  cursor: pointer;
  text-transform: uppercase;
  box-shadow: var(--glow-red), inset 0 1px 0 rgba(255, 255, 255, 0.15);
  transition: transform 0.15s, box-shadow 0.2s, filter 0.2s;
}

.btn-primary:hover:not(:disabled) {
  transform: translateY(-1px);
  filter: brightness(1.1);
  box-shadow: 0 0 28px rgba(255, 42, 77, 0.65), inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.btn-primary:active:not(:disabled) {
  transform: translateY(1px);
}

.btn-primary:disabled {
  opacity: 0.65;
  cursor: wait;
}

.btn-loader {
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

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

/* Totals */
.totals-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.85rem;
  margin-bottom: 1.5rem;
}

@media (max-width: 720px) {
  .totals-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

.stat-card {
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 0.9rem;
  position: relative;
  overflow: hidden;
}

.stat-card::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 2px;
}

.stat-card.hp::after { background: var(--hp); box-shadow: 0 0 10px var(--hp); }
.stat-card.hive::after { background: var(--hive); box-shadow: 0 0 10px var(--hive); }
.stat-card.hbd::after { background: var(--hbd); box-shadow: 0 0 10px var(--hbd); }
.stat-card.claims::after { background: var(--red-dim); }

.stat-label {
  font-size: 0.65rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-dim);
  margin-bottom: 0.4rem;
}

.stat-value {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(1.1rem, 3vw, 1.45rem);
  color: var(--yellow);
  line-height: 1.2;
  word-break: break-all;
}

.stat-card.hp .stat-value { color: var(--red-bright); text-shadow: 0 0 12px rgba(255, 42, 77, 0.4); }
.stat-card.hive .stat-value { color: var(--yellow); text-shadow: var(--glow-yellow); }
.stat-card.hbd .stat-value { color: var(--hbd); }
.stat-card.claims .stat-value { color: var(--text); }

.stat-unit {
  font-size: 0.65rem;
  letter-spacing: 0.12em;
  color: var(--text-muted);
  margin-top: 0.25rem;
}

/* Table */
.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.rewards-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.rewards-table th,
.rewards-table td {
  padding: 0.75rem 1rem;
  text-align: left;
  border-bottom: 1px solid rgba(42, 16, 32, 0.9);
}

.rewards-table th {
  font-family: var(--font-display);
  font-size: 0.65rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-dim);
  background: rgba(227, 19, 55, 0.08);
}

.rewards-table th.num,
.rewards-table td.num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.rewards-table tbody tr {
  transition: background 0.15s;
}

.rewards-table tbody tr:hover {
  background: rgba(227, 19, 55, 0.07);
}

.rewards-table tbody td {
  color: var(--text);
}

.rewards-table tbody td:first-child {
  color: var(--yellow);
  font-weight: 600;
  letter-spacing: 0.04em;
}

.rewards-table tfoot td {
  font-family: var(--font-display);
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--red-bright);
  background: rgba(227, 19, 55, 0.1);
  border-bottom: none;
  letter-spacing: 0.06em;
}

.meta {
  margin-top: 1rem;
  font-size: 0.75rem;
  color: var(--text-muted);
  letter-spacing: 0.04em;
}

/* Empty state — compact banner above the form */
.empty-panel {
  display: flex;
  align-items: center;
  padding: 0.75rem 1rem;
  border-style: dashed;
  border-color: var(--red-dim);
  min-height: 0;
}

.prompt-panel {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  width: 100%;
  max-width: none;
  padding: 0;
  text-align: left;
}

.prompt-icon {
  font-size: 1.25rem;
  color: var(--red);
  text-shadow: var(--glow-red);
  margin: 0;
  flex-shrink: 0;
  line-height: 1;
  animation: pulse-logo 3s ease-in-out infinite;
}

.prompt-text {
  min-width: 0;
}

.prompt-panel h2 {
  font-family: var(--font-display);
  font-size: 0.8rem;
  letter-spacing: 0.12em;
  color: var(--yellow);
  margin: 0 0 0.15rem;
}

.prompt-panel p {
  font-size: 0.75rem;
  color: var(--text-dim);
  line-height: 1.35;
  margin: 0;
}

/* Ensure [hidden] wins over display:flex/grid rules */
[hidden] {
  display: none !important;
}

/* Banners */
.error-banner {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 1rem 1.15rem;
  margin-bottom: 1.25rem;
  border-radius: var(--radius);
  font-size: 0.9rem;
  line-height: 1.45;
  background: rgba(227, 19, 55, 0.12);
  border: 1px solid var(--red);
  color: var(--red-bright);
  box-shadow: var(--glow-red);
  transform-origin: center top;
}

.error-banner.is-animating {
  animation: error-appear 0.55s cubic-bezier(0.22, 1, 0.36, 1);
}

@keyframes error-appear {
  0% {
    opacity: 0;
    transform: translateY(-10px) scale(0.96);
    box-shadow: 0 0 0 rgba(227, 19, 55, 0);
  }
  35% {
    opacity: 1;
    transform: translateY(0) scale(1.02);
    box-shadow: 0 0 28px rgba(227, 19, 55, 0.65);
  }
  50% {
    transform: translateX(-6px) scale(1);
  }
  65% {
    transform: translateX(6px);
  }
  80% {
    transform: translateX(-3px);
  }
  100% {
    opacity: 1;
    transform: translateX(0) scale(1);
    box-shadow: var(--glow-red);
  }
}

.error-icon {
  flex-shrink: 0;
  animation: error-icon-pulse 0.55s ease-out;
}

@keyframes error-icon-pulse {
  0%,
  100% {
    transform: scale(1);
  }
  40% {
    transform: scale(1.25);
  }
}

.progress-banner {
  margin-bottom: 1.25rem;
  padding: 1rem 1.15rem;
  background: rgba(255, 225, 74, 0.06);
  border: 1px solid var(--yellow-dim);
  border-radius: var(--radius);
}

.progress-bar {
  height: 4px;
  background: rgba(255, 225, 74, 0.15);
  border-radius: 2px;
  overflow: hidden;
  margin-bottom: 0.65rem;
}

.progress-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--red), var(--yellow));
  box-shadow: 0 0 10px var(--yellow);
  transition: width 0.3s ease;
  animation: progress-pulse 1.2s ease-in-out infinite;
}

@keyframes progress-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.7; }
}

#progressText {
  font-size: 0.8rem;
  color: var(--yellow);
  letter-spacing: 0.06em;
}

/* Footer */
.footer {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.25rem;
  margin-top: 2.5rem;
  text-align: center;
}

.social-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.85rem;
}

.btn-social {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.55rem 1rem;
  background: transparent;
  border: none;
  border-radius: 0;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 0.65rem;
  letter-spacing: 0.1em;
  text-decoration: none;
  text-transform: none;
  opacity: 0.75;
  transition: opacity 0.2s, color 0.2s, text-shadow 0.2s;
}

.btn-social::before,
.btn-social::after {
  content: "";
  position: absolute;
  width: 8px;
  height: 8px;
  pointer-events: none;
  transition: width 0.2s, height 0.2s, border-color 0.2s;
}

/* Top-left + bottom-right corners */
.btn-social::before {
  top: 0;
  left: 0;
  border-top: 1px solid currentColor;
  border-left: 1px solid currentColor;
}

.btn-social::after {
  right: 0;
  bottom: 0;
  border-right: 1px solid currentColor;
  border-bottom: 1px solid currentColor;
}

.btn-social:hover {
  opacity: 1;
}

.btn-social:hover::before,
.btn-social:hover::after {
  width: 12px;
  height: 12px;
}

.btn-social:active {
  opacity: 0.9;
}

.btn-social-red {
  color: var(--red-bright);
}

.btn-social-red:hover {
  text-shadow: 0 0 10px rgba(255, 42, 77, 0.45);
}

.btn-social-yellow {
  color: var(--yellow-dim);
}

.btn-social-yellow:hover {
  color: var(--yellow);
  text-shadow: 0 0 10px rgba(255, 225, 74, 0.35);
}

.footer-meta {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.5rem;
  font-size: 0.65rem;
  letter-spacing: 0.16em;
  color: var(--text-muted);
}

.footer .sep {
  color: var(--red-dim);
}

.footer-link {
  color: var(--yellow);
  text-decoration: none;
  transition: color 0.15s, text-shadow 0.2s;
}

.footer-link:hover {
  color: var(--yellow);
  text-shadow: var(--glow-yellow);
  text-decoration: underline;
  text-underline-offset: 0.2em;
}

.footer .version {
  color: var(--text-dim);
  letter-spacing: 0.12em;
}

/* Date input calendar icon tint for webkit */
input[type="date"]::-webkit-calendar-picker-indicator {
  filter: invert(0.7) sepia(1) saturate(5) hue-rotate(330deg);
  cursor: pointer;
}

/* Logo home link (app → toolbox) */
.logo-home {
  display: block;
  flex-shrink: 0;
  line-height: 0;
  text-decoration: none;
}

/* ─── Hive Toolbox hub: app cards ─── */
.app-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1rem;
}

.app-card {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  padding: 1.25rem 1.15rem 1.15rem;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  text-decoration: none;
  color: inherit;
  position: relative;
  overflow: hidden;
  transition: border-color 0.2s, box-shadow 0.2s, transform 0.15s;
}

.app-card::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--red), var(--yellow));
  box-shadow: 0 0 10px rgba(255, 225, 74, 0.35);
  opacity: 0.7;
  transition: opacity 0.2s;
}

.app-card:hover {
  border-color: var(--red-bright);
  box-shadow: 0 0 0 1px rgba(227, 19, 55, 0.25), var(--glow-red);
  transform: translateY(-2px);
}

.app-card:hover::after {
  opacity: 1;
}

.app-card-tag {
  position: absolute;
  top: 0.85rem;
  right: 0.85rem;
  font-family: var(--font-display);
  font-size: 0.6rem;
  font-weight: 700;
  color: var(--bg);
  background: var(--red);
  padding: 0.15rem 0.4rem;
  border-radius: 2px;
  letter-spacing: 0.1em;
}

.app-card-icon {
  font-size: 1.5rem;
  color: var(--red-bright);
  text-shadow: var(--glow-red);
  line-height: 1;
}

.app-card-title {
  font-family: var(--font-display);
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--yellow);
  text-shadow: var(--glow-yellow);
  padding-right: 2rem;
}

.app-card-desc {
  font-size: 0.8rem;
  color: var(--text-dim);
  line-height: 1.45;
  flex: 1;
}

.app-card-cta {
  font-family: var(--font-display);
  font-size: 0.65rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--red-bright);
  margin-top: 0.35rem;
  transition: color 0.15s, text-shadow 0.2s;
}

.app-card:hover .app-card-cta {
  color: var(--yellow);
  text-shadow: var(--glow-yellow);
}
