/* Publishing platform — base styles.
   Palette: indigo ink (book cloth) and saffron (spine stamp). One distinctive
   element: the "spine" panel on the sign-in pages. Everything else stays quiet. */

@font-face {
  font-family: "Vazirmatn";
  src: url("../fonts/Vazirmatn-Variable.woff2") format("woff2");
  font-weight: 100 900;
  font-display: swap;
}

:root {
  --ink: #1d2747;          /* headings, spine */
  --ink-soft: #3c4770;
  --paper: #f4f5f8;        /* page background */
  --sheet: #ffffff;        /* panels */
  --line: #d9dce6;
  --muted: #5d6478;
  --saffron: #d9971a;      /* accent: one per screen */
  --saffron-deep: #a86f05;
  --ok: #2b7a57;
  --ok-bg: #e5f3ec;
  --error: #b3261e;
  --error-bg: #fbeaea;
  --focus: #2f5bd3;
  --radius-sm: 6px;
  --radius-lg: 14px;
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: "Vazirmatn", Tahoma, sans-serif;
  font-size: 16px;
  line-height: 1.8;
}

h1, h2, h3 { line-height: 1.4; margin: 0 0 .6em; font-weight: 800; }
h1 { font-size: 1.75rem; }
h2 { font-size: 1.25rem; }
h3 { font-size: 1.05rem; }
p { margin: 0 0 1em; }
a { color: var(--ink-soft); }

:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }

.ltr { direction: ltr; unicode-bidi: isolate; }

/* --- App shell ----------------------------------------------------------- */

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 24px;
  background: var(--ink);
  color: #fff;
}
.topbar a { color: #fff; text-decoration: none; }
.brand { font-weight: 800; font-size: 1.05rem; display: flex; align-items: center; gap: 10px; }
.brand .logo-mark { flex: none; }
.topbar .who { display: flex; align-items: center; gap: 12px; font-size: .9rem; opacity: .92; }

.page { max-width: 960px; margin: 0 auto; padding: 32px 24px 64px; }

.panel {
  background: var(--sheet);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 24px;
  margin-bottom: 24px;
}

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

.nav { display: flex; gap: 4px; margin-inline-end: auto; margin-inline-start: 16px; }
.nav a { padding: 6px 12px; border-radius: var(--radius-sm); font-size: .95rem; opacity: .85; }
.nav a:hover { opacity: 1; background: rgba(255,255,255,.08); }
.nav a[aria-current="page"] { opacity: 1; box-shadow: inset 0 -2px 0 var(--saffron); border-radius: 0; }

/* --- Forms --------------------------------------------------------------- */

label { display: block; font-weight: 600; margin-bottom: 6px; }
input[type=text], input[type=tel], input[type=number], textarea, select {
  width: 100%;
  padding: 12px 14px;
  border: 1.5px solid var(--line);
  border-radius: var(--radius-sm);
  background: #fff;
  font: inherit;
  color: inherit;
}
input:focus, textarea:focus, select:focus { border-color: var(--ink-soft); outline: none; box-shadow: 0 0 0 3px rgba(47, 91, 211, .18); }
input.code-input { font-size: 1.6rem; letter-spacing: .5em; text-align: center; font-weight: 700; }
.field { margin-bottom: 18px; }
.field-error { color: var(--error); font-size: .9rem; margin-top: 6px; }
.hint { color: var(--muted); font-size: .9rem; }

.btn {
  display: inline-flex; align-items: center; justify-content: center;
  gap: 8px;
  padding: 12px 22px;
  border: 0;
  border-radius: var(--radius-sm);
  font: inherit; font-weight: 700;
  cursor: pointer;
  text-decoration: none;
}
.btn-primary { background: var(--ink); color: #fff; }
.btn-primary:hover { background: var(--ink-soft); }
.btn-block { width: 100%; }
.btn-link { background: none; color: var(--ink-soft); padding: 0; font-weight: 600; text-decoration: underline; }
.btn-link:disabled { color: var(--muted); text-decoration: none; cursor: default; }
.btn-quiet { background: transparent; color: #fff; border: 1px solid rgba(255,255,255,.4); padding: 6px 14px; font-weight: 600; }

/* --- Messages ------------------------------------------------------------ */

.notice { padding: 12px 16px; border-radius: var(--radius-sm); margin-bottom: 16px; font-weight: 500; }
.notice-error { background: var(--error-bg); color: var(--error); }
.notice-success { background: var(--ok-bg); color: var(--ok); }
.notice-info { background: #eef1fa; color: var(--ink-soft); }

/* --- Sign-in: the spine -------------------------------------------------- */

.auth {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(220px, 34%) 1fr;
}
.spine {
  background: var(--ink);
  color: #fff;
  padding: 48px 40px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  position: relative;
  overflow: hidden;
}
/* Gold-stamped bands, like the bands on a cloth book spine. */
.spine::before, .spine::after {
  content: "";
  position: absolute;
  inset-inline: 0;
  height: 3px;
  background: var(--saffron);
}
.spine::before { top: 22px; box-shadow: 0 8px 0 var(--saffron); }
.spine::after { bottom: 22px; box-shadow: 0 -8px 0 var(--saffron); }
.spine-title {
  font-size: clamp(1.9rem, 3.4vw, 2.8rem);
  font-weight: 900;
  line-height: 1.25;
  margin: 24px 0 0;
}
.spine-title span { display: block; color: var(--saffron); }
.spine-brand { position: relative; align-self: flex-start; display: inline-flex; align-items: center; gap: 10px; color: #fff; text-decoration: none; font-weight: 800; font-size: 1.15rem; margin-top: 12px; }
.spine-brand .logo-mark { flex: none; }
.spine-text { color: rgba(255,255,255,.82); max-width: 32ch; margin: 0; }

.auth-main { display: flex; align-items: center; justify-content: center; padding: 40px 24px; }
.auth-card { width: 100%; max-width: 400px; }
.auth-card h1 { font-size: 1.5rem; }
.auth-foot { margin-top: 18px; display: flex; justify-content: space-between; align-items: center; gap: 12px; font-size: .95rem; }

/* --- Dashboards ---------------------------------------------------------- */

.stat { display: flex; align-items: baseline; gap: 10px; }
.stat strong { font-size: 2rem; font-weight: 900; }
.empty { color: var(--muted); padding: 8px 0; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .95rem; }
th, td { text-align: start; padding: 10px 8px; border-bottom: 1px solid var(--line); }
th { color: var(--muted); font-weight: 600; }
.badge { display: inline-block; padding: 2px 10px; border-radius: 999px; background: #eef1fa; color: var(--ink-soft); font-size: .85rem; font-weight: 600; }
.badge-published { background: var(--ok-bg); color: var(--ok); }
.badge-needs_revision, .badge-rejected { background: var(--error-bg); color: var(--error); }

/* --- Plans, course and payments ------------------------------------------ */

.page-head { margin-bottom: 24px; }
.page-head p { color: var(--muted); max-width: 60ch; }

.plans { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 20px; margin-bottom: 24px; }
.plan { display: flex; flex-direction: column; gap: 6px; margin-bottom: 0; }
.plan.is-best { border-color: var(--saffron); box-shadow: 0 0 0 1px var(--saffron); }
.plan-tag { align-self: flex-start; font-size: .8rem; font-weight: 700; color: var(--saffron-deep); background: #fbf1dc; padding: 1px 10px; border-radius: 999px; }
.plan h2 { margin: 0; }
.price { font-size: 1.6rem; font-weight: 900; line-height: 1.3; }
.price small { font-size: .9rem; font-weight: 600; color: var(--muted); }
.price-old { color: var(--muted); text-decoration: line-through; font-size: .95rem; }
.plan ul { margin: 6px 0 14px; padding-inline-start: 18px; color: var(--ink-soft); font-size: .95rem; }
.plan form { margin-top: auto; }

.btn-accent { background: var(--saffron); color: var(--ink); }
.btn-accent:hover { background: #e6a63a; }
.btn-outline { background: #fff; color: var(--ink); border: 1.5px solid var(--line); }
.btn-outline:hover { border-color: var(--ink-soft); }

.facts { display: grid; grid-template-columns: max-content 1fr; gap: 6px 20px; margin: 0 0 16px; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; font-weight: 600; }

.result { text-align: center; max-width: 520px; margin: 0 auto; }
.result .facts { text-align: start; max-width: 360px; margin: 16px auto 24px; }
.result-mark { width: 56px; height: 56px; border-radius: 50%; display: grid; place-items: center; margin: 0 auto 12px; font-size: 1.6rem; font-weight: 900; }
.result-ok .result-mark { background: var(--ok-bg); color: var(--ok); }
.result-fail .result-mark { background: var(--error-bg); color: var(--error); }
.actions { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }

.course-tiers { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 20px; }
.course-tier { position: relative; display: flex; flex-direction: column; margin-bottom: 0; }
.course-tier.is-featured { border-color: var(--saffron); box-shadow: 0 0 0 1px var(--saffron); }
.course-tier .plan-tag { position: absolute; top: -12px; inset-inline-start: 20px; }
.course-tier .btn { margin-top: auto; }
.course-tiers + .guarantee-note, form + .guarantee-note { margin-top: 20px; }

/* Course feature list: ticks for what's included, muted crosses for what isn't. */
.cfeat { list-style: none; margin: 8px 0 20px; padding: 0; }
.cfeat li { position: relative; padding: 8px 0; padding-inline-start: 34px; border-top: 1px solid var(--line); color: var(--muted); font-size: .92rem; line-height: 1.6; }
.cfeat li b { display: block; color: var(--ink); font-size: 1rem; }
.cfeat li::before { content: ""; position: absolute; inset-inline-start: 0; top: 10px; width: 22px; height: 22px; border-radius: 50%; background: var(--ok-bg); }
.cfeat li::after { content: ""; position: absolute; inset-inline-start: 6px; top: 16px; width: 10px; height: 5px; border-inline-start: 2.5px solid var(--ok); border-bottom: 2.5px solid var(--ok); transform: rotate(-45deg) scaleX(-1); }
.cfeat li.star::before { background: #fbf1dc; }
.cfeat li.star::after { border-color: var(--saffron-deep); }
.cfeat li.no { opacity: .55; }
.cfeat li.no b { text-decoration: line-through; color: var(--muted); }
.cfeat li.no::before { background: #eceef3; }
.cfeat li.no::after { inset-inline-start: 5px; top: 20px; width: 12px; height: 0; border: 0; border-top: 2px solid var(--muted); transform: none; }
.guarantee-note { font-size: .88rem; color: var(--muted); background: #fff; border: 1px dashed var(--line); border-radius: var(--radius-sm); padding: 12px 16px; }
.guarantee-note b { color: var(--ink); }

.testbank { max-width: 440px; margin: 40px auto; border-style: dashed; }

.badge-paid { background: var(--ok-bg); color: var(--ok); }
.badge-failed { background: var(--error-bg); color: var(--error); }

@media (max-width: 720px) {
  .topbar { flex-wrap: wrap; }
  .nav { order: 3; width: 100%; margin: 0; overflow-x: auto; }
  .auth { grid-template-columns: 1fr; }
  .spine { padding: 40px 24px 32px; min-height: 0; }
  .spine-title { margin-top: 12px; }
  .spine-text { display: none; }
  .topbar { padding: 12px 16px; }
  .page { padding: 24px 16px 48px; }
  .panel { padding: 18px; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}

/* --- Books and review (stage 3) ------------------------------------------ */

.req { color: var(--error); }
.muted { color: var(--muted); }
.field-check label { display: flex; gap: 10px; align-items: flex-start; font-weight: 500; cursor: pointer; }
.field-check input { margin-top: 5px; width: 18px; height: 18px; flex: none; accent-color: var(--ink); }
input[type=file] { width: 100%; padding: 10px; border: 1.5px dashed var(--line); border-radius: var(--radius-sm); background: #fff; font: inherit; }
.form-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 0 16px; }
.form-actions { display: flex; gap: 12px; flex-wrap: wrap; }
.book-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; flex-wrap: wrap; }
.book-head h1 { margin-bottom: 6px; }
.book-head .hint { margin-inline-start: 8px; }
.desc { margin-top: 14px; padding: 12px 14px; background: #f7f8fb; border-radius: var(--radius-sm); font-size: .95rem; }
.review-callout { border-inline-start: 4px solid var(--ink-soft); }
.review-callout.is-revise { border-inline-start-color: var(--saffron); }
.review-callout.is-reject { border-inline-start-color: var(--error); }
.review-callout.is-ok { border-inline-start-color: var(--ok); }
.review-callout h2 { margin-top: 0; }
.review-callout .note { white-space: normal; background: #fffaf0; padding: 10px 14px; border-radius: var(--radius-sm); }
.submit-panel { border-color: var(--saffron); }
.contract-box { margin: 10px 0 18px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: #fff; }
.contract-box summary { cursor: pointer; padding: 10px 14px; font-weight: 600; }
.contract-text { max-height: 340px; overflow-y: auto; padding: 0 14px 6px; font-size: .93rem; line-height: 2; }
section.contract-text { max-height: none; padding: 20px 24px; }
.timeline-list { list-style: none; margin: 0; padding: 0; }
.timeline-list li { padding: 10px 0; border-bottom: 1px solid var(--line); }
.timeline-list li:last-child { border-bottom: 0; }
.timeline-list p { margin: 6px 0 0; }
.btn-sm { padding: 6px 14px; font-size: .9rem; }
.btn-danger { background: var(--error); color: #fff; }
.btn-danger:hover { filter: brightness(.92); }
.btn-link.danger { color: var(--error); }
.review-grid { display: grid; grid-template-columns: 1.3fr 1fr; gap: 20px; align-items: start; }
.review-grid .panel { margin-bottom: 0; }
.review-grid + .panel { margin-top: 20px; }
@media (max-width: 760px) { .review-grid { grid-template-columns: 1fr; } }
.checklist { border: 0; padding: 0; margin: 0 0 16px; }
.checklist legend { font-weight: 700; margin-bottom: 8px; }
.checklist label { display: flex; gap: 10px; align-items: flex-start; font-weight: 500; padding: 6px 0; cursor: pointer; }
.checklist input { margin-top: 5px; width: 18px; height: 18px; flex: none; accent-color: var(--ink); }
.review-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.start-review { margin-bottom: 18px; }
.badge-approved, .badge-assigned { background: var(--ok-bg); color: var(--ok); }
.badge-submitted, .badge-in_review { background: #fdf3e1; color: #8a5a00; }
.badge-guarantee { background: #fbf1dc; color: var(--saffron-deep); }
.book-link { color: inherit; text-decoration: none; font-weight: 600; }
.book-link:hover { text-decoration: underline; }
.panel-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.panel-head h2 { margin: 0; }
.facts dd.ltr { text-align: right; }

/* --- Publishing queue (stage 4) ----------------------------------------- */

.danger-text { color: var(--error); }
.meter { display: inline-block; padding: 2px 10px; border-radius: 999px; background: var(--ok-bg); color: var(--ok); font-size: .85rem; font-weight: 600; white-space: nowrap; }
.meter.is-full { background: var(--error-bg); color: var(--error); }
.fmt-cells { display: flex; gap: 6px; flex-wrap: wrap; }
.assign-list { display: grid; gap: 10px; }
.assign-row { display: grid; grid-template-columns: 1fr minmax(180px, 260px) auto; gap: 12px; align-items: center; padding: 12px 0; border-bottom: 1px solid var(--line); }
.assign-row:last-child { border-bottom: 0; }
.assign-book { display: flex; flex-direction: column; gap: 2px; }
.assign-row select { padding: 9px 12px; }
@media (max-width: 720px) { .assign-row { grid-template-columns: 1fr; } }
.sheet-grid { display: grid; grid-template-columns: 1.25fr 1fr; gap: 20px; align-items: start; }
.sheet-grid > * { min-width: 0; }
@media (max-width: 860px) { .sheet-grid { grid-template-columns: 1fr; } }
.file-buttons { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 22px; }
.copy-row { display: grid; grid-template-columns: 130px 1fr auto; gap: 10px; align-items: start; padding: 9px 0; border-bottom: 1px solid var(--line); }
.copy-label { color: var(--muted); font-size: .88rem; direction: ltr; text-align: right; padding-top: 4px; }
.copy-value { font-weight: 600; overflow-wrap: anywhere; padding-top: 3px; }
.copy-value.is-long { font-weight: 400; font-size: .92rem; max-height: 140px; overflow-y: auto; white-space: pre-wrap; background: #f7f8fb; padding: 8px 10px; border-radius: var(--radius-sm); }
.copy-btn.is-done { border-color: var(--ok); color: var(--ok); }
@media (max-width: 520px) { .copy-row { grid-template-columns: 1fr auto; } .copy-label { grid-column: 1 / -1; text-align: left; padding: 0; } }
.kdp-steps { margin: 0; padding-inline-start: 22px; }
.kdp-steps li { padding: 6px 0; }
.kdp-steps label { display: flex; gap: 8px; align-items: flex-start; font-weight: 500; cursor: pointer; margin: 0; }
.kdp-steps input { margin-top: 6px; accent-color: var(--ok); flex: none; }
.kdp-steps input:checked + * , .kdp-steps label:has(input:checked) { color: var(--muted); text-decoration: line-through; }
input[type=date] { width: 100%; padding: 12px 14px; border: 1.5px solid var(--line); border-radius: var(--radius-sm); background: #fff; font: inherit; }

/* Stage 5: sales and payouts */
.radio-row { display: flex; flex-wrap: wrap; gap: .5rem 1.25rem; }
.radio { display: inline-flex; align-items: center; gap: .4rem; font-weight: 500; }
.field .label { display: block; font-weight: 600; margin-bottom: .4rem; }
.inline-form { display: flex; flex-wrap: wrap; gap: .4rem; align-items: center; margin-top: .3rem; }
.inline-form input[type="date"] { width: auto; min-width: 9.5rem; padding: .35rem .5rem; }
.row-actions { display: flex; flex-wrap: wrap; gap: .4rem; align-items: center; }
.row-actions form { margin: 0; }
.alert-list { margin: 0; padding-inline-start: 1.2rem; display: grid; gap: .35rem; }
.panel.narrow { max-width: 34rem; }
.payout-list { display: grid; gap: .75rem; }
.payout-card { border: 1px solid var(--line, #e5e1da); border-radius: 12px; padding: .8rem 1rem; }
.payout-main { display: flex; flex-wrap: wrap; gap: .5rem 1rem; align-items: center; }
.payout-card .hint { margin: .35rem 0 0; }
.payout-actions { display: flex; flex-wrap: wrap; gap: .5rem; align-items: flex-start; margin-top: .6rem; }
.payout-actions form { margin: 0; }
.payout-actions details { flex: 1 1 16rem; }
.payout-actions summary { list-style: none; display: inline-block; cursor: pointer; }
.payout-actions summary::-webkit-details-marker { display: none; }
.dispute-form { display: grid; gap: .4rem; margin-top: .5rem; }
.dispute-form textarea { width: 100%; }

/* Card-to-card payment */
.pay-amount { display: flex; align-items: baseline; gap: .5rem; margin: .25rem 0 1rem; }
.pay-amount strong { font-size: 1.8rem; color: var(--ink); }
.pay-review { border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 1rem; margin-bottom: 1rem; }
.review-buttons { display: flex; flex-wrap: wrap; gap: .6rem; align-items: flex-start; margin-top: .75rem; }
.review-buttons form { margin: 0; }
.review-buttons details { flex: 1 1 16rem; }
.review-buttons summary { list-style: none; display: inline-block; cursor: pointer; }
.review-buttons summary::-webkit-details-marker { display: none; }

/* Footer and legal pages */
.site-foot { display: flex; flex-wrap: wrap; justify-content: center; gap: .5rem 1.5rem; padding: 1.5rem 16px 2rem; color: var(--muted); font-size: .9rem; }
.site-foot a { color: inherit; }
.auth-legal { text-align: center; font-size: .85rem; color: var(--muted); margin-top: 1rem; }
.legal { line-height: 2.1; max-width: 52rem; }
.legal h2 { font-size: 1.1rem; margin: 1.6rem 0 .4rem; }
.legal ul { padding-inline-start: 1.3rem; margin: 0; }
.legal li { margin-bottom: .35rem; }
.rate-form { display: flex; flex-wrap: wrap; gap: .4rem; align-items: center; margin: 0; }
.rate-field { display: inline-flex; align-items: center; gap: .25rem; font-size: .85rem; }
.rate-field input { width: 5rem; padding: .3rem .4rem; }

/* Sales dashboard (charts drawn as inline SVG) */
:root {
  --series-1: #2a78d6;   /* Kindle / share */
  --series-2: #eb6834;   /* paperback */
  --series-3: #1baf7a;   /* hardcover */
  --grid: #e3e6ee;
}
.dash-filters { display: flex; flex-wrap: wrap; gap: .6rem 1rem; align-items: center; margin-bottom: .4rem; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 999px; padding: 3px; background: var(--sheet); }
.seg-btn { border: 0; background: transparent; padding: .35rem .9rem; border-radius: 999px; font: inherit; font-size: .9rem; color: var(--muted); cursor: pointer; }
.seg-btn.is-on { background: var(--ink); color: #fff; font-weight: 600; }
.seg-btn:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.dash-select { display: inline-flex; align-items: center; gap: .5rem; font-size: .9rem; }
.dash-select select { max-width: 16rem; padding: .35rem .5rem; }
.dash-range { margin-top: 0; }
.stat-row { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: .75rem; margin: .5rem 0 1rem; }
.stat-row.is-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.sales-summary .stat-row { margin-bottom: .5rem; }
.sales-cell { white-space: nowrap; }
.stat-tile { background: var(--sheet); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: .8rem 1rem; display: flex; flex-direction: column; gap: .2rem; }
.stat-label { font-size: .82rem; color: var(--muted); }
.stat-tile strong { font-size: 1.35rem; font-weight: 700; color: var(--ink); }
.stat-tile.is-hero strong { font-size: 2.2rem; line-height: 1.2; }
.chart-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; }
.chart-grid > .panel { margin: 0 0 1rem; min-width: 0; }
.chart { margin: 0; }
.chart figcaption { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: .5rem; }
.chart figcaption h2 { margin: 0; }
.chart-stack > .panel { margin: 0 0 1rem; }
.chart-box { overflow-x: auto; margin-top: .5rem; direction: ltr; }  /* scroll starts at the y axis */
.chart-svg { display: block; width: 100%; min-width: 520px; height: auto; }
.chart-svg .grid { stroke: var(--grid); stroke-width: 1; shape-rendering: crispEdges; }
.chart-svg .grid.base { stroke: #c9cdd8; }
.chart-svg .tick { fill: var(--muted); font-size: 12px; font-family: inherit; }
.chart-svg .hit { fill: transparent; }
.chart-svg .col { outline: none; cursor: default; }
.chart-svg .col:hover .hit, .chart-svg .col:focus-visible .hit { fill: rgba(29, 39, 71, .05); }
.chart-svg .col.is-est .mark { opacity: .45; }
.sw-ebook { fill: var(--series-1); background: var(--series-1); }
.sw-paperback { fill: var(--series-2); background: var(--series-2); }
.sw-hardcover { fill: var(--series-3); background: var(--series-3); }
.legend { list-style: none; display: flex; flex-wrap: wrap; gap: .3rem 1rem; margin: 0; padding: 0; font-size: .85rem; color: var(--muted); }
.legend li { display: inline-flex; align-items: center; gap: .35rem; }
.swatch { display: inline-block; width: 10px; height: 10px; border-radius: 2px; vertical-align: middle; }
table.compact td, table.compact th { padding: .45rem .6rem; }
.hbars { list-style: none; margin: 0; padding: 0; display: grid; gap: .55rem; }
.hbars li { display: grid; grid-template-columns: 7.5rem 1fr auto; gap: .6rem; align-items: center; font-size: .9rem; }
.hbar-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-align: right; }
.hbar-track { height: 12px; }
.hbar { display: block; height: 12px; min-width: 2px; background: var(--series-1); border-radius: 0 4px 4px 0; }
[dir="rtl"] .hbar { border-radius: 4px 0 0 4px; margin-inline-start: 0; }
.hbar-value { color: var(--muted); font-size: .85rem; white-space: nowrap; }
.data-table { margin-top: .8rem; }
.data-table summary { cursor: pointer; color: var(--ink-soft); font-weight: 600; }
.chart-tip { position: fixed; z-index: 50; pointer-events: none; background: var(--ink); color: #fff; padding: .45rem .7rem; border-radius: 8px; font-size: .85rem; line-height: 1.6; box-shadow: 0 6px 18px rgba(0,0,0,.18); max-width: 18rem; }
.chart-tip strong { display: block; font-size: 1rem; }
.chart-tip[hidden] { display: none; }
@media (max-width: 760px) {
  .stat-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stat-tile.is-hero { grid-column: 1 / -1; }
  .chart-grid { grid-template-columns: 1fr; }
  .hbars li { grid-template-columns: 5.5rem 1fr; }
  .hbar-value { grid-column: 2; }
}
