:root {
  color-scheme: light;
  --page: #f4f4f2;
  --panel: rgba(255, 255, 255, 0.84);
  --text: #171717;
  --muted: #6f6f6f;
  --line: #dededb;
  --strong: #1c1c1c;
  --danger: #9d2c24;
  --success: #28683c;
  --radius: 10px;
  --shadow: 0 24px 70px rgba(15, 15, 15, 0.08);
  --width: 1160px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  color: var(--text);
  background: linear-gradient(180deg, #fff 0, var(--page) 100%);
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; }
button, input, textarea { font: inherit; }

.admin-header {
  position: sticky;
  top: 0;
  z-index: 10;
  border-bottom: 1px solid rgba(255, 255, 255, 0.72);
  background: rgba(255, 255, 255, 0.76);
  backdrop-filter: blur(22px) saturate(1.3);
  -webkit-backdrop-filter: blur(22px) saturate(1.3);
}

.admin-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: min(100% - 32px, var(--width));
  min-height: 70px;
  margin: 0 auto;
  gap: 20px;
}

.admin-brand { font-weight: 700; text-decoration: none; }
.admin-brand span { color: var(--muted); font-weight: 500; }
.nav-actions { display: flex; align-items: center; gap: 10px; }

.admin-main {
  width: min(100% - 32px, var(--width));
  min-height: calc(100vh - 70px);
  margin: 0 auto;
  padding: 54px 0 90px;
}

.login-main { display: grid; place-items: center; }
.login-card { width: min(100%, 440px); }

h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 12px; font-size: clamp(2rem, 6vw, 4rem); line-height: 1; letter-spacing: -0.035em; }
h2 { margin-bottom: 18px; font-size: clamp(1.35rem, 3vw, 2rem); line-height: 1.15; }
h3 { margin-bottom: 8px; font-size: 1.12rem; }
.intro { max-width: 720px; margin-bottom: 34px; color: var(--muted); }

.panel {
  padding: clamp(22px, 4vw, 38px);
  border: 1px solid rgba(255, 255, 255, 0.8);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
}

.dashboard-grid { display: grid; gap: 28px; }
.book-list { display: grid; gap: 14px; margin-top: 24px; }

.book-row {
  display: grid;
  grid-template-columns: 66px minmax(0, 1fr) auto;
  gap: 18px;
  align-items: center;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.62);
}

.book-cover {
  width: 66px;
  aspect-ratio: 938 / 1500;
  border-radius: 5px;
  object-fit: cover;
  background: #e8e8e5;
}

.book-meta p { margin: 0; color: var(--muted); font-size: 0.88rem; }
.row-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; }

.field-grid { display: grid; gap: 20px; }
.two-columns { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.field { display: grid; gap: 8px; }
.field > span, .field legend { font-size: 0.9rem; font-weight: 680; }
.hint { color: var(--muted); font-size: 0.8rem; font-weight: 450; }

input[type="text"],
input[type="url"],
input[type="password"],
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.88);
  color: var(--text);
  outline: none;
  transition: border-color 160ms ease, box-shadow 160ms ease;
}

input[type="text"], input[type="url"], input[type="password"] { min-height: 46px; padding: 0 13px; }
textarea { min-height: 230px; padding: 12px 13px; resize: vertical; }

input:focus, textarea:focus {
  border-color: #90908c;
  box-shadow: 0 0 0 3px rgba(23, 23, 23, 0.08);
}

input[type="file"] { max-width: 100%; color: var(--muted); }

.toggle {
  display: flex;
  align-items: flex-start;
  gap: 11px;
  padding: 15px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.54);
}

.toggle input { width: 20px; height: 20px; margin: 2px 0 0; accent-color: var(--strong); }
.toggle strong, .toggle small { display: block; }
.toggle small { margin-top: 3px; color: var(--muted); }

.button {
  display: inline-flex;
  min-height: 42px;
  padding: 0 16px;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--strong);
  border-radius: 7px;
  background: var(--strong);
  color: #fff;
  font-weight: 650;
  text-decoration: none;
  cursor: pointer;
}

.button-secondary { border-color: var(--line); background: rgba(255, 255, 255, 0.72); color: var(--text); }
.button-danger { border-color: rgba(157, 44, 36, 0.25); background: transparent; color: var(--danger); }
.button-small { min-height: 34px; padding: 0 11px; font-size: 0.84rem; }
.button:hover, .button:focus-visible { transform: translateY(-1px); }

.form-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 28px; }
.inline-form { display: inline-flex; margin: 0; }
.section-divider { height: 1px; margin: 34px 0; border: 0; background: var(--line); }

.flash {
  margin-bottom: 24px;
  padding: 13px 16px;
  border-radius: 7px;
  font-weight: 600;
}

.flash-success { background: rgba(40, 104, 60, 0.1); color: var(--success); }
.flash-error { background: rgba(157, 44, 36, 0.1); color: var(--danger); }

.current-cover { display: flex; align-items: center; gap: 14px; color: var(--muted); font-size: 0.86rem; }
.current-cover img { width: 64px; aspect-ratio: 938 / 1500; border-radius: 4px; object-fit: cover; }
.fixed-label { margin: 0; color: var(--muted); }
.security-panel { max-width: 720px; }

@media (min-width: 900px) {
  .dashboard-grid { grid-template-columns: minmax(0, 1.35fr) minmax(300px, 0.65fr); align-items: start; }
  .sticky-panel { position: sticky; top: 98px; }
}

@media (max-width: 720px) {
  .two-columns { grid-template-columns: 1fr; }
  .book-row { grid-template-columns: 52px minmax(0, 1fr); }
  .book-cover { width: 52px; }
  .row-actions { grid-column: 1 / -1; justify-content: flex-start; }
  .admin-brand span { display: none; }
}
