/* Trang quản trị thư viện: cùng "hộp nhung" với app, các bảng là giấy hồng phấn như thẻ chi tiết mẫu. */
/* html bị khoá cuộn cho màn quét (style.css), nên ở các trang này chính body là vùng cuộn, cao đúng bằng màn hình. */
body.admin { height: 100%; overflow-x: hidden; overflow-y: auto; -webkit-overflow-scrolling: touch; overscroll-behavior-y: contain; }
.adm {
  max-width: 1040px; margin: 0 auto;
  padding: calc(var(--safe-t) + 14px) 22px calc(var(--safe-b) + 60px);
}
.adm .wordmark { text-decoration: none; }
.adm-head { padding: 26px 0 8px; }
.adm-head h1 { margin: 0 0 10px; font: 600 clamp(30px, 6vw, 40px)/1.1 var(--display); color: #fff7f3; }
.adm-head .lede { max-width: 56ch; }
.adm-std { display: inline-block; margin: 14px 0 0; padding: 6px 12px; border-radius: 999px; font-size: 13.5px; font-weight: 600; color: var(--brass); border: 1.5px solid rgba(227, 179, 76, .5); }

.adm-grid { display: grid; gap: 20px; margin-top: 22px; }
@media (min-width: 860px) { .adm-grid { grid-template-columns: 1.15fr 1fr; align-items: start; } .adm-col:last-child { position: sticky; top: 16px; } }
.adm-col { display: grid; gap: 20px; min-width: 0; }

.panel { padding: 22px; border-radius: 22px; background: var(--blush); color: var(--ink); }
.panel h2 { display: flex; align-items: center; gap: 12px; margin: 0 0 16px; font: 600 22px/1.2 var(--display); }
.panel h2 b { flex: none; width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center; font: 600 16px/1 var(--display); background: var(--brass); }
.panel h2 small { margin-left: auto; font: 600 13.5px/1 var(--body); color: rgba(11, 36, 35, .6); }

.lbl { display: block; margin: 16px 0 6px; padding: 0; font-size: 13.5px; font-weight: 600; color: rgba(11, 36, 35, .72); }
.field, .langs input, .langs textarea {
  width: 100%; padding: 11px 13px; border-radius: 12px; font: 400 15px/1.35 var(--body); color: var(--ink);
  background: #fffaf7; border: 1.5px solid rgba(11, 36, 35, .22);
}
.field:focus-visible, .langs input:focus-visible, .langs textarea:focus-visible { outline-offset: 1px; }
select.field { appearance: none; -webkit-appearance: none; font-weight: 600; padding-right: 34px;
  background: #fffaf7 url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M1 1l4 4 4-4' fill='none' stroke='%230b2423' stroke-width='1.6'/%3E%3C/svg%3E") no-repeat right 14px center; }
.langs { display: grid; gap: 8px; }
.langs textarea { resize: vertical; min-height: 64px; }
.langs details { margin-top: 2px; }
.langs summary { cursor: pointer; padding: 4px 0; font-size: 13.5px; font-weight: 600; color: rgba(11, 36, 35, .72); }
.langs .other { display: grid; gap: 8px; margin-top: 8px; }
.langs .other label { display: grid; grid-template-columns: 84px 1fr; align-items: center; gap: 10px; font-size: 13.5px; color: rgba(11, 36, 35, .72); }

.drop {
  display: grid; place-items: center; min-height: 120px; padding: 18px; text-align: center; cursor: pointer;
  border-radius: 16px; border: 2px dashed rgba(11, 36, 35, .35); font-size: 15px; font-weight: 600; color: rgba(11, 36, 35, .75);
}
.drop.over { border-color: var(--brass-dark); background: rgba(227, 179, 76, .18); }
.drop:focus-within { outline: 3px solid var(--coral); outline-offset: 3px; }
.drop input { position: absolute; opacity: 0; width: 1px; height: 1px; }

.edit-row { display: grid; grid-template-columns: 150px 1fr; gap: 20px; align-items: center; margin-top: 20px; }
@media (max-width: 460px) { .edit-row { grid-template-columns: 1fr; } .bezel.preview { width: 170px; } }
.bezel canvas { display: block; width: 100%; height: 100%; border-radius: 9%; background: var(--blush); }
.sliders { display: grid; gap: 10px; }
.sliders label { display: grid; gap: 2px; font-size: 13.5px; font-weight: 600; color: rgba(11, 36, 35, .72); }
.sliders input[type=range] { width: 100%; accent-color: var(--brass-dark); }
.reveal { margin: 0; padding: 0; border: 0; }
.reveal label { display: flex; gap: 10px; align-items: flex-start; padding: 6px 0; font-size: 15px; }
.reveal input { margin-top: 4px; accent-color: var(--brass-dark); }

.cta.small { width: auto; max-width: none; padding: 14px 20px; font-size: 15.5px; border-radius: 14px; box-shadow: 0 4px 0 var(--brass-dark); }
.cta.small:active { transform: translateY(2px); box-shadow: 0 2px 0 var(--brass-dark); }
.cta.ghosted { background: #fffaf7; box-shadow: 0 4px 0 rgba(11, 36, 35, .3); border: 1.5px solid rgba(11, 36, 35, .3); }
#add { margin-top: 16px; }
.actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 18px; }
.msg { margin: 14px 0 0; padding: 10px 14px; border-radius: 12px; font-size: 14.5px; font-weight: 600; background: rgba(255, 122, 112, .22); }
.msg.ok { background: rgba(15, 59, 58, .12); }
.note, .empty { margin: 14px 0 0; font-size: 13.5px; color: rgba(11, 36, 35, .66); }
.empty { margin: 0; }

.samples { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.samples li { display: grid; grid-template-columns: 64px 1fr auto; gap: 14px; align-items: center; }
.samples .bezel { box-shadow: 0 4px 10px rgba(0, 0, 0, .25); }
.samples li > div { min-width: 0; }   /* tên dài không dấu cách không đẩy tràn ô lưới */
.samples .nm, .samples .meta { overflow-wrap: anywhere; }
.samples .nm { font-weight: 600; font-size: 15px; line-height: 1.3; }
.samples .meta { font-size: 13px; color: rgba(11, 36, 35, .66); }
.samples .rm { padding: 8px 12px; border-radius: 999px; font-size: 13.5px; font-weight: 600; border: 1.5px solid rgba(11, 36, 35, .3); }
.badge { display: inline-block; margin-right: 6px; padding: 2px 9px; border-radius: 999px; font-size: 12.5px; font-weight: 700; }
.badge.good { background: #0f3b3a; color: var(--blush); }
.badge.fair { background: var(--brass); color: var(--ink); }
.badge.weak { background: var(--coral); color: var(--ink); }
.tagnew { color: var(--brass-dark); font-weight: 700; }

/* Trang "Tạo mặt nhẫn của bạn" (create.html) dùng chung các bảng với trang quản trị. */
.adm.narrow { max-width: 600px; }
a.cta { display: inline-block; text-decoration: none; text-align: center; }
.samples.mine li { grid-template-columns: 64px 1fr auto auto; }
.samples .dl { padding: 8px 12px; border-radius: 999px; font-size: 13.5px; font-weight: 600; border: 1.5px solid rgba(11, 36, 35, .3); color: var(--ink); text-decoration: none; }
@media (max-width: 460px) { .samples.mine li { grid-template-columns: 56px 1fr; } .samples.mine .dl, .samples.mine .rm { justify-self: start; } .samples.mine .btns { grid-column: 2; display: flex; gap: 8px; } }
.samples .btns { display: flex; gap: 8px; }
.adm .top a.ghost { text-decoration: none; }

.cloud { margin: 14px 0 0; padding: 10px 14px; border-radius: 12px; background: rgba(15, 59, 58, .08); display: flex; flex-wrap: wrap; gap: 10px; align-items: center; font-size: 14.5px; font-weight: 600; }

/* Đặt in */
.lbl + .field { margin-bottom: 12px; }
textarea.field { resize: vertical; min-height: 76px; font-family: inherit; }
.ord-items li { grid-template-columns: 64px 1fr auto; }
.qty { display: inline-flex; align-items: center; gap: 4px; }
.qty button { width: 36px; height: 36px; border-radius: 50%; border: 1.5px solid rgba(11, 36, 35, .3); background: none; font: 700 18px/1 var(--body); color: var(--ink); cursor: pointer; }
.qty output { min-width: 28px; text-align: center; font-weight: 700; }
.sum { margin: 0 0 12px; display: grid; gap: 6px; }
.sum div { display: flex; justify-content: space-between; gap: 12px; }
.sum dt, .sum dd { margin: 0; }
.sum .tot { padding-top: 8px; border-top: 1.5px solid rgba(11, 36, 35, .2); font-weight: 700; font-size: 18px; }
.bank { margin: 0; padding: 12px 14px; border-radius: 12px; background: rgba(15, 59, 58, .08); white-space: pre-wrap; font: 600 14.5px/1.5 var(--body); }
.sub { margin: 16px 0 8px; font: 600 15px/1.2 var(--body); }
.orders { list-style: none; margin: 0; padding: 0; display: grid; gap: 14px; }
.orders > li { padding: 14px; border-radius: 16px; background: rgba(15, 59, 58, .07); display: grid; gap: 8px; font-size: 14.5px; }
.orders .hd { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; justify-content: space-between; font-weight: 700; }
.orders .ln { display: flex; align-items: center; gap: 10px; }
.orders .ln img { width: 44px; height: 44px; border-radius: 6px; background: #fff; image-rendering: pixelated; }
.orders .row-btns { display: flex; flex-wrap: wrap; gap: 8px; }
.orders .row-btns button, .orders .row-btns a { padding: 8px 12px; border-radius: 999px; font: 600 13.5px/1 var(--body); border: 1.5px solid rgba(11, 36, 35, .3); background: none; color: var(--ink); text-decoration: none; cursor: pointer; }
.orders .muted { color: rgba(11, 36, 35, .66); font-size: 13px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.chips button { padding: 8px 14px; border-radius: 999px; border: 1.5px solid rgba(255, 255, 255, .4); background: none; color: #fff; font: 600 14px/1 var(--body); cursor: pointer; }
.chips button[aria-pressed=true] { background: var(--brass); color: var(--ink); border-color: var(--brass); }
.badge.cancelled { background: rgba(11, 36, 35, .25); color: var(--ink); }
/* Ô nhập mã là phần chính: rộng hết khung, chữ to; nút nằm dưới trên điện thoại, nằm cạnh trên màn rộng. */
.redeem { display: grid; gap: 10px; margin: 10px 0 4px; }
.redeem .field { width: 100%; min-width: 0; margin: 0; padding: 15px 16px; font: 600 20px/1.2 ui-monospace, Menlo, Consolas, monospace; letter-spacing: .06em; text-align: center; }
.redeem .cta { width: 100%; }
@media (min-width: 560px) { .redeem { grid-template-columns: 1fr auto; } .redeem .cta { width: auto; } }
.code { font: 700 16px/1.2 ui-monospace, Menlo, Consolas, monospace; letter-spacing: .04em; user-select: all; }
.orders .codes { display: grid; gap: 4px; padding: 10px 12px; border-radius: 12px; background: rgba(255, 255, 255, .55); }
.ord-col { margin-top: 22px; }
.note.first { margin-top: 0; }
.pay { margin: 0 0 14px; padding: 0; border: 0; display: grid; gap: 8px; }
.pay label { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-radius: 12px; border: 1.5px solid rgba(15, 59, 58, .22); font: 600 15px/1.25 var(--body); cursor: pointer; }
.pay label:has(input:checked) { border-color: var(--ink, #0f3b3a); background: rgba(15, 59, 58, .06); }
.pay input { width: 18px; height: 18px; accent-color: #0f3b3a; flex: none; }
.pay .note { margin: 0; }
.lg-list { margin: 8px 0 0; padding-left: 20px; display: grid; gap: 6px; }

/* ---------- Chỉnh hiển thị: cùng nền nhung với trang chủ, bảng gọn trên màn hẹp ---------- */
body.admin { background: radial-gradient(120% 420px at 85% 0%, #1b5553 0%, transparent 60%) no-repeat, var(--velvet); }
.adm-head h1 { font-size: clamp(27px, 7.6vw, 40px); overflow-wrap: anywhere; }
.adm-head .lede { font-size: 15.5px; }
/* Đường dẫn trong bảng giấy: màu mực, gạch chân đồng (không dùng xanh mặc định của trình duyệt). */
.panel a:not(.cta):not(.dl), .orders a:not(.cta) { color: var(--ink); font-weight: 600; text-decoration: underline; text-decoration-color: var(--brass-dark); text-decoration-thickness: 1.5px; text-underline-offset: 3px; }
.panel h2 { overflow-wrap: anywhere; }
.panel > .cta.small, #place, #add { width: 100%; }
#place { margin-top: 14px; }
.msg { overflow-wrap: anywhere; }
.adm > .msg { color: var(--ink); background: var(--blush); }
.adm .empty { color: rgba(247, 228, 222, .8); }
.panel .empty { color: rgba(11, 36, 35, .66); }

/* Chọn mặt nhẫn để in: ảnh nhỏ, tên tối đa hai dòng, nút số lượng gọn, không chen nhau ở 320–360 px. */
.ord-items li { grid-template-columns: 52px minmax(0, 1fr) auto; gap: 12px; }
.ord-items .nm { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; font-size: 14.5px; }
.ord-items .meta { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.qty { gap: 2px; }
.qty button { width: 34px; height: 34px; font-size: 17px; background: #fffaf7; }
.qty button:active { background: rgba(227, 179, 76, .35); }
.qty output { min-width: 24px; font-size: 15px; font-variant-numeric: tabular-nums; }
.sum { font-variant-numeric: tabular-nums; }
.redeem ~ .orders, .redeem ~ ul { margin-top: 16px; }
.pay label { min-height: 52px; }
.code { overflow-wrap: anywhere; }

/* Trang quản lý đơn: mỗi đơn là một tờ giấy hồng trên nền nhung (trước đây chữ mực nằm thẳng trên nền tối, không đọc được). */
.orders.admin > li { padding: 16px; background: var(--blush); color: var(--ink); box-shadow: 0 8px 20px rgba(0, 0, 0, .22); }
.orders.admin .codes { background: rgba(15, 59, 58, .08); }
.orders .hd { overflow-wrap: anywhere; }
.orders .ln { min-width: 0; overflow-wrap: anywhere; }
.orders .ln img { flex: none; }
.chips { gap: 8px; overflow-x: auto; flex-wrap: nowrap; margin: 0 -22px 16px; padding: 2px 22px 6px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chips button { flex: none; white-space: nowrap; }

@media (max-width: 400px) {
  .adm { padding-left: 16px; padding-right: 16px; }
  .chips { margin-left: -16px; margin-right: -16px; padding-left: 16px; padding-right: 16px; }
  .panel { padding: 18px 16px; border-radius: 20px; }
  .panel h2 { font-size: 20px; margin-bottom: 14px; }
  .orders > li { padding: 12px; }
  .orders.admin > li { padding: 14px; }
  .samples li { gap: 12px; }
  .cta.small { padding: 14px 16px; }
}
.adm > .note, .adm-head .note, .adm > section > .note:not(.panel .note) { color: rgba(247, 228, 222, .72); }
.panel .note { color: rgba(11, 36, 35, .66); }
/* Tên dài không có dấu cách (tối đa 40 ký tự) không được đẩy bảng rộng hơn màn hình. */
.adm-col > *, .orders > li, .orders > li > *, .samples li > * { min-width: 0; }
.orders > li, .ord-items .nm, .ord-items .meta, .sum, .bank { overflow-wrap: anywhere; }
.orders .hd .badge { flex: none; }
.plan-panel { margin-top: 26px; }
.plan-panel .cta { margin-top: 14px; }
.ops-panel { margin-top: 18px; }
.ops-list { list-style: none; margin: 14px 0 0; padding: 0; display: grid; gap: 8px; }
.ops-list li { padding: 10px 12px; border-radius: 12px; background: rgba(255, 255, 255, .55); font-size: 13.5px; line-height: 1.4; overflow-wrap: anywhere; }
.ops-list .src { font-weight: 600; margin-right: 6px; }
.ops-list .msg-text { font-family: ui-monospace, Menlo, monospace; font-size: 12.5px; }
.ops-list .meta { display: block; margin-top: 3px; color: rgba(11, 36, 35, .62); font-size: 12.5px; }
.ops-list a { color: var(--ink); font-weight: 600; }
