/* ==========================================================================
   藝文票務管理後台 — Design tokens & shared components
   ========================================================================== */

:root {
  --color-bg: #f8f9fa;
  --color-surface: #ffffff;
  --color-border: rgba(0, 0, 0, 0.06);
  --color-border-strong: #000000;
  --color-text: #0a0a0a;
  --color-text-muted: #717182;
  --color-text-soft: #4a5565;
  --color-text-faint: #6a7282;
  --color-accent: #030213;
  --color-accent-hover: #1a1a2e;
  --color-success: #06d6a0;
  --color-success-bg: #e6faf5;
  /* Darker green for TEXT on light backgrounds — --color-success itself is
     ~1.9:1 against white (used for chart lines/dots/swatches, which are
     graphical, not text). This one is ~5:1+ and meets WCAG AA 4.5:1 for
     normal text. */
  --color-success-text: #047857;
  --color-danger: #e63946;
  --color-danger-bg: #fdecee;
  --color-destructive: #d4183d;
  --color-warning: #ffb703;
  --color-warning-bg: #fef3e0;
  --color-info: #155dfc;
  --color-info-bg: #eaf1ff;
  --color-track: #eceef2;
  --color-input-bg: #f3f3f5;
  --color-input-border: #d1d5dc;

  --sidebar-width: 256px;
  --sidebar-width-collapsed: 80px;
  --header-height: 64px;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 12px;
  --shadow-card: 0 1px 2px rgba(0, 0, 0, 0.06), 0 1px 1px rgba(0, 0, 0, 0.04);
  --font-ui: "Inter", "PingFang TC", "Noto Sans TC", "Microsoft JhengHei", system-ui, sans-serif;
  --font-mono: "JetBrains Mono", Menlo, monospace;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: var(--font-ui);
  color: var(--color-text);
  background: var(--color-bg);
  -webkit-font-smoothing: antialiased;
  line-height: 1.3;
}

a { color: inherit; text-decoration: none; }
button { font-family: inherit; }
img { max-width: 100%; display: block; }
ul { list-style: none; margin: 0; padding: 0; }

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--color-accent);
  color: #fff;
  padding: 10px 16px;
  border-radius: 0 0 8px 0;
  z-index: 200;
}
.skip-link:focus { left: 0; }

/* ---------- App shell ---------- */

.app-shell {
  min-height: 100vh;
  display: flex;
}

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: var(--sidebar-width);
  background: var(--color-surface);
  border-right: 1px solid var(--color-border);
  display: flex;
  flex-direction: column;
  z-index: 40;
  transition: width 0.3s ease;
  overflow: hidden;
}
body.sidebar-collapsed .sidebar { width: var(--sidebar-width-collapsed); }

.sidebar-brand {
  height: var(--header-height);
  display: flex;
  align-items: center;
  padding: 0 24px;
  border-bottom: 1px solid var(--color-border);
  flex-shrink: 0;
  overflow: hidden;
}
.sidebar-brand a {
  font-size: 20px;
  font-weight: 600;
  white-space: nowrap;
}
.sidebar-brand svg { display: none; flex-shrink: 0; width: 24px; height: 24px; }
body.sidebar-collapsed .sidebar-brand a { display: none; }
body.sidebar-collapsed .sidebar-brand svg { display: block; }

.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 12px;
  height: 40px;
  padding: 0 12px;
  border-radius: var(--radius-md);
  font-size: 14px;
  color: var(--color-text);
  cursor: pointer;
  white-space: nowrap;
}
.sidebar-link:hover { background: var(--color-track); }
.sidebar-link svg { flex-shrink: 0; width: 20px; height: 20px; }
.sidebar-link.active {
  background: var(--color-accent);
  color: #fff;
  font-weight: 500;
  box-shadow: 0 1px 1.5px rgba(0, 0, 0, 0.1), 0 1px 1px rgba(0, 0, 0, 0.1);
}
.sidebar-link.active svg { stroke: #fff; }
body.sidebar-collapsed .sidebar-link span { display: none; }

.sidebar-foot {
  border-top: 1px solid var(--color-border);
  padding: 10px;
  flex-shrink: 0;
}
.sidebar-foot .sidebar-link { width: 100%; }

.main-col {
  margin-left: var(--sidebar-width);
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  transition: margin-left 0.3s ease;
}
body.sidebar-collapsed .main-col { margin-left: var(--sidebar-width-collapsed); }

.demo-banner {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 24px;
  background: var(--color-info-bg);
  color: var(--color-info);
  font-size: 12px;
  font-weight: 500;
  border-bottom: 1px solid #bcd6ff;
}
.demo-banner svg { width: 14px; height: 14px; flex-shrink: 0; }

@media (max-width: 640px) {
  .demo-banner { padding: 8px 16px; font-size: 11px; }
}

.topbar {
  height: var(--header-height);
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
  padding: 0 24px;
  position: sticky;
  top: 0;
  z-index: 20;
}

/* The bar's background/border span full width edge-to-edge; only its
   content (search, notifications, user chip) gets constrained to match
   the main content container on wide screens — see the dashboard
   max-width rules further down. */
.topbar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  width: 100%;
  height: 100%;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 16px;
  flex: 1;
  min-width: 0;
}

.sidebar-toggle {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  border: none;
  background: transparent;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--color-text);
  flex-shrink: 0;
}
.sidebar-toggle:hover { background: var(--color-track); }

.global-search {
  flex: 1;
  min-width: 0;
  max-width: 420px;
  height: 36px;
  border-radius: var(--radius-md);
  background: var(--color-input-bg);
  border: 1px solid var(--color-border);
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 12px;
  color: var(--color-text-muted);
  font-size: 14px;
  cursor: pointer;
  text-align: left;
  font-family: inherit;
}
.global-search:hover { background: var(--color-track); }
.global-search svg { flex-shrink: 0; width: 16px; height: 16px; }
.global-search span.hint-text:first-of-type { flex: 1; min-width: 0; font-weight: 300; }
.global-search input {
  border: none;
  background: none;
  outline: none;
  font: inherit;
  color: var(--color-text);
  flex: 1;
  min-width: 0;
}
.global-search kbd {
  background: #ececf0;
  border: 1px solid var(--color-border);
  border-radius: 4px;
  font-family: var(--font-mono);
  font-size: 11px;
  padding: 1px 6px;
  color: var(--color-text-muted);
  flex-shrink: 0;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}

.icon-btn {
  position: relative;
  width: 36px;
  height: 36px;
  border-radius: 8px;
  border: none;
  background: transparent;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--color-text);
}
.icon-btn:hover { background: var(--color-track); }
.icon-btn .badge-dot {
  position: absolute;
  top: -4px;
  right: -4px;
  background: var(--color-danger);
  color: #fff;
  font-size: 11px;
  font-weight: 600;
  min-width: 18px;
  height: 18px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 3px;
}

.user-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
}
.user-chip span { font-size: 14px; color: var(--color-text-muted); }
.user-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--color-accent);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 500;
  flex-shrink: 0;
}

.page {
  padding: 28px;
  flex: 1;
}

.page-head { margin-bottom: 28px; }
.page-head h1 {
  font-size: 30px;
  font-weight: 600;
  line-height: 1.35;
  margin: 0 0 8px;
}
.page-head p {
  margin: 0;
  color: var(--color-text-muted);
  font-size: 14px;
  font-weight: 400;
  line-height: 1.5;
}

/* ---------- Cards / stats ---------- */

.stat-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
  margin-bottom: 24px;
}

.card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
}

.stat-card { padding: 20px; }
.stat-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}
.stat-card-head span {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--color-text-muted);
}
.stat-card-head svg { width: 14px; height: 14px; color: var(--color-text-muted); }
.stat-value {
  font-size: 26px;
  font-weight: 700;
  line-height: 1.3;
  margin: 0 0 8px;
}
.stat-delta {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 700;
  line-height: 1.4;
}
.stat-delta.up { color: var(--color-success-text); }
.stat-delta.info { color: var(--color-info); }
.stat-delta-label { color: var(--color-text-muted); font-weight: 700; }

.grid-2 {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 20px;
}

.card-head {
  padding: 20px 20px 0;
  font-size: 14px;
  font-weight: 600;
}
.card-body { padding: 20px; }

/* mini chart */
.chart-wrap { width: 100%; height: 240px; position: relative; }
.chart-wrap svg { width: 100%; height: 100%; }
.chart-wrap svg rect[data-i] { cursor: pointer; }

.chart-tooltip {
  position: absolute;
  transform: translate(12px, -110%);
  background: #fff;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
  padding: 10px 12px;
  min-width: 140px;
  pointer-events: none;
  z-index: 5;
}
.chart-tooltip.flip-left { transform: translate(calc(-100% - 12px), -110%); }
.chart-tooltip-month {
  margin: 0 0 6px;
  font-size: 13px;
  font-weight: 700;
  color: var(--color-text);
}
.chart-tooltip-row {
  margin: 0;
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--color-text-soft);
  white-space: nowrap;
}
.chart-tooltip-row + .chart-tooltip-row { margin-top: 4px; }
.chart-tooltip-row i { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.chart-tooltip-row b { color: var(--color-text); font-weight: 700; }
.chart-legend {
  display: flex;
  gap: 16px;
  font-size: 12px;
  color: var(--color-text-muted);
  margin-top: 8px;
}
.chart-legend span { display: inline-flex; align-items: center; gap: 6px; }
.chart-legend i { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }

/* progress list */
.progress-row + .progress-row { margin-top: 18px; }
.progress-row-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 6px;
  gap: 12px;
}
.progress-row-head h4 { margin: 0 0 3px; font-size: 13px; font-weight: 500; }
.progress-row-head p { margin: 0; font-size: 11px; color: var(--color-text-muted); font-weight: 300; }
.progress-row-head .count { font-size: 11px; color: var(--color-text-muted); font-weight: 500; white-space: nowrap; }
.progress-track {
  background: var(--color-track);
  height: 6px;
  border-radius: 999px;
  overflow: hidden;
}
.progress-fill { height: 100%; border-radius: 999px; }
.progress-fill.warn { background: var(--color-danger); }
.progress-fill.default { background: var(--color-accent); }

/* ---------- Buttons ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 36px;
  padding: 0 16px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
}
.btn svg { width: 16px; height: 16px; }
.btn-primary { background: var(--color-accent); color: #fff; }
.btn-primary:hover { background: var(--color-accent-hover); }
.btn-ghost { background: transparent; border-color: var(--color-input-border); color: var(--color-text); }
.btn-ghost:hover { background: var(--color-track); }
.btn-danger { background: var(--color-danger); color: #fff; }
.btn-danger:hover { background: #cc2b37; }
.btn-sm { height: 30px; padding: 0 12px; font-size: 12px; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* ---------- Forms ---------- */

.field { display: flex; flex-direction: column; gap: 6px; }
.field label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--color-text);
}
.field input,
.field select,
.field textarea {
  height: 40px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--color-input-border);
  background: var(--color-input-bg);
  padding: 0 12px;
  font: inherit;
  font-size: 13px;
  color: var(--color-text);
}
.field textarea { height: auto; padding: 10px 12px; resize: vertical; }
.field input:focus,
.field select:focus,
.field textarea:focus {
  outline: 2px solid var(--color-accent);
  outline-offset: 1px;
  background: #fff;
}
.field-hint { font-size: 11px; color: var(--color-text-faint); }
.field-row { display: flex; gap: 16px; }
.field-row .field { flex: 1; }

.filter-bar {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  align-items: center;
  margin-bottom: 16px;
}
.filter-bar .global-search { max-width: 320px; }
.filter-bar select { height: 36px; }

/* ---------- Table ---------- */

.table-card { overflow: hidden; }
.table-scroll { overflow-x: auto; }
.scroll-hint {
  display: none;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  font-size: 11px;
  color: var(--color-text-muted);
  border-bottom: 1px solid var(--color-border);
}
.scroll-hint svg { width: 12px; height: 12px; flex-shrink: 0; }
@media (max-width: 640px) {
  .scroll-hint { display: flex; }
}
table.data-table { width: 100%; border-collapse: collapse; min-width: 640px; }
.data-table th {
  text-align: left;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--color-text-muted);
  padding: 12px 16px;
  border-bottom: 1px solid var(--color-border);
  white-space: nowrap;
}
.data-table td {
  padding: 14px 16px;
  font-size: 13px;
  border-bottom: 1px solid var(--color-border);
  vertical-align: middle;
}
.data-table tr:last-child td { border-bottom: none; }
.data-table tbody tr:hover { background: #fafafb; }
.data-table td.num, .data-table th.num { text-align: right; }
.data-table .cell-primary { font-weight: 500; }
.data-table .cell-muted { color: var(--color-text-muted); font-size: 12px; }

.checkbox-cell { width: 40px; }
input[type="checkbox"] { width: 16px; height: 16px; accent-color: var(--color-accent); cursor: pointer; }

.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  font-weight: 600;
  padding: 3px 9px;
  border-radius: 999px;
  white-space: nowrap;
}
.badge-success { background: var(--color-success-bg); color: var(--color-success-text); }
.badge-danger { background: var(--color-danger-bg); color: var(--color-danger); }
.badge-warning { background: var(--color-warning-bg); color: #a06400; }
.badge-info { background: var(--color-info-bg); color: var(--color-info); }
.badge-neutral { background: var(--color-track); color: var(--color-text-muted); }

.row-actions { display: flex; gap: 6px; justify-content: flex-end; }

.pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-top: 1px solid var(--color-border);
  font-size: 12px;
  color: var(--color-text-muted);
  flex-wrap: wrap;
  gap: 12px;
}
.pagination-controls { display: flex; gap: 6px; }
.pagination-controls button {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  border: 1px solid var(--color-input-border);
  background: #fff;
  cursor: pointer;
  font-size: 12px;
}
.pagination-controls button.active { background: var(--color-accent); color: #fff; border-color: var(--color-accent); }
.pagination-controls button:disabled { opacity: 0.4; cursor: not-allowed; }

.bulk-bar {
  display: none;
  align-items: center;
  gap: 12px;
  background: var(--color-info-bg);
  border: 1px solid #bcd6ff;
  border-radius: var(--radius-md);
  padding: 10px 16px;
  margin-bottom: 16px;
  font-size: 13px;
  color: var(--color-info);
}
.bulk-bar.visible { display: flex; }
.bulk-bar .btn { margin-left: auto; }

/* ---------- Modal / dialog ---------- */

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(10, 10, 10, 0.45);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 20px;
}
.modal-backdrop.open { display: flex; }
body.modal-open { overflow: hidden; }
.modal {
  background: #fff;
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 440px;
  padding: 24px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.2);
}
.modal h3 { margin: 0 0 8px; font-size: 17px; font-weight: 600; }
.modal p { margin: 0 0 16px; font-size: 13px; color: var(--color-text-muted); line-height: 1.6; }
.modal-warn {
  display: flex;
  gap: 10px;
  background: var(--color-danger-bg);
  border: 1px solid #f6c6cb;
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  font-size: 12px;
  color: #9d2530;
  margin-bottom: 16px;
  line-height: 1.6;
}
.modal-warn svg { width: 18px; height: 18px; flex-shrink: 0; margin-top: 1px; color: var(--color-danger); }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; }
.modal-confirm-field { margin-bottom: 16px; }

/* ---------- Command palette (⌘K global search) ---------- */

.cmdk-backdrop { align-items: flex-start; padding-top: 12vh; }
.cmdk-panel {
  background: #fff;
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 560px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.25);
  overflow: hidden;
}
.cmdk-input-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--color-border);
}
.cmdk-input-row svg { width: 18px; height: 18px; color: var(--color-text-muted); flex-shrink: 0; }
.cmdk-input-row input {
  flex: 1;
  border: none;
  outline: none;
  font: inherit;
  font-size: 15px;
  color: var(--color-text);
}
.cmdk-results { max-height: 60vh; overflow-y: auto; padding: 8px; }
.cmdk-empty { text-align: center; padding: 32px 16px; color: var(--color-text-muted); font-size: 13px; margin: 0; }
.cmdk-group-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--color-text-muted);
  padding: 8px 10px 4px;
}
.cmdk-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
}
.cmdk-item:hover { background: var(--color-track); }
.cmdk-item-icon { flex-shrink: 0; width: 16px; height: 16px; color: var(--color-text-muted); }
.cmdk-item-icon svg { width: 100%; height: 100%; }
.cmdk-item-text { display: flex; flex-direction: column; min-width: 0; }
.cmdk-item-title { font-size: 13px; font-weight: 500; color: var(--color-text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cmdk-item-subtitle { font-size: 12px; color: var(--color-text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---------- Notification center dropdown ---------- */

.notif-panel {
  display: none;
  position: fixed;
  width: 340px;
  max-width: calc(100vw - 32px);
  background: #fff;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.18);
  z-index: 150;
  top: 60px;
  right: 24px;
}
.notif-panel.open { display: block; }
.notif-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid var(--color-border);
}
.notif-head span { font-size: 14px; font-weight: 600; }
.notif-head button {
  border: none;
  background: none;
  color: var(--color-text-muted);
  font-size: 12px;
  cursor: pointer;
  font: inherit;
}
.notif-head button:hover { color: var(--color-text); }
.notif-list { max-height: 380px; overflow-y: auto; }
.notif-item {
  display: flex;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--color-border);
}
.notif-item:last-child { border-bottom: none; }
.notif-item.unread { background: #fafafe; }
.notif-icon { flex-shrink: 0; width: 18px; height: 18px; margin-top: 2px; }
.notif-icon svg { width: 100%; height: 100%; }
.notif-body { flex: 1; min-width: 0; }
.notif-title-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.notif-title { margin: 0; font-size: 13px; font-weight: 500; line-height: 1.4; }
.notif-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--color-info); flex-shrink: 0; margin-top: 4px; }
.notif-message { margin: 4px 0 0; font-size: 12px; color: var(--color-text-muted); line-height: 1.5; }
.notif-time { margin: 4px 0 0; font-size: 11px; color: var(--color-text-muted); font-weight: 300; }
.notif-foot {
  display: block;
  width: 100%;
  border: none;
  background: none;
  color: inherit;
  text-align: center;
  padding: 12px;
  font: inherit;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  border-top: 1px solid var(--color-border);
}
.notif-foot:hover { background: var(--color-track); }

@media (max-width: 480px) {
  .notif-panel { right: 16px; left: 16px; width: auto; }
}

/* ---------- Toast ---------- */

.toast-stack {
  position: fixed;
  right: 20px;
  bottom: 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 200;
}
.toast {
  background: var(--color-text);
  color: #fff;
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
  animation: toast-in 0.2s ease;
}
@keyframes toast-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ---------- Login page (Swiss / neubrutalist) ---------- */

.login-grid-bg {
  position: fixed;
  inset: 0;
  z-index: -1;
  opacity: 0.03;
  background-image: linear-gradient(to right, #000 1px, transparent 1px), linear-gradient(to bottom, #000 1px, transparent 1px);
  background-size: 24px 24px;
}

.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: #fff;
}
.login-wrap { width: 100%; max-width: 380px; }
.login-mark {
  width: 64px;
  height: 64px;
  background: #000;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 24px;
}
.login-mark svg { width: 32px; height: 32px; color: #fff; }
.login-wrap h1 {
  text-align: center;
  font-size: 24px;
  font-weight: 700;
  margin: 0 0 8px;
  line-height: 1.35;
}
.login-wrap > p.sub {
  text-align: center;
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--color-text-soft);
  margin: 0 0 28px;
}
.login-card {
  background: #fff;
  border: 2px solid #000;
  border-radius: var(--radius-lg);
  box-shadow: 8px 8px 0 #000;
  padding: 28px;
}
.login-card h2 { margin: 0 0 6px; font-size: 19px; font-weight: 700; }
.login-card > p { margin: 0 0 20px; font-size: 12px; color: var(--color-text-soft); }
.login-form { display: flex; flex-direction: column; gap: 18px; }
.login-form .field-hint { color: var(--color-text-faint); }
.password-field { position: relative; }
.password-field input { padding-right: 40px; width: 100%; }
.password-toggle {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  border: none;
  background: none;
  cursor: pointer;
  color: var(--color-text-muted);
  display: flex;
  padding: 4px;
}
.login-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
}
.login-remember { display: flex; align-items: center; gap: 6px; color: var(--color-text-soft); font-weight: 500; }
.login-forgot { color: var(--color-text); font-weight: 500; }
.login-submit {
  background: #000;
  color: #fff;
  border: none;
  height: 42px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.05em;
  cursor: pointer;
  box-shadow: 3px 3px 0 rgba(0, 0, 0, 0.3);
}
.login-submit:hover { transform: translate(1px, 1px); box-shadow: 2px 2px 0 rgba(0, 0, 0, 0.3); }
.login-divider { display: flex; align-items: center; gap: 12px; margin: 4px 0; }
.login-divider::before, .login-divider::after { content: ""; flex: 1; height: 1px; background: #e5e7eb; }
.login-divider span { font-size: 10px; letter-spacing: 0.15em; text-transform: uppercase; color: var(--color-text-faint); }
.login-test-account {
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  border-radius: 4px;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 12px;
}
.login-test-account div { display: flex; justify-content: space-between; color: var(--color-text-soft); }
.login-test-account code { font-family: var(--font-mono); font-weight: 700; color: var(--color-text); }
.login-demo-note { margin: 10px 0 0; font-size: 11px; line-height: 1.5; color: var(--color-text-faint); }
.login-error {
  display: none;
  align-items: flex-start;
  gap: 10px;
  background: var(--color-danger-bg);
  color: var(--color-destructive);
  border: 2px solid var(--color-destructive);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  font-size: 12px;
  font-weight: 500;
  margin-bottom: 20px;
}
.login-error svg { width: 16px; height: 16px; flex-shrink: 0; margin-top: 1px; }
.login-error.visible { display: flex; }
.field-error-outline { border-color: var(--color-destructive) !important; outline-color: var(--color-destructive) !important; }
.login-spinner {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid rgba(255, 255, 255, 0.4);
  border-top-color: #fff;
  border-radius: 50%;
  margin-right: 8px;
  vertical-align: -2px;
  animation: login-spin 0.7s linear infinite;
}
@keyframes login-spin { to { transform: rotate(360deg); } }
.login-submit:disabled { opacity: 0.85; cursor: not-allowed; transform: none !important; }
.login-footnote { text-align: center; font-size: 10px; color: var(--color-text-faint); margin-top: 28px; }

/* ---------- Dashboard: wide-screen layout ----------
   The real constraining box is .dashboard-container, a dedicated wrapper
   INSIDE .page (dashboard.html only) — not .page itself. .page is shared
   with every other page (events/members/developer/hardware/brand.html)
   and stays full-width/unconstrained for all of them; .dashboard-container
   only exists in dashboard.html's markup, so this can't leak elsewhere. */

/* .page still contributes its own 28px padding (shared with every other
   page) — zero it out here so .dashboard-container's max-width/padding
   below is the ONLY inset math in play, matching viewport - sidebar -
   1440px exactly instead of stacking two independent paddings. */
body[data-page="dashboard"] .page { padding: 0; }

.dashboard-container {
  width: min(100%, 1440px);
  max-width: 1440px;
  margin-inline: auto;
  padding-inline: 24px;
  padding-block: 28px;
  box-sizing: border-box;
}

body[data-page="dashboard"] .topbar { padding-inline: 0; }
body[data-page="dashboard"] .topbar-inner {
  width: min(100%, 1440px);
  max-width: 1440px;
  margin-inline: auto;
  padding-inline: 24px;
  box-sizing: border-box;
}

.stats-grid,
.dashboard-grid {
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 20px;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: minmax(0, 3fr) minmax(320px, 2fr);
  gap: 24px;
}

.dashboard-grid > *,
.stats-grid > * {
  min-width: 0;
}

.stats-grid .stat-card {
  min-height: 148px;
  padding: 24px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  box-sizing: border-box;
}
.stats-grid .stat-card-head { margin-bottom: 14px; }
.stats-grid .stat-value { margin: 0 0 10px; }

.dashboard-grid > .card {
  min-width: 0;
  display: flex;
  flex-direction: column;
}
.dashboard-grid > .card .card-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.chart-card { min-height: 400px; }
.chart-card .chart-wrap { height: 330px; flex: none; }
.chart-card .chart-wrap svg {
  display: block;
  width: 100%;
  height: 330px;
  max-height: 330px;
}
#top-events-list { flex: 1; display: flex; flex-direction: column; justify-content: space-between; min-width: 0; }

@media (max-width: 1280px) {
  .dashboard-grid { grid-template-columns: 1fr; }
  .dashboard-grid > .card { min-height: 0; }
}

@media (max-width: 640px) {
  .dashboard-container { padding-inline: 18px; }
  body[data-page="dashboard"] .topbar-inner { padding-inline: 16px; }
}

/* ---------- Responsive ---------- */

@media (max-width: 1024px) {
  .grid-2 { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
  :root { --sidebar-width: var(--sidebar-width-collapsed); }
  .sidebar-brand a { display: none; }
  .sidebar-brand svg { display: block; }
  .sidebar-link span { display: none; }
  body.sidebar-collapsed .sidebar { width: var(--sidebar-width-collapsed); }
}

@media (max-width: 860px) {
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 640px) {
  .page { padding: 18px; }
  .stat-grid { grid-template-columns: 1fr; gap: 14px; }
  .topbar { padding: 0 16px; gap: 10px; }
  .global-search span.hint-text { display: none; }
  .user-chip span { display: none; }
  .page-head h1 { font-size: 22px; }
  .filter-bar { flex-direction: column; align-items: stretch; }
  .filter-bar .global-search { max-width: none; }
}

@media (max-width: 480px) {
  .login-card { padding: 20px; box-shadow: 5px 5px 0 #000; }
  .login-mark { width: 52px; height: 52px; }
}

/* ---------- Ticket management page (tickets.html) ---------- */

.page-head.page-head-flex {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.filter-control {
  height: 36px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--color-input-border);
  background: var(--color-input-bg);
  padding: 0 12px;
  font: inherit;
  font-size: 13px;
  color: var(--color-text);
  cursor: pointer;
}
.filter-control:focus {
  outline: 2px solid var(--color-accent);
  outline-offset: 1px;
}

.modal-lg { max-width: 480px; }

.detail-list { display: flex; flex-direction: column; gap: 10px; }
.detail-row { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; }
.detail-row dt { margin: 0; font-size: 12px; color: var(--color-text-muted); }
.detail-row dd { margin: 0; font-size: 13px; font-weight: 500; text-align: right; }

.cell-event-tier { font-size: 12px; color: var(--color-text-muted); margin-top: 2px; }

@media (max-width: 640px) {
  .filter-control { width: 100%; }
  .page-head.page-head-flex .btn { width: 100%; }
}

/* ---------- Event management page (events.html) ---------- */

th.sortable { user-select: none; }
th.sortable:hover { color: var(--color-text); }
.sort-arrow { font-size: 9px; margin-left: 2px; }

/* ---------- Member management page (members.html) ---------- */

.modal-profile-head {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 18px;
}
.modal-profile-head .user-avatar { width: 48px; height: 48px; font-size: 16px; flex-shrink: 0; }
.modal-profile-head h3 { margin: 0 0 6px; }

.modal-contact-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--color-text);
  margin-bottom: 8px;
}
.modal-contact-row svg { width: 14px; height: 14px; color: var(--color-text-muted); flex-shrink: 0; }

.modal-profile-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin: 16px 0;
}
.modal-profile-stats > div {
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  padding: 10px 8px;
  text-align: center;
}
.modal-profile-stats .num { font-size: 16px; font-weight: 700; }
.modal-profile-stats .label { font-size: 10px; color: var(--color-text-muted); margin-top: 2px; }

.modal-section-title {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--color-text-muted);
  margin: 0 0 8px;
}

.consume-list { display: flex; flex-direction: column; gap: 8px; max-height: 220px; overflow-y: auto; }
.consume-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  font-size: 12px;
}
.consume-event { font-weight: 500; color: var(--color-text); }
.consume-date { color: var(--color-text-muted); font-size: 11px; margin-top: 2px; }
.consume-amount { font-weight: 600; white-space: nowrap; }

/* ---------- Marketing / targeted push page (marketing.html) ---------- */

.segment-tags { display: flex; flex-wrap: wrap; gap: 8px; }
.segment-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid var(--color-input-border);
  background: var(--color-input-bg);
  font-size: 12px;
  font-weight: 500;
  color: var(--color-text);
  cursor: pointer;
  user-select: none;
}
.segment-tag:hover { border-color: var(--color-accent); }
.segment-tag input[type="checkbox"] { width: 14px; height: 14px; }
.segment-tag.is-active {
  background: var(--color-accent);
  border-color: var(--color-accent);
  color: #fff;
}
.segment-tag.is-active input[type="checkbox"] { accent-color: #fff; }

.audience-estimate {
  background: var(--color-info-bg);
  border: 1px solid #bcd6ff;
  border-radius: var(--radius-md);
  padding: 12px 16px;
  font-size: 13px;
  color: var(--color-text);
}
.audience-estimate strong { font-size: 20px; margin: 0 4px; }
.audience-estimate .field-hint { margin: 6px 0 0; }

.schedule-options { display: flex; gap: 20px; align-items: center; height: 40px; font-size: 13px; }
.schedule-options label { display: flex; align-items: center; gap: 6px; cursor: pointer; }

.field-error {
  display: none;
  font-size: 11px;
  color: var(--color-danger);
}
.field-error.visible { display: block; }
.field.has-error input,
.field.has-error textarea {
  outline: 2px solid var(--color-danger);
  outline-offset: 1px;
}

.summary-list { margin-bottom: 16px; display: flex; flex-direction: column; gap: 8px; }
.summary-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-size: 13px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--color-border);
}
.summary-row:last-child { border-bottom: none; padding-bottom: 0; }
.summary-row .label { color: var(--color-text-muted); flex-shrink: 0; }
.summary-row .value { font-weight: 500; text-align: right; }

@media (max-width: 640px) {
  .field-row { flex-direction: column; gap: 20px; }
  .segment-tags { gap: 6px; }
  .schedule-options { flex-direction: column; align-items: flex-start; height: auto; gap: 10px; }
  .summary-row { flex-direction: column; gap: 2px; }
  .summary-row .value { text-align: left; }
}

/* ---------- Customer service / refund page (refund.html) ---------- */

/* Long free-text values (reasons, review notes) read poorly right-aligned
   next to a short label inside .detail-list — stack them instead. */
.detail-row.detail-row-block {
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
}
.detail-row.detail-row-block dd { text-align: left; }

/* Checkbox-gated confirmation row used by the irreversible-action (refund
   approval) modal — the danger button stays disabled until this is checked. */
.confirm-check {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-size: 12px;
  font-weight: 500;
  color: var(--color-text-soft);
  cursor: pointer;
  line-height: 1.5;
}
.confirm-check input { margin-top: 2px; flex-shrink: 0; }

/* Section tabs (退換票處理 / 客訴紀錄) — underline style, matches shadcn Tabs used
   in the CustomerSupport view of the Figma Make prototype. */
.tab-nav {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--color-border);
  margin-bottom: 20px;
}
.tab-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: none;
  background: none;
  font: inherit;
  font-size: 14px;
  font-weight: 500;
  color: var(--color-text-muted);
  padding: 10px 4px;
  margin-bottom: -1px;
  border-bottom: 2px solid transparent;
  cursor: pointer;
}
.tab-btn:hover { color: var(--color-text); }
.tab-btn.active { color: var(--color-text); border-bottom-color: var(--color-accent); }
.tab-btn .tab-count {
  font-size: 11px;
  font-weight: 700;
  color: var(--color-text-muted);
  background: var(--color-track);
  border-radius: 999px;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.tab-btn.active .tab-count { background: var(--color-accent); color: #fff; }
.tab-panel { display: none; }
.tab-panel.active { display: block; }
/* Some tab panels need an internal flex column instead of block layout.
   This must only apply while .active is also present — an unconditional
   `display: flex` on the panel itself (as inline styles used to do) beats
   `.tab-panel { display: none }` and left inactive panels visibly stacked
   underneath the active one. */
.tab-panel.active.tab-panel-flex-col { display: flex; flex-direction: column; gap: 20px; }

@media (max-width: 640px) {
  .tab-nav { gap: 0; overflow-x: auto; }
  .tab-btn { white-space: nowrap; }
}

/* ---------- Brand appearance page (brand.html) ---------- */

.brand-grid { align-items: start; }
.brand-settings-col { display: flex; flex-direction: column; gap: 20px; }

.brand-logo-row { display: flex; gap: 20px; align-items: flex-start; }
.brand-logo-preview {
  width: 96px;
  height: 96px;
  border-radius: var(--radius-lg);
  border: 1px dashed var(--color-input-border);
  background: var(--color-input-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  flex-shrink: 0;
  color: var(--color-text-muted);
}
.brand-logo-preview img { width: 100%; height: 100%; object-fit: cover; }
.brand-logo-preview svg { width: 36px; height: 36px; }
.brand-logo-actions { display: flex; flex-direction: column; gap: 8px; flex: 1; min-width: 0; }
.brand-logo-actions .btn { align-self: flex-start; }

.brand-color-field { margin-bottom: 20px; }
.brand-color-field:last-child { margin-bottom: 0; }
.swatch-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.swatch {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 2px solid transparent;
  padding: 0;
  cursor: pointer;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.08);
  transition: transform 0.1s ease;
}
.swatch:hover { transform: scale(1.1); }
.swatch.active {
  border-color: #fff;
  box-shadow: 0 0 0 2px var(--color-text), inset 0 0 0 1px rgba(0, 0, 0, 0.08);
}
.swatch-hex {
  width: 104px;
  height: 30px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--color-input-border);
  background: var(--color-input-bg);
  padding: 0 10px;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--color-text);
  text-transform: uppercase;
}
.swatch-hex:focus {
  outline: 2px solid var(--color-accent);
  outline-offset: 1px;
  background: #fff;
}

.brand-preview-card { position: sticky; top: 84px; }
.brand-preview {
  border-radius: var(--radius-lg);
  overflow: hidden;
  border: 1px solid var(--color-border);
  background: #fff;
  transition: background 0.2s ease;
}
.brand-preview.is-dark { background: #16161d; border-color: rgba(255, 255, 255, 0.08); }
.brand-preview-topbar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  background: var(--preview-primary, #030213);
  color: #fff;
  font-size: 14px;
  font-weight: 600;
}
.brand-preview-logo {
  width: 28px;
  height: 28px;
  border-radius: var(--preview-radius, 10px);
  background: rgba(255, 255, 255, 0.18);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  flex-shrink: 0;
}
.brand-preview-logo svg { width: 16px; height: 16px; color: #fff; }
.brand-preview-logo img { width: 100%; height: 100%; object-fit: cover; }
.brand-preview-body { padding: 20px; }
.brand-preview-card-mock {
  border: 1px solid var(--color-border);
  border-radius: var(--preview-radius, 10px);
  padding: 16px;
  background: var(--color-bg);
}
.brand-preview.is-dark .brand-preview-card-mock { background: #1f1f27; border-color: rgba(255, 255, 255, 0.08); }
.brand-preview-label { margin: 0 0 6px; font-size: 11px; color: var(--color-text-muted); text-transform: uppercase; letter-spacing: 0.05em; }
.brand-preview.is-dark .brand-preview-label { color: #9a9aa8; }
.brand-preview-value { margin: 0 0 14px; font-size: 22px; font-weight: 700; color: var(--color-text); }
.brand-preview.is-dark .brand-preview-value { color: #f5f5f7; }
.brand-preview-btn {
  border: none;
  background: var(--preview-accent, #06d6a0);
  color: #06261c;
  font-weight: 600;
  font-size: 12px;
  padding: 8px 16px;
  border-radius: var(--preview-radius, 10px);
  cursor: default;
}

.brand-actions { display: flex; justify-content: flex-end; gap: 12px; margin-top: 20px; }

@media (max-width: 1024px) {
  .brand-preview-card { position: static; }
}

@media (max-width: 640px) {
  .brand-logo-row { flex-direction: column; align-items: flex-start; }
  .brand-actions { flex-direction: column-reverse; }
  .brand-actions .btn { width: 100%; }
  .swatch-row { gap: 8px; }
  .swatch-hex { width: 100%; }
}

/* ---------- Hardware integration page (hardware.html) ---------- */

.device-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 20px;
}
.device-card { padding: 20px; }
.device-card-head {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 16px;
}
.device-icon {
  width: 40px;
  height: 40px;
  flex-shrink: 0;
  border-radius: var(--radius-md);
  background: var(--color-track);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-text);
}
.device-icon svg { width: 20px; height: 20px; }
.device-card-title { flex: 1; min-width: 0; }
.device-card-title h3 { margin: 0 0 2px; font-size: 14px; font-weight: 600; }
.device-card-title p { margin: 0; font-size: 12px; color: var(--color-text-muted); }
.device-meta {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px 16px;
  margin: 0 0 16px;
  padding: 14px 0;
  border-top: 1px solid var(--color-border);
  border-bottom: 1px solid var(--color-border);
}
.device-meta dt { font-size: 11px; color: var(--color-text-muted); margin-bottom: 2px; }
.device-meta dd { margin: 0; font-size: 13px; }
.device-card-actions { justify-content: flex-start; flex-wrap: wrap; }

/* ---------- Responsive data tables: card layout below 768px ----------
   Row-dense tables (events/tickets/members/refund) are unusable on a phone
   as a shrunk table — cells get too narrow to read or tap. Below 768px each
   <tr> becomes a card and each <td> becomes a labeled row (label from the
   td's own data-label attribute, so the row template doesn't need to
   duplicate the <th> text). Table markup/semantics are unchanged above
   768px; this only kicks in at the breakpoint where a real table stops
   being usable with a thumb. */

@media (max-width: 768px) {
  .table-responsive-stack thead {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
  }
  table.data-table.table-responsive-stack,
  .table-responsive-stack tbody,
  .table-responsive-stack tr {
    display: block;
    width: 100%;
    min-width: 0;
  }
  .table-responsive-stack tr {
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    margin-bottom: 12px;
    padding: 4px 12px;
  }
  .table-responsive-stack tbody tr:hover { background: none; }
  .table-responsive-stack td {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    width: 100%;
    padding: 10px 0;
    border-bottom: 1px dashed var(--color-border);
    text-align: right;
    white-space: normal;
  }
  .table-responsive-stack tr:last-child { margin-bottom: 0; }
  .table-responsive-stack td:last-child { border-bottom: none; }
  .table-responsive-stack td::before {
    content: attr(data-label);
    flex-shrink: 0;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--color-text-muted);
    text-align: left;
  }
  .table-responsive-stack td.cell-primary { font-size: 14px; }
  .table-responsive-stack td.checkbox-cell { justify-content: flex-end; }
  .table-responsive-stack .row-actions,
  .table-responsive-stack .progress-track { margin-left: auto; }
  .table-responsive-stack .progress-track { width: 100% !important; max-width: 140px; }
  /* Rows with no meaningful data-label (icon-only "選取/操作" columns still
     get one via data-label so the layout doesn't look unlabeled). */
}


.key-display-row { display: flex; gap: 8px; }
.card-row-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 12px; gap: 12px; }

@media (max-width: 400px) {
  .device-grid { grid-template-columns: 1fr; }
  .key-display-row { flex-wrap: wrap; }
  .key-display-row input { width: 100%; }
  .card-row-header { flex-wrap: wrap; }
}
