/* Petiht Ebooks Hub — gray / white / matte black / yellow / blue / red */

:root {
  --eh-bg: #f0f0f0;
  --eh-surface: #ffffff;
  --eh-ink: #1a1a1a;
  --eh-muted: #6b7280;
  --eh-border: #e5e7eb;
  --eh-yellow: #eab308;
  --eh-yellow-dark: #ca8a04;
  --eh-blue: #2563eb;
  --eh-blue-dark: #1d4ed8;
  --eh-red: #dc2626;
  --eh-gray-100: #f9fafb;
  --eh-gray-200: #f3f4f6;
  --eh-radius: 12px;
  --eh-font: "DM Sans", system-ui, sans-serif;
  --eh-serif: "Libre Baskerville", Georgia, serif;
  --eh-shadow: 0 4px 24px rgba(26, 26, 26, 0.08);
}

*, *::before, *::after { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }

.eh-body {
  font-family: var(--eh-font);
  background: var(--eh-bg);
  color: var(--eh-ink);
  min-height: 100vh;
  line-height: 1.5;
}

.eh-body--workbook { background: var(--eh-gray-200); }

.eh-main { min-height: calc(100vh - 120px); }

/* Header */
.eh-header {
  background: var(--eh-ink);
  color: #fff;
  border-bottom: 3px solid var(--eh-yellow);
}

.eh-header__inner {
  max-width: 1400px;
  margin: 0 auto;
  padding: 12px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.eh-header__brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #fff;
  text-decoration: none;
  font-weight: 700;
  font-size: 15px;
}

.eh-header__nav {
  display: flex;
  align-items: center;
  gap: 16px;
  font-size: 14px;
}

.eh-header__link {
  color: rgba(255,255,255,0.85);
  text-decoration: none;
}

.eh-header__link:hover { color: var(--eh-yellow); }

.eh-header__link.is-active { color: var(--eh-yellow); font-weight: 700; }

.eh-header__link--muted { opacity: 0.65; font-size: 13px; }

.eh-header__user { font-size: 13px; opacity: 0.75; }

.eh-logo {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: var(--eh-yellow);
  color: var(--eh-ink);
  font-weight: 800;
  font-size: 14px;
  letter-spacing: -0.02em;
}

.eh-logo--sm { width: 32px; height: 32px; font-size: 11px; border-radius: 8px; }

/* Auth */
.eh-auth {
  min-height: calc(100vh - 80px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
}

.eh-auth__panel {
  width: 100%;
  max-width: 920px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 32px;
  align-items: center;
}

@media (max-width: 768px) {
  .eh-auth__panel { grid-template-columns: 1fr; }
}

.eh-auth__brand h1 {
  font-family: var(--eh-serif);
  font-size: 2rem;
  margin: 16px 0 12px;
}

.eh-auth__brand p { color: var(--eh-muted); max-width: 360px; }

.eh-card {
  background: var(--eh-surface);
  border-radius: var(--eh-radius);
  box-shadow: var(--eh-shadow);
  padding: 28px;
  border: 1px solid var(--eh-border);
}

.eh-form { display: flex; flex-direction: column; gap: 16px; }

.eh-field { display: flex; flex-direction: column; gap: 6px; font-size: 14px; }

.eh-field span { font-weight: 600; color: var(--eh-muted); font-size: 12px; text-transform: uppercase; letter-spacing: 0.04em; }

.eh-field input,
.eh-field textarea,
.eh-field select,
.eh-field-input {
  width: 100%;
  padding: 11px 14px;
  border: 1px solid var(--eh-border);
  border-radius: 8px;
  font: inherit;
  background: var(--eh-gray-100);
}

.eh-field input:focus,
.eh-field textarea:focus,
.eh-field select:focus { outline: 2px solid var(--eh-blue); border-color: var(--eh-blue); }

.eh-check { display: flex; align-items: center; gap: 8px; font-size: 14px; color: var(--eh-muted); }

.eh-auth__hint { margin-top: 16px; font-size: 13px; text-align: center; }

.eh-auth__hint a { color: var(--eh-blue); }

/* Buttons */
.eh-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 18px;
  border-radius: 8px;
  border: none;
  font: inherit;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  transition: transform 0.12s, box-shadow 0.12s;
}

.eh-btn:active { transform: scale(0.98); }

.eh-btn--full { width: 100%; }

.eh-btn--blue { background: var(--eh-blue); color: #fff; }
.eh-btn--blue:hover { background: var(--eh-blue-dark); }

.eh-btn--yellow { background: var(--eh-yellow); color: var(--eh-ink); }
.eh-btn--yellow:hover { background: var(--eh-yellow-dark); }

.eh-btn--ghost {
  background: transparent;
  border: 1px solid var(--eh-border);
  color: var(--eh-ink);
}

.eh-btn--sm { padding: 6px 12px; font-size: 12px; }

.eh-icon-btn {
  width: 36px;
  height: 36px;
  border: none;
  background: transparent;
  border-radius: 8px;
  cursor: pointer;
  color: var(--eh-muted);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
}

.eh-icon-btn:hover:not(:disabled) { background: var(--eh-gray-200); color: var(--eh-ink); }

.eh-icon-btn:disabled { opacity: 0.35; cursor: not-allowed; }

/* Alerts */
.eh-alert {
  padding: 12px 14px;
  border-radius: 8px;
  font-size: 14px;
  margin-bottom: 16px;
}

.eh-alert--error { background: #fef2f2; color: var(--eh-red); border: 1px solid #fecaca; }

.eh-toast {
  position: fixed;
  top: 80px;
  right: 20px;
  z-index: 900;
  padding: 12px 18px;
  border-radius: 8px;
  background: var(--eh-ink);
  color: #fff;
  font-size: 14px;
  box-shadow: var(--eh-shadow);
}

.eh-toast--success { border-left: 4px solid var(--eh-yellow); }

.eh-toast--error { border-left: 4px solid var(--eh-red); background: #1a1a1a; }

/* Workbook layout */
.eh-workbook {
  display: grid;
  grid-template-columns: 260px 1fr;
  min-height: calc(100vh - 56px);
  max-width: 1600px;
  margin: 0 auto;
}

@media (max-width: 960px) {
  .eh-workbook { grid-template-columns: 1fr; }
  .eh-sidebar { display: none; }
}

.eh-sidebar {
  background: var(--eh-surface);
  border-right: 1px solid var(--eh-border);
  padding: 16px;
  overflow-y: auto;
}

.eh-sidebar__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.eh-sidebar__head h2 { font-size: 13px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--eh-muted); margin: 0; }

.eh-sidebar__list { display: flex; flex-direction: column; gap: 4px; }

.eh-sidebar__row {
  display: flex;
  align-items: stretch;
  gap: 4px;
}

.eh-sidebar__row .eh-sidebar__item {
  flex: 1;
  margin-bottom: 0;
}

.eh-sidebar__delete {
  flex-shrink: 0;
  width: 34px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--eh-muted);
  cursor: pointer;
  font-size: 18px;
  line-height: 1;
  padding: 0;
}

.eh-sidebar__delete:hover {
  background: #fef2f2;
  border-color: #fecaca;
  color: var(--eh-red, #dc2626);
}

.eh-sidebar__item {
  display: block;
  width: 100%;
  text-align: left;
  padding: 10px 12px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  cursor: pointer;
  font: inherit;
  margin-bottom: 4px;
}

.eh-sidebar__item:hover { background: var(--eh-gray-100); }

.eh-sidebar__item.is-active {
  background: #eff6ff;
  border-color: #bfdbfe;
}

.eh-sidebar__item strong { display: block; font-size: 14px; margin-bottom: 2px; }

.eh-sidebar__item small { color: var(--eh-muted); font-size: 11px; }

.eh-sidebar__empty {
  margin: 0;
  padding: 8px 4px;
  font-size: 13px;
  color: var(--eh-muted);
}

.eh-workspace { display: flex; flex-direction: column; min-width: 0; }

.eh-doc-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 20px;
  background: var(--eh-surface);
  border-bottom: 1px solid var(--eh-border);
  gap: 12px;
  flex-wrap: wrap;
}

.eh-doc-bar__left, .eh-doc-bar__right { display: flex; align-items: center; gap: 8px; }

.eh-doc-bar__sep { width: 1px; height: 20px; background: var(--eh-border); margin: 0 4px; }

.eh-save-status { font-size: 12px; color: var(--eh-muted); }

.eh-save-status.is-dirty { color: var(--eh-yellow-dark); }

.eh-save-status.is-saving { color: var(--eh-blue); }

.eh-canvas-wrap {
  flex: 1;
  padding: 24px 32px 48px;
  overflow-y: auto;
}

.eh-doc-title {
  width: 100%;
  border: none;
  background: transparent;
  font-family: var(--eh-serif);
  font-size: clamp(1.75rem, 4vw, 2.25rem);
  font-weight: 700;
  color: var(--eh-ink);
  margin-bottom: 16px;
  padding: 0;
}

.eh-doc-title:focus { outline: none; }

.eh-doc-title::placeholder { color: #9ca3af; }

/* Toolbar */
.eh-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px;
  padding: 8px 10px;
  background: var(--eh-surface);
  border: 1px solid var(--eh-border);
  border-radius: var(--eh-radius);
  margin-bottom: 12px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}

.eh-toolbar__select {
  padding: 6px 10px;
  border: 1px solid var(--eh-border);
  border-radius: 6px;
  font-size: 13px;
  background: var(--eh-gray-100);
  min-width: 120px;
}

.eh-toolbar__btn {
  padding: 6px 10px;
  border: none;
  background: transparent;
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
  color: var(--eh-ink);
}

.eh-toolbar__btn:hover { background: var(--eh-gray-200); }

.eh-toolbar__btn--ai { color: var(--eh-blue); font-weight: 600; }

.eh-toolbar__btn--spark {
  color: var(--eh-yellow-dark);
  font-weight: 700;
  font-size: 16px;
  width: 32px;
}

.eh-toolbar__btn--gen {
  color: var(--eh-blue);
  font-weight: 600;
  margin-left: auto;
}

.eh-toolbar__btn--toc {
  color: #0d9488;
  font-weight: 600;
  font-size: 12px;
  white-space: nowrap;
}

.eh-modal__panel--lg { max-width: 640px; max-height: min(90vh, 820px); overflow: hidden; display: flex; flex-direction: column; }

.eh-modal__panel--lg .eh-modal__body {
  overflow-y: auto;
  flex: 1;
}

.eh-toc-form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

@media (max-width: 560px) {
  .eh-toc-form-row { grid-template-columns: 1fr; }
}

.eh-field--check {
  flex-direction: row;
  align-items: center;
  gap: 10px;
}

.eh-field--check input { width: auto; margin: 0; }

.eh-toc-preview__meta {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 16px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--eh-border);
}

.eh-toc-preview__count {
  margin: 0;
  font-size: 13px;
  font-weight: 600;
  color: var(--eh-blue);
}

.eh-toc-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.eh-toc-item {
  display: grid;
  grid-template-columns: 32px 1fr;
  gap: 10px;
  padding: 12px;
  border-radius: 12px;
  background: var(--eh-paper);
  border: 1px solid var(--eh-border);
}

.eh-toc-item__num {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, #0d9488, #0891b2);
  color: #fff;
  font-weight: 700;
  font-size: 13px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.eh-toc-item__fields {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
}

.eh-toc-item__fields input,
.eh-toc-item__fields textarea {
  width: 100%;
  border: 1px solid var(--eh-border);
  border-radius: 8px;
  padding: 8px 10px;
  font: inherit;
  font-size: 14px;
  background: #fff;
}

.eh-toc-item__fields textarea {
  min-height: 56px;
  resize: vertical;
}

.eh-toc-item__fields input:focus,
.eh-toc-item__fields textarea:focus {
  outline: 2px solid rgba(13, 148, 136, 0.35);
  border-color: #0d9488;
}

.eh-toolbar__sep { width: 1px; height: 22px; background: var(--eh-border); margin: 0 4px; }

.eh-wordcount { font-size: 11px; color: var(--eh-muted); margin-left: 8px; white-space: nowrap; }

.eh-toolbar__dropdown { position: relative; }

.eh-ai-menu {
  position: absolute;
  top: 100%;
  left: 0;
  z-index: 100;
  min-width: 220px;
  background: var(--eh-surface);
  border: 1px solid var(--eh-border);
  border-radius: var(--eh-radius);
  box-shadow: var(--eh-shadow);
  padding: 6px;
  margin-top: 4px;
}

.eh-ai-menu button {
  display: block;
  width: 100%;
  text-align: left;
  padding: 9px 12px;
  border: none;
  background: transparent;
  border-radius: 6px;
  font: inherit;
  font-size: 13px;
  cursor: pointer;
}

.eh-ai-menu button:hover { background: #eff6ff; color: var(--eh-blue); }

/* Chapter nav */
.eh-chapter-nav {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
  padding: 8px 12px;
  background: var(--eh-gray-100);
  border-radius: var(--eh-radius);
  border: 1px solid var(--eh-border);
}

.eh-chapter-nav__arrow,
.eh-chapter-nav__add {
  width: 32px;
  height: 32px;
  border: 1px solid var(--eh-border);
  background: var(--eh-surface);
  border-radius: 8px;
  cursor: pointer;
  font-size: 18px;
  line-height: 1;
  color: var(--eh-ink);
}

.eh-chapter-nav__add { color: var(--eh-blue); font-weight: 700; }

.eh-chapter-nav__track {
  flex: 1;
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding: 2px 0;
  scrollbar-width: thin;
}

.eh-chapter-pill {
  flex-shrink: 0;
  padding: 6px 14px;
  border-radius: 999px;
  border: 1px solid var(--eh-border);
  background: var(--eh-surface);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}

.eh-chapter-pill.is-active {
  background: var(--eh-ink);
  color: #fff;
  border-color: var(--eh-ink);
}

.eh-meta-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 12px;
}

@media (max-width: 640px) {
  .eh-meta-row { grid-template-columns: 1fr; }
}

.eh-chapter-title,
.eh-chapter-summary {
  padding: 10px 14px;
  border: 1px solid var(--eh-border);
  border-radius: 8px;
  font: inherit;
  background: var(--eh-surface);
}

.eh-chapter-summary { font-size: 13px; color: var(--eh-muted); }

/* Editor page */
.eh-editor-page {
  background: var(--eh-surface);
  border: 1px solid var(--eh-border);
  border-radius: var(--eh-radius);
  box-shadow: var(--eh-shadow);
  min-height: 480px;
}

.eh-editor {
  padding: 40px 48px 64px;
  min-height: 480px;
  font-family: var(--eh-serif);
  font-size: 17px;
  line-height: 1.75;
  color: var(--eh-ink);
  outline: none;
}

@media (max-width: 640px) {
  .eh-editor { padding: 24px 20px 48px; }
}

.eh-editor:empty::before {
  content: attr(data-placeholder);
  color: #9ca3af;
  pointer-events: none;
}

.eh-editor h2, .eh-editor h3 { font-family: var(--eh-serif); margin-top: 1.2em; }

.eh-editor blockquote {
  border-left: 3px solid var(--eh-yellow);
  margin: 1em 0;
  padding-left: 16px;
  color: var(--eh-muted);
  font-style: italic;
}

.eh-editor img { max-width: 100%; border-radius: 8px; margin: 12px 0; }

.eh-editor .eh-image-block {
  margin: 16px 0;
  text-align: center;
}

.eh-editor .eh-inline-img {
  display: inline-block;
  cursor: pointer;
  border-radius: 10px;
  box-shadow: 0 2px 12px rgba(15, 23, 42, 0.08);
}

.eh-editor .eh-inline-img:hover {
  outline: 2px solid var(--eh-blue);
  outline-offset: 3px;
}

/* Modal */
.eh-modal[hidden] { display: none !important; }

.eh-modal {
  position: fixed;
  inset: 0;
  z-index: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.eh-modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(26, 26, 26, 0.45);
}

.eh-modal__panel {
  position: relative;
  width: 100%;
  max-width: 520px;
  background: var(--eh-surface);
  border-radius: var(--eh-radius);
  box-shadow: var(--eh-shadow);
  border: 1px solid var(--eh-border);
  max-height: 90vh;
  overflow-y: auto;
}

.eh-modal__panel--sm { max-width: 400px; }

.eh-modal__panel--md { max-width: 480px; }

.eh-field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.eh-field-lock {
  display: flex;
  align-items: center;
  gap: 6px;
}

.eh-field-lock input { flex: 1; }

.eh-lock-btn {
  width: 36px;
  height: 36px;
  border: 1px solid var(--eh-border);
  background: var(--eh-gray-100);
  border-radius: 8px;
  cursor: pointer;
  font-size: 14px;
  line-height: 1;
  flex-shrink: 0;
}

.eh-lock-btn.is-locked { background: var(--eh-gray-200); }

.eh-toolbar__btn--more {
  width: 32px;
  height: 32px;
  padding: 0;
  background: var(--eh-gray-200);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.eh-toolbar__btn--more:hover { background: var(--eh-gray-300, #d1d5db); }

.eh-toolbar__btn--more svg { display: block; }

.eh-color-trigger {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  min-width: 32px;
  padding: 4px 8px !important;
}

.eh-color-trigger__letter {
  font-weight: 700;
  font-size: 15px;
  line-height: 1;
}

.eh-color-trigger__bar {
  display: block;
  width: 18px;
  height: 3px;
  border-radius: 2px;
  background: #000;
}

.eh-color-trigger__bar--hi { background: #fef08a; }

.eh-color-popover[hidden],
.eh-ai-menu[hidden] { display: none !important; }

.eh-color-popover {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  z-index: 120;
  background: var(--eh-surface);
  border: 1px solid var(--eh-border);
  border-radius: 10px;
  box-shadow: var(--eh-shadow);
  padding: 10px;
  width: 196px;
}

.eh-color-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 4px;
}

.eh-color-swatch {
  width: 26px;
  height: 26px;
  border: 1px solid rgba(0,0,0,0.08);
  border-radius: 4px;
  cursor: pointer;
  padding: 0;
  position: relative;
}

.eh-color-swatch:hover { transform: scale(1.08); }

.eh-color-swatch.is-selected::after {
  content: '✓';
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 14px;
  font-weight: 700;
  text-shadow: 0 0 2px rgba(0,0,0,0.8);
}

.eh-color-swatch--none {
  background: #fff !important;
  background-image: linear-gradient(135deg, transparent 46%, #ef4444 46%, #ef4444 54%, transparent 54%) !important;
}

.eh-color-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--eh-border);
}

.eh-more-menu[hidden] { display: none !important; }

.eh-more-menu {
  position: absolute;
  top: calc(100% + 4px);
  right: 0;
  z-index: 120;
  display: flex;
  align-items: center;
  gap: 2px;
  background: var(--eh-surface);
  border: 1px solid var(--eh-border);
  border-radius: 10px;
  box-shadow: var(--eh-shadow);
  padding: 6px;
}

.eh-more-menu button {
  width: 36px;
  height: 36px;
  border: none;
  background: transparent;
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--eh-ink);
  font-size: 13px;
  font-weight: 600;
}

.eh-more-menu button:hover,
.eh-more-menu button.is-active { background: var(--eh-gray-200); }

.eh-more-md {
  font-weight: 700;
  font-size: 14px;
  line-height: 1;
}

.eh-editor pre {
  background: var(--eh-gray-100);
  border: 1px solid var(--eh-border);
  border-radius: 8px;
  padding: 12px 14px;
  overflow-x: auto;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 13px;
  line-height: 1.5;
}

.eh-editor code {
  font-family: inherit;
  font-size: inherit;
}

.eh-editor img {
  max-width: 100%;
  height: auto;
  border-radius: 6px;
}

.eh-editor a { color: var(--eh-blue); text-decoration: underline; }

.eh-modal__hint {
  margin: 0;
  font-size: 13px;
  color: var(--eh-muted);
  line-height: 1.5;
}

.eh-modal__tabs {
  display: flex;
  gap: 4px;
  padding: 0 20px;
  border-bottom: 1px solid var(--eh-border);
}

.eh-modal-tab {
  padding: 10px 14px;
  border: none;
  background: transparent;
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  color: var(--eh-muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}

.eh-modal-tab:hover { color: var(--eh-ink); }

.eh-modal-tab.is-active {
  color: var(--eh-blue);
  border-bottom-color: var(--eh-blue);
}

  margin-top: 12px;
  border: 1px solid var(--eh-border);
  border-radius: 10px;
  overflow: hidden;
  background: var(--eh-gray-100);
}

.eh-image-ai-preview img {
  display: block;
  width: 100%;
  max-height: 220px;
  object-fit: contain;
}

.eh-field textarea {
  padding: 10px 12px;
  border: 1px solid var(--eh-border);
  border-radius: 8px;
  font: inherit;
  font-size: 14px;
  resize: vertical;
  min-height: 72px;
}

.eh-field textarea:focus {
  outline: 2px solid var(--eh-blue);
  border-color: var(--eh-blue);
}

.eh-modal__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 20px;
  border-bottom: 1px solid var(--eh-border);
}

.eh-modal__head h2 { margin: 0; font-size: 18px; font-family: var(--eh-serif); }

.eh-modal__body { padding: 20px; display: flex; flex-direction: column; gap: 14px; }

.eh-modal__foot {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 10px;
  padding: 16px 20px;
  border-top: 1px solid var(--eh-border);
}

.eh-modal__foot #eh-link-remove { margin-right: auto; }

.eh-cover-preview img {
  max-width: 120px;
  border-radius: 8px;
  margin-top: 8px;
  border: 1px solid var(--eh-border);
}

.eh-edit-banner {
  margin: 0 0 12px;
  padding: 10px 14px;
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  border-radius: 10px;
  font-size: 13px;
  color: var(--eh-ink);
}

.eh-edit-banner a { color: var(--eh-blue); font-weight: 600; text-decoration: none; }
.eh-edit-banner a:hover { text-decoration: underline; }

/* My ebooks library */
.eh-body--library .eh-main { max-width: 1100px; margin: 0 auto; padding: 24px 20px 48px; }

.eh-library__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 28px;
  flex-wrap: wrap;
}

.eh-library__title {
  margin: 0 0 6px;
  font-family: var(--eh-serif);
  font-size: 28px;
  font-weight: 700;
}

.eh-library__subtitle {
  margin: 0;
  color: var(--eh-muted);
  font-size: 14px;
  max-width: 520px;
}

.eh-library__grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 18px;
}

.eh-library__loading,
.eh-library__error,
.eh-library__empty {
  grid-column: 1 / -1;
  text-align: center;
  padding: 48px 20px;
  color: var(--eh-muted);
}

.eh-library__empty .eh-btn { margin-top: 16px; }

.eh-book-card {
  background: var(--eh-surface);
  border: 1px solid var(--eh-border);
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 1px 4px rgba(0,0,0,0.04);
  display: flex;
  flex-direction: column;
}

.eh-book-card__cover {
  aspect-ratio: 3 / 4;
  background: var(--eh-gray-100);
  overflow: hidden;
}

.eh-book-card__cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.eh-book-card__no-cover {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  font-size: 48px;
  opacity: 0.35;
}

.eh-book-card__body { padding: 16px; display: flex; flex-direction: column; gap: 8px; flex: 1; }

.eh-book-card__title {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
  line-height: 1.3;
}

.eh-book-card__meta,
.eh-book-card__date {
  margin: 0;
  font-size: 12px;
  color: var(--eh-muted);
}

.eh-book-card__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: auto;
  padding-top: 10px;
}

.eh-btn--sm { padding: 7px 12px; font-size: 12px; }

.eh-btn--danger { color: var(--eh-red) !important; }
.eh-btn--danger:hover { background: #fef2f2 !important; }

/* Loading overlay */
.eh-loading[hidden] { display: none !important; }

.eh-loading {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(240, 240, 240, 0.85);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
}

.eh-loading__spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--eh-border);
  border-top-color: var(--eh-blue);
  border-radius: 50%;
  animation: eh-spin 0.8s linear infinite;
}

@keyframes eh-spin { to { transform: rotate(360deg); } }

.eh-footer {
  padding: 16px;
  text-align: center;
  font-size: 12px;
  color: var(--eh-muted);
  border-top: 1px solid var(--eh-border);
  background: var(--eh-surface);
}

.eh-footer__dot { margin: 0 6px; }
