/* Web pages for customers, on top of the admin panel's styles.css: the same look, plus what only they need. */

/* No window controls in a browser, so the top strip needs no room for them. */
.topbar { padding: 0 28px; -webkit-app-region: no-drag; }
.brand { -webkit-app-region: no-drag; }

.err { color: var(--bad); font-size: 12.5px; }
.err:empty { display: none; }
.info { font-size: 12.5px; color: var(--muted); display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.info:empty { display: none; }
.info.bad { color: var(--bad); }
.stack { display: flex; flex-direction: column; gap: 14px; }
.form-card { max-width: 640px; display: flex; flex-direction: column; gap: 14px; padding: 20px 22px; }
.wide-btn { width: 100%; height: 40px; font-size: 14px; }
.who { display: flex; align-items: center; gap: 9px; padding: 8px 10px; border-radius: var(--radius-sm); background: var(--input); font-size: 12.5px; overflow: hidden; }
.who b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.who svg { width: 15px; height: 15px; color: var(--muted); }

/* Buy */
.price { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; padding: 12px 14px; border-radius: var(--radius-sm); background: var(--input); border: 1px solid var(--line); color: var(--muted); }
.price b { font-size: 18px; color: var(--text); font-variant-numeric: tabular-nums; text-align: right; }
.nets { display: flex; gap: 8px; }
.nets label { flex: 1; flex-direction: row; align-items: center; justify-content: center; gap: 8px; height: 38px; border: 1px solid var(--line); border-radius: var(--radius-sm); cursor: pointer; color: var(--text); font-size: 13px; }
.nets input { width: auto; height: auto; margin: 0; accent-color: var(--accent); }
.nets label:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.pay-row { display: flex; flex-direction: column; gap: 6px; color: var(--muted); font-size: 12px; font-weight: 500; }
.pending-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }

/* Payment */
.inv-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.inv-head b { font-family: "Cascadia Code", Consolas, monospace; font-size: 15px; letter-spacing: .5px; }
.countdown { font-family: "Cascadia Code", Consolas, monospace; font-weight: 700; color: var(--warn); font-size: 15px; }
.copy { display: flex; gap: 8px; align-items: center; padding: 9px 12px; border-radius: var(--radius-sm); background: var(--input); border: 1px solid var(--line); }
.copy code { flex: 1; font-family: "Cascadia Code", Consolas, monospace; font-size: 13.5px; color: var(--text); word-break: break-all; }
.qr { display: flex; flex-direction: column; align-items: center; gap: 8px; }
.qr-img { width: 200px; max-width: 70vw; border-radius: 10px; overflow: hidden; line-height: 0; }
.qr-img svg { width: 100%; height: auto; display: block; }
.qr .info { text-align: center; justify-content: center; }
.result { text-align: center; display: flex; flex-direction: column; gap: 10px; }
.result .ok { color: var(--ok); font-weight: 650; font-size: 15px; }
.result .bad { color: var(--bad); font-weight: 650; }
.key-out { font: 700 20px "Cascadia Code", Consolas, monospace; letter-spacing: .5px; word-break: break-all; white-space: pre-line; padding: 12px; border-radius: var(--radius-sm); background: var(--input); border: 1px dashed var(--accent); color: var(--accent); }
.key-out.many { font-size: 15px; line-height: 1.7; max-height: 260px; overflow-y: auto; }

/* Redeem */
.order-no { display: inline-block; border-radius: var(--radius-sm); }
.done-panel .btn-row { margin-top: 6px; }

/* Lists */
.key-list td:last-child, .inv-list td:last-child { text-align: right; }
.key-list .pkg-info { flex-wrap: nowrap; }
.dash-row { flex-wrap: wrap; }
.dash-row .dash-name { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; white-space: normal; }
.dash-row .key-cell { font-size: 12.5px; }
.dash-end { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.member .dash-kpis { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.member .dash-grid { grid-template-columns: repeat(auto-fit, minmax(min(340px, 100%), 1fr)); }
.member .view-head h1 { font-size: 22px; }

/* Public pages (log in, redeem): one card in the middle. */
body.public { display: block; overflow: auto; }
.public-wrap { min-height: 100%; display: grid; grid-template-columns: minmax(0, 1fr); place-items: center; padding: 32px 16px; }
.public-card { width: 440px; }
.public-card.wide { width: 580px; }
.public-head { display: flex; align-items: center; gap: 11px; }
.public-head .brand-text { flex: 1; min-width: 0; }
.public-tools { display: flex; gap: 6px; }
.public-tools .theme-select select { width: 150px; }
/* The narrow log in card puts the language and theme pickers on a row of their own. */
.public-card:not(.wide) .public-head { flex-wrap: wrap; }
.public-card:not(.wide) .public-tools { width: 100%; }
.public-card:not(.wide) .public-tools .theme-select { flex: 1; }
.public-card:not(.wide) .public-tools .theme-select select { width: 100%; }
.public-card h1 { margin: 10px 0 0; }
.public-card .tabs { align-self: stretch; display: flex; }
.public-card .tabs .tab { flex: 1; }
.public-links { display: flex; justify-content: center; gap: 6px; font-size: 13px; color: var(--muted); padding-top: 4px; }
.public-links a { color: var(--accent); text-decoration: none; font-weight: 600; }
.public-links a:hover { text-decoration: underline; }

/* Mobile top bar and the menu drawer's backdrop; only shown on small screens. */
.mobile-bar, .scrim { display: none; }
.mobile-bar {
  position: sticky; top: 0; z-index: 40; height: 56px; align-items: center; gap: 10px; padding: 0 12px;
  padding-top: env(safe-area-inset-top); background: var(--panel); border-bottom: 1px solid var(--line);
}
.mobile-bar .logo { width: 30px; height: 30px; }
.mobile-title { flex: 1; min-width: 0; font-weight: 650; font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.icon-btn { width: 40px; height: 40px; padding: 0; flex-shrink: 0; }
.icon-btn svg { width: 20px; height: 20px; }

/* Laptops and tablets: fewer columns. */
@media (max-width: 1100px) {
  .member .dash-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* Tablets and phones: the sidebar slides in as a drawer from the ☰ button; the page scrolls as a whole. */
@media (max-width: 900px) {
  body.member { display: block; overflow: auto; height: auto; min-height: 100%; }
  .member .mobile-bar { display: flex; }
  .member .sidebar {
    position: fixed; inset: 0 auto 0 0; z-index: 60; width: min(280px, 86vw);
    transform: translateX(-100%); transition: transform .22s var(--ease); box-shadow: var(--shadow);
    padding-bottom: max(12px, env(safe-area-inset-bottom));
  }
  .member .nav-list { flex: 1; }
  .member.menu-open .sidebar { transform: none; }
  .member .scrim { display: block; position: fixed; inset: 0; z-index: 50; background: color-mix(in srgb, #000 50%, transparent); opacity: 0; pointer-events: none; transition: opacity .22s var(--ease); }
  .member.menu-open .scrim { opacity: 1; pointer-events: auto; }
  .member.menu-open { overflow: hidden; }
  .member main { overflow: visible; }
  .member .topbar { display: none; }
  .member .view { padding: 18px 16px 28px; overflow: visible; }
  .member .nav { padding: 11px 12px; }

  /* Bigger touch targets; 16px text keeps phones from zooming in on a focused field. */
  input, select, textarea { height: 42px; font-size: 16px; }
  .loc-parts input { height: 42px; font-size: 16px; }
  .theme-select select { height: 40px; font-size: 14px; }
  button { height: 40px; }
  button.sm { height: 34px; padding: 0 12px; font-size: 13px; }
  .key-input { height: 50px; }
}

/* Phones */
@media (max-width: 640px) {
  .member .view-head { align-items: stretch; }
  .member .head-actions { width: 100%; }
  .member .head-actions button { flex: 1; }
  .form-card { padding: 16px; }
  .nets { flex-direction: column; }
  .nets label { flex: none; height: 44px; }
  .price { flex-direction: column; align-items: flex-start; gap: 4px; }
  .price b { text-align: left; }
  .copy code { font-size: 13px; }
  .stat-value { font-size: 22px; }
  .stat { padding: 12px 14px; }
  .dash-kpis { gap: 10px; }
  .loc-parts { grid-template-columns: repeat(3, 1fr); }
  .loc-parts > div:nth-child(-n + 2) { grid-column: 1 / -1; }
  .row2 { grid-template-columns: 1fr; }

  /* Tables become one card per row, each value with its column name. */
  .table-wrap table, .table-wrap tbody, .table-wrap tr, .table-wrap td { display: block; }
  .table-wrap thead { display: none; }
  .table-wrap tr { padding: 12px 14px; border-bottom: 1px solid var(--line); cursor: default; }
  .table-wrap tbody tr:last-child { border-bottom: 0; }
  .table-wrap td { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 4px 0; border: 0; white-space: normal; text-align: right; }
  .table-wrap td::before { content: attr(data-label); color: var(--subtle); font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .5px; text-align: left; flex-shrink: 0; }
  .table-wrap td:first-child { font-size: 14px; padding-bottom: 8px; }
  .table-wrap td:first-child::before, .table-wrap td:last-child::before { content: none; }
  .table-wrap td:last-child:empty { display: none; }
  .table-wrap td:last-child { padding-top: 8px; }
  .table-wrap td:last-child button { width: 100%; }
  .table-wrap .pkg-info { flex-wrap: wrap; justify-content: flex-end; }

  /* Public pages fill the screen instead of floating as a card. */
  .public-wrap { padding: 0; place-items: stretch; }
  .public-card, .public-card.wide { width: 100%; min-height: 100vh; border: 0; border-radius: 0; box-shadow: none; padding: 20px 16px max(24px, env(safe-area-inset-bottom)); }
  .public-head { flex-wrap: wrap; }
  .public-tools { width: 100%; }
  .public-tools .theme-select { flex: 1; }
  .public-tools .theme-select select { width: 100%; }
}
