:root {
  --paper: #f8f7f2;
  --surface: #ffffff;
  --ink: #263a30;
  --green: #355c4b;
  --deep: #1f3027;
  --muted: #5c675d;
  --line: #e5e7de;
  --mint: #e8ede3;
  --gold: #bb9457;
  --red: #a64436;
  --amber: #8a5a12;
  --serif: Georgia, "Times New Roman", serif;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font:
    14px/1.55 system-ui,
    sans-serif;
}
[hidden] {
  display: none !important;
}
h1,
h2 {
  font-family: var(--serif);
  font-weight: 400;
  margin: 0;
  letter-spacing: -0.3px;
}
h1 {
  font-size: 30px;
  line-height: 1.2;
}
h2 {
  font-size: 20px;
}
p {
  margin: 0;
}
.muted {
  color: var(--muted);
}
.small,
.sub {
  font-size: 12px;
}
.sub {
  display: block;
  color: var(--muted);
  font-weight: 400;
}
.eyebrow {
  font-size: 10px;
  letter-spacing: 2px;
  color: var(--muted);
}
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}
.icon,
nav svg {
  width: 16px;
  height: 16px;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font: 30px var(--serif);
  letter-spacing: -1.2px;
  text-decoration: none;
  color: inherit;
}
.brand img {
  width: 34px;
  height: 34px;
  object-fit: contain;
}
.sidebar .brand img {
  background: var(--paper);
  border-radius: 9px;
  padding: 4px;
}

/* Controls */
button {
  border: 0;
  border-radius: 9px;
  background: var(--green);
  color: #fff;
  font: 600 13px system-ui;
  padding: 10px 16px;
  cursor: pointer;
}
button:hover:not(:disabled) {
  filter: brightness(1.08);
}
button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
button.secondary {
  background: var(--mint);
  color: var(--green);
}
button.danger {
  background: transparent;
  color: var(--red);
  box-shadow: inset 0 0 0 1px #e3c5bf;
}
button.link {
  background: none;
  color: var(--green);
  padding: 0;
  text-align: left;
  text-decoration: underline;
  text-underline-offset: 3px;
}
button.link.strong {
  color: var(--ink);
  text-decoration: none;
  font-size: 14px;
}
button.link.strong:hover {
  text-decoration: underline;
}
:focus-visible {
  outline: 2px solid #7fa184;
  outline-offset: 2px;
}
label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  margin-bottom: 16px;
}
input,
textarea,
select {
  display: block;
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #cfd6ca;
  border-radius: 9px;
  background: var(--surface);
  color: var(--ink);
  margin-top: 6px;
  font: 14px system-ui;
}
textarea {
  resize: vertical;
}
input[type="color"] {
  height: 42px;
  padding: 4px;
}
input[type="file"] {
  border: 0;
  padding: 6px 0;
  background: transparent;
  font-size: 12px;
}
small {
  display: block;
  font-size: 11.5px;
  font-weight: 400;
  color: var(--muted);
  margin-top: 6px;
  line-height: 1.5;
}
.check {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  margin-bottom: 4px;
}
.check input {
  width: 20px;
  height: 20px;
  margin: 0;
  flex: none;
  accent-color: var(--green);
}
.two {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
.file-box {
  padding: 18px;
  border: 1px dashed #b9c9b5;
  border-radius: 12px;
  background: #f1f4eb;
  margin: 0;
}
progress {
  width: 100%;
  accent-color: var(--green);
  margin-bottom: 12px;
}
.segmented {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 2px;
  padding: 3px;
  background: var(--mint);
  border-radius: 10px;
}
.segmented button {
  background: transparent;
  color: var(--muted);
  padding: 7px 12px;
  border-radius: 8px;
  font-weight: 500;
}
.segmented button[aria-pressed="true"] {
  background: var(--surface);
  color: var(--ink);
  font-weight: 600;
  box-shadow: 0 1px 2px rgba(30, 40, 25, 0.12);
}

/* Sign in */
.login-screen {
  max-width: 440px;
  margin: 0 auto;
  padding: 9vh 24px 48px;
}
.login-screen .eyebrow {
  margin: 6px 0 36px;
}
.login-screen h1 {
  font-size: 38px;
  margin-bottom: 12px;
}
.login-screen form {
  margin-top: 28px;
}
.login-screen form button {
  width: 100%;
  padding: 14px;
}
.form-error {
  color: var(--red);
  font-size: 13px;
  margin-bottom: 12px;
}
.form-error:empty {
  display: none;
}

/* Shell */
.shell {
  display: grid;
  grid-template-columns: 236px minmax(0, 1fr);
  min-height: 100vh;
}
.sidebar {
  background: var(--deep);
  color: #f3f1e8;
  padding: 26px 16px 20px;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
}
.sidebar .brand {
  padding: 0 8px;
}
.sidebar .eyebrow {
  color: #a9b8ab;
  padding: 4px 8px 26px;
}
nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
}
nav button,
.sidebar-signout {
  display: flex;
  align-items: center;
  gap: 11px;
  width: 100%;
  background: transparent;
  color: #cdd6cc;
  font-weight: 500;
  font-size: 14px;
  padding: 10px 10px;
  text-align: left;
}
nav button:hover:not(:disabled),
.sidebar-signout:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.07);
  filter: none;
}
nav button[aria-current="page"] {
  background: rgba(255, 255, 255, 0.13);
  color: #fff;
  font-weight: 600;
}
.count {
  margin-left: auto;
  background: var(--gold);
  color: #1f1a0e;
  font-size: 11px;
  font-weight: 700;
  border-radius: 10px;
  padding: 1px 7px;
}
.workspace {
  padding: 30px 36px 80px;
  max-width: 1280px;
  width: 100%;
}
.topbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 26px;
}
.topbar-actions {
  display: flex;
  gap: 8px;
}
.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 22px;
  margin-bottom: 18px;
}
.panel.flush {
  padding: 4px 0;
}
.panel.narrow {
  max-width: 620px;
}
.panel > h2 {
  margin-bottom: 16px;
}
.panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}
.split {
  display: grid;
  grid-template-columns: 3fr 2fr;
  gap: 18px;
  align-items: start;
}
.toolbar {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 14px;
}
.toolbar label {
  margin: 0;
}
.toolbar input,
.toolbar select {
  margin-top: 0;
}
.toolbar .grow {
  flex: 1;
  min-width: 200px;
}
.empty {
  color: var(--muted);
  text-align: center;
  padding: 34px 20px;
}
.empty button {
  margin-top: 14px;
}

/* Figures */
.kpis {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  margin-bottom: 18px;
}
#payment-kpis {
  grid-template-columns: repeat(4, 1fr);
}
.kpi {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 16px 18px;
}
.kpi-label {
  font-size: 12px;
  color: var(--muted);
}
.kpi-value {
  font: 28px/1.25 var(--serif);
  margin: 4px 0 2px;
  font-variant-numeric: tabular-nums;
}
.kpi-note {
  font-size: 12px;
  color: var(--muted);
}
.attention {
  list-style: none;
  margin: 0 0 18px;
  padding: 6px 16px;
  background: #fbf4e4;
  border: 1px solid #ecdcb6;
  border-radius: 14px;
}
.attention li {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
}
.attention li + li {
  border-top: 1px solid #ecdcb6;
}
.attention .icon {
  color: var(--amber);
}
.attention span {
  flex: 1;
}
.chart {
  position: relative;
  min-height: 240px;
}
.chart svg {
  display: block;
}
.chart .bar {
  fill: var(--green);
}
.chart .bar.active {
  fill: var(--deep);
}
.chart .grid {
  stroke: var(--line);
}
.chart .axis {
  stroke: #c3cabd;
}
.chart .tick {
  fill: var(--muted);
  font-size: 11px;
}
.chart .hit {
  fill: transparent;
}
.chart-tip {
  position: absolute;
  z-index: 5;
  pointer-events: none;
  background: var(--deep);
  color: #fff;
  border-radius: 8px;
  padding: 7px 10px;
  font-size: 12px;
  white-space: nowrap;
}
.chart-tip strong,
.chart-tip span {
  display: block;
}
.chart-tip span {
  color: #cdd6cc;
}
.chart-table {
  margin-top: 10px;
  font-size: 12px;
}
.chart-table summary {
  cursor: pointer;
  color: var(--muted);
}
.chart-table .table-scroll {
  max-height: 260px;
  margin-top: 8px;
}

/* Tables and lists */
.table-scroll {
  overflow: auto;
}
table {
  width: 100%;
  border-collapse: collapse;
}
th {
  text-align: left;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.4px;
  color: var(--muted);
  padding: 10px 14px;
  white-space: nowrap;
}
td {
  padding: 12px 14px;
  border-top: 1px solid var(--line);
  vertical-align: middle;
}
.panel:not(.flush) td:first-child,
.panel:not(.flush) th:first-child {
  padding-left: 0;
}
.panel:not(.flush) td:last-child,
.panel:not(.flush) th:last-child {
  padding-right: 0;
}
.num {
  text-align: right;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.mono {
  font:
    11px ui-monospace,
    monospace;
  color: var(--muted);
  white-space: nowrap;
}
.nowrap {
  white-space: nowrap;
}
.row-actions {
  white-space: nowrap;
  text-align: right;
}
.row-actions button {
  padding: 7px 11px;
  font-size: 12px;
  margin-left: 4px;
}
.book-cell {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 220px;
}
.meter {
  width: 120px;
  height: 6px;
  border-radius: 3px;
  background: var(--mint);
  overflow: hidden;
  margin-bottom: 4px;
}
.meter span {
  display: block;
  height: 100%;
  background: var(--green);
  border-radius: 3px;
}
.pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  font-weight: 600;
  padding: 3px 9px;
  border-radius: 20px;
  white-space: nowrap;
  background: var(--mint);
  color: var(--green);
}
.pill .icon {
  width: 12px;
  height: 12px;
}
.pill-draft,
.pill-closed {
  background: #eeeeea;
  color: var(--muted);
}
.pill-paused,
.pill-processing,
.pill-open {
  background: #fbf0d8;
  color: var(--amber);
}
.pill-withdrawn,
.pill-failed,
.pill-refunded {
  background: #f7e4e0;
  color: var(--red);
}
.feed {
  list-style: none;
  margin: 0;
  padding: 0;
}
.feed li {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 11px 0;
  border-top: 1px solid var(--line);
}
.feed li:first-child {
  border-top: 0;
  padding-top: 0;
}
.feed-end {
  text-align: right;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
  white-space: nowrap;
}
.ticket h2 {
  font-size: 18px;
}
.ticket-message {
  white-space: pre-wrap;
  margin-bottom: 12px;
}
.notice {
  background: var(--mint);
  border-radius: 10px;
  padding: 12px 14px;
  margin-bottom: 14px;
}
.notice.error {
  background: #f7e4e0;
  color: var(--red);
}
.form-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 12px;
}
.form-actions .danger {
  margin-left: auto;
}
.toast {
  position: fixed;
  left: 50%;
  bottom: 22px;
  transform: translateX(-50%);
  max-width: min(560px, calc(100vw - 32px));
  background: var(--deep);
  color: #fff;
  padding: 12px 18px;
  border-radius: 10px;
  box-shadow: 0 6px 24px rgba(20, 35, 25, 0.25);
  z-index: 10;
}
.toast:empty {
  display: none;
}
.toast.error {
  background: var(--red);
}

/* Editor and in-app preview */
.editor {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: 28px;
  align-items: start;
}
.preview {
  position: sticky;
  top: 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  text-align: center;
}
.phone {
  width: 320px;
  max-width: 100%;
  border-radius: 38px;
  background: #16211b;
  padding: 10px;
  box-shadow: 0 14px 34px rgba(20, 35, 25, 0.22);
}
.phone-screen {
  height: 610px;
  border-radius: 29px;
  background: var(--paper);
  overflow: auto;
  text-align: left;
  display: flex;
  flex-direction: column;
  padding: 26px 18px 18px;
  scrollbar-width: thin;
}
.phone-screen:has(.app-header) {
  padding: 0;
}
.app-eyebrow {
  font-size: 8px;
  letter-spacing: 1.6px;
  color: var(--muted);
}
.app-heading {
  font: 26px/1.2 var(--serif);
  margin: 8px 0 22px;
}
.app-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
.app-card-title {
  font: 15px/1.3 var(--serif);
  margin-top: 10px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  overflow-wrap: anywhere;
}
.app-card-author {
  font-size: 11px;
  color: var(--muted);
  margin-top: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.app-card-bottom {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 9px;
}
.app-price {
  font-size: 13px;
  font-weight: 600;
  color: var(--green);
}
.app-format {
  font-size: 9px;
  color: var(--muted);
  letter-spacing: 0.5px;
}
.app-card.ghost .cover {
  background: var(--line);
  box-shadow: none;
}
.app-card.ghost p {
  height: 10px;
  border-radius: 5px;
  background: var(--line);
  margin-top: 12px;
}
.app-card.ghost p + p {
  width: 60%;
  margin-top: 8px;
}
.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 18px 10px;
  flex: none;
}
.app-header .icon {
  width: 18px;
  height: 18px;
}
.app-header span:last-child {
  width: 18px;
}
.app-body {
  flex: 1;
  overflow: auto;
  padding: 8px 22px 20px;
  scrollbar-width: thin;
}
.app-stage {
  display: flex;
  justify-content: center;
  border-radius: 18px;
  padding: 24px;
  margin-bottom: 20px;
}
.app-title {
  font: 27px/1.2 var(--serif);
  letter-spacing: -0.6px;
  text-align: center;
  overflow-wrap: anywhere;
}
.app-author {
  color: var(--muted);
  text-align: center;
  margin-top: 8px;
  font-size: 13px;
}
.app-badges {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 7px;
  margin: 18px 0 24px;
}
.app-badges span {
  padding: 5px 10px;
  background: var(--mint);
  color: var(--green);
  border-radius: 20px;
  font-size: 10px;
}
.app-subheading {
  font: 20px var(--serif);
}
.app-description {
  font-size: 13px;
  line-height: 1.75;
  color: var(--muted);
  margin: 10px 0 16px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.app-button {
  background: var(--green);
  color: #fff;
  font-weight: 600;
  font-size: 13px;
  text-align: center;
  border-radius: 13px;
  padding: 14px 12px;
}
.app-button.secondary {
  background: var(--mint);
  color: var(--green);
}
.app-note {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-top: 14px;
  font-size: 11.5px;
  line-height: 1.5;
  color: var(--muted);
}
.app-note .icon {
  color: var(--ink);
}
.app-footer {
  flex: none;
  border-top: 1px solid var(--line);
  padding: 16px 18px;
}
.app-footnote {
  font-size: 10px;
  color: var(--muted);
  text-align: center;
  margin-top: 8px;
}
.app-placeholder {
  margin: auto;
  padding: 24px;
  text-align: center;
  color: var(--muted);
}
.phone-screen.reading select {
  margin: 0 14px 10px;
  width: auto;
  font-size: 12px;
  padding: 7px 10px;
  flex: none;
}
.phone-screen.reading iframe {
  flex: 1;
  min-height: 0;
  width: 100%;
  border: 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: var(--paper);
}
.reading-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 14px 6px;
  font-size: 12px;
  color: var(--muted);
  flex: none;
}
.reading-controls button {
  padding: 8px 12px;
  font-size: 12px;
}
#reading-text {
  align-self: center;
  font-size: 12px;
  margin-bottom: 12px;
}

/* Cover, mirroring the reader app's designed cover */
.cover {
  position: relative;
  overflow: hidden;
  flex: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  text-align: center;
  border-radius: 4px;
  background: var(--green);
  color: #fcf7ed;
  box-shadow: 2px 4px 8px rgba(30, 40, 25, 0.14);
  width: 100%;
  aspect-ratio: 2 / 3;
  padding: 14px 12px;
}
.cover::before {
  content: "";
  position: absolute;
  inset: 7px 8px;
  border: 1px solid rgba(255, 255, 255, 0.35);
}
.cover::after {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: 4px;
  width: 3px;
  background: rgba(0, 0, 0, 0.1);
}
.cover img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  z-index: 1;
}
.cover-genre,
.cover-author {
  font-size: 7px;
  letter-spacing: 1.2px;
  color: #f4ebdd;
  max-width: 100%;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.cover-title {
  font: 17px/1.2 var(--serif);
  display: -webkit-box;
  -webkit-line-clamp: 4;
  -webkit-box-orient: vertical;
  overflow: hidden;
  overflow-wrap: anywhere;
}
.cover-orbit {
  width: 34px;
  height: 34px;
  flex: none;
  border: 1px solid rgba(255, 255, 255, 0.5);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #eedfc2;
  font-size: 17px;
}
.cover.large {
  width: 150px;
  padding: 18px 14px;
}
.cover.large .cover-title {
  font-size: 21px;
}
.cover.large .cover-orbit {
  width: 44px;
  height: 44px;
  font-size: 22px;
}
.cover.mini {
  width: 38px;
  padding: 5px 4px;
  border-radius: 3px;
  box-shadow: none;
}
.cover.mini::before,
.cover.mini .cover-genre,
.cover.mini .cover-orbit,
.cover.mini .cover-author {
  display: none;
}
.cover.mini .cover-title {
  font-size: 6px;
  margin: auto;
}

@media (max-width: 1080px) {
  #payment-kpis {
    grid-template-columns: 1fr 1fr;
  }
  .editor,
  .split {
    grid-template-columns: 1fr;
  }
  .preview {
    position: static;
  }
}
@media (max-width: 820px) {
  .shell {
    display: block;
  }
  .sidebar {
    position: static;
    height: auto;
    padding: 14px 12px 10px;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px 12px;
  }
  .sidebar .eyebrow {
    padding: 0;
    flex: 1;
  }
  .sidebar-signout {
    width: auto;
    order: 2;
  }
  nav {
    order: 3;
    flex: 0 0 100%;
    flex-direction: row;
    overflow-x: auto;
    padding-bottom: 4px;
  }
  nav button {
    width: auto;
    white-space: nowrap;
  }
  .workspace {
    padding: 22px 16px 80px;
  }
  .two {
    grid-template-columns: 1fr;
  }
  .kpis,
  #payment-kpis {
    grid-template-columns: 1fr 1fr;
    gap: 10px;
  }
  .kpi {
    padding: 13px 14px;
  }
  .kpi-value {
    font-size: 22px;
  }
  h1 {
    font-size: 26px;
  }
}

small .link {
  font-size: inherit;
}
