:root {
  --ink: #111318;
  --ink-soft: #3b3f48;
  --mute: #747985;
  --line: #e3e5ea;
  --line-strong: #cfd2d9;
  --paper: #f4f5f7;
  --surface: #ffffff;
  --tint: #eceef2;
  --ok: #167a3c;
  --ok-bg: #eaf6ee;
  --warn: #8a5a00;
  --warn-bg: #fdf3dc;
  --danger: #b3261e;
  --danger-bg: #fcecea;
  --radius: 10px;
  --radius-sm: 8px;
  --shadow-pop: 0 18px 48px rgba(17, 19, 24, 0.18);
  --font-ui: -apple-system, BlinkMacSystemFont, "PingFang SC", "PingFang TC", "Noto Sans SC", "Noto Sans TC", "Microsoft YaHei", "Segoe UI", sans-serif;
  --font-code: ui-monospace, "SF Mono", Menlo, Consolas, monospace;

  /* kept for older inline references */
  --bg-root: var(--paper);
  --primary-text: var(--ink);
  --muted-text: var(--mute);
  --border: var(--line);
  --success: var(--ok);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-ui);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

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

button {
  cursor: pointer;
}

main {
  min-height: 100vh;
  padding: 0;
}

code {
  font-family: var(--font-code);
  font-size: 0.92em;
  background: var(--tint);
  padding: 1px 6px;
  border-radius: 6px;
}

.hidden {
  display: none !important;
}

.muted {
  color: var(--mute);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.card {
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: var(--radius);
}

/* ---------- buttons ---------- */

.btn {
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  min-height: 38px;
  padding: 0 14px;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-weight: 500;
  white-space: nowrap;
}

.btn:focus-visible,
input:focus-visible,
select:focus-visible,
.publish-switch-input:focus-visible + .publish-switch-slider {
  outline: 2px solid var(--ink);
  outline-offset: 2px;
}

.btn.is-loading {
  pointer-events: none;
}

.btn.is-loading::after {
  content: "";
  width: 14px;
  height: 14px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: button-spin 0.7s linear infinite;
}

.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

@keyframes button-spin {
  to {
    transform: rotate(360deg);
  }
}

.btn-primary {
  background: var(--ink);
  color: #ffffff;
}

.btn-primary:hover:not(:disabled) {
  background: #2a2d35;
}

.btn-secondary {
  background: var(--surface);
  border-color: var(--line-strong);
}

.btn-secondary:hover:not(:disabled) {
  border-color: var(--ink);
}

.btn-ghost {
  background: transparent;
  border-color: transparent;
  color: var(--ink-soft);
}

.btn-ghost:hover:not(:disabled) {
  background: var(--tint);
  color: var(--ink);
}

.btn-sm {
  min-height: 32px;
  padding: 0 10px;
}

.btn-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  flex: 0 0 16px;
}

.btn-icon svg {
  width: 16px;
  height: 16px;
  stroke: currentColor;
  stroke-width: 1.9;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.icon-only {
  width: 36px;
  min-height: 36px;
  padding: 0;
}

.row-actions {
  display: inline-flex;
  align-items: center;
  gap: 2px;
}

.icon-btn {
  width: 32px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--ink-soft);
  transition: background 0.15s ease, color 0.15s ease;
}

.icon-btn:hover:not(:disabled) {
  background: var(--tint);
  color: var(--ink);
}

.icon-btn:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 1px;
}

.icon-btn:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

.icon-btn.is-danger:hover:not(:disabled) {
  background: var(--danger-bg);
  color: var(--danger);
}

.icon-btn .btn-icon,
.icon-btn .btn-icon svg {
  width: 17px;
  height: 17px;
}

/* ---------- form controls ---------- */

input,
select {
  width: 100%;
  min-height: 38px;
  padding: 0 12px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  transition: border-color 0.15s ease;
}

input:hover,
select:hover {
  border-color: var(--mute);
}

input:focus,
select:focus {
  outline: 2px solid var(--ink);
  outline-offset: 0;
  border-color: var(--ink);
}

input[type="checkbox"] {
  width: 16px;
  min-height: 16px;
  height: 16px;
  padding: 0;
  accent-color: var(--ink);
}

input[readonly] {
  background: var(--paper);
  color: var(--ink-soft);
}

select {
  appearance: none;
  padding-right: 34px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23747985' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
}

/* ---------- login ---------- */

.login-wrap {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.login-card {
  width: min(420px, 100%);
  padding: 32px;
}

.login-card h1 {
  margin: 0 0 6px;
  font-size: 24px;
  font-weight: 650;
  letter-spacing: -0.01em;
}

.login-card form {
  display: grid;
  gap: 14px;
  margin-top: 22px;
}

.login-card label {
  display: grid;
  gap: 6px;
  font-size: 13px;
  font-weight: 500;
  color: var(--ink-soft);
}

.login-card input {
  width: 100%;
}

.login-card .btn {
  width: 100%;
  margin-top: 4px;
}

.error-text {
  margin: 14px 0 0;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: var(--danger-bg);
  color: var(--danger);
  font-size: 13px;
}

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

.app {
  display: grid;
  grid-template-columns: 248px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  border-right: 1px solid var(--line);
  background: var(--surface);
  padding: 22px 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 22px;
}

.sidebar-head {
  padding: 0 8px;
}

.sidebar-head h2 {
  margin: 0;
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.sidebar-head p {
  margin: 2px 0 0;
  font-size: 12px;
}

.page-nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
  overflow: auto;
}

.page-nav-row {
  position: relative;
  display: flex;
  align-items: center;
  border-radius: var(--radius-sm);
}

.page-nav-row:hover {
  background: var(--paper);
}

.page-nav-row.active {
  background: var(--tint);
}

.page-nav-row.active::before {
  content: "";
  position: absolute;
  left: 0;
  top: 9px;
  bottom: 9px;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: var(--ink);
}

.page-nav-item {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  text-align: left;
  flex: 1;
  min-width: 0;
  background: transparent !important;
  border-color: transparent !important;
  color: var(--ink-soft);
  font-weight: 500;
}

.page-nav-row.active .page-nav-item {
  color: var(--ink);
  font-weight: 650;
}

.nav-item-main {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.page-nav-label {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.page-nav-actions {
  display: inline-flex;
  align-items: center;
  flex-direction: row-reverse;
  gap: 2px;
  margin: 0 8px 0 auto;
}

.page-rename-btn {
  flex-shrink: 0;
  width: 28px;
  min-height: 28px;
  opacity: 0;
  transition: opacity 0.15s ease;
}

.page-nav-row:hover .page-rename-btn,
.page-rename-btn:focus-visible {
  opacity: 1;
}

.record-count {
  min-width: 22px;
  padding: 0 7px;
  border-radius: 999px;
  background: var(--tint);
  color: var(--ink-soft);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  line-height: 20px;
  text-align: center;
}

.page-nav-row.active .record-count {
  background: var(--surface);
}

.sidebar-footer {
  margin-top: auto;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.sidebar-footer .btn {
  justify-content: flex-start;
  background: transparent;
  border-color: transparent;
  color: var(--ink-soft);
}

.sidebar-footer .btn:hover {
  background: var(--paper);
  color: var(--ink);
}

.workspace {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 26px 32px 40px;
  min-width: 0;
  max-width: 1480px;
}

/* ---------- workspace header ---------- */

.workspace-header {
  display: grid;
  gap: 14px;
  border: 0;
  background: transparent;
  padding: 0;
}

.breadcrumbs {
  color: var(--mute);
  font-size: 12px;
  letter-spacing: 0.02em;
}

.page-title {
  margin: -8px 0 0;
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -0.01em;
  line-height: 1.2;
}

.page-scope-nav {
  display: flex;
  align-items: center;
  gap: 4px;
  border-bottom: 1px solid var(--line);
}

.scope-switch {
  min-height: 40px;
  border-radius: 0;
  border: 0;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  padding: 0 14px;
  gap: 8px;
  color: var(--mute);
}

.scope-switch:hover:not(:disabled) {
  background: transparent;
  color: var(--ink);
}

.scope-switch.active {
  background: transparent;
  border-bottom-color: var(--ink);
  color: var(--ink);
  font-weight: 650;
}

.scope-switch.active .record-count {
  background: var(--ink);
  color: #ffffff;
}

.toolbar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
}

.toolbar-group {
  display: flex;
  align-items: center;
  gap: 8px;
}

.toolbar-group.grow {
  order: 1;
  flex: 1 1 520px;
  min-width: 0;
}

.toolbar-group:not(.grow) {
  order: 2;
  margin-left: auto;
}

.toolbar-group.grow > * {
  flex: 0 1 auto;
}

.toolbar-group.grow .search-wrap {
  flex: 1 1 220px;
}

.toolbar-group.grow #base-filter-input {
  flex: 1 1 180px;
}

.toolbar-group.grow select {
  flex: 0 0 160px;
  width: 160px;
}

.search-wrap {
  min-width: 180px;
  display: flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  padding: 0 0 0 12px;
  background: var(--surface);
  color: var(--mute);
  transition: border-color 0.15s ease;
}

.search-wrap:hover {
  border-color: var(--mute);
}

.search-wrap:focus-within {
  outline: 2px solid var(--ink);
  border-color: var(--ink);
}

.search-wrap .search-glyph {
  width: 15px;
  height: 15px;
  flex: 0 0 15px;
  stroke: currentColor;
  stroke-width: 2;
  fill: none;
  stroke-linecap: round;
}

.search-wrap input {
  border: 0;
  outline: 0 !important;
  border-radius: 0;
  background: transparent;
  padding-left: 0;
}

/* ---------- banners ---------- */

.creation-result {
  padding: 14px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.creation-result-main h3 {
  margin: 0 0 2px;
  font-size: 15px;
}

.creation-result-main p {
  margin: 0;
  color: var(--mute);
}

.creation-result-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.sync-banner {
  padding: 12px 16px;
  border-color: #efd9a0;
  background: var(--warn-bg);
  color: var(--warn);
}

.sync-banner strong {
  font-weight: 700;
}

.trash-note {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0;
  padding: 10px 16px;
  border-bottom: 1px solid var(--line);
  background: var(--paper);
  color: var(--ink-soft);
  font-size: 13px;
}

.trash-note .btn-icon {
  color: var(--mute);
}

.qr-preview {
  width: 72px;
  height: 72px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 6px;
  background: #ffffff;
}

/* ---------- table ---------- */

.table-card {
  padding: 0;
  display: block;
  overflow: hidden;
}

.table-scroll {
  overflow: auto;
}

table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  min-width: 760px;
}

th,
td {
  padding: 0 14px;
  height: 56px;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
  text-align: left;
  vertical-align: middle;
}

thead th {
  height: 42px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--mute);
  background: var(--paper);
  position: sticky;
  top: 0;
}

tbody tr:last-child td {
  border-bottom: 0;
}

tbody tr:hover td {
  background: #fafafb;
}

td:first-child,
th:first-child {
  padding-left: 18px;
}

td.col-actions,
th.col-actions {
  text-align: right;
  padding-right: 12px;
}

/* the left edge of each row carries the publish state */
tbody tr[data-state] td:first-child {
  box-shadow: inset 3px 0 0 var(--line-strong);
}

tbody tr[data-state="published"] td:first-child {
  box-shadow: inset 3px 0 0 var(--ok);
}

.cell-title {
  display: grid;
  gap: 1px;
  max-width: 360px;
}

.cell-title strong {
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cell-code {
  font-family: var(--font-code);
  font-size: 12px;
  color: var(--mute);
  letter-spacing: 0.01em;
}

.cell-date {
  color: var(--ink-soft);
  font-variant-numeric: tabular-nums;
}

.cell-muted {
  color: var(--mute);
  font-size: 13px;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 280px;
}

.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border-radius: 999px;
  padding: 2px 10px;
  font-size: 12px;
  font-weight: 500;
  background: var(--tint);
  color: var(--ink-soft);
}

.status-badge.published {
  background: var(--ok-bg);
  color: var(--ok);
}

.status-badge.draft {
  background: var(--tint);
  color: var(--mute);
}

.days-left {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 2px 10px;
  font-size: 12px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  background: var(--tint);
  color: var(--ink-soft);
}

.days-left.soon {
  background: var(--danger-bg);
  color: var(--danger);
}

.publish-cell {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.publish-label {
  font-size: 13px;
  color: var(--mute);
  min-width: 36px;
}

.publish-label.on {
  color: var(--ok);
  font-weight: 500;
}

.publish-switch {
  position: relative;
  display: inline-flex;
  width: 38px;
  height: 22px;
  cursor: pointer;
}

.publish-switch-input {
  position: absolute;
  inset: 0;
  opacity: 0;
  margin: 0;
  cursor: pointer;
  width: 100%;
  min-height: 0;
}

.publish-switch-slider {
  width: 100%;
  height: 100%;
  border-radius: 999px;
  background: var(--line-strong);
  transition: background 0.2s ease;
  position: relative;
}

.publish-switch-slider::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #ffffff;
  box-shadow: 0 1px 2px rgba(17, 19, 24, 0.25);
  transition: transform 0.2s ease;
}

.publish-switch-input:checked + .publish-switch-slider {
  background: var(--ok);
}

.publish-switch-input:checked + .publish-switch-slider::after {
  transform: translateX(16px);
}

.publish-switch-input:disabled + .publish-switch-slider {
  opacity: 0.5;
}

.inline-actions {
  display: inline-flex;
  gap: 8px;
}

.empty-state {
  padding: 56px 16px;
  text-align: center;
  display: grid;
  justify-items: center;
  gap: 14px;
  color: var(--mute);
}

.empty-state p {
  margin: 0;
}

.pagination {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  padding: 10px 14px;
  border-top: 1px solid var(--line);
  color: var(--mute);
  font-variant-numeric: tabular-nums;
}

#page-indicator {
  min-width: 52px;
  text-align: center;
}

/* ---------- modal ---------- */

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(17, 19, 24, 0.5);
  display: grid;
  place-items: center;
  padding: 20px;
  z-index: 100;
}

.modal {
  width: min(600px, 100%);
  padding: 0;
  max-height: calc(100vh - 40px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: var(--shadow-pop);
}

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--line);
}

.modal-head h3 {
  margin: 0;
  font-size: 17px;
}

.modal-form {
  display: grid;
  gap: 14px;
  overflow-y: auto;
  padding: 18px 20px 0;
}

.modal-form label {
  display: grid;
  gap: 6px;
  font-size: 13px;
  font-weight: 500;
  color: var(--ink-soft);
}

.modal-form label small {
  font-weight: 400;
  color: var(--mute);
}

.module-fields {
  display: grid;
  gap: 14px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.module-fields-title {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--mute);
}

.form-status {
  margin: 0;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: var(--tint);
  font-size: 13px;
}

.form-status.error {
  background: var(--danger-bg);
  color: var(--danger);
}

.form-status.success {
  background: var(--ok-bg);
  color: var(--ok);
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin: 0 -20px;
  padding: 14px 20px;
  position: sticky;
  bottom: 0;
  background: var(--surface);
  border-top: 1px solid var(--line);
}

.stamp-preview-wrap {
  display: grid;
  justify-items: start;
  gap: 10px;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
  padding: 12px;
  background: var(--paper);
}

.stamp-preview {
  display: block;
  max-width: 100%;
  max-height: 220px;
  object-fit: contain;
  border-radius: var(--radius-sm);
  background: #ffffff;
}

/* ---------- toast ---------- */

.toast-stack {
  position: fixed;
  right: 20px;
  bottom: 20px;
  display: grid;
  gap: 8px;
  z-index: 110;
}

.toast {
  width: min(360px, calc(100vw - 40px));
  border: 1px solid var(--line);
  border-left: 3px solid var(--ink);
  border-radius: var(--radius);
  background: #ffffff;
  box-shadow: var(--shadow-pop);
  padding: 12px 14px;
}

.toast.success {
  border-left-color: var(--ok);
}

.toast.error {
  border-left-color: var(--danger);
}

.toast p {
  margin: 0;
}

.toast-actions {
  display: flex;
  gap: 8px;
  margin-top: 10px;
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    transition: none !important;
    animation-duration: 0.01ms !important;
  }
}

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

  .sidebar {
    position: static;
    height: auto;
    border-right: 0;
    border-bottom: 1px solid var(--line);
    padding: 14px 14px 10px;
    gap: 12px;
  }

  .page-nav {
    flex-direction: row;
    overflow: auto;
  }

  .page-nav-row {
    flex: 0 0 auto;
    min-width: 160px;
  }

  .page-rename-btn {
    opacity: 1;
  }

  .sidebar-footer {
    flex-direction: row;
    padding-top: 8px;
  }

  .workspace {
    padding: 18px 14px 32px;
  }

  .toolbar-group:not(.grow) {
    order: 0;
    margin-left: 0;
    width: 100%;
  }

  .toolbar-group.grow {
    flex-wrap: wrap;
  }

  .toolbar-group.grow select {
    flex: 1 1 140px;
    width: auto;
  }

  .creation-result {
    flex-direction: column;
    align-items: flex-start;
  }
}

@media (max-width: 700px) {
  table {
    min-width: 0;
  }

  th,
  td {
    padding: 0 8px;
    height: 60px;
  }

  td:first-child,
  th:first-child {
    padding-left: 14px;
  }

  .col-date,
  .publish-label {
    display: none;
  }

  .cell-title {
    max-width: 150px;
  }

  .cell-title strong {
    white-space: normal;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
  }

  .icon-btn {
    width: 30px;
    height: 30px;
  }

  .row-actions {
    gap: 0;
  }

  .toolbar-group.grow > .search-wrap,
  .toolbar-group.grow > #base-filter-input {
    flex-basis: 100%;
  }
}

/* ---------- selection and bulk actions ---------- */

th.col-check,
td.col-check {
  width: 44px;
  padding-left: 18px;
  padding-right: 0;
}

tbody tr.is-selected td {
  background: #f1f3f7;
}

.bulk-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding: 10px 14px 10px 18px;
  background: var(--ink);
  color: #ffffff;
}

.bulk-info {
  display: flex;
  align-items: center;
  gap: 14px;
}

.bulk-info strong {
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.bulk-link {
  border: 0;
  background: transparent;
  color: #cfd3dc;
  text-decoration: underline;
  text-underline-offset: 3px;
  padding: 0;
}

.bulk-link:hover {
  color: #ffffff;
}

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

.btn-bulk {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.22);
  color: #ffffff;
}

.btn-bulk:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.22);
}

.btn-bulk-danger {
  background: #c0392b;
  border-color: #c0392b;
}

.btn-bulk-danger:hover:not(:disabled) {
  background: #a93226;
}

.btn-bulk-ghost {
  background: transparent;
  color: #cfd3dc;
}

.btn-bulk-ghost:hover:not(:disabled) {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.12);
}

.page-size {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-right: auto;
  font-size: 13px;
}

.page-size select {
  width: 76px;
  min-height: 32px;
  padding-left: 10px;
}

.total-indicator {
  font-size: 13px;
  margin-right: 12px;
}

@media (max-width: 700px) {
  th.col-check,
  td.col-check {
    width: 36px;
    padding-left: 12px;
  }

  .bulk-bar {
    padding: 10px 12px;
  }

  .page-size {
    margin-right: 0;
  }
}

/* ---------- date fields: dd/mm/yyyy text over an invisible native picker ---------- */

.date-field {
  position: relative;
}

.date-field:focus-within {
  outline: 2px solid var(--ink);
  outline-offset: 0;
  border-radius: var(--radius-sm);
}

.date-field .date-display {
  padding-right: 40px;
  cursor: pointer;
  background: var(--surface);
  color: var(--ink);
}

.date-field .date-icon {
  position: absolute;
  right: 12px;
  top: 50%;
  width: 18px;
  height: 18px;
  transform: translateY(-50%);
  color: var(--mute);
  pointer-events: none;
}

.date-field .date-icon svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.date-native {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
}

/* ---------- QR download menu ---------- */

.qr-menu {
  position: fixed;
  z-index: 120;
  width: 290px;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-pop);
  display: grid;
  gap: 2px;
}

.qr-menu button {
  display: grid;
  gap: 1px;
  text-align: left;
  padding: 9px 12px;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
}

.qr-menu button:hover,
.qr-menu button:focus-visible {
  background: var(--tint);
  outline: none;
}

.qr-menu small {
  color: var(--mute);
  font-size: 12px;
}

/* ---------- built-in calendar (identical on every OS and browser) ---------- */

.date-field .date-display {
  cursor: pointer;
}

.calendar-pop {
  position: fixed;
  z-index: 130;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-pop);
  user-select: none;
}

.cal-head {
  display: grid;
  grid-template-columns: 34px 1fr 1fr 34px;
  gap: 6px;
  margin-bottom: 10px;
}

.cal-head select {
  min-height: 34px;
  padding: 0 24px 0 8px;
  background-position: right 8px center;
  font-weight: 600;
}

.cal-nav {
  min-height: 34px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  font-size: 18px;
  line-height: 1;
}

.cal-nav:hover {
  border-color: var(--ink);
}

.cal-weekdays,
.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 2px;
}

.cal-weekdays span {
  padding: 4px 0;
  text-align: center;
  font-size: 12px;
  color: var(--mute);
}

.cal-day {
  aspect-ratio: 1 / 1;
  min-height: 34px;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  font-variant-numeric: tabular-nums;
}

.cal-day:hover {
  background: var(--tint);
}

.cal-day:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: -2px;
}

.cal-day.is-muted {
  color: #a6aab3;
}

.cal-day.is-today {
  box-shadow: inset 0 0 0 1px var(--ink);
}

.cal-day.is-selected {
  background: var(--ink);
  color: #ffffff;
}

.cal-foot {
  display: flex;
  justify-content: space-between;
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--line);
}

.cal-link {
  border: 0;
  background: transparent;
  padding: 4px 6px;
  color: var(--ink-soft);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.cal-link:hover {
  color: var(--ink);
}

/* ---------- modals stay open on backdrop clicks; a quick nudge shows the click was seen ---------- */

@keyframes modal-nudge {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-6px); }
  75% { transform: translateX(6px); }
}

.modal.is-nudged {
  animation: modal-nudge 0.28s ease;
}
