:root {
  --ink: #193033;
  --ink-soft: #587073;
  --paper: #f8f6f0;
  --panel: #fffaf1;
  --white: #ffffff;
  --sage: #3f665b;
  --sage-soft: #dbe9e3;
  --clay: #934b38;
  --gold: #ddbb72;
  --line: rgba(25, 48, 51, 0.12);
  --shadow: 0 28px 78px rgba(25, 48, 51, 0.14);
  --shadow-soft: 0 16px 44px rgba(25, 48, 51, 0.08);
  --shadow-lift: 0 24px 56px rgba(25, 48, 51, 0.16);
  --radius-control: 12px;
  --radius-card: 18px;
  --radius-panel: 28px;
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

/* Custom scrollbar for admin */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: rgba(63, 102, 91, 0.25);
  border-radius: 999px;
}
::-webkit-scrollbar-thumb:hover {
  background: rgba(63, 102, 91, 0.4);
}
* {
  scrollbar-width: thin;
  scrollbar-color: rgba(63, 102, 91, 0.25) transparent;
}

/* ElevenLabs one-time recording studio */
.voice-manager {
  margin-top: 1.4rem;
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: clamp(1.2rem, 3vw, 2rem);
  background:
    radial-gradient(circle at 92% 6%, rgba(209, 174, 94, 0.16), transparent 18rem),
    rgba(255, 250, 241, 0.96);
  box-shadow: 0 18px 48px rgba(25, 48, 51, 0.1);
  transition: box-shadow 240ms ease;
}

.voice-manager:hover {
  box-shadow: 0 22px 56px rgba(25, 48, 51, 0.13);
}

.sleep-sounds-manager {
  margin-top: 1.4rem;
  padding: clamp(1.2rem, 3vw, 2rem);
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255, 250, 241, 0.96);
  box-shadow: var(--shadow-soft);
}

.sleep-sounds-form { display: grid; grid-template-columns: minmax(0, 1fr) minmax(180px, .35fr); gap: 1rem; margin-top: 1.5rem; }
.sleep-sounds-form label { display: block; margin-bottom: .45rem; font-weight: 800; }
.sleep-sounds-form input, .sleep-sounds-form textarea { box-sizing: border-box; width: 100%; border: 1px solid var(--line); border-radius: 8px; padding: .8rem; font: inherit; }
.sleep-sounds-form small { display: block; margin-top: .4rem; color: var(--ink-soft); }.sleep-sounds-form audio { width: 100%; margin-top: .75rem; }.sleep-sounds-form .form-wide { grid-column: 1 / -1; }
.sleep-sounds-list { display: grid; gap: .85rem; margin-top: 2rem; }.sleep-sound-admin-item { display: grid; grid-template-columns: minmax(0, 1fr) minmax(220px, .7fr) auto; gap: 1rem; align-items: center; padding: 1rem; border: 1px solid var(--line); border-radius: 10px; background: var(--white); }.sleep-sound-admin-item h3, .sleep-sound-admin-item p { margin: 0; }.sleep-sound-admin-item p { margin-top: .35rem; color: var(--ink-soft); line-height: 1.5; }.sleep-sound-admin-item small { display: block; margin-top: .55rem; color: var(--sage); font-weight: 800; }.sleep-sound-admin-item audio { width: 100%; }.sleep-sound-admin-actions { display: flex; gap: .5rem; }.sleep-sounds-empty { color: var(--ink-soft); }
@media (max-width: 760px) { .sleep-sounds-form, .sleep-sound-admin-item { grid-template-columns: 1fr; }.sleep-sound-admin-actions { justify-content: flex-start; } }

.voice-manager .manager-heading {
  align-items: flex-start;
}

.voice-manager .status-badge {
  flex: 0 0 auto;
}

.voice-studio-grid {
  display: grid;
  grid-template-columns: minmax(0, 0.82fr) minmax(0, 1.18fr);
  gap: 1rem;
}

.voice-studio-panel {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: clamp(1rem, 2.5vw, 1.5rem);
  background: rgba(255, 255, 255, 0.88);
}

.voice-studio-panel h3 {
  margin: 0 0 0.45rem;
  font-size: clamp(1.25rem, 2.5vw, 1.7rem);
}

.voice-studio-panel > p:not(.panel-label) {
  margin: 0 0 1rem;
  color: var(--ink-soft);
  line-height: 1.6;
}

.voice-studio-panel label {
  display: block;
  margin-bottom: 0.45rem;
  color: var(--ink);
  font-size: 0.88rem;
  font-weight: 800;
}

.voice-key-form + .voice-key-form {
  margin-top: 1.15rem;
  padding-top: 1.15rem;
  border-top: 1px solid var(--line);
}

.voice-key-form label span {
  color: var(--ink-soft);
  font-weight: 650;
}

.voice-field-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.65rem;
}

.voice-field-row input,
.voice-field-row select {
  width: 100%;
  min-height: 3rem;
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 0.75rem 0.85rem;
  background: #fffdf8;
  color: var(--ink);
  font: inherit;
}

.voice-field-row input:focus,
.voice-field-row select:focus {
  border-color: var(--sage);
  box-shadow: 0 0 0 4px rgba(63, 102, 91, 0.13);
  outline: none;
}

.voice-field-row button {
  min-height: 3rem;
  white-space: nowrap;
}

.voice-adjustment-box {
  margin-top: 1.25rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--line);
}

.voice-adjustment-box label {
  display: block;
  margin-bottom: 0.45rem;
  color: var(--ink);
  font-size: 0.88rem;
  font-weight: 800;
}

.voice-adjustment-box textarea {
  display: block;
  width: 100%;
  min-height: 4.4rem;
  resize: vertical;
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 0.75rem 0.85rem;
  background: #fffdf8;
  color: var(--ink);
  font: inherit;
}

.voice-adjustment-box textarea:focus {
  border-color: var(--sage);
  box-shadow: 0 0 0 4px rgba(63, 102, 91, 0.13);
  outline: none;
}

.voice-adjustment-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.65rem 0.9rem;
  margin-top: 0.7rem;
}

.voice-adjustment-row .form-message {
  margin: 0;
  flex: 1 1 16rem;
}

.voice-adjustment-status {
  margin: 0.65rem 0 0;
  color: var(--ink-soft);
  font-size: 0.85rem;
  line-height: 1.45;
}

.voice-gallery-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.8rem;
  margin-bottom: 0.85rem;
}

.voice-gallery-toolbar > div {
  display: grid;
  gap: 0.12rem;
}

.voice-gallery-toolbar strong {
  color: var(--ink);
  font-size: 0.92rem;
}

.voice-gallery-toolbar span {
  color: var(--ink-soft);
  font-size: 0.76rem;
}

.voice-choice-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem;
  max-height: 31rem;
  overflow-y: auto;
  padding: 0.15rem 0.25rem 0.3rem 0.15rem;
  scrollbar-color: rgba(63, 102, 91, 0.35) transparent;
}

.voice-choice-grid.is-loading {
  min-height: 8rem;
}

.voice-gallery-empty {
  grid-column: 1 / -1;
  display: grid;
  place-items: center;
  min-height: 7.5rem;
  border: 1px dashed rgba(63, 102, 91, 0.3);
  border-radius: 12px;
  padding: 1.1rem;
  background: rgba(219, 233, 227, 0.3);
  color: var(--ink-soft);
  text-align: center;
  line-height: 1.55;
}

.voice-gallery-empty.is-error {
  border-color: rgba(147, 75, 56, 0.32);
  background: rgba(147, 75, 56, 0.06);
  color: #9e3425;
}

.voice-choice-card {
  position: relative;
  display: flex;
  flex-direction: column;
  min-width: 0;
  border: 1px solid rgba(25, 48, 51, 0.12);
  border-radius: 14px;
  padding: 0.85rem;
  background:
    radial-gradient(circle at 100% 0, rgba(221, 187, 114, 0.13), transparent 8rem),
    #fffdf9;
  box-shadow: 0 8px 22px rgba(25, 48, 51, 0.06);
  transition: border-color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

.voice-choice-card:hover {
  border-color: rgba(63, 102, 91, 0.36);
  box-shadow: 0 12px 30px rgba(25, 48, 51, 0.1);
  transform: translateY(-2px);
}

.voice-choice-card.is-selected {
  border-color: var(--sage);
  box-shadow: 0 0 0 3px rgba(63, 102, 91, 0.13), 0 12px 28px rgba(25, 48, 51, 0.1);
}

.voice-choice-card.is-selected::after {
  content: "Chosen";
  position: absolute;
  top: -0.48rem;
  right: 0.7rem;
  border-radius: 999px;
  padding: 0.22rem 0.52rem;
  background: var(--sage);
  color: white;
  font-size: 0.62rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.voice-choice-header {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 0.58rem;
}

.voice-avatar {
  display: grid;
  place-items: center;
  width: 2.4rem;
  height: 2.4rem;
  border-radius: 50%;
  background: linear-gradient(145deg, var(--sage), #6d8c81);
  color: white;
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 1.05rem;
  font-weight: 800;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.34);
}

.voice-choice-title {
  min-width: 0;
}

.voice-choice-title h4 {
  overflow: hidden;
  margin: 0;
  color: var(--ink);
  font-size: 0.94rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.voice-choice-title span {
  display: block;
  overflow: hidden;
  margin-top: 0.12rem;
  color: var(--clay);
  font-size: 0.7rem;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.voice-sample-audio {
  width: 100%;
  margin-top: 0.55rem;
}

.voice-meta-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  margin-top: 0.7rem;
}

.voice-meta-tag {
  border: 1px solid rgba(63, 102, 91, 0.14);
  border-radius: 999px;
  padding: 0.2rem 0.45rem;
  background: rgba(219, 233, 227, 0.44);
  color: var(--ink-soft);
  font-size: 0.62rem;
  font-weight: 750;
  text-transform: capitalize;
}

.voice-choice-card > p {
  display: -webkit-box;
  min-height: 2.8rem;
  overflow: hidden;
  margin: 0.65rem 0 0.75rem;
  color: var(--ink-soft);
  font-size: 0.74rem;
  line-height: 1.45;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
}

.voice-select-button {
  width: 100%;
  min-height: 2.35rem;
  margin-top: auto;
  border: 1px solid rgba(63, 102, 91, 0.24);
  border-radius: 9px;
  background: transparent;
  color: var(--sage);
  font-size: 0.75rem;
  font-weight: 900;
  cursor: pointer;
}

.voice-select-button:hover,
.voice-choice-card.is-selected .voice-select-button {
  border-color: var(--sage);
  background: var(--sage);
  color: white;
}

.voice-record-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.75rem 1rem;
  margin-top: 1rem;
}

.voice-record-actions > span {
  color: var(--ink-soft);
  font-size: 0.82rem;
}

.exercise-voice-picker {
  display: grid !important;
  gap: 0.35rem;
  min-width: min(100%, 15rem);
  margin: 0 !important;
}

.exercise-voice-picker span {
  color: var(--ink-soft);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.exercise-voice-picker select {
  width: 100%;
  min-height: 2.75rem;
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 0.62rem 2.2rem 0.62rem 0.75rem;
  background: #fffdf8;
  color: var(--ink);
  font: inherit;
  font-size: 0.86rem;
  font-weight: 700;
}

.exercise-voice-picker select:focus {
  border-color: var(--sage);
  outline: 3px solid rgba(63, 102, 91, 0.12);
}

.exercise-voice-picker select:disabled {
  cursor: not-allowed;
  opacity: 0.6;
}

.exercise-voice-picker textarea {
  width: 100%;
  min-height: 3.2rem;
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 0.62rem 0.75rem;
  background: #fffdf8;
  color: var(--ink);
  font: inherit;
  font-size: 0.86rem;
  font-weight: 600;
  resize: vertical;
  box-sizing: border-box;
}

.exercise-voice-picker textarea:focus {
  border-color: var(--sage);
  outline: 3px solid rgba(63, 102, 91, 0.12);
}

.voice-settings-current-voice {
  margin: 0.35rem 0 0;
  color: var(--sage);
  font-size: 0.74rem;
  font-weight: 800;
  line-height: 1.4;
}

.voice-settings-hint {
  margin: 0.35rem 0 0;
  color: var(--ink-soft);
  font-size: 0.7rem;
  line-height: 1.45;
}

.voice-publish-note {
  margin: 0.8rem 0 0 !important;
  border-left: 3px solid var(--gold);
  border-radius: 0 8px 8px 0;
  padding: 0.65rem 0.75rem;
  background: rgba(221, 187, 114, 0.1);
  color: var(--ink-soft);
  font-size: 0.76rem;
  line-height: 1.5 !important;
}

.voice-publish-note strong {
  color: var(--ink);
}

.voice-preview {
  width: 100%;
  margin-top: 0.8rem;
}

.voice-ambience-panel {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) minmax(13rem, 0.32fr);
  align-items: center;
  gap: 1rem;
  margin-top: 1rem;
  border: 1px solid rgba(63, 102, 91, 0.18);
  border-radius: 14px;
  padding: clamp(1rem, 2.5vw, 1.35rem);
  background:
    radial-gradient(circle at 4% 50%, rgba(219, 233, 227, 0.72), transparent 9rem),
    rgba(255, 255, 255, 0.9);
  transition: box-shadow 240ms ease;
}

.voice-ambience-panel:hover {
  box-shadow: 0 12px 34px rgba(25, 48, 51, 0.07);
}

.voice-ambience-icon {
  display: grid;
  place-items: center;
  width: 3.3rem;
  height: 3.3rem;
  border-radius: 50%;
  background: var(--sage-soft);
  color: var(--sage);
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 2rem;
  line-height: 1;
}

.voice-ambience-copy h3 {
  margin: 0 0 0.3rem;
  font-size: 1.2rem;
}

.voice-ambience-copy > p:not(.panel-label) {
  margin: 0;
  color: var(--ink-soft);
  font-size: 0.8rem;
  line-height: 1.55;
}

.voice-ambience-copy .voice-ambience-status {
  margin-top: 0.35rem !important;
  color: var(--sage) !important;
  font-weight: 800;
}

.voice-ambience-actions {
  display: grid;
  gap: 0.55rem;
}

.voice-ambience-actions button,
.voice-ambience-actions audio {
  width: 100%;
}

.voice-sleep-script-box {
  grid-column: 1 / -1;
  display: grid;
  gap: 0.55rem;
  margin-top: 0.35rem;
  border-top: 1px dashed rgba(63, 102, 91, 0.25);
  padding-top: 1rem;
}

.voice-sleep-script-head h4 {
  margin: 0 0 0.3rem;
  font-size: 1.05rem;
}

.voice-sleep-script-head p {
  margin: 0;
  color: var(--ink-soft);
  font-size: 0.8rem;
  line-height: 1.55;
}

.voice-sleep-script-head code {
  padding: 0.1rem 0.3rem;
  border-radius: 5px;
  background: rgba(63, 102, 91, 0.12);
  color: var(--sage);
  font-size: 0.75rem;
}

.voice-sleep-script-label {
  margin-top: 0.4rem;
  font-size: 0.8rem;
  font-weight: 800;
  color: var(--ink-soft);
}

#sleep-script {
  width: 100%;
  min-height: 16rem;
  padding: 0.75rem 0.9rem;
  border: 1px solid rgba(63, 102, 91, 0.3);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.92);
  color: var(--ink);
  font-family: ui-monospace, "Cascadia Mono", Consolas, monospace;
  font-size: 0.85rem;
  line-height: 1.6;
  resize: vertical;
}

#sleep-script:focus {
  border-color: var(--sage);
  box-shadow: 0 0 0 3px rgba(63, 102, 91, 0.15);
  outline: none;
}

.voice-sleep-script-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem 1rem;
  font-size: 0.78rem;
  color: var(--ink-soft);
}

.voice-sleep-script-meta .voice-sleep-script-freshness.is-stale {
  color: #b45309;
  font-weight: 800;
}

.voice-sleep-script-meta .voice-sleep-script-freshness.is-fresh {
  color: var(--sage);
  font-weight: 800;
}

.voice-custom-exercise-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
}

.voice-custom-exercise-head .secondary-button {
  align-self: flex-start;
  white-space: nowrap;
}

.voice-custom-exercise-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-top: 0.2rem;
}

.voice-custom-exercise-library {
  margin-top: 1rem;
  border-top: 1px solid rgba(63, 102, 91, 0.16);
  padding-top: 0.8rem;
}

.voice-custom-exercise-library .panel-label {
  margin-bottom: 0.45rem;
}

[data-custom-exercise-editor][hidden],
[data-custom-exercise-preview][hidden] {
  display: none !important;
}

.voice-custom-step {
  margin: 0.5rem 0 0;
  color: var(--ink-soft);
  font-size: 0.82rem;
  line-height: 1.5;
}

.voice-custom-step strong {
  color: var(--ink);
}

.voice-custom-save-actions {
  margin-top: 0.35rem;
}

.voice-custom-conversion {
  display: grid;
  gap: 0.75rem;
  margin-top: 0.65rem;
  border: 2px solid rgba(63, 102, 91, 0.28);
  border-radius: 12px;
  padding: 1rem;
  background: linear-gradient(135deg, rgba(236, 246, 242, 0.96), rgba(255, 253, 248, 0.98));
}

.voice-custom-conversion-copy h5 {
  margin: 0.15rem 0 0.3rem;
  color: var(--ink);
  font-size: 1rem;
}

.voice-custom-conversion-copy > p:last-child {
  margin: 0;
  color: var(--ink-soft);
  font-size: 0.82rem;
  line-height: 1.5;
}

.voice-custom-conversion .voice-record-actions {
  margin-top: 0;
}

.voice-custom-exercise-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  max-width: 100%;
  border: 1px solid rgba(63, 102, 91, 0.28);
  border-radius: 999px;
  padding: 0.35rem 0.8rem;
  background: rgba(255, 255, 255, 0.85);
  color: var(--ink);
  font-size: 0.78rem;
  font-weight: 700;
  cursor: pointer;
}

.voice-custom-exercise-chip:hover {
  border-color: var(--sage);
}

.voice-custom-exercise-chip[aria-pressed="true"] {
  background: var(--sage);
  border-color: var(--sage);
  color: #fff;
}

.voice-custom-exercise-chip .chip-status {
  font-weight: 800;
  color: var(--sage);
}

.voice-custom-exercise-chip[aria-pressed="true"] .chip-status {
  color: #e7f3ef;
}

.voice-custom-exercise-empty {
  font-size: 0.78rem;
  color: var(--ink-soft);
  padding: 0.2rem 0;
}

.guided-music-tracks {
  display: grid;
  gap: 0.6rem;
  max-height: 21rem;
  overflow: auto;
}

.guided-music-track {
  display: grid;
  gap: 0.55rem;
  border: 1px solid rgba(63, 102, 91, 0.16);
  border-radius: 12px;
  padding: 0.85rem;
  background: rgba(255, 255, 255, 0.86);
}

.guided-music-track-head {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.guided-music-track-title {
  display: grid;
  min-width: 0;
  margin-right: auto;
}

.guided-music-track-title strong {
  color: var(--ink);
  font-size: 0.88rem;
  line-height: 1.3;
}

.guided-music-track-title span {
  color: var(--ink-soft);
  font-size: 0.72rem;
}

.guided-music-in-use {
  flex: 0 0 auto;
  border-radius: 999px;
  padding: 0.28rem 0.6rem;
  background: var(--sage-soft);
  color: var(--sage);
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.guided-music-play {
  flex: 0 0 auto;
  white-space: nowrap;
}

.guided-music-track .guided-music-preview-audio {
  width: 100%;
}

.guided-music-applied-audio {
  flex: 1 1 16rem;
  min-width: 12rem;
}

.guided-music-volume {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 0.55rem;
  color: var(--ink-soft);
  font-size: 0.74rem;
}

.guided-music-volume input[type="range"] {
  width: 100%;
  accent-color: var(--sage);
}

.guided-music-volume output {
  min-width: 2.6rem;
  color: var(--ink);
  font-size: 0.74rem;
  font-weight: 800;
  text-align: right;
}

.guided-music-track-actions {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.5rem;
}

.guided-music-url {
  width: 100%;
  box-sizing: border-box;
}

.guided-music-applied-preview {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-wrap: wrap;
  margin-top: 0.5rem;
}

.guided-music-applied-preview[hidden] {
  display: none;
}

.guided-music-applied-preview .form-message {
  margin: 0;
}

.voice-cost-note {
  display: grid;
  grid-template-columns: minmax(10rem, 0.28fr) minmax(0, 1fr);
  gap: 1rem;
  margin-top: 1rem;
  border-left: 4px solid var(--gold);
  border-radius: 0 10px 10px 0;
  padding: 1rem 1.1rem;
  background: #fff8e7;
}

.voice-cost-note p {
  margin: 0;
  color: var(--ink-soft);
  line-height: 1.6;
}

@media (max-width: 820px) {
  .voice-studio-grid,
  .voice-cost-note,
  .voice-ambience-panel {
    grid-template-columns: 1fr;
  }

  .voice-ambience-icon {
    display: none;
  }
}

@media (max-width: 620px) {
  .voice-manager .manager-heading,
  .voice-field-row {
    display: grid;
    grid-template-columns: 1fr;
  }

  .voice-field-row button,
  .voice-record-actions .primary-button {
    width: 100%;
  }

  .voice-gallery-toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .voice-gallery-toolbar button {
    width: 100%;
  }

  .voice-choice-grid {
    grid-template-columns: 1fr;
    max-height: 34rem;
  }
}

/* Compact, paged product library */
.product-library-heading {
  align-items: end;
}

.product-library-tools {
  display: grid;
  grid-template-columns: minmax(12rem, 1fr) auto auto;
  align-items: end;
  gap: 0.55rem;
  width: min(100%, 34rem);
}

.product-library-search {
  position: relative;
  display: block;
}

.product-library-search svg {
  position: absolute;
  top: 50%;
  left: 0.75rem;
  width: 1rem;
  height: 1rem;
  fill: none;
  stroke: var(--ink-soft);
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
  transform: translateY(-50%);
  pointer-events: none;
}

.product-library-search input,
.product-library-filter select {
  width: 100%;
  min-height: 2.55rem;
  border: 1px solid var(--line-strong);
  border-radius: 0.75rem;
  background: rgba(255, 255, 255, 0.96);
  color: var(--ink);
  font: inherit;
  font-size: 0.82rem;
}

.product-library-search input {
  padding: 0.58rem 0.75rem 0.58rem 2.25rem;
}

.product-library-filter {
  display: grid;
  gap: 0.2rem;
}

.product-library-filter > span {
  color: var(--ink-soft);
  font-size: 0.64rem;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.product-library-filter select {
  min-width: 8.5rem;
  padding: 0.5rem 2rem 0.5rem 0.7rem;
}

.product-library-search input:focus,
.product-library-filter select:focus {
  border-color: var(--sage);
  box-shadow: 0 0 0 3px rgba(63, 102, 91, 0.13);
  outline: none;
}

.product-actions-help {
  position: relative;
  display: grid;
  width: 2.55rem;
  height: 2.55rem;
  place-items: center;
  border: 1px solid rgba(63, 102, 91, 0.2);
  border-radius: 50%;
  background: var(--sage-soft);
  color: var(--sage-dark);
  cursor: help;
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 1rem;
  font-weight: 800;
}

.product-admin-list {
  max-height: none;
  overflow: visible;
  padding: 0.55rem;
  gap: 0.48rem;
}

.product-admin-item {
  grid-template-columns: 2rem 64px minmax(0, 1fr) 9.6rem;
  gap: 0.7rem;
  min-height: 5.2rem;
  border-radius: 0.9rem;
  padding: 0.52rem 0.6rem;
  scroll-margin-block: 1rem;
  transition: border-color 160ms ease, box-shadow 160ms ease;
}

.product-admin-item:hover {
  border-color: rgba(63, 102, 91, 0.3);
  box-shadow: 0 7px 20px rgba(25, 48, 51, 0.06);
  transform: none;
}

.product-selector {
  width: 2rem;
  min-height: 3.8rem;
}

.product-admin-image {
  width: 64px;
  border-radius: 0.7rem;
}

.product-admin-copy {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 0.2rem 0.55rem;
}

.product-admin-copy h4 {
  min-width: 0;
  overflow: hidden;
  margin: 0;
  font-size: 0.94rem;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.product-admin-copy > p {
  grid-column: 1 / -1;
  overflow: hidden;
  margin: 0;
  font-size: 0.75rem;
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: nowrap;
  -webkit-line-clamp: unset;
}

.product-status {
  padding: 0.22rem 0.45rem;
  font-size: 0.6rem;
}

.product-admin-meta {
  grid-column: 1 / -1;
  gap: 0.25rem 0.6rem;
  overflow: hidden;
  font-size: 0.68rem;
  white-space: nowrap;
}

.product-admin-actions {
  display: grid;
  grid-template-columns: repeat(4, 2.15rem);
  align-content: center;
  justify-content: end;
  min-width: 9.6rem;
  gap: 0.35rem;
}

.product-icon-action {
  position: relative;
  display: grid;
  width: 2.15rem;
  height: 2.15rem;
  place-items: center;
  border: 1px solid rgba(63, 102, 91, 0.2);
  border-radius: 0.65rem;
  padding: 0;
  background: #fff;
  color: var(--sage-dark);
  cursor: pointer;
  text-decoration: none;
  transition: border-color 150ms ease, background 150ms ease, box-shadow 150ms ease, color 150ms ease, transform 150ms ease;
}

.product-icon-action svg {
  width: 1.05rem;
  height: 1.05rem;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

.product-icon-action:hover:not(:disabled),
.product-icon-action:focus-visible {
  border-color: var(--sage);
  background: var(--sage-soft);
  box-shadow: 0 5px 14px rgba(25, 48, 51, 0.12);
  color: var(--sage-dark);
  outline: none;
  transform: translateY(-1px);
}

.product-icon-action.is-active {
  border-color: var(--sage);
  background: var(--sage);
  color: #fff;
}

.product-icon-action.is-danger {
  border-color: rgba(178, 59, 59, 0.2);
  color: #a63d3d;
}

.product-icon-action.is-danger:hover,
.product-icon-action.is-danger:focus-visible {
  border-color: #b23b3b;
  background: #fbe4e4;
  color: #8e2e2e;
}

.product-icon-action:disabled {
  cursor: not-allowed;
  opacity: 0.38;
}

.product-icon-action.is-loading svg {
  animation: product-action-spin 900ms linear infinite;
}

@keyframes product-action-spin {
  to { transform: rotate(360deg); }
}

.product-icon-action[data-tooltip]::after,
.product-actions-help[data-tooltip]::after {
  position: absolute;
  right: 0;
  bottom: calc(100% + 0.42rem);
  z-index: 30;
  width: max-content;
  max-width: min(15rem, 65vw);
  border-radius: 0.5rem;
  padding: 0.42rem 0.58rem;
  background: var(--ink);
  color: #fff;
  box-shadow: 0 6px 18px rgba(25, 48, 51, 0.18);
  content: attr(data-tooltip);
  font-family: inherit;
  font-size: 0.7rem;
  font-weight: 700;
  line-height: 1.3;
  opacity: 0;
  pointer-events: none;
  text-align: left;
  transform: translateY(0.2rem);
  transition: opacity 120ms ease, transform 120ms ease;
  white-space: normal;
}

.product-icon-action[data-tooltip]:hover::after,
.product-icon-action[data-tooltip]:focus-visible::after,
.product-actions-help[data-tooltip]:hover::after,
.product-actions-help[data-tooltip]:focus-visible::after {
  opacity: 1;
  transform: translateY(0);
}

.product-edit-form {
  grid-column: 3 / -1;
  margin-top: 0.35rem;
}

.product-filter-empty {
  min-height: 9rem;
}

.product-library-pagination {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 0.75rem;
  margin-top: 0.75rem;
}

.product-library-pagination[hidden] {
  display: none;
}

.product-library-pagination button {
  min-width: 7.2rem;
  margin: 0;
  padding: 0.58rem 0.8rem;
}

.product-library-pagination > span {
  color: var(--ink-soft);
  font-size: 0.76rem;
  font-weight: 800;
  text-align: center;
}

@media (max-width: 900px) {
  .product-library-heading {
    align-items: stretch;
    flex-direction: column;
  }

  .product-library-tools {
    width: 100%;
  }

  .product-admin-item {
    grid-template-columns: 2rem 58px minmax(0, 1fr);
  }

  .product-admin-image {
    width: 58px;
  }

  .product-admin-actions {
    grid-column: 2 / -1;
    grid-template-columns: repeat(7, 2.15rem);
    justify-content: start;
    min-width: 0;
  }

  .product-edit-form {
    grid-column: 2 / -1;
  }
}

@media (max-width: 620px) {
  .product-library-tools {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .product-library-search {
    grid-column: 1 / -1;
  }

  .product-library-filter select {
    min-width: 0;
  }

  .product-admin-list {
    max-height: none;
    padding: 0.38rem;
  }

  .product-admin-item {
    grid-template-columns: 1.7rem 48px minmax(0, 1fr);
    gap: 0.5rem;
    min-height: 0;
    padding: 0.5rem;
  }

  .product-selector {
    grid-row: 1;
    width: 1.7rem;
    min-height: 3rem;
    height: auto;
  }

  .product-admin-image {
    grid-column: 2;
    width: 48px;
  }

  .product-admin-copy {
    grid-column: 3;
  }

  .product-admin-copy > p {
    display: none;
  }

  .product-admin-meta span:nth-child(n + 4) {
    display: none;
  }

  .product-admin-actions {
    grid-column: 2 / -1;
    grid-template-columns: repeat(7, minmax(2.15rem, 1fr));
    width: 100%;
  }

  .product-admin-actions > * {
    width: 100%;
  }

  .product-edit-form {
    grid-column: 1 / -1;
  }

  .product-library-pagination {
    grid-template-columns: 1fr 1fr;
  }

  .product-library-pagination > span {
    grid-column: 1 / -1;
    grid-row: 1;
  }

  .product-library-pagination button {
    min-width: 0;
    width: 100%;
  }
}

@media (prefers-reduced-motion: reduce) {
  .product-icon-action {
    transition: none;
  }
}

* {
  box-sizing: border-box;
}

body {
  min-height: 100vh;
  margin: 0;
  background:
    radial-gradient(circle at top left, rgba(139, 169, 154, 0.28), transparent 34rem),
    linear-gradient(135deg, var(--paper), #edf4f2);
  color: var(--ink);
}

button,
input,
textarea {
  font: inherit;
}

.admin-shell {
  min-height: 100vh;
}

.login-panel {
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 1.25rem;
}

.back-link {
  position: fixed;
  top: 1.25rem;
  left: 1.25rem;
  color: var(--sage);
  font-weight: 800;
  text-decoration: none;
}

.login-card {
  width: min(400px, 100%);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: clamp(1.25rem, 3vw, 1.75rem);
  background: rgba(255, 250, 241, 0.92);
  box-shadow: var(--shadow);
  backdrop-filter: blur(16px);
}

.admin-mark {
  position: relative;
  display: inline-grid;
  width: 2.6rem;
  height: 2.6rem;
  margin-bottom: 0.75rem;
  place-items: center;
  border-radius: 50%;
  border: 2px solid var(--panel);
  background: var(--sage);
  color: var(--ink);
  box-shadow: 0 12px 24px rgba(25, 48, 51, 0.14);
}

.admin-mark::before {
  content: "";
  position: absolute;
  inset: 0.18rem;
  border: 1px solid rgba(255, 250, 241, 0.55);
  border-radius: 50%;
  pointer-events: none;
}

.admin-mark::after {
  content: "";
  position: absolute;
  z-index: 1;
  width: 0.16rem;
  height: 2.2rem;
  background: linear-gradient(180deg, var(--clay) 0 50%, var(--sage-soft) 50% 100%);
  clip-path: polygon(50% 0, 100% 39%, 68% 50%, 100% 61%, 50% 100%, 0 61%, 32% 50%, 0 39%);
}

.compass-ring {
  position: absolute;
  z-index: 1;
  width: 2.2rem;
  height: 0.16rem;
  background: rgba(255, 250, 241, 0.82);
  clip-path: polygon(0 50%, 39% 0, 50% 32%, 61% 0, 100% 50%, 61% 100%, 50% 68%, 39% 100%);
}

.compass-needle {
  position: absolute;
  z-index: 2;
  width: 0.56rem;
  height: 2.1rem;
  background: linear-gradient(180deg, var(--clay) 0 48%, var(--sage-soft) 52% 100%);
  clip-path: polygon(50% 0, 84% 48%, 50% 100%, 16% 48%);
  filter: drop-shadow(0 2px 2px rgba(25, 48, 51, 0.2));
}

.compass-core {
  position: relative;
  z-index: 3;
  display: grid;
  width: 1.3rem;
  height: 1.3rem;
  place-items: center;
  border-radius: 50%;
  background: var(--panel);
  color: var(--sage);
  font-size: 0.42rem;
  font-weight: 800;
  line-height: 1;
  box-shadow: 0 0 0 2px var(--sage), 0 2px 5px rgba(25, 48, 51, 0.2);
}

.eyebrow {
  margin: 0 0 0.65rem;
  color: var(--clay);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

.login-card .eyebrow {
  margin-bottom: 0.35rem;
  font-size: 0.7rem;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0.9rem;
  font-size: clamp(2.1rem, 6vw, 3.8rem);
  line-height: 1.02;
  letter-spacing: 0;
}

.intro,
.admin-card p,
.admin-note p {
  color: var(--ink-soft);
}

.login-card h1 {
  margin-bottom: 0.6rem;
  font-size: clamp(1.4rem, 4vw, 1.8rem);
  line-height: 1.15;
  letter-spacing: -0.01em;
}

.login-card .intro {
  font-size: 0.85rem;
  line-height: 1.5;
}

.login-form {
  display: grid;
  gap: 0.5rem;
  margin-top: 1.2rem;
}

.login-form label {
  color: var(--ink);
  font-weight: 800;
}

.password-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.6rem;
}

.password-row input {
  min-height: 2.5rem;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.55rem 0.75rem;
  background: var(--white);
  color: var(--ink);
}

.password-row input:focus {
  border-color: var(--sage);
  box-shadow: 0 0 0 4px rgba(63, 102, 91, 0.13);
  outline: none;
}

.primary-button,
.secondary-button,
.ghost-button,
.danger-button {
  min-height: 3rem;
  border: 0;
  border-radius: 999px;
  padding: 0.78rem 1rem;
  font-weight: 800;
  cursor: pointer;
  text-align: center;
  text-decoration: none;
}

.primary-button {
  margin-top: 0.5rem;
  background: var(--sage);
  color: var(--white);
}

.login-form .primary-button,
.login-form .ghost-button {
  min-height: 2.5rem;
  padding: 0.55rem 0.85rem;
}

.login-form .primary-button {
  margin-top: 0.3rem;
}

.secondary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  background: var(--white);
  color: var(--sage);
}

.ghost-button {
  background: var(--sage-soft);
  color: var(--sage);
}

.danger-button {
  background: #f3ded8;
  color: #9c3d2e;
}

.error-message {
  min-height: 1rem;
  margin: 0;
  color: #a54134;
  font-size: 0.8rem;
  font-weight: 700;
}

.dashboard {
  width: min(1180px, calc(100% - 2rem));
  margin: 0 auto;
  padding: clamp(1.2rem, 4vw, 3rem) 0 4rem;
}

.dashboard-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.2rem 0 2rem;
}

.dashboard-header h1 {
  margin-bottom: 0;
}

.dashboard-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
}

.admin-card,
.admin-note {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.82);
  box-shadow: 0 16px 42px rgba(25, 48, 51, 0.08);
}

.admin-card {
  min-height: 220px;
  padding: 1.25rem;
}

.admin-contact-details {
  margin-top: 1rem;
  padding: clamp(1.25rem, 3vw, 2rem);
  border: 1px solid var(--line);
  border-radius: 12px;
  background: linear-gradient(135deg, rgba(255, 250, 241, 0.98), rgba(255, 255, 255, 0.94));
  box-shadow: 0 18px 48px rgba(25, 48, 51, 0.09);
}

.admin-contact-heading,
.admin-contact-item-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
}

.admin-contact-heading h2 {
  margin: 0 0 0.4rem;
  color: var(--ink);
  font-size: clamp(1.35rem, 3vw, 1.8rem);
}

.admin-contact-heading p:not(.eyebrow) {
  margin: 0;
  color: var(--ink-soft);
}

.admin-contact-count {
  flex: 0 0 auto;
  padding: 0.45rem 0.8rem;
  border: 1px solid rgba(63, 102, 91, 0.18);
  border-radius: 999px;
  background: rgba(184, 206, 194, 0.25);
  color: var(--sage-deep);
  font-size: 0.82rem;
  font-weight: 700;
}

.admin-contact-list {
  display: grid;
  gap: 0.75rem;
  margin-top: 1.35rem;
}

.admin-contact-item {
  padding: 1rem 1.15rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.82);
}

.admin-contact-item h3 {
  margin: 0 0 0.2rem;
  color: var(--ink);
  font-size: 1rem;
}

.admin-contact-item a {
  color: var(--sage-deep);
  overflow-wrap: anywhere;
}

.admin-contact-item time {
  color: var(--ink-soft);
  font-size: 0.8rem;
  white-space: nowrap;
}

.admin-contact-item-actions {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 0.75rem;
}

.admin-contact-delete {
  min-height: 2.25rem;
  padding: 0.45rem 0.8rem;
  font-size: 0.8rem;
}

.admin-contact-item > p {
  margin: 0.9rem 0 0;
  color: var(--ink-soft);
  line-height: 1.65;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.admin-contact-empty {
  margin: 0;
  padding: 1.2rem;
  border: 1px dashed rgba(25, 48, 51, 0.2);
  border-radius: 10px;
  color: var(--ink-soft);
  text-align: center;
}

@media (max-width: 620px) {
  .admin-contact-heading,
  .admin-contact-item-heading {
    flex-direction: column;
  }

  .admin-contact-item time {
    white-space: normal;
  }

  .admin-contact-item-actions {
    width: 100%;
    justify-content: space-between;
  }
}

.admin-card span {
  display: inline-flex;
  margin-bottom: 2.8rem;
  color: var(--clay);
  font-size: 1.5rem;
  font-weight: 800;
}

.admin-card h2,
.admin-note h2 {
  margin-bottom: 0.45rem;
  font-size: 1.25rem;
}

.card-value {
  display: block;
  margin: 0.9rem 0 0.35rem;
  color: var(--sage);
  font-size: 1.05rem;
}

.admin-note {
  margin-top: 1rem;
  padding: 1.4rem;
}

.sales-manager,
.bookshop-manager,
.charity-manager {
  margin-top: 1rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: clamp(1.1rem, 3vw, 1.6rem);
  background: rgba(255, 250, 241, 0.9);
  box-shadow: 0 18px 48px rgba(25, 48, 51, 0.1);
}

.sales-manager {
  margin-top: 1.4rem;
}

.bookshop-manager {
  margin-top: 1.4rem;
}

.manager-heading {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.2rem;
}

.manager-heading h2 {
  margin-bottom: 0.35rem;
  font-size: clamp(1.65rem, 4vw, 2.4rem);
}

.manager-heading p {
  max-width: 720px;
  margin-bottom: 0;
  color: var(--ink-soft);
}

.manager-actions,
.catalogue-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
}

.sales-truth-banner {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1px;
  margin-bottom: 1rem;
  overflow: hidden;
  border: 1px solid rgba(63, 102, 91, 0.18);
  border-radius: 8px;
  background: rgba(63, 102, 91, 0.18);
}

.sales-truth-banner > div {
  padding: 1rem;
  background: linear-gradient(145deg, rgba(219, 233, 227, 0.82), rgba(255, 255, 255, 0.94));
}

.sales-truth-banner strong {
  display: block;
  margin-bottom: 0.2rem;
}

.sales-truth-banner p {
  margin: 0;
  color: var(--ink-soft);
}

.sales-kpi-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.sales-kpi {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 1rem;
  background: var(--white);
}

.sales-kpi > span {
  display: inline-flex;
  margin-bottom: 1rem;
  border-radius: 999px;
  padding: 0.25rem 0.5rem;
  background: var(--sage-soft);
  color: var(--sage);
  font-size: 0.66rem;
  font-weight: 800;
  text-transform: uppercase;
}

.sales-kpi strong {
  display: block;
  color: var(--ink);
  font-size: clamp(1.35rem, 3vw, 2rem);
  line-height: 1;
  overflow-wrap: anywhere;
}

.sales-kpi p {
  margin: 0.4rem 0 0;
  color: var(--ink-soft);
}

.sales-entry-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(300px, 0.75fr);
  gap: 1rem;
}

.record-panel,
.activity-panel {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: clamp(1rem, 3vw, 1.4rem);
  background: var(--white);
}

.record-panel h3,
.activity-panel h3 {
  margin: 0 0 0.4rem;
  font-size: 1.35rem;
}

.sales-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.8rem 1rem;
  margin-top: 1rem;
}

.sales-form label:not(.check-row) {
  display: block;
  margin-bottom: 0.4rem;
  color: var(--ink);
  font-weight: 800;
}

.sales-form label small {
  color: var(--ink-soft);
  font-weight: 500;
}

.sales-form input:not([type="checkbox"]),
.sales-form select,
.sales-form textarea {
  width: 100%;
  min-height: 2.9rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.75rem 0.85rem;
  background: #fffdf8;
  color: var(--ink);
  font: inherit;
}

.sales-form textarea {
  resize: vertical;
}

.sales-form input:focus,
.sales-form select:focus,
.sales-form textarea:focus {
  border-color: var(--sage);
  box-shadow: 0 0 0 4px rgba(63, 102, 91, 0.13);
  outline: none;
}

.privacy-warning {
  margin-top: 1rem;
  border-left: 4px solid var(--clay);
  border-radius: 0 8px 8px 0;
  padding: 0.8rem 0.9rem;
  background: #fff3ef;
}

.privacy-warning p {
  margin: 0.2rem 0 0;
  color: var(--ink-soft);
  font-size: 0.86rem;
}

.sales-ledger-grid {
  display: grid;
  grid-template-columns: minmax(260px, 0.75fr) minmax(0, 1.25fr);
  gap: 1rem;
  margin-top: 1rem;
}

.sales-ledger-grid .activity-panel:last-child {
  grid-column: 1 / -1;
}

.activity-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
}

.activity-explainer {
  margin: 0 0 0.8rem;
  color: var(--ink-soft);
  font-size: 0.88rem;
}

.activity-list {
  display: grid;
  gap: 0.65rem;
}

.activity-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.75rem;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.8rem;
  background: #fffdf8;
}

.activity-row h4 {
  margin: 0 0 0.2rem;
  font-size: 0.98rem;
}

.activity-row p {
  margin: 0;
  color: var(--ink-soft);
  font-size: 0.82rem;
}

.activity-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 0.75rem;
  margin-top: 0.35rem;
  color: var(--ink-soft);
  font-size: 0.76rem;
}

.activity-amounts {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 0.45rem;
}

.amount-pill {
  display: inline-flex;
  border-radius: 999px;
  padding: 0.25rem 0.5rem;
  background: var(--sage-soft);
  color: var(--sage);
  font-size: 0.74rem;
  font-weight: 800;
}

.amount-pill.is-return {
  background: #f3ded8;
  color: #9c3d2e;
}

.activity-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 0.4rem;
}

.activity-actions button {
  min-height: 2.35rem;
  padding: 0.5rem 0.7rem;
  font-size: 0.75rem;
}

.activity-empty {
  border: 1px dashed var(--line);
  border-radius: 8px;
  padding: 1.5rem;
  color: var(--ink-soft);
  text-align: center;
  background: rgba(255, 255, 255, 0.5);
}

.activity-empty strong {
  display: block;
  margin-bottom: 0.25rem;
  color: var(--ink);
}

.shop-status-panel {
  display: grid;
  grid-template-columns: minmax(240px, 0.72fr) minmax(0, 1.28fr);
  gap: 1.25rem;
  margin-bottom: 1rem;
  border: 1px solid rgba(63, 102, 91, 0.18);
  border-radius: 8px;
  padding: clamp(1rem, 3vw, 1.5rem);
  background: linear-gradient(145deg, rgba(219, 233, 227, 0.78), rgba(255, 255, 255, 0.9));
}

.shop-status-copy {
  align-self: center;
}

.shop-status-copy h3 {
  margin: 0.8rem 0 0.45rem;
  font-size: clamp(1.35rem, 3vw, 2rem);
  line-height: 1.15;
}

.shop-status-copy p,
.panel-intro,
.sales-panel > p,
.catalogue-heading p {
  margin-bottom: 0;
  color: var(--ink-soft);
}

.status-badge,
.book-status {
  display: inline-flex;
  align-items: center;
  width: max-content;
  border-radius: 999px;
  padding: 0.35rem 0.65rem;
  background: #f5e5bc;
  color: #725314;
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
}

.status-badge.is-ready,
.book-status.is-live {
  background: var(--sage-soft);
  color: var(--sage);
}

.status-badge.is-attention,
.book-status.is-attention {
  background: #f5e5bc;
  color: #725314;
}

.book-status.is-draft {
  background: #e8eceb;
  color: #526466;
}

.setup-checklist {
  display: grid;
  gap: 0.65rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.setup-checklist li {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 0.75rem;
  align-items: start;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.7rem;
  background: rgba(255, 255, 255, 0.72);
}

.setup-checklist li > span {
  display: grid;
  width: 1.9rem;
  height: 1.9rem;
  place-items: center;
  border-radius: 50%;
  background: #e8eceb;
  color: var(--ink-soft);
  font-size: 0.78rem;
  font-weight: 800;
}

.setup-checklist li.is-complete > span {
  background: var(--sage);
  color: white;
}

.setup-checklist li.is-complete > span::before {
  content: "✓";
}

.setup-checklist li.is-complete > span {
  font-size: 0;
}

.setup-checklist li.is-complete > span::before {
  font-size: 0.82rem;
}

.setup-checklist strong,
.setup-checklist small {
  display: block;
}

.setup-checklist small {
  margin-top: 0.15rem;
  color: var(--ink-soft);
}

.bookshop-setup-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
}

.settings-panel,
.sales-panel,
.book-import-panel,
.catalogue-manager,
.book-list-section {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: clamp(1rem, 3vw, 1.4rem);
  background: var(--white);
}

.settings-panel,
.sales-panel {
  min-width: 0;
}

.settings-panel h3,
.sales-panel h3,
.catalogue-heading h3 {
  margin: 0 0 0.45rem;
  font-size: 1.35rem;
}

.panel-label {
  margin: 0 0 0.35rem;
  color: var(--clay);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.settings-panel > label:not(.check-row),
.book-form label:not(.check-row) {
  display: block;
  margin: 1rem 0 0.45rem;
  color: var(--ink);
  font-weight: 800;
}

.settings-panel input[type="text"],
.book-form input[type="text"],
.book-form input[type="url"],
.book-form textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.85rem 0.95rem;
  background: #fffdf8;
  color: var(--ink);
}

.book-form textarea {
  resize: vertical;
}

.settings-panel input:focus,
.book-form input:focus,
.book-form textarea:focus {
  border-color: var(--sage);
  box-shadow: 0 0 0 4px rgba(63, 102, 91, 0.13);
  outline: none;
}

.field-help,
.field-status {
  display: block;
  margin-top: 0.4rem;
  color: var(--ink-soft);
  font-size: 0.8rem;
}

.field-status.is-valid {
  color: var(--sage);
  font-weight: 800;
}

.field-status.is-error {
  color: #a54134;
  font-weight: 800;
}

.field-help-row {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  margin-top: 0.4rem;
  color: var(--ink-soft);
}

.check-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 0.7rem;
  align-items: start;
  margin-top: 1rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.8rem;
  background: #fffdf8;
  cursor: pointer;
}

.check-row input {
  width: 1.1rem;
  height: 1.1rem;
  margin: 0.2rem 0 0;
  accent-color: var(--sage);
}

.check-row strong,
.check-row small {
  display: block;
}

.check-row small {
  margin-top: 0.15rem;
  color: var(--ink-soft);
}

.form-message {
  min-height: 1.5rem;
  margin: 0.85rem 0 0;
  font-size: 0.88rem;
  font-weight: 800;
}

.form-message.is-error {
  color: #a54134;
}

.form-message.is-success {
  color: var(--sage);
}

.external-data-note {
  margin: 1rem 0;
  border-left: 4px solid var(--gold);
  border-radius: 0 8px 8px 0;
  padding: 0.9rem 1rem;
  background: #fff8e7;
}

.external-data-note p {
  margin: 0.25rem 0 0;
  color: var(--ink-soft);
  font-size: 0.9rem;
}

.external-dashboard-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
}

.catalogue-manager,
.book-import-panel,
.book-list-section {
  margin-top: 1rem;
}

.book-import-panel {
  background:
    radial-gradient(circle at 100% 0, rgba(221, 187, 114, 0.18), transparent 16rem),
    rgba(255, 255, 255, 0.96);
}

.book-import-panel .catalogue-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
}

.book-import-panel .catalogue-heading p:last-child {
  max-width: 68ch;
}

.book-import-draft-badge {
  flex: 0 0 auto;
  border: 1px solid rgba(63, 102, 91, 0.2);
  border-radius: 999px;
  padding: 0.45rem 0.7rem;
  background: var(--sage-soft);
  color: var(--sage);
  font-size: 0.72rem;
  font-weight: 800;
}

.book-import-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.85rem;
  margin-top: 1rem;
}

.book-import-form {
  display: grid;
  align-content: start;
  gap: 0.65rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  padding: 1rem;
  background: #fffdf8;
}

.book-import-form label {
  color: var(--ink);
  font-weight: 800;
}

.book-import-form input {
  width: 100%;
  min-height: 3rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-control);
  padding: 0.78rem 0.9rem;
  background: white;
  color: var(--ink);
}

.book-import-form input:focus {
  border-color: var(--sage);
  box-shadow: 0 0 0 4px rgba(63, 102, 91, 0.13);
  outline: none;
}

.book-import-form small {
  color: var(--ink-soft);
  line-height: 1.45;
}

.book-import-control {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.6rem;
}

.book-saved-page-fields {
  display: grid;
  gap: 0.6rem;
}

.book-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
  margin-top: 1rem;
  border-top: 1px solid var(--line);
  padding-top: 0.3rem;
}

.link-test-panel {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  border: 1px solid rgba(63, 102, 91, 0.18);
  border-radius: 8px;
  padding: 0.9rem;
  background: var(--sage-soft);
}

.link-test-panel code {
  display: block;
  margin-top: 0.3rem;
  color: var(--sage);
  font-size: 0.78rem;
  overflow-wrap: anywhere;
}

.book-admin-list {
  display: grid;
  gap: 0.8rem;
  margin-top: 1rem;
}

.book-admin-item {
  display: grid;
  grid-template-columns: 82px minmax(0, 1fr) auto;
  gap: 1rem;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.85rem;
  background: #fffdf8;
}

.book-admin-cover {
  display: grid;
  width: 82px;
  aspect-ratio: 2 / 3;
  place-items: center;
  overflow: hidden;
  border-radius: 5px;
  background: linear-gradient(145deg, var(--sage-soft), #f5e6cf);
  color: var(--sage);
  font-size: 0.68rem;
  font-weight: 800;
  text-align: center;
}

.book-admin-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.book-admin-copy {
  min-width: 0;
}

.book-admin-copy h4 {
  margin: 0.45rem 0 0.2rem;
  font-size: 1.08rem;
}

.book-admin-copy p {
  margin: 0;
  color: var(--ink-soft);
}

.book-admin-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem 0.9rem;
  margin-top: 0.45rem;
  color: var(--ink-soft);
  font-size: 0.78rem;
}

.book-link-status {
  color: #8a6215;
  font-weight: 800;
}

.book-link-status.is-checked {
  color: var(--sage);
}

.book-admin-actions {
  display: grid;
  grid-template-columns: repeat(2, auto);
  gap: 0.45rem;
}

.book-admin-actions button,
.book-admin-actions a {
  min-height: 2.5rem;
  padding: 0.55rem 0.75rem;
  font-size: 0.78rem;
}

.empty-state {
  text-align: left;
}

.charity-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
  padding: 1rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--white);
}

.charity-research-actions {
  flex: 0 0 min(100%, 230px);
  text-align: right;
}

.charity-research-actions .primary-button {
  width: 100%;
}

.charity-research-actions .form-message {
  min-height: 0;
  margin-top: 0.55rem;
  line-height: 1.35;
}

.charity-research-note {
  margin: 0 0 1rem;
  border: 1px solid rgba(63, 102, 91, 0.2);
  border-radius: 8px;
  padding: 0.9rem 1rem;
  background: linear-gradient(135deg, rgba(219, 233, 227, 0.72), rgba(255, 255, 255, 0.92));
}

.charity-research-note strong {
  display: block;
  margin-bottom: 0.2rem;
}

.charity-research-note p {
  margin: 0;
  color: var(--ink-soft);
  font-size: 0.9rem;
}

.charity-name-research-form {
  margin-top: 0.9rem;
  border-top: 1px solid rgba(63, 102, 91, 0.18);
  padding-top: 0.9rem;
}

.charity-name-research-form label {
  display: block;
  margin-bottom: 0.45rem;
  color: var(--ink);
  font-weight: 800;
}

.charity-name-research-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.65rem;
}

.charity-name-research-row input {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.8rem 0.9rem;
  background: #fffdf8;
  color: var(--ink);
}

.charity-name-research-row input:focus {
  border-color: var(--sage);
  box-shadow: 0 0 0 4px rgba(63, 102, 91, 0.13);
  outline: none;
}

.charity-name-research-form .form-message {
  min-height: 0;
  margin-top: 0.55rem;
}

.charity-research-dialog {
  width: min(760px, calc(100vw - 2rem));
  max-height: calc(100vh - 2rem);
  overflow: auto;
  border: 0;
  border-radius: 18px;
  padding: 0;
  background: transparent;
  color: var(--ink);
  box-shadow: 0 32px 90px rgba(22, 43, 43, 0.32);
}

.charity-research-dialog::backdrop {
  background: rgba(20, 38, 40, 0.68);
  backdrop-filter: blur(7px);
  animation: dialog-backdrop-in 200ms ease both;
}

@keyframes dialog-backdrop-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

.charity-research-dialog-content {
  position: relative;
  padding: clamp(1.35rem, 4vw, 2.25rem);
  background:
    radial-gradient(circle at 100% 0%, rgba(217, 235, 226, 0.95), transparent 38%),
    linear-gradient(155deg, #fffdf8 0%, #f7fbf8 100%);
  animation: dialog-content-in 250ms ease both;
}

@keyframes dialog-content-in {
  from {
    opacity: 0;
    transform: scale(0.97) translateY(0.5rem);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

.charity-preview-kicker {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.8rem;
  color: var(--sage);
  font-size: 0.78rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.charity-preview-kicker span {
  display: grid;
  width: 1.65rem;
  height: 1.65rem;
  place-items: center;
  border-radius: 50%;
  background: var(--sage);
  color: white;
}

.charity-research-dialog h2 {
  max-width: 620px;
  margin: 0 2.5rem 0.55rem 0;
  font-size: clamp(1.65rem, 4vw, 2.4rem);
  line-height: 1.08;
}

.charity-preview-description {
  max-width: 660px;
  margin: 0 0 0.7rem;
  color: var(--ink-soft);
  line-height: 1.65;
}

.charity-preview-website {
  display: inline-block;
  margin-bottom: 1.2rem;
  color: var(--sage);
  font-weight: 850;
  overflow-wrap: anywhere;
}

.charity-preview-summary {
  margin-bottom: 0.75rem;
  border-left: 4px solid var(--gold);
  border-radius: 0 8px 8px 0;
  padding: 0.75rem 0.9rem;
  background: #fff7df;
  color: #725822;
  font-size: 0.88rem;
  font-weight: 750;
}

.charity-preview-offerings {
  display: grid;
  gap: 0.75rem;
}

.charity-preview-offering {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 0.75rem;
  border: 1px solid rgba(63, 102, 91, 0.16);
  border-radius: 12px;
  padding: 0.95rem;
  background: rgba(255, 255, 255, 0.86);
}

.charity-preview-offering-mark {
  display: grid;
  width: 2.5rem;
  height: 2.5rem;
  place-items: center;
  border-radius: 10px;
  background: #e2eee8;
  color: var(--sage);
  font-weight: 900;
}

.charity-preview-offering-type {
  display: block;
  margin-bottom: 0.15rem;
  color: var(--sage);
  font-size: 0.72rem;
  font-weight: 900;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.charity-preview-offering strong,
.charity-preview-offering p {
  display: block;
}

.charity-preview-offering p {
  margin: 0.3rem 0 0;
  line-height: 1.5;
}

.charity-preview-offering-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 0.65rem;
  margin-top: 0.55rem;
  color: var(--ink-soft);
  font-size: 0.82rem;
}

.charity-preview-question {
  margin-top: 1rem;
  border-radius: 12px;
  padding: 0.95rem 1rem;
  background: #e8f1ec;
}

.charity-preview-question p {
  margin: 0.25rem 0 0;
  color: var(--ink-soft);
  font-size: 0.86rem;
}

.charity-preview-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  margin-top: 0.85rem;
}

@media (max-width: 700px) {
  .charity-research-actions {
    flex-basis: 100%;
    text-align: left;
  }

  .charity-name-research-row {
    grid-template-columns: 1fr;
  }
}

.charity-form label {
  display: block;
  margin-bottom: 0.45rem;
  color: var(--ink);
  font-weight: 800;
}

.charity-form input,
.charity-form textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.85rem 0.95rem;
  background: #fffdf8;
  color: var(--ink);
  resize: vertical;
}

.charity-form input:focus,
.charity-form textarea:focus {
  border-color: var(--sage);
  box-shadow: 0 0 0 4px rgba(63, 102, 91, 0.13);
  outline: none;
}

.form-wide {
  grid-column: 1 / -1;
}

.form-actions,
.item-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
}

.charity-list {
  display: grid;
  gap: 0.85rem;
  margin-top: 1rem;
}

.charity-item,
.empty-state {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 1rem;
  background: rgba(255, 255, 255, 0.82);
}

.charity-item {
  display: grid;
  gap: 1rem;
  align-items: start;
}

.charity-item-main {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 1rem;
  align-items: center;
}

.charity-offerings-panel {
  border-top: 1px solid var(--line);
  padding-top: 1rem;
}

.charity-offerings-panel-heading {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.45rem 1rem;
  margin-bottom: 0.85rem;
}

.charity-offerings-panel-heading strong {
  font-size: 0.95rem;
}

.charity-offerings-panel-heading span {
  color: var(--ink-soft);
  font-size: 0.82rem;
}

.charity-offerings-empty {
  margin: 0 0 0.85rem;
  color: var(--ink-soft);
  font-size: 0.88rem;
}

.charity-offerings-admin-list {
  display: grid;
  gap: 0.75rem;
  margin: 0 0 1rem;
  padding: 0;
  list-style: none;
}

.charity-offering-admin-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.85rem;
  align-items: start;
  border: 1px solid rgba(63, 102, 91, 0.14);
  border-radius: 8px;
  padding: 0.85rem;
  background: rgba(255, 253, 248, 0.92);
}

.charity-offering-admin-type {
  display: inline-flex;
  margin-bottom: 0.35rem;
  padding: 0.18rem 0.45rem;
  border-radius: 999px;
  background: rgba(63, 102, 91, 0.1);
  color: var(--sage);
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.charity-offering-admin-item strong {
  display: block;
  margin-bottom: 0.25rem;
}

.charity-offering-admin-item p {
  margin-bottom: 0.45rem;
}

.charity-offering-admin-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem 0.85rem;
  color: var(--ink-soft);
  font-size: 0.82rem;
}

.charity-offering-admin-meta a {
  color: var(--sage);
  font-weight: 700;
}

.charity-offering-form {
  border: 1px dashed rgba(63, 102, 91, 0.24);
  border-radius: 8px;
  padding: 1rem;
  background: rgba(255, 255, 255, 0.72);
}

.charity-offering-form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.85rem;
}

.charity-offering-form label {
  display: block;
  margin-bottom: 0.4rem;
  color: var(--ink);
  font-weight: 800;
}

.charity-offering-form .field-note {
  color: var(--ink-soft);
  font-weight: 600;
}

.charity-offering-form input,
.charity-offering-form textarea,
.charity-offering-form select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.75rem 0.85rem;
  background: #fffdf8;
  color: var(--ink);
}

.charity-offering-form input:focus,
.charity-offering-form textarea:focus,
.charity-offering-form select:focus {
  border-color: var(--sage);
  box-shadow: 0 0 0 4px rgba(63, 102, 91, 0.13);
  outline: none;
}

@media (max-width: 760px) {
  .charity-item-main,
  .charity-offering-admin-item,
  .charity-offering-form-grid {
    grid-template-columns: 1fr;
  }
}

.charity-item span {
  display: inline-flex;
  margin-bottom: 0.45rem;
  color: var(--clay);
  font-size: 0.75rem;
  font-weight: 800;
  text-transform: uppercase;
}

.charity-item h3 {
  margin: 0 0 0.35rem;
  font-size: 1.1rem;
}

.charity-item p,
.empty-state p {
  margin-bottom: 0.55rem;
  color: var(--ink-soft);
}

.charity-item a {
  color: var(--sage);
  font-weight: 800;
  overflow-wrap: anywhere;
}

@media (max-width: 780px) {
  .login-panel {
    padding: 3rem 1rem 1rem;
  }

  .dashboard-header,
  .dashboard-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .dashboard-grid,
  .sales-truth-banner,
  .sales-kpi-grid,
  .sales-entry-grid,
  .sales-ledger-grid,
  .shop-status-panel,
  .bookshop-setup-grid,
  .book-form,
  .book-admin-item,
  .charity-form,
  .charity-item {
    grid-template-columns: 1fr;
  }

  .sales-ledger-grid .activity-panel:last-child {
    grid-column: auto;
  }

  .manager-heading,
  .manager-actions,
  .catalogue-heading,
  .link-test-panel {
    align-items: stretch;
    flex-direction: column;
  }

  .book-admin-cover {
    width: 96px;
  }

  .book-admin-actions {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .sales-form {
    grid-template-columns: 1fr;
  }

  .activity-row {
    grid-template-columns: 1fr;
  }

  .activity-actions {
    justify-content: flex-start;
  }

  .password-row {
    grid-template-columns: 1fr;
  }
}

/* Premium admin workspace */

html {
  scroll-behavior: smooth;
  scroll-padding-top: 6.5rem;
}

body {
  background:
    radial-gradient(circle at 8% 8%, rgba(139, 169, 154, 0.3), transparent 30rem),
    radial-gradient(circle at 92% 32%, rgba(221, 187, 114, 0.14), transparent 25rem),
    linear-gradient(145deg, #f8f6f0 0%, #eef4f1 55%, #f6eee4 100%);
}

::selection {
  background: var(--gold);
  color: var(--ink);
}

:where(a, button, input, textarea, select):focus-visible {
  outline: 3px solid var(--gold);
  outline-offset: 3px;
}

button,
.primary-button,
.secondary-button,
.ghost-button,
.danger-button {
  transition:
    background 180ms ease,
    border-color 180ms ease,
    box-shadow 180ms ease,
    color 180ms ease,
    transform 180ms ease;
}

.primary-button:hover,
.secondary-button:hover,
.ghost-button:hover,
.danger-button:hover {
  transform: translateY(-2px);
}

.primary-button {
  background: linear-gradient(135deg, var(--sage), #31594f);
  box-shadow: 0 12px 28px rgba(63, 102, 91, 0.2);
}

.primary-button:hover {
  box-shadow: 0 17px 34px rgba(63, 102, 91, 0.28);
}

.primary-button:disabled,
.secondary-button:disabled,
.ghost-button:disabled,
.danger-button:disabled {
  cursor: not-allowed;
  opacity: 0.48;
  box-shadow: none;
  transform: none;
}

.secondary-button:hover:not(:disabled) {
  border-color: rgba(63, 102, 91, 0.3);
  background: var(--sage-soft);
}

.secondary-button:active:not(:disabled) {
  transform: translateY(0);
}

.login-panel {
  position: relative;
  isolation: isolate;
  overflow: hidden;
}

.login-panel::before,
.login-panel::after {
  content: "";
  position: absolute;
  z-index: -1;
  border: 1px solid rgba(63, 102, 91, 0.12);
  border-radius: 50%;
  pointer-events: none;
}

.login-panel::before {
  top: -8rem;
  right: -6rem;
  width: 22rem;
  height: 22rem;
  border-color: rgba(63, 102, 91, 0.08);
  box-shadow:
    0 0 0 2rem rgba(255, 255, 255, 0.18),
    0 0 0 4rem rgba(255, 255, 255, 0.09);
  animation: login-float 20s ease-in-out infinite;
}

.login-panel::after {
  bottom: -8rem;
  left: -7rem;
  width: 20rem;
  height: 20rem;
  border-color: rgba(147, 75, 56, 0.08);
  animation: login-float 25s ease-in-out infinite reverse;
}

@keyframes login-float {
  0%, 100% { transform: translate(0, 0); }
  33% { transform: translate(1.5rem, -0.75rem); }
  66% { transform: translate(-0.75rem, 1rem); }
}

.back-link {
  min-height: 2.25rem;
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 0.4rem 0.7rem;
  background: rgba(255, 255, 255, 0.72);
  box-shadow: 0 8px 20px rgba(25, 48, 51, 0.07);
  backdrop-filter: blur(10px);
  font-size: 0.82rem;
  transition: background 180ms ease, box-shadow 180ms ease, transform 180ms ease;
}

.back-link:hover {
  background: rgba(255, 255, 255, 0.9);
  box-shadow: 0 12px 28px rgba(25, 48, 51, 0.12);
  transform: translateY(-1px);
}

.login-card {
  position: relative;
  overflow: hidden;
  border-color: rgba(25, 48, 51, 0.14);
  border-radius: var(--radius-panel);
  background: rgba(255, 253, 248, 0.93);
  box-shadow: 0 24px 60px rgba(25, 48, 51, 0.15);
  animation: login-card-in 400ms ease both;
}

@keyframes login-card-in {
  from {
    opacity: 0;
    transform: translateY(1rem);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.login-card::after {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 3px;
  background: linear-gradient(90deg, var(--sage), var(--gold), var(--clay));
}

.login-card h1 {
  max-width: 14ch;
  font-size: clamp(1.35rem, 4vw, 1.65rem);
  letter-spacing: -0.02em;
  text-wrap: balance;
}

.login-assurance {
  margin-top: 0.85rem;
  border-left: 3px solid var(--sage);
  border-radius: 0 var(--radius-control) var(--radius-control) 0;
  padding: 0.6rem 0.75rem;
  background: var(--sage-soft);
}

.login-assurance strong {
  display: block;
  margin-bottom: 0.1rem;
  color: var(--ink);
  font-size: 0.82rem;
}

.login-assurance p {
  margin: 0;
  color: var(--ink-soft);
  font-size: 0.75rem;
  line-height: 1.45;
}

.login-panel {
  overflow-x: hidden;
  overflow-y: auto;
}

.login-divider {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 0.65rem;
  margin: 0.85rem 0;
  color: var(--ink-soft);
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
}

.login-divider::before,
.login-divider::after {
  content: "";
  height: 1px;
  background: var(--line);
}

.authenticator-choice {
  width: 100%;
  gap: 0.6rem;
}

.authenticator-choice-icon {
  display: inline-grid;
  width: 1.6rem;
  height: 1.6rem;
  place-items: center;
  border-radius: 50%;
  background: var(--sage);
  color: var(--white);
  font-size: 0.8rem;
  font-weight: 900;
}

.authenticator-panel {
  display: grid;
  gap: 0.85rem;
  margin-top: 1rem;
  border: 1px solid rgba(63, 102, 91, 0.2);
  border-radius: var(--radius-card);
  padding: 1rem;
  background: rgba(219, 233, 227, 0.28);
}

.authenticator-panel[hidden],
.device-approval-form[hidden],
.authenticator-login-form[hidden],
.authenticator-setup-form[hidden],
.authenticator-enrolment[hidden],
.math-challenge-panel[hidden],
.math-challenge-form[hidden] {
  display: none;
}

.authenticator-panel-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.8rem;
}

.authenticator-panel-heading .eyebrow {
  margin-bottom: 0.12rem;
}

.authenticator-panel h2 {
  margin: 0;
  color: var(--ink);
  font-size: 1.25rem;
}

.text-button {
  border: 0;
  padding: 0.25rem;
  background: transparent;
  color: var(--sage);
  font: inherit;
  font-size: 0.78rem;
  font-weight: 800;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 0.18rem;
}

.authenticator-note,
.form-hint {
  margin: 0;
  color: var(--ink-soft);
  font-size: 0.78rem;
  line-height: 1.5;
}

.device-approval-form,
.authenticator-login-form,
.authenticator-setup-form,
.authenticator-confirm-form,
.math-challenge-form {
  display: grid;
  gap: 0.5rem;
}

.device-approval-form label,
.authenticator-login-form label,
.authenticator-setup-form label,
.authenticator-confirm-form label,
.math-challenge-form label {
  color: var(--ink);
  font-size: 0.85rem;
  font-weight: 800;
}

.authenticator-login-form > input,
.authenticator-confirm-form > input {
  width: 100%;
  min-height: 2.7rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-control);
  padding: 0.6rem 0.75rem;
  background: var(--white);
  color: var(--ink);
  font-size: 1.05rem;
  font-weight: 800;
  letter-spacing: 0.24em;
  text-align: center;
}

.authenticator-login-form > input:focus,
.authenticator-confirm-form > input:focus {
  border-color: var(--sage);
  box-shadow: 0 0 0 4px rgba(63, 102, 91, 0.13);
  outline: none;
}

.authenticator-qr-card {
  display: grid;
  justify-items: center;
  gap: 0.65rem;
  margin-bottom: 0.85rem;
  border: 1px solid rgba(63, 102, 91, 0.2);
  border-radius: var(--radius-card);
  padding: 0.85rem;
  background: var(--white);
  text-align: center;
}

.authenticator-qr-card p {
  margin: 0;
  color: var(--ink);
  font-size: 0.82rem;
}

.authenticator-qr-card img {
  display: block;
  width: min(230px, 100%);
  height: auto;
  aspect-ratio: 1;
  border: 8px solid var(--white);
  image-rendering: pixelated;
}

.authenticator-qr-card img[hidden] {
  display: none;
}

.math-challenge-panel {
  display: grid;
  gap: 0.7rem;
  border-top: 1px solid rgba(63, 102, 91, 0.2);
  padding-top: 0.9rem;
}

.math-challenge-panel .eyebrow {
  margin: 0;
}

.math-challenge-panel h3 {
  margin: -0.45rem 0 0;
  color: var(--ink);
  font-size: 1.08rem;
}

.math-challenge-panel > .secondary-button {
  width: 100%;
}

.math-question {
  display: block;
  overflow-wrap: anywhere;
  border: 1px solid rgba(147, 75, 56, 0.22);
  border-radius: var(--radius-control);
  padding: 0.7rem;
  background: #fff7ed;
  color: var(--ink);
  font-family: ui-monospace, "Cascadia Mono", Consolas, monospace;
  font-size: clamp(0.82rem, 3vw, 1rem);
  font-weight: 900;
  line-height: 1.45;
  text-align: center;
}

.math-timer {
  overflow: hidden;
  height: 0.36rem;
  border-radius: 999px;
  background: rgba(147, 75, 56, 0.12);
}

.math-timer span {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--sage), var(--gold), var(--clay));
  transform: scaleX(1);
  transform-origin: left center;
}

.math-time {
  margin: -0.2rem 0 0;
  color: var(--clay);
  font-family: ui-monospace, "Cascadia Mono", Consolas, monospace;
  font-size: 0.75rem;
  font-weight: 900;
  text-align: right;
}

.math-challenge-form > input {
  width: 100%;
  min-height: 3rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-control);
  padding: 0.6rem;
  background: var(--white);
  color: var(--ink);
  font-size: 1.4rem;
  font-weight: 900;
  letter-spacing: 0.2em;
  text-align: center;
}

.math-challenge-form > input:focus {
  border-color: var(--sage);
  box-shadow: 0 0 0 4px rgba(63, 102, 91, 0.13);
  outline: none;
}

.authenticator-steps {
  margin: 0;
  padding-left: 1.2rem;
  color: var(--ink-soft);
  font-size: 0.78rem;
  line-height: 1.5;
}

.authenticator-steps li + li {
  margin-top: 0.3rem;
}

.authenticator-secret-box {
  display: grid;
  gap: 0.45rem;
  margin: 0.85rem 0 0.55rem;
  border: 1px dashed rgba(63, 102, 91, 0.35);
  border-radius: var(--radius-control);
  padding: 0.75rem;
  background: var(--white);
}

.authenticator-secret-box > span {
  color: var(--ink-soft);
  font-size: 0.68rem;
  font-weight: 800;
  text-transform: uppercase;
}

.authenticator-secret-box code {
  overflow-wrap: anywhere;
  color: var(--ink);
  font-family: ui-monospace, "Cascadia Mono", Consolas, monospace;
  font-size: 0.88rem;
  font-weight: 800;
  letter-spacing: 0.08em;
}

.authenticator-secret-box .ghost-button {
  min-height: 2.25rem;
  justify-self: start;
  padding: 0.45rem 0.75rem;
}

.authenticator-app-link {
  display: inline-block;
  margin-bottom: 0.85rem;
  color: var(--sage);
  font-size: 0.78rem;
  font-weight: 800;
}

.password-row input {
  border-radius: var(--radius-control);
}

.dashboard {
  width: min(1320px, calc(100% - 2rem));
  padding-top: clamp(1rem, 3vw, 2.25rem);
}

.dashboard-header {
  padding-bottom: 1.35rem;
}

.dashboard-header h1 {
  font-size: clamp(2.5rem, 5vw, 4.6rem);
  letter-spacing: -0.04em;
}

.dashboard-heading-copy {
  max-width: 760px;
}

.dashboard-page-intro {
  max-width: 650px;
  margin: 0.65rem 0 0;
  color: var(--ink-soft);
  font-size: clamp(0.92rem, 1.5vw, 1.05rem);
  line-height: 1.65;
}

.dashboard-actions .secondary-button {
  min-width: 8rem;
}

.admin-navigation-shell {
  position: sticky;
  z-index: 18;
  top: 0.75rem;
  margin: 0 0 1.4rem;
  border: 1px solid rgba(25, 48, 51, 0.1);
  border-radius: 22px;
  padding: 0.5rem;
  background: rgba(255, 253, 248, 0.94);
  box-shadow: 0 18px 48px rgba(25, 48, 51, 0.11);
  backdrop-filter: blur(18px);
}

.admin-navigation-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: .25rem .4rem .55rem; color: var(--ink-soft); font-size: .76rem; }
.admin-navigation-toolbar strong { font-weight: 800; letter-spacing: .05em; text-transform: uppercase; }
.admin-navigation-toolbar button { border: 1px solid rgba(63, 102, 91, .25); border-radius: 9px; padding: .42rem .72rem; background: #fff; color: var(--sage); font: inherit; font-weight: 800; cursor: pointer; }
.admin-navigation-toolbar button:hover { background: var(--sage-soft); }
.admin-navigation-toolbar button:focus-visible { outline: 3px solid var(--sage); outline-offset: 2px; }

.admin-section-nav {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  width: 100%;
  gap: 0.45rem;
  overflow-x: auto;
  scrollbar-width: none;
}
.admin-section-nav[hidden] { display: none; }

.admin-section-nav::-webkit-scrollbar {
  display: none;
}

.admin-section-nav a {
  min-width: 142px;
  min-height: 4.2rem;
  display: flex;
  align-items: center;
  gap: 0.7rem;
  border: 1px solid transparent;
  border-radius: 16px;
  padding: 0.65rem 0.72rem;
  background: transparent;
  color: var(--ink);
  text-decoration: none;
  transition: background 180ms ease, border-color 180ms ease, box-shadow 180ms ease, color 180ms ease, transform 180ms ease;
  position: relative;
}

.admin-section-nav a:hover {
  border-color: rgba(63, 102, 91, 0.15);
  background: rgba(219, 233, 227, 0.58);
  transform: translateY(-1px);
}

.admin-section-nav a:active {
  transform: translateY(0);
}

.admin-section-nav a[aria-current="page"] {
  border-color: rgba(63, 102, 91, 0.28);
  background:
    radial-gradient(circle at 100% 0, rgba(221, 187, 114, 0.24), transparent 6rem),
    linear-gradient(145deg, #456f63, #31564d);
  box-shadow: 0 12px 28px rgba(49, 86, 77, 0.22);
  color: var(--white);
}

.admin-section-nav a[aria-current="page"]::after {
  content: "";
  position: absolute;
  bottom: -0.5rem;
  left: 50%;
  width: 1.2rem;
  height: 0.2rem;
  margin-left: -0.6rem;
  border-radius: 999px;
  background: var(--gold);
  opacity: 0;
  animation: admin-nav-active-in 300ms ease forwards;
}

@keyframes admin-nav-active-in {
  to { opacity: 1; }
}

.admin-nav-icon {
  display: grid;
  width: 2.25rem;
  height: 2.25rem;
  flex: 0 0 2.25rem;
  place-items: center;
  border-radius: 11px;
  background: rgba(63, 102, 91, 0.1);
  color: var(--clay);
  font-size: 0.67rem;
  font-weight: 900;
  letter-spacing: 0.08em;
}

.admin-section-nav a[aria-current="page"] .admin-nav-icon {
  background: rgba(255, 255, 255, 0.14);
  color: #f7d897;
}

.admin-nav-copy {
  display: grid;
  min-width: 0;
  gap: 0.12rem;
}

.admin-nav-copy strong {
  font-size: 0.78rem;
  line-height: 1.15;
}

.admin-nav-copy small {
  overflow: hidden;
  color: var(--ink-soft);
  font-size: 0.62rem;
  font-weight: 650;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.admin-section-nav a[aria-current="page"] .admin-nav-copy small {
  color: rgba(255, 255, 255, 0.72);
}

[data-admin-view] {
  display: none !important;
}

html[data-admin-page="overview"] [data-admin-view="overview"] {
  display: grid !important;
}

html[data-admin-page="sales"] [data-admin-view="sales"],
html[data-admin-page="books"] [data-admin-view="books"],
html[data-admin-page="products"] [data-admin-view="products"],
html[data-admin-page="charities"] [data-admin-view="charities"],
html[data-admin-page="helplines"] [data-admin-view="helplines"],
html[data-admin-page="voice"] [data-admin-view="voice"],
html[data-admin-page="sleep-sounds"] [data-admin-view="sleep-sounds"],
html[data-admin-page="stories"] [data-admin-view="stories"],
html[data-admin-page="publishers"] [data-admin-view="publishers"],
html[data-admin-page="content-review"] [data-admin-view="content-review"] {
  display: block !important;
}

html[data-admin-page="overview"] .first-aid-protection[data-admin-view="overview"] {
  display: block !important;
}

#orders-sales,
#bookshop-manager,
#charity-manager {
  scroll-margin-top: 6.5rem;
}

.dashboard-grid {
  gap: 1rem;
}

.admin-card {
  position: relative;
  display: flex;
  min-height: 235px;
  flex-direction: column;
  overflow: hidden;
  border-radius: var(--radius-card);
  padding: 1.35rem;
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.94), rgba(255, 250, 241, 0.82)),
    var(--white);
  box-shadow: var(--shadow-soft);
  transition: transform 240ms ease, box-shadow 240ms ease;
}

.admin-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lift);
}

.admin-card::after {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 4px;
  background: linear-gradient(90deg, var(--sage), var(--gold), var(--clay));
  opacity: 0.72;
}

.admin-card > span {
  margin-bottom: 1.55rem;
  font-size: 1rem;
  letter-spacing: 0.08em;
}

.admin-card h2 {
  font-size: 1.16rem;
}

.card-value {
  margin-top: 0.65rem;
  font-size: clamp(1.15rem, 2vw, 1.42rem);
  line-height: 1.2;
}

.admin-card p {
  margin-bottom: 1rem;
  font-size: 0.87rem;
}

.card-link {
  display: inline-flex;
  width: max-content;
  align-items: center;
  gap: 0.45rem;
  margin-top: auto;
  color: var(--sage);
  font-size: 0.83rem;
  font-weight: 800;
  text-decoration: none;
}

.admin-card .card-link span {
  display: inline;
  margin: 0;
  color: currentColor;
  font-size: 1rem;
  transition: transform 180ms ease;
}

.card-link:hover span {
  transform: translateX(4px);
}

.sales-manager,
.bookshop-manager,
.charity-manager {
  margin-top: 1.25rem;
  border-color: rgba(25, 48, 51, 0.13);
  border-radius: var(--radius-panel);
  padding: clamp(1.1rem, 3vw, 2rem);
  background: rgba(255, 253, 248, 0.9);
  box-shadow: 0 26px 72px rgba(25, 48, 51, 0.1);
  backdrop-filter: blur(12px);
  transition: box-shadow 240ms ease;
}

.sales-manager:hover,
.bookshop-manager:hover,
.charity-manager:hover {
  box-shadow: 0 30px 84px rgba(25, 48, 51, 0.13);
}

.manager-heading {
  align-items: flex-end;
  margin-bottom: 1.5rem;
}

.manager-heading h2 {
  font-size: clamp(2rem, 4vw, 3.35rem);
  letter-spacing: -0.035em;
  text-wrap: balance;
}

.manager-heading p {
  line-height: 1.7;
}

.sales-truth-banner {
  gap: 0.75rem;
  overflow: visible;
  border: 0;
  border-radius: 0;
  background: transparent;
}

.sales-truth-banner > div {
  position: relative;
  min-height: 145px;
  overflow: hidden;
  border: 1px solid rgba(63, 102, 91, 0.16);
  border-radius: var(--radius-card);
  padding: 1.2rem 1.25rem 1.2rem 4.7rem;
  background:
    radial-gradient(circle at 100% 0%, rgba(63, 102, 91, 0.1), transparent 10rem),
    linear-gradient(145deg, rgba(219, 233, 227, 0.88), rgba(255, 255, 255, 0.95));
  transition: box-shadow 240ms ease, transform 240ms ease;
}

.sales-truth-banner > div:hover {
  box-shadow: 0 12px 34px rgba(25, 48, 51, 0.07);
  transform: translateY(-2px);
}

.sales-truth-banner > div::before {
  content: "AUTO";
  position: absolute;
  top: 1.2rem;
  left: 1.2rem;
  display: grid;
  width: 2.7rem;
  height: 2.7rem;
  place-items: center;
  border-radius: 50%;
  background: var(--sage);
  color: var(--white);
  font-size: 0.56rem;
  font-weight: 800;
  letter-spacing: 0.04em;
}

.sales-truth-banner > div:last-child {
  border-color: rgba(221, 187, 114, 0.35);
  background:
    radial-gradient(circle at 100% 0%, rgba(221, 187, 114, 0.16), transparent 10rem),
    linear-gradient(145deg, #fff5dc, rgba(255, 255, 255, 0.96));
}

.sales-truth-banner > div:last-child::before {
  content: "ADD";
  background: var(--gold);
  color: var(--ink);
}

.panel-label,
.sales-kpi > span {
  color: var(--clay);
  font-size: 0.74rem;
  letter-spacing: 0.08em;
}

.sales-kpi-grid {
  gap: 0.8rem;
  margin-top: 1.1rem;
  margin-bottom: 1.25rem;
}

.sales-kpi {
  position: relative;
  min-height: 155px;
  overflow: hidden;
  border-radius: var(--radius-card);
  padding: 1.1rem;
  background:
    radial-gradient(circle at 100% 0%, rgba(139, 169, 154, 0.12), transparent 8rem),
    var(--white);
  box-shadow: 0 12px 32px rgba(25, 48, 51, 0.05);
  transition: transform 240ms ease, box-shadow 240ms ease;
}

.sales-kpi:hover {
  transform: translateY(-3px);
  box-shadow: 0 18px 44px rgba(25, 48, 51, 0.1);
}

.sales-kpi::after {
  content: "";
  position: absolute;
  right: -2rem;
  bottom: -3rem;
  width: 7rem;
  height: 7rem;
  border: 1px solid rgba(63, 102, 91, 0.09);
  border-radius: 50%;
}

.kpi-period-note {
  margin: -0.3rem 0 1.25rem;
  border-left: 3px solid var(--gold);
  padding-left: 0.8rem;
  color: var(--ink-soft);
  font-size: 0.8rem;
}

.sales-kpi > span {
  margin-bottom: 1.35rem;
  background: #f3e5dc;
}

.external-dashboard-button {
  gap: 0.5rem;
}

.external-dashboard-button span {
  transition: transform 180ms ease;
}

.external-dashboard-button:hover span {
  transform: translate(2px, -2px);
}

.sales-kpi strong {
  font-size: clamp(1.42rem, 3vw, 2.1rem);
}

.sales-entry-grid {
  grid-template-columns: minmax(0, 1.15fr) minmax(340px, 0.85fr);
  gap: 1.15rem;
}

.record-panel,
.activity-panel {
  border-radius: var(--radius-card);
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 12px 34px rgba(25, 48, 51, 0.05);
  transition: box-shadow 240ms ease;
}

.record-panel:hover,
.activity-panel:hover {
  box-shadow: 0 16px 44px rgba(25, 48, 51, 0.08);
}

.record-panel h3,
.activity-panel h3 {
  font-size: 1.45rem;
  letter-spacing: -0.025em;
}

.sales-form {
  gap: 0.9rem 1rem;
}

.sales-form input:not([type="checkbox"]),
.sales-form select,
.sales-form textarea,
.book-form input:not([type="checkbox"]),
.book-form select,
.book-form textarea,
.affiliate-form input:not([type="checkbox"]),
.charity-form input,
.charity-form textarea {
  border-radius: var(--radius-control);
  background: #fffdf9;
  transition: border-color 180ms ease, box-shadow 180ms ease, background 180ms ease;
}

.sales-form input:hover:not(:focus),
.sales-form select:hover:not(:focus),
.sales-form textarea:hover:not(:focus),
.book-form input:hover:not(:focus),
.book-form select:hover:not(:focus),
.book-form textarea:hover:not(:focus),
.charity-form input:hover:not(:focus),
.charity-form textarea:hover:not(:focus) {
  border-color: rgba(63, 102, 91, 0.2);
  background: #fffefc;
}

.sales-form input:hover,
.sales-form select:hover,
.sales-form textarea:hover {
  border-color: rgba(63, 102, 91, 0.28);
}

.check-row {
  border-radius: var(--radius-control);
  padding: 0.85rem;
  background: var(--sage-soft);
  transition: border-color 180ms ease, box-shadow 180ms ease, background 180ms ease;
}

.check-row:hover {
  border-color: rgba(63, 102, 91, 0.25);
  background: #dcebe5;
}

.check-row:focus-within {
  outline: 3px solid var(--gold);
  outline-offset: 3px;
}

.privacy-warning {
  border-radius: 0 var(--radius-control) var(--radius-control) 0;
}

.sales-ledger-grid {
  gap: 1.15rem;
  margin-top: 1.15rem;
}

.activity-row {
  border-radius: var(--radius-control);
  padding: 0.95rem;
  transition: border-color 180ms ease, box-shadow 180ms ease, transform 180ms ease;
}

.activity-row:hover {
  border-color: rgba(63, 102, 91, 0.24);
  box-shadow: 0 12px 28px rgba(25, 48, 51, 0.07);
  transform: translateY(-2px);
}

.activity-actions button,
.book-admin-actions button,
.book-admin-actions a {
  min-height: 2.75rem;
}

.amount-pill {
  padding: 0.35rem 0.62rem;
}

.shop-status-panel,
.bookshop-setup-panel,
.book-catalogue-panel {
  border-radius: var(--radius-card);
}

.shop-status-panel {
  background:
    radial-gradient(circle at 95% 8%, rgba(221, 187, 114, 0.16), transparent 15rem),
    linear-gradient(145deg, rgba(219, 233, 227, 0.9), rgba(255, 255, 255, 0.94));
  transition: box-shadow 240ms ease;
}

.shop-status-panel:hover {
  box-shadow: 0 16px 44px rgba(25, 48, 51, 0.08);
}

.setup-checklist li,
.affiliate-form,
.book-form,
.link-test-panel,
.book-admin-item,
.charity-form,
.charity-item,
.empty-state {
  border-radius: var(--radius-card);
}

.book-admin-item {
  transition: border-color 180ms ease, box-shadow 180ms ease, transform 180ms ease;
}

.book-admin-item:hover {
  border-color: rgba(63, 102, 91, 0.24);
  box-shadow: 0 14px 34px rgba(25, 48, 51, 0.07);
  transform: translateY(-2px);
}

@media (max-width: 980px) {
  .sales-entry-grid {
    grid-template-columns: 1fr;
  }

  .sales-kpi-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* Video Publisher Portal administration */
.video-publisher-admin{--vp-ink:#183234;--vp-sage:#2f665d;--vp-line:rgba(24,50,52,.12)}
.publisher-admin-kpis{display:grid;grid-template-columns:repeat(7,minmax(0,1fr));gap:.65rem;margin:1.25rem 0}.publisher-admin-kpis article{min-height:7.6rem;padding:1rem;border:1px solid var(--vp-line);border-radius:1rem;background:linear-gradient(145deg,#fff,#f5f8f5);box-shadow:0 10px 24px rgba(24,50,52,.05)}.publisher-admin-kpis article:first-child{color:#fff;border-color:transparent;background:linear-gradient(145deg,#1c4a45,#2f665d)}.publisher-admin-kpis span,.publisher-admin-kpis strong{display:block}.publisher-admin-kpis span{min-height:2.2rem;color:#71817e;font-size:.63rem;font-weight:800;line-height:1.35;text-transform:uppercase}.publisher-admin-kpis article:first-child span{color:#bdd1cb}.publisher-admin-kpis strong{margin-top:.75rem;font-size:1.75rem}
.publisher-admin-workspace{display:grid;grid-template-columns:minmax(260px,.72fr) minmax(0,1.55fr);gap:1rem;align-items:start}.publisher-application-panel,.publisher-review-panel,.publisher-suspicious-panel{overflow:hidden;border:1px solid var(--vp-line);border-radius:1.2rem;background:#fff;box-shadow:0 14px 32px rgba(24,50,52,.05)}
.publisher-admin-panel-heading{display:flex;align-items:flex-start;justify-content:space-between;gap:1rem;padding:1rem;border-bottom:1px solid #e9efeb}.publisher-admin-panel-heading h3,.publisher-admin-panel-heading h4{margin:.2rem 0 0;font-size:1rem}.publisher-admin-panel-heading p{margin:.25rem 0 0;color:#73827f;font-size:.67rem}.publisher-admin-panel-heading>span{display:grid;min-width:1.8rem;height:1.8rem;place-items:center;border-radius:50%;color:#fff;background:#2f665d;font-size:.67rem;font-weight:800}
.publisher-admin-filters{display:flex;gap:.25rem;padding:.7rem;border-bottom:1px solid #edf1ee}.publisher-admin-filters button{border:0;border-radius:999px;padding:.45rem .58rem;color:#788683;background:#f1f4f2;font:700 .57rem Inter;cursor:pointer}.publisher-admin-filters button.is-active{color:#fff;background:#2f665d}
.publisher-application-list{max-height:650px;overflow:auto;padding:.45rem}.publisher-application-row{display:grid;width:100%;grid-template-columns:auto minmax(0,1fr) auto;gap:.6rem;align-items:center;padding:.75rem;border:1px solid transparent;border-radius:.85rem;color:var(--vp-ink);background:transparent;text-align:left;cursor:pointer}.publisher-application-row:hover,.publisher-application-row.is-selected{border-color:#d8e3dd;background:#f3f8f5}.publisher-avatar{display:grid;width:2.25rem;aspect-ratio:1;place-items:center;border-radius:.7rem;color:#fff;background:linear-gradient(145deg,#6e9c90,#2f665d);font-size:.75rem;font-weight:800}.publisher-application-row strong,.publisher-application-row small{display:block}.publisher-application-row strong{font-size:.69rem}.publisher-application-row small{overflow:hidden;max-width:18ch;margin-top:.2rem;color:#788683;font-size:.58rem;text-overflow:ellipsis;white-space:nowrap}.publisher-application-row .status-badge{grid-column:3;grid-row:1;font-size:.48rem}.publisher-application-row>b{grid-column:2/4;color:#8a9693;font-size:.52rem}.publisher-admin-list-empty{margin:0;padding:1.25rem;color:#7c8986;font-size:.67rem;text-align:center}
.publisher-admin-empty{display:grid;justify-items:center;align-content:center;min-height:31rem;padding:2rem;text-align:center}.publisher-admin-empty>span{display:grid;width:3.7rem;aspect-ratio:1;place-items:center;border-radius:50%;color:#fff;background:#4a7c70}.publisher-admin-empty h3{margin:1rem 0 .35rem}.publisher-admin-empty p{max-width:27rem;margin:0;color:#7b8986;font-size:.7rem;line-height:1.5}
.publisher-review-header{display:flex;justify-content:space-between;gap:1rem;padding:1.25rem;border-bottom:1px solid #e9efeb}.publisher-review-header h3{margin:.15rem 0;font-size:1.35rem}.publisher-review-header p:not(.panel-label){margin:0;color:#778682;font-size:.69rem}.publisher-contact-grid{display:grid;grid-template-columns:repeat(5,1fr);gap:1px;background:#e9efeb;border-bottom:1px solid #e9efeb}.publisher-contact-grid div{min-width:0;padding:.85rem;background:#fbfcfb}.publisher-contact-grid span,.publisher-contact-grid strong{display:block}.publisher-contact-grid span{color:#7d8b88;font-size:.5rem;font-weight:800;text-transform:uppercase}.publisher-contact-grid strong{overflow-wrap:anywhere;margin-top:.35rem;font-size:.63rem}.publisher-contact-grid a{color:#2f665d}
.publisher-admin-note{margin:1rem 1rem 0;padding:.8rem;border-left:3px solid #c99235;border-radius:.6rem;background:#fff8e8}.publisher-admin-note.is-rejected{border-color:#bf5741;background:#fff2ef}.publisher-admin-note strong{font-size:.66rem}.publisher-admin-note p{margin:.25rem 0 0;color:#6f7d79;font-size:.63rem}.publisher-review-actions{display:flex;flex-wrap:wrap;gap:.5rem;padding:1rem}.publisher-review-actions button{font-size:.62rem}.secondary-button.is-danger{border-color:#e6c0b8;color:#a53b2f}
.publisher-review-actions [data-vp-action="delete_account"]{margin-left:auto}
.publisher-credit-adjust{display:grid;grid-template-columns:minmax(150px,1fr) 120px minmax(180px,1fr) auto;gap:.6rem;align-items:end;margin:0 1rem 1rem;padding:1rem;border:1px solid #dfe8e3;border-radius:.9rem;background:#f5f8f6}.publisher-credit-adjust h4{margin:.18rem 0 0;font-size:.8rem}.publisher-credit-adjust input{min-width:0;height:2.5rem;border:1px solid #d4dfd9;border-radius:.65rem;padding:.6rem;font:500 .66rem Inter}.publisher-credit-adjust button{height:2.5rem;font-size:.62rem}
.publisher-admin-videos,.publisher-admin-history{border-top:1px solid #e8eeea}.publisher-admin-video{display:grid;grid-template-columns:125px minmax(0,1fr) 120px;gap:.8rem;align-items:center;padding:.85rem 1rem;border-top:1px solid #edf1ee}.publisher-admin-video>img{width:100%;aspect-ratio:16/9;object-fit:cover;border-radius:.65rem}.publisher-admin-video h5{margin:.35rem 0 .2rem;font-size:.72rem}.publisher-admin-video p{display:-webkit-box;overflow:hidden;margin:0;color:#6e7e7a;font-size:.59rem;-webkit-box-orient:vertical;-webkit-line-clamp:2}.publisher-admin-video small{display:block;margin-top:.35rem;color:#899591;font-size:.52rem}.publisher-admin-video-actions{display:grid;gap:.35rem}.publisher-admin-video-actions a,.publisher-admin-video-actions button{display:block;width:100%;border:1px solid #dbe4df;border-radius:.55rem;padding:.5rem;color:#2f665d;background:#f6f9f7;font:700 .56rem Inter;text-align:center;text-decoration:none;cursor:pointer}.publisher-admin-video-actions button:hover{color:#fff;background:#2f665d}.publisher-admin-history>div:not(.publisher-admin-panel-heading){display:grid;grid-template-columns:90px 1fr 70px 90px;gap:.6rem;align-items:center;padding:.6rem 1rem;border-top:1px solid #edf1ee;font-size:.58rem}.publisher-admin-history time,.publisher-admin-history em{color:#7d8986;font-style:normal}.publisher-admin-history b.is-positive{color:#267b55}.publisher-admin-history b.is-negative{color:#a05c3b}
.publisher-suspicious-panel{margin-top:1rem}.publisher-suspicious-list{max-height:260px;overflow:auto}.publisher-suspicious-list>div{display:grid;grid-template-columns:100px minmax(180px,1fr) minmax(140px,.7fr) 190px;gap:1rem;padding:.65rem 1rem;border-top:1px solid #edf1ee;font-size:.59rem}.publisher-suspicious-list time,.publisher-suspicious-list span{color:#788582}.publisher-suspicious-list b{color:#a15938;text-transform:capitalize}
@media(max-width:1200px){.publisher-admin-kpis{grid-template-columns:repeat(4,1fr)}.publisher-contact-grid{grid-template-columns:repeat(3,1fr)}.publisher-credit-adjust{grid-template-columns:1fr 110px 1fr}.publisher-credit-adjust button{grid-column:2/4}.publisher-suspicious-list>div{grid-template-columns:90px 1fr 150px}.publisher-suspicious-list b{grid-column:2/4}}
@media(max-width:800px){.publisher-admin-kpis{grid-template-columns:repeat(2,1fr)}.publisher-admin-workspace{grid-template-columns:1fr}.publisher-application-list{max-height:330px}.publisher-contact-grid{grid-template-columns:1fr 1fr}.publisher-credit-adjust{grid-template-columns:1fr}.publisher-credit-adjust button{grid-column:auto}.publisher-admin-video{grid-template-columns:100px 1fr}.publisher-admin-video-actions{grid-column:1/-1;grid-template-columns:repeat(3,1fr)}.publisher-admin-history{overflow-x:auto}.publisher-admin-history>div:not(.publisher-admin-panel-heading){min-width:520px}}
@media(max-width:520px){.publisher-contact-grid,.publisher-admin-video{grid-template-columns:1fr}.publisher-suspicious-list>div{grid-template-columns:1fr}.publisher-suspicious-list b{grid-column:auto}}

@media (max-width: 780px) {
  html {
    scroll-padding-top: 5.5rem;
  }

  .dashboard {
    width: min(100% - 1rem, 1320px);
  }

  .admin-section-nav {
    width: 100%;
    grid-template-columns: repeat(6, minmax(142px, 1fr));
  }

  .manager-actions > * {
    width: 100%;
  }

  .sales-truth-banner {
    gap: 0.65rem;
  }

  .sales-truth-banner > div {
    padding-left: 4.4rem;
  }
}

@media (max-width: 560px) {
  .dashboard-header {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    align-items: flex-start;
  }

  .dashboard-header h1 {
    font-size: clamp(2.35rem, 13vw, 3.25rem);
  }

  .dashboard-actions {
    align-items: center;
    flex-direction: row;
    justify-content: flex-start;
  }

  .dashboard-actions .secondary-button {
    min-width: 0;
    padding-inline: 0.85rem;
  }

  .admin-navigation-shell {
    border-radius: 18px;
  }

  .dashboard-grid,
  .sales-kpi-grid {
    grid-template-columns: 1fr;
  }

  .admin-card {
    min-height: 205px;
  }

  .sales-manager,
  .bookshop-manager,
  .charity-manager {
    border-radius: 1.3rem;
    padding: 0.8rem;
  }

  .record-panel,
  .activity-panel {
    padding: 1rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }
}

/* eBay product curation */

#product-manager {
  scroll-margin-top: 6.5rem;
}

.product-manager {
  margin-top: 1.25rem;
  border: 1px solid rgba(25, 48, 51, 0.13);
  border-radius: var(--radius-panel);
  padding: clamp(1.1rem, 3vw, 2rem);
  background: rgba(255, 253, 248, 0.9);
  box-shadow: 0 26px 72px rgba(25, 48, 51, 0.1);
  backdrop-filter: blur(12px);
}

.product-import-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(300px, 0.8fr);
  gap: 1rem;
}

.manual-product-form,
.saved-page-import-form {
  margin-bottom: 1rem;
  border: 1px solid rgba(63, 102, 91, 0.22);
  border-radius: var(--radius-card);
  padding: clamp(1.1rem, 3vw, 1.6rem);
  background:
    radial-gradient(circle at 100% 0%, rgba(221, 187, 114, 0.16), transparent 18rem),
    linear-gradient(145deg, rgba(219, 233, 227, 0.78), rgba(255, 255, 255, 0.96));
  box-shadow: 0 14px 38px rgba(25, 48, 51, 0.07);
  transition: box-shadow 240ms ease;
}

.manual-product-form:hover,
.saved-page-import-form:hover {
  box-shadow: 0 18px 48px rgba(25, 48, 51, 0.1);
}

.ai-title-settings {
  border-color: rgba(63, 102, 91, 0.38);
  background:
    radial-gradient(circle at 100% 0%, rgba(221, 187, 114, 0.2), transparent 18rem),
    linear-gradient(145deg, rgba(20, 43, 45, 0.98), rgba(39, 77, 70, 0.96));
  color: var(--white);
}

.ai-title-settings .panel-label,
.ai-title-settings .manual-product-intro p,
.ai-title-settings .field-help {
  color: rgba(255, 255, 255, 0.72);
}

.ai-title-settings .manual-product-intro > span {
  background: rgba(255, 255, 255, 0.1);
  color: rgba(255, 255, 255, 0.72);
}

.ai-title-settings .manual-product-intro > span.is-connected {
  background: var(--gold);
  color: var(--ink);
}

.ai-title-settings > label {
  display: block;
  margin-bottom: 0.45rem;
  font-size: 0.82rem;
  font-weight: 800;
}

.ai-title-settings .form-message.is-success {
  color: #f1d68e;
}

.ai-keys-panel-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  margin: 0 0 0.85rem;
}

.ai-keys-toggle-button {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.ai-keys-toggle-button svg {
  width: 1.05rem;
  height: 1.05rem;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

.ai-keys-panel-hint {
  margin: 0;
  color: var(--ink-soft);
  font-size: 0.88rem;
}

.ai-keys-panel {
  display: grid;
  gap: 1rem;
}

.ai-keys-panel[hidden] {
  display: none;
}

.ai-keys-panel > .manual-product-form,
.ai-keys-panel > .saved-page-import-form {
  margin-bottom: 0;
}

.ai-image-settings {
  background:
    radial-gradient(circle at 92% 8%, rgba(224, 188, 111, 0.3), transparent 17rem),
    radial-gradient(circle at 8% 100%, rgba(126, 170, 151, 0.2), transparent 20rem),
    linear-gradient(145deg, #173335, #2d5149);
}

.saved-page-import-form {
  border-color: rgba(221, 187, 114, 0.55);
  background:
    radial-gradient(circle at 100% 0%, rgba(63, 102, 91, 0.13), transparent 18rem),
    linear-gradient(145deg, #fff5dc, rgba(255, 255, 255, 0.97));
}

.manual-product-intro {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.15rem;
}

.manual-product-intro h3 {
  margin: 0 0 0.35rem;
  font-size: 1.65rem;
  letter-spacing: -0.03em;
}

.manual-product-intro p {
  max-width: 680px;
  margin: 0;
  color: var(--ink-soft);
  line-height: 1.55;
}

.manual-product-intro > span {
  flex: 0 0 auto;
  border-radius: 999px;
  padding: 0.5rem 0.75rem;
  background: var(--white);
  color: var(--sage);
  font-size: 0.72rem;
  font-weight: 800;
}

.manual-product-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.85rem 1rem;
}

.saved-page-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.85rem 1rem;
}

.manual-product-grid label {
  display: block;
  margin-bottom: 0.4rem;
  font-size: 0.82rem;
  font-weight: 800;
}

.manual-product-grid label small {
  color: var(--ink-soft);
  font-weight: 600;
}

.saved-page-grid label {
  display: block;
  margin-bottom: 0.4rem;
  font-size: 0.82rem;
  font-weight: 800;
}

.saved-page-grid label small {
  color: var(--ink-soft);
  font-weight: 600;
}

.manual-product-grid input,
.manual-product-grid textarea,
.saved-page-grid input {
  width: 100%;
  border: 1px solid rgba(25, 48, 51, 0.17);
  border-radius: var(--radius-control);
  padding: 0.82rem 0.9rem;
  background: #fffdf9;
  color: var(--ink);
  font: inherit;
}

.manual-product-grid input[type="file"] {
  padding: 0.58rem;
  background: var(--white);
}

.saved-page-grid input[type="file"] {
  padding: 0.58rem;
  background: var(--white);
}

.saved-page-grid input[type="file"]::file-selector-button {
  margin-right: 0.8rem;
  border: 0;
  border-radius: 999px;
  padding: 0.62rem 0.8rem;
  background: #f2e8d1;
  color: #735a22;
  font-weight: 800;
  cursor: pointer;
}

.manual-product-grid input[type="file"]::file-selector-button {
  margin-right: 0.8rem;
  border: 0;
  border-radius: 999px;
  padding: 0.62rem 0.8rem;
  background: var(--sage-soft);
  color: var(--sage);
  font-weight: 800;
  cursor: pointer;
}

.manual-product-grid input:focus,
.manual-product-grid textarea:focus,
.saved-page-grid input:focus {
  border-color: var(--sage);
  box-shadow: 0 0 0 4px rgba(63, 102, 91, 0.12);
  outline: none;
}

.manual-product-form .form-actions {
  margin-top: 0.8rem;
}

.saved-page-import-form .form-actions {
  margin-top: 0.8rem;
}

.manual-product-form .primary-button,
.saved-page-import-form .primary-button {
  margin: 0;
}

.product-import-panel,
.product-import-note,
.product-library {
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 12px 34px rgba(25, 48, 51, 0.05);
  transition: box-shadow 240ms ease;
}

.product-import-panel:hover,
.product-library:hover {
  box-shadow: 0 16px 44px rgba(25, 48, 51, 0.08);
}

.product-import-panel {
  padding: clamp(1.1rem, 3vw, 1.6rem);
}

.product-import-panel h3,
.product-library h3 {
  margin: 0 0 0.45rem;
  font-size: 1.45rem;
  letter-spacing: -0.025em;
}

.product-import-panel label {
  display: block;
  margin: 1.25rem 0 0.45rem;
  font-size: 0.88rem;
  font-weight: 800;
}

.product-url-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.65rem;
}

.product-url-row input,
.product-edit-form input,
.product-edit-form textarea {
  width: 100%;
  border: 1px solid rgba(25, 48, 51, 0.17);
  border-radius: var(--radius-control);
  padding: 0.85rem 0.95rem;
  background: #fffdf9;
  color: var(--ink);
  font: inherit;
}

.product-url-row input:focus,
.product-edit-form input:focus,
.product-edit-form textarea:focus {
  border-color: var(--sage);
  box-shadow: 0 0 0 4px rgba(63, 102, 91, 0.12);
  outline: none;
}

.product-url-row .primary-button {
  min-width: 10.5rem;
  margin: 0;
}

.product-import-note {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.95rem 0.9rem;
  align-content: center;
  padding: 1.25rem;
  background:
    radial-gradient(circle at 100% 0%, rgba(221, 187, 114, 0.18), transparent 12rem),
    linear-gradient(145deg, rgba(219, 233, 227, 0.85), rgba(255, 255, 255, 0.95));
  transition: box-shadow 240ms ease;
}

.product-import-note:hover {
  box-shadow: 0 14px 38px rgba(25, 48, 51, 0.08);
}

.product-import-note > span {
  display: grid;
  width: 2.4rem;
  height: 2.4rem;
  place-items: center;
  border-radius: 50%;
  background: var(--sage);
  color: var(--white);
  font-size: 0.68rem;
  font-weight: 800;
}

.product-import-note strong {
  display: block;
  margin-bottom: 0.18rem;
}

.product-import-note p,
.product-library-heading p {
  margin: 0;
  color: var(--ink-soft);
  font-size: 0.84rem;
  line-height: 1.5;
}

.product-library {
  margin-top: 1rem;
  padding: clamp(1rem, 2.5vw, 1.4rem);
}

.product-library-heading {
  align-items: flex-end;
  margin-bottom: 1rem;
}

.product-bulk-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
}

.product-price-actions {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 0.55rem;
}

.product-price-refresh-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  margin: 0;
  box-shadow: 0 9px 22px rgba(25, 48, 51, 0.14);
  transition: background 180ms ease, border-color 180ms ease, box-shadow 180ms ease, color 180ms ease, transform 180ms ease, opacity 180ms ease;
}

.product-price-refresh-button:disabled {
  opacity: 0.45;
  box-shadow: none;
  transform: none;
}

.product-price-refresh-button svg,
.product-price-refresh-icon svg {
  width: 1.05rem;
  height: 1.05rem;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

.product-price-refresh-button.is-running svg {
  animation: product-price-refresh-spin 1.2s linear infinite;
}

.product-price-refresh-panel {
  display: grid;
  gap: 0.75rem;
  overflow: hidden;
  margin: 0 0 1rem;
  border: 1px solid rgba(63, 102, 91, 0.2);
  border-radius: 18px;
  padding: 0.85rem 1rem;
  background:
    radial-gradient(circle at 100% 0%, rgba(221, 187, 114, 0.2), transparent 12rem),
    linear-gradient(135deg, rgba(219, 233, 227, 0.82), rgba(255, 253, 249, 0.98));
  color: var(--ink);
  animation: price-refresh-in 300ms ease both;
}

@keyframes price-refresh-in {
  from {
    opacity: 0;
    max-height: 0;
    padding-block: 0;
  }
  to {
    opacity: 1;
    max-height: 20rem;
    padding-block: 0.85rem;
  }
}

.product-price-refresh-panel[hidden] {
  display: none;
}

.product-price-refresh-status {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.product-price-refresh-status > div {
  display: grid;
  gap: 0.12rem;
  flex: 1 1 auto;
  min-width: 0;
}

.product-price-refresh-details-button {
  flex: 0 0 auto;
  margin: 0;
  margin-left: auto;
  border: 1px solid rgba(63, 102, 91, 0.24);
  border-radius: 999px;
  padding: 0.5rem 0.95rem;
  background: rgba(255, 255, 255, 0.7);
  color: var(--sage);
  font-size: 0.76rem;
  font-weight: 800;
  cursor: pointer;
  transition: background-color 160ms ease, transform 160ms ease;
}

.product-price-refresh-details-button:hover {
  background: rgba(255, 255, 255, 0.95);
  transform: translateY(-1px);
}

.product-price-refresh-details-button[hidden] {
  display: none;
}

.product-price-refresh-status strong {
  font-size: 0.88rem;
}

.product-price-refresh-status span:not(.product-price-refresh-icon) {
  color: var(--ink-soft);
  font-size: 0.76rem;
  line-height: 1.45;
}

.product-price-refresh-icon {
  display: grid;
  flex: 0 0 auto;
  width: 2.15rem;
  height: 2.15rem;
  place-items: center;
  border-radius: 50%;
  background: var(--sage);
  color: var(--white);
  box-shadow: 0 7px 18px rgba(63, 102, 91, 0.18);
}

.product-price-refresh-panel.is-running .product-price-refresh-icon svg {
  animation: product-price-refresh-spin 1.2s linear infinite;
}

.product-price-refresh-panel.is-warning .product-price-refresh-icon {
  background: #a36d28;
}

.product-price-refresh-panel progress {
  width: 100%;
  height: 0.42rem;
  overflow: hidden;
  border: 0;
  border-radius: 999px;
  background: rgba(63, 102, 91, 0.12);
  color: var(--sage);
}

.product-price-refresh-panel progress::-webkit-progress-bar {
  border-radius: 999px;
  background: rgba(63, 102, 91, 0.12);
}

.product-price-refresh-panel progress::-webkit-progress-value {
  border-radius: 999px;
  background: linear-gradient(90deg, var(--sage), #ddbb72);
  transition: width 240ms ease;
}

.product-price-refresh-panel progress::-moz-progress-bar {
  border-radius: 999px;
  background: linear-gradient(90deg, var(--sage), #ddbb72);
}

@keyframes product-price-refresh-spin {
  to { transform: rotate(360deg); }
}

.price-refresh-dialog {
  width: min(620px, calc(100% - 1.25rem));
  max-height: min(760px, calc(100vh - 1.25rem));
  overflow: auto;
  border: 0;
  border-radius: 1.7rem;
  padding: 0;
  background: transparent;
  color: var(--ink);
  box-shadow: 0 36px 100px rgba(16, 35, 37, 0.3);
}

.price-refresh-dialog::backdrop {
  background: rgba(16, 35, 37, 0.72);
  backdrop-filter: blur(6px);
  animation: dialog-backdrop-in 200ms ease both;
}

.price-refresh-dialog-shell {
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.7);
  border-radius: inherit;
  background: #fffdf9;
}

.price-refresh-dialog-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  border-bottom: 1px solid var(--line);
  padding: 1.25rem 1.35rem;
  background:
    radial-gradient(circle at 90% 0%, rgba(221, 187, 114, 0.2), transparent 12rem),
    var(--sage-soft);
}

.price-refresh-dialog-header h2 {
  margin: 0.2rem 0 0.35rem;
  font-size: 1.4rem;
}

.price-refresh-dialog-header p[data-price-refresh-dialog-summary] {
  margin: 0;
  color: var(--ink-soft);
  font-size: 0.82rem;
}

.price-refresh-dialog-body {
  display: grid;
  gap: 1.1rem;
  max-height: min(560px, calc(100vh - 12rem));
  overflow: auto;
  padding: clamp(1.1rem, 4vw, 1.6rem);
}

.price-refresh-group[hidden] {
  display: none;
}

.price-refresh-group h3 {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0 0 0.55rem;
  font-size: 0.86rem;
  letter-spacing: -0.01em;
}

.price-refresh-group-count {
  margin-left: 0.15rem;
  color: var(--ink-soft);
  font-weight: 700;
}

.price-refresh-dot {
  display: inline-block;
  width: 0.6rem;
  height: 0.6rem;
  border-radius: 50%;
  background: var(--sage);
}

.price-refresh-dot.is-unchanged {
  background: rgba(25, 48, 51, 0.25);
}

.price-refresh-dot.is-unlisted {
  background: #b23b3b;
}

.price-refresh-dot.is-failed {
  background: #9b4d27;
}

.price-refresh-group-list {
  display: grid;
  gap: 0.5rem;
}

.price-refresh-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  border: 1px solid var(--line);
  border-radius: 0.9rem;
  padding: 0.6rem 0.85rem;
  background: rgba(255, 255, 255, 0.7);
}

.price-refresh-item-copy {
  display: grid;
  gap: 0.15rem;
  min-width: 0;
}

.price-refresh-item strong {
  font-size: 0.82rem;
  font-weight: 700;
}

.price-refresh-item-copy span {
  color: var(--ink-soft);
  font-size: 0.76rem;
}

.price-refresh-item-link {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 0.3rem;
  color: var(--sage);
  font-size: 0.76rem;
  font-weight: 700;
  line-height: 1.2;
  text-decoration: none;
}

.price-refresh-item-link svg {
  width: 0.95rem;
  height: 0.95rem;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

.price-refresh-item-link:hover,
.price-refresh-item-link:focus-visible {
  color: var(--ink);
  outline: none;
  text-decoration: underline;
  text-underline-offset: 2px;
}

@media (max-width: 620px) {
  .price-refresh-item {
    align-items: flex-start;
    flex-direction: column;
  }

  .price-refresh-item-copy {
    width: 100%;
  }
}

.product-admin-list {
  display: grid;
  gap: 0.8rem;
  max-height: min(70svh, 48rem);
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
  border: 1px solid rgba(25, 48, 51, 0.12);
  border-radius: calc(var(--radius-card) + 0.1rem);
  padding: 0.7rem;
  background:
    linear-gradient(180deg, rgba(219, 233, 227, 0.18), transparent 4rem),
    rgba(247, 248, 244, 0.72);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.9);
  -webkit-overflow-scrolling: touch;
}

.product-admin-list:focus-visible {
  border-color: var(--sage);
  outline: 4px solid rgba(63, 102, 91, 0.14);
  outline-offset: 2px;
}

.product-admin-list::-webkit-scrollbar {
  width: 0.75rem;
}

.product-admin-list::-webkit-scrollbar-track {
  border-radius: 999px;
  background: rgba(25, 48, 51, 0.06);
}

.product-admin-list::-webkit-scrollbar-thumb {
  border: 3px solid transparent;
  border-radius: 999px;
  background: rgba(63, 102, 91, 0.48);
  background-clip: padding-box;
}

.product-admin-list::-webkit-scrollbar-thumb:hover {
  background: rgba(63, 102, 91, 0.68);
  background-clip: padding-box;
}

.sleep-product-manager {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(18rem, 0.95fr);
  gap: 1.25rem 1.5rem;
  margin-bottom: 1.5rem;
  border: 1px solid rgba(212, 164, 47, 0.34);
  border-radius: var(--radius-card);
  padding: clamp(1rem, 2.5vw, 1.5rem);
  background:
    radial-gradient(circle at 100% 0%, rgba(255, 216, 112, 0.24), transparent 15rem),
    linear-gradient(145deg, #fff9e9, #fffdf9);
  box-shadow: 0 14px 38px rgba(93, 72, 23, 0.08);
}

.loved-ones-product-manager {
  border-color: rgba(63, 102, 91, 0.3);
  background:
    radial-gradient(circle at 100% 0%, rgba(184, 206, 194, 0.3), transparent 16rem),
    linear-gradient(145deg, #f3faf5, #fffdf9);
  box-shadow: 0 14px 38px rgba(35, 78, 65, 0.08);
}

.loved-ones-product-manager .sleep-product-selection {
  border-top-color: rgba(63, 102, 91, 0.2);
}

.sleep-product-manager-copy h3 {
  margin: 0.3rem 0 0.55rem;
  font-size: clamp(1.25rem, 2vw, 1.65rem);
}

.sleep-product-manager-copy > p:last-child {
  max-width: 42rem;
  margin: 0;
  color: var(--ink-soft);
  line-height: 1.65;
}

.sleep-product-picker {
  align-self: center;
}

.sleep-product-picker > label {
  display: block;
  margin-bottom: 0.45rem;
  color: var(--ink);
  font-size: 0.78rem;
  font-weight: 800;
}

.sleep-product-picker-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.65rem;
}

.sleep-product-picker select {
  min-width: 0;
  min-height: 2.9rem;
  border: 1px solid var(--line-strong);
  border-radius: 0.8rem;
  padding: 0.65rem 0.8rem;
  background: #fff;
  color: var(--ink);
  font: inherit;
}

.sleep-product-picker select:focus {
  border-color: var(--sage);
  outline: 3px solid rgba(63, 102, 91, 0.14);
}

.sleep-product-selection {
  grid-column: 1 / -1;
  border-top: 1px solid rgba(212, 164, 47, 0.26);
  padding-top: 1rem;
}

.sleep-product-selection-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.7rem;
}

.sleep-product-selection-heading a {
  color: var(--sage-dark);
  font-size: 0.82rem;
  font-weight: 800;
}

.sleep-product-admin-list {
  display: grid;
  gap: 0.55rem;
}

.sleep-product-admin-item {
  display: grid;
  grid-template-columns: 3rem minmax(0, 1fr) auto;
  align-items: center;
  gap: 0.8rem;
  border: 1px solid rgba(25, 48, 51, 0.11);
  border-radius: 0.85rem;
  padding: 0.55rem 0.65rem;
  background: rgba(255, 255, 255, 0.82);
}

.sleep-product-admin-image {
  width: 3rem;
  border-radius: 0.65rem;
}

.sleep-product-admin-item strong {
  min-width: 0;
  overflow: hidden;
  font-size: 0.88rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sleep-product-admin-empty {
  margin: 0;
  border: 1px dashed rgba(25, 48, 51, 0.18);
  border-radius: 0.85rem;
  padding: 0.9rem;
  color: var(--ink-soft);
  background: rgba(255, 255, 255, 0.52);
  font-size: 0.86rem;
}

.sleep-product-admin-message {
  margin: 0.65rem 0 0;
}

.product-admin-item {
  display: grid;
  grid-template-columns: auto 112px minmax(0, 1fr) auto;
  gap: 1rem;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  padding: 0.9rem;
  background: #fffdf9;
  scroll-margin-block: 0.75rem;
  transition: border-color 180ms ease, box-shadow 180ms ease, transform 180ms ease;
}

.product-admin-item:hover {
  border-color: rgba(63, 102, 91, 0.28);
  box-shadow: 0 14px 34px rgba(25, 48, 51, 0.07);
  transform: translateY(-2px);
}

.product-admin-item:has(.product-edit-form) {
  box-shadow: 0 0 0 2px rgba(63, 102, 91, 0.12), 0 14px 34px rgba(25, 48, 51, 0.07);
}

.product-selector {
  display: grid;
  width: 2.5rem;
  min-height: 5rem;
  place-items: center;
  border-right: 1px solid var(--line);
}

.product-selector input {
  width: 1.15rem;
  height: 1.15rem;
  accent-color: var(--sage);
}

.product-admin-image {
  display: grid;
  width: 112px;
  aspect-ratio: 1;
  overflow: hidden;
  place-items: center;
  border-radius: 14px;
  background: var(--sage-soft);
  color: var(--ink-soft);
  font-size: 0.72rem;
  text-align: center;
}

.product-admin-image img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: var(--white);
}

.product-admin-copy {
  min-width: 0;
}

.product-admin-copy h4 {
  margin: 0.45rem 0 0.35rem;
  font-size: 1.06rem;
}

.product-admin-copy > p {
  display: -webkit-box;
  overflow: hidden;
  margin: 0 0 0.55rem;
  color: var(--ink-soft);
  font-size: 0.82rem;
  line-height: 1.5;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.product-status {
  display: inline-flex;
  border-radius: 999px;
  padding: 0.28rem 0.58rem;
  background: #f2e8d1;
  color: #735a22;
  font-size: 0.7rem;
  font-weight: 800;
  text-transform: uppercase;
}

.product-status.is-live {
  background: var(--sage-soft);
  color: var(--sage);
}

.product-admin-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 0.75rem;
  color: var(--ink-soft);
  font-size: 0.76rem;
  font-weight: 700;
}

.product-admin-meta .is-price-rule {
  border-radius: 999px;
  padding: 0.2rem 0.48rem;
  background: #f2e8d1;
  color: #735a22;
}

.product-admin-meta .is-delivery-estimate {
  border-radius: 999px;
  padding: 0.2rem 0.48rem;
  background: #e4f1ed;
  color: #285d50;
}

.product-admin-meta .product-price-check-result {
  border-radius: 999px;
  padding: 0.2rem 0.48rem;
  background: var(--sage-soft);
  color: var(--sage);
}

.product-admin-meta .product-price-check-result.is-unchanged {
  background: rgba(25, 48, 51, 0.07);
  color: var(--ink-soft);
}

.product-admin-meta .product-price-check-result.is-failed {
  background: #fff0e5;
  color: #9b4d27;
}

.product-admin-meta .product-price-check-result.is-unlisted {
  background: #fbe4e4;
  color: #b23b3b;
}

.product-admin-actions {
  display: grid;
  min-width: 9.5rem;
  gap: 0.45rem;
}

.product-admin-actions .primary-button {
  margin: 0;
}

.product-edit-form {
  grid-column: 2 / -1;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.75rem;
  border-top: 1px solid var(--line);
  padding-top: 1rem;
}

.product-edit-form label {
  display: grid;
  gap: 0.4rem;
  color: var(--ink);
  font-size: 0.78rem;
  font-weight: 800;
}

.product-edit-form .product-edit-wide,
.product-pricing-editor,
.product-image-editor,
.product-video-editor,
.product-edit-actions {
  grid-column: 1 / -1;
}

.product-pricing-editor {
  overflow: hidden;
  border: 1px solid rgba(63, 102, 91, 0.18);
  border-radius: 16px;
  background: linear-gradient(135deg, #f2f7f4, #fffaf0);
}

.product-pricing-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  border-bottom: 1px solid rgba(63, 102, 91, 0.13);
  padding: 0.9rem 1rem;
}

.product-pricing-heading strong {
  display: block;
  font-size: 0.86rem;
}

.product-pricing-heading p {
  margin: 0.2rem 0 0;
  color: var(--ink-soft);
  font-size: 0.7rem;
  font-weight: 500;
}

.product-price-preview {
  flex: 0 0 auto;
  border-radius: 999px;
  padding: 0.55rem 0.75rem;
  background: var(--sage);
  color: #fff;
  box-shadow: 0 8px 20px rgba(63, 102, 91, 0.2);
  font-size: 0.83rem;
  font-weight: 900;
}

.product-pricing-controls {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.8rem;
  padding: 0.9rem 1rem 0.7rem;
}

.product-pricing-controls label {
  align-content: start;
}

.profit-slider-label > span {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
}

.profit-slider-label output {
  color: var(--sage);
  font-weight: 900;
}

.product-edit-form input[type="range"] {
  height: 2.65rem;
  border: 0;
  padding: 0;
  background: transparent;
  accent-color: var(--sage);
  box-shadow: none;
  cursor: pointer;
}

.product-pricing-help {
  margin: 0;
  padding: 0 1rem 0.9rem;
  color: var(--ink-soft);
  font-size: 0.67rem;
  line-height: 1.45;
}

.product-pricing-help::after {
  content: " This changes the displayed store price; retailer checkout cannot collect the markup until a payment provider is connected.";
  color: #875f52;
  font-weight: 750;
}

.product-image-editor {
  overflow: hidden;
  border: 1px solid rgba(63, 102, 91, 0.18);
  border-radius: 16px;
  background: #f7faf8;
}

.product-image-editor-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  border-bottom: 1px solid rgba(63, 102, 91, 0.13);
  padding: 0.9rem 1rem;
}

.product-image-editor-heading strong {
  display: block;
  font-size: 0.86rem;
}

.product-image-editor-heading p {
  margin: 0.2rem 0 0;
  color: var(--ink-soft);
  font-size: 0.7rem;
  font-weight: 500;
}

.product-image-editor-heading > span {
  flex: 0 0 auto;
  border-radius: 999px;
  padding: 0.35rem 0.55rem;
  background: var(--sage-soft);
  color: var(--sage);
  font-size: 0.62rem;
  font-weight: 850;
}

.product-edit-images {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 0.65rem;
  padding: 1rem;
}

.product-edit-image {
  position: relative;
  display: flex;
  flex-direction: column;
  min-width: 0;
  overflow: hidden;
  margin: 0;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #edf3ef;
  box-shadow: 0 8px 20px rgba(25, 48, 51, 0.08);
  transition: border-color 160ms ease, box-shadow 160ms ease, opacity 160ms ease, transform 160ms ease;
}

.product-edit-image:focus-visible {
  outline: 3px solid #e0bc6f;
  outline-offset: 3px;
}

.product-edit-image.is-dragging {
  opacity: 0.38;
  transform: scale(0.96);
}

.product-edit-image.is-drop-before {
  border-color: #c99c42;
  box-shadow: inset 5px 0 0 #e0bc6f, 0 12px 26px rgba(25, 48, 51, 0.16);
  transform: translateX(3px);
}

.product-edit-image.is-drop-after {
  border-color: #c99c42;
  box-shadow: inset -5px 0 0 #e0bc6f, 0 12px 26px rgba(25, 48, 51, 0.16);
  transform: translateX(-3px);
}

.product-edit-image img {
  width: 100%;
  height: auto;
  aspect-ratio: 1;
  flex: 0 0 auto;
  object-fit: cover;
}

.product-edit-image-drag {
  position: absolute;
  z-index: 3;
  top: 0.35rem;
  left: 50%;
  display: grid;
  width: 1.85rem;
  height: 1.7rem;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.76);
  border-radius: 999px;
  background: rgba(25, 48, 51, 0.86);
  box-shadow: 0 5px 14px rgba(12, 28, 29, 0.2);
  color: #fff;
  font-size: 1rem;
  line-height: 1;
  cursor: grab;
  transform: translateX(-50%);
  user-select: none;
  backdrop-filter: blur(8px);
}

.product-edit-image-drag:hover {
  border-color: #f3d895;
  background: #315d52;
}

.product-edit-image-drag:active {
  cursor: grabbing;
}

.product-edit-images.is-generating .product-edit-image-drag {
  cursor: wait;
  opacity: 0.55;
}

.product-edit-image.is-unavailable::after {
  content: "Image unavailable";
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 0.5rem;
  color: var(--ink-soft);
  font-size: 0.58rem;
  text-align: center;
}

.product-edit-image.is-unavailable img {
  display: none;
}

.product-edit-image-remove {
  position: absolute;
  top: 0.35rem;
  right: 0.35rem;
  display: grid;
  width: 1.7rem;
  height: 1.7rem;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.72);
  border-radius: 50%;
  padding: 0;
  background: rgba(25, 48, 51, 0.88);
  color: #fff;
  font-size: 1rem;
  line-height: 1;
  cursor: pointer;
}

.product-edit-image-remove:hover {
  background: #a24f47;
}

.product-edit-image-remove:focus-visible {
  outline: 3px solid #e0bc6f;
  outline-offset: 2px;
}

.product-edit-image-tools {
  position: relative;
  z-index: 4;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.35rem;
  padding: 0.45rem;
  background: #fffdf8;
}

.product-edit-image-generate,
.product-edit-image-customise,
.product-edit-image-show-person {
  border: 1px solid rgba(255, 255, 255, 0.78);
  border-radius: 999px;
  padding: 0.34rem 0.52rem;
  background: rgba(25, 48, 51, 0.9);
  box-shadow: 0 6px 16px rgba(12, 28, 29, 0.22);
  color: #fff;
  font: inherit;
  font-size: 0.54rem;
  font-weight: 900;
  letter-spacing: 0.02em;
  cursor: pointer;
  backdrop-filter: blur(8px);
}

.product-edit-image-customise {
  background: rgba(255, 250, 241, 0.94);
  color: var(--ink);
}

.product-edit-image-show-person {
  grid-column: 1 / -1;
  background: rgba(44, 96, 82, 0.96);
  text-align: center;
}

.product-edit-image-generate:hover,
.product-edit-image-customise:hover,
.product-edit-image-show-person:hover {
  border-color: var(--gold);
  background: #315d52;
  color: #fff;
  transform: translateY(-1px);
}

.product-edit-image-generate:focus-visible,
.product-edit-image-customise:focus-visible,
.product-edit-image-show-person:focus-visible {
  outline: 3px solid #e0bc6f;
  outline-offset: 2px;
}

.product-edit-image-generate:disabled,
.product-edit-image-customise:disabled,
.product-edit-image-show-person:disabled {
  cursor: wait;
  opacity: 0.65;
}

.product-edit-images.is-generating .product-edit-image img {
  filter: saturate(0.72);
  opacity: 0.72;
}

.product-studio-image-badge {
  position: absolute;
  z-index: 2;
  top: 0.35rem;
  left: 0.35rem;
  border: 1px solid rgba(255, 255, 255, 0.7);
  border-radius: 999px;
  padding: 0.25rem 0.42rem;
  background: linear-gradient(135deg, #e0bc6f, #f3d895);
  box-shadow: 0 5px 14px rgba(25, 48, 51, 0.18);
  color: var(--ink);
  font-size: 0.48rem;
  font-weight: 950;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.product-edit-image.is-studio-preview {
  border-color: rgba(224, 188, 111, 0.9);
  box-shadow: 0 0 0 3px rgba(224, 188, 111, 0.18);
}

.product-main-image-badge {
  position: absolute;
  z-index: 1;
  bottom: 0.35rem;
  left: 0.35rem;
  border-radius: 999px;
  padding: 0.26rem 0.42rem;
  background: #e0bc6f;
  color: var(--ink);
  font-size: 0.5rem;
  font-weight: 900;
  text-transform: uppercase;
}

.product-images-empty {
  grid-column: 1 / -1;
  margin: 0;
  border: 1px dashed rgba(162, 79, 71, 0.32);
  border-radius: 12px;
  padding: 1rem;
  background: #fff8f5;
  color: #80574f;
  font-size: 0.73rem;
  font-weight: 700;
  text-align: center;
}

.product-studio-message {
  margin: 0;
  border-top: 1px solid rgba(63, 102, 91, 0.13);
  padding: 0.75rem 1rem;
  background: rgba(219, 233, 227, 0.48);
  color: var(--ink-soft);
  font-size: 0.7rem;
  font-weight: 700;
  line-height: 1.5;
}

.product-studio-message:empty {
  display: none;
}

.product-studio-message.is-success {
  background: rgba(219, 233, 227, 0.8);
  color: #315d52;
}

.product-studio-message.is-error {
  background: #fff4f0;
  color: #98473f;
}

.product-custom-studio[hidden] {
  display: none;
}

.product-custom-studio {
  border-top: 1px solid rgba(63, 102, 91, 0.16);
  padding: 1rem;
  background:
    radial-gradient(circle at 100% 0%, rgba(224, 188, 111, 0.18), transparent 16rem),
    #fffdf9;
}

.product-custom-studio-heading,
.product-custom-studio-feedback-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.product-custom-studio-heading strong {
  font-size: 0.9rem;
}

.product-custom-studio-heading p {
  max-width: 54rem;
  margin: 0.25rem 0 0;
  color: var(--ink-soft);
  font-size: 0.7rem;
  line-height: 1.5;
}

.product-custom-studio-close {
  flex: 0 0 auto;
  border: 0;
  padding: 0.35rem;
  background: transparent;
  color: var(--sage-deep);
  font: inherit;
  font-size: 0.72rem;
  font-weight: 800;
  cursor: pointer;
}

.product-custom-studio-workspace {
  display: grid;
  grid-template-columns: minmax(13rem, 0.85fr) minmax(0, 1.15fr);
  gap: 1rem;
  margin-top: 0.9rem;
}

.product-custom-studio-preview {
  overflow: hidden;
  margin: 0;
  border: 1px solid rgba(224, 188, 111, 0.72);
  border-radius: 14px;
  background: #edf3ef;
  box-shadow: 0 12px 28px rgba(25, 48, 51, 0.1);
}

.product-custom-studio-preview[hidden] {
  display: none;
}

.product-custom-studio-preview img {
  display: block;
  width: 100%;
  aspect-ratio: 1;
  object-fit: contain;
  background: #fff;
}

.product-custom-studio-preview figcaption {
  padding: 0.55rem 0.7rem;
  background: #f4dfaa;
  color: var(--ink);
  font-size: 0.66rem;
  font-weight: 900;
  text-align: center;
  text-transform: uppercase;
}

.product-custom-studio-history-section > strong {
  display: block;
  margin-bottom: 0.55rem;
  font-size: 0.72rem;
}

.product-custom-studio-history {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.55rem;
}

.product-custom-studio-history > p {
  grid-column: 1 / -1;
  margin: 0;
  border: 1px dashed rgba(63, 102, 91, 0.22);
  border-radius: 12px;
  padding: 1rem;
  color: var(--ink-soft);
  font-size: 0.7rem;
}

.product-custom-studio-cost-summary {
  margin: 0.65rem 0 0;
  border-radius: 9px;
  padding: 0.55rem 0.65rem;
  background: rgba(224, 188, 111, 0.2);
  color: var(--ink);
  font-size: 0.64rem;
  font-weight: 850;
  line-height: 1.45;
}

.product-custom-studio-cost-summary[hidden] {
  display: none;
}

.product-custom-studio-history-item {
  overflow: hidden;
  margin: 0;
  border: 1px solid rgba(63, 102, 91, 0.16);
  border-radius: 10px;
  background: #fff;
}

.product-custom-studio-history-item img {
  display: block;
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
}

.product-custom-studio-history-item figcaption {
  padding: 0.35rem;
  color: var(--ink-soft);
  font-size: 0.58rem;
  font-weight: 800;
  text-align: center;
}

.product-custom-studio-prompt,
.product-custom-studio-feedback {
  margin-top: 0.9rem;
  border: 1px solid rgba(63, 102, 91, 0.14);
  border-radius: 12px;
  padding: 0.85rem;
  background: rgba(247, 250, 248, 0.88);
}

.product-custom-studio-prompt[hidden],
.product-custom-studio-feedback[hidden],
.product-custom-studio-accepted[hidden] {
  display: none;
}

.product-custom-studio-prompt label {
  display: grid;
  gap: 0.45rem;
}

.product-custom-studio-prompt label > strong,
.product-custom-studio-feedback > strong {
  font-size: 0.78rem;
}

.product-custom-studio-prompt textarea {
  width: 100%;
  resize: vertical;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  padding: 0.75rem;
  background: #fff;
  color: var(--ink);
  font: inherit;
  font-size: 0.78rem;
  line-height: 1.5;
}

.product-custom-studio-prompt textarea:focus {
  border-color: var(--sage);
  outline: 3px solid rgba(63, 102, 91, 0.14);
}

.product-custom-studio-help {
  margin: 0.45rem 0 0.7rem;
  color: var(--ink-soft);
  font-size: 0.65rem;
  line-height: 1.45;
}

.product-custom-studio-feedback-actions {
  justify-content: flex-start;
  margin-top: 0.7rem;
}

.product-custom-studio-accepted {
  margin: 0.75rem 0 0;
  border-radius: 10px;
  padding: 0.7rem 0.8rem;
  background: rgba(219, 233, 227, 0.82);
  color: #315d52;
  font-size: 0.7rem;
  font-weight: 800;
}

.product-custom-studio.is-generating {
  cursor: wait;
}

.product-custom-studio.is-generating .product-custom-studio-workspace,
.product-custom-studio.is-generating .product-custom-studio-prompt {
  opacity: 0.72;
}

.product-image-upload {
  display: grid;
  gap: 0.25rem;
  border-top: 1px solid rgba(63, 102, 91, 0.13);
  padding: 0.9rem 1rem 1rem;
  background: #fffdf9;
}

.product-image-upload > strong {
  font-size: 0.78rem;
}

.product-image-upload > span {
  color: var(--ink-soft);
  font-size: 0.65rem;
  font-weight: 500;
}

.product-image-upload input {
  margin-top: 0.45rem;
}

.product-video-editor {
  overflow: hidden;
  border: 1px solid rgba(63, 102, 91, 0.2);
  border-radius: 16px;
  background: #f7faf8;
  box-shadow: 0 14px 34px rgba(25, 48, 51, 0.06);
}

.product-video-editor-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  border-bottom: 1px solid rgba(63, 102, 91, 0.13);
  padding: 0.9rem 1rem;
}

.product-video-editor-heading strong {
  display: block;
  font-size: 0.86rem;
}

.product-video-editor-heading p {
  margin: 0.2rem 0 0;
  color: var(--ink-soft);
  font-size: 0.7rem;
  font-weight: 500;
}

.product-video-editor-heading > span {
  flex: 0 0 auto;
  border-radius: 999px;
  padding: 0.35rem 0.58rem;
  background: linear-gradient(135deg, #e7f0ec, #f3e6c8);
  color: #315d52;
  font-size: 0.62rem;
  font-weight: 850;
}

.product-video-stage {
  padding: 1rem;
  background:
    radial-gradient(circle at 80% 10%, rgba(224, 188, 111, 0.2), transparent 18rem),
    linear-gradient(145deg, #173335, #294c46);
}

.product-video-empty {
  display: grid;
  min-height: 170px;
  place-items: center;
  align-content: center;
  gap: 0.38rem;
  border: 1px dashed rgba(255, 255, 255, 0.3);
  border-radius: 13px;
  padding: 1.5rem;
  color: #fff;
  text-align: center;
}

.product-video-empty strong {
  font-size: 0.85rem;
}

.product-video-empty > span:last-child {
  max-width: 430px;
  color: rgba(255, 255, 255, 0.68);
  font-size: 0.67rem;
  line-height: 1.5;
}

.product-video-empty-mark {
  position: relative;
  display: grid;
  width: 2.8rem;
  height: 2.8rem;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.36);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.1);
  box-shadow: 0 0 0 8px rgba(255, 255, 255, 0.035);
}

.product-video-empty-mark::after {
  content: "";
  border-top: 0.42rem solid transparent;
  border-bottom: 0.42rem solid transparent;
  border-left: 0.66rem solid #e0bc6f;
  margin-left: 0.14rem;
}

.product-video-preview {
  position: relative;
  width: min(100%, 720px);
  overflow: hidden;
  margin: 0 auto;
  border: 1px solid rgba(255, 255, 255, 0.24);
  border-radius: 14px;
  background: #0d2021;
  box-shadow: 0 22px 54px rgba(8, 24, 25, 0.34);
}

.product-video-preview video,
.product-video-preview iframe {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  max-height: 380px;
  border: 0;
  background: #0a1b1c;
  object-fit: contain;
}

.product-video-preview-badge {
  position: absolute;
  top: 0.7rem;
  left: 0.7rem;
  border: 1px solid rgba(255, 255, 255, 0.58);
  border-radius: 999px;
  padding: 0.32rem 0.55rem;
  background: rgba(25, 48, 51, 0.84);
  color: #fff;
  font-size: 0.55rem;
  font-weight: 850;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  backdrop-filter: blur(8px);
}

.product-video-remove {
  position: absolute;
  top: 0.65rem;
  right: 0.65rem;
  border: 1px solid rgba(255, 255, 255, 0.7);
  border-radius: 999px;
  padding: 0.42rem 0.68rem;
  background: rgba(25, 48, 51, 0.88);
  color: #fff;
  font: inherit;
  font-size: 0.6rem;
  font-weight: 850;
  cursor: pointer;
  backdrop-filter: blur(8px);
}

.product-video-remove:hover {
  background: #a24f47;
}

.product-video-upload {
  display: grid;
  gap: 0.25rem;
  border-top: 1px solid rgba(63, 102, 91, 0.13);
  padding: 0.9rem 1rem 1rem;
  background: #fffdf9;
}

.product-video-upload > strong {
  font-size: 0.78rem;
}

.product-video-upload > span {
  color: var(--ink-soft);
  font-size: 0.65rem;
  font-weight: 500;
  line-height: 1.45;
}

.product-video-upload input {
  margin-top: 0.45rem;
}

.product-video-source-divider {
  position: relative;
  display: grid;
  height: 0;
  place-items: center;
  border-top: 1px solid rgba(63, 102, 91, 0.13);
  color: var(--ink-soft);
  font-size: 0.58rem;
  font-weight: 850;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.product-video-source-divider::before {
  content: "";
  position: absolute;
  width: 2.3rem;
  height: 1.25rem;
  background: #fffdf9;
}

.product-video-source-divider {
  z-index: 1;
}

.product-video-source-divider::after {
  content: "or";
  position: relative;
  z-index: 1;
  font-size: 0.58rem;
}

.product-video-source-divider {
  font-size: 0;
}

.product-video-link {
  display: grid;
  gap: 0.28rem;
  padding: 1rem;
  background: #fffdf9;
}

.product-video-link > strong {
  font-size: 0.78rem;
}

.product-video-link > span {
  color: var(--ink-soft);
  font-size: 0.65rem;
  font-weight: 500;
  line-height: 1.45;
}

.product-video-link input {
  margin-top: 0.4rem;
}

.product-admin-meta .is-video {
  border-radius: 999px;
  padding: 0.2rem 0.48rem;
  background: #e7f0ec;
  color: #315d52;
}

.product-admin-meta .is-sleep-featured {
  border: 1px solid rgba(192, 143, 34, 0.32);
  border-radius: 999px;
  padding: 0.2rem 0.48rem;
  background: #fff4bd;
  color: #654b0b;
  font-weight: 800;
}

.product-edit-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
}

.product-edit-actions .primary-button {
  margin: 0;
}

.product-import-panel .form-message {
  margin-bottom: 0;
}

.browser-import-fallback {
  display: grid;
  gap: 0.7rem;
  margin-top: 1.1rem;
  border-top: 1px solid var(--line);
  padding-top: 1.1rem;
}

.browser-import-fallback strong {
  display: block;
  margin-bottom: 0.25rem;
}

.browser-import-fallback p,
.browser-import-fallback small {
  margin: 0;
  color: var(--ink-soft);
  font-size: 0.78rem;
  line-height: 1.55;
}

.guided-import-start {
  width: max-content;
  margin: 0;
}

.browser-import-fallback details {
  border-top: 1px solid var(--line);
  padding-top: 0.7rem;
}

.browser-import-fallback summary {
  color: var(--sage);
  font-size: 0.78rem;
  font-weight: 800;
  cursor: pointer;
}

.browser-import-fallback details p {
  margin: 0.65rem 0;
}

.browser-import-bookmark {
  width: max-content;
  border-style: dashed;
  cursor: grab;
}

.browser-import-bookmark:active {
  cursor: grabbing;
}

.guided-import-dialog {
  width: min(620px, calc(100% - 1.25rem));
  max-height: min(760px, calc(100vh - 1.25rem));
  overflow: auto;
  border: 0;
  border-radius: 1.7rem;
  padding: 0;
  background: transparent;
  color: var(--ink);
  box-shadow: 0 36px 100px rgba(16, 35, 37, 0.3);
}

.guided-import-dialog::backdrop {
  background: rgba(16, 35, 37, 0.72);
  backdrop-filter: blur(6px);
  animation: dialog-backdrop-in 200ms ease both;
}

.guided-import-shell {
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.7);
  border-radius: inherit;
  background: #fffdf9;
}

.guided-import-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  border-bottom: 1px solid var(--line);
  padding: 1.25rem 1.35rem;
  background:
    radial-gradient(circle at 90% 0%, rgba(221, 187, 114, 0.2), transparent 12rem),
    var(--sage-soft);
}

.guided-import-header h2 {
  margin: 0;
  font-size: 1.45rem;
}

.guided-import-header .panel-label {
  margin-bottom: 0.35rem;
}

.guided-import-close {
  display: grid;
  width: 2.6rem;
  height: 2.6rem;
  flex: 0 0 auto;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.8);
  color: var(--ink);
  font-size: 1.35rem;
  cursor: pointer;
}

.guided-import-step {
  min-height: 330px;
  padding: clamp(1.4rem, 5vw, 2.3rem);
  animation: guided-step-in 300ms ease both;
}

@keyframes guided-step-in {
  from {
    opacity: 0;
    transform: translateY(0.75rem);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.guided-step-number {
  display: grid;
  width: 3rem;
  height: 3rem;
  margin-bottom: 1.15rem;
  place-items: center;
  border-radius: 50%;
  background: var(--sage);
  color: var(--white);
  font-size: 1rem;
  font-weight: 800;
}

.guided-import-step h3 {
  margin: 0 0 0.55rem;
  font-size: clamp(1.5rem, 5vw, 2rem);
  letter-spacing: -0.03em;
}

.guided-import-step > p:not(.form-message) {
  max-width: 500px;
  margin: 0 0 1.4rem;
  color: var(--ink-soft);
  line-height: 1.7;
}

.guided-import-step .primary-button {
  margin: 0;
}

.guided-import-step kbd {
  display: inline-grid;
  min-width: 2rem;
  min-height: 1.8rem;
  place-items: center;
  border: 1px solid rgba(25, 48, 51, 0.2);
  border-bottom-width: 3px;
  border-radius: 0.4rem;
  padding: 0.1rem 0.35rem;
  background: var(--white);
  color: var(--ink);
  font: 700 0.82rem/1 Inter, sans-serif;
}

.guided-paste-zone {
  display: grid;
  min-height: 150px;
  place-content: center;
  gap: 0.35rem;
  border: 2px dashed rgba(63, 102, 91, 0.42);
  border-radius: var(--radius-card);
  padding: 1.25rem;
  background: var(--sage-soft);
  color: var(--sage);
  text-align: center;
  cursor: text;
  transition: border-color 180ms ease, box-shadow 180ms ease, background 180ms ease;
}

.guided-paste-zone:hover {
  border-color: rgba(63, 102, 91, 0.6);
  background: #dcebe5;
}

.guided-paste-zone:focus {
  border-color: var(--sage);
  box-shadow: 0 0 0 4px rgba(63, 102, 91, 0.13);
  outline: none;
}

.guided-paste-zone.is-working {
  cursor: wait;
}

.guided-paste-zone span {
  color: var(--ink-soft);
  font-size: 0.78rem;
  font-weight: 600;
}

.guided-import-footer {
  display: flex;
  justify-content: space-between;
  gap: 0.65rem;
  border-top: 1px solid var(--line);
  padding: 0.9rem 1.35rem;
  background: var(--paper);
}

@media (min-width: 1080px) {
  .dashboard-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

@media (max-width: 900px) {
  .product-import-layout {
    grid-template-columns: 1fr;
  }

  .product-admin-item {
    grid-template-columns: auto 96px minmax(0, 1fr);
  }

  .product-admin-image {
    width: 96px;
  }

  .product-admin-actions {
    grid-column: 2 / -1;
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .product-edit-form {
    grid-column: 1 / -1;
  }
}

@media (max-width: 620px) {
  .book-import-grid,
  .book-import-control {
    grid-template-columns: 1fr;
  }

  .book-import-panel .catalogue-heading {
    flex-direction: column;
  }

  .book-import-form button {
    width: 100%;
  }

  .product-manager {
    border-radius: 1.3rem;
    padding: 0.8rem;
  }

  .product-url-row,
  .sleep-product-manager,
  .sleep-product-picker-row,
  .product-edit-form,
  .manual-product-grid,
  .saved-page-grid {
    grid-template-columns: 1fr;
  }

  .sleep-product-selection {
    grid-column: auto;
  }

  .sleep-product-picker-row .primary-button,
  .sleep-product-admin-item .secondary-button {
    width: 100%;
  }

  .sleep-product-admin-item {
    grid-template-columns: 3rem minmax(0, 1fr);
  }

  .sleep-product-admin-item .secondary-button {
    grid-column: 1 / -1;
  }

  .manual-product-intro {
    flex-direction: column;
  }

  .product-url-row .primary-button,
  .product-bulk-actions > *,
  .product-price-actions,
  .product-price-actions > *,
  .product-admin-actions > *,
  .browser-import-bookmark,
  .guided-import-start {
    width: 100%;
  }

  .product-library-heading {
    align-items: stretch;
  }

  .product-admin-list {
    max-height: 72svh;
    padding: 0.5rem;
  }

  .product-admin-item {
    grid-template-columns: auto minmax(0, 1fr);
  }

  .product-selector {
    grid-row: 1 / 3;
    height: 100%;
  }

  .product-admin-image {
    width: 100%;
    max-width: 170px;
  }

  .product-admin-copy,
  .product-admin-actions,
  .product-edit-form {
    grid-column: 2;
  }

  .product-admin-actions {
    grid-template-columns: 1fr 1fr;
  }

  .product-edit-form .product-edit-wide,
  .product-pricing-editor,
  .product-image-editor,
  .product-video-editor,
  .product-edit-actions {
    grid-column: auto;
  }

  .product-pricing-controls {
    grid-template-columns: 1fr;
  }

  .product-pricing-heading {
    align-items: flex-start;
    flex-direction: column;
  }

  .product-edit-images {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .product-image-editor-heading,
  .product-video-editor-heading {
    align-items: flex-start;
    flex-direction: column;
  }

  .product-custom-studio-workspace {
    grid-template-columns: 1fr;
  }

  .product-custom-studio-feedback-actions {
    align-items: stretch;
    flex-direction: column;
  }
}

@media (prefers-reduced-motion: reduce) {
  .product-admin-item {
    transition: none;
  }

  .product-price-refresh-button.is-running svg,
  .product-price-refresh-panel.is-running .product-price-refresh-icon svg {
    animation: none;
  }
}

/* AI Comparison Dialog */
.ai-comparison-dialog {
  max-width: 900px;
  max-height: 90vh;
  padding: 0;
  border: none;
  border-radius: 16px;
  background: #fff;
  box-shadow: 0 24px 48px rgba(0, 0, 0, 0.18);
  overflow: hidden;
}

.ai-comparison-dialog::backdrop {
  background: rgba(25, 48, 51, 0.7);
  backdrop-filter: blur(3px);
  animation: dialog-backdrop-in 200ms ease both;
}

.ai-comparison-content {
  padding: 2rem;
  max-height: 85vh;
  overflow-y: auto;
}

.ai-comparison-dialog h2 {
  margin: 0 0 0.5rem 0;
  color: var(--ink);
  font-size: 1.6rem;
  font-weight: 700;
}

.ai-comparison-intro {
  margin: 0 0 1.75rem 0;
  color: var(--ink-soft);
  font-size: 0.95rem;
}

.ai-comparison-section {
  margin-bottom: 2rem;
  padding: 1.5rem;
  border: 1px solid rgba(63, 102, 91, 0.15);
  border-radius: 12px;
  background: #f9fbfa;
}

.ai-comparison-section h3 {
  margin: 0 0 1rem 0;
  color: var(--ink);
  font-size: 1rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.comparison-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
}

.comparison-before,
.comparison-after {
  padding: 1rem;
  border-radius: 8px;
  background: #fff;
}

.comparison-before {
  border: 2px solid rgba(220, 38, 38, 0.2);
}

.comparison-after {
  border: 2px solid rgba(34, 197, 94, 0.3);
  background: rgba(34, 197, 94, 0.03);
}

.comparison-before strong,
.comparison-after strong {
  display: block;
  margin-bottom: 0.5rem;
  color: var(--ink);
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.comparison-before p,
.comparison-after p {
  margin: 0;
  max-height: 12rem;
  overflow-y: auto;
  color: var(--ink);
  font-size: 0.92rem;
  line-height: 1.6;
  word-break: break-word;
  scrollbar-width: thin;
  scrollbar-color: rgba(63, 102, 91, 0.3) transparent;
}

.comparison-before p::-webkit-scrollbar,
.comparison-after p::-webkit-scrollbar {
  width: 6px;
}

.comparison-before p::-webkit-scrollbar-track,
.comparison-after p::-webkit-scrollbar-track {
  background: transparent;
}

.comparison-before p::-webkit-scrollbar-thumb,
.comparison-after p::-webkit-scrollbar-thumb {
  background: rgba(63, 102, 91, 0.3);
  border-radius: 3px;
}

.ai-comparison-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
  margin-top: 1.5rem;
}

.dialog-close-button {
  position: absolute;
  top: 1.5rem;
  right: 1.5rem;
  width: 2.5rem;
  height: 2.5rem;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: rgba(63, 102, 91, 0.08);
  color: var(--ink);
  font-size: 1.75rem;
  font-weight: 300;
  line-height: 1;
  cursor: pointer;
  transition: background 150ms ease, transform 150ms ease;
  display: grid;
  place-items: center;
}

.dialog-close-button:hover {
  background: rgba(63, 102, 91, 0.15);
  transform: scale(1.1) rotate(90deg);
}

.dialog-close-button:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
}

@media (max-width: 768px) {
  .ai-comparison-dialog {
    max-width: 95vw;
  }

  .comparison-row {
    grid-template-columns: 1fr;
  }

  .ai-comparison-content {
    padding: 1.5rem;
  }
}

/* Batch Import Dialog */
.batch-import-dialog {
  max-width: 700px;
  max-height: 90vh;
  padding: 0;
  border: none;
  border-radius: 16px;
  background: #fff;
  box-shadow: 0 24px 48px rgba(0, 0, 0, 0.18);
  overflow: hidden;
}

.batch-import-dialog::backdrop {
  background: rgba(25, 48, 51, 0.7);
  backdrop-filter: blur(3px);
  animation: dialog-backdrop-in 200ms ease both;
}

.batch-import-content {
  padding: 2rem;
  max-height: 85vh;
  overflow-y: auto;
}

.batch-import-dialog h2 {
  margin: 0 0 0.5rem 0;
  padding-right: 3rem;
  color: var(--ink);
  font-size: 1.6rem;
  font-weight: 700;
}

.batch-import-intro {
  margin: 0 0 1.5rem 0;
  color: var(--ink-soft);
  font-size: 0.95rem;
  line-height: 1.6;
}

.batch-import-form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.batch-import-form label {
  display: block;
  margin-bottom: 0.5rem;
  color: var(--ink);
  font-size: 0.9rem;
  font-weight: 600;
}

.batch-import-form textarea {
  width: 100%;
  padding: 0.75rem;
  border: 1px solid rgba(63, 102, 91, 0.25);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 0.88rem;
  line-height: 1.5;
  resize: vertical;
  min-height: 180px;
}

.batch-import-form textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(147, 197, 167, 0.15);
}

.batch-import-progress {
  padding: 1.5rem;
  border: 1px solid rgba(63, 102, 91, 0.15);
  border-radius: 12px;
  background: #f9fbfa;
}

.batch-progress-status {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.75rem;
}

.batch-progress-status strong {
  color: var(--ink);
  font-size: 0.95rem;
}

.batch-progress-status span {
  color: var(--ink-soft);
  font-size: 0.85rem;
}

.batch-import-progress progress {
  width: 100%;
  height: 8px;
  border: none;
  border-radius: 4px;
  background: rgba(63, 102, 91, 0.1);
  overflow: hidden;
  transition: opacity 240ms ease;
}

.batch-import-progress progress[value="0"] {
  opacity: 0.5;
}

.batch-import-progress progress::-webkit-progress-bar {
  background: rgba(63, 102, 91, 0.1);
  border-radius: 4px;
}

.batch-import-progress progress::-webkit-progress-value {
  background: var(--accent);
  border-radius: 4px;
}

.batch-import-progress progress::-moz-progress-bar {
  background: var(--accent);
  border-radius: 4px;
}

.batch-import-results {
  max-height: 300px;
  overflow-y: auto;
  padding: 1rem;
  border: 1px solid rgba(63, 102, 91, 0.15);
  border-radius: 8px;
  background: #f9fbfa;
}

.batch-import-results h3 {
  margin: 0 0 0.75rem 0;
  color: var(--ink);
  font-size: 0.95rem;
  font-weight: 600;
}

.batch-result-item {
  padding: 0.75rem;
  margin-bottom: 0.5rem;
  border-radius: 6px;
  background: #fff;
  font-size: 0.85rem;
  line-height: 1.5;
}

.batch-result-item.success {
  border-left: 3px solid #22c55e;
}

.batch-result-item.error {
  border-left: 3px solid #ef4444;
}

.batch-result-item strong {
  display: block;
  margin-bottom: 0.25rem;
  color: var(--ink);
}

.batch-result-item .url {
  color: var(--ink-soft);
  font-size: 0.8rem;
  word-break: break-all;
}

.batch-import-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
  margin-top: 1rem;
}

@media (max-width: 768px) {
  .batch-import-dialog {
    max-width: 95vw;
  }

  .batch-import-content {
    padding: 1.5rem;
  }
}

/* ---------- Stories moderation ---------- */

.story-queue-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
  margin: 1.5rem 0;
}

.story-queue-summary > div {
  padding: 1.1rem 1.2rem;
  background: var(--paper-warm, #fffaf1);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
}

.story-queue-summary strong {
  display: block;
  margin: 0.25rem 0;
  color: var(--ink);
  font-size: 1.6rem;
  line-height: 1.1;
}

.story-queue-summary small {
  color: var(--ink-soft);
  font-size: 0.85rem;
}

.story-queue-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1.2rem;
  margin-bottom: 1.5rem;
}

.story-admin-list {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.story-admin-item {
  padding: 1rem 1.1rem;
  background: var(--paper-warm, #fffaf1);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
}

.story-admin-item.is-active {
  border-color: var(--sage-deep, #3f665b);
  box-shadow: 0 0 0 2px rgba(63, 102, 91, 0.18);
}

.story-admin-item-heading strong {
  display: block;
  color: var(--ink);
  font-size: 1rem;
  line-height: 1.35;
}

.story-admin-item-heading span {
  display: block;
  margin-top: 0.2rem;
  color: var(--ink-soft);
  font-size: 0.78rem;
}

.story-admin-item-excerpt {
  margin: 0.55rem 0 0;
  color: var(--ink-soft);
  font-size: 0.85rem;
  line-height: 1.5;
}

.story-admin-item-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.8rem;
}

.story-admin-item-actions .secondary-button,
.story-admin-item-actions .primary-button {
  padding: 0.45rem 0.75rem;
  font-size: 0.82rem;
}

.story-edit-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 1.5rem;
  color: var(--ink-soft);
  font-size: 0.85rem;
}

.story-edit-meta strong {
  color: var(--ink);
  font-weight: 600;
}

.activity-empty {
  margin: 0.5rem 0 0;
  color: var(--ink-soft);
  font-size: 0.9rem;
  font-style: italic;
}

@media (max-width: 980px) {
  .story-queue-grid {
    grid-template-columns: 1fr;
  }

  .story-queue-summary {
    grid-template-columns: 1fr;
  }
}

/* Product manager: compact page-placement panels and a navigable card grid. */
body .product-placement-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
  margin-bottom: 1rem;
}

body .product-placement-grid .sleep-product-manager {
  grid-template-columns: 1fr;
  align-content: start;
  gap: 0.9rem;
  min-width: 0;
  margin-bottom: 0;
}

body .product-placement-grid .sleep-product-selection {
  grid-column: auto;
}

body .product-library {
  scroll-margin-top: 1rem;
}

body .product-library-heading {
  align-items: end;
}

body .product-library-tools {
  grid-template-columns: minmax(12rem, 1fr) auto auto auto;
  width: min(100%, 44rem);
}

body .product-admin-list {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  align-items: stretch;
  max-height: none;
  overflow: visible;
  padding: 0.75rem;
  gap: 0.75rem;
}

body .product-admin-item {
  position: relative;
  grid-template-columns: 76px minmax(0, 1fr);
  grid-template-rows: 1fr auto;
  align-items: start;
  gap: 0.7rem;
  min-width: 0;
  min-height: 12.5rem;
  border-radius: 1rem;
  padding: 0.75rem;
}

body .product-admin-item:hover {
  transform: translateY(-2px);
}

body .product-admin-item:has(.product-edit-form) {
  grid-column: 1 / -1;
  grid-template-columns: 112px minmax(0, 1fr);
  min-height: 0;
}

body .product-selector {
  position: absolute;
  top: 0.4rem;
  left: 0.4rem;
  z-index: 2;
  width: 1.9rem;
  min-height: 1.9rem;
  border: 1px solid rgba(25, 48, 51, 0.14);
  border-radius: 0.55rem;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 3px 10px rgba(25, 48, 51, 0.08);
}

body .product-admin-image {
  grid-column: 1;
  grid-row: 1;
  width: 76px;
  border-radius: 0.8rem;
}

body .product-admin-copy {
  grid-column: 2;
  grid-row: 1;
  display: block;
}

body .product-admin-copy h4 {
  margin: 0.38rem 0 0.35rem;
  font-size: 0.94rem;
  line-height: 1.3;
}

body .product-admin-copy > p {
  display: -webkit-box;
  overflow: hidden;
  margin: 0 0 0.45rem;
  font-size: 0.75rem;
  line-height: 1.4;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.product-admin-variations {
  grid-column: 1 / -1;
  display: grid;
  gap: 0.55rem;
  margin-top: 0.35rem;
  border: 1px solid rgba(47, 91, 79, 0.18);
  border-radius: 0.8rem;
  padding: 0.65rem;
  background: rgba(240, 247, 243, 0.72);
}

.product-admin-variations-heading {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.35rem 0.8rem;
}

.product-admin-variations-heading strong { color: #173e35; font-size: 0.78rem; }
.product-admin-variations-heading span { color: #5d756e; font-size: 0.7rem; }

.product-admin-variation-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(9.5rem, 1fr));
  gap: 0.5rem;
}

.product-admin-variation {
  display: grid;
  grid-template-columns: 3.25rem minmax(0, 1fr);
  align-items: center;
  gap: 0.55rem;
  min-width: 0;
  border: 1px solid rgba(47, 91, 79, 0.13);
  border-radius: 0.65rem;
  padding: 0.4rem;
  background: #fff;
}

.product-admin-variation img,
.product-admin-variation-no-image {
  width: 3.25rem;
  aspect-ratio: 1;
  border-radius: 0.45rem;
  object-fit: cover;
}

.product-admin-variation-no-image {
  display: grid;
  place-items: center;
  background: #edf2ef;
  color: #6e7f79;
  font-size: 0.58rem;
  text-align: center;
}

.product-admin-variation > div { display: grid; gap: 0.08rem; min-width: 0; }
.product-admin-variation strong { color: #173e35; font-size: 0.7rem; overflow-wrap: anywhere; }
.product-admin-variation span { color: #2f5b4f; font-size: 0.7rem; font-weight: 800; }
.product-admin-variation small { color: #6e7f79; font-size: 0.62rem; }

body .product-status {
  padding: 0.22rem 0.45rem;
  font-size: 0.6rem;
}

body .product-admin-meta {
  gap: 0.25rem 0.45rem;
  font-size: 0.68rem;
}

body .product-admin-actions {
  grid-column: 1 / -1;
  grid-row: 2;
  display: flex;
  align-self: end;
  justify-content: flex-end;
  min-width: 0;
  gap: 0.32rem;
  border-top: 1px solid rgba(25, 48, 51, 0.1);
  padding-top: 0.6rem;
}

body .product-edit-form {
  grid-column: 1 / -1;
  grid-row: 3;
  margin-top: 0;
}

@media (max-width: 1180px) {
  body .product-admin-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 980px) {
  body .product-placement-grid {
    grid-template-columns: 1fr;
  }

  body .product-library-heading {
    align-items: stretch;
    flex-direction: column;
  }

  body .product-library-tools {
    width: 100%;
  }
}

@media (max-width: 700px) {
  body .product-library-tools {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto;
  }

  body .product-library-search {
    grid-column: 1 / -1;
  }

  body .product-library-filter select {
    width: 100%;
    min-width: 0;
  }

  body .product-admin-list {
    grid-template-columns: 1fr;
    max-height: none;
    padding: 0.5rem;
  }

  body .product-admin-item {
    grid-template-columns: 70px minmax(0, 1fr);
    min-height: 11.5rem;
    padding: 0.65rem;
  }

  body .product-admin-image {
    width: 70px;
  }

  body .product-admin-actions {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    width: 100%;
  }

  body .product-admin-actions > * {
    width: 100%;
  }

  body .product-icon-action[data-tooltip]:nth-child(-n + 3)::after {
    right: auto;
    left: 0;
  }
}

/* ---- Content review (DeepSeek research check) ---- */
.content-review .cr-controls { display: flex; gap: 1rem; align-items: end; flex-wrap: wrap; margin: 1.25rem 0 0.75rem; }
.content-review .cr-controls label { display: grid; gap: 0.4rem; font-weight: 600; }
.content-review .cr-controls select { min-width: 300px; padding: 0.55rem 0.7rem; border: 1px solid #cfd8d4; border-radius: 10px; background: #fff; font: inherit; }
.content-review .cr-status { margin: 0.4rem 0 1rem; font-weight: 600; }
.content-review .cr-status.is-error { color: #b42318; }
.content-review .cr-status.is-success { color: #067647; }
.content-review .cr-status.is-working { color: #8a6400; }
.content-review .cr-progress { border: 1px solid #dfe7e3; border-radius: 14px; background: #f7faf8; padding: 1rem 1.1rem; margin-bottom: 1.25rem; }
.content-review .cr-progress ol { margin: 0; padding-left: 1.2rem; display: grid; gap: 0.35rem; font-size: 0.9rem; color: #344b45; }
.content-review .cr-progress ol li::marker { color: #8a6400; font-weight: 700; }
.content-review .cr-progress-message { margin: 0.6rem 0 0; font-weight: 600; }
.content-review .cr-dialog { width: min(860px, calc(100vw - 2rem)); max-height: calc(100vh - 3rem); border: none; border-radius: 18px; padding: 1.5rem 1.6rem 1.25rem; box-shadow: 0 30px 80px rgba(16, 33, 28, 0.35); overflow: auto; }
.content-review .cr-dialog::backdrop { background: rgba(14, 26, 22, 0.6); }
.content-review .cr-dialog-close { position: absolute; top: 0.55rem; right: 0.7rem; border: none; background: transparent; font-size: 1.6rem; line-height: 1; cursor: pointer; color: #475467; }
.content-review .cr-dialog-kicker { margin: 0 0 0.3rem; font-size: 0.78rem; font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase; }
.content-review .cr-dialog-kicker[data-overall="supported"] { color: #067647; }
.content-review .cr-dialog-kicker[data-overall="mixed"] { color: #8a6400; }
.content-review .cr-dialog-kicker[data-overall="issues"] { color: #b42318; }
.content-review .cr-dialog h3 { margin: 0 0 0.5rem; }
.content-review .cr-dialog-summary { margin: 0 0 0.9rem; color: #344b45; }
.content-review .cr-dialog-stats { display: flex; gap: 0.6rem; flex-wrap: wrap; margin: 0 0 1rem; }
.content-review .cr-dialog-stats div { padding: 0.4rem 0.7rem; border-radius: 10px; background: #eef4f1; }
.content-review .cr-dialog-stats dt { font-size: 0.68rem; text-transform: uppercase; letter-spacing: 0.07em; color: #5b6f69; }
.content-review .cr-dialog-stats dd { margin: 0.1rem 0 0; font-weight: 800; }
.content-review .cr-finding { border: 1px solid #e2e9e6; border-left: 4px solid #98a6a1; border-radius: 12px; background: #fff; padding: 0.75rem 0.9rem; margin: 0.6rem 0; }
.content-review .cr-finding[data-verdict="supported"] { border-left-color: #16a34a; }
.content-review .cr-finding[data-verdict="unsupported"] { border-left-color: #dc2626; }
.content-review .cr-finding[data-verdict="notVerified"] { border-left-color: #d97706; }
.content-review .cr-verdict { display: inline-block; font-size: 0.7rem; font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase; color: #475467; }
.content-review .cr-claim { margin: 0.35rem 0 0.2rem; font-weight: 650; }
.content-review .cr-note { margin: 0.2rem 0 0; font-size: 0.92rem; color: #475467; }
.content-review .cr-finding-sources { margin: 0.4rem 0 0; }
.content-review .cr-finding-sources a { font-size: 0.82rem; margin-right: 0.5rem; color: #1f5f4f; }
.content-review .cr-sources h4 { margin: 1rem 0 0.3rem; font-size: 0.95rem; }
.content-review .cr-sources ul { margin: 0; padding-left: 1.1rem; font-size: 0.86rem; color: #475467; }

/* Content review: elapsed timer and per-claim yes/no check. */
.content-review .cr-progress-elapsed { display: block; margin-top: 0.35rem; font-size: 0.82rem; font-weight: 700; color: #5b6f69; font-variant-numeric: tabular-nums; }
.content-review .cr-finding-actions { margin: 0.55rem 0 0; }
.content-review .cr-check { border: 1px solid #cfdcd7; border-radius: 999px; background: #fff; padding: 0.32rem 0.85rem; font-size: 0.82rem; font-weight: 700; color: #1f5f4f; cursor: pointer; transition: border-color 160ms ease, background 160ms ease; }
.content-review .cr-check:hover { border-color: #1f5f4f; background: #f2f8f6; }
.content-review .cr-check:disabled { opacity: 0.6; cursor: wait; }
.content-review .cr-check-answer { display: inline-block; margin-top: 0.55rem; font-size: 1.02rem; letter-spacing: 0.02em; }
.content-review .cr-check-answer[data-answer="yes"] { color: #067647; }
.content-review .cr-check-answer[data-answer="no"] { color: #b42318; }

/* Content review: Tavily research key row. */
.content-review .cr-key-row { display: grid; gap: 0.4rem; margin: 1rem 0 1.25rem; padding: 0.9rem 1.1rem; border: 1px solid #e2e9e6; border-radius: 14px; background: #f7faf8; }
.content-review .cr-key-row label { font-size: 0.82rem; font-weight: 800; letter-spacing: 0.05em; text-transform: uppercase; color: #475467; }
.content-review .cr-key-fields { display: flex; gap: 0.6rem; flex-wrap: wrap; }
.content-review .cr-key-fields input { flex: 1 1 260px; min-width: 0; padding: 0.55rem 0.75rem; border: 1px solid #cfdcd7; border-radius: 10px; background: #fff; font: inherit; }
.content-review .cr-key-status { margin: 0.15rem 0 0; font-size: 0.86rem; font-weight: 650; color: #5b6f69; }
.content-review .cr-key-status[data-connected="true"] { color: #067647; }

/* Content review: which research provider served the check. */
.content-review .cr-check-result { display: inline-flex; flex-direction: column; vertical-align: bottom; }
.content-review .cr-check-provider { display: block; margin-top: 0.1rem; font-size: 0.74rem; font-weight: 650; letter-spacing: 0.02em; color: #5b6f69; }

/* Content review: verification checklist table. */
.content-review .cr-log { margin-top: 1.5rem; border: 1px solid #e2e9e6; border-radius: 14px; background: #fff; padding: 1rem 1.1rem 1.1rem; }
.content-review .cr-log-heading { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: 0.35rem; }
.content-review .cr-log-heading h3 { margin: 0; font-size: 1.02rem; }
.content-review .cr-log-wrap { overflow-x: auto; margin-top: 0.6rem; }
.content-review .cr-log-table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
.content-review .cr-log-table th { text-align: left; font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.07em; color: #5b6f69; padding: 0.45rem 0.6rem; border-bottom: 2px solid #e2e9e6; }
.content-review .cr-log-table td { padding: 0.55rem 0.6rem; border-bottom: 1px solid #eef2f1; vertical-align: middle; }
.content-review .cr-log-table tr:last-child td { border-bottom: none; }
.content-review .cr-log-table a { color: #1f5f4f; font-weight: 650; }
.content-review .cr-log-audit { white-space: nowrap; }
.content-review .cr-log-audit input { margin-right: 0.45rem; accent-color: #067647; width: 1rem; height: 1rem; cursor: pointer; }
.content-review .cr-log-audit span { font-size: 0.78rem; color: #5b6f69; }

html[data-admin-page="site-security"] [data-admin-view="site-security"] { display: block !important; }
