@import url('/core/_tokens.css');

:root{
 /* ── Neutral palette (B&W + gray) ── */
 --brand-green:#22C55E;  /* Green accent — used SPARINGLY */
 --brand-text:#111111;
 --acc-1:#F4F4F5;        /* zinc-100 — neutral surface */
 --acc-2:#F4F4F5;        /* zinc-100 — neutral surface */
 --acc-3:#F4F4F5;        /* zinc-100 — neutral surface */
 --accent: var(--brand-blue);
 --brand-fg: #111;
 /* UI tokens */
 --bg: var(--surface-1);
 --text: var(--brand-text);
 --radius: 14px;
 --radius-inner: 8px;
 --gap: 20px;
 --gap-lg: 24px;
 --shadow: 0 1px 2px rgba(0,0,0,.04), 0 2px 8px rgba(0,0,0,.03);
 --shadow-soft: 0 1px 2px rgba(0,0,0,.03), 0 2px 6px rgba(0,0,0,.02);
 /* Buttons */
 --btn-bg:var(--white);
 --btn-bd:#D4D4D8;
 --btn-text:#18181B;
 --btn-bg-hover:#F4F4F5;
 --btn-accent-bg:#18181B;
 --btn-accent-text:var(--white);
 --danger-bg:#FEF2F2;
 --danger-bd:#FECACA;
 /* Inputs */
 --input-bg:var(--white);
 --input-bd:#D4D4D8;
 --input-bd-focus:#18181B;
 /* Surfaces */
 --panel: var(--surface-1);
 /* Sidebar */
 --sidebar-w: 240px;
 --author-input-w: 180px;
 --ctrl-gap: 6px;
}

*{box-sizing:border-box}
html,body{height:100%}
body{
 margin:0;
 font-family:"Open Sans", ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial;
 background:var(--bg);
 color:var(--text);
 line-height:1.5;
 -webkit-font-smoothing: antialiased;
 -moz-osx-font-smoothing: grayscale;
}

/* ==================================================
   HEADER — FULL WIDTH + WHITESPACE BETWEEN SECTIONS
   ================================================== */
header{
 position:sticky; top:0; z-index:10;
 width:100%;
 background:var(--white);
 border-bottom:1px solid var(--border);
 padding:0;
}
header > .wrap{
 padding-left:0;
 padding-right:0;
}

details.floorbar{
 width:100%;
 border:none;
 border-radius:0;
 box-shadow:var(--shadow-soft);
 background:var(--panel);
 margin-bottom:22px;
}
details.floorbar > summary,
.floor-body{
 max-width:1100px;
 margin:0 auto;
 padding-left:18px;
 padding-right:18px;
}
details.floorbar > summary{
 display:flex; align-items:center; gap:12px;
 padding:12px 16px;
 background:transparent; border-bottom:0;
}
.floor-body{
 padding:8px 16px 14px;
 color:var(--brand-text);
 border-top:1px solid var(--border-2);
}
.floor-body .desc{ margin-top:6px; color:var(--muted); }
.floor-brand{ display:flex; align-items:center; gap:10px; flex-wrap:wrap; }
.org-logo{ height:22px; width:auto; }

/* ==================================================
   TYPOGRAPHY
   ================================================== */

.wrap{max-width:1100px; margin:0 auto; padding:14px 18px;}
h1,h2,h3,h4{
 font-family:"Outfit", ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial;
 letter-spacing:.2px; margin:0;
 color:var(--brand-text);
 text-wrap: balance;
}
h1{font-size:1.25rem;}
h2{font-size:1.15rem;}
h3{font-size:1rem;}
h4{font-size:.95rem;}

textarea, input, select {
 font-family: inherit !important;
}

/* =============================
   Core UI
   ============================= */
.toolbar{
 display:flex; flex-wrap:wrap; gap:10px; align-items:center; justify-content:space-between;
}
.btn{
 appearance:none; border:1px solid var(--btn-bd);
 background:var(--btn-bg); color:var(--btn-text);
 padding:9px 12px; border-radius:var(--radius-inner); cursor:pointer;
 box-shadow: none;
 font-weight:600; letter-spacing:.2px;
 transition-property: background, color, border-color, box-shadow, transform, filter, opacity;
 transition-duration: 0.15s;
 transition-timing-function: cubic-bezier(0.2, 0, 0, 1);
}
.btn:hover{background:var(--btn-bg-hover)}
.btn:active:not([disabled]){transform: scale(0.96)}
.btn.small{padding:6px 10px; font-size:.9rem}
.btn.add{ background:var(--brand-blue); color:var(--white); border-color:var(--brand-blue); }
.btn.add:hover{filter:brightness(0.95)}
.btn.ghost{background:transparent; border-color:var(--btn-bd); color:var(--muted)}
.btn.danger{background:var(--danger-bg); color:var(--danger); border-color:var(--danger-bd)}
.btn.danger:hover{filter:brightness(0.95)}
.btn[disabled]{opacity:.5; cursor:not-allowed}
.spacer{flex:1}
.save-indicator{display:inline-flex; align-items:center; gap:6px; color:var(--muted); font-size:.9rem;}
/* Save indicator dot — B&W tones + shape differentiate state (per decision #3). */
.dot{width:8px; height:8px; border-radius:50%; background:transparent; border:1.5px solid var(--muted); transition-property: background, box-shadow, border-color; transition-duration: 0.25s;}
.dot.ok{background:var(--brand-text); border-color:var(--brand-text); box-shadow: 0 0 0 3px rgba(24,24,27,.12);}
.dot.pending{background:var(--brand-text); border-color:var(--brand-text); box-shadow: 0 0 0 3px rgba(24,24,27,.22); animation: dot-pulse 1.2s ease-in-out infinite;}
@keyframes dot-pulse { 50% { box-shadow: 0 0 0 5px rgba(24,24,27,.08);} }
main{max-width:1100px; margin:24px auto; padding:0 18px 40px}
section{margin-bottom:40px;}
.card{
 background:var(--white);
 border: none;
 border-radius:var(--radius);
 box-shadow: 0 1px 2px rgba(0,0,0,.04), 0 2px 8px rgba(0,0,0,.03);
 padding:16px;
}
.section-head{
 display:flex; align-items:center; justify-content:space-between; gap:10px; margin-bottom:10px
}
.section-head .left{display:flex; align-items:center; gap:10px}
.kicker{font-size:.92rem; color:var(--muted)}

/* =============================
   Generic Panel Component
   ============================= */
.panel {
 background: var(--white);
 border: none;
 border-radius: var(--radius);
 box-shadow: 0 1px 2px rgba(0,0,0,.04), 0 2px 8px rgba(0,0,0,.03);
 padding: 16px;
}
.panel__summary {
 list-style: none;
 cursor: pointer;
 display: block;
 padding: 12px 14px;
 border-bottom: none;
 border-radius: var(--radius-inner);
 user-select: none;
}
.panel__summary::-webkit-details-marker { display: none; }
/* Color modifier — neutral with left accent bar */
.panel--primary .panel__summary {
 background: var(--white);
 color: var(--brand-text);
 border-left: 3px solid var(--brand-blue);
 font-weight: 600;
}
/* Subheaders inside panels — neutral gray */
.panel__subheader {
 display: flex;
 justify-content: space-between;
 align-items: flex-end;
 gap: var(--space-2);
 margin-bottom: var(--space-3);
 background: var(--acc-2);
 padding: var(--space-3) var(--space-4);
 border-radius: var(--radius-input);
 border-bottom: 1px solid var(--border);
}
.panel__subheader .btn.add.small {
 margin: 0;
}
.panel__table {
 border: 1px solid var(--border);
 border-radius: var(--radius-card);
}
.panel__table,
.panel__table .thead,
.panel__table .trow {
 background: var(--white);
}

/* Collection column-count variants (replaces :has() rules) */
.trow--2col { grid-template-columns: 1fr 1fr 90px; }
.trow--3col { grid-template-columns: 1fr 1fr 1fr 90px; }
.trow--4col { grid-template-columns: 1.1fr 1.1fr 0.8fr 0.8fr 80px; }
.panel__table .thead.trow--2col,
.panel__table .thead.trow--3col,
.panel__table .thead.trow--4col { display: grid; }

.panel__table .thead div {
 font-size: 0.82rem !important;
 font-weight: 600 !important;
 color: #52525B !important;
 line-height: 1.25;
 margin: 0;
}

/* Chip — neutral with accent text */
.chip{
 display:inline-flex; gap:6px; align-items:center; padding:6px 10px; border-radius:999px;
 border:1px solid var(--border-2); background:var(--white); color:var(--brand-text); font-size:.85rem;
 font-variant-numeric: tabular-nums;
}

label{display:block; font-size:.8125rem; color:var(--ink-2); margin-bottom:var(--space-3); font-weight:600; letter-spacing:.1px}
textarea, input, select{
 width:100%; border-radius:var(--radius-input); border:1px solid var(--input-bd);
 background:var(--input-bg); color:var(--text); padding:10px 12px; min-height:40px; font-size:0.9375rem; outline:none;
}
textarea:focus, input:focus, select:focus{
  border-color:var(--input-bd-focus) !important;
  box-shadow: var(--focus-ring) !important;
  outline: none !important;
}
textarea{min-height:88px; padding:var(--space-3); line-height:1.6; resize:vertical}

.btn:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(24,24,27,.22) !important;
}

/* Tables */
.table{
 width:100%; overflow:auto; border:1px solid var(--border); border-radius:var(--radius-inner); background:var(--white);
}
.thead, .trow{
 display:grid; gap:var(--space-4); align-items:center; padding:var(--space-3) var(--space-4); min-height:56px; border-bottom:1px solid var(--border); background:var(--white);
}
.thead{font-weight:700; color:#52525B}
.trow:last-child{border-bottom:0}
.cell-actions{display:flex; gap:6px; justify-content:flex-end}

/* Catalog grid */
.table.catalog .thead, .table.catalog .trow{
 grid-template-columns: 1.2fr 0.6fr 0.6fr 0.5fr 0.5fr 0.5fr 0.5fr 220px;
}
@media (max-width:900px){
 .table.catalog .thead{display:none}
 .table.catalog .trow{grid-template-columns:1fr}
 .table.catalog .trow .cell-actions{justify-content:flex-start}
}

/* Builder layout */
.stack-vertical{display:grid; grid-template-columns:1fr; gap:var(--space-4);}

/* Two-column grid used inside section cards */
.two-col-grid{display:grid; grid-template-columns:1fr 1fr; gap:var(--space-4);}
.span-full{grid-column:1 / -1;}

.table.fp .thead, .table.fp .trow{grid-template-columns: repeat(5, minmax(160px, 1fr)) 100px;}
@media (max-width:420px){
 .table.fp .thead, .table.fp .trow{grid-template-columns:1fr}
 .cell-actions{justify-content:flex-start}
}

/* Collapsible item cards — neutral with left accent */
details.item{
 border:none; border-radius:var(--radius-inner); overflow:hidden; background:var(--white);
 box-shadow: 0 1px 2px rgba(0,0,0,.04), 0 2px 8px rgba(0,0,0,.03);
}
summary{
 list-style:none; cursor:pointer; display:block; padding:12px 14px;
 background: var(--white);
 border-bottom:none;
 border-left: 3px solid var(--brand-blue);
 color: var(--brand-text);
 font-weight: 600;
}
summary::-webkit-details-marker{display:none}
.item-summary-row{
 display:grid; gap:8px; grid-template-columns:1.2fr 0.6fr 0.6fr; align-items:center;
}
.badge{
 display:inline-block; background:#F4F4F5; border:1px solid var(--border); border-radius:999px; padding:4px 8px; font-size:.8rem; color:#52525B;
 font-variant-numeric: tabular-nums;
}
.item-body{padding:16px; display:grid; gap:var(--gap); background:var(--white);}
.item-actions{display:flex; gap:6px; justify-content:flex-end; margin-bottom:8px}
.subgrid{display:grid; grid-template-columns:1fr; gap:16px}
.subheader{display:flex; align-items:center; justify-content:space-between; gap:10px}
.subheader h4{margin:0}

/* ============================
   Assignments header (two rows)
   ============================ */
.section-assign .section-head {
 display: grid;
 grid-template-columns: 1fr auto;
 grid-rows: auto auto;
 gap: 8px 20px;
}
.section-assign .section-head .left {
 grid-column: 1;
 grid-row: 1 / span 2;
 display: flex;
 flex-direction: column;
 justify-content: space-between;
 text-align: left;
 margin-top: 8px;
}
.section-assign .section-head .left .kicker {
 margin-bottom: 15px;
}
.section-assign .section-head .right {
 grid-column: 2;
 grid-row: 1 / span 2;
 display: flex;
 flex-direction: column;
 justify-content: space-between;
 align-items: flex-end;
 gap: 8px;
}
.section-assign .section-head .right select {
 width: auto;
 min-width: 220px;
}
.section-assign .section-head .right .assign-actions {
 display: flex;
 gap: 8px;
 flex-wrap: wrap;
}

/* Section headers — all neutral */
.section-assign .section-head h2,
.section-global .section-head h2,
.section-apps .section-head h2,
.section-dp .section-head h2 { color: var(--brand-text); }
.section-assign .card.accent,
.section-global .card.accent,
.section-apps .card.accent,
.section-dp .card.accent { background:var(--white); border:none; }

.ht-author-row{
 display: grid;
 grid-template-columns: var(--author-input-w) var(--author-input-w);
 gap: var(--ctrl-gap);
}
.ht-author-row input{
 width: var(--author-input-w) !important;
}
.ht-lang-row{
 display: flex;
 justify-content: flex-end;
}
.ht-lang-row select{
 width: var(--author-input-w) !important;
 min-width: var(--author-input-w);
 max-width: var(--author-input-w);
}
@media (max-width: 480px){
 .ht-author-row{
  grid-template-columns: 1fr;
 }
 .ht-author-row input{
  width: 100% !important;
 }
 .ht-lang-row select{
  width: 100% !important;
  min-width: 0;
  max-width: none;
 }
}

.section-assign .section-head .left {
 justify-self: start;
 text-align: left;
 align-items: flex-start;
}

.ht-top-right{
 display: flex;
 flex-direction: column;
 align-items: flex-end;
 gap: 6px;
}

/* validation */
.field-group {
 display: flex;
 flex-direction: column;
}
.field-error {
 color: var(--danger);
 font-size: 12px;
 margin-top: var(--space-2);
}
.is-invalid {
 outline: 2px solid #f1a9a0;
 outline-offset: 1px;
}

/* SUPPLY */
.supply-row{
 display: grid;
 gap: 0;
 grid-template-rows: auto auto;
 border-bottom: 1px solid var(--border);
 background: var(--white);
}
.supply-top{
 display: grid;
 gap: 8px;
 align-items: center;
 padding: 10px;
 grid-template-columns: 1.1fr 0.8fr 0.6fr 100px;
 border-top: 1px solid var(--border);
}
.supply-lists{
 display: grid;
 gap: 12px;
 padding: 10px 10px 14px;
 grid-template-columns: 1fr 1fr 1fr;
 align-items: start;
 border-top: 1px solid var(--border-2);
 background: var(--white);
}
.supply-lists .stacked{
 display: flex;
 flex-direction: column;
 gap: 6px;
}
.supply-lists .stacked label{
 margin: 0;
 font-weight: 600;
 color: #52525B;
}
.table .trow.supply-row {
 display: block;
}

.input-euro {
 position: relative;
 display: block;
 width: 100%;
 font-family: "Open Sans", ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial !important;
 font-size: 1rem;
 line-height: 1.5;
 font-weight: 600;
}
.input-euro::before {
 content: "€";
 position: absolute;
 left: 12px;
 top: 50%;
 transform: translateY(-50%);
 font-family: inherit;
 font-size: inherit;
 line-height: 1;
 font-weight: inherit;
 color: var(--muted);
 pointer-events: none;
 z-index: 2;
}
.input-euro > input[type="number"] {
 width: 100%;
 padding-left: 38px !important;
 appearance: textfield;
 font-family: inherit;
 font-size: 1rem;
 line-height: 1.5;
}

/* Application/Data Product item cards — neutral */
#appsList details.item{
  background: var(--white);
  border: none;
  border-radius: var(--radius-inner);
  padding: 0;
  overflow: hidden;
  margin: 0;
  box-shadow: 0 1px 2px rgba(0,0,0,.04), 0 2px 8px rgba(0,0,0,.03);
}

.panel__summary .item-summary-row{
  display: flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
  overflow: hidden;
}

.panel__summary .badge{
  font-size: 12px;
  line-height: 18px;
  padding: 0 6px;
  border-radius: 10px;
}

.panel__summary.panel__summary--primary{
  padding-right: 40px;
}

@media (max-width: 560px){
  .panel__summary .item-summary-row{
    white-space: normal;
  }
  details > summary.panel__summary--primary::after{
    top: 1.15em;
    transform: translateY(-50%);
  }
}

summary::-webkit-details-marker { 
  display: none;
}
summary::marker {
  content: "";
}

/* Custom arrow — dark on white */
.panel__summary {
  position: relative;
  padding-right: 32px;
}

.panel__summary::after {
  content: "";
  position: absolute;
  right: 16px;
  top: 50%;
  width: 8px;
  height: 8px;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: translateY(-50%) rotate(-45deg);
  pointer-events: none;
  opacity: 0.5;
  transition: transform .15s cubic-bezier(0.2,0,0,1);
}

details[open] > .panel__summary::after {
  transform: translateY(-50%) rotate(45deg);
}

.panel.item-card > details.item,
.panel.item-card > details.item[open] {
  border: none !important;
  outline: none !important;
  box-shadow: none !important;
  background: transparent !important;
  margin: 0 !important;
  padding: 0 !important;
}

.panel.item-card details.item .item-body {
  padding: 16px 0 0;
}

.panel__summary,
.panel__summary--primary {
  border: none !important;
  box-shadow: none !important;
}

.menu-card .panel__table .trow input[type="text"],
.menu-card .panel__table .trow input[type="url"],
.menu-card .panel__table .trow textarea {
  width: 100%;
  max-width: 100%;
}
.menu-card .panel__table .trow .opt-wrap {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  justify-self: start;
}
.menu-card .panel__table .trow .cell-actions {
  justify-self: end;
  display: flex;
  gap: 6px;
}

#pubQaHead {
  display: grid;
  grid-template-columns: 1.1fr 1.1fr 0.8fr 0.8fr 80px;
  align-items: center;
}

.supply-meta {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--gap, 20px);
  margin-top: 16px;
}

@media(max-width: 800px) {
  .supply-meta {
    grid-template-columns: 1fr;
  }
}

#supplyList.subgrid {
  display: grid;
  gap: var(--gap, 20px);
}

.item-card {
  padding: 16px;
}

.item-card .item-summary-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.item-card .item-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  margin-bottom: 16px;
}

.field-group label {
  font-weight: 600;
}

.field-group input,
.field-group textarea,
.field-group select {
  width: 100%;
}

/* Assignment Section — sits outside .page-content, needs matching x-padding */
#assignmentSection {
  padding: 0 32px 32px;
}

/* Assignment Section — neutral treatment */
#assignmentSection .section-head h2 {
  color: var(--brand-text) !important;
}
#assignmentSection .panel--primary .panel__summary {
  background: var(--white) !important;
  color: var(--brand-text) !important;
  border-left: 3px solid var(--brand-text) !important;
}
#assignmentSection .panel__subheader {
  background: var(--acc-2) !important;
  color: var(--brand-fg, #111) !important;
}

#infoRulesCard .panel__summary {
  background: var(--panel);
  color: var(--brand-text);
  font-weight: 700;
}

/* Message containers — subtle neutral */
.info-msg {
  display: flex;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-inner);
  border: 1px solid var(--border);
  align-items: flex-start;
}
/* Info-msg variants: B&W only — the .icon glyph carries the semantic. */
.info-msg.negative { background: #F4F4F5; border-color: var(--border); border-left: 3px solid var(--brand-text); }
.info-msg.positive { background: #F4F4F5; border-color: var(--border); border-left: 3px solid var(--brand-text); }
.info-msg.neutral  { background: #F4F4F5; border-color: var(--border); }

.info-msg .icon { font-size: 20px; margin-top: 2px; }
.info-msg .text { font-size: 0.95rem; color: var(--brand-text); }

/* =====================================================
   View system
   ===================================================== */

#activeViewSelect {
  margin-left: 4px;
  padding: 4px 8px;
  border: 1px solid var(--border);
  border-radius: 6px;
}
.vw-divider { opacity: 0.5; margin: 0 4px; }

.view-rule-warning {
  display: flex;
  gap: 10px;
  padding: 10px 12px;
  margin: 8px 0;
  border-radius: var(--radius-inner);
  border: 1px solid var(--border);
  border-left: 3px solid var(--brand-text);
  background: #FAFAFA;
}
/* Rule-warning variants: B&W only — the .icon glyph carries the semantic. */
.view-rule-warning.negative { background: #F4F4F5; border-color: var(--border); }
.view-rule-warning.positive { background: #F4F4F5; border-color: var(--border); }
.view-rule-warning.neutral  { background: #F4F4F5; border-color: var(--border); }
.view-rule-warning .icon { font-size: 18px; line-height: 1; }
.view-rule-warning .text { font-size: 0.9rem; color: var(--brand-text); }

.view-custom-fields-card {
  margin-top: 12px;
  border: 1px dashed var(--border-2);
  background: #FAFAFA;
}

.view-editor-grid {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 16px;
  padding: 12px;
}
.vw-left { display: flex; flex-direction: column; gap: 8px; }
.vw-list-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.vw-view-list {
  list-style: none;
  padding: 0;
  margin: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-inner);
  background: var(--white);
  max-height: 60vh;
  overflow-y: auto;
}
.vw-view-list-item {
  padding: 8px 12px;
  cursor: pointer;
  border-bottom: 1px solid var(--border);
}
.vw-view-list-item:last-child { border-bottom: none; }
.vw-view-list-item.selected { background: #F4F4F5; font-weight: 600; color: var(--brand-blue); }
.vw-right { display: flex; flex-direction: column; gap: 8px; }
.vw-textarea {
  width: 100%;
  min-height: 50vh;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 13px;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-inner);
  background: #FAFAFA;
  box-sizing: border-box;
  line-height: 1.65;
  tab-size: 2;
  resize: vertical;
}
.vw-validation-status { font-size: 0.9rem; min-height: 1.2em; padding: 8px 12px; border-radius: var(--radius-inner); background: #F4F4F5; border: 1px solid var(--border); }
.vw-validation-status:empty { display: none; }
/* Validation status: B&W only — text + weight differentiates. */
.vw-validation-status .vw-err  { color: var(--brand-text); white-space: pre-wrap; font-weight: 600; }
.vw-validation-status .vw-ok   { color: var(--brand-text); font-weight: 600; }
.vw-validation-status .vw-warn { color: var(--muted); }
.vw-actions { display: flex; gap: 8px; justify-content: flex-end; }

/* ===================================================
   UX POLISH — Toast & Dialog
   =================================================== */

.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9990;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}
.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  border-radius: var(--radius-inner);
  background: #18181B;
  color: var(--white);
  font-size: 0.875rem;
  font-weight: 500;
  box-shadow: 0 4px 20px rgba(0,0,0,.18), 0 1px 4px rgba(0,0,0,.1);
  pointer-events: auto;
  cursor: pointer;
  max-width: 360px;
  width: max-content;
  animation: toast-in 0.2s cubic-bezier(0.2,0,0,1) both;
}
.toast.toast-exit { animation: toast-out 0.15s cubic-bezier(0.2,0,0,1) both; }
/* Toast background is uniform B&W; the icon character differentiates state. */
.toast.success { background: #18181B; }
.toast.error   { background: #18181B; }
.toast.info    { background: #18181B; }
.toast-icon { font-size: 0.95rem; flex-shrink: 0; }

@keyframes toast-in {
  from { opacity: 0; transform: translateX(16px); }
  to   { opacity: 1; transform: translateX(0); }
}
@keyframes toast-out {
  from { opacity: 1; transform: translateX(0); }
  to   { opacity: 0; transform: translateX(16px); }
}

.dialog-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: rgba(0,0,0,.35);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  animation: dialog-bg-in 0.15s ease both;
}
[hidden] { display: none !important; }
.dialog-overlay.hidden { display: none; }
.dialog-box {
  background: var(--white);
  border-radius: 16px;
  box-shadow: 0 24px 64px rgba(0,0,0,.22), 0 4px 16px rgba(0,0,0,.1);
  padding: 28px 24px 20px;
  max-width: min(420px, calc(100vw - 32px));
  width: 100%;
  animation: dialog-in 0.18s cubic-bezier(0.2,0,0,1) both;
}
.dialog-icon { font-size: 1.75rem; line-height: 1; margin-bottom: 12px; }
.dialog-title {
  font-family: "Outfit", ui-sans-serif, system-ui;
  font-size: 1.1rem; font-weight: 700;
  color: var(--brand-text);
  margin: 0 0 6px;
  text-wrap: balance;
}
.dialog-message {
  font-size: 0.9rem;
  color: var(--muted);
  margin: 0 0 20px;
  line-height: 1.55;
  text-wrap: pretty;
}
.dialog-actions { display: flex; gap: 8px; justify-content: flex-end; }
@keyframes dialog-bg-in {
  from { opacity: 0; } to { opacity: 1; }
}
@keyframes dialog-in {
  from { opacity: 0; transform: scale(0.95) translateY(8px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}

/* ================================================================
   APP SHELL — Sidebar, Pages, Builder Cards
   ================================================================ */

body { overflow: hidden; }

.app-layout {
  display: flex;
  height: 100vh;
  overflow: hidden;
  background: var(--bg);
}

/* ── Sidebar — White, minimal ── */
.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: #FFFFFF;
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  overflow-x: hidden;
  z-index: 20;
  scrollbar-width: thin;
  scrollbar-color: var(--border-2) transparent;
  container: sidebar / inline-size;
}
/* No horizontal overflow: ensure flex/grid children can shrink */
.sidebar,
.sidebar * {
  min-width: 0;
}
.sidebar img,
.sidebar svg {
  max-width: 100%;
  height: auto;
}
.sidebar::-webkit-scrollbar { width: 4px; }
.sidebar::-webkit-scrollbar-track { background: transparent; }
.sidebar::-webkit-scrollbar-thumb { background: var(--border-2); border-radius: 4px; }

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-5) var(--space-4) var(--space-4);
  border-bottom: 1px solid var(--border);
  min-width: 0;
}
/* Logo: clean, minimal, never overflows. Hides automatically when
   the sidebar is too narrow to display it cleanly. */
.sidebar-org-logo {
  display: block;
  height: 28px;
  max-width: 100%;
  width: auto;
  object-fit: contain;
  object-position: left center;
  flex: 0 1 auto;
  min-width: 0;
}
@container sidebar (max-width: 140px) {
  .sidebar-org-logo { display: none; }
}
/* Fallback for browsers without container queries: hide at collapse width */
@media (max-width: 720px) {
  .sidebar-org-logo { display: none; }
}
.sidebar-brand-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
  flex: 1 1 auto;
  overflow: hidden;
}
.sidebar-app-name {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sidebar-app-name {
  font-family: "Outfit", sans-serif;
  font-size: .9rem;
  font-weight: 700;
  color: var(--brand-text);
  line-height: 1.2;
}
.sidebar-floor-name {
  font-size: .72rem;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  padding: 8px 0;
  flex: 1;
}
.sidebar-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 16px;
  color: #52525B;
  text-decoration: none;
  font-size: .85rem;
  font-weight: 500;
  border-left: 3px solid transparent;
  border-radius: 0;
  transition: color .12s, background .12s, border-color .12s;
  cursor: pointer;
}
.sidebar-item:hover {
  background: #F4F4F5;
  color: #18181B;
}
.sidebar-item.active {
  background: #F4F4F5;
  color: var(--brand-blue);
  font-weight: 600;
  border-left-color: var(--brand-blue);
}
.sidebar-icon {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  opacity: .6;
}
.sidebar-item.active .sidebar-icon { opacity: 1; }

/* ── Sidebar tabs (Fill / Build) ── */
.sidebar-tabs {
  display: flex;
  gap: 4px;
  padding: 10px 10px 8px;
  border-bottom: 1px solid var(--border);
}
.sidebar-panel[data-panel="fill"],
.sidebar-panel[data-panel="build"] {
  padding-top: 6px;
}
.sidebar-tab {
  flex: 1;
  padding: 5px 8px;
  font-size: .78rem;
  font-weight: 500;
  font-family: inherit;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  transition: background .12s, color .12s, border-color .12s;
}
.sidebar-tab:hover {
  background: var(--acc-1);
  color: var(--brand-text);
  border-color: var(--border-2);
}
.sidebar-tab.active {
  background: #18181B;
  color: var(--white);
  border-color: #18181B;
}

/* ── Prospectus context strip ── */
.sidebar-context-strip {
  padding: 8px 14px 10px;
  border-bottom: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.sidebar-context-name {
  font-size: .8rem;
  font-weight: 600;
  color: var(--brand-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.3;
}
.sidebar-context-badge {
  display: inline-flex;
  align-items: center;
  align-self: flex-start;
  padding: 2px 7px;
  border-radius: 99px;
  font-size: .67rem;
  font-weight: 600;
  letter-spacing: .3px;
  text-transform: uppercase;
}
.sidebar-context-badge.badge-draft        { background: #FEF3C7; color: #92400E; }
.sidebar-context-badge.badge-review       { background: #DBEAFE; color: #1E40AF; }
.sidebar-context-badge.badge-publication  { background: #D1FAE5; color: #065F46; }
.sidebar-context-badge.badge-granted      { background: #D1FAE5; color: #065F46; }
.sidebar-context-badge.badge-cancelled    { background: #FEE2E2; color: #991B1B; }
.sidebar-context-badge.badge-default      { background: var(--acc-1); color: var(--muted); }

.sidebar-subnav {
  display: flex;
  flex-direction: column;
  padding: 4px 0;
}
.sidebar-subitem {
  display: flex;
  align-items: center;
  padding: 6px 14px 6px 42px;
  font-size: .8rem;
  color: #71717A;
  text-decoration: none;
  border-left: 3px solid transparent;
  transition: color .12s, background .12s, border-color .12s;
  border-radius: 0;
}
.sidebar-subitem:hover {
  color: #18181B;
  background: #F4F4F5;
}

/* ── Section completion dots ── */
.section-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-left: auto;
  flex-shrink: 0;
  background: var(--border-2);
  transition: background .2s, box-shadow .2s;
}
.section-dot.dot-filled  { background: var(--brand-text); box-shadow: 0 0 0 2px rgba(24,24,27,.15); }
.section-dot.dot-partial { background: transparent; box-shadow: inset 0 0 0 2px var(--brand-text); }
.sidebar-subitem.active-section .section-dot { box-shadow: 0 0 0 3px rgba(24,24,27,.18); }

.sidebar-spacer { flex: 1; }

.sidebar-footer {
  padding: 12px 12px;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.sidebar-input {
  width: 100%;
  padding: 6px 8px;
  font-size: .78rem;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: #FAFAFA;
  color: var(--brand-text);
  outline: none;
  transition: border-color .15s, background .15s;
}
.sidebar-input::placeholder { color: var(--muted); }
.sidebar-input:focus {
  border-color: var(--brand-blue);
  background: var(--white);
  box-shadow: 0 0 0 2px rgba(24,24,27,.08);
}
.sidebar-lang {
  width: 100%;
  padding: 6px 8px;
  font-size: .78rem;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: #FAFAFA;
  color: var(--brand-text);
  cursor: pointer;
  outline: none;
}
.sidebar-lang option { background: var(--white); color: var(--brand-text); }

/* ── Main content area ── */
.app-main {
  flex: 1;
  overflow-y: auto;
  min-width: 0;
}

.page {
  min-height: 100%;
  display: flex;
  flex-direction: column;
}

/* ── Page header ── */
.page-header {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--white);
  border-bottom: 1px solid var(--border);
  padding: 16px 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.page-header-left {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}
.page-header-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}
.page-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--brand-text);
  margin: 0;
}
.page-subtitle {
  font-size: .8rem;
  color: var(--muted);
  margin: 2px 0 0;
}

.builder-header { padding: 12px 24px; }
.builder-header .save-indicator { font-size: .83rem; }
.view-label { font-size: .83rem; color: var(--muted); white-space: nowrap; }

/* ── Page content — generous spacing ── */
.page-content {
  padding: var(--space-9) var(--space-9) calc(var(--space-9) + var(--space-3));
  flex: 1;
  max-width: 1140px;
  width: 100%;
  margin: 0 auto;
}

.catalog-util-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.util-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: .8rem;
  color: var(--muted);
  cursor: pointer;
  user-select: none;
}
.util-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.content-card {
  background: var(--white);
  border: none;
  border-radius: var(--radius);
  box-shadow: 0 1px 2px rgba(0,0,0,.04), 0 2px 8px rgba(0,0,0,.03);
  overflow: hidden;
}

/* ── Builder sections — breathing room ── */
.builder-section {
  margin-bottom: var(--space-7);
}
.builder-section:last-child { margin-bottom: 0; }

.section-card {
  background: var(--white);
  border: none;
  border-left: 4px solid var(--brand-blue);
  border-radius: var(--radius-card);
  box-shadow: 0 1px 2px rgba(0,0,0,.04), 0 2px 8px rgba(0,0,0,.03);
  overflow: hidden;
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  padding: var(--space-5) var(--space-6) var(--space-3);
  background: var(--white);
}
.card-header-left {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.card-header-left h2 {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--brand-text);
  letter-spacing: .1px;
}
.card-header-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}
.card-subtitle {
  font-size: .82rem;
  color: #52525B;
  margin-top: 2px;
  line-height: 1.45;
}

.card-body {
  padding: var(--space-5) var(--space-6) var(--space-6);
}
.card-body--list {
  padding: var(--space-3) var(--space-6) var(--space-6);
}
.card-body--list .subgrid { padding: 0; }

/* ── Staggered card entrance ── */
.builder-section {
  animation: card-in .25s cubic-bezier(0.2,0,0,1) both;
}
.builder-section:nth-child(1) { animation-delay: 0ms; }
.builder-section:nth-child(2) { animation-delay: 60ms; }
.builder-section:nth-child(3) { animation-delay: 120ms; }
.builder-section:nth-child(4) { animation-delay: 180ms; }
.builder-section:nth-child(5) { animation-delay: 240ms; }

/* Skip animation on initial page load */
.app-main.no-anim .builder-section { animation: none; }

@keyframes card-in {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ================================================================
   VIEW EDITOR MODAL
   ================================================================ */

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.35);
  z-index: 100;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 24px;
  overflow-y: auto;
  backdrop-filter: blur(2px);
}
.modal-overlay[hidden] { display: none; }

.modal-panel {
  background: var(--white);
  border-radius: 16px;
  box-shadow: 0 24px 60px rgba(0,0,0,.18);
  width: 100%;
  max-width: 1060px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  max-height: calc(100vh - 48px);
}

.vwe-modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: 20px 24px 16px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.vwe-modal-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--brand-text);
  margin: 0 0 2px;
}
.vwe-modal-sub {
  font-size: .78rem;
  color: var(--muted);
  margin: 0;
}

.vwe-body {
  display: grid;
  grid-template-columns: 220px 1fr;
  align-items: start;
  gap: 0;
}

.vwe-left {
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 16px;
  background: #FAFAFA;
}
.vwe-list-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-bottom: 12px;
}
.vw-view-list {
  list-style: none;
  margin: 0;
  padding: 0;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.vw-view-list-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  padding: 7px 10px;
  border-radius: var(--radius-inner);
  cursor: pointer;
  font-size: .82rem;
  color: var(--text);
  transition: background .1s;
  border: 1px solid transparent;
}
.vw-view-list-item:hover:not(.selected) { background: #F4F4F5; }
.vw-view-list-item.selected {
  background: #F4F4F5;
  border-color: var(--border-2);
  color: var(--brand-blue);
  font-weight: 600;
}
.vw-readonly-badge {
  font-size: .68rem;
  padding: 2px 5px;
  background: #F4F4F5;
  border: 1px solid var(--border-2);
  border-radius: 999px;
  color: var(--muted);
  white-space: nowrap;
  flex-shrink: 0;
}
.vwe-delete-row { margin-top: 10px; }
.vwe-delete-row .btn { width: 100%; justify-content: center; }

.vwe-right {
  display: flex;
  flex-direction: column;
  padding: 20px 24px;
  gap: 16px;
}

.vwe-name-row {
  display: flex;
  align-items: center;
  gap: 10px;
}
.vwe-name-label {
  font-size: .82rem;
  font-weight: 600;
  color: var(--muted);
  white-space: nowrap;
}
.vwe-name-input {
  flex: 1;
  padding: 8px 12px;
  border: 1px solid var(--border-2);
  border-radius: var(--radius-inner);
  font-size: .9rem;
  font-family: inherit;
  outline: none;
  transition: border-color .15s;
}
.vwe-name-input:focus { border-color: var(--brand-blue); box-shadow: 0 0 0 2px rgba(24,24,27,.08); }
.vwe-name-input:disabled { background: #F4F4F5; color: var(--muted); }

.vwe-status {
  font-size: .8rem;
  min-height: 1.5em;
  padding: 0 2px;
}
.vwe-status .vw-ok  { color: #16a34a; }
.vwe-status .vw-err { color: var(--danger); }
.vwe-status .vw-warn { color: #d97706; }

/* ── C3: editor shell (document + sticky overview rail) ── */
.vwe-editor {
  display: grid;
  grid-template-columns: 1fr 250px;
  gap: 20px;
  align-items: start;
  min-height: 120px;
}

.vwe-doc {
  display: flex;
  flex-direction: column;
  gap: 0;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 8px 24px 24px;
  box-shadow: var(--shadow-soft);
  min-width: 0;
}

/* Shared drag grip */
.vwe-grip {
  cursor: grab;
  color: var(--border-2);
  font-size: 1rem;
  line-height: 1;
  padding: 2px 4px;
  border-radius: 4px;
  flex-shrink: 0;
  opacity: 0;
  transition: opacity .12s, color .12s;
}

/* ── Document section ── */
.vwe-sec {
  padding: 16px 0;
  border-bottom: 1px solid var(--border);
  user-select: none;
}
.vwe-sec:last-child { border-bottom: none; }
.vwe-sec.dragging { opacity: .4; }
.vwe-sec.drag-over { box-shadow: 0 -2px 0 var(--brand-blue); }
.vwe-sec.excluded { opacity: .55; }
.vwe-sec.excluded .vwe-field-list,
.vwe-sec.excluded .vwe-mock-ctrl { filter: grayscale(1); }

.vwe-sec-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border);
}
.vwe-sec:hover > .vwe-sec-header .vwe-grip { opacity: 1; color: var(--muted); }

.vwe-sec-title {
  font-family: Outfit, system-ui, sans-serif;
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--brand-text);
  flex: 1;
  min-width: 0;
  border-radius: 6px;
  padding: 2px 6px;
  margin: -2px -6px;
  outline: none;
}

.vwe-count-chip {
  font-size: .72rem;
  font-variant-numeric: tabular-nums;
  color: var(--muted);
  background: #F4F4F5;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 2px 8px;
  white-space: nowrap;
  flex-shrink: 0;
}

.vwe-sec-hide {
  font-size: .76rem;
  color: var(--muted);
  background: none;
  border: 1px solid transparent;
  border-radius: 6px;
  cursor: pointer;
  padding: 3px 8px;
  flex-shrink: 0;
  opacity: 0;
  transition: opacity .12s, background .12s, border-color .12s;
}
.vwe-sec:hover > .vwe-sec-header .vwe-sec-hide { opacity: 1; }
.vwe-sec-hide:hover { background: #F4F4F5; border-color: var(--border); color: var(--brand-text); }
.vwe-sec.excluded > .vwe-sec-header .vwe-sec-hide { opacity: 1; }

/* ── Field list / blocks ── */
.vwe-field-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.vwe-field {
  display: grid;
  grid-template-columns: 20px 1fr auto;
  align-items: start;
  gap: 8px;
  padding: 6px 8px;
  border-radius: 8px;
  border: 1px solid transparent;
  transition: background .1s, border-color .1s;
}
.vwe-field:hover { background: #FAFAFA; border-color: var(--border); }
.vwe-field:hover .vwe-grip { opacity: 1; color: var(--muted); }
.vwe-field.dragging { opacity: .35; }
.vwe-field.drag-over { box-shadow: inset 0 2px 0 var(--brand-blue); }

.vwe-field .vwe-grip { cursor: grab; align-self: center; }

.vwe-field-body { min-width: 0; grid-column: 2; }
.vwe-field-label-line {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 5px;
}
.vwe-field-label {
  font-size: .85rem;
  font-weight: 600;
  color: var(--brand-text);
  border-radius: 5px;
  padding: 1px 5px;
  margin: -1px -5px;
  outline: none;
  max-width: 100%;
}
.vwe-field-label:empty::before {
  content: attr(data-placeholder);
  color: var(--muted);
  font-weight: 400;
  font-style: italic;
}

.vwe-req-star { color: var(--brand-blue); font-size: .8rem; flex-shrink: 0; }
.vwe-req-star[hidden] { display: none; }

.vwe-invalid-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--danger, #c0392b);
  flex-shrink: 0;
}
.vwe-invalid-dot[hidden] { display: none; }

/* Greyed mock control so the row reads like the real form */
.vwe-mock-ctrl {
  height: 28px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: repeating-linear-gradient(
    -45deg, #FAFAFA, #FAFAFA 6px, #F4F4F5 6px, #F4F4F5 12px);
}
.vwe-mock-ctrl.tall { height: 52px; }

.vwe-field-acts {
  display: flex;
  align-items: center;
  gap: 4px;
  opacity: 0;
  transition: opacity .12s;
}
.vwe-field:hover .vwe-field-acts { opacity: 1; }
.vwe-field-act {
  width: 26px;
  height: 26px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: .85rem;
  color: var(--muted);
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 6px;
  cursor: pointer;
  transition: background .1s, color .1s, border-color .1s;
}
.vwe-field-act:hover { background: #F4F4F5; color: var(--brand-text); border-color: var(--border-2); }
.vwe-field-act.on { color: var(--brand-blue); border-color: var(--brand-blue); }

/* ── Ghost slots (hidden fields, in place) ── */
.vwe-ghosts {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}
.vwe-ghost {
  font-size: .78rem;
  color: var(--muted);
  background: repeating-linear-gradient(
    -45deg, transparent, transparent 5px, #F4F4F5 5px, #F4F4F5 10px);
  border: 1px dashed var(--border-2);
  border-radius: 6px;
  padding: 4px 10px;
  cursor: pointer;
  transition: border-color .12s, color .12s, background .12s;
}
.vwe-ghost:hover { border-color: var(--brand-blue); color: var(--brand-blue); }

/* ── Overview rail (sticky) ── */
.vwe-rail {
  position: sticky;
  top: 12px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  align-self: start;
}
.vwe-rail-title {
  font-size: .7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--muted);
  margin-bottom: 6px;
}
.vwe-rail-nav { display: flex; flex-direction: column; gap: 2px; }
.vwe-rail-jump {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  text-align: left;
  font-size: .8rem;
  color: var(--brand-text);
  background: none;
  border: 1px solid transparent;
  border-radius: 6px;
  padding: 6px 8px;
  cursor: pointer;
  transition: background .1s, border-color .1s;
}
.vwe-rail-jump:hover { background: #F4F4F5; border-color: var(--border); }
.vwe-rail-jump.excluded { opacity: .5; }
.vwe-rail-jump-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.vwe-rail-jump-count {
  font-size: .7rem;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  flex-shrink: 0;
}

.vwe-rail-check {
  border-top: 1px solid var(--border);
  padding-top: 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.vwe-rail-totals {
  font-size: .76rem;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.vwe-rail-check-line { font-size: .8rem; font-weight: 600; }
.vwe-rail-check-line.ok  { color: #16a34a; }
.vwe-rail-check-line.bad { color: var(--danger, #c0392b); }

.vwe-custom-section {
  border-top: 1px dashed var(--border-2);
  padding-top: 10px;
}
.vwe-custom-label {
  font-size: .73rem;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .05em;
  margin-bottom: 6px;
}
.vwe-custom-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 8px;
}
.vwe-custom-item {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 0;
}
.vwe-custom-id {
  font-size: .72rem;
  color: var(--muted);
  font-family: monospace;
  min-width: 90px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.vwe-custom-item input[type=text],
.vwe-custom-item select {
  flex: 1;
  padding: 4px 8px;
  font-size: .8rem;
  border: 1px solid var(--border-2);
  border-radius: 6px;
  font-family: inherit;
  background: var(--white);
  outline: none;
  min-width: 0;
}
.vwe-custom-item input[type=text]:focus,
.vwe-custom-item select:focus {
  border-color: var(--brand-blue);
}
.vwe-add-cf-btn {
  font-size: .78rem;
  padding: 5px 10px;
  align-self: flex-start;
}

/* ── Inline add-custom-field form ── */
.vwe-add-cf-form {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 8px;
  flex-wrap: wrap;
}
.vwe-add-cf-label {
  flex: 1;
  min-width: 120px;
  padding: 5px 8px;
  border: 1px solid var(--border-2);
  border-radius: var(--radius-inner);
  font-size: .83rem;
}
.vwe-add-cf-label:focus { border-color: var(--brand-blue); outline: none; }
.vwe-add-cf-type {
  padding: 5px 6px;
  border: 1px solid var(--border-2);
  border-radius: var(--radius-inner);
  font-size: .83rem;
  background: var(--surface-0);
}

/* ── JSON escape hatch ── */
.vwe-json-hatch {
  margin-top: 8px;
  font-size: .78rem;
}
.vwe-json-hatch summary {
  cursor: pointer;
  color: var(--muted);
  user-select: none;
  padding: 2px 0;
}
.vwe-json-hatch summary:hover { color: var(--brand-blue); }
.vwe-json-hatch-area {
  display: block;
  width: 100%;
  margin: 6px 0 4px;
  padding: 6px 8px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: .78rem;
  border: 1px solid var(--border-2);
  border-radius: var(--radius-inner);
  resize: vertical;
  box-sizing: border-box;
}
.vwe-json-hatch-err {
  display: block;
  margin-top: 4px;
  font-size: .76rem;
  color: var(--danger, #c0392b);
}

.vwe-collection-note {
  font-size: .76rem;
  color: var(--muted);
  font-style: italic;
  padding: 4px 0;
}

.vwe-json-panel {
  border: 1px solid var(--border);
  border-radius: var(--radius-inner);
  overflow: hidden;
}
.vwe-json-summary {
  padding: 8px 12px;
  font-size: .8rem;
  font-weight: 600;
  color: var(--muted);
  background: #F4F4F5;
  cursor: pointer;
  user-select: none;
  list-style: none;
}
.vwe-json-summary::-webkit-details-marker { display: none; }
.vwe-json-summary::before { content: '▶ '; font-size: .65rem; }
.vwe-json-panel[open] .vwe-json-summary::before { content: '▼ '; }
.vwe-json-pre {
  margin: 0;
  padding: 12px 14px;
  font-size: .75rem;
  font-family: "SF Mono", "Fira Code", "Fira Mono", "Roboto Mono", monospace;
  white-space: pre;
  overflow-x: auto;
  background: #FAFAFA;
  color: #374151;
  max-height: 280px;
  overflow-y: auto;
  line-height: 1.5;
}

.vwe-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  padding-top: 4px;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}
.vwe-actions .btn.add { min-width: 80px; }

/* ── Catalog empty state ── */
.catalog-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 72px 24px;
  text-align: center;
  color: var(--muted);
  max-width: 380px;
  margin: 0 auto;
}
.catalog-empty .empty-icon { font-size: 2.25rem; opacity: 0.3; line-height: 1; }
.catalog-empty strong { font-size: 1.05rem; font-weight: 700; color: var(--brand-text); display: block; }
.catalog-empty .kicker { margin: 0; line-height: 1.55; }

/* ── Controlbar ── */
.controlbar {
  display: flex;
  gap: 10px;
  margin-bottom: 12px;
  align-items: center;
}
.controlbar input[type="search"] { flex: 1; }
.controlbar select { width: auto; min-width: 180px; flex-shrink: 0; }

/* View Editor workflow steps — neutral */
.vw-workflow {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  background: #F4F4F5;
  border: 1px solid var(--border);
  border-radius: var(--radius-inner);
  font-size: 0.82rem;
  color: var(--muted);
  flex-wrap: wrap;
}
.vw-workflow-step { display: flex; align-items: center; gap: 6px; white-space: nowrap; }
.vw-step-num {
  width: 20px; height: 20px;
  border-radius: 50%;
  background: var(--brand-blue);
  color: var(--white);
  font-size: 0.7rem; font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.vw-workflow-arrow { opacity: 0.35; }

.vw-view-list-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  transition-property: background;
  transition-duration: 0.1s;
}
.vw-view-list-item:hover:not(.selected) { background: #F4F4F5; }

/* ── View editor — inline contenteditable affordances ──
   Subtle hover bg + focus ring so editable titles/labels are discoverable. */
.vwe-sec-title[contenteditable="true"],
.vwe-field-label[contenteditable="true"] {
  cursor: text;
  transition: background .12s, box-shadow .12s;
}
.vwe-sec-title[contenteditable="true"]:hover,
.vwe-field-label[contenteditable="true"]:hover {
  background: #F4F4F5;
}
.vwe-sec-title[contenteditable="true"]:focus,
.vwe-field-label[contenteditable="true"]:focus {
  background: var(--white);
  box-shadow: 0 0 0 2px rgba(63, 50, 171, .18);
}

/* ── Overflow / more menu ── */
.more-menu-wrap {
  position: relative;
}
.more-btn {
  font-size: 1.1rem;
  letter-spacing: .1em;
  line-height: 1;
  padding: 9px 12px;
  min-width: 40px;
  color: var(--muted);
}
.more-btn:hover { color: var(--brand-text); }
.more-menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  z-index: 200;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius-inner);
  box-shadow: 0 4px 16px rgba(0,0,0,.12), 0 1px 4px rgba(0,0,0,.06);
  min-width: 160px;
  overflow: hidden;
  animation: menu-in .12s cubic-bezier(0.2,0,0,1) both;
}
@keyframes menu-in {
  from { opacity: 0; transform: translateY(-4px) scale(.98); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
.more-menu-item {
  display: block;
  width: 100%;
  padding: 9px 14px;
  text-align: left;
  background: none;
  border: none;
  cursor: pointer;
  font-size: .85rem;
  font-family: inherit;
  font-weight: 500;
  color: var(--text);
  transition: background .1s;
}
.more-menu-item:hover { background: #F4F4F5; }
.more-menu-item.danger { color: var(--danger); }
.more-menu-item.danger:hover { background: var(--danger-bg); }
.more-menu-item[disabled] { opacity: .4; cursor: not-allowed; }

/* ── Catalog utility bar (Phase 2) ── */
.util-import-section {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.util-danger-zone {
  display: flex;
  align-items: center;
  gap: 8px;
  padding-left: 16px;
  border-left: 1px solid var(--danger-bd);
}
.advanced-options {
  display: inline-block;
}
.advanced-options-summary {
  font-size: .75rem;
  color: var(--muted);
  cursor: pointer;
  user-select: none;
  list-style: none;
  padding: 2px 0;
}
.advanced-options-summary::-webkit-details-marker { display: none; }
.advanced-options-summary::before { content: '▶ '; font-size: .65rem; }
.advanced-options[open] .advanced-options-summary::before { content: '▼ '; }
.advanced-options .util-label { margin-top: 6px; }

/* ── Assignments sidebar item — always visible ── */
.sidebar-subitem.assignments-link {
  color: var(--muted);
  font-style: italic;
}
.sidebar-subitem.assignments-link .assignments-icon {
  margin-left: auto;
  font-size: .75rem;
  opacity: .5;
}

/* ── View editor drawer (Phase 4) ── */
.view-editor-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.35);
  z-index: 50;
  opacity: 0;
  pointer-events: none;
  transition: opacity .22s cubic-bezier(0.2,0,0,1);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
}
.view-editor-backdrop.open {
  opacity: 1;
  pointer-events: auto;
}

.view-editor-drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(720px, 90vw);
  background: var(--white);
  z-index: 51;
  transform: translateX(100%);
  transition: transform .22s cubic-bezier(0.2,0,0,1);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: -8px 0 48px rgba(0,0,0,.16), -1px 0 0 var(--border);
}
.view-editor-drawer.open {
  transform: translateX(0);
}
.view-editor-drawer.closing {
  transition: transform .18s cubic-bezier(0.2,0,0,1);
}

.view-editor-drawer-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: 18px 20px 14px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  gap: 16px;
}
.view-editor-drawer-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}
.vwe-close-btn {
  width: 32px;
  height: 32px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  border-radius: 6px;
}

.view-editor-drawer-body {
  display: grid;
  grid-template-columns: 220px 1fr;
  flex: 1;
  overflow: hidden;
}
.view-editor-drawer-body .vwe-left {
  overflow-y: auto;
}
.view-editor-drawer-body .vwe-right {
  overflow-y: auto;
}

/* ── View Builder Page (full page, not drawer) ── */
.vwe-page-header {
  flex-shrink: 0;
}
.vwe-page-body {
  flex: 1;
  overflow: hidden;
  display: grid;
  grid-template-columns: 220px 1fr;
  min-height: 0;
}
.vwe-page-body .vwe-left {
  overflow-y: auto;
  border-right: 1px solid var(--border);
}
.vwe-page-body .vwe-right {
  overflow-y: auto;
}

/* ── Responsive ── */
@media (max-width: 720px) {
  .sidebar { width: 56px; }
  .sidebar-brand-text,
  .sidebar-item span:not(.sidebar-icon),
  .sidebar-subnav,
  .sidebar-footer { display: none; }
  .sidebar-item { justify-content: center; padding: 12px; border-left: none; }
  .sidebar-item.active { border-left: none; }
  .app-main { overflow-y: auto; }
  .page-header { padding: 12px 16px; }
  .page-content { padding: 16px; }
  #assignmentSection { padding: 0 16px 16px; }
  .vwe-body { grid-template-columns: 1fr; }
  .vwe-left { border-right: none; border-bottom: 1px solid var(--border); }
  .builder-section { animation: none; }
  .two-col-grid { grid-template-columns: 1fr; }
}
