/* ========================================
   个人工作台 - ins风设计系统
   ======================================== */

/* ===== Reset & Base ===== */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.5;
  overflow: hidden;
  height: 100vh;
  height: 100dvh;
  transition: background 0.3s ease, color 0.3s ease;
}

a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; border: none; background: none; }
input { font-family: inherit; }

/* ===== CSS Variables: Light Theme (Default) ===== */
:root {
  --bg-primary: #FAFAFA;
  --bg-card: #FFFFFF;
  --bg-nav: #FFFFFF;
  --bg-input: #F5F5F5;
  --bg-tag: #EFEFEF;
  --text-primary: #262626;
  --text-secondary: #8E8E8E;
  --text-tertiary: #C7C7C7;
  --border: #EFEFEF;
  --border-strong: #DBDBDB;
  --accent: #E1306C;
  --accent-2: #F77737;
  --accent-gradient: linear-gradient(135deg, #E1306C 0%, #F77737 100%);
  --accent-soft: rgba(225, 48, 108, 0.08);
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.06);
  --shadow-md: 0 2px 16px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.08);
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --nav-width: 72px;
}

/* ===== Dark Theme ===== */
[data-theme="dark"] {
  --bg-primary: #000000;
  --bg-card: #1C1C1C;
  --bg-nav: #0A0A0A;
  --bg-input: #262626;
  --bg-tag: #2A2A2A;
  --text-primary: #F5F5F5;
  --text-secondary: #999999;
  --text-tertiary: #555555;
  --border: #2A2A2A;
  --border-strong: #3A3A3A;
  --accent-soft: rgba(225, 48, 108, 0.12);
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 2px 16px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.5);
}

/* ===== Skin: 薄荷 ===== */
[data-skin="mint"] {
  --accent: #00C9A7;
  --accent-2: #00B8D9;
  --accent-gradient: linear-gradient(135deg, #00C9A7 0%, #00B8D9 100%);
  --accent-soft: rgba(0, 201, 167, 0.08);
}

/* ===== Skin: 天空 ===== */
[data-skin="sky"] {
  --accent: #5B7CFA;
  --accent-2: #00B8D9;
  --accent-gradient: linear-gradient(135deg, #5B7CFA 0%, #00B8D9 100%);
  --accent-soft: rgba(91, 124, 250, 0.08);
}

/* ===== Skin: 暖橙 ===== */
[data-skin="orange"] {
  --accent: #FF8C42;
  --accent-2: #FFB627;
  --accent-gradient: linear-gradient(135deg, #FF8C42 0%, #FFB627 100%);
  --accent-soft: rgba(255, 140, 66, 0.08);
}

/* ===== Skin: 暗夜 (forces dark) ===== */
[data-skin="dark"] {
  --bg-primary: #000000;
  --bg-card: #1C1C1C;
  --bg-nav: #0A0A0A;
  --bg-input: #262626;
  --bg-tag: #2A2A2A;
  --text-primary: #F5F5F5;
  --text-secondary: #999999;
  --text-tertiary: #555555;
  --border: #2A2A2A;
  --border-strong: #3A3A3A;
  --accent: #BB86FC;
  --accent-2: #03DAC6;
  --accent-gradient: linear-gradient(135deg, #BB86FC 0%, #03DAC6 100%);
  --accent-soft: rgba(187, 134, 252, 0.12);
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 2px 16px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.5);
}

/* ===== App Layout ===== */
#app {
  display: flex;
  height: 100vh;
  height: 100dvh;
  width: 100vw;
  overflow: hidden;
  padding-top: env(safe-area-inset-top);
  padding-bottom: env(safe-area-inset-bottom);
  padding-left: env(safe-area-inset-left);
  background: var(--bg-primary);
}

/* ===== Sidebar Navigation ===== */
#sidebar {
  flex-shrink: 0;
  width: var(--nav-width);
  background: var(--bg-nav);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  align-items: stretch;
  padding: 16px 0 calc(16px + env(safe-area-inset-bottom));
  gap: 4px;
  z-index: 10;
}

.nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 12px 4px;
  margin: 0 8px;
  border-radius: var(--radius-md);
  color: var(--text-tertiary);
  transition: color 0.2s ease, background 0.2s ease;
  position: relative;
}

.nav-item:active {
  background: var(--bg-input);
}

.nav-item.active {
  color: var(--accent);
}

.nav-item.active::before {
  content: '';
  position: absolute;
  top: 4px;
  left: 50%;
  transform: translateX(-50%);
  width: 20px;
  height: 3px;
  background: var(--accent-gradient);
  border-radius: 0 0 3px 3px;
}

.nav-icon {
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.nav-icon svg {
  width: 24px;
  height: 24px;
  stroke: currentColor;
  stroke-width: 1.8;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.nav-label {
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.2px;
}

/* ===== Content Area ===== */
#content {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  padding: 20px 16px 100px;
  position: relative;
}

#content::-webkit-scrollbar { width: 0; }

/* ===== Views ===== */
.view {
  display: none;
  animation: fadeIn 0.25s ease;
}

.view.active {
  display: block;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ===== View Header ===== */
.view-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 20px;
}

.view-header h1 {
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.5px;
}

.view-header .date-badge {
  font-size: 13px;
  color: var(--text-secondary);
  font-weight: 500;
}

/* ===== Cards ===== */
.card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  padding: 18px;
  margin-bottom: 14px;
  transition: background 0.3s ease;
}

.card-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* ===== Schedule Module ===== */
.week-strip {
  display: flex;
  justify-content: space-between;
  gap: 4px;
  margin-bottom: 20px;
}

.week-day {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 10px 4px;
  border-radius: var(--radius-md);
  background: var(--bg-card);
  box-shadow: var(--shadow-sm);
}

.week-day.today {
  background: var(--accent-gradient);
  color: #fff;
}

.week-day .week-label {
  font-size: 11px;
  color: var(--text-secondary);
}

.week-day.today .week-label {
  color: rgba(255, 255, 255, 0.85);
}

.week-day .week-num {
  font-size: 16px;
  font-weight: 700;
}

.schedule-item {
  display: flex;
  align-items: stretch;
  gap: 12px;
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
}

.schedule-item:last-child { border-bottom: none; }

.schedule-time {
  flex-shrink: 0;
  width: 48px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  display: flex;
  align-items: flex-start;
  padding-top: 2px;
}

.schedule-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  margin-top: 6px;
  flex-shrink: 0;
}

.schedule-content { flex: 1; }

.schedule-content .item-title {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 2px;
}

.schedule-content .item-desc {
  font-size: 13px;
  color: var(--text-secondary);
}

/* ===== Accounting Module ===== */
.summary-card {
  background: var(--accent-gradient);
  border-radius: var(--radius-lg);
  padding: 24px 20px;
  margin-bottom: 16px;
  color: #fff;
  box-shadow: var(--shadow-md);
}

.summary-card .summary-label {
  font-size: 13px;
  opacity: 0.85;
  margin-bottom: 4px;
}

.summary-card .summary-amount {
  font-size: 32px;
  font-weight: 700;
  letter-spacing: -1px;
}

.summary-row {
  display: flex;
  gap: 12px;
  margin-top: 16px;
}

.summary-row .summary-item {
  flex: 1;
  background: rgba(255, 255, 255, 0.15);
  border-radius: var(--radius-md);
  padding: 12px;
}

.summary-row .summary-item .label {
  font-size: 11px;
  opacity: 0.85;
  margin-bottom: 2px;
}

.summary-row .summary-item .amount {
  font-size: 18px;
  font-weight: 700;
}

.category-bar {
  display: flex;
  height: 8px;
  border-radius: 4px;
  overflow: hidden;
  margin-bottom: 8px;
  background: var(--bg-input);
}

.category-bar span {
  display: block;
}

.category-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  font-size: 12px;
  color: var(--text-secondary);
}

.category-legend .dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-right: 4px;
}

.entry-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}

.entry-item:last-child { border-bottom: none; }

.entry-icon {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: var(--bg-input);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 16px;
}

.entry-info { flex: 1; }

.entry-info .entry-cat {
  font-size: 14px;
  font-weight: 600;
}

.entry-info .entry-note {
  font-size: 12px;
  color: var(--text-secondary);
}

.entry-amount {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-primary);
}

/* ===== AI Daily Module ===== */
.speed-summary {
  background: var(--accent-gradient);
  border-radius: var(--radius-lg);
  padding: 20px;
  margin-bottom: 16px;
  color: #fff;
  box-shadow: var(--shadow-md);
}

.speed-summary .speed-label {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 1px;
  opacity: 0.85;
  margin-bottom: 8px;
}

.speed-summary .speed-text {
  font-size: 15px;
  line-height: 1.6;
}

.news-item {
  display: flex;
  gap: 12px;
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
}

.news-item:last-child { border-bottom: none; }

.news-source-tag {
  flex-shrink: 0;
  font-size: 11px;
  font-weight: 600;
  color: var(--accent);
  background: var(--accent-soft);
  padding: 3px 8px;
  border-radius: 6px;
  height: fit-content;
  white-space: nowrap;
}

.news-content { flex: 1; }

.news-content .news-title {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 4px;
  line-height: 1.4;
}

.news-content .news-summary {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.news-content .news-link {
  font-size: 12px;
  color: var(--accent);
  margin-top: 6px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.knowledge-card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  padding: 18px;
  margin-bottom: 14px;
  border: 1px solid var(--border);
}

.knowledge-card .knowledge-badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  color: var(--accent);
  background: var(--accent-soft);
  padding: 3px 10px;
  border-radius: 6px;
  margin-bottom: 10px;
}

.knowledge-card .knowledge-title {
  font-size: 17px;
  font-weight: 700;
  margin-bottom: 8px;
  line-height: 1.3;
}

.knowledge-card .knowledge-desc {
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.6;
}

.knowledge-card .knowledge-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 12px;
}

.knowledge-tag {
  font-size: 11px;
  background: var(--bg-tag);
  color: var(--text-secondary);
  padding: 4px 10px;
  border-radius: 6px;
}

/* ===== Language Module ===== */
.lang-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
}

.lang-tab {
  padding: 8px 16px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 600;
  background: var(--bg-card);
  color: var(--text-secondary);
  box-shadow: var(--shadow-sm);
  transition: all 0.2s ease;
}

.lang-tab.active {
  background: var(--accent-gradient);
  color: #fff;
  box-shadow: var(--shadow-md);
}

.article-card {
  display: flex;
  gap: 12px;
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  padding: 14px;
  margin-bottom: 12px;
  align-items: flex-start;
}

.article-thumb {
  width: 64px;
  height: 64px;
  border-radius: var(--radius-md);
  background: var(--bg-input);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
}

.article-info { flex: 1; min-width: 0; }

.article-info .article-title {
  font-size: 15px;
  font-weight: 600;
  line-height: 1.3;
  margin-bottom: 4px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.article-info .article-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--text-secondary);
}

.article-info .article-link {
  font-size: 12px;
  color: var(--accent);
  margin-top: 6px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

/* ===== Settings Module ===== */
.setting-section {
  margin-bottom: 24px;
}

.setting-section h2 {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.skin-grid {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.skin-option {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  cursor: pointer;
}

.skin-circle {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: 3px solid transparent;
  transition: border-color 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.skin-option.active .skin-circle {
  border-color: var(--accent);
}

.skin-option .skin-name {
  font-size: 11px;
  color: var(--text-secondary);
}

.skin-option.active .skin-name {
  color: var(--text-primary);
  font-weight: 600;
}

.weather-card {
  display: flex;
  align-items: center;
  gap: 16px;
}

.weather-icon {
  font-size: 40px;
}

.weather-info { flex: 1; }

.weather-info .weather-city {
  font-size: 16px;
  font-weight: 600;
}

.weather-info .weather-desc {
  font-size: 13px;
  color: var(--text-secondary);
}

.weather-temp {
  font-size: 36px;
  font-weight: 300;
  letter-spacing: -2px;
}

/* ===== FAB ===== */
.fab {
  position: fixed;
  right: 20px;
  bottom: calc(24px + env(safe-area-inset-bottom));
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: var(--accent-gradient);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-lg);
  font-size: 24px;
  z-index: 50;
  transition: transform 0.15s ease;
}

.fab:active {
  transform: scale(0.92);
}

.fab svg {
  width: 24px;
  height: 24px;
  stroke: #fff;
  stroke-width: 2.5;
  fill: none;
  stroke-linecap: round;
}

/* ===== Empty State ===== */
.empty-state {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-tertiary);
}

.empty-state .empty-icon {
  font-size: 40px;
  margin-bottom: 12px;
}

.empty-state .empty-text {
  font-size: 14px;
}

/* ===== Section Divider ===== */
.section-divider {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 20px 0 12px;
}

.section-divider h2 {
  font-size: 16px;
  font-weight: 700;
  white-space: nowrap;
}

.section-divider .line {
  flex: 1;
  height: 1px;
  background: var(--border);
}

/* ===== Modal ===== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  display: none;
  z-index: 100;
  align-items: flex-end;
  justify-content: center;
  padding: 0 0 0 var(--nav-width);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  animation: overlayIn 0.2s ease;
}

.modal-overlay.show {
  display: flex;
}

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

.modal-sheet {
  width: 100%;
  max-width: 480px;
  background: var(--bg-card);
  border-radius: var(--radius-xl) var(--radius-xl) 0 0;
  padding: 24px 20px calc(24px + env(safe-area-inset-bottom));
  box-shadow: var(--shadow-lg);
  animation: sheetIn 0.25s cubic-bezier(0.32, 0.72, 0, 1);
}

@keyframes sheetIn {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}

.modal-handle {
  width: 36px;
  height: 4px;
  background: var(--border-strong);
  border-radius: 2px;
  margin: 0 auto 20px;
}

.modal-title {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 20px;
  text-align: center;
}

/* ===== Form ===== */
.form-group {
  margin-bottom: 16px;
}

.form-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.form-input,
.form-select {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  background: var(--bg-input);
  color: var(--text-primary);
  font-size: 15px;
  outline: none;
  transition: border-color 0.2s ease;
  -webkit-appearance: none;
}

.form-input:focus,
.form-select:focus {
  border-color: var(--accent);
}

.form-row {
  display: flex;
  gap: 12px;
}

.form-row .form-group {
  flex: 1;
}

.form-actions {
  display: flex;
  gap: 12px;
  margin-top: 20px;
}

.btn {
  flex: 1;
  padding: 14px;
  border-radius: var(--radius-md);
  font-size: 15px;
  font-weight: 600;
  transition: opacity 0.15s ease, transform 0.1s ease;
}

.btn:active {
  transform: scale(0.97);
}

.btn-primary {
  background: var(--accent-gradient);
  color: #fff;
  box-shadow: var(--shadow-md);
}

.btn-cancel {
  background: var(--bg-input);
  color: var(--text-secondary);
}

/* ===== Category Picker ===== */
.category-picker {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.cat-pill {
  padding: 8px 14px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 500;
  background: var(--bg-input);
  color: var(--text-secondary);
  border: 1.5px solid transparent;
  transition: all 0.2s ease;
}

.cat-pill.active {
  background: var(--accent-soft);
  color: var(--accent);
  border-color: var(--accent);
}

/* ===== Item Delete Button ===== */
.item-delete {
  opacity: 0.5;
  transition: opacity 0.2s ease;
}

.item-delete:active {
  opacity: 1;
}

/* ===== Week Day Selected ===== */
.week-day.selected {
  background: var(--accent-soft);
  color: var(--accent);
}

/* ===== Utility ===== */
.text-accent { color: var(--accent); }
.text-secondary { color: var(--text-secondary); }
.text-sm { font-size: 13px; }
.font-bold { font-weight: 700; }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 12px; }
