:root {
  color-scheme: light;
  --ink: #18332e;
  --ink-2: #27463f;
  --paper: #f5f2eb;
  --surface: #fffdf8;
  --surface-2: #ece8de;
  --line: #ded9ce;
  --muted: #777a76;
  --accent: #c66143;
  --accent-soft: #f2ded5;
  --green-soft: #dce8e1;
  --shadow: 0 18px 50px rgba(28, 45, 39, .09);
  --sidebar: 264px;
  font-family: Inter, "PingFang SC", "Microsoft YaHei", system-ui, -apple-system, sans-serif;
}

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

.brand { display: inline-flex; align-items: center; gap: 11px; font-size: 20px; font-weight: 800; letter-spacing: .08em; }
.brand-light { color: #fffdf7; }
.brand-mark { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 11px; background: #f2eee3; color: var(--ink); font-family: Georgia, "Songti SC", serif; font-size: 19px; letter-spacing: 0; }
.eyebrow { margin: 0 0 12px; color: #b8cbc3; font-size: 11px; font-weight: 800; letter-spacing: .2em; }
.eyebrow.accent { color: var(--accent); }
.muted { color: var(--muted); }

.auth-screen { display: grid; grid-template-columns: minmax(450px, 1.12fr) minmax(430px, .88fr); min-height: 100vh; }
.auth-story { position: relative; display: flex; flex-direction: column; padding: 54px clamp(54px, 8vw, 132px); overflow: hidden; color: #eef2ea; background: #142d28; }
.auth-story::before, .auth-story::after { content: ""; position: absolute; right: -17vw; top: 8vh; width: 48vw; height: 48vw; border: 1px solid rgba(255,255,255,.055); border-radius: 50%; }
.auth-story::after { right: -10vw; top: 16vh; width: 34vw; height: 34vw; box-shadow: 0 0 0 90px rgba(255,255,255,.018), 0 0 0 180px rgba(255,255,255,.018); }
.story-copy { position: relative; z-index: 1; margin: auto 0; max-width: 650px; }
.story-copy h1 { margin: 0 0 24px; font: 400 clamp(48px, 5.6vw, 84px)/1.27 Georgia, "Songti SC", "STSong", serif; letter-spacing: -.04em; }
.story-copy > p:last-child { max-width: 540px; margin: 0; color: #a9c2b9; font-size: 17px; line-height: 1.9; }
.auth-story blockquote { position: relative; z-index: 1; margin: 0; color: #8ba79d; font: 15px/1.8 Georgia, "Songti SC", serif; }
.auth-panel { display: grid; place-items: center; padding: 48px; background: #faf8f3; }
.auth-box { width: min(100%, 500px); }
.auth-box h2 { margin: 0 0 13px; font: 500 39px/1.3 Georgia, "Songti SC", serif; }
.auth-box .muted { margin: 0 0 34px; line-height: 1.7; }
.stack-form, .form-grid, .dialog form { display: grid; gap: 18px; }
label { display: grid; gap: 8px; color: #34443f; font-size: 13px; font-weight: 700; }
input, select, textarea { width: 100%; min-height: 46px; border: 1px solid var(--line); border-radius: 11px; outline: none; background: #fff; color: var(--ink); padding: 11px 13px; transition: border-color .16s, box-shadow .16s; }
textarea { min-height: 90px; resize: vertical; line-height: 1.65; }
input:focus, select:focus, textarea:focus { border-color: #78978d; box-shadow: 0 0 0 3px rgba(79, 124, 112, .12); }
.form-error { min-height: 18px; margin: -4px 0 0; color: #bd4f39; font-size: 13px; }
.privacy-note { margin: 22px 0 0; color: #a3a29d; font-size: 12px; text-align: center; }

.button { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 43px; border: 0; border-radius: 11px; padding: 10px 17px; font-weight: 750; cursor: pointer; transition: transform .15s, background .15s, opacity .15s; }
.button:hover { transform: translateY(-1px); }
.button:disabled { opacity: .55; cursor: wait; transform: none; }
.button-primary { background: var(--ink); color: #fff; box-shadow: 0 9px 24px rgba(24,51,46,.15); }
.button-soft { background: var(--green-soft); color: var(--ink); }
.button-ghost { border: 1px solid var(--line); background: #fff; }
.button-wide { width: 100%; min-height: 54px; }
.text-button { border: 0; padding: 7px 2px; color: var(--accent); background: transparent; font-weight: 750; cursor: pointer; }
.icon-button, .small-icon-button { display: inline-grid; place-items: center; border: 0; background: transparent; cursor: pointer; }
.icon-button { width: 40px; height: 40px; border-radius: 10px; font-size: 24px; }
.small-icon-button { width: 30px; height: 30px; border-radius: 8px; font-size: 18px; }
.icon-button:hover, .small-icon-button:hover { background: rgba(255,255,255,.08); }

.app-shell { min-height: 100vh; }
.sidebar { position: fixed; inset: 0 auto 0 0; z-index: 30; display: flex; flex-direction: column; width: var(--sidebar); padding: 27px 18px 20px; overflow-y: auto; color: #dbe5df; background: #17342f; }
.sidebar-head { display: flex; align-items: center; justify-content: space-between; padding: 0 10px 25px; }
.main-nav, .board-nav { display: grid; gap: 4px; }
.nav-item { display: grid; grid-template-columns: 25px 1fr auto; align-items: center; gap: 9px; width: 100%; min-height: 44px; border: 0; border-radius: 10px; padding: 9px 11px; color: #bacbc4; background: transparent; text-align: left; cursor: pointer; }
.nav-item:hover { color: #fff; background: rgba(255,255,255,.06); }
.nav-item.active { color: #fff; background: rgba(255,255,255,.11); }
.nav-item b { min-width: 24px; border-radius: 99px; padding: 2px 7px; color: #a9beb6; background: rgba(255,255,255,.07); font-size: 11px; text-align: center; }
.nav-icon { font-size: 18px; text-align: center; }
.sidebar-section-head { display: flex; align-items: center; justify-content: space-between; margin: 28px 10px 9px; color: #809c92; font-size: 10px; font-weight: 800; letter-spacing: .15em; text-transform: uppercase; }
.sidebar-section-head .small-icon-button { color: #b9ccc4; }
.board-nav .nav-item { grid-template-columns: 16px 1fr auto; }
.board-dot { width: 9px; height: 9px; border-radius: 3px; }
.sidebar-foot { display: grid; gap: 3px; margin-top: auto; padding-top: 26px; }
.account-row { display: grid; grid-template-columns: 38px 1fr 30px; align-items: center; gap: 10px; margin-top: 13px; border-top: 1px solid rgba(255,255,255,.1); padding: 18px 7px 0; }
.avatar { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 50%; color: var(--ink); background: #e8e1d4; font-family: Georgia, "Songti SC", serif; }
.account-row strong, .account-row small { display: block; max-width: 130px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.account-row strong { color: #fff; font-size: 13px; }
.account-row small { margin-top: 3px; color: #78978c; font-size: 10px; }
.account-row button { color: #9cb3aa; }
.sidebar-scrim { display: none; }

.main-content { min-height: 100vh; margin-left: var(--sidebar); }
.topbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 20px; min-height: 78px; border-bottom: 1px solid rgba(206,201,190,.8); padding: 14px clamp(24px, 4vw, 58px); background: rgba(245,242,235,.92); backdrop-filter: blur(14px); }
.global-search { display: grid; grid-template-columns: 24px minmax(100px, 1fr) auto; align-items: center; gap: 7px; width: min(560px, 50vw); min-height: 45px; border: 1px solid var(--line); border-radius: 12px; padding: 0 12px; background: rgba(255,255,255,.72); }
.global-search input { min-height: auto; border: 0; padding: 0; background: transparent; box-shadow: none; }
.global-search kbd { border: 1px solid #dedbd3; border-radius: 5px; padding: 3px 6px; color: #93938e; background: #f6f4ee; font-size: 10px; }
.top-actions { display: flex; gap: 9px; margin-left: auto; }
.content-wrap { width: min(1420px, 100%); margin: 0 auto; padding: 40px clamp(24px, 4vw, 58px) 80px; }
.page-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 24px; margin-bottom: 29px; }
.page-heading h1 { margin: 0 0 8px; font: 500 clamp(34px, 4vw, 48px)/1.15 Georgia, "Songti SC", serif; letter-spacing: -.03em; }
.page-heading > div > p:last-child { margin: 0; color: var(--muted); line-height: 1.7; }
.date-chip { border: 1px solid var(--line); border-radius: 99px; margin: 6px 0 0; padding: 8px 13px; color: #6f7772; background: rgba(255,255,255,.65); font-size: 12px; white-space: nowrap; }
.summary-grid { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 15px; }
.summary-card { position: relative; min-height: 155px; border: 1px solid rgba(217,211,200,.86); border-radius: 16px; padding: 22px; overflow: hidden; background: var(--surface); box-shadow: 0 8px 28px rgba(41,54,48,.035); }
.summary-card span, .summary-card small { display: block; color: #7b7f7b; font-size: 12px; }
.summary-card strong { display: block; margin: 15px 0 8px; font: 500 38px/1 Georgia, serif; }
.summary-card i { position: absolute; right: 17px; top: 17px; display: grid; place-items: center; width: 34px; height: 34px; border-radius: 10px; color: var(--accent); background: var(--accent-soft); font-style: normal; }
.summary-primary { color: #fff; border-color: var(--ink); background: var(--ink); }
.summary-primary span, .summary-primary small { color: #afc6bd; }
.summary-primary i { color: #fff; background: rgba(255,255,255,.12); }
.section-title-row { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin: 40px 0 16px; }
.section-title-row h2 { margin: 0 0 5px; font: 600 23px/1.3 Georgia, "Songti SC", serif; }
.section-title-row p { margin: 0; color: var(--muted); font-size: 12px; }
.board-grid { display: grid; grid-template-columns: repeat(5, minmax(150px,1fr)); gap: 13px; }
.board-card { position: relative; display: grid; min-height: 162px; border: 1px solid var(--line); border-radius: 15px; padding: 19px; overflow: hidden; background: var(--surface); cursor: pointer; transition: transform .16s, box-shadow .16s; }
.board-card:hover { transform: translateY(-3px); box-shadow: var(--shadow); }
.board-card::after { content: ""; position: absolute; right: -30px; bottom: -36px; width: 100px; height: 100px; border: 23px solid var(--board-color); border-radius: 50%; opacity: .07; }
.board-icon { display: grid; place-items: center; width: 37px; height: 37px; border-radius: 11px; color: #fff; background: var(--board-color); font: 600 17px Georgia, "Songti SC", serif; }
.board-card h3 { align-self: end; margin: 20px 0 4px; font-size: 15px; }
.board-card p { margin: 0; color: var(--muted); font-size: 11px; }
.board-card-menu { position: absolute; right: 9px; top: 10px; z-index: 2; width: 30px; height: 30px; border: 0; border-radius: 8px; color: var(--muted); background: transparent; cursor: pointer; }
.board-card-menu:hover { background: var(--surface-2); }

.item-list { display: grid; gap: 10px; }
.item-list.grid-layout { grid-template-columns: repeat(3, minmax(0,1fr)); gap: 14px; }
.item-card { position: relative; display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 14px; border: 1px solid var(--line); border-radius: 14px; padding: 18px 19px; background: var(--surface); transition: border-color .15s, box-shadow .15s; }
.item-card:hover { border-color: #c5c5ba; box-shadow: 0 9px 28px rgba(35,54,46,.055); }
.grid-layout .item-card { grid-template-columns: 1fr; min-height: 225px; }
.item-main { min-width: 0; }
.item-topline { display: flex; align-items: center; flex-wrap: wrap; gap: 7px; margin-bottom: 8px; }
.board-pill, .status-pill, .type-pill { display: inline-flex; align-items: center; border-radius: 99px; padding: 4px 8px; font-size: 10px; font-weight: 750; }
.board-pill { color: var(--board-color); background: color-mix(in srgb, var(--board-color) 12%, white); }
.status-pill { color: #75663f; background: #f0e8d0; }
.status-pill.read { color: #527264; background: #deebe5; }
.status-pill.reading { color: #5c6691; background: #e1e5f1; }
.type-pill { color: #777; background: #eeece6; }
.item-title { display: inline; margin: 0; font: 650 16px/1.55 Georgia, "Songti SC", "Microsoft YaHei", serif; }
.item-title-link:hover { color: var(--accent); }
.item-meta { display: flex; flex-wrap: wrap; gap: 7px 15px; margin-top: 9px; color: #8b8d89; font-size: 11px; }
.item-note { display: -webkit-box; margin: 10px 0 0; overflow: hidden; color: #606964; font-size: 12px; line-height: 1.6; -webkit-box-orient: vertical; -webkit-line-clamp: 2; }
.tag-row { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 10px; }
.tag { border-radius: 5px; padding: 3px 6px; color: #69716c; background: #efede7; font-size: 10px; }
.item-actions { display: flex; align-items: flex-start; gap: 3px; }
.item-action { display: grid; place-items: center; width: 34px; height: 34px; border: 0; border-radius: 9px; color: #8b8c87; background: transparent; cursor: pointer; }
.item-action:hover { color: var(--ink); background: var(--surface-2); }
.item-action.starred { color: #c18a32; }
.grid-layout .item-actions { position: absolute; right: 12px; top: 12px; }
.compact-list .item-card { padding: 15px 18px; }
.compact-list .item-note { display: none; }
.empty-state { display: grid; place-items: center; min-height: 250px; border: 1px dashed #d3cfc5; border-radius: 16px; padding: 35px; text-align: center; background: rgba(255,255,255,.35); }
.empty-state i { display: grid; place-items: center; width: 54px; height: 54px; border-radius: 50%; color: var(--accent); background: var(--accent-soft); font: 24px Georgia, serif; }
.empty-state h3 { margin: 16px 0 7px; font: 600 20px Georgia, "Songti SC", serif; }
.empty-state p { max-width: 360px; margin: 0 0 16px; color: var(--muted); font-size: 12px; line-height: 1.7; }

.library-heading { align-items: center; }
.view-switch { display: flex; border: 1px solid var(--line); border-radius: 10px; padding: 3px; background: var(--surface); }
.view-switch button { width: 37px; height: 32px; border: 0; border-radius: 7px; color: #92918b; background: transparent; cursor: pointer; }
.view-switch button.active { color: var(--ink); background: var(--surface-2); }
.filter-bar { display: flex; align-items: center; flex-wrap: wrap; gap: 9px; margin-bottom: 17px; border: 1px solid var(--line); border-radius: 13px; padding: 10px; background: rgba(255,255,255,.5); }
.filter-bar select { width: auto; min-height: 37px; border: 0; padding: 6px 32px 6px 10px; background-color: #fff; box-shadow: none; font-size: 12px; }
.result-count { margin-left: auto; padding-right: 7px; color: var(--muted); font-size: 11px; }

.dialog { width: min(94vw, 780px); max-height: min(90vh, 900px); border: 0; border-radius: 18px; padding: 0; overflow: auto; color: var(--ink); background: #faf8f3; box-shadow: 0 30px 90px rgba(13,31,26,.3); }
.dialog::backdrop { background: rgba(13,29,25,.55); backdrop-filter: blur(4px); }
.dialog > form, .dialog > div:not(.dialog-head) { padding: 28px; }
.dialog form { padding: 28px; }
.dialog-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; }
.dialog-head h2 { margin: 0; font: 600 28px/1.25 Georgia, "Songti SC", serif; }
.dialog-head p:last-child { margin: 8px 0 0; color: var(--muted); font-size: 12px; line-height: 1.6; }
.dialog-head .icon-button:hover { background: var(--surface-2); }
.form-grid { grid-template-columns: 1fr 1fr; }
.form-grid .full { grid-column: 1 / -1; }
.optional { color: #a3a39d; font-size: 10px; font-weight: 500; }
.input-with-action { display: grid; grid-template-columns: 1fr auto; }
.input-with-action input { border-radius: 11px 0 0 11px; }
.input-with-action button { border: 1px solid var(--line); border-left: 0; border-radius: 0 11px 11px 0; padding: 0 14px; color: var(--accent); background: #fff; cursor: pointer; }
.star-check { display: flex; align-items: center; align-self: end; min-height: 46px; border: 1px solid var(--line); border-radius: 11px; padding: 0 13px; background: #fff; }
.star-check input { width: 16px; min-height: auto; box-shadow: none; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 9px; border-top: 1px solid var(--line); margin: 4px -28px -28px; padding: 19px 28px; }
.small-dialog { width: min(92vw, 470px); }
.import-dialog { width: min(94vw, 720px); }
.import-guide { display: flex; align-items: center; flex-wrap: wrap; gap: 7px; border-radius: 12px; padding: 12px 14px; color: #6f716d; background: #ece9e0; font-size: 11px; }
.import-guide b { color: var(--ink); margin-right: 4px; }
.import-guide span::before { content: "✓"; margin-right: 4px; color: #518070; }
.import-preview { display: flex; align-items: center; justify-content: space-between; min-height: 30px; color: var(--muted); font-size: 11px; }
.help-dialog { width: min(94vw, 680px); padding: 28px; }
.help-steps { display: grid; gap: 12px; margin: 25px 0; padding: 0; list-style: none; counter-reset: step; }
.help-steps li { position: relative; display: grid; gap: 4px; min-height: 56px; padding: 8px 10px 8px 57px; counter-increment: step; }
.help-steps li::before { content: counter(step); position: absolute; left: 4px; top: 4px; display: grid; place-items: center; width: 37px; height: 37px; border-radius: 50%; color: #fff; background: var(--ink); font: 18px Georgia, serif; }
.help-steps span { color: var(--muted); font-size: 12px; line-height: 1.6; }
.help-note { border-left: 3px solid var(--accent); padding: 3px 0 3px 14px; }
.help-note p { margin: 6px 0 0; color: var(--muted); font-size: 12px; line-height: 1.65; }
.help-dialog .dialog-actions { margin: 24px -28px -28px; }
.toast { position: fixed; left: 50%; bottom: 28px; z-index: 100; max-width: min(90vw, 520px); border-radius: 11px; padding: 12px 17px; color: #fff; background: #18332e; box-shadow: var(--shadow); opacity: 0; pointer-events: none; transform: translate(-50%, 18px); transition: opacity .2s, transform .2s; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.error { background: #ad4f3a; }
.mobile-fab { display: none; }

@media (max-width: 1180px) {
  .summary-grid { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .board-grid { grid-template-columns: repeat(3, minmax(0,1fr)); }
  .item-list.grid-layout { grid-template-columns: repeat(2, minmax(0,1fr)); }
}

@media (max-width: 860px) {
  .mobile-only { display: inline-grid !important; }
  .auth-screen { grid-template-columns: 1fr; }
  .auth-story { min-height: 36vh; padding: 28px 30px 45px; }
  .story-copy { margin: 70px 0 20px; }
  .story-copy h1 { font-size: clamp(36px, 9vw, 56px); }
  .auth-story blockquote { display: none; }
  .auth-panel { padding: 40px 24px 55px; }
  .sidebar { transform: translateX(-105%); transition: transform .22s ease; }
  .sidebar.open { transform: translateX(0); }
  .sidebar-scrim { position: fixed; inset: 0; z-index: 25; width: 100%; border: 0; background: rgba(10,25,21,.48); }
  .sidebar.open + .sidebar-scrim { display: block; }
  .main-content { margin-left: 0; }
  .topbar { min-height: 70px; gap: 10px; padding: 11px 18px; }
  .global-search { width: auto; flex: 1; }
  .global-search kbd { display: none; }
  .desktop-label { display: none; }
  .content-wrap { padding: 30px 20px 90px; }
}

@media (max-width: 620px) {
  .top-actions .button-soft { display: none; }
  .top-actions .button-primary { display: none; }
  .global-search { min-width: 0; }
  .page-heading { display: grid; gap: 13px; }
  .page-heading h1 { font-size: 36px; }
  .date-chip { justify-self: start; }
  .summary-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .summary-card { min-height: 135px; padding: 17px; }
  .summary-card strong { font-size: 32px; }
  .summary-card i { right: 13px; top: 13px; width: 30px; height: 30px; }
  .board-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .board-card { min-height: 145px; padding: 15px; }
  .item-card { grid-template-columns: minmax(0,1fr); padding: 16px; }
  .item-actions { position: absolute; right: 8px; top: 8px; }
  .item-topline { padding-right: 70px; }
  .item-list.grid-layout { grid-template-columns: 1fr; }
  .library-heading { display: flex; }
  .filter-bar { display: grid; grid-template-columns: 1fr 1fr; }
  .filter-bar select { width: 100%; }
  .result-count { margin: 0; text-align: right; }
  .form-grid { grid-template-columns: 1fr; }
  .form-grid .full { grid-column: auto; }
  .dialog { width: 100vw; max-width: none; max-height: 94vh; border-radius: 20px 20px 0 0; margin: auto 0 0; }
  .dialog form, .help-dialog { padding: 22px 18px; }
  .dialog-actions { margin: 3px -18px -22px; padding: 16px 18px calc(16px + env(safe-area-inset-bottom)); }
  .help-dialog .dialog-actions { margin: 20px -18px -22px; }
  .import-guide { align-items: flex-start; flex-direction: column; }
  .mobile-fab { position: fixed; right: 20px; bottom: calc(20px + env(safe-area-inset-bottom)); z-index: 19; display: grid; place-items: center; width: 57px; height: 57px; border: 0; border-radius: 50%; color: #fff; background: var(--ink); box-shadow: 0 12px 30px rgba(24,51,46,.3); font-size: 27px; }
}

@media (max-width: 390px) {
  .summary-grid { grid-template-columns: 1fr; }
  .board-grid { grid-template-columns: 1fr; }
  .board-card { min-height: 125px; }
}
