/* ============================================================
   Workbook - core theme
   LOCATION ON SERVER: /home/frithappens/workbook/css/workbook.css

   Three themes via CSS custom properties. Heather glen is default;
   Deep amethyst and Dusk plum are applied by setting data-theme on
   <html>. Only the variable values change between themes - every
   component reads the variables, so theming is one attribute.
   ============================================================ */

:root,
[data-theme="heather-glen"] {
  --wb-ink:        #2F2740;   /* darkest - headings, primary text */
  --wb-primary:    #6B5B8A;   /* mid heather - buttons, headers, accents */
  --wb-primary-2:  #A88FBE;   /* light heather - secondary accents */
  --wb-tint:       #E8E3EF;   /* pale heather - chips, soft fills */
  --wb-paper:      #F7F5F2;   /* warm stone - app background */

  --wb-surface:    #FFFFFF;   /* cards */
  --wb-border:     #E0DBD3;   /* hairlines */
  --wb-text:       #2F2740;
  --wb-text-soft:  #6E675C;
  --wb-text-faint: #8A8276;
  --wb-primary-ink:#4A3D68;   /* readable heather text on tint */
  --wb-focus:      rgba(107, 91, 138, 0.28);
}

[data-theme="deep-amethyst"] {
  --wb-ink:        #2B1B45;
  --wb-primary:    #5B3E8C;
  --wb-primary-2:  #9B7FD4;
  --wb-tint:       #EDE7F6;
  --wb-paper:      #F5F4F7;

  --wb-surface:    #FFFFFF;
  --wb-border:     #DFDCE8;
  --wb-text:       #2B1B45;
  --wb-text-soft:  #63606E;
  --wb-text-faint: #86828F;
  --wb-primary-ink:#3D2A63;
  --wb-focus:      rgba(91, 62, 140, 0.28);
}

[data-theme="dusk-plum"] {
  --wb-ink:        #3A2740;
  --wb-primary:    #6E4F73;
  --wb-primary-2:  #B08FB0;
  --wb-tint:       #F0E8F0;
  --wb-paper:      #FAF7F5;

  --wb-surface:    #FFFFFF;
  --wb-border:     #E6DEDE;
  --wb-text:       #3A2740;
  --wb-text-soft:  #6B6062;
  --wb-text-faint: #8C8286;
  --wb-primary-ink:#4A3350;
  --wb-focus:      rgba(110, 79, 115, 0.28);
}

* { box-sizing: border-box; }

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

body {
  background: var(--wb-paper);
  color: var(--wb-text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  line-height: 1.5;
}

/* --- App header bar --- */
.wb-header {
  background: var(--wb-primary);
  color: #FFFFFF;
  padding: 14px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.wb-header h1 {
  font-size: 18px;
  font-weight: 500;
  letter-spacing: 0.3px;
  margin: 0;
}

/* --- Buttons --- */
.wb-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-size: 15px;
  font-weight: 500;
  padding: 12px 20px;
  border-radius: 8px;
  border: none;
  cursor: pointer;
  text-decoration: none;
  font-family: inherit;
}
.wb-btn-primary {
  background: var(--wb-primary);
  color: #FFFFFF;
}
.wb-btn-primary:active { filter: brightness(0.95); }
.wb-btn-block { width: 100%; }

/* --- Form fields --- */
.wb-field { margin-bottom: 14px; }
.wb-label {
  display: block;
  font-size: 13px;
  color: var(--wb-text-soft);
  margin-bottom: 6px;
}
.wb-input {
  width: 100%;
  font-size: 16px;              /* >=16px so iOS does not zoom on focus */
  padding: 12px 14px;
  border: 1px solid var(--wb-border);
  border-radius: 10px;
  background: var(--wb-surface);
  color: var(--wb-text);
  font-family: inherit;
}
.wb-input:focus {
  outline: none;
  border-color: var(--wb-primary);
  box-shadow: 0 0 0 3px var(--wb-focus);
}

/* --- Message strip --- */
.wb-msg {
  border-radius: 10px;
  padding: 11px 14px;
  font-size: 14px;
  margin-bottom: 14px;
}
.wb-msg-error {
  background: #FBEAF0;
  color: #993556;
  border: 1px solid #F3D4DF;
}

/* --- Auth screen layout --- */
.wb-auth-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.wb-auth-card {
  width: 100%;
  max-width: 380px;
  background: var(--wb-surface);
  border: 1px solid var(--wb-border);
  border-radius: 16px;
  padding: 28px 24px;
}
.wb-auth-brand {
  text-align: center;
  margin-bottom: 4px;
  font-size: 22px;
  font-weight: 600;
  color: var(--wb-ink);
  letter-spacing: 0.3px;
}
.wb-auth-sub {
  text-align: center;
  font-size: 13px;
  color: var(--wb-text-faint);
  margin: 0 0 22px;
}

.wb-foot {
  text-align: center;
  font-size: 12px;
  color: var(--wb-text-faint);
  padding: 18px;
}

/* ============================================================
   Home screen
   ============================================================ */

.wb-app-main {
  max-width: 860px;
  margin: 0 auto;
  padding: 20px 20px 40px;
}

/* Section cards - three across, stacking on narrow screens */
.wb-sections {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 26px;
}
@media (max-width: 560px) {
  .wb-sections { grid-template-columns: 1fr; }
}

.wb-section-card {
  display: block;
  text-decoration: none;
  background: var(--wb-surface);
  border: 1px solid var(--wb-border);
  border-radius: 12px;
  padding: 16px;
  color: inherit;
}
.wb-section-card:active { filter: brightness(0.985); }

.wb-section-icon {
  width: 38px;
  height: 38px;
  border-radius: 9px;
  background: var(--wb-tint);
  color: var(--wb-primary-ink);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 12px;
  font-size: 20px;
}
.wb-section-name {
  font-size: 15px;
  font-weight: 500;
  color: var(--wb-ink);
  margin: 0 0 3px;
}
.wb-section-desc {
  font-size: 12px;
  color: var(--wb-text-soft);
  margin: 0 0 12px;
  line-height: 1.5;
}
.wb-section-count {
  font-size: 22px;
  font-weight: 500;
  color: var(--wb-primary);
  margin: 0;
}
.wb-section-unit {
  font-size: 11px;
  color: var(--wb-text-faint);
  margin: 2px 0 0;
}

/* Recent list */
.wb-recent-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 10px;
}
.wb-recent-title {
  font-size: 13px;
  font-weight: 500;
  color: var(--wb-ink);
}
.wb-recent-list {
  background: var(--wb-surface);
  border: 1px solid var(--wb-border);
  border-radius: 12px;
  overflow: hidden;
}
.wb-recent-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--wb-tint);
  text-decoration: none;
  color: inherit;
}
.wb-recent-row:last-child { border-bottom: none; }
.wb-recent-row .ti { font-size: 17px; color: var(--wb-primary-2); }
.wb-recent-main { flex: 1; min-width: 0; }
.wb-recent-name {
  font-size: 13px;
  font-weight: 500;
  color: var(--wb-ink);
  margin: 0 0 2px;
}
.wb-recent-sub {
  font-size: 11px;
  color: var(--wb-text-faint);
  margin: 0;
}
.wb-recent-when {
  font-size: 11px;
  color: var(--wb-text-faint);
  white-space: nowrap;
}

.wb-empty {
  padding: 28px 16px;
  text-align: center;
  font-size: 13px;
  color: var(--wb-text-faint);
  line-height: 1.6;
}

.wb-header-actions {
  display: flex;
  gap: 16px;
  align-items: center;
}
.wb-header-actions a {
  color: var(--wb-tint);
  text-decoration: none;
  font-size: 14px;
  display: inline-flex;
  align-items: center;
}
.wb-header-actions .ti { font-size: 19px; }

/* ============================================================
   Section list pages (notebooks, entries, etc)
   ============================================================ */

.wb-subhead {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}
.wb-back {
  font-size: 13px;
  color: var(--wb-primary);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.wb-btn-sm {
  font-size: 13px;
  padding: 7px 14px;
  border-radius: 6px;
}
.wb-btn-sm .ti { font-size: 14px; }

/* Notebook list - each card is its own self-contained unit with a gap
   between, so an opened edit panel is clearly part of that one card. */
.wb-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.wb-nb-row {
  display: flex;
  align-items: stretch;
  text-decoration: none;
  color: inherit;
  cursor: pointer;
}
.wb-nb-card:not(.is-open) .wb-nb-row:active { background: var(--wb-tint); }
.wb-nb-spine { display: none; }  /* replaced by the card's full-height ::before */
.wb-nb-body {
  flex: 1;
  min-width: 0;
  padding: 13px 16px 13px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
}
.wb-nb-main { flex: 1; min-width: 0; }
.wb-nb-namerow {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 2px;
}
.wb-nb-name {
  font-size: 14px;
  font-weight: 500;
  color: var(--wb-ink);
  margin: 0;
}
.wb-badge {
  font-size: 10px;
  color: var(--wb-primary-ink);
  background: var(--wb-tint);
  padding: 2px 7px;
  border-radius: 20px;
  white-space: nowrap;
}
.wb-nb-desc {
  font-size: 12px;
  color: var(--wb-text-soft);
  margin: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.wb-nb-count {
  font-size: 12px;
  color: var(--wb-text-faint);
  white-space: nowrap;
}
.wb-nb-when {
  font-size: 12px;
  color: var(--wb-text-faint);
  white-space: nowrap;
  width: 84px;
  text-align: right;
}
.wb-nb-chev { font-size: 16px; color: var(--wb-border); }

/* Modal (create notebook) */
.wb-modal-back {
  position: fixed; inset: 0;
  background: rgba(47,39,64,0.4);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
  z-index: 50;
}
.wb-modal-back.open { display: flex; }
.wb-modal {
  width: 100%;
  max-width: 420px;
  background: var(--wb-surface);
  border-radius: 16px;
  padding: 22px;
}
.wb-modal h2 {
  font-size: 17px;
  color: var(--wb-ink);
  margin: 0 0 16px;
}
.wb-modal-actions {
  display: flex;
  gap: 10px;
  margin-top: 18px;
}
.wb-btn-ghost {
  background: transparent;
  border: 1px solid var(--wb-border);
  color: var(--wb-text-soft);
}
.wb-swatches {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.wb-swatch {
  width: 30px; height: 30px;
  border-radius: 8px;
  cursor: pointer;
  border: 2px solid transparent;
}
.wb-swatch.sel { border-color: var(--wb-ink); }

/* ============================================================
   Notebook flip-open card (edit in place)
   ============================================================ */

/* Each notebook is a self-contained rounded card. The spine runs the
   FULL height of the card down its left edge (as a background layer),
   so it meets the rounded corners cleanly with no gap. The row and the
   open edit panel both sit inside, padded left past the spine. */
.wb-nb-card {
  position: relative;
  background: var(--wb-surface);
  border: 1px solid var(--wb-border);
  border-left: 6px solid var(--wb-nb-spine, var(--wb-primary));
  border-radius: 12px;
  overflow: hidden;
}
.wb-nb-card.is-open { border-color: var(--wb-primary); border-left-color: var(--wb-primary); }
.wb-nb-card.is-open .wb-nb-row { border-bottom: 1px solid var(--wb-tint); }

/* pencil edit button on the row */
.wb-nb-edit {
  flex: 0 0 auto;
  border: none;
  background: transparent;
  color: var(--wb-text-faint);
  cursor: pointer;
  padding: 6px;
  border-radius: 8px;
  display: inline-flex;
  line-height: 0;
}
.wb-nb-edit:hover { color: var(--wb-primary); background: var(--wb-tint); }
.wb-nb-edit .ti { font-size: 17px; }

/* the edit panel, hidden until open. Indented on the left so it lines up
   with the row content past the spine, not under it. */
.wb-nb-back {
  display: none;
  padding: 16px;
  background: var(--wb-surface);
}
.wb-nb-card.is-open .wb-nb-back {
  display: block;
  animation: wb-slide 0.24s ease;
}
@keyframes wb-slide {
  from { opacity: 0; transform: translateY(-6px); }
  to   { opacity: 1; transform: none; }
}

.wb-nb-back .wb-field { margin-bottom: 12px; }
.wb-nb-back-actions {
  display: flex;
  gap: 10px;
  margin-top: 6px;
  align-items: center;
}
.wb-btn-danger {
  background: transparent;
  border: 1px solid #E4B8C6;
  color: #993556;
}
.wb-btn-danger:hover { background: #FBEAF0; }
.wb-btn-danger:disabled { opacity: 0.4; cursor: not-allowed; }
.wb-nb-back-spacer { flex: 1; }

.wb-swatch-sm { width: 26px; height: 26px; }

.wb-inline-msg {
  font-size: 12px;
  color: #993556;
  margin: 8px 0 0;
  display: none;
}
.wb-inline-msg.show { display: block; }

/* Home (house) link in header */
.wb-home-link {
  display: inline-flex !important;
  align-items: center;
}
.wb-home-link .ti { font-size: 22px !important; }

/* ============================================================
   Settings
   ============================================================ */
.wb-settings-group-label {
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--wb-text-faint);
  margin: 18px 0 8px;
}
.wb-settings-group-label:first-of-type { margin-top: 0; }
.wb-settings-card {
  background: var(--wb-surface);
  border: 1px solid var(--wb-border);
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 4px;
}
.wb-settings-row-label {
  font-size: 13px;
  color: var(--wb-text);
  margin: 0 0 12px;
}
.wb-theme-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}
.wb-theme-opt {
  border: 2px solid var(--wb-border);
  border-radius: 10px;
  background: var(--wb-surface);
  padding: 10px;
  cursor: pointer;
  text-align: center;
  font-family: inherit;
}
.wb-theme-opt.sel { border-color: var(--wb-primary); }
.wb-theme-swatches {
  display: flex;
  gap: 3px;
  justify-content: center;
  margin-bottom: 7px;
}
.wb-theme-sw { width: 15px; height: 15px; border-radius: 3px; }
.wb-theme-name { font-size: 11px; color: var(--wb-text-soft); }

/* ============================================================
   Entries list (inside a notebook)
   ============================================================ */

.wb-entry-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  background: var(--wb-surface);
  border: 1px solid var(--wb-border);
  border-radius: 10px;
  text-decoration: none;
  color: inherit;
}
.wb-entry-row:active { background: var(--wb-tint); }

.wb-entry-thumb {
  flex: 0 0 56px;
  width: 56px;
  height: 56px;
  border-radius: 8px;
  background: var(--wb-tint);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--wb-primary-2);
  overflow: hidden;
}
.wb-entry-thumb .ti { font-size: 24px; }
.wb-entry-thumb img { width: 100%; height: 100%; object-fit: cover; }

.wb-entry-body { flex: 1; min-width: 0; }

.wb-entry-toprow {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 2px;
}
.wb-entry-title {
  flex: 1;
  min-width: 0;
  font-size: 14px;
  font-weight: 500;
  color: var(--wb-ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.wb-entry-date {
  font-size: 12px;
  color: var(--wb-text-faint);
  white-space: nowrap;
}
.wb-entry-sub {
  display: block;
  font-size: 12px;
  color: var(--wb-text-soft);
  margin-bottom: 6px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.wb-entry-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}
.wb-chip {
  font-size: 11px;
  line-height: 1;
  padding: 4px 8px;
  border-radius: 20px;
  background: var(--wb-tint);
  color: var(--wb-primary-ink);
  white-space: nowrap;
}
.wb-chip-more {
  background: transparent;
  color: var(--wb-text-faint);
  padding-left: 2px;
}
.wb-chip-problem {
  background: #FBEAF0;
  color: #993556;
}

.wb-entry-chev {
  flex: 0 0 auto;
  font-size: 18px;
  color: var(--wb-border);
}

/* Explicit "open" chevron on notebook cards */
.wb-nb-open {
  font-size: 18px;
  color: var(--wb-primary-2);
  flex: 0 0 auto;
  margin-left: 2px;
}

/* Empty-state call to action (entries page) */
.wb-empty-cta {
  background: var(--wb-surface);
  border: 1px solid var(--wb-border);
  border-radius: 12px;
  padding: 32px 20px;
  text-align: center;
}
.wb-empty-cta > .ti {
  font-size: 34px;
  color: var(--wb-primary-2);
}
.wb-empty-cta-title {
  margin: 12px 0 2px;
  font-size: 15px;
  font-weight: 600;
  color: var(--wb-ink);
}
.wb-empty-cta-sub {
  margin: 0 0 18px;
  font-size: 13px;
  color: var(--wb-text-soft);
}

/* ============================================================
   Entry detail
   ============================================================ */

/* At-a-glance facts */
.wb-facts {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin-bottom: 12px;
}
@media (min-width: 620px) {
  .wb-facts { grid-template-columns: repeat(4, 1fr); }
}
.wb-fact {
  background: var(--wb-tint);
  border-radius: 10px;
  padding: 10px 12px;
}
.wb-fact-label { font-size: 11px; color: var(--wb-text-soft); margin-bottom: 3px; }
.wb-fact-value { font-size: 15px; font-weight: 600; color: var(--wb-ink); }

.wb-process {
  font-size: 13px;
  color: var(--wb-text-soft);
  margin: 0 2px 16px;
}

/* Pieces */
.wb-pieces { display: flex; flex-direction: column; gap: 14px; margin-bottom: 22px; }

.wb-piece-card {
  background: var(--wb-surface);
  border: 1px solid var(--wb-border);
  border-radius: 12px;
  padding: 14px;
}
.wb-piece-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}
.wb-piece-num {
  flex: 0 0 auto;
  width: 26px; height: 26px;
  border-radius: 50%;
  background: var(--wb-tint);
  color: var(--wb-primary-ink);
  font-size: 13px; font-weight: 600;
  display: flex; align-items: center; justify-content: center;
}
.wb-piece-title { flex: 1; min-width: 0; font-size: 15px; font-weight: 600; color: var(--wb-ink); }
.wb-piece-actions { flex: 0 0 auto; }

.wb-icon-btn {
  border: none; background: transparent; cursor: pointer;
  color: var(--wb-primary); padding: 6px; border-radius: 8px;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 18px;
}
.wb-icon-btn:active { background: var(--wb-tint); }

.wb-piece-body { display: flex; gap: 16px; flex-wrap: wrap; }
.wb-layup { flex: 1 1 220px; min-width: 200px; }
.wb-layup-label { font-size: 12px; color: var(--wb-text-soft); margin-bottom: 8px; }
.wb-layup-row {
  border-left: 2px solid var(--wb-tint);
  padding: 2px 0 8px 12px;
  margin-bottom: 4px;
}
.wb-layup-main { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.wb-layup-name { font-size: 14px; color: var(--wb-ink); }
.wb-layup-meta { font-size: 12px; color: var(--wb-text-soft); margin-top: 2px; }
.wb-layup-empty { font-size: 13px; color: var(--wb-text-faint); }

/* Photo panels (placeholders) */
.wb-photo-pair { display: flex; gap: 10px; }
.wb-photo {
  width: 116px; height: 116px;
  border-radius: 10px;
  background: var(--wb-tint);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 4px;
  color: var(--wb-primary-2);
}
.wb-photo .ti { font-size: 22px; }
.wb-photo span { font-size: 11px; color: var(--wb-text-soft); }

/* Observation */
.wb-obs {
  margin-top: 12px;
  background: var(--wb-paper);
  border-radius: 10px;
  padding: 10px 12px;
}
.wb-obs-label { font-size: 11px; color: var(--wb-text-soft); margin-bottom: 3px; }
.wb-obs-body { font-size: 14px; color: var(--wb-ink); }

/* Tags */
.wb-tags {
  border-top: 1px solid var(--wb-border);
  padding-top: 16px;
  margin-top: 4px;
}
.wb-tags-head {
  display: flex; align-items: center; gap: 6px;
  font-size: 13px; color: var(--wb-text-soft); margin-bottom: 10px;
}
.wb-tags-list { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.wb-tag {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--wb-tint);
  color: var(--wb-primary-ink);
  border-radius: 20px;
  padding: 5px 6px 5px 12px;
  font-size: 13px;
}
.wb-tag-x {
  border: none; background: transparent; cursor: pointer;
  color: var(--wb-primary-ink); opacity: 0.6;
  font-size: 16px; line-height: 1; padding: 0 4px;
}
.wb-tag-x:hover { opacity: 1; }
.wb-tag-add {
  display: inline-flex; align-items: center; gap: 4px;
  border: 1px dashed var(--wb-primary-2);
  background: transparent; color: var(--wb-primary);
  border-radius: 20px; padding: 5px 12px; font-size: 13px; cursor: pointer;
}
.wb-tag-add:active { background: var(--wb-tint); }
.wb-tag-input { width: 140px; padding: 6px 10px; }

/* Autocomplete dropdown */
.wb-ac-wrap { position: relative; display: inline-block; }
.wb-le-code-wrap { position: relative; flex: 1 1 auto; }
.wb-ac {
  position: absolute;
  top: 100%; left: 0;
  min-width: 200px; max-width: 320px;
  background: var(--wb-surface);
  border: 1px solid var(--wb-border);
  border-radius: 8px;
  box-shadow: 0 6px 20px rgba(47, 39, 64, 0.14);
  z-index: 40;
  max-height: 240px; overflow-y: auto;
  margin-top: 4px;
}
.wb-ac-item { padding: 8px 12px; font-size: 13px; cursor: pointer; color: var(--wb-ink); }
.wb-ac-item:hover { background: var(--wb-tint); }
.wb-ac-item strong { color: var(--wb-primary-ink); }

/* Wide modal + layup editor */
.wb-modal-wide { max-width: 560px; }
.wb-optional { color: var(--wb-text-faint); font-weight: 400; }
.wb-hint { font-size: 12px; color: var(--wb-text-faint); margin-top: 4px; }

.wb-le-rows { display: flex; flex-direction: column; gap: 10px; margin-bottom: 10px; }
.wb-le-row {
  display: flex; gap: 8px; align-items: flex-start;
  background: var(--wb-paper);
  border-radius: 10px;
  padding: 10px;
}
.wb-le-code { width: 100%; }
.wb-le-name { font-size: 12px; color: var(--wb-text-soft); margin-top: 4px; min-height: 14px; }
.wb-le-meta { flex: 1 1 auto; display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.wb-le-meta .wb-le-qty { grid-column: span 2; }
@media (min-width: 520px) {
  .wb-le-meta { grid-template-columns: 1.4fr 1fr 0.7fr; }
  .wb-le-meta .wb-le-qty { grid-column: auto; }
}
.wb-le-remove { flex: 0 0 auto; color: var(--wb-text-faint); }
.wb-le-remove:active { background: var(--wb-tint); }

.wb-check {
  display: flex; align-items: center; gap: 8px;
  font-size: 14px; color: var(--wb-ink);
  margin: 4px 0 4px;
}
.wb-check input { width: 18px; height: 18px; }

.wb-modal-actions-spread { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.wb-modal-actions-right { display: flex; gap: 10px; }

/* ============================================================
   Entry canvas (freeform ink)
   ============================================================ */
.wb-canvas-body { height: 100dvh; overflow: hidden; background: var(--wb-paper); }
.wb-canvas-page { display: flex; flex-direction: column; height: 100dvh; }

/* Toolbar */
.wb-cv-bar {
  background: var(--wb-primary); color: #FFFFFF;
  display: flex; align-items: center; gap: 8px;
  padding: 8px 10px; padding-top: calc(8px + env(safe-area-inset-top));
  flex: 0 0 auto;
}
.wb-cv-back {
  color: #E8E3EF; font-size: 22px; text-decoration: none;
  width: 32px; height: 32px; display: flex; align-items: center; justify-content: center;
  flex: 0 0 auto;
}
.wb-cv-title {
  flex: 1 1 auto; min-width: 0; text-align: left;
  background: transparent; border: none; color: #FFFFFF;
  font-size: 15px; font-weight: 500; padding: 4px 6px; border-radius: 8px;
  overflow: hidden; white-space: nowrap; text-overflow: ellipsis; cursor: pointer;
}
.wb-cv-title:active { background: rgba(255,255,255,0.12); }
.wb-cv-tools { display: flex; align-items: center; gap: 5px; flex: 0 0 auto; }
.wb-cv-colors { display: flex; gap: 5px; margin-right: 4px; }
.wb-cv-color {
  width: 20px; height: 20px; border-radius: 50%;
  background: var(--c); border: 2px solid rgba(255,255,255,0.45);
  padding: 0; cursor: pointer;
}
.wb-cv-color.is-active { border-color: #FFFFFF; box-shadow: 0 0 0 2px rgba(255,255,255,0.35); }
.wb-cv-tool {
  color: #E8E3EF; background: transparent; border: none;
  width: 34px; height: 34px; border-radius: 8px; cursor: pointer;
  display: flex; align-items: center; justify-content: center; font-size: 19px; text-decoration: none;
}
.wb-cv-tool.is-on { background: #54467A; color: #FFFFFF; }
.wb-cv-tool:active { background: rgba(255,255,255,0.14); }

/* Glass strip */
.wb-cv-glass {
  background: var(--wb-surface); border-bottom: 1px solid var(--wb-border);
  display: flex; align-items: center; gap: 8px; padding: 8px 12px;
  position: relative; flex: 0 0 auto; flex-wrap: wrap;
}
.wb-cv-glass-ico { color: var(--wb-primary-2); font-size: 15px; }
.wb-cv-glass-label { font-size: 11px; color: var(--wb-text-soft); margin-right: 2px; }
.wb-cv-chips { display: flex; gap: 6px; flex-wrap: wrap; }
.wb-cv-chip {
  display: inline-flex; align-items: center;
  background: var(--wb-tint); color: var(--wb-primary-ink);
  border-radius: 20px; padding: 3px 4px 3px 10px; font-size: 12px;
}
.wb-cv-chip-code { line-height: 1.4; }
.wb-cv-chip-x {
  border: none; background: transparent; color: var(--wb-primary-ink);
  opacity: 0.5; font-size: 15px; line-height: 1; padding: 0 4px; cursor: pointer;
}
.wb-cv-chip-x:hover { opacity: 1; }
.wb-cv-chip-add {
  border: 1px dashed var(--wb-primary-2); background: transparent; color: var(--wb-primary);
  min-width: 28px; height: 24px; border-radius: 20px; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; font-size: 13px;
}
.wb-cv-glass-hint { margin-left: auto; font-size: 10px; color: var(--wb-text-faint); }
.wb-cv-glass-input { position: relative; }
.wb-cv-glass-input .wb-input { width: 150px; padding: 6px 10px; }

/* Canvas stage */
.wb-cv-stage {
  flex: 1 1 auto; position: relative; overflow: hidden;
  background: var(--wb-paper); touch-action: none; overscroll-behavior: none;
}
.wb-cv-canvas { display: block; touch-action: none; }
.wb-cv-saved {
  position: absolute; top: 10px; right: 12px;
  background: rgba(47,39,64,0.72); color: #FFFFFF;
  font-size: 11px; padding: 4px 10px; border-radius: 20px; pointer-events: none;
}

/* Pages footer */
.wb-cv-foot {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 12px; padding-bottom: calc(8px + env(safe-area-inset-bottom));
  background: var(--wb-surface); border-top: 1px solid var(--wb-border); flex: 0 0 auto;
}
.wb-cv-pagenav {
  border: none; background: transparent; color: var(--wb-primary);
  font-size: 18px; width: 30px; height: 30px; border-radius: 8px; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}
.wb-cv-pagenav:disabled { opacity: 0.3; cursor: default; }
.wb-cv-pagelabel { font-size: 12px; color: var(--wb-text-soft); white-space: nowrap; }
.wb-cv-dots { display: flex; gap: 6px; align-items: center; }
.wb-cv-dot { width: 8px; height: 8px; border-radius: 50%; background: #D3D1C7; border: none; padding: 0; cursor: pointer; }
.wb-cv-dot.is-active { background: var(--wb-primary); }
.wb-cv-addpage {
  margin-left: auto; border: none; background: transparent; color: var(--wb-primary);
  font-size: 12px; cursor: pointer; display: inline-flex; align-items: center; gap: 4px; white-space: nowrap;
}

/* ---- Canvas toolbar clarity + plain-language strip (v1.0.17) ---- */
.wb-cv-tools { flex-wrap: wrap; justify-content: flex-end; gap: 6px; }
.wb-cv-colors { padding-right: 8px; margin-right: 2px; border-right: 1px solid rgba(255,255,255,0.25); }
.wb-cv-colors.is-dim { opacity: 0.4; }

.wb-cv-labeled { width: auto; padding: 0 11px; gap: 6px; height: 34px; }
.wb-cv-labeled span { font-size: 12.5px; font-weight: 500; }
.wb-cv-tool.is-on { background: #FFFFFF; color: var(--wb-primary); }
.wb-cv-tool.is-on:active { background: #FFFFFF; }

/* Glass codes strip - plain wording, input hidden until "Add code" */
.wb-cv-code-add {
  display: inline-flex; align-items: center; gap: 5px;
  border: 1px dashed var(--wb-primary-2); background: transparent; color: var(--wb-primary);
  border-radius: 20px; padding: 5px 12px; font-size: 12.5px; cursor: pointer;
}
.wb-cv-code-add:active { background: var(--wb-tint); }
.wb-cv-code-input { position: relative; display: inline-block; }
.wb-cv-code-input .wb-input { width: 180px; padding: 7px 11px; }
.wb-cv-code-input .wb-ac { left: 0; top: 100%; }

/* Safety: an author display rule must not defeat hidden */
[hidden] { display: none !important; }

/* ---- Photo selection bar on the canvas (v1.0.18) ---- */
.wb-cv-photobar {
  position: absolute; left: 50%; transform: translateX(-50%); bottom: 16px;
  display: flex; gap: 8px; z-index: 5;
  background: rgba(47,39,64,0.94); border-radius: 12px; padding: 8px;
  box-shadow: 0 6px 20px rgba(47,39,64,0.28);
}
.wb-cv-photobar button {
  border: none; background: rgba(255,255,255,0.15); color: #FFFFFF;
  font-size: 12.5px; padding: 9px 13px; border-radius: 8px; cursor: pointer;
  display: inline-flex; align-items: center; gap: 5px;
}
.wb-cv-photobar button:active { background: rgba(255,255,255,0.28); }
.wb-cv-photobar button.danger { background: rgba(198,64,84,0.9); }
