/* App pages: store, cart, account, admin. Builds on site.css tokens and components. */

.page { padding: clamp(2rem, 5vw, 3.5rem) 0 clamp(3rem, 7vw, 5rem); min-height: 60vh; }
.page-head { margin-bottom: 2rem; max-width: 70ch; }
.page-head .title { margin-bottom: .5rem; }
.page-head p { color: var(--steel); margin: 0; }
.page-narrow { max-width: 480px; }
.page-mid { max-width: 780px; }

/* Header extras */
.nav-cart { display: inline-flex; align-items: center; gap: .4rem; text-decoration: none; font-weight: 600; font-size: var(--fs-1); text-transform: uppercase; letter-spacing: .08em; color: var(--steel); padding: .5rem 0; }
.nav-cart:hover { color: var(--ash); }
.cart-count { min-width: 20px; height: 20px; padding: 0 .35rem; border-radius: 10px; background: var(--red); color: var(--night); font-size: 12px; font-weight: 700; display: inline-grid; place-items: center; letter-spacing: 0; }
.nav-account { text-decoration: none; font-weight: 600; font-size: var(--fs-1); text-transform: uppercase; letter-spacing: .08em; color: var(--steel); padding: .5rem 0; }
.nav-account:hover { color: var(--ash); }

/* Forms */
.form { display: grid; gap: 1rem; }
.field { display: grid; gap: .35rem; }
.field label { font-weight: 600; font-size: var(--fs-1); }
.field .hint { color: var(--dim); font-size: var(--fs-0); }
input:not([type="checkbox"]):not([type="radio"]), select, textarea {
  width: 100%; min-height: 46px; padding: .55rem .8rem;
  background: var(--deep); color: var(--ash); border: 1px solid var(--line);
  font: 500 var(--fs-2) var(--font-body); border-radius: 0;
}
textarea { min-height: 120px; resize: vertical; }
input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 2px solid var(--red); outline-offset: 1px; border-color: var(--steel); }
input::placeholder, textarea::placeholder { color: var(--dim); }
select { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--steel) 50%), linear-gradient(135deg, var(--steel) 50%, transparent 50%); background-position: calc(100% - 18px) 55%, calc(100% - 12px) 55%; background-size: 6px 6px, 6px 6px; background-repeat: no-repeat; padding-right: 2.2rem; }
.row { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 1rem; }
.check { display: flex; align-items: center; gap: .6rem; font-weight: 500; }
.check input { width: 18px; height: 18px; accent-color: var(--red); }
.form-actions { display: flex; flex-wrap: wrap; gap: .75rem; align-items: center; }
.error { background: rgba(255,70,85,.12); border-left: 3px solid var(--red); padding: .6rem .8rem; color: var(--ash); font-size: var(--fs-1); }
.notice { background: var(--panel); border-left: 3px solid var(--steel); padding: .8rem 1rem; color: var(--ash); }
.notice.ok { border-left-color: #4CC38A; }
.muted { color: var(--steel); }
.small { font-size: var(--fs-1); }
.links { display: flex; flex-wrap: wrap; gap: 1rem; font-size: var(--fs-1); }
.links a { text-decoration-color: var(--red); text-underline-offset: .2em; }

/* Panels */
.panel { background: var(--panel); padding: 1.4rem 1.5rem 1.6rem; clip-path: polygon(0 0, calc(100% - var(--cut)) 0, 100% var(--cut), 100% 100%, var(--cut) 100%, 0 calc(100% - var(--cut))); }
.panel h2, .panel h3 { font-family: var(--font-display); text-transform: uppercase; font-weight: 800; letter-spacing: .01em; line-height: .95; margin: 0 0 1rem; font-size: var(--fs-4); }
.stack { display: grid; gap: 1.5rem; }

/* Store grid */
.grid-products { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 1.25rem; }
.product-tile { background: var(--panel); clip-path: polygon(0 0, calc(100% - var(--cut)) 0, 100% var(--cut), 100% 100%, var(--cut) 100%, 0 calc(100% - var(--cut))); }
.product-tile a { display: block; color: inherit; text-decoration: none; }
.product-tile .thumb { aspect-ratio: 1 / 1; background: var(--panel-2); position: relative; overflow: hidden; }
.product-tile .thumb img { width: 100%; height: 100%; object-fit: cover; }
.product-tile .thumb .empty { position: absolute; inset: 0; display: grid; place-items: center; color: var(--dim); font-weight: 600; text-transform: uppercase; letter-spacing: .08em; font-size: var(--fs-0); }
.product-tile .body { padding: .9rem 1rem 1.1rem; display: grid; gap: .25rem; }
.product-tile .name { font-weight: 600; }
.product-tile .price { color: var(--steel); }
.badge { display: inline-block; padding: .15rem .5rem; font-size: var(--fs-0); font-weight: 700; text-transform: uppercase; letter-spacing: .08em; background: var(--panel-2); color: var(--ash); }
.badge.red { background: var(--red); color: var(--night); }
.badge.dim { color: var(--steel); }
.product-tile a:focus-visible { outline-offset: -3px; }

/* Product page */
.product { display: grid; grid-template-columns: minmax(0, 6fr) minmax(0, 5fr); gap: clamp(1.5rem, 4vw, 3rem); align-items: start; }
.gallery .main { aspect-ratio: 1 / 1; background: var(--panel); overflow: hidden; clip-path: polygon(0 0, calc(100% - var(--cut)) 0, 100% var(--cut), 100% 100%, var(--cut) 100%, 0 calc(100% - var(--cut))); }
.gallery .main img { width: 100%; height: 100%; object-fit: cover; }
.gallery .thumbs { display: flex; gap: .5rem; margin-top: .6rem; flex-wrap: wrap; }
.gallery .thumbs button { width: 64px; height: 64px; padding: 0; border: 2px solid transparent; background: var(--panel); cursor: pointer; }
.gallery .thumbs button[aria-pressed="true"] { border-color: var(--red); }
.gallery .thumbs img { width: 100%; height: 100%; object-fit: cover; }
.product-info .title { font-size: var(--fs-5); }
.product-info .price { font-family: var(--font-display); font-size: var(--fs-5); font-weight: 800; margin: .25rem 0 1rem; }
.product-info .desc { color: var(--ash); white-space: pre-line; max-width: 60ch; }
.options { display: flex; flex-wrap: wrap; gap: .5rem; }
.options button { min-height: 44px; min-width: 52px; padding: .4rem .9rem; background: var(--panel); color: var(--ash); border: 1px solid var(--line); font: 600 var(--fs-1) var(--font-body); cursor: pointer; }
.options button[aria-pressed="true"] { border-color: var(--red); background: var(--panel-2); }
.qty { display: inline-flex; align-items: center; border: 1px solid var(--line); }
.qty button { width: 44px; height: 44px; background: transparent; color: var(--ash); border: 0; font-size: 1.25rem; cursor: pointer; }
.qty input { width: 56px; text-align: center; border: 0; border-inline: 1px solid var(--line); min-height: 44px; }
.buy-row { display: flex; flex-wrap: wrap; gap: .75rem; align-items: center; margin-top: 1.25rem; }

/* Cart + tables */
.table { width: 100%; border-collapse: collapse; font-size: var(--fs-1); }
.table th, .table td { text-align: left; padding: .75rem .6rem; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table th { color: var(--steel); font-weight: 600; font-size: var(--fs-0); text-transform: uppercase; letter-spacing: .08em; }
.table td.r, .table th.r { text-align: right; white-space: nowrap; }
.table-wrap { overflow-x: auto; }
.cart-item { display: flex; align-items: center; gap: .8rem; min-width: 0; }
.cart-item img { width: 56px; height: 56px; object-fit: cover; background: var(--panel-2); flex: none; }
.cart-item .n { font-weight: 600; }
.cart-item .o { color: var(--steel); font-size: var(--fs-0); }
.totals { display: grid; gap: .4rem; justify-content: end; text-align: right; margin-top: 1rem; }
.totals .grand { font-family: var(--font-display); font-size: var(--fs-5); font-weight: 800; }
.btn-link { background: none; border: 0; color: var(--steel); text-decoration: underline; text-underline-offset: .2em; cursor: pointer; font: inherit; padding: .4rem 0; min-height: 32px; }
.btn-link:hover { color: var(--ash); }
.empty-state { padding: 2rem 0; color: var(--steel); }

/* Account */
.account-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 1.5rem; align-items: start; }
.order { border: 1px solid var(--line); padding: 1rem 1.1rem; display: grid; gap: .5rem; }
.order .head { display: flex; flex-wrap: wrap; justify-content: space-between; gap: .5rem; align-items: baseline; }
.order .id { font-weight: 600; }
.order ul { margin: 0; padding-left: 1.1rem; color: var(--steel); font-size: var(--fs-1); }
.status { display: inline-block; padding: .1rem .5rem; font-size: var(--fs-0); font-weight: 700; text-transform: uppercase; letter-spacing: .08em; background: var(--panel-2); }
.status.paid { background: rgba(76,195,138,.18); color: #7BE0AB; }
.status.fulfilled { background: rgba(163,174,185,.18); }
.status.cancelled, .status.failed, .status.refunded { background: rgba(255,70,85,.15); color: var(--red); }

/* Admin */
.tabs { display: flex; flex-wrap: wrap; gap: .25rem; border-bottom: 1px solid var(--line); margin-bottom: 1.5rem; }
.tabs button { background: transparent; color: var(--steel); border: 0; border-bottom: 2px solid transparent; padding: .75rem 1rem; font: 600 var(--fs-1) var(--font-body); text-transform: uppercase; letter-spacing: .08em; cursor: pointer; min-height: 44px; }
.tabs button[aria-selected="true"] { color: var(--ash); border-bottom-color: var(--red); }
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 1rem; }
.stat { background: var(--panel); padding: 1rem 1.1rem; }
.stat .v { font-family: var(--font-display); font-size: var(--fs-5); font-weight: 800; line-height: 1; }
.stat .l { color: var(--steel); font-size: var(--fs-0); margin-top: .25rem; }
.split { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 1.5rem; align-items: start; }
.tiny { font-size: var(--fs-0); color: var(--dim); }
.pill-ok { color: #7BE0AB; } .pill-off { color: var(--red); }

/* Toast */
.toast { position: fixed; left: 50%; bottom: 1.5rem; transform: translate(-50%, 20px); background: var(--ash); color: var(--night); padding: .7rem 1.1rem; font-weight: 600; opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; z-index: 200; max-width: min(90vw, 480px); }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

@media (max-width: 900px) {
  .product { grid-template-columns: 1fr; }
  .split { grid-template-columns: 1fr; }
}

/* Discord */
.discord-btn { display: inline-flex; align-items: center; gap: .6rem; width: 100%; }
.discord-btn svg { width: 20px; height: 20px; color: #5865F2; }
.dc-row { display: flex; align-items: center; gap: .8rem; }
.dc-row img { width: 44px; height: 44px; border-radius: 50%; background: var(--panel-2); }

/* Store tools + related */
.store-tools { display: flex; flex-wrap: wrap; gap: 1rem; align-items: center; justify-content: space-between; margin-bottom: 1.25rem; }
.pills { display: flex; flex-wrap: wrap; gap: .5rem; }
.pills button { min-height: 40px; padding: .35rem .9rem; background: var(--panel); color: var(--steel); border: 1px solid var(--line); font: 600 var(--fs-1) var(--font-body); text-transform: uppercase; letter-spacing: .06em; cursor: pointer; }
.pills button[aria-pressed="true"] { color: var(--ash); border-color: var(--red); background: var(--panel-2); }
.sort select { min-width: 200px; }
.related { margin-top: 3rem; }
.related .title { font-size: var(--fs-5); margin-bottom: 1rem; }
.product-tile .cat { color: var(--dim); font-size: var(--fs-0); text-transform: uppercase; letter-spacing: .08em; }
.restock { display: grid; gap: .6rem; margin-top: 1rem; padding: 1rem 1.1rem; background: var(--panel); border-left: 3px solid var(--red); }
.restock input { min-height: 44px; }
.alt-login summary { cursor: pointer; color: var(--steel); font-weight: 600; }
.alt-login summary .hint { font-weight: 400; color: var(--dim); font-size: var(--fs-0); }
.alt-login[open] summary { color: var(--ash); }
.dc-id { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: var(--fs-0); color: var(--dim); }

/* utilities (CSP forbids inline style attributes) */
.form-actions-end { justify-content: flex-end; margin-top: 1rem; }
.dc-avatar-sm { width: 28px; height: 28px; }
.order-items { margin: 0; padding-left: 1rem; }
textarea.tall { min-height: 200px; }
.notify-narrow { max-width: 420px; }
.mt-1 { margin-top: 1rem; }

.mb-1 { margin-bottom: 1.25rem; }
.thumb-badge { position: absolute; left: .6rem; top: .6rem; background: rgba(7,9,12,.85); color: var(--ash); }
