:root {
  --bg: #f3f6f2;
  --panel: #ffffff;
  --line: #d4ddd4;
  --text: #143025;
  --muted: #5a6e64;
  --primary: #0b7a53;
  --primary-dark: #085f40;
  --danger: #b22222;
  --good: #0f7a44;
  --warn: #92400e;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "IBM Plex Sans", sans-serif;
  background: radial-gradient(circle at 10% 20%, #e1f5eb, transparent 28%), radial-gradient(circle at 90% 0%, #ffecc8, transparent 32%), var(--bg);
  color: var(--text);
  min-height: 100vh;
}

.bg-orb {
  position: fixed;
  border-radius: 999px;
  filter: blur(70px);
  opacity: 0.4;
  z-index: -1;
}

.orb-1 {
  width: 240px;
  height: 240px;
  background: #8fd8b8;
  top: 0;
  left: -60px;
}

.orb-2 {
  width: 260px;
  height: 260px;
  background: #f6d486;
  top: 8rem;
  right: -90px;
}

.topbar {
  max-width: 1200px;
  margin: 1.4rem auto 0;
  padding: 1rem 1.2rem;
  background: rgba(255, 255, 255, 0.75);
  border: 1px solid var(--line);
  border-radius: 18px;
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: center;
  backdrop-filter: blur(12px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.8rem;
}

.brand-logo {
  width: 42px;
  height: 42px;
  object-fit: contain;
}

.brand-kicker,
.section-label {
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.72rem;
  color: var(--muted);
  margin: 0;
}

.brand h1 {
  margin: 0;
  font-family: "Space Grotesk", sans-serif;
  font-size: 1.15rem;
}

.topbar-actions {
  display: flex;
  gap: 0.8rem;
  align-items: center;
}

.topbar-actions p {
  margin: 0;
  color: var(--muted);
}

.page-shell {
  max-width: 1200px;
  margin: 1rem auto 2rem;
  padding: 0 1rem;
  display: grid;
  gap: 1rem;
}

.login-shell {
  min-height: calc(100vh - 2rem);
  place-items: center;
}

.flash-stack {
  display: grid;
  gap: 0.6rem;
}

.flash {
  border-radius: 12px;
  padding: 0.7rem 0.9rem;
  border: 1px solid;
  font-size: 0.95rem;
}

.flash-success {
  background: #ecfdf3;
  border-color: #95d5b2;
  color: var(--good);
}

.flash-error {
  background: #fff4ed;
  border-color: #f3b08f;
  color: var(--warn);
}

.hero-grid {
  display: grid;
  grid-template-columns: 2fr repeat(4, 1fr);
  gap: 1rem;
}

.hero-card,
.metric-card,
.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 1rem;
}

.hero-card h2 {
  margin: 0.2rem 0;
  font-size: 1.35rem;
  font-family: "Space Grotesk", sans-serif;
}

.hero-card p {
  margin: 0.2rem 0;
  color: var(--muted);
}

.metric-card p {
  color: var(--muted);
  margin: 0;
  font-size: 0.85rem;
}

.metric-card h3 {
  margin: 0.4rem 0 0;
  font-size: 1.5rem;
}

.panel-head h3 {
  margin: 0;
  font-size: 1.08rem;
  font-family: "Space Grotesk", sans-serif;
}

.panel-head p {
  margin: 0.3rem 0 0.8rem;
  color: var(--muted);
  font-size: 0.92rem;
}

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

.wizard-form {
  display: grid;
  gap: 0.7rem;
}

.wizard-progress {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.45rem;
  margin-bottom: 0.6rem;
}

.wizard-step {
  padding: 0.5rem;
  border-radius: 10px;
  text-align: center;
  background: #edf3ee;
  color: var(--muted);
  font-size: 0.85rem;
}

.wizard-step.active {
  background: #d8f3e8;
  color: #0a5038;
  font-weight: 600;
}

.wizard-pane {
  display: none;
  gap: 0.65rem;
}

.wizard-pane.active {
  display: grid;
}

input,
textarea {
  width: 100%;
  border: 1px solid #c7d4cc;
  border-radius: 10px;
  padding: 0.62rem 0.7rem;
  font: inherit;
  color: var(--text);
  background: #fff;
}

label {
  font-size: 0.88rem;
  font-weight: 600;
  color: #27473a;
}

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

.checkbox-line {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.checkbox-line input {
  width: auto;
}

.manual-og {
  display: grid;
  gap: 0.65rem;
}

.disabled-block {
  opacity: 0.55;
}

.field-hint {
  margin: 0;
  color: var(--muted);
  font-size: 0.82rem;
}

.review-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.6rem;
}

.review-card {
  border: 1px solid #d2ddd6;
  border-radius: 10px;
  padding: 0.6rem;
}

.review-card span {
  display: block;
  color: var(--muted);
  font-size: 0.76rem;
  margin-bottom: 0.2rem;
}

.wizard-actions,
.bulk-actions {
  display: flex;
  justify-content: space-between;
  gap: 0.6rem;
  margin-top: 0.2rem;
}

.btn {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  border: 1px solid transparent;
  border-radius: 10px;
  padding: 0.58rem 0.9rem;
  text-decoration: none;
  font-weight: 600;
  color: #fff;
  background: var(--primary);
  cursor: pointer;
}

.btn:hover {
  background: var(--primary-dark);
}

.btn-primary {
  background: var(--primary);
}

.btn-ghost {
  background: #edf3ef;
  color: #204536;
  border-color: #d0ddd5;
}

.btn-ghost:hover {
  background: #e0ece5;
}

.full {
  width: 100%;
}

.dropzone {
  border: 1.5px dashed #9bc1ad;
  border-radius: 12px;
  background: #f7fcf9;
  padding: 1rem;
  display: grid;
  gap: 0.35rem;
  text-align: center;
  cursor: pointer;
}

.dropzone.dragover {
  border-color: var(--primary);
  background: #e8f8f0;
}

.dropzone input {
  display: none;
}

.stat-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.5rem;
}

.stat-list li {
  display: flex;
  justify-content: space-between;
  border: 1px solid #d4ddd5;
  border-radius: 10px;
  padding: 0.55rem 0.7rem;
}

.compact-top {
  margin-top: 0.6rem;
}

.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  text-align: left;
  padding: 0.62rem;
  border-bottom: 1px solid #e0e8e2;
  font-size: 0.9rem;
}

th {
  color: var(--muted);
  font-weight: 600;
}

.short-anchor {
  display: inline-block;
  margin-right: 0.45rem;
  color: var(--primary);
  text-decoration: none;
}

.copy-button,
.table-link {
  border: 0;
  background: transparent;
  color: #0a6a49;
  text-decoration: underline;
  cursor: pointer;
  font-size: 0.84rem;
  padding: 0;
}

.table-link.danger {
  color: var(--danger);
}

.pagination-bar {
  margin-top: 0.8rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.6rem;
}

.pagination-actions {
  display: flex;
  gap: 0.5rem;
}

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

.qr-modal {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: grid;
  place-items: center;
}

.qr-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(12, 30, 22, 0.55);
}

.qr-modal-card {
  position: relative;
  z-index: 1;
  width: min(420px, calc(100vw - 2rem));
  background: #fff;
  border-radius: 16px;
  border: 1px solid #cfddd3;
  padding: 1rem;
  display: grid;
  gap: 0.55rem;
}

.qr-modal-card h3 {
  margin: 0;
}

.qr-close {
  position: absolute;
  right: 0.6rem;
  top: 0.6rem;
  border: 0;
  background: transparent;
  color: #395447;
  cursor: pointer;
  font-size: 0.95rem;
  font-weight: 700;
}

.qr-short-url {
  margin: 0;
  color: var(--muted);
  word-break: break-all;
}

.qr-preview {
  width: min(280px, 100%);
  margin: 0 auto;
  border: 1px solid #dce7e1;
  border-radius: 12px;
  background: #fff;
  padding: 0.45rem;
}

.chart-tooltip {
  position: fixed;
  z-index: 20;
  pointer-events: none;
  background: #123d2e;
  color: #fff;
  border-radius: 8px;
  padding: 0.34rem 0.5rem;
  font-size: 0.75rem;
  border: 1px solid #2e6852;
}

.hidden {
  display: none;
}

#clicksChart {
  cursor: crosshair;
}

.inline-form {
  display: inline;
}

.truncate {
  max-width: 300px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.panel-narrow {
  max-width: 540px;
  margin: 0 auto;
}

.login-panel {
  text-align: center;
}

.login-logo {
  width: 88px;
  height: 88px;
  object-fit: contain;
  margin: 0 auto;
}

@media (max-width: 980px) {
  .hero-grid {
    grid-template-columns: 1fr 1fr;
  }

  .hero-card {
    grid-column: 1 / -1;
  }

  .grid-two {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .topbar {
    flex-direction: column;
    align-items: flex-start;
  }

  .topbar-actions {
    width: 100%;
    justify-content: space-between;
  }

  .input-row,
  .review-grid {
    grid-template-columns: 1fr;
  }

  .wizard-actions,
  .bulk-actions,
  .pagination-bar,
  .pagination-actions {
    flex-direction: column;
  }

  .btn {
    width: 100%;
  }
}
