:root {
  --bg: #000000;
  --card-bg: #1d1d1f;
  --accent: #0071e3;
  --accent-soft: rgba(0, 113, 227, 0.15);
  --border-subtle: #424245;
  --text-main: #f5f5f7;
  --text-muted: #86868b;
  --danger: #ff3b30;
  --radius-lg: 18px;
  --radius-md: 12px;
  --radius-pill: 980px;
  --shadow-soft: 0 2px 16px rgba(0, 0, 0, 0.25);
  --body-bg: #000000;
  --input-bg: #2c2c2e;
  --input-border: #424245;
  --case-item-bg: #1d1d1f;
  --case-item-border: rgba(66, 66, 69, 0.6);
  --btn-secondary-bg: rgba(66, 66, 69, 0.5);
  --btn-secondary-border: #424245;
  --hover-bg: rgba(66, 66, 69, 0.35);
  --bg-subtle: rgba(66, 66, 69, 0.25);
  --border-default: #424245;
}

[data-theme="light"] {
  --bg: #fbfbfd;
  --card-bg: #ffffff;
  --accent: #0071e3;
  --accent-soft: rgba(0, 113, 227, 0.12);
  --border-subtle: #d2d2d7;
  --text-main: #1d1d1f;
  --text-muted: #86868b;
  --danger: #ff3b30;
  --shadow-soft: 0 2px 14px rgba(0, 0, 0, 0.06);
  --body-bg: #fbfbfd;
  --input-bg: #ffffff;
  --input-border: #d2d2d7;
  --case-item-bg: #ffffff;
  --case-item-border: #e8e8ed;
  --btn-secondary-bg: #e8e8ed;
  --btn-secondary-border: #d2d2d7;
  --hover-bg: #d2d2d7;
  --bg-subtle: #f5f5f7;
  --border-default: #d2d2d7;
}

[data-theme="light"] .case-item:hover {
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.04);
}

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

body {
  margin: 0;
  min-height: 100vh;
  font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'SF Pro Display', 'Segoe UI', system-ui, sans-serif;
  font-weight: 400;
  line-height: 1.47059;
  background: var(--body-bg);
  color: var(--text-main);
  transition: background 0.25s ease, color 0.2s ease;
}

.app {
  max-width: 980px;
  margin: 0 auto;
  padding: 40px 24px 56px;
}

.app-header {
  text-align: left;
  margin-bottom: 32px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.app-header h1 {
  margin: 0 0 4px;
  font-size: 28px;
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.14286;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.current-user {
  font-size: 14px;
  color: var(--text-muted);
}

.btn-logout {
  font-size: 14px;
  padding: 6px 14px;
}

.subtitle {
  margin: 0;
  font-size: 17px;
  font-weight: 400;
  color: var(--text-muted);
  line-height: 1.47059;
}

.app-footer-watermark {
  margin-top: 40px;
  padding: 20px 16px 0;
  text-align: center;
  font-size: 11px;
  font-weight: 400;
  letter-spacing: 0.06em;
  text-transform: none;
  color: var(--text-muted);
  opacity: 0.45;
  user-select: none;
  pointer-events: none;
}

.app-footer-version {
  letter-spacing: 0.04em;
  opacity: 0.9;
  font-variant-numeric: tabular-nums;
}

/* 登录页 */
.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  animation: fadeIn 0.4s ease;
}

.login-wrap.hidden {
  display: none !important;
}

.app-wrap.hidden {
  display: none !important;
}

.login-card {
  width: 100%;
  max-width: 400px;
  padding: 40px 32px;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-soft);
}

.login-title {
  margin: 0 0 8px;
  font-size: 28px;
  font-weight: 600;
  letter-spacing: -0.02em;
  text-align: center;
}

.login-subtitle {
  margin: 0 0 24px;
  font-size: 17px;
  color: var(--text-muted);
  text-align: center;
  line-height: 1.47059;
}

.login-form .form-field {
  margin-bottom: 18px;
}

.login-remember-row {
  margin-top: 4px;
}

.login-remember-label {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.45;
  cursor: pointer;
}

.login-remember-label input {
  margin-top: 3px;
  flex-shrink: 0;
}

.login-auto-status {
  margin: 0 0 8px;
  font-size: 13px;
  color: var(--accent);
}

.login-form .form-field:last-of-type {
  margin-bottom: 20px;
}

.login-error {
  margin: 0 0 14px;
  font-size: 14px;
  color: var(--danger);
}

.login-error.hidden {
  display: none !important;
}

.btn-login {
  width: 100%;
  padding: 12px 20px;
  font-size: 17px;
  font-weight: 400;
}

/* 删除密码弹窗 */
.modal {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal.hidden {
  display: none !important;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  cursor: pointer;
}

.modal-content.card {
  position: relative;
  z-index: 1;
  min-width: 320px;
  max-width: 90vw;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-soft);
}

.modal-content h3 {
  margin: 0 0 12px;
  font-size: 16px;
}

.modal-content input {
  width: 100%;
  margin-bottom: 12px;
}

.modal-content .modal-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  margin-top: 8px;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.app-main {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 1.3fr);
  gap: 24px;
}

.app-main > .card {
  animation: fadeIn 0.35s ease;
}

.app-main > .card:nth-child(1) { animation-delay: 0.05s; }
.app-main > .card:nth-child(2) { animation-delay: 0.1s; }
.app-main > .card:nth-child(3) { animation-delay: 0.15s; }

@media (max-width: 840px) {
  .app-main {
    grid-template-columns: minmax(0, 1fr);
  }
}

.card {
  background: var(--card-bg);
  border-radius: var(--radius-lg);
  padding: 28px 24px 32px;
  border: 1px solid var(--border-subtle);
  box-shadow: var(--shadow-soft);
  transition: background 0.25s ease, border-color 0.2s ease, box-shadow 0.25s ease;
}

.card-wide {
  grid-column: 1 / -1;
}

.card h2 {
  margin: 0 0 20px;
  font-size: 22px;
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.27273;
}

.admin-import-export .subtitle.muted {
  margin: -8px 0 12px;
  font-size: 13px;
  color: var(--text-muted);
}

.import-export-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 16px;
}

.import-export-actions .btn {
  flex-shrink: 0;
}

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

.import-wrap .input-file {
  position: absolute;
  width: 0;
  height: 0;
  opacity: 0;
  overflow: hidden;
}

.import-result {
  display: block;
  margin-top: 6px;
  font-size: 13px;
  color: var(--text-muted);
}

.import-export-form .form-field {
  margin-bottom: 16px;
}

.import-export-form .form-field label {
  display: block;
  margin-bottom: 6px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
}

.export-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.export-filters select {
  min-width: 100px;
  padding: 8px 12px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
  background: var(--card-bg);
  color: var(--text-main);
  font-size: 14px;
}

.btn-block {
  width: 100%;
}

.import-export-form .input-file {
  position: absolute;
  width: 0;
  height: 0;
  opacity: 0;
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.case-count {
  font-size: 14px;
  color: var(--text-muted);
}

.cases-idle-hint {
  margin: 0;
  padding: 14px 16px;
  font-size: 14px;
  line-height: 1.55;
  color: var(--text-muted);
  border: 1px dashed var(--border-subtle);
  border-radius: 10px;
  background: var(--bg-subtle);
}

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

@media (max-width: 720px) {
  .form-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}

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

.form-grid .form-field-full,
.edit-grid .form-field-full {
  grid-column: 1 / -1;
}

.edit-grid textarea {
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  min-height: 72px;
  resize: vertical;
  padding: 10px 12px;
  font-size: 14px;
  line-height: 1.45;
  border-radius: var(--radius-md);
  border: 1px solid var(--input-border);
  background: var(--input-bg);
  color: var(--text-main);
}

.form-field label {
  font-size: 14px;
  color: var(--text-muted);
  font-weight: 400;
}

.form-field label .required {
  color: var(--danger);
}

.checkbox-group-label,
.radio-row .radio-label,
.checkbox-row .checkbox-label {
  font-size: 14px;
  color: var(--text-muted);
}

.checkbox-group,
.radio-row {
  margin-bottom: 4px;
}

.checkbox-group .checkbox-group-label,
.checkbox-group .checkbox-row {
  display: block;
  margin-bottom: 6px;
}

.checkbox-row,
.radio-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 16px;
  align-items: center;
}

.checkbox-label,
.radio-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  color: var(--text-main);
}

.checkbox-label input,
.radio-label input {
  width: auto;
  margin: 0;
  cursor: pointer;
}

.checkbox-group.hidden,
.form-field.checkbox-group.hidden {
  display: none !important;
}

input,
select,
textarea {
  border-radius: var(--radius-md);
  border: 1px solid var(--input-border);
  background-color: var(--input-bg);
  color: var(--text-main);
  padding: 10px 14px;
  font-size: 14px;
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease, color 0.2s ease;
}

textarea {
  resize: vertical;
  min-height: 72px;
}

input::placeholder,
textarea::placeholder {
  color: var(--text-muted);
}

.ai-match-section {
  margin-top: 20px;
  padding-top: 20px;
  border-top: 1px solid var(--border-subtle);
}

.ai-match-btn {
  margin-top: 12px;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-soft);
}

.form-actions {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: flex-end;
  margin-top: 8px;
}

.edit-form-actions {
  margin-top: 20px;
  padding-top: 20px;
  border-top: 1px solid var(--border-subtle);
}

.btn.primary:disabled,
.btn.primary.btn-loading {
  opacity: 0.55;
  cursor: not-allowed;
  pointer-events: none;
}

.btn {
  border-radius: var(--radius-pill);
  border: 1px solid transparent;
  padding: 8px 18px;
  font-size: 14px;
  font-weight: 400;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  white-space: nowrap;
  transition: background 0.2s ease, border-color 0.2s ease, opacity 0.2s ease;
}

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

.btn.primary:hover {
  opacity: 0.9;
}

.btn.secondary {
  background: var(--btn-secondary-bg);
  border-color: var(--btn-secondary-border);
  color: var(--text-main);
}

.btn.secondary:hover {
  background: var(--hover-bg);
  border-color: var(--border-subtle);
}

.fab-btn {
  position: fixed;
  right: 24px;
  bottom: 24px;
  border-radius: var(--radius-pill);
  border: none;
  padding: 12px 20px;
  font-size: 14px;
  font-weight: 500;
  background: var(--accent);
  color: #fff;
  box-shadow: var(--shadow-soft);
  cursor: pointer;
  z-index: 40;
  transition: opacity 0.2s ease, transform 0.15s ease;
}

.fab-btn:hover {
  opacity: 0.92;
}

.import-export-toggle {
  position: fixed;
  left: 24px;
  bottom: 132px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1px solid var(--border-subtle);
  background: var(--card-bg);
  color: var(--text-main);
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-soft);
  transition: background 0.2s ease, border-color 0.2s ease, transform 0.2s ease, opacity 0.2s ease;
}

.import-export-toggle:hover {
  opacity: 0.9;
  transform: scale(1.03);
}

/* 账号管理在批量导入上方，避免重叠 */
.account-mgmt-toggle {
  bottom: 188px;
}

.favorites-toggle {
  position: fixed;
  left: 24px;
  bottom: 76px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1px solid var(--border-subtle);
  background: var(--card-bg);
  color: var(--text-main);
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-soft);
  transition: background 0.2s ease, border-color 0.2s ease, transform 0.2s ease, opacity 0.2s ease;
}

.favorites-toggle:hover {
  opacity: 0.9;
  transform: scale(1.03);
}

.theme-toggle {
  position: fixed;
  left: 24px;
  bottom: 24px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1px solid var(--border-subtle);
  background: var(--card-bg);
  color: var(--text-main);
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-soft);
  transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease, transform 0.2s ease, opacity 0.2s ease;
}

.theme-toggle:hover {
  opacity: 0.9;
  transform: scale(1.03);
}

/* 收藏面板 */
.favorites-panel {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  justify-content: flex-end;
  pointer-events: none;
}

.favorites-panel:not(.hidden) {
  pointer-events: auto;
}

.favorites-panel-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  opacity: 0;
  transition: opacity 0.2s ease;
}

.favorites-panel:not(.hidden) .favorites-panel-backdrop {
  opacity: 1;
}

.favorites-panel-content {
  width: 100%;
  max-width: 420px;
  height: 100%;
  background: var(--card-bg);
  box-shadow: -4px 0 24px rgba(0, 0, 0, 0.12);
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 0.25s ease;
  overflow: hidden;
}

.favorites-panel:not(.hidden) .favorites-panel-content {
  transform: translateX(0);
}

.favorites-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-subtle);
  flex-shrink: 0;
}

.favorites-panel-header h2 {
  margin: 0;
  font-size: 22px;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--text-main);
}

.favorites-panel-close {
  width: 36px;
  height: 36px;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--text-muted);
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s, color 0.2s;
}

.favorites-panel-close:hover {
  background: var(--bg-subtle);
  color: var(--text-main);
}

.favorites-panel-body {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
}

.favorites-section {
  margin-bottom: 24px;
}

.favorites-section:last-child {
  margin-bottom: 0;
}

.favorites-section h3 {
  margin: 0 0 10px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: none;
}

.account-mgmt-table th,
.account-mgmt-table td {
  padding: 8px 12px;
  text-align: left;
  border-bottom: 1px solid var(--border-color, #e5e7eb);
}
.account-mgmt-table th {
  font-weight: 600;
  color: var(--text-muted);
}
.btn-sm {
  padding: 4px 10px;
  font-size: 12px;
}

.favorites-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.favorites-list:empty::after {
  content: '暂无收藏';
  display: block;
  font-size: 13px;
  color: var(--text-muted);
  padding: 8px 0;
}

.favorites-item {
  padding: 12px;
  border-radius: 8px;
  background: var(--bg-subtle);
  border: 1px solid var(--border-subtle);
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s;
  text-align: left;
}

.favorites-item:hover {
  background: var(--hover-bg);
  border-color: var(--border-default);
}

.favorites-item-title {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-main);
  margin: 0 0 4px;
}

.favorites-item-meta {
  font-size: 12px;
  color: var(--text-muted);
  margin: 0;
}

.hidden {
  display: none !important;
}

/* 编辑案例：悬浮层（顶部、模糊背景、动画） */
.edit-overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 24px 16px 40px;
  overflow-y: auto;
  pointer-events: none;
  visibility: hidden;
  opacity: 0;
  transition: visibility 0.25s ease, opacity 0.25s ease;
}

.edit-overlay:not(.hidden) {
  pointer-events: auto;
  visibility: visible;
  opacity: 1;
}

.edit-overlay-backdrop {
  position: fixed;
  inset: 0;
  z-index: 0;
  background: rgba(0, 0, 0, 0.35);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  opacity: 0;
  transition: opacity 0.25s ease;
}

.edit-overlay:not(.hidden) .edit-overlay-backdrop {
  opacity: 1;
}

.edit-overlay #edit-card {
  position: relative;
  z-index: 1;
  margin: 0 auto;
  max-width: 980px;
  width: 100%;
  transform: translateY(-20px);
  opacity: 0;
  transition: transform 0.28s ease, opacity 0.28s ease;
}

.edit-overlay:not(.hidden) #edit-card {
  transform: translateY(0);
  opacity: 1;
}

.card-edit {
  margin-top: 0;
}

.edit-attachments-input-hidden {
  position: absolute;
  width: 0;
  height: 0;
  opacity: 0;
  overflow: hidden;
  pointer-events: none;
}

.edit-upload-section {
  margin-bottom: 8px;
  padding: 16px 18px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
  background: var(--bg-subtle);
}

.edit-upload-section-head {
  margin-bottom: 12px;
}

.edit-upload-section-title {
  display: block;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-main);
  margin-bottom: 6px;
}

.edit-upload-hint {
  margin: 0;
  font-size: 13px;
  line-height: 1.45;
}

.edit-upload-body {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.edit-existing-hint {
  margin: 0;
  font-size: 13px;
  line-height: 1.45;
}

.edit-existing-attachments:empty {
  display: none;
}

.edit-upload-btn {
  padding: 10px 20px;
  font-size: 14px;
  border-radius: var(--radius-md);
  align-self: flex-start;
}

.edit-upload-preview {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  min-height: 0;
  max-height: 220px;
  overflow-y: auto;
  padding: 4px 2px 8px;
}

.edit-upload-preview-item {
  position: relative;
  width: 96px;
  height: 96px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
  overflow: hidden;
  background: var(--card-bg);
  flex-shrink: 0;
  transition: box-shadow 0.2s ease, border-color 0.2s ease;
}

.edit-upload-preview-item.is-image {
  cursor: pointer;
}

.edit-upload-preview-item.is-image:hover {
  border-color: var(--accent);
  box-shadow: 0 2px 12px var(--accent-soft);
}

.edit-upload-preview-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  pointer-events: none;
}

.edit-existing-file-link {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  font-size: 13px;
  font-weight: 600;
  color: var(--accent);
  text-decoration: none;
}

.edit-existing-file-link:hover {
  text-decoration: underline;
}

.edit-upload-preview-item.is-pdf {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 500;
}

.edit-upload-preview-item .edit-preview-remove {
  position: absolute;
  top: 2px;
  right: 2px;
  width: 20px;
  height: 20px;
  border: none;
  border-radius: 50%;
  background: rgba(0,0,0,0.6);
  color: #fff;
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  transition: background 0.2s;
}

.edit-upload-preview-item .edit-preview-remove:hover {
  background: var(--danger);
}


.edit-case-type-tabs {
  display: inline-flex;
  margin-bottom: 20px;
  padding: 4px;
  border-radius: var(--radius-md);
  background: var(--btn-secondary-bg);
  border: 1px solid var(--border-subtle);
  width: fit-content;
}

.edit-case-type-tabs .tab-label {
  border: none;
  border-radius: 8px;
  padding: 8px 16px;
  margin: 0;
}

.edit-case-type-tabs .tab-label:first-child {
  border-radius: 8px 0 0 8px;
}

.edit-case-type-tabs .tab-label:last-child {
  border-radius: 0 8px 8px 0;
}

.edit-case-type-tabs .tab-label:only-child {
  border-radius: 8px;
}

.edit-case-type-tabs .tab-label:has(input:checked) {
  background: var(--card-bg);
  color: var(--text-main);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12);
}

.tab-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
  background: transparent;
  color: var(--text-muted);
  font-size: 14px;
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease, box-shadow 0.2s ease;
}

.tab-label:hover {
  color: var(--text-main);
}

.tab-label input {
  margin: 0;
  cursor: pointer;
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.tab-label:has(input:checked) {
  background: var(--card-bg);
  color: var(--text-main);
  border-color: var(--border-subtle);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.edit-form-wrap .edit-panel {
  display: block;
}

.edit-form-wrap .edit-panel.hidden {
  display: none !important;
}

.search-case-type-tabs {
  display: inline-flex;
  margin-bottom: 20px;
  padding: 4px;
  border-radius: var(--radius-md);
  background: var(--btn-secondary-bg);
  border: 1px solid var(--border-subtle);
  width: fit-content;
}

.search-case-type-tabs .tab-label {
  border: none;
  border-radius: 8px;
  padding: 8px 16px;
  margin: 0;
}

.search-case-type-tabs .tab-label:first-child {
  border-radius: 8px 0 0 8px;
}

.search-case-type-tabs .tab-label:last-child {
  border-radius: 0 8px 8px 0;
}

.search-case-type-tabs .tab-label:only-child {
  border-radius: 8px;
}

.search-case-type-tabs .tab-label:has(input:checked) {
  background: var(--card-bg);
  color: var(--text-main);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12);
}

.need-form-wrap .search-panel {
  display: block;
}

.need-form-wrap .search-panel.hidden {
  display: none !important;
}

.results {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 8px;
  max-height: 520px;
  overflow-y: auto;
  padding-right: 4px;
}

.case-item {
  border-radius: var(--radius-md);
  padding: 16px 18px;
  background: var(--case-item-bg);
  border: 1px solid var(--case-item-border);
  transition: background 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

.case-item:hover {
  border-color: var(--border-subtle);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.case-title {
  margin: 0 0 6px;
  font-size: 17px;
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.23529;
}

.case-meta {
  margin: 0 0 6px;
  font-size: 14px;
  color: var(--text-muted);
}

.case-tags {
  margin: 0 0 6px;
  font-size: 14px;
  color: var(--accent);
}

.case-result {
  margin: 0 0 4px;
  font-size: 14px;
  line-height: 1.47059;
}

.case-quote {
  margin: 0;
  font-size: 14px;
  color: var(--text-muted);
  line-height: 1.47059;
}

.case-remark {
  margin: 4px 0 0;
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-word;
}

.case-favorite-row {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 6px;
}

.btn-favorite {
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
  padding: 2px 4px;
  transition: color 0.2s, transform 0.15s;
}

.btn-favorite:hover {
  color: #e11d48;
}

.btn-favorite[data-favorited="1"] {
  color: #e11d48;
}

.btn-favorite:disabled {
  opacity: 0.55;
  cursor: wait;
}

.case-favorite-count {
  font-size: 12px;
  color: var(--text-muted);
}

.case-attachments {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
  align-items: flex-start;
}

.case-attachment-thumb-wrap {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.case-attachment-thumb {
  width: 72px;
  height: 72px;
  object-fit: cover;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
  cursor: pointer;
  transition: box-shadow 0.2s ease, border-color 0.2s ease;
}

.case-attachment-thumb:hover {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-soft);
}

.copy-img-btn {
  font-size: 11px;
  padding: 2px 8px;
}

.case-attachment-link {
  font-size: 12px;
  color: var(--accent);
  text-decoration: none;
}

.case-attachment-link:hover {
  text-decoration: underline;
}

/* 全局提示：保存成功等，自动消失、无需确认 */
.app-toast {
  position: fixed;
  top: 28px;
  left: 50%;
  transform: translateX(-50%) translateY(-16px);
  z-index: 280;
  max-width: min(90vw, 420px);
  padding: 14px 22px;
  border-radius: var(--radius-md);
  font-size: 15px;
  font-weight: 600;
  line-height: 1.4;
  text-align: center;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.18);
  border: 1px solid var(--border-subtle);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.28s ease, transform 0.28s ease, visibility 0.28s ease;
}

.app-toast.is-visible {
  opacity: 1;
  visibility: visible;
  transform: translateX(-50%) translateY(0);
}

.app-toast--success {
  background: var(--card-bg);
  color: var(--text-main);
  border-color: rgba(34, 197, 94, 0.45);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12), 0 0 0 1px rgba(34, 197, 94, 0.2);
}

[data-theme="dark"] .app-toast--success {
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.45), 0 0 0 1px rgba(34, 197, 94, 0.25);
}

.app-toast--error {
  background: var(--card-bg);
  color: var(--danger);
  border-color: rgba(239, 68, 68, 0.4);
}

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 260;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.lightbox.hidden {
  display: none !important;
}

.lightbox-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.85);
  cursor: pointer;
}

.lightbox-content {
  position: relative;
  max-width: 90vw;
  max-height: 90vh;
  z-index: 1;
}

.lightbox-content img {
  max-width: 90vw;
  max-height: 90vh;
  object-fit: contain;
  border-radius: 8px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.6);
}

.lightbox-close {
  position: absolute;
  top: -36px;
  right: 0;
  width: 32px;
  height: 32px;
  border: none;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.2);
  color: #fff;
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.lightbox-close:hover {
  background: rgba(255, 255, 255, 0.3);
}

