@import url('https://fonts.googleapis.com/css2?family=Archivo:wght@400;500;600;700&family=IBM+Plex+Mono:wght@400;500&family=IBM+Plex+Sans:wght@400;500;600&family=Montserrat:wght@400;500;600;700&family=Lato:wght@400;700&family=Roboto:wght@400;500;700&family=Open+Sans:wght@400;600;700&family=Poppins:wght@400;500;600;700&display=swap');

@font-face {
  font-family: 'Camaro';
  src: url("../fonts/camaro.otf") format("opentype"),
       url("../fonts/camaro.ttf") format("opentype");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'LuxeUno';
  src: url("../fonts/LuxeUno-Regular.ttf") format("truetype");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'LuxeUno';
  src: url("../fonts/LuxeUno-Bold.ttf") format("truetype");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'LuxeUno';
  src: url("../fonts/LuxeUno-SemiBold.ttf") format("truetype");
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'LuxeUno';
  src: url("../fonts/LuxeUno-Light.ttf") format("truetype");
  font-weight: 300;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'LuxeUno-Regular';
  src: url("../fonts/LuxeUno-Regular.ttf") format("truetype");
  font-weight: normal;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'LuxeUno-Bold';
  src: url("../fonts/LuxeUno-Bold.ttf") format("truetype");
  font-weight: bold;
  font-style: normal;
  font-display: swap;
}

/* ==========================================================================
   TileCat — catalogue editor
   Chrome stays graphite so page artwork reads true. Accents are ROEX lime
   and cyan, used only where an action or a live value needs to be found.
   ========================================================================== */

:root {
  /* ── White + warm-gold theme ── */
  --gold: #B0803A;
  --gold-dim: #8A6329;
  --gold-light: #F1E7D6;
  --gold-bg: #FBFAF8;

  --ink: #f3f4f6;
  --panel: #FFFFFF;
  --panel-2: #FBFAF8;
  --pit: #F5F4F1;
  /* warm canvas background */
  --line: #E8E3DB;
  --line-soft: #EFE9DF;
  --text: #1C1410;
  --text-dim: #3D3025;
  --text-faint: #8A7E72;
  --lime: #000000;
  --lime-dim: #27272A;
  --cyan: #000000;
  --amber: #f59e0b;
  --danger: #ef4444;
  --paper: #FFFFFF;

  --font-display: 'Archivo', system-ui, sans-serif;
  --font-ui: 'IBM Plex Sans', system-ui, sans-serif;
  --font-mono: 'IBM Plex Mono', ui-monospace, monospace;

  --rail-w: 250px;
  --insp-w: 300px;
  --bar-h: 52px;
  --r: 6px;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100vh;
  background: var(--gold-bg);
  color: var(--text);
  font-family: var(--font-ui);
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
  display: flex;
  flex-direction: column;
}

h1,
h2,
h3,
.display {
  font-family: var(--font-display);
  letter-spacing: -0.015em;
  margin: 0;
}

a {
  color: var(--gold);
}

.mono {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
}

.eyebrow {
  font-family: var(--font-display);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: #64748b;
}

:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
}

/* --- Buttons -------------------------------------------------------------- */

.btn {
  font-family: var(--font-ui);
  font-size: 13px;
  font-weight: 500;
  color: #374151;
  background: #ffffff;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 8px 16px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  transition: all 0.15s ease;
  white-space: nowrap;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}

.btn:hover:not(:disabled) {
  background: #f9fafb;
  border-color: #d1d5db;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.06);
}

.btn:disabled {
  opacity: .4;
  cursor: not-allowed;
}

.btn-primary {
  background: var(--gold);
  border-color: var(--gold);
  color: #ffffff;
  font-weight: 600;
  box-shadow: 0 1px 3px rgba(176, 128, 58, 0.35);
}

.btn-primary:hover:not(:disabled) {
  background: var(--gold-dim);
  border-color: var(--gold-dim);
  box-shadow: 0 4px 8px rgba(176, 128, 58, 0.4);
}

.btn-ghost {
  background: transparent;
  border-color: transparent;
  color: #6b7280;
  box-shadow: none;
}

.btn-ghost:hover:not(:disabled) {
  background: #f3f4f6;
  color: #111827;
  box-shadow: none;
}

.btn-danger {
  color: #ef4444;
  border-color: transparent;
  background: transparent;
  box-shadow: none;
}

.btn-danger:hover:not(:disabled) {
  background: #fef2f2;
  border-color: #fecaca;
  box-shadow: none;
}

.btn-sm {
  padding: 6px 12px;
  font-size: 12px;
  border-radius: 6px;
}

.btn-block {
  width: 100%;
  justify-content: center;
}

/* --- Login gate ----------------------------------------------------------- */

.gate-body {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  margin: 0;
  background: radial-gradient(circle at top, #e0f2fe 0%, #f3f4f6 60%, #e5e7eb 100%);
}

.gate {
  width: 400px;
  text-align: center;
  padding: 48px 40px;
  background: #ffffff;
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 24px;
  box-shadow: 0 12px 24px -8px rgba(0, 0, 0, 0.05), 0 4px 12px -4px rgba(0, 0, 0, 0.02);
}

.gate-mark {
  display: grid;
  grid-template-columns: repeat(2, 32px);
  grid-auto-rows: 32px;
  gap: 6px;
  justify-content: center;
  margin-bottom: 28px;
}

.gate-mark span {
  background: var(--line);
  border-radius: 6px;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.05);
}

.gate-mark span:nth-child(1) {
  background: linear-gradient(135deg, var(--lime), var(--lime-dim));
}

.gate-mark span:nth-child(4) {
  background: linear-gradient(135deg, #38bdf8, var(--cyan));
}

.gate h1 {
  font-size: 26px;
  font-weight: 700;
  color: #111827;
  letter-spacing: -0.04em;
  margin-bottom: 8px;
}

.gate-sub {
  color: #6b7280;
  margin: 0 0 36px;
  font-size: 15px;
}

.gate-form {
  text-align: left;
  display: grid;
  gap: 20px;
}

.gate-form .field {
  display: grid;
  gap: 8px;
  margin-bottom: 0;
}

.gate-form label {
  font-size: 14px;
  font-weight: 500;
  color: #374151;
}

.gate-error {
  color: var(--danger);
  font-size: 13px;
  margin: 0;
}

input[type=email],
input[type=text],
input[type=password],
input[type=number],
select,
textarea {
  width: 100%;
  font-family: var(--font-ui);
  font-size: 14px;
  color: var(--text);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  transition: border-color .15s, box-shadow .15s;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--lime);
  outline: none;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

/* --- App shell ------------------------------------------------------------ */

.topbar {
  height: 52px;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 20px;
  background: #121212;
  border-bottom: 0.5px solid #27272A;
  position: sticky;
  top: 0;
  z-index: 40;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 15px;
  letter-spacing: -0.03em;
  color: #FFFFFF;
  text-decoration: none;
  transition: opacity 0.15s;
}

.brand:hover {
  opacity: 0.7;
}

.brand-mark {
  width: 22px;
  height: 22px;
  display: grid;
  grid-template: repeat(2, 1fr) / repeat(2, 1fr);
  gap: 3px;
}

.brand-mark i {
  background: #FFFFFF;
  border-radius: 2px;
}

.brand-mark i:first-child {
  background: #FFFFFF;
}

.brand-mark i:last-child {
  background: #FFFFFF;
}

.spacer {
  flex: 1;
}

.doc-title {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 14px;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 4px;
  padding: 5px 8px;
  color: #FFFFFF;
  min-width: 140px;
  max-width: 320px;
}

.doc-title:hover {
  border-color: #27272A;
}

.doc-title:focus {
  background: #1E1E1E !important;
  border-color: #3F3F46 !important;
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.05) !important;
}

.savestate {
  font-family: var(--font-mono);
  font-size: 11px;
  color: #A1A1AA;
  display: flex;
  align-items: center;
  gap: 6px;
}

.topbar .btn {
  background: #1E1E1E !important;
  border-color: #27272A !important;
  color: #E4E4E7 !important;
}

.topbar .btn:hover:not(:disabled) {
  background: #2D2D30 !important;
  border-color: #3F3F46 !important;
  color: #FFFFFF !important;
}

.topbar .btn-primary {
  background: #FFFFFF !important;
  border-color: #FFFFFF !important;
  color: #121212 !important;
  box-shadow: none !important;
}

.topbar .btn-primary:hover:not(:disabled) {
  background: #E4E4E7 !important;
  border-color: #E4E4E7 !important;
  color: #121212 !important;
  box-shadow: none !important;
}

.topbar .btn-white {
  background: #FFFFFF !important;
  border-color: #FFFFFF !important;
  color: #121212 !important;
}

.topbar .btn-white:hover:not(:disabled) {
  background: #E4E4E7 !important;
  border-color: #E4E4E7 !important;
  color: #121212 !important;
}

.topbar span.mono {
  color: #94A3B8 !important;
}

.savestate::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--lime-dim);
}

.savestate[data-state="dirty"]::before {
  background: var(--amber);
}

.savestate[data-state="saving"]::before {
  background: var(--cyan);
}

.savestate[data-state="error"]::before {
  background: var(--danger);
}

/* --- Dashboard / Index ----------------------------------------------------- */

.topbar-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  color: #A1A1AA;
  transition: background .15s, color .15s;
  text-decoration: none;
}

.topbar-icon:hover {
  background: #27272A;
  color: #FFFFFF;
}

/* Page wrapper */
.idx-wrap {
  width: 100%;
  max-width: 1600px;
  margin: 0 auto;
  padding: 40px 48px 60px;
  flex: 1;
  /* pushes footer down */
}

/* Page header */
.idx-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 36px;
}

.idx-title {
  font-family: var(--font-display);
  font-size: 40px;
  font-weight: 800;
  letter-spacing: -0.04em;
  color: var(--text);
  margin: 6px 0 8px;
}

.idx-sub {
  color: var(--text-faint);
  font-size: 14px;
  line-height: 1.6;
  margin: 0;
  max-width: 52ch;
}

.idx-new-btn {
  flex-shrink: 0;
  padding: 10px 20px;
  font-size: 14px;
  border-radius: 10px;
  margin-top: 4px;
}

/* Stats bar */
.idx-stats {
  display: flex;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #FFFFFF;
  margin-bottom: 28px;
  overflow: hidden;
}

.idx-stat {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 20px 24px;
  border-right: 1px solid var(--line);
}

.idx-stat:last-child {
  border-right: none;
}

.idx-stat-icon {
  color: var(--gold);
  flex-shrink: 0;
}

.idx-stat-val {
  font-family: var(--font-display);
  font-size: 28px;
  font-weight: 800;
  color: var(--text);
  letter-spacing: -0.03em;
  line-height: 1;
}

.idx-stat-lbl {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-faint);
  margin-top: 4px;
}

/* Import zone */
.idx-import {
  display: flex;
  align-items: center;
  gap: 28px;
  border: 1.5px dashed var(--line);
  border-radius: 16px;
  padding: 28px 32px;
  background: #FFFFFF;
  margin-bottom: 40px;
  cursor: pointer;
  transition: border-color .2s, box-shadow .2s;
}

.idx-import:hover,
.idx-import.over {
  border-color: var(--gold);
  box-shadow: 0 4px 20px rgba(176, 128, 58, .1);
}

.idx-import--error {
  border-color: var(--danger);
  cursor: default;
}

.idx-import--error:hover {
  border-color: var(--danger);
  box-shadow: none;
}

.idx-import-icon {
  flex-shrink: 0;
}

.idx-import-body h3 {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
  margin: 0 0 4px;
}

.idx-import-body>p {
  color: var(--text-faint);
  font-size: 14px;
  margin: 0 0 16px;
}

.idx-import-btn {
  padding: 9px 20px;
  font-size: 13px;
  border-radius: 9px;
  pointer-events: all;
}

.idx-import-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
  margin: 12px 0 0 !important;
  font-size: 12px;
  color: var(--text-faint);
  font-family: var(--font-mono);
}

.idx-import-tags span::before {
  content: '· ';
}

.idx-import-tags span:first-child::before {
  content: '';
}

/* Library section */
.idx-lib-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

.idx-lib-title-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
}

.idx-lib-title {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 800;
  color: var(--text);
  margin: 0;
}

.idx-lib-badge {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  color: var(--gold-dim);
  background: var(--gold-light);
  border: 1px solid #D4B07A;
  padding: 3px 10px;
  border-radius: 20px;
}

/* Library card grid */
.idx-lib-grid {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* Individual library card */
.lib-card {
  display: flex;
  align-items: stretch;
  gap: 0;
  background: #FFFFFF;
  border: 1px solid var(--line);
  border-radius: 14px;
  overflow: hidden;
  transition: border-color .18s, box-shadow .18s;
}

.lib-card:hover {
  border-color: var(--gold);
  box-shadow: 0 4px 16px rgba(176, 128, 58, .1);
}

.lib-card-thumb-link {
  display: contents;
}

.lib-card-thumb {
  width: 200px;
  flex-shrink: 0;
  background: #1A2740 center/cover no-repeat;
  display: grid;
  place-items: center;
  position: relative;
  border-right: 1px solid var(--line);
}

.lib-card-pdf-badge {
  position: absolute;
  top: 10px;
  right: 10px;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  background: var(--gold);
  color: #fff;
  padding: 3px 7px;
  border-radius: 5px;
}

.lib-card-body {
  flex: 1;
  padding: 20px 24px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.lib-card-name {
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.01em;
  text-transform: uppercase;
}

.lib-card-meta {
  display: flex;
  align-items: center;
  gap: 18px;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-faint);
}

.lib-card-meta span {
  display: flex;
  align-items: center;
  gap: 5px;
}

.lib-card-status-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.lib-badge {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 20px;
  border: 1px solid var(--line);
  background: var(--panel-2);
  color: var(--text-faint);
}

.lib-badge--ready {
  color: #15803d;
  background: #f0fdf4;
  border-color: #bbf7d0;
}

.lib-badge--warn {
  color: var(--amber);
  background: #fffbeb;
  border-color: #fde68a;
}

.lib-card-edits {
  font-size: 12px;
  color: var(--text-faint);
  font-family: var(--font-mono);
}

.lib-card-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: auto;
  padding-top: 4px;
}

.lib-card-open {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  padding: 8px 16px;
}

/* Dropdown menu */
.lib-menu-wrap {
  position: relative;
}

.lib-menu-btn {
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 2px;
  padding: 7px 10px;
  color: var(--text-faint);
}

.lib-menu {
  position: absolute;
  bottom: calc(100% + 6px);
  left: 0;
  min-width: 210px;
  background: #FFFFFF;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 6px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, .12);
  z-index: 50;
}

.lib-menu[hidden] {
  display: none;
}

.lib-menu-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 9px 12px;
  font-size: 13px;
  color: var(--text);
  background: none;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  text-decoration: none;
  text-align: left;
  transition: background .12s;
}

.lib-menu-item:hover {
  background: var(--gold-bg);
}

.lib-menu-item--danger {
  color: var(--danger);
}

.lib-menu-item--danger:hover {
  background: #fef2f2;
}

/* Empty state */
.idx-empty {
  text-align: center;
  padding: 80px 20px;
  color: var(--text-faint);
  font-size: 15px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}

/* Footer — always at bottom of viewport */
.idx-footer {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 18px 48px;
  border-top: 1px solid var(--line);
  font-size: 13px;
  color: var(--text-faint);
  background: #FFFFFF;
  flex-shrink: 0;
  /* don't shrink in flex column body */
}

.idx-footer a {
  color: var(--text-faint);
  text-decoration: none;
}

.idx-footer a:hover {
  color: var(--text);
}

/* Keep old .tag for compatibility */
.tag {
  display: inline-block;
  font-family: var(--font-mono);
  font-weight: 500;
  font-size: 11px;
  padding: 4px 8px;
  border-radius: 6px;
  border: 1px solid var(--line);
  color: var(--text-dim);
  background: var(--panel-2);
}

.tag-edited {
  color: var(--gold-dim);
  border-color: #e8d4b0;
  background: var(--gold-light);
}



/* --- Import progress ------------------------------------------------------ */

.overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(8px);
  display: grid;
  place-items: center;
  z-index: 100;
}

.overlay[hidden] {
  display: none;
}

.dialog {
  width: 460px;
  max-width: calc(100vw - 32px);
  background: #ffffff;
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 20px;
  padding: 28px;
  box-shadow: 0 24px 48px -12px rgba(0, 0, 0, 0.18);
}

.dialog h2 {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.03em;
  color: var(--text);
  margin-bottom: 6px;
}

.dialog .sub {
  color: #64748b;
  font-size: 14px;
  margin: 0 0 20px;
}

.bar {
  height: 6px;
  background: #f1f5f9;
  border-radius: 99px;
  overflow: hidden;
}

.bar>i {
  display: block;
  height: 100%;
  width: 0;
  background: #111827;
  transition: width .3s ease;
  border-radius: 99px;
}

.bar-label {
  font-family: var(--font-mono);
  font-size: 11px;
  color: #94a3b8;
  display: flex;
  justify-content: space-between;
  margin-top: 10px;
}

.dialog-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  margin-top: 18px;
}

.field {
  display: grid;
  gap: 6px;
  margin-bottom: 14px;
}

.field label {
  font-size: 12px;
  color: var(--text-dim);
}

.field .hint {
  font-size: 11px;
  color: var(--text-faint);
  font-family: var(--font-mono);
}

/* --- Editor layout -------------------------------------------------------- */

.editor {
  display: grid;
  grid-template-columns: var(--rail-w) 1fr var(--insp-w);
  height: calc(100vh - var(--bar-h));
  overflow: hidden;
}

.editor.rail-hidden {
  grid-template-columns: 1fr var(--insp-w);
}

/* ─── Left page-rail ─────────────────────────────────────────────────────── */

.rail {
  background: #FAFAF8;
  border-right: 1px solid var(--line);
  overflow-y: auto;
  overflow-x: hidden;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 0 8px 12px;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.rail::-webkit-scrollbar {
  display: none;
}

/* sticky page-count header */
.rail::before {
  content: 'Pages';
  display: block;
  font-family: var(--font-display);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-faint);
  padding: 10px 10px 6px;
  border-bottom: 0.5px solid var(--line-soft);
  position: sticky;
  top: 0;
  background: #FAFAF8;
  z-index: 2;
  /* bleed out of the rail's side padding so it goes full-width */
  margin: 0 -8px;
}


.thumb {
  position: relative;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 4px;
  overflow: hidden;
  cursor: pointer;
  background: #FFFFFF;
  flex-shrink: 0;
  width: 100%;
  /* fills rail minus its 8px side padding */
  transition: border-color .18s, box-shadow .18s, transform .15s;
  box-shadow: 0 1px 3px rgba(0, 0, 0, .06);
}

.thumb:hover {
  border-color: var(--gold);
  box-shadow: 0 4px 12px rgba(176, 128, 58, .18), 0 1px 4px rgba(0, 0, 0, .08);
  transform: translateY(-1px);
}

.thumb > img,
.thumb-frame > img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: fill;
  object-position: center center;
  border-radius: 5px;
  background: var(--paper);
}

.thumb-ov .ov-img {
  border-radius: 0 !important;
}

.thumb-ov .slot-tile-border {
  position: absolute !important;
  inset: 0 !important;
  box-sizing: border-box !important;
  border: 1px dashed #000000 !important;
  pointer-events: none !important;
  z-index: 20 !important;
}

.thumb-ov .ov-t,
.thumb-ov .ov-t.ov-t-light-ink {
  position: absolute !important;
  display: flex !important;
  align-items: flex-start !important;
  line-height: 1.05 !important;
  white-space: pre !important;
  overflow: hidden !important;
  outline: 1px dashed #000000 !important;
  outline-offset: -1px !important;
  box-sizing: border-box !important;
  z-index: 25 !important;
}

.thumb.active {
  border-color: var(--gold);
  border-width: 2px;
  box-shadow: 0 0 0 3px rgba(176, 128, 58, .18), 0 2px 8px rgba(0, 0, 0, .1);
  transform: translateY(0);
}

.thumb-no {
  position: absolute;
  left: 6px;
  bottom: 6px;
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 500;
  padding: 2px 5px;
  border-radius: 4px;
  background: rgba(28, 20, 16, .72);
  color: #fff;
  letter-spacing: 0.04em;
}

.thumb-dot {
  display: none !important;
}

/* --- Canvas pit ----------------------------------------------------------- */

.pit {
  background: var(--pit);
  overflow: auto;
  position: relative;
  padding: 24px 0 48px;
  scroll-behavior: smooth;
}

.doc {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 22px;
  min-height: 100%;
}

.pageview {
  position: relative;
  flex: none;
  background: var(--paper);
  box-shadow: 0 1px 3px rgba(16, 24, 40, .18), 0 10px 28px rgba(16, 24, 40, .14);
}

.pageview img.page-bg,
.pageview .stage-patch {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  user-select: none;
  -webkit-user-drag: none;
}

.pageview img.page-bg {
  object-fit: fill;
  z-index: 0;
}

.pageview .stage-patch {
  z-index: 1;
}

.page-layer {
  position: absolute;
  inset: 0;
  z-index: 2;
  contain: layout;
}

.pageview-no {
  position: absolute;
  left: 50%;
  bottom: -20px;
  transform: translateX(-50%);
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-faint);
  pointer-events: none;
}

/* Slots: corner registration marks, the way a prepress proof is marked up. */
.slot {
  position: absolute;
  cursor: pointer;
  overflow: hidden;
  z-index: 8;
  box-sizing: border-box;
}

.slot-tile-border {
  position: absolute !important;
  inset: 0 !important;
  box-sizing: border-box !important;
  border: 1px dashed #000000 !important;
  pointer-events: none !important;
  z-index: 30 !important;
}

.slot .slot-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.slot::before,
.slot::after,
.slot>.reg-b,
.slot>.reg-c {
  content: '';
  position: absolute;
  width: 11px;
  height: 11px;
  border: 1.5px solid var(--cyan);
  opacity: 0;
  transition: opacity .12s;
  pointer-events: none;
  z-index: 2;
}

.slot::before {
  top: -1px;
  left: -1px;
  border-right: 0;
  border-bottom: 0;
}

.slot::after {
  top: -1px;
  right: -1px;
  border-left: 0;
  border-bottom: 0;
}

.slot>.reg-b {
  bottom: -1px;
  left: -1px;
  border-right: 0;
  border-top: 0;
}

.slot>.reg-c {
  bottom: -1px;
  right: -1px;
  border-left: 0;
  border-top: 0;
}

.slot,
.slot.selected,
.pit.show-slots .slot {
  outline: 1px dashed #000000;
  outline-offset: -1px;
}

.pit.show-slots .slot::before,
.pit.show-slots .slot::after,
.pit.show-slots .slot>.reg-b,
.pit.show-slots .slot>.reg-c {
  opacity: .85;
}

.slot:hover::before,
.slot:hover::after,
.slot:hover>.reg-b,
.slot:hover>.reg-c {
  opacity: 1;
}

.slot.selected::before,
.slot.selected::after,
.slot.selected>.reg-b,
.slot.selected>.reg-c {
  opacity: 1;
  border-color: var(--lime);
  width: 15px;
  height: 15px;
}

/* Room-scene frames filled by Bulk stay editable, but do not obscure the
   scene with the editor-only label or registration marks. */
.slot.hide-editor-overlay::before,
.slot.hide-editor-overlay::after,
.slot.hide-editor-overlay>.reg-b,
.slot.hide-editor-overlay>.reg-c {
  opacity: 0 !important;
}

.slot.over {
  box-shadow: inset 0 0 0 2px var(--lime), 0 0 0 2px var(--lime);
  background: rgba(177, 211, 57, .16);
}

.slot-badge {
  position: absolute;
  top: 3px;
  left: 3px;
  font-family: var(--font-mono);
  font-size: 9px;
  line-height: 1;
  padding: 3px 6px;
  border-radius: 2px;
  background: rgba(0, 0, 0, .75);
  color: #ffffff;
  opacity: 0;
  transition: opacity .12s;
  pointer-events: none;
  white-space: nowrap;
  z-index: 10;
}

.slot:hover .slot-badge,
.slot.selected .slot-badge {
  opacity: 1;
}

.slot.locked {
  cursor: default;
}

.slot.locked .slot-badge {
  color: var(--text-faint);
}

/* A frame being replaced says so, the whole way through. */
.slot-busy {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 7px;
  background: rgba(255, 255, 255, .78);
  backdrop-filter: blur(2px);
  z-index: 4;
  pointer-events: none;
}

.busy-ring {
  width: 22px;
  height: 22px;
  border: 2px solid rgba(20, 115, 230, .25);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: busy-spin .7s linear infinite;
}

@keyframes busy-spin {
  to {
    transform: rotate(360deg);
  }
}

.busy-label {
  font-size: 11.5px;
  font-weight: 500;
  color: var(--text);
  letter-spacing: .01em;
}

.busy-pct {
  font-size: 11px;
  color: var(--text-dim);
}

/* Small frames only have room for the ring. */
.slot-busy:has(.busy-ring) {
  padding: 4px;
}

/* Text overlays */
.tbox {
  position: absolute;
  cursor: text;
  display: flex;
  align-items: center;
  line-height: 1.05;
  white-space: pre;
  overflow: visible;
  z-index: 10;
  box-sizing: border-box;
  user-select: none;
  -webkit-user-select: none;
}

.tbox:not(.editing) * {
  pointer-events: none;
}

.tbox.is-multiline {
  flex-direction: column;
  align-items: stretch;
  justify-content: flex-start;
}

.tbox,
.tbox.edited,
.tbox.tbox-light-ink,
.tbox.selected,
.tbox.editing,
.pit.show-slots .tbox,
.pit.show-slots .tbox.tbox-light-ink {
  outline: 1px dashed #000000 !important;
  outline-offset: -1px !important;
}

.tbox:hover {
  box-shadow: none !important;
  outline: 1px dashed #000000 !important;
  outline-offset: -1px !important;
}

.tbox.selected {
  box-shadow: none !important;
  outline: 1px dashed #000000 !important;
  outline-offset: -1px !important;
  background-color: rgba(0, 0, 0, 0.04) !important;
}

.tbox.editing {
  box-shadow: none !important;
  outline: 1px dashed #000000 !important;
  outline-offset: -1px !important;
  background-color: rgba(0, 0, 0, 0.04) !important;
  cursor: text;
  z-index: 15;
  min-width: 6px;
  overflow-wrap: anywhere;
  caret-color: var(--lime);
  user-select: text;
  -webkit-user-select: text;
}

.tbox.editing.overset {
  box-shadow: 0 0 0 2px var(--amber);
}

.tbox.editing:hover {
  background-color: transparent;
}

/* ─── Right inspector ────────────────────────────────────────────────────── */

.inspector {
  background: #FAFAF8;
  border-left: 1px solid var(--line);
  overflow-y: auto;
  overflow-x: hidden;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.inspector::-webkit-scrollbar {
  display: none;
}

.insp-section {
  display: grid;
  gap: 10px;
  padding: 14px 14px 16px;
  border-bottom: 1px solid var(--line-soft);
}

.insp-section:last-child {
  border-bottom: none;
}

.insp-section>.eyebrow {
  font-size: 10px;
  letter-spacing: 0.14em;
  color: var(--gold-dim);
  padding-bottom: 0;
  border-bottom: none;
  margin-bottom: -2px;
}

.kv {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 4px 12px;
  font-family: var(--font-mono);
  font-size: 11px;
}

.kv dt {
  color: var(--text-faint);
}

.kv dd {
  margin: 0;
  color: var(--text-dim);
  text-align: right;
}

.row {
  display: flex;
  gap: 8px;
  align-items: center;
}

.row>* {
  min-width: 0;
}

.range {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 3px;
  background: var(--line);
  border-radius: 2px;
}

.range::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 13px;
  height: 13px;
  border-radius: 50%;
  background: var(--lime);
  cursor: pointer;
}

.range::-moz-range-thumb {
  width: 13px;
  height: 13px;
  border: 0;
  border-radius: 50%;
  background: var(--lime);
  cursor: pointer;
}

.slot-list {
  display: grid;
  gap: 5px;
}

.slot-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  border: 1px solid var(--line-soft);
  border-radius: 7px;
  cursor: pointer;
  font-size: 12px;
  background: #FFFFFF;
  transition: border-color .15s, box-shadow .15s;
}

.slot-row:hover {
  border-color: var(--gold);
  box-shadow: 0 2px 8px rgba(176, 128, 58, .12);
}

.slot-row.active {
  border-color: var(--gold);
  background: var(--gold-light);
  box-shadow: 0 0 0 2px rgba(176, 128, 58, .15);
}

.slot-row .sw {
  width: 22px;
  height: 22px;
  border-radius: 3px;
  background: var(--pit) center/cover no-repeat;
  border: 1px solid var(--line);
  flex: none;
}

.slot-row .nm {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.slot-row .st {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-faint);
}

.slot-row.filled .st {
  color: var(--lime);
}

.hint-box {
  font-size: 12px;
  color: var(--text-faint);
  line-height: 1.6;
  padding: 10px 12px;
  border: 1px dashed var(--gold-light);
  background: rgba(176, 128, 58, .04);
  border-radius: 8px;
}

.toast-stack {
  position: fixed;
  right: 16px;
  bottom: 16px;
  display: grid;
  gap: 8px;
  z-index: 200;
}

.toast {
  background: #111827;
  color: #FFFFFF;
  border: 1px solid #1F2937;
  border-left: 3px solid #000000;
  border-radius: 6px;
  padding: 10px 14px;
  font-size: 13px;
  font-weight: 500;
  font-family: 'Inter', var(--font-ui), sans-serif;
  max-width: 340px;
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.3), 0 8px 10px -6px rgba(0, 0, 0, 0.2);
  animation: slidein .18s ease-out;
}

.toast.err {
  background: #111827;
  border-left-color: var(--danger);
  color: #FFFFFF;
}

@keyframes slidein {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
}

/* --- Responsive ----------------------------------------------------------- */

@media (max-width: 1080px) {
  .editor {
    grid-template-columns: 120px 1fr 264px;
  }

  .editor.rail-hidden {
    grid-template-columns: 1fr 264px;
  }

  :root {
    --insp-w: 264px;
  }
}

@media (max-width: 820px) {
  .editor {
    grid-template-columns: 1fr;
    grid-template-rows: auto 1fr auto;
    height: auto;
  }

  .rail {
    flex-direction: row;
    overflow-x: auto;
    overflow-y: hidden;
    border-right: 0;
    border-bottom: 1px solid var(--line);
    padding: 8px;
  }

  .thumb {
    width: 96px;
    flex-shrink: 0;
  }

  .inspector {
    border-left: 0;
    border-top: 1px solid var(--line);
  }

  .pit {
    min-height: 60vh;
  }

  .doc-title {
    max-width: 150px;
  }
}

@media (prefers-reduced-motion: reduce) {

  *,
  *::before,
  *::after {
    animation-duration: .001ms !important;
    transition-duration: .001ms !important;
  }
}

#txtValue {
  width: 100%;
  min-height: 40px;
  max-height: 200px;
  overflow-y: auto;
  resize: vertical;
  font-family: inherit;
  font-size: inherit;
  padding: 8px;
  border: 1px solid #ddd;
  border-radius: 4px;
  box-sizing: border-box;
}

/* --- SweetAlert2 Custom Theme (tc-swal-*) --------------------------------- */
.tc-swal-popup {
  border-radius: 16px !important;
  padding: 28px !important;
  font-family: var(--font-ui), system-ui, sans-serif !important;
  box-shadow: 0 24px 48px -12px rgba(0,0,0,0.2) !important;
}

.tc-swal-title {
  font-size: 18px !important;
  font-weight: 700 !important;
  color: #111827 !important;
  letter-spacing: -0.02em !important;
}

.tc-swal-html {
  font-size: 14px !important;
  color: #64748B !important;
  line-height: 1.5 !important;
  margin-top: 8px !important;
}

.tc-swal-input {
  border: 1px solid #E2E8F0 !important;
  border-radius: 8px !important;
  font-size: 14px !important;
  padding: 10px 12px !important;
  width: 100% !important;
  font-family: var(--font-ui), system-ui, sans-serif !important;
  box-shadow: none !important;
}

.tc-swal-input:focus {
  border-color: #000000 !important;
  box-shadow: 0 0 0 3px rgba(0,0,0,0.06) !important;
}

.tc-swal-actions,
.swal2-popup.tc-swal-popup .swal2-actions {
  display: flex !important;
  flex-direction: row !important;
  gap: 12px !important;
  justify-content: center !important;
  align-items: center !important;
  margin-top: 24px !important;
  margin-bottom: 0 !important;
  padding: 0 !important;
  width: 100% !important;
}

.tc-swal-confirm,
.swal2-popup.tc-swal-popup .swal2-confirm {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  background: #000000 !important;
  color: #ffffff !important;
  border: 1px solid #000000 !important;
  height: 40px !important;
  min-width: 105px !important;
  padding: 0 22px !important;
  border-radius: 8px !important;
  font-size: 14px !important;
  font-weight: 600 !important;
  font-family: var(--font-ui), system-ui, sans-serif !important;
  cursor: pointer !important;
  margin: 0 !important;
  transition: all 0.15s ease-in-out !important;
}

.tc-swal-confirm:hover,
.swal2-popup.tc-swal-popup .swal2-confirm:hover {
  background: #27272A !important;
  border-color: #27272A !important;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.15) !important;
}

.tc-swal-cancel,
.swal2-popup.tc-swal-popup .swal2-cancel {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  background: #FFFFFF !important;
  color: #374151 !important;
  border: 1px solid #D1D5DB !important;
  height: 40px !important;
  min-width: 105px !important;
  padding: 0 22px !important;
  border-radius: 8px !important;
  font-size: 14px !important;
  font-weight: 500 !important;
  font-family: var(--font-ui), system-ui, sans-serif !important;
  cursor: pointer !important;
  margin: 0 !important;
  transition: all 0.15s ease-in-out !important;
}

.tc-swal-cancel:hover,
.swal2-popup.tc-swal-popup .swal2-cancel:hover {
  background: #F9FAFB !important;
  border-color: #9CA3AF !important;
  color: #111827 !important;
}

.tc-swal-confirm:focus,
.tc-swal-cancel:focus {
  outline: none !important;
  box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.12) !important;
}