/* 管理後台樣式 — 桌機全寬延伸、無左側色條、無副標題、高密度清晰表單 */
.admin-login-wrap {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.admin-login-card {
  width: min(410px, 100%);
  background: transparent;
  border: 1px solid transparent;
  border-image-source: url("/assets/ui/frame-card-gold.webp");
  border-image-slice: 90 90 90 90 fill;
  border-image-width: 24px;
  border-image-repeat: stretch;
  padding: 28px 26px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.login-brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.emblem {
  border-radius: 8px;
  object-fit: cover;
  flex-shrink: 0;
}

.admin-shell {
  min-height: 100dvh;
  width: 100%;
  display: flex;
  flex-direction: column;
}

.admin-topbar {
  position: sticky;
  top: 0;
  z-index: 25;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 24px;
  background: rgba(11, 18, 32, 0.94);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}

.topbar-left,
.topbar-right {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.filter-inline select {
  min-height: 44px;
  padding: 8px 12px;
  width: auto;
  min-width: 170px;
}

/* 單列不換行功能分頁（依 modern-web-guidance/tabs 規範，含狹窄螢幕捲動漸層提示） */
.admin-tabs-wrap {
  position: relative;
  background: var(--bg-elev);
  border-bottom: 1px solid var(--border);
}
.admin-tabs-wrap::after {
  content: "";
  position: absolute;
  inset: 0 0 0 auto;
  width: 28px;
  pointer-events: none;
  background: linear-gradient(90deg, transparent, var(--bg-elev));
}

.admin-tabs {
  display: flex;
  overflow-x: auto;
  gap: 4px;
  padding: 0 28px 0 24px;
  scrollbar-width: none;
}
.admin-tabs::-webkit-scrollbar { display: none; }

.tab-btn {
  flex: none;
  position: relative;
  min-height: 46px;
  padding: 10px 16px;
  border: 0;
  background: transparent;
  color: var(--text-muted);
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}

.tab-btn:hover {
  color: var(--text);
}

.tab-btn[aria-selected="true"] {
  color: #ffffff;
}

.tab-btn[aria-selected="true"]::after {
  content: "";
  position: absolute;
  inset: auto 0 0 0;
  border-block-end: 3px solid var(--accent);
}

/* 桌機全寬延伸主內容區 */
.admin-main {
  width: 100%;
  padding: 20px 24px 40px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.admin-section {
  display: flex;
  flex-direction: column;
  gap: 16px;
  width: 100%;
}

.admin-section[hidden] {
  display: none;
}

.sec-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.sec-head h1 {
  margin: 0;
  font-size: 1.35rem;
}

.head-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 14px;
  width: 100%;
}

.kpi-box {
  background: transparent;
  border: 1px solid transparent;
  border-image-source: url("/assets/ui/frame-card-sapphire.webp");
  border-image-slice: 96 96 96 96 fill;
  border-image-width: 20px;
  border-image-repeat: stretch;
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.kpi-label {
  font-size: 0.85rem;
  color: var(--text-muted);
  font-weight: 600;
}

.kpi-value {
  font-size: 1.65rem;
  font-weight: 800;
  color: #ffffff;
}

.two-col-stack {
  display: flex;
  flex-direction: column;
  gap: 18px;
  width: 100%;
}

.action-group {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.stack-md { display: flex; flex-direction: column; gap: 14px; }
.muted-sm { font-size: 0.85rem; color: var(--text-muted); }

@media (max-width: 640px) {
  .admin-topbar,
  .admin-tabs,
  .admin-main {
    padding-inline: 14px;
  }
}

.face-capture-box {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.face-cam-wrap {
  position: relative;
  width: 100%;
  max-width: 360px;
  aspect-ratio: 4 / 3;
  border-radius: var(--radius-md);
  overflow: hidden;
  background: #050a14;
  border: 1px solid var(--border-strong);
  margin: 0 auto;
}
.face-cam-wrap video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform: scaleX(-1);
}
.face-guide-oval {
  position: absolute;
  inset: 12% 24%;
  border: 2px dashed rgba(250, 204, 21, 0.78);
  border-radius: 50%;
  pointer-events: none;
}
.face-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 10px;
}
.face-card {
  padding: 10px;
  border-radius: var(--radius-sm);
  background: var(--bg-elev);
  border: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  text-align: center;
}
.face-card img {
  width: 84px;
  height: 84px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid rgba(250, 204, 21, 0.6);
}
.grid-2-inline {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 10px;
}
.grid-2-inline[hidden] {
  display: none;
}
.msec-unlock-box {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}
.msec-unlock-box[hidden] {
  display: none;
}
.stack-xs {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.logo-current-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 14px;
  border-radius: var(--radius-md);
  background: var(--bg-elev);
  border: 1px solid var(--border);
}
.logo-thumb-lg {
  width: 64px;
  height: 64px;
  border-radius: 12px;
  object-fit: cover;
  border: 1px solid var(--border-strong);
  background: #0b1220;
  flex-shrink: 0;
}
.logo-thumb-sm {
  width: 30px;
  height: 30px;
  border-radius: 6px;
  object-fit: cover;
  border: 1px solid var(--border);
  background: #0b1220;
  flex-shrink: 0;
}
.store-name-cell {
  display: flex;
  align-items: center;
  gap: 10px;
}
.media-preview-box {
  margin-top: 8px;
  padding: 10px;
  border-radius: var(--radius-sm);
  background: rgba(15, 23, 42, 0.72);
  border: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.media-preview-box[hidden] {
  display: none;
}
.media-preview-box img,
.media-preview-box video {
  max-width: 100%;
  max-height: 220px;
  width: auto;
  height: auto;
  border-radius: 8px;
  object-fit: contain;
  background: #050a14;
}

/* ========== 會計帳務與盈虧報表頁 ========== */
.acc-toolbar {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 14px 16px;
  border-radius: var(--radius-md);
  background: var(--bg-elev);
  border: 1px solid var(--border);
}
.acc-presets {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.btn.acc-preset[aria-pressed="true"] {
  border-image-source: url("/assets/ui/btn-art-gold.webp");
  color: #0b1220;
  font-weight: 800;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.45);
}
@container (width >= 600px) {
  #tbl-acc-entries td:nth-child(2),
  #tbl-acc-entries td:nth-child(3),
  #tbl-acc-entries td:nth-child(5),
  #tbl-acc-entries td:nth-child(6),
  #tbl-acc-entries td:nth-child(9),
  #tbl-acc-entries td:nth-child(10),
  #tbl-acc-closures td:nth-child(2),
  #tbl-acc-closures td:nth-child(3),
  #tbl-acc-closures td:nth-child(4),
  #tbl-acc-closures td:nth-child(5),
  #tbl-acc-closures td:nth-child(6),
  #tbl-acc-closures td:nth-child(7) {
    white-space: nowrap;
  }
}
.acc-filter-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 14px;
}
.acc-date-group {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.acc-date-pair {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}
.acc-mobile-sort-bar {
  display: none;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
@media (max-width: 640px) {
  .acc-mobile-sort-bar {
    display: flex;
  }
}
.acc-date-group[hidden] {
  display: none;
}
.acc-date-group label {
  font-size: 0.85rem;
  color: var(--text-muted);
  font-weight: 600;
}
.acc-date-group input[type="date"],
.acc-date-group input[type="time"],
.acc-date-group select {
  width: auto;
  min-height: 40px;
  padding: 6px 10px;
}
.acc-time-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.88rem;
  color: var(--text);
  cursor: pointer;
  white-space: nowrap;
}
.acc-time-toggle input[type="checkbox"] {
  width: 18px;
  min-height: 18px;
  margin: 0;
}
.acc-meta-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 16px;
  font-size: 0.85rem;
  color: var(--text-muted);
}
.acc-subtabs-wrap {
  position: relative;
  border-bottom: 1px solid var(--border);
}
.acc-subtabs {
  display: flex;
  overflow-x: auto;
  gap: 4px;
  scrollbar-width: none;
}
.acc-subtabs::-webkit-scrollbar { display: none; }
.acc-subtab {
  flex: none;
  position: relative;
  min-height: 44px;
  padding: 10px 16px;
  border: 0;
  background: transparent;
  color: var(--text-muted);
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
}
.acc-subtab:hover {
  color: var(--text);
}
.acc-subtab[aria-selected="true"] {
  color: #ffffff;
}
.acc-subtab[aria-selected="true"]::after {
  content: "";
  position: absolute;
  inset: auto 0 0 0;
  border-block-end: 3px solid #f59e0b;
}
.acc-subpanel {
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.acc-subpanel[hidden] {
  display: none;
}
.acc-member-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}
.acc-pager {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.kpi-sub {
  font-size: 0.8rem;
  color: var(--text-muted);
  line-height: 1.35;
}
.val-pos {
  color: #4ade80;
  font-weight: 700;
}
.val-neg {
  color: #f87171;
  font-weight: 700;
}
.val-muted {
  color: var(--text-muted);
}
.acc-store-link {
  padding: 2px 0;
  border: 0;
  background: transparent;
  color: #93c5fd;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  text-align: left;
  text-decoration: underline;
  text-underline-offset: 3px;
}
.acc-store-link:hover {
  color: #bfdbfe;
}
.acc-closure-preview {
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  background: rgba(15, 23, 42, 0.82);
  border: 1px solid var(--border);
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 8px 12px;
  font-size: 0.86rem;
}
.acc-row-reversed {
  opacity: 0.62;
}
tfoot tr {
  background: rgba(30, 41, 59, 0.85);
  font-weight: 800;
}
tfoot td,
tfoot th {
  border-top: 2px solid var(--border-strong);
  color: #ffffff;
}

/* 可排序表頭按鈕（依 modern-web-guidance/sortable-table，僅在 th:has(> button) 去內距） */
th:has(> button[command="--sort"]) {
  padding: 0;
}
th > button[command="--sort"] {
  width: 100%;
  min-height: 40px;
  padding: 10px 12px;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  white-space: nowrap;
}
th.num-col > button[command="--sort"] {
  justify-content: flex-end;
}
th > button[command="--sort"]::after {
  content: "↕";
  font-size: 0.78em;
  opacity: 0.45;
}
th[aria-sort="ascending"] > button[command="--sort"]::after {
  content: "↑";
  opacity: 1;
  color: #facc15;
}
th[aria-sort="descending"] > button[command="--sort"]::after {
  content: "↓";
  opacity: 1;
  color: #facc15;
}
th > button[command="--sort"]:focus-visible,
.acc-subtab:focus-visible,
.acc-store-link:focus-visible {
  outline: 2px solid #facc15;
  outline-offset: -2px;
}


#toast-region {
  top: auto;
  bottom: 24px;
  left: auto;
  right: 24px;
  transform: none;
}

/* 單一綁定機台歷史收鈔彈出卡片（寬幅原生 dialog，窄屏零水平溢出） */
dialog.dialog-wide {
  width: min(1100px, calc(100vw - 24px));
}
.dch-head-main {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}
.dch-meta-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 10px;
  font-size: 0.84rem;
  color: var(--text-muted);
}
.dch-filter-card {
  padding: 12px 14px;
  border-radius: var(--radius-md);
  background: rgba(15, 23, 42, 0.72);
  border: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.dch-presets {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.btn.dch-preset[aria-pressed="true"] {
  border-image-source: url("/assets/ui/btn-art-gold.webp");
  color: #0b1220;
  font-weight: 800;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.45);
}
.dch-filter-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 10px;
}
.dch-select-group {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}
.dch-select-group select {
  width: auto;
  min-height: 40px;
  padding: 6px 10px;
  font-size: 0.9rem;
}
.dch-search-group {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 1 1 200px;
  min-width: 0;
}
.dch-search-group input {
  min-height: 40px;
  padding: 6px 10px;
  font-size: 0.9rem;
}
.dch-summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 10px;
}
.dch-stat-card {
  padding: 12px 14px;
  border-radius: var(--radius-md);
  background: rgba(15, 23, 42, 0.84);
  border: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.dch-stat-card.is-primary {
  border-color: rgba(250, 204, 21, 0.55);
  background: linear-gradient(160deg, rgba(250, 204, 21, 0.12), rgba(15, 23, 42, 0.9));
}
.dch-stat-label {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-weight: 600;
}
.dch-stat-value {
  font-size: 1.35rem;
  font-weight: 800;
  color: #ffffff;
}
.dch-stat-card.is-primary .dch-stat-value {
  color: #fde047;
}
.dch-stat-sub {
  font-size: 0.78rem;
  color: var(--text-muted);
  line-height: 1.35;
}
.dch-table-wrap {
  max-block-size: min(420px, 48vh);
}
@container (width >= 600px) {
  #tbl-dch-events th:first-child > div:first-child,
  #tbl-dch-events td:nth-child(2),
  #tbl-dch-events td:nth-child(3),
  #tbl-dch-events td:nth-child(6) {
    white-space: nowrap;
  }
  #tbl-dch-events td:nth-child(4) .muted-sm {
    white-space: nowrap;
  }
  #tbl-dch-events td:nth-child(5) .action-group {
    flex-wrap: nowrap;
  }
}
.denom-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 3px 10px;
  border-radius: 999px;
  font-weight: 800;
  font-size: 0.88rem;
  border: 1px solid transparent;
  white-space: nowrap;
}
.denom-1000 {
  background: rgba(250, 204, 21, 0.16);
  border-color: rgba(250, 204, 21, 0.55);
  color: #fde047;
}
.denom-500 {
  background: rgba(56, 189, 248, 0.16);
  border-color: rgba(56, 189, 248, 0.55);
  color: #7dd3fc;
}
.denom-100 {
  background: rgba(52, 211, 153, 0.16);
  border-color: rgba(52, 211, 153, 0.55);
  color: #6ee7b7;
}
.denom-other {
  background: rgba(148, 163, 184, 0.16);
  border-color: rgba(148, 163, 184, 0.45);
  color: #e2e8f0;
}
@media (max-width: 640px) {
  dialog.dialog-wide {
    padding: 8px;
  }
  dialog.dialog-wide .dialog-head {
    flex-direction: column;
    align-items: stretch;
    padding-inline: 12px;
  }
  dialog.dialog-wide .dialog-head > .action-group {
    justify-content: flex-end;
  }
  dialog.dialog-wide .dialog-body {
    padding-inline: 12px;
  }
  .dch-summary-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .dch-stat-card.is-primary {
    grid-column: 1 / -1;
  }
  .dch-select-group select {
    flex: 1 1 110px;
  }
}
