:root {
  --ink: #101923;
  --paper: #f3efe6;
  --surface: #fbf8f1;
  --line: #d3ccbf;
  --muted: #70736f;
  --blue: #1e4d66;
  --red: #b9412d;
  --lime: #d7df86;
  --white: #fffdf8;
  --serif: "Songti SC", "Noto Serif SC", "Source Han Serif SC", "STSong",
    "SimSun", Georgia, serif;
  --sans: "Aptos", "Segoe UI", "Microsoft YaHei", "PingFang SC", sans-serif;
  --mono: "Cascadia Mono", "SFMono-Regular", Consolas, monospace;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  min-width: 320px;
  color: var(--ink);
  background: var(--paper);
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
}

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

a {
  color: inherit;
  text-decoration: none;
}

:focus-visible {
  outline: 2px solid var(--red);
  outline-offset: 3px;
}

.admin-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  min-height: 68px;
  padding: 0 28px;
  color: var(--white);
  background: var(--ink);
}

.admin-brand {
  display: inline-flex;
  gap: 12px;
  align-items: center;
}

.admin-brand strong {
  font-family: var(--serif);
  font-size: 1.25rem;
  font-weight: 600;
}

.admin-brand small {
  color: #87a2ac;
  font-family: var(--mono);
  font-size: 0.53rem;
  letter-spacing: 0.08em;
}

.admin-logo {
  display: grid;
  gap: 3px;
  width: 28px;
}

.admin-logo span {
  display: block;
  height: 2.5px;
  background: var(--white);
}

.admin-logo span:nth-child(2) {
  width: 72%;
}

.admin-header-actions {
  display: flex;
  gap: 20px;
  align-items: center;
  font-size: 0.7rem;
}

.admin-header-actions a {
  color: #b6c0c1;
}

.admin-header-actions button {
  padding: 4px 0;
  color: var(--lime);
  border: 0;
  border-bottom: 1px solid currentColor;
  background: transparent;
  cursor: pointer;
}

.admin-login {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(340px, 0.55fr);
  gap: clamp(40px, 8vw, 120px);
  align-items: center;
  width: min(1180px, calc(100% - 44px));
  min-height: calc(100svh - 68px);
  margin: 0 auto;
}

.admin-login-copy > p,
.admin-dashboard-head p,
.recent-head span {
  color: var(--red);
  font-family: var(--mono);
  font-size: 0.58rem;
  letter-spacing: 0.08em;
}

.admin-login-copy h1,
.admin-dashboard-head h1 {
  margin: 18px 0 0;
  font-family: var(--serif);
  font-size: clamp(4rem, 7vw, 7rem);
  font-weight: 500;
  letter-spacing: -0.06em;
  line-height: 0.95;
}

.admin-login-copy > span {
  display: block;
  margin-top: 26px;
  color: var(--muted);
  font-size: 0.86rem;
}

.admin-login-form {
  display: grid;
  gap: 10px;
  padding: 28px;
  background: var(--surface);
  border: 1px solid var(--line);
}

.admin-login-form label,
.form-field label {
  color: var(--ink);
  font-size: 0.7rem;
  font-weight: 650;
}

.admin-login-form input,
.book-form input,
.book-form select,
.book-form textarea {
  width: 100%;
  min-height: 48px;
  padding: 11px 13px;
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 0;
  outline: 0;
  background: var(--white);
}

.book-form textarea {
  resize: vertical;
}

.admin-login-form button,
.form-actions button {
  min-height: 50px;
  margin-top: 12px;
  color: var(--white);
  border: 0;
  background: var(--ink);
  cursor: pointer;
  font-weight: 700;
}

.admin-login-form button:hover,
.form-actions button:hover {
  background: var(--red);
}

.admin-login-form button:disabled,
.form-actions button:disabled {
  cursor: wait;
  opacity: 0.5;
}

#admin-status,
#book-status {
  min-height: 20px;
  margin: 4px 0 0;
  color: var(--red);
  font-size: 0.72rem;
}

.admin-dashboard {
  width: min(1350px, calc(100% - 44px));
  margin: 0 auto;
  padding: 64px 0 100px;
}

.admin-dashboard-head {
  display: flex;
  justify-content: space-between;
  align-items: end;
  padding-bottom: 28px;
  border-bottom: 1px solid var(--line);
}

.admin-dashboard-head h1 {
  font-size: clamp(3.2rem, 5.5vw, 5.5rem);
}

.admin-dashboard-head > p {
  max-width: 400px;
  color: var(--muted);
  font-family: var(--sans);
  font-size: 0.8rem;
  letter-spacing: 0;
  line-height: 1.75;
}

.admin-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 330px;
  gap: 38px;
  margin-top: 38px;
}

.book-form {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
  align-self: start;
  padding: 26px;
  background: var(--surface);
  border: 1px solid var(--line);
}

.form-field {
  display: grid;
  gap: 7px;
}

.span-2 {
  grid-column: 1 / -1;
}

.cover-preview {
  display: grid;
  place-items: center;
  width: 132px;
  height: 188px;
  overflow: hidden;
  color: #99988f;
  border: 1px dashed var(--line);
  background: var(--paper);
  font-family: var(--mono);
  font-size: 0.54rem;
}

.cover-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.form-actions {
  display: grid;
  grid-template-columns: 180px 1fr;
  gap: 18px;
  align-items: center;
}

.form-actions button {
  margin-top: 0;
}

.admin-recent {
  align-self: start;
  border-top: 1px solid var(--ink);
}

.recent-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 0;
}

.recent-head h2 {
  margin: 0;
  font-family: var(--serif);
  font-size: 1.35rem;
}

.admin-book-item {
  display: grid;
  grid-template-columns: 46px minmax(0, 1fr);
  gap: 12px;
  padding: 13px 0;
  border-top: 1px solid var(--line);
}

.admin-book-cover {
  display: grid;
  place-items: center;
  width: 46px;
  height: 66px;
  overflow: hidden;
  color: var(--white);
  background: var(--blue);
  font-family: var(--serif);
  font-size: 0.8rem;
}

.admin-book-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.admin-book-item h3 {
  overflow: hidden;
  margin: 0;
  font-family: var(--serif);
  font-size: 0.9rem;
  font-weight: 600;
  line-height: 1.4;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.admin-book-item p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 0.62rem;
  line-height: 1.55;
}

@media (max-width: 900px) {
  .admin-login {
    grid-template-columns: 1fr;
    align-content: center;
    gap: 32px;
    padding: 60px 0;
  }

  .admin-layout {
    grid-template-columns: 1fr;
  }

  .admin-dashboard-head {
    align-items: flex-start;
    flex-direction: column;
    gap: 18px;
  }
}

@media (max-width: 620px) {
  .admin-header {
    padding: 0 16px;
  }

  .admin-brand small,
  .admin-header-actions a {
    display: none;
  }

  .admin-login,
  .admin-dashboard {
    width: calc(100% - 28px);
  }

  .admin-login-copy h1 {
    font-size: 3.5rem;
  }

  .book-form {
    grid-template-columns: 1fr;
    padding: 18px;
  }

  .span-2 {
    grid-column: auto;
  }

  .form-actions {
    grid-template-columns: 1fr;
  }
}
