:root {
  font-family: "Inter", "Microsoft YaHei", "PingFang SC", system-ui, sans-serif;
  color: #182822;
  background: #f4f7f5;
  --ink: #182822;
  --muted: #5d6d65;
  --line: #e1e9e3;
  --paper: #fff;
  --green: #21644d;
  --green-dark: #184c3b;
  --green-pale: #e8f3ec;
  --red: #9f3636;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; min-width: 320px; }
button, input, textarea, select { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button { color: inherit; cursor: pointer; }
button:disabled { cursor: default; opacity: .42; }
button:focus-visible, a:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible {
  outline: 2px solid #258461;
  outline-offset: 3px;
}
h1, h2, h3, p { margin: 0; }
a { text-decoration: none; color: inherit; }
.muted { color: var(--muted); }
.button {
  display: inline-flex; justify-content: center; align-items: center; gap: 8px;
  min-height: 40px; padding: 0 15px; border: 1px solid transparent; border-radius: 8px;
  font-size: 13px; font-weight: 650; white-space: nowrap;
}
.primary { background: var(--green); color: white; }
.primary:hover { background: var(--green-dark); }
.secondary { background: white; border-color: #d9e4dc; }
.secondary:hover { background: #f0f6f2; }
.danger-light { color: var(--red); border-color: #efd6d6; background: white; }
.danger-light:hover { background: #fcf0f0; }
.danger { background: var(--red); color: white; }
.danger:hover { background: #822b2b; }
.icon-button, .zoom-btn { background: transparent; border: 0; border-radius: 6px; }
.icon-button { width: 31px; height: 30px; padding: 0; font-size: 22px; line-height: 1; }
.icon-button:hover:not(:disabled), .zoom-btn:hover { background: #e9f1ec; }
.text-btn { border: 0; padding: 0; background: none; color: var(--green); font-size: 13px; font-weight: 650; text-align: left; }
.text-btn:hover { text-decoration: underline; }
.brand { display: inline-flex; align-items: center; gap: 10px; font-size: 20px; font-weight: 760; letter-spacing: -.05em; white-space: nowrap; }
.brand-icon {
  width: 32px; height: 32px; display: inline-grid; place-items: center; border-radius: 9px 9px 9px 3px;
  font-size: 19px; font-weight: 780; letter-spacing: 0; color: white; background: var(--green);
}

.login-view { display: grid; min-height: 100dvh; grid-template-columns: minmax(360px, .94fr) 1.06fr; background: #f9fbf9; }
.login-cover {
  display: flex; flex-direction: column; justify-content: space-between;
  min-height: 100%; padding: 40px clamp(34px, 6vw, 90px); overflow: hidden;
  background: radial-gradient(ellipse at 20% 80%, #255b47 0, transparent 65%), #153e33; color: #eef8f2;
}
.brand-cover .brand-icon { background: #d9efe3; color: #174535; }
.cover-content { padding: 40px 0; }
.cover-content h1 { font-size: clamp(32px, 4vw, 57px); line-height: 1.14; letter-spacing: -.065em; }
.cover-content p { margin-top: 16px; font-size: 16px; line-height: 1.7; color: #c2d9cb; }
.cover-foot { color: #b7d4c4; font-size: 13px; }
.cover-art { position: relative; width: 180px; height: 172px; margin-bottom: 30px; }
.paper { position: absolute; width: 112px; height: 144px; border-radius: 12px; }
.paper-back { transform: rotate(-15deg); background: #71a890; left: 8px; top: 12px; }
.paper-front { transform: rotate(8deg); background: #e8f5ec; left: 46px; top: 8px; padding: 23px 16px; color: #215943; box-shadow: 0 12px 35px #0b2d23aa; }
.paper-front b { font-size: 27px; letter-spacing: -.07em; }
.paper-front i { display: block; width: 64px; height: 4px; margin-top: 10px; border-radius: 4px; background: #a2ccb5; }
.paper-front i:nth-of-type(3) { width: 40px; }
.paper-front span { position: absolute; bottom: -6px; right: -9px; width: 34px; height: 34px; display: grid; place-items: center; border-radius: 50%; background: #3e9a74; color: white; font-weight: 800; }
.login-main { display: grid; place-items: center; padding: 36px; }
.login-form { width: min(100%, 350px); display: grid; gap: 19px; }
.login-form h2 { font-size: 31px; letter-spacing: -.055em; }
.login-form > p.muted { font-size: 14px; margin-top: -10px; margin-bottom: 10px; }
.brand-mobile { display: none; margin-bottom: 16px; }
.login-submit { width: 100%; min-height: 46px; margin-top: 8px; }

label { display: grid; gap: 8px; color: #293b32; font-size: 13px; font-weight: 620; min-width: 0; }
label > input, label > textarea, label > select {
  background: white; border: 1px solid #d7e3db; border-radius: 8px; color: var(--ink);
  font-size: 14px; font-weight: 400; min-height: 41px; padding: 9px 11px; width: 100%;
}
input::placeholder { color: #6d7e74; }
textarea { resize: vertical; line-height: 1.57; }
input[type=color] { padding: 5px; }
input[type=file] { font-size: 12px; }
.form-error { color: var(--red); font-size: 13px; line-height: 1.55; }

.workspace { height: 100dvh; display: grid; grid-template-rows: auto minmax(0, 1fr); }
.topbar { min-height: 65px; display: flex; align-items: center; gap: 34px; padding: 0 24px; background: white; border-bottom: 1px solid var(--line); }
.topbar nav { display: flex; align-self: stretch; gap: 23px; }
.nav-item { border: 0; border-bottom: 2px solid transparent; padding: 0 3px; margin-bottom: -1px; background: none; font-size: 13px; color: var(--muted); white-space: nowrap; }
.nav-item.active { color: var(--green-dark); border-bottom-color: #358468; font-weight: 700; }
.nav-item:hover { color: var(--green); }
.account { margin-left: auto; }
.account-btn { display: flex; align-items: center; gap: 9px; padding: 3px 4px; background: none; border: 0; border-radius: 8px; color: #2c4438; font-size: 13px; }
.account-btn:hover { background: #f0f6f2; }
#account-name { max-width: 150px; text-overflow: ellipsis; overflow: hidden; white-space: nowrap; }
.avatar { display: grid; place-items: center; width: 31px; height: 31px; border-radius: 50%; background: #dcefe4; color: var(--green-dark); font-weight: 750; }

.editor { display: grid; grid-template-columns: 236px minmax(0, 1fr) 291px; min-height: 0; }
.editor:not(.has-document) { grid-template-columns: 236px minmax(0, 1fr); }
.sidebar, .inspector { min-height: 0; background: white; display: flex; flex-direction: column; }
.sidebar { border-right: 1px solid var(--line); }
.sidebar-head { padding: 24px 16px 13px; display: grid; gap: 13px; }
.sidebar-heading { display: flex; gap: 9px; align-items: center; }
.sidebar-heading h2 { font-size: 15px; }
.count { background: #eaf1ec; color: #476556; font-size: 11px; font-weight: 700; border-radius: 10px; padding: 1px 7px; }
.upload-btn { width: 100%; }
.search { position: relative; }
.search span { position: absolute; top: 7px; left: 10px; font-size: 19px; font-weight: 500; color: #5e7468; }
.search input { padding-left: 33px; min-height: 36px; font-size: 13px; }
.doc-list { display: grid; align-content: start; gap: 4px; padding: 0 8px 18px; overflow: auto; flex: 1; }
.file-entry {
  display: grid; grid-template-columns: 31px minmax(0, 1fr); align-items: center; gap: 9px;
  background: transparent; border: 1px solid transparent; padding: 9px 7px; border-radius: 8px; text-align: left; width: 100%;
}
.file-entry:hover { background: #f1f6f3; }
.file-entry.active { background: #e9f3ec; border-color: #d8ebde; }
.file-icon { display: grid; place-items: center; border-radius: 6px 6px 6px 2px; background: #dcece2; color: #285f48; width: 31px; height: 33px; font-size: 9px; font-weight: 790; }
.file-info { min-width: 0; }
.file-name { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; font-weight: 700; }
.file-meta { display: block; margin-top: 4px; font-size: 11px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list-empty { padding: 14px 9px; font-size: 12px; color: var(--muted); }
.sidebar-foot { padding: 15px 16px; border-top: 1px solid var(--line); }
.sidebar-foot span { padding-left: 4px; }

.workarea { min-width: 0; min-height: 0; display: flex; flex-direction: column; }
.document-header { min-height: 77px; padding: 15px 20px; display: flex; align-items: center; gap: 12px; background: #fff; border-bottom: 1px solid var(--line); }
.document-title { min-width: 0; flex: 1; }
.document-title h1 { font-size: 20px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; letter-spacing: -.025em; }
.document-title p { font-size: 12px; margin-top: 5px; }
.document-title p:empty { display: none; }
.download-btn { min-height: 36px; }
.toolbar { min-height: 51px; padding: 6px 13px; display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 5px; background: #fbfdfb; border-bottom: 1px solid var(--line); }
.tool-set { display: flex; align-items: center; gap: 3px; }
.tool { display: inline-flex; align-items: center; gap: 5px; padding: 7px 8px; background: transparent; border: 1px solid transparent; border-radius: 6px; font-size: 12px; white-space: nowrap; }
.tool span { width: 15px; font-size: 15px; font-weight: 690; }
.tool.active { background: var(--green-pale); color: #174e38; border-color: #d4e9db; font-weight: 720; }
.tool:hover { background: var(--green-pale); }
.page-indicator { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: 12px; white-space: nowrap; }
.page-indicator input { width: 32px; padding: 3px 2px; border: 1px solid var(--line); border-radius: 5px; background: white; text-align: center; }
.tool-divider { width: 1px; height: 22px; margin: 0 4px; background: var(--line); }
.zoom-btn { font-size: 11px; min-width: 42px; height: 30px; padding: 0; font-variant-numeric: tabular-nums; }
.viewer { flex: 1; min-height: 0; overflow: auto; background: #e8eee9; padding: 28px clamp(13px, 3vw, 39px); }
.viewer:has(.empty-editor:not([hidden])) { display: grid; place-items: center; }
.viewer-footer { min-height: 34px; display: flex; justify-content: space-between; gap: 10px; align-items: center; background: #fbfdfb; padding: 6px 14px; color: var(--muted); font-size: 11px; border-top: 1px solid var(--line); }
#save-state { text-align: right; color: var(--green); }
.empty-editor { text-align: center; background: #f9fcfa; width: min(100%, 408px); border: 1px solid #dce8df; border-radius: 16px; padding: 40px 18px 34px; }
.empty-icon, .inspector-icon { display: grid; place-items: center; margin: 0 auto 15px; color: var(--green-dark); background: #e3f1e8; font-weight: 780; border-radius: 10px 10px 10px 4px; }
.empty-icon { width: 54px; height: 60px; font-size: 17px; }
.empty-editor h2 { font-size: 23px; letter-spacing: -.035em; }
.empty-editor p { color: var(--muted); margin: 9px 0 22px; font-size: 13px; }
.page-wrap { margin: 0 auto; }
.page-sheet { position: relative; background: white; border-radius: 2px; box-shadow: 0 2px 4px #22382d10, 0 7px 28px #22382d21; }
.page-sheet img { display: block; width: 100%; height: 100%; user-select: none; }
.overlay { position: absolute; inset: 0; }
.overlay.placement { cursor: crosshair; }
.text-hit, .placement-pin { position: absolute; }
.text-hit { min-height: 7px; background: transparent; border: 1px solid transparent; border-radius: 2px; padding: 0; }
.text-hit:hover, .text-hit:focus-visible, .text-hit.selected { background: #b4e6c75c; border-color: #429873; outline: none; }
.placement-pin { width: 13px; height: 13px; border-radius: 50%; transform: translate(-50%, -50%); border: 2px solid white; background: #258461; box-shadow: 0 0 0 1px #216a4d; pointer-events: none; }

.inspector { border-left: 1px solid var(--line); }
.inspector-tabs { display: flex; gap: 23px; min-height: 50px; padding: 0 17px; border-bottom: 1px solid var(--line); }
.panel-tab { border: 0; border-bottom: 2px solid transparent; margin-bottom: -1px; background: none; color: var(--muted); padding: 0 2px; font-size: 13px; }
.panel-tab.active { border-bottom-color: #358468; color: var(--green-dark); font-weight: 700; }
.inspector-body { overflow: auto; padding: 18px 16px; }
.inspector-empty { text-align: center; margin: 26px 2px; padding: 22px 11px; border: 1px dashed #d3e2d8; border-radius: 11px; }
.inspector-icon { width: 39px; height: 41px; font-size: 22px; }
.inspector-empty h3 { font-size: 14px; }
.inspector-empty p { color: var(--muted); margin-top: 8px; font-size: 12px; line-height: 1.65; }
.edit-form { display: grid; gap: 16px; }
.form-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.form-heading h3 { font-size: 16px; }
.form-heading h2 { font-size: 22px; line-height: 1.25; }
.field-grid { display: grid; gap: 10px; grid-template-columns: repeat(auto-fit, minmax(100px, 1fr)); }
.form-note { font-size: 12px; line-height: 1.65; }
.edit-buttons { display: flex; flex-wrap: wrap; gap: 8px; }
.version { display: grid; gap: 7px; padding: 14px 0; border-bottom: 1px solid var(--line); }
.version:first-child { padding-top: 0; }
.version strong { font-size: 13px; }
.version small { color: var(--muted); font-size: 11px; line-height: 1.5; }
.version-actions { display: flex; align-items: center; gap: 14px; margin-top: 3px; }
.version-actions > * { font-size: 12px; }

.management { width: min(100%, 1180px); margin: auto; align-self: stretch; padding: 34px 24px; overflow: auto; height: 100%; }
.management-head { display: flex; align-items: center; justify-content: space-between; gap: 15px; margin: 0 0 22px; }
.management-head h1 { font-size: 27px; letter-spacing: -.045em; margin-bottom: 6px; }
.management-head p { font-size: 13px; line-height: 1.5; }
.table-card { background: white; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.table-controls { display: flex; gap: 8px; padding: 15px; border-bottom: 1px solid var(--line); }
.table-controls .button { min-height: 36px; }
.table-controls .search { max-width: 300px; flex-grow: 1; }
.table-scroll { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; min-width: 660px; }
th, td { text-align: left; padding: 14px 15px; font-size: 13px; border-bottom: 1px solid #ebf0ed; }
th { background: #f5f8f6; font-size: 12px; color: #435f50; font-weight: 700; white-space: nowrap; }
tr:last-child td { border-bottom: 0; }
td > small { display: block; color: var(--muted); margin-top: 3px; }
td .text-btn + .text-btn { margin-left: 10px; }
.table-footer { padding: 12px 15px; border-top: 1px solid var(--line); }
.table-footer:has(button[hidden]) { display: none; }
.status-tag { display: inline-block; color: #29654b; background: #e8f3eb; border-radius: 20px; padding: 3px 8px; font-size: 11px; white-space: nowrap; }
.status-tag.off { color: #5e6862; background: #edf1ee; }
.nowrap { white-space: nowrap; }

dialog { width: min(calc(100% - 32px), 440px); border-radius: 13px; padding: 23px; border: 1px solid var(--line); color: var(--ink); box-shadow: 0 18px 80px #1a382950; }
dialog::backdrop { background: #142d24aa; }
#dialog-form, #dialog-body { display: grid; gap: 15px; }
#dialog-body p { font-size: 14px; line-height: 1.6; overflow-wrap: anywhere; }
.dialog-actions { display: flex; gap: 9px; justify-content: flex-end; flex-wrap: wrap; }
.toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); z-index: 2; max-width: min(90vw, 520px); background: #173b2e; color: white; border-radius: 9px; padding: 11px 17px; font-size: 13px; box-shadow: 0 4px 16px #182d2552; }
.toast.error { background: #792d2d; }

@media (max-width: 1100px) {
  .editor { grid-template-columns: 195px minmax(0, 1fr) 251px; }
  .editor:not(.has-document) { grid-template-columns: 195px minmax(0, 1fr); }
  .toolbar { justify-content: flex-start; }
}
@media (max-width: 800px) {
  .workspace { height: auto; min-height: 100dvh; grid-template-rows: auto minmax(0, 1fr); }
  .topbar { padding: 0 13px; min-height: 56px; gap: 15px; flex-wrap: wrap; }
  .topbar nav { gap: 12px; }
  .editor, .editor:not(.has-document) { grid-template-columns: minmax(0, 1fr); }
  .sidebar { border-right: 0; border-bottom: 1px solid var(--line); }
  .sidebar-head { display: flex; align-items: center; padding: 11px; gap: 9px; flex-wrap: wrap; }
  .sidebar-head .button { width: auto; min-height: 34px; }
  .sidebar-head .search { flex: 1; min-width: 125px; }
  .doc-list { display: flex; padding: 0 8px 7px; max-width: 100%; }
  .file-entry { width: 170px; flex: none; padding: 4px 5px; }
  .sidebar-foot { padding: 7px 11px; }
  .document-header { min-height: 58px; padding: 10px 13px; }
  .viewer { height: 62vh; min-height: 360px; flex: auto; }
  .viewer-footer { font-size: 10px; }
  .inspector { border-left: 0; border-top: 1px solid var(--line); }
  .inspector-empty { margin: 0; padding: 12px; }
  .inspector-icon { display: none; }
  .inspector-body { padding: 11px 13px; }
  .management { padding: 24px 13px; }
}
@media (max-width: 620px) {
  .login-view { grid-template-columns: 1fr; }
  .login-cover { display: none; }
  .brand-mobile { display: inline-flex; }
  .login-main { padding: 24px; }
  #account-name { display: none; }
  .topbar .brand > span:nth-child(2) { display: none; }
  .nav-item { font-size: 12px; }
  .document-title h1 { font-size: 16px; }
  .doc-search { width: 100%; }
}
