:root {
  --bg: #f6f1e7;
  --bg-2: #efe5d3;
  --ink: #201b14;
  --muted: #7a7164;
  --line: #e6dccb;
  --card: #fffdf9;
  --amber: #b45309;
  --amber-soft: #fdf0dc;
  --blue: #1d4ed8;
  --blue-soft: #e8efff;
  --violet: #6d28d9;
  --violet-soft: #f1e9ff;
  --rose: #be123c;
  --rose-soft: #ffe9ee;
  --teal: #0f766e;
  --teal-soft: #e2f5f1;
  --indigo: #4338ca;
  --indigo-soft: #eae9ff;
  --green: #15803d;
  --green-soft: #e7f6ea;
  --slate: #475569;
  --slate-soft: #eef1f5;
  --shadow: 0 1px 2px rgba(60, 45, 20, .05), 0 10px 30px rgba(60, 45, 20, .07);
  --radius: 20px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Noto Sans CJK SC", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  line-height: 1.55;
  min-height: 100vh;
}
a { color: inherit; text-decoration: none; }
button { font: inherit; }
.bg-blob {
  position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background:
    radial-gradient(900px 500px at 12% -8%, rgba(180, 83, 9, .12), transparent 60%),
    radial-gradient(800px 500px at 100% 0%, rgba(15, 118, 110, .10), transparent 55%),
    linear-gradient(180deg, var(--bg) 0%, var(--bg-2) 100%);
}

/* top bar */
.topbar {
  max-width: 1120px; margin: 0 auto; padding: 26px 24px 10px;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
}
.brand { display: flex; align-items: center; gap: 12px; }
.mark {
  width: 42px; height: 42px; border-radius: 14px; display: grid; place-items: center;
  background: linear-gradient(145deg, #d97706, #92400e);
  color: #fff; font-weight: 700; font-size: 20px;
  box-shadow: 0 6px 16px rgba(146, 64, 14, .25);
  flex: 0 0 auto;
}
.mark.big { width: 58px; height: 58px; border-radius: 18px; font-size: 28px; margin: 0 auto 14px; }
.brand-text { display: flex; flex-direction: column; line-height: 1.2; }
.brand-text strong { font-size: 17px; letter-spacing: .2px; }
.brand-text small { color: var(--muted); font-size: 12px; margin-top: 2px; }
.top-actions { display: flex; align-items: center; gap: 8px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border-radius: 12px; padding: 10px 16px; border: 1px solid transparent;
  cursor: pointer; transition: transform .12s ease, background .15s ease, box-shadow .15s ease;
  font-size: 14px; white-space: nowrap;
}
.btn:active { transform: translateY(1px); }
.btn.primary {
  background: #1f2937; color: #fff; box-shadow: 0 6px 16px rgba(31, 41, 55, .2);
}
.btn.primary:hover { background: #111827; }
.btn.ghost { background: rgba(255, 255, 255, .55); border-color: var(--line); color: #3f3a31; }
.btn.ghost:hover { background: #fff; }
.btn.wide { width: 100%; padding: 12px 16px; border-radius: 14px; font-size: 15px; }
.btn:disabled { opacity: .55; cursor: default; }

/* hero */
.wrap { max-width: 1120px; margin: 0 auto; padding: 8px 24px 40px; }
.hero {
  display: flex; align-items: flex-end; justify-content: space-between; gap: 28px;
  padding: 26px 4px 24px;
}
.eyebrow { margin: 0 0 8px; color: var(--amber); font-size: 13px; font-weight: 600; letter-spacing: .6px; }
.hero h1 { margin: 0; font-size: clamp(28px, 4vw, 40px); letter-spacing: -1px; line-height: 1.15; }
.sub { margin: 10px 0 0; color: var(--muted); font-size: 14.5px; }
.hero-stat {
  min-width: 220px; background: rgba(255, 253, 249, .7); border: 1px solid var(--line);
  border-radius: 16px; padding: 14px 16px; box-shadow: var(--shadow);
}
.stat-label { display: block; color: var(--muted); font-size: 12px; }
.hero-stat strong { display: block; font-size: 20px; margin: 2px 0 8px; }
.bar { height: 7px; background: #eee4d2; border-radius: 99px; overflow: hidden; }
.bar i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, #d97706, #0f766e); border-radius: 99px; transition: width .5s ease; }
.hero-stat small { display: block; margin-top: 7px; color: var(--muted); font-size: 12px; }

/* task grid */
.grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.skeleton { height: 172px; border-radius: var(--radius); background: rgba(255,255,255,.45); border: 1px solid var(--line); animation: pulse 1.3s infinite ease-in-out; }
@keyframes pulse { 50% { opacity: .5; } }

.card {
  position: relative; text-align: left; background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 18px 18px 16px; cursor: pointer;
  box-shadow: var(--shadow); transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease;
  display: flex; flex-direction: column; gap: 10px; min-height: 172px;
}
.card:hover { transform: translateY(-3px); box-shadow: 0 14px 34px rgba(60, 45, 20, .12); border-color: #d8c9ae; }
.card:focus-visible { outline: 3px solid rgba(180, 83, 9, .35); outline-offset: 2px; }
.card-icon {
  width: 44px; height: 44px; border-radius: 13px; display: grid; place-items: center;
  font-size: 22px; background: var(--slate-soft); flex: 0 0 auto;
}
.card h3 { margin: 0; font-size: 17px; letter-spacing: -.2px; }
.card p { margin: 0; color: var(--muted); font-size: 12.8px; line-height: 1.55; }
.card .go { margin-top: auto; color: var(--amber); font-size: 12.5px; font-weight: 600; display: flex; align-items: center; gap: 4px; }
.card .badge { position: absolute; top: 16px; right: 16px; font-size: 11px; color: var(--muted); }

.tone-amber .card-icon { background: var(--amber-soft); }
.tone-blue .card-icon { background: var(--blue-soft); }
.tone-violet .card-icon { background: var(--violet-soft); }
.tone-rose .card-icon { background: var(--rose-soft); }
.tone-teal .card-icon { background: var(--teal-soft); }
.tone-indigo .card-icon { background: var(--indigo-soft); }
.tone-green .card-icon { background: var(--green-soft); }
.tone-slate .card-icon { background: var(--slate-soft); }

/* lower */
.lower { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(280px, .8fr); gap: 14px; margin-top: 18px; }
.panel { background: rgba(255, 253, 249, .82); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 18px 14px; box-shadow: var(--shadow); }
.panel-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 8px; }
.panel-head h2 { margin: 0; font-size: 15px; letter-spacing: .2px; }
.link { color: var(--amber); font-size: 12.5px; font-weight: 600; }
.file-list { list-style: none; margin: 0; padding: 0; }
.file-list li { border-top: 1px solid #f0e8da; }
.file-list li:first-child { border-top: 0; }
.file-list a { display: flex; align-items: center; gap: 12px; padding: 10px 2px; border-radius: 10px; }
.file-list a:hover { background: #fbf7ee; }
.file-ico { width: 34px; height: 34px; border-radius: 10px; background: #f3ecdf; display: grid; place-items: center; font-size: 16px; flex: 0 0 auto; }
.file-main { min-width: 0; display: flex; flex-direction: column; }
.file-main b { font-weight: 500; font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-main small { color: var(--muted); font-size: 11.5px; }
.file-list time { margin-left: auto; color: var(--muted); font-size: 11.5px; white-space: nowrap; }
.empty { color: var(--muted); font-size: 13px; padding: 14px 2px; }

.tips { margin: 0; padding-left: 18px; color: #4b4439; font-size: 13px; }
.tips li { margin: 7px 0; }
.tips b { font-weight: 600; color: var(--ink); }
.mini { margin-top: 14px; border-top: 1px dashed var(--line); padding-top: 12px; display: grid; gap: 8px; }
.mini-row { display: flex; justify-content: space-between; gap: 10px; font-size: 12.3px; color: var(--muted); }
.mini-row b { color: var(--ink); font-weight: 500; }

.foot { text-align: center; color: #9a8f7e; font-size: 11.5px; padding: 0 20px 30px; }

/* dialog */
dialog {
  border: 0; padding: 0; border-radius: 22px; width: min(580px, calc(100vw - 28px));
  background: var(--card); box-shadow: 0 24px 80px rgba(40, 30, 10, .28);
  color: var(--ink);
}
dialog::backdrop { background: rgba(32, 27, 20, .45); backdrop-filter: blur(3px); }
.dialog-inner { padding: 22px; margin: 0; }
.dialog-head { display: flex; gap: 12px; align-items: flex-start; margin-bottom: 14px; }
.dialog-head h3 { margin: 0 0 2px; font-size: 19px; }
.dialog-head p { margin: 0; color: var(--muted); font-size: 13px; }
.dlg-block { margin: 14px 0; }
.dlg-block h4 { margin: 0 0 8px; font-size: 13px; color: var(--muted); font-weight: 600; }
.dlg-block ul { margin: 0; padding-left: 18px; font-size: 13px; color: #4b4439; }
.dlg-block li { margin: 5px 0; }
textarea {
  width: 100%; border: 1px solid var(--line); border-radius: 14px; padding: 12px 13px;
  font: 13px/1.6 ui-monospace, SFMono-Regular, Menlo, Consolas, "Noto Sans Mono CJK SC", monospace;
  color: #2b261e; background: #fbf8f1; resize: vertical; min-height: 150px;
}
textarea:focus { outline: 2px solid rgba(180, 83, 9, .3); border-color: #d4b483; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; }
.dlg-note { margin: 10px 0 0; color: var(--muted); font-size: 11.8px; text-align: right; }

/* toast */
.toast {
  position: fixed; left: 50%; bottom: 28px; transform: translate(-50%, 20px);
  background: #201b14; color: #fff; padding: 11px 16px; border-radius: 12px; font-size: 13px;
  opacity: 0; pointer-events: none; transition: opacity .2s ease, transform .2s ease; z-index: 50;
  max-width: calc(100vw - 32px); text-align: center;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* login */
.login-body { display: grid; place-items: center; min-height: 100vh; }
.login-wrap { width: 100%; padding: 24px; }
.login-card {
  width: min(400px, 100%); margin: 0 auto; background: rgba(255, 253, 249, .92);
  border: 1px solid var(--line); border-radius: 26px; padding: 34px 28px 26px;
  box-shadow: 0 24px 70px rgba(60, 45, 20, .18); text-align: center;
}
.login-card h1 { margin: 0 0 4px; font-size: 24px; letter-spacing: -.4px; }
.login-sub { margin: 0 0 24px; color: var(--muted); font-size: 13px; }
.login-card form { text-align: left; }
.login-card label { display: block; font-size: 12.5px; color: var(--muted); margin: 0 0 6px 4px; }
.pw-field { position: relative; margin-bottom: 14px; }
.pw-field input {
  width: 100%; padding: 13px 62px 13px 14px; border-radius: 14px; border: 1px solid var(--line);
  font-size: 16px; background: #fbf8f1; color: var(--ink);
}
.pw-field input:focus { outline: 2px solid rgba(180, 83, 9, .3); border-color: #d4b483; }
.pw-toggle {
  position: absolute; right: 8px; top: 50%; transform: translateY(-50%);
  border: 0; background: transparent; color: var(--amber); font-size: 12.5px; cursor: pointer; padding: 6px 8px;
}
.login-err { color: #b91c1c; font-size: 12.5px; margin: 10px 2px 0; }
.login-foot { margin: 20px 0 0; color: #9a8f7e; font-size: 11.5px; }

/* help page */
.help-wrap { max-width: 820px; margin: 0 auto; padding: 26px 24px 50px; }
.help-card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 26px; box-shadow: var(--shadow); }
.help-card h1 { margin: 0 0 6px; font-size: 26px; }
.help-card h2 { font-size: 16px; margin: 26px 0 8px; }
.help-card h3 { font-size: 14px; margin: 18px 0 6px; }
.help-card p, .help-card li { color: #4b4439; font-size: 13.5px; }
.help-card ul, .help-card ol { padding-left: 20px; }
.help-card code { background: #f3ecdf; padding: 1px 6px; border-radius: 6px; font-size: 12.5px; }
.help-card table { width: 100%; border-collapse: collapse; margin: 10px 0; font-size: 13px; }
.help-card th, .help-card td { text-align: left; padding: 8px 10px; border-bottom: 1px solid #f0e8da; vertical-align: top; }
.help-card th { color: var(--muted); font-weight: 600; }
.help-back { display: inline-flex; margin-bottom: 14px; color: var(--amber); font-size: 13px; font-weight: 600; }

/* responsive */
@media (max-width: 960px) {
  .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .lower { grid-template-columns: 1fr; }
}
@media (max-width: 620px) {
  .topbar { padding: 18px 16px 6px; }
  .wrap { padding: 4px 16px 30px; }
  .brand-text small { display: none; }
  .top-actions .btn { padding: 8px 11px; font-size: 12.5px; }
  .hero { flex-direction: column; align-items: stretch; gap: 16px; padding: 18px 2px 18px; }
  .hero-stat { min-width: 0; }
  .grid { grid-template-columns: 1fr; gap: 11px; }
  .card { min-height: 0; padding: 16px; }
  .card p { font-size: 12.5px; }
  .panel { padding: 15px 14px 12px; }
  .dialog-inner { padding: 18px; }
  .dialog-head h3 { font-size: 17px; }
  .dialog-actions { flex-direction: column-reverse; }
  .dialog-actions .btn { width: 100%; }
  .dlg-note { text-align: center; }
}
@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}

/* ---------- drag & drop / upload ---------- */
.drop-overlay {
  position: fixed; inset: 0; z-index: 60; display: none; place-items: center;
  background: rgba(246, 241, 231, .78); backdrop-filter: blur(4px); padding: 24px;
  pointer-events: none;
}
.drop-overlay.show { display: grid; }
.drop-card {
  width: min(520px, 92vw); border: 3px dashed var(--amber); border-radius: 24px;
  background: rgba(255, 253, 249, .97); padding: 42px 30px; text-align: center;
  display: grid; gap: 6px; box-shadow: 0 24px 80px rgba(40, 30, 10, .25);
}
.drop-card span { font-size: 42px; color: var(--amber); }
.drop-card strong { font-size: 22px; }
.drop-card small { color: var(--muted); font-size: 13px; }
.drop-card b { color: var(--amber); }
.dash-upload {
  position: fixed; right: 20px; bottom: 20px; z-index: 55; width: min(340px, calc(100vw - 24px));
  background: var(--card); border: 1px solid var(--line); border-radius: 14px;
  padding: 12px 14px; box-shadow: var(--shadow); font-size: 12px;
}
.dash-upload-row { display: flex; justify-content: space-between; gap: 8px; margin-bottom: 7px; }
.dash-upload-row span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dash-upload-row b { color: var(--amber); white-space: nowrap; }
.card.drop-hover { border-color: var(--teal); background: #e9f6f2; box-shadow: 0 0 0 2px rgba(15,110,110,.18); }
