/*!
 * cabinet.css — components of the cabinet module (characters, shop, item icons, bonus, admin item editor).
 * Loaded after site.css by templates/layout.php (public/assets/css/cabinet*.css). Uses the site tokens (--surface, --accent…).
 * CSP-safe: no inline styles anywhere.
 */

/* ------------------------------------------------------------------ item grades (AAEmu item_grades colours) */
.grade-basic { --grade: #ba976d; }
.grade-crude { --grade: #949293; }
.grade-grand { --grade: #77b064; }
.grade-rare { --grade: #558fd7; }
.grade-arcane { --grade: #cb72d8; }
.grade-heroic { --grade: #d78b06; }
.grade-unique { --grade: #e17853; }
.grade-celestial { --grade: #f95252; }
.grade-divine { --grade: #cf7d5d; }
.grade-epic { --grade: #8fa5ca; }
.grade-legendary { --grade: #bf7900; }
.grade-mythic { --grade: #c90b0b; }
.item-name[class*="grade-"], .shop-contents li[class*="grade-"], .item-inline span[class*="grade-"] { color: var(--grade); }

/* ------------------------------------------------------------------ item icon frame */
.item-frame {
  position: relative; display: inline-grid; place-items: center; flex: none;
  width: 56px; height: 56px; border-radius: 10px;
  background: radial-gradient(circle at 50% 35%, var(--surface-2), var(--bg-alt));
  border: 2px solid var(--grade, var(--border-strong));
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .35), var(--shadow-sm);
}
.item-frame img { width: 48px; height: 48px; border-radius: 6px; image-rendering: auto; }
.item-frame-lg { width: 76px; height: 76px; border-radius: 14px; }
.item-frame-lg img { width: 64px; height: 64px; }
.item-frame-sm { width: 46px; height: 46px; border-radius: 8px; }
.item-frame-sm img { width: 38px; height: 38px; }
.item-frame-xs { width: 30px; height: 30px; border-radius: 6px; border-width: 1px; }
.item-frame-xs img { width: 24px; height: 24px; border-radius: 4px; }
.item-glyph { display: grid; place-items: center; color: var(--accent); }
.item-glyph .icon { width: 28px; height: 28px; }
.item-frame-lg .item-glyph .icon { width: 36px; height: 36px; }
.item-count {
  position: absolute; right: -6px; bottom: -6px; min-width: 22px; padding: 1px 6px; border-radius: 999px;
  background: var(--bg); border: 1px solid var(--border-strong); color: var(--text-strong);
  font-size: .75rem; font-weight: 700; text-align: center; line-height: 1.5;
}

/* ------------------------------------------------------------------ shop catalog */
/* catalog toolbar: categories on the left, balance / login on the right edge of the content column (review L20) */
.shop-toolbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px 24px; margin-bottom: 24px; }
.shop-toolbar > .cluster { margin-left: auto; }
.shop-grid { display: grid; gap: 20px; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); }
.shop-card { display: flex; flex-direction: column; gap: 12px; }
.shop-card .card-footer { margin-top: auto; }
.shop-card-media { display: flex; justify-content: center; padding: 6px 0 2px; text-decoration: none; }
.shop-card .card-title { font-size: 1.1rem; margin-bottom: 4px; }
.shop-card .card-title a { color: var(--heading); text-decoration: none; }
.shop-card .card-title a:hover { color: var(--accent-strong); }
.shop-card.is-sold-out .shop-card-media { opacity: .5; filter: grayscale(.7); }
.shop-contents { list-style: none; margin: 6px 0 0; padding: 0; font-size: .92rem; }
.shop-contents li + li { margin-top: 2px; }
.shop-credits { display: flex; align-items: center; gap: 6px; color: var(--accent); font-weight: 600; }
.btn.is-disabled { pointer-events: none; opacity: .5; }

/* product page */
.product-layout { grid-template-columns: minmax(0, 1fr); }
@media (min-width: 900px) { .product-layout { grid-template-columns: minmax(0, 1.6fr) minmax(300px, 1fr); } }
.product-head { display: flex; gap: 16px; align-items: center; margin-bottom: 14px; }
.product-head .card-title { margin-bottom: 2px; }
.product-buy { position: sticky; top: 90px; }
.item-list { list-style: none; margin: 0 0 18px; padding: 0; display: grid; gap: 10px; }
.item-row { display: flex; gap: 12px; align-items: flex-start; padding: 10px; border: 1px solid var(--border); border-radius: 12px; background: var(--bg-alt); }
.item-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.item-descr { color: var(--text-muted); white-space: normal; }

/* balance widget */
.shop-balance .stats { margin: 4px 0; }

/* ------------------------------------------------------------------ characters */
.char-grid { list-style: none; margin: 0; padding: 0; display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 340px), 1fr)); }
.char-card {
  border: 1px solid var(--border); border-radius: 14px; padding: 16px; background: var(--bg-alt);
  --race: var(--accent);
}
.char-card.race-nuian { --race: #8fb8e8; }
.char-card.race-elf, .char-card.race-fairy { --race: #7fd6a4; }
.char-card.race-dwarf { --race: #d9a45a; }
.char-card.race-harani, .char-card.race-returned { --race: #efcd85; }
.char-card.race-firran { --race: #f08467; }
.char-card.race-warborn { --race: #c96b6b; }
.char-head { display: grid; grid-template-columns: auto 1fr auto; gap: 12px; align-items: center; margin-bottom: 12px; }
.char-crest { display: grid; place-items: center; width: 52px; height: 52px; border-radius: 50%; border: 1px solid var(--border-strong); color: var(--race); background: var(--surface); }
.char-crest-svg { width: 34px; height: 34px; }
.char-name { margin: 0; font-size: 1.15rem; color: var(--heading); overflow-wrap: anywhere; }
.char-sub { margin: 2px 0 0; color: var(--text-muted); font-size: .9rem; }
.char-status { text-align: right; }
.char-facts { display: grid; grid-template-columns: max-content 1fr; gap: 6px 14px; margin: 0; font-size: .93rem; }
.char-facts dt { color: var(--text-muted); }
.char-facts dd { margin: 0; color: var(--text-strong); overflow-wrap: anywhere; }
.char-mini { list-style: none; margin: 8px 0 10px; padding: 0; display: grid; gap: 6px; }
.char-mini li { display: flex; align-items: center; gap: 8px; }
.char-mini-crest { width: 22px; height: 22px; color: var(--accent); flex: none; }
.char-mini-name { color: var(--text-strong); font-weight: 600; }
.cabinet-credits { display: flex; align-items: center; gap: 8px; font-size: 1.05rem; margin-bottom: 2px; }
.cabinet-credits .icon { color: var(--accent); }
.cabinet-credits strong { color: var(--accent-strong); font-size: 1.25rem; }

/* ------------------------------------------------------------------ teleport / history / misc forms */
.teleport-rules { margin: 8px 0 16px; }
.teleport-form { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.teleport-form select { max-width: 280px; }
.history-filter, .form-inline { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; margin-bottom: 14px; }
.history-filter .field, .form-inline .field { margin: 0; }
.meter { display: block; height: 8px; border-radius: 999px; background: var(--surface-2); overflow: hidden; }
.meter > span { display: block; height: 100%; background: var(--sea-grad); }

/* ------------------------------------------------------------------ admin: product item editor */
.item-editor input[type="text"] { width: 100%; min-width: 70px; }
.item-inline { display: inline-flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.item-search { margin: 12px 0 20px; padding: 14px; border: 1px dashed var(--border-strong); border-radius: 12px; }
.item-search input#item_q { min-width: 280px; }
.item-cell { margin: 0; }
.admin-grid { display: grid; gap: 18px; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); align-items: start; }

@media (max-width: 560px) {
  .char-head { grid-template-columns: auto 1fr; }
  .char-status { grid-column: 1 / -1; text-align: left; }
  .product-buy { position: static; }
  .item-search input#item_q { min-width: 0; width: 100%; }
}

/* cabinet dashboard: game + balance cards stacked in the right column */
.cabinet-side { display: grid; gap: 18px; align-content: start; min-width: 0; }
.cabinet-side > .card { margin: 0; }
.shop-balance .stat { min-width: 160px; }
.shop-card .card-sub { margin-top: 2px; }
/* admin delivery queue: actions live in their own full-width row under the delivery, so the table never overflows */
.delivery-actions-row > td { border-top: 0; padding-top: 0; }
tr:has(+ .delivery-actions-row) > td { border-bottom: 0; }
.delivery-actions { display: flex; flex-wrap: wrap; gap: 8px 14px; align-items: center; }
.delivery-actions .inline-form { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin: 0; }
.delivery-actions input[type="text"] { width: 12rem; max-width: 100%; }
input.otp-inline { width: 7.5rem; font-family: var(--font-mono, monospace); letter-spacing: .08em; }
.delivery-what { min-width: 200px; max-width: 420px; overflow-wrap: anywhere; }
