:root {
  --bg: #f2f3f5;
  --surface: #ffffff;
  --surface-2: #f7f7f8;
  --text: #17171a;
  --text-2: #6b6b72;
  --text-3: #9b9ba2;
  --border: rgba(0, 0, 0, 0.07);
  --btn: #18181b;
  --btn-hover: #2b2b2f;
  --danger: #c2413b;
  --radius-lg: 14px;
  --radius-md: 10px;
  --radius-sm: 8px;
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei",
    sans-serif;
  font-size: 13px;
  -webkit-font-smoothing: antialiased;
  -webkit-text-size-adjust: 100%;
}

.hidden {
  display: none !important;
}

/* ===== 登录页 ===== */

.login-view {
  min-height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
}

.login-card {
  width: 100%;
  max-width: 360px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.02);
}

.login-card .brand {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 22px;
}

.input {
  width: 100%;
  height: 42px;
  padding: 0 14px;
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  background: var(--surface-2);
  color: var(--text);
  font: inherit;
  font-size: 14px;
  outline: none;
  transition: background 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}

.input:focus {
  background: var(--surface);
  border-color: rgba(0, 0, 0, 0.14);
  box-shadow: 0 0 0 4px rgba(0, 0, 0, 0.03);
}

.btn-block {
  width: 100%;
  margin-top: 16px;
  height: 42px;
}

.error {
  margin-top: 10px;
  min-height: 16px;
  color: var(--danger);
  font-size: 12px;
}

/* ===== 主界面 ===== */

.titlebar {
  height: 48px;
  display: flex;
  align-items: center;
  padding: 0 16px;
}

.brand {
  font-size: 13px;
  font-weight: 600;
}

.shell {
  max-width: 720px;
  margin: 0 auto;
  padding: 4px 16px 40px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.02);
}

.field + .field {
  margin-top: 14px;
}

.label {
  display: block;
  font-size: 12px;
  color: var(--text-3);
  margin-bottom: 8px;
}

.input-area {
  width: 100%;
  min-height: 110px;
  padding: 12px 14px;
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  background: var(--surface-2);
  color: var(--text);
  font: inherit;
  font-size: 13px;
  line-height: 1.6;
  resize: vertical;
  outline: none;
  transition: background 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}

.input-area:focus {
  background: var(--surface);
  border-color: rgba(0, 0, 0, 0.14);
  box-shadow: 0 0 0 4px rgba(0, 0, 0, 0.03);
}

.toolbar {
  display: flex;
  justify-content: flex-end;
  margin-top: 16px;
}

.btn {
  height: 38px;
  padding: 0 16px;
  border: 0;
  border-radius: var(--radius-sm);
  font: inherit;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s ease, opacity 0.15s ease;
}

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

.btn-primary {
  background: var(--btn);
  color: #fff;
  min-width: 104px;
}

.btn-primary:hover:not(:disabled) {
  background: var(--btn-hover);
}

.btn-ghost {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
}

.btn-sm {
  height: 30px;
  padding: 0 12px;
  font-size: 12px;
  flex: none;
}

.progress-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 10px;
}

.status {
  font-size: 13px;
  font-weight: 500;
}

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

.progress-track {
  height: 5px;
  background: #ececef;
  border-radius: 3px;
  overflow: hidden;
}

.progress-bar {
  height: 100%;
  width: 0%;
  background: var(--btn);
  border-radius: 3px;
  transition: width 0.25s ease;
}

.notes {
  margin-top: 4px;
}

.note-item {
  padding: 10px 0;
  border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

.note-item:last-child {
  border-bottom: 0;
}

.note-row {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
}

.asset-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-top: 10px;
}

@media (min-width: 720px) {
  .asset-grid {
    grid-template-columns: repeat(6, 1fr);
  }
}

.asset-cell {
  position: relative;
  aspect-ratio: 1;
}

.asset-thumb {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 8px;
  background: var(--surface-2);
  cursor: zoom-in;
  display: block;
}

.asset-thumb.is-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-3);
  font-size: 12px;
  cursor: default;
}

.asset-check {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 20px;
  height: 20px;
  padding: 0;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.85);
  background: rgba(0, 0, 0, 0.35);
  color: transparent;
  font-size: 12px;
  line-height: 18px;
  text-align: center;
  cursor: pointer;
}

.asset-check.is-selected {
  background: var(--btn);
  border-color: var(--btn);
}

.asset-check.is-selected::after {
  content: "✓";
  color: #fff;
}

.asset-empty {
  padding: 10px 0 4px;
  font-size: 12px;
  color: var(--text-3);
}

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

.note-thumb {
  width: 48px;
  height: 48px;
  border-radius: 8px;
  object-fit: cover;
  flex: none;
  background: var(--surface-2);
  cursor: zoom-in;
}

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(0, 0, 0, 0.78);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  cursor: zoom-out;
}

.lightbox-content {
  display: flex;
  align-items: center;
  justify-content: center;
  max-width: 92vw;
  max-height: 92vh;
}

.lightbox-content img,
.lightbox-content video {
  max-width: 92vw;
  max-height: 92vh;
  border-radius: 10px;
  box-shadow: 0 12px 48px rgba(0, 0, 0, 0.45);
}

.note-thumb.is-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-3);
  font-size: 11px;
}

.note-title {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  word-break: break-all;
}

.note-meta {
  flex: none;
  max-width: 40%;
  color: var(--text-3);
  font-size: 12px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.note-meta.is-error {
  color: var(--danger);
  white-space: normal;
  word-break: break-all;
}

.log {
  margin-top: 12px;
  border-top: 1px solid rgba(0, 0, 0, 0.05);
  padding-top: 10px;
}

.log summary {
  font-size: 12px;
  color: var(--text-3);
  cursor: pointer;
  user-select: none;
}

.log pre {
  margin: 8px 0 0;
  max-height: 160px;
  overflow: auto;
  padding: 10px 12px;
  background: var(--surface-2);
  border-radius: 9px;
  font-family: ui-monospace, "SF Mono", Consolas, monospace;
  font-size: 11px;
  line-height: 1.65;
  color: var(--text-2);
  white-space: pre-wrap;
  word-break: break-all;
}
