/* ============================================================
   我的工具站 · 全站样式（与已确认的设计稿一致）
   布局：内容居中（最大 860px）｜搜索框在上｜Work 左 / Self 右
   ============================================================ */

:root {
  color-scheme: light dark;
  --accent: #2f6fed;
  --radius: 20px;
  --page-bg: #f4f6f9;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --border: #e2e8f0;
  --text: #1b2530;
  --muted: #5d6b7e;
  --input-bg: #ffffff;
  --green-fg: #157347;
  --green-bg: rgba(21, 115, 71, 0.1);
  --amber-fg: #9a5b0a;
  --amber-bg: rgba(154, 91, 10, 0.1);
  --red-fg: #b3261e;
  --red-bg: rgba(179, 38, 30, 0.08);
  --shadow-sm: 0 1px 2px rgba(20, 30, 45, 0.05);
  --shadow-lg: 0 10px 30px rgba(20, 30, 45, 0.06);
}

@media (prefers-color-scheme: dark) {
  :root {
    --page-bg: #0e141b;
    --surface: #161d27;
    --surface-2: #1b2430;
    --border: #29323e;
    --text: #e7ecf3;
    --muted: #93a0b0;
    --input-bg: #111823;
    --green-fg: #57d68d;
    --green-bg: rgba(87, 214, 141, 0.12);
    --amber-fg: #f5b84c;
    --amber-bg: rgba(245, 184, 76, 0.12);
    --red-fg: #f2867d;
    --red-bg: rgba(242, 134, 125, 0.12);
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 10px 30px rgba(0, 0, 0, 0.25);
  }
}

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB",
    "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  color: var(--text);
  background: var(--page-bg);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

[hidden] { display: none !important; }

a { color: var(--accent); }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.shell {
  width: 100%;
  max-width: 860px;
  margin: 0 auto;
  padding: 0 28px;
}

/* ---------------- 顶部站点栏 ---------------- */

.top-header { padding-top: 40px; }

.header-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 28px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: inherit;
}

.brand-logo {
  width: 36px;
  height: 36px;
  border-radius: 11px;
  flex: none;
  background: var(--accent);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 14px color-mix(in srgb, var(--accent) 35%, transparent);
}

.brand-name { font-size: 17px; font-weight: 600; letter-spacing: 0.2px; }

.brand-tag { margin-left: auto; font-size: 12px; color: var(--muted); }

/* ---------------- 搜索框 ---------------- */

.search-wrap { position: relative; }

.search-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 8px 8px 8px 18px;
  box-shadow: var(--shadow-sm), var(--shadow-lg);
}

.search-bar:focus-within {
  border-color: color-mix(in srgb, var(--accent) 55%, var(--border));
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 16%, transparent);
}

.search-icon { display: flex; color: var(--muted); }

.search-input {
  flex: 1;
  min-width: 0;
  height: 38px;
  border: none;
  outline: none;
  background: transparent;
  color: var(--text);
  font-size: 15px;
  font-family: inherit;
}

.search-input::placeholder { color: var(--muted); }

/* 搜索结果下拉面板 */
.search-results {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  right: 0;
  z-index: 50;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: var(--shadow-sm), var(--shadow-lg);
  padding: 8px;
  max-height: 340px;
  overflow-y: auto;
}

.search-result {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 12px;
  text-decoration: none;
  color: inherit;
}

.search-result:hover { background: color-mix(in srgb, var(--accent) 8%, transparent); }

.sr-icon { display: flex; color: var(--accent); flex: none; }
.sr-main { flex: 1; min-width: 0; }
.sr-title { font-size: 14px; font-weight: 500; }
.sr-desc { font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.search-empty { padding: 14px 12px; font-size: 13px; color: var(--muted); }

/* ---------------- 双区卡片 ---------------- */

.zones {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  margin-top: 24px;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow-sm), var(--shadow-lg);
}

.zone-head {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  margin-bottom: 18px;
}

.zone-icon {
  width: 42px;
  height: 42px;
  border-radius: 13px;
  flex: none;
  display: flex;
  align-items: center;
  justify-content: center;
}

.zone-icon-work {
  background: color-mix(in srgb, var(--accent) 14%, transparent);
  color: var(--accent);
}

.zone-icon-self { background: var(--amber-bg); color: var(--amber-fg); }

.zone-titles { flex: 1; min-width: 0; }

.zone-title { font-size: 18px; font-weight: 600; margin: 0; }

.zone-sub { font-size: 13px; color: var(--muted); margin: 3px 0 0; }

/* 标签胶囊 */
.pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  flex: none;
  font-size: 12px;
  font-weight: 500;
  padding: 4px 10px;
  border-radius: 999px;
}

.pill-green { background: var(--green-bg); color: var(--green-fg); }
.pill-amber { background: var(--amber-bg); color: var(--amber-fg); }

/* Work 工具列表 */
.entry-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.entry-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 12px;
  border-radius: 12px;
  text-decoration: none;
  color: inherit;
}

.entry-item:hover { background: color-mix(in srgb, var(--accent) 8%, transparent); }

.entry-icon { display: flex; color: var(--accent); flex: none; }
.entry-name { font-size: 14px; font-weight: 500; }
.entry-note { margin-left: auto; font-size: 12px; color: var(--muted); }
.entry-chevron { display: flex; color: var(--muted); flex: none; }

.more-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-top: 14px;
  font-size: 13px;
  font-weight: 500;
  text-decoration: none;
}

.more-link:hover { text-decoration: underline; }

/* ---------------- 表单 ---------------- */

.login-form, .field-group { display: flex; flex-direction: column; gap: 14px; }

.field { display: flex; flex-direction: column; gap: 6px; }

.field-label { font-size: 13px; font-weight: 500; color: var(--muted); }

.input {
  height: 42px;
  width: 100%;
  padding: 0 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--input-bg);
  color: var(--text);
  font-size: 14px;
  font-family: inherit;
}

.textarea {
  height: auto;
  min-height: 160px;
  padding: 12px 14px;
  resize: vertical;
  line-height: 1.6;
}

.input::placeholder, .textarea::placeholder { color: var(--muted); }

.input:focus {
  outline: none;
  border-color: color-mix(in srgb, var(--accent) 60%, var(--border));
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 16%, transparent);
}

.select {
  appearance: none;
  padding-right: 36px;
  background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%235d6b7e' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
}

/* ---------------- 按钮 ---------------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  height: 42px;
  padding: 0 20px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  color: var(--text);
  font-size: 14px;
  font-weight: 500;
  font-family: inherit;
  text-decoration: none;
  cursor: pointer;
}

.btn:hover { background: color-mix(in srgb, var(--accent) 7%, var(--surface)); }

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

.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.btn-primary:hover { background: color-mix(in srgb, var(--accent) 86%, #000); }

.btn-sm { height: 36px; padding: 0 14px; font-size: 13px; }

.btn-block { width: 100%; }

.search-btn {
  flex: none;
  height: 40px;
  padding: 0 22px;
  border-radius: calc(var(--radius) - 8px);
}

/* ---------------- 提示 / 错误 ---------------- */

.form-hint {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--muted);
  margin: 0;
}

.form-error {
  display: flex;
  align-items: flex-start;
  gap: 6px;
  font-size: 13px;
  color: var(--red-fg);
  background: var(--red-bg);
  border-radius: 10px;
  padding: 10px 12px;
  margin: 0;
}

/* 已登录状态 */
.logged-in { display: flex; flex-direction: column; gap: 16px; }

.logged-in-text { font-size: 14px; margin: 0; }

.logged-in-actions { display: flex; flex-wrap: wrap; gap: 10px; }

/* ---------------- 页脚 ---------------- */

.site-footer {
  margin-top: 40px;
  padding: 22px 0 30px;
  text-align: center;
  font-size: 12px;
  color: var(--muted);
}

/* ---------------- 子页面通用 ---------------- */

.page-main { flex: 1; padding-bottom: 20px; }

.page-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 36px 0 24px;
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 500;
  text-decoration: none;
  color: var(--muted);
}

.back-link:hover { color: var(--accent); }

.page-title { font-size: 24px; font-weight: 700; margin: 0 0 6px; }

.page-lead { font-size: 14px; color: var(--muted); margin: 0 0 24px; }

/* 工具网格（Work / Self 列表页） */
.tool-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
}

.tool-tile {
  display: flex;
  flex-direction: column;
  gap: 10px;
  text-decoration: none;
  color: inherit;
}

a.tool-tile:hover { border-color: color-mix(in srgb, var(--accent) 45%, var(--border)); }

.tool-tile-icon {
  width: 38px;
  height: 38px;
  border-radius: 11px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: color-mix(in srgb, var(--accent) 14%, transparent);
  color: var(--accent);
}

.tool-tile-icon-amber { background: var(--amber-bg); color: var(--amber-fg); }

.tool-name { font-size: 15px; font-weight: 600; }

.tool-desc { font-size: 13px; color: var(--muted); margin: 0; }

/* ---------------- 工具页 ---------------- */

.tool-page { max-width: 720px; }

.tool-card { display: flex; flex-direction: column; gap: 16px; }

.seg-tabs { display: flex; gap: 8px; flex-wrap: wrap; }

.seg-btn {
  height: 36px;
  padding: 0 16px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--muted);
  font-size: 13px;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
}

.seg-btn:hover { color: var(--text); }

.seg-btn.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.convert-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.convert-result {
  grid-column: 1 / -1;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 18px 20px;
  text-align: center;
}

.result-value { font-size: 26px; font-weight: 700; font-variant-numeric: tabular-nums; word-break: break-all; }
.result-unit { font-size: 13px; color: var(--muted); margin-top: 2px; }

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

.tool-status { font-size: 13px; margin: 0; min-height: 20px; }
.tool-status.ok { color: var(--green-fg); }
.tool-status.err { color: var(--red-fg); }

/* ---------------- 文章/资料页 ---------------- */

.article { max-width: 720px; }

.article-meta { font-size: 12px; color: var(--muted); margin: 0 0 24px; }

.article-body h2 { font-size: 18px; margin: 28px 0 10px; }
.article-body p { margin: 0 0 14px; }
.article-body ul, .article-body ol { margin: 0 0 14px; padding-left: 22px; }
.article-body li { margin: 4px 0; }
.article-body code {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 1px 6px;
  font-size: 13px;
}
.article-body pre {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px 16px;
  overflow-x: auto;
}
.article-body pre code { background: none; border: none; padding: 0; }

/* 提示卡 */
.notice-card h2 { font-size: 15px; margin: 0 0 10px; display: flex; align-items: center; gap: 8px; }
.notice-card ul { margin: 0; padding-left: 20px; color: var(--muted); }
.notice-card li { margin: 5px 0; font-size: 13px; }

/* ---------------- 响应式 ---------------- */

@media (max-width: 680px) {
  .shell { padding: 0 16px; }
  .top-header { padding-top: 24px; }
  .header-row { margin-bottom: 20px; }
  .zones, .tool-grid, .convert-row { grid-template-columns: 1fr; }
  .brand-tag { display: none; }
}
