/* ============================================================
   善器仓 · Modules Stylesheet
   明亮温暖 · 浅色主题
   ============================================================ */

/* ---------- Home / Hero ---------- */
.hero {
  display: flex; align-items: center; justify-content: space-between;
  gap: 24px; margin-bottom: 22px; flex-wrap: wrap;
}
.hero-text { flex: 1; min-width: 260px; }
.brand-title {
  font-size: 52px; font-weight: 800; letter-spacing: 2px; line-height: 1.1;
  background: var(--accent-grad); -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 4px 24px rgba(44,167,127,.2));
}
.brand-slogan { color: var(--text-soft); font-size: 15px; margin-top: 8px; letter-spacing: .5px; }

.hero-clock {
  min-width: 230px; text-align: right; position: relative; overflow: hidden;
}
.hero-clock::before {
  content:''; position:absolute; top:-30px; right:-30px; width:120px; height:120px;
  background: var(--accent-grad); filter: blur(40px); opacity:.15; border-radius:50%;
}
.clock-time {
  font-family: var(--font-mono); font-size: 38px; font-weight: 700;
  letter-spacing: 2px; background: var(--accent-grad); -webkit-background-clip: text;
  background-clip: text; -webkit-text-fill-color: transparent; position: relative;
}
.clock-date { color: var(--text-soft); font-size: 13px; margin-top: 4px; position: relative; }

/* ---------- Search ---------- */
.search-wrap { margin-bottom: 22px; }
.search-input { display: flex; align-items: center; gap: 10px; position: relative; }
.search-icon { width: 20px; height: 20px; color: var(--text-dim); position: absolute; left: 16px; pointer-events: none; }
.search-input input {
  flex: 1; padding: 15px 16px 15px 46px;
  background: var(--bg-soft); border: 1px solid var(--glass-border);
  border-radius: 13px; color: var(--text); font-size: 15px; outline: none;
  transition: all var(--t-fast) var(--ease);
}
.search-input input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(44,167,127,.1); background: #fff; }
.search-engs { display: flex; gap: 8px; }
.search-eng {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 12px 18px; border-radius: 13px; font-size: 14px; font-weight: 600;
  background: var(--surface); border: 1px solid var(--glass-border);
  color: var(--text); transition: all var(--t-fast) var(--ease); white-space: nowrap;
  box-shadow: var(--shadow-sm);
}
.search-eng:hover { color: var(--accent); border-color: var(--glass-border-strong); transform: translateY(-1px); box-shadow: var(--shadow); }
.search-eng.active { color: #fff; border-color: transparent; }
.search-eng.active[data-engine="baidu"] { background: linear-gradient(135deg, #3385ff, #2d6ce0); box-shadow: 0 4px 14px rgba(51,133,255,.3); }
.search-eng.active[data-engine="google"] { background: linear-gradient(135deg, #4285f4, #ea4335); box-shadow: 0 4px 14px rgba(66,133,244,.3); }
.eng-ic { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; font-size: 11px; font-weight: 800; color: #fff; flex: none; }
.eng-ic.baidu { background: #fff; color: #2932e1; }
.eng-ic.google { background: #fff; color: #4285f4; }

/* ---------- Grid helpers ---------- */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; margin-bottom: 22px; }
.section-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.section-head h2 { font-size: 18px; font-weight: 700; color: var(--text); }

/* ---------- Quick note ---------- */
#quickNote { font-size: 13.5px; }

/* ---------- App launch grid ---------- */
.app-launch-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-top: 12px; }
.app-launch {
  display: flex; flex-direction: column; align-items: center; gap: 7px;
  padding: 14px 6px; border-radius: 13px; cursor: pointer;
  background: var(--bg-soft); border: 1px solid var(--glass-border);
  transition: all var(--t-fast) var(--ease); text-align: center;
}
.app-launch:hover { border-color: var(--glass-border-strong); background: var(--accent-grad-soft); transform: translateY(-2px); }
.app-launch .ic { width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; background: var(--accent-grad); color: #fff; }
.app-launch .ic svg { width: 16px; height: 16px; }
.app-launch span { font-size: 11.5px; color: var(--text-soft); }

/* ---------- Nav categories ---------- */
.nav-cat { margin-bottom: 22px; }
.nav-cat-head { display: flex; align-items: center; gap: 9px; margin-bottom: 12px; }
.nav-cat-head .cat-icon { width: 26px; height: 26px; border-radius: 8px; display: grid; place-items: center; background: var(--accent-grad-soft); border: 1px solid var(--glass-border); }
.nav-cat-head .cat-icon svg { width: 14px; height: 14px; color: var(--accent); }
.nav-cat-head h3 { font-size: 15px; font-weight: 600; color: var(--text); }
.nav-cat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px; }
.nav-site {
  position: relative; display: flex; align-items: center; gap: 11px;
  padding: 13px 14px; border-radius: 14px; cursor: pointer;
  background: var(--surface); border: 1px solid var(--glass-border);
  transition: all var(--t) var(--ease); overflow: hidden;
  box-shadow: var(--shadow-sm);
}
.nav-site::after {
  content:''; position:absolute; inset:0; background: var(--accent-grad-soft);
  opacity: 0; transition: opacity var(--t); pointer-events: none;
}
.nav-site:hover { border-color: var(--glass-border-strong); transform: translateY(-3px); box-shadow: var(--shadow); }
.nav-site:hover::after { opacity: 1; }
.nav-site .site-ic {
  width: 36px; height: 36px; flex: none; border-radius: 10px; display: grid; place-items: center;
  font-weight: 700; font-size: 15px; color: #fff; background: var(--accent-grad);
  box-shadow: 0 2px 8px rgba(44,167,127,.2); position: relative; z-index: 1; overflow: hidden;
}
.nav-site .site-ic img { width: 100%; height: 100%; object-fit: cover; background: #fff; }
.nav-site .site-info { position: relative; z-index: 1; min-width: 0; }
.nav-site .site-name { font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--text); }
.nav-site .site-url { font-size: 11px; color: var(--text-dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nav-site .site-actions { position: absolute; top: 6px; right: 6px; display: flex; gap: 3px; opacity: 0; transition: opacity var(--t-fast); z-index: 2; }
.nav-site:hover .site-actions { opacity: 1; }
.site-actions button { width: 24px; height: 24px; border-radius: 7px; display: grid; place-items: center; background: rgba(255,255,255,.9); border: 1px solid var(--glass-border); color: var(--text-soft); box-shadow: var(--shadow-sm); }
.site-actions button:hover { color: var(--accent); background: #fff; }
.site-actions button svg { width: 12px; height: 12px; }

/* ============================================================
   FocusFlow
   ============================================================ */
.ff-layout { display: grid; grid-template-columns: 380px 1fr; gap: 18px; align-items: start; }
.ff-pomodoro { text-align: center; }
.ff-timer-ring { position: relative; width: 220px; height: 220px; margin: 6px auto 18px; }
.ring-svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring-bg { fill: none; stroke: rgba(44,167,127,.08); stroke-width: 8; }
.ring-fg { fill: none; stroke: url(#grad); stroke: var(--accent); stroke-width: 8; stroke-linecap: round; stroke-dasharray: 553; stroke-dashoffset: 0; transition: stroke-dashoffset 1s linear; filter: drop-shadow(0 0 6px rgba(44,167,127,.3)); }
.ff-timer-center { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.ff-timer-display { font-family: var(--font-mono); font-size: 42px; font-weight: 700; letter-spacing: 1px; color: var(--text); }
.ff-timer-label { font-size: 12px; color: var(--text-dim); margin-top: 2px; letter-spacing: 1px; }
.ff-controls { display: flex; gap: 8px; justify-content: center; margin-bottom: 20px; }
.ff-stats { display: flex; gap: 8px; }
.ff-stat { flex: 1; padding: 12px 6px; border-radius: 12px; background: var(--bg-soft); border: 1px solid var(--glass-border); }
.ff-stat-num { font-size: 22px; font-weight: 700; color: var(--accent); font-family: var(--font-mono); }
.ff-stat-label { font-size: 11px; color: var(--text-dim); margin-top: 2px; }
.ff-config { display: flex; align-items: center; gap: 8px; justify-content: center; margin-top: 16px; flex-wrap: wrap; }
.ff-config label { font-size: 11px; }

.todo-list { display: flex; flex-direction: column; gap: 7px; max-height: 460px; overflow-y: auto; }
.todo-item { display: flex; align-items: center; gap: 11px; padding: 11px 13px; border-radius: 11px; background: var(--bg-soft); border: 1px solid var(--glass-border); transition: all var(--t-fast); }
.todo-item:hover { border-color: var(--glass-border-strong); }
.todo-item.active { border-color: var(--accent); box-shadow: 0 0 0 1px rgba(44,167,127,.15); }
.todo-item .chk .box { flex: none; }
.todo-text { flex: 1; font-size: 13.5px; cursor: pointer; color: var(--text); }
.todo-item.done .todo-text { color: var(--text-dim); text-decoration: line-through; }
.todo-pomo { font-size: 11px; color: var(--accent); font-family: var(--font-mono); }
.todo-del { width: 26px; height: 26px; border-radius: 8px; display: grid; place-items: center; color: var(--text-faint); opacity: 0; transition: all var(--t-fast); }
.todo-item:hover .todo-del { opacity: 1; }
.todo-del:hover { color: var(--danger); background: rgba(220,68,68,.06); }
.todo-del svg { width: 14px; height: 14px; }

/* ============================================================
   Knowledge Base
   ============================================================ */
.kb-layout { display: grid; grid-template-columns: 280px 1fr; gap: 18px; height: calc(100vh - 130px); }
.kb-sidebar { display: flex; flex-direction: column; overflow: hidden; }
.kb-search { padding: 0 14px 10px; }
.kb-list { flex: 1; overflow-y: auto; padding: 0 8px 12px; }
.kb-item { padding: 11px 13px; border-radius: 11px; cursor: pointer; transition: all var(--t-fast); margin-bottom: 4px; border: 1px solid transparent; }
.kb-item:hover { background: var(--bg-soft); }
.kb-item.active { background: var(--accent-grad-soft); border-color: var(--glass-border); }
.kb-item .kb-title { font-size: 13.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--text); }
.kb-item .kb-meta { font-size: 11px; color: var(--text-dim); margin-top: 3px; }
.kb-editor { overflow-y: auto; }
.kb-editor-head { display: flex; gap: 8px; margin-bottom: 14px; }
.kb-title-input { flex: 1; }
.kb-body { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.kb-textarea { min-height: 480px; font-family: var(--font-mono); font-size: 13px; line-height: 1.7; }
.kb-preview { min-height: 480px; padding: 14px 16px; background: var(--bg-soft); border: 1px solid var(--glass-border); border-radius: 11px; overflow-y: auto; }
.kb-preview h1,.kb-preview h2,.kb-preview h3 { margin: 14px 0 8px; font-weight: 700; color: var(--text); }
.kb-preview h1 { font-size: 22px; } .kb-preview h2 { font-size: 18px; } .kb-preview h3 { font-size: 15px; }
.kb-preview p { margin: 8px 0; color: var(--text-soft); }
.kb-preview code { background: rgba(44,167,127,.08); padding: 2px 6px; border-radius: 5px; font-family: var(--font-mono); font-size: 12.5px; color: var(--accent); }
.kb-preview pre { background: var(--bg-deep); padding: 12px; border-radius: 9px; overflow-x: auto; margin: 10px 0; border: 1px solid var(--glass-border); }
.kb-preview pre code { background: none; padding: 0; color: var(--text); }
.kb-preview ul,.kb-preview ol { padding-left: 22px; margin: 8px 0; color: var(--text-soft); }
.kb-preview blockquote { border-left: 3px solid var(--accent); padding-left: 12px; margin: 10px 0; color: var(--text-dim); }
.kb-preview a { color: var(--accent); text-decoration: underline; }
.kb-preview table { border-collapse: collapse; width: 100%; margin: 10px 0; }
.kb-preview th,.kb-preview td { border: 1px solid var(--glass-border); padding: 8px; font-size: 13px; }
.kb-preview img { border-radius: 9px; margin: 10px 0; }

/* ============================================================
   AI Diary
   ============================================================ */
.diary-layout { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.diary-todos { display: flex; flex-direction: column; gap: 6px; max-height: 160px; overflow-y: auto; }
.diary-todo { display: flex; align-items: center; gap: 9px; padding: 8px 11px; border-radius: 9px; background: var(--bg-soft); border: 1px solid var(--glass-border); font-size: 13px; color: var(--text); }
.diary-output { min-height: 200px; }
.diary-output .ai-content { font-size: 14px; line-height: 1.85; color: var(--text-soft); }
.diary-output .ai-content p { margin: 10px 0; }
.diary-output .ai-content h2,.diary-output .ai-content h3 { margin: 16px 0 8px; color: var(--text); }
.diary-loading { display: flex; align-items: center; gap: 10px; color: var(--accent); font-size: 13px; }
.diary-loading .spin { width: 16px; height: 16px; border: 2px solid rgba(44,167,127,.2); border-top-color: var(--accent); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.diary-history { margin-top: 18px; border-top: 1px solid var(--glass-border); padding-top: 14px; }
.diary-history h4 { font-size: 12px; color: var(--text-dim); margin-bottom: 10px; letter-spacing: 1px; }
.diary-hist-item { padding: 9px 12px; border-radius: 9px; background: var(--bg-soft); border: 1px solid var(--glass-border); margin-bottom: 6px; font-size: 12.5px; cursor: pointer; transition: all var(--t-fast); color: var(--text-soft); }
.diary-hist-item:hover { border-color: var(--glass-border-strong); background: #fff; }

/* ============================================================
   Finance
   ============================================================ */
.fin-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin-bottom: 18px; }
.fin-stat-card { padding: 18px; border-radius: var(--radius-lg); background: var(--surface); border: 1px solid var(--glass-border); position: relative; overflow: hidden; box-shadow: var(--shadow-sm); }
.fin-stat-card .lbl { font-size: 12px; color: var(--text-dim); }
.fin-stat-card .val { font-size: 26px; font-weight: 700; font-family: var(--font-mono); margin-top: 4px; }
.fin-stat-card.income .val { color: var(--ok); }
.fin-stat-card.expense .val { color: var(--danger); }
.fin-stat-card.balance .val { color: var(--accent); }
.fin-tags { display: flex; flex-wrap: wrap; gap: 8px; }
.fin-tag { padding: 7px 14px; border-radius: 20px; font-size: 12.5px; cursor: pointer; background: var(--bg-soft); border: 1px solid var(--glass-border); color: var(--text-soft); transition: all var(--t-fast); }
.fin-tag:hover { color: var(--text); border-color: var(--glass-border-strong); }
.fin-tag.active { background: var(--accent-grad); border-color: transparent; color: #fff; }
.fin-list { max-height: 360px; overflow-y: auto; }
.fin-row { display: flex; align-items: center; gap: 12px; padding: 11px 4px; border-bottom: 1px solid var(--glass-border); }
.fin-row:last-child { border-bottom: none; }
.fin-row .fin-ic { width: 34px; height: 34px; border-radius: 9px; display: grid; place-items: center; font-size: 15px; }
.fin-row .fin-ic.expense { background: rgba(220,68,68,.08); }
.fin-row .fin-ic.income { background: rgba(44,167,127,.08); }
.fin-row .fin-info { flex: 1; }
.fin-row .fin-cat { font-size: 13px; font-weight: 600; color: var(--text); }
.fin-row .fin-note { font-size: 11.5px; color: var(--text-dim); }
.fin-row .fin-amt { font-family: var(--font-mono); font-weight: 700; font-size: 14px; }
.fin-row .fin-amt.expense { color: var(--danger); }
.fin-row .fin-amt.income { color: var(--ok); }
.fin-row .fin-del { width: 26px; height: 26px; border-radius: 7px; display: grid; place-items: center; color: var(--text-faint); opacity: 0; transition: all var(--t-fast); }
.fin-row:hover .fin-del { opacity: 1; }
.fin-row .fin-del:hover { color: var(--danger); }

/* ============================================================
   Habit
   ============================================================ */
.habit-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 16px; }
.habit-card { padding: 18px; border-radius: var(--radius-lg); background: var(--surface); border: 1px solid var(--glass-border); transition: all var(--t); box-shadow: var(--shadow-sm); }
.habit-card:hover { border-color: var(--glass-border-strong); box-shadow: var(--shadow); }
.habit-head { display: flex; align-items: center; gap: 11px; margin-bottom: 14px; }
.habit-ic { width: 38px; height: 38px; border-radius: 11px; display: grid; place-items: center; font-size: 19px; background: var(--accent-grad-soft); border: 1px solid var(--glass-border); }
.habit-name { flex: 1; font-size: 14px; font-weight: 600; color: var(--text); }
.habit-streak { display: flex; align-items: center; gap: 5px; font-size: 18px; font-weight: 700; color: var(--warn); font-family: var(--font-mono); }
.habit-week { display: grid; grid-template-columns: repeat(7, 1fr); gap: 5px; margin-bottom: 12px; }
.habit-day { aspect-ratio: 1; border-radius: 7px; display: grid; place-items: center; font-size: 10px; color: var(--text-dim); background: var(--bg-soft); border: 1px solid var(--glass-border); position: relative; }
.habit-day.done { background: var(--accent-grad); border-color: transparent; color: #fff; }
.habit-day.today { box-shadow: 0 0 0 2px var(--accent); }
.habit-actions { display: flex; gap: 8px; }
.habit-check { flex: 1; padding: 10px; border-radius: 11px; font-weight: 600; font-size: 13px; background: var(--bg-soft); border: 1px solid var(--glass-border); transition: all var(--t-fast); color: var(--text); }
.habit-check.done { background: var(--accent-grad); border-color: transparent; color: #fff; }
.habit-check:hover { transform: translateY(-1px); }
.habit-mini-del { width: 38px; border-radius: 11px; background: var(--bg-soft); border: 1px solid var(--glass-border); color: var(--text-faint); }
.habit-mini-del:hover { color: var(--danger); }

/* ============================================================
   Bookmark
   ============================================================ */
.bm-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 10px; }
.bm-item { position: relative; display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 16px 8px; border-radius: 13px; cursor: pointer; background: var(--bg-soft); border: 1px solid var(--glass-border); transition: all var(--t-fast); }
.bm-item:hover { border-color: var(--glass-border-strong); transform: translateY(-2px); background: var(--accent-grad-soft); }
.bm-item .bm-ic { width: 40px; height: 40px; border-radius: 11px; display: grid; place-items: center; font-weight: 700; color: #fff; background: var(--accent-grad); }
.bm-item .bm-name { font-size: 12px; color: var(--text-soft); text-align: center; }
.bm-item .bm-del { position: absolute; top: 5px; right: 5px; width: 22px; height: 22px; border-radius: 6px; display: grid; place-items: center; color: var(--text-faint); opacity: 0; background: rgba(255,255,255,.8); }
.bm-item:hover .bm-del { opacity: 1; }
.bm-item .bm-del:hover { color: var(--danger); }

/* ============================================================
   Calculator & Convert
   ============================================================ */
.calc-layout { display: grid; grid-template-columns: 340px 1fr; gap: 18px; align-items: start; }
.calc-screen { background: var(--bg-soft); border: 1px solid var(--glass-border); border-radius: 13px; padding: 18px 20px; text-align: right; margin-bottom: 14px; font-family: var(--font-mono); font-size: 30px; font-weight: 600; min-height: 68px; overflow-x: auto; color: var(--text); }
.calc-keys { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.calc-key { padding: 16px 0; border-radius: 11px; font-size: 17px; font-weight: 600; background: var(--surface); border: 1px solid var(--glass-border); transition: all var(--t-fast); color: var(--text); box-shadow: var(--shadow-sm); }
.calc-key:hover { background: var(--bg-soft); border-color: var(--glass-border-strong); }
.calc-key:active { transform: scale(.95); }
.calc-key.op { color: var(--accent); }
.calc-key.eq { background: var(--accent-grad); border: none; color: #fff; box-shadow: 0 4px 14px rgba(44,167,127,.25); }
.calc-key.fn { color: var(--warn); }
.calc-key.span2 { grid-column: span 2; }

.conv-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.conv-eq { text-align: center; font-size: 20px; color: var(--text-dim); margin: 10px 0; }
.conv-note { font-size: 11.5px; color: var(--text-faint); margin-top: 12px; text-align: center; }

/* ---------- Responsive ---------- */
@media (max-width: 1100px) {
  .ff-layout, .calc-layout, .diary-layout { grid-template-columns: 1fr; }
  .kb-layout { grid-template-columns: 220px 1fr; }
  .kb-body { grid-template-columns: 1fr; }
}
@media (max-width: 980px) {
  .grid-2 { grid-template-columns: 1fr; }
  .fin-stats { grid-template-columns: 1fr; }
  .kb-layout { grid-template-columns: 1fr; height: auto; }
  .app-launch-grid { grid-template-columns: repeat(3, 1fr); }
  .brand-title { font-size: 38px; }
  .clock-time { font-size: 30px; }
}
@media (max-width: 640px) {
  .hero { flex-direction: column; align-items: flex-start; }
  .hero-clock { text-align: left; min-width: 0; width: 100%; }
  .nav-cat-grid { grid-template-columns: 1fr 1fr; }
  .habit-week { gap: 3px; }
  .search-input input { font-size: 13px; }
}
