/* ===== Reset & Base ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; -webkit-text-size-adjust: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  background: #f5f5fa;
  color: #1a1a2e;
  line-height: 1.6;
  min-height: 100vh;
}
input, textarea, button { font-family: inherit; font-size: inherit; }
a { color: #534AB7; text-decoration: none; }

/* ===== Variables ===== */
:root {
  --primary: #534AB7;
  --primary-light: #7B6FD9;
  --primary-dark: #3D3499;
  --primary-bg: #F0EEFA;
  --green: #2ECC71;
  --green-bg: #E8F8F0;
  --red: #E74C3C;
  --red-bg: #FDEAE8;
  --amber: #F39C12;
  --amber-bg: #FEF5E7;
  --text: #1a1a2e;
  --text-secondary: #6B7280;
  --text-light: #9CA3AF;
  --card-bg: #FFFFFF;
  --border: #E8E8F0;
  --shadow: 0 2px 8px rgba(83,74,183,0.06);
  --shadow-hover: 0 6px 20px rgba(83,74,183,0.12);
}

/* ===== Layout ===== */
#app { max-width: 480px; margin: 0 auto; min-height: 100vh; background: #f5f5fa; position: relative; }
.container { padding: 16px; padding-bottom: 40px; }

/* ===== Header ===== */
.header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 16px;
  background: #fff; border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 100;
}
.logo { font-size: 1.1rem; font-weight: 700; color: var(--primary); flex: 1; text-align: center; }
.icon-btn {
  width: 36px; height: 36px; border: none; background: none;
  font-size: 1.3rem; cursor: pointer; border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  transition: background .2s;
}
.icon-btn:hover { background: var(--primary-bg); }
.back-btn { font-size: 1.8rem; color: var(--primary); }

/* ===== Views ===== */
.view { display: none; }
.view.active { display: block; }

/* ===== Greeting ===== */
.greeting {
  display: flex; align-items: center; justify-content: space-between;
  padding: 20px 4px 16px;
}
.greeting h2 { font-size: 1.25rem; font-weight: 700; color: var(--text); }
.greeting p { font-size: 0.85rem; color: var(--text-secondary); margin-top: 2px; }
.btn-float {
  background: var(--primary); color: #fff; border: none;
  padding: 8px 16px; border-radius: 20px; font-size: 0.85rem; font-weight: 600;
  cursor: pointer; transition: all .2s; white-space: nowrap;
}
.btn-float:hover { background: var(--primary-dark); transform: translateY(-1px); }
.btn-float:active { transform: translateY(0); }

/* ===== Stats Cards ===== */
.stats-row {
  display: flex; gap: 10px; margin-bottom: 14px;
}
.stat-card {
  flex: 1; background: var(--card-bg); border-radius: 14px; padding: 14px 12px;
  display: flex; flex-direction: column; gap: 8px;
  box-shadow: var(--shadow); border: 1px solid var(--border);
}
.stat-card-icon {
  width: 32px; height: 32px; border-radius: 9px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1rem; font-weight: 700;
}
.stat-card-icon.purple { background: var(--primary-bg); color: var(--primary); }
.stat-card-icon.green { background: var(--green-bg); color: var(--green); }
.stat-card-icon.amber { background: var(--amber-bg); color: var(--amber); }
.stat-card-body { display: flex; flex-direction: column; }
.stat-card-num { font-size: 1.35rem; font-weight: 800; color: var(--text); line-height: 1.1; }
.stat-card-label { font-size: 0.72rem; color: var(--text-secondary); margin-top: 2px; }

/* ===== Dashboard Row ===== */
.dashboard-row {
  display: flex; gap: 10px; margin-bottom: 14px;
}
.dash-card {
  background: var(--card-bg); border-radius: 14px; padding: 14px;
  box-shadow: var(--shadow); border: 1px solid var(--border);
}
.dash-card-title {
  font-size: 0.78rem; font-weight: 700; color: var(--text-secondary);
  margin-bottom: 10px; text-transform: uppercase; letter-spacing: 0.5px;
}
.progress-card { flex: 0 0 130px; display: flex; flex-direction: column; align-items: center; }
.progress-ring-wrap { position: relative; width: 100px; height: 100px; }
.progress-ring { transform: rotate(-90deg); }
.progress-ring .ring-bg {
  fill: none; stroke: #F0EEFA; stroke-width: 8;
}
.progress-ring .ring-fill {
  fill: none; stroke: var(--primary); stroke-width: 8;
  stroke-linecap: round; stroke-dasharray: 264; stroke-dashoffset: 264;
  transition: stroke-dashoffset 0.8s ease;
}
.progress-ring-text {
  position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
  text-align: center;
}
.ring-num { display: block; font-size: 1.5rem; font-weight: 800; color: var(--primary); }
.ring-label { font-size: 0.7rem; color: var(--text-light); }

.chart-card { flex: 1; }
.mini-chart {
  height: 70px; display: flex; align-items: flex-end; gap: 4px; padding-top: 4px;
}
.chart-bar {
  flex: 1; border-radius: 4px 4px 0 0; min-height: 4px;
  transition: height 0.6s ease; position: relative;
}
.chart-bar.has-data { background: linear-gradient(to top, var(--primary), var(--primary-light)); }
.chart-bar.no-data { background: #F0EEFA; }
.chart-bar-label {
  position: absolute; bottom: -16px; left: 50%; transform: translateX(-50%);
  font-size: 0.6rem; color: var(--text-light); white-space: nowrap;
}
.chart-empty {
  width: 100%; text-align: center; color: var(--text-light);
  font-size: 0.8rem; line-height: 70px;
}

/* ===== Type Distribution ===== */
.type-dist-card { margin-bottom: 14px; }
.type-dist-bar {
  display: flex; height: 24px; border-radius: 8px; overflow: hidden; gap: 2px;
}
.type-dist-segment {
  display: flex; align-items: center; justify-content: center;
  font-size: 0.7rem; font-weight: 600; color: #fff;
  transition: flex 0.6s ease;
}
.type-dist-segment.single { background: var(--primary); }
.type-dist-segment.multiple { background: var(--amber); }
.type-dist-segment.judge { background: var(--green); }
.type-dist-legend {
  display: flex; gap: 12px; margin-top: 8px; font-size: 0.75rem; color: var(--text-secondary);
}
.type-dist-legend span { display: flex; align-items: center; gap: 4px; }
.type-dist-legend .dot {
  width: 8px; height: 8px; border-radius: 50%;
}

/* ===== Recent Practice ===== */
.recent-card { margin-bottom: 14px; }
.recent-list { display: flex; flex-direction: column; gap: 8px; }
.recent-item {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 12px; border-radius: 10px; background: #FAFAFE;
}
.recent-item-info { display: flex; align-items: center; gap: 10px; }
.recent-item-score {
  width: 36px; height: 36px; border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.85rem; font-weight: 800;
}
.recent-item-score.high { background: var(--green-bg); color: var(--green); }
.recent-item-score.mid { background: var(--amber-bg); color: var(--amber); }
.recent-item-score.low { background: var(--red-bg); color: var(--red); }
.recent-item-name { font-size: 0.85rem; font-weight: 600; color: var(--text); }
.recent-item-date { font-size: 0.72rem; color: var(--text-light); }

/* ===== Section Header ===== */
.section-header {
  font-size: 1rem; font-weight: 700; margin: 20px 0 12px; color: var(--text);
  display: flex; align-items: center; gap: 8px;
}
.section-header::before {
  content: ''; width: 3px; height: 16px; background: var(--primary); border-radius: 2px;
}

/* ===== Empty State ===== */
.empty-state { text-align: center; padding: 50px 20px; color: var(--text-light); }
.empty-icon { font-size: 2.5rem; margin-bottom: 12px; }
.empty-hint { font-size: 0.8rem; color: var(--text-light); margin-top: 4px; }

/* ===== Bank List ===== */
.bank-list { display: flex; flex-direction: column; gap: 10px; }
.bank-card {
  background: var(--card-bg); border-radius: 14px; padding: 16px;
  box-shadow: var(--shadow); cursor: pointer; transition: all .2s;
  border: 1px solid var(--border); position: relative; overflow: hidden;
}
.bank-card:hover { box-shadow: var(--shadow-hover); transform: translateY(-2px); }
.bank-card::before {
  content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 4px;
  background: var(--primary);
}
.bank-card-name { font-size: 1rem; font-weight: 700; color: var(--text); margin-bottom: 6px; padding-left: 8px; }
.bank-card-info { display: flex; gap: 10px; font-size: 0.8rem; color: var(--text-secondary); padding-left: 8px; }
.bank-card-info span { display: flex; align-items: center; gap: 3px; }
.bank-card-badge {
  display: inline-block; font-size: 0.7rem; padding: 2px 8px; border-radius: 6px;
  background: var(--primary-bg); color: var(--primary); font-weight: 600; margin-left: 8px;
}

/* ===== Buttons ===== */
.btn-primary {
  background: var(--primary); color: #fff; border: none;
  padding: 12px 24px; border-radius: 12px; font-size: 1rem; font-weight: 600;
  cursor: pointer; transition: all .2s; width: 100%;
}
.btn-primary:hover { background: var(--primary-dark); transform: translateY(-1px); box-shadow: 0 4px 12px rgba(83,74,183,0.2); }
.btn-primary:active { transform: translateY(0); }
.btn-primary:disabled { background: #C4BEDB; cursor: not-allowed; transform: none; box-shadow: none; }
.btn-large { padding: 14px 24px; font-size: 1.05rem; margin: 12px 0; }
.btn-secondary {
  background: #fff; color: var(--primary); border: 1.5px solid var(--primary);
  padding: 10px 20px; border-radius: 12px; font-size: 0.95rem; font-weight: 600;
  cursor: pointer; transition: all .2s; flex: 1;
}
.btn-secondary:hover { background: var(--primary-bg); }
.btn-danger {
  background: #fff; color: var(--red); border: 1.5px solid var(--red);
  padding: 10px 20px; border-radius: 12px; font-size: 0.95rem; font-weight: 600;
  cursor: pointer; transition: all .2s; flex: 1;
}
.btn-danger:hover { background: var(--red-bg); }
.btn-block { width: 100%; }
.btn-text { background: none; border: none; color: var(--primary); cursor: pointer; font-size: 0.85rem; }

/* ===== Upload ===== */
.view-title { font-size: 1.2rem; font-weight: 700; margin-bottom: 16px; }
.tabs { display: flex; gap: 4px; margin-bottom: 16px; background: var(--primary-bg); border-radius: 12px; padding: 4px; }
.tab {
  flex: 1; padding: 8px 4px; border: none; background: none;
  border-radius: 8px; cursor: pointer; font-size: 0.82rem; color: var(--text-secondary);
  transition: all .2s;
}
.tab.active { background: #fff; color: var(--primary); font-weight: 600; box-shadow: 0 1px 4px rgba(0,0,0,0.06); }
.tab-content { display: none; }
.tab-content.active { display: block; }

.upload-zone {
  border: 2px dashed #D5D0E8; border-radius: 14px; padding: 40px 20px;
  text-align: center; cursor: pointer; transition: all .2s; background: #fff;
}
.upload-zone:hover, .upload-zone.dragover { border-color: var(--primary); background: var(--primary-bg); }
.upload-icon { font-size: 2.5rem; margin-bottom: 12px; }
.upload-zone p { font-size: 0.95rem; color: var(--text); margin-bottom: 4px; }
.upload-hint { font-size: 0.8rem; color: var(--text-light); }

.upload-status { margin-top: 12px; }
.status-msg { padding: 10px 14px; border-radius: 10px; font-size: 0.9rem; }
.status-msg.success { background: var(--green-bg); color: #1a8a4a; }
.status-msg.error { background: var(--red-bg); color: #c0392b; }
.status-msg.loading { background: var(--primary-bg); color: var(--primary); }

.image-preview { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.image-preview img { width: 80px; height: 80px; object-fit: cover; border-radius: 10px; border: 1px solid var(--border); }

.text-input {
  width: 100%; padding: 14px; border: 1.5px solid #E0E0EC; border-radius: 12px;
  font-size: 0.95rem; resize: vertical; outline: none; transition: border-color .2s;
}
.text-input:focus { border-color: var(--primary); }

.text-preview-wrap { margin-top: 16px; }
.preview-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.preview-header span { font-size: 0.9rem; font-weight: 600; color: var(--text); }
.text-preview {
  width: 100%; padding: 14px; border: 1.5px solid #E0E0EC; border-radius: 12px;
  font-size: 0.9rem; resize: vertical; outline: none; background: #FAFAFE;
  max-height: 300px; overflow-y: auto;
}
.text-stats { font-size: 0.8rem; color: var(--text-secondary); margin-top: 6px; }

/* ===== Settings Section ===== */
.settings-section { background: #fff; border-radius: 14px; padding: 16px; margin-top: 20px; border: 1px solid var(--border); box-shadow: var(--shadow); }
.settings-title { font-size: 0.95rem; font-weight: 700; margin-bottom: 14px; color: var(--text); }
.setting-row { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; }
.setting-row:last-child { margin-bottom: 0; }
.setting-row label { font-size: 0.9rem; color: var(--text); }
.counter { display: flex; align-items: center; gap: 12px; }
.counter-btn {
  width: 32px; height: 32px; border: 1.5px solid var(--primary); background: #fff;
  border-radius: 9px; font-size: 1.2rem; color: var(--primary); cursor: pointer;
  display: flex; align-items: center; justify-content: center; transition: all .2s;
}
.counter-btn:hover { background: var(--primary-bg); }
.counter span { font-size: 1.1rem; font-weight: 800; min-width: 30px; text-align: center; color: var(--text); }
.type-toggles { display: flex; gap: 8px; }
.toggle {
  display: flex; align-items: center; gap: 4px; font-size: 0.82rem;
  padding: 6px 12px; border-radius: 8px; background: #F5F5FA; cursor: pointer;
  border: 1.5px solid transparent; transition: all .2s;
}
.toggle input { accent-color: var(--primary); }
.toggle:has(input:checked) { border-color: var(--primary); background: var(--primary-bg); }

.input-group { margin-top: 16px; }
.input-group label { display: block; font-size: 0.9rem; font-weight: 600; margin-bottom: 6px; color: var(--text); }
.text-field {
  width: 100%; padding: 12px 14px; border: 1.5px solid #E0E0EC; border-radius: 12px;
  font-size: 0.95rem; outline: none; transition: border-color .2s;
}
.text-field:focus { border-color: var(--primary); }
.input-hint { font-size: 0.8rem; color: var(--text-secondary); margin-top: 6px; line-height: 1.5; }

/* ===== Generating ===== */
.generating-wrap { text-align: center; padding-top: 80px; }
.generating-icon { margin-bottom: 24px; }
.spinner {
  width: 56px; height: 56px; border: 4px solid var(--primary-bg);
  border-top-color: var(--primary); border-radius: 50%;
  animation: spin 0.8s linear infinite; margin: 0 auto;
}
@keyframes spin { to { transform: rotate(360deg); } }
.generating-wrap h2 { font-size: 1.2rem; margin-bottom: 24px; color: var(--text); }
.progress-bar-wrap {
  width: 100%; height: 8px; background: #E8E8F0; border-radius: 4px; overflow: hidden;
  margin-bottom: 12px;
}
.progress-bar-wrap.slim { height: 4px; }
.progress-bar {
  height: 100%; background: linear-gradient(90deg, var(--primary), var(--primary-light));
  border-radius: 4px; transition: width 0.5s ease; min-width: 0;
}
.progress-text { font-size: 0.9rem; color: var(--text-secondary); }
.progress-count { font-size: 0.85rem; color: var(--primary); font-weight: 600; margin-top: 4px; }

/* ===== Bank Detail ===== */
.bank-header { margin-bottom: 16px; }
.bank-header h2 { font-size: 1.3rem; font-weight: 800; color: var(--text); }
.bank-meta { font-size: 0.82rem; color: var(--text-secondary); margin-top: 4px; }

.bank-stats-row {
  display: flex; gap: 10px; margin-bottom: 16px;
}
.bank-stat-card {
  flex: 1; background: #fff; border-radius: 12px; padding: 12px;
  text-align: center; border: 1px solid var(--border); box-shadow: var(--shadow);
}
.bank-stat-num { display: block; font-size: 1.3rem; font-weight: 800; color: var(--primary); }
.bank-stat-label { font-size: 0.72rem; color: var(--text-secondary); margin-top: 2px; display: block; }

.bank-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 20px; }
.bank-actions .btn-primary { width: auto; flex: 1; min-width: 100px; }

.filter-tabs { display: flex; gap: 4px; margin-bottom: 16px; overflow-x: auto; }
.filter-tab {
  padding: 6px 16px; border: none; background: #E8E8F0; border-radius: 20px;
  font-size: 0.85rem; color: var(--text-secondary); cursor: pointer; white-space: nowrap; transition: all .2s;
}
.filter-tab.active { background: var(--primary); color: #fff; }

.question-list { display: flex; flex-direction: column; gap: 10px; }
.q-card {
  background: #fff; border-radius: 12px; padding: 16px;
  border: 1px solid var(--border); box-shadow: var(--shadow);
}
.q-card-header { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.q-type-badge {
  font-size: 0.7rem; padding: 2px 8px; border-radius: 6px; font-weight: 700;
}
.q-type-badge.single { background: var(--primary-bg); color: var(--primary); }
.q-type-badge.multiple { background: var(--amber-bg); color: var(--amber); }
.q-type-badge.judge { background: var(--green-bg); color: var(--green); }
.q-card-text { font-size: 0.95rem; color: var(--text); margin-bottom: 10px; line-height: 1.6; }
.q-card-options { display: flex; flex-direction: column; gap: 6px; }
.q-option {
  font-size: 0.85rem; padding: 8px 12px; border-radius: 8px; background: #F5F5FA;
  color: var(--text-secondary);
}
.q-option.correct { background: var(--green-bg); color: #1a8a4a; font-weight: 600; }
.q-card-explanation {
  margin-top: 10px; padding: 10px 12px; background: #FFFBF0; border-radius: 8px;
  font-size: 0.82rem; color: #7D6B3A; border-left: 3px solid var(--amber);
}

/* ===== Quiz ===== */
.quiz-header { margin-bottom: 20px; }
.quiz-progress { text-align: center; font-size: 0.9rem; color: var(--text-secondary); margin-bottom: 8px; }
.quiz-progress span { font-weight: 800; color: var(--primary); }
.quiz-question { margin-bottom: 24px; }
.q-type-badge { display: inline-block; margin-bottom: 12px; }
.q-text { font-size: 1.1rem; color: var(--text); line-height: 1.7; font-weight: 600; }
.quiz-options { display: flex; flex-direction: column; gap: 10px; margin-bottom: 20px; }
.quiz-option {
  padding: 14px 16px; border: 2px solid #E0E0EC; border-radius: 12px;
  background: #fff; cursor: pointer; transition: all .2s;
  display: flex; align-items: center; gap: 12px; font-size: 0.95rem; color: var(--text);
}
.quiz-option:hover { border-color: var(--primary); background: var(--primary-bg); }
.quiz-option.selected { border-color: var(--primary); background: var(--primary-bg); font-weight: 600; }
.quiz-option.correct { border-color: var(--green); background: var(--green-bg); color: #1a8a4a; }
.quiz-option.wrong { border-color: var(--red); background: var(--red-bg); color: #c0392b; }
.quiz-option.disabled { cursor: default; }
.option-letter {
  width: 28px; height: 28px; border-radius: 50%; background: #E8E8F0;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.85rem; font-weight: 700; color: var(--text-secondary); flex-shrink: 0;
}
.quiz-option.selected .option-letter { background: var(--primary); color: #fff; }
.quiz-option.correct .option-letter { background: var(--green); color: #fff; }
.quiz-option.wrong .option-letter { background: var(--red); color: #fff; }

.quiz-explanation {
  padding: 14px 16px; border-radius: 12px; margin-bottom: 16px;
  font-size: 0.9rem; line-height: 1.6;
}
.quiz-explanation.correct { background: var(--green-bg); border-left: 4px solid var(--green); }
.quiz-explanation.wrong { background: var(--red-bg); border-left: 4px solid var(--red); }
.quiz-explanation-label { font-weight: 700; margin-bottom: 4px; }

.quiz-actions { display: flex; gap: 10px; }
.quiz-actions .btn-primary { width: 100%; }

/* ===== Results ===== */
.result-score {
  text-align: center; padding: 30px 0 20px;
  position: relative; display: flex; justify-content: center;
}
.result-ring { transform: rotate(-90deg); }
.result-ring-bg {
  fill: none; stroke: #F0EEFA; stroke-width: 10;
}
.result-ring-fill {
  fill: none; stroke-width: 10; stroke-linecap: round;
  stroke-dasharray: 427; stroke-dashoffset: 427;
  transition: stroke-dashoffset 1.2s ease;
}
.result-ring-fill.high { stroke: var(--green); }
.result-ring-fill.mid { stroke: var(--amber); }
.result-ring-fill.low { stroke: var(--red); }
.result-score-text {
  position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
  text-align: center;
}
.score-num { font-size: 2.8rem; font-weight: 800; color: var(--text); line-height: 1; }
.score-label { font-size: 0.85rem; color: var(--text-secondary); }

.result-stats { display: flex; justify-content: center; gap: 24px; margin-bottom: 24px; }
.stat-item { text-align: center; }
.stat-num { display: block; font-size: 1.6rem; font-weight: 800; color: var(--text); }
.stat-item.correct .stat-num { color: var(--green); }
.stat-item.wrong .stat-num { color: var(--red); }
.stat-label { font-size: 0.78rem; color: var(--text-secondary); }

.result-review { margin-bottom: 24px; }
.review-item { background: #fff; border-radius: 10px; padding: 14px; margin-bottom: 8px; border: 1px solid var(--border); }
.review-item.wrong { border-left: 3px solid var(--red); }
.review-item.correct { border-left: 3px solid var(--green); }
.review-q { font-size: 0.9rem; color: var(--text); margin-bottom: 6px; }
.review-a { font-size: 0.82rem; color: var(--text-secondary); }
.review-a .right { color: var(--green); font-weight: 600; }
.review-a .yours { color: var(--red); }

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

/* ===== Modal ===== */
.modal-overlay {
  position: fixed; top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(26,26,46,0.5); z-index: 200;
  display: flex; align-items: center; justify-content: center;
  backdrop-filter: blur(4px);
}
.modal {
  background: #fff; border-radius: 20px; width: 90%; max-width: 400px;
  max-height: 80vh; overflow-y: auto;
}
.modal-header {
  display: flex; justify-content: space-between; align-items: center;
  padding: 16px 20px; border-bottom: 1px solid var(--border);
}
.modal-header h3 { font-size: 1.1rem; font-weight: 700; color: var(--text); }
.modal-body { padding: 20px; }

/* ===== Toast ===== */
.toast {
  position: fixed; bottom: 30px; left: 50%; transform: translateX(-50%);
  background: rgba(26,26,46,0.95); color: #fff; padding: 12px 24px;
  border-radius: 12px; font-size: 0.9rem; z-index: 300;
  animation: toastIn .3s ease; max-width: 90%;
}
@keyframes toastIn { from { opacity: 0; transform: translate(-50%, 10px); } to { opacity: 1; transform: translate(-50%, 0); } }

/* ===== Responsive ===== */
@media (min-width: 481px) {
  #app { box-shadow: 0 0 30px rgba(83,74,183,0.08); }
}

/* ===== Login View ===== */
#view-login .login-wrap {
  min-height: 100vh; display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  padding: 40px 24px;
  background: linear-gradient(135deg, #534AB7 0%, #7B6FD9 50%, #6B5FD0 100%);
}
.login-logo { font-size: 3.5rem; margin-bottom: 12px; }
.login-title { font-size: 1.8rem; font-weight: 800; color: #fff; margin-bottom: 6px; }
.login-subtitle { font-size: 0.9rem; color: rgba(255,255,255,0.8); margin-bottom: 28px; text-align: center; }
.login-tabs {
  display: flex; gap: 4px; background: rgba(255,255,255,0.15); border-radius: 12px;
  padding: 4px; margin-bottom: 20px; width: 100%; max-width: 320px;
}
.login-tab {
  flex: 1; padding: 10px; border: none; background: none;
  border-radius: 8px; font-size: 0.9rem; color: rgba(255,255,255,0.7);
  cursor: pointer; transition: all .2s; font-weight: 600;
}
.login-tab.active { background: #fff; color: var(--primary); }
.login-form { width: 100%; max-width: 320px; }
.login-field { margin-bottom: 14px; }
.login-field label {
  display: block; font-size: 0.85rem; color: rgba(255,255,255,0.9);
  margin-bottom: 6px; font-weight: 600;
}
.login-field .text-field {
  background: rgba(255,255,255,0.95); border: none; color: var(--text);
}
.login-field .text-field:focus { border-color: transparent; box-shadow: 0 0 0 3px rgba(255,255,255,0.3); }
.login-form .btn-primary {
  background: #fff; color: var(--primary); margin-top: 8px;
}
.login-form .btn-primary:hover { background: #f0f0f0; box-shadow: 0 4px 16px rgba(0,0,0,0.15); }
.login-hint {
  font-size: 0.82rem; color: rgba(255,255,255,0.8); text-align: center;
  margin-top: 14px; min-height: 20px;
}

/* ===== Header Right ===== */
.header-right { display: flex; align-items: center; gap: 6px; }
.user-avatar-sm {
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--primary); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.8rem; font-weight: 700; cursor: pointer;
  transition: all .2s; border: 2px solid #fff; box-shadow: 0 1px 4px rgba(83,74,183,0.2);
}
.user-avatar-sm:hover { background: var(--primary-dark); transform: scale(1.05); }

/* ===== User Section in Settings ===== */
.user-section {
  display: flex; align-items: center; gap: 12px;
  padding: 14px; background: var(--primary-bg); border-radius: 12px;
}
.user-avatar-lg {
  width: 48px; height: 48px; border-radius: 50%;
  background: var(--primary); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.2rem; font-weight: 700; flex-shrink: 0;
}
.user-info { flex: 1; min-width: 0; }
.user-info-name { font-size: 1rem; font-weight: 700; color: var(--text); }
.user-info-meta { font-size: 0.75rem; color: var(--text-secondary); margin-top: 2px; }
.settings-divider { height: 1px; background: var(--border); margin: 16px 0; }
.logout-btn {
  background: var(--red-bg); color: var(--red); border: 1.5px solid var(--red);
  padding: 10px 20px; border-radius: 12px; font-size: 0.95rem; font-weight: 600;
  cursor: pointer; transition: all .2s; width: 100%;
}
.logout-btn:hover { background: var(--red); color: #fff; }

/* ===== Header hidden on login ===== */
.header.hidden { display: none; }
