:root {
  --paper: #F7F8FA;
  --paper-raised: #FFFFFF;
  --ink: #111827;
  --ink-soft: #6B7280;
  --rule: #E5E7EB;
  --brass: #2563EB;
  --brass-dark: #1D4ED8;
  --live: #16A34A;
  --submitted: #2563EB;
  --blocked: #DC2626;
  --not-started: #9CA3AF;
  --radius: 3px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background-color: var(--paper);
  color: var(--ink);
  font-family: 'Inter', sans-serif;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 { font-family: 'Libre Baskerville', serif; font-weight: 700; margin: 0; }

.hidden { display: none !important; }

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 40px;
  border-bottom: 1px solid var(--rule);
  gap: 24px;
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--paper);
}
.brand {
  font-family: 'Libre Baskerville', serif;
  font-weight: 700;
  font-size: 22px;
  letter-spacing: 0.02em;
  text-decoration: none;
  color: var(--ink);
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
}
.app-nav { display: flex; gap: 22px; flex: 1; }
.app-nav a {
  font-family: 'Inter', sans-serif;
  font-size: 14px;
  font-weight: 500;
  color: var(--ink-soft);
  text-decoration: none;
}
.app-nav a:hover { color: var(--ink); }
.auth-status { font-family: 'Inter', sans-serif; font-size: 13px; color: var(--ink-soft); }
.auth-status span[id] { cursor: pointer; text-decoration: underline; }
.auth-status span[id]:hover { color: var(--ink); }

.nav-toggle {
  display: none;
  background: none;
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  font-size: 18px;
  padding: 5px 11px;
  cursor: pointer;
  color: var(--ink);
}

@media (max-width: 640px) {
  .nav-toggle { display: block; }
  .topbar { flex-wrap: wrap; }
  .app-nav {
    display: none;
    flex-direction: column;
    gap: 4px;
    width: 100%;
    position: absolute;
    top: 100%;
    left: 0;
    background: var(--paper-raised);
    border: 1px solid var(--rule);
    border-radius: var(--radius);
    padding: 12px 16px;
    margin-top: 8px;
    z-index: 20;
  }
  .app-nav.open { display: flex; }
  .app-nav a { padding: 8px 0; }
  .nav-dropdown { width: 100%; }
  .nav-dropdown summary { padding: 8px 0; }
  .nav-dropdown-menu { position: static; box-shadow: none; border: none; padding: 2px 0 4px 14px; min-width: 0; }
  .nav-dropdown-menu a { padding: 8px 0; }
}

/* --- Resources dropdown (matches the marketing site nav) --- */
.nav-dropdown { position: relative; }
.nav-dropdown summary {
  list-style: none; cursor: pointer; color: var(--ink-soft);
  font-family: 'Inter', sans-serif; font-size: 14px; font-weight: 500;
  display: flex; align-items: center; gap: 5px;
}
.nav-dropdown summary::-webkit-details-marker { display: none; }
.nav-dropdown summary:hover { color: var(--ink); }
.nav-dropdown summary::after { content: '\25BE'; font-size: 10px; position: relative; top: 1px; }
.nav-dropdown[open] summary::after { content: '\25B4'; }
.nav-dropdown-menu {
  position: absolute; top: calc(100% + 14px); left: 0;
  background: var(--paper-raised); border: 1px solid var(--rule); border-radius: var(--radius);
  padding: 8px; min-width: 260px; box-shadow: 0 16px 36px -16px rgba(17,24,39,0.22);
  display: flex; flex-direction: column; gap: 2px; z-index: 110;
}
.nav-dropdown-menu a {
  padding: 10px 12px; border-radius: 4px; font-size: 14px; color: var(--ink);
  text-decoration: none; white-space: nowrap;
}
.nav-dropdown-menu a:hover { background: var(--paper); color: var(--brass-dark); }

/* --- Auth --- */
.auth-wrap { display: flex; justify-content: center; padding: 60px 20px; }
.auth-card {
  background: var(--paper-raised);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  padding: 48px;
  max-width: 440px;
  width: 100%;
}
.auth-card h1 { font-size: 28px; line-height: 1.25; margin-bottom: 12px; }
.sub { color: var(--ink-soft); font-size: 15px; margin-bottom: 28px; line-height: 1.5; }
.tabs { display: flex; border-bottom: 1px solid var(--rule); margin-bottom: 24px; }
.tab {
  font-family: 'Inter', sans-serif;
  font-size: 15px;
  font-weight: 600;
  background: none; border: none; cursor: pointer;
  padding: 10px 4px; margin-right: 24px;
  color: var(--ink-soft);
  border-bottom: 2px solid transparent;
}
.tab.active { color: var(--ink); border-bottom-color: var(--brass); }
.auth-form { display: flex; flex-direction: column; gap: 16px; }

.free-title-badge {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  background-color: #f0f6ff;
  border: 1px solid #c9dcf5;
  border-radius: 8px;
  padding: 12px 14px;
  margin-bottom: -4px;
}
.free-title-badge .badge-icon {
  background-color: #1a3c5e;
  color: #fff;
  border-radius: 50%;
  width: 20px;
  height: 20px;
  min-width: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  margin-top: 2px;
}
.free-title-badge strong {
  display: block;
  font-size: 14px;
  color: var(--ink);
}
.free-title-badge span {
  display: block;
  font-size: 13px;
  color: var(--ink-soft);
  margin-top: 2px;
}
.signup-reassurance {
  text-align: center;
  font-size: 12px;
  color: var(--ink-soft);
  margin-top: -6px;
}
label { font-size: 13px; color: var(--ink-soft); display: flex; flex-direction: column; gap: 6px; }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=date], textarea {
  font-family: 'Inter', sans-serif;
  font-size: 15px;
  padding: 10px 12px;
  border: 1px solid #D1D5DB;
  border-radius: 5px;
  background: #FFFFFF;
  color: var(--ink);
  box-shadow: inset 0 1px 2px rgba(31,42,60,0.06);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
textarea { font-family: 'Inter', sans-serif; resize: vertical; }
input:focus, textarea:focus {
  outline: none;
  border-color: var(--brass);
  box-shadow: 0 0 0 3px rgba(169,121,59,0.15);
}
input::placeholder, textarea::placeholder { color: #9CA3AF; opacity: 1; }
.checkbox { flex-direction: row; align-items: center; gap: 8px; }
.checkbox input { width: auto; }

button { font-family: inherit; cursor: pointer; }
.btn-primary {
  background: var(--ink);
  color: var(--paper-raised);
  border: none;
  padding: 12px 20px;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 600;
}
.btn-primary:hover { background: var(--brass-dark); }
.btn-ghost {
  background: none;
  border: 1px solid var(--rule);
  padding: 10px 16px;
  border-radius: var(--radius);
  font-size: 14px;
  color: var(--ink-soft);
}
.btn-ghost:hover { border-color: var(--brass); color: var(--ink); }
.form-error { color: var(--blocked); font-size: 13px; min-height: 16px; }
.form-success { color: var(--live); font-size: 14px; font-weight: 600; }
.link-btn {
  background: none; border: none; color: var(--ink-soft); font-size: 13px;
  text-decoration: underline; padding: 0; cursor: pointer; text-align: left;
}
.link-btn:hover { color: var(--ink); }

/* --- Dashboard / shelf --- */
main { padding: 40px; max-width: 1100px; margin: 0 auto; }
.billing-bar {
  display: flex; justify-content: space-between; align-items: center;
  background: var(--paper-raised); border: 1px solid var(--brass);
  border-radius: var(--radius); padding: 14px 20px; margin-bottom: 24px;
  font-size: 14px;
}
.verify-bar { border-color: var(--rule); }
.verify-bar button { background: var(--ink); }
.verify-bar button:hover { background: var(--brass-dark); }
.billing-bar .plans { display: flex; gap: 10px; align-items: center; }
.billing-bar button {
  background: var(--brass); color: #fff; border: none;
  padding: 8px 16px; border-radius: var(--radius); font-size: 13px; font-weight: 600;
}
.billing-bar .btn-ghost-small {
  background: none; color: var(--ink-soft); border: 1px solid var(--rule);
  padding: 7px 14px; font-weight: 500;
}
.billing-bar #promoInput {
  padding: 7px 10px; font-size: 13px; border-radius: var(--radius);
  border: 1px solid #D1D5DB; background: #FFFFFF; width: 120px;
}
.shelf-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 28px; flex-wrap: wrap; gap: 12px; }
.shelf-header h1 { font-size: 26px; }
.shelf-header-actions { display: flex; gap: 10px; align-items: center; }
.shelf-filter-row { display: flex; align-items: center; gap: 10px; margin-bottom: 18px; }
.shelf-filter-row label { font-size: 13px; font-weight: 600; color: var(--ink); }
.shelf-filter-row select { padding: 8px 12px; border-radius: var(--radius); border: 1px solid var(--rule); font-size: 14px; background: var(--paper-raised); }

.report-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.report-table th {
  text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: 0.04em;
  color: var(--ink-soft); padding: 8px 10px; border-bottom: 1px solid var(--rule);
}
.report-table td { padding: 10px; border-bottom: 1px solid var(--rule); vertical-align: middle; }
.status-badge {
  display: inline-flex; align-items: center; padding: 3px 9px; border-radius: 10px;
  font-size: 11px; font-weight: 600; text-transform: capitalize;
}
.status-badge.status-not_started { background: rgba(154,145,130,0.14); color: var(--not-started); }
.status-badge.status-submitted { background: rgba(184,134,59,0.14); color: var(--submitted); }
.status-badge.status-live { background: rgba(63,108,81,0.14); color: var(--live); }
.status-badge.status-blocked, .status-badge.status-rejected { background: rgba(155,59,52,0.14); color: var(--blocked); }

.shelf-groups { display: block; }
.shelf-group { margin-bottom: 36px; }
.shelf-group-header {
  display: flex; align-items: baseline; gap: 10px; margin-bottom: 12px;
}
.shelf-group-header h2 {
  font-family: 'Libre Baskerville', serif; font-size: 18px; color: var(--ink);
}
.shelf-group-count { font-size: 13px; color: var(--ink-soft); }
.shelf {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 3px;
  padding-bottom: 16px;
  border-bottom: 6px solid var(--brass-dark);
}
.spine {
  width: 74px;
  min-height: 220px;
  background: var(--ink);
  border-radius: 2px 2px 0 0;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 14px 8px;
  cursor: pointer;
  position: relative;
  transition: transform 0.15s ease;
}
.spine:hover { transform: translateY(-6px); }
.spine-title {
  writing-mode: vertical-rl;
  transform: rotate(180deg);
  font-family: 'Libre Baskerville', serif;
  font-weight: 700;
  font-size: 15px;
  letter-spacing: 0.01em;
  color: var(--paper-raised);
  line-height: 1.4;
  max-height: 160px;
  overflow: hidden;
}
.spine-progress {
  writing-mode: vertical-rl;
  transform: rotate(180deg);
  font-family: 'Inter', sans-serif;
  font-size: 10px;
  color: var(--paper);
  opacity: 0.7;
}
.spine.spine-cover {
  width: 140px; padding: 0; background: var(--rule); overflow: hidden;
}
.spine-cover-img { width: 100%; height: 220px; object-fit: cover; display: block; }
.spine-cover-progress {
  position: absolute; bottom: 8px; left: 8px; right: 8px;
  background: rgba(0,0,0,0.6); color: #fff; font-size: 10px; font-family: 'Inter', sans-serif;
  padding: 3px 8px; border-radius: 10px; text-align: center;
}
.empty-shelf {
  font-family: 'Inter', sans-serif;
  color: var(--ink-soft);
  font-size: 14px;
  padding: 40px 0;
}

/* --- Title detail --- */
.title-head { margin-bottom: 8px; }
.title-head-row { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; flex-wrap: wrap; }
.title-head h1 { font-size: 30px; }

.btn-danger {
  background: none; border: 1px solid var(--blocked); color: var(--blocked);
  padding: 8px 16px; border-radius: var(--radius); font-size: 13px; font-weight: 600; cursor: pointer;
}
.btn-danger:hover { background: var(--blocked); color: #fff; }
.btn-danger-small {
  background: none; border: 1px solid var(--rule); color: var(--blocked);
  padding: 4px 10px; border-radius: var(--radius); font-size: 12px; cursor: pointer;
}
.btn-danger-small:hover { background: var(--blocked); color: #fff; border-color: var(--blocked); }
.title-meta { color: var(--ink-soft); font-size: 14px; margin-top: 6px; }
.ku-flag {
  display: inline-block;
  background: var(--brass);
  color: #fff;
  font-family: 'Inter', sans-serif;
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 10px;
  margin-left: 8px;
}

.section { margin-top: 36px; }
.section-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; }
.section-head h3 { font-size: 17px; }
.section-desc { font-size: 14px; color: var(--ink-soft); margin: -8px 0 14px; max-width: 560px; line-height: 1.5; }
.field-counter { font-size: 12px; color: var(--ink-soft); margin: 4px 0 16px; }
.rich-text-editor { border: 1px solid #D1D5DB; border-radius: 5px; overflow: hidden; margin-bottom: 4px; }
.rich-text-editor .ql-toolbar { border: none; border-bottom: 1px solid #D1D5DB; background: var(--paper-raised); }
.rich-text-editor .ql-container { border: none; font-family: 'Inter', sans-serif; font-size: 15px; min-height: 100px; }
.dashboard-intro { font-size: 14px; color: var(--ink-soft); margin: -18px 0 24px; max-width: 560px; }
.page-intro { font-size: 14px; color: var(--ink-soft); margin: 10px 0 24px; max-width: 560px; line-height: 1.5; }

.legend { display: flex; flex-direction: column; gap: 8px; }
.legend-item { font-size: 13px; color: var(--ink-soft); display: flex; align-items: center; }
.legend-item .status-dot { margin-right: 8px; }
.legend-item.status-not_started .status-dot { background: var(--not-started); }
.legend-item.status-submitted .status-dot { background: var(--submitted); }
.legend-item.status-live .status-dot { background: var(--live); }
.legend-item.status-blocked .status-dot, .legend-item.status-rejected .status-dot { background: var(--blocked); }

.format-block {
  background: var(--paper-raised);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 16px;
}
.format-block-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; }
.format-block-head-right { display: flex; align-items: center; gap: 8px; }
.format-type { font-family: 'Libre Baskerville', serif; font-weight: 700; font-size: 17px; text-transform: capitalize; }
.stage-pill {
  font-family: 'Inter', sans-serif;
  font-size: 11px;
  padding: 3px 10px;
  border-radius: 10px;
  background: var(--rule);
  color: var(--ink);
  text-transform: capitalize;
}
.format-sub { font-size: 13px; color: var(--ink-soft); margin-bottom: 14px; }

.platform-table-controls { display: flex; gap: 10px; margin-bottom: 12px; }
.platform-search { flex: 1; max-width: 280px; font-size: 13px; padding: 6px 10px; border: 1px solid var(--rule); border-radius: var(--radius); }
.platform-status-filter { font-size: 13px; padding: 6px 10px; border: 1px solid var(--rule); border-radius: var(--radius); background: #FFFFFF; }
.platform-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.platform-table th {
  text-align: left; font-family: 'Inter', sans-serif; font-weight: 600; font-size: 12px;
  color: var(--ink-soft); padding: 8px 10px; border-bottom: 2px solid var(--rule);
}
.platform-sort-header { cursor: pointer; user-select: none; }
.platform-sort-header:hover { color: var(--ink); }
.sort-arrow { font-size: 9px; margin-left: 2px; }
.platform-table td { padding: 8px 10px; border-bottom: 1px solid var(--rule); vertical-align: middle; }
.platform-row:nth-child(odd) { background: rgba(0,0,0,0.02); }
.platform-name { font-weight: 500; }
.platform-isbn-input { font-family: 'Inter', sans-serif; font-size: 12px; padding: 4px 8px; border: 1px solid #D1D5DB; border-radius: var(--radius); width: 100%; }
.status-select {
  font-family: 'Inter', sans-serif;
  font-size: 11px;
  padding: 4px 6px;
  border-radius: 10px;
  border: 1px solid #D1D5DB;
  background: #FFFFFF;
}
.submission-summary { margin: 12px 0 20px; }
.submission-summary-line { font-size: 13px; color: var(--ink-soft); display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.submission-summary-line .status-dot:not(:first-child) { margin-left: 12px; }
.ku-blocked-callout {
  margin-top: 8px; font-size: 13px; font-weight: 600; color: var(--blocked);
  background: rgba(220,38,38,0.08); padding: 8px 12px; border-radius: 6px;
  display: flex; align-items: center; gap: 6px;
}
.status-select.platform-status-select {
  appearance: none; -webkit-appearance: none; border: none; font-weight: 600;
  padding: 4px 22px 4px 10px; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%23888'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 8px center;
}
.status-select.platform-status-select.status-not_started { background-color: rgba(154,145,130,0.16); color: var(--not-started); }
.status-select.platform-status-select.status-submitted { background-color: rgba(184,134,59,0.16); color: var(--submitted); }
.status-select.platform-status-select.status-live { background-color: rgba(63,108,81,0.16); color: var(--live); }
.status-select.platform-status-select.status-blocked, .status-select.platform-status-select.status-rejected { background-color: rgba(155,59,52,0.16); color: var(--blocked); }
.status-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; }
.status-not_started .status-dot { background: var(--not-started); }
.status-submitted .status-dot { background: var(--submitted); }
.status-live .status-dot { background: var(--live); }
.status-rejected .status-dot, .status-blocked .status-dot { background: var(--blocked); }
.reason-input-wrap { display: flex; align-items: center; gap: 8px; width: 100%; }
.reason-input {
  font-family: 'Inter', sans-serif;
  font-size: 12px;
  padding: 4px 8px;
  border: 1px solid #D1D5DB;
  border-radius: var(--radius);
  background: #FFFFFF;
  color: var(--ink);
  width: 100%;
}
.product-link {
  font-size: 12px; font-weight: 600; color: var(--live);
  white-space: nowrap; text-decoration: none;
}
.product-link:hover { text-decoration: underline; }

.vendor-list, .cover-list { display: flex; flex-wrap: wrap; gap: 8px; }
.vendor-chip {
  background: var(--paper-raised);
  border: 1px solid var(--rule);
  border-radius: 16px;
  padding: 6px 14px;
  font-size: 13px;
}
.vendor-chip .vtype { color: var(--ink-soft); font-family: 'Inter', sans-serif; font-size: 11px; margin-left: 6px; }

.inline-form { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-top: 10px; }
.inline-form input, .inline-form select {
  font-family: 'Inter', sans-serif;
  font-size: 13px;
  padding: 8px 10px;
  border: 1px solid #D1D5DB;
  border-radius: 5px;
  background: #FFFFFF;
  color: var(--ink);
}
.inline-form button {
  background: var(--brass);
  color: #fff;
  border: none;
  padding: 8px 14px;
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 600;
}

/* --- Modal --- */
.modal {
  position: fixed; inset: 0;
  background: rgba(31,42,60,0.45);
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
}
.modal-card {
  background: var(--paper-raised);
  border-radius: var(--radius);
  padding: 32px;
  max-width: 420px;
  width: 100%;
}
.modal-card h2 { font-size: 20px; margin-bottom: 20px; }
.modal-card form { display: flex; flex-direction: column; gap: 14px; }
.row { display: flex; gap: 12px; }
.row label { flex: 1; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 8px; }

@media (max-width: 640px) {
  main { padding: 24px 16px; }
  .platform-row { grid-template-columns: 1fr; }
  .modal { padding: 12px; }
  .modal-card { padding: 22px; max-width: 100%; }
  .row { flex-direction: column; gap: 14px; }
  .spine { width: 60px; min-height: 180px; }
}
