/* 实用工具 · 早期桌面窗口风格（蓝色标题栏、米色面板、任务栏）。全部用 CSS 绘制，不使用任何系统商标或位图素材。 */
:root {
  /* 保留旧变量名，供页面内联样式使用 */
  --paper: #ffffff;
  --paper-2: #f1efe2;
  --card: #ffffff;
  --ink: #000000;
  --ink-2: #3d3d3d;
  --ink-3: #6f6f6f;
  --rule: #c9c5b4;
  --cinnabar: #c8401c;
  --cinnabar-soft: #c8401c1f;
  --jade: #2a7d2e;
  --jade-soft: #2a7d2e1f;
  --gold: #e8a317;

  --face: #ece9d8;            /* 面板底色 */
  --face-hi: #f7f6ef;
  --edge: #aca899;            /* 面板边线 */
  --field: #7f9db9;           /* 输入框边线 */
  --sel: #316ac5;             /* 选中蓝 */
  --link: #0b4fc4;
  --title-ink: #0a2a7d;

  --serif: Tahoma, "Microsoft YaHei", "PingFang SC", "Hiragino Sans GB", "Noto Sans CJK SC", sans-serif;
  --sans: Tahoma, "Microsoft YaHei", "PingFang SC", "Hiragino Sans GB", "Noto Sans CJK SC", sans-serif;
  --mono: "Lucida Console", Consolas, "SF Mono", Menlo, monospace;
  --radius: 3px;
  --shadow: 0 1px 0 #fff inset;
  color-scheme: light;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; color: var(--ink); font: 13px/1.6 var(--sans); background: #fff;
}
a { color: var(--link); }
a:hover { color: #e06a00; }
img { max-width: 100%; }
[hidden] { display: none !important; }
::selection { background: var(--sel); color: #fff; }
h1, h2, h3 { font-family: var(--sans); line-height: 1.35; }

/* ---------- 图标：内联 SVG ---------- */
.ico { --s: 24px; flex: none; display: inline-block; width: var(--s); height: var(--s); vertical-align: middle; filter: drop-shadow(0 1px 1px #0003); }
.ico svg { display: block; width: 100%; height: 100%; overflow: visible; }
.ico-xs { --s: 16px; } .ico-sm { --s: 18px; } .ico-md { --s: 26px; } .ico-lg { --s: 40px; } .ico-xl { --s: 60px; }

.wrap { padding: 18px 24px 26px; }

/* ---------- 页面标题与章节 ---------- */
.page-head { margin: -18px -22px 20px; padding: 16px 22px 14px; background: linear-gradient(90deg, #f3f6fd, #fff 70%); border-bottom: 1px solid #c5d2ef; }
.crumb { font-size: 12px; color: #666; }
.crumb a { color: #666; }
h1 { font-size: 22px; margin: 4px 0 6px; color: var(--title-ink); }
.page-head p { margin: 0; color: #444; max-width: 52em; }
h2 { font-size: 15px; margin: 28px 0 10px; color: #215dc6; padding-bottom: 4px; border-bottom: 0; background: linear-gradient(90deg, #4a7fe0, #c5d6f5 45%, transparent) bottom / 100% 1px no-repeat; }
h3 { font-size: 13px; margin: 18px 0 6px; color: #333; }

/* ---------- 面板、表单与按钮 ---------- */
.panel { background: linear-gradient(180deg, #fbfbf8, #f3f1e7); border: 1px solid #d0ccbb; border-radius: 4px; padding: 16px; }
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 320px), 1fr)); gap: 14px; }
.row { display: flex; flex-wrap: wrap; gap: 12px; align-items: end; }
.row > * { flex: 1 1 160px; }
.row > .shrink { flex: 0 0 auto; }
label { display: grid; gap: 4px; font-size: 12px; color: #333; }
input, select, textarea, button { font: inherit; color: inherit; }
input[type="text"], input[type="number"], input[type="date"], input[type="datetime-local"], select, textarea {
  width: 100%; background: #fff; border: 1px solid var(--field); border-radius: 0; padding: 4px 6px; outline: none; font-size: 13px; min-height: 26px;
}
select { padding-right: 4px; }
textarea { font-family: var(--mono); font-size: 12.5px; line-height: 1.55; min-height: 220px; resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: var(--sel); box-shadow: 0 0 0 1px #316ac555; }
input[type="range"] { accent-color: #2f9a24; }
input[type="checkbox"], input[type="radio"] { accent-color: #2f9a24; }
.btns { display: flex; flex-wrap: wrap; gap: 8px; margin-block: 12px; align-items: center; }
.btn {
  min-width: 75px; padding: 4px 14px; cursor: pointer; font-size: 13px; color: #000;
  border: 1px solid #003c74; border-radius: 3px;
  background: linear-gradient(180deg, #fff 0%, #f4f3ee 40%, #ece9d8 86%, #d6d0c5 100%);
  box-shadow: inset 0 -1px 0 #0000000d;
}
.btn:hover { box-shadow: inset 0 0 0 1px #fce4a8, inset 0 0 0 2px #f8b636; }
.btn:active { background: linear-gradient(180deg, #e5e3d6, #f0eee3); }
.btn:focus-visible { outline: 1px dotted #000; outline-offset: -4px; }
.btn:disabled { color: #a3a090; border-color: #c9c7ba; cursor: default; box-shadow: none; }
.btn:not(.ghost) { font-weight: 700; }
.btn.ghost { font-weight: 400; }
.seg { display: inline-flex; flex-wrap: wrap; border-bottom: 1px solid #919b9c; gap: 0; padding-left: 2px; }
.seg button {
  border: 1px solid #919b9c; border-bottom: 0; margin-right: -1px; border-radius: 3px 3px 0 0; padding: 3px 12px; cursor: pointer; font-size: 13px;
  background: linear-gradient(180deg, #fff, #f2f1ea 60%, #e7e5da); position: relative; top: 1px;
}
.seg button:hover { box-shadow: inset 0 2px 0 #f8b636; }
.seg button[aria-pressed="true"] { background: #fcfcfe; box-shadow: inset 0 3px 0 #e68b2c; z-index: 1; padding-bottom: 5px; top: 1px; font-weight: 700; }
.check { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: #222; }
.error { color: #8a1f00; background: #fff4ec; border: 1px solid #e5a07a; padding: 6px 10px 6px 34px; font-size: 13px; margin-top: 10px; white-space: pre-wrap; position: relative; border-radius: 3px; }
.error::before { content: "×"; position: absolute; left: 8px; top: 50%; margin-top: -9px; width: 18px; height: 18px; border-radius: 50%; background: radial-gradient(circle at 35% 30%, #ff9b7a, #d8320c 60%, #9c1f02); color: #fff; font: 700 14px/18px var(--sans); text-align: center; }
.note { font-size: 12px; color: #666; }
.mono { font-family: var(--mono); }

/* 结果格：属性表风格 */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 6px; margin-top: 14px; }
.stat { background: #fff; border: 1px solid; border-color: #aca899 #fff #fff #aca899; box-shadow: inset 1px 1px 0 #716f64; padding: 8px 10px; }
.stat small { display: block; color: #555; font-size: 11.5px; }
.stat b { font: 700 18px/1.4 var(--mono); font-variant-numeric: tabular-nums; color: #000; }
.stat.hl { background: #fffbe6; }
.stat.hl b { color: #0b3fae; }
/* 列表视图表格 */
.table-wrap { overflow-x: auto; margin-top: 12px; border: 1px solid #7f9db9; background: #fff; }
table { border-collapse: collapse; width: 100%; font-size: 13px; background: #fff; }
th, td { padding: 4px 10px; text-align: left; white-space: nowrap; }
th { font-weight: 400; color: #000; background: linear-gradient(180deg, #fff, #f5f4ef 80%, #e3e1d6); border-right: 1px solid #d6d2c2; border-bottom: 2px solid #d6d2c2; font-size: 12px; position: sticky; top: 0; }
tr:nth-child(even) td { background: #f7f9fe; }
tbody tr:hover td { background: #e3ecfb; }
td.num, th.num { text-align: right; font-family: var(--mono); font-variant-numeric: tabular-nums; }
.tag { display: inline-block; font-size: 11px; padding: 0 6px; border-radius: 2px; border: 1px solid currentColor; line-height: 1.6; }
.tag.off { color: var(--cinnabar); } .tag.work { color: var(--jade); } .tag.muted { color: #888; }

/* 说明：黄色气泡提示风格 */
.explain { margin-top: 36px; padding: 6px 18px 12px 18px; max-width: 54em; background: #ffffe1; border: 1px solid #c9c38f; border-radius: 7px; box-shadow: 2px 2px 6px #0000001a; position: relative; }
.explain > h2:first-child { margin-top: 10px; color: #000; background: none; padding-left: 26px; position: relative; }
.explain > h2:first-child::before { content: "i"; position: absolute; left: 0; top: 0; width: 19px; height: 19px; border-radius: 50%; background: radial-gradient(circle at 35% 30%, #9cc4ff, #2a6fdb 60%, #123f99); color: #fff; font: italic 700 13px/19px Georgia, serif; text-align: center; }
.explain p, .explain li { color: #222; }
.explain code { font-family: var(--mono); font-size: .92em; background: #fff; border: 1px solid #e3dda6; padding: 0 4px; }
.explain .src { font-size: 12px; color: #6b6640; }

/* ---------- 首页：资源管理器布局 ---------- */
.explorer { display: grid; grid-template-columns: 240px minmax(0, 1fr); min-height: 100vh; }
.taskpane { padding: 14px 12px 24px; background: linear-gradient(180deg, #7ba2e7, #6375d6); border-right: 1px solid #5470c8; }
.tp-box { margin-bottom: 12px; border-radius: 5px 5px 0 0; overflow: hidden; box-shadow: 0 1px 2px #0003; }
.tp-head { margin: 0; padding: 5px 10px; display: flex; align-items: center; gap: 6px; font-size: 12px; color: #215dc6; background: linear-gradient(90deg, #fff 30%, #c6d3f7); border: 0; }
.tp-special .tp-head { color: #fff; background: linear-gradient(90deg, #0054e3 40%, #2b6fe8); }
.tp-body { background: #d6dff7; padding: 10px; border: 1px solid #fff; border-top: 0; }
.tp-special .tp-body { background: #eff3ff; }
.tp-links { list-style: none; margin: 0; padding: 0; }
.tp-links a { display: flex; align-items: center; gap: 6px; padding: 2px 0; color: #215dc6; text-decoration: none; font-size: 12px; }
.tp-links a:hover { text-decoration: underline; color: #428eff; }
.tp-detail { margin: 0; font-size: 12px; color: #333; }
.files { min-width: 0; display: flex; flex-direction: column; }
.files > main { flex: 1; }
.home { padding: 16px 24px 24px; }
.tp-links a[aria-current] { font-weight: 700; color: #0a2a7d; }
.page-head h1 { display: flex; align-items: center; gap: 10px; }
.site-foot { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 4px 16px; padding: 8px 24px; font-size: 12px; color: #555; background: var(--face); border-top: 1px solid #d8d2bd; }
.site-foot a { color: #555; }
.welcome { display: flex; align-items: center; gap: 14px; padding: 4px 0 6px; }
.welcome h1 { margin: 0; font-size: 24px; }
.welcome p { margin: 2px 0 0; color: #444; }
.tools { display: grid; gap: 4px; }
.cat-name { display: flex; align-items: center; gap: 8px; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 250px), 1fr)); gap: 4px 10px; }
.card { display: flex; align-items: flex-start; gap: 10px; padding: 7px 8px; color: #000; text-decoration: none; border: 1px solid transparent; border-radius: 2px; }
.card:hover { color: #000; background: #e8eefa; border-color: #b8cdf2; }
.card:focus-visible { outline: 1px dotted #000; background: var(--sel); color: #fff; }
.card:focus-visible .card-text span { color: #e6ecff; }
.card-text b { display: block; font-size: 13px; }
.card-text span { display: block; font-size: 12px; color: #666; line-height: 1.45; margin-top: 1px; }

/* 首页日历：日期属性小窗 */
.leaf { background: #fff; border: 1px solid #7f9db9; text-align: center; padding-bottom: 8px; }
.leaf-top { background: linear-gradient(180deg, #3d7be6, #1d55c9); color: #fff; padding: 5px 0; font-weight: 700; font-size: 13px; }
.leaf-top small { display: block; font-weight: 400; font-size: 11px; opacity: .9; }
.leaf-day { font: 700 56px/1.1 Georgia, "Times New Roman", var(--sans); margin: 6px 0 0; color: #0a2a7d; font-variant-numeric: tabular-nums; }
.leaf-week { font-size: 13px; color: #333; }
.leaf-lunar { margin-top: 4px; font-weight: 700; color: #b32d0a; font-size: 13px; }
.leaf-term { display: inline-block; margin-top: 6px; font-size: 11px; padding: 0 6px; border: 1px solid #2a7d2e; color: #2a7d2e; border-radius: 2px; background: #f0fbef; }
.facts { margin: 10px 0 0; display: grid; gap: 6px; }
.fact { margin: 0; padding: 0 0 0 8px; border-left: 3px solid #9fb6e8; }
.fact dt { font-size: 11px; color: #555; }
.fact dd { margin: 0; font-weight: 700; font-size: 12.5px; color: #000; }
.fact.work { border-color: #2f9a24; } .fact.rest { border-color: #e2512b; }
.log { list-style: none; padding: 0; margin: 0; border: 1px solid #7f9db9; background: #fff; }
.log li { padding: 3px 10px; font-size: 12.5px; border-bottom: 1px solid #eef0f6; }
.log li:last-child { border-bottom: 0; }
.log time { font-family: var(--mono); font-size: 12px; color: #666; margin-right: 10px; }
.wrap > .log { margin-top: 4px; }

@keyframes pop { from { opacity: 0; transform: translateY(6px) scale(.995); } }
.files { animation: pop .25s ease-out both; }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

#toast { position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom, 0px)); transform: translate(-50%, 8px); background: #ffffe1; color: #000; border: 1px solid #000; padding: 5px 14px; border-radius: 6px; font-size: 13px; box-shadow: 2px 2px 5px #0004; opacity: 0; transition: .18s; pointer-events: none; z-index: 60; }
#toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- 各工具专用 ---------- */
.cal-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 240px), 1fr)); gap: 10px; }
.month { background: #fff; border: 1px solid #7f9db9; padding: 0 0 6px; }
.month h3 { margin: 0 0 4px; font-size: 12px; text-align: center; color: #fff; padding: 3px 0; background: linear-gradient(180deg, #3d7be6, #1d55c9); }
.days { display: grid; grid-template-columns: repeat(7, 1fr); gap: 1px; text-align: center; font-size: 12px; padding: 0 4px; }
.days .wk { color: #215dc6; font-size: 11px; border-bottom: 1px solid #c5d2ef; margin-bottom: 2px; }
.days .d { padding: 1px 0; font-family: var(--mono); }
.days .d.weekend { color: #c8401c; }
.days .d.holiday { background: #c8401c; color: #fff; }
.days .d.makeup { background: #e3f4e1; color: var(--jade); font-weight: 700; outline: 1px dotted var(--jade); }
.days .d.today { outline: 2px solid var(--gold); }
.legend { display: flex; flex-wrap: wrap; gap: 14px; font-size: 12px; color: #333; margin: 8px 0 12px; }
.legend i { display: inline-block; width: 12px; height: 12px; vertical-align: -1px; margin-right: 5px; }
.verdict { font: 700 28px/1.3 var(--sans); }
.verdict.rest { color: var(--cinnabar); } .verdict.work { color: var(--jade); }
.hl-out { font-family: var(--mono); font-size: 12.5px; white-space: pre-wrap; word-break: break-all; background: #fff; border: 1px solid var(--field); padding: 8px; min-height: 120px; }
.hl-out mark { background: #ffe680; color: inherit; outline: 1px solid #e0b100; }
.hl-out mark:nth-of-type(even) { background: #c7e9c0; outline-color: #69a85e; }
.swatch { height: 110px; border: 1px solid; border-color: #aca899 #fff #fff #aca899; box-shadow: inset 1px 1px 0 #716f64; display: grid; place-items: center; font: 700 18px var(--sans); }
.qr-box { display: grid; place-items: center; background: #fff; border: 1px solid #7f9db9; padding: 16px; min-height: 260px; }
.qr-box svg { width: min(100%, 280px); height: auto; }
.drop { border: 2px dashed #7f9db9; background: #f5f8fe; padding: 28px; text-align: center; color: #215dc6; cursor: pointer; }
.drop.over, .drop:hover { border-color: #e68b2c; background: #fff7ea; color: #a85800; }
.preview { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr)); gap: 12px; margin-top: 14px; }
.preview figure { margin: 0; background: #fff; border: 1px solid #7f9db9; padding: 8px; }
.preview img { display: block; margin: 0 auto; max-height: 300px; object-fit: contain; background: repeating-conic-gradient(#e6e6e6 0 25%, #fff 0 50%) 0 0 / 14px 14px; }
.preview figcaption { font-size: 12px; color: #333; margin-top: 6px; text-align: center; }

/* ---------- 窄屏 ---------- */
@media (max-width: 760px) {
  .wrap { padding: 14px 14px 22px; }
  .page-head { margin: -14px -14px 16px; padding: 12px 14px; }
  .explorer { grid-template-columns: 1fr; }
  .taskpane { order: 2; border-right: 0; border-top: 1px solid #5470c8; }
  .home { padding: 12px 14px 18px; }
  .site-foot { padding: 8px 14px; }
}
