/* ============================================================
   Corporate Content Platform — shared stylesheet
   Palette: warm terracotta / cream (client brand)
   Density: dense utilitarian (13–14px body)
   Fonts:  Inter (Latin) + Noto Sans Devanagari (Nepali)
   ============================================================ */

/* ---------- Tokens (light) ---------- */
:root {
  /* brand */
  --primary:        #C4652A;
  --primary-light:  #E8956A;
  --primary-dark:   #8B3E10;
  --accent:         #D4814E;

  /* surfaces */
  --bg:             #FDF6F0;  /* page background, cream */
  --surface:        #FFFFFF;  /* cards, inputs */
  --surface-warm:   #F5EBE0;  /* warm beige panels */
  --surface-sunk:   #F0E4D4;  /* table stripes, empty states */

  /* text */
  --text:           #1A1A1A;
  --text-muted:     #6B6B6B;
  --text-subtle:    #8F8A84;
  --text-on-primary:#FFFFFF;

  /* borders / dividers */
  --border:         #E6D9C9;
  --border-strong:  #D4C3AE;
  --divider:        #EDE1D1;

  /* semantic */
  --error:          #D32F2F;
  --error-bg:       #FCE8E6;
  --warning:        #C98A1A;
  --warning-bg:     #FBF0D6;
  --success:        #2E7D32;
  --success-bg:     #E6F2E7;
  --info:           #1565C0;
  --info-bg:        #E4EEF8;

  /* elevation */
  --shadow-1: 0 1px 0 rgba(69, 42, 18, .04), 0 1px 2px rgba(69, 42, 18, .06);
  --shadow-2: 0 2px 4px rgba(69, 42, 18, .06), 0 4px 10px rgba(69, 42, 18, .08);
  --shadow-pop: 0 8px 28px rgba(69, 42, 18, .18);

  /* radius */
  --r-sm: 3px;
  --r-md: 5px;
  --r-lg: 8px;

  /* spacing */
  --sp-1: 4px;
  --sp-2: 8px;
  --sp-3: 12px;
  --sp-4: 16px;
  --sp-5: 20px;
  --sp-6: 24px;
  --sp-8: 32px;

  /* layout */
  --topbar-h: 52px;
  --sidebar-w: 220px;
  --sidebar-w-collapsed: 56px;
  --content-max: 960px;
}

/* ---------- Tokens (dark) ---------- */
html[data-theme="dark"] {
  --primary:        #E8956A;
  --primary-light:  #F2AE8B;
  --primary-dark:   #C4652A;
  --accent:         #D4814E;

  --bg:             #1A1511;
  --surface:        #231D18;
  --surface-warm:   #2A2420;
  --surface-sunk:   #322923;

  --text:           #F2EAE0;
  --text-muted:     #B6A896;
  --text-subtle:    #857A6E;
  --text-on-primary:#1A1511;

  --border:         #3A3129;
  --border-strong:  #4A3E33;
  --divider:        #2F2721;

  --error:          #EF6B6B;
  --error-bg:       #3A1F1F;
  --warning:        #E0A94F;
  --warning-bg:     #3A2D16;
  --success:        #71B87A;
  --success-bg:     #1E2F21;
  --info:           #6CA6E4;
  --info-bg:        #1C2A3A;

  --shadow-1: 0 1px 0 rgba(0,0,0,.25), 0 1px 2px rgba(0,0,0,.35);
  --shadow-2: 0 2px 4px rgba(0,0,0,.3), 0 4px 10px rgba(0,0,0,.45);
  --shadow-pop: 0 8px 28px rgba(0,0,0,.55);
}

/* ---------- Reset-ish ---------- */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html { color-scheme: light; }
html[data-theme="dark"] { color-scheme: dark; }

body {
  font-family: 'Inter', 'Noto Sans JP', 'Noto Sans Devanagari', -apple-system, BlinkMacSystemFont,
               'Segoe UI', sans-serif;
  font-size: 13.5px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  font-feature-settings: "cv11", "ss01";
}

/* Nepali blocks get Devanagari-first stack + slightly adjusted line-height */
:lang(ne), .ne {
  font-family: 'Noto Sans Devanagari', 'Inter', sans-serif;
  line-height: 1.65;
  font-feature-settings: normal;
}

a { color: var(--primary-dark); text-decoration: none; }
html[data-theme="dark"] a { color: var(--primary-light); }
a:hover { text-decoration: underline; }

h1, h2, h3, h4, h5 { margin: 0; font-weight: 600; letter-spacing: -0.01em; color: var(--text); }
h1 { font-size: 22px; line-height: 1.3; }
h2 { font-size: 17px; line-height: 1.35; }
h3 { font-size: 14.5px; line-height: 1.4; }
h4 { font-size: 13px; line-height: 1.4; text-transform: uppercase; letter-spacing: .06em; color: var(--text-muted); font-weight: 600;}

p { margin: 0 0 var(--sp-3); }
small { font-size: 11.5px; color: var(--text-muted); }
hr  { border: 0; border-top: 1px solid var(--divider); margin: var(--sp-4) 0; }

code, kbd, .mono {
  font-family: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px;
}

/* ---------- App shell ---------- */
.app {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  grid-template-rows: var(--topbar-h) 1fr;
  grid-template-areas:
    "topbar  topbar"
    "sidebar main";
  min-height: 100vh;
}
.sidebar { transition: width .18s ease; }
html[data-sidebar="collapsed"] .app { grid-template-columns: var(--sidebar-w-collapsed) 1fr; }

/* TOP BAR */
.topbar {
  grid-area: topbar;
  display: flex;
  align-items: center;
  gap: var(--sp-4);
  padding: 0 var(--sp-5);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 40;
}
.topbar .search {
  flex: 1;
  max-width: 520px;
  position: relative;
}
.topbar .search input {
  width: 100%;
  height: 32px;
  padding: 0 10px 0 30px;
  border: 1px solid var(--border);
  background: var(--bg);
  border-radius: var(--r-md);
  font: inherit;
  color: var(--text);
}
.topbar .search .icon {
  position: absolute; left: 9px; top: 50%; transform: translateY(-50%);
  color: var(--text-subtle);
}
.topbar .spacer { flex: 1; }
.topbar-actions { display: flex; align-items: center; gap: var(--sp-2); }

/* Brand chip in the topbar — styled like the search box (rounded, subtle bg) */
.brand-chip { display: inline-flex; align-items: center; gap: 8px; padding: 0 12px 0 6px; height: 32px; border: 1px solid var(--border); background: var(--bg); border-radius: var(--r-md); cursor: pointer; color: var(--text); font: inherit; font-size: 12.5px; font-weight: 500; flex: 0 0 auto; max-width: 220px; }
.brand-chip:hover { background: var(--surface-warm); border-color: var(--border-strong); }
.brand-chip-mark { width: 22px; height: 22px; border-radius: 5px; background: linear-gradient(135deg, var(--primary), var(--primary-dark)); color: #fff; display: inline-flex; align-items: center; justify-content: center; flex: 0 0 auto; }
.brand-chip-mark svg { width: 13px; height: 13px; }
.brand-chip-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.topbar .icon-btn {
  position: relative;
  width: 32px; height: 32px;
  display: inline-flex; align-items: center; justify-content: center;
  background: transparent; border: 1px solid transparent; color: var(--text-muted);
  border-radius: var(--r-md); cursor: pointer;
}
.topbar .icon-btn:hover { background: var(--surface-warm); color: var(--text); }
.topbar .icon-btn .dot {
  position: absolute; top: 6px; right: 7px;
  width: 7px; height: 7px; background: var(--primary); border-radius: 50%;
  box-shadow: 0 0 0 2px var(--surface);
}

.profile-chip {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 3px 8px 3px 3px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--bg);
  cursor: pointer;
  color: var(--text);
}
.profile-chip:hover { background: var(--surface-warm); }
.profile-chip .avatar { width: 24px; height: 24px; border-radius: 50%; }
.profile-chip .name { font-weight: 500; font-size: 12.5px; }
.profile-chip .caret { color: var(--text-subtle); }

/* SIDEBAR */
.sidebar {
  grid-area: sidebar;
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  overflow: hidden;
  position: sticky; top: var(--topbar-h); height: calc(100vh - var(--topbar-h));
}
.sidebar-head {
  display: flex; align-items: center; justify-content: center;
  height: var(--topbar-h);
  padding: 0;
  flex: 0 0 auto;
  border-bottom: 1px solid var(--border);
}
.sidebar .brand .mark {
  width: 22px; height: 22px;
  border-radius: 5px;
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  color: #fff;
  font-weight: 700; font-size: 11px;
  display: flex; align-items: center; justify-content: center;
  letter-spacing: -.02em;
  flex: 0 0 auto;
}
.sidebar .brand .mark svg { width: 14px; height: 14px; }
.sidebar .brand .name { font-weight: 600; font-size: 13.5px; color: var(--text); }
.sidebar .brand .sub  { font-size: 10.5px; color: var(--text-muted); text-transform: uppercase; letter-spacing: .08em; }
.sidebar .brand .stack { display: flex; flex-direction: column; line-height: 1.1; gap: 2px; min-width: 0; }

.nav {
  padding: var(--sp-3) 10px;
  overflow-y: auto;
  flex: 1 1 auto;
}
.nav .group { margin-bottom: var(--sp-4); }
.nav .group-label {
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--text-subtle);
  padding: 0 10px var(--sp-2);
  font-weight: 600;
}
.nav a {
  display: flex; align-items: center; gap: 10px;
  padding: 6px 10px;
  margin-bottom: 2px;
  border-radius: var(--r-md);
  color: var(--text);
  font-size: 13px;
  text-decoration: none;
  white-space: nowrap;
  overflow: hidden;
}
.nav a:hover { background: var(--surface-warm); }
.nav a.active {
  background: color-mix(in srgb, var(--primary) 14%, transparent);
  color: var(--primary-dark);
  font-weight: 600;
}
html[data-theme="dark"] .nav a.active { color: var(--primary-light); }
.nav a .ico { width: 16px; height: 16px; flex: 0 0 16px; color: currentColor; opacity: .85; }
.nav a .badge {
  margin-left: auto; background: var(--surface-sunk); color: var(--text-muted);
  font-size: 10.5px; padding: 1px 6px; border-radius: 999px;
}

/* Sidebar top: hamburger toggle (sits beside the brand in .sidebar-head) */
.sidebar-toggle { width: 28px; height: 28px; border: 0; background: transparent; color: var(--text-muted); cursor: pointer; display: inline-flex; align-items: center; justify-content: center; padding: 0; border-radius: 4px; flex: 0 0 auto; }
.sidebar-toggle:hover { color: var(--text); background: var(--surface-warm); }
.sidebar-toggle svg { width: 16px; height: 16px; }

/* Collapsed sidebar: brand (avatar + name) stays identical; only nav labels hide. */
html[data-sidebar="collapsed"] .nav .group-label,
html[data-sidebar="collapsed"] .nav a span:not(.ico),
html[data-sidebar="collapsed"] .nav a .badge { display: none; }
html[data-sidebar="collapsed"] .nav a { justify-content: center; padding: 8px 0; }

.sidebar-footer {
  padding: var(--sp-3);
  border-top: 1px solid var(--divider);
  font-size: 11.5px;
  color: var(--text-muted);
}

/* MAIN */
.main {
  grid-area: main;
  padding: var(--sp-5) var(--sp-6);
  min-width: 0;
}
.page { max-width: var(--content-max); margin: 0 auto; }
.page-head {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: var(--sp-4);
  margin-bottom: var(--sp-4);
  padding-bottom: var(--sp-3);
  border-bottom: 1px solid var(--divider);
}
.page-head h1 { font-size: 19px; }
.page-head .crumbs { font-size: 12px; color: var(--text-muted); margin-bottom: 4px; }
.page-head .crumbs a { color: var(--text-muted); }

/* ---------- Primitives ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-1);
}
.card + .card { margin-top: var(--sp-3); }
.card .card-head {
  padding: 12px 14px;
  border-bottom: 1px solid var(--divider);
  display: flex; align-items: center; justify-content: space-between;
}
.card .card-body { padding: 14px; }
.card .card-foot { padding: 10px 14px; border-top: 1px solid var(--divider); display: flex; justify-content: flex-end; gap: var(--sp-2); }

.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 12px;
  height: 30px;
  border-radius: var(--r-md);
  font: inherit;
  font-weight: 500;
  font-size: 13px;
  cursor: pointer;
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--text);
  white-space: nowrap;
  user-select: none;
  transition: background .12s, border-color .12s;
}
.btn:hover { background: var(--surface-warm); }
.btn:disabled { opacity: .55; cursor: not-allowed; }

.btn-primary {
  background: var(--primary);
  border-color: var(--primary-dark);
  color: var(--text-on-primary);
}
.btn-primary:hover { background: var(--primary-dark); }

.btn-ghost { border-color: transparent; background: transparent; color: var(--text-muted); }
.btn-ghost:hover { background: var(--surface-warm); color: var(--text); }

.btn-danger { background: transparent; color: var(--error); border-color: color-mix(in srgb, var(--error) 35%, transparent); }
.btn-danger:hover { background: var(--error-bg); }

.btn-sm { height: 26px; padding: 3px 9px; font-size: 12px; }

/* Badges */
.badge {
  display: inline-flex; align-items: center;
  padding: 1px 7px;
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: .03em;
  text-transform: uppercase;
  background: var(--surface-sunk);
  color: var(--text-muted);
  border-radius: 3px;
  border: 1px solid var(--border);
}
.badge.role-owner  { background: color-mix(in srgb, var(--primary) 15%, transparent); color: var(--primary-dark); border-color: color-mix(in srgb, var(--primary) 35%, transparent); }
html[data-theme="dark"] .badge.role-owner { color: var(--primary-light); }
.badge.role-admin  { background: var(--info-bg); color: var(--info); border-color: color-mix(in srgb, var(--info) 35%, transparent); }
.badge.role-member { background: var(--surface-sunk); color: var(--text-muted); }
.badge.status-active  { background: var(--success-bg); color: var(--success); border-color: color-mix(in srgb, var(--success) 30%, transparent); }
.badge.status-invited { background: var(--warning-bg); color: var(--warning); border-color: color-mix(in srgb, var(--warning) 35%, transparent); }
.badge.status-locked  { background: var(--error-bg);   color: var(--error);   border-color: color-mix(in srgb, var(--error) 30%, transparent); }

.chip {
  display: inline-flex; align-items: center; gap: 4px;
  background: color-mix(in srgb, var(--primary) 12%, transparent);
  color: var(--primary-dark);
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11.5px;
  border: 1px solid color-mix(in srgb, var(--primary) 20%, transparent);
}
html[data-theme="dark"] .chip { color: var(--primary-light); }
.chip .x { cursor: pointer; opacity: .6; }
.chip .x:hover { opacity: 1; }

/* Forms */
.field { display: flex; flex-direction: column; gap: 4px; margin-bottom: var(--sp-3); }
.field label { font-size: 12px; font-weight: 500; color: var(--text); }
.field .hint { font-size: 11.5px; color: var(--text-muted); }
.field .err { font-size: 11.5px; color: var(--error); }

.input, select, textarea {
  width: 100%;
  padding: 7px 10px;
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--text);
  border-radius: var(--r-md);
  font: inherit;
  font-size: 13.5px;
  transition: border-color .12s, box-shadow .12s;
}
.input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 22%, transparent);
}
.input.is-error, select.is-error, textarea.is-error {
  border-color: var(--error);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--error) 18%, transparent);
}
textarea { resize: vertical; min-height: 110px; line-height: 1.55; }
select {
  appearance: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6' fill='none'><path d='M1 1l4 4 4-4' stroke='%236B6B6B' stroke-width='1.4' stroke-linecap='round' stroke-linejoin='round'/></svg>");
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-right: 28px;
}

.inline-group { display: flex; gap: var(--sp-2); }
.inline-group > * { flex: 1; }

/* Checkbox / radio / switch */
.checkbox, .radio { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; cursor: pointer; }
.checkbox input, .radio input { accent-color: var(--primary); }
.switch {
  position: relative; display: inline-block; width: 32px; height: 18px;
  background: var(--surface-sunk); border-radius: 999px; transition: background .15s;
  border: 1px solid var(--border-strong);
}
.switch.on { background: var(--primary); border-color: var(--primary-dark); }
.switch::after {
  content: ""; position: absolute; top: 1px; left: 1px;
  width: 14px; height: 14px; border-radius: 50%;
  background: #fff; box-shadow: 0 1px 2px rgba(0,0,0,.2);
  transition: left .15s;
}
.switch.on::after { left: 15px; }

/* Tables */
.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.table thead th {
  text-align: left;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--text-muted);
  padding: 8px 12px;
  background: var(--surface-warm);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0;
}
.table tbody td {
  padding: 9px 12px;
  border-bottom: 1px solid var(--divider);
  vertical-align: middle;
}
.table tbody tr:hover { background: var(--surface-warm); }
.table tbody tr:last-child td { border-bottom: none; }
.table .mono { color: var(--text); }

/* Alerts */
.alert {
  display: flex; gap: 10px; align-items: flex-start;
  padding: 10px 12px;
  border-radius: var(--r-md);
  border: 1px solid;
  font-size: 13px;
}
.alert .ico { flex: 0 0 16px; margin-top: 2px; }
.alert-info     { background: var(--info-bg);    color: var(--info);    border-color: color-mix(in srgb, var(--info) 30%, transparent); }
.alert-warning  { background: var(--warning-bg); color: var(--warning); border-color: color-mix(in srgb, var(--warning) 35%, transparent); }
.alert-critical { background: var(--error-bg);   color: var(--error);   border-color: color-mix(in srgb, var(--error) 30%, transparent); }
.alert-success  { background: var(--success-bg); color: var(--success); border-color: color-mix(in srgb, var(--success) 30%, transparent); }

/* Avatars */
.avatar {
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary-light), var(--primary-dark));
  color: #fff;
  font-weight: 600;
  font-size: 12px;
  flex: 0 0 auto;
  overflow: hidden;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar-24 { width: 24px; height: 24px; font-size: 10.5px; }
.avatar-32 { width: 32px; height: 32px; font-size: 12px; }
.avatar-40 { width: 40px; height: 40px; font-size: 14px; }
.avatar-64 { width: 64px; height: 64px; font-size: 22px; }
.avatar-96 { width: 96px; height: 96px; font-size: 34px; }

/* ---------- Feed: posts ---------- */
.feed { display: flex; flex-direction: column; gap: 10px; }

.post {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 14px 16px;
  box-shadow: var(--shadow-1);
}
.post-head {
  display: flex; align-items: center; gap: 10px;
  margin-bottom: 8px;
}
.post-head .meta { display: flex; flex-direction: column; line-height: 1.25; min-width: 0; }
.post-head .author { font-weight: 600; font-size: 13px; color: var(--text); }
.post-head .sub { color: var(--text-muted); font-size: 11.5px; }
.post-head .sub .dot { margin: 0 6px; color: var(--text-subtle); }
.post-head .actions { margin-left: auto; display: flex; gap: 2px; color: var(--text-subtle); }
.post-head .actions button {
  background: none; border: 0; cursor: pointer; color: inherit;
  width: 26px; height: 26px; border-radius: var(--r-sm);
  display: inline-flex; align-items: center; justify-content: center;
}
.post-head .actions button:hover { background: var(--surface-warm); color: var(--text); }

.post .title {
  font-size: 15.5px;
  font-weight: 600;
  color: var(--text);
  margin: 0 0 4px;
  letter-spacing: -.005em;
}
.post .excerpt { color: var(--text); margin: 0 0 10px; font-size: 13px; }
.post .tags { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 10px; }
.post .cover {
  width: 100%; height: 180px;
  background: var(--surface-warm);
  border-radius: var(--r-md);
  margin-bottom: 10px;
  object-fit: cover;
  display: block;
}

/* Reactions */
.reactions {
  display: flex; align-items: center; gap: 4px;
  padding-top: 8px;
  border-top: 1px solid var(--divider);
}
.reaction-btn {
  display: inline-flex; align-items: center; gap: 5px;
  background: transparent; border: 1px solid transparent;
  padding: 3px 8px; border-radius: 999px;
  color: var(--text-muted); font-size: 12px; cursor: pointer;
  font-family: inherit;
}
.reaction-btn:hover { background: var(--surface-warm); color: var(--text); }
.reaction-btn.active {
  background: color-mix(in srgb, var(--primary) 14%, transparent);
  color: var(--primary-dark);
  border-color: color-mix(in srgb, var(--primary) 30%, transparent);
}
html[data-theme="dark"] .reaction-btn.active { color: var(--primary-light); }
.reaction-btn .em { font-size: 13px; }
.reactions .gap { flex: 1; }
.reactions .mini {
  background: none; border: 0; cursor: pointer;
  width: 26px; height: 26px; border-radius: var(--r-sm);
  color: var(--text-subtle); display: inline-flex; align-items: center; justify-content: center;
}
.reactions .mini:hover { background: var(--surface-warm); color: var(--text); }

/* Pinned announcement */
.announce {
  border-left: 3px solid;
  padding: 10px 12px 10px 14px;
  border-radius: var(--r-md);
  display: grid;
  grid-template-columns: 18px 1fr auto;
  gap: 10px;
  align-items: start;
  font-size: 13px;
  border: 1px solid var(--border);
  background: var(--surface);
}
.announce.sev-info     { border-left-color: var(--info);    background: var(--info-bg); }
.announce.sev-warning  { border-left-color: var(--warning); background: var(--warning-bg); }
.announce.sev-critical { border-left-color: var(--error);   background: var(--error-bg); }
.announce .label { font-weight: 600; }
.announce .meta-r { color: var(--text-muted); font-size: 11.5px; }

/* Pinned strip */
.pinned-strip { display: flex; flex-direction: column; gap: 8px; margin-bottom: 14px; }

/* ---------- Comments ---------- */
.comment {
  display: grid;
  grid-template-columns: 32px 1fr;
  gap: 10px;
  padding: 10px 0;
  border-top: 1px solid var(--divider);
}
.comment:first-child { border-top: 0; }
.comment .body .author { font-weight: 600; font-size: 12.5px; }
.comment .body .time   { font-size: 11px; color: var(--text-muted); margin-left: 6px; }
.comment .body .text   { font-size: 13px; margin: 4px 0 6px; }
.comment .body .links  { font-size: 11.5px; color: var(--text-muted); display: flex; gap: 12px; }
.comment .body .links a { color: var(--text-muted); }
.comment.reply { margin-left: 32px; padding-left: 12px; border-left: 2px solid var(--divider); border-top: 0; }

/* ---------- Dropdown / menu ---------- */
.menu {
  position: absolute;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-pop);
  min-width: 260px;
  padding: 4px;
  z-index: 60;
}
.menu .m-item {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px;
  border-radius: var(--r-sm);
  color: var(--text); font-size: 13px; cursor: pointer;
  text-decoration: none;
}
.menu .m-item:hover { background: var(--surface-warm); }
.menu .m-head {
  font-size: 11px; text-transform: uppercase; letter-spacing: .06em;
  color: var(--text-muted); padding: 8px 10px 4px; font-weight: 600;
}
.menu .m-sep { height: 1px; background: var(--divider); margin: 4px 0; }

/* ---------- Auth layout ---------- */
.auth-page {
  min-height: 100vh;
  display: flex; align-items: center; justify-content: center;
  padding: 40px 20px;
  background:
    radial-gradient(1200px 500px at 50% -200px, color-mix(in srgb, var(--primary) 20%, transparent), transparent 60%),
    var(--bg);
}
.auth-card {
  width: 100%;
  max-width: 380px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-2);
  padding: 28px 28px 20px;
}
.auth-brand {
  display: flex; align-items: center; gap: 10px;
  margin-bottom: 18px;
}
.auth-brand .mark {
  width: 32px; height: 32px; border-radius: 7px;
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  color: #fff; font-weight: 700; font-size: 15px;
  display: flex; align-items: center; justify-content: center;
}
.auth-brand .t1 { font-weight: 600; font-size: 14px; }
.auth-brand .t2 { font-size: 11px; color: var(--text-muted); text-transform: uppercase; letter-spacing: .08em; }
.auth-card h1 { font-size: 17px; margin-bottom: 4px; }
.auth-card .sub { font-size: 12.5px; color: var(--text-muted); margin-bottom: 18px; }
.auth-foot {
  margin-top: 20px;
  padding-top: 14px;
  border-top: 1px solid var(--divider);
  font-size: 11.5px;
  color: var(--text-muted);
  display: flex; align-items: center; justify-content: space-between;
}
.lang-switch { display: inline-flex; gap: 0; border: 1px solid var(--border); border-radius: var(--r-sm); overflow: hidden; }
.lang-switch button {
  background: var(--surface); color: var(--text-muted); border: 0;
  padding: 3px 8px; font-size: 11px; font-family: inherit; cursor: pointer;
}
.lang-switch button.active { background: var(--primary); color: var(--text-on-primary); }
.lang-switch button + button { border-left: 1px solid var(--border); }

/* ---------- Modal / overlay ---------- */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(26, 21, 17, .45);
  backdrop-filter: blur(2px);
  display: flex; align-items: center; justify-content: center;
  z-index: 100;
}
.modal-overlay[hidden] { display: none; }
.modal {
  background: var(--surface);
  border-radius: var(--r-lg);
  width: min(92vw, 460px);
  box-shadow: var(--shadow-pop);
  border: 1px solid var(--border);
  overflow: hidden;
}
.modal .m-head { padding: 14px 16px; border-bottom: 1px solid var(--divider); display: flex; align-items: center; justify-content: space-between; }
.modal .m-head h2 { font-size: 15px; }
.modal .m-body { padding: 16px; }
.modal .m-foot { padding: 12px 16px; border-top: 1px solid var(--divider); display: flex; justify-content: flex-end; gap: 8px; background: var(--surface-warm); }

/* ---------- Tabs ---------- */
.tabs {
  display: flex; gap: 0;
  border-bottom: 1px solid var(--border);
  margin-bottom: var(--sp-4);
}
.tabs a {
  padding: 8px 14px;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--text-muted);
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  text-decoration: none;
}
.tabs a:hover { color: var(--text); }
.tabs a.active {
  color: var(--primary-dark);
  border-bottom-color: var(--primary);
  font-weight: 600;
}
html[data-theme="dark"] .tabs a.active { color: var(--primary-light); }

/* ---------- Utility ---------- */
.muted { color: var(--text-muted); }
.subtle { color: var(--text-subtle); }
.flex { display: flex; }
.row { display: flex; align-items: center; gap: 8px; }
.between { display: flex; align-items: center; justify-content: space-between; }
.grow { flex: 1; }
.right { margin-left: auto; }
.center { text-align: center; }
.mb-0 { margin-bottom: 0; }
.mb-1 { margin-bottom: var(--sp-1); }
.mb-2 { margin-bottom: var(--sp-2); }
.mb-3 { margin-bottom: var(--sp-3); }
.mb-4 { margin-bottom: var(--sp-4); }
.mb-5 { margin-bottom: var(--sp-5); }
.mt-2 { margin-top: var(--sp-2); }
.mt-3 { margin-top: var(--sp-3); }
.mt-4 { margin-top: var(--sp-4); }
.w-full { width: 100%; }
.hidden { display: none !important; }

/* Grid helpers */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: var(--sp-3); }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--sp-3); }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--sp-3); }

/* Cover image grid (collections, galleries) */
.cover-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: 12px;
}
.cover-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  overflow: hidden;
  box-shadow: var(--shadow-1);
}
.cover-card .img {
  aspect-ratio: 16 / 10;
  background: linear-gradient(135deg, var(--primary-light), var(--primary-dark));
  position: relative;
  color: #fff;
}
.cover-card .img .label {
  position: absolute; left: 10px; bottom: 10px;
  background: rgba(0,0,0,.3); color: #fff; font-size: 10.5px;
  padding: 2px 6px; border-radius: 3px;
  backdrop-filter: blur(2px);
}
.cover-card .meta { padding: 10px 12px; }
.cover-card .meta .t { font-weight: 600; font-size: 13px; margin-bottom: 2px; color: var(--text); }
.cover-card .meta .s { font-size: 11.5px; color: var(--text-muted); }

/* Notifications panel */
.notif-panel { width: 360px; }
.notif-panel .notif-item {
  display: grid; grid-template-columns: 28px 1fr auto; gap: 10px;
  padding: 10px 12px;
  border-top: 1px solid var(--divider);
  font-size: 12.5px;
  cursor: pointer;
}
.notif-panel .notif-item:first-of-type { border-top: 0; }
.notif-panel .notif-item:hover { background: var(--surface-warm); }
.notif-panel .notif-item.unread { background: color-mix(in srgb, var(--primary) 6%, transparent); }
.notif-panel .notif-item.unread::before {
  content: ""; width: 6px; height: 6px; background: var(--primary);
  border-radius: 50%; align-self: center;
  grid-column: 3; grid-row: 1;
}
.notif-panel .notif-item .t { color: var(--text); }
.notif-panel .notif-item .s { color: var(--text-muted); font-size: 11px; margin-top: 2px; }
.notif-panel .foot {
  padding: 10px 12px; text-align: center;
  border-top: 1px solid var(--divider);
  font-size: 12px;
}

/* Seat counter */
.seat-counter {
  display: flex; flex-direction: column; gap: 4px;
  padding: 10px 14px;
  background: var(--surface-warm);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  min-width: 200px;
}
.seat-counter .row1 { display: flex; align-items: baseline; gap: 6px; }
.seat-counter .num { font-size: 20px; font-weight: 600; color: var(--text); font-variant-numeric: tabular-nums; letter-spacing: -.01em; }
.seat-counter .tot { color: var(--text-muted); font-size: 13px; font-variant-numeric: tabular-nums; }
.seat-counter .bar {
  height: 6px; background: var(--surface-sunk); border-radius: 999px; overflow: hidden; margin-top: 2px;
}
.seat-counter .bar > i {
  display: block; height: 100%;
  background: var(--primary);
  border-radius: 999px;
}
.seat-counter.near  .bar > i { background: var(--warning); }
.seat-counter.full  .bar > i { background: var(--error); }
.seat-counter .hint { font-size: 11px; color: var(--text-muted); }

/* Empty states */
.empty {
  padding: 40px 24px; text-align: center;
  color: var(--text-muted);
  background: var(--surface-sunk);
  border-radius: var(--r-md);
  border: 1px dashed var(--border-strong);
}

/* Divider with label */
.divider-lbl { display: flex; align-items: center; gap: 10px; color: var(--text-muted); font-size: 11px; text-transform: uppercase; letter-spacing: .06em; }
.divider-lbl::before, .divider-lbl::after { content: ""; flex: 1; height: 1px; background: var(--divider); }

/* ---------- Rich content body ---------- */
.rich { font-size: 14px; line-height: 1.65; color: var(--text); max-width: 680px; }
.rich p { margin: 0 0 14px; }
.rich h2 { font-size: 17px; margin: 22px 0 8px; }
.rich h3 { font-size: 14.5px; margin: 18px 0 6px; }
.rich ul, .rich ol { padding-left: 20px; margin: 0 0 14px; }
.rich li { margin-bottom: 4px; }
.rich blockquote {
  border-left: 3px solid var(--primary);
  background: var(--surface-warm);
  margin: 14px 0; padding: 10px 14px;
  border-radius: 0 var(--r-md) var(--r-md) 0;
  color: var(--text);
}
.rich code { background: var(--surface-warm); padding: 1px 5px; border-radius: 3px; }

/* ---------- Gallery ---------- */
.gallery {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr;
  grid-template-rows: 130px 130px;
  gap: 6px;
  margin: 14px 0;
  max-width: 680px;
}
.gallery .g {
  background: var(--surface-warm);
  border-radius: var(--r-sm);
  overflow: hidden;
  position: relative;
}
.gallery .g img { width: 100%; height: 100%; object-fit: cover; display: block; }
.gallery .g1 { grid-row: 1 / 3; }
.gallery .more {
  position: absolute; inset: 0;
  background: rgba(0,0,0,.45); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-weight: 600;
}

/* ---------- Compose layout ---------- */
.compose-layout { display: grid; grid-template-columns: 1fr 260px; gap: var(--sp-4); }
.compose-side .side-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-md); padding: 12px; }
.compose-side h4 { margin-bottom: 8px; }

/* Cascading dropdown */
.cascade {
  display: flex; flex-wrap: wrap; gap: 6px;
}
.cascade select { flex: 1 1 110px; min-width: 110px; font-size: 12.5px; }

/* Chip input */
.chip-input {
  display: flex; flex-wrap: wrap; gap: 6px;
  padding: 6px;
  border: 1px solid var(--border-strong);
  border-radius: var(--r-md);
  background: var(--surface);
  min-height: 38px;
}
.chip-input input {
  flex: 1 1 120px;
  border: 0; outline: none; font: inherit; font-size: 13px;
  background: transparent; color: var(--text);
  min-width: 100px;
  padding: 2px;
}

/* Upload zone */
.upload {
  border: 1.5px dashed var(--border-strong);
  background: var(--surface-sunk);
  border-radius: var(--r-md);
  padding: 18px;
  text-align: center;
  color: var(--text-muted);
  font-size: 12.5px;
}
.upload .hint { font-size: 11px; margin-top: 3px; }
.upload .thumbs {
  display: flex; gap: 6px; flex-wrap: wrap;
  margin-top: 10px; justify-content: center;
}
.upload .thumb {
  width: 64px; height: 64px; border-radius: var(--r-sm);
  background: var(--surface-warm);
  border: 1px solid var(--border);
  position: relative;
  overflow: hidden;
}
.upload .thumb img { width: 100%; height: 100%; object-fit: cover; }
.upload .thumb .x {
  position: absolute; top: 2px; right: 2px;
  width: 16px; height: 16px; border-radius: 50%;
  background: rgba(0,0,0,.6); color: #fff; font-size: 10px;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
}

/* ---------- Collection detail ---------- */
.collection-hero {
  display: grid; grid-template-columns: 220px 1fr; gap: 18px;
  padding: 18px;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  background: var(--surface);
  margin-bottom: var(--sp-4);
}
.collection-hero .cover {
  aspect-ratio: 4/3;
  background: linear-gradient(135deg, var(--primary-light), var(--primary-dark));
  border-radius: var(--r-sm);
}
.collection-hero h1 { font-size: 20px; margin-bottom: 4px; }
.collection-hero .desc { color: var(--text-muted); font-size: 13px; max-width: 500px; }

/* ---------- Profile hero ---------- */
.profile-hero {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 18px;
  display: grid; grid-template-columns: 96px 1fr auto; gap: 18px;
  margin-bottom: var(--sp-4);
}
.profile-hero .top-row { display: flex; align-items: center; gap: 10px; }
.profile-hero h1 { font-size: 20px; }
.profile-hero .id { color: var(--text-muted); font-size: 12.5px; margin-top: 2px; }
.profile-hero .bio { margin-top: 8px; font-size: 13px; max-width: 500px; color: var(--text); }
.profile-hero .stats { display: flex; gap: 18px; margin-top: 10px; font-size: 12.5px; }
.profile-hero .stats b { display: block; font-size: 16px; color: var(--text); }
.profile-hero .actions { display: flex; gap: 6px; align-self: flex-start; }

/* ---------- Key-value rows (settings) ---------- */
.kv {
  display: grid;
  grid-template-columns: 200px 1fr;
  gap: 14px 20px;
  padding: 14px 4px;
  border-bottom: 1px solid var(--divider);
  align-items: start;
}
.kv:last-child { border-bottom: 0; }
.kv .k { color: var(--text-muted); font-size: 12.5px; padding-top: 6px; }
.kv .k .hint { font-size: 11.5px; color: var(--text-subtle); margin-top: 2px; display: block; }
.kv .v { font-size: 13.5px; }
.kv .v .locked { color: var(--text-muted); font-size: 12px; }

/* ---------- Dev / prototype aids ---------- */
.ribbon {
  position: fixed; top: 0; right: 0;
  padding: 4px 12px;
  background: var(--surface-warm);
  color: var(--text-muted);
  font-size: 10.5px;
  border-bottom-left-radius: var(--r-sm);
  border: 1px solid var(--border);
  border-top: 0; border-right: 0;
  z-index: 200;
}

/* ---------- Scrollbar tune ---------- */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 999px; border: 2px solid var(--bg); }
::-webkit-scrollbar-track { background: transparent; }

/* Print */
@media print {
  .sidebar, .topbar { display: none; }
  .app { grid-template-columns: 1fr; grid-template-areas: "main"; }
}


/* ---------- First-login password-change gate ---------- */
.gate-wrap {
  min-height: 100vh;
  display: grid; grid-template-columns: 1fr 1fr;
  background: var(--bg);
}
@media (max-width: 960px) { .gate-wrap { grid-template-columns: 1fr; } }
.gate-left {
  padding: 40px 44px;
  display: flex; flex-direction: column; justify-content: center;
  background:
    radial-gradient(600px 300px at 30% 20%, color-mix(in srgb, var(--primary) 18%, transparent), transparent 60%),
    var(--surface-warm);
  border-right: 1px solid var(--border);
  position: relative;
}
.gate-right {
  padding: 40px 44px;
  display: flex; align-items: center; justify-content: center;
  position: relative;
}
.locked-preview {
  position: relative;
  width: 100%; max-width: 520px; align-self: center; margin: 0 auto;
  pointer-events: none; user-select: none;
  filter: blur(2px) saturate(.7);
  opacity: .5;
  transform: scale(.88);
  transform-origin: top left;
}
.lock-tag {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 10px;
  background: var(--warning-bg); color: var(--warning);
  border: 1px solid color-mix(in srgb, var(--warning) 35%, transparent);
  border-radius: 999px;
  font-size: 11.5px; font-weight: 600;
  margin-bottom: 14px;
}
.gate-brand { display: flex; align-items: center; gap: 10px; margin-bottom: 22px; }
.gate-brand .mark {
  width: 30px; height: 30px; border-radius: 7px;
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  color: #fff; font-weight: 700; font-size: 14px;
  display: flex; align-items: center; justify-content: center;
}
.gate-card { width: 100%; max-width: 420px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); padding: 24px; box-shadow: var(--shadow-2); }
.gate-card h1 { font-size: 18px; margin-bottom: 4px; }
.gate-card .sub { color: var(--text-muted); font-size: 12.5px; margin-bottom: 18px; }
.pw-rules { font-size: 11.5px; color: var(--text-muted); margin-top: 4px; }
.pw-rules li.ok { color: var(--success); }
.pw-rules ul { padding-left: 18px; margin: 0; }
.big-lock { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; pointer-events: none; }
.big-lock svg { opacity: .4; }

/* ---------- Post detail ---------- */
.post-hero { padding: 18px 20px 16px; }
.post-hero h1 { font-size: 24px; line-height: 1.25; letter-spacing: -.015em; margin-bottom: 10px; }
.post-hero .meta-row { display: flex; align-items: center; gap: 10px; color: var(--text-muted); font-size: 12px; }
.react-picker {
  position: absolute; bottom: calc(100% + 6px); left: 0;
  display: none; gap: 2px; padding: 4px 6px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 999px; box-shadow: var(--shadow-pop); z-index: 5;
}
.react-picker.open { display: flex; }
.react-picker button {
  width: 30px; height: 30px; border: 0; background: transparent; cursor: pointer;
  font-size: 18px; border-radius: 50%;
}
.react-picker button:hover { background: var(--surface-warm); transform: scale(1.15); }
.like-wrap { position: relative; }
.comment-form { display: grid; grid-template-columns: 32px 1fr; gap: 10px; padding: 12px 0; }

/* ---------- Collection items list ---------- */
.coll-items { display:flex; flex-direction:column; gap:6px; }
.coll-item {
  display: grid;
  grid-template-columns: 24px 60px 1fr auto auto;
  gap: 12px;
  align-items: center;
  padding: 8px 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  font-size: 13px;
}
.coll-item:hover { background: var(--surface-warm); }
.coll-item .grip { color: var(--text-subtle); cursor: grab; text-align: center; font-size: 14px; }
.coll-item .thumb {
  width: 60px; height: 40px; border-radius: 3px;
  background: linear-gradient(135deg, var(--primary-light), var(--primary-dark));
  overflow: hidden;
}
.coll-item .thumb img { width:100%; height:100%; object-fit:cover; }
.coll-item .t { font-weight: 500; color: var(--text); }
.coll-item .s { color: var(--text-muted); font-size: 11.5px; }
.coll-item .pos { color: var(--text-muted); font-size: 11px; width: 22px; text-align:right; font-variant-numeric: tabular-nums; }

/* ---------- Compose editor ---------- */
.rt-toolbar {
  display: flex; gap: 2px; padding: 6px;
  border: 1px solid var(--border-strong);
  border-bottom: 0;
  border-radius: var(--r-md) var(--r-md) 0 0;
  background: var(--surface-warm);
}
.rt-toolbar button {
  background: transparent; border: 0; cursor: pointer;
  width: 28px; height: 28px; border-radius: var(--r-sm);
  color: var(--text-muted); font-family: inherit;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 13px;
}
.rt-toolbar button:hover { background: var(--surface); color: var(--text); }
.rt-toolbar .sep { width: 1px; background: var(--border); margin: 4px 2px; }
.rt-area {
  min-height: 260px;
  padding: 14px;
  border: 1px solid var(--border-strong);
  border-radius: 0 0 var(--r-md) var(--r-md);
  background: var(--surface);
  font-size: 14px; line-height: 1.6;
}
.rt-area[contenteditable]:focus { outline: none; }
.rt-area.tall { min-height: 340px; padding: 16px; line-height: 1.65; }
.counter { font-size: 11px; color: var(--text-muted); margin-left: auto; }
.kv-mini { display:flex; justify-content:space-between; font-size:12px; padding:5px 0; border-bottom:1px dashed var(--divider); }
.kv-mini:last-child { border-bottom: 0; }
.kv-mini .k { color: var(--text-muted); }

/* Article cover slot */
.cover-slot {
  position: relative;
  aspect-ratio: 3 / 1;
  border-radius: var(--r-md);
  overflow: hidden;
  border: 1px solid var(--border);
}
.cover-slot img { width:100%; height:100%; object-fit:cover; display:block; }
.cover-slot .ov { position:absolute; inset:0; background: linear-gradient(180deg, transparent 40%, rgba(0,0,0,.55)); }
.cover-slot .replace { position:absolute; right:10px; top:10px; display:flex; gap:6px; }

.read-time {
  display:inline-flex; align-items:center; gap:6px;
  padding: 4px 10px;
  background: var(--surface-warm);
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size:12px; color: var(--text);
  font-variant-numeric: tabular-nums;
}

/* ---------- Org admin (users table) ---------- */
.admin-head { display:grid; grid-template-columns: 1fr auto; gap: 14px; align-items: end; margin-bottom: 16px; padding-bottom: 14px; border-bottom: 1px solid var(--divider); }
.filter-bar {
  display: flex; align-items: center; gap: 8px;
  padding: 8px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  margin-bottom: 10px;
}
.filter-bar .input { height: 28px; font-size: 12.5px; padding: 3px 8px 3px 26px; background-position: 7px center; background-repeat: no-repeat; background-size: 14px; background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 16 16' fill='none' stroke='%236B6B6B' stroke-width='1.7'><circle cx='7' cy='7' r='4.5'/><path d='M10.5 10.5L14 14' stroke-linecap='round'/></svg>"); }
.filter-bar select { height: 28px; font-size: 12.5px; padding: 2px 24px 2px 8px; width: 130px; }
.table-wrap { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-md); overflow: hidden; }
.ellipsis-btn { background: none; border: 0; cursor: pointer; width: 26px; height: 26px; border-radius: var(--r-sm); color: var(--text-muted); }
.ellipsis-btn:hover { background: var(--surface-warm); color: var(--text); }

/* ---------- Org settings (owner-only) ---------- */
.owner-pill { display: inline-flex; align-items: center; gap: 6px; padding: 2px 8px; font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; background: color-mix(in srgb, var(--primary) 14%, transparent); color: var(--primary-dark); border: 1px solid color-mix(in srgb, var(--primary) 30%, transparent); border-radius: 999px; }
html[data-theme="dark"] .owner-pill { color: var(--primary-light); }
.settings-nav { display:flex; flex-direction:column; gap:2px; position: sticky; top: calc(var(--topbar-h) + 16px); }
.settings-nav a { padding: 6px 10px; border-radius: var(--r-sm); font-size: 12.5px; color: var(--text-muted); text-decoration: none; }
.settings-nav a:hover { background: var(--surface-warm); color: var(--text); }
.settings-nav a.active { background: color-mix(in srgb, var(--primary) 14%, transparent); color: var(--primary-dark); font-weight: 600; }
html[data-theme="dark"] .settings-nav a.active { color: var(--primary-light); }
.settings-layout { display: grid; grid-template-columns: 180px 1fr; gap: 22px; }
.danger-zone { border: 1px solid color-mix(in srgb, var(--error) 30%, transparent); border-radius: var(--r-md); background: var(--error-bg); padding: 14px; margin-top: 18px; }
.danger-zone h3 { color: var(--error); margin-bottom: 6px; }

/* Creator dashboard — tabs, tiles, list rows */
/* Sticky header block — keeps the page title, view toggle, and tab
   strip pinned while the feed/library scrolls underneath. z-index
   beats the feed cards but not modals (which sit at 1000+). */
.dash-sticky {
  position: sticky;
  top: 0;
  z-index: 20;
  background: var(--bg);
  padding-top: 12px;
  margin-top: -12px;
  /* Soft shadow fades in once the user has scrolled past the natural
     top — draws a clear boundary between sticky chrome and content. */
  box-shadow: 0 2px 0 rgba(0,0,0,0);
  transition: box-shadow .12s;
}
.dash-sticky.is-scrolled { box-shadow: 0 4px 10px rgba(0,0,0,.08); }
.dash-tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin: 8px 0 16px; overflow-x: auto; }
.dash-tab { display: inline-flex; align-items: center; gap: 6px; padding: 9px 14px; font-size: 13px; font-weight: 500; color: var(--text-muted); border-bottom: 2px solid transparent; white-space: nowrap; }
.dash-tab:hover { color: var(--text); background: var(--surface-warm); }
.dash-tab.active { color: var(--primary-dark); border-bottom-color: var(--primary); font-weight: 600; }
html[data-theme="dark"] .dash-tab.active { color: var(--primary-light); }
.dash-tab .count { font-size: 11px; font-weight: 500; padding: 1px 6px; border-radius: 999px; background: var(--surface-sunk); color: var(--text-subtle); }
.dash-tab.active .count { background: color-mix(in srgb, var(--primary) 16%, transparent); color: var(--primary-dark); }
html[data-theme="dark"] .dash-tab.active .count { color: var(--primary-light); }

.dash-tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; }
.dash-tile { display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-md); overflow: hidden; color: inherit; transition: border-color .15s, transform .15s; }
.dash-tile:hover { border-color: var(--border-strong); transform: translateY(-1px); }
.dash-tile-cover { position: relative; aspect-ratio: 16 / 10; background: var(--surface-sunk); display: flex; align-items: center; justify-content: center; }
.dash-tile-cover img { width: 100%; height: 100%; object-fit: cover; display: block; }
/* Kind tag lives at the bottom-left of the cover so the top-left
   checkbox in draft tiles doesn't overlap it. */
.dash-tile-kind { position: absolute; bottom: 8px; left: 8px; background: rgba(0,0,0,.55); color: #fff; font-size: 10.5px; padding: 2px 7px; border-radius: 3px; letter-spacing: .2px; }
.dash-tile-badge { position: absolute; top: 8px; right: 8px; background: var(--primary); color: var(--text-on-primary); font-size: 10.5px; padding: 2px 7px; border-radius: 3px; font-weight: 600; }

/* Category chip + body preview shown on dashboard cards. */
.dash-card-meta { margin: 6px 0 4px; display: flex; flex-wrap: wrap; gap: 6px; }
.dash-card-cat { display: inline-flex; align-items: center; gap: 4px; padding: 2px 7px; font-size: 11px; background: var(--surface-warm, #f6f0e6); color: var(--text-muted); border-radius: 10px; }
.dash-card-preview { margin: 4px 0 8px; font-size: 12.5px; line-height: 1.45; color: var(--text-muted); display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; text-overflow: ellipsis; }
.dash-row-preview { font-size: 12px; color: var(--text-muted); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }

/* Library tab — grid of uploaded images with used/unused badges. */
.dash-library-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 12px; margin-top: 6px; }
/* Library list view — denser row layout, one file per row. Activated
   by clicking the ☰ pill in the dashboard header. */
.dash-library-list { display: flex; flex-direction: column; margin-top: 6px; border: 1px solid var(--border); border-radius: 6px; background: var(--surface); overflow: hidden; }
.lib-row { display: grid; grid-template-columns: 28px 56px 1fr auto 32px; gap: 12px; align-items: center; padding: 8px 12px; border-bottom: 1px solid var(--divider); }
.lib-row:last-child { border-bottom: 0; }
.lib-row:hover { background: var(--surface-warm); }
.lib-row-ghost { opacity: .7; }
.lib-row-check { display: inline-flex; align-items: center; justify-content: center; cursor: pointer; }
.lib-row-thumb { width: 56px; height: 56px; border-radius: 4px; overflow: hidden; background: var(--surface-sunk); display: flex; align-items: center; justify-content: center; }
.lib-row-thumb a, .lib-row-thumb img { display: block; width: 100%; height: 100%; object-fit: cover; }
.lib-row-ghost-cover { font-size: 22px; }
.lib-row-main { min-width: 0; }
.lib-row-name { font-size: 13px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lib-row-meta { font-size: 11px; color: var(--text-muted); display: flex; gap: 10px; margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lib-row-id { color: var(--text-subtle); }
.lib-row-path { color: var(--text-subtle); overflow: hidden; text-overflow: ellipsis; max-width: 280px; }
.lib-row-badges { display: flex; gap: 4px; flex-shrink: 0; }
.lib-row .draft-single-del { position: static; width: 28px; height: 28px; }
/* Library filter pills — toggle which tiles the grid shows. Mirrors
   the feed-tabs look used elsewhere so the UI feels consistent. */
/* Library filter row — sticks just below the dashboard's sticky
   header. --dash-sticky-h is set by shell.js via a ResizeObserver;
   the fallback keeps the pills reachable even if JS is off. */
.dash-library-filters {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin: 0 0 12px;
  padding: 8px 0;
  position: sticky;
  top: var(--dash-sticky-h, 120px);
  z-index: 15;
  background: var(--bg);
}
.lib-filter-pill {
  padding: 5px 11px;
  font-size: 12.5px;
  border: 1px solid var(--border); background: var(--surface);
  color: var(--text-muted); cursor: pointer;
  border-radius: 999px;
  display: inline-flex; align-items: center; gap: 6px;
  transition: background .12s, color .12s, border-color .12s;
}
.lib-filter-pill:hover { color: var(--text); background: var(--surface-warm); }
.lib-filter-pill.is-active {
  background: var(--primary); color: #fff; border-color: var(--primary);
  font-weight: 600;
}
.lib-filter-count { font-size: 11px; opacity: .7; font-variant-numeric: tabular-nums; }
.lib-filter-pill.is-active .lib-filter-count { opacity: .9; }
.lib-filter-glyph { font-size: 13px; line-height: 1; }
.lib-tile { position: relative; display: flex; flex-direction: column; border: 1px solid var(--border); border-radius: 6px; overflow: hidden; background: var(--bg); }
/* Per-tile trash button — same pattern as draft cards: hidden until hover. */
.lib-tile .draft-single-del { position: absolute; top: 6px; right: 6px; z-index: 3; width: 26px; height: 26px; padding: 0; border: 1px solid rgba(0,0,0,.1); background: rgba(255,255,255,.92); border-radius: 4px; cursor: pointer; opacity: 0; transition: opacity 120ms, background 120ms, border-color 120ms; font-size: 13px; display: inline-flex; align-items: center; justify-content: center; }
.lib-tile:hover .draft-single-del { opacity: 1; }
.lib-tile .draft-single-del:hover { background: var(--error, #C62828); color: #fff; border-color: var(--error, #C62828); }
.lib-tile[data-used="0"] { border-color: rgba(198,40,40,.4); }
.lib-tile-link { display: block; background: var(--surface-warm); }
.lib-tile-link img { width: 100%; aspect-ratio: 1; object-fit: cover; display: block; }
.lib-tile-foot { padding: 6px 8px; display: flex; flex-direction: column; gap: 4px; }
.lib-tile-name { font-size: 11.5px; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lib-tile-id { font-size: 10.5px; color: var(--text-muted); font-family: 'JetBrains Mono', monospace; }
.lib-tile-path { font-size: 10px; color: var(--text-muted); font-family: 'JetBrains Mono', monospace; word-break: break-all; line-height: 1.3; display: block; }
.orphan-reason { padding: 0 4px; border-radius: 3px; font-size: 10.5px; }
.orphan-reason-missing     { background: rgba(198,40,40,.15); color: var(--error, #C62828); }
.orphan-reason-other_owner { background: rgba(230,120,0,.15); color: #E67300; }
.orphan-reason-inactive    { background: rgba(120,120,120,.15); color: var(--text-muted); }
.orphan-reason-shadow      { background: rgba(40,60,198,.12); color: #3048A0; }
.lib-tile-badge { align-self: flex-start; font-size: 10.5px; padding: 2px 6px; border-radius: 3px; font-weight: 500; }
/* Usage chips — one line per place a file is referenced, linking into
   the composer at the right book / section / page. Capped to 3 in the
   template; the rest collapse into a "+N more" hint. */
.lib-tile-usage { display: flex; flex-direction: column; gap: 2px; margin-top: 4px; }
.lib-usage-chip {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 6px; border-radius: 3px;
  background: var(--surface-warm); color: var(--text);
  font-size: 10.5px; text-decoration: none;
  max-width: 100%;
}
.lib-usage-chip:hover { background: var(--primary); color: #fff; }
.lib-usage-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lib-usage-more { font-size: 10.5px; color: var(--text-subtle); padding-left: 4px; }
/* List-view compact usage chip */
.lib-row-usage {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 6px; border-radius: 3px;
  background: var(--surface-warm); color: var(--text-muted);
  font-size: 11px; text-decoration: none;
}
.lib-row-usage:hover { background: var(--primary); color: #fff; }
.lib-tile-badge-used { background: rgba(46,125,50,.15); color: var(--success, #2E7D32); }
.lib-tile-badge-unused { background: rgba(198,40,40,.12); color: var(--error, #C62828); }
.lib-tile-badge-ghost { background: rgba(120,120,120,.18); color: #555; font-weight: 600; }
.lib-tile-badge-state { background: rgba(230,120,0,.14); color: #B85B00; font-family: 'JetBrains Mono', monospace; font-size: 10px; }

/* Ghost tiles — DB row present, blob missing. Muted look + striped
   placeholder so the user knows this is a delete target, not an image. */
.lib-tile-ghost { border-style: dashed; border-color: rgba(120,120,120,.4); background: repeating-linear-gradient(45deg, transparent 0 8px, rgba(120,120,120,.05) 8px 16px); }
.lib-tile-ghost-cover { aspect-ratio: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; color: var(--text-muted); background: var(--surface-warm); }
.lib-tile-ghost-icon { font-size: 32px; }
.lib-tile-ghost-label { font-size: 11px; text-align: center; padding: 0 8px; }
/* Ghost tiles always show the trash — nothing to preview, only to delete. */
.lib-tile-ghost .draft-single-del { opacity: 1; background: var(--error, #C62828); color: #fff; border-color: var(--error, #C62828); }

/* Per-card trash button — appears on the draft tile top-right (under
   the "Draft" badge) and inline-right on the list view. Hidden until
   the card is hovered to keep the UI quiet. */
.dash-tile-draft .draft-single-del { position: absolute; top: 32px; right: 8px; z-index: 3; width: 28px; height: 28px; padding: 0; border: 1px solid rgba(0,0,0,.1); background: rgba(255,255,255,.92); border-radius: 4px; cursor: pointer; opacity: 0; transition: opacity 120ms, background 120ms, border-color 120ms; font-size: 14px; display: inline-flex; align-items: center; justify-content: center; }
.dash-tile-draft:hover .draft-single-del { opacity: 1; }
.dash-tile-draft .draft-single-del:hover { background: var(--error, #C62828); color: #fff; border-color: var(--error, #C62828); }
.dash-row .draft-single-del { margin-left: 4px; width: 30px; height: 30px; padding: 0; border: 1px solid transparent; background: transparent; border-radius: 4px; cursor: pointer; font-size: 14px; color: var(--text-muted); }
.dash-row:hover .draft-single-del { border-color: var(--border); }
.dash-row .draft-single-del:hover { background: var(--error, #C62828); color: #fff; border-color: var(--error, #C62828); }
.dash-tile-body { padding: 10px 12px 12px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.dash-tile-body h3 { font-size: 14px; font-weight: 600; line-height: 1.35; margin: 0; color: var(--text); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.dash-metrics { display: flex; gap: 12px; font-size: 12px; color: var(--text-muted); }
.dash-metrics span { white-space: nowrap; }

.dash-list { display: flex; flex-direction: column; border: 1px solid var(--border); border-radius: var(--r-md); overflow: hidden; background: var(--surface); }
.dash-row { display: grid; grid-template-columns: 56px 1fr auto; gap: 12px; align-items: center; padding: 10px 14px; border-bottom: 1px solid var(--border); color: inherit; }
.dash-row:last-child { border-bottom: 0; }
.dash-row:hover { background: var(--surface-warm); }
.dash-row-thumb { width: 56px; height: 40px; border-radius: 4px; overflow: hidden; background: var(--surface-sunk); }
.dash-row-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.dash-row-kind { font-size: 11px; color: var(--text-subtle); margin-bottom: 2px; }
.dash-row-title { font-size: 13.5px; font-weight: 500; color: var(--text); line-height: 1.35; }

@media (max-width: 680px) {
  .dash-tiles { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
  .dash-row { grid-template-columns: 48px 1fr; }
  .dash-row .dash-metrics { grid-column: 1 / -1; padding-left: 60px; font-size: 11.5px; }
}

/* Book-type picker modal — mirrors mockups/composer-book.html BookTypePicker */
.modal.book-picker { width: min(720px, 94vw); }
.book-picker-head { padding: 18px 22px 14px; display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; border-bottom: 1px solid var(--border); }
.book-picker-head .eyebrow { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--text-muted); font-weight: 600; margin-bottom: 4px; }
.book-picker-title { font-size: 18px; font-weight: 600; letter-spacing: -.01em; color: var(--text); }
.book-picker-sub { font-size: 12.5px; color: var(--text-muted); margin-top: 4px; }
.book-picker-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; padding: 18px; }
.book-type-card { display: flex; flex-direction: column; gap: 8px; padding: 16px 14px 14px; background: var(--surface); border: 1px solid var(--border-strong); border-radius: 8px; color: var(--text); text-align: left; transition: border-color .12s, background .12s, transform .08s; position: relative; }
.book-type-card:hover { border-color: var(--primary); background: color-mix(in srgb, var(--primary) 6%, var(--surface)); transform: translateY(-1px); }
.book-type-card.is-default { border: 1.5px solid var(--primary); background: color-mix(in srgb, var(--primary) 10%, var(--surface)); }
html[data-theme="dark"] .book-type-card.is-default { background: color-mix(in srgb, var(--primary) 18%, var(--surface)); }
.btc-ico { color: var(--text-muted); display: flex; }
.book-type-card:hover .btc-ico, .book-type-card.is-default .btc-ico { color: var(--primary-dark); }
html[data-theme="dark"] .book-type-card:hover .btc-ico,
html[data-theme="dark"] .book-type-card.is-default .btc-ico { color: var(--primary-light); }
.btc-title { font-size: 14px; font-weight: 600; margin-bottom: 2px; color: var(--text); }
.btc-sub { font-size: 11.5px; color: var(--text-muted); text-transform: uppercase; letter-spacing: .04em; font-weight: 500; }
.btc-desc { font-size: 12px; line-height: 1.45; color: var(--text-muted); }
.btc-cta { margin-top: auto; padding-top: 8px; font-size: 11.5px; color: var(--primary-dark); font-weight: 600; display: flex; align-items: center; gap: 4px; }
html[data-theme="dark"] .btc-cta { color: var(--primary-light); }
.btc-cta span { transform: translateY(-1px); }
.book-picker-foot { padding: 12px 22px; border-top: 1px solid var(--border); background: var(--surface-warm); font-size: 11.5px; color: var(--text-muted); display: flex; align-items: center; justify-content: space-between; }
.book-picker-foot .linkish { background: none; border: 0; color: var(--text-muted); font-size: 12px; cursor: pointer; padding: 0; }
.book-picker-foot .linkish:hover { color: var(--text); }
@media (max-width: 640px) {
  .book-picker-grid { grid-template-columns: 1fr; }
}

/* Book stub hero — shown on /compose/book?type=X until the real editor ships */
.book-stub-hero { display: grid; grid-template-columns: 72px 1fr; gap: 22px; align-items: start; padding: 24px 26px; border: 1px solid var(--border); border-radius: var(--r-md); background: var(--surface); margin-top: 8px; }
.book-stub-hero .bsh-ico { display: flex; align-items: center; justify-content: center; width: 72px; height: 72px; border-radius: 8px; background: color-mix(in srgb, var(--primary) 10%, var(--surface)); color: var(--primary-dark); }
html[data-theme="dark"] .book-stub-hero .bsh-ico { background: color-mix(in srgb, var(--primary) 18%, var(--surface)); color: var(--primary-light); }
.book-stub-hero .eyebrow { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--text-muted); font-weight: 600; margin-bottom: 4px; }
.book-stub-hero .bsh-title { font-size: 22px; font-weight: 600; letter-spacing: -.01em; color: var(--text); margin: 0; }
.book-stub-hero .bsh-sub { font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--text-muted); font-weight: 500; margin-top: 4px; }
.book-stub-hero .bsh-desc { font-size: 13.5px; color: var(--text-muted); line-height: 1.55; margin-top: 10px; }
@media (max-width: 560px) {
  .book-stub-hero { grid-template-columns: 1fr; }
}

/* ============ Book composer — shared chrome ============ */
/* Fixed viewport-height shell so the app bar, section tabs and page strip
   stay locked while only the editor area below scrolls. */
.book-composer { display: flex; flex-direction: column; height: calc(100vh - var(--topbar-h)); overflow: hidden; margin: calc(-1 * var(--sp-5)) calc(-1 * var(--sp-6)); }
.bc-appbar, .bc-section-tabs, .bc-page-strip { flex: 0 0 auto; }

/* App bar */
.bc-appbar { display: flex; align-items: center; gap: 10px; padding: 10px 16px; border-bottom: 1px solid var(--border); background: var(--surface); }
.bc-crumbs { display: flex; align-items: center; gap: 6px; font-size: 12px; }
.bc-brand-mark { width: 22px; height: 22px; border-radius: 4px; background: linear-gradient(135deg, var(--primary), var(--primary-dark)); color: #fff; font-weight: 700; font-size: 10.5px; display: flex; align-items: center; justify-content: center; }
.bc-brand-mark svg { width: 13px; height: 13px; }
.bc-crumbs .bc-muted { color: var(--text-muted); }
.bc-crumbs .bc-sep { color: var(--border-strong); }
.bc-crumbs .bc-crumb-link { text-decoration: none; }
.bc-crumbs .bc-crumb-link:hover { color: var(--text); text-decoration: underline; }
.bc-crumbs a.bc-brand-mark { text-decoration: none; }

/* Composer focus-mode toggles — chip buttons in the appbar that hide the
   section tabs and/or the page title on the editor. Hidden state is driven
   by body classes set from localStorage in book_chrome.html. */
.bc-view-chip { padding: 4px 8px; border-radius: 4px; border: 1px solid var(--border,rgba(0,0,0,.15)); background: transparent; cursor: pointer; font-weight: 600; line-height: 1; transition: opacity .15s, background .15s; }
.bc-view-chip:hover { background: var(--surface-warm, rgba(0,0,0,.04)); }
body.hide-section-tabs .bc-section-tabs { display: none !important; }
body.hide-page-title .bc-page-eyebrow,
body.hide-page-title .bc-page-title { display: none !important; }
.bc-booktitle { font-size: 13px; font-weight: 600; display: inline-flex; align-items: center; gap: 8px; color: var(--text); }
.bc-spacer { flex: 1; }
.bc-saved { font-size: 11px; color: var(--text-muted); display: inline-flex; align-items: center; gap: 5px; }
.bc-saved-dot { width: 6px; height: 6px; background: var(--success); border-radius: 50%; }

/* Status pills */
.pill { display: inline-flex; align-items: center; gap: 4px; font-size: 11px; padding: 2px 7px; border-radius: 10px; font-weight: 500; }
.pill-draft { background: var(--warning-bg); color: var(--warning); }
.pill-muted { background: var(--surface-sunk); color: var(--text-muted); }
.pill-primary { background: var(--surface-warm); color: var(--primary-dark); }
html[data-theme="dark"] .pill-primary { color: var(--primary-light); }

/* Section tabs */
.bc-section-tabs { display: flex; align-items: flex-end; gap: 1px; padding-left: 14px; background: var(--surface); border-bottom: 1px solid var(--border); overflow-x: auto; }
.bc-section-tab { display: flex; align-items: center; gap: 6px; padding: 7px 14px 6px; font-size: 12.5px; border-top: 2px solid transparent; color: var(--text-muted); white-space: nowrap; cursor: pointer; margin-bottom: -1px; }
.bc-section-tab.active { border-top-color: var(--primary); border-left: 1px solid var(--border); border-right: 1px solid var(--border); border-bottom: 1px solid var(--surface); background: var(--surface); color: var(--text); font-weight: 600; }
.bc-section-num { width: 18px; height: 18px; border-radius: 3px; background: var(--surface-sunk); color: var(--primary-dark); display: inline-flex; align-items: center; justify-content: center; font-size: 10px; font-weight: 700; font-variant-numeric: tabular-nums; }
.bc-section-tab.active .bc-section-num { background: var(--surface-warm); }
html[data-theme="dark"] .bc-section-num { color: var(--primary-light); }
.bc-section-count { color: var(--text-subtle); margin-left: 3px; font-size: 11px; font-weight: 400; }
.bc-section-add { padding: 6px 10px; font-size: 12px; color: var(--text-muted); border: 0; background: transparent; cursor: pointer; }

/* Page strip */
.bc-page-strip { display: flex; align-items: center; gap: 2px; padding: 6px 14px; background: var(--surface); border-bottom: 1px solid var(--divider); overflow-x: auto; font-size: 11.5px; }
.bc-page-strip-label { color: var(--text-muted); margin-right: 6px; flex-shrink: 0; }
.bc-page-chip { padding: 3px 8px; border-radius: 3px; background: var(--surface-sunk); color: var(--text-muted); white-space: nowrap; flex-shrink: 0; font-variant-numeric: tabular-nums; max-width: 220px; overflow: hidden; text-overflow: ellipsis; cursor: pointer; }
.bc-page-chip.active { background: var(--primary); color: #fff; font-weight: 500; }
.bc-page-add { padding: 3px 8px; font-size: 11.5px; color: var(--text-muted); border: 1px dashed var(--border); background: transparent; border-radius: 3px; cursor: pointer; flex-shrink: 0; }

/* Quill toolbar */
.bc-quill { display: flex; align-items: center; flex-wrap: wrap; gap: 2px; padding: 6px 10px; border-bottom: 1px solid var(--border); background: var(--surface-warm); position: sticky; top: 0; z-index: 5; }
.bc-quill .tb { height: 26px; min-width: 26px; padding: 0 6px; border: 0; background: transparent; color: var(--text); border-radius: 4px; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 3px; font-size: 12px; font: inherit; }
.bc-quill .tb:hover { background: var(--surface-sunk); }
.bc-quill .tb.tb-active { background: var(--surface); color: var(--primary-dark); }
html[data-theme="dark"] .bc-quill .tb.tb-active { color: var(--primary-light); }
.bc-quill .tb-sep { width: 1px; height: 16px; background: var(--border); margin: 0 4px; }

/* Editor area + card */
.bc-editor-area { flex: 1; overflow: auto; display: flex; flex-direction: column; background: var(--bg); padding: 24px 20px; }
.bc-editor-card { background: var(--surface); border: 1px solid var(--border); border-radius: 6px; overflow: hidden; box-shadow: var(--shadow-1); max-width: 900px; margin: 0 auto; width: 100%; }
.bc-editor-head { padding: 22px 36px 0; }
.bc-page-eyebrow { font-size: 11px; color: var(--text-muted); letter-spacing: .4px; text-transform: uppercase; margin-bottom: 6px; }
.bc-page-title { font-size: 28px; font-weight: 700; letter-spacing: -.5px; line-height: 1.2; outline: none; color: var(--text); }
.bc-editor-body { padding: 14px 36px 48px; font-size: 14.5px; line-height: 1.7; color: var(--text); }
.bc-editor-body p { margin: 0 0 14px; }
.bc-editor-body h2 { font-size: 18px; font-weight: 600; margin: 22px 0 8px; letter-spacing: -.2px; }
.bc-editor-body h3 { font-size: 15.5px; font-weight: 600; margin: 18px 0 6px; }
.bc-editor-body ol { margin: 0 0 14px; padding-left: 22px; }
.bc-editor-body ol li { margin: 6px 0; }
.bc-editor-body blockquote { margin: 18px 0; padding: 4px 0 4px 14px; border-left: 3px solid var(--primary); color: var(--text-muted); font-style: italic; }
.bc-quote-attr { font-size: 12px; font-style: normal; margin-top: 4px; color: var(--text-subtle); }
.bc-sel { background: color-mix(in srgb, var(--primary) 22%, transparent); border-radius: 2px; padding: 0 1px; }
.bc-caret { display: inline-block; width: 1.5px; height: 1.1em; background: var(--primary-dark); vertical-align: text-bottom; animation: bc-caret 1.1s steps(2) infinite; margin-left: 1px; }
@keyframes bc-caret { 50% { opacity: 0; } }

.bc-figure { margin: 20px 0; border: 1px solid var(--border); border-radius: 5px; overflow: hidden; background: var(--surface-sunk); }
.bc-figure-placeholder { height: 170px; display: flex; align-items: center; justify-content: center; color: var(--text-subtle); font-size: 12px; background: repeating-linear-gradient(45deg, var(--surface-warm) 0 8px, var(--surface-sunk) 8px 16px); }
.bc-figure figcaption { padding: 6px 10px; font-size: 11.5px; color: var(--text-muted); display: flex; align-items: center; gap: 10px; background: var(--surface); }
.bc-figure figcaption span[contenteditable] { flex: 1; outline: none; }
.bc-alt-tag { color: var(--text-subtle); }

.bc-slash-hint { padding: 8px 12px; border: 1px dashed var(--border-strong); border-radius: 4px; font-size: 13px; color: var(--text-muted); background: var(--surface-warm); }
.bc-slash-hint kbd { font-family: 'JetBrains Mono', monospace; background: var(--surface); padding: 1px 5px; border-radius: 3px; border: 1px solid var(--border); font-size: 11px; }

/* Editor input fields — blend into the card like the mockup. The title input
   sits at font-size:28 weight:700 with no visible chrome until focus; the
   body textarea reads as long-form prose rather than a form field. */
input.bc-page-title { display: block; width: 100%; border: none; background: transparent; padding: 0; font-size: 28px; font-weight: 700; letter-spacing: -.5px; line-height: 1.2; color: var(--text); outline: none; font-family: inherit; transition: font-size .15s, margin .15s, padding .15s; }
input.bc-page-title:focus { background: var(--surface-warm); border-radius: 4px; padding: 0 6px; margin: 0 -6px; }

/* Collapsed (empty) state — looks like a tiny subtle "+ Add title" link
   that doesn't eat vertical space. Restores to the full 28px heading on
   focus or when the user types. */
input.bc-page-title-collapsing.bc-empty { font-size: 11.5px; font-weight: 400; color: var(--text-subtle); letter-spacing: 0; line-height: 1; }
input.bc-page-title-collapsing.bc-empty::placeholder { color: var(--text-subtle); opacity: 1; }
input.bc-page-title-collapsing.bc-empty:hover { color: var(--text-muted); cursor: text; }
textarea.bc-body-textarea { display: block; width: 100%; min-height: 300px; border: none; background: transparent; padding: 0; font-size: 14.5px; line-height: 1.7; color: var(--text); outline: none; resize: vertical; font-family: inherit; }
textarea.bc-body-textarea::placeholder { color: var(--text-subtle); }

/* Rich-text contenteditable body — same look as the old textarea, plus
   support for the usual rich elements (headings / lists / quote / code). */
.bc-body-editable { display: block; width: 100%; min-height: 300px; outline: none; font-size: 14.5px; line-height: 1.55; color: var(--text); }
.bc-body-editable:focus { outline: none; }
.bc-body-editable.bc-empty::before { content: attr(data-placeholder); color: var(--text-subtle); pointer-events: none; }
.bc-body-editable p { margin: 0 0 6px; }
.bc-body-editable p:empty, .bc-body-editable p:has(> br:only-child) { margin: 0 0 2px; min-height: 1.4em; }
.bc-body-editable h1 { font-size: 24px; font-weight: 700; margin: 20px 0 10px; letter-spacing: -.3px; }
.bc-body-editable h2 { font-size: 20px; font-weight: 600; margin: 20px 0 8px; letter-spacing: -.2px; }
.bc-body-editable h3 { font-size: 17px; font-weight: 600; margin: 18px 0 6px; }
.bc-body-editable ul, .bc-body-editable ol { margin: 0 0 14px; padding-left: 22px; }
.bc-body-editable blockquote { margin: 14px 0; padding: 4px 0 4px 14px; border-left: 3px solid var(--primary); color: var(--text-muted); font-style: italic; }
.bc-body-editable pre { margin: 14px 0; padding: 12px 14px; background: var(--surface-sunk); border: 1px solid var(--divider); border-radius: 4px; font-family: 'JetBrains Mono', monospace; font-size: 13px; overflow: auto; white-space: pre-wrap; }
.bc-body-editable a { color: var(--primary-dark); text-decoration: underline; }

/* Toolbar block-type dropdown — same height as the icon buttons. */
.bc-quill .tb-select { height: 26px; width: 96px; padding: 0 4px; font-size: 11.5px; background: transparent; border: 1px solid transparent; border-radius: 4px; color: var(--text); font-family: inherit; cursor: pointer; text-overflow: ellipsis; }
.bc-quill .tb-select:hover { background: var(--surface-sunk); }

/* Color-picker buttons — clickable glyph with hidden native <input type=color>
   beneath it. Clicking the glyph pops the OS color picker. */
.bc-quill .tb-color { position: relative; height: 26px; min-width: 26px; padding: 0 6px; border-radius: 4px; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 600; color: var(--text); }
.bc-quill .tb-color:hover { background: var(--surface-sunk); }
.bc-quill .tb-color input[type="color"] { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; height: 100%; padding: 0; border: none; background: transparent; }

/* Radio-as-chip for image size picker in the insert-image modal. */
.bc-sizepick { flex: 1; position: relative; cursor: pointer; }
.bc-sizepick input { position: absolute; opacity: 0; }
.bc-sizepick span { display: block; padding: 6px 8px; font-size: 12.5px; text-align: center; border: 1px solid var(--border); border-radius: 4px; color: var(--text); background: var(--bg); font-variant-numeric: tabular-nums; }
.bc-sizepick input:checked + span { background: var(--primary); color: #fff; border-color: var(--primary); font-weight: 500; }
.bc-sizepick:hover span { background: var(--surface-warm); }
.bc-sizepick input:checked + span:hover { background: var(--primary); }

/* Figures in the editor are click-to-edit. Pointer + subtle outline on
   hover makes that affordance discoverable. Keep the editor's own
   selection outline out of the way by matching its offset. */
.bc-body-editable figure[data-file-id] { cursor: pointer; transition: outline-color 120ms ease; outline: 2px solid transparent; outline-offset: 2px; }
.bc-body-editable figure[data-file-id]:hover { outline-color: var(--primary); }
.bc-body-editable figure[data-file-id] img { pointer-events: none; }

/* Tab panes in the insert-image modal. `hidden` by itself is beaten by
   any inline `display:` value, so we gate on the attribute explicitly. */
.bc-img-pane { display: flex; flex-direction: column; gap: 10px; }
.bc-img-pane[hidden] { display: none; }

/* Tab bar at the top of the insert-image modal (Upload new / Library). */
.bc-img-tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--border); margin: -4px 0 4px; }
.bc-img-tab { border: 0; background: transparent; padding: 8px 14px; font-size: 13px; color: var(--text-muted); cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.bc-img-tab:hover { color: var(--text); }
.bc-img-tab.is-active { color: var(--primary); border-bottom-color: var(--primary); font-weight: 500; }

/* Library grid — 4-up thumbnail picker in the insert-image modal. */
.bc-img-lib-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; max-height: 260px; overflow-y: auto; padding: 4px; border: 1px solid var(--border); border-radius: 4px; background: var(--surface-warm); }
.bc-img-lib-item { border: 2px solid transparent; border-radius: 4px; background: var(--bg); padding: 0; cursor: pointer; overflow: hidden; display: flex; flex-direction: column; text-align: left; }
.bc-img-lib-item img { width: 100%; aspect-ratio: 1; object-fit: cover; display: block; }
.bc-img-lib-name { font-size: 11px; color: var(--text-muted); padding: 4px 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bc-img-lib-item:hover { border-color: var(--border-strong); }
.bc-img-lib-item.is-selected { border-color: var(--primary); }
.bc-img-lib-item.is-selected .bc-img-lib-name { background: var(--primary); color: #fff; }
/* Break float flow so paragraphs after a floated figure don't wrap
   around forever — the builder also writes clear:both on the figure. */
.bc-body-editable::after, .preview-body::after { content: ''; display: block; clear: both; }
.bc-empty-hint { color: var(--text-muted); font-size: 13.5px; padding: 8px 12px; border: 1px dashed var(--border-strong); border-radius: 4px; background: var(--surface-warm); margin: 0 0 10px; }
.bc-empty-hint kbd { font-family: 'JetBrains Mono', monospace; background: var(--surface); padding: 1px 5px; border-radius: 3px; border: 1px solid var(--border); font-size: 11px; }

/* Editor footstrip — thin word-count bar under the card. Matches the
   mockup's "412 words · ~2 min read · body_html · 3.4 KB · Last edited…" */
.bc-editor-footstrip { display: flex; align-items: center; gap: 14px; padding: 10px 4px; font-size: 11.5px; color: var(--text-muted); max-width: 900px; margin: 0 auto; width: 100%; }
.bc-editor-footstrip .bc-grow { flex: 1; }
.bc-editor-footstrip .mono { font-family: 'JetBrains Mono', monospace; }

/* Saved indicator — tiny green-dot pill in the footstrip. */
.saved-indicator { display: inline-flex; align-items: center; gap: 6px; font-size: 11px; color: var(--text-muted); }
.saved-indicator::before { content:''; display:inline-block; width:6px; height:6px; border-radius:50%; background: var(--success, #2E7D32); }

/* Top-right toast stack. Toasts are appended here, animate in, and
   self-destruct after ~1.8s. */
#bc-toast-host { position: fixed; top: 16px; right: 16px; z-index: 9999; display: flex; flex-direction: column; gap: 8px; pointer-events: none; }
.bc-toast { pointer-events: auto; display: flex; align-items: center; gap: 10px; padding: 10px 14px; background: var(--surface); border: 1px solid var(--border); border-radius: 6px; box-shadow: 0 6px 18px rgba(0,0,0,.12); font-size: 13px; color: var(--text); min-width: 180px; opacity: 0; transform: translateX(12px); transition: opacity 160ms ease, transform 160ms ease; }
.bc-toast.is-in { opacity: 1; transform: translateX(0); }
.bc-toast-ok::before { content: ''; width: 8px; height: 8px; border-radius: 50%; background: var(--success, #2E7D32); flex-shrink: 0; }
.bc-toast-err { border-color: var(--error, #C62828); }
.bc-toast-err::before { content: ''; width: 8px; height: 8px; border-radius: 50%; background: var(--error, #C62828); flex-shrink: 0; }

/* ── V2 composer layout ─────────────────────────────────────────────────
   Two-pane: fixed-width outline sidebar + flex editor pane. Replaces the
   horizontal tabs + page strip for the general book composer. */
/* Composer shell fills the viewport under the topbar so only the page
   grid (.bc-editor-area, below) scrolls. The outline sidebar and the
   editor's compact header stay fixed in place. The parent .main gets
   its padding zeroed only when a composer is inside it, so the composer
   reaches every edge of the main grid area. */
.main:has(> .book-composer-v2) {
  padding: 0;
  height: calc(100vh - var(--topbar-h, 56px));
  overflow: hidden;
}
.book-composer-v2 { display: flex; height: 100%; overflow: hidden; background: var(--bg); }

.bc-outline { width: 264px; flex-shrink: 0; background: var(--surface); border-right: 1px solid var(--border); display: flex; flex-direction: column; overflow: hidden; }

/* Collapsible sub-section inside the outline sidebar — currently wraps
   the series covers/authors/credits (book info) and the hashtags. Click
   the header row to toggle. State persists per user + book-info-type in
   localStorage. */
.bc-outline-collapse {
  display: flex; align-items: center; gap: 6px;
  width: 100%; padding: 8px 12px;
  background: transparent; border: 0; border-top: 1px solid var(--divider);
  color: var(--text-muted); font: inherit; font-size: 11px; font-weight: 600;
  letter-spacing: .4px; text-transform: uppercase; text-align: left;
  cursor: pointer;
}
.bc-outline-collapse:hover { background: var(--surface-warm); color: var(--text); }
.bc-outline-collapse-chev { display: inline-block; transition: transform .12s; font-size: 10px; opacity: .7; }
.bc-outline-collapse[aria-expanded="false"] .bc-outline-collapse-chev { transform: rotate(-90deg); }
.bc-outline-collapsible { padding: 0 12px 6px; }
.bc-outline-collapsible[hidden] { display: none; }

/* Right panel — per-volume metadata (covers + authors + credits). Sits
   on the right of the editor. Collapses to a narrow rail with a chevron
   when the user wants more horizontal room for the page grid. */
.bc-vol-panel {
  width: 280px; flex-shrink: 0;
  background: var(--surface); border-left: 1px solid var(--border);
  display: flex; flex-direction: column; overflow: hidden;
  transition: width .15s ease;
}
.bc-vol-panel.is-collapsed { width: 32px; }
/* The header row IS the toggle — clicking the volume label or the
   chevron collapses/expands the panel. Title on the left, chevron on
   the right, so the interaction is obvious at a glance. */
.bc-vol-panel-toggle {
  display: flex; align-items: center; gap: 6px;
  width: 100%; padding: 10px 12px;
  background: transparent; border: 0; border-bottom: 1px solid var(--divider);
  color: var(--text); font: inherit; text-align: left;
  cursor: pointer; flex-shrink: 0;
}
.bc-vol-panel-toggle:hover { background: var(--surface-warm); }
.bc-vol-panel-title { font-size: 13px; font-weight: 600; flex: 1; }
.bc-vol-panel-chev { display: inline-block; transition: transform .12s; font-size: 14px; color: var(--text-muted); }
.bc-vol-panel.is-collapsed .bc-vol-panel-chev { transform: rotate(180deg); }
/* Rail mode (collapsed) — title hides, vertical "Volume covers" label
   shows so the user knows what the rail opens to. */
.bc-vol-panel .bc-vol-panel-rail-label { display: none; }
.bc-vol-panel.is-collapsed .bc-vol-panel-title { display: none; }
.bc-vol-panel.is-collapsed .bc-vol-panel-rail-label {
  display: inline-block; writing-mode: vertical-rl; transform: rotate(180deg);
  white-space: nowrap; font-size: 11px; color: var(--text-muted);
  letter-spacing: .3px; text-transform: uppercase;
}
.bc-vol-panel.is-collapsed .bc-vol-panel-toggle {
  flex-direction: column; padding: 8px 4px; gap: 8px; border-bottom: 0;
}
.bc-vol-panel-body { padding: 12px; overflow-y: auto; flex: 1; }
.bc-vol-panel.is-collapsed .bc-vol-panel-body { display: none; }
.bc-outline-head { padding: 10px 12px; border-bottom: 1px solid var(--divider); }
.bc-outline-eyebrow { font-size: 10.5px; color: var(--text-muted); letter-spacing: .3px; text-transform: uppercase; margin-bottom: 2px; }
.bc-outline-title { font-size: 13.5px; font-weight: 600; letter-spacing: -.2px; }
/* Inline-editable book title in the outline sidebar — looks like static
   heading text until hover/focus. */
input.bc-outline-title { width: 100%; border: 1px dashed transparent; background: transparent; color: var(--text); padding: 2px 4px; margin: -2px -4px; border-radius: 4px; font-family: inherit; transition: background 120ms, border-color 120ms; }
input.bc-outline-title:hover { border-color: var(--border); }
input.bc-outline-title:focus { outline: none; border-color: var(--primary); background: var(--surface); }
input.bc-outline-title::placeholder { color: var(--text-subtle); font-weight: 500; }
/* Category picker sits under the book title pills in the outline sidebar. */
.bc-outline-category { display: flex; flex-direction: column; gap: 4px; margin-top: 10px; }
.bc-outline-cat-label { font-size: 11px; color: var(--text-muted); letter-spacing: .3px; text-transform: uppercase; }
.bc-outline-cat-select { width: 100%; height: 30px; padding: 0 8px; font-size: 12.5px; border: 1px solid var(--border); border-radius: 4px; background: var(--bg); color: var(--text); font-family: inherit; cursor: pointer; }
.bc-outline-cat-select:hover { border-color: var(--border-strong); }
.bc-outline-cat-select:focus { outline: none; border-color: var(--primary); }
.bc-outline-pills { display: flex; align-items: center; gap: 6px; margin-top: 5px; font-size: 11px; color: var(--text-muted); }
.bc-outline-kind { margin-left: auto; font-size: 10.5px; color: var(--text-subtle); }

.bc-outline-filter { padding: 8px 12px; display: flex; gap: 6px; border-bottom: 1px solid var(--divider); }
.bc-outline-filter-input { flex: 1; position: relative; }
.bc-outline-filter-input svg { position: absolute; left: 6px; top: 7px; opacity: .5; }
.bc-outline-filter-input input { width: 100%; padding: 5px 8px 5px 24px; font-size: 12px; border: 1px solid var(--border); border-radius: 3px; background: var(--bg); color: var(--text); font-family: inherit; }
.bc-outline-add-btn { padding: 4px 10px; font-size: 14px; background: var(--surface-warm); border: 1px solid var(--border); border-radius: 3px; cursor: pointer; color: var(--primary-dark); }

.bc-outline-tree { flex: 1; overflow: auto; padding: 6px 8px; }
.bc-outline-section-row { display: flex; align-items: center; gap: 5px; padding: 5px 6px; border-radius: 3px; font-size: 12.5px; font-weight: 500; color: var(--text); text-decoration: none; }
.bc-outline-section-row:hover { background: var(--surface-warm); }
.bc-outline-section.active .bc-outline-section-row { background: var(--surface-warm); color: var(--primary-dark); font-weight: 600; }
.bc-outline-chev { opacity: .6; display: inline-flex; align-items: center; justify-content: center; width: 14px; height: 14px; font-size: 10px; border: 0; background: transparent; color: inherit; cursor: pointer; padding: 0; transition: transform .1s; }
.bc-outline-chev:hover { opacity: 1; background: rgba(0,0,0,.06); border-radius: 2px; }
/* Chev points right when collapsed, rotates to point down when the
   section is expanded (active). Matches the composer-book.html mockup. */
.bc-outline-section.active > .bc-outline-section-row .bc-outline-chev { transform: rotate(90deg); }
.bc-outline-section.active.is-collapsed > .bc-outline-section-row .bc-outline-chev { transform: rotate(0deg); }

/* Delete-section button — shows on row hover, red tint on hover to
   signal the destructive action. */
.bc-outline-section-del {
  border: 0; background: transparent; color: var(--text-subtle);
  font-size: 14px; line-height: 1; padding: 2px 6px; border-radius: 3px;
  cursor: pointer; opacity: 0;
  transition: opacity .1s, background .1s, color .1s;
}
.bc-outline-section-row:hover .bc-outline-section-del,
.bc-outline-section-del:focus { opacity: .7; }
.bc-outline-section-del:hover { opacity: 1; background: rgba(192,57,43,.12); color: #c0392b; }
/* Editable section row — active section renders an <input> in place of
   the static label so users can rename the volume/chapter/section
   inline. Input has no border at rest, gets a subtle background on
   focus so the rename mode is visible. */
.bc-outline-section-row.is-editable { cursor: text; }
.bc-outline-section-row.is-editable .bc-outline-chev { cursor: pointer; text-decoration: none; color: inherit; }
.bc-outline-section-rename {
  flex: 1; min-width: 0;
  border: none; background: transparent;
  font: inherit; font-weight: 600;
  color: var(--primary-dark); padding: 2px 4px;
  border-radius: 3px;
  outline: none;
}
.bc-outline-section-rename:hover { background: rgba(0,0,0,.04); }
.bc-outline-section-rename:focus { background: var(--bg); box-shadow: 0 0 0 1px var(--primary); }
.bc-outline-section-label { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: inherit; text-decoration: none; }
a.bc-outline-section-label:hover { color: inherit; }
.bc-outline-section-count { font-size: 10.5px; color: var(--text-subtle); }
.bc-outline-pages { display: flex; flex-direction: column; gap: 1px; }
.bc-outline-page { display: flex; align-items: center; gap: 5px; padding: 3px 6px 3px 24px; border-radius: 3px; font-size: 12px; color: var(--text-muted); text-decoration: none; }
.bc-outline-page:hover { background: var(--surface-warm); }
.bc-outline-page-num { width: 14px; height: 14px; border-radius: 2px; background: var(--surface-sunk); color: var(--text-subtle); display: inline-flex; align-items: center; justify-content: center; font-size: 9px; font-weight: 600; font-variant-numeric: tabular-nums; flex-shrink: 0; }
.bc-outline-page-label { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bc-outline-page.active { background: var(--primary); color: #fff; }
.bc-outline-page.active .bc-outline-page-num { background: rgba(255,255,255,.2); color: #fff; }
.bc-outline-empty { padding: 3px 6px 3px 24px; font-size: 11.5px; color: var(--text-subtle); font-style: italic; }
.bc-outline-standalone { display: flex; align-items: center; gap: 6px; padding: 5px 6px; border-radius: 3px; font-size: 12.5px; color: var(--text); text-decoration: none; }
.bc-outline-standalone:hover { background: var(--surface-warm); }
.bc-outline-standalone.active { background: var(--primary); color: #fff; }
.bc-outline-standalone-glyph { font-size: 11px; opacity: .7; flex-shrink: 0; }
.bc-outline-divider { height: 1px; background: var(--divider); margin: 8px -8px; }
.bc-untitled { font-style: italic; opacity: .55; font-weight: 400; }
.bc-pgref { color: var(--text-subtle); font-weight: 400; font-variant-numeric: tabular-nums; }

/* Preview modal — each page is its own paper sheet, stacked vertically on
   a soft background so scrolling feels like flipping through the book. */
.preview-overlay .preview-modal { max-width: 820px; width: calc(100vw - 40px); max-height: 90vh; display: flex; flex-direction: column; padding: 0; overflow: hidden; }
.preview-modal-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--divider); flex-shrink: 0; }
.preview-modal-body { flex: 1; overflow: auto; background: var(--surface-sunk); padding: 24px; }
.preview-stack { max-width: 680px; margin: 0 auto; display: flex; flex-direction: column; gap: 20px; }
.preview-sheet { background: var(--surface); border-radius: 6px; box-shadow: 0 4px 20px rgba(69,42,18,.12); padding: 48px 60px 56px; font-size: 14.5px; line-height: 1.7; color: var(--text); position: relative; min-height: 480px; }
.preview-sheet-cover { text-align: center; display: flex; flex-direction: column; justify-content: center; align-items: center; }
.preview-cover-eyebrow { font-size: 10.5px; letter-spacing: 1.5px; text-transform: uppercase; color: var(--text-muted); margin-bottom: 12px; }
.preview-cover-subtitle { color: var(--text-muted); font-size: 14px; margin-top: 8px; font-style: italic; }
.preview-sheet-cover h1 { font-size: 28px; font-weight: 700; letter-spacing: -.5px; line-height: 1.2; margin: 0; color: var(--text); }
.preview-sheet-divider { text-align: center; min-height: 240px; display: flex; align-items: center; justify-content: center; background: var(--surface-warm); }
.preview-sheet-divider h2 { font-size: 24px; font-weight: 600; margin: 0; color: var(--text); letter-spacing: -.2px; }
.preview-sheet-page h3 { font-size: 20px; font-weight: 600; margin: 0 0 18px; padding-bottom: 10px; border-bottom: 1px solid var(--divider); letter-spacing: -.2px; }
.preview-body { white-space: pre-wrap; }
.preview-body p { margin: 0 0 14px; }
.preview-sheet-footer { position: absolute; bottom: 18px; left: 0; right: 0; text-align: center; font-size: 11px; color: var(--text-subtle); letter-spacing: .3px; }
.preview-empty { text-align: center; color: var(--text-muted); font-style: italic; padding: 40px 20px; }
.bc-outline-addsection { width: 100%; padding: 6px 8px; font-size: 11.5px; color: var(--text-muted); border: 1px dashed var(--border); background: transparent; border-radius: 3px; cursor: pointer; text-align: left; }

.bc-outline-meta { padding: 10px 12px; border-top: 1px solid var(--divider); background: var(--surface-sunk); font-size: 11px; line-height: 1.7; }
.bc-outline-meta > div { display: flex; justify-content: space-between; }
.bc-outline-meta span:first-child { color: var(--text-muted); }
.bc-outline-meta .mono { font-family: 'JetBrains Mono', monospace; }

.bc-editor-pane { flex: 1; display: flex; flex-direction: column; overflow: hidden; background: var(--bg); }

.bc-topbar { display: flex; align-items: center; gap: 8px; padding: 8px 14px; background: var(--surface); border-bottom: 1px solid var(--border); font-size: 12px; flex-shrink: 0; }
.bc-topbar-crumbs { display: flex; align-items: center; gap: 8px; }

/* Empty-state panel — mirrors mockup's "Your book shell is ready" card. */
.bc-empty-state { max-width: 520px; margin: 48px auto; text-align: center; padding: 32px; background: var(--surface); border: 1px solid var(--border); border-radius: 8px; box-shadow: var(--shadow-1); }
.bc-empty-icon { width: 44px; height: 44px; border-radius: 8px; background: var(--surface-warm); margin: 0 auto 14px; display: flex; align-items: center; justify-content: center; font-size: 20px; }
.bc-empty-state h2 { font-size: 20px; margin: 0 0 8px; font-weight: 600; }
.bc-empty-state p { color: var(--text-muted); margin: 0 0 20px; font-size: 13.5px; line-height: 1.55; }
.bc-empty-actions { display: flex; gap: 8px; justify-content: center; margin-bottom: 20px; }
.bc-empty-facts { text-align: left; padding: 12px 14px; background: var(--surface-warm); border-radius: 6px; font-size: 12px; }
.bc-empty-facts > div { display: flex; justify-content: space-between; padding: 3px 0; }
.bc-empty-facts span:first-child { color: var(--text-muted); }
.bc-empty-facts .mono { font-family: 'JetBrains Mono', monospace; }

.bc-editor-footstrip { display: flex; align-items: center; gap: 14px; padding: 10px 4px; font-size: 11.5px; color: var(--text-muted); max-width: 900px; margin: 0 auto; width: 100%; }
.bc-grow { flex: 1; }

/* Manga editor */
.bc-manga-wrap { max-width: 1100px; margin: 0 auto; width: 100%; }
.bc-manga-head { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; font-size: 13px; font-weight: 600; }
.bc-manga-sub { font-weight: 400; font-size: 11.5px; }
.bc-manga-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.bc-manga-cell { position: relative; aspect-ratio: 3/4; background: var(--surface); border: 1px solid var(--border); border-radius: 4px; overflow: hidden; box-shadow: var(--shadow-1); }
.bc-manga-cell.bc-manga-drop { background: transparent; border: 1.5px dashed var(--border-strong); box-shadow: none; }
.bc-manga-cell.bc-manga-dragging { box-shadow: 0 8px 24px rgba(69,42,18,.25), 0 0 0 2px var(--primary); transform: rotate(-1.5deg) scale(1.02); opacity: .94; z-index: 5; }
.bc-manga-art { width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; color: rgba(255,255,255,.85); }
.bc-manga-hue-0 .bc-manga-art { background: linear-gradient(135deg, #8B3E10, #E8956A); }
.bc-manga-hue-1 .bc-manga-art { background: linear-gradient(155deg, #C4652A, #8B3E10); }
.bc-manga-hue-2 .bc-manga-art { background: linear-gradient(175deg, #D4814E, #C4652A); }
.bc-manga-hue-3 .bc-manga-art { background: linear-gradient(195deg, #E8956A, #6B4423); }
.bc-manga-hue-4 .bc-manga-art { background: linear-gradient(215deg, #6B4423, #D4814E); }
.bc-manga-hue-5 .bc-manga-art { background: linear-gradient(235deg, #A35220, #F5EBE0); }
.bc-manga-num { position: absolute; top: 4px; left: 4px; padding: 2px 5px; background: rgba(20,14,8,.7); color: #fff; border-radius: 2px; font-size: 10px; font-weight: 600; font-variant-numeric: tabular-nums; }
.bc-manga-grip { position: absolute; top: 4px; right: 4px; width: 20px; height: 20px; border-radius: 3px; border: 0; background: rgba(20,14,8,.55); color: #fff; cursor: grab; display: inline-flex; align-items: center; justify-content: center; font-size: 10px; }
/* Delete-page button — sits under the drag grip, only visible on cell
   hover so it doesn't clutter the thumbnail grid. */
.bc-manga-del {
  position: absolute; top: 28px; right: 4px;
  width: 20px; height: 20px; border-radius: 3px; border: 0;
  background: rgba(192,57,43,.7); color: #fff; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 13px; line-height: 1;
  opacity: 0; transition: opacity .12s, background .12s;
}
.bc-manga-cell:hover .bc-manga-del,
.bc-manga-del:focus { opacity: 1; }
.bc-manga-del:hover { background: rgba(192,57,43,1); }
.bc-manga-file { position: absolute; bottom: 0; left: 0; right: 0; padding: 4px 6px; background: rgba(20,14,8,.7); color: #fff; font-size: 10px; display: flex; justify-content: space-between; }
.bc-manga-file .bc-manga-size { color: rgba(255,255,255,.6); }
.bc-manga-uploading { background: var(--surface-sunk); }
.bc-manga-upload-inner { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; padding: 10px; }
.bc-progress { width: 70%; height: 3px; background: var(--border); border-radius: 2px; overflow: hidden; }
.bc-progress > div { height: 100%; background: var(--primary); }
.bc-manga-drop-inner { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; color: var(--text-subtle); font-size: 10.5px; }
/* Real image thumb fills the cell edge-to-edge; the num/grip/file bars
   already sit on top as absolutely-positioned overlays. */
.bc-manga-thumb { width: 100%; height: 100%; object-fit: cover; display: block; }
/* Drop cell is a <label for="bc-manga-upload"> — make it behave like a
   button so clicking anywhere on the cell opens the file picker. */
label.bc-manga-cell.bc-manga-drop { cursor: pointer; }
label.bc-manga-cell.bc-manga-drop:hover { background: var(--surface-warm); }

/* Series metadata panel (manga) — shows the 3 series covers and an
   authors input in the outline sidebar. Lives above the pages tree so
   book-level edits are always one click away regardless of which
   volume / page is active. */
.bc-outline-series { padding: 10px 12px; border-bottom: 1px solid var(--divider); font-size: 12px; }
.bc-outline-series-label { font-size: 10.5px; color: var(--text-muted); letter-spacing: .3px; text-transform: uppercase; margin-bottom: 6px; }
.bc-series-covers { margin: 0 0 6px; padding: 0; background: transparent; border: 0; gap: 8px; }
.bc-series-covers .bc-vol-cover { width: 56px; height: 76px; }
.bc-outline-authors-input {
  width: 100%; padding: 5px 8px; font-size: 12px;
  border: 1px solid var(--border); border-radius: 3px;
  background: var(--bg); color: var(--text); font-family: inherit;
}
.bc-outline-authors-input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 2px rgba(212,163,115,.2); }
.bc-outline-series-hint { margin-top: 4px; font-size: 10.5px; color: var(--text-subtle); }

/* Volume cover strip — shows the three physical covers of the active
   volume (front / back / spine). Each slot is a <label> wrapping a
   hidden file input; click opens the picker. Thumb or "+" placeholder
   rendered in-flow. */
.bc-vol-covers { display: flex; align-items: center; gap: 10px; margin: 10px 0 14px; padding: 10px 12px; background: var(--surface-warm); border: 1px solid var(--border); border-radius: 5px; font-size: 12px; color: var(--text-muted); }
.bc-vol-covers-label { font-weight: 600; color: var(--text); margin-right: 4px; }
.bc-vol-cover { position: relative; width: 64px; height: 88px; border-radius: 4px; overflow: hidden; background: var(--surface); border: 1px solid var(--border); cursor: pointer; display: flex; align-items: center; justify-content: center; transition: border-color .15s, box-shadow .15s; }
.bc-vol-cover:hover { border-color: var(--primary); box-shadow: 0 0 0 2px rgba(212,163,115,.2); }
.bc-vol-cover img { width: 100%; height: 100%; object-fit: cover; display: block; }
.bc-vol-cover-empty { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; color: var(--text-subtle); font-size: 18px; font-weight: 300; line-height: 1; }
.bc-vol-cover-empty span { font-size: 10px; color: var(--text-muted); font-weight: 500; }
.bc-vol-cover-tag { position: absolute; bottom: 0; left: 0; right: 0; padding: 2px 4px; background: rgba(20,14,8,.7); color: #fff; font-size: 9.5px; text-align: center; letter-spacing: .3px; text-transform: uppercase; }
.bc-vol-cover.is-uploading { opacity: .6; pointer-events: none; }
.bc-vol-cover.is-uploading::after {
  content: ''; position: absolute; inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,.4), transparent);
  animation: bc-vol-cover-shimmer 1.2s linear infinite;
}
@keyframes bc-vol-cover-shimmer { 0% { transform: translateX(-100%); } 100% { transform: translateX(100%); } }

/* Volume metadata strip — wraps the cover row and the per-volume
   authors / credits inputs in a single bordered block. */
.bc-vol-meta { margin: 0; padding: 0; background: transparent; border: 0; border-radius: 0; }
.bc-vol-meta .bc-vol-covers { margin: 0 0 8px; padding: 0; background: transparent; border: 0; }
.bc-vol-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

/* Right panel variant — narrower column, so covers row wraps / shrinks
   and the authors + credits fields stack vertically. */
.bc-vol-panel .bc-vol-covers { flex-wrap: wrap; gap: 8px; }
.bc-vol-panel .bc-vol-covers-label { width: 100%; margin: 0 0 4px; }
.bc-vol-panel .bc-vol-cover { width: 58px; height: 78px; }
.bc-vol-panel .bc-vol-fields { grid-template-columns: 1fr; gap: 10px; margin-top: 10px; }
.bc-vol-field { display: flex; flex-direction: column; gap: 4px; font-size: 12px; }
.bc-vol-field-label { font-size: 10.5px; color: var(--text-muted); letter-spacing: .3px; text-transform: uppercase; }
.bc-vol-field input {
  padding: 5px 8px; font-size: 12px;
  border: 1px solid var(--border); border-radius: 3px;
  background: var(--bg); color: var(--text); font-family: inherit;
}
.bc-vol-field input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 2px rgba(212,163,115,.2); }

/* Batch-upload progress bar — inserted above the grid while a batch is
   running so the user sees a live "X / N" and a visual fill. Removed on
   reload. */
.bc-manga-progress { display: flex; align-items: center; gap: 12px; margin: 6px 0 14px; font-size: 12px; color: var(--text-muted); }
.bc-manga-progress-track { flex: 1; height: 6px; background: var(--border); border-radius: 3px; overflow: hidden; }
.bc-manga-progress-fill { height: 100%; background: var(--primary); width: 0; transition: width .2s ease; }
.bc-manga-progress-label { white-space: nowrap; font-variant-numeric: tabular-nums; }
.bc-manga-foot { margin-top: 14px; display: flex; align-items: center; gap: 12px; padding: 10px 12px; background: var(--surface-warm); border: 1px solid var(--border); border-radius: 5px; font-size: 12px; color: var(--text-muted); }
.bc-manga-foot-ico { color: var(--primary-dark); }
html[data-theme="dark"] .bc-manga-foot-ico { color: var(--primary-light); }
.bc-manga-foot code { font-family: 'JetBrains Mono', monospace; font-size: 11px; background: var(--surface); padding: 1px 5px; border-radius: 2px; }

/* Study editor */
.bc-study-wrap { display: grid; grid-template-columns: 1fr 380px; gap: 16px; max-width: 1040px; margin: 0 auto; width: 100%; }
.bc-codeblock { background: var(--surface-sunk); padding: 10px 14px; border-radius: 4px; font-size: 12.5px; line-height: 1.7; margin: 10px 0 14px; }
.bc-err { background: var(--error-bg); color: var(--error); padding: 0 3px; border-radius: 2px; }
.bc-reading-foot { font-size: 12px; color: var(--text-muted); padding-top: 10px; border-top: 1px dashed var(--divider); }
.bc-study-questions { display: flex; flex-direction: column; gap: 10px; }
.bc-sq-head { display: flex; align-items: center; gap: 8px; font-size: 12.5px; font-weight: 600; }
.bc-qcard { background: var(--surface); border: 1px solid var(--border); border-radius: 5px; box-shadow: var(--shadow-1); overflow: hidden; }
.bc-qcard-editing { border: 1.5px solid var(--primary); box-shadow: var(--shadow-2); }
.bc-qcard-row { padding: 8px 10px; display: flex; align-items: center; gap: 8px; background: var(--surface); }
.bc-qcard-editing .bc-qcard-head { background: var(--surface-warm); border-bottom: 1px solid var(--divider); }
.bc-qgrip { opacity: .4; font-size: 11px; cursor: grab; }
.bc-qnum { width: 20px; height: 20px; border-radius: 10px; background: var(--surface-sunk); color: var(--text-muted); display: inline-flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 600; font-variant-numeric: tabular-nums; }
.bc-qnum.bc-qnum-active { background: var(--primary); color: #fff; }
.bc-qstem { font-size: 12.5px; flex: 1; color: var(--text); }
.bc-qstem.collapsed { color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bc-qcheck { font-size: 11px; color: var(--success); }
.bc-qcard-body { padding: 10px 12px; display: flex; flex-direction: column; gap: 6px; }
.bc-qopt { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border: 1px solid var(--border); background: var(--surface); border-radius: 3px; font-size: 12.5px; }
.bc-qopt.bc-qopt-correct { border-color: var(--success); background: var(--success-bg); }
.bc-qradio { width: 14px; height: 14px; border-radius: 7px; border: 1.5px solid var(--border-strong); background: var(--surface); display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; font-size: 9px; color: transparent; }
.bc-qradio.bc-qradio-on { border-color: var(--success); background: var(--success); color: #fff; }
.bc-qopt .mono { flex: 1; font-size: 12px; }
.bc-qopt-flag { font-size: 10px; color: var(--warning); }
.bc-qopt-x { background: none; border: 0; color: var(--text-subtle); cursor: pointer; padding: 2px; font-size: 14px; }
.bc-qopt-add { padding: 5px 8px; font-size: 11.5px; color: var(--text-muted); border: 1px dashed var(--border); background: transparent; border-radius: 3px; cursor: pointer; text-align: left; margin-top: 2px; }
.bc-qexpl { display: flex; align-items: center; gap: 10px; margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--divider); font-size: 11px; color: var(--text-muted); }
.bc-qexpl-text { flex: 1; font-style: italic; color: var(--text-subtle); }
.bc-new-question { padding: 10px; font-size: 12px; border: 1.5px dashed var(--border-strong); background: transparent; color: var(--text-muted); border-radius: 5px; cursor: pointer; }

@media (max-width: 900px) {
  .bc-study-wrap { grid-template-columns: 1fr; }
  .bc-manga-grid { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 640px) {
  .bc-manga-grid { grid-template-columns: repeat(2, 1fr); }
}

/* Manga view toggle */
.bc-view-toggle { display: inline-flex; border: 1px solid var(--border); border-radius: 4px; overflow: hidden; }
.bc-view-toggle .bc-vt { padding: 4px 10px; font-size: 13px; color: var(--text-muted); background: var(--surface); line-height: 1; }
.bc-view-toggle .bc-vt:hover { background: var(--surface-warm); color: var(--text); }
.bc-view-toggle .bc-vt.active { background: var(--primary); color: #fff; }
.bc-view-toggle .bc-vt + .bc-vt { border-left: 1px solid var(--border); }

/* Manga list view */
.bc-manga-list { display: flex; flex-direction: column; border: 1px solid var(--border); border-radius: var(--r-md); background: var(--surface); overflow: hidden; max-width: 760px; margin: 0 auto; }
.bc-manga-row { display: grid; grid-template-columns: 20px 32px 60px 1fr 32px; gap: 12px; align-items: center; padding: 8px 12px; border-bottom: 1px solid var(--divider); }
.bc-manga-row:last-child { border-bottom: 0; }
.bc-manga-row:hover { background: var(--surface-warm); }
.bc-manga-row-grip { color: var(--text-subtle); cursor: grab; font-size: 11px; }
.bc-manga-row-num { font-family: 'JetBrains Mono', monospace; font-size: 11.5px; color: var(--text-muted); text-align: center; }
.bc-manga-row-thumb { width: 60px; height: 80px; border-radius: 3px; overflow: hidden; display: flex; align-items: center; justify-content: center; color: rgba(255,255,255,.85); }
.bc-manga-row.bc-manga-drop .bc-manga-row-thumb { background: transparent; border: 1.5px dashed var(--border-strong); color: var(--text-subtle); }
.bc-manga-row.bc-manga-uploading .bc-manga-row-thumb { background: var(--surface-sunk); color: var(--text-muted); }
.bc-manga-row.bc-manga-dragging { box-shadow: 0 4px 16px rgba(69,42,18,.2), 0 0 0 2px var(--primary); position: relative; z-index: 2; }
.bc-manga-row-uploading { font-size: 10.5px; }
.bc-manga-row-drop { font-size: 22px; color: var(--text-subtle); }
.bc-manga-row-main { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.bc-manga-row-name { font-size: 12.5px; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bc-manga-row-meta { font-size: 11px; color: var(--text-muted); display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.bc-dot { color: var(--border-strong); }
.bc-progress-inline { display: inline-block; width: 80px; height: 3px; background: var(--border); border-radius: 2px; overflow: hidden; vertical-align: middle; }
.bc-progress-inline > span { display: block; height: 100%; background: var(--primary); }
.bc-manga-row-action { background: transparent; border: 0; color: var(--text-muted); cursor: pointer; padding: 4px 8px; border-radius: 3px; font-size: 16px; line-height: 1; }
.bc-manga-row-action:hover { background: var(--surface-sunk); color: var(--text); }

/* Right properties rail (manga) — integrated into editor, not a floating panel */
.bc-editor-with-props { flex-direction: row !important; padding: 0 !important; gap: 0; align-items: stretch; overflow: hidden !important; }
.bc-editor-with-props > .bc-manga-wrap { flex: 1; padding: 24px 20px; min-width: 0; order: 1; overflow-y: auto; }
.bc-props { flex: 0 0 240px; order: 2; background: var(--bg); border-left: 1px solid var(--divider); padding: 14px 18px 22px; display: flex; flex-direction: column; gap: 16px; overflow: hidden; position: relative; }
.bc-props-head { position: absolute; top: 10px; right: 12px; z-index: 1; }
.bc-props-title { display: none; } /* subsumed into the group labels */
.bc-lock { width: 24px; height: 24px; display: inline-flex; align-items: center; justify-content: center; border: 0; background: transparent; border-radius: 4px; cursor: pointer; color: var(--text-muted); font-size: 13px; padding: 0; opacity: .7; }
.bc-lock:hover { background: var(--surface-sunk); color: var(--text); opacity: 1; }
.bc-lock .bc-lock-icon-unlocked { display: none; }
.bc-props[data-locked="false"] .bc-lock { color: var(--primary-dark); opacity: 1; }
html[data-theme="dark"] .bc-props[data-locked="false"] .bc-lock { color: var(--primary-light); }
.bc-props[data-locked="false"] .bc-lock .bc-lock-icon-locked { display: none; }
.bc-props[data-locked="false"] .bc-lock .bc-lock-icon-unlocked { display: inline; }

.bc-props-group { display: flex; flex-direction: column; gap: 6px; }
.bc-props-label { font-size: 10.5px; text-transform: uppercase; letter-spacing: .08em; color: var(--text-muted); font-weight: 600; }
.bc-props-value { font-size: 13.5px; font-weight: 500; color: var(--text); line-height: 1.35; }
.bc-props-meta { font-size: 11.5px; color: var(--text-muted); margin-top: 2px; }
.bc-props-kv { display: flex; justify-content: space-between; gap: 8px; font-size: 11.5px; }
.bc-props-kv span:first-child { color: var(--text-muted); }
.bc-props-kv span:last-child { color: var(--text); font-weight: 500; }
.bc-props-kv .mono { font-size: 11px; }

.bc-props-input { width: 100%; font: inherit; font-size: 13.5px; font-weight: 500; color: var(--text); padding: 6px 8px; border: 1px solid transparent; background: transparent; border-radius: 4px; line-height: 1.35; }
.bc-props-input:read-only { padding-left: 0; padding-right: 0; cursor: default; }
.bc-props[data-locked="false"] .bc-props-input { border-color: var(--border); background: var(--bg); }
.bc-props[data-locked="false"] .bc-props-input:focus { outline: none; border-color: var(--primary); }

.bc-cover-slot { position: relative; width: 88px; aspect-ratio: 3 / 4; background: var(--surface-sunk); border: 1px solid var(--border); border-radius: 4px; overflow: hidden; align-self: flex-start; }
.bc-cover-slot .bc-cover-img { width: 100%; height: 100%; object-fit: cover; display: block; }
.bc-cover-placeholder { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; color: var(--text-subtle); font-size: 24px; }
.bc-cover-overlay { position: absolute; inset: 0; display: none; align-items: center; justify-content: center; background: rgba(0,0,0,.5); color: #fff; font-size: 11.5px; font-weight: 600; letter-spacing: .04em; cursor: pointer; }
.bc-props[data-locked="false"] .bc-cover-slot { cursor: pointer; }
.bc-props[data-locked="false"] .bc-cover-slot:hover .bc-cover-overlay { display: flex; }

@media (max-width: 900px) {
  .bc-editor-with-props { flex-direction: column !important; }
  .bc-props { flex: 0 0 auto; border-left: 0; border-top: 1px solid var(--border); }
}
