:root {
    --teal-50: #f3fbf9;
    --teal-100: #d7f4ee;
    --teal-200: #b4e8dd;
    --teal-300: #7fd4c4;
    --teal-400: #3fb9a5;
    --teal-500: #1a9d8a;
    --teal-600: #0f8073;
    --teal-700: #0f675e;
    --teal-800: #11534d;
    --teal-900: #123f3c;
    --ink: #143532;
    --muted: #5b7a76;
    --line: rgba(15, 103, 94, 0.14);
    --card: #ffffff;
    --shadow: 0 18px 40px rgba(18, 63, 60, 0.12);
    --radius: 16px;
    --serif: "Source Han Serif SC", "Noto Serif SC", "Songti SC", "STSong", "SimSun", serif;
    --sans: "PingFang SC", "Microsoft YaHei", "Noto Sans SC", sans-serif;
    --scroll-size: 6px;
    --scroll-thumb: rgba(17, 83, 77, 0.32);
    --scroll-thumb-hover: rgba(17, 83, 77, 0.55);
    --scroll-track: transparent;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html {
    scrollbar-width: thin;
    scrollbar-color: var(--scroll-thumb) var(--scroll-track);
}
* {
    scrollbar-width: thin;
    scrollbar-color: var(--scroll-thumb) var(--scroll-track);
}
::-webkit-scrollbar,
*::-webkit-scrollbar {
    width: var(--scroll-size);
    height: var(--scroll-size);
}
::-webkit-scrollbar-track,
*::-webkit-scrollbar-track {
    background: var(--scroll-track);
}
::-webkit-scrollbar-thumb,
*::-webkit-scrollbar-thumb {
    background-color: var(--scroll-thumb);
    border-radius: 99px;
}
::-webkit-scrollbar-thumb:hover,
*::-webkit-scrollbar-thumb:hover {
    background-color: var(--scroll-thumb-hover);
}
::-webkit-scrollbar-corner,
*::-webkit-scrollbar-corner {
    background: transparent;
}
body {
    font-family: var(--sans);
    color: var(--ink);
    background: var(--teal-50);
    min-height: 100vh;
}
a { color: var(--teal-700); text-decoration: none; }
button, input, select, textarea { font-family: inherit; }
img { max-width: 100%; }

.muted { color: var(--muted); }
.small { font-size: 12px; line-height: 1.5; }
.link { font-size: 13px; }

/* ===== login ===== */
.login-body {
    min-height: 100vh;
    overflow: hidden;
    background:
        url("../img/login-bg.svg") center / cover no-repeat,
        linear-gradient(135deg, #0b2f2d 0%, #0f534d 48%, #1a8f7e 100%);
    background-color: #0f534d;
}
.login-bg {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    pointer-events: none;
    background:
        url("../img/login-bg.svg") center / cover no-repeat,
        radial-gradient(1200px 600px at 10% 10%, rgba(63, 185, 165, .28), transparent 55%),
        radial-gradient(900px 500px at 90% 20%, rgba(234, 250, 246, .18), transparent 46%),
        linear-gradient(135deg, #0b2f2d 0%, #0f534d 48%, #1a8f7e 100%);
    background-color: #0f534d;
}
.paper-grain {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    opacity: .1;
    background-image: repeating-linear-gradient(0deg, rgba(255,255,255,.35) 0 1px, transparent 1px 8px);
}
.orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(2px);
    animation: float 9s ease-in-out infinite;
}
.orb-a { width: 280px; height: 280px; left: 8%; top: 18%; background: rgba(127, 212, 196, .28); }
.orb-b { width: 180px; height: 180px; right: 12%; top: 12%; background: rgba(255,255,255,.12); animation-delay: -3s; }
.orb-c { width: 320px; height: 320px; right: 18%; bottom: -60px; background: rgba(15, 103, 94, .35); animation-delay: -5s; }
@keyframes float {
    0%, 100% { transform: translateY(0) scale(1); }
    50% { transform: translateY(-22px) scale(1.04); }
}

.login-wrap {
    position: relative;
    z-index: 1;
    min-height: 100vh;
    display: grid;
    grid-template-columns: 1.1fr .9fr;
    gap: 48px;
    align-items: center;
    max-width: 1080px;
    margin: 0 auto;
    padding: 48px 32px;
}
.login-intro { color: #e7f7f3; }
.login-intro h1 {
    font-family: var(--serif);
    font-size: 48px;
    margin: 18px 0 12px;
    letter-spacing: .12em;
}
.login-intro p { max-width: 420px; line-height: 1.8; color: rgba(231,247,243,.86); }
.login-points { padding: 0; margin: 28px 0 0; list-style: none; }
.login-points li {
    margin: 10px 0;
    padding-left: 22px;
    position: relative;
    color: #d7f4ee;
}
.login-points li::before {
    content: "";
    width: 8px; height: 8px;
    border-radius: 50%;
    background: #7fd4c4;
    position: absolute;
    left: 0; top: 8px;
    box-shadow: 0 0 0 4px rgba(127,212,196,.18);
}

.seal {
    width: 72px; height: 72px;
    border: 2px solid rgba(231,247,243,.85);
    color: #e7f7f3;
    display: grid;
    place-items: center;
    font-family: var(--serif);
    font-size: 26px;
    letter-spacing: .2em;
    transform: rotate(-8deg);
    background: rgba(255,255,255,.06);
    box-shadow: inset 0 0 0 4px rgba(231,247,243,.2);
}
.seal-sm {
    width: 42px; height: 42px;
    font-size: 15px;
    letter-spacing: .12em;
    color: #d7f4ee;
    border-color: rgba(215,244,238,.7);
    flex-shrink: 0;
}

.login-card {
    background: rgba(255,255,255,.94);
    border-radius: 24px;
    padding: 36px 32px 28px;
    box-shadow: var(--shadow);
    backdrop-filter: blur(10px);
    animation: rise .6s ease both;
}
@keyframes rise {
    from { opacity: 0; transform: translateY(16px); }
    to { opacity: 1; transform: none; }
}
.login-card h2 {
    font-family: var(--serif);
    margin: 0 0 6px;
    font-size: 28px;
}
.login-sub { margin: 0 0 24px; color: var(--muted); }
.field { display: block; margin-bottom: 16px; }
.field span {
    display: block;
    font-size: 13px;
    color: var(--teal-800);
    margin-bottom: 6px;
}
.field input, .field select, .field textarea,
.form-control {
    width: 100%;
    border: 1px solid var(--line);
    background: #fbfffe;
    border-radius: 12px;
    padding: 12px 14px;
    font-size: 14px;
    color: var(--ink);
    outline: none;
    transition: border-color .2s, box-shadow .2s, transform .2s;
}
.field textarea, textarea.form-control { min-height: 110px; resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus, .form-control:focus {
    border-color: var(--teal-500);
    box-shadow: 0 0 0 4px rgba(26,157,138,.14);
}
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-msg { min-height: 22px; color: #b42318; font-size: 13px; margin: 8px 0 0; }
.login-hint {
    margin: 18px 0 0;
    font-size: 12px;
    color: var(--muted);
    text-align: center;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    border: 0;
    border-radius: 12px;
    padding: 10px 16px;
    cursor: pointer;
    font-size: 14px;
    transition: transform .15s ease, box-shadow .15s ease, background .15s ease;
}
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn-primary {
    background: linear-gradient(180deg, #1aa38f, var(--teal-700));
    color: #fff;
    box-shadow: 0 8px 18px rgba(15,103,94,.28);
}
.btn-primary:hover { box-shadow: 0 12px 22px rgba(15,103,94,.32); }
.btn-ghost {
    background: transparent;
    color: var(--teal-800);
    border: 1px solid var(--line);
}
.btn-danger {
    background: #fff;
    color: #b42318;
    border: 1px solid rgba(180,35,24,.2);
}
.btn-block { width: 100%; padding: 12px; font-size: 15px; }
.btn[disabled] { opacity: .6; cursor: not-allowed; transform: none; }

/* ===== app shell ===== */
.app-body { background: #eef7f4; }
.app-shell {
    position: relative;
    z-index: 1;
    min-height: 100vh;
    display: grid;
    grid-template-columns: 240px 1fr;
}
.sidebar {
    background: linear-gradient(180deg, #123f3c 0%, #0f534d 100%);
    color: #d7f4ee;
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    height: 100vh;
    padding: 20px 14px;
}
.brand {
    display: flex;
    align-items: center;
    gap: 10px;
    color: #e7f7f3;
    padding: 6px 8px 18px;
    border-bottom: 1px solid rgba(255,255,255,.08);
}
.brand strong { display: block; font-family: var(--serif); letter-spacing: .12em; }
.brand small { color: rgba(215,244,238,.7); font-size: 12px; }
.side-nav { display: flex; flex-direction: column; gap: 6px; margin-top: 22px; flex: 1; }
.side-nav a {
    display: flex;
    align-items: center;
    gap: 10px;
    color: rgba(231,247,243,.82);
    padding: 11px 12px;
    border-radius: 12px;
    position: relative;
    transition: background .2s, color .2s, transform .2s;
}
.side-nav a:hover { background: rgba(255,255,255,.08); color: #fff; }
.side-nav a.active {
    background: rgba(127,212,196,.16);
    color: #fff;
}
.side-nav a.active::before {
    content: "";
    position: absolute;
    left: 0; top: 10px; bottom: 10px;
    width: 3px;
    border-radius: 3px;
    background: #7fd4c4;
}
.side-foot { margin-top: auto; }
.side-user {
    display: flex;
    gap: 10px;
    align-items: center;
    padding: 10px;
    border-radius: 14px;
    background: rgba(0,0,0,.16);
}
.side-user b { display: block; font-size: 13px; color: #fff; }
.side-user small { color: rgba(215,244,238,.7); }
.avatar {
    width: 34px; height: 34px;
    border-radius: 50%;
    background: var(--teal-400);
    color: #0f3d3a;
    display: grid;
    place-items: center;
    font-weight: 700;
}

.ico {
    width: 18px; height: 18px;
    display: inline-block;
    background: currentColor;
    mask-size: contain;
    mask-repeat: no-repeat;
    mask-position: center;
    -webkit-mask-size: contain;
    -webkit-mask-repeat: no-repeat;
    -webkit-mask-position: center;
    opacity: .9;
}
.ico-home { mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><path fill='black' d='M12 3 3 10h2v10h6v-6h2v6h6V10h2z'/></svg>"); -webkit-mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><path fill='black' d='M12 3 3 10h2v10h6v-6h2v6h6V10h2z'/></svg>"); }
.ico-book { mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><path fill='black' d='M6 3h11a3 3 0 0 1 3 3v14H8a2 2 0 0 0-2 2V5a2 2 0 0 1 2-2Zm0 16h11V6a1 1 0 0 0-1-1H6z'/></svg>"); -webkit-mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><path fill='black' d='M6 3h11a3 3 0 0 1 3 3v14H8a2 2 0 0 0-2 2V5a2 2 0 0 1 2-2Zm0 16h11V6a1 1 0 0 0-1-1H6z'/></svg>"); }
.ico-users { mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><path fill='black' d='M12 12a4 4 0 1 0-4-4 4 4 0 0 0 4 4Zm-8 8a7 7 0 0 1 14 0H4Zm15-9a3 3 0 1 0-3-3 3 3 0 0 0 3 3Zm2 9h-3a6 6 0 0 0-1.4-3.6A6 6 0 0 1 21 20Z'/></svg>"); -webkit-mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><path fill='black' d='M12 12a4 4 0 1 0-4-4 4 4 0 0 0 4 4Zm-8 8a7 7 0 0 1 14 0H4Zm15-9a3 3 0 1 0-3-3 3 3 0 0 0 3 3Zm2 9h-3a6 6 0 0 0-1.4-3.6A6 6 0 0 1 21 20Z'/></svg>"); }
.ico-cal { mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><path fill='black' d='M7 2h2v2h6V2h2v2h3v18H4V4h3V2zm13 8H4v10h16V10zM6 6v2h2V6H6zm10 0v2h2V6h-2z'/></svg>"); -webkit-mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><path fill='black' d='M7 2h2v2h6V2h2v2h3v18H4V4h3V2zm13 8H4v10h16V10zM6 6v2h2V6H6zm10 0v2h2V6h-2z'/></svg>"); }
.ico-goal { mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><path fill='black' d='M5 3h9l-1.8 3.6L14 10H7v11H5V3zm12 4 4 4-4 4v-3h-3V10h3V7z'/></svg>"); -webkit-mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><path fill='black' d='M5 3h9l-1.8 3.6L14 10H7v11H5V3zm12 4 4 4-4 4v-3h-3V10h3V7z'/></svg>"); }
.ico-rank { mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><path fill='black' d='M8 4h8v4h5v12H3V8h5V4zm2 2v2h4V6h-4zM5 10v8h14v-8H5zm3 2h2v4H8v-4zm4 0h2v4h-2v-4zm4 0h2v4h-2v-4z'/></svg>"); -webkit-mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><path fill='black' d='M8 4h8v4h5v12H3V8h5V4zm2 2v2h4V6h-4zM5 10v8h14v-8H5zm3 2h2v4H8v-4zm4 0h2v4h-2v-4zm4 0h2v4h-2v-4z'/></svg>"); }
.ico-train { mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><path fill='black' d='M4 5h16v11H8l-4 4V5zm3 3v2h10V8H7zm0 4v2h7v-2H7z'/></svg>"); -webkit-mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><path fill='black' d='M4 5h16v11H8l-4 4V5zm3 3v2h10V8H7zm0 4v2h7v-2H7z'/></svg>"); }
.ico-neg { mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><path fill='black' d='M12 2a10 10 0 1 0 0 20 10 10 0 0 0 0-20zm5 11H7v-2h10v2z'/></svg>"); -webkit-mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><path fill='black' d='M12 2a10 10 0 1 0 0 20 10 10 0 0 0 0-20zm5 11H7v-2h10v2z'/></svg>"); }
.ico-plus { mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><path fill='black' d='M11 5h2v6h6v2h-6v6h-2v-6H5v-2h6z'/></svg>"); -webkit-mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><path fill='black' d='M11 5h2v6h6v2h-6v6h-2v-6H5v-2h6z'/></svg>"); }
.ico-trash { mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><path fill='black' d='M9 4h6l1 2h4v2H4V6h4l1-2Zm1 6h2v8h-2v-8Zm4 0h2v8h-2v-8ZM7 8h10l-1 12H8L7 8Z'/></svg>"); -webkit-mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><path fill='black' d='M9 4h6l1 2h4v2H4V6h4l1-2Zm1 6h2v8h-2v-8Zm4 0h2v8h-2v-8ZM7 8h10l-1 12H8L7 8Z'/></svg>"); }
.ico-pen { mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><path fill='black' d='M3 17.2V21h3.8L17.8 9.9l-3.7-3.7L3 17.2zm17.7-10.2a1 1 0 0 0 0-1.4l-2.3-2.3a1 1 0 0 0-1.4 0l-1.8 1.8 3.7 3.8 1.8-1.9z'/></svg>"); -webkit-mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><path fill='black' d='M3 17.2V21h3.8L17.8 9.9l-3.7-3.7L3 17.2zm17.7-10.2a1 1 0 0 0 0-1.4l-2.3-2.3a1 1 0 0 0-1.4 0l-1.8 1.8 3.7 3.8 1.8-1.9z'/></svg>"); }

.ico-down { mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><path fill='black' d='M12 16.5 5 9.5l1.4-1.4L12 13.7l5.6-5.6L19 9.5z'/></svg>"); -webkit-mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><path fill='black' d='M12 16.5 5 9.5l1.4-1.4L12 13.7l5.6-5.6L19 9.5z'/></svg>"); }
.ico-up { mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><path fill='black' d='M12 7.5 19 14.5l-1.4 1.4L12 10.3l-5.6 5.6L5 14.5z'/></svg>"); -webkit-mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><path fill='black' d='M12 7.5 19 14.5l-1.4 1.4L12 10.3l-5.6 5.6L5 14.5z'/></svg>"); }

.app-main { min-width: 0; display: flex; flex-direction: column; }
.topbar {
    height: 64px;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0 22px;
    background: rgba(255,255,255,.78);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--line);
    position: sticky;
    top: 0;
    z-index: 8;
}
.crumb { font-family: var(--serif); font-size: 18px; flex: 1; }
.top-actions { display: flex; align-items: center; gap: 10px; }
.top-user { color: var(--muted); font-size: 13px; }
.icon-btn {
    width: 36px; height: 36px;
    border: 0;
    background: transparent;
    border-radius: 10px;
    font-size: 18px;
    color: var(--teal-800);
    cursor: pointer;
}
.icon-btn:hover { background: var(--teal-100); }
.page-body { padding: 24px; }

.page-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    gap: 16px;
    margin-bottom: 20px;
}
.page-head h1 { margin: 0; font-family: var(--serif); font-size: 28px; }
.page-head p { margin: 6px 0 0; }

.stat-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 14px;
    margin-bottom: 18px;
}
.stat-card {
    background: var(--card);
    border-radius: var(--radius);
    padding: 18px 18px 16px;
    box-shadow: 0 10px 24px rgba(18,63,60,.06);
    border: 1px solid rgba(255,255,255,.8);
    position: relative;
    overflow: hidden;
}
.stat-card::after {
    content: "";
    position: absolute;
    right: -20px; top: -20px;
    width: 90px; height: 90px;
    border-radius: 50%;
    background: rgba(26,157,138,.08);
}
.stat-card span { color: var(--muted); font-size: 13px; }
.stat-card strong { display: block; font-size: 28px; margin: 8px 0 4px; color: var(--teal-800); }
.stat-card em { font-style: normal; color: var(--teal-600); font-size: 12px; }

.panel {
    background: var(--card);
    border-radius: var(--radius);
    box-shadow: 0 10px 24px rgba(18,63,60,.06);
    padding: 8px 8px 4px;
}
.panel-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 16px 8px;
}
.panel-head h2 { margin: 0; font-size: 16px; }
.toolbar { gap: 10px; }
.search-input { max-width: 240px; }
.detail-list p {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    margin: 0;
    padding: 8px 0;
    border-bottom: 1px solid var(--line);
    font-size: 13px;
}
.detail-list p span { color: var(--muted); }
.detail-list p b { font-weight: 600; }

.table-wrap { overflow: auto; }
.table { width: 100%; border-collapse: collapse; }
.table th, .table td {
    text-align: left;
    padding: 12px 16px;
    border-bottom: 1px solid var(--line);
    font-size: 13px;
    vertical-align: middle;
}
.table th { color: var(--muted); font-weight: 600; background: #f7fdfb; }
.table tbody tr { transition: background .15s; }
.table tbody tr:hover { background: #f3fbf9; }

.badge {
    display: inline-flex;
    padding: 3px 8px;
    border-radius: 999px;
    font-size: 12px;
}
.badge-admin, .badge-serial { background: var(--teal-100); color: var(--teal-800); }
.badge-author, .badge-draft { background: #eef2f1; color: #4b5c59; }
.badge-stock { background: #e4f0fb; color: #1d4e89; }
.badge-done { background: #e4f4e8; color: #17663a; }
.badge-pause { background: #fff4dc; color: #8a5a00; }
.badge-on { background: var(--teal-100); color: var(--teal-800); }
.badge-off { background: #fdecec; color: #b42318; }

.ops { display: flex; gap: 6px; flex-wrap: wrap; }
.ops .btn { padding: 6px 10px; font-size: 12px; border-radius: 8px; }
.ops .icon-btn {
    width: 28px;
    height: 28px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    font-size: 0;
    flex: none;
}
.ops .icon-btn .ico {
    width: 14px;
    height: 14px;
    flex: none;
}
.ops .icon-btn-danger { color: #b42318; }
.ops .icon-btn-danger:hover { background: #fdecec; }

.empty {
    text-align: center;
    padding: 48px 16px;
    color: var(--muted);
}
.empty-seal {
    width: 64px; height: 64px;
    margin: 0 auto 12px;
    border: 2px solid var(--teal-300);
    color: var(--teal-700);
    display: grid;
    place-items: center;
    font-family: var(--serif);
    font-size: 24px;
    transform: rotate(-8deg);
}

.work-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 16px;
}
.work-card {
    background: var(--card);
    border-radius: 18px;
    padding: 0;
    box-shadow: 0 10px 24px rgba(18,63,60,.06);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transition: transform .2s ease, box-shadow .2s ease;
    border: 1px solid transparent;
    cursor: pointer;
}
.work-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 16px 30px rgba(18,63,60,.12);
    border-color: var(--teal-200);
}
.work-cover-wrap {
    width: 100%;
    aspect-ratio: 3 / 4;
    background: linear-gradient(180deg, #d7f4ee, #b4e8dd);
    overflow: hidden;
}
.work-cover {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
.work-cover-ph {
    display: grid;
    place-items: center;
    font-family: var(--serif);
    font-size: 42px;
    color: var(--teal-700);
    background: linear-gradient(160deg, #e7f7f3, #b4e8dd);
}
.work-body { padding: 12px 12px 10px; }
.work-card .meta { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.work-card h3 { margin: 0; font-size: 16px; font-family: var(--serif); line-height: 1.4; }
.work-card .foot {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 10px;
    gap: 8px;
}
.work-words {
    color: var(--muted);
    font-size: 12px;
    line-height: 1.4;
}
.work-card .ops {
    flex-direction: row;
    align-items: center;
    flex-wrap: nowrap;
    gap: 4px;
}
.work-card .ops .btn {
    width: auto;
}
.cover-field { margin-bottom: 14px; }
.cover-field > span {
    display: block;
    font-size: 13px;
    color: var(--teal-800);
    margin-bottom: 6px;
}
.cover-row { display: flex; gap: 12px; align-items: center; }
.cover-preview-wrap {
    width: 72px;
    height: 96px;
    border-radius: 8px;
    overflow: hidden;
    background: #e7f7f3;
    border: 1px solid var(--line);
    position: relative;
    flex-shrink: 0;
}
.cover-preview-wrap img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
.cover-placeholder {
    position: absolute;
    inset: 0;
    display: none;
    place-items: center;
    font-family: var(--serif);
    font-style: normal;
    color: var(--teal-700);
    font-size: 22px;
}
.cover-preview-wrap.is-empty .cover-placeholder { display: grid; }
.cover-preview-wrap.is-empty img { display: none; }
.cover-actions .muted { margin: 6px 0 0; }
.cover-pick {
    position: relative;
    overflow: hidden;
}
.cover-pick input[type="file"] {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
}
.cover-remove {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 8px;
    font-size: 12px;
    color: var(--muted);
    cursor: pointer;
}

@keyframes fade {
    from { opacity: 0; }
    to { opacity: 1; }
}
.modal-mask {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(18, 63, 60, .55);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 99999;
    padding: 20px;
}
.modal-mask.is-open {
    display: flex !important;
    animation: fade .18s ease;
}
.modal-card {
    position: relative;
    z-index: 1;
    width: min(520px, 100%);
    background: #fff;
    border-radius: 20px;
    box-shadow: var(--shadow);
    animation: rise .25s ease;
}
.modal-head, .modal-foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 18px;
}
.modal-head { border-bottom: 1px solid var(--line); }
.modal-head h3 { margin: 0; font-family: var(--serif); }
.modal-body { padding: 18px; }
.modal-foot { border-top: 1px solid var(--line); justify-content: flex-end; gap: 8px; }
.modal-mask.danger .btn-primary { background: #b42318; box-shadow: none; }

.scroll-fab {
    position: fixed;
    right: 18px;
    bottom: 18px;
    z-index: 40;
    width: 32px;
    height: 32px;
    border: 0;
    outline: none;
    border-radius: 50%;
    background: linear-gradient(180deg, #1aa38f, var(--teal-700));
    color: #fff;
    box-shadow: 0 6px 16px rgba(18, 63, 60, .24);
    cursor: pointer;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 0;
    -webkit-tap-highlight-color: transparent;
}
.scroll-fab.is-show { display: inline-flex; }
.scroll-fab:hover { transform: translateY(-1px); }
.scroll-fab:focus,
.scroll-fab:focus-visible,
.scroll-fab:active {
    outline: none;
    border: 0;
    box-shadow: 0 6px 16px rgba(18, 63, 60, .24);
}
.scroll-fab .ico {
    width: 14px;
    height: 14px;
    opacity: 1;
}
.scroll-fab .ico-up { display: none; }
.scroll-fab.is-bottom .ico-down { display: none; }
.scroll-fab.is-bottom .ico-up { display: block; }

.toast-wrap {
    position: fixed;
    right: 20px;
    top: 20px;
    z-index: 100000;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.toast {
    min-width: 220px;
    background: #123f3c;
    color: #e7f7f3;
    padding: 12px 14px;
    border-radius: 12px;
    box-shadow: var(--shadow);
    opacity: 0;
    transform: translateY(-8px);
    transition: .25s ease;
}
.toast.in { opacity: 1; transform: none; }
.toast-ok { background: var(--teal-700); }
.toast-err { background: #9b1c1c; }

.watch-stage {
    position: fixed;
    right: 20px;
    bottom: 24px;
    z-index: 100010;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 8px;
    pointer-events: none;
    max-width: min(380px, calc(100vw - 32px));
}
.watch-danmaku {
    max-width: 100%;
    padding: 8px 14px;
    border-radius: 999px;
    background: linear-gradient(180deg, rgba(26, 163, 143, .94), rgba(15, 103, 94, .94));
    color: #e7f7f3;
    font-size: 13px;
    line-height: 1.45;
    box-shadow: 0 10px 22px rgba(18, 63, 60, .22);
    opacity: 0;
    transform: translateY(18px);
    animation: watch-pop .45s ease forwards;
    word-break: break-word;
}
.watch-danmaku.is-out {
    animation: watch-gone .55s ease forwards;
}
@keyframes watch-pop {
    from { opacity: 0; transform: translateY(18px); }
    to { opacity: 1; transform: translateY(0); }
}
@keyframes watch-gone {
    from { opacity: 1; transform: translateY(0); }
    to { opacity: 0; transform: translateY(-14px); }
}

.app-shell.collapsed { grid-template-columns: 72px 1fr; }
.app-shell.collapsed .sidebar { overflow: hidden; padding: 12px 8px; }
.app-shell.collapsed .brand { justify-content: center; padding-left: 0; padding-right: 0; }
.app-shell.collapsed .brand > span:last-of-type,
.app-shell.collapsed .side-nav a span,
.app-shell.collapsed .side-user > span:last-of-type { display: none; }
.app-shell.collapsed .side-nav a {
    justify-content: center;
    padding: 10px 0;
    gap: 0;
}
.app-shell.collapsed .side-nav a.active::before { display: none; }
.app-shell.collapsed .side-user { justify-content: center; padding: 8px 0; }

/* ===== 后台紧凑字号与间距 ===== */
.app-body {
    font-size: 13px;
    line-height: 1.5;
}
.app-body .app-shell { grid-template-columns: 196px 1fr; }
.app-body .app-shell.collapsed { grid-template-columns: 64px 1fr; }
.app-body .sidebar { padding: 12px 10px; }
.app-body .brand {
    gap: 8px;
    padding: 2px 6px 12px;
}
.app-body .seal-sm {
    width: 32px;
    height: 32px;
    font-size: 12px;
    letter-spacing: .08em;
}
.app-body .brand strong {
    font-size: 14px;
    letter-spacing: .08em;
    line-height: 1.3;
}
.app-body .brand small { font-size: 11px; }
.app-body .side-nav {
    gap: 2px;
    margin-top: 12px;
}
.app-body .side-nav a {
    gap: 8px;
    padding: 7px 10px;
    border-radius: 8px;
    font-size: 13px;
}
.app-body .side-nav a.active::before { top: 7px; bottom: 7px; }
.app-body .ico { width: 15px; height: 15px; }
.app-body .side-user {
    gap: 8px;
    padding: 8px;
    border-radius: 10px;
}
.app-body .side-user b { font-size: 12px; }
.app-body .side-user small { font-size: 11px; }
.app-body .avatar {
    width: 28px;
    height: 28px;
    font-size: 12px;
}
.app-body .topbar {
    height: 46px;
    gap: 8px;
    padding: 0 14px;
}
.app-body .crumb { font-size: 14px; }
.app-body .top-user { font-size: 12px; }
.app-body .icon-btn {
    width: 30px;
    height: 30px;
    font-size: 15px;
    border-radius: 8px;
}
.app-body .page-body { padding: 14px 16px; }
.app-body .page-head {
    gap: 10px;
    margin-bottom: 12px;
    align-items: center;
}
.app-body .page-head h1 { font-size: 18px; }
.app-body .page-head p {
    margin: 3px 0 0;
    font-size: 12px;
}
.app-body .btn {
    padding: 6px 12px;
    font-size: 12px;
    border-radius: 8px;
    gap: 4px;
}
.app-body .ops { gap: 4px; }
.app-body .ops .btn { padding: 4px 8px; font-size: 12px; border-radius: 6px; }
.app-body .ops .icon-btn {
    width: 26px;
    height: 26px;
    border-radius: 6px;
}
.app-body .stat-grid {
    gap: 10px;
    margin-bottom: 12px;
}
.app-body .stat-card {
    border-radius: 12px;
    padding: 12px 14px 10px;
}
.app-body .stat-card span { font-size: 12px; }
.app-body .stat-card strong {
    font-size: 20px;
    margin: 4px 0 2px;
}
.app-body .stat-card em { font-size: 11px; }
.app-body .panel {
    border-radius: 12px;
    padding: 4px;
}
.app-body .panel-head { padding: 10px 12px 6px; }
.app-body .panel-head h2 { font-size: 13px; }
.app-body .search-input { max-width: 200px; padding: 6px 10px; font-size: 12px; }
.app-body .detail-list p { font-size: 12px; padding: 6px 0; }
.app-body .table th,
.app-body .table td {
    padding: 8px 12px;
    font-size: 12px;
}
.app-body .badge {
    padding: 1px 6px;
    font-size: 11px;
}
.app-body .empty { padding: 28px 12px; font-size: 12px; }
.app-body .empty-seal {
    width: 44px;
    height: 44px;
    margin-bottom: 8px;
    font-size: 18px;
}
.app-body .work-grid {
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 10px;
}
.app-body .work-card {
    border-radius: 12px;
    padding: 0;
    min-height: 0;
}
.app-body .work-body { padding: 10px; }
.app-body .work-card .meta { margin-bottom: 6px; }
.app-body .work-card h3 {
    margin: 0;
    font-size: 14px;
}
.app-body .work-card .foot { margin-top: 8px; gap: 6px; }
.app-body .cover-field { margin-bottom: 10px; }
.app-body .cover-field > span { font-size: 12px; }
.app-body .field { margin-bottom: 10px; }
.app-body .field span {
    font-size: 12px;
    margin-bottom: 4px;
}
.app-body .field input,
.app-body .field select,
.app-body .field textarea,
.app-body .form-control {
    border-radius: 8px;
    padding: 8px 10px;
    font-size: 13px;
}
.app-body .field textarea,
.app-body textarea.form-control { min-height: 84px; }
.app-body .form-row { gap: 8px; }
.app-body .modal-card {
    width: min(460px, 100%);
    border-radius: 14px;
}
.app-body .modal-head,
.app-body .modal-foot { padding: 10px 14px; }
.app-body .modal-head h3 { font-size: 15px; }
.app-body .modal-body { padding: 12px 14px; }
.app-body .toast {
    min-width: 180px;
    padding: 8px 12px;
    font-size: 12px;
    border-radius: 8px;
}

.page-body.chapter-page {
    padding: 12px 14px;
    display: flex;
    flex-direction: column;
    min-height: calc(100vh - 46px);
}
.chapter-layout {
    display: flex;
    flex: 1;
    min-height: 0;
    gap: 12px;
    align-items: stretch;
}
.chapter-side {
    flex: 0 0 20%;
    width: 20%;
    max-width: 20%;
    background: var(--card);
    border-radius: 12px;
    box-shadow: 0 10px 24px rgba(18,63,60,.06);
    padding: 16px 14px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}
.chapter-work h2 {
    margin: 10px 0 8px;
    font-family: var(--serif);
    font-size: 16px;
    line-height: 1.4;
}
.chapter-tags { display: flex; gap: 6px; flex-wrap: wrap; }
.chapter-cover {
    width: 96px;
    height: 128px;
    border-radius: 8px;
    overflow: hidden;
    background: linear-gradient(160deg, #e7f7f3, #b4e8dd);
    display: grid;
    place-items: center;
    font-family: var(--serif);
    font-size: 28px;
    color: var(--teal-700);
}
.chapter-cover img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
.chapter-actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: auto;
}
.chapter-actions .btn {
    width: 100%;
    justify-content: center;
}
.chapter-doc-btns {
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-height: 0;
    overflow: auto;
}
.chapter-doc-btns .btn {
    width: 100%;
    justify-content: center;
}
.chapter-char-btns {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}
.chapter-char-btns .btn {
    width: 100%;
    padding: 8px 6px;
    font-size: 13px;
}
.chapter-doc-btns .js-work-doc.is-filled {
    background: var(--teal-100);
    border-color: var(--teal-200);
    color: var(--teal-800);
}
.chapter-doc-btns .js-work-doc.is-filled:hover {
    background: var(--teal-200);
}
.chapter-doc-split {
    height: 1px;
    margin: 4px 10px;
    background: var(--line);
}
.chapter-main {
    flex: 0 0 calc(80% - 12px);
    width: calc(80% - 12px);
    max-width: calc(80% - 12px);
    background: var(--card);
    border-radius: 12px;
    box-shadow: 0 10px 24px rgba(18,63,60,.06);
    padding: 6px 8px 12px;
    min-width: 0;
    overflow: auto;
}
.chapter-toolbar {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}
.volume-block { margin-top: 12px; }
.volume-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    background: #f3fbf9;
    border-radius: 8px;
    margin-bottom: 6px;
}
.volume-empty { padding: 8px 12px 12px; }
.chapter-editor { min-height: 220px !important; }
.modal-mask.wide .modal-card { width: min(680px, 96vw); }
.td-mark { text-align: center; }
.mark-icon {
    display: inline-flex;
    width: 20px;
    height: 20px;
    border: 0;
    padding: 0;
    border-radius: 50%;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 700;
    line-height: 1;
    cursor: pointer;
    outline: none;
}
.mark-icon:focus,
.mark-icon:focus-visible { outline: none; box-shadow: none; }
.mark-ok { background: #e4f4e8; color: #17663a; }
.mark-no { background: #fdecec; color: #b42318; }
.modal-mask.md-wide {
    padding: 12px;
    align-items: center;
}
.modal-mask.md-wide .modal-card {
    width: min(960px, 96vw);
    height: min(860px, calc(100vh - 24px));
    max-height: calc(100vh - 24px);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
.modal-mask.md-wide .modal-head,
.modal-mask.md-wide .modal-foot {
    flex: none;
    background: #fff;
    z-index: 2;
}
.modal-mask.md-wide .modal-body {
    flex: 1 1 auto;
    min-height: 0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    padding: 8px 12px;
}
.modal-mask.md-wide #prompt-form {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
    height: 100%;
    margin: 0;
}
.modal-mask.md-wide #prompt-form .field:last-child {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    margin-bottom: 0;
}
.editormd .CodeMirror-focused .cm-matchhighlight,
.editormd .cm-matchhighlight {
    background-image: none !important;
}
.editormd .CodeMirror {
    font-size: 13px;
    line-height: 21px;
}
.editormd .CodeMirror pre,
.editormd .CodeMirror-linenumber {
    font-size: 13px !important;
    line-height: 21px !important;
    margin: 0 !important;
}
.editormd .CodeMirror-code > div {
    overflow: hidden;
}
.editormd .CodeMirror pre span[cm-text] {
    display: inline !important;
    width: auto !important;
    height: auto !important;
    margin: 0 !important;
    vertical-align: top;
}
.editormd .CodeMirror pre.CodeMirror-placeholder {
    font-size: 13px !important;
    line-height: 21px !important;
    white-space: nowrap !important;
    word-wrap: normal !important;
    word-break: keep-all !important;
    pointer-events: none;
}
#outline-md {
    flex: 1;
    min-height: 0;
    border: 1px solid var(--line);
    border-radius: 8px;
}
#outline-md .editormd,
#outline-md.editormd {
    margin: 0;
    z-index: 1;
}
#outline-md .CodeMirror,
#outline-md .editormd-preview {
    font-size: 13px;
}
#outline-md.editormd .editormd-preview {
    display: block;
}
#doc-md {
    flex: 1;
    min-height: 0;
    border: 1px solid var(--line);
    border-radius: 8px;
}
#doc-md .editormd,
#doc-md.editormd {
    margin: 0;
    z-index: 1;
}
#doc-md .CodeMirror,
#doc-md .editormd-preview {
    font-size: 13px;
}
#doc-md.editormd .editormd-preview {
    display: block;
}
.modal-mask.md-wide.is-char-list .modal-card {
    height: auto;
    max-height: min(640px, calc(100vh - 24px));
}
.modal-mask.md-wide.is-char-list .char-grid {
    max-height: min(420px, calc(100vh - 220px));
}
.modal-mask.md-wide .char-panel,
.modal-mask.md-wide #char-form {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
    height: 100%;
    margin: 0;
}
.char-toolbar {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: none;
    margin-bottom: 8px;
}
.char-toolbar .form-control {
    flex: 1;
    padding: 8px 12px;
    border-radius: 10px;
}
.char-toolbar .btn {
    flex: none;
    padding: 8px 14px;
}
.char-count {
    flex: none;
    white-space: nowrap;
}
.char-grid {
    flex: 1;
    min-height: 0;
    overflow: auto;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    align-content: start;
    padding: 2px 2px 8px;
}
.char-empty {
    grid-column: 1 / -1;
    text-align: center;
    padding: 48px 16px;
    color: var(--muted);
    font-size: 14px;
}
.char-card {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-height: 108px;
    padding: 12px;
    background: var(--teal-50);
    border: 1px solid var(--line);
    border-radius: 12px;
    cursor: pointer;
}
.char-card:hover {
    background: #fff;
    border-color: var(--teal-400);
    box-shadow: 0 8px 18px rgba(18, 63, 60, .08);
}
.char-card.is-ask {
    cursor: default;
    background: #fff8f7;
    border-color: rgba(180, 35, 24, .28);
}
.char-card-top {
    display: flex;
    align-items: flex-start;
    gap: 8px;
}
.char-card-top h4 {
    margin: 0;
    flex: 1;
    font-size: 15px;
    line-height: 1.4;
}
.char-card-ops {
    display: flex;
    align-items: center;
    gap: 4px;
    flex: none;
}
.char-card-ops .icon-btn {
    width: 28px;
    height: 28px;
    border-radius: 8px;
}
.char-card-ops .btn {
    padding: 4px 8px;
    font-size: 12px;
    border-radius: 8px;
}
.char-ask {
    font-size: 12px;
    color: #b42318;
    white-space: nowrap;
}
.char-meta {
    font-size: 12px;
    color: var(--teal-700);
}
.char-meta.is-empty,
.char-sum.is-empty {
    color: var(--muted);
}
.char-sum {
    margin: 2px 0 0;
    font-size: 13px;
    line-height: 1.45;
    color: var(--ink);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.char-edit-bar {
    flex: none;
    margin-bottom: 6px;
}
.char-back {
    border: 0;
    background: none;
    padding: 0;
    color: var(--teal-700);
    cursor: pointer;
    font-size: 13px;
}
.char-back:hover { text-decoration: underline; }
.modal-mask.md-wide #char-form .field {
    margin-bottom: 8px;
}
.modal-mask.md-wide #char-form .form-row .field {
    margin-bottom: 0;
}
.modal-mask.md-wide #char-form .form-row .field:only-child {
    grid-column: 1 / -1;
}
.modal-mask.md-wide #char-form .form-row {
    margin-bottom: 6px;
    gap: 8px;
}
.modal-mask.md-wide #char-form .form-row.cols-3 {
    grid-template-columns: 1fr 1fr 1fr;
}
.modal-mask.md-wide #char-form .form-control {
    padding: 6px 10px;
    border-radius: 10px;
}
.modal-mask.md-wide #char-form .field:last-child {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    margin-bottom: 0;
}
#char-md {
    flex: 1;
    min-height: 0;
    border: 1px solid var(--line);
    border-radius: 8px;
}
#char-md .editormd,
#char-md.editormd {
    margin: 0;
    z-index: 1;
}
#char-md .CodeMirror,
#char-md .editormd-preview {
    font-size: 13px;
}
#char-md.editormd .editormd-preview {
    display: block;
}
#prompt-md {
    flex: 1;
    min-height: 0;
    border: 1px solid var(--line);
    border-radius: 8px;
}
#prompt-md .editormd,
#prompt-md.editormd {
    margin: 0;
    z-index: 1;
}
#prompt-md .CodeMirror,
#prompt-md .editormd-preview {
    font-size: 13px;
}
#prompt-md.editormd .editormd-preview {
    display: block;
}
.chapter-title-input {
    width: 100%;
    max-width: 460px;
    box-sizing: border-box;
    border: 1px solid transparent;
    background: transparent;
    color: inherit;
    font: inherit;
    font-weight: 600;
    padding: 4px 8px;
    border-radius: 6px;
}
.chapter-title-input:hover {
    border-color: var(--teal-200);
    background: #fff;
}
.chapter-title-input:focus {
    outline: none;
    border-color: var(--teal-500);
    background: #fff;
    box-shadow: 0 0 0 3px rgba(26, 157, 138, 0.16);
}
.chapter-status-box {
    display: inline-flex;
    align-items: center;
    border-radius: 6px;
    overflow: hidden;
}
.chapter-status-box.is-draft { background-color: #d9dee3; color: #3d4a52; }
.chapter-status-box.is-polish { background-color: #ffd666; color: #7a4a00; }
.chapter-status-box.is-published { background-color: #52c41a; color: #06380d; }
.chapter-status-select {
    display: block;
    width: auto;
    min-width: 76px;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    border: 0;
    background: transparent !important;
    color: inherit;
    font: inherit;
    font-size: 12px;
    font-weight: 700;
    padding: 5px 22px 5px 8px;
    cursor: pointer;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath fill='%23333' d='M1 1l4 4 4-4'/%3E%3C/svg%3E") !important;
    background-repeat: no-repeat !important;
    background-position: right 8px center !important;
    background-color: transparent !important;
}
.chapter-status-select:focus {
    outline: none;
}

html.is-writing,
body.is-writing {
    overflow: hidden !important;
    height: 100%;
}
body.is-writing .scroll-fab { display: none !important; }
.write-overlay {
    position: fixed !important;
    top: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    left: 0 !important;
    width: 100vw;
    width: 100dvw;
    height: 100vh;
    height: 100dvh;
    max-width: none;
    max-height: none;
    margin: 0;
    padding: 0;
    z-index: 99990;
    display: none;
    flex-direction: column;
    background: #111;
    color: #e8e8e8;
    box-sizing: border-box;
    --scroll-thumb: rgba(255, 255, 255, 0.28);
    --scroll-thumb-hover: rgba(255, 255, 255, 0.48);
}
.write-overlay.is-open {
    display: flex !important;
}
.write-head {
    flex: none;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    height: 48px;
    padding: 0 16px;
    background: #161616;
    border-bottom: 1px solid #2a2a2a;
}
.write-head h3 {
    margin: 0;
    font-size: 15px;
    font-weight: 600;
    color: #eee;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    flex: none;
    max-width: 42%;
}
.write-status {
    flex: 1;
    min-width: 0;
    font-size: 13px;
    color: #8a8a8a;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.write-status.is-wait { color: #8ab4f8; }
.write-status.is-saving { color: #ffd666; }
.write-status.is-ok { color: #73d13d; }
.write-status.is-err { color: #ff7875; }
.write-head-actions { display: flex; gap: 8px; flex: none; }
.write-stage {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: row;
    align-items: stretch;
    justify-content: center;
    gap: 16px;
    padding: 12px 16px 10px;
    background: #0a0a0a;
    box-sizing: border-box;
}
.write-col {
    min-height: 0;
    display: flex;
    flex-direction: column;
}
.write-col-side {
    flex: 1 1 0;
    min-width: 200px;
    background: #161616;
    border: 1px solid #2a2a2a;
    border-radius: 10px;
    overflow: hidden;
}
.write-notes { position: relative; }
.write-col-head {
    flex: none;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 10px 12px 10px 14px;
    border-bottom: 1px solid #2a2a2a;
    font-size: 13px;
    font-weight: 600;
    color: #9adbcf;
    letter-spacing: .04em;
}
.write-note-add {
    flex: none;
    height: 24px;
    padding: 0 8px;
    font-size: 12px;
    font-weight: 500;
    letter-spacing: 0;
    color: #9adbcf;
    background: transparent;
    border: 1px solid #3a5a55;
    border-radius: 4px;
    cursor: pointer;
}
.write-note-add:hover { background: #1e2e2c; }
.write-note-add:focus,
.write-note-add:focus-visible { outline: none; box-shadow: none; }
.write-col-body {
    flex: 1;
    min-height: 0;
    overflow: auto;
}
.write-col-empty {
    margin: 0;
    padding: 22px 16px;
    color: #6b6b6b;
    font-size: 13px;
    line-height: 1.7;
}
.write-notes-list {
    padding: 10px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.write-note-card {
    position: relative;
    border-radius: 8px;
    padding: 10px 12px 34px;
    color: #2c2c2c;
    cursor: pointer;
    user-select: none;
    -webkit-user-select: none;
}
.write-note-card h4 {
    margin: 0 0 6px;
    font-size: 13px;
    font-weight: 600;
    line-height: 1.3;
}
.write-note-card p {
    margin: 0;
    font-size: 12px;
    line-height: 1.55;
    white-space: pre-wrap;
    word-break: break-word;
    max-height: 160px;
    overflow: auto;
}
.write-note-ops {
    position: absolute;
    right: 6px;
    bottom: 6px;
    display: flex;
    gap: 4px;
}
.write-note-ops .icon-btn {
    width: 22px;
    height: 22px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    border: 0;
    border-radius: 4px;
    background: rgba(255, 255, 255, .45);
    color: rgba(44, 44, 44, .72);
    cursor: pointer;
}
.write-note-ops .icon-btn .ico {
    width: 12px;
    height: 12px;
}
.write-note-ops .icon-btn:hover { background: rgba(255, 255, 255, .85); }
.write-note-ops .icon-btn-danger { color: #b42318; }
.write-note-ops .icon-btn:focus,
.write-note-ops .icon-btn:focus-visible { outline: none; box-shadow: none; }
.note-colors {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    padding-top: 2px;
}
.note-color {
    position: relative;
    width: 28px;
    height: 28px;
    margin: 0;
    cursor: pointer;
}
.note-color input {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}
.note-color i {
    display: block;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: 2px solid transparent;
    box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .12);
    box-sizing: border-box;
}
.note-color input:checked + i {
    border-color: var(--teal-700);
    box-shadow: 0 0 0 2px rgba(26, 157, 138, .28);
}
.note-color:focus-within i {
    border-color: var(--teal-700);
}
#note-form textarea.form-control {
    min-height: 140px;
}
.write-phone {
    flex: 0 0 390px;
    width: 390px;
    max-width: 390px;
}
.write-phone-frame {
    position: relative;
    display: flex;
    flex-direction: column;
    width: 100%;
    height: 100%;
    background: #111;
    border: 1px solid #3a3a3a;
    border-radius: 22px;
    overflow: hidden;
    box-shadow: 0 0 0 3px #1a1a1a, 0 16px 40px rgba(0,0,0,.5);
}
#content.write-editor {
    display: block;
    flex: 1;
    width: 100%;
    height: auto;
    min-height: 0;
    box-sizing: border-box;
    resize: none;
    border: 0;
    outline: none;
    margin: 0;
    padding: 18px 16px 24px;
    background: #111;
    color: #e8e8e8;
    font-size: 14px;
    line-height: 1.2;
    font-family: "PingFang SC", "Microsoft YaHei", "Noto Sans SC", serif;
    caret-color: #1aa38f;
}
.write-dagang {
    display: none;
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 2;
    width: auto;
    background: #161616;
    overflow: auto;
    padding: 14px 16px 20px;
}
.write-dagang.is-open { display: block; }
.write-dagang h4 {
    margin: 0 0 10px;
    font-size: 13px;
    color: #9adbcf;
}
.write-dagang-md {
    color: #ddd;
    font-size: 13px;
    line-height: 1.7;
    word-break: break-word;
    overflow: visible;
    background: transparent;
    padding: 0;
    font-family: inherit;
}
.write-dagang-md.markdown-body,
.write-dagang-md.editormd-html-preview {
    color: #ddd;
    background: transparent;
    padding: 0;
    overflow: visible;
    width: auto;
    font-size: 13px;
    line-height: 1.7;
}
.write-dagang-md h1,
.write-dagang-md h2,
.write-dagang-md h3,
.write-dagang-md h4,
.write-dagang-md h5,
.write-dagang-md h6 {
    margin: .7em 0 .4em;
    color: #eee;
    font-weight: 600;
    line-height: 1.35;
    border: 0;
}
.write-dagang-md h1 { font-size: 1.45em; }
.write-dagang-md h2 { font-size: 1.28em; }
.write-dagang-md h3 { font-size: 1.14em; }
.write-dagang-md h4 { font-size: 1.05em; color: #eee; }
.write-dagang-md p,
.write-dagang-md ul,
.write-dagang-md ol,
.write-dagang-md pre,
.write-dagang-md blockquote,
.write-dagang-md table {
    margin: 0 0 .75em;
}
.write-dagang-md ul,
.write-dagang-md ol { padding-left: 1.4em; }
.write-dagang-md a { color: #6ec8b8; }
.write-dagang-md hr {
    border: 0;
    border-top: 1px solid #333;
    margin: 12px 0;
}
.write-dagang-md code {
    padding: .1em .35em;
    border-radius: 3px;
    background: #2a2a2a;
    color: #e8e8e8;
    font-size: .92em;
}
.write-dagang-md pre {
    padding: 10px 12px;
    border-radius: 6px;
    background: #111;
    border: 1px solid #2a2a2a;
    overflow: auto;
    white-space: pre-wrap;
}
.write-dagang-md pre code {
    padding: 0;
    background: transparent;
}
.write-dagang-md blockquote {
    margin-left: 0;
    padding: 0 0 0 12px;
    color: #aaa;
    border-left: 3px solid #3a5a55;
}
.write-dagang-md table {
    border-collapse: collapse;
    width: 100%;
}
.write-dagang-md th,
.write-dagang-md td {
    border: 1px solid #333;
    padding: 4px 8px;
}
.write-dagang-md img { max-width: 100%; }
.write-dagang .write-col-empty { padding: 0; }
.write-foot {
    flex: none;
    min-height: 42px;
    padding: 4px 16px 8px;
    background: #161616;
    border-top: 1px solid #2a2a2a;
    color: #d0d0d0;
    font-size: 13px;
    overflow: hidden;
}
.write-foot .wc {
    float: left;
    line-height: 32px;
}
.write-foot .wc span {
    background: #F44336;
    color: #fff;
    border-radius: 5px;
    padding: 0 3px;
}
#word-count span { background: #2196F3; }
.write-btn {
    display: inline-block;
    float: right;
    height: 28px;
    line-height: 26px;
    padding: 0 12px;
    margin-top: 5px;
    font-size: 12px;
    border-radius: 4px;
    cursor: pointer;
    text-decoration: none;
    border: 1px solid transparent;
    box-sizing: border-box;
    color: #eee;
    background: transparent;
}
.write-btn:focus,
.write-btn:focus-visible,
#content.write-editor:focus {
    outline: none;
    box-shadow: none;
}
.write-btn-view {
    float: right;
    background: #1E9FFF;
    color: #fff;
}
.write-btn-plain {
    float: right;
    margin: 5px 15px 0 0;
    background: transparent;
    color: #ddd;
    border-color: #555;
}
.write-head .write-btn { float: none; margin: 0; }
.write-head .write-btn-plain { margin: 0; }

.app-shell:has(.calendar-page) {
    height: 100vh;
    min-height: 100vh;
    overflow: hidden;
}
.app-main:has(.calendar-page) {
    min-height: 0;
    height: 100vh;
    overflow: hidden;
}
body:has(.calendar-page) { overflow: hidden; }
body:has(.calendar-page) .scroll-fab { display: none !important; }
.page-body.calendar-page {
    height: calc(100vh - 46px);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    min-height: 0;
    padding: 12px 16px 14px;
}
.calendar-page .page-head {
    margin-bottom: 10px;
    flex: none;
}
.cal-board {
    flex: 1;
    min-height: 0;
    display: grid;
    grid-template-rows: auto auto minmax(0, 1fr);
    background: var(--card);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: 0 10px 24px rgba(18, 63, 60, .06);
    border: 1px solid rgba(255, 255, 255, .8);
}
.cal-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 16px;
    background: linear-gradient(180deg, #1aa38f, var(--teal-700));
    color: #e7f7f3;
    flex: none;
}
.cal-total {
    font-size: 15px;
    font-weight: 600;
    letter-spacing: .02em;
}
.cal-total b { font-weight: 700; color: #fff; }
.cal-pick {
    display: flex;
    gap: 8px;
    flex: none;
}
.cal-pick select {
    height: 28px;
    padding: 0 26px 0 10px;
    border: 1px solid rgba(231, 247, 243, .45);
    border-radius: 8px;
    background: rgba(255, 255, 255, .12) url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 8'><path fill='white' d='M1 1.2 6 6.2 11 1.2'/></svg>") no-repeat right 8px center / 10px 7px;
    color: #fff;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
}
.cal-pick select option { color: var(--ink); }
.cal-pick select:focus,
.cal-pick select:focus-visible { outline: none; border-color: #fff; }
.cal-week {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    padding: 8px 6px 4px;
    color: var(--muted);
    font-size: 13px;
    text-align: center;
    flex: none;
}
.cal-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    grid-template-rows: repeat(6, minmax(0, 1fr));
    min-height: 0;
    height: 100%;
    padding: 0 6px 8px;
}
.cal-cell {
    min-height: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    padding: 4px 0 2px;
    color: var(--teal-600);
}
.cal-num {
    width: 28px;
    height: 28px;
    line-height: 28px;
    text-align: center;
    font-size: 15px;
    border-radius: 50%;
}
.cal-cell.is-today .cal-num {
    background: var(--teal-100);
    color: var(--teal-800);
    font-weight: 700;
}
.cal-cell.is-other .cal-num { color: #c5d6d3; }
.cal-words {
    margin-top: 1px;
    color: var(--ink);
    font-size: 12px;
    line-height: 1.15;
}

.dash-board {
    display: grid;
    grid-template-columns: 1.15fr 1fr .92fr;
    gap: 14px;
    align-items: stretch;
}
.dash-card {
    background: var(--card);
    border-radius: var(--radius);
    box-shadow: 0 10px 24px rgba(18, 63, 60, .06);
    border: 1px solid rgba(255, 255, 255, .8);
    padding: 16px 16px 14px;
    display: flex;
    flex-direction: column;
    min-height: 0;
    position: relative;
    overflow: hidden;
}
.dash-card-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 14px;
    flex: none;
}
.dash-card-head h2 {
    margin: 0;
    font-size: 15px;
    font-family: var(--serif);
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--teal-800);
}
.dash-card-head h2 .ico {
    width: 16px;
    height: 16px;
    color: var(--teal-600);
}
.dash-card-head a,
.dash-card-head span {
    color: var(--muted);
    font-size: 12px;
}
.dash-card-head a:hover { color: var(--teal-700); }
.dash-empty {
    flex: 1;
    display: grid;
    place-items: center;
    color: var(--muted);
    font-size: 13px;
}
.dash-book {
    display: flex;
    gap: 12px;
    align-items: flex-start;
    color: inherit;
    background: #f7fdfb;
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 12px;
    position: relative;
    flex: none;
    min-height: 0;
}
.dash-book:hover { border-color: var(--teal-300); }
.dash-cover {
    width: 72px;
    height: 96px;
    border-radius: 8px;
    overflow: hidden;
    flex: none;
    background: linear-gradient(160deg, #e7f7f3, #b4e8dd);
    display: grid;
    place-items: center;
}
.dash-cover img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
.dash-cover span {
    font-family: var(--serif);
    font-size: 22px;
    color: var(--teal-700);
}
.dash-book-body { min-width: 0; flex: 1; padding-right: 22px; }
.dash-book-body h3 {
    margin: 0 0 6px;
    font-size: 16px;
    font-family: var(--serif);
    line-height: 1.4;
}
.dash-book-meta,
.dash-book-time { margin: 0; color: var(--muted); font-size: 12px; }
.dash-book-time { margin-top: 8px; }
.dash-book-edit {
    position: absolute;
    right: 10px;
    top: 10px;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: #fff;
    color: var(--teal-700);
    display: grid;
    place-items: center;
    font-size: 13px;
    box-shadow: 0 4px 10px rgba(18, 63, 60, .08);
}
.dash-card-btn {
    margin-top: 12px;
    width: 100%;
    text-align: center;
}
.dash-card > .btn-ghost.dash-card-btn {
    width: auto;
    align-self: flex-end;
}
.dash-progress::after {
    content: "码";
    position: absolute;
    right: 8px;
    top: 36px;
    font-family: var(--serif);
    font-size: 120px;
    color: rgba(26, 157, 138, .06);
    pointer-events: none;
    line-height: 1;
}
.dash-prog-num {
    display: flex;
    align-items: baseline;
    gap: 6px;
    color: var(--teal-800);
    position: relative;
    z-index: 1;
}
.dash-prog-num b {
    font-size: 36px;
    font-weight: 700;
    line-height: 1;
}
.dash-prog-num span { font-size: 14px; color: var(--muted); }
.dash-prog-desc {
    margin: 8px 0 12px;
    color: var(--muted);
    font-size: 12px;
    position: relative;
    z-index: 1;
}
.dash-bar {
    height: 8px;
    border-radius: 99px;
    background: var(--teal-100);
    overflow: hidden;
    position: relative;
    z-index: 1;
}
.dash-bar i {
    display: block;
    height: 100%;
    border-radius: 99px;
    background: linear-gradient(90deg, #3fb9a5, var(--teal-700));
    min-width: 0;
}
.dash-levels {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 6px;
    margin-top: 12px;
    position: relative;
    z-index: 1;
}
.dash-levels span {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    padding: 6px 4px;
    border-radius: 8px;
    background: #f7fdfb;
    color: var(--muted);
    font-size: 12px;
    text-align: center;
}
.dash-levels em { font-style: normal; font-size: 11px; }
.dash-levels span.is-on {
    background: var(--teal-100);
    color: var(--teal-800);
    font-weight: 600;
}
.dash-levels span.is-done {
    background: rgba(26, 157, 138, .16);
    color: var(--teal-800);
}
.dash-streak {
    margin: 14px 0 0;
    color: var(--teal-700);
    font-size: 13px;
    position: relative;
    z-index: 1;
}
.dash-rank-list {
    list-style: none;
    margin: 0;
    padding: 0;
    flex: 1;
    overflow: auto;
    min-height: 0;
}
.dash-rank-list li {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 4px;
    border-bottom: 1px solid var(--line);
    font-size: 13px;
}
.dash-rank-list li:last-child { border-bottom: 0; }
.dash-rank-list em {
    width: 22px;
    flex: none;
    font-style: normal;
    font-weight: 700;
    color: var(--muted);
    text-align: center;
}
.dash-rank-list li:nth-child(1) em { color: #c27803; }
.dash-rank-list li:nth-child(2) em { color: #7a8894; }
.dash-rank-list li:nth-child(3) em { color: #b56a3a; }
.dash-rank-list span {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.dash-rank-list b { font-weight: 700; color: var(--teal-800); }
.dash-rank-list li.is-me {
    background: var(--teal-50);
    border-radius: 8px;
    padding-left: 6px;
    padding-right: 6px;
}

@media (max-width: 1180px) {
    .write-col-side { min-width: 160px; }
    .write-phone {
        flex-basis: 360px;
        width: 360px;
        max-width: 360px;
    }
    .dash-board { grid-template-columns: 1fr 1fr; min-height: 0; }
    .dash-rank { grid-column: 1 / -1; }
}
@media (max-width: 900px) {
    .write-col-side { display: none; }
    .write-phone,
    .write-phone-frame {
        flex-basis: min(390px, 100%);
        width: min(390px, 100%);
        max-width: 100%;
    }
    .dash-board { grid-template-columns: 1fr; }
    .dash-rank { grid-column: auto; }
}

@media (max-width: 980px) {
    .login-wrap { grid-template-columns: 1fr; padding-top: 32px; }
    .login-intro { text-align: left; }
    .stat-grid { grid-template-columns: 1fr 1fr; }
    .app-shell { grid-template-columns: 1fr; }
    .sidebar {
        position: fixed;
        z-index: 20;
        width: 196px;
        transform: translateX(-105%);
        transition: transform .25s ease;
    }
    .app-shell.open .sidebar { transform: none; }
    .chapter-layout { flex-direction: column; }
    .chapter-side,
    .chapter-main {
        width: 100%;
        max-width: none;
        flex: none;
    }
}
@media (max-width: 640px) {
    .stat-grid, .form-row { grid-template-columns: 1fr; }
    .page-head { flex-direction: column; align-items: flex-start; }
    .char-grid { grid-template-columns: 1fr; }
}
