.admin-body { background: var(--bg); }

.admin-gate {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 24px 16px;
}
.admin-gate[hidden] { display: none; }
.gate-card {
  width: 100%;
  max-width: 400px;
  padding: 36px 28px 28px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow);
  text-align: center;
}
.gate-logo { height: 72px; width: auto; max-width: 220px; margin: 0 auto 18px; object-fit: contain; }
.gate-card h1 { margin: 0 0 6px; font-size: 22px; font-weight: 900; letter-spacing: -.02em; }
.gate-sub { margin: 0 0 22px; font-size: 14px; color: var(--muted); }
.gate-msg { margin: 14px 0 0; font-size: 13px; font-weight: 600; color: var(--danger); }
.gate-msg[hidden] { display: none; }
.gate-back { display: inline-block; margin-top: 18px; font-size: 13px; color: var(--muted); text-decoration: none; }
.gate-back:hover { color: var(--ink); text-decoration: underline; }

.admin-app { display: flex; min-height: 100dvh; }
.admin-app[hidden] { display: none; }

.admin-side {
  position: sticky;
  top: 0;
  flex-shrink: 0;
  width: 232px;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  padding: 20px 14px;
  background: var(--surface);
  border-right: 1px solid var(--line);
}
.admin-brand { display: block; padding: 4px 8px 20px; }
.admin-brand img { height: 48px; width: auto; max-width: 100%; object-fit: contain; object-position: left center; }

.admin-nav { display: flex; flex-direction: column; gap: 4px; }
.admin-nav-btn {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  height: 44px;
  padding: 0 12px;
  border: none;
  border-radius: 10px;
  background: transparent;
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
  text-align: left;
  cursor: pointer;
  transition: background-color .2s ease, color .2s ease;
}
.admin-nav-btn svg { width: 20px; height: 20px; flex-shrink: 0; }
.admin-nav-btn:hover { background: var(--surface-2); color: var(--ink); }
.admin-nav-btn.is-active { background: var(--ink); color: var(--on-ink); }
.nav-count {
  margin-left: auto;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--accent-bg);
  color: #fff;
  font-size: 11px;
  font-style: normal;
  font-weight: 800;
  display: grid;
  place-items: center;
}
.nav-count[hidden] { display: none; }

.admin-side-foot {
  margin-top: auto;
  padding: 14px 8px 0;
  border-top: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 13px;
}
.admin-name { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.link-btn { border: none; background: transparent; color: var(--muted); font-size: 13px; font-weight: 600; cursor: pointer; padding: 6px; border-radius: 6px; }
.link-btn:hover { color: var(--ink); background: var(--surface-2); }

.admin-main { flex: 1; min-width: 0; padding: 20px 24px 60px; }
.admin-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 20px;
}
.admin-top h1 { margin: 0; font-size: 24px; font-weight: 900; letter-spacing: -.02em; }
.admin-top-right { display: flex; align-items: center; gap: 8px; }

.live-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 32px;
  padding: 0 12px;
  border-radius: 999px;
  border: 1.5px solid var(--line-strong);
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .12em;
}
.live-pill .live-dot { width: 8px; height: 8px; animation: none; background: var(--muted-2); }
.live-pill.is-on { border-color: var(--accent-bg); background: var(--accent-bg); color: #fff; }
.live-pill.is-on .live-dot { background: #fff; animation: pulse 1.6s ease-in-out infinite; }

.admin-view { display: none; }
.admin-view.is-active { display: block; animation: authViewIn .3s var(--ease-out) both; }

.admin-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 16px; margin-bottom: 20px; }
.admin-card {
  padding: 20px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
}
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
.card-head h2 { margin: 0; font-size: 16px; font-weight: 800; }
.card-desc { margin: 0; font-size: 13px; color: var(--muted); line-height: 1.6; }
.admin-card textarea, .admin-modal textarea {
  width: 100%;
  padding: 12px 14px;
  border: 1.5px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-size: 14px;
  line-height: 1.5;
  resize: vertical;
}
.admin-card textarea:focus, .admin-modal textarea:focus { outline: none; border-color: var(--ink); box-shadow: 0 0 0 3px rgba(128, 128, 128, .18); }
.row-end { display: flex; align-items: center; justify-content: flex-end; gap: 12px; margin-top: 10px; }
.char-count { font-size: 12px; color: var(--muted-2); font-variant-numeric: tabular-nums; }

.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; }
.stat {
  padding: 16px 18px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.stat-label { font-size: 12px; font-weight: 600; color: var(--muted); }
.stat-value { font-size: 24px; font-weight: 900; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }

.switch { position: relative; display: inline-flex; align-items: center; gap: 10px; cursor: pointer; user-select: none; }
.switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch-track {
  position: relative;
  width: 52px;
  height: 30px;
  border-radius: 999px;
  background: var(--line-strong);
  transition: background-color .25s ease;
}
.switch-track::after {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 2px 6px rgba(0, 0, 0, .25);
  transition: transform .25s var(--ease-out);
}
.switch input:checked + .switch-track { background: var(--accent-bg); }
.switch input:checked + .switch-track::after { transform: translateX(22px); }
.switch input:focus-visible + .switch-track { outline: 2px solid var(--ink); outline-offset: 2px; }
.switch-text { font-size: 13px; font-weight: 800; letter-spacing: .1em; color: var(--muted); min-width: 28px; }
.switch input:checked ~ .switch-text { color: var(--accent); }

.btn-primary, .btn-ghost, .btn-danger {
  height: 40px;
  padding: 0 16px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  transition: background-color .2s ease, transform .15s ease, opacity .2s ease;
}
.btn-primary { border: none; background: var(--ink); color: var(--on-ink); }
.btn-primary:hover { background: var(--ink-2); }
.btn-ghost { border: 1.5px solid var(--line-strong); background: var(--surface); color: var(--ink); }
.btn-ghost:hover { background: var(--surface-2); }
.btn-danger { border: 1.5px solid var(--danger); background: transparent; color: var(--danger); }
.btn-danger:hover { background: var(--danger-bg); color: #fff; }
.btn-primary:active, .btn-ghost:active, .btn-danger:active { transform: scale(.97); }
.btn-primary:disabled, .btn-ghost:disabled, .btn-danger:disabled { opacity: .5; cursor: not-allowed; transform: none; }
.btn-sm { height: 32px; padding: 0 10px; font-size: 13px; border-radius: 8px; }
.file-btn { display: inline-flex; align-items: center; justify-content: center; }
.file-btn.is-busy { opacity: .6; pointer-events: none; }

.view-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-bottom: 14px; }
.tool-input {
  flex: 1;
  min-width: 200px;
  height: 40px;
  padding: 0 14px;
  border: 1.5px solid var(--line-strong);
  border-radius: 10px;
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-size: 14px;
}
.tool-input:focus { outline: none; border-color: var(--ink); }
.tool-count { font-size: 13px; color: var(--muted); }
.check { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 600; color: var(--ink-2); cursor: pointer; }
.check input { width: 18px; height: 18px; accent-color: var(--ink); }

.filter-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.filter-chip {
  height: 36px;
  padding: 0 14px;
  border-radius: 999px;
  border: 1.5px solid var(--line-strong);
  background: var(--surface);
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: background-color .2s ease, color .2s ease, border-color .2s ease;
}
.filter-chip.is-active { background: var(--ink); border-color: var(--ink); color: var(--on-ink); }

.table-wrap {
  overflow-x: auto;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
}
.admin-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.admin-table th, .admin-table td { padding: 12px 14px; text-align: left; vertical-align: middle; border-bottom: 1px solid var(--line); white-space: nowrap; }
.admin-table th { font-size: 12px; font-weight: 700; color: var(--muted); background: var(--surface-2); position: sticky; top: 0; }
.admin-table tbody tr:last-child td { border-bottom: none; }
.admin-table tbody tr:hover { background: color-mix(in srgb, var(--surface-2) 60%, transparent); }
.admin-table tr.is-clickable { cursor: pointer; }
.admin-table .num { text-align: right; font-variant-numeric: tabular-nums; }
.admin-table .muted { color: var(--muted); }
.admin-table .empty td { text-align: center; padding: 40px 14px; color: var(--muted); }
.admin-table .wrap { white-space: normal; min-width: 200px; }

.prod-cell { display: flex; align-items: center; gap: 10px; min-width: 220px; }
.prod-thumb { width: 44px; height: 44px; border-radius: 8px; object-fit: cover; background: var(--surface-2); border: 1px solid var(--line); flex-shrink: 0; }
.prod-name { font-weight: 700; white-space: normal; }
.prod-sub { font-size: 12px; color: var(--muted); }

.stock-ctl { display: inline-flex; align-items: center; border: 1.5px solid var(--line-strong); border-radius: 8px; overflow: hidden; }
.stock-ctl button { width: 32px; height: 32px; border: none; background: var(--surface); color: var(--ink); font-size: 16px; font-weight: 700; cursor: pointer; }
.stock-ctl button:hover { background: var(--surface-2); }
.stock-ctl input {
  width: 56px;
  height: 32px;
  border: none;
  border-left: 1.5px solid var(--line-strong);
  border-right: 1.5px solid var(--line-strong);
  background: var(--surface);
  color: var(--ink);
  text-align: center;
  font: inherit;
  font-size: 14px;
  font-weight: 700;
}
.stock-ctl input:focus { outline: none; background: var(--surface-2); }
.stock-zero { color: var(--danger); font-weight: 800; }

.badge {
  display: inline-block;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  background: var(--surface-2);
  color: var(--muted);
}
.badge.on { background: color-mix(in srgb, var(--success) 18%, transparent); color: var(--success); }
.badge.off { background: color-mix(in srgb, var(--danger) 14%, transparent); color: var(--danger); }
.badge.admin { background: var(--ink); color: var(--on-ink); }
.badge.US { background: color-mix(in srgb, var(--accent) 16%, transparent); color: var(--accent); }
.badge.JP { background: color-mix(in srgb, #dc2626 16%, transparent); color: #dc2626; }
html[data-theme="dark"] .badge.JP { color: #fca5a5; }

.status-select {
  height: 34px;
  padding: 0 10px;
  border: 1.5px solid var(--line-strong);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}
.status-select.pending { border-color: var(--warning); color: var(--warning); }
.status-select.paid { border-color: var(--accent); color: var(--accent); }
.status-select.done { border-color: var(--success); color: var(--success); }
.status-select.shipping { border-color: #8b5cf6; color: #8b5cf6; }
.status-select.shipped { border-color: var(--ink); color: var(--ink); }
.status-cell { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.status-open-btn { height: 34px; padding: 0 12px; border: none; border-radius: 8px; background: linear-gradient(135deg, #ffd76a, #f0a500); color: #3a2a00; font: inherit; font-size: 13px; font-weight: 900; cursor: pointer; white-space: nowrap; box-shadow: 0 2px 8px rgba(240, 165, 0, .35); }
.status-open-btn:hover { filter: brightness(1.05); }
.tracking-btn { height: 34px; padding: 0 12px; border: 1.5px solid var(--ink); border-radius: 8px; background: var(--surface); color: var(--ink); font: inherit; font-size: 13px; font-weight: 700; cursor: pointer; white-space: nowrap; }
.tracking-btn:hover { background: var(--surface-2); }
.order-tracking { margin-top: 4px; font-size: 12px; color: var(--ink-2); }
.order-tracking b { font-variant-numeric: tabular-nums; }
.status-select.shipping { border-color: #8b5cf6; color: #8b5cf6; }
.status-select.shipped { border-color: var(--ink); color: var(--ink); }
.status-cell { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.status-open-btn { height: 34px; padding: 0 12px; border: none; border-radius: 8px; background: linear-gradient(135deg, #ffd76a, #f0a500); color: #3a2a00; font: inherit; font-size: 13px; font-weight: 900; cursor: pointer; white-space: nowrap; box-shadow: 0 2px 8px rgba(240, 165, 0, .35); }
.status-open-btn:hover { filter: brightness(1.05); }
.tracking-btn { height: 34px; padding: 0 12px; border: 1.5px solid var(--ink); border-radius: 8px; background: var(--surface); color: var(--ink); font: inherit; font-size: 13px; font-weight: 700; cursor: pointer; white-space: nowrap; }
.tracking-btn:hover { background: var(--surface-2); }
.order-tracking { margin-top: 4px; font-size: 12px; color: var(--ink-2); }
.order-tracking b { font-variant-numeric: tabular-nums; }
.status-select.cancelled { color: var(--muted-2); }
.memo-input {
  width: 180px;
  height: 34px;
  padding: 0 10px;
  border: 1.5px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-size: 13px;
}
.memo-input:hover { border-color: var(--line-strong); }
.memo-input:focus { outline: none; border-color: var(--ink); background: var(--surface); }
.order-items { white-space: normal; min-width: 220px; font-size: 13px; line-height: 1.5; }
.order-items span { display: block; }
.order-date { font-size: 12px; color: var(--muted); }

.admin-modal { max-width: 560px; text-align: left; }
.admin-modal h2 { text-align: center; }
.admin-modal .modal-sub { text-align: center; }
.admin-modal select {
  width: 100%;
  height: 48px;
  padding: 0 14px;
  border: 1.5px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-size: 15px;
}
.admin-modal select:focus { outline: none; border-color: var(--ink); }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 480px) { .field-row { grid-template-columns: 1fr; gap: 0; } }
.image-field { display: flex; gap: 12px; align-items: flex-start; }
.image-preview { width: 84px; height: 84px; border-radius: 12px; object-fit: cover; border: 1px solid var(--line); background: var(--surface-2); flex-shrink: 0; }
.image-controls { flex: 1; display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.image-controls input { height: 44px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 18px; }
.modal-actions .btn-danger { margin-right: auto; }
.modal-actions button { height: 46px; padding: 0 20px; }

@media (max-width: 860px) {
  .admin-app { flex-direction: column; }
  .admin-side {
    position: sticky;
    top: 0;
    z-index: 50;
    width: auto;
    height: auto;
    flex-direction: row;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-right: none;
    border-bottom: 1px solid var(--line);
    overflow-x: auto;
    scrollbar-width: none;
  }
  .admin-side::-webkit-scrollbar { display: none; }
  .admin-brand { padding: 0 6px 0 0; flex-shrink: 0; }
  .admin-brand img { height: 34px; }
  .admin-nav { flex-direction: row; gap: 2px; }
  .admin-nav-btn { height: 38px; padding: 0 10px; font-size: 13px; }
  .admin-nav-btn span { display: none; }
  .admin-nav-btn.is-active span { display: inline; }
  .admin-side-foot { margin: 0 0 0 auto; padding: 0; border: none; flex-shrink: 0; }
  .admin-name { display: none; }
  .admin-main { padding: 16px 16px 48px; }
  .admin-top h1 { font-size: 20px; }
}

.nav-live { color: var(--accent); }
.nav-live.is-active { background: var(--accent-bg); color: #fff; }
.live-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.live-link { display: flex; flex: 1 1 420px; gap: 8px; margin: 0; }
.live-link .tool-input { min-width: 0; }
.live-bar-right { display: flex; align-items: center; gap: 16px; }
.live-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(300px, 360px); gap: 16px; align-items: start; }
@media (max-width: 1100px) { .live-grid { grid-template-columns: 1fr; } }
.live-chat-card { display: flex; flex-direction: column; min-height: max(640px, calc(100vh - 200px)); }
.live-chat-frame { position: relative; flex: 1; min-height: 560px; border-radius: 12px; overflow: hidden; background: var(--surface-2); }
.live-chat-frame iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.live-chat-empty { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; padding: 24px; text-align: center; color: var(--muted); font-size: 14px; line-height: 1.6; }
.live-chat-empty svg { width: 40px; height: 40px; color: var(--muted-2); }
.live-chat-empty p { margin: 0; }
.live-side { display: flex; flex-direction: column; gap: 16px; }
.live-products-head .muted { margin-right: auto; }
.live-feed { list-style: none; margin: 0; padding: 0; max-height: 420px; overflow-y: auto; display: flex; flex-direction: column; gap: 8px; }
.live-feed-empty { padding: 24px 0; text-align: center; color: var(--muted); font-size: 13px; }
.live-order { display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); font-size: 13px; }
.live-order.is-new { animation: live-flash 2.4s ease-out; }
@keyframes live-flash { 0% { background: color-mix(in srgb, var(--accent) 22%, var(--surface)); border-color: var(--accent); } 100% { background: var(--surface); border-color: var(--line); } }
.live-order-head { display: flex; align-items: center; gap: 8px; min-width: 0; }
.live-order-head b { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.live-order-time { color: var(--muted-2); font-size: 12px; white-space: nowrap; }
.live-order-items { grid-column: 1 / -1; color: var(--ink-2); line-height: 1.5; word-break: keep-all; }
.live-order-total { font-weight: 800; font-variant-numeric: tabular-nums; white-space: nowrap; }
.live-order-foot { grid-column: 1 / -1; display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 2px; }
.live-order .order-status { font-size: 11px; padding: 3px 8px; border-radius: 999px; font-weight: 800; }
.live-order .order-status.pending { background: color-mix(in srgb, var(--warning) 18%, transparent); color: var(--warning); }
.live-order .order-status.paid { background: color-mix(in srgb, var(--accent) 16%, transparent); color: var(--accent); }
.live-order .order-status.done { background: color-mix(in srgb, var(--success) 18%, transparent); color: var(--success); }
.live-order .order-status.shipping { background: color-mix(in srgb, #8b5cf6 16%, transparent); color: #8b5cf6; }
.live-order .order-status.shipped { background: var(--ink); color: var(--on-ink); }
.live-order .status-open-btn { height: 28px; padding: 0 10px; font-size: 12px; }
.live-order .order-status.shipping { background: color-mix(in srgb, #8b5cf6 16%, transparent); color: #8b5cf6; }
.live-order .order-status.shipped { background: var(--ink); color: var(--on-ink); }
.live-order .status-open-btn { height: 28px; padding: 0 10px; font-size: 12px; }
.live-order .order-status.cancelled { background: var(--line); color: var(--muted); }
.live-products { list-style: none; margin: 10px 0 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.live-product { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 10px; font-size: 13px; }
.live-product img { width: 36px; height: 36px; border-radius: 8px; object-fit: cover; background: var(--surface-2); flex-shrink: 0; }
.live-product .lp-name { flex: 1; min-width: 0; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.live-product .lp-meta { color: var(--muted); white-space: nowrap; font-variant-numeric: tabular-nums; }
.live-products-empty { padding: 14px 0 4px; text-align: center; color: var(--muted); font-size: 13px; }
.badge.live { background: color-mix(in srgb, var(--accent) 16%, transparent); color: var(--accent); }
.badge.oripa { background: linear-gradient(135deg, #ffd76a, #f0a500); color: #3a2a00; }

.oripa-panel { margin: 0 0 16px; padding: 14px; border: 1.5px solid var(--accent); border-radius: 12px; background: color-mix(in srgb, var(--accent) 5%, var(--surface)); }
.oripa-panel[hidden] { display: none; }
.oripa-panel-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; font-size: 14px; }
.oripa-panel .card-desc { margin-bottom: 10px; }
.oripa-rows { display: flex; flex-direction: column; gap: 6px; }
.oripa-row { display: grid; grid-template-columns: 44px 1fr 84px 32px; gap: 6px; align-items: center; }
.oripa-row .rank-badge { display: inline-flex; align-items: center; justify-content: center; height: 36px; border-radius: 8px; background: var(--line); font-size: 12px; font-weight: 900; }
.oripa-row input { height: 36px; padding: 0 10px; border: 1.5px solid var(--line-strong); border-radius: 8px; background: var(--surface); color: var(--ink); font: inherit; font-size: 13px; min-width: 0; }
.oripa-row input:focus { outline: none; border-color: var(--ink); }
.oripa-row input:disabled { background: var(--surface-2); color: var(--muted); }
.oripa-row .row-del { height: 36px; border: none; background: transparent; color: var(--muted); font-size: 18px; cursor: pointer; border-radius: 8px; }
.oripa-row .row-del:hover { background: var(--surface-2); color: var(--danger); }
.oripa-row .row-del:disabled { opacity: .3; cursor: not-allowed; }
.oripa-panel-foot { margin-top: 8px; }
.oripa-panel .field-msg { margin-top: 8px; }

.oripa-queue { list-style: none; margin: 10px 0 0; padding: 0; display: flex; flex-direction: column; gap: 6px; max-height: 320px; overflow-y: auto; }
.oripa-queue-empty { padding: 14px 0 4px; text-align: center; color: var(--muted); font-size: 13px; }
.oq { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 10px; font-size: 13px; }
.oq img { width: 34px; height: 34px; border-radius: 8px; object-fit: cover; background: var(--surface-2); flex-shrink: 0; }
.oq .oq-no { display: inline-flex; align-items: center; height: 26px; padding: 0 9px; border-radius: 7px; background: var(--ink); color: var(--on-ink); font-weight: 900; font-variant-numeric: tabular-nums; flex-shrink: 0; }
.oq .oq-info { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.oq .oq-info b { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.oq .oq-info span { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.oq-open { height: 32px; padding: 0 12px; border: none; border-radius: 8px; background: linear-gradient(135deg, #ffd76a, #f0a500); color: #3a2a00; font: inherit; font-size: 13px; font-weight: 900; cursor: pointer; white-space: nowrap; }
.oq-open:hover { filter: brightness(1.05); }
.order-tickets { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; }
.order-ticket { display: inline-flex; align-items: center; gap: 6px; height: 26px; padding: 0 8px; border-radius: 7px; background: var(--surface-2); border: 1px solid var(--line); font-size: 12px; font-weight: 700; font-variant-numeric: tabular-nums; }
.order-ticket.is-opened { background: var(--ink); color: var(--on-ink); border-color: var(--ink); }
.order-ticket .ot-open { height: 20px; padding: 0 7px; border: none; border-radius: 5px; background: linear-gradient(135deg, #ffd76a, #f0a500); color: #3a2a00; font: inherit; font-size: 11px; font-weight: 900; cursor: pointer; }
.order-ticket .ot-rank { padding: 0 6px; border-radius: 999px; background: var(--accent-bg); color: #fff; font-size: 10px; font-weight: 900; }
.order-ticket .ot-rank.r1 { background: linear-gradient(135deg, #ffd76a, #f0a500); color: #3a2a00; }
.order-ticket .ot-rank.r2 { background: linear-gradient(135deg, #e8eaf0, #b8bcc8); color: #2b2f3a; }
.order-ticket .ot-rank.r3 { background: linear-gradient(135deg, #f3c8a0, #c47a3a); color: #3a1f08; }

.reveal { position: fixed; inset: 0; z-index: 2000; display: flex; align-items: center; justify-content: center; background: radial-gradient(ellipse at center, #1b1f3a 0%, #06070f 70%); color: #fff; overflow: hidden; user-select: none; }
.reveal[hidden] { display: none; }
.reveal::before { content: ''; position: absolute; inset: -50%; background: conic-gradient(from 0deg, transparent 0 20%, rgba(255, 255, 255, .06) 25%, transparent 30%, transparent 60%, rgba(255, 255, 255, .06) 65%, transparent 70%); animation: reveal-spin 14s linear infinite; pointer-events: none; }
@keyframes reveal-spin { to { transform: rotate(360deg); } }
.reveal.is-flash::after { content: ''; position: absolute; inset: 0; background: #fff; animation: reveal-flash .7s ease-out forwards; pointer-events: none; }
@keyframes reveal-flash { from { opacity: .95; } to { opacity: 0; } }
.reveal-confetti { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.reveal-stage { position: relative; display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 24px; text-align: center; width: min(92vw, 560px); }
.reveal-kicker { margin: 0; font-size: 13px; font-weight: 900; letter-spacing: .3em; color: #ffd76a; }
.reveal-title { margin: 0; font-size: clamp(20px, 3.4vw, 30px); font-weight: 900; letter-spacing: -.02em; }
.reveal-sub { margin: 0 0 18px; font-size: 15px; color: rgba(255, 255, 255, .75); }
.reveal-scene { position: relative; width: min(66vw, 280px); aspect-ratio: 3 / 4.2; perspective: 1400px; perspective-origin: 50% 45%; }

.reveal-under { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: space-between; gap: 10px; padding: 26px 18px 22px; box-sizing: border-box; border-radius: 22px; background: linear-gradient(160deg, #2a2d3e, #15172a); box-shadow: 0 30px 80px rgba(0, 0, 0, .6), inset 0 0 0 4px rgba(255, 255, 255, .15); filter: brightness(.55); transition: filter .3s ease; }
.reveal-under.is-lit { filter: brightness(1); }
.reveal-under.tier-1 { background: linear-gradient(160deg, #ffe08a 0%, #f0a500 50%, #a86a00 100%); color: #2a1d00; box-shadow: 0 30px 120px rgba(255, 200, 60, .75), inset 0 0 0 5px rgba(255, 255, 255, .6); }
.reveal-under.tier-2 { background: linear-gradient(160deg, #f4f6fb 0%, #c3c8d6 50%, #7c8398 100%); color: #1e2230; box-shadow: 0 30px 100px rgba(200, 210, 240, .6), inset 0 0 0 5px rgba(255, 255, 255, .7); }
.reveal-under.tier-3 { background: linear-gradient(160deg, #f6d2b0 0%, #c47a3a 50%, #7a4517 100%); color: #2c1606; box-shadow: 0 30px 100px rgba(196, 122, 58, .6), inset 0 0 0 5px rgba(255, 255, 255, .45); }
.reveal-rank { display: inline-flex; align-items: center; justify-content: center; padding: 6px 18px; border-radius: 999px; background: rgba(0, 0, 0, .35); color: #fff; font-size: clamp(26px, 6vw, 40px); font-weight: 900; letter-spacing: -.02em; min-height: 52px; }
.reveal-under.tier-1 .reveal-rank, .reveal-under.tier-2 .reveal-rank, .reveal-under.tier-3 .reveal-rank { background: rgba(0, 0, 0, .55); }
.reveal-prize { font-size: clamp(18px, 4vw, 26px); font-weight: 900; line-height: 1.3; word-break: keep-all; }
.reveal-img { width: 52%; aspect-ratio: 1; object-fit: cover; border-radius: 14px; box-shadow: 0 10px 30px rgba(0, 0, 0, .4); }
.reveal-img[hidden] { display: none; }
.reveal-under:not(:has(.reveal-img:not([hidden]))) { justify-content: center; gap: 18px; }

.reveal-pageshadow {
  position: absolute; inset: 0; border-radius: 22px;
  background: radial-gradient(ellipse at 50% 50%, rgba(0, 0, 0, .55), transparent 70%);
  opacity: 0; pointer-events: none;
}
.reveal-cover {
  position: absolute; inset: 0;
  transform-style: preserve-3d;
  cursor: default; touch-action: none; will-change: transform;
  transform-origin: 50% 0;
}
.reveal-sheet { position: absolute; inset: 0; transform-style: preserve-3d; will-change: transform; }
.reveal-cover-front, .reveal-cover-back {
  position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px;
  border-radius: 22px; overflow: hidden;
  backface-visibility: hidden; -webkit-backface-visibility: hidden;
}
.reveal-cover-front {
  background: linear-gradient(160deg, #2b6cff 0%, #0474f4 45%, #023f8f 100%);
  box-shadow: 0 30px 80px rgba(4, 116, 244, .45), inset 0 0 0 4px rgba(255, 255, 255, .25);
}
.reveal-cover-front::before { content: ''; position: absolute; left: 14px; right: 14px; top: 26%; border-top: 2px dashed rgba(255, 255, 255, .55); }
.reveal-cover-back {
  transform: rotateX(180deg);
  background: repeating-linear-gradient(45deg, #1d2a4a 0 10px, #16203a 10px 20px);
  box-shadow: 0 30px 80px rgba(0, 0, 0, .5), inset 0 0 0 4px rgba(255, 255, 255, .12);
}
.reveal-cover-back::after { content: 'GAZUA TCG'; font-size: 13px; font-weight: 900; letter-spacing: .4em; color: rgba(255, 255, 255, .35); }
.reveal-shade { position: absolute; inset: 0; border-radius: 22px; opacity: 0; pointer-events: none; }
.reveal-corner {
  position: absolute; width: 58px; height: 58px; pointer-events: none;
  background: linear-gradient(var(--corner-dir), rgba(255, 255, 255, .85) 0 48%, rgba(255, 255, 255, 0) 48.5%);
  opacity: .28;
  transition: opacity .3s ease;
}
.reveal-corner.c-tl { top: 0; left: 0; --corner-dir: 135deg; border-top-left-radius: 22px; }
.reveal-corner.c-tr { top: 0; right: 0; --corner-dir: -135deg; border-top-right-radius: 22px; }
.reveal-corner.c-bl { bottom: 0; left: 0; --corner-dir: 45deg; border-bottom-left-radius: 22px; }
.reveal-corner.c-br { bottom: 0; right: 0; --corner-dir: -45deg; border-bottom-right-radius: 22px; }
.reveal-cover.is-armed .reveal-corner { animation: corner-wink 2.6s ease-in-out infinite; }
.reveal-cover.is-armed .c-tr { animation-delay: .2s; }
.reveal-cover.is-armed .c-bl { animation-delay: .4s; }
.reveal-cover.is-armed .c-br { animation-delay: .6s; }
.reveal-cover.is-dragging .reveal-corner { animation: none; opacity: .12; }
@keyframes corner-wink { 0%, 100% { opacity: .22; } 50% { opacity: .6; } }
.reveal-drag-hint.is-nudge { animation: hint-nudge .45s ease; }
@keyframes hint-nudge { 0%, 100% { transform: none; } 25% { transform: translateX(-7px); } 75% { transform: translateX(7px); } }
#revealShadeFront { background: linear-gradient(var(--shade-angle, 180deg), rgba(0, 0, 0, .05), rgba(0, 0, 0, .75)); }
#revealShadeBack { background: linear-gradient(var(--shade-angle, 0deg), rgba(255, 255, 255, .22), rgba(0, 0, 0, .55)); }
.reveal-cover.is-armed { cursor: grab; }
.reveal-cover.is-armed .reveal-cover-front { animation: reveal-breathe 2.4s ease-in-out infinite; }
.reveal-cover.is-dragging { cursor: grabbing; }
.reveal-cover.is-dragging .reveal-cover-front { animation: none; }
.reveal-cover.is-gone { transition: opacity .8s ease; opacity: 0; pointer-events: none; }
@keyframes reveal-breathe {
  0%, 100% { box-shadow: 0 30px 80px rgba(4, 116, 244, .45), inset 0 0 0 4px rgba(255, 255, 255, .25); }
  50%      { box-shadow: 0 38px 96px rgba(4, 116, 244, .6), inset 0 0 0 4px rgba(255, 255, 255, .45); }
}
.reveal-no { position: absolute; top: 9%; font-size: 20px; font-weight: 900; letter-spacing: .05em; opacity: .9; }
.reveal-q { font-size: clamp(90px, 22vw, 150px); font-weight: 900; line-height: 1; text-shadow: 0 10px 30px rgba(0, 0, 0, .35); margin-top: 18%; }
.reveal-hint-text { font-size: 12px; letter-spacing: .4em; opacity: .7; }
.reveal-drag-hint { margin: 14px 0 0; font-size: 14px; font-weight: 800; color: #ffd76a; animation: reveal-hint 1.6s ease-in-out infinite; }
.reveal-drag-hint[hidden] { display: none; }
@keyframes reveal-hint { 0%, 100% { opacity: .6; transform: translateY(0); } 50% { opacity: 1; transform: translateY(-4px); } }
.reveal-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin-top: 20px; }
.reveal-btn { height: 54px; padding: 0 30px; border: none; border-radius: 14px; background: linear-gradient(135deg, #ffd76a, #f0a500); color: #3a2a00; font: inherit; font-size: 18px; font-weight: 900; letter-spacing: .02em; cursor: pointer; box-shadow: 0 10px 30px rgba(240, 165, 0, .4); transition: transform .15s ease, filter .2s ease; }
.reveal-btn:hover { filter: brightness(1.06); transform: translateY(-2px); }
.reveal-btn:active { transform: scale(.97); }
.reveal-btn:disabled { opacity: .4; cursor: not-allowed; transform: none; }
.reveal-btn.is-ghost { background: transparent; color: rgba(255, 255, 255, .8); box-shadow: none; border: 1.5px solid rgba(255, 255, 255, .3); }
.reveal-btn.is-next { background: #fff; color: #111; box-shadow: 0 10px 30px rgba(255, 255, 255, .25); }
.reveal-btn.is-quick { background: rgba(255, 255, 255, .12); color: #fff; box-shadow: none; border: 1.5px solid rgba(255, 255, 255, .25); font-size: 15px; }
.reveal-btn[hidden] { display: none; }
.reveal-result-line { margin: 12px 0 0; font-size: 16px; font-weight: 800; color: #ffd76a; min-height: 22px; }
.label-hint { margin-left: 6px; font-size: 12px; font-weight: 500; color: var(--muted); }
.grade-rows { display: flex; flex-direction: column; gap: 6px; }
.grade-row { display: grid; grid-template-columns: 34px 1fr 150px 30px; gap: 8px; align-items: center; }
.grade-row .grade-no { display: inline-flex; align-items: center; justify-content: center; height: 36px; border-radius: 8px; background: var(--line); font-size: 12px; font-weight: 900; }
.grade-row input { height: 36px; padding: 0 10px; border: 1.5px solid var(--line-strong); border-radius: 8px; background: var(--surface); color: var(--ink); font: inherit; font-size: 13px; min-width: 0; }
.grade-row input:focus { outline: none; border-color: var(--ink); }
.grade-row input:disabled { background: var(--surface-2); color: var(--muted); }
.grade-row .grade-unit { font-size: 12px; color: var(--muted); }
.badge.grade { background: color-mix(in srgb, var(--accent) 14%, transparent); color: var(--accent); }
.badge.grade.g0 { background: var(--surface-2); color: var(--muted); }
.badge.grade.g3 { background: linear-gradient(135deg, #ffd76a, #f0a500); color: #3a2a00; }
.badge.grade.g4 { background: linear-gradient(135deg, #a78bfa, #6d28d9); color: #fff; }
.check-row { display: flex; flex-wrap: wrap; gap: 8px 20px; }
.check-live { color: var(--accent); }
.empty-view {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  min-height: 320px;
  border: 1.5px dashed var(--line-strong);
  border-radius: var(--radius-lg);
  color: var(--muted);
  font-size: 14px;
}
.empty-view svg { width: 44px; height: 44px; color: var(--muted-2); }
.empty-view p { margin: 0; }

.chart-card { margin-bottom: 16px; padding-bottom: 12px; }
.chart-tools { display: flex; align-items: center; gap: 12px; }
.chart-sub { font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }
.chart-wrap { position: relative; width: 100%; }
.chart-wrap[hidden] { display: none; }
.chart-svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart-grid { stroke: var(--line); stroke-width: 1; }
.chart-base { stroke: var(--line-strong); stroke-width: 1; }
.chart-axis, .chart-x { fill: var(--muted); font-size: 11px; font-weight: 600; font-variant-numeric: tabular-nums; }
.chart-x.is-today { fill: var(--ink); font-weight: 800; }
.chart-value { fill: var(--ink); font-size: 12px; font-weight: 800; font-variant-numeric: tabular-nums; }
.chart-bar { fill: var(--ink); transition: opacity .15s ease; }
.chart-bar.is-today { fill: var(--accent-bg); }
.chart-bar.is-zero { fill: var(--line-strong); }
.chart-hit { fill: transparent; cursor: crosshair; }
.chart-hit:hover { fill: color-mix(in srgb, var(--ink) 6%, transparent); }
.chart-tip {
  position: absolute;
  z-index: 5;
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 8px 12px;
  border-radius: 10px;
  background: var(--ink);
  color: var(--on-ink);
  font-size: 12px;
  white-space: nowrap;
  pointer-events: none;
  box-shadow: var(--shadow);
}
.chart-tip[hidden] { display: none; }
.chart-tip b { font-size: 13px; }
.chart-table { margin-top: 8px; }
.chart-table[hidden] { display: none; }
.chart-table .admin-table { border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
@media (max-width: 640px) {
  .chart-x:nth-of-type(even) { display: none; }
  .chart-tools .chart-sub { display: none; }
}

.stat-grid-3 { grid-template-columns: repeat(3, 1fr); margin-bottom: 16px; }
@media (max-width: 720px) { .stat-grid-3 { grid-template-columns: 1fr; } }
.stat-btn { font: inherit; text-align: left; cursor: pointer; transition: transform .15s ease, box-shadow .2s ease, border-color .2s ease; }
.stat-btn:hover { border-color: var(--line-strong); box-shadow: var(--shadow-sm); transform: translateY(-2px); }
.stat-btn:active { transform: translateY(0); }
.stat-sub { font-size: 12px; color: var(--muted-2); }

.date-filter { display: flex; align-items: center; gap: 6px; }
.date-input { flex: none; min-width: 0; width: 160px; }
.tool-hint { font-size: 12px; color: var(--muted-2); }

.cal-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.cal-head h2 { margin: 0 4px; font-size: 20px; font-weight: 900; letter-spacing: -.02em; min-width: 120px; text-align: center; }
.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
  padding: 12px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
}
.cal-w { padding: 4px 0 6px; text-align: center; font-size: 12px; font-weight: 700; color: var(--muted); }
.cal-w:first-child { color: var(--accent); }
.cal-cell {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  min-height: 74px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition: background-color .15s ease, border-color .15s ease, transform .15s ease;
}
.cal-cell.is-pad { border-color: transparent; background: transparent; cursor: default; }
.cal-cell:not(.is-pad):hover { background: var(--surface-2); border-color: var(--line-strong); }
.cal-cell.is-today { border-color: var(--accent-bg); }
.cal-cell.is-today .cal-num { color: var(--accent); }
.cal-cell.has-sales { background: color-mix(in srgb, var(--ink) 4%, var(--surface)); }
.cal-cell.is-selected { background: var(--ink); color: var(--on-ink); border-color: var(--ink); }
.cal-cell.is-selected .cal-num, .cal-cell.is-selected .cal-cnt, .cal-cell.is-selected .cal-rev { color: inherit; }
.cal-num { font-size: 13px; font-weight: 800; }
.cal-cnt { font-size: 12px; font-weight: 700; color: var(--ink-2); }
.cal-rev { font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums; }
.cal-note-mark { display: block; max-width: 100%; font-size: 11px; color: var(--accent); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cal-cell.is-selected .cal-note-mark { color: inherit; }
.cal-note { margin: 0 0 14px; padding: 12px 14px; border: 1.5px solid var(--line-strong); border-radius: 12px; background: var(--surface-2); }
.cal-note label { display: block; margin-bottom: 6px; font-size: 13px; font-weight: 800; }
.cal-note textarea { width: 100%; box-sizing: border-box; resize: vertical; }
.cal-note-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 8px; }
.cal-day { margin-top: 16px; }
.cal-day[hidden] { display: none; }
.cal-day h3 { margin: 0 0 10px; font-size: 16px; font-weight: 800; }
@media (max-width: 640px) {
  .cal-grid { gap: 3px; padding: 8px; }
  .cal-cell { min-height: 58px; padding: 6px 5px; }
  .cal-rev { display: none; }
}

.admin-modal-wide { max-width: 640px; }
.extra-block { margin-top: 22px; padding-top: 18px; border-top: 1px solid var(--line); }
.extra-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.extra-head h3 { margin: 0; font-size: 15px; font-weight: 800; }
.points-balance { font-size: 18px; font-weight: 900; color: var(--accent); font-variant-numeric: tabular-nums; }
.extra-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.extra-row input, .extra-row select {
  height: 40px;
  padding: 0 12px;
  border: 1.5px solid var(--line-strong);
  border-radius: 10px;
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-size: 14px;
  min-width: 0;
}
.extra-row input:focus, .extra-row select:focus { outline: none; border-color: var(--ink); }
.extra-row #mPointAmount { width: 120px; }
.extra-row #mPointReason { flex: 1; min-width: 140px; }
.coupon-row #mCouponName { flex: 1 1 100%; }
.coupon-row #mCouponType { width: 110px; }
.coupon-row #mCouponValue { width: 100px; }
.coupon-row #mCouponMin { width: 150px; }
.coupon-row #mCouponExpires { width: 150px; }
.log-list { list-style: none; margin: 12px 0 0; padding: 0; display: flex; flex-direction: column; gap: 6px; max-height: 220px; overflow-y: auto; }
.log-list li {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 4px 10px;
  align-items: center;
  padding: 8px 12px;
  border-radius: 10px;
  background: var(--surface-2);
  font-size: 13px;
}
.log-list li.muted { display: block; color: var(--muted); background: transparent; padding: 4px 0; }
.log-list li.is-used { opacity: .55; }
.log-delta { font-weight: 800; font-variant-numeric: tabular-nums; }
.log-delta.plus { color: var(--success); }
.log-delta.minus { color: var(--danger); }
.log-reason { color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.log-meta { grid-column: 1 / -1; font-size: 11px; color: var(--muted-2); }
.log-list .link-btn { padding: 2px 6px; font-size: 12px; }

.confirm-box { max-width: 380px; padding: 28px 24px 22px; text-align: center; }
.confirm-box h2 { margin: 0 0 8px; font-size: 18px; font-weight: 900; }
.confirm-text { margin: 0 0 18px; font-size: 14px; line-height: 1.6; color: var(--ink-2); white-space: pre-line; }
.confirm-box .tool-input { width: 100%; margin-bottom: 14px; }
.confirm-actions { display: flex; gap: 10px; }
.confirm-actions button { flex: 1; height: 46px; }
.confirm-actions .btn-danger.is-primary { border-color: var(--ink); background: var(--ink); color: var(--on-ink); }
.bank-input { width: 100%; margin-top: 4px; }
.order-cancel-btn { margin-top: 6px; }
.order-pay { margin-top: 6px; font-size: 12px; color: var(--muted); }
.order-ship { margin-top: 4px; font-size: 12px; color: var(--muted); white-space: normal; }
