.customers-entry { display:flex; align-items:center; gap:10px; margin:0 0 16px; padding:12px 14px; border:1px solid #38313a; border-radius:7px; color:#e9c9cf; text-decoration:none; font-size:13px; background:#292027; }
.customers-entry span:last-child { margin-left:auto; color:#b4808a; }
.customers-entry:hover { background:#39252e; color:#fff; }
:root {
  --page: #f6f7f9;
  --surface: #ffffff;
  --surface-soft: #f8f8fa;
  --surface-hover: #f1f2f5;
  --sidebar: #191b20;
  --sidebar-hover: #24272e;
  --sidebar-active: #2c3038;
  --text: #202228;
  --text-soft: #6c7078;
  --text-faint: #989ca5;
  --line: #e2e4e9;
  --line-strong: #d3d6dc;
  --accent: #5367e8;
  --accent-hover: #4357d3;
  --accent-soft: #eef0ff;
  --success: #3c9b62;
  --danger: #d14d4d;
  --shadow-sm: 0 1px 2px rgba(20, 24, 32, .05);
  --shadow-md: 0 12px 32px rgba(20, 24, 32, .12);
}

* { box-sizing: border-box; }
html, body { width: 100%; min-height: 100%; margin: 0; }
body {
  overflow: hidden;
  background: var(--page);
  color: var(--text);
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}
button, input, textarea, select { font: inherit; }
button, label, select { cursor: pointer; }
button:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible {
  outline: 2px solid rgba(83, 103, 232, .32);
  outline-offset: 2px;
}
.hidden { display: none !important; }
.eyebrow {
  margin: 0;
  color: var(--accent);
  font-size: 11px;
  font-weight: 650;
  letter-spacing: .02em;
}

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { border: 3px solid transparent; border-radius: 99px; background: #c8cbd1; background-clip: padding-box; }
::-webkit-scrollbar-thumb:hover { background: #aeb2ba; background-clip: padding-box; }

/* Opening scene */
.landing-screen {
  --landing-ink: #070809;
  --landing-paper: #f7f2e8;
  --landing-cola: #e31b2c;
  position: fixed; inset: 0; z-index: 140; overflow: hidden;
  color: var(--landing-paper); background:
    radial-gradient(circle at 80% 16%, rgba(227,27,44,.26), transparent 28%),
    radial-gradient(circle at 19% 73%, rgba(255,255,255,.07), transparent 24%), var(--landing-ink);
  isolation: isolate;
}
.landing-screen::before { content: ""; position: absolute; inset: 0; z-index: -1; background-image: linear-gradient(rgba(247,242,232,.035) 1px, transparent 1px), linear-gradient(90deg, rgba(247,242,232,.035) 1px, transparent 1px); background-size: 44px 44px; mask-image: linear-gradient(to bottom, #000, transparent 82%); }
.landing-screen.hidden { opacity: 0; pointer-events: none; transition: opacity .28s ease; }
.landing-topbar { position: relative; z-index: 4; display: flex; align-items: center; justify-content: space-between; padding: 28px clamp(25px, 5vw, 78px); }
.landing-brand { display: inline-flex; align-items: center; gap: 11px; font-size: 15px; font-weight: 800; letter-spacing: -.02em; }
.landing-brand img { width: 32px; height: 32px; filter: invert(1); }
.landing-status { display: flex; align-items: center; gap: 9px; color: rgba(247,242,232,.66); font: 700 10px/1 ui-monospace, Consolas, monospace; letter-spacing: .13em; }
.landing-status i { width: 7px; height: 7px; border-radius: 50%; background: var(--landing-cola); box-shadow: 0 0 0 5px rgba(227,27,44,.15); }
.landing-hero { position: relative; z-index: 3; display: grid; min-height: calc(100vh - 90px); place-content: center; justify-items: center; padding: 0 24px 78px; text-align: center; }
.landing-eyebrow { margin: 0 0 20px; color: var(--landing-cola); font: 800 11px/1 ui-monospace, Consolas, monospace; letter-spacing: .21em; }
.landing-hero h1 { max-width: 870px; margin: 0; color: var(--landing-paper); font-family: Georgia, "Songti SC", serif; font-size: clamp(52px, 7vw, 108px); font-weight: 500; line-height: .96; letter-spacing: -.07em; text-wrap: balance; }
.landing-hero h1 em { color: var(--landing-cola); font-style: normal; }
.landing-hero > p:not(.landing-eyebrow) { max-width: 555px; margin: 25px auto 0; color: rgba(247,242,232,.68); font-size: 15px; line-height: 1.85; }
#landingEnter { display: inline-flex; align-items: center; gap: 20px; min-height: 46px; margin-top: 31px; padding: 0 19px; border: 1px solid var(--landing-cola); background: var(--landing-cola); color: var(--landing-paper); font-size: 13px; font-weight: 750; cursor: pointer; }
#landingEnter:hover { background: #ff2639; }
.landing-screen footer { position: absolute; z-index: 4; bottom: 26px; left: clamp(25px, 5vw, 78px); right: clamp(25px, 5vw, 78px); display: flex; justify-content: space-between; color: rgba(247,242,232,.48); font: 700 10px/1.5 ui-monospace, Consolas, monospace; letter-spacing: .07em; }
.landing-screen footer strong { color: rgba(247,242,232,.8); }
.landing-rain { position: absolute; z-index: 1; inset: 0; overflow: hidden; pointer-events: none; }
.landing-drop { position: absolute; top: -120px; left: var(--x); will-change: transform, opacity; animation: landing-fall var(--duration) cubic-bezier(.25,.58,.45,1) var(--delay) forwards; }
.landing-drop.rice { width: var(--w); height: calc(var(--w) * 2.2); border: 1px solid rgba(40,34,24,.18); border-radius: 100%; background: linear-gradient(135deg, #fffef7 0 57%, #e5ddca 100%); box-shadow: 0 4px 13px rgba(0,0,0,.26); }
.landing-drop.can { width: var(--w); height: calc(var(--w) * 2.25); display: grid; place-items: center; border: 1px solid rgba(255,255,255,.48); border-radius: 4px 4px 7px 7px; background: linear-gradient(90deg, #8d0816 0 13%, var(--landing-cola) 14% 80%, #9b0717 81%); box-shadow: inset 3px 0 rgba(255,255,255,.16), inset -3px 0 rgba(0,0,0,.24), 0 9px 16px rgba(0,0,0,.29); color: #fff9ed; font: 900 7px/1 ui-monospace, monospace; letter-spacing: .06em; }
.landing-drop.can::before { content: ""; position: absolute; top: -3px; width: 76%; height: 4px; border-radius: 99px; background: #d2d2d2; box-shadow: 0 1px 0 rgba(0,0,0,.35); }
.landing-drop.can::after { content: ""; position: absolute; bottom: -3px; width: 74%; height: 4px; border-radius: 99px; background: #b5b5b5; }
@keyframes landing-fall { 0% { opacity: 0; transform: translate3d(0,-90px,0) rotate(var(--spin)); } 7% { opacity: 1; } 100% { opacity: 0; transform: translate3d(var(--drift), calc(100vh + 100px), 0) rotate(calc(var(--spin) + var(--turn))); } }
@media (max-width: 720px) { .landing-status, .landing-screen footer span { display: none; } .landing-topbar { padding-top: 20px; } .landing-hero h1 { font-size: clamp(52px, 16vw, 78px); } .landing-hero > p:not(.landing-eyebrow) { font-size: 13px; } .landing-screen footer { display: block; } }
@media (prefers-reduced-motion: reduce) { .landing-drop { display: none; } }

/* Loading */
.boot-screen {
  position: fixed;
  inset: 0;
  z-index: 120;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 14px;
  background: var(--page);
}
.boot-screen .brand-mark { width: 42px; height: 42px; }
.boot-screen p { margin: 0; color: var(--text-soft); font-size: 12px; }
.brand-mark {
  width: 36px;
  height: 36px;
  display: block;
  object-fit: contain;
  flex: 0 0 auto;
}

/* Login */
.login-view { min-height: 100vh; display: grid; grid-template-columns: minmax(520px, 1.05fr) minmax(460px, .95fr); background: var(--surface); }
.login-story {
  position: relative;
  min-height: 100vh;
  overflow: hidden;
  padding: 42px clamp(48px, 7vw, 110px);
  border-right: 1px solid var(--line);
  background: var(--page);
}
.login-brand { display: flex; align-items: center; gap: 12px; color: var(--text); font-size: 16px; font-weight: 700; }
.story-copy { position: absolute; left: clamp(48px, 7vw, 110px); right: 48px; top: 30%; max-width: 680px; }
.story-copy .eyebrow { margin-bottom: 18px; }
.story-copy h1 {
  max-width: 660px;
  margin: 0;
  font-size: clamp(44px, 4.4vw, 72px);
  font-weight: 720;
  line-height: 1.12;
  letter-spacing: -.055em;
}
.story-note { max-width: 480px; margin: 24px 0 0; color: var(--text-soft); font-size: 16px; line-height: 1.75; }
.mission-orbit { display: none; }
.archive-glance {
  position: absolute;
  left: clamp(48px, 7vw, 110px);
  right: clamp(48px, 7vw, 110px);
  bottom: 58px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}
.glance-line { min-width: 0; padding: 18px 20px; border-right: 1px solid var(--line); }
.glance-line:last-child { border-right: 0; }
.glance-line span, .glance-line time { display: block; }
.glance-line span { margin-bottom: 6px; color: var(--text); font-size: 12px; font-weight: 650; }
.glance-line time { overflow: hidden; color: var(--text-soft); font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.privacy-note { position: absolute; right: clamp(48px, 7vw, 110px); top: 51px; display: flex; align-items: center; gap: 8px; margin: 0; color: var(--text-soft); font-size: 11px; }
.privacy-note span { width: 7px; height: 7px; border-radius: 50%; background: var(--success); box-shadow: 0 0 0 3px rgba(60, 155, 98, .11); }
.login-panel { min-height: 100vh; display: grid; place-items: center; padding: 48px; background: var(--surface); }
.login-card { width: min(100%, 390px); }
.login-card::before { display: none; }
.login-card .eyebrow { margin-bottom: 10px; }
.login-card h2 { margin: 0; font-size: 31px; font-weight: 700; line-height: 1.2; letter-spacing: -.035em; }
.login-hint { margin: 11px 0 34px; color: var(--text-soft); font-size: 13px; line-height: 1.6; }
.auth-switch { display: grid; grid-template-columns: 1fr 1fr; gap: 3px; padding: 3px; border: 1px solid var(--line); border-radius: 7px; background: var(--surface-soft); }
.auth-switch button { min-height: 30px; border: 0; border-radius: 5px; background: transparent; color: var(--text-soft); font: inherit; font-size: 11px; font-weight: 600; }
.auth-switch button.active { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }
.phone-login-note { margin: 11px 0 0; color: var(--text-faint); font-size: 10px; line-height: 1.55; }
.code-button { min-width: 72px; color: var(--accent); font-weight: 650; }
.login-card > label { display: block; margin: 18px 0 7px; color: var(--text); font-size: 12px; font-weight: 600; }
.field-shell {
  min-height: 46px;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 0 12px;
  border: 1px solid var(--line-strong);
  border-radius: 7px;
  background: var(--surface);
  transition: border-color .15s, box-shadow .15s;
}
.field-shell:hover { border-color: #b9bdc5; }
.field-shell:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(83, 103, 232, .11); }
.field-shell input { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; color: var(--text); font-size: 14px; }
.field-icon { color: var(--text-faint); font-size: 13px; }
.icon-button { padding: 4px 0 4px 8px; border: 0; background: transparent; color: var(--text-soft); font-size: 11px; }
.icon-button:hover { color: var(--text); }
.form-error { min-height: 18px; margin: 10px 0 -2px; color: var(--danger); font-size: 12px; }
.primary-button {
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 0 16px;
  border: 1px solid var(--accent);
  border-radius: 7px;
  background: var(--accent);
  color: #fff;
  font-size: 13px;
  font-weight: 650;
  box-shadow: 0 1px 2px rgba(42, 53, 126, .2);
  transition: background .15s, border-color .15s, transform .15s;
}
.primary-button:hover { border-color: var(--accent-hover); background: var(--accent-hover); }
.primary-button:active { transform: translateY(1px); }
.primary-button:disabled { opacity: .55; cursor: wait; }
.login-button { width: 100%; min-height: 46px; justify-content: space-between; margin-top: 22px; }
.security-copy { margin: 15px 0 0; color: var(--text-faint); font-size: 10px; line-height: 1.55; text-align: center; }

/* App shell */
.app-shell { height: 100vh; display: grid; grid-template-columns: 238px minmax(330px, 372px) minmax(520px, 1fr); overflow: hidden; background: var(--surface); }
.sidebar {
  z-index: 30;
  height: 100vh;
  display: flex;
  flex-direction: column;
  padding: 14px 12px 12px;
  border-right: 1px solid #2b2e35;
  background: var(--sidebar);
  color: #fff;
}
.sidebar-head { min-height: 48px; display: flex; align-items: center; justify-content: space-between; padding: 2px 6px 12px; }
.login-brand.compact { gap: 10px; color: #f4f4f5; font-size: 14px; font-weight: 650; }
.login-brand.compact .brand-mark { width: 30px; height: 30px; filter: invert(1); }
.sidebar-close { display: none; padding: 3px 6px; border: 0; background: transparent; color: #a9acb3; font-size: 22px; }
.new-note-button {
  width: 100%;
  min-height: 40px;
  margin: 4px 0 8px;
  padding: 0 12px;
  border: 1px solid #3a3e47;
  border-radius: 7px;
  background: #292c33;
  color: #f7f7f8;
  font-size: 12px;
  font-weight: 600;
  text-align: left;
  box-shadow: 0 1px 2px rgba(0, 0, 0, .12);
}
.new-note-button span { display: inline-block; margin-right: 7px; color: #cfd3ff; }
.new-note-button:hover { border-color: #4b505b; background: #31353d; }
.side-nav { flex: 1; margin-top: 4px; overflow-y: auto; }
.nav-label { margin: 20px 10px 7px; color: #747982; font-size: 10px; font-weight: 600; }
.categories-label { margin-top: 24px; }
.nav-item {
  width: 100%;
  min-height: 36px;
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr) auto;
  align-items: center;
  gap: 5px;
  margin: 1px 0;
  padding: 0 10px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: #aeb2ba;
  text-align: left;
  font-size: 12px;
}
.nav-item:hover { background: var(--sidebar-hover); color: #fff; }
.nav-item.active { background: var(--sidebar-active); color: #fff; }
.nav-glyph { color: #858b96; font-size: 13px; text-align: center; }
.nav-item.active .nav-glyph { color: #aeb8ff; }
.nav-item b { min-width: 20px; color: #747982; font-size: 10px; font-weight: 500; text-align: right; }
.nav-item.active b { color: #b6bac2; }
.sidebar-foot { padding-top: 10px; border-top: 1px solid #2d3037; }
.storage-meter { padding: 5px 8px 13px; color: #7e838c; font-size: 9px; }
.storage-meter > div:first-child { display: flex; justify-content: space-between; margin-bottom: 8px; }
.meter-track { height: 3px; overflow: hidden; border-radius: 99px; background: #30343b; }
.meter-track span { display: block; width: 5%; height: 100%; border-radius: inherit; background: var(--accent); transition: width .3s ease; }
.account-chip {
  width: 100%;
  min-height: 50px;
  display: grid;
  grid-template-columns: 31px minmax(0, 1fr) auto;
  align-items: center;
  gap: 9px;
  padding: 7px 8px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: #aeb2ba;
  text-align: left;
}
.account-chip:hover { background: var(--sidebar-hover); }
.avatar { width: 31px; height: 31px; display: grid; place-items: center; border-radius: 50%; background: #343841; color: #e9eaff; font-size: 12px; font-weight: 650; }
.account-chip strong, .account-chip small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.account-chip strong { color: #f5f5f6; font-size: 11px; font-weight: 600; }
.account-chip small { margin-top: 2px; color: #777c85; font-size: 9px; }
.account-security-button { width: 100%; margin: 0 0 3px; padding: 7px 8px; border: 0; border-radius: 6px; background: transparent; color: #9da2ad; font: inherit; font-size: 10px; text-align: left; }
.account-security-button:hover { background: var(--sidebar-hover); color: #fff; }

/* Library list */
.library-column { min-width: 0; height: 100vh; display: flex; flex-direction: column; overflow: hidden; border-right: 1px solid var(--line); background: var(--surface-soft); }
.library-header {
  min-height: 84px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 20px 12px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}
.library-header .eyebrow { margin-bottom: 4px; color: var(--text-faint); }
.library-header h1 { margin: 0; font-size: 24px; font-weight: 700; line-height: 1.2; letter-spacing: -.035em; }
.mobile-menu, .mobile-new { display: none; }
.search-shell {
  min-height: 40px;
  display: flex;
  align-items: center;
  gap: 9px;
  margin: 14px 14px 9px;
  padding: 0 11px;
  border: 1px solid var(--line-strong);
  border-radius: 7px;
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  transition: border-color .15s, box-shadow .15s;
}
.search-shell:hover { border-color: #bdc1c9; }
.search-shell:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(83, 103, 232, .09); }
.search-shell > span { color: var(--text-faint); font-size: 18px; }
.search-shell input { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; color: var(--text); font-size: 12px; }
kbd { padding: 2px 6px; border: 1px solid var(--line); border-radius: 4px; background: var(--surface-soft); color: var(--text-faint); font-family: inherit; font-size: 9px; box-shadow: inset 0 -1px rgba(0, 0, 0, .04); }
.list-toolbar { min-height: 38px; display: flex; align-items: center; justify-content: space-between; padding: 0 15px; border-bottom: 1px solid var(--line); color: var(--text-soft); font-size: 10px; }
.list-toolbar p { margin: 0; }
.list-toolbar strong { color: var(--text); font-size: 11px; font-weight: 650; }
.list-toolbar select { padding: 4px 0; border: 0; outline: 0; background: transparent; color: var(--text-soft); font-size: 10px; }
.note-list { flex: 1; overflow-y: auto; padding: 6px 8px 14px; }
.note-card {
  position: relative;
  width: 100%;
  display: block;
  margin: 2px 0;
  padding: 14px 13px 13px;
  border: 1px solid transparent;
  border-radius: 7px;
  background: transparent;
  color: var(--text);
  text-align: left;
  transition: background .12s, border-color .12s;
}
.note-card:hover { background: var(--surface); }
.note-card.active { border-color: #dce0ff; background: var(--accent-soft); }
.note-card.active::before { content: ""; position: absolute; left: -1px; top: 10px; bottom: 10px; width: 2px; border-radius: 2px; background: var(--accent); }
.note-card .card-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.note-card h3 { overflow: hidden; margin: 0; font-size: 13px; font-weight: 650; line-height: 1.45; text-overflow: ellipsis; white-space: nowrap; }
.pin-mark { flex: 0 0 auto; color: var(--accent); font-size: 8px; }
.note-card p { display: -webkit-box; overflow: hidden; min-height: 35px; margin: 7px 0 11px; color: var(--text-soft); font-size: 11px; line-height: 1.6; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.card-meta { display: flex; align-items: center; gap: 7px; overflow: hidden; color: var(--text-faint); font-size: 9px; }
.category-pill { max-width: 92px; overflow: hidden; padding: 3px 6px; border-radius: 4px; background: #e4e7ff; color: #4f5fc4; font-weight: 550; text-overflow: ellipsis; white-space: nowrap; }
.tag-pill { max-width: 105px; overflow: hidden; color: var(--text-soft); text-overflow: ellipsis; white-space: nowrap; }
.empty-state { flex: 1; display: grid; place-content: center; justify-items: center; padding: 40px; text-align: center; }
.empty-symbol { width: 40px; height: 40px; display: grid; place-items: center; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); color: var(--accent); font-size: 17px; box-shadow: var(--shadow-sm); }
.empty-state h2 { margin: 15px 0 6px; font-size: 17px; font-weight: 650; }
.empty-state p { max-width: 260px; margin: 0 0 17px; color: var(--text-soft); font-size: 11px; line-height: 1.6; }
.secondary-button {
  min-height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 13px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background: var(--surface);
  color: var(--text);
  font-size: 11px;
  font-weight: 550;
  box-shadow: var(--shadow-sm);
}
.secondary-button:hover { border-color: #b8bcc4; background: var(--surface-hover); }

/* Editor */
.editor-panel { min-width: 0; height: 100vh; overflow: hidden; background: var(--surface); }
.editor-empty { height: 100%; display: grid; place-content: center; justify-items: center; padding: 48px; text-align: center; }
.editor-empty-mark { width: 48px; height: 48px; display: grid; place-items: center; border: 1px solid #dfe2ff; border-radius: 13px; background: var(--accent-soft); color: var(--accent); font-family: Georgia, serif; font-size: 16px; font-weight: 700; }
.editor-empty h2 { margin: 17px 0 6px; font-size: 18px; font-weight: 650; letter-spacing: -.025em; }
.editor-empty p { margin: 0; color: var(--text-soft); font-size: 12px; }
.editor-content { height: 100%; display: flex; flex-direction: column; }
.editor-actions { min-height: 56px; display: flex; align-items: center; justify-content: space-between; padding: 0 18px; border-bottom: 1px solid var(--line); background: rgba(255, 255, 255, .97); }
.save-state { display: flex; align-items: center; gap: 7px; color: var(--text-faint); font-size: 10px; }
.save-state span:first-child { width: 6px; height: 6px; border-radius: 50%; background: #b8bbc1; }
.save-state.dirty span:first-child { background: #e2a43a; }
.save-state.saved span:first-child { background: var(--success); }
.editor-action-group { display: flex; align-items: center; gap: 4px; }
.quiet-button { min-height: 34px; padding: 0 10px; border: 0; border-radius: 5px; background: transparent; color: var(--text-soft); font-size: 11px; }
.quiet-button:hover { background: var(--surface-hover); color: var(--text); }
.quiet-button.active { background: var(--accent-soft); color: var(--accent); }
.danger-text { color: var(--danger); }
.danger-text:hover { background: #fff0f0; color: #b83e3e; }
.primary-button.small { min-height: 34px; padding: 0 15px; font-size: 11px; }
.mobile-back { display: none; }
.editor-scroll { flex: 1; overflow-y: auto; padding: 42px clamp(32px, 5vw, 76px) 72px; }
.editor-scroll > * { width: min(100%, 1100px); margin-left: auto; margin-right: auto; }
.title-input { width: min(100%, 1100px); display: block; padding: 0 0 22px; border: 0; outline: 0; background: transparent; color: var(--text); font-size: clamp(32px, 3.2vw, 46px); font-weight: 720; line-height: 1.2; letter-spacing: -.045em; }
.title-input::placeholder { color: #b1b4bb; }
.meta-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 2px; }
.meta-grid label, .source-field { min-height: 44px; display: flex; align-items: center; padding: 0 12px; border: 1px solid var(--line); border-radius: 6px; background: var(--surface-soft); }
.meta-grid label span, .source-field span { flex: 0 0 auto; width: 58px; color: var(--text-faint); font-size: 10px; }
.meta-grid input, .source-field input { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; color: var(--text); font-size: 12px; }
.source-field { margin-top: 10px; margin-bottom: 24px; }
.editor-tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); }
.editor-tabs button { position: relative; padding: 10px 12px; border: 0; border-radius: 5px 5px 0 0; background: transparent; color: var(--text-soft); font-size: 11px; }
.editor-tabs button:hover { background: var(--surface-hover); color: var(--text); }
.editor-tabs button.active { color: var(--text); font-weight: 600; }
.editor-tabs button.active::after { content: ""; position: absolute; left: 10px; right: 10px; bottom: -1px; height: 2px; background: var(--accent); }
.content-input { width: min(100%, 1100px); min-height: 370px; resize: vertical; padding: 24px 2px; border: 0; outline: 0; background: transparent; color: #303239; font: 15px/1.9 Inter, ui-sans-serif, "PingFang SC", "Microsoft YaHei", sans-serif; }
.markdown-preview { min-height: 370px; padding: 24px 2px; color: #303239; font-size: 15px; line-height: 1.85; }
.markdown-preview h1, .markdown-preview h2, .markdown-preview h3 { color: var(--text); font-weight: 700; line-height: 1.25; letter-spacing: -.025em; }
.markdown-preview blockquote { margin-left: 0; padding: 11px 15px; border-left: 3px solid var(--accent); border-radius: 0 5px 5px 0; background: var(--surface-soft); color: var(--text-soft); }
.markdown-preview code { padding: 2px 5px; border-radius: 4px; background: #f0f1f3; color: #4d55a8; font-size: .88em; }
.markdown-preview pre { overflow-x: auto; padding: 17px; border: 1px solid var(--line); border-radius: 7px; background: #24262c; color: #f0f1f3; }
.markdown-preview pre code { padding: 0; background: transparent; color: inherit; }
.markdown-preview a { color: var(--accent); }
.attachments-section { margin-top: 24px; padding-top: 22px; border-top: 1px solid var(--line); }
.attachments-head { display: flex; align-items: center; justify-content: space-between; gap: 20px; }
.attachments-head h3 { margin: 0 0 4px; font-size: 16px; font-weight: 650; }
.attachments-head p { margin: 0; color: var(--text-faint); font-size: 10px; }
.upload-button input { display: none; }
.upload-button.disabled { opacity: .45; pointer-events: none; }
.attachment-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px; margin-top: 16px; }
.attachment-card { min-width: 0; padding: 12px; border: 1px solid var(--line); border-radius: 7px; background: var(--surface); box-shadow: var(--shadow-sm); }
.attachment-card:hover { border-color: var(--line-strong); }
.attachment-main { display: grid; grid-template-columns: 38px minmax(0, 1fr); align-items: center; gap: 10px; }
.file-glyph { width: 38px; height: 38px; display: grid; place-items: center; border-radius: 7px; background: var(--accent-soft); color: var(--accent); font-size: 9px; font-weight: 700; }
.attachment-main strong { display: block; overflow: hidden; color: var(--text); font-size: 11px; font-weight: 600; text-overflow: ellipsis; white-space: nowrap; }
.attachment-main small { display: block; margin-top: 3px; color: var(--text-faint); font-size: 9px; }
.attachment-actions { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; margin-top: 11px; }
.attachment-actions button { min-height: 29px; border: 0; border-radius: 4px; background: var(--surface-soft); color: var(--text-soft); font-size: 9px; }
.attachment-actions button:hover { background: var(--surface-hover); color: var(--text); }
.attachment-actions button[data-action="remove"]:hover { background: #fff0f0; color: var(--danger); }
.attachment-hint { margin: 13px 0 0; color: var(--text-faint); font-size: 10px; }
.upload-progress { margin-top: 14px; }
.upload-progress > span { display: block; width: 36%; height: 3px; border-radius: 99px; background: var(--accent); animation: upload 1s ease-in-out infinite alternate; }
.upload-progress p { margin: 7px 0 0; color: var(--text-soft); font-size: 10px; }
@keyframes upload { to { width: 86%; opacity: .55; } }

/* Modal and feedback */
.modal { position: fixed; inset: 0; z-index: 80; display: grid; place-items: center; padding: 24px; background: rgba(25, 27, 32, .64); backdrop-filter: blur(2px); }
.modal-card { width: min(980px, 96vw); max-height: 92vh; overflow: hidden; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); box-shadow: var(--shadow-md); }
.modal-card header { min-height: 54px; display: flex; align-items: center; justify-content: space-between; padding: 0 17px; border-bottom: 1px solid var(--line); }
.modal-card h2 { overflow: hidden; margin: 0; font-size: 13px; font-weight: 650; text-overflow: ellipsis; white-space: nowrap; }
.modal-card header button { padding: 4px 8px; border: 0; border-radius: 5px; background: transparent; color: var(--text-soft); font-size: 22px; }
.modal-card header button:hover { background: var(--surface-hover); color: var(--text); }
.preview-body { height: min(760px, calc(92vh - 54px)); display: grid; place-items: center; overflow: auto; background: #24262c; }
.preview-body img, .preview-body video { display: block; max-width: 100%; max-height: 100%; }
.preview-body audio { width: min(640px, 82%); }
.preview-body iframe { width: 100%; height: 100%; border: 0; background: var(--surface); }
.security-card { width: min(92vw, 390px); padding: 22px; }
.security-card header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 9px; }
.security-card header h2 { margin: 0; font-size: 18px; }
.security-card header button { border: 0; background: transparent; color: var(--text-soft); font-size: 22px; }
.security-card > p:not(.form-error) { margin: 0 0 18px; color: var(--text-soft); font-size: 12px; line-height: 1.6; }
.security-card label { display: block; margin: 14px 0 6px; font-size: 11px; font-weight: 650; }
.security-card input { box-sizing: border-box; width: 100%; min-height: 40px; padding: 0 10px; border: 1px solid var(--line-strong); border-radius: 6px; outline: 0; background: var(--surface); color: var(--text); font: inherit; font-size: 12px; }
.security-card input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(83, 103, 232, .11); }
.security-code-row { display: grid; grid-template-columns: 1fr auto; gap: 8px; }
.security-code-row .secondary-button { min-height: 40px; padding-inline: 10px; font-size: 11px; }
.security-card > .primary-button { width: 100%; margin-top: 10px; }
.toast-region { position: fixed; right: 18px; bottom: 18px; z-index: 100; display: grid; gap: 8px; }
.toast { min-width: 230px; max-width: 380px; padding: 12px 14px; border: 1px solid var(--line-strong); border-radius: 7px; background: var(--surface); color: var(--text); font-size: 11px; box-shadow: var(--shadow-md); }
.toast.error { border-color: #f0c8c8; color: #a73f3f; }
.toast.success { border-color: #c5e5d0; color: #2e7950; }
.list-loading { display: grid; gap: 6px; padding: 7px; }
.list-loading i { display: block; height: 94px; border-radius: 7px; background: #eceef1; animation: pulse 1.1s ease-in-out infinite alternate; }
.attachment-loading { grid-column: 1 / -1; padding: 18px; color: var(--text-soft); font-size: 11px; }
@keyframes pulse { to { background: #f5f6f8; } }

@media (max-width: 1120px) {
  .app-shell { grid-template-columns: 218px 340px minmax(450px, 1fr); }
  .editor-scroll { padding-left: 34px; padding-right: 34px; }
  .login-story { padding-left: 54px; padding-right: 54px; }
  .story-copy, .archive-glance { left: 54px; right: 54px; }
}

@media (max-width: 900px) {
  .login-view { grid-template-columns: 1fr; }
  .login-story { display: none; }
  .login-panel { min-height: 100vh; background: var(--page); }
  .login-card { padding: 28px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); box-shadow: var(--shadow-sm); }
  .app-shell { grid-template-columns: 330px 1fr; }
  .sidebar { position: fixed; left: 0; top: 0; width: 248px; transform: translateX(-102%); transition: transform .2s ease; box-shadow: 18px 0 36px rgba(17, 19, 23, .2); }
  .sidebar.open { transform: translateX(0); }
  .sidebar-close, .mobile-menu, .mobile-new { display: inline-grid; place-items: center; }
  .mobile-menu, .mobile-new { width: 34px; height: 34px; border: 1px solid var(--line); border-radius: 6px; background: var(--surface); color: var(--text); }
  .library-header { gap: 10px; padding-left: 14px; }
  .library-header > div { flex: 1; }
}

@media (max-width: 680px) {
  .app-shell { display: block; }
  .library-column, .editor-panel { width: 100%; }
  .library-column { border: 0; }
  .library-header { min-height: 75px; padding: 13px 13px 10px; }
  .library-header h1 { font-size: 21px; }
  .search-shell { margin-left: 10px; margin-right: 10px; }
  .note-list { padding-left: 5px; padding-right: 5px; }
  .editor-panel { position: fixed; inset: 0; z-index: 20; transform: translateX(102%); transition: transform .22s ease; }
  .editor-panel.mobile-open { transform: translateX(0); }
  .editor-empty { display: none; }
  .editor-actions { padding: 0 10px; }
  .mobile-back { width: 32px; height: 32px; display: inline-grid; place-items: center; margin-right: 6px; border: 1px solid var(--line); border-radius: 6px; background: var(--surface); color: var(--text); }
  .save-state { flex: 1; }
  .quiet-button { padding: 0 7px; font-size: 10px; }
  .primary-button.small { padding: 0 11px; }
  .editor-scroll { padding: 28px 16px 56px; }
  .title-input { font-size: 32px; }
  .meta-grid { grid-template-columns: 1fr; gap: 8px; }
  .content-input, .markdown-preview { min-height: 300px; }
  .attachments-head { align-items: center; }
  .toast-region { left: 10px; right: 10px; bottom: 10px; }
  .toast { min-width: 0; max-width: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
