/* =========================================================
   App-specific styles for the dashboard
   ========================================================= */

/* sticky topbar already in styles.css */
.app-shell {
  padding: 40px 0 96px;
  position: relative;
  z-index: 1;
}

/* signup */
.signup-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  margin-top: 40px;
}
@media (max-width: 900px) {
  .signup-grid {
    grid-template-columns: 1fr;
  }
}

.signup-card {
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: var(--r-3);
  padding: 32px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  position: relative;
  overflow: hidden;
}
.signup-card .or-mark {
  position: absolute;
  top: 50%;
  left: -16px;
  transform: translateY(-50%);
  background: var(--bg-0);
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--fg-3);
  padding: 4px 8px;
  border: 1px solid var(--border);
  border-radius: 4px;
}
.signup-card h3 {
  margin: 0;
  font-size: 18px;
  font-weight: 500;
  letter-spacing: -0.012em;
  color: var(--fg-0);
}
.signup-card .helper {
  font-size: 12.5px;
  color: var(--fg-3);
  line-height: 1.6;
  font-family: var(--font-mono);
}

/* api key reveal modal */
.modal-veil {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(8px);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  animation: veilIn 200ms ease;
}
@keyframes veilIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}
.modal {
  width: 100%;
  max-width: 540px;
  background: var(--bg-1);
  border: 1px solid var(--border-strong);
  border-radius: var(--r-3);
  overflow: hidden;
  box-shadow: 0 40px 80px -20px rgba(0, 0, 0, 0.6);
  animation: modalIn 240ms cubic-bezier(0.2, 0.8, 0.2, 1);
}
@keyframes modalIn {
  from {
    transform: translateY(8px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}
.modal-hd {
  padding: 18px 22px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.modal-hd h3 {
  margin: 0;
  font-size: 15px;
  font-weight: 500;
  color: var(--fg-0);
}
.modal-bd {
  padding: 22px;
}
.modal-foot {
  padding: 14px 22px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  background: var(--bg-2);
}
.key-reveal {
  display: flex;
  align-items: center;
  gap: 0;
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid var(--border);
  border-radius: var(--r-2);
  font-family: var(--font-mono);
  font-size: 13.5px;
  padding: 12px 14px;
  color: var(--accent);
  letter-spacing: 0.02em;
  word-break: break-all;
}
.key-reveal .label {
  color: var(--fg-3);
  margin-right: 10px;
}

/* dashboard hd */
.app-title {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 24px;
  flex-wrap: wrap;
  margin-bottom: 32px;
}
.app-title h1 {
  font-size: 32px;
  font-weight: 500;
  letter-spacing: -0.025em;
  margin: 0 0 6px;
  color: var(--fg-0);
}
.app-title .sub {
  color: var(--fg-3);
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.02em;
}
.app-title .sub .acc {
  color: var(--accent);
}

/* stat tiles */
.stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 28px;
}
@media (max-width: 900px) {
  .stats {
    grid-template-columns: 1fr 1fr;
  }
}
.stat {
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: var(--r-3);
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  position: relative;
}
.stat .label {
  font-family: var(--font-mono);
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--fg-3);
}
.stat .val {
  font-size: 28px;
  font-weight: 500;
  letter-spacing: -0.018em;
  color: var(--fg-0);
  font-variant-numeric: tabular-nums;
  line-height: 1.1;
}
.stat .unit {
  font-size: 13px;
  font-family: var(--font-mono);
  color: var(--fg-3);
  margin-left: 6px;
}
.stat .meta {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--fg-3);
  display: flex;
  align-items: center;
  gap: 8px;
}
.stat .pulse {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 8px var(--accent);
  animation: pulse 1.6s ease-in-out infinite;
}
@keyframes pulse {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.3;
  }
}

/* spark line */
.sparkline {
  height: 28px;
  width: 100%;
  margin-top: 2px;
}
.sparkline path.line {
  fill: none;
  stroke: var(--accent);
  stroke-width: 1.5;
}
.sparkline path.area {
  fill: var(--accent);
  opacity: 0.1;
}

/* section cards (feeds, subs, billing, broadcasts) */
.sec-card {
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: var(--r-3);
  overflow: hidden;
  margin-bottom: 16px;
}
.sec-card-hd {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}
.sec-card-hd h2 {
  margin: 0;
  font-size: 15px;
  font-weight: 500;
  color: var(--fg-0);
  letter-spacing: -0.005em;
}
.sec-card-hd .meta {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--fg-3);
  letter-spacing: 0.02em;
}

.sec-form {
  display: grid;
  gap: 8px;
  padding: 16px 20px;
  background: var(--bg-2);
  border-bottom: 1px solid var(--border);
}
.sec-form.feed-form {
  grid-template-columns: 2fr 1.5fr 1fr auto;
}
.sec-form.sub-form {
  grid-template-columns: 1fr auto;
}
.sec-form.topup-form {
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 16px;
}
@media (max-width: 800px) {
  .sec-form.feed-form,
  .sec-form.topup-form {
    grid-template-columns: 1fr;
  }
}

/* empty state */
.empty {
  padding: 36px 20px;
  text-align: center;
  color: var(--fg-3);
  font-family: var(--font-mono);
  font-size: 12px;
}
.empty .ascii {
  font-size: 10px;
  letter-spacing: 0.2em;
  color: var(--fg-4);
  display: block;
  margin-bottom: 12px;
}

/* danger zone */
.danger-zone {
  background: var(--bg-1);
  border: 1px solid rgba(248, 113, 113, 0.18);
  border-radius: var(--r-3);
  padding: 24px;
}
.danger-zone h2 {
  margin: 0 0 6px;
  font-size: 15px;
  color: var(--danger);
  font-weight: 500;
}
.danger-zone p {
  margin: 0 0 16px;
  color: var(--fg-2);
  font-size: 13.5px;
  line-height: 1.55;
  max-width: 56ch;
}

/* toast */
.toast-wrap {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}
.toast {
  background: var(--bg-3);
  border: 1px solid var(--border-strong);
  color: var(--fg-0);
  padding: 10px 16px;
  border-radius: var(--r-2);
  font-size: 13px;
  font-family: var(--font-mono);
  display: flex;
  align-items: center;
  gap: 10px;
  box-shadow: 0 12px 40px -12px rgba(0, 0, 0, 0.6);
  animation: toastIn 240ms cubic-bezier(0.2, 0.8, 0.2, 1);
  pointer-events: auto;
}
.toast.ok::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 8px var(--accent);
}
.toast.warn::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--warn);
  box-shadow: 0 0 8px var(--warn);
}
@keyframes toastIn {
  from {
    transform: translate(-50%, 8px);
    opacity: 0;
  }
  to {
    transform: translate(-50%, 0);
    opacity: 1;
  }
}

/* link buttons inside table */
.link-btn {
  appearance: none;
  background: transparent;
  border: 0;
  color: var(--fg-3);
  font-size: 12.5px;
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 3px;
  transition:
    color 120ms,
    background 120ms;
  font-family: var(--font-mono);
}
.link-btn:hover {
  color: var(--danger);
  background: var(--danger-soft);
}

/* row hover actions */
.row-actions {
  display: flex;
  gap: 6px;
  justify-content: flex-end;
}
