/* 拍摄配置 board — light theme, neutral greys, single blue accent. */

:root {
  --bg: #f2f5f9;
  --panel: #ffffff;
  --rail: #ffffff;
  --text: #1c2b3a;
  --text-2: #425466;
  --muted: #7c8b9c;
  --faint: #9aa8b6;
  --border: #e1e8f0;
  --border-strong: #cbd7e4;
  --surface-2: #f7f9fc;

  --accent: #1f6feb;
  --accent-dark: #1657bd;
  --accent-soft: #eaf1ff;
  --accent-line: #bcd3ff;

  --danger: #d92d20;
  --danger-soft: #fef2f1;
  --danger-line: #f3c1bc;

  --success: #0f7b57;
  --success-soft: #e7f6ef;
  --success-line: #b9e5d2;

  --warn: #9a5b00;
  --warn-soft: #fff6e5;
  --warn-line: #f0d29b;

  --shadow-sm: 0 1px 2px rgba(23, 43, 77, 0.06);
  --shadow-md: 0 18px 40px rgba(23, 43, 77, 0.16);
  --shadow-rail: 0 1px 2px rgba(23, 43, 77, 0.05);

  --radius: 12px;
  --radius-sm: 9px;
  --radius-xs: 6px;

  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 24px;
  --space-6: 32px;

  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  height: 100%;
}

body {
  margin: 0;
  min-height: 100%;
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
  color: var(--text);
  background:
    radial-gradient(circle at 12% -12%, #e6eefb 0%, rgba(230, 238, 251, 0) 52%),
    var(--bg);
  -webkit-font-smoothing: antialiased;
}

h1,
h2,
h3,
p {
  margin: 0;
}

button,
input,
select {
  font-family: inherit;
}

/* ── Shell ──────────────────────────────────────────────────────────────── */

.app {
  width: 100%;
  max-width: 1440px;
  margin: 0 auto;
  padding: var(--space-5) var(--space-5) var(--space-6);
}

.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  padding: 0 var(--space-1) var(--space-5);
}

.app-brand {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  min-width: 0;
}

.brand-mark {
  width: 40px;
  height: 40px;
  flex: 0 0 auto;
  border-radius: var(--radius-sm);
  background: linear-gradient(135deg, var(--accent), #4f9bff);
  color: #fff;
  font-size: 19px;
  font-weight: 700;
  line-height: 40px;
  text-align: center;
  user-select: none;
  box-shadow: 0 4px 12px rgba(31, 111, 235, 0.22);
}

.brand-text {
  min-width: 0;
}

.app-title {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: 0.4px;
}

.app-sub {
  margin-top: 1px;
  font-size: 12px;
  color: var(--muted);
  letter-spacing: 0.3px;
}

.app-tools {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  flex: 0 0 auto;
}

.app-stat {
  font-size: 12px;
  color: var(--muted);
  padding: var(--space-1) var(--space-3);
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid var(--border);
  border-radius: 999px;
  white-space: nowrap;
}

/* ── Layout ─────────────────────────────────────────────────────────────── */

.layout {
  display: grid;
  grid-template-columns: 272px minmax(0, 1fr);
  align-items: start;
  gap: var(--space-4);
}

/* ── Left rail ──────────────────────────────────────────────────────────── */

.rail {
  background: var(--rail);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-rail);
  padding: var(--space-4);
}

.rail-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--space-2);
  padding-bottom: var(--space-3);
}

.rail-title {
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.4px;
}

.rail-count {
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
}

.cat-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.rail-loading {
  padding: var(--space-5) 0;
  text-align: center;
  font-size: 13px;
  color: var(--muted);
}

.cat-card {
  position: relative;
  padding: var(--space-3) var(--space-3) var(--space-2);
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  transition: border-color 0.15s ease, box-shadow 0.15s ease,
    transform 0.15s ease;
}

.cat-card:hover {
  border-color: var(--border-strong);
}

.cat-card.is-selected {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(31, 111, 235, 0.14), var(--shadow-sm);
}

.cat-card.is-selected::before {
  content: "";
  position: absolute;
  left: -1px;
  top: 12px;
  bottom: 12px;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: var(--accent);
}

.cat-name-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-2);
}

.cat-name {
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
  word-break: break-all;
  min-width: 0;
}

.cat-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--space-1) var(--space-3);
  margin-top: 2px;
  font-size: 12px;
  color: var(--muted);
}

.cat-sort {
  font-variant-numeric: tabular-nums;
}

.cat-badges {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin-top: var(--space-2);
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: 1px var(--space-2);
  font-size: 11px;
  line-height: 18px;
  color: var(--text-2);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 999px;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.badge-qr {
  color: var(--accent-dark);
  background: var(--accent-soft);
  border-color: var(--accent-line);
}

.badge-rec {
  color: var(--text-2);
}

.cat-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: var(--space-3);
  padding-top: var(--space-2);
  border-top: 1px dashed var(--border);
}

.cat-edit {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.cat-name-input {
  width: 100%;
  height: 34px;
  padding: 0 var(--space-2);
  font-size: 14px;
  color: var(--text);
  background: #fff;
  border: 1px solid var(--accent);
  border-radius: var(--radius-xs);
  outline: none;
  box-shadow: 0 0 0 3px rgba(31, 111, 235, 0.14);
}

.cat-edit-actions {
  display: flex;
  gap: 6px;
}

.cat-edit-error {
  margin: 0;
  font-size: 12px;
  color: var(--danger);
}

.rail-note {
  margin-top: var(--space-4);
  padding: var(--space-3);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-left: 3px solid var(--border-strong);
  border-radius: var(--radius-xs);
}

.rail-note-label {
  display: block;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.6px;
  color: var(--muted);
  text-transform: uppercase;
}

.rail-note-text {
  margin-top: var(--space-1);
  font-size: 12px;
  line-height: 1.7;
  color: var(--text-2);
  word-break: break-word;
}

/* ── Right panel ────────────────────────────────────────────────────────── */

.panel {
  min-width: 0;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-rail);
  padding: var(--space-4) var(--space-5) var(--space-5);
}

.panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-4);
  padding-bottom: var(--space-3);
  border-bottom: 1px solid var(--border);
}

.panel-head-main {
  min-width: 0;
}

.panel-title {
  font-size: 17px;
  font-weight: 700;
  letter-spacing: 0.3px;
  word-break: break-all;
}

.panel-meta {
  margin-top: var(--space-1);
  font-size: 12px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

/* ── Alerts ─────────────────────────────────────────────────────────────── */

.alert {
  display: flex;
  align-items: flex-start;
  gap: var(--space-2);
  margin-top: var(--space-3);
  padding: var(--space-2) var(--space-3);
  font-size: 13px;
  line-height: 1.6;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
}

.alert-warn {
  color: var(--warn);
  background: var(--warn-soft);
  border-color: var(--warn-line);
}

.alert-error {
  color: var(--danger);
  background: var(--danger-soft);
  border-color: var(--danger-line);
}

.alert-dot {
  flex: 0 0 auto;
  width: 8px;
  height: 8px;
  margin-top: 6px;
  border-radius: 50%;
  background: currentColor;
}

/* ── Table ──────────────────────────────────────────────────────────────── */

.table-wrap {
  position: relative;
  margin-top: var(--space-3);
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

.sub-table {
  width: 100%;
  min-width: 820px;
  border-collapse: collapse;
  font-size: 13px;
}

.sub-table thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  padding: var(--space-2) var(--space-3);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.6px;
  text-transform: uppercase;
  text-align: left;
  color: var(--muted);
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.sub-table tbody td {
  padding: 10px var(--space-3);
  border-bottom: 1px solid #eef2f7;
  vertical-align: middle;
  color: var(--text-2);
}

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

.sub-table tbody tr {
  transition: background-color 0.12s ease;
}

.sub-table tbody tr:hover {
  background: #f8fbff;
}

.sub-table tbody tr.is-off {
  background: #fcfcfd;
}

.sub-table tbody tr.is-off .cell-name {
  color: var(--muted);
}

.cell-name {
  font-weight: 600;
  color: var(--text);
  word-break: break-all;
}

.cell-short,
.cell-sort,
.cell-usage {
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.cell-usage {
  color: var(--muted);
}

.cell-usage.has-usage {
  color: var(--text);
  font-weight: 600;
}

.col-actions {
  width: 1%;
}

.cell-actions {
  white-space: nowrap;
}

.row-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

/* ── Pills / tags ───────────────────────────────────────────────────────── */

.pill {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: 1px var(--space-2);
  font-size: 11px;
  font-weight: 600;
  line-height: 18px;
  border-radius: 999px;
  border: 1px solid transparent;
  white-space: nowrap;
}

.pill::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}

.pill-on {
  color: var(--success);
  background: var(--success-soft);
  border-color: var(--success-line);
}

.pill-off {
  color: var(--muted);
  background: #f1f4f8;
  border-color: #e2e7ee;
}

.tag {
  display: inline-flex;
  align-items: center;
  padding: 1px var(--space-2);
  font-size: 11px;
  font-weight: 600;
  line-height: 18px;
  border-radius: var(--radius-xs);
  border: 1px solid transparent;
  white-space: nowrap;
}

.tag-video {
  color: #6b3fb5;
  background: #f3eeff;
  border-color: #dfd2fb;
}

.tag-image {
  color: #0d7490;
  background: #e8f7fb;
  border-color: #bfe6ef;
}

/* ── Buttons ────────────────────────────────────────────────────────────── */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 34px;
  padding: 0 var(--space-4);
  font-size: 13px;
  font-weight: 600;
  line-height: 1;
  color: var(--text-2);
  background: #fff;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  cursor: pointer;
  white-space: nowrap;
  transition: background-color 0.15s ease, border-color 0.15s ease,
    color 0.15s ease, transform 0.05s ease, box-shadow 0.15s ease;
}

.btn:hover:not(:disabled) {
  background: var(--surface-2);
  border-color: var(--border-strong);
}

.btn:active:not(:disabled) {
  transform: translateY(1px);
}

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

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

.btn-primary {
  color: #fff;
  background: var(--accent);
  border-color: var(--accent);
}

.btn-primary:hover:not(:disabled) {
  background: var(--accent-dark);
  border-color: var(--accent-dark);
}

.btn-danger {
  color: #fff;
  background: var(--danger);
  border-color: var(--danger);
}

.btn-danger:hover:not(:disabled) {
  background: #b72318;
  border-color: #b72318;
}

.btn-ghost {
  color: var(--text-2);
  background: #fff;
}

.btn-sm {
  height: 26px;
  padding: 0 var(--space-2);
  font-size: 12px;
  font-weight: 500;
  border-radius: var(--radius-xs);
}

.btn-danger-ghost {
  color: var(--danger);
  background: #fff;
  border-color: var(--danger-line);
}

.btn-danger-ghost:hover:not(:disabled) {
  background: var(--danger-soft);
}

/* ── Table states ───────────────────────────────────────────────────────── */

.table-loading,
.table-empty {
  padding: var(--space-6) var(--space-4);
  text-align: center;
  font-size: 13px;
  color: var(--muted);
}

/* ── Modal ──────────────────────────────────────────────────────────────── */

.modal-mask {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-4);
  background: rgba(16, 28, 44, 0.46);
  -webkit-backdrop-filter: blur(2px);
  backdrop-filter: blur(2px);
  animation: mask-in 0.14s ease-out;
}

.modal {
  width: 100%;
  max-width: 460px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  padding: var(--space-5);
  animation: modal-in 0.18s cubic-bezier(0.22, 0.9, 0.36, 1);
}

.modal-sm {
  max-width: 400px;
}

.modal-head {
  margin-bottom: var(--space-4);
}

.modal-title {
  font-size: 17px;
  font-weight: 700;
  letter-spacing: 0.3px;
}

.modal-sub {
  margin-top: var(--space-1);
  font-size: 12px;
  color: var(--muted);
}

.modal-form {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.form-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-label-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--space-2);
}

.form-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-2);
}

.counter {
  font-size: 11px;
  color: var(--faint);
  font-variant-numeric: tabular-nums;
}

.counter.is-over {
  color: var(--danger);
  font-weight: 700;
}

.form-input,
.form-select {
  width: 100%;
  height: 38px;
  padding: 0 var(--space-3);
  font-size: 14px;
  color: var(--text);
  background: #fbfcfe;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.form-input:focus,
.form-select:focus {
  background: #fff;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(31, 111, 235, 0.16);
}

.form-input[aria-invalid="true"] {
  border-color: var(--danger);
  box-shadow: 0 0 0 3px rgba(217, 45, 32, 0.12);
}

.field-error {
  font-size: 12px;
  color: var(--danger);
}

.form-error {
  margin: 0;
  padding: var(--space-2) var(--space-3);
  font-size: 13px;
  color: var(--danger);
  background: var(--danger-soft);
  border: 1px solid var(--danger-line);
  border-radius: var(--radius-xs);
}

.segmented {
  display: inline-flex;
  padding: 3px;
  gap: 3px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  width: fit-content;
}

.seg {
  position: relative;
  cursor: pointer;
}

.seg input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
  pointer-events: none;
}

.seg-face {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 72px;
  height: 30px;
  padding: 0 var(--space-3);
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  border-radius: var(--radius-xs);
  transition: background-color 0.15s ease, color 0.15s ease,
    box-shadow 0.15s ease;
}

.seg input:checked + .seg-face {
  color: var(--accent-dark);
  background: #fff;
  box-shadow: 0 1px 3px rgba(23, 43, 77, 0.14);
}

.seg input:focus-visible + .seg-face {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

.modal-foot {
  display: flex;
  justify-content: flex-end;
  gap: var(--space-2);
  margin-top: var(--space-2);
  padding-top: var(--space-4);
  border-top: 1px solid var(--border);
}

.confirm-text {
  font-size: 14px;
  line-height: 1.7;
  color: var(--text-2);
  word-break: break-word;
}

/* ── Toast ──────────────────────────────────────────────────────────────── */

.toast {
  position: fixed;
  top: var(--space-5);
  right: var(--space-5);
  z-index: 80;
  max-width: 340px;
  padding: 10px var(--space-4);
  font-size: 13px;
  color: #fff;
  background: #1c2b3a;
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-md);
  animation: toast-in 0.18s ease-out;
}

.toast.is-error {
  background: var(--danger);
}

/* ── Motion ─────────────────────────────────────────────────────────────── */

@keyframes mask-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes modal-in {
  from { opacity: 0; transform: translateY(8px) scale(0.985); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes toast-in {
  from { opacity: 0; transform: translateY(-6px); }
  to { opacity: 1; transform: translateY(0); }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}

/* ── Responsive ─────────────────────────────────────────────────────────── */

@media (max-width: 900px) {
  .app {
    padding: var(--space-4) var(--space-3) var(--space-6);
  }

  .app-header {
    padding-bottom: var(--space-4);
  }

  .layout {
    grid-template-columns: minmax(0, 1fr);
  }

  .cat-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  }

  .panel {
    padding: var(--space-4);
  }
}

@media (max-width: 560px) {
  .app-header {
    flex-direction: column;
    align-items: flex-start;
    gap: var(--space-3);
  }

  .app-tools {
    width: 100%;
    justify-content: space-between;
  }

  .cat-list {
    grid-template-columns: minmax(0, 1fr);
  }

  .panel-head {
    flex-direction: column;
    gap: var(--space-3);
  }

  .panel-head .btn {
    width: 100%;
  }

  .modal {
    padding: var(--space-4);
  }

  .modal-foot .btn {
    flex: 1 1 auto;
  }
}
