/* 创作工作台 —— Esther design 风格
   大面积米白 #fefcf6 / 深奶 #faf6eb + 明黄 #F4D758，深蓝 #1B3A6B 点缀 */

:root {
  --yellow: #F4D758;
  --yellow-d: #E8C63F;
  --yellow-l: #FDF3C8;
  --navy: #1B3A6B;
  --navy-l: #2A5298;
  --red: #E5484D;
  --cream: #fefcf6;
  --cream-2: #faf6eb;
  --ink: #1A1A2E;
  --ink-2: #4A4A5A;
  --ink-3: #8a8a96;
  --card: #fff;
  --line: rgba(26, 26, 46, .09);
  --line-2: rgba(26, 26, 46, .16);
  --r: 16px;
  --r-s: 12px;
  --drawer-w: 236px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0; padding: 0; height: 100%;
  background: var(--cream);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB",
               "Noto Sans SC", "Microsoft YaHei", sans-serif;
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

::selection { background: var(--yellow); color: var(--ink); }
h1, h2, h3 { margin: 0; font-weight: 600; }
p { margin: 0; }
.hidden { display: none !important; }

a { color: var(--navy-l); text-decoration: none; border-bottom: 1px solid rgba(42, 82, 152, .25); }
a:hover { background: var(--yellow); border-bottom-color: transparent; }

/* ---------- 布局 ---------- */
.app { display: flex; min-height: 100vh; }

/* ---------- 抽屉 ---------- */
.drawer {
  width: var(--drawer-w); flex: 0 0 var(--drawer-w);
  background: var(--cream-2);
  border-right: 1px solid var(--line);
  display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh;
  z-index: 40;
}
.drawer-head {
  padding: 26px 16px 22px;
  background: var(--yellow);
  border-bottom: 5px solid var(--navy);
  text-align: center;
}
.who-name {
  font-size: 22px; font-weight: 800; line-height: 1.2;
  color: var(--navy); letter-spacing: 1px;
}
.who-sub {
  font-size: 12.5px; color: rgba(27, 58, 107, .72); font-weight: 600;
  letter-spacing: 2px; margin-top: 6px;
}
.greet {
  margin-top: 12px;
  display: inline-block;
  background: #fff; border-radius: 999px;
  padding: 4px 13px;
  font-size: 12.5px; font-weight: 600; color: var(--navy);
  box-shadow: 0 2px 6px rgba(27, 58, 107, .12);
}

.menu { padding: 18px 12px; display: flex; flex-direction: column; gap: 10px; flex: 1; overflow-y: auto; }
.menu-item {
  display: flex; align-items: center; gap: 12px;
  width: 100%; padding: 13px 16px;
  border: none; background: transparent; cursor: pointer;
  border-radius: 17px;
  font-family: inherit; font-size: 15px; color: var(--ink);
  text-align: left;
  transition: background .16s, color .16s, transform .16s;
}
.menu-item:active { transform: scale(.97); }
.m-ico { font-size: 19px; line-height: 1; flex: 0 0 22px; text-align: center; }
.menu-item span:not(.m-ico) { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.menu-item:hover { background: rgba(244, 215, 88, .5); }
.menu-item.is-active {
  background: var(--yellow); color: var(--ink); font-weight: 600;
  box-shadow: 0 3px 10px rgba(244, 215, 88, .55);
}

.dot {
  font-style: normal; font-size: 11px; font-weight: 600;
  min-width: 19px; height: 18px; padding: 0 5px;
  border-radius: 9px; background: rgba(27, 58, 107, .12); color: var(--navy);
  display: grid; place-items: center;
}
.menu-item.is-active .dot { background: rgba(26, 26, 46, .18); color: var(--ink); }

/* ---------- 左侧：今日时间使用 ---------- */
.time-box {
  margin: 0 12px 4px;
  padding: 12px 14px 13px;
  background: var(--yellow-l);
  border: 1px solid rgba(244, 215, 88, .6);
  border-radius: var(--r-s);
}
.tb-head { font-size: 12px; font-weight: 700; color: var(--navy); margin-bottom: 6px; }
.tb-total { display: flex; align-items: baseline; gap: 4px; }
.tb-total em { font-style: normal; font-size: 24px; font-weight: 800; color: var(--navy); line-height: 1.1; }
.tb-total span { font-size: 11px; color: rgba(27, 58, 107, .7); }
.tb-total b { margin-left: auto; font-size: 12px; font-weight: 600; color: var(--ink-3); }
.tb-bar {
  display: flex; height: 9px; border-radius: 999px; overflow: hidden;
  background: rgba(26, 26, 46, .07); margin: 8px 0 8px;
}
.tb-seg { height: 100%; }
.tb-legend { display: flex; flex-wrap: wrap; gap: 4px 10px; }
.tb-lg { display: flex; align-items: center; gap: 4px; font-size: 11px; color: var(--ink-2); }
.tb-lg i { width: 7px; height: 7px; border-radius: 2px; display: block; }
.tb-empty { font-size: 11px; color: var(--ink-3); margin-top: 6px; }

.drawer-foot {
  padding: 14px 20px 16px;
  background: var(--yellow-l); border-top: 1px solid rgba(244, 215, 88, .5);
}
.foot-line { font-size: 11px; color: rgba(27, 58, 107, .6); line-height: 1.6; }

/* ---------- 主区 ---------- */
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.topbar {
  position: sticky; top: 0; z-index: 30;
  height: 56px; flex: 0 0 56px;
  background: rgba(253, 243, 200, .92);
  backdrop-filter: saturate(180%) blur(8px);
  border-bottom: 3px solid var(--yellow);
  box-shadow: 0 2px 0 0 var(--navy);
  display: flex; align-items: center; gap: 12px;
  padding: 0 20px;
}
.hamburger {
  display: none; width: 34px; height: 34px; padding: 0;
  border: none; background: transparent; cursor: pointer; color: var(--ink);
}
.hamburger svg { width: 21px; height: 21px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; }
.topbar-title { font-size: 16px; font-weight: 600; flex: 1; }
.topbar-right { display: flex; align-items: center; gap: 10px; }
.today-chip { font-size: 12px; color: var(--ink-3); }

.content { padding: 20px; max-width: 1080px; width: 100%; }

.view { display: none; }
.view.is-active { display: block; }

.page-head { margin-bottom: 18px; }
.page-head-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; }
.page-head h1 { font-size: 21px; letter-spacing: .3px; display: inline-block; color: var(--navy); }
.page-head h1::after {
  content: ''; display: block;
  width: 46px; height: 7px; margin-top: 7px;
  background: var(--yellow); border-radius: 6px 10px 7px 9px;
  transform: rotate(-1.4deg);
}
.page-head p { font-size: 13px; color: var(--ink-3); margin-top: 8px; }

/* ---------- 数据概览 ---------- */
.stat-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-bottom: 14px; }
.stat {
  background: var(--yellow-l); border: 1px solid rgba(244, 215, 88, .55); border-radius: var(--r);
  padding: 14px 16px; display: flex; flex-direction: column; gap: 2px;
}
.stat em { font-style: normal; font-size: 22px; font-weight: 700; color: var(--navy); line-height: 1.2; }
.stat span { font-size: 12px; color: rgba(27, 58, 107, .62); }
.stat-hl { background: var(--yellow); border-color: var(--yellow); }
.stat-hl em, .stat-hl span { color: var(--ink); }

/* ---------- 最重要的三件事 ---------- */
.focus-card { background: var(--yellow-l); border-top-color: var(--yellow); }
.focus-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.focus-slot {
  border: 1.5px dashed rgba(232, 198, 63, .9); border-radius: var(--r-s);
  background: rgba(255, 255, 255, .65);
  padding: 12px 13px; min-height: 92px;
  display: flex; flex-direction: column; gap: 6px;
}
.focus-slot.filled { border-style: solid; background: #fff; box-shadow: 0 2px 8px rgba(26, 26, 46, .05); }
.focus-slot.empty { align-items: center; justify-content: center; color: var(--ink-3); font-size: 13px; text-align: center; }
.fs-num {
  font-size: 11px; font-weight: 700; color: var(--navy);
  background: var(--yellow); border-radius: 999px;
  padding: 1px 8px; align-self: flex-start;
}
.fs-text { font-size: 14px; font-weight: 600; line-height: 1.5; word-break: break-word; }
.focus-slot.done .fs-text { text-decoration: line-through; color: var(--ink-3); }
.fs-act { display: flex; gap: 5px; margin-top: auto; }

/* ---------- 卡片 ---------- */
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-top: 3px solid var(--yellow);
  border-radius: var(--r);
  padding: 16px 18px;
  margin-bottom: 14px;
}
.card-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; margin-bottom: 12px;
}
.card-head h2 { font-size: 15px; color: var(--navy); position: relative; padding-left: 13px; }
.card-head h2::before {
  content: ''; position: absolute; left: 0; top: 50%; transform: translateY(-50%);
  width: 6px; height: 6px; border-radius: 2px; background: var(--navy);
}
.card-head > .tag, .card-head > .head-right { position: relative; }
.head-right { display: flex; align-items: center; gap: 8px; }
.mini { font-size: 12px; color: var(--ink-3); }
.track { width: 88px; height: 5px; border-radius: 3px; background: var(--cream-2); overflow: hidden; }
.fill { height: 100%; width: 0; background: var(--navy); border-radius: 3px; transition: width .3s ease; }

/* ---------- 表单 ---------- */
.field { display: flex; flex-direction: column; gap: 5px; }
.field label { font-size: 12px; color: var(--ink-2); font-weight: 500; }
.grid3 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.span2 { grid-column: span 2; }
.span3 { grid-column: span 4; }
.mtop { margin-top: 10px; }

.ipt {
  width: 100%;
  border: 1px solid var(--line-2);
  border-radius: var(--r-s);
  padding: 8px 11px;
  font-size: 14px; font-family: inherit;
  color: var(--ink); background: #fff;
  transition: border-color .16s, box-shadow .16s;
}
.ipt:focus { outline: none; border-color: var(--navy-l); box-shadow: 0 0 0 3px rgba(42, 82, 152, .12); }
.ipt.area { resize: vertical; line-height: 1.65; }
.ipt-s { max-width: 110px; padding: 4px 6px; font-size: 12px; }
.dy-sleep-summary { margin: 0 0 10px; padding: 8px 12px; background: #fbf7ec; border: 1px solid rgba(27,58,107,.12); border-radius: 10px; font-size: 12.5px; color: #6b6f76; }
.dy-sleep-summary b { color: #1B3A6B; }
.ipt-m { max-width: 170px; }
.sel-s { max-width: 110px; }
.search { max-width: 320px; }
.file { font-size: 13px; padding: 6px 0; border: none; background: transparent; }
.file::file-selector-button {
  border: 1px solid var(--line-2); background: #fff; border-radius: 7px;
  padding: 5px 12px; margin-right: 10px; cursor: pointer; font-family: inherit; font-size: 13px;
}
.upload-row { display: flex; align-items: center; gap: 10px; }
.img-preview { margin-top: 8px; }
.img-preview img { max-width: 160px; max-height: 160px; border-radius: 8px; border: 1px solid var(--line); display: block; }

.row-act { display: flex; align-items: center; gap: 10px; margin-top: 12px; flex-wrap: wrap; }
.hint { font-size: 12px; color: var(--ink-3); }
.check { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--ink-2); cursor: pointer; }
.check input { width: 15px; height: 15px; accent-color: var(--navy); }

.quick-add { display: flex; gap: 8px; margin-bottom: 12px; flex-wrap: wrap; }
.quick-add .ipt:first-child { flex: 1; min-width: 180px; }

/* ---------- 按钮 ---------- */
.btn {
  border: none; cursor: pointer; border-radius: var(--r-s);
  padding: 8px 16px; font-family: inherit; font-size: 14px; font-weight: 500;
  transition: background .16s, transform .12s, box-shadow .16s;
  white-space: nowrap;
}
.btn-primary { background: var(--navy); color: #fff; }
.btn-primary:hover { background: var(--navy-l); }
.btn-primary:active { transform: translateY(1px); }
.btn-ghost { background: #fff; color: var(--navy); border: 1px solid rgba(27, 58, 107, .28); }
.btn-ghost:hover { background: rgba(27, 58, 107, .07); color: var(--navy); border-color: rgba(27, 58, 107, .5); }
.btn-sm { padding: 5px 11px; font-size: 13px; }
.btn-danger { background: #fff; color: var(--red); border: 1px solid rgba(229, 72, 77, .3); }
.btn-danger:hover { background: rgba(229, 72, 77, .07); }
.btn-yellow { background: var(--yellow); color: var(--ink); font-weight: 600; }
.btn-yellow:hover { background: var(--yellow-d); }

/* ---------- 标签 ---------- */
.tag { font-size: 11.5px; font-weight: 600; padding: 2px 9px; border-radius: 999px; white-space: nowrap; }
.tag-navy { background: rgba(27, 58, 107, .1); color: var(--navy); }
.tag-yellow { background: rgba(244, 215, 88, .38); color: #6b5a0f; }
.tag-red { background: rgba(229, 72, 77, .1); color: var(--red); }
.tag-gray { background: var(--cream-2); color: var(--ink-2); }

.chips { display: flex; gap: 5px; flex-wrap: wrap; }
.chip {
  border: 1px solid var(--line-2); background: #fff; cursor: pointer;
  padding: 4px 11px; border-radius: 999px;
  font-family: inherit; font-size: 12.5px; color: var(--ink-2);
  transition: all .15s;
}
.chip:hover { border-color: var(--ink-3); }
.chip.is-on { background: var(--ink); border-color: var(--ink); color: #fff; }
.toolbar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }

/* ---------- 列表 ---------- */
.list { display: flex; flex-direction: column; gap: 6px; }
.li {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 9px 11px; border-radius: var(--r-s);
  background: var(--cream-2); border: 1px solid transparent;
  transition: border-color .15s, background .15s;
}
.li:hover { border-color: rgba(244, 215, 88, .7); background: var(--yellow-l); }
.li-body { flex: 1; min-width: 0; }
.li-text { font-size: 14px; line-height: 1.55; word-break: break-word; }
.li-meta { display: flex; gap: 5px; align-items: center; margin-top: 4px; flex-wrap: wrap; }
.li-act { display: flex; gap: 5px; align-items: center; }
.li.done .li-text { text-decoration: line-through; color: var(--ink-3); }

.tick {
  width: 18px; height: 18px; flex: 0 0 18px; margin-top: 2px;
  border: 1.6px solid var(--line-2); border-radius: 5px;
  background: #fff; cursor: pointer; padding: 0;
  display: grid; place-items: center;
  font-size: 11px; color: transparent;
  transition: background .15s, border-color .15s;
}
.tick:hover { border-color: var(--navy-l); }
.tick.on { background: var(--navy); border-color: var(--navy); color: #fff; }

/* ---------- 条目卡 ---------- */
.stack { display: flex; flex-direction: column; gap: 8px; }
.item {
  border: 1px solid var(--line); border-radius: var(--r-s);
  padding: 12px 14px; background: #fff;
  transition: box-shadow .16s, border-color .16s;
}
.item:hover { box-shadow: 0 2px 10px rgba(26, 26, 46, .05); border-color: var(--line-2); }
.item-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.item-title { font-size: 14.5px; font-weight: 600; line-height: 1.45; }
.item-sub { font-size: 12px; color: var(--ink-3); margin-top: 2px; }
.item-text { font-size: 13.5px; color: var(--ink-2); margin-top: 6px; line-height: 1.65; white-space: pre-wrap; }
.item-tags { display: flex; gap: 5px; flex-wrap: wrap; margin-top: 8px; }
.item-act { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 10px; }
.item.pinned { border-left: 3px solid var(--yellow); }

.block { margin-top: 16px; }
.block h3 { font-size: 14px; margin-bottom: 8px; color: var(--navy); }

.note {
  background: var(--yellow-l); border-radius: var(--r-s);
  padding: 12px 14px; font-size: 13.5px; line-height: 1.75; color: var(--ink-2);
}
.note ol, .note ul { margin: 0; padding-left: 18px; }
.note li { margin: 3px 0; }

/* ---------- 表格 ---------- */
.tbl-wrap { overflow-x: auto; }
.tbl { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13.5px; }
.tbl th, .tbl td { padding: 8px 10px; text-align: left; }
.tbl thead th { font-size: 12px; color: var(--navy); font-weight: 600; background: var(--yellow-l); border-bottom: 2px solid var(--yellow); }
.tbl thead th:first-child { border-top-left-radius: var(--r-s); }
.tbl thead th:last-child { border-top-right-radius: var(--r-s); }
.tbl tbody td { border-bottom: 1px solid var(--line); }
.tbl tbody tr:last-child td { border-bottom: none; }
.tbl .num { font-variant-numeric: tabular-nums; font-weight: 600; }
.tbl .lv-good { color: var(--navy-l); }
.tbl .lv-mid { color: var(--ink-2); }
.tbl .lv-bad { color: var(--red); }

/* ---------- 热点 ---------- */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 14px; }
.tab {
  border: none; background: transparent; cursor: pointer;
  padding: 9px 16px; font-family: inherit; font-size: 14px; color: var(--ink-2);
  border-bottom: 2px solid transparent; margin-bottom: -1px;
  transition: color .15s, border-color .15s;
}
.tab:hover { color: var(--ink); }
.tab.is-active { color: var(--ink); font-weight: 600; border-bottom-color: var(--yellow); }

.plat-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.plat-col { background: var(--yellow-l); border-radius: var(--r-s); padding: 12px 14px; }
.plat-name { font-size: 13px; font-weight: 600; margin-bottom: 8px; display: flex; align-items: center; gap: 6px; }
.plat-name::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: var(--navy); }
.plat-col:nth-child(2) .plat-name::before { background: var(--yellow-d); }
.plat-col:nth-child(3) .plat-name::before { background: var(--red); }
.plat-item { padding: 7px 0; border-bottom: 1px dashed var(--line); font-size: 13px; line-height: 1.6; }
.plat-item:last-child { border-bottom: none; }
.plat-item .pt { font-weight: 600; }
.plat-item .pw { color: var(--ink-3); font-size: 12px; margin-top: 2px; }

.empty { text-align: center; padding: 22px 12px; font-size: 13px; color: rgba(27, 58, 107, .5); }
.empty-box { text-align: center; padding: 34px 16px; background: var(--yellow-l); border: 1px solid rgba(244, 215, 88, .5); border-radius: var(--r); }
.empty-title { font-size: 15px; font-weight: 600; }
.empty-sub { font-size: 13px; color: var(--ink-3); margin-top: 5px; }

/* ---------- 分数 ---------- */
.score { display: flex; align-items: baseline; gap: 4px; }
.score span { font-size: 26px; font-weight: 700; color: var(--navy); line-height: 1; }
.score em { font-style: normal; font-size: 12px; color: var(--ink-3); }

/* ---------- 编辑态 ---------- */
.edit-box { display: flex; flex-direction: column; gap: 8px; padding: 12px 14px; border: 1.5px solid var(--yellow); border-radius: var(--r-s); background: var(--yellow-l); }
.edit-row { display: flex; gap: 8px; flex-wrap: wrap; }

/* ---------- 时光日记：48 格 ---------- */
.diary { display: flex; flex-direction: column; gap: 1px; }
.dy-row {
  display: flex; align-items: center; gap: 10px;
  padding: 5px 8px; border-radius: 8px;
  transition: background .14s;
}
.dy-row:hover { background: var(--yellow-l); }
.dy-row.now { background: rgba(244, 215, 88, .4); box-shadow: inset 3px 0 0 var(--navy); }
.dy-time {
  flex: 0 0 104px; font-size: 12.5px; font-weight: 600; color: var(--navy);
  font-variant-numeric: tabular-nums; letter-spacing: .3px;
}
.dy-time i { font-style: normal; color: var(--ink-3); font-weight: 500; }
.dy-text {
  flex: 1; min-width: 0;
  border: none; border-bottom: 1.5px dashed rgba(27, 58, 107, .3);
  background: transparent; padding: 5px 3px;
  font-family: inherit; font-size: 14px; color: var(--ink-3);
  transition: border-color .15s, color .15s;
}
.dy-text:focus { outline: none; border-bottom-color: var(--navy); border-bottom-style: solid; }
.dy-text::placeholder { color: #c9c9d2; }
/* 完成的变深蓝，不加删除线 */
.dy-row.done .dy-text { color: var(--navy); font-weight: 600; text-decoration: none; }
.dy-row.done .dy-time { color: var(--navy); }

/* 睡眠段折叠条：短条贴左，不拉满 */
.dy-fold {
  display: inline-flex; align-items: center; gap: 8px;
  margin: 3px 0 3px 40px; padding: 4px 8px 4px 5px;
  border: 1.5px dashed rgba(27, 58, 107, .25); border-radius: 999px;
  background: rgba(27, 58, 107, .04);
  font-size: 12.5px; color: var(--ink-2); cursor: pointer;
  width: fit-content; max-width: 27%;
  transition: background .15s, border-color .15s;
}
.dy-fold:hover { background: rgba(244, 215, 88, .28); border-color: rgba(232, 198, 63, .8); }
.dy-fold.is-open { border-style: solid; background: rgba(244, 215, 88, .3); }
.dy-fold .btn { flex: 0 0 auto; padding: 2px 10px; font-size: 12px; }
.dy-fold span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- Toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%) translateY(14px);
  background: var(--ink); color: #fff;
  padding: 9px 18px; border-radius: 999px;
  font-size: 13.5px; opacity: 0; pointer-events: none;
  transition: opacity .22s, transform .22s; z-index: 999;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

.mask { display: none; position: fixed; inset: 0; background: rgba(0, 0, 0, .3); z-index: 35; }
.mask.show { display: block; }

/* ---------- 响应式 ---------- */
@media (max-width: 900px) {
  .drawer {
    position: fixed; left: 0; top: 0; bottom: 0;
    transform: translateX(-100%); transition: transform .25s ease;
    box-shadow: 0 0 30px rgba(26, 26, 46, .14);
  }
  .drawer.open { transform: translateX(0); }
  .hamburger { display: grid; place-items: center; }
  .content { padding: 16px 14px; }
  .grid3 { grid-template-columns: repeat(2, 1fr); }
  .span3 { grid-column: span 2; }
  .plat-grid { grid-template-columns: 1fr; }
  .topbar { padding: 0 14px; }
  .today-chip { display: none; }
  .stat-row { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 560px) {
  .grid3 { grid-template-columns: 1fr; }
  .span2, .span3 { grid-column: span 1; }
  .page-head h1 { font-size: 19px; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}
