/* ShotSlots UI. Tokens first; light is the base, dark via system or data-theme. */
:root {
  --bg: #eef0f3;
  --surface: #ffffff;
  --surface-2: #f6f7f9;
  --surface-3: #eceef2;
  --border: #dde1e7;
  --border-strong: #c3cad3;
  --text: #15191e;
  --text-2: #4b5562;
  --text-3: #7a8491;
  --accent: #3b5fdc;
  --accent-strong: #2c4bb9;
  --accent-soft: rgba(59, 95, 220, 0.12);
  --on-accent: #ffffff;
  --ok: #1d8a4b;
  --ok-soft: rgba(29, 138, 75, 0.12);
  --warn: #b26b00;
  --warn-soft: rgba(178, 107, 0, 0.12);
  --danger: #c93030;
  --danger-soft: rgba(201, 48, 48, 0.11);
  --overlay: rgba(12, 15, 20, 0.45);
  --shadow: 0 1px 2px rgba(16, 24, 40, 0.06), 0 4px 14px rgba(16, 24, 40, 0.07);
  --shadow-lg: 0 24px 64px rgba(16, 24, 40, 0.22);
  --thumb-bg: #e7e7e4;
  --radius: 11px;
  --radius-sm: 7px;
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Inter", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: "SF Mono", ui-monospace, Menlo, Consolas, "Liberation Mono", monospace;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #111316;
    --surface: #1a1d21;
    --surface-2: #1f2328;
    --surface-3: #262b31;
    --border: #2d333a;
    --border-strong: #414952;
    --text: #e8ebee;
    --text-2: #b2b9c2;
    --text-3: #7f8893;
    --accent: #7092ff;
    --accent-strong: #8ea8ff;
    --accent-soft: rgba(112, 146, 255, 0.16);
    --on-accent: #0b1020;
    --ok: #45c07a;
    --ok-soft: rgba(69, 192, 122, 0.15);
    --warn: #e7a53c;
    --warn-soft: rgba(231, 165, 60, 0.15);
    --danger: #ff6b6b;
    --danger-soft: rgba(255, 107, 107, 0.14);
    --overlay: rgba(0, 0, 0, 0.55);
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 6px 18px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 24px 64px rgba(0, 0, 0, 0.55);
    --thumb-bg: #2b2f35;
    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
  --bg: #111316;
  --surface: #1a1d21;
  --surface-2: #1f2328;
  --surface-3: #262b31;
  --border: #2d333a;
  --border-strong: #414952;
  --text: #e8ebee;
  --text-2: #b2b9c2;
  --text-3: #7f8893;
  --accent: #7092ff;
  --accent-strong: #8ea8ff;
  --accent-soft: rgba(112, 146, 255, 0.16);
  --on-accent: #0b1020;
  --ok: #45c07a;
  --ok-soft: rgba(69, 192, 122, 0.15);
  --warn: #e7a53c;
  --warn-soft: rgba(231, 165, 60, 0.15);
  --danger: #ff6b6b;
  --danger-soft: rgba(255, 107, 107, 0.14);
  --overlay: rgba(0, 0, 0, 0.55);
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 6px 18px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 24px 64px rgba(0, 0, 0, 0.55);
  --thumb-bg: #2b2f35;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 13px/1.45 var(--font);
  -webkit-font-smoothing: antialiased;
  -webkit-user-select: none;
  user-select: none;
}
input, textarea, select, button { font: inherit; color: inherit; }
input, textarea { -webkit-user-select: text; user-select: text; }
[hidden] { display: none !important; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.icon { display: inline-flex; width: 16px; height: 16px; flex: none; }
.icon svg { width: 100%; height: 100%; }

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

.app { display: flex; height: 100%; min-height: 0; }
.board-pane { flex: 1 1 auto; display: flex; flex-direction: column; min-width: 0; min-height: 0; background: var(--bg); }
body.demo .board-pane { flex: 0 0 min(540px, 46vw); border-left: 1px solid var(--border); }
.demo-pane { flex: 1 1 auto; min-width: 0; }

@media (max-width: 860px) {
  .app { flex-direction: column; height: auto; min-height: 100%; }
  body.demo .board-pane { flex: none; width: 100%; border-left: 0; border-top: 1px solid var(--border); }
  .demo-pane { max-height: 62vh; }
  .slots { overflow: visible; }
}

/* ------------------------------------------------------------ top bar */

.topbar {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}
.brand { display: flex; align-items: center; gap: 7px; font-weight: 700; letter-spacing: -0.01em; white-space: nowrap; }
.brand .logo { width: 22px; height: 22px; color: var(--accent); }
body.native .brand-name { display: none; }
.tpl-picker { flex: 1; min-width: 0; }
.tpl-picker select { width: 100%; }

select, input[type="text"], input[type="search"], input:not([type]) {
  height: 30px;
  padding: 0 9px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  outline: none;
  min-width: 0;
}
select { padding-right: 26px; -webkit-appearance: none; appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, var(--text-3) 50%), linear-gradient(135deg, var(--text-3) 50%, transparent 50%);
  background-position: calc(100% - 13px) 12.5px, calc(100% - 9px) 12.5px;
  background-size: 4px 4px, 4px 4px; background-repeat: no-repeat;
}
select:focus, input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }

.icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 30px; height: 30px; flex: none;
  border: 1px solid transparent; border-radius: var(--radius-sm);
  background: transparent; color: var(--text-2); cursor: pointer;
}
.icon-btn:hover { background: var(--surface-3); color: var(--text); }
.icon-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.icon-btn.small { width: 26px; height: 26px; }

/* ------------------------------------------------------------ product row */

.product {
  display: grid; grid-template-columns: auto 1fr; align-items: center; gap: 6px 10px;
  padding: 10px 12px 9px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}
.field-label { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; color: var(--text-3); }
.sku-wrap { display: flex; gap: 4px; min-width: 0; }
.sku-wrap input { flex: 1; font: 600 14px/1 var(--mono); height: 32px; }
.product.missing .sku-wrap input { border-color: var(--warn); box-shadow: 0 0 0 3px var(--warn-soft); }
.flash { animation: flash 0.9s ease; }
@keyframes flash { 0%, 100% { box-shadow: 0 0 0 0 transparent; } 30% { box-shadow: 0 0 0 4px var(--accent-soft); border-color: var(--accent); } }

.status { grid-column: 1 / -1; display: flex; align-items: center; gap: 7px; font-size: 11.5px; color: var(--text-3); min-width: 0; }
.status .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--text-3); flex: none; }
.status.ok .dot { background: var(--ok); box-shadow: 0 0 0 3px var(--ok-soft); }
.status.warn .dot { background: var(--warn); }
.status.bad .dot { background: var(--danger); }
.status.bad { color: var(--danger); }
.status.demo .dot { background: #a178f0; box-shadow: 0 0 0 3px rgba(161, 120, 240, 0.18); }
.status-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ------------------------------------------------------------ tip */

.tip {
  display: flex; gap: 10px; align-items: flex-start;
  margin: 10px 12px 0; padding: 10px 12px;
  border-radius: var(--radius); background: var(--accent-soft); color: var(--text);
  font-size: 12.5px;
}
.tip .icon { color: var(--accent); margin-top: 1px; }
.tip p { margin: 0; flex: 1; }
.tip b { font-weight: 600; }

/* ------------------------------------------------------------ slots */

.slots {
  flex: 1 1 auto; min-height: 0; overflow: auto;
  display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  align-content: start; gap: 10px;
  padding: 12px;
}
.slot {
  position: relative; display: flex; flex-direction: column; min-width: 0;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow);
  transition: border-color 0.15s, box-shadow 0.15s, transform 0.15s, opacity 0.15s;
  cursor: pointer; outline: none;
}
.slot.empty { background: var(--surface-2); border-style: dashed; box-shadow: none; }
.slot.filled { cursor: grab; }
.slot:focus-visible { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.slot.drop-target { border-color: var(--accent); border-style: solid; box-shadow: 0 0 0 3px var(--accent-soft), var(--shadow); transform: translateY(-2px); }
.slot.dragging { opacity: 0.45; }
.slot.just-placed { animation: placed 0.6s ease; }
@keyframes placed { 0% { transform: scale(0.96); } 45% { transform: scale(1.02); } 100% { transform: none; } }

.slot-head { display: flex; align-items: center; gap: 6px; padding: 8px 9px 7px; min-width: 0; }
.slot-badge {
  font: 700 11px/1 var(--mono); padding: 4px 6px; border-radius: 5px;
  background: var(--accent-soft); color: var(--accent); white-space: nowrap; max-width: 60%;
  overflow: hidden; text-overflow: ellipsis;
}
.slot-label { flex: 1; min-width: 0; font-weight: 600; font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.slot-req { color: var(--warn); font-size: 18px; line-height: 10px; }
.slot-key { font: 600 10px/1 var(--mono); color: var(--text-3); border: 1px solid var(--border); border-bottom-width: 2px; border-radius: 4px; padding: 2px 4px; }

.slot-media { position: relative; margin: 0 8px; aspect-ratio: 4 / 5; border-radius: 7px; overflow: hidden; background: var(--thumb-bg); }
.slot.empty .slot-media { background: transparent; border: 1px dashed var(--border-strong); }
.slot-media .thumb { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; display: block; }
.thumb-fallback { position: absolute; inset: 0; display: grid; place-items: center; font: 700 14px var(--mono); color: var(--text-3); }
.slot-placeholder { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; padding: 10px; text-align: center; }
.ph-num { font: 700 30px/1 var(--mono); color: var(--border-strong); max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
.ph-hint { font-size: 11.5px; color: var(--text-2); }
.ph-drop { font-size: 11px; color: var(--accent); opacity: 0; transition: opacity 0.15s; }
.slot:hover .ph-drop, .slot.drop-target .ph-drop { opacity: 1; }

.slot-remove {
  position: absolute; top: 6px; right: 6px; width: 24px; height: 24px; border-radius: 50%;
  border: 0; background: rgba(12, 14, 18, 0.62); color: #fff; display: grid; place-items: center;
  cursor: pointer; opacity: 0; transition: opacity 0.15s, background 0.15s;
}
.slot-remove .icon { width: 13px; height: 13px; }
.slot-remove:hover { background: var(--danger); }
.slot:hover .slot-remove, .slot:focus-within .slot-remove { opacity: 1; }
@media (hover: none) { .slot-remove { opacity: 1; } }

.chip {
  position: absolute; left: 6px; top: 6px; height: 22px; min-width: 22px; padding: 0 6px;
  display: inline-flex; align-items: center; justify-content: center; gap: 4px;
  border-radius: 11px; font-size: 11px; font-weight: 600; color: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
}
.chip .icon { width: 13px; height: 13px; }
.chip.ok { background: var(--ok); }
.chip.pending { background: var(--warn); }
.chip.error { background: var(--danger); }
.chip.busy { background: var(--accent); }

.slot-foot { padding: 8px 10px 10px; min-width: 0; }
.slot-name { font: 600 12.5px/1.3 var(--mono); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text); }
.slot.empty .slot-name { color: var(--text-3); font-weight: 500; }
.slot-sub { margin-top: 3px; font-size: 11px; color: var(--text-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.slot.st-done .slot-sub { color: var(--ok); }
.slot.st-pending .slot-sub { color: var(--warn); }
.slot.st-error { border-color: var(--danger); }
.slot.st-error .slot-name, .slot.st-error .slot-sub { color: var(--danger); }
.slot.st-busy .slot-sub { color: var(--accent); }

.spin { animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ------------------------------------------------------------ footer */

.footer {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 10px;
  padding: 10px 12px;
  border-top: 1px solid var(--border);
  background: var(--surface);
}
.progress { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--text-2); min-width: 0; }
.busy { display: inline-flex; align-items: center; gap: 5px; color: var(--accent); }
.footer-actions { display: flex; gap: 6px; flex-wrap: wrap; margin-left: auto; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 30px; padding: 0 12px;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--surface-2); color: var(--text); font-weight: 500; cursor: pointer; white-space: nowrap;
}
.btn:hover { background: var(--surface-3); }
.btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.btn:disabled { opacity: 0.45; cursor: default; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); font-weight: 600; }
.btn.primary:hover:not(:disabled) { background: var(--accent-strong); border-color: var(--accent-strong); }
.btn.danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn.ghost { background: transparent; border-color: transparent; color: var(--text-2); }
.btn.ghost:hover:not(:disabled) { background: var(--surface-3); color: var(--text); }
.btn.icon-only { width: 30px; padding: 0; }
.btn.small { height: 26px; padding: 0 9px; font-size: 12px; }

/* ------------------------------------------------------------ toasts */

.toasts {
  position: fixed; left: 50%; bottom: 16px; transform: translateX(-50%);
  display: flex; flex-direction: column; gap: 8px; align-items: center;
  z-index: 80; width: min(460px, calc(100vw - 32px)); pointer-events: none;
}
.toast {
  pointer-events: auto; display: flex; align-items: center; gap: 10px; width: 100%;
  padding: 9px 8px 9px 12px; border-radius: 10px;
  background: var(--text); color: var(--bg); box-shadow: var(--shadow-lg);
  font-size: 12.5px; animation: toast-in 0.18s ease;
}
.toast.out { opacity: 0; transform: translateY(6px); transition: opacity 0.18s, transform 0.18s; }
.toast .toast-msg { flex: 1; min-width: 0; }
.toast::before { content: ""; width: 8px; height: 8px; border-radius: 50%; flex: none; background: var(--accent); }
.toast.ok::before { background: var(--ok); }
.toast.warn::before { background: var(--warn); }
.toast.error::before { background: var(--danger); }
.toast-action { border: 0; background: transparent; color: inherit; font-weight: 700; text-decoration: underline; cursor: pointer; padding: 2px 4px; }
.toast-close { border: 0; background: transparent; color: inherit; opacity: 0.6; cursor: pointer; display: grid; place-items: center; width: 22px; height: 22px; }
.toast-close:hover { opacity: 1; }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }

/* ------------------------------------------------------------ modals */

.modal-overlay {
  position: fixed; inset: 0; z-index: 60; background: var(--overlay);
  display: flex; align-items: center; justify-content: center; padding: 16px;
  animation: fade 0.12s ease;
}
@keyframes fade { from { opacity: 0; } }
.modal {
  width: min(540px, 100%); max-height: calc(100vh - 32px);
  display: flex; flex-direction: column;
  background: var(--surface); color: var(--text);
  border: 1px solid var(--border); border-radius: 14px; box-shadow: var(--shadow-lg);
}
.modal.wide { width: min(1000px, 100%); height: min(760px, calc(100vh - 32px)); }
.modal-head { display: flex; align-items: center; gap: 8px; padding: 14px 16px 12px 18px; border-bottom: 1px solid var(--border); }
.modal-head h2 { margin: 0; font-size: 15px; font-weight: 650; flex: 1; }
.modal-body { padding: 16px 18px; overflow: auto; min-height: 0; flex: 1 1 auto; -webkit-user-select: text; user-select: text; }
.modal-body p { margin: 0 0 10px; color: var(--text-2); }
.modal-actions { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: 8px; padding: 12px 16px; border-top: 1px solid var(--border); }

.form-grid { display: grid; grid-template-columns: 170px 1fr; gap: 12px 14px; align-items: center; }
.form-grid > label { color: var(--text-2); font-size: 12.5px; }
.form-grid .full { grid-column: 1 / -1; }
.form-grid > .btn { justify-self: start; }
.form-grid .hint { grid-column: 2; margin-top: -6px; font-size: 11.5px; color: var(--text-3); }
.form-section { grid-column: 1 / -1; margin: 8px 0 -2px; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-3); }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.radio-row label, .check-row { display: inline-flex; align-items: center; gap: 6px; color: var(--text); cursor: pointer; }
.segmented { display: inline-flex; padding: 2px; border-radius: 8px; background: var(--surface-3); gap: 2px; }
.segmented button { border: 0; background: transparent; padding: 5px 10px; border-radius: 6px; cursor: pointer; color: var(--text-2); }
.segmented button.on { background: var(--surface); color: var(--text); box-shadow: 0 1px 2px rgba(0, 0, 0, 0.12); font-weight: 600; }
.swatches { display: flex; gap: 6px; flex-wrap: wrap; }
.swatch { width: 22px; height: 22px; border-radius: 50%; border: 2px solid transparent; cursor: pointer; display: grid; place-items: center; background: var(--surface-3); color: var(--text-3); padding: 0; }
.swatch.on { border-color: var(--text); }
.warn-text { color: var(--warn); font-size: 12px; }
.error-text { color: var(--danger); font-size: 12px; }

@media (max-width: 560px) {
  .form-grid { grid-template-columns: 1fr; }
  /* Anything still pinned to column 2 would open an implicit second column and shift every row. */
  .form-grid .hint, .form-grid .tokens { grid-column: 1; }
}

/* ------------------------------------------------------------ template editor */

.tpl-editor { display: grid; grid-template-columns: 230px 1fr; gap: 16px; height: 100%; min-height: 0; }
.tpl-side { display: flex; flex-direction: column; gap: 8px; min-height: 0; }
.tpl-list { flex: 1; overflow: auto; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface-2); padding: 4px; }
.tpl-item { display: block; width: 100%; text-align: left; border: 0; background: transparent; padding: 8px 10px; border-radius: 7px; cursor: pointer; }
.tpl-item:hover { background: var(--surface-3); }
.tpl-item.on { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.tpl-item small { display: block; color: var(--text-3); font: 11px var(--mono); margin-top: 2px; font-weight: 400; }
.tpl-side .row .btn { flex: 1 1 auto; }
.tpl-form { min-width: 0; min-height: 0; overflow: auto; padding-right: 4px; }
.code-hint { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; }
.tokens { display: flex; flex-wrap: wrap; gap: 5px; grid-column: 2; margin-top: -4px; }
.token { font: 11.5px var(--mono); padding: 3px 7px; border-radius: 5px; border: 1px solid var(--border); background: var(--surface-2); cursor: pointer; }
.token:hover { border-color: var(--accent); color: var(--accent); }
.pattern-input { font-family: var(--mono) !important; }

.table-scroll { overflow-x: auto; }
.slot-table { width: 100%; border-collapse: collapse; }
.slot-table th { text-align: left; font-size: 11px; font-weight: 600; color: var(--text-3); padding: 0 6px 6px; white-space: nowrap; }
.slot-table td { padding: 3px 4px; vertical-align: middle; }
.slot-table input[type="text"] { width: 100%; height: 28px; }
.slot-table .pos { font: 600 12px var(--mono); color: var(--accent); white-space: nowrap; padding-left: 6px; }
.slot-table .code input { font-family: var(--mono); }
.slot-table .tools { white-space: nowrap; }
.slot-table .tools .icon-btn { width: 26px; height: 26px; }

.preview { margin-top: 14px; padding: 10px 12px; border-radius: var(--radius); background: var(--surface-2); border: 1px solid var(--border); }
.preview h4 { margin: 0 0 6px; font-size: 11px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-3); }
.preview ol { margin: 0; padding-left: 0; list-style: none; columns: 2 220px; column-gap: 20px; }
.preview li { font: 12px/1.7 var(--mono); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.preview li span { color: var(--text-3); }

@media (max-width: 760px) {
  .tpl-editor { grid-template-columns: 1fr; height: auto; }
  .modal.wide { height: auto; }
  .tpl-list { max-height: 180px; }
  .slot-table .hint-col { display: none; }
}

/* ------------------------------------------------------------ log */

.log-list { list-style: none; margin: 0; padding: 0; font-size: 12px; }
.log-list li { display: grid; grid-template-columns: 64px 74px 1fr; gap: 8px; padding: 6px 0; border-bottom: 1px solid var(--border); }
.log-list time { color: var(--text-3); font-family: var(--mono); }
.log-type { font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; color: var(--text-3); }
.log-type.error { color: var(--danger); }
.log-type.rename { color: var(--accent); }
.log-type.commit { color: var(--ok); }
.log-msg { font-family: var(--mono); word-break: break-all; }

/* ------------------------------------------------------------ Capture One simulation (demo only) */

.demo-pane { display: flex; flex-direction: column; background: #202020; color: #cfcfcf; min-height: 0; -webkit-user-select: none; user-select: none; }
.c1-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; padding: 9px 12px; background: #2a2a2a; border-bottom: 1px solid #111; }
.c1-app { font-weight: 700; color: #f1f1f1; white-space: nowrap; }
.c1-badge { font-size: 10.5px; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase; color: #cdb6ff; background: rgba(161, 120, 240, 0.18); padding: 3px 7px; border-radius: 10px; white-space: nowrap; }
.c1-path { flex: 1; min-width: 0; font-size: 12px; color: #9a9a9a; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.c1-path b { color: #e2e2e2; font-weight: 600; }
.c1-tools { display: flex; gap: 6px; align-items: center; }
.c1-btn { height: 26px; padding: 0 10px; border-radius: 5px; border: 1px solid #3c3c3c; background: #333; color: #e6e6e6; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; font-size: 12px; white-space: nowrap; }
.c1-btn:hover { background: #3d3d3d; }
.c1-btn .icon { width: 14px; height: 14px; }
.c1-select { height: 26px; border-radius: 5px; border: 1px solid #3c3c3c; background-color: #333; color: #e6e6e6; font-size: 12px; }
.c1-hint { padding: 8px 12px; font-size: 12px; color: #a9a9a9; background: #252525; border-bottom: 1px solid #161616; display: flex; gap: 8px; align-items: center; }
.c1-hint .icon { color: #cdb6ff; }
.c1-grid { flex: 1; min-height: 0; overflow: auto; display: grid; grid-template-columns: repeat(auto-fill, minmax(128px, 1fr)); align-content: start; gap: 10px; padding: 12px; }
.c1-cell { background: #2b2b2b; border: 2px solid transparent; border-radius: 4px; padding: 5px 5px 6px; cursor: grab; transition: border-color 0.1s; }
.c1-cell:hover { background: #313131; }
.c1-cell.selected { border-color: #8a8a8a; background: #353535; }
.c1-cell.primary { border-color: #f0f0f0; }
.c1-cell img { display: block; width: 100%; aspect-ratio: 4 / 5; object-fit: cover; border-radius: 2px; background: #3a3a3a; pointer-events: none; }
.c1-meta { display: flex; align-items: center; gap: 5px; margin-top: 5px; min-width: 0; }
.c1-name { flex: 1; min-width: 0; font: 11px/1.3 var(--mono); color: #d8d8d8; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.c1-cell.renamed .c1-name { color: #9fe0b5; }
.c1-tag { width: 9px; height: 9px; border-radius: 50%; flex: none; }
.c1-stars { font-size: 10px; letter-spacing: -1px; color: #d9b44a; white-space: nowrap; }
.c1-foot { padding: 7px 12px; font-size: 11.5px; color: #8d8d8d; border-top: 1px solid #111; background: #262626; display: flex; flex-wrap: wrap; justify-content: space-between; gap: 4px 10px; }
.c1-note { flex-basis: 100%; color: #6f6f6f; }

/* ------------------------------------------------------------ files mode: library */

body.files .board-pane { flex: 0 0 min(540px, 46vw); border-left: 1px solid var(--border); }
@media (max-width: 860px) {
  body.files .board-pane { flex: none; width: 100%; border-left: 0; border-top: 1px solid var(--border); }
}
.demo-pane.library-pane { position: relative; background: var(--bg); color: var(--text); }
.library-pane.drag-over { box-shadow: inset 0 0 0 3px var(--accent); }

.lib-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; padding: 10px 12px; background: var(--surface); border-bottom: 1px solid var(--border); }
.lib-title { font-weight: 700; }
.lib-progress { font-size: 12px; color: var(--text-3); }
.lib-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-left: auto; }
.lib-privacy { display: flex; align-items: center; gap: 8px; padding: 7px 12px; font-size: 12px; color: var(--text-2); background: var(--surface-2); border-bottom: 1px solid var(--border); }
.lib-privacy .icon { color: var(--ok); width: 14px; height: 14px; }

.lib-body { flex: 1 1 auto; min-height: 0; display: grid; grid-template-columns: minmax(180px, 230px) 1fr; }
.lib-products { min-height: 0; overflow: auto; padding: 6px; background: var(--surface); border-right: 1px solid var(--border); display: flex; flex-direction: column; gap: 2px; }
.lib-product {
  position: relative; display: grid; grid-template-columns: 1fr auto; gap: 1px 8px; align-items: baseline;
  width: 100%; padding: 7px 9px; border: 0; border-radius: 8px; background: transparent; text-align: left; cursor: pointer;
}
.lib-product:hover { background: var(--surface-3); }
.lib-product.on { background: var(--accent-soft); }
.lib-product .name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lib-product.on .name { color: var(--accent); }
.lib-product .state { font-size: 11px; color: var(--text-3); white-space: nowrap; }
.lib-product.done .state { color: var(--ok); font-weight: 600; }
.lib-product .meta { grid-column: 1 / -1; font-size: 11px; color: var(--text-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lib-product .warn-icon { position: absolute; right: 8px; bottom: 7px; width: 13px; height: 13px; color: var(--warn); }

.lib-main { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.lib-product-head { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; padding: 10px 12px; border-bottom: 1px solid var(--border); background: var(--surface-2); }
.lib-product-title { font-weight: 700; font-size: 14px; }
.lib-path { font-size: 12px; color: var(--text-3); min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mode-badge { font-size: 11px; font-weight: 600; padding: 3px 9px; border-radius: 11px; white-space: nowrap; }
.mode-badge.move { background: var(--ok-soft); color: var(--ok); }
.mode-badge.copy { background: var(--accent-soft); color: var(--accent); }
.mode-badge.zip, .mode-badge.zipDenied, .mode-badge.zipFramed, .mode-badge.zipInsecure { background: var(--warn-soft); color: var(--warn); }
.mode-badge.ask { background: var(--accent-soft); color: var(--accent); }
.lib-warning { display: flex; gap: 8px; align-items: flex-start; margin: 10px 12px 0; padding: 9px 12px; border-radius: var(--radius); background: var(--warn-soft); font-size: 12.5px; }
.lib-warning .icon { color: var(--warn); margin-top: 1px; }

.lib-grid { flex: 1 1 auto; min-height: 0; overflow: auto; display: grid; grid-template-columns: repeat(auto-fill, minmax(128px, 1fr)); align-content: start; gap: 10px; padding: 12px; }
.lib-cell { position: relative; padding: 5px 5px 6px; border: 2px solid transparent; border-radius: 8px; background: var(--surface); box-shadow: var(--shadow); cursor: grab; }
.lib-cell:hover { border-color: var(--border); }
.lib-cell.selected { border-color: var(--border-strong); background: var(--surface-3); }
.lib-cell.primary { border-color: var(--accent); }
.lib-cell img { display: block; width: 100%; max-width: 100%; aspect-ratio: 4 / 5; object-fit: contain; border-radius: 4px; background: var(--thumb-bg); pointer-events: none; }
.lib-cell .meta { display: flex; align-items: center; gap: 5px; margin-top: 5px; min-width: 0; }
.lib-cell .name { flex: 1; min-width: 0; font: 11px/1.3 var(--mono); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lib-cell.renamed .name { color: var(--ok); font-weight: 600; }
.lib-cell .types { font: 600 9.5px/1 var(--mono); color: var(--text-3); white-space: nowrap; }
.lib-cell .slot-mark { position: absolute; top: 9px; left: 9px; padding: 3px 6px; border-radius: 5px; background: var(--accent); color: var(--on-accent); font: 700 11px/1 var(--mono); box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25); }
/* Open pictures on top, renamed ones in their own resizable section below. */
.lib-split { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; }
.lib-split > .lib-grid-open { flex: 1 1 0; min-height: 90px; }
.lib-grid-empty { grid-column: 1 / -1; margin: 0; padding: 28px 8px; text-align: center; font-size: 12.5px; color: var(--text-3); }
.lib-done { flex: 0 0 35%; min-height: 0; display: flex; flex-direction: column; border-top: 1px solid var(--border-strong); background: var(--surface-2); }
.lib-done.collapsed { flex: 0 0 auto; }
.lib-done-head { display: flex; align-items: center; gap: 8px; min-width: 0; padding: 5px 8px 5px 12px; font-size: 12px; color: var(--text-2); cursor: row-resize; user-select: none; touch-action: none; }
.lib-done.collapsed .lib-done-head { cursor: default; }
.lib-done-head .icon { width: 14px; height: 14px; color: var(--ok); flex: none; }
.lib-done-title { font-weight: 700; color: var(--text); white-space: nowrap; }
.lib-done-hint { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text-3); }
.lib-done .lib-grid { flex: 1 1 auto; min-height: 0; padding-top: 6px; }
.lib-done.collapsed .lib-grid { display: none; }
.lib-foot { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 4px 10px; padding: 7px 12px; font-size: 11.5px; color: var(--text-3); border-top: 1px solid var(--border); background: var(--surface); }

.lib-empty { flex: 1 1 auto; display: flex; align-items: center; justify-content: center; padding: 24px 16px; }
.drop-zone { display: flex; flex-direction: column; align-items: center; gap: 12px; max-width: 520px; padding: 40px 28px; border: 2px dashed var(--border-strong); border-radius: 16px; text-align: center; color: var(--text-2); }
.drop-zone h2 { margin: 0; font-size: 18px; color: var(--text); text-wrap: balance; }
.drop-zone p { margin: 0; }
.drop-zone .drop-icon { width: 34px; height: 34px; color: var(--accent); }
.drop-zone .hint-text { font-size: 12px; color: var(--warn); }
.drop-zone .note-text { font-size: 12px; color: var(--text-3); max-width: 46ch; }
.library-pane.drag-over .drop-zone { border-color: var(--accent); background: var(--accent-soft); }

.lib-busy { position: absolute; inset: 0; z-index: 5; display: flex; align-items: center; justify-content: center; background: rgba(10, 12, 16, 0.28); }
.lib-busy-box { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-radius: 12px; background: var(--surface); box-shadow: var(--shadow-lg); font-weight: 600; }
.lib-busy-box .icon { color: var(--accent); }

@media (max-width: 1100px) {
  .lib-body { grid-template-columns: 1fr; grid-template-rows: auto 1fr; }
  .lib-products { flex-direction: row; overflow-x: auto; border-right: 0; border-bottom: 1px solid var(--border); }
  .lib-product { width: auto; min-width: 150px; flex: none; }
}
