/* ---------- 基础 ---------- */

* { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  color-scheme: dark;
  --primary: #4f6bff;
  --primary-dark: #3b55e6;
  --bg: #1a1a1f;
  --card: #25252c;
  --input-bg: #1e1e24;
  --border: #34343e;
  --text: #eee;
  --text-sub: #9a9aa5;
  --danger: #ff5d5d;
  --success: #34c98e;
  --radius: 14px;
}

html { -webkit-text-size-adjust: 100%; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB",
    "Microsoft YaHei", "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.6;
  max-width: 560px;
  margin: 0 auto;
  min-height: 100vh;
  -webkit-tap-highlight-color: transparent;
}

.hidden { display: none !important; }

button { font-family: inherit; cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: 0.5; }

input:not([type="checkbox"]), textarea {
  font-family: inherit;
  font-size: 15px;
  color: var(--text);
  width: 100%;
  padding: 11px 13px;
  background: var(--input-bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}

input:not([type="checkbox"]):focus, textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(79, 107, 255, 0.18);
}

input::placeholder, textarea::placeholder { color: #6b6b76; }

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

.primary {
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: 10px;
  padding: 12px 16px;
  font-size: 15px;
  font-weight: 600;
  transition: background 0.15s, transform 0.1s;
}
.primary:hover:not(:disabled) { background: var(--primary-dark); }
.primary:active:not(:disabled) { transform: translateY(1px); }

.msg { font-size: 13px; margin-top: 10px; color: var(--text-sub); }
.msg.error { color: var(--danger); }
.msg.success { color: var(--success); }

.status-line { font-size: 12.5px; color: var(--text-sub); margin-top: 8px; line-height: 1.5; }
.status-line.error { color: var(--danger); }
.status-line.success { color: var(--success); }

.empty-hint {
  padding: 18px 0;
  text-align: center;
  font-size: 13px;
  color: var(--text-sub);
}

/* ---------- 登录 ---------- */

#login-view {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 20px;
}

.login-card {
  width: 100%;
  max-width: 380px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 34px 24px 26px;
  text-align: center;
}

.login-logo {
  width: 52px;
  height: 52px;
  margin: 0 auto 14px;
  border-radius: 15px;
  background: var(--primary);
  color: #fff;
  font-size: 22px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 8px 22px -8px rgba(79, 107, 255, 0.8);
}

.login-card h1 { font-size: 21px; margin-bottom: 6px; }
.login-sub { font-size: 13px; color: var(--text-sub); margin-bottom: 22px; }
#login-view input { margin-bottom: 12px; }

.code-row { display: flex; gap: 10px; margin-bottom: 12px; }
.code-row input { flex: 1; margin-bottom: 0; }
.code-row button {
  flex: none;
  padding: 0 16px;
  white-space: nowrap;
  border: 1px solid rgba(79, 107, 255, 0.5);
  border-radius: 10px;
  background: rgba(79, 107, 255, 0.12);
  color: #93a4ff;
  font-size: 13.5px;
  font-weight: 600;
  transition: background 0.15s;
}
.code-row button:hover:not(:disabled) { background: rgba(79, 107, 255, 0.22); }

.login-btn { width: 100%; margin-top: 6px; padding: 13px; font-size: 15.5px; letter-spacing: 2px; }

/* ---------- 顶栏 ---------- */

.topbar {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  gap: 12px;
  height: 56px;
  padding: 0 16px;
  background: rgba(26, 26, 31, 0.92);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}

.app-title { flex: 1; font-size: 17px; font-weight: 700; }

.link-btn {
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-sub);
  font-size: 13px;
  padding: 6px 14px;
  border-radius: 8px;
  transition: all 0.15s;
}
.link-btn:hover { color: var(--text); border-color: var(--primary); }

/* ---------- Tab ---------- */

.main-tabs { display: flex; gap: 8px; padding: 12px 16px 0; }

.main-tab {
  flex: 1;
  padding: 10px 0;
  border: 1px solid var(--border);
  border-radius: 11px;
  background: var(--card);
  color: var(--text-sub);
  font-size: 15px;
  font-weight: 600;
  transition: all 0.15s;
}
.main-tab.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
  box-shadow: 0 6px 18px -8px rgba(79, 107, 255, 0.9);
}

/* ---------- 内容容器 / 卡片 ---------- */

.container { padding: 14px 16px calc(56px + env(safe-area-inset-bottom, 0px)); }

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 14px;
}

.card-title { font-size: 13.5px; font-weight: 600; color: var(--text-sub); margin-bottom: 12px; }

/* ---------- 录音按钮 ---------- */

.record-area { display: flex; flex-direction: column; align-items: center; gap: 12px; }

.record-btn {
  width: 124px;
  height: 124px;
  border-radius: 50%;
  border: 4px solid rgba(79, 107, 255, 0.35);
  background: var(--primary);
  color: #fff;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 1px;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  touch-action: none;
  transition: background 0.12s, border-color 0.12s, transform 0.12s;
}

.record-btn:active,
.record-btn.recording {
  background: #e5484d;
  border-color: rgba(229, 72, 77, 0.45);
  transform: scale(0.96);
}

.record-btn.recording { animation: rec-pulse 1.2s ease-out infinite; }

@keyframes rec-pulse {
  0% { box-shadow: 0 0 0 0 rgba(229, 72, 77, 0.5); }
  100% { box-shadow: 0 0 0 22px rgba(229, 72, 77, 0); }
}

.record-area .status-line { margin-top: 0; text-align: center; }

/* ---------- 文件选择 ---------- */

.file-label {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  padding: 12px 14px;
  border: 1px dashed rgba(79, 107, 255, 0.55);
  border-radius: 11px;
  background: rgba(79, 107, 255, 0.07);
  color: #93a4ff;
  font-size: 14px;
  font-weight: 600;
  text-align: center;
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
  transition: background 0.15s, border-color 0.15s;
}
.file-label:hover { background: rgba(79, 107, 255, 0.14); border-color: var(--primary); }
.file-label input[type="file"] { display: none; }

/* ---------- 材料勾选列表 ---------- */

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

.check-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: var(--input-bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  cursor: pointer;
  transition: border-color 0.15s;
}
.check-item:hover { border-color: rgba(79, 107, 255, 0.6); }

.check-item input[type="checkbox"] {
  flex: none;
  width: 18px;
  height: 18px;
  margin: 0;
  accent-color: var(--primary);
  cursor: pointer;
}

.check-item .check-title {
  flex: 1;
  min-width: 0;
  font-size: 14px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.check-badge { flex: none; font-size: 10.5px; font-weight: 700; padding: 2px 8px; border-radius: 5px; }
.check-badge.recording { background: rgba(79, 107, 255, 0.16); color: #93a4ff; }
.check-badge.document { background: rgba(52, 201, 142, 0.15); color: #45d69f; }

/* ---------- 提炼结果 ---------- */

.extract-btn { width: 100%; margin-top: 12px; padding: 13px; font-size: 15.5px; font-weight: 700; }

.extract-result {
  white-space: pre-wrap;
  word-break: break-word;
  font-size: 14.5px;
  line-height: 1.75;
}

.transcripts-area { display: flex; flex-direction: column; gap: 8px; }

.transcripts-area details {
  background: var(--input-bg);
  border: 1px solid var(--border);
  border-radius: 10px;
}

.transcripts-area summary {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 11px 13px;
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  list-style: none;
  user-select: none;
  -webkit-user-select: none;
}
.transcripts-area summary::-webkit-details-marker { display: none; }
.transcripts-area summary::after {
  content: "▾";
  margin-left: auto;
  color: var(--text-sub);
  font-size: 12px;
  transition: transform 0.15s;
}
.transcripts-area details[open] summary::after { transform: rotate(180deg); }
.transcripts-area details[open] summary { border-bottom: 1px solid var(--border); }

.transcripts-area pre {
  padding: 12px 13px;
  max-height: 340px;
  overflow-y: auto;
  white-space: pre-wrap;
  word-break: break-word;
  font-family: inherit;
  font-size: 13px;
  line-height: 1.7;
  color: #c9c9d1;
}

/* ---------- 导出 ---------- */

.export-row { display: flex; gap: 10px; }

.export-btn {
  flex: 1;
  padding: 12px 0;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--input-bg);
  color: var(--text);
  font-size: 13.5px;
  font-weight: 600;
  transition: all 0.15s;
}
.export-btn:hover:not(:disabled) { border-color: var(--primary); color: #93a4ff; }
.export-btn:active:not(:disabled) { transform: translateY(1px); }

/* ---------- 材料列表页 ---------- */

.materials-list { display: flex; flex-direction: column; gap: 12px; }

.material-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
}

.material-card .mc-top { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }

.material-card .mc-title {
  flex: 1;
  min-width: 0;
  font-size: 14px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.material-card .mc-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  font-size: 12px;
  color: var(--text-sub);
  margin-bottom: 8px;
}

.mc-status { flex: none; font-size: 10.5px; font-weight: 700; padding: 2px 8px; border-radius: 99px; }
.mc-status.done { background: rgba(52, 201, 142, 0.15); color: #45d69f; }
.mc-status.processing { background: rgba(79, 107, 255, 0.16); color: #93a4ff; }
.mc-status.failed { background: rgba(255, 93, 93, 0.15); color: #ff7b7b; }

.material-card .mc-content {
  margin-top: 10px;
  padding: 12px 13px;
  background: var(--input-bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  max-height: 320px;
  overflow-y: auto;
  white-space: pre-wrap;
  word-break: break-word;
  font-size: 13px;
  line-height: 1.7;
  color: #c9c9d1;
}

.material-card .mc-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }

.mini-btn {
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-sub);
  font-size: 12.5px;
  padding: 5px 12px;
  border-radius: 8px;
  transition: all 0.15s;
}
.mini-btn:hover:not(:disabled) { color: #93a4ff; border-color: var(--primary); }
