/* Book Studio v2 — production-oriented editorial workflow */
.app-loading { min-height: 70vh; display: grid; place-items: center; color: var(--muted); font: 600 16px/1.4 var(--sans); }
.studio-account { display: flex; align-items: center; gap: 7px; margin-left: 4px; padding-left: 8px; border-left: 1px solid var(--line); font-size: 10px; color: var(--muted); }
.studio-account button { border: 0; background: transparent; cursor: pointer; color: #7a443d; font-size: 10px; font-weight: 800; }
.role-badge { display: inline-flex; align-items: center; min-height: 24px; padding: 0 8px; border-radius: 999px; background: #e4e8e2; color: #304238; font-size: 9px; font-weight: 800; letter-spacing: .05em; text-transform: uppercase; }
.studio-mode-banner, .preview-banner { display: flex; align-items: center; justify-content: center; gap: 12px; padding: 10px 18px; background: #fff2c7; border-bottom: 1px solid #e6d392; color: #685618; font-size: 11px; font-weight: 700; }
.preview-banner { position: sticky; top: 72px; z-index: 45; }
.preview-banner span { font-weight: 500; }
.preview-banner a { margin-left: auto; text-decoration: underline; }
.studio-gate { max-width: 760px; padding-top: 90px; padding-bottom: 110px; }
.studio-gate h1 { margin: 0 0 18px; font: 600 clamp(44px, 7vw, 72px)/1 var(--serif); letter-spacing: -.04em; }
.studio-gate > p { max-width: 620px; color: var(--muted); line-height: 1.7; }
.setup-card, .login-card { margin: 34px 0; padding: 26px; border: 1px solid var(--line); border-radius: 16px; background: var(--surface); }
.setup-card h2 { margin: 0 0 10px; font-size: 14px; }
.setup-card h2:not(:first-child) { margin-top: 24px; }
.setup-card code { display: block; padding: 14px; border-radius: 10px; background: #f1efe7; font: 600 12px/1.8 ui-monospace, SFMono-Regular, Consolas, monospace; }
.login-card { display: grid; gap: 14px; max-width: 500px; }
.login-card .primary-button, .login-card .secondary-button { width: 100%; border: 0; cursor: pointer; }
.form-error { margin: 0; color: #9c4238; font-size: 12px; }
.secondary-button { display: inline-flex; align-items: center; justify-content: center; min-height: 44px; padding: 0 15px; border: 1px solid #cbc9bf; border-radius: 9px; background: transparent; color: var(--ink); font-size: 12px; font-weight: 800; cursor: pointer; }
.publish-button { min-height: 46px; padding: 0 18px; border: 0; border-radius: 9px; background: #294d3c; color: #fff; font-size: 12px; font-weight: 800; cursor: pointer; }
.danger-button { margin-top: 22px; padding: 10px 14px; border: 1px solid #d8b6b2; border-radius: 9px; background: #fff8f7; color: #93463e; font-weight: 800; cursor: pointer; }
.admin-shell, .admin-editor { padding-top: 54px; padding-bottom: 100px; }
.admin-hero { display: flex; align-items: end; justify-content: space-between; gap: 36px; padding-bottom: 38px; }
.admin-hero h1, .editor-head h1 { margin: 0; font: 600 clamp(42px, 6vw, 68px)/1 var(--serif); letter-spacing: -.04em; }
.admin-hero p, .editor-head p { max-width: 700px; color: var(--muted); line-height: 1.65; }
.admin-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin: 20px 0 46px; }
.admin-stats article { padding: 20px; border: 1px solid var(--line); border-radius: 13px; background: var(--surface); }
.admin-stats span { display: block; margin-bottom: 10px; color: var(--muted); font-size: 10px; font-weight: 800; letter-spacing: .04em; text-transform: uppercase; }
.admin-stats strong { font: 600 34px/1 var(--serif); }
.admin-toolbar { display: flex; align-items: end; justify-content: space-between; gap: 20px; margin-bottom: 16px; }
.admin-toolbar h2 { margin: 0; font: 600 28px/1.1 var(--serif); }
.admin-toolbar p { margin: 6px 0 0; color: var(--muted); font-size: 12px; }
.studio-table { border: 1px solid var(--line); border-radius: 14px; overflow: hidden; background: var(--surface); }
.studio-table-head, .studio-table-row { display: grid; grid-template-columns: minmax(280px, 1.8fr) .65fr .75fr .75fr 1fr; gap: 16px; align-items: center; padding: 13px 16px; }
.studio-table-head { background: #efede5; color: var(--muted); font-size: 9px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.studio-table-row { min-height: 100px; border-top: 1px solid var(--line); font-size: 12px; }
.studio-book-cell { display: flex; gap: 14px; align-items: center; min-width: 0; }
.studio-book-cell .book-cover { width: 46px; height: 66px; min-width: 46px; padding: 7px 5px; border-radius: 2px 5px 5px 2px; }
.studio-book-cell .book-cover strong { font-size: 8px; }
.studio-book-cell .book-cover small, .studio-book-cell .cover-kicker, .studio-book-cell .cover-line { display: none; }
.studio-book-cell .book-cover-image { width: 46px; height: 66px; min-width: 46px; }
.studio-book-cell > div:last-child { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.studio-book-cell strong { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.studio-book-cell span, .studio-book-cell small { color: var(--muted); font-size: 10px; }
.studio-row-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; }
.studio-row-actions a { font-size: 10px; font-weight: 800; text-decoration: underline; text-underline-offset: 3px; }
.status-pill { display: inline-flex; width: max-content; align-items: center; min-height: 27px; padding: 0 9px; border-radius: 999px; background: #e8e6de; color: #5d5c55; font-size: 9px; font-weight: 800; text-transform: uppercase; letter-spacing: .03em; }
.status-pill.published { background: #dfeadf; color: #33583d; }
.status-pill.in_review { background: #e5e8f3; color: #46557d; }
.status-pill.approved { background: #dceae6; color: #2f5d50; }
.status-pill.archived, .status-pill.superseded { background: #ece9e5; color: #7b7069; }
.editor-head { display: flex; justify-content: space-between; gap: 30px; align-items: end; margin-bottom: 26px; }
.editor-head-actions { display: flex; gap: 9px; align-items: center; }
.editor-status-row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-top: 12px; color: var(--muted); font-size: 10px; }
.book-form > fieldset { min-width: 0; margin: 0; padding: 0; border: 0; }
.form-panel { margin: 0 0 20px; padding: 26px; border: 1px solid var(--line); border-radius: 16px; background: var(--surface); }
.form-panel-head { display: grid; grid-template-columns: 38px 1fr; gap: 12px; margin-bottom: 24px; }
.form-panel-head > span { display: grid; place-items: center; width: 31px; height: 31px; border: 1px solid var(--line); border-radius: 50%; color: var(--muted); font-size: 9px; font-weight: 800; }
.form-panel-head h2 { margin: 0; font: 600 28px/1.1 var(--serif); }
.form-panel-head p { margin: 5px 0 0; color: var(--muted); font-size: 11px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.field { display: grid; gap: 7px; margin-bottom: 14px; }
.field-wide { grid-column: 1/-1; }
.field > span { color: #5f6059; font-size: 10px; font-weight: 800; letter-spacing: .02em; }
.field input, .field textarea, .field select { width: 100%; border: 1px solid #d4d1c7; border-radius: 9px; outline: none; background: #fbfaf6; color: var(--ink); font: 500 13px/1.55 var(--sans); }
.field input, .field select { min-height: 43px; padding: 0 11px; }
.field textarea { padding: 11px; resize: vertical; }
.field input:focus, .field textarea:focus, .field select:focus { border-color: #788a7f; box-shadow: 0 0 0 3px rgba(54,84,65,.08); }
.topic-fieldset { margin: 8px 0 20px; padding: 15px; border: 1px solid var(--line); border-radius: 11px; }
.topic-fieldset legend { padding: 0 7px; color: var(--muted); font-size: 10px; font-weight: 800; }
.topic-checks, .related-grid { display: flex; flex-wrap: wrap; gap: 8px; }
.topic-checks label, .related-grid label { display: inline-flex; align-items: center; gap: 6px; padding: 8px 10px; border: 1px solid #d7d4ca; border-radius: 999px; background: #fbfaf7; font-size: 10px; font-weight: 700; cursor: pointer; }
.block-stack { display: grid; gap: 12px; }
.content-block { padding: 17px; border: 1px solid #d8d5cb; border-radius: 12px; background: #fbfaf6; }
.content-block.compact { padding-bottom: 8px; }
.content-block-head { display: flex; justify-content: space-between; gap: 14px; align-items: center; margin-bottom: 14px; }
.content-block-head strong { font-size: 11px; }
.content-block-head div { display: flex; flex-wrap: wrap; gap: 5px; }
.content-block-head button { padding: 5px 7px; border: 1px solid #d5d2c8; border-radius: 6px; background: #fff; color: #66675f; font-size: 9px; font-weight: 800; cursor: pointer; }
.add-block { margin-top: 13px; }
.read-only-form { opacity: .78; }
.workflow-panel { display: flex; justify-content: space-between; gap: 26px; align-items: center; margin-top: 26px; padding: 24px; border-radius: 16px; background: #202b24; color: #fff; }
.workflow-panel h2 { margin: 0; font: 600 30px/1.1 var(--serif); }
.workflow-panel p { max-width: 650px; margin: 8px 0 0; color: #b8c1bb; font-size: 11px; line-height: 1.65; }
.workflow-panel .overline { color: #b8c1bb; }
.workflow-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; }
.workflow-panel .secondary-button { border-color: #57645c; color: #fff; }
.studio-feedback { margin: 0 0 18px; padding: 14px 17px; border-radius: 11px; font-size: 11px; line-height: 1.6; }
.studio-feedback.error { border: 1px solid #e0bbb4; background: #fff4f2; color: #7e3d35; }
.studio-feedback.success { border: 1px solid #b9d3bf; background: #f1f8f2; color: #345b3c; }
.studio-feedback ul { margin: 8px 0 0; padding-left: 18px; }
.version-list { display: grid; gap: 10px; }
.version-list article { display: grid; grid-template-columns: 1fr 1fr auto; gap: 18px; align-items: center; padding: 18px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
.version-list article > div { display: flex; flex-wrap: wrap; gap: 9px; align-items: center; }
.version-list article span { color: var(--muted); font-size: 10px; }
.version-list article a { font-size: 10px; font-weight: 800; text-decoration: underline; }
.book-cover-image { width: 138px; aspect-ratio: .68; overflow: hidden; border-radius: 4px 10px 10px 4px; background: #e8e6de; box-shadow: 0 16px 30px rgba(25,25,22,.16); }
.book-cover-image img { display: block; width: 100%; height: 100%; object-fit: cover; }
.book-cover-large-image { width: 270px; border-radius: 6px 18px 18px 6px; }
.book-subtitle { margin: 8px 0 0; color: var(--muted); font: 500 18px/1.35 var(--serif); }
.reflection-list { display: grid; gap: 10px; padding-left: 22px; }
.reflection-list li { padding: 10px 0; color: #55574f; line-height: 1.65; }
.muted { color: var(--muted); font-size: 11px; }

@media (max-width: 900px) {
  .studio-account > span:first-child { display: none; }
  .admin-stats { grid-template-columns: repeat(2, 1fr); }
  .studio-table-head { display: none; }
  .studio-table-row { grid-template-columns: 1fr auto; gap: 10px; }
  .studio-table-row > span { display: none; }
  .studio-row-actions { justify-content: flex-start; }
  .editor-head, .workflow-panel { align-items: flex-start; flex-direction: column; }
  .editor-head-actions, .workflow-actions { width: 100%; }
  .version-list article { grid-template-columns: 1fr; }
}

@media (max-width: 620px) {
  .main-nav .studio-account { display: none; }
  .admin-shell, .admin-editor { padding-top: 30px; }
  .admin-hero { align-items: flex-start; flex-direction: column; }
  .admin-stats { grid-template-columns: 1fr 1fr; }
  .form-grid { grid-template-columns: 1fr; }
  .field-wide { grid-column: auto; }
  .form-panel { padding: 18px; }
  .content-block-head { align-items: flex-start; flex-direction: column; }
  .preview-banner { align-items: flex-start; flex-direction: column; top: 72px; }
  .preview-banner a { margin-left: 0; }
}
