:root {
  --bg: #f5f5f1;
  --ink: #24352e;
  --muted: #6f7c74;
  --line: #e2e7df;
  --accent: #df682b;
  --green: #305d49;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  font:
    14px/1.6 system-ui,
    -apple-system,
    "Microsoft YaHei",
    sans-serif;
  background: var(--bg);
  color: var(--ink);
}
button,
input,
textarea,
select {
  font: inherit;
}
button,
a,
input,
select,
textarea {
  outline-offset: 3px;
}
button {
  cursor: pointer;
  border: 1px solid var(--line);
  background: white;
  border-radius: 8px;
  padding: 8px 14px;
  color: var(--ink);
}
button:hover {
  border-color: #9cab9d;
}
button:disabled {
  opacity: 0.45;
  cursor: default;
}
.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: white;
}
.danger {
  color: #ae3d2c;
}
.small {
  padding: 4px 8px;
  font-size: 12px;
}
.layout {
  display: flex;
  min-height: 100vh;
}
aside {
  width: 218px;
  background: #233c31;
  color: #f1f5ef;
  padding: 28px 20px;
  position: fixed;
  inset: 0 auto 0 0;
  display: flex;
  flex-direction: column;
}
.brand {
  font-size: 20px;
  font-weight: 750;
  letter-spacing: 1px;
}
.brand span {
  color: #ef9963;
}
aside p {
  font-size: 12px;
  color: #b9c9be;
  margin: 4px 0 30px;
}
nav {
  display: grid;
  gap: 8px;
}
nav button {
  border: 0;
  text-align: left;
  background: transparent;
  color: #c4d2c8;
  padding: 12px;
}
nav button.active {
  background: #385347;
  color: white;
}
aside footer {
  margin-top: auto;
  font-size: 12px;
  color: #bacbbe;
}
main {
  margin-left: 218px;
  width: calc(100% - 218px);
  padding: 32px 38px;
  max-width: 1680px;
}
.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
h1 {
  font-size: 27px;
  letter-spacing: -0.5px;
  margin: 0;
}
h2 {
  font-size: 18px;
  margin: 0 0 12px;
}
h3 {
  font-size: 15px;
}
p {
  color: var(--muted);
  margin: 8px 0 20px;
}
.row {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}
.card {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: white;
  padding: 22px;
  margin: 18px 0;
}
.stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin: 24px 0;
}
.stat {
  border: 1px solid var(--line);
  background: #fff;
  padding: 16px 22px;
  border-radius: 12px;
}
.stat small {
  color: var(--muted);
}
.stat strong {
  display: block;
  font-size: 27px;
  margin-top: 5px;
}
.toolbar {
  display: grid;
  gap: 12px;
}
.searchrow {
  display: flex;
  gap: 10px;
}
.searchrow input {
  flex: 1;
  min-width: 0;
}
.filters {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
input,
select,
textarea {
  border: 1px solid #d6dfd5;
  background: #fff;
  border-radius: 7px;
  padding: 9px 11px;
  color: var(--ink);
}
textarea {
  resize: vertical;
  line-height: 1.7;
}
label {
  color: #4b5e51;
}
.tablewrap {
  overflow: auto;
  margin: 16px -22px 0;
}
table {
  border-collapse: collapse;
  width: 100%;
  font-size: 13px;
}
td,
th {
  padding: 14px 14px;
  text-align: left;
  border-top: 1px solid var(--line);
  vertical-align: top;
}
th {
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
  background: #fafbf8;
}
td small {
  display: block;
  color: var(--muted);
  margin-top: 4px;
}
td a {
  color: var(--accent);
  text-decoration: none;
}
td input[type="checkbox"] {
  margin-top: 5px;
}
.tag {
  display: inline-block;
  font-size: 11px;
  background: #eff3ed;
  color: #5c7464;
  padding: 1px 7px;
  border-radius: 4px;
  margin: 2px 3px 2px 0;
}
.state {
  font-size: 12px;
  white-space: nowrap;
  color: #4a6856;
}
.note {
  max-width: 240px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.name {
  max-width: 270px;
  overflow-wrap: anywhere;
}
.empty {
  text-align: center;
  color: var(--muted);
  padding: 50px;
}
.pagination {
  justify-content: space-between;
  margin-top: 18px;
}
.subtle {
  color: var(--muted);
  font-size: 12px;
}
.badge {
  font-size: 11px;
  padding: 3px 8px;
  background: #e6eee6;
  color: #3b694d;
  border-radius: 100px;
}
#message {
  border-radius: 9px;
  padding: 12px 16px;
  background: #e8f0e5;
  margin: 16px 0;
  overflow-wrap: anywhere;
}
#message.error {
  background: #fff0e8;
  color: #a84726;
}
[hidden] {
  display: none !important;
}
.formgrid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}
.field {
  display: grid;
  gap: 5px;
}
.field.full {
  grid-column: 1/-1;
}
.field textarea {
  width: 100%;
  min-height: 110px;
}
.steps {
  line-height: 1.95;
  max-width: 850px;
}
.steps li {
  margin-bottom: 10px;
}
.callout {
  background: #faf4e9;
  border-left: 3px solid #e0a56b;
  padding: 12px 16px;
  color: #87633f;
  border-radius: 0 6px 6px 0;
  font-size: 13px;
}
.path {
  word-break: break-all;
  color: #3f6850;
  font-family: ui-monospace, monospace;
  font-size: 13px;
}
.preview {
  max-height: 300px;
  overflow: auto;
}
dialog {
  padding: 26px;
  border: 1px solid var(--line);
  border-radius: 15px;
  width: min(620px, 96vw);
  color: var(--ink);
}
dialog::backdrop {
  background: #172a2266;
}
.modalhead {
  justify-content: space-between;
  margin-bottom: 12px;
}
.foot {
  justify-content: flex-end;
  margin-top: 18px;
}
#bulkbar {
  background: #f0f4ec;
  padding: 12px;
  border-radius: 9px;
  margin-top: 14px;
}
.counts {
  display: flex;
  gap: 24px;
  flex-wrap: wrap;
  margin: 16px 0;
}
.counts strong {
  font-size: 22px;
  display: block;
}
.counts small {
  color: var(--muted);
}
.filezone {
  background: #f7f9f4;
  border: 1px dashed #b9c8b6;
  border-radius: 10px;
  padding: 18px;
}
.tabbtn {
  background: #f4f6f0;
}
.tabs .active {
  background: #e8eee1;
  border-color: #acc19e;
}
details {
  margin: 14px 0;
}
summary {
  cursor: pointer;
  font-weight: 600;
}
code {
  background: #eef3eb;
  border-radius: 4px;
  padding: 2px 5px;
}
#connection {
  display: inline-block;
  width: 7px;
  height: 7px;
  background: #86bd88;
  border-radius: 50%;
  margin-right: 4px;
}
@media (max-width: 1000px) {
  aside {
    width: 175px;
    padding: 24px 14px;
  }
  main {
    margin-left: 175px;
    width: calc(100% - 175px);
    padding: 24px 20px;
  }
  .filters select {
    max-width: 160px;
  }
}
@media (max-width: 700px) {
  .layout {
    display: block;
  }
  aside {
    position: static;
    width: auto;
    padding: 16px;
  }
  aside p,
  aside footer {
    display: none;
  }
  aside p.app-version {
    display: block;
    margin-bottom: 12px;
  }
  nav {
    display: flex;
    flex-wrap: wrap;
    margin-top: 12px;
  }
  nav button {
    padding: 8px;
  }
  main {
    margin: 0;
    width: 100%;
    padding: 22px 14px;
  }
  .stats {
    gap: 8px;
  }
  .stat {
    padding: 12px;
  }
  .stat strong {
    font-size: 23px;
  }
  .card {
    padding: 16px;
  }
  .tablewrap {
    margin-left: -16px;
    margin-right: -16px;
  }
  .formgrid {
    grid-template-columns: 1fr;
  }
  .top {
    align-items: flex-start;
  }
  h1 {
    font-size: 23px;
  }
  .filters select {
    max-width: 100%;
  }
}

[data-css="layout-1"] {
  margin-bottom: 14px;
}
[data-css="layout-2"] {
  margin-top: 14px;
}
[data-css="layout-3"] {
  margin-top: 18px;
}
[data-css="layout-4"] {
  margin-top: 20px;
}
[data-css="layout-5"] {
  margin-top: 25px;
}
.actions-cell {
  min-width: 160px;
}
.record-actions {
  gap: 5px;
  margin-top: 8px;
}
.save-feedback {
  display: grid;
  gap: 5px;
  margin-top: 18px;
  font-size: 13px;
}
#savestatus[data-state="saving"],
#savestatus[data-state="pending"] {
  color: #87633f;
}
#savestatus[data-state="saved"] {
  color: #305d49;
}
#savestatus[data-state="error"],
#savestatus[data-state="conflict"] {
  color: #ae3d2c;
}
#editerror:empty {
  display: none;
}
#editconflict p {
  color: inherit;
  margin: 8px 0;
}
#loginDialog {
  width: min(420px, calc(100vw - 32px));
  padding: 36px;
}
#loginDialog::backdrop {
  background: #233c31ed;
  backdrop-filter: blur(8px);
}
.login-icon {
  display: inline-grid;
  place-items: center;
  width: 46px;
  height: 46px;
  background: #eff3ed;
  border-radius: 12px;
  font-size: 27px;
  color: var(--green);
  margin-bottom: 18px;
}
.login-button {
  width: 100%;
  margin-top: 8px;
}
.login-note {
  margin: 20px 0 0;
  text-align: center;
}
#loginError {
  min-height: 22px;
  margin: 10px 0 0;
}
.noscript {
  position: fixed;
  inset: 0;
  background: var(--bg);
  padding: 40px;
  z-index: 100;
}
.connection-offline {
  background: #bf755c !important;
}
#editform .foot {
  gap: 8px;
}
#editform .foot .subtle {
  margin-right: auto;
}
.auth-locked #app {
  visibility: hidden;
}
.auth-locked #editor {
  visibility: hidden;
}
#editor {
  max-height: 90vh;
  overflow-y: auto;
}
#cloudStatus[data-state="offline"] {
  background: #fff0e8;
  color: #a84726;
}
