@font-face {
  font-family: "Noto Sans";
  src: url("/fonts/noto-sans-latin-ext-400-normal.woff2") format("woff2");
  font-style: normal;
  font-weight: 400;
  font-display: swap;
}

@font-face {
  font-family: "Noto Sans";
  src: url("/fonts/noto-sans-latin-ext-600-normal.woff2") format("woff2");
  font-style: normal;
  font-weight: 600;
  font-display: swap;
}

@font-face {
  font-family: "Noto Sans";
  src: url("/fonts/noto-sans-latin-ext-700-normal.woff2") format("woff2");
  font-style: normal;
  font-weight: 700;
  font-display: swap;
}

/* Same palette and type as the public site (public/site.css). */
:root {
  --paper: #faf7f0;
  --surface: #f0f1e8;
  --card: #fffefa;
  --ink: #243d35;
  --muted: #68776e;
  --green: #245744;
  --green-dark: #183d30;
  --green-soft: #e2e9dc;
  --gold: #d7a349;
  --gold-soft: #f6ead0;
  --line: #dce1d6;
  --line-strong: #cad3c4;
  --danger: #a4423f;
  --danger-soft: #f7e7e3;
  --shadow: 0 5px 14px #3344231a;
  --radius: 22px;
  --admin-header: 76px;
  --admin-sidebar: 252px;
  color-scheme: light;
  font-family: "Noto Sans", Arial, sans-serif;
  color: var(--ink);
  background: var(--paper);
  font-synthesis: none;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--admin-header) + 24px);
}

body {
  min-width: 320px;
  margin: 0;
  background: var(--paper);
  line-height: 1.5;
}

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

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

button,
a,
input,
select,
textarea {
  -webkit-tap-highlight-color: transparent;
}

button,
select,
input[type="checkbox"],
input[type="color"] {
  cursor: pointer;
}

img {
  display: block;
  max-width: 100%;
}

a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 3px solid #b17423;
  outline-offset: 3px;
}

[hidden] {
  display: none !important;
}

h1,
h2,
h3,
h4,
p {
  overflow-wrap: break-word;
}

/* Brand */

.brand-symbol {
  position: relative;
  width: 34px;
  flex-shrink: 0;
  color: var(--green);
  font: italic 46px/1 Georgia, serif;
}

.brand-symbol > span {
  position: absolute;
  top: 1px;
  right: -4px;
  color: var(--gold);
  font: 14px Georgia, serif;
}

.admin-wordmark,
.auth-brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.admin-wordmark strong,
.auth-brand strong {
  display: block;
  font: 700 21px/1.1 Georgia, serif;
  letter-spacing: -0.5px;
  white-space: nowrap;
}

.admin-wordmark small,
.auth-brand small {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 2.2px;
  text-transform: uppercase;
}

.eyebrow {
  display: flex;
  align-items: center;
  gap: 9px;
  margin: 0 0 12px;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 2px;
  text-transform: uppercase;
}

.eyebrow > span {
  width: 7px;
  height: 7px;
  flex-shrink: 0;
  border-radius: 50%;
  background: var(--gold);
}

/* Header */

.admin-header {
  position: fixed;
  z-index: 50;
  top: 0;
  right: 0;
  left: 0;
  display: flex;
  align-items: center;
  gap: 18px;
  height: var(--admin-header);
  padding: 0 28px;
  background: #faf7f0f2;
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(8px);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-left: auto;
}

.header-actions form {
  margin: 0;
}

.view-site {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  padding: 0 12px;
  font-size: 13px;
  font-weight: 600;
}

.view-site:hover {
  text-decoration: underline;
  text-underline-offset: 4px;
}

.sidebar-toggle {
  display: none;
  width: 44px;
  height: 44px;
  flex-shrink: 0;
  padding: 0;
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 50%;
}

.sidebar-toggle span {
  display: block;
  width: 16px;
  height: 2px;
  margin: 3px auto;
  border-radius: 2px;
  background: var(--ink);
}

/* Layout */

.admin-shell {
  display: grid;
  grid-template-columns: var(--admin-sidebar) minmax(0, 1fr);
  min-height: 100vh;
  padding-top: var(--admin-header);
}

.sidebar {
  position: sticky;
  top: var(--admin-header);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  height: calc(100vh - var(--admin-header));
  padding: 26px 18px;
  overflow-y: auto;
  background: var(--surface);
  border-right: 1px solid #e5e7dc;
}

.sidebar nav {
  display: grid;
  gap: 4px;
}

.sidebar nav a {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 44px;
  padding: 0 16px;
  border-radius: 25px;
  font-size: 13px;
  font-weight: 600;
  transition: background 0.2s;
}

.sidebar nav a span {
  color: var(--muted);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 1px;
}

.sidebar nav a:hover {
  background: #e3e8db;
}

.sidebar nav a.is-active {
  background: var(--green);
  color: #fff;
}

.sidebar nav a.is-active span {
  color: #cfe0d4;
}

.sidebar-footer {
  display: grid;
  gap: 3px;
  margin-top: 24px;
  padding: 16px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  font-size: 11px;
}

.sidebar-footer span {
  color: var(--muted);
}

.sidebar-footer strong {
  overflow-wrap: anywhere;
}

.sidebar-footer a {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 36px;
  margin-top: 6px;
  color: var(--green);
  font-weight: 600;
}

.sidebar-footer a:hover {
  text-decoration: underline;
  text-underline-offset: 3px;
}

.admin-main {
  width: 100%;
  max-width: 1160px;
  min-width: 0;
  padding: 44px 5% 90px;
}

/* Section headings */

.dashboard-section,
.admin-section {
  padding-bottom: 56px;
}

.admin-section {
  padding-top: 52px;
  border-top: 1px solid var(--line);
}

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

.section-title > p {
  max-width: 400px;
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.7;
}

.section-title h1,
.section-title h2 {
  margin: 0;
  font-weight: 400;
  font-family: Georgia, serif;
  letter-spacing: -1px;
}

.section-title h1 {
  font-size: clamp(36px, 4vw, 54px);
  line-height: 1.08;
}

.section-title h2 {
  font-size: clamp(28px, 3vw, 40px);
  line-height: 1.15;
}

.inline-title {
  align-items: center;
}

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

.subsection-heading h3,
.subsection-heading h4 {
  margin: 0;
  font: 400 24px/1.2 Georgia, serif;
}

.subsection-heading h4 {
  font-size: 21px;
}

.subsection-heading p {
  max-width: 460px;
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.7;
}

.subsection-heading > div > p:not(.eyebrow) {
  margin-top: 6px;
}

/* Flash */

.flash {
  margin: 0 0 24px;
  padding: 14px 18px;
  border: 1px solid;
  border-radius: 14px;
  font-size: 13px;
  font-weight: 600;
}

.flash.success {
  background: var(--green-soft);
  border-color: #bdcbb8;
  color: var(--green-dark);
}

.flash.error {
  background: var(--danger-soft);
  border-color: #e6c3bb;
  color: var(--danger);
}

/* Cards */

.panel,
.stats-grid > div,
.link-card,
.audiobook-editor,
.category-row,
.empty-note {
  background: var(--card);
  border: 1px solid #e6e8de;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.panel {
  padding: 28px;
}

.panel + .panel {
  margin-top: 22px;
}

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

.stats-grid > div {
  display: grid;
  gap: 6px;
  padding: 22px 24px;
}

.stats-grid span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 1.2px;
  text-transform: uppercase;
}

.stats-grid strong {
  font: 400 40px/1 Georgia, serif;
  color: var(--green);
}

.empty-note {
  padding: 26px;
  color: var(--muted);
  font-size: 13px;
}

/* Book links and QR codes */

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

.link-card {
  display: flex;
  flex-direction: column;
  gap: 18px;
  min-width: 0;
  padding: 22px;
}

.link-card-head {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}

.link-card-head img {
  width: 64px;
  height: 64px;
  flex-shrink: 0;
  object-fit: cover;
  border-radius: 12px;
  box-shadow: 0 3px 8px #33442322;
}

.link-card-head > div {
  min-width: 0;
}

.link-card h3 {
  margin: 8px 0 0;
  font: 400 19px/1.25 Georgia, serif;
}

.language-pill {
  display: inline-flex;
  padding: 4px 10px;
  border-radius: 20px;
  background: #e2e7d9;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.4px;
}

.qr-preview {
  display: grid;
  place-items: center;
  margin: 0;
  padding: 18px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 16px;
}

.qr-preview img {
  width: 100%;
  max-width: 220px;
  height: auto;
  aspect-ratio: 1;
  image-rendering: pixelated;
}

.link-url {
  display: block;
  padding: 10px 14px;
  background: var(--surface);
  border-radius: 12px;
  font-size: 12px;
  overflow-wrap: anywhere;
}

.link-url:hover {
  text-decoration: underline;
  text-underline-offset: 3px;
}

.link-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: auto;
}

.link-actions > * {
  flex: 1 1 130px;
  padding-inline: 14px;
  white-space: nowrap;
}

/* Buttons */

.button-primary,
.button-secondary,
.button-outline,
.button-danger,
.editor-toggle,
.auth-box button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  min-height: 46px;
  padding: 11px 22px;
  border: 1px solid transparent;
  border-radius: 30px;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.2;
  text-align: center;
  transition:
    background 0.2s,
    border-color 0.2s,
    color 0.2s,
    transform 0.2s;
}

.button-primary {
  background: var(--green);
  color: #fff;
  box-shadow: 0 5px 10px #24574414;
}

.button-primary:hover {
  background: var(--green-dark);
  transform: translateY(-1px);
}

.button-secondary,
.editor-toggle {
  background: var(--card);
  border-color: #bfcbb9;
  color: var(--green);
}

.button-secondary:hover,
.editor-toggle:hover {
  background: var(--green-soft);
  border-color: var(--green);
}

.button-outline {
  background: transparent;
  border-color: var(--line-strong);
}

.button-outline:hover {
  border-color: var(--ink);
}

.button-danger {
  background: transparent;
  border-color: #e0bfb8;
  color: var(--danger);
}

.button-danger:hover {
  background: var(--danger-soft);
  border-color: var(--danger);
}

.icon-danger {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  flex-shrink: 0;
  padding: 0;
  background: transparent;
  border: 1px solid #e0bfb8;
  border-radius: 50%;
  color: var(--danger);
  font-size: 20px;
  line-height: 1;
}

.icon-danger:hover {
  background: var(--danger-soft);
}

button:disabled {
  cursor: progress;
  opacity: 0.65;
  transform: none;
}

.text-link {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  font-size: 12px;
  font-weight: 600;
}

.text-link:hover {
  text-decoration: underline;
  text-underline-offset: 4px;
}

/* Forms */

label {
  display: grid;
  gap: 7px;
  min-width: 0;
  color: var(--ink);
  font-size: 12px;
  font-weight: 600;
}

input:not([type="checkbox"]):not([type="color"]):not([type="file"]),
select,
textarea {
  width: 100%;
  min-height: 46px;
  padding: 11px 15px;
  background: #fff;
  border: 1px solid #d6dccf;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 400;
  transition: border-color 0.2s;
}

textarea {
  min-height: 110px;
  line-height: 1.6;
  resize: vertical;
}

input:not([type="checkbox"]):not([type="color"]):not([type="file"]):hover,
select:hover,
textarea:hover {
  border-color: #b8c3b1;
}

input[type="file"] {
  width: 100%;
  min-height: 46px;
  padding: 7px;
  background: #fff;
  border: 1px dashed #c3ccbd;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 400;
}

input[type="file"]::file-selector-button {
  margin-right: 12px;
  padding: 7px 14px;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: 20px;
  color: var(--ink);
  font: 600 12px "Noto Sans", Arial, sans-serif;
  cursor: pointer;
}

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

::placeholder {
  color: #9aa49d;
}

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

.wide {
  grid-column: 1 / -1;
}

.check-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 28px;
}

.check-row label,
.compact-check {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  font-weight: 600;
}

.form-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
}

/* Audiobook list */

.library-tools {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) minmax(0, 1.4fr);
  gap: 16px;
  margin-bottom: 22px;
  padding: 18px 20px;
  background: var(--surface);
  border: 1px solid #e5e7dc;
  border-radius: 18px;
}

.audiobook-list {
  display: grid;
  gap: 16px;
}

.audiobook-editor {
  overflow: hidden;
}

.book-editor-heading {
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 18px 22px;
}

.book-editor-heading img {
  width: 72px;
  height: 72px;
  flex-shrink: 0;
  object-fit: cover;
  border-radius: 12px;
  box-shadow: 0 3px 8px #33442322;
}

.book-editor-heading > div {
  flex: 1;
  min-width: 0;
}

.book-editor-heading h3 {
  margin: 6px 0 2px;
  font: 400 23px/1.25 Georgia, serif;
}

.book-editor-heading p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
}

.status-line {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.status {
  display: inline-flex;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.6px;
  text-transform: uppercase;
}

.status.published {
  background: var(--green-soft);
  color: var(--green);
}

.status.draft {
  background: #ecebe6;
  color: var(--muted);
}

.status.featured {
  background: var(--gold-soft);
  color: #85621f;
}

.book-editor-body {
  display: grid;
  gap: 34px;
  padding: 28px 22px 26px;
  background: #fbfaf4;
  border-top: 1px solid #e6e8de;
}

.tracks-section {
  padding-top: 30px;
  border-top: 1px solid #e6e8de;
}

.track-list {
  display: grid;
  gap: 16px;
  margin-bottom: 16px;
}

.track-card {
  display: grid;
  gap: 18px;
  padding: 20px;
  background: var(--card);
  border: 1px solid #e3e6da;
  border-radius: 18px;
}

.track-card-head {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}

.track-card-head h4 {
  margin: 0;
  font: 400 19px/1.2 Georgia, serif;
}

.language-code {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  flex-shrink: 0;
  border-radius: 50%;
  background: var(--green);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.5px;
}

.language-code.is-new {
  background: var(--gold-soft);
  color: #85621f;
  font-size: 20px;
  font-weight: 400;
}

.track-link {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 16px;
  min-width: 0;
  color: var(--muted);
  font-size: 12px;
}

.track-link a {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 32px;
  color: var(--ink);
  font-weight: 600;
  overflow-wrap: anywhere;
}

.track-link a:hover {
  text-decoration: underline;
  text-underline-offset: 3px;
}

.track-link .track-qr {
  padding: 0 12px;
  background: var(--surface);
  border-radius: 20px;
  color: var(--green);
}

.track-fields {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px 18px;
}

.track-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.track-add-form {
  background: transparent;
  border-style: dashed;
  border-color: #c9d2c3;
}

.create-form {
  margin-top: 28px;
}

/* Categories */

.category-list {
  display: grid;
  gap: 14px;
  margin-bottom: 18px;
}

.category-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.8fr) 96px auto;
  align-items: end;
  gap: 16px;
  padding: 18px 20px;
  box-shadow: none;
}

.row-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 16px;
  min-height: 46px;
}

.item-count {
  display: inline-flex;
  align-items: center;
  min-height: 46px;
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}

.row-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.category-add-form {
  background: transparent;
  border-style: dashed;
  border-color: #c9d2c3;
}

.category-add-form h3 {
  grid-column: 1 / -1;
  margin: 0;
  font: 400 20px/1.2 Georgia, serif;
}

/* Texts */

.lang-tabs {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-bottom: 20px;
  padding: 4px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 999px;
}

.lang-tabs button {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  min-height: 44px;
  padding: 0 18px 0 8px;
  background: transparent;
  border: 0;
  border-radius: 999px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
  transition:
    background 0.2s,
    color 0.2s;
}

.lang-tabs button:hover {
  color: var(--ink);
}

.lang-tabs .lang-code {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--surface);
  color: var(--ink);
  font-size: 10.5px;
  letter-spacing: 0.04em;
}

.lang-tabs .custom-count {
  display: inline-grid;
  place-items: center;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--gold-soft);
  color: #85621f;
  font-size: 11px;
}

.lang-tabs button[aria-selected="true"] {
  background: var(--green);
  color: #fff;
}

.lang-tabs button[aria-selected="true"] .lang-code,
.lang-tabs button[aria-selected="true"] .custom-count {
  background: #ffffff29;
  color: #fff;
}

.lang-tabs button.is-dirty::after {
  content: "";
  width: 7px;
  height: 7px;
  margin-left: -2px;
  border-radius: 50%;
  background: var(--gold);
}

.texts-form {
  display: grid;
  gap: 28px;
}

.texts-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px 24px;
  padding-bottom: 22px;
  border-bottom: 1px solid var(--line);
}

.texts-toolbar h3 {
  margin: 0;
  font: 400 26px/1.2 Georgia, serif;
}

.texts-toolbar p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.texts-toolbar-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 16px;
}

.text-group {
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

.text-group + .text-group {
  padding-top: 26px;
  border-top: 1px solid var(--line);
}

/* Floated so the legend does not sit on the fieldset border. */
.text-group legend {
  float: left;
  width: 100%;
  margin: 0 0 4px;
  padding: 0;
  font: 400 20px/1.25 Georgia, serif;
}

.text-group legend + * {
  clear: both;
}

.text-group-lead {
  margin: 0 0 16px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.6;
}

.text-group legend + .form-grid {
  margin-top: 12px;
}

.field-label {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.custom-tag {
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--gold-soft);
  color: #85621f;
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.texts-actions {
  position: sticky;
  z-index: 5;
  bottom: 0;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  margin: 0 -28px -28px;
  padding: 16px 28px;
  background: #fffefaf5;
  border-top: 1px solid var(--line);
  border-radius: 0 0 var(--radius) var(--radius);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
}

.form-note {
  margin: 0;
  padding: 14px 16px;
  background: var(--surface);
  border-radius: 12px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 400;
}

.form-note a {
  color: var(--green);
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* Appearance */

.theme-form {
  display: grid;
  gap: 20px;
}

.theme-form .subsection-heading {
  margin-bottom: 0;
}

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

.swatch {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 14px;
}

.swatch input[type="color"] {
  width: 38px;
  height: 38px;
  flex-shrink: 0;
  padding: 0;
  background: none;
  border: 1px solid var(--line-strong);
  border-radius: 50%;
  overflow: hidden;
}

.swatch input[type="color"]::-webkit-color-swatch-wrapper {
  padding: 0;
}

.swatch input[type="color"]::-webkit-color-swatch {
  border: 0;
  border-radius: 50%;
}

.swatch input[type="color"]::-moz-color-swatch {
  border: 0;
  border-radius: 50%;
}

.swatch span {
  display: grid;
  min-width: 0;
  font-size: 12px;
}

.swatch small {
  color: var(--muted);
  font-size: 10px;
  font-weight: 400;
  text-transform: uppercase;
}

/* Legal and account */

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

.legal-admin-list .panel + .panel {
  margin-top: 0;
}

.legal-form {
  align-items: end;
}

.password-form {
  max-width: 680px;
}

/* Login and setup */

.auth-page {
  display: grid;
  place-items: center;
  min-height: 100vh;
  padding: 24px 16px;
  background:
    radial-gradient(circle at 85% 12%, #e4e8da 0 22%, transparent 22.2%),
    radial-gradient(circle at 8% 92%, #efe6cf 0 16%, transparent 16.2%),
    var(--paper);
}

.auth-box {
  width: min(100%, 440px);
  padding: 36px;
  background: var(--card);
  border: 1px solid #e6e8de;
  border-radius: 26px;
  box-shadow: 0 18px 40px #2441371a;
}

.auth-brand {
  margin-bottom: 30px;
}

.auth-box h1 {
  margin: 0 0 24px;
  font: 400 36px/1.1 Georgia, serif;
  letter-spacing: -1px;
}

.auth-box form {
  display: grid;
  gap: 18px;
}

.auth-box button {
  width: 100%;
  margin-top: 6px;
}

/* Responsive */

@media (max-width: 1180px) {
  .category-row {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.6fr) 96px;
  }

  .row-meta {
    grid-column: 1 / -1;
  }

  .row-actions {
    margin-left: auto;
  }

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

@media (max-width: 980px) {
  :root {
    --admin-header: 68px;
  }

  .admin-header {
    padding: 0 16px;
  }

  .sidebar-toggle {
    display: block;
  }

  .admin-shell {
    grid-template-columns: minmax(0, 1fr);
  }

  .sidebar {
    position: fixed;
    z-index: 40;
    top: var(--admin-header);
    bottom: 0;
    left: 0;
    width: min(300px, 86vw);
    height: auto;
    box-shadow: 12px 0 30px #24413722;
    transform: translateX(-102%);
    transition: transform 0.25s;
  }

  .sidebar.is-open {
    box-shadow: 0 0 0 100vmax #24413747;
    transform: none;
  }

  .admin-main {
    padding: 32px 16px 70px;
  }

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

  .legal-admin-list {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (max-width: 720px) {
  .admin-wordmark small {
    display: none;
  }

  .lang-tabs {
    display: flex;
  }

  .lang-tabs button {
    flex: 1 1 0;
    justify-content: center;
    padding: 0 10px;
  }

  .lang-tabs .lang-code {
    display: none;
  }

  .texts-actions {
    margin: 0 -20px -20px;
    padding: 14px 20px;
  }

  .texts-actions > button {
    flex: 1 1 auto;
  }

  .view-site {
    padding: 0 6px;
    font-size: 12px;
  }

  .button-outline {
    padding: 11px 16px;
  }

  .section-title,
  .subsection-heading {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }

  .inline-title {
    align-items: flex-start;
  }

  .form-grid,
  .track-fields,
  .library-tools {
    grid-template-columns: minmax(0, 1fr);
  }

  .panel {
    padding: 20px;
  }

  .category-row {
    grid-template-columns: minmax(0, 1fr) 96px;
    grid-auto-flow: dense;
  }

  .category-row .category-description {
    grid-column: 1 / -1;
  }

  .book-editor-heading {
    flex-wrap: wrap;
    padding: 16px;
  }

  .book-editor-heading img {
    width: 60px;
    height: 60px;
  }

  .book-editor-heading .editor-toggle {
    width: 100%;
  }

  .book-editor-body {
    padding: 22px 14px;
  }

  .track-card {
    padding: 16px;
  }

  .form-actions > button,
  .track-actions > button {
    flex: 1 1 auto;
  }

  .auth-box {
    padding: 28px 22px;
  }
}

@media (max-width: 420px) {
  .view-site {
    display: none;
  }

  .stats-grid {
    gap: 12px;
  }

  .stats-grid > div {
    padding: 16px;
  }

  .stats-grid strong {
    font-size: 32px;
  }

}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    transition: none !important;
  }
}
