/* Customer dashboard. Layered on top of site.css - mobile first. */

.acct-top {
  display: flex; align-items: center; gap: 1rem;
  padding: .75rem 1rem; border-bottom: 1px solid var(--line);
  background: #fff; position: sticky; top: 0; z-index: 40;
}
.acct-top__brand { display: flex; align-items: center; }
.acct-top__brand img { display: block; height: 68px; width: auto; max-width: 100%; }
.acct-top__out { margin-left: auto; font-size: .85rem; font-weight: 600; }

.acct-burger {
  margin-left: auto; width: 42px; height: 38px; display: grid; gap: 5px;
  align-content: center; justify-items: center;
  background: none; border: 1px solid var(--line); border-radius: 9px; cursor: pointer;
}
.acct-burger span { width: 18px; height: 2px; background: var(--ink); border-radius: 2px; }

.acct { max-width: 1120px; margin-inline: auto; padding: 1rem; }

/* Mobile: the nav is an overlay drawer that slides down UNDER the header.
   Because it is fixed it is out of flow, so opening it never pushes the page
   content down - the content simply sits underneath. */
.acct-nav {
  position: fixed;
  top: var(--acct-top-h, 56px);
  left: 0; right: 0;
  z-index: 60;
  max-height: calc(100vh - var(--acct-top-h, 56px));
  max-height: calc(100dvh - var(--acct-top-h, 56px));
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: .5rem 1rem 1.1rem;
  background: #fff;
  border-bottom: 1px solid var(--line);
  box-shadow: 0 14px 30px rgba(11, 11, 13, .12);

  opacity: 0;
  visibility: hidden;
  transform: translateY(-10px);
  transition: transform .2s ease, opacity .2s ease, visibility .2s;
}
.acct-nav.is-open { opacity: 1; visibility: visible; transform: none; }

.acct-backdrop {
  position: fixed;
  inset: var(--acct-top-h, 56px) 0 0 0;
  z-index: 50;
  background: rgba(11, 11, 13, .38);
  animation: acct-fade .2s ease;
}
@keyframes acct-fade { from { opacity: 0; } to { opacity: 1; } }

/* Freeze the page behind the open drawer. */
body.acct-locked { overflow: hidden; }

@media (prefers-reduced-motion: reduce) {
  .acct-nav { transition: none; }
  .acct-backdrop { animation: none; }
}
.acct-nav__biz {
  font-size: .68rem; letter-spacing: .12em; text-transform: uppercase;
  color: var(--ink-3); padding: .5rem .25rem .75rem;
}
.acct-nav__link {
  display: block; padding: .7rem .85rem; border-radius: 10px;
  font-size: .92rem; font-weight: 500; color: var(--ink-2); text-decoration: none;
}
.acct-nav__link:hover { background: var(--paper); color: var(--ink); }
.acct-nav__link.is-on { background: var(--red); color: #fff; font-weight: 600; }

.acct-main { min-width: 0; }
.acct-h1 { font-size: 1.5rem; font-weight: 800; letter-spacing: -.02em; margin-bottom: .35rem; }

.acct-grid {
  display: grid; grid-template-columns: repeat(2, 1fr); gap: .75rem; margin-top: 1.5rem;
}
.acct-card {
  padding: 1rem; border: 1px solid var(--line); border-radius: 14px; background: #fff;
  display: flex; flex-direction: column; gap: .4rem; min-width: 0;
}
.acct-card__k { font-size: .68rem; letter-spacing: .1em; text-transform: uppercase; color: var(--ink-3); }
.acct-card__v { font-size: 1.15rem; font-weight: 700; overflow-wrap: anywhere; }

.acct-panel {
  margin-top: 1.5rem; padding: 1.25rem; border: 1px solid var(--line);
  border-radius: 14px; background: #fff;
}
.acct-panel__lbl {
  font-size: .68rem; letter-spacing: .12em; text-transform: uppercase;
  color: var(--red); font-weight: 700; margin-bottom: .85rem;
}
.acct-row {
  display: flex; gap: 12px; padding: .6rem 0; border-top: 1px solid var(--line); font-size: .92rem;
}
.acct-row:first-of-type { border-top: 0; }
.acct-row > span { flex: 0 0 40%; color: var(--ink-3); }
.acct-row > b { flex: 1; min-width: 0; overflow-wrap: anywhere; font-weight: 600; }

.acct-list { margin: 0; padding-left: 1.1rem; list-style: disc; }
.acct-list li { padding: .2rem 0; font-size: .92rem; }

.acct-link a { font-weight: 700; overflow-wrap: anywhere; }
.acct-actions { display: flex; flex-wrap: wrap; gap: .6rem; margin-top: 1.5rem; }
.acct-form .acct-panel:first-of-type { margin-top: 1.5rem; }

.pill {
  display: inline-block; padding: .2rem .6rem; border-radius: 999px;
  font-size: .7rem; font-weight: 700; letter-spacing: .04em;
}
.pill--ok   { background: rgba(18,140,74,.12); color: var(--green, #128c4a); }
.pill--warn { background: rgba(233,71,18,.12); color: #b8410f; }

.swatch {
  display: inline-block; width: 14px; height: 14px; border-radius: 4px;
  border: 1px solid rgba(0,0,0,.15); vertical-align: -2px; margin-right: .35rem;
}
.swatch-lg {
  width: 72px; height: 72px; border-radius: 14px; display: grid; place-items: center;
  font-weight: 800; font-size: 1.4rem; border: 1px solid rgba(0,0,0,.1);
}

.colorpick { display: flex; align-items: center; gap: .75rem; }
.colorpick input[type="color"] {
  width: 62px; height: 46px; padding: 0; border: 1px solid var(--line);
  border-radius: 10px; background: none; cursor: pointer;
}
.colorpick input[type="text"] {
  flex: 1; max-width: 160px; font-family: ui-monospace, monospace;
  padding: .7rem .8rem; border: 1px solid var(--line); border-radius: 10px;
}

/* ---------------------------------------------------------------- designs */
.design-grid {
  display: grid; grid-template-columns: 1fr; gap: 1rem; margin-top: 1.5rem;
}
.design {
  border: 1px solid var(--line); border-radius: 14px; padding: 1rem; background: #fff;
}
.design.is-on { border-color: var(--red); box-shadow: 0 0 0 3px rgba(200,16,46,.08); }
.design__thumb {
  position: relative; height: 120px; border-radius: 10px; overflow: hidden;
  border: 1px solid rgba(0,0,0,.08); margin-bottom: .85rem;
}
.design__bar { position: absolute; inset: 0 0 auto 0; height: 34px; }
.design__dot {
  position: absolute; top: 20px; left: 14px; width: 30px; height: 30px;
  border-radius: 9px; border: 2px solid #fff;
}
.design__l1, .design__l2 {
  position: absolute; left: 14px; height: 7px; border-radius: 4px; background: rgba(0,0,0,.10);
}
.design__l1 { top: 64px; width: 60%; }
.design__l2 { top: 78px; width: 42%; }
.design__name { font-weight: 700; display: flex; align-items: center; gap: .5rem; }
.design__desc { font-size: .85rem; color: var(--ink-3); margin: .35rem 0 .9rem; line-height: 1.5; }
.design__act { display: flex; gap: .5rem; flex-wrap: wrap; }

/* ---------------------------------------------------------------- preview */
.preview-wrap { display: flex; justify-content: center; margin-top: 1.5rem; }
.preview-frame { width: 100%; height: 100%; border: 0; display: block; }

/* ----------------------------------------------------------------- table */
.acct-table-wrap { margin-top: 1.5rem; overflow-x: auto; -webkit-overflow-scrolling: touch; }
.acct-table { width: 100%; border-collapse: collapse; font-size: .9rem; min-width: 520px; }
.acct-table th {
  text-align: left; font-size: .68rem; letter-spacing: .1em; text-transform: uppercase;
  color: var(--ink-3); padding: .6rem .75rem; border-bottom: 2px solid var(--line);
}
.acct-table td { padding: .8rem .75rem; border-bottom: 1px solid var(--line); }
.acct-table .num { text-align: right; }
.mono { font-family: ui-monospace, monospace; font-size: .85em; }

.alert--ok {
  background: rgba(18,140,74,.08); border: 1px solid rgba(18,140,74,.25);
  color: #0f6c39; padding: .85rem 1rem; border-radius: 12px; margin-top: 1.25rem;
}

/* Outstanding payment - same panel shape, warm tint so it reads first. */
.acct-due {
  background: rgba(233,71,18,.06);
  border-color: rgba(233,71,18,.3);
}
.acct-due__msg { font-size: .95rem; margin-bottom: 1rem; }

/* ------------------------------------------------------------- >= tablet */
@media (min-width: 800px) {
  .acct-burger { display: none; }
  .acct-backdrop { display: none; }
  .acct { display: grid; grid-template-columns: 232px 1fr; gap: 2rem; padding: 2rem 1.5rem; }

  /* Back to a normal in-flow sidebar - every drawer property is reset so a
     drawer left open on mobile cannot leak into the desktop layout. */
  .acct-nav {
    position: sticky; top: 84px; inset: auto; align-self: start;
    z-index: auto; max-height: none; overflow: visible;
    padding: 0; background: none; border-bottom: 0; box-shadow: none;
    opacity: 1; visibility: visible; transform: none; margin-bottom: 0;
  }
  body.acct-locked { overflow: auto; }
  .acct-grid { grid-template-columns: repeat(4, 1fr); }
  .design-grid { grid-template-columns: repeat(3, 1fr); }
  .acct-h1 { font-size: 1.9rem; }
}

/* ------------------------------------------------- gallery management --- */
/* Current gallery on Edit Card. Each thumbnail carries a small × so a single
   image - a duplicate, say - can be dropped without re-uploading the set.
   The × is the <label> for a real checkbox, so removal still submits with
   JavaScript disabled. */
.galmg {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(92px, 1fr));
  gap: .6rem;
  margin-top: .65rem;
}

.galmg__item {
  position: relative;
  display: block;
  cursor: pointer;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  overflow: hidden;
  background: var(--paper);
}

.galmg__img {
  display: block;
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;            /* photos, not marks - a square crop is fine */
  transition: opacity .16s ease, filter .16s ease;
}

/* The real control: reachable by keyboard, invisible on screen. */
.galmg__cb {
  position: absolute;
  width: 1px; height: 1px;
  margin: -1px; padding: 0; border: 0;
  overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%);
}

.galmg__x {
  position: absolute;
  top: 5px; right: 5px;
  width: 22px; height: 22px;
  display: grid;
  place-items: center;
  border-radius: var(--r-pill);
  background: rgba(11, 11, 13, .55);
  color: #fff;
  backdrop-filter: blur(2px);
  transition: background .16s ease, transform .16s ease;
}
.galmg__x svg {
  width: 13px; height: 13px;
  fill: none; stroke: currentColor; stroke-width: 2.4;
  stroke-linecap: round;
}
@media (hover: hover) {
  .galmg__item:hover .galmg__x { background: var(--red); transform: scale(1.08); }
}

/* Keyboard focus has to be visible even though the input itself is not. */
.galmg__cb:focus-visible ~ .galmg__x {
  outline: 2px solid var(--red);
  outline-offset: 2px;
  background: var(--red);
}

.galmg__flag {
  position: absolute;
  inset: auto 0 0 0;
  display: none;
  padding: .25rem .4rem;
  background: var(--red);
  color: #fff;
  font-size: .64rem;
  font-weight: 700;
  letter-spacing: .04em;
  text-align: center;
  text-transform: uppercase;
}

/* Marked for removal - obvious before the form is ever submitted. */
.galmg__item:has(.galmg__cb:checked),
.galmg__item.is-removing { border-color: var(--red); }

.galmg__item:has(.galmg__cb:checked) .galmg__img,
.galmg__item.is-removing .galmg__img { opacity: .3; filter: grayscale(1); }

.galmg__item:has(.galmg__cb:checked) .galmg__x,
.galmg__item.is-removing .galmg__x { background: var(--red); transform: rotate(90deg); }

.galmg__item:has(.galmg__cb:checked) .galmg__flag,
.galmg__item.is-removing .galmg__flag { display: block; }

@media (prefers-reduced-motion: reduce) {
  .galmg__img,
  .galmg__x { transition: none; }
  .galmg__item:has(.galmg__cb:checked) .galmg__x,
  .galmg__item.is-removing .galmg__x { transform: none; }
}

/* ------------------------------------------------------------- QR code --- */
/* Dashboard call-to-action. Sits directly under the status grid so the
   feature is visible on login without opening another menu. */
.qrcta {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}

.qrcta__icon {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  flex: none;
  border-radius: 12px;
  background: var(--red-soft);
  color: var(--red);
}

.qrcta__icon svg { width: 22px; height: 22px; }
.qrcta__body { flex: 1 1 14rem; min-width: 0; }
.qrcta__title { font-size: 1rem; font-weight: 700; letter-spacing: -.02em; }
.qrcta__go { flex: none; }

/* Locked (draft) state - visible, but visibly not yet available. */
.qrcta--locked .qrcta__icon { background: rgba(11,11,13,.06); color: var(--ink-3); }

@media (max-width: 560px) {
  .qrcta__go { width: 100%; justify-content: center; }
}

/* ------------------------------------------------------------ QR page --- */
.qrpanel {
  display: grid;
  gap: clamp(1.25rem, 4vw, 2rem);
  margin-top: 1.5rem;
  align-items: start;
}

@media (min-width: 780px) {
  .qrpanel { grid-template-columns: minmax(0, 260px) minmax(0, 1fr); }
}

.qrpanel__code {
  padding: 1.1rem;
  border: 1px solid var(--line);
  border-radius: var(--r-md, 16px);
  background: #fff;
}

/* Fixed square: the QR is injected after load, so reserving the box keeps
   the layout from shifting. */
.qrbox {
  aspect-ratio: 1 / 1;
  display: grid;
  place-items: center;
  width: 100%;
}

.qrbox svg { width: 100%; height: auto; display: block; }

.qrlocked { margin-top: 1.5rem; text-align: center; }
.qrlocked__icon {
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  margin: 0 auto .9rem;
  border-radius: 14px;
  background: rgba(11,11,13,.06);
  color: var(--ink-3);
}
.qrlocked__icon svg { width: 24px; height: 24px; }
.qrlocked__title { font-size: 1.02rem; font-weight: 700; letter-spacing: -.02em; }
.qrlocked .acct-actions { justify-content: center; }
