:root {
  color-scheme: light;
  --ink: #282722;
  --muted: #77736a;
  --paper: #f6f3ed;
  --panel: #fffdf8;
  --line: #e4dfd5;
  --accent: #d5673f;
  --accent-dark: #af4c2c;
  --sage: #506b5e;
  --sage-light: #e5ece7;
  --danger: #ad3e35;
  --shadow: 0 20px 70px rgba(57, 50, 39, .10);
  font-family: "Microsoft YaHei UI", "PingFang SC", "Noto Sans SC", system-ui, sans-serif;
}

* { box-sizing: border-box; }
html, body { min-height: 100%; }
body { margin: 0; color: var(--ink); background: var(--paper); }
button, input, textarea, select { font: inherit; }
button { color: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }

.login-view { min-height: 100vh; display: grid; grid-template-columns: minmax(360px, 1.2fr) minmax(420px, .8fr); background: #eee9df; }
.login-art { position: relative; overflow: hidden; display: grid; place-items: center; align-content: center; gap: 30px; padding: 50px; background: linear-gradient(145deg, #d9e2d9 0%, #eff0e7 58%, #e8ddcb 100%); }
.login-art::before, .login-art::after { content: ""; position: absolute; border: 1px solid rgba(40,39,34,.08); border-radius: 50%; }
.login-art::before { width: 520px; height: 520px; left: -210px; top: -240px; }
.login-art::after { width: 280px; height: 280px; right: -110px; bottom: -90px; }
.login-art > p { margin: 0; color: #53635a; letter-spacing: .08em; }
.sun { position: absolute; width: 120px; height: 120px; border-radius: 50%; top: 12%; right: 15%; background: rgba(222, 139, 82, .48); filter: blur(.2px); }
.kindle-frame { position: relative; width: min(390px, 74%); aspect-ratio: 3 / 4; border-radius: 24px; padding: 27px 23px 46px; background: #2d2d2b; box-shadow: 0 35px 80px rgba(55, 57, 48, .28), inset 0 0 0 2px rgba(255,255,255,.09); transform: rotate(-4deg); }
.kindle-screen { height: 100%; padding: 42px 32px; background: #deddd4; box-shadow: inset 0 0 32px rgba(39,39,35,.14); color: #292924; }
.kindle-screen strong { display: block; margin: 22px 0 42px; font-family: SimSun, "Songti SC", serif; font-size: clamp(24px, 3vw, 38px); line-height: 1.45; }
.ink-line { height: 5px; width: 58%; margin: 13px 0; background: rgba(41,41,36,.58); }
.ink-line.long { width: 85%; }
.ink-card { margin-top: 35px; padding: 14px 12px; border-block: 1px solid rgba(41,41,36,.35); font-size: 14px; }
.kindle-button { position: absolute; bottom: 16px; left: 50%; width: 42px; height: 5px; border-radius: 3px; background: #111; transform: translateX(-50%); }
.login-panel { display: flex; flex-direction: column; justify-content: center; padding: clamp(40px, 7vw, 100px); background: var(--panel); }
.brand { display: flex; align-items: center; gap: 12px; }
.brand span:last-child { display: grid; gap: 2px; }
.brand strong { font-size: 16px; letter-spacing: .02em; }
.brand small { color: var(--muted); font-size: 11px; letter-spacing: .14em; }
.brand-mark { display: grid; place-items: center; width: 40px; height: 48px; border: 2px solid currentColor; border-radius: 4px 4px 10px 4px; font-family: Georgia, serif; font-size: 24px; }
.brand-login { position: absolute; top: 38px; }
.login-copy { margin-bottom: 32px; }
.eyebrow { color: var(--accent); font-size: 12px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; }
h1, h2, p { margin-top: 0; }
.login-copy h1, .page-heading h1 { margin: 9px 0 8px; font-family: SimSun, "Songti SC", serif; font-size: clamp(32px, 4vw, 50px); font-weight: 600; }
.login-copy p, .page-heading p { color: var(--muted); line-height: 1.7; }
.stack-form, .account-form { display: grid; gap: 18px; }
label { display: grid; gap: 8px; color: #57534d; font-size: 14px; font-weight: 700; }
input, textarea, select { width: 100%; border: 1px solid var(--line); border-radius: 10px; outline: 0; background: #fff; color: var(--ink); transition: border-color .15s, box-shadow .15s; }
input, select { min-height: 46px; padding: 0 13px; }
textarea { padding: 13px; resize: vertical; line-height: 1.65; }
input:focus, textarea:focus, select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(213,103,63,.12); }
.primary-button, .secondary-button, .danger-button { min-height: 44px; padding: 0 18px; border: 0; border-radius: 9px; cursor: pointer; font-weight: 700; transition: transform .15s, opacity .15s, background .15s; }
.primary-button { background: var(--accent); color: white; box-shadow: 0 8px 22px rgba(213,103,63,.18); }
.primary-button:hover { background: var(--accent-dark); transform: translateY(-1px); }
.secondary-button { border: 1px solid var(--line); background: #fff; }
.secondary-button:hover { background: #f5f2ec; }
.danger-button { background: var(--danger); color: #fff; }
.full-button { width: 100%; margin-top: 4px; }
.form-error { min-height: 20px; margin: 0; color: var(--danger); font-size: 13px; }
.login-footnote { margin: 30px 0 0; color: #9a958c; font-size: 12px; line-height: 1.6; }

.app-shell { min-height: 100vh; display: grid; grid-template-columns: 250px 1fr; }
.sidebar { position: fixed; inset: 0 auto 0 0; z-index: 20; width: 250px; display: flex; flex-direction: column; padding: 30px 22px 24px; background: #2c322e; color: #f7f2e8; }
.sidebar .brand { padding: 0 8px 32px; }
.sidebar .brand small { color: #aeb9b1; }
.nav-list { display: grid; gap: 7px; }
.nav-button { display: flex; align-items: center; gap: 12px; min-height: 48px; padding: 0 13px; border: 0; border-radius: 10px; background: transparent; color: #cbd3cc; cursor: pointer; text-align: left; }
.nav-button:hover { background: rgba(255,255,255,.06); color: white; }
.nav-button.active { background: #f3eee3; color: #2c322e; font-weight: 700; box-shadow: 0 10px 25px rgba(0,0,0,.13); }
.nav-icon { display: grid; place-items: center; width: 26px; height: 26px; border: 1px solid currentColor; border-radius: 7px; font-family: SimSun, serif; font-size: 13px; }
.privacy-note { margin-top: auto; padding: 16px; border: 1px solid rgba(255,255,255,.12); border-radius: 12px; color: #b9c2bb; }
.privacy-note > span { color: #f0b693; font-size: 11px; font-weight: 700; letter-spacing: .12em; }
.privacy-note p { margin: 7px 0 0; font-size: 12px; line-height: 1.6; }
.workspace { grid-column: 2; min-width: 0; }
.topbar { position: sticky; top: 0; z-index: 10; min-height: 78px; display: flex; align-items: center; justify-content: space-between; padding: 12px clamp(24px, 4vw, 60px); border-bottom: 1px solid rgba(228,223,213,.75); background: rgba(246,243,237,.92); backdrop-filter: blur(14px); }
.topbar > div:first-of-type { display: grid; gap: 3px; }
.topbar-kicker { color: var(--muted); font-size: 11px; letter-spacing: .06em; }
.account-chip { display: flex; align-items: center; gap: 10px; }
.account-chip > span:nth-child(2) { display: grid; gap: 1px; font-size: 13px; }
.account-chip small { color: var(--muted); font-size: 11px; }
.account-chip button { margin-left: 8px; border: 0; background: transparent; color: var(--muted); cursor: pointer; font-size: 12px; }
.avatar { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 50%; background: var(--sage); color: white; font-family: SimSun, serif; }
.mobile-menu { display: none; border: 0; background: transparent; font-size: 22px; }
.main-content { width: min(1180px, 100%); margin: 0 auto; padding: 52px clamp(24px, 5vw, 70px) 90px; }
.page-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 30px; margin-bottom: 32px; }
.page-heading h1 { font-size: clamp(32px, 4vw, 46px); }
.page-heading p { margin: 0; }
.panel, .list-card { border: 1px solid var(--line); border-radius: 14px; background: var(--panel); box-shadow: 0 5px 20px rgba(61,54,44,.035); }
.stat-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin-bottom: 24px; }
.stat-card { padding: 18px 20px; border: 1px solid var(--line); border-radius: 12px; background: rgba(255,253,248,.7); }
.stat-card span { display: block; color: var(--muted); font-size: 12px; }
.stat-card strong { display: block; margin-top: 5px; font-family: Georgia, serif; font-size: 26px; }
.filter-row { display: flex; gap: 8px; margin-bottom: 15px; }
.filter-button { min-height: 36px; padding: 0 14px; border: 1px solid var(--line); border-radius: 20px; background: transparent; color: var(--muted); cursor: pointer; font-size: 13px; }
.filter-button.active { border-color: var(--sage); background: var(--sage); color: white; }
.card-list { display: grid; gap: 12px; }
.list-card { display: flex; align-items: center; gap: 16px; min-height: 80px; padding: 16px 18px; }
.list-card-main { min-width: 0; flex: 1; }
.list-card-main strong { display: block; overflow-wrap: anywhere; }
.list-card-main p { margin: 6px 0 0; color: var(--muted); font-size: 12px; line-height: 1.6; }
.card-actions { display: flex; align-items: center; gap: 6px; }
.text-button { min-height: 36px; padding: 0 10px; border: 0; border-radius: 7px; background: transparent; color: var(--sage); cursor: pointer; font-size: 12px; }
.text-button:hover { background: var(--sage-light); }
.text-button.danger { color: var(--danger); }
.complete-button { min-width: 72px; min-height: 38px; border: 1px solid #aac0b2; border-radius: 8px; background: var(--sage-light); color: #3f5d4d; cursor: pointer; font-weight: 700; }
.status-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 5px rgba(213,103,63,.11); }
.status-dot.done { background: #87938c; box-shadow: none; }
.priority-badge, .role-badge, .state-badge { display: inline-flex; align-items: center; min-height: 24px; padding: 0 8px; border-radius: 12px; background: #f1e8df; color: #9d4f31; font-size: 11px; font-weight: 700; }
.role-badge { background: var(--sage-light); color: var(--sage); }
.state-badge.inactive { background: #eeeae4; color: #8f8a81; }
.empty-state { padding: 60px 30px; border: 1px dashed #d7d0c4; border-radius: 14px; color: var(--muted); text-align: center; }
.empty-state strong { display: block; margin-bottom: 8px; color: var(--ink); font-family: SimSun, serif; font-size: 20px; }
.calendar-strip { display: grid; grid-template-columns: repeat(7, 1fr); gap: 8px; margin-bottom: 24px; }
.calendar-day { padding: 12px 8px; border: 1px solid var(--line); border-radius: 10px; background: rgba(255,255,255,.45); text-align: center; }
.calendar-day span, .calendar-day small { display: block; }
.calendar-day span { color: var(--muted); font-size: 11px; }
.calendar-day strong { display: block; margin: 4px 0; font-family: Georgia, serif; font-size: 20px; }
.calendar-day small { color: var(--accent); font-size: 10px; }
.calendar-day.today { border-color: var(--accent); background: #fff9f3; }
.schedule-time { min-width: 76px; font-family: Georgia, serif; font-size: 22px; }
.quote-layout { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(280px, .85fr); gap: 22px; }
.quote-editor { padding: 22px; }
.quote-editor label { display: flex; justify-content: space-between; margin-bottom: 10px; }
.quote-editor small { display: block; margin-top: 9px; color: var(--muted); }
.quote-preview { min-height: 360px; display: flex; flex-direction: column; justify-content: center; padding: 45px; border-radius: 14px; background: #dfe2d8; box-shadow: inset 0 0 35px rgba(43,48,42,.08); }
.quote-preview > span, .quote-preview > small { color: #718076; font-size: 11px; letter-spacing: .08em; }
.quote-preview blockquote { margin: 34px 0; font-family: SimSun, "Songti SC", serif; font-size: clamp(24px, 3vw, 38px); line-height: 1.55; }
.boundary-banner { display: flex; gap: 14px; margin-bottom: 22px; padding: 16px 18px; border-left: 4px solid var(--sage); background: var(--sage-light); color: #3e5448; }
.boundary-banner span { color: #687a70; font-size: 13px; }
.device-tip { display: flex; align-items: center; gap: 15px; margin-bottom: 22px; padding: 18px; border: 1px solid var(--line); border-radius: 13px; background: #fffdf8; }
.device-tip-icon { display: grid; place-items: center; width: 44px; height: 54px; border: 2px solid var(--ink); border-radius: 4px 4px 10px 4px; font-family: Georgia, serif; font-size: 23px; }
.device-tip p { margin: 4px 0 0; color: var(--muted); font-size: 13px; }
.account-form { max-width: 580px; padding: 26px; }

.modal-backdrop { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; padding: 20px; background: rgba(34,35,31,.5); backdrop-filter: blur(4px); }
.modal { width: min(590px, 100%); max-height: calc(100vh - 40px); overflow: auto; border-radius: 16px; background: var(--panel); box-shadow: var(--shadow); }
.modal > header { display: flex; justify-content: space-between; align-items: flex-start; padding: 24px 26px 15px; }
.modal h2 { margin: 5px 0 0; font-family: SimSun, serif; font-size: 28px; }
.close-button { border: 0; background: transparent; color: var(--muted); cursor: pointer; font-size: 28px; line-height: 1; }
.modal form > div { display: grid; gap: 16px; padding: 10px 26px 22px; }
.modal footer { display: flex; justify-content: flex-end; gap: 10px; padding: 18px 26px; border-top: 1px solid var(--line); }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-grid .full { grid-column: 1 / -1; }
.modal-message { color: var(--muted); line-height: 1.7; }
.token-box { min-height: 112px; font-family: Consolas, monospace; font-size: 12px; }
.token-warning { padding: 12px; border-radius: 8px; background: #fff1e8; color: #995035; font-size: 12px; line-height: 1.6; }
.toast { position: fixed; z-index: 200; right: 26px; bottom: 26px; max-width: min(390px, calc(100vw - 40px)); padding: 13px 18px; border-radius: 10px; background: #2c322e; color: white; box-shadow: var(--shadow); font-size: 13px; }
.toast.error { background: var(--danger); }

@media (max-width: 900px) {
  .login-view { grid-template-columns: 1fr; }
  .login-art { display: none; }
  .login-panel { min-height: 100vh; padding: 90px clamp(26px, 9vw, 70px) 50px; }
  .brand-login { top: 30px; }
  .app-shell { display: block; }
  .sidebar { transform: translateX(-100%); transition: transform .2s; box-shadow: 20px 0 50px rgba(0,0,0,.2); }
  .sidebar.open { transform: translateX(0); }
  .workspace { width: 100%; }
  .mobile-menu { display: block; }
  .topbar { justify-content: flex-start; gap: 15px; padding-inline: 18px; }
  .account-chip { margin-left: auto; }
  .account-chip > span:nth-child(2) { display: none; }
  .main-content { padding: 35px 18px 70px; }
  .quote-layout { grid-template-columns: 1fr; }
}

@media (max-width: 620px) {
  .page-heading { align-items: stretch; flex-direction: column; gap: 17px; }
  .page-heading .primary-button { width: 100%; }
  .stat-row { grid-template-columns: 1fr 1fr 1fr; gap: 7px; }
  .stat-card { padding: 13px; }
  .stat-card strong { font-size: 21px; }
  .calendar-strip { grid-template-columns: repeat(4, 1fr); }
  .calendar-day:nth-child(n+5) { display: none; }
  .list-card { align-items: flex-start; flex-wrap: wrap; }
  .card-actions { width: 100%; justify-content: flex-end; border-top: 1px solid var(--line); padding-top: 9px; }
  .form-grid { grid-template-columns: 1fr; }
  .form-grid .full { grid-column: auto; }
  .boundary-banner { flex-direction: column; }
  .account-chip button { margin-left: 0; }
}
