:root {
  font-family:
    Inter,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    "PingFang SC",
    "Microsoft YaHei",
    sans-serif;
  color-scheme: light;
  --bg: #f8f9fb;
  --surface: #fff;
  --text: #202833;
  --muted: #596574;
  --line: #e3e7ed;
  --accent: #176b54;
  --soft: #e6f2ec;
  --hover: #f0f3f6;
  --danger: #b52a3b;
  --shadow: 0 16px 60px #16263220;
  font-size: 15px;
  line-height: 1.6;
}
html[data-theme="dark"] {
  color-scheme: dark;
  --bg: #12171d;
  --surface: #191f27;
  --text: #edf1f6;
  --muted: #a7b1bf;
  --line: #303945;
  --accent: #83d7b5;
  --soft: #213b33;
  --hover: #252f3a;
  --danger: #ff9fac;
  --shadow: 0 16px 60px #0006;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
}
a {
  color: inherit;
  text-decoration: none;
}
button,
input,
textarea,
select {
  font: inherit;
}
button,
a,
input,
textarea,
select {
  -webkit-tap-highlight-color: transparent;
}
button {
  cursor: pointer;
}
button:disabled {
  opacity: 0.55;
  cursor: wait;
}
input,
textarea,
select {
  min-width: 0;
  max-width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  padding: 10px 12px;
}
input:not([type="checkbox"]):not([type="file"]),
textarea {
  width: 100%;
}
input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--accent);
}
input[type="file"] {
  width: 100%;
}
textarea {
  resize: vertical;
  min-height: 86px;
}
input:focus,
textarea:focus,
select:focus {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
button:focus-visible,
a:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 4px;
}
h1,
h2,
p {
  margin-top: 0;
}
h1 {
  font-size: clamp(26px, 3vw, 36px);
  line-height: 1.3;
  letter-spacing: -0.04em;
  margin-bottom: 12px;
  font-weight: 650;
}
h2 {
  font-size: 18px;
  line-height: 1.5;
  margin-bottom: 12px;
}
p {
  color: var(--muted);
}
[hidden] {
  display: none !important;
}
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
.skip {
  position: fixed;
  top: -80px;
  left: 20px;
  z-index: 30;
  background: var(--surface);
  padding: 12px;
}
.skip:focus {
  top: 12px;
}
.sidebar {
  width: 244px;
  position: fixed;
  inset: 0 auto 0 0;
  background: var(--surface);
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  padding: 30px 19px 20px;
  overflow: auto;
  z-index: 20;
}
.brand {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 0 10px 32px;
  font-size: 23px;
  font-weight: 700;
  line-height: 1.2;
}
.brand img {
  border-radius: 9px;
}
.brand small {
  display: block;
  font-size: 12px;
  letter-spacing: 0.02em;
  font-weight: 400;
  color: var(--muted);
  margin-top: 6px;
}
.nav-caption {
  font-size: 12px;
  margin: 27px 12px 10px;
}
.nav-link {
  display: flex;
  align-items: center;
  gap: 10px;
  justify-content: space-between;
  padding: 11px 13px;
  border-radius: 7px;
  margin: 3px 0;
  font-size: 14px;
}
.nav-link span {
  font-size: 12px;
  color: var(--muted);
}
.nav-link:hover {
  background: var(--hover);
}
.nav-link.active {
  background: var(--soft);
  color: var(--accent);
  font-weight: 600;
}
.nav-link.depth-1 {
  padding-left: 26px;
}
.nav-link.depth-2 {
  padding-left: 39px;
}
.nav-link.depth-3 {
  padding-left: 48px;
}
.sidebar-foot {
  margin-top: auto;
  padding: 35px 12px 0;
  color: var(--muted);
  font-size: 12px;
  display: grid;
  gap: 12px;
}
.sidebar-foot img {
  max-width: 100px;
  min-height: 18px;
}
.page {
  margin-left: 244px;
}
.topbar {
  height: 81px;
  display: flex;
  align-items: center;
  gap: 15px;
  justify-content: space-between;
  padding: 0 40px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}
.breadcrumb {
  font-size: 13px;
  color: var(--muted);
}
.breadcrumb span {
  padding: 0 12px;
  color: var(--line);
}
.actions {
  display: flex;
  gap: 10px;
  align-items: center;
}
.button,
.icon-button {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text);
  border-radius: 7px;
  padding: 9px 15px;
  font-size: 14px;
  line-height: 1.5;
  white-space: nowrap;
}
.button:hover,
.icon-button:hover {
  background: var(--hover);
}
.button.primary {
  background: var(--accent);
  color: var(--surface);
  border-color: var(--accent);
  font-weight: 600;
}
html[data-theme="dark"] .button.primary {
  color: #10241c;
}
.button.danger {
  color: var(--danger);
}
.icon-button {
  padding: 7px 12px;
  font-size: 20px;
}
.mobile-menu {
  display: none;
}
main {
  max-width: 1500px;
  padding: 44px 40px 24px;
  margin: auto;
}
.intro {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  align-items: center;
  margin-bottom: 26px;
}
.intro p {
  margin-bottom: 0;
}
.total {
  color: var(--muted);
  white-space: nowrap;
  font-size: 13px;
}
.total strong {
  font-size: 32px;
  color: var(--text);
  margin-right: 5px;
  font-weight: 500;
}
.search {
  display: flex;
  gap: 10px;
  padding: 10px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
}
.search input {
  border: 0;
  padding: 7px 12px;
  background: transparent;
}
.search input:focus {
  outline-offset: 0;
}
.meta {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: var(--muted);
  margin: 22px 0 30px;
}
.section-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin: 0 0 13px;
  gap: 12px;
}
.section-head h2 {
  margin: 0;
}
.section-head h2 span {
  font-size: 12px;
  color: var(--muted);
  margin-left: 6px;
  font-weight: 400;
}
.section-head > a,
.section-head > span {
  font-size: 12px;
  color: var(--muted);
}
.collection {
  margin-bottom: 32px;
}
.resource-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}
.resource {
  position: relative;
  display: flex;
  align-items: center;
  gap: 13px;
  padding: 20px 17px;
  min-height: 95px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 9px;
  transition:
    border-color 0.15s,
    background 0.15s;
}
.resource:hover {
  border-color: var(--accent);
  background: var(--hover);
}
.monogram {
  width: 32px;
  height: 32px;
  flex: none;
  background: var(--soft);
  color: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 7px;
  font-size: 15px;
  font-weight: 600;
}
.favicon {
  position: absolute;
  left: 17px;
  background: var(--surface);
  border-radius: 7px;
  object-fit: contain;
}
.resource-copy {
  display: block;
  min-width: 0;
  flex: 1;
}
.resource-copy strong {
  display: block;
  font-size: 14px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-weight: 600;
}
.resource-copy small {
  display: block;
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 5px;
}
.arrow {
  color: var(--muted);
  font-size: 13px;
}
.private {
  font-size: 11px;
  font-weight: 400;
  color: var(--muted);
  margin-left: 6px;
}
.empty {
  text-align: center;
  padding: 60px 20px;
  border: 1px dashed var(--line);
  border-radius: 9px;
  background: var(--surface);
}
footer {
  border-top: 1px solid var(--line);
  padding: 24px 0 10px;
  margin-top: 44px;
  display: flex;
  justify-content: space-between;
  color: var(--muted);
  font-size: 12px;
}
.theme-label select {
  font-size: 12px;
  padding: 8px;
  max-width: 110px;
}
.login-wrap {
  min-height: 100svh;
  display: grid;
  place-items: center;
  padding: 24px;
}
.login-box {
  width: 100%;
  max-width: 440px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 40px;
}
.login-box .brand {
  padding-left: 0;
  margin-bottom: 10px;
}
.login-box h1 {
  font-size: 29px;
}
.login-box form {
  margin-top: 26px;
}
.login-box label {
  font-size: 14px;
  display: block;
  margin-bottom: 8px;
}
.login-box form > .button {
  width: 100%;
}
.login-bottom {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 24px;
  font-size: 13px;
  color: var(--muted);
}
.form-error {
  color: var(--danger);
  font-size: 13px;
  margin: 10px 0;
  min-height: 0;
  white-space: pre-wrap;
}
.form-error:empty {
  display: none;
}
.filters {
  display: flex;
  gap: 9px;
  margin: 10px 0 22px;
  flex-wrap: wrap;
}
.filters input {
  flex: 1;
  min-width: 140px;
  width: auto !important;
}
.filters select {
  max-width: 200px;
}
.table-wrap {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  overflow: auto;
}
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
  text-align: left;
}
th {
  font-weight: 500;
  font-size: 12px;
  color: var(--muted);
  background: var(--hover);
  white-space: nowrap;
}
td,
th {
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
}
tr:last-child td {
  border-bottom: 0;
}
td.title-cell {
  min-width: 190px;
  max-width: 340px;
}
td small {
  display: block;
  color: var(--muted);
  font-size: 12px;
  max-width: 320px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  margin-top: 4px;
}
.row-actions {
  display: flex;
  gap: 6px;
}
.row-actions button {
  padding: 6px 10px;
  font-size: 12px;
}
.badge {
  font-size: 12px;
  color: var(--accent);
  background: var(--soft);
  padding: 3px 7px;
  border-radius: 4px;
  white-space: nowrap;
}
.badge.private {
  color: var(--muted);
  background: var(--hover);
  margin: 0;
}
.pagination {
  display: flex;
  gap: 14px;
  align-items: center;
  justify-content: flex-end;
  color: var(--muted);
  font-size: 13px;
  padding: 24px 0;
}
.data-block {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 26px;
  margin-bottom: 22px;
  max-width: 780px;
}
.data-block label {
  display: block;
  margin: 16px 0 8px;
  font-size: 14px;
}
.data-block p {
  font-size: 14px;
  max-width: 640px;
}
#import-preview {
  margin: 14px 0;
  color: var(--muted);
  font-size: 14px;
}
dialog {
  width: min(560px, calc(100% - 24px));
  max-height: 90svh;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
  color: var(--text);
  padding: 26px;
  box-shadow: var(--shadow);
}
dialog::backdrop {
  background: #11182766;
}
.dialog-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}
.dialog-head h2 {
  margin: 0;
  font-size: 21px;
}
.dialog-head .icon-button {
  border: 0;
}
.field {
  display: block;
  margin-bottom: 17px;
  font-size: 14px;
}
.field > span {
  display: block;
  margin-bottom: 7px;
}
.field small {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-top: 5px;
}
.field select {
  width: 100%;
}
.field.check {
  display: flex;
  gap: 9px;
  align-items: center;
}
.field.check span {
  margin: 0;
}
.field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 15px;
}
.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 22px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}
#toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 100;
  background: var(--text);
  color: var(--surface);
  padding: 12px 20px;
  border-radius: 9px;
  box-shadow: var(--shadow);
  max-width: calc(100% - 32px);
  font-size: 14px;
}
#toast:empty {
  display: none;
}
@media (min-width: 1600px) {
  .resource-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}
@media (max-width: 1150px) {
  .resource-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .sidebar {
    width: 215px;
  }
  .page {
    margin-left: 215px;
  }
  .topbar {
    padding: 0 26px;
  }
  main {
    padding: 34px 26px;
  }
}
@media (max-width: 760px) {
  .sidebar {
    transform: translateX(-100%);
    width: 244px;
    box-shadow: var(--shadow);
  }
  .menu-open .sidebar {
    transform: translateX(0);
  }
  .page {
    margin-left: 0;
  }
  .mobile-menu {
    display: inline-flex;
  }
  .topbar {
    height: 70px;
    padding: 0 18px;
    gap: 10px;
  }
  .breadcrumb {
    flex: 1;
    font-size: 12px;
  }
  .breadcrumb > span {
    display: none;
  }
  .actions {
    gap: 7px;
  }
  .topbar .button {
    font-size: 12px;
    padding: 8px 10px;
  }
  .theme-label select {
    max-width: 84px;
    font-size: 11px;
  }
  main {
    padding: 29px 18px 20px;
  }
  .intro {
    align-items: flex-start;
    gap: 12px;
  }
  .intro .button {
    font-size: 12px;
    padding: 8px 11px;
  }
  .intro p {
    font-size: 13px;
  }
  .total {
    display: none;
  }
  .resource-grid {
    gap: 10px;
  }
  .resource {
    padding: 17px 13px;
    gap: 10px;
    min-height: 86px;
  }
  .resource-copy strong {
    font-size: 13px;
  }
  .resource-copy small {
    font-size: 11px;
  }
  .monogram {
    width: 29px;
    height: 29px;
  }
  .favicon {
    left: 13px;
    width: 29px;
    height: 29px;
  }
  .arrow {
    display: none;
  }
  .meta {
    font-size: 11px;
  }
  .meta span {
    display: none;
  }
  .section-head h2 {
    font-size: 16px;
  }
  .filters input {
    flex-basis: 100%;
  }
  .filters select {
    flex: 1;
    max-width: none;
    width: 25%;
  }
  .filters .button {
    padding: 8px 12px;
  }
  .table-wrap {
    margin-right: 0;
  }
  td,
  th {
    padding: 13px 12px;
  }
  .login-box {
    padding: 30px 24px;
  }
  .login-wrap {
    padding: 18px;
  }
  .data-block {
    padding: 21px;
  }
  dialog {
    padding: 21px;
  }
  .pagination {
    flex-wrap: wrap;
    font-size: 12px;
  }
  .field-row {
    gap: 10px;
  }
  .resource-copy strong .private {
    display: none;
  }
}
@media (max-width: 390px) {
  .resource-grid {
    grid-template-columns: minmax(0, 1fr);
  }
  .breadcrumb {
    display: none;
  }
  .topbar .actions {
    margin-left: auto;
  }
  .resource-copy strong {
    font-size: 14px;
  }
}
@media (prefers-reduced-motion: reduce) {
  * {
    transition: none !important;
    scroll-behavior: auto !important;
  }
}

@media (max-width: 760px) {
  .resource-copy small {
    font-size: 12px;
  }
  .theme-label select,
  .meta {
    font-size: 12px;
  }
}

/* Keep reading and management controls within the viewport, including long labels. */
.page,
main,
main > section,
.intro > div,
.resource-grid,
.resource {
  min-width: 0;
}
main {
  padding-top: 32px;
}
.intro {
  margin-bottom: 22px;
}
.meta {
  margin: 16px 0 22px;
}
.resource {
  min-height: 82px;
  padding-top: 15px;
  padding-bottom: 15px;
}
.collection {
  margin-bottom: 28px;
}
.close-menu {
  margin: -12px 10px 14px;
}
th:first-child {
  width: 42%;
}
td.title-cell {
  overflow: hidden;
}
td.title-cell strong {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
@media (max-width: 760px) {
  main {
    padding-top: 24px;
  }
  .intro {
    margin-bottom: 20px;
  }
  .meta {
    margin: 14px 0 22px;
  }
  .resource {
    min-height: 78px;
    padding-top: 13px;
    padding-bottom: 13px;
  }
  .table-wrap {
    overflow: visible;
  }
  .table-wrap table,
  .table-wrap tbody {
    display: block;
    width: 100%;
  }
  .table-wrap thead {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
  }
  .table-wrap tr {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 7px 12px;
    padding: 15px;
    border-bottom: 1px solid var(--line);
  }
  .table-wrap tr:last-child {
    border-bottom: 0;
  }
  .table-wrap td {
    display: block;
    padding: 0;
    border: 0;
    min-width: 0;
  }
  .table-wrap td.title-cell {
    grid-column: 1/-1;
    max-width: none;
    min-width: 0;
  }
  .table-wrap td small {
    max-width: 100%;
  }
  .table-wrap td[data-label] {
    font-size: 12px;
    color: var(--muted);
  }
  .table-wrap td[data-label]::before {
    content: attr(data-label) "：";
  }
  .table-wrap td:last-child {
    grid-column: 1/-1;
  }
  .row-actions {
    justify-content: flex-end;
  }
  .row-actions button {
    padding: 9px 14px;
    font-size: 13px;
    min-height: 40px;
  }
}
