/* ================================================
   SportHub — Admin Styles
   User Management, EXP, Roles, Logs, Ad Management
   ================================================ */

/* ─── Admin Sections ─── */
.admin-search { padding: .3rem .2rem .6rem; display: flex; gap: .4rem; flex-wrap: wrap; }
.admin-search input { flex: 1; min-width: 180px; }
.admin-filters { display: flex; gap: .3rem; flex: 1; flex-wrap: wrap; }
.admin-filters select { flex: 1; min-width: 100px; }
.admin-filters input[type="date"] { flex: 1; min-width: 130px; }
#page-admin-error-logs .admin-search,
.admin-log-panel[data-admin-log-panel="error"] .admin-search,
.admin-log-panel[data-admin-log-panel="prompt"] .admin-search { display: grid; grid-template-columns: minmax(0,1fr); gap: .45rem; align-items: start; }
#page-admin-error-logs #errlog-search,
.admin-log-panel[data-admin-log-panel="error"] #errlog-search,
.admin-log-panel[data-admin-log-panel="prompt"] #promptlog-search { width: 100%; min-width: 0; height: auto; min-height: 2.35rem; flex: none; align-self: start; }
#page-admin-error-logs .admin-filters,
.admin-log-panel[data-admin-log-panel="error"] .admin-filters,
.admin-log-panel[data-admin-log-panel="prompt"] .admin-filters { display: grid; grid-template-columns: repeat(auto-fit,minmax(130px,1fr)); gap: .35rem; width: 100%; flex: none; }
#page-admin-error-logs .admin-filters select,
#page-admin-error-logs .admin-filters input[type="date"],
.admin-log-panel[data-admin-log-panel="error"] .admin-filters select,
.admin-log-panel[data-admin-log-panel="error"] .admin-filters input[type="date"],
.admin-log-panel[data-admin-log-panel="prompt"] .admin-filters select,
.admin-log-panel[data-admin-log-panel="prompt"] .admin-filters input[type="date"] { width: 100%; min-width: 0; flex: none; }
#page-admin-error-logs .error-log-clear-filter,
.admin-log-panel[data-admin-log-panel="error"] .error-log-clear-filter,
.admin-log-panel[data-admin-log-panel="prompt"] .error-log-clear-filter { justify-self: start; }
@media (max-width: 520px) {
  #page-admin-error-logs .admin-filters,
  .admin-log-panel[data-admin-log-panel="error"] .admin-filters,
  .admin-log-panel[data-admin-log-panel="prompt"] .admin-filters { grid-template-columns: 1fr; }
  #page-admin-error-logs .error-log-clear-filter,
  .admin-log-panel[data-admin-log-panel="error"] .error-log-clear-filter,
  .admin-log-panel[data-admin-log-panel="prompt"] .error-log-clear-filter { width: 100%; }
}
.admin-card-list { display: flex; flex-direction: column; gap: .5rem; }
.admin-log-tabs { margin-bottom: .7rem; }
.admin-log-toolbar { display: flex; justify-content: center; align-items: center; gap: .45rem; margin-bottom: .5rem; padding: .5rem .65rem; border: 1px solid var(--border); border-radius: var(--radius); background: var(--bg-card); }
.admin-log-toolbar.is-empty { display: none; }
.admin-log-toolbar-actions { display: flex; align-items: center; justify-content: center; gap: .45rem; flex-wrap: wrap; }
.admin-log-action-btn { min-width: 6rem; justify-content: center; font-size: .74rem; padding: .38rem .8rem; white-space: nowrap; }
.admin-log-action-danger { border-color: rgba(220,38,38,.45); color: #dc2626; }
.admin-log-action-danger:hover { border-color: #dc2626; background: rgba(220,38,38,.08); }
.admin-log-panels { display: flex; flex-direction: column; gap: .7rem; }
.admin-log-panel { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); padding: .5rem; }
.admin-log-panel[hidden] { display: none !important; }

/* 圓形圖示按鈕（重整 + 說明） */
.admin-log-info-btn { width: 1.8rem; height: 1.8rem; border: 1px solid var(--border); border-radius: 50%; background: transparent; color: var(--text-muted); cursor: pointer; display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; }
.admin-log-info-btn:first-of-type { margin-left: auto; }
.admin-log-info-btn + .admin-log-info-btn { margin-left: .35rem; }
.admin-log-info-btn:hover { color: var(--primary); border-color: var(--primary); }
.admin-log-info-btn:disabled { opacity: .5; cursor: not-allowed; }

/* 毛玻璃 overlay */
.admin-log-info-overlay { position: fixed; inset: 0; z-index: 1100; display: flex; align-items: center; justify-content: center; background: rgba(0,0,0,.15); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); opacity: 0; pointer-events: none; transition: opacity .25s; }
.admin-log-info-overlay.open { opacity: 1; pointer-events: auto; }

/* 置中 modal */
.admin-log-info-modal { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); width: 90%; max-width: 360px; transform: scale(.92); opacity: 0; transition: transform .25s cubic-bezier(.4,0,.2,1), opacity .25s; }
.admin-log-info-modal.open { transform: scale(1); opacity: 1; }
.admin-log-info-modal .modal-header { display: flex; align-items: center; justify-content: space-between; padding: .75rem .85rem; border-bottom: 1px solid var(--border); }
.admin-log-info-modal .modal-header h3 { margin: 0; font-size: .88rem; font-weight: 700; }
.admin-log-info-modal .modal-close { background: none; border: none; font-size: 1.2rem; color: var(--text-muted); cursor: pointer; padding: 0 .2rem; }
.admin-log-info-modal .modal-body { padding: .85rem; font-size: .82rem; line-height: 1.7; color: var(--text-secondary); }
.error-log-summary-grid { display: grid; grid-template-columns: repeat(auto-fit,minmax(92px,1fr)); gap: .45rem; margin-bottom: .65rem; }
.error-log-stat { border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--bg-main); padding: .55rem .65rem; display: flex; flex-direction: column; gap: .18rem; }
.error-log-stat span { font-size: .68rem; color: var(--text-muted); }
.error-log-stat strong { font-size: 1rem; color: var(--text-primary); }
.error-log-card { flex-direction: column; gap: .5rem; align-items: stretch; }
.error-log-main { display: flex; align-items: flex-start; gap: .55rem; width: 100%; }
.error-log-body { flex: 1; min-width: 0; }
.error-log-title-row { display: flex; align-items: center; gap: .25rem; flex-wrap: wrap; }
.error-log-message { margin-top: .28rem; color: var(--text-primary); font-size: .82rem; line-height: 1.55; }
.error-log-meta { margin-top: .35rem; display: flex; flex-wrap: wrap; gap: .25rem; }
.error-log-meta span { font-size: .68rem; line-height: 1.35; color: var(--text-muted); background: var(--bg-elevated); border: 1px solid var(--border); border-radius: 999px; padding: .12rem .4rem; }
.error-log-insights { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.5fr); gap: .55rem; margin-bottom: .65rem; }
.error-log-insight-panel { border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--bg-main); padding: .65rem; min-width: 0; }
.error-log-insight-title { font-size: .74rem; font-weight: 800; color: var(--text-primary); margin-bottom: .55rem; }
.error-log-trend { display: grid; grid-template-columns: repeat(7, minmax(0,1fr)); gap: .28rem; align-items: end; min-height: 92px; }
.error-log-trend-day { display: flex; flex-direction: column; align-items: center; gap: .14rem; min-width: 0; }
.error-log-trend-bar { width: 100%; max-width: 22px; border-radius: 6px 6px 2px 2px; background: rgba(59,130,246,.28); border: 1px solid rgba(59,130,246,.35); }
.error-log-trend-day.has-critical .error-log-trend-bar { background: rgba(220,38,38,.28); border-color: rgba(220,38,38,.45); }
.error-log-trend-day strong { font-size: .7rem; color: var(--text-primary); }
.error-log-trend-day small { font-size: .62rem; color: var(--text-muted); white-space: nowrap; }
.error-log-groups { display: flex; flex-direction: column; gap: .45rem; }
.error-log-group { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: .5rem; background: var(--bg-elevated); }
.error-log-group-head { display: flex; align-items: center; gap: .3rem; flex-wrap: wrap; }
.error-log-group-head strong { font-size: .78rem; color: var(--text-primary); }
.error-log-details { border-top: 1px solid var(--border); padding-top: .45rem; }
.error-log-details summary { cursor: pointer; color: var(--primary); font-size: .74rem; font-weight: 700; }
.error-log-copy-btn { font-size: .68rem; padding: .18rem .45rem; margin-top: .4rem; }
.user-prompt-log-copy { margin-top: 0; margin-left: auto; white-space: nowrap; }
.user-prompt-log-group .error-log-message { color: var(--text-primary); }
.error-log-detail-grid { margin-top: .5rem; display: flex; flex-direction: column; gap: .42rem; }
.error-log-detail-row { display: grid; grid-template-columns: 76px minmax(0,1fr); gap: .5rem; align-items: start; }
.error-log-detail-row span { color: var(--text-muted); font-size: .68rem; padding-top: .18rem; }
.error-log-detail-row pre { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; font-size: .72rem; line-height: 1.45; color: var(--text-secondary); background: var(--bg-elevated); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: .42rem .5rem; }
.error-log-detail-row pre.is-mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.error-log-pagination { display: flex; justify-content: center; align-items: center; gap: .5rem; padding: .8rem 0; font-size: .78rem; color: var(--text-muted); }
.error-log-pagination .outline-btn { font-size: .72rem; padding: .25rem .6rem; }
.error-log-empty { text-align: center; padding: 2rem; color: var(--text-muted); }
.error-log-clear-filter { font-size: .72rem; padding: .34rem .65rem; white-space: nowrap; }
.error-log-empty-inline { font-size: .72rem; color: var(--text-muted); padding: .4rem 0; }
@media (max-width: 760px) { .error-log-insights { grid-template-columns: 1fr; } }
.audit-log-filter-card { display: flex; flex-direction: column; gap: .75rem; }
.audit-log-filter-details { border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--bg-main); overflow: hidden; }
.audit-log-filter-details[open] { background: var(--bg-card); }
.audit-log-filter-summary { display: flex; align-items: center; gap: .65rem; padding: .75rem .85rem; cursor: pointer; list-style: none; user-select: none; }
.audit-log-filter-summary::-webkit-details-marker { display: none; }
.audit-log-filter-summary-copy { display: flex; flex-direction: column; gap: .12rem; min-width: 0; }
.audit-log-filter-summary-title { font-size: .82rem; font-weight: 700; color: var(--text-primary); }
.audit-log-filter-summary-text { font-size: .72rem; color: var(--text-muted); }
.audit-log-filter-summary-meta { margin-left: auto; font-size: .74rem; color: var(--text-secondary); text-align: right; }
.audit-log-date-field { display: flex; flex-direction: column; gap: .25rem; font-size: .78rem; min-width: 180px; }
.audit-log-date-field input { width: 100%; }
.audit-log-filter-body { display: flex; flex-direction: column; gap: .1rem; padding: 0 .85rem .85rem; border-top: 1px solid var(--border); }
.audit-log-filter-grid { display: grid; grid-template-columns: repeat(auto-fit,minmax(180px,1fr)); gap: .6rem; }
.audit-log-filter-details.has-active-filters .audit-log-filter-summary-text,
.audit-log-filter-details.has-active-filters .audit-log-filter-summary-meta { color: var(--primary); }
.audit-log-filter-arrow { font-size: .7rem; color: var(--text-muted); transition: transform .2s ease; }
.audit-log-filter-details[open] .audit-log-filter-arrow { transform: rotate(90deg); }
.audit-log-summary { display: flex; flex-wrap: wrap; gap: .35rem; align-items: center; }
.audit-log-summary span { border: 1px solid var(--border); border-radius: 999px; background: var(--bg-main); color: var(--text-secondary); font-size: .72rem; line-height: 1.35; padding: .16rem .48rem; }
.audit-log-summary strong { color: var(--text-primary); }
.audit-log-summary .audit-log-summary-note { flex-basis: 100%; border-style: dashed; border-radius: var(--radius-sm); color: var(--text-muted); background: transparent; }
.audit-log-item { flex-direction: column; align-items: stretch; gap: .45rem; }
.audit-log-main { display: flex; align-items: flex-start; gap: .55rem; width: 100%; min-width: 0; }
.audit-log-main .log-content { flex: 1; min-width: 0; }
.audit-log-action-text { overflow-wrap: anywhere; }
.audit-log-result { flex-shrink: 0; border: 1px solid var(--border); border-radius: 999px; padding: .12rem .42rem; font-size: .68rem; font-weight: 800; color: var(--text-secondary); background: var(--bg-elevated); }
.audit-log-result-success { border-color: rgba(34,197,94,.38); color: #15803d; background: rgba(34,197,94,.1); }
.audit-log-result-failure { border-color: rgba(220,38,38,.42); color: #dc2626; background: rgba(220,38,38,.1); }
.audit-log-meta { display: flex; flex-wrap: wrap; gap: .25rem; padding-left: calc(70px + .55rem); }
.audit-log-meta span { font-size: .68rem; line-height: 1.35; color: var(--text-muted); background: var(--bg-elevated); border: 1px solid var(--border); border-radius: 999px; padding: .12rem .4rem; overflow-wrap: anywhere; }
.audit-log-details { border-top: 1px solid var(--border); padding-top: .42rem; }
.audit-log-details summary { cursor: pointer; color: var(--primary); font-size: .74rem; font-weight: 700; }
.audit-log-detail-grid { margin-top: .5rem; display: flex; flex-direction: column; gap: .42rem; }
.audit-log-detail-row { display: grid; grid-template-columns: 70px minmax(0,1fr); gap: .5rem; align-items: start; }
.audit-log-detail-row span { color: var(--text-muted); font-size: .68rem; padding-top: .18rem; }
.audit-log-detail-row pre { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; font-size: .72rem; line-height: 1.45; color: var(--text-secondary); background: var(--bg-elevated); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: .42rem .5rem; }
.audit-log-detail-row pre.is-mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.audit-log-copy-btn { font-size: .68rem; padding: .18rem .45rem; margin-top: .45rem; }
@media (max-width: 520px) {
  .audit-log-main { flex-wrap: wrap; }
  .audit-log-main .log-time { width: 100%; }
  .audit-log-meta { padding-left: 0; }
  .audit-log-detail-row { grid-template-columns: 1fr; gap: .2rem; }
}
/* ─── Admin User Card ─── */
.admin-user-page-header { align-items: center; }
.admin-user-page-heading { min-width: 0; }
.admin-user-filter-panel.admin-search {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(116px, .8fr) minmax(106px, .72fr);
  align-items: end;
  padding: .48rem;
}
.admin-user-filter-panel.admin-search[hidden] { display: none !important; }
.admin-user-filter-panel.visible { display: grid; }
.admin-user-range-field {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: .24rem;
  color: var(--text-muted);
  font-size: .68rem;
  font-weight: 800;
}
.admin-user-range-inputs {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: .35rem;
}
.admin-user-filter-panel input,
.admin-user-filter-panel select {
  width: 100%;
  min-width: 0;
  flex: initial;
  height: 36px;
  box-sizing: border-box;
}
@media (max-width: 620px) {
  .admin-user-filter-panel.admin-search { grid-template-columns: 1fr; }
}
.admin-user-card { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); padding: .75rem .85rem; display: flex; gap: .65rem; align-items: flex-start; }
.au-avatar { width: 40px; height: 40px; border-radius: 50%; flex-shrink: 0; }
.au-avatar-fallback { display: flex; align-items: center; justify-content: center; background: var(--primary); color: #fff; font-weight: 700; font-size: .9rem; }
.admin-user-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: .35rem; }
.admin-user-info { min-width: 0; }
.admin-user-name { font-weight: 600; font-size: .88rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.admin-user-meta { font-size: .72rem; color: var(--text-muted); margin-top: .1rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.admin-user-actions { display: flex; gap: .35rem; align-items: center; }
.au-btn { font-size: .72rem; padding: .3rem .6rem; border-radius: 999px; border: 1px solid var(--border); background: transparent; color: var(--text-secondary); cursor: pointer; white-space: nowrap; transition: all .15s; }
.au-btn:hover { border-color: var(--primary); color: var(--primary); }
.au-btn-edit { border-color: var(--primary); color: var(--primary); }
.au-btn-edit:hover { background: var(--primary); color: #fff; }
.au-btn-view { border-color: rgba(99,102,241,.4); color: var(--text-muted); }
.au-btn-view:hover { border-color: var(--primary); color: var(--primary); }

/* ─── EXP Management ─── */
.exp-target-card { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); padding: 1rem; margin-bottom: .75rem; }
.exp-target-info { display: flex; align-items: center; gap: .65rem; margin-bottom: .85rem; padding-bottom: .65rem; border-bottom: 1px solid var(--border); }
.exp-target-name { font-weight: 700; font-size: .95rem; }
.exp-target-detail { font-size: .75rem; color: var(--text-muted); margin-top: .15rem; }
.exp-form .form-row { margin-bottom: .65rem; }

/* ─── Condition Builder ─── */
.condition-builder { margin-top: .75rem; }
.condition-group { background: var(--bg-elevated); border-radius: var(--radius-sm); padding: .65rem; margin-bottom: .5rem; }
.group-label { font-size: .78rem; font-weight: 600; margin-bottom: .4rem; display: flex; align-items: center; gap: .4rem; }
.group-logic { display: inline-block; padding: .1rem .35rem; background: var(--accent-bg); color: var(--accent); border-radius: var(--radius-full); font-size: .65rem; }
.condition-row { display: flex; gap: .3rem; align-items: center; margin-bottom: .35rem; }
.condition-row select, .condition-row input { flex: 1; font-size: .78rem; padding: .35rem .5rem; }
.condition-row input[type="number"] { max-width: 70px; }
.or-divider { text-align: center; color: var(--text-muted); font-size: .75rem; font-weight: 600; padding: .3rem 0; }

/* ─── Reward Tags ─── */
.reward-tags { display: flex; flex-wrap: wrap; gap: .3rem; }
.reward-tag { display: inline-flex; align-items: center; gap: .3rem; padding: .25rem .55rem; background: var(--bg-elevated); border-radius: var(--radius-full); font-size: .75rem; }
.reward-tag button { font-size: .7rem; color: var(--text-muted); }

/* ─── Permissions List ─── */
.permissions-list { max-height: 350px; overflow-y: auto; }
/* ─── Role Hierarchy Management ─── */
.role-hierarchy-card { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); padding: .85rem; margin-bottom: .65rem; }
.role-hierarchy-title { font-weight: 700; font-size: .85rem; margin-bottom: .6rem; padding-bottom: .4rem; border-bottom: 1px solid var(--border); display: flex; align-items: center; }
.role-level-row { display: flex; align-items: center; gap: .5rem; padding: .45rem .3rem; border-bottom: 1px solid var(--border); }
.role-level-row:last-child { border-bottom: none; }
.role-level-num { font-family: var(--font-display); font-size: .7rem; font-weight: 700; color: var(--text-muted); min-width: 2rem; }
.role-level-badge { display: inline-block; padding: .15rem .5rem; border-radius: var(--radius-full); color: #fff; font-size: .72rem; font-weight: 600; min-width: 3rem; text-align: center; }
.role-perm-count { display: inline-flex; align-items: center; justify-content: center; min-width: 1.25rem; height: 1.25rem; padding: 0 .25rem; border-radius: 50%; background: var(--accent-bg); color: var(--accent); font-size: .62rem; font-weight: 700; font-family: var(--font-display); flex-shrink: 0; border: 1px solid var(--accent); line-height: 1; }
.role-user-count { font-size: .65rem; font-weight: 700; color: #dc2626; font-family: var(--font-display); }
.role-level-key { font-size: .68rem; color: var(--text-muted); font-family: monospace; flex: 1; }
.role-level-row:hover { background: var(--accent-bg); }
.role-level-row.role-level-selected { background: var(--accent-bg); border-color: var(--accent); }
.role-delete-btn { width: 22px; height: 22px; border-radius: 50%; border: 1px solid var(--danger); background: transparent; color: var(--danger); font-size: .7rem; cursor: pointer; display: flex; align-items: center; justify-content: center; flex-shrink: 0; transition: all .15s; line-height: 1; }
.role-delete-btn:hover { background: var(--danger); color: #fff; }
.role-perm-panel { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); padding: .85rem; margin-bottom: .65rem; }
.role-perm-panel-header { font-weight: 700; font-size: .85rem; padding-bottom: .4rem; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; cursor: pointer; }
.role-perm-toolbar { display: flex; align-items: center; justify-content: space-between; gap: .6rem; flex-wrap: wrap; padding: .6rem 0 .55rem; }
.role-perm-toolbar-actions { display: flex; align-items: center; gap: .45rem; flex-wrap: wrap; }
.role-perm-filter-btn { font-size: .7rem !important; color: var(--text-secondary) !important; padding: .18rem .5rem; border: 1px solid var(--border); border-radius: var(--radius-full); background: var(--bg-elevated); }
.role-perm-filter-btn.active { color: var(--accent) !important; border-color: var(--accent); background: var(--accent-bg); }
.role-perm-reset-btn { font-size: .68rem !important; color: var(--accent) !important; padding: .15rem .4rem; border: 1px solid var(--accent); border-radius: var(--radius-sm); background: transparent; }
.role-perm-reset-btn:active { background: var(--accent); color: #fff !important; }
.role-perm-lock-hint { margin-bottom: .55rem; padding: .5rem .65rem; border-radius: var(--radius-sm); background: rgba(220, 38, 38, .08); color: #b91c1c; font-size: .72rem; line-height: 1.45; }
.role-perm-arrow { font-size: .65rem; color: var(--text-muted); user-select: none; }
.role-editor-card { background: var(--bg-card); border: 1px solid var(--accent); border-radius: var(--radius); padding: .85rem; margin-bottom: .65rem; }
.role-editor-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: .65rem; padding-bottom: .4rem; border-bottom: 1px solid var(--border); font-weight: 700; font-size: .85rem; }

.perm-category { margin-bottom: .5rem; border: 1px solid var(--border); border-radius: var(--radius-sm); overflow: hidden; }
.perm-category-title { font-size: .78rem; font-weight: 700; color: var(--accent); padding: .5rem .6rem; cursor: pointer; display: flex; align-items: center; gap: .3rem; background: var(--bg-elevated); }
.perm-category-title::before { content: '▼'; font-size: .6rem; transition: transform var(--transition); }
.perm-category.collapsed .perm-category-title::before { transform: rotate(-90deg); }
.perm-category.no-sub .perm-category-title::before { display: none; }
.perm-category.no-sub .perm-category-title { cursor: default; }
.perm-cat-name { flex: 1; }
.perm-category-title .toggle-switch { flex-shrink: 0; }
.perm-items { display: flex; flex-direction: column; gap: 0; }
.perm-category.collapsed .perm-items { display: none; }
.perm-item { display: flex; align-items: center; justify-content: space-between; gap: .5rem; padding: .45rem .6rem .45rem 1.6rem; font-size: .78rem; }
.perm-item:nth-child(odd) { background: var(--bg-elevated); }
.perm-item:nth-child(even) { background: transparent; }
.perm-item span { flex: 1; }
.perm-item .toggle-switch { margin-left: 0; flex-shrink: 0; }
.perm-item.perm-item-locked { opacity: .72; }
.perm-item.perm-item-locked .toggle-switch { pointer-events: none; }
.perm-item-label { display: flex; align-items: center; gap: .45rem; flex-wrap: wrap; }
.perm-item-tag { display: inline-flex; align-items: center; padding: .12rem .4rem; border-radius: var(--radius-full); font-size: .62rem; font-weight: 700; color: #b91c1c; background: rgba(220, 38, 38, .1); }

/* ── 權限說明按鈕（圓形 ? 圖示，參考 edu-info-btn）── */
.perm-info-btn { width: 20px; height: 20px; border-radius: 50%; border: 1.5px solid var(--accent); background: transparent; color: var(--accent); font-size: .68rem; font-weight: 700; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; padding: 0; line-height: 1; margin-left: .3rem; vertical-align: middle; }
.perm-info-btn:hover { background: var(--accent); color: #fff; }

/* ── 權限說明彈窗 ── */
.perm-info-overlay { position: fixed; inset: 0; z-index: 1200; background: rgba(0,0,0,.35); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); display: flex; align-items: center; justify-content: center; padding: 1rem; }
.perm-info-dialog { background: var(--bg-card); border-radius: 16px; padding: 1.2rem 1.4rem; max-width: 420px; width: 100%; box-shadow: 0 8px 32px rgba(0,0,0,.15); }
.perm-info-dialog-title { font-size: 1rem; font-weight: 700; margin-bottom: .6rem; text-align: center; }
.perm-info-dialog-body { font-size: .84rem; line-height: 1.65; color: var(--text-secondary); }
.perm-info-dialog-body p { margin: .3rem 0; }
.perm-info-dialog-body b { color: var(--text-primary); }

/* ─── Log List ─── */
.log-list { display: flex; flex-direction: column; gap: .3rem; }
.log-item { display: flex; align-items: flex-start; gap: .5rem; padding: .55rem .5rem; border-bottom: 1px solid var(--border); font-size: .8rem; }
.log-time { font-size: .7rem; color: var(--text-muted); white-space: nowrap; min-width: 80px; }
.log-content { flex: 1; color: var(--text-secondary); }
.log-type { display: inline-block; padding: .1rem .38rem; border-radius: var(--radius-full); font-size: .65rem; font-weight: 700; margin-right: .3rem; border: 1px solid transparent; }
.log-type.exp { background: rgba(96,165,250,.15); color: var(--info); }
.log-type.role { background: rgba(167,139,250,.15); color: #a78bfa; }
.log-type.event { background: rgba(52,211,153,.15); color: var(--success); }
.log-type.error_log { background: rgba(220,38,38,.15); color: #dc2626; }
.log-type.severity-critical { background: rgba(220,38,38,.15); color: #dc2626; }
.log-type.severity-warn { background: rgba(245,158,11,.18); color: #d97706; }
.log-type.severity-info { background: rgba(59,130,246,.14); color: #2563eb; }
.log-type.log-tone-blue { background: rgba(59,130,246,.14); color: #2563eb; }
.log-type.log-tone-violet { background: rgba(168,85,247,.14); color: #9333ea; }
.log-type.log-tone-purple { background: rgba(139,92,246,.14); color: #7c3aed; }
.log-type.log-tone-green { background: rgba(34,197,94,.14); color: #15803d; }
.log-type.log-tone-teal { background: rgba(20,184,166,.14); color: #0f766e; }
.log-type.log-tone-orange { background: rgba(249,115,22,.14); color: #ea580c; }
.log-type.log-tone-indigo { background: rgba(99,102,241,.14); color: #4338ca; }
.log-type.log-tone-sky { background: rgba(14,165,233,.14); color: #0284c7; }
.log-type.log-tone-pink { background: rgba(236,72,153,.14); color: #db2777; }
.log-type.log-tone-amber { background: rgba(245,158,11,.16); color: #d97706; }
.log-type.log-tone-cyan { background: rgba(6,182,212,.14); color: #0e7490; }
.log-type.log-tone-rose { background: rgba(244,63,94,.14); color: #e11d48; }
.log-type.log-tone-red { background: rgba(239,68,68,.14); color: #dc2626; }
.log-type.log-tone-gray { background: rgba(100,116,139,.14); color: #475569; }
.log-type[class*="log-tone-"] { border-color: currentColor; }
.log-detail { font-size: .65rem; color: var(--text-muted); margin-top: .2rem; word-break: break-all; }
.error-log-message { margin-top: .2rem; line-height: 1.55; color: var(--text-secondary); }
.admin-icon-btn { display: inline-flex; align-items: center; justify-content: center; width: 2.1rem; height: 2.1rem; padding: 0; }
.admin-icon-btn svg { pointer-events: none; }

/* ─── Inactive Card ─── */
.inactive-card { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); padding: .75rem .85rem; opacity: .65; position: relative; margin-bottom: .5rem; }

/* ─── Banner Manage Card ─── */
.banner-manage-card { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); padding: .75rem; display: flex; gap: .75rem; align-items: center; }
.banner-thumb { width: 80px; aspect-ratio: 2.2/1; border-radius: var(--radius-sm); display: flex; align-items: center; justify-content: center; font-size: .75rem; color: #fff; font-weight: 600; flex-shrink: 0; overflow: hidden; }
.banner-thumb-empty { background: transparent; border: 2px dashed var(--border); color: var(--text-muted); font-size: .55rem; line-height: 1.2; text-align: center; }
.banner-thumb-circle { width: 50px; height: 50px; border-radius: 50%; }
#banner-manage-list .banner-thumb { width: 112px; aspect-ratio: 1200 / 545; }
#popup-ad-manage-list .banner-thumb { width: 54px; aspect-ratio: 3 / 4; }
#shotgame-ad-manage-list .banner-thumb { width: 96px; aspect-ratio: 1200 / 545; }
.banner-manage-info { flex: 1; }
.banner-manage-title { font-weight: 600; font-size: .85rem; }
.banner-manage-meta { font-size: .72rem; color: var(--text-muted); margin-top: .1rem; }
.banner-manage-status { display: inline-block; padding: .1rem .4rem; border-radius: var(--radius-full); font-size: .65rem; font-weight: 600; }
.home-layout-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: .75rem;
}
.home-layout-list {
  display: flex;
  flex-direction: column;
  gap: .45rem;
  margin-top: .6rem;
}
.home-layout-row {
  display: grid;
  grid-template-columns: 2rem minmax(0, 1fr) auto;
  align-items: center;
  gap: .65rem;
  padding: .58rem .65rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-elevated);
}
.home-layout-rank {
  width: 1.8rem;
  height: 1.8rem;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(37, 99, 235, .12);
  color: #2563eb;
  font-weight: 800;
  font-size: .78rem;
}
.home-layout-row-actions,
.home-layout-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: .4rem;
}
.home-layout-actions {
  margin-top: .7rem;
  flex-wrap: wrap;
}
.home-layout-move-btn {
  padding: .22rem .48rem;
  font-size: .72rem;
}
.home-layout-move-btn:disabled {
  opacity: .42;
  cursor: not-allowed;
}

@media (max-width: 520px) {
  .home-layout-row {
    grid-template-columns: 1.8rem minmax(0, 1fr);
  }
  .home-layout-row-actions {
    grid-column: 2;
    justify-content: flex-start;
  }
}

/* ─── System Announcement Management ─── */
#page-admin-announcements {
  padding-bottom: calc(5rem + env(safe-area-inset-bottom));
}
.announcement-admin-header {
  align-items: center;
  gap: .55rem;
}
.announcement-admin-header h2 {
  min-width: 0;
  flex: 1;
}
.announcement-create-btn {
  flex-shrink: 0;
  margin-left: auto;
  padding: .42rem .75rem;
  font-size: .75rem;
  white-space: nowrap;
}
.announcement-count {
  padding: .15rem .25rem .6rem;
  color: var(--text-muted);
  font-size: .75rem;
}
.announcement-card-list {
  display: flex;
  flex-direction: column;
  gap: .55rem;
}
.announcement-card {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr) auto;
  align-items: center;
  gap: .72rem;
  padding: .8rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-card);
  box-shadow: var(--shadow-sm);
}
.announcement-order-controls {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .12rem;
}
.announcement-order-btn {
  width: 24px;
  height: 22px;
  padding: 0;
  line-height: 1;
  color: var(--accent);
  font-size: .78rem;
}
.announcement-order-btn:disabled {
  opacity: .28;
  cursor: not-allowed;
}
.announcement-main {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: .3rem;
}
.announcement-title-row {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: .45rem;
}
.announcement-title {
  min-width: 0;
  overflow: hidden;
  color: var(--text-primary);
  font-size: .86rem;
  font-weight: 700;
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.announcement-content {
  max-width: 100%;
  overflow: hidden;
  color: var(--text-secondary);
  font-size: .76rem;
  line-height: 1.45;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.announcement-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .35rem;
  color: var(--text-muted);
  font-size: .72rem;
  line-height: 1.35;
}
.announcement-status-dot {
  width: 8px;
  height: 8px;
  flex-shrink: 0;
  border-radius: 50%;
}
.announcement-status-active { background: #10b981; }
.announcement-status-scheduled { background: #f59e0b; }
.announcement-status-expired { background: #94a3b8; }
.announcement-actions {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: .24rem;
}
.announcement-action-btn {
  min-height: 1.45rem;
  padding: .12rem .22rem;
  font-size: .72rem;
  white-space: nowrap;
}
.announcement-action-btn:disabled {
  opacity: .5;
  cursor: wait;
}
.announcement-action-accent { color: var(--accent) !important; }
.announcement-action-muted { color: var(--text-muted) !important; }
.announcement-action-danger { color: var(--danger) !important; }
.announcement-empty {
  padding: 1.45rem .8rem;
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  color: var(--text-muted);
  background: var(--bg-card);
  font-size: .82rem;
  text-align: center;
}
#announcement-form-overlay {
  align-items: flex-start;
  overflow-y: auto;
  padding: calc(58px + .75rem) .75rem calc(1rem + env(safe-area-inset-bottom));
}
#announcement-form-overlay .announcement-form-modal {
  position: relative;
  inset: auto;
  display: flex;
  flex-direction: column;
  width: min(100%, 560px);
  max-height: calc(100dvh - 92px);
  margin: 0 auto;
  overflow: hidden;
  border-radius: 16px;
  transform: translateY(12px);
  box-shadow: 0 18px 50px rgba(15, 23, 42, .18);
}
#announcement-form-overlay .announcement-form-modal.open {
  transform: translateY(0);
}
#announcement-form-overlay .modal-header {
  flex-shrink: 0;
}
.announcement-form-body {
  display: flex;
  flex-direction: column;
  gap: .72rem;
  overflow-y: auto;
  padding-bottom: 1rem;
}
.announcement-form-body .form-row {
  margin-bottom: 0;
}
.announcement-form-body input,
.announcement-form-body select,
.announcement-form-body textarea {
  width: 100%;
  box-sizing: border-box;
}
.announcement-form-body textarea {
  min-height: 92px;
  resize: vertical;
}
.announcement-form-body #ann-content-count {
  display: block;
  margin-top: .25rem;
  color: var(--text-muted);
  font-size: .68rem;
  text-align: right;
}
.announcement-save-btn {
  margin-top: .15rem;
}

@media (min-width: 800px) {
  #announcement-form-overlay .announcement-form-modal {
    left: auto;
    right: auto;
    bottom: auto;
    border-radius: 16px;
    transform: translateY(12px);
  }
  #announcement-form-overlay .announcement-form-modal.open {
    transform: translateY(0);
  }
}

@media (max-width: 520px) {
  .announcement-card {
    grid-template-columns: 24px minmax(0, 1fr);
    align-items: start;
    gap: .62rem;
    padding: .72rem;
  }
  .announcement-actions {
    grid-column: 2;
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: flex-start;
    align-items: center;
  }
  .announcement-content {
    display: -webkit-box;
    white-space: normal;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
  }
  .announcement-create-btn {
    padding: .38rem .62rem;
  }
}

/* ─── Admin Achievement/Badge Rows ─── */
.admin-ach-row { display: flex; align-items: center; gap: .6rem; padding: .55rem .6rem; border-bottom: 1px solid var(--border); }
.admin-ach-row:last-child { border-bottom: none; }
.admin-ach-info { flex: 1; min-width: 0; }
.admin-ach-name { font-size: .82rem; font-weight: 600; }
.admin-ach-status { font-size: .7rem; margin-top: .1rem; }
.admin-ach-actions { display: flex; gap: .4rem; flex-shrink: 0; }

/* ─── Admin Section Label ─── */
.admin-section-label { font-weight: 700; font-size: .85rem; color: var(--text-secondary); padding: .5rem 0 .3rem; margin-top: .5rem; border-bottom: 1px solid var(--border); margin-bottom: .5rem; }

/* ─── Sponsor Manage Rows ─── */
.sp-manage-row {
  display: flex;
  align-items: center;
  gap: .4rem;
  padding: .35rem .3rem;
  border-bottom: 1px solid var(--border);
}
.sp-manage-row:last-child { border-bottom: none; }
.sp-row-num {
  width: 1.6rem;
  text-align: center;
  font-size: .72rem;
  font-weight: 600;
  color: var(--text-muted);
  flex-shrink: 0;
}
.sp-row-thumb {
  width: 44px;
  height: 44px;
  flex-shrink: 0;
  border: 1px dashed var(--border);
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  overflow: hidden;
  background: var(--bg-elevated);
  transition: border-color .2s;
}
.sp-row-thumb:hover { border-color: var(--accent); }
.sp-row-thumb.has-img { border-style: solid; }
.sp-row-upload-hint {
  font-size: 1.1rem;
  color: var(--text-muted);
  line-height: 1;
}
.sp-manage-row .banner-manage-info {
  flex: 1;
  min-width: 0;
}
.sp-manage-row .banner-manage-meta {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.sp-row-link {
  flex: 1;
  min-width: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: .35rem .5rem;
  font-size: .75rem;
  background: var(--bg-input);
  color: var(--text-primary);
  outline: none;
}
.sp-row-link:focus { border-color: var(--accent); }
.sp-row-save {
  flex-shrink: 0;
  font-size: .7rem;
  padding: .28rem .5rem;
  border: none;
  border-radius: var(--radius-sm);
  background: var(--accent);
  color: #fff;
  font-weight: 600;
  cursor: pointer;
}
.sp-row-save:active { opacity: .8; }
.sp-row-del {
  flex-shrink: 0;
  width: 22px;
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: 50%;
  background: var(--danger);
  color: #fff;
  font-size: .65rem;
  cursor: pointer;
  line-height: 1;
}
.sp-row-del:active { opacity: .8; }

/* ─── Ad Collapse Toggle ─── */
.ad-collapse-section { margin-top: .8rem; }
.ad-collapse-section:first-child { margin-top: 0; }
.ad-collapse-toggle {
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  user-select: none;
}
.ad-collapse-arrow {
  font-size: .7rem;
  transition: transform .25s;
  color: var(--text-muted);
}
.ad-collapse-toggle.open .ad-collapse-arrow {
  transform: rotate(90deg);
}
.ad-collapse-content {
  padding-top: .4rem;
}

.watch-party-bg-preview {
  min-height: 92px;
  aspect-ratio: 5 / 1;
}

#banner-preview {
  aspect-ratio: 1200 / 545;
  min-height: 96px;
}

.banner-color-inputs {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: .55rem;
}

.banner-color-inputs label {
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .5rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: .48rem .55rem;
  background: var(--bg-elevated);
  color: var(--text-secondary);
  font-size: .75rem;
  font-weight: 800;
}

.banner-color-inputs input[type="color"] {
  width: 34px;
  height: 28px;
  border: 0;
  padding: 0;
  background: transparent;
}

#floatad-preview {
  width: min(100%, 220px);
  aspect-ratio: 1 / 1;
  border-radius: 50%;
  margin-inline: auto;
}

#floatad-preview img {
  border-radius: 50% !important;
}

#popupad-preview {
  width: min(100%, 260px);
  aspect-ratio: 3 / 4;
  margin-inline: auto;
}

#sponsor-preview {
  width: min(100%, 260px);
  aspect-ratio: 1 / 1;
  margin-inline: auto;
}

#sgad-preview {
  aspect-ratio: 1200 / 545;
  min-height: 96px;
}

.ad-edit-modal-root {
  position: fixed;
  inset: 0;
  z-index: 1300;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  background: rgba(15, 23, 42, .46);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
}

.ad-edit-modal-root.is-open {
  display: flex;
}

body.ad-edit-modal-open {
  overflow: hidden;
}

.ad-edit-modal-root .form-card.ad-edit-modal-card {
  width: min(100%, 460px);
  max-height: calc(100vh - 2rem);
  overflow-y: auto;
  overscroll-behavior: contain;
  margin: 0;
  box-shadow: 0 20px 55px rgba(15, 23, 42, .28);
  border-radius: var(--radius-lg);
}

.ad-edit-modal-root .form-card.ad-edit-modal-card .role-editor-header {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--bg-card);
  padding-bottom: .45rem;
}

@media (max-width: 520px) {
  .ad-edit-modal-root {
    align-items: flex-end;
    padding: .7rem;
  }

  .ad-edit-modal-root .form-card.ad-edit-modal-card {
    width: 100%;
    max-height: calc(100vh - 1.4rem);
    border-radius: 18px 18px 12px 12px;
  }
}

/* ─── EXP Log Operator Label ─── */
.exp-log-operator { font-size: .72rem; font-style: italic; color: var(--text-muted); margin-left: .3rem; }

/* ─── EXP Batch Tags & Team Members Scroll ─── */
#exp-batch-tags, #exp-team-members { max-height: 120px; overflow-y: auto; }

/* ─── EXP Tab Panels ─── */
.exp-tab-panel { padding: .3rem .2rem; }

/* ─── EXP Log Pagination ─── */
.exp-log-pagination { display: flex; justify-content: center; gap: .25rem; padding: .6rem 0 .3rem; flex-wrap: wrap; }
.exp-pg-btn { min-width: 28px; height: 28px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: transparent; color: var(--text-secondary); font-size: .75rem; cursor: pointer; display: flex; align-items: center; justify-content: center; transition: all .15s; }
.exp-pg-btn:hover { border-color: var(--primary); color: var(--primary); }
.exp-pg-btn.active { background: var(--primary); color: #fff; border-color: var(--primary); }

/* ─── EXP Log Color Classes ─── */
.log-item.log-user-plus  { background: rgba(34,197,94,.10); border-radius: 6px; }
.log-item.log-user-minus { background: rgba(239,68,68,.10); border-radius: 6px; }
.log-item.log-team-plus  { background: rgba(168,85,247,.10); border-radius: 6px; }
.log-item.log-team-minus { background: rgba(234,179,8,.10); border-radius: 6px; }
.log-type.team_exp { background: rgba(168,85,247,.15); color: #a855f7; }
.log-type.event_create, .log-type.event_edit, .log-type.event_end,
.log-type.event_cancel, .log-type.event_reopen, .log-type.event_delete { background: rgba(52,211,153,.15); color: var(--success); }
.log-type.tourn_create, .log-type.tourn_edit, .log-type.tourn_end,
.log-type.tourn_reopen, .log-type.tourn_delete, .log-type.tourn_approve { background: rgba(124,58,237,.15); color: #7c3aed; }
.log-type.team_create, .log-type.team_edit, .log-type.team_delete, .log-type.team_position, .log-type.team_approve { background: rgba(249,115,22,.15); color: #f97316; }
.log-type.ach_create, .log-type.ach_edit, .log-type.ach_toggle, .log-type.ach_delete { background: rgba(236,72,153,.15); color: #ec4899; }
.log-type.ann_create, .log-type.ann_edit, .log-type.ann_toggle, .log-type.ann_delete { background: rgba(14,165,233,.15); color: #0ea5e9; }

/* ─── Operation Log Row Background Colors ─── */
.log-item[class*="oplog-row-"] { border-radius: 6px; }
.operation-log-item { flex-direction: column; align-items: stretch; gap: .45rem; }
.operation-log-main { display: flex; align-items: flex-start; gap: .55rem; width: 100%; min-width: 0; }
.operation-log-main .log-content { flex: 1; min-width: 0; }
.operation-log-action-text { overflow-wrap: anywhere; }
.operation-log-meta { display: flex; flex-wrap: wrap; gap: .25rem; padding-left: calc(70px + .55rem); }
.operation-log-meta span { font-size: .68rem; line-height: 1.35; color: var(--text-muted); background: var(--bg-elevated); border: 1px solid var(--border); border-radius: 999px; padding: .12rem .4rem; overflow-wrap: anywhere; }
.operation-log-details { border-top: 1px solid var(--border); padding-top: .42rem; }
.operation-log-details summary { cursor: pointer; color: var(--primary); font-size: .74rem; font-weight: 700; }
.operation-log-detail-grid { margin-top: .5rem; display: flex; flex-direction: column; gap: .42rem; }
.operation-log-detail-row { display: grid; grid-template-columns: 70px minmax(0,1fr); gap: .5rem; align-items: start; }
.operation-log-detail-row span { color: var(--text-muted); font-size: .68rem; padding-top: .18rem; }
.operation-log-detail-row pre { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; font-size: .72rem; line-height: 1.45; color: var(--text-secondary); background: var(--bg-elevated); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: .42rem .5rem; }
.operation-log-detail-row pre.is-mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.operation-log-copy-btn { font-size: .68rem; padding: .18rem .45rem; margin-top: .45rem; }
@media (max-width: 520px) {
  .operation-log-main { flex-wrap: wrap; }
  .operation-log-main .log-time { width: 100%; }
  .operation-log-meta { padding-left: 0; }
  .operation-log-detail-row { grid-template-columns: 1fr; gap: .2rem; }
}
.log-item.oplog-row-log-tone-blue   { background: rgba(59,130,246,.06); }
.log-item.oplog-row-log-tone-violet { background: rgba(168,85,247,.06); }
.log-item.oplog-row-log-tone-purple { background: rgba(139,92,246,.06); }
.log-item.oplog-row-log-tone-green  { background: rgba(34,197,94,.06); }
.log-item.oplog-row-log-tone-teal   { background: rgba(20,184,166,.06); }
.log-item.oplog-row-log-tone-orange { background: rgba(249,115,22,.06); }
.log-item.oplog-row-log-tone-indigo { background: rgba(99,102,241,.06); }
.log-item.oplog-row-log-tone-sky    { background: rgba(14,165,233,.06); }
.log-item.oplog-row-log-tone-pink   { background: rgba(236,72,153,.06); }
.log-item.oplog-row-log-tone-amber  { background: rgba(245,158,11,.06); }
.log-item.oplog-row-log-tone-cyan   { background: rgba(6,182,212,.06); }
.log-item.oplog-row-log-tone-rose   { background: rgba(244,63,94,.06); }
.log-item.oplog-row-log-tone-red    { background: rgba(239,68,68,.08); }
.log-item.oplog-row-log-tone-gray   { background: rgba(100,116,139,.05); }
[data-theme="dark"] .log-item.oplog-row-log-tone-blue   { background: rgba(59,130,246,.12); }
[data-theme="dark"] .log-item.oplog-row-log-tone-violet { background: rgba(168,85,247,.12); }
[data-theme="dark"] .log-item.oplog-row-log-tone-purple { background: rgba(139,92,246,.12); }
[data-theme="dark"] .log-item.oplog-row-log-tone-green  { background: rgba(34,197,94,.12); }
[data-theme="dark"] .log-item.oplog-row-log-tone-teal   { background: rgba(20,184,166,.12); }
[data-theme="dark"] .log-item.oplog-row-log-tone-orange { background: rgba(249,115,22,.12); }
[data-theme="dark"] .log-item.oplog-row-log-tone-indigo { background: rgba(99,102,241,.12); }
[data-theme="dark"] .log-item.oplog-row-log-tone-sky    { background: rgba(14,165,233,.12); }
[data-theme="dark"] .log-item.oplog-row-log-tone-pink   { background: rgba(236,72,153,.12); }
[data-theme="dark"] .log-item.oplog-row-log-tone-amber  { background: rgba(245,158,11,.12); }
[data-theme="dark"] .log-item.oplog-row-log-tone-cyan   { background: rgba(6,182,212,.12); }
[data-theme="dark"] .log-item.oplog-row-log-tone-rose   { background: rgba(244,63,94,.12); }
[data-theme="dark"] .log-item.oplog-row-log-tone-red    { background: rgba(239,68,68,.14); }
[data-theme="dark"] .log-item.oplog-row-log-tone-gray   { background: rgba(100,116,139,.10); }

/* ─── Audit Log Action Color Classes ─── */
.log-item.audit-login     { background: rgba(34,197,94,.08); border-radius: 6px; }
.log-item.audit-logout    { background: rgba(100,116,139,.08); border-radius: 6px; }
.log-item.audit-signup    { background: rgba(59,130,246,.08); border-radius: 6px; }
.log-item.audit-cancel    { background: rgba(249,115,22,.08); border-radius: 6px; }
.log-item.audit-team      { background: rgba(168,85,247,.08); border-radius: 6px; }
.log-item.audit-role      { background: rgba(236,72,153,.08); border-radius: 6px; }
.log-item.audit-admin     { background: rgba(239,68,68,.08); border-radius: 6px; }
.log-item.audit-failure   { background: rgba(239,68,68,.10); border-radius: 6px; }
[data-theme="dark"] .log-item.audit-login   { background: rgba(34,197,94,.14); }
[data-theme="dark"] .log-item.audit-logout  { background: rgba(100,116,139,.14); }
[data-theme="dark"] .log-item.audit-signup  { background: rgba(59,130,246,.14); }
[data-theme="dark"] .log-item.audit-cancel  { background: rgba(249,115,22,.14); }
[data-theme="dark"] .log-item.audit-team    { background: rgba(168,85,247,.14); }
[data-theme="dark"] .log-item.audit-role    { background: rgba(236,72,153,.14); }
[data-theme="dark"] .log-item.audit-admin   { background: rgba(239,68,68,.14); }
[data-theme="dark"] .log-item.audit-failure { background: rgba(239,68,68,.16); }

/* ─── Dark Theme Log Types ─── */
[data-theme="dark"] .log-type.exp { background: rgba(96,165,250,.20); }
[data-theme="dark"] .log-type.role { background: rgba(167,139,250,.20); }
[data-theme="dark"] .log-type.event { background: rgba(52,211,153,.20); }
[data-theme="dark"] .log-type.log-tone-blue { background: rgba(59,130,246,.22); }
[data-theme="dark"] .log-type.log-tone-violet { background: rgba(168,85,247,.22); }
[data-theme="dark"] .log-type.log-tone-purple { background: rgba(139,92,246,.22); }
[data-theme="dark"] .log-type.log-tone-green { background: rgba(34,197,94,.22); }
[data-theme="dark"] .log-type.log-tone-teal { background: rgba(20,184,166,.22); }
[data-theme="dark"] .log-type.log-tone-orange { background: rgba(249,115,22,.22); }
[data-theme="dark"] .log-type.log-tone-indigo { background: rgba(99,102,241,.22); }
[data-theme="dark"] .log-type.log-tone-sky { background: rgba(14,165,233,.22); }
[data-theme="dark"] .log-type.log-tone-pink { background: rgba(236,72,153,.22); }
[data-theme="dark"] .log-type.log-tone-amber { background: rgba(245,158,11,.24); }
[data-theme="dark"] .log-type.log-tone-cyan { background: rgba(6,182,212,.22); }
[data-theme="dark"] .log-type.log-tone-rose { background: rgba(244,63,94,.22); }
[data-theme="dark"] .log-type.log-tone-red { background: rgba(239,68,68,.22); }
[data-theme="dark"] .log-type.log-tone-gray { background: rgba(100,116,139,.24); }
[data-theme="dark"] .log-type.team_exp { background: rgba(168,85,247,.25); }
[data-theme="dark"] .log-type.event_create, [data-theme="dark"] .log-type.event_edit,
[data-theme="dark"] .log-type.event_end, [data-theme="dark"] .log-type.event_cancel,
[data-theme="dark"] .log-type.event_reopen, [data-theme="dark"] .log-type.event_delete { background: rgba(52,211,153,.20); }
[data-theme="dark"] .log-type.tourn_create, [data-theme="dark"] .log-type.tourn_edit,
[data-theme="dark"] .log-type.tourn_end, [data-theme="dark"] .log-type.tourn_reopen,
[data-theme="dark"] .log-type.tourn_delete, [data-theme="dark"] .log-type.tourn_approve { background: rgba(124,58,237,.20); }
[data-theme="dark"] .log-type.team_create, [data-theme="dark"] .log-type.team_edit,
[data-theme="dark"] .log-type.team_delete, [data-theme="dark"] .log-type.team_position,
[data-theme="dark"] .log-type.team_approve { background: rgba(249,115,22,.20); }
[data-theme="dark"] .log-type.ach_create, [data-theme="dark"] .log-type.ach_edit,
[data-theme="dark"] .log-type.ach_toggle, [data-theme="dark"] .log-type.ach_delete { background: rgba(236,72,153,.20); }
[data-theme="dark"] .log-type.ann_create, [data-theme="dark"] .log-type.ann_edit,
[data-theme="dark"] .log-type.ann_toggle, [data-theme="dark"] .log-type.ann_delete { background: rgba(14,165,233,.20); }

/* ─── Achievement Condition Form ─── */
.ach-cond-section { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: .6rem; margin-bottom: .5rem; background: var(--bg-elevated); }
.ach-cond-section-title { font-size: .78rem; font-weight: 700; color: var(--text-secondary); margin-bottom: .4rem; }
.ach-cond-preview-wrap { display: flex; align-items: center; gap: .3rem; padding: .4rem 0 0; border-top: 1px dashed var(--border); margin-top: .4rem; }
.ach-badge-upload-box { width: 50px; height: 50px; border: 2px dashed var(--border); border-radius: var(--radius-sm); display: flex; align-items: center; justify-content: center; cursor: pointer; background: var(--bg-main); overflow: hidden; flex-shrink: 0; transition: border-color .2s; }
.ach-badge-upload-box:hover { border-color: var(--accent); }
.ach-badge-upload-box img { width: 100%; height: 100%; object-fit: cover; border-radius: 4px; }

/* ─── Dashboard ─── */
.dash-summary { display: grid; grid-template-columns: repeat(4, 1fr); gap: .5rem; padding: .5rem; }
.dash-card { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); padding: .6rem .4rem; text-align: center; }
.dash-num { font-family: var(--font-display); font-size: 1.15rem; font-weight: 800; color: var(--accent); }
.dash-label { font-size: .65rem; color: var(--text-muted); margin-top: .1rem; }
.dash-bar-list { display: flex; flex-direction: column; gap: .45rem; }
.dash-bar-row { display: flex; align-items: center; gap: .5rem; }
.dash-bar-label { font-size: .78rem; font-weight: 600; min-width: 3rem; flex-shrink: 0; }
.dash-bar-track { flex: 1; height: 10px; background: var(--bg-elevated); border-radius: 5px; overflow: hidden; }
.dash-bar-fill { height: 100%; border-radius: 5px; transition: width .4s ease; }
.dash-bar-fill.type-friendly { background: #0d9488; }
.dash-bar-fill.type-camp { background: #ec4899; }
.dash-bar-fill.type-play { background: #7c3aed; }
.dash-bar-fill.type-watch { background: #f59e0b; }
.dash-bar-val { font-size: .72rem; color: var(--text-secondary); font-weight: 600; min-width: 3.5rem; text-align: right; flex-shrink: 0; }

.dash-query-card { overflow: hidden; padding: 0; }
/* 2026-04-27：活動參與度調查獨立底色 — 與上下卡片視覺區分 */
.dash-query-details { background: linear-gradient(180deg, rgba(13,148,136,.10), rgba(13,148,136,.04)); border: 1px solid rgba(13,148,136,.22); }
/* 深色主題用更亮的 teal #34d399 + 提高不透明度，避免在 #181d27 底上消失 */
[data-theme="dark"] .dash-query-details { background: linear-gradient(180deg, rgba(52,211,153,.16), rgba(52,211,153,.06)); border: 1px solid rgba(52,211,153,.36); }
.dash-query-panel-summary { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: .16rem .65rem; align-items: center; padding: .75rem .85rem; cursor: pointer; list-style: none; user-select: none; }
.dash-query-panel-summary::-webkit-details-marker { display: none; }
.dash-query-panel-title { font-size: .85rem; font-weight: 700; color: var(--text-primary); }
.dash-query-panel-side { display: inline-flex; align-items: center; justify-content: flex-end; gap: .45rem; white-space: nowrap; }
.dash-query-panel-text { grid-column: 1 / -1; font-size: .72rem; line-height: 1.55; color: var(--text-muted); }
.dash-query-panel-meta-primary { font-size: .74rem; font-weight: 600; color: var(--text-secondary); }
.dash-query-details.has-active-filters .dash-query-panel-text,
.dash-query-details.has-active-filters .dash-query-panel-meta-primary { color: var(--primary); }
.dash-query-arrow { display: inline-flex; align-items: center; justify-content: center; width: 1.45rem; height: 1.45rem; flex-shrink: 0; border-radius: 999px; border: 1px solid var(--border); background: var(--bg-elevated); font-size: .72rem; color: var(--text-secondary); transition: transform .2s ease, color .2s ease, border-color .2s ease, background .2s ease; }
.dash-query-details.has-active-filters .dash-query-arrow { color: var(--primary); border-color: rgba(37,99,235,.24); background: rgba(37,99,235,.08); }
.dash-query-details[open] .dash-query-panel-summary { border-bottom: 1px solid var(--border); }
.dash-query-details[open] .dash-query-arrow { transform: rotate(90deg); }
.dash-query-body { padding: .8rem .9rem .9rem; }
.dash-query-help { font-size: .75rem; color: var(--text-muted); line-height: 1.6; margin-bottom: .75rem; }
.dash-query-form { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: .6rem; margin-bottom: .75rem; }
.dash-query-field { display: flex; flex-direction: column; gap: .28rem; font-size: .76rem; color: var(--text-secondary); min-width: 0; overflow: hidden; }
/* 2026-04-27：iOS Safari 原生 date input 撐爆 grid 1fr — 沿用 .ce-row-half 成功模式：父層 overflow:hidden + appearance:none + 顯式 padding/font-size */
.dash-query-field input { width: 100%; max-width: 100%; min-width: 0; box-sizing: border-box; padding: .5rem .55rem; font-size: 16px; -webkit-appearance: none; appearance: none; border: 1px solid var(--border); border-radius: .5rem; background: var(--bg-card); color: var(--text-primary); }
.dash-query-field input[type="date"] { font-family: inherit; }
.dash-query-actions { display: flex; gap: .45rem; flex-wrap: wrap; margin-bottom: .8rem; }
.dash-query-state { padding: .75rem .85rem; border-radius: var(--radius-sm); background: var(--bg-elevated); color: var(--text-secondary); font-size: .78rem; }
.dash-query-state.muted { color: var(--text-muted); }
.dash-query-state.error { background: rgba(220,38,38,.10); color: #dc2626; }
.dash-query-share-box { margin-bottom: .8rem; padding: .8rem .9rem; border: 1px solid rgba(37,99,235,.18); border-radius: var(--radius-sm); background: linear-gradient(180deg, rgba(37,99,235,.08), rgba(37,99,235,.03)); }
.dash-query-share-title { font-size: .82rem; font-weight: 800; color: var(--text-primary); }
.dash-query-share-meta { margin-top: .2rem; font-size: .73rem; line-height: 1.6; color: var(--text-muted); }
.dash-query-share-link { margin-top: .55rem; padding: .55rem .65rem; border-radius: .55rem; background: var(--bg-card); border: 1px dashed var(--border); font-size: .72rem; line-height: 1.6; color: var(--text-secondary); word-break: break-all; }
.dash-query-share-actions { display: flex; gap: .45rem; flex-wrap: wrap; margin-top: .65rem; }
.dash-query-summary { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: .55rem; margin-bottom: .8rem; }
.dash-query-summary-card { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: .7rem .8rem; background: var(--bg-elevated); }
.dash-query-summary-num { font-family: var(--font-display); font-size: 1.25rem; font-weight: 800; color: var(--accent); }
.dash-query-summary-label { margin-top: .15rem; font-size: .72rem; color: var(--text-muted); }
.dash-query-table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius-sm); }
.dash-query-table { width: 100%; border-collapse: collapse; min-width: 680px; background: var(--bg-card); }
.dash-query-table th, .dash-query-table td { padding: .65rem .7rem; border-bottom: 1px solid var(--border); text-align: left; vertical-align: top; font-size: .78rem; }
.dash-query-table th { font-size: .72rem; color: var(--text-muted); background: var(--bg-elevated); white-space: nowrap; }
.dash-query-table tbody tr:last-child td { border-bottom: none; }
.dash-query-user-name { font-weight: 700; color: var(--text-primary); }
.dash-query-user-uid { margin-top: .18rem; font-size: .68rem; color: var(--text-muted); word-break: break-all; }
.dash-query-event-list { display: flex; flex-direction: column; gap: .28rem; min-width: 220px; }
.dash-query-event-line { display: flex; flex-direction: column; gap: .08rem; padding: .35rem .45rem; border-radius: .5rem; background: var(--bg-elevated); }
.dash-query-event-title { font-weight: 600; color: var(--text-primary); line-height: 1.4; }
.dash-query-event-date { font-size: .67rem; color: var(--text-muted); }
.participant-share-page { display: flex; flex-direction: column; gap: .8rem; }
.participant-share-meta { margin-top: .22rem; font-size: .76rem; line-height: 1.6; color: var(--text-secondary); }
.participant-share-note { margin-top: .7rem; padding: .7rem .8rem; border-radius: .6rem; background: rgba(239,68,68,.08); color: #b91c1c; font-size: .74rem; line-height: 1.65; }

@media (max-width: 640px) {
  .admin-log-toolbar {
    align-items: center;
  }
  .admin-log-toolbar-actions {
    justify-content: center;
  }
  .dash-query-panel-summary {
    gap: .18rem .5rem;
  }
  .dash-query-panel-side {
    align-self: start;
  }
  .dash-query-form { grid-template-columns: 1fr; }
  .dash-query-actions { flex-direction: column; }
  .dash-query-actions button { width: 100%; }
  .dash-query-share-actions { flex-direction: column; }
  .dash-query-share-actions button { width: 100%; }
}

/* ── 雲端用量指標 ── */
.dash-usage-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: .5rem;
}
@media (max-width: 480px) {
  .dash-usage-grid { grid-template-columns: repeat(2, 1fr); }
  .dash-usage-grid .dash-usage-card:last-child:nth-child(odd) { grid-column: 1 / -1; }
}
.dash-usage-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: .5rem .6rem;
  text-align: center;
}
/* 2026-04-27：警示橫幅 — 半透明紅、深淺主題皆可讀 */
.dash-usage-alert {
  background: rgba(239, 68, 68, .12);
  border: 1px solid rgba(239, 68, 68, .35);
  color: #dc2626;
  border-radius: 8px;
  padding: .5rem .75rem;
  margin-bottom: .75rem;
  font-size: .78rem;
}
[data-theme="dark"] .dash-usage-alert { color: #fca5a5; background: rgba(239, 68, 68, .16); border-color: rgba(239, 68, 68, .45); }
.dash-usage-label {
  font-size: .72rem;
  color: var(--text-secondary);
  margin-bottom: .2rem;
}
.dash-usage-num {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: .3rem;
}
.dash-usage-bar-track {
  height: 6px;
  background: var(--bg-elevated);
  border-radius: 3px;
  overflow: hidden;
  margin-bottom: .2rem;
}
.dash-usage-bar-fill {
  height: 100%;
  border-radius: 3px;
  transition: width .3s ease;
}
.dash-usage-sub {
  font-size: .65rem;
  color: var(--text-muted);
}

/* ─── Dashboard Cost Rows ─── */
.dash-cost-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: .25rem 0;
  font-size: .8rem;
}
.dash-cost-row.dash-cost-detail {
  padding-left: .75rem;
  font-size: .72rem;
  color: var(--text-secondary);
}
.dash-cost-label { flex: 1; }
.dash-cost-val { font-weight: 600; font-variant-numeric: tabular-nums; }

.dash-map-section {
  margin-top: .85rem;
  padding-top: .85rem;
  border-top: 1px solid var(--border);
}
.dash-map-section-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: .7rem;
  margin-bottom: .55rem;
}
.dash-map-section-title {
  font-size: .86rem;
  font-weight: 800;
  color: var(--text-primary);
}
.dash-map-section-sub,
.dash-map-note {
  font-size: .68rem;
  line-height: 1.55;
  color: var(--text-muted);
}
.dash-map-estimate,
.dash-map-sku {
  margin-top: .45rem;
}
.dash-map-warning {
  margin-top: .5rem;
  padding: .45rem .6rem;
  border-radius: 8px;
  border: 1px solid rgba(245, 158, 11, .35);
  background: rgba(245, 158, 11, .1);
  color: #b45309;
  font-size: .72rem;
  line-height: 1.5;
}
.dash-map-breakdown-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: .55rem;
  margin-top: .65rem;
}
.dash-map-breakdown-card {
  min-width: 0;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg-card);
  padding: .55rem .6rem;
}
.dash-map-block-title {
  font-size: .73rem;
  font-weight: 800;
  color: var(--text-secondary);
  margin-bottom: .42rem;
}
.dash-map-breakdown-row {
  display: flex;
  flex-direction: column;
  gap: .18rem;
  margin-bottom: .42rem;
}
.dash-map-breakdown-row:last-child {
  margin-bottom: 0;
}
.dash-map-breakdown-head {
  display: flex;
  justify-content: space-between;
  gap: .45rem;
  min-width: 0;
  font-size: .7rem;
  color: var(--text-secondary);
}
.dash-map-breakdown-head span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.dash-map-breakdown-head strong {
  flex-shrink: 0;
  color: var(--text-primary);
  font-variant-numeric: tabular-nums;
}
.dash-map-breakdown-track {
  height: 5px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--bg-elevated);
}
.dash-map-breakdown-fill {
  height: 100%;
  border-radius: 999px;
  background: #0d9488;
}
.dash-map-empty {
  color: var(--text-muted);
  font-size: .72rem;
  line-height: 1.5;
}
@media (max-width: 560px) {
  .dash-map-breakdown-grid { grid-template-columns: 1fr; }
  .dash-map-section-head { align-items: center; }
}

/* ═══════════════════════════════════════════════════
   Dashboard Drilldown（八大卡片點擊彈窗 + 進度 modal）
   ═══════════════════════════════════════════════════ */

/* ── 重新整理資料條（儀表板最上方） ── */
/* 2026-04-27：用 amber 漸層 + border 與「活動參與查詢」（teal）做視覺區隔 */
.dash-refresh-bar {
  display: flex; align-items: center; gap: .5rem;
  padding: .6rem .8rem;
  background: linear-gradient(180deg, rgba(245,158,11,.10), rgba(245,158,11,.04));
  border: 1px solid rgba(245,158,11,.26);
  border-radius: var(--radius-md, 12px);
  margin-bottom: .8rem;
  flex-wrap: wrap;
}
/* 深色主題下用更亮的 amber 提高識別度 */
[data-theme="dark"] .dash-refresh-bar { background: linear-gradient(180deg, rgba(251,191,36,.14), rgba(251,191,36,.05)); border-color: rgba(251,191,36,.38); }
.dash-refresh-bar select {
  padding: .3rem .5rem;
  border-radius: var(--radius-sm, 6px);
  border: 1px solid var(--border); background: var(--bg-card);
  color: var(--text-primary); font-size: .8rem;
}
.dash-refresh-bar .dash-refresh-info {
  flex: 1; font-size: .72rem; color: var(--text-muted); min-width: 140px;
}
.dash-refresh-bar button { flex-shrink: 0; }

/* dash-card 可點擊視覺提示 */
.dash-card[data-drill-key] { cursor: pointer; transition: transform .15s, box-shadow .15s; }
.dash-card[data-drill-key]:hover { transform: translateY(-1px); box-shadow: 0 4px 14px rgba(0,0,0,.08); }
.dash-card[data-drill-key]:active { transform: translateY(0); }

/* Dashboard mobile-first presentation */
#dashboard-content {
  display: flex;
  flex-direction: column;
  gap: .7rem;
  padding: .1rem .15rem 1.2rem;
}

.dash-mobile-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: .7rem;
  padding: .9rem;
  border: 1px solid rgba(13, 148, 136, .18);
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(13, 148, 136, .14), rgba(59, 130, 246, .08) 56%, rgba(245, 158, 11, .08)),
    var(--bg-card);
  box-shadow: 0 10px 28px rgba(15, 23, 42, .07);
  overflow: hidden;
}
[data-theme="dark"] .dash-mobile-hero {
  border-color: rgba(52, 211, 153, .28);
  box-shadow: 0 10px 28px rgba(0, 0, 0, .18);
}
.dash-hero-copy { min-width: 0; }
.dash-hero-kicker {
  display: block;
  margin-bottom: .18rem;
  color: var(--accent);
  font-size: .68rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}
.dash-hero-copy h3 {
  margin: 0;
  color: var(--text-primary);
  font-size: 1.08rem;
  line-height: 1.25;
}
.dash-hero-copy p {
  margin: .25rem 0 0;
  color: var(--text-secondary);
  font-size: .76rem;
  line-height: 1.45;
}
.dash-hero-metric {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: .05rem;
  min-width: 5rem;
  padding: .55rem .65rem;
  border: 1px solid rgba(13, 148, 136, .22);
  border-radius: 8px;
  background: rgba(255, 255, 255, .72);
  color: var(--text-primary);
  cursor: pointer;
  text-align: right;
}
[data-theme="dark"] .dash-hero-metric { background: rgba(17, 24, 39, .72); }
.dash-hero-metric span {
  color: var(--text-muted);
  font-size: .68rem;
  font-weight: 700;
}
.dash-hero-metric strong {
  color: var(--accent);
  font-family: var(--font-display);
  font-size: 1.35rem;
  line-height: 1;
}

.dash-refresh-bar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) 2.35rem;
  align-items: center;
  gap: .5rem;
  margin-bottom: 0;
  padding: .7rem;
  border-radius: 8px;
}
.dash-refresh-bar .dash-refresh-info {
  grid-column: 1 / -1;
  min-width: 0;
  line-height: 1.5;
}
.dash-refresh-bar select {
  grid-column: 1 / -1;
  width: 100%;
  min-height: 2.25rem;
  padding: .42rem .55rem;
  font-size: .78rem;
}
.dash-refresh-bar .primary-btn,
.dash-refresh-bar .outline-btn {
  width: 100%;
  min-height: 2.35rem;
  padding: .45rem .55rem;
  font-size: .74rem;
  white-space: normal;
  line-height: 1.25;
}
.dash-refresh-bar .dash-info-btn {
  width: 2.35rem;
  height: 2.35rem;
  justify-self: stretch;
}

.dash-section-tabs {
  display: flex;
  gap: .4rem;
  overflow-x: auto;
  padding: .05rem .05rem .15rem;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}
.dash-section-tabs::-webkit-scrollbar { display: none; }
.dash-section-tabs button {
  flex: 0 0 auto;
  min-height: 2rem;
  padding: .45rem .72rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--bg-card);
  color: var(--text-secondary);
  cursor: pointer;
  font-size: .76rem;
  font-weight: 700;
  line-height: 1;
  box-shadow: 0 4px 12px rgba(15, 23, 42, .05);
}
.dash-section-tabs button:active {
  transform: translateY(1px);
}

.dash-summary {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: .55rem;
  padding: 0;
}
.dash-card {
  position: relative;
  min-height: 6rem;
  padding: .75rem .72rem .7rem;
  border-radius: 8px;
  text-align: left;
  overflow: hidden;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, .72), rgba(255, 255, 255, .38)),
    var(--bg-card);
  box-shadow: 0 8px 18px rgba(15, 23, 42, .06);
}
[data-theme="dark"] .dash-card {
  background: linear-gradient(180deg, rgba(31, 41, 55, .8), rgba(17, 24, 39, .62)), var(--bg-card);
  box-shadow: 0 8px 18px rgba(0, 0, 0, .18);
}
.dash-card::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 4px;
  background: var(--accent);
}
.dash-summary .dash-card:nth-child(2)::before { background: #3b82f6; }
.dash-summary .dash-card:nth-child(3)::before { background: #f59e0b; }
.dash-summary .dash-card:nth-child(4)::before { background: #ec4899; }
.dash-num {
  display: block;
  margin-top: .1rem;
  font-size: 1.55rem;
  line-height: 1.05;
  color: var(--text-primary);
  font-variant-numeric: tabular-nums;
}
.dash-label {
  margin-top: .45rem;
  color: var(--text-secondary);
  font-size: .74rem;
  font-weight: 700;
  line-height: 1.35;
}
.dash-card[data-drill-key]:hover {
  box-shadow: 0 10px 24px rgba(15, 23, 42, .1);
}

#dashboard-content .info-card:not(.dash-query-card) {
  margin-bottom: 0;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  box-shadow: 0 8px 22px rgba(15, 23, 42, .06);
}
#dashboard-content .info-card {
  margin-bottom: 0;
}
#dashboard-content .info-title {
  margin-bottom: .65rem;
  color: var(--text-primary);
  font-size: .9rem;
  font-weight: 800;
  line-height: 1.35;
}
#dashboard-content canvas {
  max-width: 100%;
}

.dash-bar-list {
  gap: .55rem;
}
.dash-bar-row {
  display: grid;
  grid-template-columns: minmax(5rem, .9fr) minmax(6rem, 1.45fr) minmax(3.2rem, auto);
  gap: .45rem;
  align-items: center;
}
.dash-bar-label {
  min-width: 0;
  overflow: hidden;
  color: var(--text-secondary);
  text-overflow: ellipsis;
  white-space: nowrap;
}
.dash-bar-track {
  min-width: 0;
  height: 8px;
}
.dash-bar-val {
  min-width: 0;
  font-variant-numeric: tabular-nums;
}
.dash-region-more-btn {
  width: 100%;
  min-height: 2.35rem;
  border: 1px dashed color-mix(in srgb, var(--accent) 52%, var(--border));
  border-radius: 8px;
  background: color-mix(in srgb, var(--accent) 8%, var(--bg-card));
  color: var(--accent);
  font-size: .78rem;
  font-weight: 800;
  cursor: pointer;
}
.dash-region-more-btn:focus-visible {
  outline: 2px solid color-mix(in srgb, var(--accent) 68%, transparent);
  outline-offset: 2px;
}
.dash-region-more-note,
.dash-region-empty {
  padding: .55rem .65rem;
  border-radius: 8px;
  background: var(--bg-elevated);
  color: var(--text-muted);
  font-size: .74rem;
  line-height: 1.45;
}

.dash-usage-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: .55rem;
}
.dash-usage-card {
  padding: .65rem .6rem;
  border-radius: 8px;
  text-align: left;
  box-shadow: 0 6px 16px rgba(15, 23, 42, .05);
}
.dash-usage-num {
  font-family: var(--font-display);
  font-size: 1.2rem;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
}
.dash-map-breakdown-grid {
  grid-template-columns: 1fr;
}

@media (max-width: 420px) {
  #dashboard-content {
    gap: .62rem;
    padding-left: 0;
    padding-right: 0;
  }
  .dash-mobile-hero {
    grid-template-columns: 1fr;
  }
  .dash-hero-metric {
    width: 100%;
    align-items: flex-start;
    text-align: left;
  }
  .dash-card {
    min-height: 5.75rem;
    padding: .7rem .62rem .65rem;
  }
  .dash-num {
    font-size: 1.4rem;
  }
  .dash-bar-row {
    grid-template-columns: 1fr;
    gap: .25rem;
    padding: .45rem 0;
    border-bottom: 1px solid var(--border);
  }
  .dash-bar-row:last-child {
    border-bottom: 0;
  }
  .dash-bar-val {
    text-align: left;
  }
}

@media (min-width: 760px) {
  #dashboard-content {
    gap: .85rem;
    padding: .25rem .25rem 1.5rem;
  }
  .dash-refresh-bar {
    grid-template-columns: minmax(14rem, 1fr) auto auto auto 2.35rem;
  }
  .dash-refresh-bar .dash-refresh-info,
  .dash-refresh-bar select,
  .dash-refresh-bar .primary-btn,
  .dash-refresh-bar .outline-btn,
  .dash-refresh-bar .dash-info-btn {
    grid-column: auto;
  }
  .dash-refresh-bar select {
    min-width: 8.5rem;
  }
  .dash-refresh-bar .primary-btn,
  .dash-refresh-bar .outline-btn {
    width: auto;
    white-space: nowrap;
  }
  .dash-summary {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: .7rem;
  }
  .dash-mobile-hero {
    padding: 1rem 1.05rem;
  }
  .dash-usage-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
  .dash-map-breakdown-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (min-width: 1080px) {
  #dashboard-content {
    max-width: 1180px;
    margin: 0 auto;
  }
  .dash-usage-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
  .dash-map-breakdown-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

/* ── 進度 modal ── */
.dash-progress-overlay {
  position: fixed; inset: 0; z-index: 2000;
  background: rgba(0,0,0,.35);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  display: flex; align-items: center; justify-content: center;
  padding: 1rem;
}
.dash-progress-box {
  background: var(--bg-card);
  border-radius: 16px; box-shadow: 0 8px 32px rgba(0,0,0,.15);
  padding: 1.2rem;
  max-width: 440px; width: 100%;
  max-height: 80vh; overflow-y: auto;
}
.dash-progress-header {
  font-size: 1rem; font-weight: 600; margin-bottom: .8rem;
  color: var(--text-primary);
}
.dash-progress-bar-wrap {
  width: 100%; height: 8px;
  background: var(--border); border-radius: 4px; overflow: hidden;
  margin-bottom: .4rem;
}
.dash-progress-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--primary, var(--accent)));
  transition: width .3s ease-out;
}
.dash-progress-percent {
  font-size: .82rem; text-align: right;
  color: var(--text-muted); margin-bottom: .6rem;
}
.dash-progress-steps { list-style: none; padding: 0; margin: 0 0 .8rem; }
.dash-progress-steps li {
  padding: .35rem 0; font-size: .82rem;
  border-bottom: 1px solid var(--border);
}
.dash-progress-steps li:last-child { border-bottom: none; }
.dash-progress-actions {
  display: flex; justify-content: flex-end; gap: .5rem;
}

/* ── Drilldown 彈窗 ── */
.dash-drill-overlay {
  position: fixed; inset: 0; z-index: 2050;
  background: rgba(0,0,0,.35);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  display: flex; align-items: center; justify-content: center;
  padding: 1rem;
}
.dash-drill-overlay-secondary { z-index: 2100; }
.dash-drill-box {
  background: var(--bg-card);
  border-radius: 16px; box-shadow: 0 8px 32px rgba(0,0,0,.15);
  max-width: 520px; width: 100%;
  max-height: 85vh;
  display: flex; flex-direction: column;
  overflow: hidden;
}
.dash-drill-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: .9rem 1.1rem;
  border-bottom: 1px solid var(--border); flex-shrink: 0;
}
.dash-drill-header h3 {
  margin: 0; font-size: 1rem; font-weight: 600; color: var(--text-primary);
}
.dash-drill-close {
  width: 28px; height: 28px; border: none; background: transparent;
  font-size: 1.1rem; color: var(--text-muted); cursor: pointer;
  border-radius: 6px; transition: background .15s;
}
.dash-drill-close:hover { background: rgba(128,128,128,.12); }
.dash-drill-tabs {
  display: flex; gap: .4rem;
  padding: .55rem .8rem;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.dash-drill-tab {
  flex: 1; padding: .45rem .5rem;
  border: 1px solid var(--border);
  background: transparent; color: var(--text-secondary);
  border-radius: var(--radius-sm, 6px);
  font-size: .8rem; cursor: pointer;
  transition: all .15s;
}
.dash-drill-tab.active {
  background: var(--accent); color: #fff; border-color: var(--accent);
}
.dash-drill-body {
  flex: 1; overflow-y: auto;
  padding: .8rem .9rem;
}

/* ── Drilldown 內容區塊 ── */
.dash-section {
  background: var(--bg-elevated);
  border-radius: var(--radius-md, 12px);
  padding: .75rem .85rem;
  margin-bottom: .7rem;
  border: 1px solid var(--border);
}
.dash-section-title {
  font-size: .85rem; font-weight: 600;
  color: var(--text-primary);
  margin-bottom: .55rem;
  display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: .3rem;
}
.dash-section-note {
  font-size: .68rem; color: var(--text-muted);
  background: rgba(128,128,128,.15); padding: .1rem .35rem;
  border-radius: 999px; font-weight: 500;
}

.dash-stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(90px, 1fr));
  gap: .5rem;
}
.dash-stat-item {
  text-align: center;
  padding: .5rem;
  background: var(--bg-card);
  border-radius: var(--radius-sm, 6px);
  border: 1px solid var(--border);
}
.dash-stat-num {
  font-size: 1.15rem; font-weight: 700;
  color: var(--accent); line-height: 1.2;
}
.dash-stat-label {
  font-size: .7rem; color: var(--text-muted); margin-top: .2rem;
}

.dash-bar-row {
  display: flex; align-items: center; gap: .4rem;
  margin-bottom: .35rem; font-size: .78rem;
}
.dash-bar-label {
  min-width: 5em; max-width: 10em;
  color: var(--text-secondary);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.dash-bar-track {
  flex: 1; min-width: 60px;
  height: 8px; background: var(--border);
  border-radius: 4px; overflow: hidden;
}
.dash-bar-fill {
  height: 100%; border-radius: 4px;
  background: var(--accent);
}
.dash-bar-val {
  min-width: 3em; text-align: right;
  color: var(--text-primary); font-weight: 600;
}

.dash-kv {
  font-size: .82rem; color: var(--text-secondary);
  padding: .2rem 0;
}
.dash-kv strong { color: var(--text-primary); font-weight: 600; }

.dash-rank-item {
  display: flex; justify-content: space-between; align-items: center;
  padding: .5rem; gap: .5rem;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background .15s;
}
.dash-rank-item:hover { background: rgba(128,128,128,.08); }
.dash-rank-item:last-child { border-bottom: none; }
.dash-rank-name {
  font-size: .82rem; color: var(--text-primary);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1;
}
.dash-rank-val {
  font-size: .72rem; color: var(--text-muted); flex-shrink: 0;
}

.dash-empty {
  text-align: center; color: var(--text-muted);
  padding: .8rem; font-size: .82rem;
}

/* ═══════════════════════════════════════════════════
   Dashboard 說明按鈕 + 說明彈窗
   ═══════════════════════════════════════════════════ */

/* 說明按鈕（圓形 ? 圖示；參考 edu-info-btn） */
.dash-info-btn {
  width: 22px; height: 22px;
  border-radius: 50%;
  border: 1.5px solid var(--accent);
  background: transparent;
  color: var(--accent);
  font-size: .75rem; font-weight: 700;
  cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  padding: 0; line-height: 1;
  transition: background .15s, color .15s;
}
.dash-info-btn:hover { background: var(--accent); color: #fff; }

/* drill 彈窗 header 右側動作區（info + close） */
.dash-drill-header-actions {
  display: inline-flex; align-items: center; gap: .4rem;
  flex-shrink: 0;
}

/* 說明彈窗 overlay（層級最高 2200，蓋過 drill secondary） */
.dash-info-overlay {
  position: fixed; inset: 0; z-index: 2200;
  background: rgba(0,0,0,.35);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  display: flex; align-items: center; justify-content: center;
  padding: 1rem;
}
.dash-info-dialog {
  background: var(--bg-card);
  border-radius: 16px;
  padding: 1.2rem 1.4rem;
  max-width: 420px; width: 100%;
  max-height: calc(100vh - 2rem);
  display: flex; flex-direction: column;
  box-shadow: 0 8px 32px rgba(0,0,0,.15);
}
.dash-info-dialog-title {
  font-size: 1rem; font-weight: 700;
  margin-bottom: .6rem; text-align: center;
  flex-shrink: 0;
  color: var(--text-primary);
}
.dash-info-dialog-body {
  font-size: .84rem; line-height: 1.65;
  color: var(--text-secondary);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  flex: 1; min-height: 0;
}
.dash-info-section {
  background: var(--bg-elevated);
  border-radius: var(--radius-sm, 6px);
  padding: .6rem .75rem;
  margin-bottom: .5rem;
}
.dash-info-section:last-child { margin-bottom: 0; }
.dash-info-section b {
  display: block; font-size: .85rem;
  color: var(--text-primary); font-weight: 600;
  margin-bottom: .25rem;
}
.dash-info-section p {
  margin: 0; font-size: .78rem; line-height: 1.6;
}
.dash-info-close-btn {
  margin-top: .9rem;
  width: 100%; padding: .55rem;
  background: var(--accent); color: #fff;
  border: none; border-radius: var(--radius-sm, 6px);
  font-weight: 600; font-size: .88rem;
  cursor: pointer;
  transition: opacity .15s;
}
.dash-info-close-btn:hover { opacity: .9; }

/* Data sync and monitoring settings */
.sync-config-title {
  display: flex;
  align-items: center;
  gap: .4rem;
}
.sync-config-title > span:first-child { min-width: 0; }
.sync-config-log-btn {
  margin-left: auto;
  flex-shrink: 0;
  padding: .3rem .6rem;
  border-radius: var(--radius-sm, 6px);
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text-primary);
  font-size: .75rem;
  font-weight: 800;
  cursor: pointer;
  white-space: nowrap;
}
.sync-config-lock-pill {
  flex-shrink: 0;
  padding: .24rem .5rem;
  border: 1px solid rgba(245, 158, 11, .45);
  border-radius: 999px;
  background: rgba(245, 158, 11, .12);
  color: #b45309;
  font-size: .7rem;
  font-weight: 800;
  white-space: nowrap;
}
.sync-config-lock-note {
  padding: .55rem .7rem;
  border: 1px solid rgba(245, 158, 11, .38);
  border-radius: var(--radius-sm, 6px);
  background: rgba(245, 158, 11, .1);
  color: var(--text-secondary);
  font-size: .74rem;
  line-height: 1.45;
}
.sync-config-toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: .65rem .75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm, 6px);
  background: var(--bg-elevated);
}
.sync-config-toggle-row span {
  display: flex;
  flex-direction: column;
  gap: .18rem;
  min-width: 0;
}
.sync-config-toggle-row strong {
  font-size: .82rem;
  color: var(--text-primary);
}
.sync-config-toggle-row small {
  font-size: .7rem;
  color: var(--text-secondary);
  line-height: 1.35;
}
.sync-config-toggle-row input {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}
.uid-health-panel {
  padding: .7rem .75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm, 6px);
  background: var(--bg-elevated);
  background: color-mix(in srgb, var(--bg-elevated) 86%, #2563eb 14%);
}
.uid-health-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: .75rem;
  margin-bottom: .6rem;
}
.uid-health-head > span {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: .16rem;
}
.uid-health-head strong {
  color: var(--text-primary);
  font-size: .84rem;
}
.uid-health-head small {
  color: var(--text-secondary);
  font-size: .7rem;
  line-height: 1.35;
}
.uid-health-status {
  flex-shrink: 0;
  padding: .18rem .52rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text-secondary);
  font-size: .7rem;
  font-weight: 900;
  white-space: nowrap;
}
.uid-health-status.is-ok,
.uid-health-section summary b.is-ok {
  border-color: rgba(16, 185, 129, .35);
  background: rgba(16, 185, 129, .12);
  color: #047857;
}
.uid-health-status.is-warning,
.uid-health-section summary b.is-warning {
  border-color: rgba(245, 158, 11, .45);
  background: rgba(245, 158, 11, .13);
  color: #b45309;
}
.uid-health-status.is-error,
.uid-health-section summary b.is-error {
  border-color: rgba(239, 68, 68, .42);
  background: rgba(239, 68, 68, .12);
  color: #dc2626;
}
.uid-health-summary-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: .4rem;
}
.uid-health-summary-grid > div {
  padding: .48rem .45rem;
  border-radius: var(--radius-sm, 6px);
  background: var(--bg-card);
  text-align: center;
}
.uid-health-summary-grid b {
  display: block;
  color: var(--text-primary);
  font-size: .9rem;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
}
.uid-health-summary-grid span,
.uid-health-summary-text,
.uid-health-empty {
  color: var(--text-secondary);
  font-size: .7rem;
}
.uid-health-summary-grid span {
  display: block;
  margin-top: .15rem;
}
.uid-health-summary-text {
  margin-top: .45rem;
  text-align: center;
}
.uid-health-actions {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(8rem, 1fr));
  gap: .5rem;
  margin-top: .65rem;
}
.uid-health-actions button {
  width: 100%;
  padding: 9px;
  font-size: .82rem;
  font-weight: 800;
}
.uid-health-danger-action {
  border-color: rgba(220, 38, 38, .38) !important;
  color: var(--danger, #dc2626) !important;
  background: rgba(220, 38, 38, .06) !important;
}
.uid-health-repair-result {
  margin-top: .65rem;
  padding: .65rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm, 6px);
  background: color-mix(in srgb, var(--bg-card) 88%, #0f766e 12%);
}
.uid-health-repair-result[hidden] {
  display: none !important;
}
.uid-health-repair-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .5rem;
  margin-bottom: .5rem;
}
.uid-health-repair-head b {
  color: var(--text-primary);
  font-size: .82rem;
}
.uid-health-repair-head span {
  color: var(--text-secondary);
  font-size: .7rem;
  white-space: nowrap;
}
.uid-health-repair-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: .35rem;
}
.uid-health-repair-grid > div {
  padding: .38rem .32rem;
  border-radius: var(--radius-sm, 6px);
  background: var(--bg-card);
  text-align: center;
}
.uid-health-repair-grid b {
  display: block;
  color: var(--text-primary);
  font-size: .82rem;
  line-height: 1.1;
}
.uid-health-repair-grid span {
  display: block;
  margin-top: .12rem;
  color: var(--text-secondary);
  font-size: .66rem;
}
.uid-health-repair-samples {
  display: grid;
  gap: .28rem;
  margin-top: .55rem;
}
.uid-health-repair-samples code {
  display: block;
  overflow-wrap: anywhere;
  padding: .32rem .42rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm, 6px);
  background: color-mix(in srgb, var(--bg-card) 92%, #0f766e 8%);
  color: var(--text-secondary);
  font-size: .68rem;
}
.uid-health-progress {
  margin-top: .6rem;
}
.sync-config-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: .5rem;
  margin-top: .75rem;
}
.sync-config-actions button {
  width: 100%;
  padding: 10px;
  font-size: .88rem;
  font-weight: 700;
}
.sync-config-progress {
  margin-top: .65rem;
  padding: .65rem .75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm, 6px);
  background: var(--bg-elevated);
}
.sync-config-progress[hidden] { display: none !important; }
.sync-config-progress-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
  margin-bottom: .45rem;
}
.sync-config-progress-head span {
  min-width: 0;
  color: var(--text-secondary);
  font-size: .74rem;
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.sync-config-progress-head strong {
  flex-shrink: 0;
  color: var(--accent);
  font-size: .76rem;
  font-variant-numeric: tabular-nums;
}
.sync-config-progress-track {
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(148, 163, 184, .28);
}
.sync-config-progress-fill {
  height: 100%;
  min-width: 0;
  border-radius: inherit;
  background: linear-gradient(90deg, #2563eb, #14b8a6, #22c55e);
  transition: width .28s ease;
}
.sync-config-progress.is-running .sync-config-progress-fill {
  background-size: 180% 100%;
  animation: sync-config-progress-flow 1.35s linear infinite;
}
.sync-config-progress.is-done .sync-config-progress-fill {
  background: linear-gradient(90deg, #10b981, #22c55e);
}
.sync-config-progress.is-error .sync-config-progress-fill {
  background: linear-gradient(90deg, #ef4444, #f97316);
}
.sync-config-progress.is-error .sync-config-progress-head strong {
  color: var(--danger, #ef4444);
}
@keyframes sync-config-progress-flow {
  from { background-position: 0 0; }
  to { background-position: 180% 0; }
}
.sync-config-log-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 1200;
  background: rgba(0,0,0,.45);
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
  align-items: center;
  justify-content: center;
}
.sync-config-log-overlay.open { display: flex; }
.sync-config-log-box {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  max-width: 460px;
  width: 92%;
  max-height: 75vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 18px 50px rgba(15,23,42,.24);
}
.sync-config-log-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: .8rem 1rem;
  border-bottom: 1px solid var(--border);
  font-weight: 800;
  font-size: .95rem;
  color: var(--text-primary);
}
.sync-config-log-header .event-reg-log-close {
  background: none;
  border: none;
  font-size: 1.3rem;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0 .2rem;
}
.sync-config-log-body {
  overflow-y: auto;
  padding: .65rem .85rem;
  flex: 1;
  min-height: 0;
}
.sync-config-log-item {
  border-bottom: 1px solid var(--border);
  padding: .55rem 0;
}
.sync-config-log-item:last-child { border-bottom: none; }
.sync-config-log-main {
  display: flex;
  align-items: center;
  gap: .5rem;
}
.sync-config-log-main .event-reg-log-time {
  color: var(--text-muted);
  font-size: .72rem;
  white-space: nowrap;
  min-width: 5.5em;
}
.sync-config-log-main .event-reg-log-user {
  padding: .15rem .5rem;
  border-radius: 999px;
  font-size: .72rem;
  font-weight: 700;
  background: var(--bg-elevated);
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 120px;
}
.sync-config-log-main .event-reg-log-action {
  font-size: .72rem;
  font-weight: 800;
  white-space: nowrap;
}
.sync-config-log-main .event-reg-log-action.reg { color: var(--success, #34d399); }
.sync-config-log-main .event-reg-log-action.cancel { color: var(--danger, #f87171); }
.sync-config-log-main .event-reg-log-action.promote { color: #8b5cf6; }
.sync-config-log-main .event-reg-log-action.warning { color: var(--warning, #f59e0b); }
.sync-config-log-sub {
  margin-top: .3rem;
  font-size: .72rem;
  color: var(--text-secondary);
}
.sync-config-log-msg {
  margin-top: .18rem;
  font-size: .72rem;
  color: var(--text-muted);
  line-height: 1.45;
  word-break: break-word;
}
.sync-config-empty {
  text-align: center;
  color: var(--text-muted);
  padding: 1.5rem .75rem;
  font-size: .82rem;
}
.sync-config-password-overlay {
  position: fixed;
  inset: 0;
  z-index: 1300;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  background: rgba(15, 23, 42, .42);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
}
.sync-config-password-box {
  width: min(92vw, 360px);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--bg-card);
  box-shadow: 0 18px 50px rgba(15, 23, 42, .24);
  padding: 1rem;
}
.sync-config-password-title {
  color: var(--text-primary);
  font-size: 1rem;
  font-weight: 800;
  margin-bottom: .45rem;
}
.sync-config-password-text {
  color: var(--text-secondary);
  font-size: .82rem;
  line-height: 1.5;
  margin-bottom: .75rem;
}
.sync-config-password-input {
  width: 100%;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm, 6px);
  background: var(--bg-elevated);
  color: var(--text-primary);
  font-size: 1rem;
  padding: .72rem .8rem;
  outline: none;
}
.sync-config-password-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, .15);
}
.sync-config-password-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: .6rem;
  margin-top: .9rem;
}
.sync-config-help-list {
  display: flex;
  flex-direction: column;
  gap: .5rem;
}
.sync-config-help-list > div {
  padding: .55rem .65rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm, 6px);
  background: var(--bg-elevated);
}
.sync-config-help-list b {
  display: block;
  margin-bottom: .18rem;
  color: var(--text-primary);
  font-size: .82rem;
}
.sync-config-help-list span {
  display: block;
  color: var(--text-secondary);
  font-size: .78rem;
  line-height: 1.45;
}
.uid-health-report-box {
  max-width: 680px;
}
.uid-health-report-tools {
  display: flex;
  align-items: center;
  gap: .35rem;
}
.uid-health-report-copy-btn {
  padding: .32rem .65rem;
  font-size: .72rem;
  font-weight: 800;
  white-space: nowrap;
}
.uid-health-report-head {
  display: flex;
  flex-direction: column;
  gap: .38rem;
  padding: .65rem .75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm, 6px);
  background: var(--bg-elevated);
  margin-bottom: .65rem;
}
.uid-health-report-head p {
  margin: 0;
  color: var(--text-primary);
  font-size: .82rem;
  line-height: 1.5;
}
.uid-health-report-head small {
  color: var(--text-muted);
  font-size: .72rem;
}
.uid-health-section {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm, 6px);
  background: var(--bg-card);
  margin-bottom: .5rem;
  overflow: hidden;
}
.uid-health-section summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
  padding: .65rem .75rem;
  cursor: pointer;
  color: var(--text-primary);
  font-size: .82rem;
  font-weight: 800;
}
.uid-health-section summary b {
  flex-shrink: 0;
  padding: .16rem .46rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--text-secondary);
  font-size: .68rem;
}
.uid-health-section-body {
  border-top: 1px solid var(--border);
  padding: .55rem .75rem;
}
.uid-health-no-issue {
  color: var(--text-secondary);
  font-size: .78rem;
}
.uid-health-issue {
  padding: .5rem 0;
  border-bottom: 1px solid var(--border);
}
.uid-health-issue:last-child {
  border-bottom: none;
}
.uid-health-issue > div:first-child {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
}
.uid-health-issue b {
  color: var(--text-primary);
  font-size: .78rem;
}
.uid-health-issue span {
  color: var(--text-muted);
  font-size: .72rem;
  white-space: nowrap;
}
.uid-health-issue.is-error b { color: var(--danger, #dc2626); }
.uid-health-issue.is-warning b { color: var(--warning, #b45309); }
.uid-health-samples {
  display: flex;
  flex-direction: column;
  gap: .28rem;
  margin-top: .4rem;
}
.uid-health-samples code {
  display: block;
  padding: .36rem .45rem;
  border-radius: var(--radius-sm, 6px);
  background: var(--bg-elevated);
  color: var(--text-secondary);
  font-size: .68rem;
  line-height: 1.45;
  white-space: normal;
  word-break: break-word;
}
@media (max-width: 420px) {
  .sync-config-actions { grid-template-columns: 1fr; }
  .sync-config-title { gap: .3rem; }
  .sync-config-password-actions { grid-template-columns: 1fr; }
  .uid-health-summary-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .uid-health-actions { grid-template-columns: 1fr; }
  .uid-health-repair-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .uid-health-repair-head { align-items: flex-start; flex-direction: column; }
}
