/* @import url('https://fonts.googleapis.com/css2?family=Noto+Sans+TC:wght@100;300;400;500;700;900&display=swap'); */
@import url('https://fonts.googleapis.com/css2?family=Maven+Pro:wght@400;500;600;700;800;900&display=swap');

:root {
  --navy: #010f2e;
  --blue: #6697ff;
  --blue-deep: #204863;
  --bg: #eef2f8;
  --panel: #ffffff;
  --line: #d7dee9;
  --text: #1a2332;
  --muted: #6b778a;
  --fail-bg: #fde8e8;
  --fail-fg: #b42318;
  --refund-bg: #fff1e6;
  --refund-fg: #c2410c;
  --ok: #0f7b4c;
  --warn: #b45309;
  --sidebar-w: 248px;
  --radius: 10px;
  --shadow: 0 10px 30px rgba(1, 15, 46, 0.08);
  --font: "Maven Pro", "Noto Sans TC", sans-serif;
  --fs-body: 16px;
  --fs-table: 0.84rem;
  --fs-meta: 0.86rem;
  --fs-toolbar: 0.85rem;
  --fs-nav: 1rem;
  --fs-title: 1.25rem;
  --dt-footer-font: 0.85rem;
}

/* db.php 專用：info 靠表格右側、sensor 欄位縮窄 */
#dbTabsContent div.dataTables_wrapper div.dataTables_info {
  text-align: right !important;
  width: auto !important;
}
#dbOrderInfoTable .js-order-sensor {
  width: 80px !important;
  max-width: 80px !important;
  display: inline-block;
}

/* ===== 基礎重置 ===== */
* {
  margin: 0;
  padding: 0;
  -webkit-box-sizing: border-box;
  -moz-box-sizing: border-box;
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  font-family: var(--font);
  font-size: var(--fs-body);
  color: var(--text);
  background:
    radial-gradient(1200px 500px at 10% -10%, rgba(102, 151, 255, 0.22), transparent 60%),
    radial-gradient(900px 400px at 100% 0%, rgba(32, 72, 99, 0.12), transparent 55%),
    var(--bg);
}

button,
input,
select,
textarea {
  font: inherit;
}

/* ===== 登入頁面樣式（對齊 partner／後台殼層） ===== */
#userLogin {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.25rem;
  background: linear-gradient(180deg, #071833 0%, #010f2e 100%);
}

#logoNav {
  background-color: var(--navy);
}

#userLogin .login-shell {
  width: 100%;
  max-width: 760px;
}

#userLogin .login-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.75rem 1.5rem 1.5rem;
}

#userLogin .login-heading {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  margin: 0 0 1rem;
}

#userLogin .login-heading-logo {
  width: 56px;
  height: 56px;
  object-fit: contain;
  flex-shrink: 0;
}

#userLogin .login-card h1 {
  font-size: var(--fs-title);
  font-weight: 700;
  color: var(--navy);
  margin: 0;
  text-align: center;
}

#userLogin .login-lead {
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.5;
  margin: 0 0 1rem;
}

#userLogin .login-card a {
  color: var(--blue-deep);
  font-weight: 600;
}

#userLogin .form-group {
  margin-bottom: 0.85rem;
}

#userLogin .input-group-text {
  background: #f7f9fc;
  border: 1px solid var(--line);
  color: var(--blue-deep);
  min-width: 2.75rem;
  justify-content: center;
}

#userLogin .form-control {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--text);
}

#userLogin .form-control:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 0.15rem rgba(102, 151, 255, 0.2);
}

#userLogin .input-group:not(:has(.input-group-append)) .form-control {
  border-radius: 0 8px 8px 0 !important;
}

#userLogin .input-group:not(:has(.input-group-append)) .input-group-text {
  border-radius: 8px 0 0 8px !important;
}

#userLogin .input-group:has(.input-group-append) .form-control {
  border-radius: 0 !important;
}

#userLogin .input-group:has(.input-group-append) .input-group-text {
  border-radius: 8px 0 0 8px !important;
}

#userLogin .input-group:has(.input-group-append) .input-group-append .btn {
  border-radius: 0 8px 8px 0 !important;
  border-color: var(--line);
  color: var(--muted);
  background: #fff;
}

#userLogin .login-remember {
  margin-bottom: 1.1rem;
}

#userLogin .custom-control-label {
  color: var(--muted);
  font-size: 0.9rem;
}

#userLogin .loginBtn,
#userLogin .myBtn {
  appearance: none;
  border: 0;
  border-radius: 8px;
  padding: 0.7rem 0.95rem;
  background: linear-gradient(135deg, #0acffe, #495aff);
  color: #fff;
  font-weight: 700;
  font-size: 1rem;
  box-shadow: 0 8px 16px rgba(73, 90, 255, 0.28);
}

#userLogin .loginBtn:hover,
#userLogin .myBtn:hover {
  filter: brightness(1.05);
  color: #fff;
}

#userLogin .login-back {
  appearance: none;
  display: block;
  width: 100%;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 8px;
  padding: 0.55rem 0.8rem;
  color: var(--blue-deep);
  font-weight: 600;
  cursor: pointer;
}

#userLogin .login-back:hover {
  background: #f7f9fc;
}

.wrapper {
  height: 100vh;
}

.myColor {
  background-color: var(--navy);
}

.myShadow {
  box-shadow: var(--shadow);
}

.myHr {
  height: 2px;
  border-radius: 100px;
}

.myLinkBtn {
  border-radius: 8px;
  width: 80%;
  border: 2px solid #fff;
}

/* ===== 登入表單輸入框圓角 ===== */
.input-group:not(:has(.input-group-append)) .form-control {
  border-radius: 0 0.375rem 0.375rem 0 !important;
}

.input-group:not(:has(.input-group-append)) .input-group-text {
  border-radius: 0.375rem 0 0 0.375rem !important;
}

.input-group:has(.input-group-append) .form-control {
  border-radius: 0 !important;
}

.input-group:has(.input-group-append) .input-group-text {
  border-radius: 0.375rem 0 0 0.375rem !important;
}

.input-group:has(.input-group-append) .input-group-append .btn {
  border-radius: 0 0.375rem 0.375rem 0 !important;
}

/* ===== Partner 風格 App Shell ===== */
.app {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  background: linear-gradient(180deg, #071833 0%, #010f2e 100%);
  color: #fff;
  padding: 1.1rem 0.85rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  z-index: 30;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.35rem 0.45rem 0.85rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
  min-width: 0;
}

.brand-link {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-width: 0;
  text-decoration: none;
  color: inherit;
}

.brand-logo {
  width: 56px;
  height: 56px;
  object-fit: contain;
  flex-shrink: 0;
}

.brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
}

.brand-text strong {
  font-size: 1.05rem;
}

.brand-text span {
  font-size: 0.78rem;
  color: rgba(255, 255, 255, 0.65);
}

.sidebar .nav {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  overflow: auto;
  flex: 1;
  padding-right: 0.15rem;
}

.sidebar .nav a {
  appearance: none;
  border: 0;
  background: transparent;
  color: rgba(255, 255, 255, 0.78);
  text-align: left;
  padding: 0.7rem 0.8rem;
  border-radius: 8px;
  cursor: pointer;
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 0.65rem;
  font-size: var(--fs-nav);
  transition: background 0.15s ease, color 0.15s ease;
  white-space: nowrap;
}

.sidebar .nav a i {
  width: 1.1rem;
  text-align: center;
  flex-shrink: 0;
}

.sidebar .nav a:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
}

.sidebar .nav a.active,
.sidebar .nav a.link-active {
  background: rgba(102, 151, 255, 0.22);
  color: #fff;
  box-shadow: inset 0 0 0 1px rgba(102, 151, 255, 0.45);
}

.sidebar-foot {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  padding: 0.75rem 0.8rem;
  border-top: 1px solid rgba(255, 255, 255, 0.12);
  font-size: 0.78rem;
  color: rgba(255, 255, 255, 0.8);
}

.sidebar-foot .muted {
  color: rgba(255, 255, 255, 0.5);
}

.app > .main {
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 0.85rem;
  padding: 1rem 1.25rem;
  background: rgba(238, 242, 248, 0.88);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(215, 222, 233, 0.85);
}

.menu-btn {
  display: none;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 8px;
  width: 40px;
  height: 40px;
  cursor: pointer;
  place-items: center;
  text-decoration: none;
  color: var(--navy);
  flex-shrink: 0;
}

.topbar-title {
  flex: 1;
  min-width: 0;
}

.topbar-title h1 {
  font-size: var(--fs-title);
  font-weight: 700;
  color: var(--navy);
  margin: 0;
}

.topbar:has(.topbar-report-nav) {
  justify-content: center;
}

.topbar:has(.topbar-report-nav) .topbar-actions {
  position: absolute;
  right: 1.25rem;
  top: 50%;
  transform: translateY(-50%);
}

.topbar-report-nav {
  flex: 0 1 auto;
  max-width: calc(100% - 14rem);
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.2rem;
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
}

.topbar-report-nav button {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--muted);
  white-space: nowrap;
  padding: 0.4rem 0.7rem;
  border-radius: 8px;
  font-size: 0.92rem;
  font-weight: 600;
  cursor: pointer;
  line-height: 1.3;
}

.topbar-report-nav button:hover {
  color: var(--navy);
  background: rgba(255, 255, 255, 0.7);
}

.topbar-report-nav button.active {
  color: var(--navy);
  background: #fff;
  box-shadow: inset 0 0 0 1px var(--line);
}

.topbar-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  align-items: center;
  justify-content: flex-end;
}

.ghost-btn,
.topbar-logout {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 8px;
  padding: 0.45rem 0.8rem;
  color: var(--blue-deep);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 600;
}

.ghost-btn:hover,
.topbar-logout:hover {
  background: #f7f9fc;
  color: var(--navy);
  text-decoration: none;
}

.app > .main > .content {
  padding: 1rem 1.25rem 2rem;
  margin-left: 0;
  min-width: 0;
}

.myContent {
  margin-top: 0;
}

/* 表格／DataTables：對齊 partner table.report 0.84rem */
.table,
table.dataTable,
.dataTables_wrapper {
  font-size: var(--fs-table);
}

.card-header,
.card-header h5,
.card-header h6,
.panel-head h2 {
  font-size: 1rem;
  font-weight: 700;
}

.note {
  font-size: var(--fs-meta);
  color: var(--muted);
}

.form-control,
.custom-select,
.btn:not(.btn-lg):not(.btn-sm) {
  font-size: var(--fs-toolbar);
}

.btn-sm {
  font-size: 0.78rem;
}

.backdrop {
  display: none;
}

/* 相容舊 class 名稱（殼層已改為 .sidebar / .topbar） */

/* ===== 卡片樣式（對齊 partner panel） ===== */
.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.card-header {
  background: linear-gradient(90deg, rgba(102, 151, 255, 0.12), transparent 70%);
  border-bottom: 1px solid var(--line);
  color: var(--navy);
}

.card-header.text-white:not(.bg-light):not(.bg-white) {
  background: var(--navy);
  color: #fff;
}

/* ===== 各頁統一內容卡片（對齊 partner .panel） ===== */
.page-panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  margin-bottom: 1rem;
}

/* 機台列表：避免 page-panel 圓角裁切造成表頭左右縫 */
.page-panel:has(#showDevice) {
  overflow: visible;
}

.page-panel > .card-body,
.page-panel-body {
  padding: 1rem 1.15rem;
}

.myContent.px-0 > .page-panel,
.myContent > .page-panel {
  margin-bottom: 0;
}

/* 卡片內表格不再套雙層邊框 */
.page-panel #showDevice.table-responsive,
.page-panel #showInventory.table-responsive,
.page-panel #showAvalible.table-responsive,
.page-panel #showBoxAlias.table-responsive,
.page-panel .table-responsive {
  border: 0 !important;
  box-shadow: none !important;
  background: transparent !important;
  padding: 0 !important;
  margin-top: 0 !important;
  border-radius: 0 !important;
}

.page-panel .records-cubo-table-scroll {
  box-shadow: none;
}

.page-panel.records-location-panel {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
  margin-bottom: 0;
  height: 100%;
}

.page-panel.records-location-panel > .page-panel-body {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
  height: 100%;
}

/* 全寬設定頁分頁 */
.myContent .nav-tabs {
  border-bottom: 1px solid #dee2e6;
}

.myContent .tab-content {
  width: 100%;
}

.myContent .tab-pane .d-flex h5 {
  margin: 0;
  font-weight: 600;
}

/* ===== 按鈕樣式 ===== */
.myContent .btn-primary {
  background-color: var(--blue);
  border-color: var(--blue);
  font-weight: 500;
}

.myContent .btn-primary:hover {
  background-color: #4d7ff0;
  border-color: #4d7ff0;
}

.btn:focus,
.btn:active {
  outline: none !important;
  box-shadow: none;
}

/* ===== 邊框樣式 ===== */
.border-left-primary {
  border-left: 0.25rem solid #4e73df !important;
}

.border-left-info {
  border-left: 0.25rem solid #36b9cc !important;
}

.border-left-success {
  border-left: 0.25rem solid #1cc88a !important;
}

.border-left-warning {
  border-left: 0.25rem solid #f6c23e !important;
}

/* ===== 側邊欄動畫（舊 collapse；新殼層改用手機 drawer） ===== */
.myBtn[aria-expanded="false"] .myCaret:before {
  font-family: "Font Awesome 5 Free";
  font-weight: 900;
  content: "\f107";
  float: right;
  transition: all 0.5s;
}

.myBtn[aria-expanded="true"] .myCaret:before {
  font-family: "Font Awesome 5 Free";
  font-weight: 900;
  content: "\f107";
  float: right;
  transition: all 0.5s;
  -webkit-transform: rotate(180deg);
  -moz-transform: rotate(180deg);
  transform: rotate(180deg);
}

/* ===== 固定滾動區域 ===== */
.lockscroll {
  position: relative;
  width: 100%;
  max-width: 100%;
}

/* ===== 表格和 DataTable 樣式 ===== */
/* 通用 DataTable 樣式 */
.dataTables_wrapper {
  width: 100% !important;
  margin: 0 !important;
  overflow: hidden !important;
}

.dataTables_wrapper .row {
  margin: 0 !important;
  width: 100% !important;
  overflow: hidden;
}

.dataTables_wrapper .col-sm-12 {
  padding: 0 !important;
  overflow: hidden;
}

.dataTables_wrapper .dataTable {
  width: 100% !important;
  min-width: 100%;
}

.dataTables_wrapper .dataTables_scroll {
  width: 100%;
}

/* DataTables scrollY：不加整表外框；表頭上方圓角、表身下方圓角（對齊機台列表解法） */
.dataTables_wrapper .dataTables_scroll {
  border: 0 !important;
  border-radius: 0 !important;
  overflow: visible;
  background: transparent;
}

.dataTables_wrapper .dataTables_scrollHead,
.dataTables_wrapper .dataTables_scrollHeadInner {
  border: 0 !important;
  background: var(--navy) !important;
  margin: 0 !important;
}

.dataTables_wrapper .dataTables_scrollHead {
  border-radius: var(--radius) var(--radius) 0 0 !important;
  overflow: hidden !important;
}

.dataTables_wrapper .dataTables_scrollHeadInner {
  padding-top: 0 !important;
  padding-bottom: 0 !important;
  padding-left: 0 !important;
}

.dataTables_wrapper .dataTables_scrollHead table {
  margin: 0 !important;
}

.dataTables_wrapper .dataTables_scrollBody {
  border: 1px solid var(--line) !important;
  border-radius: 0 0 var(--radius) var(--radius) !important;
  background: #fff !important;
  margin: 0 !important;
}

.dataTables_wrapper .dataTables_scrollHead table thead th {
  border-radius: 0 !important;
  background: var(--navy) !important;
}

/* 表身隱藏 thead：避免全域海軍藍樣式撐出上方空隙 */
.dataTables_wrapper .dataTables_scrollBody thead,
.dataTables_wrapper .dataTables_scrollBody thead tr,
.dataTables_wrapper .dataTables_scrollBody thead th {
  height: 0 !important;
  min-height: 0 !important;
  max-height: 0 !important;
  padding-top: 0 !important;
  padding-bottom: 0 !important;
  border: 0 !important;
  line-height: 0 !important;
  font-size: 0 !important;
  color: transparent !important;
  background: transparent !important;
  overflow: hidden !important;
}

/* 機台列表：有 scrollY 時由 DataTable 負責捲動，預留上方與分頁區高度 */
#showDevice .dataTables_wrapper .dataTables_scrollBody {
  max-height: calc(100vh - 430px) !important;
  overflow: auto !important;
}

#showDevice .dataTables_wrapper .dataTables_scroll {
  margin-bottom: 1rem !important;
  margin-top: 0 !important;
}
#showDevice.table-responsive {
  overflow: visible;
}
#showDevice .dataTables_wrapper .top-information {
  margin-bottom: 0.25rem !important;
}

/* 銷售記錄列表：scrollY 表格捲動、分頁固定可見 */
#showAllRecords .dataTables_wrapper .dataTables_scrollBody {
  max-height: calc(100vh - 430px) !important;
}
#showAllRecords.table-responsive {
  overflow: visible;
}
#showAllRecords .dataTables_wrapper .top-information {
  margin-bottom: 0.25rem !important;
}
#showAllRecords .dataTables_wrapper .dataTables_scroll {
  margin-top: 0 !important;
}

.table-responsive {
  max-width: 100%;
  border-radius: 0;
  background: transparent;
  overflow-x: auto !important;
  overflow-y: visible;
  margin-top: 1rem;
  border: 0;
  box-shadow: none;
}

/* 無 scrollY 的 DataTables：表頭上方圓角、表身下方圓角＋邊框 */
.dataTables_wrapper:not(:has(.dataTables_scroll)) table.dataTable > thead > tr > th:first-child {
  border-top-left-radius: var(--radius) !important;
}
.dataTables_wrapper:not(:has(.dataTables_scroll)) table.dataTable > thead > tr > th:last-child {
  border-top-right-radius: var(--radius) !important;
}
.dataTables_wrapper:not(:has(.dataTables_scroll)) table.dataTable > thead > tr > th {
  border-radius: 0;
  background: var(--navy) !important;
  color: #fff !important;
}
.dataTables_wrapper:not(:has(.dataTables_scroll)) table.dataTable > tbody > tr > td:first-child {
  border-left: 1px solid var(--line) !important;
}
.dataTables_wrapper:not(:has(.dataTables_scroll)) table.dataTable > tbody > tr > td:last-child {
  border-right: 1px solid var(--line) !important;
}
.dataTables_wrapper:not(:has(.dataTables_scroll)) table.dataTable > tbody > tr:first-child > td {
  border-top: 1px solid var(--line) !important;
}
.dataTables_wrapper:not(:has(.dataTables_scroll)) table.dataTable > tbody > tr:last-child > td {
  border-bottom: 1px solid var(--line) !important;
}
.dataTables_wrapper:not(:has(.dataTables_scroll)) table.dataTable > tbody > tr:last-child > td:first-child {
  border-bottom-left-radius: var(--radius) !important;
}
.dataTables_wrapper:not(:has(.dataTables_scroll)) table.dataTable > tbody > tr:last-child > td:last-child {
  border-bottom-right-radius: var(--radius) !important;
}

/* 一般 HTML 表格（非 DataTables）：同樣表頭上圓角、表身下圓角 */
.table-responsive > table.table:not(.dataTable) > thead > tr > th {
  background: var(--navy) !important;
  color: #fff !important;
  border-radius: 0 !important;
}
.table-responsive > table.table:not(.dataTable) > thead > tr > th:first-child {
  border-top-left-radius: var(--radius) !important;
}
.table-responsive > table.table:not(.dataTable) > thead > tr > th:last-child {
  border-top-right-radius: var(--radius) !important;
}
.table-responsive > table.table:not(.dataTable) > tbody > tr > td:first-child {
  border-left: 1px solid var(--line) !important;
}
.table-responsive > table.table:not(.dataTable) > tbody > tr > td:last-child {
  border-right: 1px solid var(--line) !important;
}
.table-responsive > table.table:not(.dataTable) > tbody > tr:first-child > td {
  border-top: 1px solid var(--line) !important;
}
.table-responsive > table.table:not(.dataTable) > tbody > tr:last-child > td {
  border-bottom: 1px solid var(--line) !important;
}
.table-responsive > table.table:not(.dataTable) > tbody > tr:last-child > td:first-child {
  border-bottom-left-radius: var(--radius) !important;
}
.table-responsive > table.table:not(.dataTable) > tbody > tr:last-child > td:last-child {
  border-bottom-right-radius: var(--radius) !important;
}

/* 單日機台銷售：與其他表一致的表頭／表身圓角（需 separate 才看得到圓角） */
.day-sales-table-wrap {
  margin-top: 0 !important;
}
.day-sales-table {
  width: 100% !important;
  margin: 0 !important;
  border-collapse: separate !important;
  border-spacing: 0 !important;
  background: transparent;
}
.day-sales-table > thead > tr > th {
  background: var(--navy) !important;
  color: #fff !important;
  font-weight: 600;
  text-align: center !important;
  vertical-align: middle !important;
  border: 0 !important;
  border-radius: 0 !important;
  padding: 0.75rem 0.5rem !important;
}
.day-sales-table > thead > tr > th:first-child {
  border-top-left-radius: var(--radius) !important;
}
.day-sales-table > thead > tr > th:last-child {
  border-top-right-radius: var(--radius) !important;
}
.day-sales-table > tbody > tr > td {
  text-align: center !important;
  vertical-align: middle !important;
  background: #fff;
  border-top: 0 !important;
  border-bottom: 1px solid var(--line) !important;
  border-left: 0 !important;
  border-right: 0 !important;
  padding: 0.7rem 0.5rem !important;
}
.day-sales-table > tbody > tr > td:first-child {
  border-left: 1px solid var(--line) !important;
}
.day-sales-table > tbody > tr > td:last-child {
  border-right: 1px solid var(--line) !important;
}
.day-sales-table > tbody > tr:first-child > td {
  border-top: 1px solid var(--line) !important;
}
.day-sales-table > tbody > tr:last-child > td {
  border-bottom: 1px solid var(--line) !important;
}
.day-sales-table > tbody > tr:last-child > td:first-child {
  border-bottom-left-radius: var(--radius) !important;
}
.day-sales-table > tbody > tr:last-child > td:last-child {
  border-bottom-right-radius: var(--radius) !important;
}
.day-sales-table > tbody > tr:hover > td {
  background: #f8f9fa;
}

/* sticky 明細表：表頭上方圓角、表身下方圓角＋邊框（與 DataTables 機台列表一致） */
.records-location-table-scroll,
.records-cubo-table-scroll {
  border: 0 !important;
  border-radius: 0 !important;
  overflow: auto;
  background: transparent;
  box-shadow: none;
}

.records-location-table-scroll {
  overflow-x: auto;
  overflow-y: visible;
}

.records-location-table-scroll table thead th,
.records-cubo-table-scroll table thead th {
  border-radius: 0 !important;
  background: var(--navy) !important;
  color: #fff !important;
}

.records-location-table-scroll table thead th:first-child,
.records-cubo-table-scroll table thead th:first-child {
  border-top-left-radius: var(--radius) !important;
}

.records-location-table-scroll table thead th:last-child,
.records-cubo-table-scroll table thead th:last-child {
  border-top-right-radius: var(--radius) !important;
}

.records-location-table-scroll table tbody td:first-child,
.records-cubo-table-scroll table tbody td:first-child {
  border-left: 1px solid var(--line) !important;
}

.records-location-table-scroll table tbody td:last-child,
.records-cubo-table-scroll table tbody td:last-child {
  border-right: 1px solid var(--line) !important;
}

.records-location-table-scroll table tbody tr:first-child td,
.records-cubo-table-scroll table tbody tr:first-child td {
  border-top: 1px solid var(--line) !important;
}

.records-location-table-scroll table tbody tr:last-child td,
.records-cubo-table-scroll table tbody tr:last-child td {
  border-bottom: 1px solid var(--line) !important;
}

.records-location-table-scroll table tbody tr:last-child td:first-child,
.records-cubo-table-scroll table tbody tr:last-child td:first-child {
  border-bottom-left-radius: var(--radius) !important;
}

.records-location-table-scroll table tbody tr:last-child td:last-child,
.records-cubo-table-scroll table tbody tr:last-child td:last-child {
  border-bottom-right-radius: var(--radius) !important;
}

.table-responsive table {
  width: 100% !important;
}

/* DataTable 控制項樣式 */
.dataTables_filter {
  margin-bottom: 15px;
  text-align: right;
  overflow: visible !important;
}

.dataTables_filter input {
  max-width: 200px;
  width: 200px;
  border: 1px solid #ddd;
  border-radius: 4px;
  padding: 6px 12px;
  overflow: visible !important;
}

.dataTables_filter label {
  white-space: nowrap;
  overflow: visible !important;
}

.dataTables_length,
.dataTables_length label,
.dataTables_length select {
  white-space: nowrap;
}

.dataTables_length label {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  margin-bottom: 0;
}

.dataTables_info {
  text-align: center;
  width: 100%;
  margin-left: auto;
  margin-right: auto;
}

.bottom-information .dataTables_info {
  width: auto;
  flex: 1 1 auto;
  text-align: center;
  margin-left: 0;
  margin-right: 0;
}

.bottom-information .dataTables_length,
.bottom-information .dataTables_paginate {
  flex: 0 0 auto;
}

.bottom-information {
  align-items: flex-start;
}
.bottom-information .dataTables_length,
.bottom-information .dataTables_info,
.bottom-information .dataTables_paginate {
  margin-top: 0 !important;
  padding-top: 0 !important;
}

.bottom-information {
  margin-top: 1rem !important;
}

.dt-buttons {
  margin-bottom: 15px;
  overflow: visible !important;
}

.dt-buttons .btn {
  font-size: var(--fs-toolbar);
  padding: 0.45rem 0.75rem;
  border-radius: 8px;
  margin-right: 5px;
  overflow: visible !important;
}

.dataTables_length {
  margin-bottom: 15px;
  overflow: visible !important;
}

.dataTables_length,
.dataTables_length label,
.dataTables_length select {
  white-space: nowrap;
}

.dataTables_length label {
  display: inline-block;
  margin-bottom: 0;
}

.dataTables_length select {
  margin: 0 0.35rem;
}

.dataTables_length select {
  border: 1px solid #ddd;
  border-radius: 4px;
  padding: 4px 8px;
  overflow: visible !important;
}

.dataTables_info {
  margin-top: 15px;
  color: #666;
  overflow: visible !important;
  font-size: var(--dt-footer-font, 1.15rem) !important;
  text-align: center;
}

.dataTables_paginate {
  margin-top: 15px;
  overflow: visible !important;
  white-space: nowrap;
  font-size: var(--dt-footer-font, 1.15rem) !important;
}

/* 分頁樣式：與 db.php 一致（提高 selector specificity 以覆蓋外部套件） */
div.dataTables_wrapper div.dataTables_paginate .paginate_button {
  padding: 0.05rem 0.2rem !important;
  margin: 0 0.05rem !important;
  border: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
  min-width: 0 !important;
  color: #333 !important;
  white-space: nowrap;
  display: inline-block;
  border-radius: 0.25rem;
}

/* 壓縮分頁按鈕間距（DataTables 預設把按鈕放在 span 裡） */
div.dataTables_wrapper div.dataTables_paginate span {
  display: inline-flex;
  gap: 0.1rem !important;
  align-items: center;
}

div.dataTables_wrapper div.dataTables_paginate .paginate_button.current,
div.dataTables_wrapper div.dataTables_paginate .paginate_button.current:hover {
  background: rgba(0, 0, 0, 0.08) !important;
  color: #333 !important;
  border: 0 !important;
}

div.dataTables_wrapper div.dataTables_paginate .paginate_button:hover {
  background: rgba(0, 0, 0, 0.04) !important;
}

/* 若頁面使用 DataTables Bootstrap 分頁（ul.pagination / .page-link）也套用 db.php 同款 */
div.dataTables_wrapper div.dataTables_paginate ul.pagination {
  margin: 0;
  white-space: nowrap;
  flex-wrap: nowrap;
  column-gap: 0.1rem;
}
div.dataTables_wrapper div.dataTables_paginate ul.pagination .page-item {
  flex: 0 0 auto;
}
div.dataTables_wrapper div.dataTables_paginate ul.pagination .page-link {
  padding: 0.05rem 0.2rem !important;
  border: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
  min-width: 0 !important;
  width: auto !important;
  line-height: 1.1;
  font-size: var(--dt-footer-font, 1.15rem) !important;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
div.dataTables_wrapper div.dataTables_paginate ul.pagination .page-item + .page-item {
  margin-left: 0 !important;
}
div.dataTables_wrapper div.dataTables_paginate ul.pagination .page-item.active .page-link {
  background: rgba(0, 0, 0, 0.08) !important;
  border-radius: 0.25rem;
}

/* management.php 使用 bottom-information 容器，避免左右欄位被撐擠導致折行 */
.bottom-information {
  flex-wrap: nowrap;
  align-items: flex-start;
  margin-top: 1rem !important; /* 與表格保留距離 */
}
.bottom-information > * {
  flex: 0 0 auto;
}

.bottom-information .dataTables_info {
  flex: 1 1 auto;
  text-align: center;
}

.bottom-information .dataTables_length,
.bottom-information .dataTables_info,
.bottom-information .dataTables_paginate {
  margin-top: 0 !important;
  padding-top: 0 !important;
}

/* 表格文字置中 */
.dataTables_wrapper table thead th,
.dataTables_wrapper table tbody td {
  text-align: center !important;
}

.table td, .table th {
  text-align: center !important;
  vertical-align: middle !important;
}

/* 表頭：對齊左側側欄海軍藍（partner table.report th） */
.table thead th,
table.dataTable thead th,
.dataTables_wrapper table thead th {
  background: var(--navy) !important;
  color: #fff !important;
  font-weight: 600;
}

.table thead th a,
table.dataTable thead th a,
.dataTables_wrapper table thead th a,
.table thead th .sorting,
.table thead th .sorting_asc,
.table thead th .sorting_desc {
  color: #fff !important;
}

/* ===== Modal 樣式 ===== */
.modal {
  position: fixed !important;
  top: 0 !important;
  left: 0 !important;
  width: 100vw !important;
  height: 100vh !important;
  z-index: 1050 !important;
  margin: 0 !important;
  padding: 0 !important;
}

.modal-dialog {
  position: fixed !important;
  top: 50% !important;
  left: 50% !important;
  transform: translate(-50%, -50%) !important;
  margin: 0 !important;
  max-width: 98% !important;
  width: 98% !important;
}

/* records-grid modal 特殊樣式 */
.records-modal-dialog {
  max-width: 98% !important;
  width: 98% !important;
}

.records-modal-content {
  width: 100% !important;
}

.records-modal-header {
  padding: 10px 20px !important;
}

.records-modal-body {
  padding: 20px !important;
}

/* 編輯設備 modal 樣式：高度隨內容，僅在內容多時限制最大 80vh */
#editDeviceModal .modal-dialog {
  max-width: 500px !important;
  width: 500px !important;
  max-height: 80vh !important;
  height: auto !important;
}

#editDeviceModal .modal-content {
  height: 100% !important;
  display: flex !important;
  flex-direction: column !important;
  border-radius: 0.3rem;
}

#editDeviceModal .modal-header {
  flex-shrink: 0 !important;
  padding: 0.5rem 1rem;
  background-color: #6697ff;
}

#editDeviceModal .modal-body {
  flex: 1 !important;
  overflow-y: auto !important;
  padding: 0.75rem !important;
}

#editDeviceModal .modal-footer {
  flex-shrink: 0 !important;
}

#editDeviceModal .modal-title {
  font-size: 1rem;
}

#editDeviceModal .form-group {
  margin-bottom: 0.75rem;
}

#editDeviceModal .form-group h5 {
  font-size: 0.9rem;
  margin-bottom: 0.25rem;
}

#editDeviceModal .form-control {
  font-size: 0.8rem;
  padding: 0.25rem 0.5rem;
  height: auto;
}

#editDeviceModal .btn {
  font-size: 0.75rem;
  padding: 0.25rem 0.5rem;
  margin-bottom: 0.25rem;
}

#editDeviceModal .btn-lg {
  font-size: 0.8rem;
  padding: 0.4rem 0.8rem;
}

/* QR Modal 樣式 */
.qr-modal-header {
  background-color: #6697ff;
}

.qr-print-btn {
  background-color: #6697ff;
}

/* management.php：QR 列印彈出視窗（僅載入本檔時 body 使用下列 class） */
body.qr-print-window {
  font-family: "Maven Pro", sans-serif;
  margin: 0;
  padding: 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  box-sizing: border-box;
}

body.qr-print-window .qr-print-window-device-id {
  margin-bottom: 16px;
  font-size: 18px;
}

body.qr-print-window .qr-print-window-img {
  width: 4cm;
  height: 4cm;
  display: block;
}

/* ===== 地圖相關樣式 ===== */
.map-wrapper {
  width: 100%; 
  overflow: hidden; 
  margin-top: 10px;
}

.map-container {
  display: none; 
  border: 1px solid #ddd; 
  border-radius: 5px; 
  box-sizing: border-box;
}

#editDeviceModal .map-wrapper {
  margin-top: 0.5rem;
}

#editDeviceModal #mapContainer {
  height: 400px;
  width: 100%;
  max-width: 100%;
}

.location-info {
  display: none;
}

/* Google Maps 樣式優化 */
.gm-style .gm-style-iw {
  padding: 0 !important;
  border-radius: 6px !important;
  box-shadow: 0 2px 7px rgba(0,0,0,0.3) !important;
}

.gm-style .gm-style-iw-c {
  padding: 0 !important;
  max-width: 350px !important;
  min-width: 200px !important;
}

.gm-style .gm-style-iw-d {
  overflow: hidden !important;
  padding: 0 !important;
}

.gm-style .gm-style-iw-tc {
  display: none !important;
  width: 20px !important;
  height: 20px !important;
}

.gm-style .gm-style-iw-tc::after {
  display: none !important;
}

.gm-style .gm-style-iw-tc .gm-style-iw-tc-gm {
  width: 20px !important;
  height: 20px !important;
}

/* 地圖信息窗口樣式 */
.map-info-window {
  padding: 10px 15px; 
  min-width: 200px; 
  max-width: 350px; 
  font-size: 15px; 
  line-height: 1.5;
}

.map-info-title {
  font-weight: bold; 
  color: #333; 
  margin-bottom: 6px; 
  font-size: 16px; 
  white-space: nowrap;
}

.map-info-address {
  color: #666; 
  font-size: 14px; 
  white-space: nowrap; 
  overflow: hidden; 
  text-overflow: ellipsis;
}

/* ===== 導覽連結上的徽章定位 ===== */
.nav-link {
  position: relative;
}

.badge-counter {
  position: absolute;
  transform: scale(0.7);
  transform-origin: top right;
  right: .25rem;
  margin-top: -.25rem;
}

/* ===== 設備管理相關樣式 ===== */
#edit-device-form #ebxid {
  font-size: 2rem;
  font-weight: 500;
  background-color: transparent;
  border: none;
  outline-width: 0;
}

.dt-button.excelButton {
  width: 15em;
  background-color: #6697ff !important;
  color: white;
  border: 0em;
}

.marginImage {
  margin-left: 0;
  display: flex;
  justify-content: center;
}

.circle-online {
  display: flex;
  justify-content: center;
  align-items: center;
  border-style: solid;
  border-color: rgb(45, 183, 45);
  border-radius: 50% !important;
  height: 100px;
  width: 100px;
  border-width: 5px !important;
}

.circle-offline {
  display: flex;
  justify-content: center;
  align-items: center;
  border-style: solid;
  border-color: rgb(228, 226, 226);
  border-radius: 50% !important;
  height: 100px;
  width: 100px;
  border-width: 5px !important;
}

/* ===== 表單樣式 ===== */
form.is-readonly input[readonly],
input[disabled],
textarea[disabled] {
  cursor: text;
  background-color: #fff !important;
  border-color: transparent;
  outline-color: transparent;
  box-shadow: none;
}

form.is-readonly .KeyUpdateBtn {
  display: none;
}

form.is-editing .KeyEditBtn {
  display: none;
}

/* 金鑰長度驗證樣式 */
.error {
  border-color: red;
}

.warning {
  color: red;
  display: none;
}

/* ===== Records 頁面樣式 ===== */
/* 網格檢視：固定於頂欄與側欄內側，內容過長時可垂直捲動 */
.records-container {
  position: fixed;
  top: 4.75rem;
  left: var(--sidebar-w);
  right: 0;
  bottom: 0;
  width: auto;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  padding: 1rem 1.25rem 2rem;
  box-sizing: border-box;
}

.main.animate .records-container {
  left: var(--sidebar-w);
}

/* records-grid：機台卡片網格間距 */
#showAllCubo.row {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem 1.25rem;
  margin-left: 0;
  margin-right: 0;
}

#showAllCubo .card {
  flex: 0 0 250px;
  width: 250px;
  max-width: 100%;
  margin: 0;
  border: 1px solid var(--line) !important;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  background: var(--panel);
}

#showAllCubo .card .card-body {
  padding: 1rem 0.85rem;
}

/* records-location：鎖住整頁捲軸，僅表格 stack／卡片區可捲；容器高度 = 視窗 − 頂欄 */
@media (min-width: 1025px) {
  html.is-records-location,
  html.is-records-location body {
    height: 100%;
    max-height: 100vh;
    overflow: hidden !important;
  }

  body.is-records-location > .app {
    height: 100%;
    min-height: 0;
    overflow: hidden;
  }

  body.is-records-location .app > .main {
    height: 100%;
    min-height: 0;
    overflow: hidden;
  }

  body.is-records-location .app > .main > .content {
    height: 100%;
    min-height: 0;
    overflow: hidden;
    padding: 0;
  }

  .records-container.records-container--location-list {
    display: flex;
    flex-direction: column;
    position: relative;
    top: auto;
    left: auto !important;
    right: auto;
    bottom: auto;
    height: calc(100dvh - 4.75rem);
    max-height: calc(100dvh - 4.75rem);
    overflow: hidden !important;
    overflow-x: hidden;
    padding: 1rem 1.25rem 0.5rem;
    box-sizing: border-box;
  }

  .records-container.records-container--location-list > .row {
    flex-shrink: 0;
  }

  .records-container.records-container--location-list .page-panel.records-location-panel {
    flex: 1 1 auto;
    min-height: 0;
  }

  .records-container.records-container--location-list #showAllRecords {
    flex: 1 1 auto;
    min-height: 16rem;
    overflow: hidden;
    display: flex;
    flex-direction: column;
  }

  .records-container.records-container--location-list #showAllRecords > p,
  .records-container.records-container--location-list #showAllRecords > .alert {
    flex-shrink: 0;
  }

  .records-container.records-container--location-list #showAllRecords > h3 {
    flex-shrink: 0;
  }

  .records-container.records-container--location-list #showAllRecords > .records-location-cards-pane {
    flex: 1 1 auto;
    min-height: 12rem;
    overflow-x: hidden;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  .records-container.records-container--location-list #showAllRecords > .records-location-tables-stack {
    flex: 1 1 auto;
    min-height: 16rem;
    overflow-x: hidden;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  .records-container.records-container--location-list #showAllRecords > .records-location-tables-stack > .records-location-group-title {
    flex-shrink: 0;
    color: var(--navy);
  }

  .records-container.records-container--location-list .records-location-tables-stack .records-location-table-scroll {
    overflow-x: auto;
    overflow-y: visible;
    max-height: none;
    min-height: 12rem;
    background: transparent;
    border: 0 !important;
    border-radius: 0 !important;
  }
}

/* records-cubo.php：機台銷售明細（新殼層下改為文件流，避免 flex 高度被壓成 0） */
.records-cubo-layout {
  height: auto !important;
  min-height: 0 !important;
  max-height: none !important;
}

.records-cubo-table-panel {
  flex: none !important;
  min-height: 20rem;
  height: auto !important;
  width: 100%;
}

.records-cubo-table-scroll {
  flex: none !important;
  min-height: 20rem;
  max-height: min(70vh, 40rem);
  height: auto !important;
  overflow: auto !important;
  -webkit-overflow-scrolling: touch;
  background: transparent;
  border: 0 !important;
  border-radius: 0 !important;
  box-shadow: none;
}

/* separate + spacing 0：避免 collapse 時 sticky 表頭與資料列之間透出字 */
.records-cubo-table-scroll .table.records-cubo-sticky-table {
  border-collapse: separate;
  border-spacing: 0;
}

.records-cubo-table-scroll .table.records-cubo-sticky-table thead th {
  position: sticky;
  top: 0;
  z-index: 5;
  background: var(--navy) !important;
  color: #fff !important;
  background-clip: padding-box;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12) !important;
  box-shadow: none;
  vertical-align: middle;
}

/* 兩張統計卡：grid 第二列放數字，上緣對齊且不強制撐高標題 */
.records-cubo-stats-pair {
  display: grid;
  grid-template-columns: minmax(10rem, auto) minmax(12rem, auto);
  grid-template-rows: auto auto;
  column-gap: 0.75rem;
  row-gap: 0;
}

.records-cubo-stat-top {
  border: 1px solid #dee2e6;
  border-bottom: none;
  border-radius: 0.25rem 0.25rem 0 0;
  background-color: #f8f9fa;
  padding: 0.5rem 1rem 0.35rem;
  text-align: center;
}

.records-cubo-stat-bottom {
  border: 1px solid #dee2e6;
  border-top: 1px solid rgba(0, 0, 0, 0.06);
  border-radius: 0 0 0.25rem 0.25rem;
  background-color: #f8f9fa;
  padding: 0.35rem 1rem 0.5rem;
  text-align: center;
}

/* records-location.php：表格 sticky、工具列、統計卡（與 .records-container--location-list 搭配） */
#showAllRecords .records-location-table-scroll {
  -webkit-overflow-scrolling: touch;
}

#showAllRecords .table.records-location-sticky-table {
  border-collapse: separate;
  border-spacing: 0;
}

#showAllRecords .table.records-location-sticky-table thead th {
  position: sticky;
  top: 0;
  z-index: 5;
  background: var(--navy) !important;
  color: #fff !important;
  background-clip: padding-box;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12) !important;
  box-shadow: none;
  vertical-align: middle;
}

#showAllRecords .records-location-summary-card-head {
  border-bottom: 2px solid #dee2e6 !important;
}

#showAllRecords .records-location-summary-title {
  font-size: 1.125rem;
  line-height: 1.3;
}

#recordsLocStatsSlot .records-location-stats-pair {
  display: grid;
  grid-template-columns: minmax(10rem, auto) minmax(12rem, auto);
  grid-template-rows: auto auto;
  column-gap: 0.75rem;
  row-gap: 0;
}

#recordsLocStatsSlot .records-location-stat-top {
  border: 1px solid #dee2e6;
  border-bottom: none;
  border-radius: 0.25rem 0.25rem 0 0;
  background-color: #f8f9fa;
  padding: 0.5rem 1rem 0.35rem;
  text-align: center;
}

#recordsLocStatsSlot .records-location-stat-bottom {
  border: 1px solid #dee2e6;
  border-top: 1px solid rgba(0, 0, 0, 0.06);
  border-radius: 0 0 0.25rem 0.25rem;
  background-color: #f8f9fa;
  padding: 0.35rem 1rem 0.5rem;
  text-align: center;
}

.records-loc-toolbar .records-loc-toolbar-row {
  min-width: 0;
}

.records-loc-toolbar--all-stores .records-loc-toolbar-row {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  overflow-x: auto;
}

.records-loc-toolbar--all-stores .records-loc-toolbar-left-wrap {
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  align-items: center;
  flex: 0 1 auto;
  min-width: 0;
  margin-right: 0.75rem;
}

.records-loc-toolbar--all-stores .records-loc-toolbar-top {
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  align-items: center;
}

.records-loc-toolbar--all-stores .records-loc-field {
  display: flex;
  flex-direction: row;
  align-items: center;
}

.records-loc-toolbar--all-stores .records-loc-label {
  margin-right: 0.5rem;
  white-space: nowrap;
}

.records-loc-toolbar--all-stores .records-loc-toolbar-bottom {
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  align-items: center;
  padding-left: 0.5rem;
  margin-left: 0.25rem;
}

.records-loc-toolbar--all-stores .records-loc-stats-slot {
  display: flex;
  align-items: center;
}

.records-loc-toolbar--single-store .records-loc-toolbar-row {
  display: flex;
  flex-wrap: nowrap;
  align-items: stretch;
  overflow: visible;
}

.records-loc-toolbar--single-store .records-loc-toolbar-left-wrap {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  flex: 1 1 auto;
  min-width: 0;
  margin-right: 0.75rem;
  align-self: stretch;
}

.records-loc-toolbar--single-store .records-loc-toolbar-top {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  align-items: center;
}

.records-loc-toolbar--single-store .records-loc-field {
  display: flex;
  flex-direction: row;
  align-items: center;
}

.records-loc-toolbar--single-store .records-loc-label {
  margin-right: 0.5rem;
  white-space: nowrap;
}

.records-loc-toolbar--single-store .records-loc-toolbar-bottom {
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  align-items: center;
}

.records-loc-toolbar--single-store .records-loc-stats-slot {
  display: flex;
  flex-direction: column;
  align-self: stretch;
  align-items: stretch;
  min-height: 0;
}

.records-loc-toolbar.records-loc-toolbar--single-store #recordsLocStatsSlot .records-location-stats-pair {
  flex: 1 1 auto;
  min-height: 0;
  width: 100%;
  height: 100%;
  grid-template-rows: auto minmax(2.25rem, 1fr);
}

.records-loc-toolbar.records-loc-toolbar--single-store #recordsLocStatsSlot .records-location-stat-bottom {
  display: flex;
  align-items: center;
  justify-content: center;
}

.records-location-summary-card .records-location-summary-amount-block {
  max-width: 100%;
  overflow-x: auto;
}

.records-nav-icon {
  color: #7a7a7a;
}

/* 空資料提示（:( ...） */
.empty-state-msg {
  font-size: 1rem;
  font-weight: 400;
  margin: 1.25rem 0;
}

/* 郵件驗證樣式 */
.email-verification {
  color: Gray;
}

.resend-email-link {
  color: red; 
  font-weight: 600;
}

/* Tab 圖片樣式 */
.tab-image {
  height: 30px !important;
}

/* 狀態圖標樣式 */
.status-4g-filter {
  filter: invert(69%) sepia(10%) saturate(2293%) hue-rotate(71deg) brightness(91%) contrast(86%);
}

.status-joystick-enabled {
  filter: invert(75%) sepia(18%) saturate(1467%) hue-rotate(346deg) brightness(98%) contrast(91%);
}

.status-joystick-disabled {
  filter: invert(100%) sepia(0%) saturate(7500%) hue-rotate(71deg) brightness(100%) contrast(100%);
}

/* 操作按鈕樣式 */
.action-buttons {
  white-space: nowrap;
}

/* ===== Mobile：Partner drawer + 整頁可捲動 ===== */
@media (max-width: 820px) {
  .app {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: min(84vw, 280px);
    transform: translateX(-105%);
    transition: transform 0.2s ease;
  }

  body.nav-open .sidebar {
    transform: translateX(0);
  }

  .menu-btn {
    display: inline-grid;
  }

  .backdrop {
    position: fixed;
    inset: 0;
    background: rgba(1, 15, 46, 0.45);
    z-index: 25;
  }

  body.nav-open .backdrop {
    display: block;
  }

  .records-container {
    left: 0 !important;
    top: 4.25rem;
    padding: 0.75rem 1rem 2rem;
  }

  .topbar-logout span {
    display: none;
  }
}

@media (max-width: 1024px) {
  html {
    min-height: 100%;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }
  body {
    min-height: 100%;
    height: auto !important;
    overflow-y: auto !important;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
  }

  .app > .main {
    min-height: 100%;
    overflow: visible !important;
  }
  .app > .main > .content {
    overflow: visible !important;
    min-height: 0;
  }
  .myContent {
    overflow: visible !important;
    min-height: 0;
    padding-bottom: 2rem;
  }
  .records-container {
    position: relative;
    top: auto;
    left: auto !important;
    right: auto;
    bottom: auto;
    overflow-y: visible;
    padding-bottom: 0;
  }

  #page-content-wrapper {
    overflow: visible !important;
  }
}

/* ===== dashboard.php（銷售額圖表 / 暢銷機台）===== */
/* 若調整 .dashboard-sales-visual-frame 高度，請同步改 dashboard.php 內 DataTables scrollY（約 高度 − 48px 表頭） */
.dashboard-chart-subrow {
  min-height: 2.75rem;
  margin-bottom: 0.5rem;
}

.dashboard-sales-visual-frame {
  height: 520px;
  position: relative;
  overflow: hidden;
}

.dashboard-sales-visual-frame > #Chart {
  height: 100%;
}

/* 暢銷機台：不外層捲動，由 DataTables .dataTables_scrollBody 捲動 */
.dashboard-sales-visual-frame #showTopSales {
  height: 100%;
  overflow: hidden;
}

/* dashboard：支付佔比餅圖（獨立檢視時置中於圖表區） */
.dashboard-paypie-frame {
  display: flex;
  align-items: center;
  justify-content: center;
}

.dashboard-paypie-inner {
  min-height: 0;
  height: 100%;
}

.dashboard-pie-wrap {
  display: flex;
  flex-direction: column;
  min-height: 0;
  align-self: center;
  justify-content: center;
  height: auto;
  max-height: 100%;
}

.dashboard-pie-wrap--panel {
  width: 100%;
  max-width: 22rem;
}

.dashboard-pie-sidebar {
  min-width: 14rem;
  max-width: 26rem;
  font-size: 150%;
}

.dashboard-pie-sidebar .dashboard-paypie-legend-swatch {
  width: 1.05rem;
  height: 1.05rem;
}

@media (min-width: 768px) {
  .dashboard-pie-sidebar {
    border-left: 1px solid #dee2e6;
    padding-left: 1.25rem;
    margin-left: 1rem;
  }
}

@media (max-width: 767.98px) {
  .dashboard-pie-sidebar {
    width: 100%;
    max-width: none;
    border-top: 1px solid #dee2e6;
    padding-top: 1rem;
    margin-top: 0.5rem;
  }
}

.dashboard-paypie-legend-swatch {
  display: inline-block;
  width: 0.7rem;
  height: 0.7rem;
  border-radius: 2px;
  flex-shrink: 0;
}

/* 限制畫布為小正方形；勿 flex:1 否則會撐滿 520px 變「大餅」 */
.dashboard-pie-canvas-wrap {
  flex: 0 0 auto;
  width: min(15rem, min(78vw, 48vh));
  aspect-ratio: 1;
  height: auto;
  margin: 0 auto;
  position: relative;
}

@media (min-width: 768px) {
  .dashboard-pie-canvas-wrap {
    width: min(17rem, min(34vw, 52vh));
  }
}

.dashboard-main-view-select {
  max-width: 14rem;
}

.dashboard-chart-date-input {
  width: 11rem;
  max-width: 11rem;
}

/* 銷售額圖表：月份模式等提示靠右（與左側操作說明並排） */
.dashboard-chart-hint-dynamic {
  max-width: 22rem;
  flex-shrink: 0;
}

/* ===== logs/index.php：Log 查詢（獨立頁，body.logs-index-page 避免影響主系統） ===== */
body.logs-index-page {
  font-family: sans-serif;
  margin: 1rem 2rem;
  background: #1a1a1a;
  color: #e0e0e0;
}

body.logs-index-page a {
  color: #6ab7ff;
}

body.logs-index-page a:hover {
  text-decoration: underline;
}

body.logs-index-page h1 {
  font-size: 1.25rem;
  margin-bottom: 1rem;
}

body.logs-index-page ul {
  list-style: none;
  padding: 0;
}

body.logs-index-page ul li {
  margin: 0.5rem 0;
}

body.logs-index-page ul li small {
  color: #888;
  margin-left: 0.5rem;
}

body.logs-index-page pre {
  background: #252525;
  padding: 1rem;
  overflow-x: auto;
  font-size: 0.85rem;
  line-height: 1.4;
  border-radius: 4px;
  white-space: pre-wrap;
  word-break: break-all;
}

body.logs-index-page .logs-index-meta {
  margin-bottom: 1rem;
  color: #888;
  font-size: 0.9rem;
}

body.logs-index-page .logs-index-meta a {
  margin-right: 1rem;
}