/* GoClub app shell — the wide, navigable layout the captive portal never needed.
   Built on tokens.css so it reads as the same product; component blocks marked
   "from the portal" are copied byte-for-byte to keep that true. */

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }

body {
  font-family: 'Nunito', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
}

a { color: var(--magenta-600); }

/* ---------- Shell ---------- */

.app {
  display: grid;
  grid-template-columns: 264px 1fr;
  grid-template-rows: auto 1fr;
  grid-template-areas:
    "nav header"
    "nav main";
  min-height: 100dvh;
}

.app-nav {
  grid-area: nav;
  position: relative;
  /* The same gradient the portal paints in .page:before — reusing it is what makes
     these apps read as one family rather than two products. */
  background: linear-gradient(180deg, var(--navy-800), var(--navy-900));
  color: #fff;
  padding: 22px 18px;
  display: flex;
  flex-direction: column;
  gap: 26px;
}

.app-nav .brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 900;
  font-size: 17px;
  letter-spacing: -0.01em;
}
.app-nav .brand img { width: 34px; height: 34px; }

.app-nav .nav-group { display: flex; flex-direction: column; gap: 2px; }
.app-nav .nav-label {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.45);
  padding: 0 12px 6px;
}

.app-nav a.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  color: rgba(255, 255, 255, 0.78);
  text-decoration: none;
  font-size: 14.5px;
  font-weight: 700;
  transition: background 0.15s ease, color 0.15s ease;
}
.app-nav a.nav-item:hover { background: rgba(255, 255, 255, 0.08); color: #fff; }
.app-nav a.nav-item.active { background: var(--magenta-600); color: #fff; }
.app-nav .nav-item .ico { width: 18px; text-align: center; flex: 0 0 18px; }

.app-nav .nav-foot { margin-top: auto; font-size: 12px; color: rgba(255, 255, 255, 0.4); }

.app-header {
  grid-area: header;
  background: var(--bg-card);
  border-bottom: 1px solid var(--line);
  padding: 0 32px;
  height: 68px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.app-header h1 { font-size: 19px; font-weight: 900; margin: 0; letter-spacing: -0.01em; }
.app-header .sub { font-size: 13px; color: var(--ink-muted); margin: 2px 0 0; }

.app-user { display: flex; align-items: center; gap: 10px; font-size: 13.5px; }
.app-user .avatar {
  width: 34px; height: 34px; border-radius: 50%;
  background: var(--magenta-100); color: var(--magenta-700);
  display: flex; align-items: center; justify-content: center;
  font-weight: 900; font-size: 13px;
}
.app-user .who { font-weight: 800; }
.app-user .role { color: var(--ink-muted); font-size: 12px; }
.app-user form { margin: 0; }
.app-user button {
  background: none; border: 0; padding: 6px 8px; cursor: pointer;
  font-family: inherit; font-size: 13px; font-weight: 700;
  color: var(--magenta-600); text-decoration: underline;
}

.app-main { grid-area: main; padding: 26px 32px 44px; }

/* ---------- Card — copied from the portal stylesheet ---------- */

.card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  overflow: hidden;
}
.card-header { padding: 20px 24px 0; }
.card-header h2 { font-size: 17px; font-weight: 900; margin: 0 0 4px; }
.card-header p { font-size: 13.5px; color: var(--ink-muted); margin: 0; }
.card-body { padding: 20px 24px; }
.card-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--line);
  background: #FAFAFC;
}

.grid { display: grid; gap: 18px; }
.grid.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid.cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }

/* ---------- Stat tiles ---------- */

.stat {
  background: var(--bg-card);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-card);
  padding: 18px 20px;
}
.stat .stat-label {
  display: block;
  font-size: 11.5px; font-weight: 800;
  letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--ink-muted); margin-bottom: 8px;
}
.stat .stat-value {
  display: block;
  font-size: 30px; font-weight: 900;
  line-height: 1; letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}
.stat .stat-note { display: block; margin-top: 7px; font-size: 12.5px; color: var(--ink-muted); }
.stat .stat-note.up { color: var(--success); font-weight: 700; }
.stat .stat-note.down { color: var(--error); font-weight: 700; }

/* ---------- Tables ---------- */

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

.data-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.data-table th {
  position: sticky; top: 0;
  background: #FAFAFC;
  text-align: left;
  font-size: 11.5px; font-weight: 800;
  letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--ink-muted);
  padding: 11px 14px;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
.data-table td {
  padding: 13px 14px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}
.data-table tbody tr:last-child td { border-bottom: 0; }
.data-table tbody tr:hover { background: #FCFBFD; }
.data-table .num { text-align: right; font-variant-numeric: tabular-nums; }
.data-table .muted { color: var(--ink-muted); }
/* Masked identifiers stay monospaced so the mask lines up down the column. */
.data-table .masked { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13px; }

/* ---------- Pills ---------- */

.pill {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 10px; border-radius: 999px;
  font-size: 12px; font-weight: 800;
  background: var(--magenta-100); color: var(--magenta-700);
  white-space: nowrap;
}
.pill.teal { background: #DEFAF5; color: var(--teal-600); }
.pill.navy { background: #E7ECF5; color: var(--navy-700); }
.pill.grey { background: #EFF1F6; color: var(--ink-muted); }
.pill.good { background: #ECFDF5; color: var(--success); }
.pill.bad  { background: #FEF2F2; color: var(--error); }

/* ---------- Toolbar ---------- */

.toolbar {
  display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px;
  margin-bottom: 18px;
}
.toolbar .grow { flex: 1 1 220px; }
.toolbar label {
  display: block;
  font-size: 12px; font-weight: 800;
  color: var(--ink-muted); margin-bottom: 5px;
}

/* ---------- Inputs — copied from the portal stylesheet ---------- */

.text-input, .select-input {
  width: 100%;
  padding: 11px 13px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 14.5px;
  color: var(--ink);
  background: #fff;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.text-input:focus, .select-input:focus {
  outline: none;
  border-color: var(--magenta-500);
  box-shadow: 0 0 0 3px var(--magenta-100);
}

.field { margin-bottom: 16px; }
.field label.fl { display: block; font-size: 13.5px; font-weight: 800; margin-bottom: 6px; }
.field .hint { display: block; margin-top: 6px; font-size: 12.5px; color: var(--ink-muted); }
.error-msg { display: none; margin-top: 6px; font-size: 12.5px; color: var(--error); font-weight: 700; }
.field.has-error .text-input { border-color: var(--error); }
.field.has-error .error-msg { display: block; }

/* ---------- Buttons — copied from the portal stylesheet ---------- */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 11px 20px;
  border: 0; border-radius: var(--radius-md);
  font-family: inherit; font-size: 14.5px; font-weight: 800;
  cursor: pointer; text-decoration: none;
  transition: filter 0.15s ease, transform 0.15s ease;
}
.btn:active { transform: translateY(1px); }
.btn[disabled] { opacity: 0.5; cursor: default; }

.btn-primary {
  background: var(--magenta-600); color: #fff;
  box-shadow: 0 8px 18px -6px rgba(185, 28, 146, 0.55);
}
.btn-primary:hover:not([disabled]) { filter: brightness(1.05); }

.btn-secondary {
  background: #fff; color: var(--ink);
  border: 1px solid var(--line-strong);
}
.btn-secondary:hover:not([disabled]) { background: #FAFAFC; }

.btn-sm { padding: 7px 13px; font-size: 13px; }

/* ---------- Pagination ---------- */

.pagination {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; font-size: 13.5px; color: var(--ink-muted);
}
.pagination .pages { display: flex; gap: 6px; }
.pagination a, .pagination span.current {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 32px; height: 32px; padding: 0 8px;
  border-radius: var(--radius-sm);
  text-decoration: none; font-weight: 700;
  border: 1px solid var(--line-strong); color: var(--ink);
}
.pagination span.current { background: var(--magenta-600); border-color: var(--magenta-600); color: #fff; }

/* ---------- Flash — result of the member's last action ---------- */

.flash {
  margin: 0 0 18px;
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  font-weight: 700;
}
.flash.good { background: #ECFDF5; color: var(--success); }
.flash.bad  { background: #FEF2F2; color: var(--error); }

/* ---------- Empty state ---------- */

.empty-state { padding: 44px 24px; text-align: center; color: var(--ink-muted); }
.empty-state .ico { font-size: 30px; display: block; margin-bottom: 10px; opacity: 0.5; }
.empty-state h3 { margin: 0 0 6px; font-size: 15.5px; font-weight: 800; color: var(--ink); }
.empty-state p { margin: 0; font-size: 13.5px; }

/* ---------- Section heading ---------- */

.section-head {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: 12px; margin: 0 0 14px;
}
.section-head h2 { font-size: 16px; font-weight: 900; margin: 0; }
.eyebrow {
  font-size: 11.5px; font-weight: 800;
  letter-spacing: 0.09em; text-transform: uppercase;
  color: var(--magenta-700);
}
.footnote { font-size: 12.5px; color: var(--ink-muted); }

/* ---------- Responsive ---------- */

@media (max-width: 900px) {
  .grid.cols-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid.cols-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* ---------- Mobile menu ---------- */

/* The toggle and backdrop exist only below the breakpoint. */
.nav-toggle, .nav-backdrop, .nav-close { display: none; }

@media (max-width: 768px) {
  /* The sidebar becomes a drawer rather than a scrolling strip: a strip pushes items
     off-screen with nothing to say they are there. */
  .app {
    grid-template-columns: 1fr;
    grid-template-areas: "header" "main";
  }

  .app-nav {
    position: fixed;
    inset: 0 auto 0 0;
    width: min(82vw, 300px);
    z-index: 60;
    transform: translateX(-100%);
    transition: transform 0.22s ease;
    overflow-y: auto;
    padding-top: 18px;
  }
  .app.nav-open .app-nav { transform: translateX(0); }

  .nav-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 50;
    background: rgba(18, 30, 51, 0.5);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.22s ease;
    border: 0;
    padding: 0;
  }
  .app.nav-open .nav-backdrop { opacity: 1; pointer-events: auto; }

  /* Hamburger, sitting in the header where a thumb can reach it. */
  .nav-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 42px; height: 42px;
    flex: 0 0 42px;
    margin-right: 12px;
    border: 1px solid var(--line-strong);
    border-radius: var(--radius-sm);
    background: #fff;
    cursor: pointer;
    color: var(--ink);
  }
  .nav-toggle .bars {
    display: block;
    width: 18px; height: 2px;
    background: currentColor;
    border-radius: 2px;
    position: relative;
  }
  .nav-toggle .bars::before,
  .nav-toggle .bars::after {
    content: "";
    position: absolute;
    left: 0;
    width: 18px; height: 2px;
    background: currentColor;
    border-radius: 2px;
  }
  .nav-toggle .bars::before { top: -6px; }
  .nav-toggle .bars::after { top: 6px; }

  /* Close control inside the drawer, so the menu can be dismissed from within it. */
  .nav-close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    position: absolute;
    top: 14px; right: 14px;
    width: 34px; height: 34px;
    border: 0;
    border-radius: var(--radius-sm);
    background: rgba(255, 255, 255, 0.12);
    color: #fff;
    font-size: 19px;
    line-height: 1;
    cursor: pointer;
  }

  .app-header {
    padding: 12px 16px;
    height: auto;
    min-height: 60px;
    align-items: flex-start;
  }
  .app-header > div:first-child { display: flex; align-items: center; flex: 1; min-width: 0; }
  .app-header h1 { font-size: 17px; }
  .app-header .sub { display: none; }

  .app-user .who, .app-user .role { display: none; }

  .app-main { padding: 18px 16px 32px; }
  .grid.cols-2, .grid.cols-3, .grid.cols-4 { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  .app-nav, .nav-backdrop { transition: none; }
}

@media (prefers-reduced-motion: reduce) {
  .btn, .app-nav a.nav-item, .text-input { transition: none; }
}

/* ---------- Definition list, used for profile details ---------- */

.detail-list { margin: 0; }
.detail-list > div {
  display: grid;
  grid-template-columns: 180px 1fr;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}
.detail-list > div:last-child { border-bottom: 0; }
.detail-list dt { font-size: 13.5px; font-weight: 800; color: var(--ink-muted); margin: 0; }
.detail-list dd {
  margin: 0;
  font-size: 14.5px;
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
}
.detail-list dd.masked { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }

@media (max-width: 560px) {
  /* Label above value: 180px of label leaves too little for the value on a phone. */
  .detail-list > div { grid-template-columns: 1fr; gap: 4px; }
}

/* ---------- Voucher cards ---------- */

.voucher h3 { margin: 8px 0 6px; font-size: 16.5px; font-weight: 900; }
.voucher p { margin: 0 0 16px; font-size: 13.5px; color: var(--ink-muted); }
.voucher.spent { opacity: 0.6; }

.voucher-foot {
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px; flex-wrap: wrap;
}
.voucher-foot code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12.5px;
  background: #F1F5F9;
  padding: 3px 8px;
  border-radius: var(--radius-sm);
  color: var(--ink-muted);
}
