:root {
  font-family: Arial, Helvetica, sans-serif;
  color: #1b3027;
  background: #f3f2eb;
  --accent: #087c77;
  --border: #d6ded5;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
}
button,
input,
select {
  font: inherit;
}
button,
.button {
  min-height: 44px;
  padding: 10px 14px;
  background: white;
  border: 1px solid var(--border);
  border-radius: 7px;
  color: #1e3c2d;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  cursor: pointer;
}
button:disabled {
  opacity: 0.45;
  cursor: default;
}
.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: white;
}
.danger {
  color: #9e3434;
}
.button:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
summary:focus-visible {
  outline: 3px solid #d1a345;
  outline-offset: 2px;
}
.shell-header {
  min-height: 82px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px max(24px, env(safe-area-inset-right)) 18px
    max(24px, env(safe-area-inset-left));
  background: #14251f;
  color: white;
}
.brand {
  color: inherit;
  text-decoration: none;
}
.brand b {
  font-size: 14px;
  letter-spacing: 0.1em;
}
.brand span {
  display: block;
  font-size: 12px;
  margin-top: 7px;
  color: #b4c9bb;
}
.badge {
  display: inline-block;
  font-size: 11px;
  border: 1px solid #b2c8b666;
  background: #e6efe415;
  color: inherit;
  border-radius: 30px;
  padding: 7px 10px;
}
.library {
  max-width: 1400px;
  padding: 36px 28px;
  margin: auto;
}
.page-heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 18px;
}
.page-heading small,
.editor-heading small {
  letter-spacing: 0.12em;
  font-size: 10px;
  color: var(--accent);
}
h1 {
  font:
    normal clamp(28px, 4vw, 43px) / 1.2 Georgia,
    serif;
  margin: 10px 0;
}
p {
  line-height: 1.6;
}
.page-heading p,
.storage-note {
  color: #68766b;
  font-size: 13px;
}
.storage-note {
  padding: 14px 0 10px;
  border-bottom: 1px solid var(--border);
}
.magazine-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 260px), 1fr));
  gap: 24px;
  margin-top: 26px;
}
.magazine-card {
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #fff;
  overflow: hidden;
}
.cover-link {
  height: 260px;
  background: #e3e6da;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 16px;
}
.cover-link img {
  display: block;
  max-height: 100%;
  max-width: 100%;
  width: auto;
  height: auto;
  box-shadow: 0 6px 15px #15251a20;
}
.card-body {
  padding: 18px;
}
.card-state {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: center;
}
.status-pill {
  display: inline-block;
  padding: 5px 8px;
  border-radius: 20px;
  background: #edf2e8;
  color: #4b6c48;
  font-size: 10px;
}
.card-state small {
  font-size: 11px;
  color: #6b786c;
}
.card-body h2 {
  font:
    normal 25px/1.2 Georgia,
    serif;
  overflow-wrap: anywhere;
  margin: 14px 0 8px;
}
.subtitle {
  font-size: 12px;
  color: #68746b;
  margin: 7px 0 12px;
  overflow-wrap: anywhere;
}
.card-body > small {
  font-size: 11px;
  color: #6b786c;
}
.card-actions {
  display: flex;
  gap: 8px;
  margin-top: 20px;
}
.card-actions > * {
  flex: 1;
}
.card-menu {
  border-top: 1px solid var(--border);
  padding: 0 18px;
}
.card-menu summary {
  min-height: 44px;
  display: flex;
  align-items: center;
  font-size: 12px;
  cursor: pointer;
  color: #5f7466;
}
.card-menu button {
  display: flex;
  width: 100%;
  margin: 0 0 8px;
  justify-content: flex-start;
}
.empty {
  text-align: center;
  padding: 70px 18px;
}
.empty h2 {
  font:
    normal 30px Georgia,
    serif;
}
.empty p {
  color: #6a786e;
}
.header-actions {
  display: flex;
  align-items: center;
  gap: 9px;
}
.header-actions > span {
  font-size: 11px;
  color: #bacfbf;
}
.editor-heading {
  padding: 18px 24px;
  background: #fff;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}
.editor-heading h1 {
  font-size: 26px;
  overflow-wrap: anywhere;
}
.editor-heading p {
  font-size: 11px;
  color: #6c7b70;
  max-width: 38%;
  overflow-wrap: anywhere;
}
.editor-layout {
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr);
  min-height: calc(100dvh - 190px);
}
.editor-sidebar {
  background: #fbfbf7;
  border-right: 1px solid var(--border);
}
.editor-sidebar details {
  border-bottom: 1px solid var(--border);
}
.editor-sidebar summary {
  cursor: pointer;
  min-height: 52px;
  display: flex;
  align-items: center;
  padding: 12px 20px;
  font-size: 14px;
  font-weight: bold;
}
.panel {
  padding: 0 18px 20px;
}
.panel label {
  display: block;
  font-size: 12px;
  margin: 12px 0;
}
.panel input,
.panel select {
  width: 100%;
  min-height: 44px;
  margin-top: 6px;
  padding: 9px;
  border: 1px solid #c4d0c4;
  border-radius: 6px;
  background: #fff;
  color: #21382a;
}
.panel input[type="color"] {
  height: 44px;
  padding: 5px;
}
.panel label.check {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 38px;
  margin: 0;
}
.panel label.check input {
  width: 20px;
  height: 20px;
  min-height: 20px;
  margin: 0;
  accent-color: var(--accent);
}
fieldset {
  border: 1px solid var(--border);
  border-radius: 7px;
  padding: 10px;
  margin: 15px 0;
}
legend {
  font-size: 11px;
  color: #677b68;
}
.help {
  font-size: 11px;
  color: #6b7b6d;
  line-height: 1.6;
}
.row {
  display: flex;
  gap: 7px;
}
.item-list {
  list-style: none;
  padding: 0;
  margin: 14px 0;
}
.item-list li {
  display: flex;
  gap: 5px;
  margin: 6px 0;
}
.item-list button {
  font-size: 12px;
  text-align: left;
  justify-content: flex-start;
  overflow-wrap: anywhere;
  flex: 1;
  min-width: 0;
}
.item-list button.danger {
  flex: 0;
}
.viewer-panel {
  min-width: 0;
  background: #e9e6df;
}
.viewer-panel > p {
  font-size: 11px;
  padding: 8px 16px;
  margin: 0;
  color: #67786b;
}
.viewer-panel iframe {
  display: block;
  border: 0;
  width: 100%;
  height: calc(100dvh - 230px);
  min-height: 520px;
}
#notification {
  margin: 12px 24px;
  padding: 12px 16px;
  border-radius: 7px;
  font-size: 13px;
  background: #dcefe7;
  color: #235941;
}
#notification.error {
  background: #f8e6de;
  color: #8a352c;
}
dialog {
  border: 0;
  border-radius: 12px;
  padding: 26px;
  width: 480px;
  max-width: 92vw;
  background: #fcfbf5;
}
dialog::backdrop {
  background: #15291fb0;
}
dialog h2 {
  font:
    normal 28px Georgia,
    serif;
}
.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 22px;
}
.preview-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 14px 24px;
  background: #14251f;
  color: white;
}
.preview-header h1 {
  font-size: 22px;
  margin: 8px 0 0;
  overflow-wrap: anywhere;
}
.preview-header .badge {
  font-size: 10px;
}
.preview-page > iframe {
  display: block;
  width: 100%;
  height: calc(100dvh - 104px);
  min-height: 520px;
  border: 0;
}
.contents-menu {
  position: absolute;
  right: 20px;
  top: 95px;
  z-index: 10;
  width: 300px;
  max-width: 90vw;
  padding: 18px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 9px;
  box-shadow: 0 12px 30px #14281b30;
}
.contents-menu h2 {
  font:
    normal 25px Georgia,
    serif;
}
[hidden] {
  display: none !important;
}
@media (max-width: 900px) {
  .shell-header {
    padding: 14px 16px;
    flex-wrap: wrap;
  }
  .header-actions {
    gap: 6px;
    flex-wrap: wrap;
  }
  .header-actions > span {
    width: 100%;
  }
  .library {
    padding: 24px 16px;
  }
  .page-heading {
    align-items: flex-start;
    flex-direction: column;
    gap: 12px;
  }
  .page-heading h1 {
    font-size: 35px;
  }
  .editor-heading {
    padding: 16px;
    display: block;
  }
  .editor-heading p {
    max-width: 100%;
    margin: 4px 0;
  }
  .editor-layout {
    display: flex;
    flex-direction: column;
  }
  .viewer-panel {
    order: 0;
  }
  .editor-sidebar {
    order: 1;
    border-right: 0;
  }
  .viewer-panel iframe {
    height: 70dvh;
    min-height: 500px;
  }
  .preview-header {
    padding: 12px 14px;
    flex-wrap: wrap;
  }
  .preview-header > div {
    max-width: 100%;
  }
  .preview-page > iframe {
    height: calc(100dvh - 150px);
  }
  .panel {
    padding: 0 16px 20px;
  }
  .contents-menu {
    top: 130px;
  }
  #notification {
    margin: 10px 16px;
  }
  .magazine-grid {
    gap: 18px;
  }
}
textarea {
  width: 100%;
  max-width: 100%;
  font: 12px/1.5 monospace;
  padding: 9px;
  border: 1px solid var(--border);
  border-radius: 6px;
  resize: vertical;
}
#publicationQR {
  display: block;
  width: 180px;
  max-width: 100%;
  height: auto;
  margin: 14px auto;
}
#shareTools > .button,
#shareTools > button {
  width: 100%;
  margin: 5px 0;
}
.public-reader #readerSubtitle {
  font-size: 12px;
  margin: 6px 0;
  color: #b4c9bb;
}
.public-reader > .preview-header:has(h1:empty) {
  display: none;
}
@media (min-width: 901px) {
  .editor-layout {
    align-items: start;
  }
  .editor-sidebar {
    max-height: calc(100dvh - 190px);
    overflow: auto;
    overscroll-behavior: contain;
  }
  .viewer-panel {
    position: sticky;
    top: 0;
  }
}
.preview-session { display:flex; gap:12px; align-items:center; justify-content:space-between; padding:6px 14px; background:#152a21; color:white; }
.preview-session .button { padding:5px 10px; min-height:36px; }
.preview-page > iframe { display:block; width:100%; height:calc(100dvh - 50px); min-height:0; border:0; }
.public-reader > iframe { height:100dvh; }
#zoneText { min-height:100px; font:inherit; }
.book-alignments { flex-wrap:wrap; }
.book-alignments button { flex:1; font-size:12px; padding:6px; }
#zoneMetadata,#positionAdvanced { border:1px solid var(--border); border-radius:6px; padding:8px; margin:8px 0; }
#zoneMetadata summary,#positionAdvanced summary { cursor:pointer; font-size:13px; }

/* Editorial tools keep the existing Dashboard structure and form controls. */
.floating-style { position:fixed; right:18px; top:130px; width:350px; max-width:calc(100vw - 20px); max-height:70dvh; overflow:auto; z-index:120; background:#faf9f3; border:1px solid #a8b4a8; border-radius:10px; padding:14px; box-shadow:0 12px 42px #0003; }
.floating-style legend { cursor:move; touch-action:none; padding:6px; background:#243b30; color:white; border-radius:6px; }
.floating-style #zoneText { min-height:100px; }
#zoneList li { display:flex; flex-wrap:wrap; gap:4px; padding:8px 0; align-items:center; border-bottom:1px solid #c7cfc7; }
#zoneList li > button:first-child { flex:1 0 80%; text-align:left; }
#zoneList small { color:#536557; }
.header-actions { flex-wrap:wrap; }
