/* Simulix admin panels (project panel and main panel): a sidebar layout with light and dark themes. */
@font-face {
  font-family: Vazirmatn;
  src: url("/shared/fonts/Vazirmatn-Variable.woff2") format("woff2");
  font-weight: 100 900;
  font-display: swap;
}

:root {
  color-scheme: light;
  --bg: #f4f3f0;
  --surface: #ffffff;
  --surface-2: #f8f7f4;
  --hover: #f1efea;
  --text: #1d1c1a;
  --muted: #6e6a63;
  --faint: #9c978e;
  --line: #e6e3dc;
  --line-strong: #d6d2c8;
  --accent: #a98545;
  --accent-hover: #93723a;
  --accent-ink: #ffffff;
  --accent-soft: #f5eedf;
  --accent-text: #85672f;
  --danger: #b4443c;
  --danger-soft: #fbeceb;
  --ok: #2f7a47;
  --ok-soft: #e5f3e9;
  --warn: #9a6a12;
  --warn-soft: #fbf1dc;
  --input: #ffffff;
  --shadow: 0 1px 2px rgba(20, 18, 14, .04), 0 4px 16px rgba(20, 18, 14, .04);
  --shadow-pop: 0 12px 40px rgba(20, 18, 14, .18);
  --radius: 14px;
  --radius-sm: 9px;
  --sidebar: 268px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #111113;
    --surface: #19191c;
    --surface-2: #1f1f23;
    --hover: #26262b;
    --text: #ecebe8;
    --muted: #a3a09a;
    --faint: #75726c;
    --line: #2a2a2f;
    --line-strong: #393940;
    --accent: #cfae6d;
    --accent-hover: #dcbf85;
    --accent-ink: #1b1508;
    --accent-soft: #2c261a;
    --accent-text: #dcbf85;
    --danger: #ec7b72;
    --danger-soft: #3a1f1d;
    --ok: #6cc58a;
    --ok-soft: #1a3022;
    --warn: #e2b252;
    --warn-soft: #352a14;
    --input: #141417;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3);
    --shadow-pop: 0 16px 48px rgba(0, 0, 0, .55);
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #111113;
  --surface: #19191c;
  --surface-2: #1f1f23;
  --hover: #26262b;
  --text: #ecebe8;
  --muted: #a3a09a;
  --faint: #75726c;
  --line: #2a2a2f;
  --line-strong: #393940;
  --accent: #cfae6d;
  --accent-hover: #dcbf85;
  --accent-ink: #1b1508;
  --accent-soft: #2c261a;
  --accent-text: #dcbf85;
  --danger: #ec7b72;
  --danger-soft: #3a1f1d;
  --ok: #6cc58a;
  --ok-soft: #1a3022;
  --warn: #e2b252;
  --warn-soft: #352a14;
  --input: #141417;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3);
  --shadow-pop: 0 16px 48px rgba(0, 0, 0, .55);
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: Vazirmatn, Tahoma, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14.5px;
  line-height: 1.75;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent-text); }
.hidden { display: none !important; }
.ltr { direction: ltr; text-align: left; }
svg.i { width: 18px; height: 18px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

.brand { letter-spacing: .32em; font-weight: 300; font-size: 17px; direction: ltr; color: var(--text); }
.brand b { font-weight: 650; color: var(--accent-text); }

/* ---------- Shell: sidebar + content ---------- */
.shell { display: grid; grid-template-columns: var(--sidebar) minmax(0, 1fr); min-height: 100vh; }
.sidebar { background: var(--surface); border-inline-end: 1px solid var(--line); }
.sidebar-inner { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; padding: 20px 14px 14px; overflow-y: auto; }
.sb-head { padding: 2px 10px 18px; }
.sb-head .project { margin-top: 2px; color: var(--muted); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sb-label { font-size: 12px; color: var(--faint); padding: 14px 10px 6px; }
.sb-link {
  display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 10px;
  color: var(--text); text-decoration: none; font-size: 14px; margin-bottom: 2px;
}
.sb-link:hover { background: var(--hover); }
.sb-link.active { background: var(--accent-soft); color: var(--accent-text); font-weight: 600; }
.sb-link .sb-text { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sb-link .chip { font-weight: 400; }
.sb-link.is-hidden .sb-text { opacity: .55; }
.sb-foot { margin-top: auto; padding-top: 14px; display: flex; flex-direction: column; gap: 10px; }
.sb-user { display: flex; align-items: center; gap: 8px; padding: 10px; border-top: 1px solid var(--line); margin-top: 4px; }
.sb-user .name { flex: 1; font-size: 13px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; direction: ltr; text-align: right; }
.avatar {
  width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; flex: none;
  background: var(--accent-soft); color: var(--accent-text); font-weight: 650; font-size: 13px; text-transform: uppercase;
}

.main { min-width: 0; display: flex; flex-direction: column; }
.mobile-bar { display: none; }
.page { width: 100%; max-width: 1040px; margin: 0 auto; padding: 32px 32px 64px; }
.page-head { display: flex; align-items: flex-start; gap: 16px; flex-wrap: wrap; margin-bottom: 22px; }
.page-head .titles { flex: 1 1 260px; min-width: 0; }
.page-head h1 { margin: 0; font-size: 24px; font-weight: 700; line-height: 1.4; display: flex; align-items: center; gap: 10px; }
.page-head .sub { margin: 4px 0 0; color: var(--muted); }
.page-head .actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

/* ---------- Segmented control (theme, sub-pages) ---------- */
.seg { display: flex; padding: 3px; border-radius: 11px; background: var(--surface-2); border: 1px solid var(--line); gap: 2px; }
.seg button {
  flex: 1; display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 6px 10px; border: 0; border-radius: 8px; background: transparent; color: var(--muted);
  font: inherit; font-size: 13px; cursor: pointer;
}
.seg button:hover { color: var(--text); }
.seg button.active { background: var(--surface); color: var(--text); box-shadow: var(--shadow); font-weight: 600; }
.seg svg.i { width: 16px; height: 16px; }
.subnav { display: inline-flex; margin-bottom: 18px; max-width: 100%; overflow-x: auto; }
.subnav button { flex: none; padding: 7px 16px; font-size: 14px; }

/* ---------- Cards ---------- */
.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 22px 24px; margin-bottom: 18px; box-shadow: var(--shadow);
}
.card-head { display: flex; align-items: flex-start; gap: 12px; margin-bottom: 14px; }
.card-head > div { flex: 1; min-width: 0; }
.card h2 { margin: 0; font-size: 16.5px; font-weight: 650; }
.card .sub { margin: 4px 0 0; color: var(--muted); font-size: 13.5px; }
.card h3 { font-size: 14.5px; font-weight: 650; margin: 24px 0 2px; }
.card > h3:first-child { margin-top: 0; }
.divider { border: 0; border-top: 1px solid var(--line); margin: 22px 0; }

/* ---------- Forms ---------- */
label { display: block; font-size: 13.5px; margin: 14px 0 6px; color: var(--muted); }
label.check { display: flex; align-items: center; gap: 8px; color: var(--text); cursor: pointer; }
input[type=text], input[type=password], input[type=email], input[type=number], input[type=search], select, textarea {
  width: 100%; padding: 9px 12px; border: 1px solid var(--line-strong); border-radius: var(--radius-sm);
  font: inherit; background: var(--input); color: var(--text); transition: border-color .15s, box-shadow .15s;
}
textarea { resize: vertical; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
input[type=radio] { accent-color: var(--accent); margin: 0; }
input[type=checkbox] { width: 16px; height: 16px; accent-color: var(--accent); margin: 0; }
input[type=file] { font: inherit; font-size: 13px; color: var(--muted); max-width: 100%; }
input[type=file]::file-selector-button {
  font: inherit; margin-inline-end: 10px; padding: 7px 14px; border-radius: var(--radius-sm);
  border: 1px solid var(--line-strong); background: var(--surface-2); color: var(--text); cursor: pointer;
}
input[type=file]::file-selector-button:hover { background: var(--hover); }
.row { display: flex; gap: 12px; flex-wrap: wrap; align-items: end; }
.row > * { flex: 1 1 180px; }
.row > .shrink { flex: 0 0 auto; }
.hint { color: var(--muted); font-size: 13px; margin: 6px 0 0; }
.msg { margin-top: 10px; font-size: 13.5px; min-height: 1.4em; }
.msg:empty { min-height: 0; margin: 0; }
.msg.err { color: var(--danger); }
.msg.ok { color: var(--ok); }

/* Switch (a checkbox styled as a toggle) */
.switch { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; margin: 0; color: var(--text); font-size: 14px; }
.switch input { appearance: none; -webkit-appearance: none; width: 38px; height: 22px; border-radius: 99px; background: var(--line-strong); position: relative; cursor: pointer; transition: background .2s; flex: none; }
.switch input::after { content: ""; position: absolute; top: 3px; inset-inline-start: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: transform .2s; box-shadow: 0 1px 2px rgba(0,0,0,.25); }
.switch input:checked { background: var(--accent); }
.switch input:checked::after { transform: translateX(-16px); }
[dir="ltr"] .switch input:checked::after { transform: translateX(16px); }

/* ---------- Buttons ---------- */
button, .btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  padding: 8px 16px; border-radius: var(--radius-sm); border: 1px solid var(--accent);
  background: var(--accent); color: var(--accent-ink); font: inherit; font-size: 14px; font-weight: 550;
  cursor: pointer; text-decoration: none; white-space: nowrap; transition: background .15s, border-color .15s, color .15s;
}
button:hover, .btn:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
button.ghost, .btn.ghost { background: var(--surface); color: var(--text); border-color: var(--line-strong); font-weight: 500; }
button.ghost:hover, .btn.ghost:hover { background: var(--hover); border-color: var(--line-strong); }
button.danger { background: transparent; color: var(--danger); border-color: var(--line-strong); font-weight: 500; }
button.danger:hover { background: var(--danger-soft); border-color: var(--danger); }
button.icon, .btn.icon { padding: 7px; background: transparent; border-color: transparent; color: var(--muted); }
button.icon:hover, .btn.icon:hover { background: var(--hover); color: var(--text); border-color: transparent; }
button.sm { padding: 4px 10px; font-size: 13px; }
button:disabled, button:disabled:hover { opacity: .45; cursor: not-allowed; }
.seg button:disabled { opacity: .45; }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; margin: 0 -4px; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: right; padding: 11px 8px; border-bottom: 1px solid var(--line); vertical-align: middle; }
tbody tr:last-child td { border-bottom: 0; }
th { color: var(--faint); font-weight: 500; font-size: 12.5px; }
td.actions { text-align: left; white-space: nowrap; }
td.actions button, td.actions .btn { margin-inline-start: 4px; vertical-align: middle; }

/* ---------- Badges and chips ---------- */
.badge, .chip {
  display: inline-flex; align-items: center; gap: 5px; padding: 1px 10px; border-radius: 99px; font-size: 12.5px;
  background: var(--surface-2); color: var(--muted); border: 1px solid var(--line); white-space: nowrap; line-height: 1.8;
}
.chip { padding: 0 8px; font-size: 11.5px; }
.badge.ready, .chip.ready { background: var(--ok-soft); color: var(--ok); border-color: transparent; }
.badge.processing, .badge.queued, .chip.warn { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
.note-warn { margin: 0 0 12px; padding: 8px 12px; border-radius: 10px; background: var(--warn-soft); color: var(--warn); font-size: 13px; }
.badge.failed { background: var(--danger-soft); color: var(--danger); border-color: transparent; }
.chip.accent { background: var(--accent-soft); color: var(--accent-text); border-color: transparent; }

/* ---------- Progress ---------- */
.progress { height: 6px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 99px; overflow: hidden; margin-top: 10px; }
.progress > div { height: 100%; background: var(--accent); width: 0; transition: width .4s; }

/* ---------- Mode cards (choose how a menu shows its content) ---------- */
.modes { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; }
.mode {
  position: relative; display: flex; flex-direction: column; align-items: flex-start; gap: 6px; text-align: right;
  padding: 16px 16px 14px; border-radius: 12px; border: 1.5px solid var(--line); background: var(--surface-2);
  color: var(--text); font-weight: 400; white-space: normal; cursor: pointer;
}
.mode:hover { background: var(--hover); border-color: var(--line-strong); }
.mode .mode-icon { width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center; background: var(--surface); border: 1px solid var(--line); color: var(--accent-text); }
.mode .mode-icon svg.i { width: 20px; height: 20px; }
.mode strong { font-size: 14.5px; font-weight: 650; }
.mode span.desc { font-size: 13px; color: var(--muted); line-height: 1.7; }
.mode.active { border-color: var(--accent); background: var(--accent-soft); }
.mode.active::after {
  content: ""; position: absolute; top: 14px; left: 14px; width: 20px; height: 20px; border-radius: 50%;
  background: var(--accent) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 12l5 5L20 7'/%3E%3C/svg%3E") center / 12px no-repeat;
}
.mode:disabled { cursor: not-allowed; opacity: .6; }
.mode:disabled:hover { background: var(--surface-2); border-color: var(--line); }
.mode .soon { position: absolute; top: 14px; left: 14px; }

/* ---------- Empty state ---------- */
.empty { text-align: center; padding: 34px 16px; color: var(--muted); }
.empty svg.i { width: 34px; height: 34px; color: var(--faint); stroke-width: 1.4; }
.empty p { margin: 8px 0 0; }

/* ---------- Dialog and toast ---------- */
dialog.dlg {
  border: 1px solid var(--line); border-radius: 16px; padding: 22px 24px 18px; width: min(420px, calc(100vw - 32px));
  background: var(--surface); color: var(--text); box-shadow: var(--shadow-pop);
}
dialog.dlg::backdrop { background: rgba(10, 10, 12, .45); backdrop-filter: blur(2px); }
dialog.dlg h3 { margin: 0 0 6px; font-size: 16px; }
dialog.dlg p { margin: 0; color: var(--muted); font-size: 14px; white-space: pre-line; }
dialog.dlg input { margin-top: 12px; }
dialog.dlg .dlg-actions { display: flex; gap: 8px; justify-content: flex-start; margin-top: 20px; }
.toasts { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; gap: 8px; z-index: 50; pointer-events: none; }
.toast {
  padding: 9px 18px; border-radius: 11px; background: var(--text); color: var(--bg); font-size: 14px;
  box-shadow: var(--shadow-pop); animation: toast-in .2s ease; max-width: calc(100vw - 32px);
}
.toast.err { background: var(--danger); color: #fff; }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }

/* ---------- Login ---------- */
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.login-wrap .card { width: 100%; max-width: 380px; padding: 30px 28px; }
.login-wrap .brand { text-align: center; margin-bottom: 18px; font-size: 20px; }
.login-wrap h2 { text-align: center; }
.login-wrap button[type=submit] { width: 100%; margin-top: 18px; padding: 10px; }
.login-theme { position: fixed; top: 16px; left: 16px; }

/* ---------- Misc ---------- */
code, pre { direction: ltr; font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 12.5px; }
pre { background: var(--surface-2); border: 1px solid var(--line); padding: 12px 14px; border-radius: var(--radius-sm); white-space: pre-wrap; word-break: break-all; margin: 0; text-align: left; }
.copy-row { display: flex; gap: 8px; align-items: stretch; }
.copy-row pre { flex: 1; }
.range-row { display: flex; align-items: center; gap: 12px; }
.range-row input[type=range] { flex: 1; accent-color: var(--accent); }
.range-row output { min-width: 56px; text-align: center; font-weight: 600; padding: 2px 8px; border-radius: 8px; background: var(--surface-2); border: 1px solid var(--line); font-size: 13px; }
.preview { width: 100%; aspect-ratio: 16 / 9; border: 1px solid var(--line); border-radius: 12px; background: #0d0d0f; display: block; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; margin-top: 14px; }
.stat { padding: 10px 14px; border-radius: 11px; background: var(--surface-2); border: 1px solid var(--line); }
.stat .k { font-size: 12px; color: var(--faint); }
.stat .v { font-size: 14px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dropzone { border: 1.5px dashed var(--line-strong); border-radius: 12px; padding: 18px; background: var(--surface-2); }
.order-btns { display: inline-flex; gap: 2px; }
.order-btns button { padding: 4px 8px; }

/* ---------- Balloon editor ---------- */
.spot-image { margin-top: 8px; }
.spot-image img { display: block; max-width: 100%; max-height: 220px; border-radius: 10px; }
.spot-image img:not([src]) { display: none; }
.photo-grid { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 8px; }
.photo-grid figure { margin: 0; width: 124px; }
.photo-grid img { display: block; width: 124px; height: 82px; object-fit: cover; border-radius: 9px; border: 1px solid var(--line); }
.photo-grid .tools { display: flex; justify-content: space-between; margin-top: 4px; }
.photo-grid button { padding: 2px 8px; font-size: 12.5px; }
.placer { position: relative; margin-top: 8px; background: #0d0d0f; border-radius: 12px; overflow: hidden; cursor: crosshair; user-select: none; }
.placer img { display: block; width: 100%; height: auto; min-height: 120px; }
.placer-path { position: absolute; inset: 0; pointer-events: none; }
.placer-path i { position: absolute; width: 8px; height: 8px; margin: -4px 0 0 -4px; border-radius: 50%; background: #fff; border: 2px solid var(--accent); }
.placer-pin { position: absolute; transform: translate(-50%, -100%); pointer-events: none; }
.placer-pin span {
  display: block; padding: 4px 12px; border-radius: 10px; background: rgba(234, 234, 234, .9); color: #252525;
  font-size: 13px; white-space: nowrap; margin-bottom: 8px; position: relative;
}
.placer-pin span::after {
  content: ""; position: absolute; left: 50%; bottom: -7px; margin-left: -7px;
  border: 7px solid transparent; border-bottom: 0; border-top-color: rgba(234, 234, 234, .9);
}
.placer-pin.key span { outline: 2px solid var(--accent); }
.range-strip { position: relative; height: 10px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 99px; margin: 6px 0 0; overflow: hidden; direction: ltr; }
.range-strip b { position: absolute; top: 0; bottom: 0; background: var(--accent); opacity: .6; }
.range-strip i { position: absolute; top: 0; bottom: 0; width: 2px; background: var(--text); }
.keys { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; align-items: center; }
.keys button { padding: 2px 10px; font-size: 13px; }

/* ---------- Idle + transition videos ---------- */
.clip-rules { margin: 4px 0 12px; padding-inline-start: 18px; color: var(--muted); font-size: 13.5px; line-height: 1.9; }
.clip-rules b { color: var(--text); font-weight: 600; margin-inline-end: 6px; }
.clip-rules .names { display: block; direction: ltr; text-align: right; unicode-bidi: isolate; font-size: 12.5px; line-height: 1.6; margin-bottom: 4px; overflow-wrap: anywhere; }
.clip-set { border: 1px solid var(--line); border-radius: 12px; padding: 12px; margin-top: 10px; }
.clip-set h3 { margin: 0 0 8px; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.clip-ring { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; direction: ltr; }
.clip-ring figure { margin: 0; text-align: center; font-size: 12.5px; }
.clip-ring img { display: block; width: 112px; height: 63px; object-fit: cover; border-radius: 8px; border: 1px solid var(--line); background: #0d0d0f; }
.clip-ring .arrow { color: var(--muted); font-size: 18px; }
.idle-strip { display: flex; gap: 8px; overflow-x: auto; padding: 4px 0 8px; direction: ltr; }
.idle-strip button { flex: none; padding: 4px; border-radius: 10px; background: var(--surface); border: 2px solid var(--line); color: var(--text); font-size: 12.5px; }
.idle-strip button.active { border-color: var(--accent); }
.idle-strip img { display: block; width: 120px; height: 68px; object-fit: cover; border-radius: 7px; margin-bottom: 3px; background: #0d0d0f; }
#cbPins .placer-pin.sel span { outline: 2px solid var(--accent); }
tr.sel td { background: var(--accent-soft); }

/* ---------- Thumbnail sections ---------- */
.amen-section { border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; margin-top: 12px; background: var(--surface-2); }
.amen-section-head { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.amen-section-head strong { flex: 1 1 auto; font-size: 15px; }
.amen-section-head button, .amen-items button { padding: 3px 10px; font-size: 13px; }
.amen-items td { vertical-align: middle; }
.amen-items img { display: block; width: 72px; height: 44px; object-fit: cover; border-radius: 7px; background: var(--hover); }
.amen-add { display: flex; gap: 8px; margin-top: 10px; }
.amen-add input { flex: 1; }
/* Sub-scenes: the balloons that lead into each, one per line; the new-scene form picks its kind. */
.sc-use { display: block; font-size: 13px; line-height: 1.7; white-space: nowrap; }
.sc-new select { width: auto; flex: none; }
.amen-media { margin: 8px 0; }
.amen-media img, .amen-media video { display: block; max-width: 100%; max-height: 260px; border-radius: 10px; background: #0d0d0f; }
.amen-thumb { display: block; width: 120px; height: 72px; object-fit: cover; border-radius: 9px; background: var(--hover); }
.amen-thumb:not([src]) { visibility: hidden; }
.amen-editor { margin-top: 8px; }


/* ---------- Sales mode ---------- */
.grid-4 { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 0 12px; }
.sales-tools { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 8px; }
.sales-tools input[type=search] { flex: 0 1 280px; margin: 0; }
.sales-table td { padding: 8px 6px; }
.sales-table th { padding: 8px 6px; }
.sales-table input[type=checkbox] { width: auto; margin: 0; }
.swatch { display: inline-block; width: 22px; height: 14px; border-radius: 4px; border: 1px solid var(--line-strong); vertical-align: middle; }
.status-dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; background: var(--c); margin-inline-end: 6px; vertical-align: middle; }
input.color-input { width: 46px; height: 36px; padding: 2px; flex: 0 0 auto; cursor: pointer; }
.filter-toggles { display: flex; flex-wrap: wrap; gap: 8px 22px; }
.su-blocks { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 14px; margin-bottom: 12px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; }
.msg { white-space: pre-line; }
.content-ed h3 { margin: 22px 0 6px; font-size: 15px; }
.ce-thumb { display: block; width: 120px; height: 80px; object-fit: contain; border-radius: 9px; background: var(--hover); border: 1px solid var(--line); }
.ce-thumb.wide { width: 160px; height: 80px; object-fit: cover; }
.scene-list { display: flex; flex-direction: column; gap: 6px; }
.scene-row { display: flex; align-items: center; gap: 10px; padding: 6px; border: 1px solid var(--line); border-radius: var(--radius-sm); flex-wrap: wrap; }
.scene-row img { width: 96px; height: 48px; object-fit: cover; border-radius: 7px; }
.scene-row .scene-name { flex: 1 1 140px; display: flex; flex-direction: column; }
.scene-row .scene-name .hint { margin: 0; }
.scene-row button { padding: 3px 10px; font-size: 13px; }
.scope-stage { cursor: default; }
.scope-stage canvas { position: absolute; inset: 0; }
.shape-stage canvas { outline: none; touch-action: none; }
.shape-tools { align-items: end; }
.shape-kind .hint { min-height: 38px; display: flex; align-items: center; }
.shape-strip { display: block; width: 100%; height: 14px; margin-top: 6px; border-radius: 4px; cursor: pointer; background: var(--surface-2); border: 1px solid var(--line); }
.cam-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin-bottom: 12px; }
.cam-bar .hint { flex: 1 1 260px; }
.cam-bar .progress { flex: 1 1 100%; margin-top: 0; order: 3; }
.shape-legend { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 6px; font-size: 12px; }
.shape-legend i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-inline-end: 5px; vertical-align: -1px; }
.shape-legend .k-key { background: var(--accent); }
.shape-legend .k-fix { background: #e0a43a; }
.shape-legend .k-on { background: #8a8f98; }
.shape-legend .k-hide { background: #d65a5a; }
.shape-cell { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.shape-spread { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; }
.shape-spread input { width: 70px; padding: 4px 8px; }
dialog.pano-dlg { width: min(1100px, 94vw); max-width: none; }
.pano-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.pano-view { height: min(64vh, 620px); border-radius: 10px; overflow: hidden; margin-top: 10px; direction: ltr; }
.tour-pin { display: flex; flex-direction: column; align-items: center; gap: 2px; color: #fff; cursor: pointer; }
.tour-pin span { font-size: 22px; color: var(--accent); text-shadow: 0 0 0 4px #fff, 0 2px 6px rgba(0,0,0,.5); }
.tour-pin b { font: 600 12px Vazirmatn, sans-serif; background: rgba(0,0,0,.65); padding: 2px 8px; border-radius: 8px; white-space: nowrap; }

/* ---------- Narrow screens: the sidebar slides in from the side ---------- */
@media (max-width: 900px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .sidebar {
    position: fixed; inset-block: 0; inset-inline-start: 0; width: min(300px, 86vw); z-index: 40; overflow-y: auto;
    transform: translateX(105%); transition: transform .25s ease; box-shadow: var(--shadow-pop);
  }
  body.nav-open .sidebar { transform: none; }
  body.nav-open::after { content: ""; position: fixed; inset: 0; background: rgba(10, 10, 12, .4); z-index: 30; }
  .mobile-bar {
    display: flex; align-items: center; gap: 10px; position: sticky; top: 0; z-index: 20;
    padding: 10px 14px; background: var(--surface); border-bottom: 1px solid var(--line);
  }
  .mobile-bar .title { flex: 1; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .page { padding: 20px 16px 48px; }
  .card { padding: 18px 16px; }
  .page-head h1 { font-size: 20px; }
}

/* Unit page links: types and units of each sales menu, as checkboxes. */
.pl-group + .pl-group { margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--line); }
.pl-group h3 { margin: 0 0 6px; }
.pl-head { display: flex; align-items: center; gap: 10px; margin: 10px 0 6px; font-size: 13px; color: var(--muted); }
.pl-search { max-width: 220px; padding: 4px 10px; height: 30px; font-size: 13px; }
.pl-list { display: flex; flex-wrap: wrap; gap: 4px 18px; max-height: 260px; overflow-y: auto; }
.pl-list .check { margin: 0; }

/* Unit shapes from the CAD plan */
.cad-step { font-size: 15px; margin: 18px 0 6px; }
.row-inline { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.cad-plans { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 8px; margin-bottom: 8px; }
.cad-plans label { display: flex; gap: 8px; align-items: flex-start; margin: 0; padding: 8px 10px; border: 1px solid var(--line); border-radius: 10px; cursor: pointer; font-weight: 400; }
.cad-plans label:has(input:checked) { border-color: var(--accent); background: var(--surface-2); }
.cad-plans small { display: block; color: var(--muted); }
.cad-model { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; align-items: start; margin-top: 10px; }
.cad-model img { width: 100%; height: auto; border-radius: 10px; border: 1px solid var(--line); background: #fff; }
.cad-nums { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 6px; }
.cad-nums label { display: flex; align-items: center; gap: 6px; margin: 0; font-weight: 400; font-size: 13px; }
.cad-nums input { width: 56px; }
.cad-nums i { width: 12px; height: 12px; border-radius: 3px; flex: none; }
.cad-groups { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0 4px; align-items: center; }
.cad-groups .chip { cursor: pointer; }
.cad-groups .chip.on { background: var(--accent); color: #fff; border-color: transparent; }
.cad-group-units { display: flex; flex-wrap: wrap; gap: 4px 10px; margin: 4px 0 8px; font-size: 13px; }
.cad-group-units label { margin: 0; font-weight: 400; display: flex; gap: 4px; align-items: center; }
.cad-stages { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); gap: 12px; align-items: start; }
.cad-stage canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.cad-plan-stage { background: #fff; aspect-ratio: 1; }
.cad-points { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; font-size: 13px; }
.cad-points span { display: inline-flex; align-items: center; gap: 6px; padding: 2px 4px 2px 10px; border-radius: 8px; background: var(--surface-2); border: 1px solid var(--line); }
.cad-points span.bad { border-color: var(--danger); }
.cad-points button { padding: 0 6px; font-size: 12px; }
@media (max-width: 900px) { .cad-model, .cad-stages { grid-template-columns: 1fr; } }

/* Sales mode: what the units sit on (orbit or idle videos). */
.stage-pick { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; color: var(--muted); font-size: 13.5px; }
.stage-pick .seg button { min-height: 40px; }
#cbPins .placer-pin.unit span { background: var(--c, #fff); color: #111; font-weight: 600; }
#cbPins .placer-pin.unit.sel span { outline: 2px solid var(--accent); }
#cpBox { margin-top: 22px; }
#cpBox h3 { margin: 0 0 4px; font-size: 15px; }
#cpList tr.sel td { background: var(--accent-soft, rgba(176, 138, 62, .12)); }
.swatch { display: inline-block; width: 14px; height: 14px; border-radius: 4px; margin: 0 0 0 4px; vertical-align: middle; border: 1px solid var(--line); }

/* Unit shapes drawn by hand on an idle. */
#cbShapes { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
#cbShapes polygon, #cbShapes polyline { fill: var(--c, #fff); fill-opacity: .35; stroke: var(--c, #fff); stroke-width: 2; vector-effect: non-scaling-stroke; stroke-linejoin: round; }
#cbShapes polyline { fill: none; }
#cbShapes .edit { stroke: var(--accent); stroke-width: 2.5; }
#cbHandles { position: absolute; inset: 0; pointer-events: none; }
#cbHandles i { position: absolute; width: 14px; height: 14px; margin: -7px 0 0 -7px; border-radius: 50%; background: #fff; border: 2px solid var(--accent); pointer-events: auto; cursor: grab; touch-action: none; }
#cbHandles i::before { content: ''; position: absolute; inset: -10px; }
#cbHandles i.first { width: 20px; height: 20px; margin: -10px 0 0 -10px; background: var(--accent); cursor: pointer; }
.placer.drawing #cbPins { opacity: .35; }
.draw-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin-top: 8px; padding: 10px 12px; border-radius: 10px; background: var(--accent-soft); font-size: 13.5px; }
.draw-bar .actions { display: flex; flex-wrap: wrap; gap: 6px; margin-inline-start: auto; }
.draw-bar button { min-height: 36px; }
/* ---------- Project data pages (data.js) ---------- */
#pageData.wide { max-width: 1280px; }
.st-dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; margin-inline-end: 6px; vertical-align: middle; }
.c-av { background: #4caf7a; } .c-re { background: #e0a43a; } .c-so { background: #d65a5a; } .c-un { background: #9c978e; }
.miss { color: var(--faint); }
.req { color: var(--danger); }
.dp-steps { list-style: none; margin: 0; padding: 0; }
.dp-steps li { display: flex; align-items: center; gap: 14px; padding: 12px 4px; border-top: 1px solid var(--line); }
.dp-steps li:first-child { border-top: 0; }
.dp-steps .n { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; flex: none; font-size: 13px; font-weight: 650; border: 1.5px solid var(--line-strong); color: var(--muted); }
.dp-steps li.done .n { background: var(--ok); border-color: var(--ok); color: #fff; }
.dp-steps li.now .n { border-color: var(--accent); color: var(--accent-text); background: var(--accent-soft); }
.dp-steps li.skipped .t { opacity: .55; }
.dp-steps .t { flex: 1; min-width: 0; }
.dp-steps .t b { display: block; font-weight: 600; font-size: 14.5px; }
.dp-steps .t span { color: var(--muted); font-size: 13px; }
.dp-steps li.done .t b { color: var(--muted); }
.dp-step-btns { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.btn.sm { padding: 4px 10px; font-size: 13px; }
.dp-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; margin-bottom: 18px; }
.dp-stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; box-shadow: var(--shadow); }
.dp-stat .k { color: var(--muted); font-size: 13px; }
.dp-stat .v { font-size: 26px; font-weight: 700; line-height: 1.5; }
.dp-stat .v small { font-size: 14px; font-weight: 500; color: var(--muted); }
.dp-stat .v.dp-src { font-size: 17px; line-height: 2.2; }
.dp-bar { display: flex; height: 8px; border-radius: 99px; overflow: hidden; margin-top: 8px; background: var(--surface-2); }
.dp-legend { display: flex; flex-wrap: wrap; gap: 4px 12px; margin-top: 6px; }
.dp-warn { list-style: none; margin: 0; padding: 0; }
.dp-warn li { display: flex; gap: 10px; align-items: center; padding: 9px 0; border-top: 1px solid var(--line); font-size: 14px; }
.dp-warn li:first-child { border-top: 0; }
.dp-warn .grow { flex: 1; }
.dp-table td { vertical-align: middle; }
.dp-cover { display: block; width: 64px; height: 42px; object-fit: cover; border-radius: 7px; background: var(--hover); }
.dp-tools { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 12px; }
.dp-tools input[type=search] { flex: 1 1 200px; margin: 0; }
.dp-tools select { flex: 0 1 150px; width: auto; margin: 0; }
.dp-bulk { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; padding: 10px 12px; border-radius: 11px; background: var(--accent-soft); color: var(--accent-text); margin-bottom: 12px; font-size: 14px; z-index: 5; }
.dp-bulk select, .dp-bulk input { width: auto; margin: 0; height: 34px; padding: 4px 10px; font-size: 13px; }
.dp-bulk b { margin-inline-end: 6px; }
.dp-ut td, .dp-ut th { padding: 8px 7px; white-space: nowrap; }
.dp-ut td.num { direction: ltr; text-align: right; }
.dp-ut tr.sel td { background: var(--accent-soft); }
.dp-ut td[data-edit] { cursor: text; }
.dp-ut td[data-edit]:hover { background: var(--hover); }
.dp-ut td input, .dp-ut td select { margin: 0; height: 32px; padding: 3px 8px; font-size: 13px; }
.dp-code { background: none; border: 0; padding: 0; color: var(--accent-text); font-weight: 700; direction: ltr; text-decoration: underline; text-underline-offset: 3px; text-decoration-color: var(--line-strong); }
.dp-code:hover { background: none; color: var(--accent); }
.dp-srcchip { font-size: 11.5px; }
.dp-shape { font-size: 12.5px; white-space: nowrap; }
.dp-shape.ok { color: var(--ok); }
.dp-cards, .dp-mob { display: none; }
.dp-overlay { position: fixed; inset: 0; background: rgba(10, 10, 12, .45); display: grid; place-items: center; z-index: 60; padding: 16px; }
body.dp-lock { overflow: hidden; }
.dp-modal { width: min(860px, 100%); max-height: calc(100vh - 32px); overflow: auto; background: var(--surface); border-radius: 16px; box-shadow: var(--shadow-pop); padding: 22px 24px; }
.dp-modal h2 { margin: 0; font-size: 18px; }
.dp-modal .card-head { margin-bottom: 4px; }
.dp-modal-actions { margin-top: 18px; position: sticky; bottom: -22px; background: var(--surface); padding: 10px 0; }
.dp-fields { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 0 14px; }
.dp-fields > .wide { grid-column: 1 / -1; }
.dp-fields .hint { margin-top: 4px; }
.dp-fields input:disabled { background: var(--surface-2); color: var(--muted); }
.dp-tabs { display: inline-flex; margin: 6px 0 4px; }
.dp-tabs button { flex: none; padding: 7px 16px; font-size: 14px; }
.dp-pat { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 4px; }
.dp-pat > label { margin: 0; display: flex; align-items: center; gap: 8px; padding: 8px 12px; border: 1px solid var(--line-strong); border-radius: 10px; color: var(--text); font-size: 13.5px; cursor: pointer; }
.dp-pat > label.on { border-color: var(--accent); background: var(--accent-soft); }
.dp-pat code { direction: ltr; font-size: 12.5px; color: var(--muted); }
.dp-pat input[type=text], .dp-pat input:not([type]) { height: 30px; padding: 2px 8px; font-size: 13px; }
.dp-prev { margin-top: 16px; border: 1px solid var(--line); border-radius: 12px; padding: 12px; background: var(--surface-2); overflow: auto; max-height: 300px; }
.dp-prev:empty { display: none; }
.dp-prev table { font-size: 12.5px; width: auto; }
.dp-prev td, .dp-prev th { padding: 3px 5px; border: 0; text-align: center; white-space: nowrap; }
.dp-prev td span { display: inline-block; min-width: 38px; padding: 2px 4px; border-radius: 6px; background: var(--surface); border: 1px solid var(--line); direction: ltr; }
.dp-prev td span.dup { background: var(--warn-soft); border-color: transparent; color: var(--warn); text-decoration: line-through; }
.dp-summary { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-top: 12px; font-size: 14px; }
.dp-checks { display: flex; flex-wrap: wrap; gap: 6px 18px; align-items: center; }
.dp-checks .check { margin: 0; }
.dp-checks .chip { cursor: pointer; }
.dp-rels { border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; background: var(--surface-2); }
.dp-rels-head { display: flex; gap: 10px; align-items: center; }
.dp-rels-head input { max-width: 260px; height: 34px; padding: 4px 10px; font-size: 13px; }
.dp-rels-head .hint { margin: 0; }
.dp-rels-quick { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.dp-rels-quick .chip { cursor: pointer; padding: 2px 10px; }
.dp-rels-quick .chip:hover { background: var(--hover); }
.dp-rels-list { display: flex; flex-wrap: wrap; gap: 4px 18px; max-height: 190px; overflow-y: auto; margin-top: 8px; }
.dp-rels-list .check { margin: 0; font-size: 13.5px; }
.dp-rows .dp-row { display: flex; gap: 10px; align-items: end; padding: 8px 0; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.dp-rows .dp-row > div { flex: 1 1 150px; min-width: 0; }
.dp-rows .dp-row label { margin: 0 0 4px; font-size: 12.5px; }
.dp-rows .dp-row > button.icon { flex: none; }
.dp-thumbs { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.dp-thumbs figure { margin: 0; position: relative; }
.dp-thumbs img { display: block; width: 72px; height: 48px; object-fit: cover; border-radius: 7px; border: 1px solid var(--line); }
.dp-thumbs figure button { position: absolute; top: -6px; left: -6px; padding: 2px; background: var(--surface); border: 1px solid var(--line); border-radius: 50%; }
.dp-thumbs figure button svg.i { width: 14px; height: 14px; }
.dp-media { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.dp-media img { display: block; width: 120px; height: 76px; object-fit: cover; border-radius: 9px; border: 1px solid var(--line); background: var(--hover); }
.dp-media .hint { margin: 0; max-width: 200px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (max-width: 900px) {
  .dp-ut-wrap, .dp-desk { display: none; }
  .dp-cards, .dp-mob { display: block; }
  .dp-ucard { border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; margin-bottom: 10px; background: var(--surface); display: flex; gap: 12px; align-items: flex-start; }
  .dp-ucard.sel { border-color: var(--accent); background: var(--accent-soft); }
  .dp-ucard input[type=checkbox] { width: 24px; height: 24px; margin-top: 4px; flex: none; }
  .dp-ucard .grow { flex: 1; min-width: 0; cursor: pointer; }
  .dp-ucard .top { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
  .dp-ucard .code { font-weight: 700; font-size: 16px; direction: ltr; }
  .dp-ucard .meta { color: var(--muted); font-size: 13px; margin-top: 2px; }
  .dp-ucard .price { font-size: 14px; margin-top: 4px; display: flex; justify-content: space-between; gap: 8px; }
  .dp-tools select { flex: 1 1 40%; }
  .dp-bulk { position: fixed; inset-inline: 10px; bottom: 10px; max-height: 46vh; overflow-y: auto; margin: 0; box-shadow: var(--shadow-pop); background: var(--surface); border: 1px solid var(--accent); }
  .dp-bulk:not(.hidden) ~ .dp-cards { padding-bottom: 46vh; }
  .dp-fields { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 10px; }
  .dp-bulk select, .dp-bulk input { flex: 1 1 40%; height: 40px; }
  .dp-bulk button { min-height: 40px; }
  .dp-steps li { flex-wrap: wrap; }
  .dp-steps .t { flex: 1 1 calc(100% - 42px); }
  .dp-step-btns { width: 100%; padding-inline-start: 42px; justify-content: flex-start; }
  .dp-step-btns .btn, .dp-step-btns button { min-height: 36px; }
  .dp-overlay { padding: 0; }
  .dp-modal { max-height: 100vh; height: 100vh; border-radius: 0; padding: 18px 16px; }
  .dp-modal-actions { bottom: -18px; }
  .dp-table td.actions button { min-height: 36px; }
  .dp-warn li { flex-wrap: wrap; }
  .dp-head { flex-wrap: wrap; }
  .dp-head > div { flex: 1 1 100%; }
  .dp-table thead { display: none; }
  .dp-table, .dp-table tbody, .dp-table tr, .dp-table td { display: block; width: 100%; }
  .dp-table tr { border: 1px solid var(--line); border-radius: 12px; padding: 8px 12px; margin-bottom: 10px; }
  .dp-table td { display: flex; justify-content: space-between; align-items: center; gap: 12px; border: 0; padding: 5px 0; text-align: left; }
  .dp-table td[data-label]::before { content: attr(data-label); color: var(--muted); font-size: 13px; text-align: right; }
  .dp-table td[data-label=""]::before { content: none; }
  .dp-table td.actions { justify-content: flex-start; gap: 8px; padding-top: 8px; border-top: 1px solid var(--line); margin-top: 4px; }
  .dp-table td.actions button { margin: 0; }
  .table-wrap:has(.dp-table) { margin: 0; overflow: visible; }
}
.su-blocks .check { margin: 0; }

/* ---------- Balloon look (balloon-style.js) ---------- */
.bs { display: grid; grid-template-columns: minmax(240px, 340px) 1fr; gap: 20px; align-items: start; }
.bs-preview {
  position: sticky; top: 12px; border-radius: var(--radius); overflow: hidden; min-height: 220px;
  background: linear-gradient(160deg, #2a4d6e, #8d7a5a 60%, #5d7f4f) center / cover;
  border: 1px solid var(--line);
}
.bs-stage { position: relative; height: 220px; overflow: hidden; direction: ltr; }   /* like the viewer */
.bs-stage .balloon { position: absolute; left: 50%; top: 82%; transform: none; pointer-events: none; }
/* Keep the balloon in view wherever its tail is (the point is the balloon's place). */
.bs-stage .balloon.tail-top { top: 18%; }
.bs-stage .balloon.tail-left { left: 8%; top: 50%; }
.bs-stage .balloon.tail-right { left: 92%; top: 50%; }
.bs-stage .balloon.tail-bottom-left { left: 22%; }
.bs-stage .balloon.tail-bottom-right { left: 78%; }
.bs-stage .balloon.shape-callout.tail-bottom-left { left: 10%; top: 70%; }
.bs-stage .balloon.shape-callout.tail-bottom-right { left: 90%; top: 70%; }
.bs-preview-note { position: absolute; bottom: 6px; right: 10px; margin: 0; color: rgba(255, 255, 255, .8); font-size: 11.5px; text-shadow: 0 1px 2px rgba(0, 0, 0, .6); }
.bs-main { display: grid; gap: 14px; min-width: 0; }
.bs-group, .bs-content { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 12px 14px; background: var(--surface-2); }
.bs-group h4, .bs-content h4 { margin: 0; font-size: 14px; }
.bs-content h4 { margin-bottom: 10px; }
.bs-group-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.bs-group-head .check { font-size: 13px; }
.bs-group.inherited .bs-group-body, .bs-group.dimmed .bs-group-body .bs-tiles { opacity: .45; }
.bs-tiles { display: flex; flex-wrap: wrap; gap: 8px; }
.bs-tile {
  display: grid; justify-items: center; align-content: center; gap: 6px; min-width: 84px; min-height: 64px; padding: 8px;
  border-radius: var(--radius-sm); border: 1.5px solid var(--line); background: var(--surface); color: var(--muted); font-size: 11.5px; cursor: pointer;
}
.bs-tile:hover:not(:disabled) { border-color: var(--line-strong); color: var(--text); }
.bs-tile.active { border-color: var(--accent); color: var(--text); background: var(--accent-soft); }
.bs-tile svg path:first-child { fill: var(--surface-2); stroke: var(--muted); stroke-width: 1.2; }
.bs-tile svg path + path { fill: var(--muted); }
.bs-tile svg text { fill: var(--muted); font: 600 12px Manrope, sans-serif; }
.bs-tile.active svg path:first-child { stroke: var(--accent); }
.bs-icons .bs-tile { min-width: 72px; }
.bs-icon-search { margin-bottom: 10px; }
.bs-set-name { margin: 14px 0 8px; font-size: 13px; font-weight: 600; }
.bs-group[data-group=icon] .bs-group-body { max-height: 420px; overflow-y: auto; }
.bs-tail-at { flex-wrap: wrap; margin-bottom: 4px; }
.bs-tail-at button.unavailable { opacity: .4; cursor: not-allowed; }
.bs-templates { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 4px; }
.bs-icons i { display: block; width: 24px; height: 24px; background: currentColor; -webkit-mask: var(--m) center / contain no-repeat; mask: var(--m) center / contain no-repeat; }
.bs-icons i.bs-noicon { background: none; -webkit-mask: none; mask: none; border: 1.5px dashed currentColor; border-radius: 6px; width: 20px; height: 20px; }
.bs .grid-3 { display: grid; grid-template-columns: 1fr 1fr 1.4fr; gap: 12px; }
.bs .grid-3 label, .bs-colors label { margin-top: 0; }
.bs-colors { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; align-items: end; }
.bs-colors .bs-wide { grid-column: span 2; }
.bs-colors input[type=color] { width: 100%; height: 40px; padding: 3px; border-radius: var(--radius-sm); border: 1px solid var(--line); background: var(--input); cursor: pointer; }
.bs-html textarea.bs-css-in { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 13px; }
.bs-fonts-box { margin-top: 16px; border-top: 1px solid var(--line); padding-top: 12px; }
.bs-fonts-box summary, .bs-own summary { cursor: pointer; font-weight: 600; }
.bs-own { margin-top: 16px; border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 12px 14px; }
.bs-own[open] summary { margin-bottom: 12px; }
.bs-font { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.bs-font-sample { font-size: 20px; min-width: 70px; }
.bs-font-name { flex: 1; }
@media (max-width: 900px) {
  .bs { grid-template-columns: 1fr; }
  .bs-preview { position: relative; top: 0; }
  .bs-colors { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .bs .grid-3 { grid-template-columns: 1fr 1fr; }
  .bs .grid-3 > div:last-child { grid-column: span 2; }
  .bs-tile { min-width: 76px; min-height: 60px; }
}
a.dp-stat-link { color: inherit; text-decoration: none; display: block; }
a.dp-stat-link:hover { border-color: var(--accent); }
.dp-readonly .dp-fields input, .dp-readonly .dp-fields select, .dp-readonly .dp-fields textarea, .dp-readonly .dp-fields button { pointer-events: none; opacity: .75; }

/* ---------- Access: users, roles, connection ---------- */
.ac-blocked td { opacity: .6; }
.ac-role-tabs { flex-wrap: wrap; margin-bottom: 14px; }
.ac-role-tabs button { display: inline-flex; align-items: center; gap: 6px; }
.ac-role-tabs small { color: var(--faint); font-size: 11.5px; }
.ac-entry { display: flex; flex-wrap: wrap; gap: 10px 22px; margin: 6px 0 12px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface-2); }
.ac-matrix { width: 100%; border-collapse: collapse; }
.ac-matrix th, .ac-matrix td { padding: 7px 8px; border-bottom: 1px solid var(--line); text-align: center; }
.ac-matrix th:first-child, .ac-matrix td:first-child { text-align: right; }
.ac-matrix tr.ac-group td { background: var(--surface-2); color: var(--muted); font-size: 12.5px; font-weight: 600; text-align: right; }
.ac-matrix input[type=checkbox] { width: 20px; height: 20px; }
.ac-clickable { cursor: pointer; }
.ac-clickable:hover { color: var(--accent-text); }
.ac-line { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.ac-line:last-child { border-bottom: 0; }
.ac-line .k { color: var(--muted); font-size: 13px; min-width: 170px; }
.ac-line code { flex: 1; min-width: 0; overflow-wrap: anywhere; font-size: 13px; background: var(--surface-2); padding: 5px 9px; border-radius: 8px; }
.ac-line-btns { display: flex; gap: 6px; }
@media (max-width: 760px) {
  .ac-line .k { min-width: 100%; }
  .ac-matrix th, .ac-matrix td { padding: 8px 4px; font-size: 13px; }
  .ac-matrix input[type=checkbox] { width: 24px; height: 24px; }
}
.ac-actions { margin-top: 16px; }
