/* ─────────────────────────────────────────────────────────
   ACKgeo Dashboard — Shared Design System
   ───────────────────────────────────────────────────────── */

/* ── Reset & Base ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg:       #0b0d10;
  --surface:  #13161b;
  --surface2: #191d24;
  --border:   #21262d;
  --border2:  #30363d;
  --text:     #e6edf3;
  --muted:    #8b949e;
  --dim:      #484f58;
  --accent:   #58a6ff;
  --accent-dim: rgba(88,166,255,0.15);
  --accent-bg:  rgba(88,166,255,0.07);
  --danger:   #f85149;
  --success:  #3fb950;
  --warn:     #d29922;
  --radius:   10px;
  --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Subtle radial glow */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background: radial-gradient(ellipse at 70% 20%, rgba(88,166,255,0.04) 0%, transparent 60%);
  pointer-events: none;
  z-index: 0;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── Header ── */
.dash-header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 0 2.5rem;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 100;
  flex-shrink: 0;
}

.dash-logo {
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: -.02em;
  color: var(--accent);
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: .5rem;
}
.dash-logo span { color: var(--text); }

.header-meta {
  font-size: .6rem;
  font-weight: 600;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--dim);
}

.header-right {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.tier-pill {
  padding: .25rem .75rem;
  border-radius: 20px;
  font-size: .65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .07em;
}
.tier-free     { background: #1c2128; color: var(--muted); }
.tier-pro      { background: #1a2e44; color: #79c0ff; }
.tier-business { background: #2d2a0a; color: var(--warn); }

.header-btn {
  font-size: .65rem;
  font-weight: 600;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--dim);
  text-decoration: none;
  border: 1px solid var(--border);
  padding: .35rem .85rem;
  border-radius: 6px;
  transition: color .2s, border-color .2s;
  background: none;
  cursor: pointer;
}
.header-btn:hover { color: var(--text); border-color: var(--border2); text-decoration: none; }

/* ── Page shell ── */
.dash-page {
  position: relative;
  z-index: 1;
  max-width: 1020px;
  margin: 0 auto;
  padding: 3rem 2.5rem 5rem;
  width: 100%;
  flex: 1;
}

/* ── Page header ── */
.page-eyebrow {
  font-size: .55rem;
  font-weight: 700;
  letter-spacing: .3em;
  text-transform: uppercase;
  color: var(--dim);
  margin-bottom: .9rem;
  display: flex;
  align-items: center;
  gap: .75rem;
}
.page-eyebrow::before {
  content: '';
  display: block;
  width: 18px;
  height: 1px;
  background: rgba(88,166,255,.35);
  flex-shrink: 0;
}

.page-title {
  font-size: 2.2rem;
  font-weight: 300;
  letter-spacing: -.03em;
  line-height: 1.1;
  color: var(--text);
  margin-bottom: .4rem;
}
.page-title em {
  font-style: italic;
  color: var(--accent);
  font-weight: 300;
}

.page-sub {
  font-size: .78rem;
  color: var(--dim);
  font-weight: 300;
  margin-bottom: 3rem;
}

/* ── Section labels ── */
.section-label {
  font-size: .55rem;
  font-weight: 700;
  letter-spacing: .3em;
  text-transform: uppercase;
  color: var(--dim);
  margin: 2.5rem 0 1rem;
  display: flex;
  align-items: center;
  gap: .9rem;
}
.section-label::before {
  content: '';
  display: block;
  width: 16px;
  height: 1px;
  background: rgba(88,166,255,.3);
  flex-shrink: 0;
}
.section-label::after {
  content: '';
  flex: 1;
  height: 1px;
  background: rgba(255,255,255,.05);
}

/* ── Module cards (landing page) ── */
.module-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 14px;
}

.module-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem 1.25rem;
  text-decoration: none;
  display: flex;
  flex-direction: column;
  gap: .85rem;
  transition: border-color .2s, background .2s, transform .18s;
  position: relative;
  overflow: hidden;
  cursor: pointer;
}
.module-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: var(--card-accent, var(--accent));
  opacity: 0;
  transition: opacity .2s;
}
.module-card:hover {
  border-color: var(--card-accent-dim, var(--accent-dim));
  background: var(--surface2);
  transform: translateY(-2px);
  text-decoration: none;
}
.module-card:hover::before { opacity: 1; }

.module-icon {
  width: 40px;
  height: 40px;
  border-radius: 9px;
  background: var(--card-accent-bg, var(--accent-bg));
  border: 1px solid var(--card-accent-dim, var(--accent-dim));
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.module-icon svg {
  width: 18px;
  height: 18px;
  stroke: var(--card-accent, var(--accent));
  fill: none;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.module-label {
  font-size: .52rem;
  font-weight: 700;
  letter-spacing: .2em;
  text-transform: uppercase;
  color: var(--card-accent, var(--accent));
  opacity: .75;
}
.module-title {
  font-size: 1.25rem;
  font-weight: 400;
  color: var(--text);
  letter-spacing: -.015em;
  line-height: 1.2;
  margin-top: -.3rem;
}
.module-desc {
  font-size: .75rem;
  color: var(--muted);
  line-height: 1.65;
  font-weight: 300;
  flex: 1;
}
.module-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: .85rem;
  border-top: 1px solid rgba(255,255,255,.05);
}
.module-url {
  font-size: .58rem;
  color: var(--dim);
  font-family: monospace;
  letter-spacing: .02em;
}
.module-arrow {
  font-size: .8rem;
  color: var(--card-accent, var(--accent));
  opacity: .45;
  transition: opacity .2s, transform .2s;
}
.module-card:hover .module-arrow { opacity: 1; transform: translateX(3px); }

/* ── Stat strip ── */
.stat-strip {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 10px;
  margin-bottom: 1.75rem;
}
.stat-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
  text-align: center;
}
.stat-val {
  font-size: 1.65rem;
  font-weight: 700;
  color: var(--accent);
  letter-spacing: -.03em;
  line-height: 1;
}
.stat-lbl {
  font-size: .65rem;
  color: var(--muted);
  margin-top: .3rem;
  text-transform: uppercase;
  letter-spacing: .06em;
}

/* ── Inner cards ── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  margin-bottom: 1rem;
}
.card-hdr {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
  flex-wrap: wrap;
  gap: .5rem;
}
.card-title {
  font-size: .6rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: var(--muted);
}

/* ── Tables ── */
.tbl-wrap { overflow: hidden; border-radius: var(--radius); border: 1px solid var(--border); }
table { width: 100%; border-collapse: collapse; }
th {
  padding: .55rem 1rem;
  text-align: left;
  font-size: .65rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--muted);
  border-bottom: 1px solid var(--border);
  background: var(--bg);
}
td {
  padding: .65rem 1rem;
  border-bottom: 1px solid var(--border);
  font-size: .83rem;
}
tr:last-child td { border-bottom: none; }
tr:hover td { background: #1c2128; }

/* ── Forms ── */
.form-row { display: flex; gap: .65rem; flex-wrap: wrap; margin-bottom: .75rem; }
input, select {
  background: #1c2128;
  border: 1px solid var(--border);
  color: var(--text);
  padding: .5rem .75rem;
  border-radius: 7px;
  font-size: 13px;
  outline: none;
  flex: 1;
  min-width: 120px;
  transition: border-color .15s;
}
input:focus, select:focus { border-color: var(--accent); }

/* ── Buttons ── */
.btn {
  padding: .45rem .9rem;
  border-radius: 7px;
  border: none;
  cursor: pointer;
  font-size: .8rem;
  font-weight: 500;
  transition: opacity .15s;
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  white-space: nowrap;
}
.btn-primary { background: var(--accent); color: #000; font-weight: 600; }
.btn-danger  { background: var(--danger); color: #fff; }
.btn-ghost   { background: transparent; border: 1px solid var(--border); color: var(--text); }
.btn-warn    { background: #2d2a0a; color: var(--warn); border: 1px solid #3d3a0a; }
.btn:hover { opacity: .82; }
.btn:disabled { opacity: .35; cursor: default; }

/* ── Badges ── */
.badge {
  display: inline-block;
  padding: .15rem .5rem;
  border-radius: 4px;
  font-size: .65rem;
  font-weight: 600;
}
.badge-green { background: #1a3a1a; color: var(--success); }
.badge-red   { background: #3a1a1a; color: var(--danger); }
.badge-blue  { background: #1a2e44; color: #79c0ff; }
.badge-muted { background: #1c2128; color: var(--muted); }
.badge-warn  { background: #2d2a0a; color: var(--warn); }

/* ── Code snippet box ── */
.snip {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 7px;
  padding: .75rem 1rem;
  font-family: 'SFMono-Regular', Consolas, monospace;
  font-size: 12px;
  word-break: break-all;
  position: relative;
}
.snip .copy-btn {
  position: absolute;
  top: .5rem; right: .5rem;
  padding: .2rem .5rem;
  font-size: .65rem;
  background: #1c2128;
  color: var(--muted);
  border: 1px solid var(--border);
  border-radius: 4px;
  cursor: pointer;
}
.snip .copy-btn:hover { color: var(--text); }

/* ── Status dots ── */
.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
  display: inline-block;
}
.dot-green  { background: #3fb950; box-shadow: 0 0 5px rgba(63,185,80,.5); }
.dot-yellow { background: var(--warn); box-shadow: 0 0 5px rgba(210,153,34,.4); }
.dot-red    { background: var(--danger); box-shadow: 0 0 5px rgba(248,81,73,.4); }

/* ── Footer ── */
.dash-footer {
  border-top: 1px solid var(--border);
  padding: 1.1rem 2.5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: .58rem;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--dim);
  flex-shrink: 0;
  position: relative;
  z-index: 1;
}
.dash-footer a { color: var(--dim); text-decoration: none; }
.dash-footer a:hover { color: var(--muted); }

/* ── Toast ── */
#toast {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: .65rem 1.1rem;
  font-size: .83rem;
  opacity: 0;
  transition: opacity .2s;
  pointer-events: none;
  z-index: 9999;
}
#toast.show { opacity: 1; }

/* ── Upgrade box ── */
.upgrade-box {
  background: #1a2e44;
  border: 1px solid #1f4166;
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}
.upgrade-box p { color: #79c0ff; flex: 1; font-size: .83rem; }

/* ── Responsive ── */
@media (max-width: 900px) {
  .dash-header { padding: 0 1.25rem; }
  .dash-page   { padding: 2rem 1.25rem 4rem; }
  .module-grid { grid-template-columns: 1fr 1fr; }
  .dash-footer { padding: 1rem 1.25rem; flex-direction: column; gap: .4rem; }
}
@media (max-width: 520px) {
  .module-grid { grid-template-columns: 1fr; }
}
