:root {
  font-family:
    Inter,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    "PingFang SC",
    "Microsoft YaHei",
    sans-serif;
  color: #1b2d2b;
  background: #f5f7f7;
  font-synthesis: none;
  --green: #14665a;
  --border: #dfe7e5;
  --muted: #72837f;
  --light: #edf5f2;
}
.permissions-dialog {
  width: min(850px, calc(100vw - 32px));
  max-width: 850px;
  max-height: 90vh;
  overflow: auto;
}
.permissions-dialog section {
  border-top: 1px solid var(--border);
  padding: 16px 0;
}
.permissions-dialog h3 {
  margin: 0 0 12px;
  font-size: 15px;
}
.acl-read-actions,
.acl-add-row {
  display: flex;
  gap: 12px;
  align-items: center;
  margin: 12px 0;
}
.acl-add-row select {
  flex: 1;
  min-width: 0;
}
.acl-add-row label {
  flex-shrink: 0;
}
.acl-user-row {
  display: grid;
  grid-template-columns: minmax(100px, 1fr) 145px minmax(140px, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}
.permissions-dialog .acl-checkbox {
  display: flex;
  align-items: center;
  gap: 7px;
  margin: 0;
  font-size: 12px;
}
.permissions-dialog input[type="checkbox"] {
  width: auto;
  margin: 0;
}
.acl-warning {
  background: #fff7e8;
  border-radius: 8px;
  padding: 12px;
  font-size: 13px;
  line-height: 1.7;
}
.acl-preview-result {
  background: var(--light);
  padding: 12px;
  border-radius: 8px;
  font-size: 13px;
  overflow-wrap: anywhere;
}
.acl-preview-result ul {
  padding-left: 20px;
  font-size: 12px;
}
#acl-status {
  font-size: 13px;
  line-height: 1.6;
}
@media (max-width: 680px) {
  .acl-user-row {
    grid-template-columns: 1fr 1fr;
  }
  .acl-add-row {
    flex-wrap: wrap;
  }
  .acl-add-row select {
    flex-basis: 50%;
  }
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
}
button,
input,
textarea,
select {
  font: inherit;
}
button {
  cursor: pointer;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  padding: 10px 16px;
  font-size: 13px;
  font-weight: 600;
  color: #334b45;
  transition: background 0.15s;
}
button:hover {
  background: #edf4f1;
}
button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
.primary {
  background: var(--green);
  border-color: var(--green);
  color: #fff;
}
.primary:hover {
  background: #0e554b;
}
.subtle {
  background: transparent;
}
.wide {
  width: 100%;
}
.text-button {
  border: 0;
  background: transparent;
  padding: 0;
  font-size: 12px;
  color: var(--green);
}
.icon-button {
  border: 0;
  background: transparent;
  padding: 7px;
  font-size: 20px;
}
.muted {
  color: var(--muted);
}
.small {
  font-size: 11px;
}
.pill {
  display: inline-block;
  padding: 6px 10px;
  border-radius: 5px;
  background: #ecf3ef;
  color: #4c7566;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.5px;
}
.pill.small {
  padding: 4px 7px;
}
.eyebrow {
  font-size: 10px;
  letter-spacing: 2px;
  color: #799289;
  font-weight: 700;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: inherit;
  text-decoration: none;
  font-size: 21px;
  letter-spacing: -0.7px;
  font-weight: 750;
}
.brand-mark {
  display: grid;
  place-items: center;
  background: var(--green);
  color: #fff;
  border-radius: 10px;
  width: 32px;
  height: 32px;
  font-size: 22px;
}
.login-view {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1.05fr 1fr;
}
.login-story {
  background: #eaf1ec;
  padding: 42px 58px;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}
.story-body {
  margin: auto;
  max-width: 460px;
  padding: 50px 0;
}
.story-body h1 {
  font-size: 43px;
  line-height: 1.4;
  letter-spacing: -2px;
  margin: 22px 0;
}
.story-body p {
  font-size: 15px;
  color: #688076;
  line-height: 2;
}
.story-card {
  background: #fcfdfb;
  border: 1px solid #d9e4db;
  border-radius: 14px;
  padding: 28px;
  margin-top: 42px;
  box-shadow: 0 16px 40px #3f64500c;
  transform: rotate(-2deg);
}
.mini-caption {
  display: flex;
  align-items: center;
  gap: 7px;
  color: #769080;
  font-size: 11px;
}
.dot {
  height: 6px;
  width: 6px;
  border-radius: 50%;
  background: #8ca873;
}
.story-card h3 {
  font-size: 24px;
  line-height: 1.7;
  font-weight: 550;
  letter-spacing: 1px;
}
.story-lines i {
  display: block;
  height: 6px;
  border-radius: 3px;
  background: #edf1ed;
  margin: 10px 0;
  width: 90%;
}
.story-lines i:nth-child(2) {
  width: 75%;
}
.story-lines i:last-child {
  width: 52%;
}
.people {
  display: flex;
  align-items: center;
  margin-top: 30px;
}
.people b {
  border: 2px solid white;
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  background: #d8e5d3;
  border-radius: 50%;
  font-size: 10px;
  color: #576b4c;
  margin-right: -5px;
}
.people b:nth-child(2) {
  background: #e7dbcc;
}
.people b:nth-child(3) {
  background: #d6e4e9;
}
.people span {
  margin-left: 20px;
  font-size: 10px;
  color: #789081;
}
.story-foot {
  color: #7d9487;
  font-size: 11px;
  letter-spacing: 2px;
}
.login-panel {
  display: grid;
  place-items: center;
  background: #fcfdfc;
  padding: 50px;
}
.login-form {
  max-width: 350px;
  width: 100%;
}
.login-form h2 {
  font-size: 29px;
  margin: 22px 0 12px;
}
.login-form p {
  font-size: 13px;
  line-height: 1.8;
  margin-bottom: 32px;
}
label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  margin: 18px 0 8px;
}
input,
select,
textarea {
  width: 100%;
  border: 1px solid #dce5e1;
  background: #fff;
  border-radius: 7px;
  padding: 12px;
  color: #293e37;
  outline: none;
  font-size: 13px;
}
input:focus,
textarea:focus,
select:focus {
  border-color: #77a695;
  box-shadow: 0 0 0 3px #14665a0c;
}
input::placeholder,
textarea::placeholder {
  color: #a2ada8;
}
.login-form .primary {
  margin-top: 26px;
  padding: 13px;
  display: flex;
  justify-content: space-between;
}
.login-tip {
  margin-top: 32px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
  font-size: 11px;
  color: #899a91;
  line-height: 1.9;
}
.workspace {
  display: flex;
  min-height: 100vh;
}
.sidebar {
  width: 250px;
  flex-shrink: 0;
  background: #f7f9f8;
  border-right: 1px solid var(--border);
  padding: 28px 20px;
  position: fixed;
  inset: 0 auto 0 0;
  display: flex;
  flex-direction: column;
}
.sidebar .brand {
  font-size: 20px;
  margin-bottom: 38px;
}
.sidebar-label {
  font-size: 11px;
  color: #7b8f87;
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
}
.sidebar select {
  background: #fff;
  font-size: 13px;
  font-weight: 600;
  padding: 12px 9px;
}
.sidebar .wide {
  margin-top: 10px;
  text-align: left;
  color: #567a6b;
  font-weight: 500;
}
.sidebar-divider {
  border-top: 1px solid var(--border);
  margin: 25px 0;
}
.nav-caption {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: #8a9b93;
  margin: 0 6px 14px;
}
.document-nav {
  width: 100%;
  text-align: left;
  border: 0;
  background: transparent;
  border-radius: 6px;
  padding: 11px 10px;
  font-size: 12px;
  font-weight: 450;
  color: #6c8177;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.document-nav.active {
  background: #e5efea;
  color: #1a6554;
  font-weight: 650;
}
.document-nav:before {
  content: "▤";
  margin-right: 9px;
  color: #91a79d;
}
.sidebar-bottom {
  margin-top: auto;
  display: flex;
  align-items: center;
  gap: 10px;
  border-top: 1px solid var(--border);
  padding-top: 20px;
}
.avatar {
  background: #e8e1d5;
  color: #8e785b;
  border-radius: 50%;
  height: 33px;
  width: 33px;
  display: grid;
  place-items: center;
  font-size: 13px;
}
.sidebar-bottom strong {
  display: block;
  font-size: 12px;
  font-weight: 600;
}
.sidebar-bottom small {
  display: block;
  color: #98a69d;
  font-size: 10px;
  margin-top: 3px;
}
.sidebar-bottom button {
  margin-left: auto;
}
.main {
  margin-left: 250px;
  flex: 1;
  min-width: 0;
}
.topbar {
  height: 74px;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 42px;
  background: #fff;
}
.breadcrumb {
  font-size: 12px;
  color: #92a098;
}
.breadcrumb span {
  padding: 0 13px;
  color: #c5cec9;
}
.breadcrumb strong {
  font-weight: 500;
  color: #4e655a;
}
.topbar-actions {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 10px;
  color: #91a298;
}
.connection-dot {
  width: 5px;
  height: 5px;
  background: #7fa48a;
  border-radius: 50%;
}
.main-body {
  max-width: 1280px;
  margin: 0 auto;
  padding: 38px 42px;
}
.space-heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  margin-bottom: 30px;
}
.space-heading h1 {
  font-size: 26px;
  letter-spacing: -0.5px;
  margin: 9px 0;
}
.space-heading p {
  font-size: 12px;
  line-height: 1.8;
  margin: 6px 0;
  max-width: 600px;
}
.actions {
  display: flex;
  align-items: center;
  gap: 8px;
}
.empty-state {
  min-height: 510px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  border: 1px dashed #dce5e0;
  border-radius: 12px;
  background: #fafcfb;
}
.empty-icon {
  width: 58px;
  height: 66px;
  border: 1px solid #d2e0d8;
  border-radius: 8px;
  background: #eff5f0;
  display: grid;
  place-items: center;
  font-size: 32px;
  color: #8baa9a;
  margin-bottom: 20px;
}
.empty-state h2 {
  font-size: 20px;
  font-weight: 550;
}
.empty-state p {
  font-size: 12px;
  color: #8c9f93;
  line-height: 2;
}
.steps {
  display: flex;
  gap: 18px;
  font-size: 10px;
  color: #8aa292;
  margin-top: 25px;
}
.steps i {
  color: #c5d2ca;
}
.editor-card {
  border: 1px solid #e0e7e3;
  border-radius: 11px;
  background: #fff;
  box-shadow: 0 7px 20px #23483203;
  overflow: hidden;
}
.editor-toolbar {
  height: 65px;
  border-bottom: 1px solid #edf0ee;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 22px;
}
.document-label {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 11px;
  color: #81968a;
}
.doc-symbol {
  font-size: 19px;
  color: #7a9987;
}
.document-page {
  padding: 42px 52px 25px;
  min-height: 450px;
}
.document-page h2 {
  font-size: 29px;
  font-weight: 650;
  letter-spacing: -0.5px;
  margin: 0 0 18px;
  overflow-wrap: anywhere;
}
.document-meta {
  display: flex;
  gap: 17px;
  font-size: 10px;
  color: #93a598;
  margin-bottom: 30px;
}
#save-status {
  color: #638875;
}
#save-status.error {
  color: #b46b4e;
}
#editor-text {
  resize: vertical;
  min-height: 290px;
  border: 0;
  padding: 0;
  box-shadow: none;
  font-size: 15px;
  line-height: 2.1;
  color: #435a4b;
  background: transparent;
}
#editor-text[readonly] {
  color: #7c8b80;
}
.editor-footer {
  display: flex;
  align-items: center;
  gap: 18px;
  border-top: 1px solid #f0f3f0;
  padding: 14px 24px;
  color: #a2afa5;
  font-size: 10px;
}
.editor-footer button {
  margin-left: auto;
}
.recovery-copies {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 24px;
  background: #fff8ef;
  border-top: 1px solid #ecd3bd;
}
.recovery-copies label {
  margin: 0;
  white-space: nowrap;
}
.recovery-copies select {
  flex: 1;
  min-width: 80px;
  width: auto;
}
.recovery-copies button {
  white-space: nowrap;
}
.local-read-recovery {
  flex-wrap: wrap;
  margin-bottom: 20px;
  border: 1px solid #ecd3bd;
  border-radius: 8px;
  font-size: 12px;
}
.local-read-recovery span {
  flex: 1 1 240px;
}
#connection-status[data-state="offline"],
#connection-status[data-state="denied"] {
  color: #a16548;
}
.workspace-foot {
  font-size: 10px;
  text-align: center;
  margin-top: 28px;
  color: #a7b5ac;
  letter-spacing: 1px;
}
.notice {
  position: fixed;
  right: 28px;
  top: 16px;
  max-width: 560px;
  padding: 14px 20px;
  background: #fff4ec;
  color: #9e512d;
  border: 1px solid #ecd3bd;
  border-radius: 8px;
  z-index: 99;
  font-size: 13px;
  line-height: 1.6;
  box-shadow: 0 5px 20px #3824130d;
}
dialog {
  border: 1px solid var(--border);
  border-radius: 13px;
  padding: 28px;
  width: 460px;
  max-width: calc(100vw - 30px);
  box-shadow: 0 25px 80px #15362a25;
}
dialog::backdrop {
  background: #16352d42;
  backdrop-filter: blur(3px);
}
dialog h2 {
  font-size: 21px;
  margin: 0;
}
.dialog-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
dialog p {
  font-size: 12px;
  line-height: 1.8;
}
dialog .primary.wide {
  margin-top: 24px;
}
.members-dialog {
  width: 650px;
}
.member-row {
  padding: 15px 0;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 12px;
}
.member-row .member-name {
  flex: 1;
}
.member-name small {
  display: block;
  color: #92a298;
  margin-top: 4px;
}
.member-row button {
  font-size: 11px;
  padding: 6px 10px;
  color: #a16548;
}
.member-form {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  align-items: end;
  margin: 10px 0 22px;
}
.member-form button {
  grid-column: 1/-1;
}
.members-dialog .eyebrow {
  margin-bottom: 7px;
  display: block;
}
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}
[hidden] {
  display: none !important;
}
@media (max-width: 900px) {
  .login-view {
    grid-template-columns: 1fr;
  }
  .login-story {
    display: none;
  }
  .login-panel {
    min-height: 100vh;
  }
  .sidebar {
    width: 200px;
    padding: 20px 14px;
  }
  .main {
    margin-left: 200px;
  }
  .main-body {
    padding: 25px;
  }
  .topbar {
    padding: 0 25px;
  }
  .document-page {
    padding: 30px;
  }
  .space-heading {
    align-items: flex-start;
    flex-direction: column;
  }
  .document-page h2 {
    font-size: 24px;
  }
}
@media (max-width: 600px) {
  .workspace {
    display: block;
  }
  .sidebar {
    position: static;
    width: 100%;
    padding: 15px;
    max-height: 250px;
  }
  .sidebar .brand,
  .sidebar-divider,
  .sidebar-label,
  .sidebar-bottom,
  .nav-caption {
    display: none;
  }
  #document-list {
    display: flex;
    overflow: auto;
  }
  .document-nav {
    width: auto;
    max-width: 200px;
  }
  .main {
    margin-left: 0;
  }
  .topbar {
    height: 48px;
  }
  .main-body {
    padding: 18px;
  }
  .document-page {
    padding: 24px;
  }
  .document-label .pill {
    display: none;
  }
  .steps {
    gap: 10px;
  }
  .editor-toolbar {
    padding: 0 12px;
  }
  .space-heading h1 {
    font-size: 24px;
  }
  .notice {
    right: 12px;
    left: 12px;
    top: 12px;
  }
}
.history-dialog {
  width: min(1050px, calc(100vw - 40px));
  max-width: none;
  max-height: 90vh;
  overflow-y: auto;
}
.history-dialog .dialog-heading p {
  margin: 8px 0 0;
}
.version-form {
  display: flex;
  align-items: end;
  gap: 12px;
}
.version-form > div {
  flex: 1;
}
.version-form label {
  margin-top: 0;
}
.version-form button {
  white-space: nowrap;
  min-height: 42px;
}
.history-layout {
  display: grid;
  grid-template-columns: minmax(220px, 0.8fr) minmax(0, 1.4fr);
  gap: 26px;
  margin-top: 24px;
}
.history-section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.history-dialog h3 {
  font-size: 14px;
  margin: 0 0 14px;
}
.history-section-heading h3 {
  margin: 0;
}
.history-timeline {
  padding-right: 24px;
  border-right: 1px solid var(--border);
}
#history-list {
  display: grid;
  gap: 8px;
  margin: 16px 0;
}
.history-entry {
  width: 100%;
  text-align: left;
  line-height: 1.6;
  padding: 12px;
  overflow-wrap: anywhere;
}
.history-entry.active {
  border-color: var(--green);
  background: var(--light);
}
.history-entry strong {
  display: block;
  font-size: 12px;
}
.history-entry small {
  display: block;
  font-size: 10px;
  color: var(--muted);
  margin-top: 5px;
}
.version-details {
  min-width: 0;
}
#version-preview {
  resize: vertical;
  min-height: 160px;
  max-height: 330px;
  background: #f8faf9;
  line-height: 1.8;
}
#compare-version {
  margin: 14px 0 22px;
}
.diff-legend {
  font-size: 11px;
  line-height: 2;
}
.version-diff {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 13px;
  line-height: 1.9;
  max-height: 280px;
  overflow-y: auto;
}
.history-dialog del {
  background: #fce6e3;
  color: #9b3934;
}
.history-dialog ins {
  background: #e0f1e7;
  color: #236144;
  text-decoration: none;
  border-bottom: 1px solid #6eab87;
}
.restore-confirmation {
  background: #f6f1e7;
  border: 1px solid #e2d6b8;
  border-radius: 10px;
  padding: 22px;
  margin-top: 22px;
}
.restore-confirmation h3 {
  color: #785d2e;
}
.restore-confirmation p,
.restore-confirmation li {
  font-size: 12px;
  line-height: 1.8;
}
.restore-confirmation ul {
  padding-left: 19px;
}
.restore-confirmation .actions {
  justify-content: flex-end;
  margin-top: 16px;
}
.retry-note {
  font-weight: 600;
  color: #785d2e;
}
.history-status {
  font-size: 12px;
  line-height: 1.8;
  margin: 18px 0 0;
}
.history-status.error {
  color: #a24438;
}
@media (max-width: 850px) {
  .editor-toolbar {
    align-items: flex-start;
    gap: 14px;
    flex-direction: column;
  }
  .editor-toolbar .actions {
    flex-wrap: wrap;
  }
  .history-layout {
    grid-template-columns: 1fr;
  }
  .history-timeline {
    padding-right: 0;
    padding-bottom: 20px;
    border-right: 0;
    border-bottom: 1px solid var(--border);
  }
  .version-form {
    align-items: stretch;
    flex-direction: column;
  }
}

/* Directory feedback and actions remain separate from editor save feedback. */
#document-list {
  overflow-y: auto;
  min-height: 60px;
}
.tree-row {
  display: flex;
  align-items: center;
  min-width: 0;
  flex-shrink: 0;
}
.tree-row .document-nav {
  min-width: 0;
  flex: 1;
}
.tree-toggle {
  border: 0;
  background: transparent;
  flex: 0 0 24px;
  padding: 7px 2px;
  color: #567a6b;
}
.tree-toggle:disabled {
  visibility: hidden;
}
.tree-feedback {
  padding: 6px;
  margin-bottom: 14px;
  font-size: 11px;
  line-height: 1.7;
  overflow-wrap: anywhere;
}
#tree-status {
  margin: 4px 0 7px;
}
#tree-status.error {
  color: #a24438;
}
.tree-document-actions {
  flex-wrap: wrap;
  margin: -8px 0 18px;
}
.tree-document-actions button {
  font-size: 12px;
  padding: 8px 13px;
}
@media (max-width: 600px) {
  .sidebar {
    max-height: 390px;
  }
  #document-list {
    display: block;
    max-height: 160px;
    flex-shrink: 1;
  }
  .tree-row .document-nav {
    width: 100%;
    max-width: none;
  }
  .tree-feedback {
    flex-shrink: 0;
    margin-bottom: 0;
  }
  .nav-caption {
    display: flex;
    margin-top: 14px;
    margin-bottom: 4px;
  }
}

/* UC04 trash: metadata-only batch management and explicit draft recovery. */
button.danger {
  color: #a02a2a;
  border-color: #e7b8b8;
  background: #fff7f7;
}
.trash-dialog {
  width: min(640px, calc(100vw - 40px));
}
.trash-entry {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 18px;
  padding: 16px 0;
  border-bottom: 1px solid var(--line, #e7e9ed);
}
.trash-entry strong,
.trash-entry small {
  display: block;
}
.trash-entry small {
  color: #6b7280;
  margin-top: 5px;
}
.protected-notice {
  padding: 14px 20px;
  margin: 0;
  color: #82531b;
  background: #fff5df;
  border-bottom: 1px solid #ead6ac;
  line-height: 1.7;
}
#trash-status,
#trash-command-status {
  font-size: 13px;
  line-height: 1.6;
}
