:root {
  color-scheme: light;
  font-family:
    Inter, "Noto Sans TC", "Microsoft JhengHei", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #f2f4f1;
  color: #1d2528;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
}

button,
input,
textarea,
select {
  font: inherit;
}

button {
  min-height: 40px;
  border: 0;
  border-radius: 6px;
  padding: 0 16px;
  background: #2d5c55;
  color: white;
  cursor: pointer;
}

button.secondary,
button.chip {
  background: #d9e1dc;
  color: #1d2528;
}

button.danger {
  background: #9c3b3b;
}

.shell {
  width: min(1280px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 28px 0 48px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 4px;
  font-size: 30px;
}

.topbar p,
.empty,
.status {
  color: #637174;
}

.topbar p {
  margin-bottom: 0;
}

.panel,
.libraryPanel,
.readerPanel {
  border: 1px solid #d6ddd8;
  border-radius: 8px;
  background: #ffffff;
}

.panel,
.libraryPanel {
  padding: 18px;
}

.tabs,
.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 18px;
}

.tab,
.chip {
  background: #e7ece8;
  color: #1d2528;
}

.tab.active,
.chip.active {
  background: #2d5c55;
  color: white;
}

.readerWorkspace {
  display: grid;
  grid-template-columns: 340px minmax(0, 1fr);
  grid-template-areas:
    "library reader"
    "library editor";
  gap: 18px;
  align-items: start;
}

.libraryPanel {
  position: sticky;
  top: 18px;
  grid-area: library;
  max-height: calc(100vh - 36px);
  overflow: auto;
}

.readerPanel {
  grid-area: reader;
  min-height: 640px;
  overflow: hidden;
}

.editorPanel {
  grid-area: editor;
}

.form {
  display: grid;
  gap: 14px;
}

label {
  display: grid;
  gap: 6px;
  color: #384547;
}

input,
textarea,
select {
  width: 100%;
  border: 1px solid #c8d2ce;
  border-radius: 6px;
  padding: 10px 11px;
  background: white;
  color: #1d2528;
}

textarea {
  resize: vertical;
}

.panelHeader,
.documentActions,
.readerToolbar,
.readerMeta,
.formActions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.panelHeader,
.documentActions {
  justify-content: space-between;
}

.panelHeader {
  margin-bottom: 12px;
}

.panelHeader h2 {
  margin-bottom: 0;
}

.documentList {
  display: grid;
  gap: 8px;
}

.documentListItem {
  display: grid;
  gap: 5px;
  width: 100%;
  height: auto;
  min-height: 84px;
  border: 1px solid #dde4e0;
  border-radius: 8px;
  padding: 12px;
  background: #fbfcfb;
  color: #1d2528;
  text-align: left;
}

.documentListItem.active {
  border-color: #2d5c55;
  background: #edf5f1;
}

.documentListItem strong {
  line-height: 1.35;
}

.documentListItem span,
.documentListItem small {
  color: #637174;
}

.readerToolbar {
  justify-content: flex-end;
  border-bottom: 1px solid #e1e7e3;
  padding: 14px 18px;
  background: #fbfcfb;
}

.readerMeta {
  margin-right: auto;
  flex-wrap: wrap;
  color: #637174;
  font-size: 14px;
}

.documentReader {
  max-width: 820px;
  margin: 0 auto;
  padding: 34px 38px 56px;
}

.documentReader h2 {
  margin-bottom: 12px;
  font-size: 30px;
  line-height: 1.3;
}

.readerBody {
  color: #253033;
  font-size: 16px;
  line-height: 1.85;
}

.readerBody h2 {
  margin: 34px 0 12px;
  font-size: 24px;
}

.readerBody h3,
.readerBody h4 {
  margin: 26px 0 10px;
}

.readerBody p {
  margin-bottom: 16px;
}

.readerBody ul {
  margin: 0 0 16px 22px;
  padding: 0;
}

.readerBody li {
  margin-bottom: 8px;
}

.emptyReader {
  color: #637174;
}

.tagRow {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  min-height: 18px;
  margin-bottom: 18px;
}

.tagRow span {
  border-radius: 999px;
  padding: 3px 8px;
  background: #e7ece8;
  color: #526165;
  font-size: 12px;
}

.formActions {
  justify-content: space-between;
}

.status {
  min-height: 24px;
  margin-top: 16px;
}

@media (max-width: 920px) {
  .readerWorkspace,
  .topbar {
    grid-template-columns: 1fr;
    grid-template-areas:
      "library"
      "reader"
      "editor";
    display: grid;
  }

  .libraryPanel {
    position: static;
    max-height: none;
  }

  .documentReader {
    padding: 24px 20px 40px;
  }
}
