:root {
  color-scheme: light;
  --bg: #f5f5f7;
  --ink: #1d1d1f;
  --muted: #6e6e73;
  --line: rgba(0, 0, 0, 0.12);
  --line-soft: rgba(0, 0, 0, 0.06);
  --accent: #0066cc;
  --accent-strong: #004f9f;
  --accent2: #bf4800;
  --panel: #ffffff;
  --panel-soft: #fbfbfd;
  --reader-paper: #fffdf8;
  --reader-width: 760px;
  --reader-font-size: 20px;
  --reader-line-height: 1.8;
  --radius: 18px;
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.08);
}

html[data-theme="dark"] {
  color-scheme: dark;
  --bg: #000000;
  --ink: #f5f5f7;
  --muted: #a1a1a6;
  --line: rgba(255, 255, 255, 0.18);
  --line-soft: rgba(255, 255, 255, 0.08);
  --accent: #2997ff;
  --accent-strong: #66b7ff;
  --accent2: #ff9f0a;
  --panel: #1c1c1e;
  --panel-soft: #111113;
  --reader-paper: #111113;
  --shadow: 0 22px 60px rgba(0, 0, 0, 0.34);
}

html[data-reader-paper="warm"] {
  --reader-paper: #fbf3e4;
}

html[data-theme="dark"][data-reader-paper="warm"] {
  --reader-paper: #1f1a14;
}

* {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.5 -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", sans-serif;
  letter-spacing: 0;
  min-width: 320px;
}

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

img,
svg {
  max-width: 100%;
}

main {
  min-height: calc(100vh - 138px);
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  border-bottom: 1px solid var(--line-soft);
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  backdrop-filter: saturate(180%) blur(20px);
}

.globalbar,
.localbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 28px;
}

.globalbar {
  min-height: 44px;
  background: rgba(0, 0, 0, 0.86);
  color: rgba(255, 255, 255, 0.86);
  max-width: none;
  flex-wrap: wrap;
}

.localbar {
  min-height: 52px;
}

.localbar span {
  overflow: hidden;
  color: var(--ink);
  font-weight: 700;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.localbar a,
.utility-nav a,
.desktop-nav a {
  color: inherit;
  font-size: 13px;
}

.localbar a {
  color: var(--accent);
  font-weight: 600;
}

.brand {
  color: #fff;
  font-size: 17px;
  font-weight: 700;
  letter-spacing: 0;
}

.desktop-nav,
.utility-nav {
  display: flex;
  align-items: center;
  gap: 14px;
}

.desktop-nav {
  flex: 1;
  justify-content: center;
  min-width: 180px;
}

.utility-nav {
  justify-content: flex-end;
  flex-wrap: wrap;
  min-width: 0;
}

.desktop-nav a,
.utility-nav a,
.link-button {
  opacity: 0.82;
}

.desktop-nav a:hover,
.utility-nav a:hover,
.link-button:hover,
.desktop-nav a[aria-current="page"],
.utility-nav a[aria-current="page"] {
  opacity: 1;
}

.inline {
  display: inline;
}

.language-switch {
  display: inline-flex;
  flex: 0 0 auto;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 999px;
}

.language-switch a {
  min-width: 34px;
  padding: 3px 8px;
  text-align: center;
  font-size: 11px;
  font-weight: 800;
  opacity: 1;
}

.language-switch a[aria-current="true"] {
  background: rgba(255, 255, 255, 0.18);
  color: #fff;
}

button,
.button,
input[type="submit"] {
  min-height: 44px;
  border: 0;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  padding: 11px 18px;
  font: inherit;
  font-weight: 700;
  line-height: 1.2;
  cursor: pointer;
  white-space: nowrap;
}

.button.secondary,
button.secondary {
  background: color-mix(in srgb, var(--ink) 8%, var(--panel));
  color: var(--accent);
  border: 1px solid var(--line-soft);
}

.button.danger,
button.danger {
  background: #d70015;
}

.button.small,
button.small {
  min-height: 30px;
  padding: 6px 12px;
  font-size: 12px;
}

.link-button {
  min-height: 0;
  border-radius: 0;
  background: transparent;
  color: inherit;
  padding: 0;
  font-size: 13px;
  font-weight: 400;
}

.section {
  max-width: 1180px;
  margin: 0 auto;
  padding: 32px 28px;
}

.home-hero {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(320px, 0.85fr);
  gap: 34px;
  align-items: center;
  padding-top: 54px;
}

.hero-copy h1,
.section h1 {
  margin: 0;
  max-width: 760px;
  font-size: clamp(38px, 6vw, 72px);
  font-weight: 800;
  line-height: 1.03;
}

.hero-copy p {
  max-width: 640px;
  color: var(--muted);
  font-size: 21px;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--accent2);
  font-size: 13px;
  font-weight: 800;
}

.panel,
.continue-card,
.form,
.paywall {
  background: var(--panel);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
}

.continue-card {
  display: grid;
  grid-template-columns: 116px minmax(0, 1fr);
  gap: 18px;
  align-items: center;
  padding: 18px;
  box-shadow: var(--shadow);
}

.continue-card strong {
  display: block;
  margin-bottom: 4px;
  font-size: 24px;
  line-height: 1.12;
}

.progress-track {
  display: block;
  height: 6px;
  margin-top: 18px;
  overflow: hidden;
  border-radius: 999px;
  background: color-mix(in srgb, var(--muted) 18%, transparent);
}

.progress-track i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--accent);
}

.metric-strip {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
}

.metric {
  padding: 18px;
}

.metric strong {
  display: block;
  font-size: 34px;
  line-height: 1;
}

.metric span {
  color: var(--muted);
  font-size: 14px;
}

.section-title {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 18px;
}

.section-title h1,
.section-title h2 {
  margin: 0;
}

.section-title h2 {
  font-size: 32px;
  line-height: 1.12;
}

.section-title a {
  color: var(--accent);
  font-weight: 600;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 24px;
}

.shelf {
  align-items: start;
}

.card {
  min-width: 0;
}

.book-card a {
  display: block;
}

.cover {
  overflow: hidden;
  border-radius: 8px;
  background: #e5e5ea;
  box-shadow: 0 12px 26px rgba(0, 0, 0, 0.14);
  aspect-ratio: 2 / 3;
}

.cover svg {
  width: 100%;
  height: 100%;
  display: block;
}

.book-card .cover {
  transition: transform 160ms ease, box-shadow 160ms ease;
}

.book-card a:hover .cover {
  transform: translateY(-3px);
  box-shadow: 0 18px 34px rgba(0, 0, 0, 0.18);
}

.book-card .pad {
  padding: 12px 2px 0;
}

.book-card strong {
  display: -webkit-box;
  overflow: hidden;
  font-size: 15px;
  line-height: 1.22;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.meta {
  color: var(--muted);
  font-size: 14px;
}

.price {
  margin-top: 4px;
  color: var(--accent2);
  font-weight: 800;
}

.action-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.search-panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 210px auto;
  gap: 10px;
  margin: 18px 0;
}

input:not([type="checkbox"]):not([type="radio"]):not([type="submit"]),
textarea,
select {
  min-height: 44px;
  border: 1px solid var(--line-soft);
  border-radius: 14px;
  background: color-mix(in srgb, var(--ink) 4%, var(--panel));
  color: var(--ink);
  padding: 10px 13px;
  font: inherit;
}

input[type="checkbox"],
input[type="radio"] {
  width: 16px;
  height: 16px;
  margin: 0;
  accent-color: var(--accent);
}

.search-panel input {
  border-radius: 999px;
}

.category-strip {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  margin: 8px -28px 24px;
  padding: 0 28px 3px;
  scrollbar-width: none;
}

.category-strip::-webkit-scrollbar {
  display: none;
}

.category-strip a {
  flex: 0 0 auto;
  min-height: 34px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--ink) 6%, var(--panel));
  color: var(--muted);
  padding: 7px 13px;
  font-size: 14px;
  font-weight: 700;
}

.category-strip a.selected {
  background: var(--ink);
  color: var(--bg);
}

.novel-section {
  max-width: 1040px;
}

.novel-hero {
  display: grid;
  grid-template-columns: 240px minmax(0, 1fr);
  gap: 42px;
  align-items: center;
  padding: 28px 0 42px;
}

.novel-cover {
  width: 100%;
  border-radius: 10px;
}

.novel-copy h1 {
  margin: 0;
  max-width: 720px;
  font-size: clamp(34px, 5vw, 60px);
  line-height: 1.04;
}

.novel-copy p {
  max-width: 720px;
  color: var(--muted);
  font-size: 18px;
}

.novel-copy .byline {
  margin: 8px 0 18px;
  color: var(--ink);
  font-weight: 700;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  border: 1px solid color-mix(in srgb, var(--accent) 25%, var(--line));
  border-radius: 999px;
  background: color-mix(in srgb, var(--accent) 10%, var(--panel));
  color: var(--accent);
  padding: 10px 15px;
  font-weight: 800;
}

.unlocked-text {
  color: var(--accent);
  font-weight: 800;
}

.settings-list {
  overflow: hidden;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  background: var(--panel);
}

.chapter-list {
  display: grid;
  grid-template-columns: 1fr;
}

.chapter-list a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 58px;
  gap: 16px;
  border-bottom: 1px solid var(--line-soft);
  padding: 12px 18px;
}

.chapter-list a:last-child {
  border-bottom: 0;
}

.progress-list a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 64px;
  gap: 18px;
  border-bottom: 1px solid var(--line-soft);
  padding: 13px 18px;
}

.progress-list a:last-child {
  border-bottom: 0;
}

.progress-list strong {
  display: block;
}

.progress-empty {
  color: var(--muted);
  padding: 18px;
}

.chevron {
  color: var(--muted);
  font-size: 26px;
  line-height: 1;
}

.reader-active .topbar,
.reader-active footer,
.reader-active .mobile-tabbar {
  display: none;
}

.reader-active {
  background: var(--reader-paper);
}

.reader {
  max-width: calc(var(--reader-width) + 48px);
  margin: 0 auto;
  padding: 20px 24px 38px;
}

.reader-head {
  position: sticky;
  top: 0;
  z-index: 20;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 16px;
  align-items: center;
  min-height: 58px;
  margin: 0 -12px 18px;
  border-radius: 0 0 18px 18px;
  background: color-mix(in srgb, var(--reader-paper) 86%, transparent);
  padding: 8px 12px;
  -webkit-backdrop-filter: saturate(180%) blur(18px);
  backdrop-filter: saturate(180%) blur(18px);
}

.reader-head h1 {
  overflow: hidden;
  margin: 0;
  font-size: 17px;
  line-height: 1.18;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.reader-kicker {
  overflow: hidden;
  margin: 0 0 2px;
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.reader-back,
.icon-button,
.reader-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  border: 0;
  border-radius: 999px;
  background: color-mix(in srgb, var(--ink) 7%, transparent);
  color: var(--accent);
  padding: 8px 12px;
  font-size: 14px;
  font-weight: 700;
}

.icon-button {
  min-width: 44px;
  min-height: 44px;
  color: var(--ink);
}

.reader-count {
  margin: 0 0 18px;
  color: var(--muted);
  background: transparent;
}

.chapter-body {
  max-width: var(--reader-width);
  margin: 0 auto;
  color: var(--ink);
  font: var(--reader-font-size) / var(--reader-line-height) ui-serif, Georgia, "Times New Roman", serif;
}

.reader-bottom {
  max-width: var(--reader-width);
  margin: 28px auto 0;
}

.chapter-nav {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.reader-settings {
  position: fixed;
  inset: 0;
  z-index: 80;
  background: rgba(0, 0, 0, 0.18);
}

.reader-settings-sheet {
  position: fixed;
  right: max(16px, env(safe-area-inset-right));
  bottom: max(16px, env(safe-area-inset-bottom));
  left: max(16px, env(safe-area-inset-left));
  max-width: 560px;
  margin: 0 auto;
  border: 1px solid var(--line-soft);
  border-radius: 24px;
  background: color-mix(in srgb, var(--panel) 92%, transparent);
  padding: 10px 14px 14px;
  box-shadow: var(--shadow);
  -webkit-backdrop-filter: saturate(180%) blur(22px);
  backdrop-filter: saturate(180%) blur(22px);
}

.sheet-handle {
  width: 38px;
  height: 5px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--muted) 42%, transparent);
  margin: 0 auto 12px;
}

.reader-controls {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.control-button {
  min-width: 0;
  border: 1px solid var(--line-soft);
  background: color-mix(in srgb, var(--ink) 5%, var(--panel));
  color: var(--ink);
  padding: 9px 10px;
  font-size: 14px;
}

.control-button.ghost {
  color: var(--muted);
}

.form {
  max-width: 560px;
  margin: 34px auto;
  padding: 24px;
}

.form label {
  display: block;
  margin-top: 14px;
  font-weight: 700;
}

.form input,
.form textarea,
.form select {
  width: 100%;
  margin-top: 6px;
}

.auth-shell {
  display: grid;
  grid-template-columns: minmax(320px, 520px) minmax(280px, 380px);
  gap: 18px;
  align-items: start;
  justify-content: center;
}

.auth-form {
  width: 100%;
  margin: 0;
}

.credential-card {
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  background: var(--panel);
  margin: 0;
  padding: 22px;
}

.credential-card h2 {
  margin: 0 0 8px;
  font-size: 20px;
}

.credential-card dl {
  display: grid;
  gap: 14px;
  margin: 18px 0 0;
}

.credential-card dt {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.credential-card dd {
  display: grid;
  gap: 7px;
  margin: 6px 0 0;
}

.credential-card code {
  display: block;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  background: color-mix(in srgb, var(--ink) 5%, var(--panel));
  color: var(--ink);
  padding: 8px 10px;
  overflow-wrap: anywhere;
}

.table {
  width: 100%;
  overflow: hidden;
  border-collapse: separate;
  border-spacing: 0;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  background: var(--panel);
}

.table th,
.table td {
  border-bottom: 1px solid var(--line-soft);
  padding: 13px 14px;
  text-align: left;
  vertical-align: top;
}

.table tr:last-child td {
  border-bottom: 0;
}

.notice,
.paywall {
  padding: 16px;
  margin: 14px 0;
}

.notice {
  background: color-mix(in srgb, var(--accent) 10%, var(--panel));
}

.paywall {
  background: color-mix(in srgb, var(--accent2) 9%, var(--panel));
}

.admin-tabs {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}

.admin-tabs a {
  border: 1px solid var(--line-soft);
  border-radius: 999px;
  background: var(--panel);
  padding: 5px 10px;
  font-size: 13px;
  font-weight: 700;
}

.admin-tabs a[aria-current="page"] {
  background: var(--ink);
  color: var(--bg);
}

.admin-shell {
  display: grid;
  grid-template-columns: 176px minmax(0, 1fr);
  min-height: calc(100vh - 44px);
}

.admin-sidebar {
  position: sticky;
  top: 44px;
  align-self: start;
  height: calc(100vh - 44px);
  border-right: 1px solid var(--line-soft);
  background: color-mix(in srgb, var(--panel) 82%, var(--bg));
  padding: 16px 10px;
}

.admin-brand {
  display: block;
  margin-bottom: 12px;
  padding: 0 8px;
}

.admin-brand strong,
.admin-sidebar nav a strong {
  display: block;
}

.admin-brand span,
.admin-sidebar nav a span {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.25;
}

.admin-sidebar nav {
  display: grid;
  gap: 3px;
}

.admin-sidebar nav a {
  display: grid;
  align-content: center;
  min-height: 42px;
  border-radius: 8px;
  padding: 5px 8px;
}

.admin-sidebar nav a:hover,
.admin-sidebar nav a[aria-current="page"] {
  background: color-mix(in srgb, var(--accent) 10%, var(--panel));
  color: var(--accent);
}

.admin-main {
  min-width: 0;
  padding: 20px;
}

.admin-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 14px;
}

.admin-heading h1 {
  margin: 0;
  font-size: 28px;
  line-height: 1.12;
}

.admin-heading p {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.admin-alert {
  border: 1px solid color-mix(in srgb, var(--accent) 24%, var(--line));
  border-radius: 10px;
  background: color-mix(in srgb, var(--accent) 8%, var(--panel));
  color: var(--accent);
  margin-bottom: 10px;
  padding: 9px 11px;
  font-size: 13px;
  font-weight: 700;
}

.admin-kpis {
  display: grid;
  grid-template-columns: repeat(7, minmax(120px, 1fr));
  gap: 8px;
  margin-bottom: 12px;
}

.admin-kpi,
.admin-panel {
  border: 1px solid var(--line-soft);
  border-radius: 10px;
  background: var(--panel);
}

.admin-kpi {
  padding: 10px 11px;
}

.admin-kpi span,
.admin-kpi p {
  color: var(--muted);
  font-size: 12px;
}

.admin-kpi strong {
  display: block;
  margin: 5px 0 2px;
  font-size: 22px;
  line-height: 1;
}

.admin-kpi p {
  margin: 0;
}

.admin-panel {
  min-width: 0;
  margin-bottom: 12px;
  padding: 12px;
}

.admin-panel h2 {
  margin: 0 0 10px;
  font-size: 16px;
  line-height: 1.25;
}

.admin-grid-2 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.admin-todo {
  display: grid;
  gap: 7px;
}

.admin-todo a {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr);
  align-items: center;
  min-height: 46px;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  padding: 8px 10px;
}

.admin-todo strong {
  color: var(--accent);
  font-size: 21px;
}

.admin-todo span {
  color: var(--muted);
  font-size: 13px;
}

.admin-toolbar,
.admin-bulkbar,
.admin-actions,
.admin-inline-form {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}

.admin-toolbar {
  position: sticky;
  top: 44px;
  z-index: 20;
  border: 1px solid var(--line-soft);
  border-radius: 10px;
  background: color-mix(in srgb, var(--panel) 88%, transparent);
  padding: 8px;
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  backdrop-filter: saturate(180%) blur(20px);
}

.admin-toolbar input {
  min-width: 260px;
  flex: 1;
}

.admin-bulkbar {
  border: 1px solid var(--line-soft);
  border-radius: 10px;
  background: var(--panel);
  padding: 8px;
}

.admin-table-wrap {
  width: 100%;
  overflow: auto;
  border: 1px solid var(--line-soft);
  border-radius: 10px;
  background: var(--panel);
}

.admin-table {
  width: 100%;
  min-width: 860px;
  border-collapse: separate;
  border-spacing: 0;
}

.admin-table th,
.admin-table td {
  border-bottom: 1px solid var(--line-soft);
  padding: 8px 10px;
  text-align: left;
  vertical-align: top;
  font-size: 13px;
  line-height: 1.35;
}

.admin-table th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: color-mix(in srgb, var(--panel) 92%, var(--bg));
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.admin-table tr:last-child td {
  border-bottom: 0;
}

.admin-empty {
  color: var(--muted);
  padding: 16px;
  text-align: center;
}

.admin-link {
  color: var(--accent);
  font-weight: 700;
}

.admin-pill {
  display: inline-flex;
  align-items: center;
  min-height: 20px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--muted) 10%, var(--panel));
  color: var(--muted);
  padding: 2px 7px;
  font-size: 11px;
  font-weight: 800;
}

.admin-pill.paid,
.admin-pill.approved {
  background: color-mix(in srgb, #248a3d 12%, var(--panel));
  color: #248a3d;
}

.admin-pill.pending {
  background: color-mix(in srgb, var(--accent2) 12%, var(--panel));
  color: var(--accent2);
}

.admin-pill.failed,
.admin-pill.rejected,
.admin-pill.refunded,
.admin-pill.cancelled {
  background: color-mix(in srgb, #d70015 10%, var(--panel));
  color: #d70015;
}

.admin-detail-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}

.admin-form {
  display: grid;
  gap: 9px;
}

.admin-form label,
.admin-setting-row label {
  display: grid;
  gap: 4px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.admin-form textarea {
  min-height: 82px;
  resize: vertical;
}

.admin-task-form {
  border-top: 1px solid var(--line-soft);
  margin-top: 10px;
  padding-top: 10px;
}

.admin-cover-preview {
  display: grid;
  place-items: center;
  width: min(132px, 100%);
  aspect-ratio: 640 / 900;
  overflow: hidden;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  background: var(--panel-soft);
  padding: 6px;
}

.admin-cover-preview svg {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: 6px;
  object-fit: contain;
  box-shadow: 0 10px 26px rgba(0, 0, 0, 0.1);
}

.admin-dl {
  display: grid;
  grid-template-columns: 88px minmax(0, 1fr);
  gap: 6px 10px;
  margin: 8px 0;
}

.admin-dl dt {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.admin-dl dd {
  min-width: 0;
  margin: 0;
  overflow-wrap: anywhere;
}

.admin-setting-row {
  display: grid;
  grid-template-columns: minmax(150px, 1fr) minmax(180px, 1.2fr) auto;
  gap: 8px;
  align-items: center;
  border-top: 1px solid var(--line-soft);
  padding: 8px 0;
}

.admin-setting-row:first-of-type {
  border-top: 0;
}

.admin-setting-row small {
  color: var(--muted);
  font-weight: 500;
}

body.admin-active {
  font-size: 14px;
}

body.admin-active main {
  min-height: calc(100vh - 44px);
}

body.admin-active .localbar,
body.admin-active footer {
  display: none;
}

body.admin-active button,
body.admin-active .button,
body.admin-active input[type="submit"] {
  min-height: 32px;
  border-radius: 8px;
  padding: 7px 12px;
  font-size: 13px;
}

body.admin-active .button.small,
body.admin-active button.small {
  min-height: 28px;
  padding: 5px 9px;
  font-size: 12px;
}

body.admin-active .link-button {
  min-height: 0;
  border-radius: 0;
  padding: 0;
}

body.admin-active input:not([type="checkbox"]):not([type="radio"]):not([type="submit"]),
body.admin-active textarea,
body.admin-active select {
  min-height: 32px;
  border-radius: 8px;
  padding: 6px 9px;
  font-size: 13px;
  line-height: 1.35;
}

body.admin-active select {
  padding-right: 28px;
}

body.admin-active input[type="checkbox"],
body.admin-active input[type="radio"] {
  flex: 0 0 auto;
}

body.admin-active label:has(> input[type="checkbox"]),
body.admin-active label:has(> input[type="radio"]) {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 24px;
}

body.admin-active .eyebrow {
  margin-bottom: 3px;
  font-size: 11px;
}

body.admin-active .meta {
  font-size: 12px;
}

body.admin-active .admin-grid-2 {
  align-items: start;
}

body.admin-active .admin-panel > .meta:first-of-type {
  margin: 0 0 10px;
}

body.admin-active .admin-form h3 {
  margin: 0 0 2px;
  font-size: 14px;
  line-height: 1.3;
}

body.admin-active .admin-task-form:first-of-type {
  border-top: 0;
  margin-top: 0;
  padding-top: 0;
}

body.admin-active .admin-form button,
body.admin-active .admin-inline-form button {
  justify-self: start;
}

body.admin-active .admin-toolbar button,
body.admin-active .admin-bulkbar button {
  justify-self: auto;
}

.admin-content-hero {
  display: grid;
  grid-template-columns: minmax(280px, 0.95fr) minmax(360px, 1.35fr);
  gap: 12px;
  align-items: stretch;
  margin-bottom: 12px;
}

.admin-content-hero > div {
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  background: var(--panel);
  padding: 14px;
}

.admin-content-hero h2,
.admin-novel-status h2 {
  margin: 0;
  font-size: 22px;
  line-height: 1.2;
}

.admin-content-hero p {
  max-width: 620px;
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.admin-content-stats {
  display: grid;
  grid-template-columns: repeat(5, minmax(92px, 1fr));
  gap: 8px;
}

.admin-content-stats span {
  display: grid;
  align-content: center;
  min-height: 64px;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  background: var(--panel-soft);
  padding: 10px;
}

.admin-content-stats strong {
  color: var(--ink);
  font-size: 20px;
  line-height: 1;
}

.admin-content-stats small {
  margin-top: 5px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.admin-content-toolbar {
  top: 44px;
}

.admin-bulkbar-sticky {
  position: sticky;
  top: 96px;
  z-index: 18;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.06);
}

.admin-selection-summary {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 32px;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  background: var(--panel-soft);
  padding: 4px 9px;
}

.admin-selection-summary strong {
  color: var(--accent);
  font-size: 18px;
  line-height: 1;
}

.admin-selection-summary span,
.admin-tag-summary {
  color: var(--muted);
  font-size: 12px;
}

.admin-row-actions {
  display: flex;
  gap: 6px;
  align-items: center;
  flex-wrap: wrap;
}

.admin-table tr.is-selected td {
  background: color-mix(in srgb, var(--accent) 7%, var(--panel));
}

.admin-table td:first-child,
.admin-table th:first-child {
  width: 42px;
  text-align: center;
}

.admin-novel-status {
  align-items: center;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  background: var(--panel);
  padding: 12px 14px;
}

.admin-status-strip {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}

.admin-status-strip > span:not(.admin-pill) {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  background: var(--panel-soft);
  padding: 5px 9px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.admin-content-detail-grid {
  display: grid;
  grid-template-columns: minmax(280px, 360px) minmax(0, 1fr);
  gap: 12px;
  align-items: start;
}

.admin-novel-meta-panel {
  position: sticky;
  top: 58px;
}

.admin-tag-cover-block {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 132px;
  gap: 12px;
  align-items: start;
  margin-top: 14px;
  border-top: 1px solid var(--line-soft);
  padding-top: 12px;
}

.admin-tag-cover-block h3 {
  grid-column: 1 / -1;
  margin: 0 0 6px;
  font-size: 14px;
}

.admin-tag-cover-block > .meta,
.admin-tag-cover-block > .admin-inline-form {
  grid-column: 1;
}

.admin-tag-cover-block > .admin-cover-preview {
  grid-column: 2;
  grid-row: 2 / span 2;
}

.admin-chapter-workbench {
  min-height: 620px;
}

.admin-workbench-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: start;
  margin-bottom: 10px;
}

.admin-workbench-head h2,
.admin-editor-head h3,
.admin-editor-empty h3 {
  margin: 0;
  font-size: 16px;
  line-height: 1.25;
}

.admin-chapter-filters {
  display: inline-flex;
  gap: 4px;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  background: var(--panel-soft);
  padding: 3px;
}

body.admin-active .admin-chapter-filters button {
  min-height: 26px;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  padding: 4px 9px;
  font-size: 12px;
}

body.admin-active .admin-chapter-filters button[aria-pressed="true"] {
  background: var(--panel);
  color: var(--accent);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
}

.admin-workbench-body {
  display: grid;
  grid-template-columns: minmax(210px, 280px) minmax(0, 1fr);
  gap: 12px;
  align-items: start;
}

.admin-chapter-list {
  max-height: 690px;
  overflow: auto;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  background: var(--panel-soft);
  padding: 6px;
}

.admin-chapter-list a {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  gap: 8px;
  align-items: start;
  border-radius: 8px;
  padding: 8px;
}

.admin-chapter-list a:hover,
.admin-chapter-list a[aria-current="page"] {
  background: var(--panel);
}

.admin-chapter-list a[aria-current="page"] {
  outline: 2px solid color-mix(in srgb, var(--accent) 36%, transparent);
}

.admin-chapter-number {
  display: inline-grid;
  place-items: center;
  min-height: 28px;
  border-radius: 7px;
  background: color-mix(in srgb, var(--accent) 10%, var(--panel));
  color: var(--accent);
  font-size: 12px;
  font-weight: 900;
}

.admin-chapter-list strong {
  display: block;
  overflow: hidden;
  color: var(--ink);
  font-size: 13px;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.admin-chapter-list small {
  display: block;
  overflow: hidden;
  margin-top: 3px;
  color: var(--muted);
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.admin-chapter-editor {
  min-width: 0;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  background: var(--panel-soft);
  padding: 10px;
}

.admin-editor-head {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}

.admin-chapter-form textarea {
  min-height: 460px;
  font: 14px/1.7 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.admin-editor-empty {
  display: grid;
  place-items: center;
  min-height: 520px;
  color: var(--muted);
  text-align: center;
}

.admin-editor-empty p {
  max-width: 360px;
  margin: 8px auto 0;
}

.admin-contract {
  color: var(--muted);
  font-size: 13px;
}

.admin-contract p {
  margin: 0 0 10px;
}

.admin-contract ul {
  margin: 0;
  padding-left: 18px;
}

.admin-contract li {
  margin: 6px 0;
}

.admin-contract-code {
  max-height: 360px;
  overflow: auto;
  margin: 0;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  background: var(--panel-soft);
  color: var(--ink);
  padding: 12px;
  font: 12px/1.55 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
}

footer {
  padding: 36px 28px;
  color: var(--muted);
  text-align: center;
  font-size: 13px;
}

.mobile-tabbar {
  display: none;
}

@media (max-width: 820px) {
  body {
    padding-bottom: calc(72px + env(safe-area-inset-bottom));
  }

  .globalbar {
    display: none;
  }

  .topbar {
    top: 0;
  }

  .localbar {
    min-height: 54px;
    padding: 0 18px;
  }

  .section {
    padding: 26px 18px;
  }

  .auth-shell {
    grid-template-columns: 1fr;
  }

  .admin-shell {
    display: block;
  }

  .admin-sidebar {
    position: static;
    height: auto;
    border-right: 0;
    border-bottom: 1px solid var(--line-soft);
    padding: 12px 18px;
  }

  .admin-sidebar nav {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding-bottom: 4px;
  }

  .admin-sidebar nav a {
    flex: 0 0 auto;
    min-width: 118px;
  }

  .admin-main {
    padding: 20px 18px;
  }

  .admin-heading {
    align-items: start;
    flex-direction: column;
  }

  .admin-heading h1 {
    font-size: 34px;
  }

  .admin-kpis,
  .admin-grid-2,
  .admin-content-hero,
  .admin-content-detail-grid,
  .admin-workbench-body {
    grid-template-columns: 1fr;
  }

  .admin-toolbar {
    position: static;
  }

  .admin-bulkbar-sticky,
  .admin-novel-meta-panel {
    position: static;
  }

  .admin-content-stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .admin-toolbar input,
  .admin-toolbar select,
  .admin-toolbar button,
  .admin-inline-form input,
  .admin-inline-form select,
  .admin-inline-form button {
    width: 100%;
  }

  .admin-bulkbar select,
  .admin-bulkbar input,
  .admin-bulkbar button,
  .admin-selection-summary {
    width: 100%;
  }

  .admin-status-strip {
    justify-content: flex-start;
  }

  .admin-tag-cover-block {
    grid-template-columns: 1fr;
  }

  .admin-tag-cover-block h3,
  .admin-tag-cover-block > .meta,
  .admin-tag-cover-block > .admin-inline-form,
  .admin-tag-cover-block > .admin-cover-preview {
    grid-column: 1;
    grid-row: auto;
  }

  .admin-cover-preview {
    width: min(150px, 100%);
  }

  .admin-workbench-head,
  .admin-editor-head {
    flex-direction: column;
  }

  .admin-chapter-list {
    display: flex;
    max-height: none;
    overflow-x: auto;
  }

  .admin-chapter-list a {
    flex: 0 0 220px;
  }

  .admin-editor-empty {
    min-height: 260px;
  }

  .admin-chapter-form textarea {
    min-height: 340px;
  }

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

  .home-hero,
  .novel-hero {
    grid-template-columns: 1fr;
  }

  .home-hero {
    gap: 22px;
    padding-top: 30px;
  }

  .hero-copy h1,
  .section h1 {
    font-size: 42px;
  }

  .hero-copy p {
    font-size: 18px;
  }

  .continue-card {
    grid-template-columns: 88px minmax(0, 1fr);
  }

  .continue-card strong {
    font-size: 19px;
  }

  .metric-strip {
    grid-template-columns: 1fr;
  }

  .grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px 14px;
  }

  .search-panel {
    grid-template-columns: 1fr;
  }

  .category-strip {
    margin-right: -18px;
    margin-left: -18px;
    padding-right: 18px;
    padding-left: 18px;
  }

  .novel-hero {
    gap: 22px;
    padding-top: 10px;
  }

  .novel-cover {
    width: min(190px, 58vw);
    margin: 0 auto;
  }

  .novel-copy h1 {
    font-size: 36px;
    text-align: center;
  }

  .novel-copy .eyebrow,
  .novel-copy .byline,
  .novel-copy .price,
  .novel-copy .action-row {
    justify-content: center;
    text-align: center;
  }

  .reader {
    padding: 12px 18px 30px;
  }

  .reader-head {
    grid-template-columns: auto minmax(0, 1fr) auto;
    margin-right: -8px;
    margin-left: -8px;
  }

  .reader-back {
    width: 44px;
    overflow: hidden;
    color: transparent;
    padding: 0;
  }

  .reader-back::before {
    content: "<";
    color: var(--accent);
    font-size: 20px;
  }

  .chapter-body {
    font-size: var(--reader-font-size);
  }

  .reader-controls {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .mobile-tabbar {
    position: fixed;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 70;
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    min-height: calc(64px + env(safe-area-inset-bottom));
    border-top: 1px solid var(--line-soft);
    background: color-mix(in srgb, var(--panel) 84%, transparent);
    padding: 7px 4px calc(7px + env(safe-area-inset-bottom));
    -webkit-backdrop-filter: saturate(180%) blur(22px);
    backdrop-filter: saturate(180%) blur(22px);
  }

  .mobile-tabbar a {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 0;
    color: var(--muted);
    font-size: 11px;
    font-weight: 700;
  }

  .mobile-tabbar a[aria-current="page"] {
    color: var(--accent);
  }
}

@media (max-width: 420px) {
  .hero-copy h1,
  .section h1 {
    font-size: 36px;
  }

  .section-title {
    align-items: start;
    flex-direction: column;
    gap: 6px;
  }

  .action-row .button,
  .chapter-nav .button {
    flex: 1 1 130px;
    text-align: center;
  }
}
