﻿/* ============================================================
   PROPERI — оболочка: тема, топбар, холст, окна, палитра
   ============================================================ */

:root {
  --bg: #08090c;
  --bg-soft: #0b0d12;
  --panel: #101319;
  --panel-2: #151922;
  --panel-3: #1a1f2a;
  --line: rgba(255, 255, 255, .075);
  --line-2: rgba(255, 255, 255, .14);
  --text: #e9ebf1;
  --muted: #949cb0;
  --dim: #616a80;
  --acc: #c8ff3d;
  --acc-soft: rgba(200, 255, 61, .12);
  --acc-2: #7c5cff;
  --acc-3: #22d3ee;
  --danger: #ff5c7a;
  --danger-soft: rgba(255, 92, 122, .12);
  --on-acc: #0a0b0e;
  --radius: 14px;
  --radius-sm: 10px;
  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, "Cascadia Mono", Consolas, monospace;
  --display: "Oswald", "Inter", "Arial Narrow", sans-serif;
  --topbar-h: 64px;
}

[data-theme="violet"] {
  --acc: #a78bfa;
  --acc-soft: rgba(167, 139, 250, .13);
  --acc-2: #f472b6;
  --acc-3: #38bdf8;
  --on-acc: #0d0a16;
}
[data-theme="amber"] {
  --acc: #ffb020;
  --acc-soft: rgba(255, 176, 32, .12);
  --acc-2: #ff5c39;
  --acc-3: #ffd98a;
  --on-acc: #140d02;
}
[data-theme="ice"] {
  --acc: #5eead4;
  --acc-soft: rgba(94, 234, 212, .12);
  --acc-2: #60a5fa;
  --acc-3: #c4b5fd;
  --on-acc: #04120f;
}
[data-theme="gitrox"] {
  --bg: #0d1117;
  --bg-soft: #0f1520;
  --panel: #17202c;
  --panel-2: #1b2634;
  --line: rgba(114, 159, 240, .17);
  --line-2: rgba(114, 159, 240, .3);
  --text: #e7edf5;
  --muted: #b4becc;
  --dim: #7d8ba0;
  --acc: #5b9bff;
  --acc-soft: rgba(91, 155, 255, .13);
  --acc-2: #3677d1;
  --acc-3: #8ec5ff;
  --on-acc: #07111f;
}
[data-theme="magenta"] {
  --acc: #ff4fa3;
  --acc-soft: rgba(255, 79, 163, .12);
  --acc-2: #a855f7;
  --acc-3: #ffa6d1;
  --on-acc: #1c0713;
}
[data-theme="red"] {
  --acc: #ff5d5d;
  --acc-soft: rgba(255, 93, 93, .12);
  --acc-2: #ff9f43;
  --acc-3: #ffb3a7;
  --on-acc: #1b0606;
}
[data-theme="mono"] {
  --acc: #d8dfeb;
  --acc-soft: rgba(216, 223, 235, .1);
  --acc-2: #8b96a8;
  --acc-3: #ffffff;
  --on-acc: #0a0b0e;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html, body { height: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.45;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

::selection { background: var(--acc); color: var(--on-acc); }

::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, .12);
  border-radius: 99px;
  border: 2px solid transparent;
  background-clip: content-box;
}
::-webkit-scrollbar-thumb:hover { background: rgba(255, 255, 255, .22); background-clip: content-box; }

kbd {
  font-family: var(--mono);
  font-size: 10px;
  line-height: 1;
  padding: 4px 5px;
  border-radius: 5px;
  background: rgba(255, 255, 255, .06);
  border: 1px solid var(--line);
  color: var(--muted);
}

h1, h2, h3, p { margin: 0; }
a { color: inherit; }
button { font: inherit; color: inherit; }

.app {
  height: 100dvh;
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
  isolation: isolate;
}

/* ----- фон ----- */
.ambient {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background: var(--bg);
}

/* ============================================================
   Топбар
   ============================================================ */
.topbar {
  flex: 0 0 var(--topbar-h);
  height: var(--topbar-h);
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 16px 0 20px;
  border-bottom: 1px solid var(--line);
  background: var(--bg);
  z-index: 60;
  position: relative;
  transition: transform .28s cubic-bezier(.4, 0, .2, 1), opacity .2s;
}

.topbar .brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  padding-right: 4px;
  flex: 0 0 auto;
}
.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-name { font-family: var(--display); font-weight: 600; font-size: 16px; letter-spacing: .11em; white-space: nowrap; }
.brand-space { color: var(--acc); }
.brand-sub {
  font-size: 9px;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--dim);
  font-weight: 500;
}

.topbar-status {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 11px;
  color: var(--dim);
  padding: 0 6px;
  white-space: nowrap;
}
.topbar-status .dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--dim);
  transition: background .2s, box-shadow .2s;
}
.topbar-status.saved .dot { background: var(--acc); }
.topbar-status.dirty .dot { background: var(--acc-3); }

.spacer { flex: 1; }

/* ----- кнопки ----- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  height: 34px;
  padding: 0 12px;
  border-radius: 8px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text);
  font-size: 12.5px;
  font-weight: 600;
  letter-spacing: .01em;
  cursor: pointer;
  white-space: nowrap;
  transition: background .16s, border-color .16s, color .16s, box-shadow .16s;
  user-select: none;
}
.btn:active { transform: none; }
.btn .btn-ico { font-size: 14px; opacity: .9; line-height: 1; }
.btn kbd { margin-left: 2px; }
.btn-ghost { border-color: var(--line); background: rgba(255, 255, 255, .025); color: var(--muted); }
.btn-ghost:hover { background: rgba(255, 255, 255, .06); color: var(--text); border-color: var(--line-2); }
.btn-primary {
  background: var(--acc);
  color: var(--on-acc);
  border-color: var(--acc);
}
.btn-primary:hover { background: color-mix(in srgb, var(--acc) 88%, #fff); border-color: color-mix(in srgb, var(--acc) 88%, #fff); }
.btn-danger-ghost { border-color: rgba(255, 92, 122, .25); background: var(--danger-soft); color: var(--danger); }
.btn-danger-ghost:hover { background: rgba(255, 92, 122, .2); border-color: rgba(255, 92, 122, .45); }
.btn-lg { height: 44px; padding: 0 20px; font-size: 13.5px; border-radius: 10px; }
.btn:focus-visible, .icon-btn:focus-visible { outline: 2px solid var(--acc); outline-offset: 2px; }
.chip:focus-visible, .cat-item:focus-visible, .theme-dot:focus-visible, .pal-item:focus-visible, .menu-item:focus-visible, .w-btn:focus-visible, .br-actions button:focus-visible, .todo-check:focus-visible, .win-stop:focus-visible, .grx-w-refresh:focus-visible {
  outline: 2px solid var(--acc);
  outline-offset: 2px;
}
.w-head:focus-visible { outline: 2px solid var(--acc); outline-offset: -2px; }

.icon-btn {
  width: 34px;
  height: 34px;
  display: inline-grid;
  place-items: center;
  border-radius: 9px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  transition: background .15s, color .15s, border-color .15s;
  flex: 0 0 auto;
}
.icon-btn:hover { background: rgba(255, 255, 255, .06); color: var(--text); border-color: var(--line); }

/* ----- кнопки ----- */
.pid-account {
  height: 34px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 0 11px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  transition: background .15s, border-color .15s, color .15s;
  flex: 0 0 auto;
}
.pid-account:hover { background: rgba(255, 255, 255, .04); border-color: var(--line-2); color: var(--text); }
.pid-account.logged { color: var(--text); border-color: var(--line-2); }
.pid-account-name {
  max-width: 92px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .01em;
}
.pid-account.guest .pid-account-name { font-size: 11px; letter-spacing: .02em; }

/* ----- окна PROPERI ID и столов ----- */
.pid-modal { max-width: 480px; }
.pid-tabs {
  display: flex;
  gap: 2px;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, .025);
}
.pid-tabs button {
  flex: 1;
  height: 30px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--dim);
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
}
.pid-tabs button:hover { color: var(--text); }
.pid-tabs button.active { background: rgba(255, 255, 255, .07); color: var(--text); }
.pid-intro {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(255, 255, 255, .025);
}
.pid-intro .pid-logo {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  background: var(--acc-soft);
  border: 1px solid color-mix(in srgb, var(--acc) 25%, transparent);
  color: var(--acc);
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .04em;
  flex: 0 0 auto;
}
.pid-intro b { display: block; font-size: 13px; }
.pid-intro span { display: block; font-size: 10.5px; color: var(--dim); line-height: 1.45; }
.pid-intro code, .pid-note code {
  font-family: var(--mono);
  font-size: .94em;
  padding: 1px 4px;
  border-radius: 4px;
  background: rgba(255, 255, 255, .06);
  color: var(--muted);
}
.pid-form { display: flex; flex-direction: column; gap: 12px; }
.pid-form .btn { width: 100%; height: 42px; }
.pid-note { font-size: 10.5px; color: var(--dim); line-height: 1.5; }
.pid-error {
  padding: 9px 11px;
  border-radius: 8px;
  background: var(--danger-soft);
  border: 1px solid rgba(255, 92, 122, .25);
  color: var(--danger);
  font-size: 11.5px;
  line-height: 1.4;
}
.pid-profile { display: flex; align-items: center; gap: 13px; padding: 14px; border: 1px solid var(--line); border-radius: 10px; background: rgba(255, 255, 255, .02); }
.pid-avatar {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  overflow: hidden;
  background: var(--acc-soft);
  border: 1px solid color-mix(in srgb, var(--acc) 25%, transparent);
  color: var(--acc);
  font-family: var(--mono);
  font-size: 20px;
  font-weight: 800;
}
.pid-avatar img { width: 100%; height: 100%; object-fit: cover; border-radius: 50%; }
.pid-profile-name { font-size: 15px; font-weight: 700; letter-spacing: -.01em; }
.pid-profile-meta { font-size: 10.5px; color: var(--dim); margin-top: 2px; }
.pid-profile-role { display: inline-block; margin-top: 4px; font-size: 8.5px; letter-spacing: .1em; text-transform: uppercase; color: var(--acc); }
.pid-actions { display: flex; flex-wrap: wrap; gap: 7px; }
.pid-actions .btn { text-decoration: none; }
.pid-stat-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.pid-stat { border: 1px solid var(--line); background: rgba(255, 255, 255, .02); border-radius: 8px; padding: 8px 10px; min-width: 0; }
.pid-stat b { display: block; font-family: var(--mono); font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pid-stat span { font-size: 8.5px; letter-spacing: .08em; text-transform: uppercase; color: var(--dim); }

.board-btn { max-width: 210px; }
.board-name {
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 11px;
  color: var(--muted);
  font-weight: 500;
}
.board-btn:hover .board-name { color: var(--text); }
.board-list { display: flex; flex-direction: column; gap: 4px; }
.board-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  padding: 8px 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, .015);
}
.board-row:hover { border-color: var(--line-2); }
.board-row.current { border-color: color-mix(in srgb, var(--acc) 32%, var(--line)); background: var(--acc-soft); }
.br-main { min-width: 0; flex: 1 1 150px; }
.br-main b { display: block; font-size: 12px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.br-main span { display: block; font-size: 9.5px; color: var(--dim); margin-top: 2px; }
.br-actions { display: flex; gap: 3px; flex: 0 0 auto; margin-left: auto; }
.br-actions button {
  height: 24px;
  padding: 0 7px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: transparent;
  color: var(--dim);
  font-size: 9px;
  cursor: pointer;
}
.br-actions button:hover { color: var(--text); border-color: var(--line-2); background: rgba(255, 255, 255, .04); }
.br-actions button.danger:hover { color: var(--danger); border-color: rgba(255, 92, 122, .35); background: var(--danger-soft); }
.board-create {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}
.board-create .input { flex: 1 1 170px; min-width: 0; }
.board-create .btn { height: 34px; }
.board-copy { display: flex; align-items: center; gap: 6px; font-size: 10px; color: var(--dim); white-space: nowrap; cursor: pointer; }
.board-copy input { accent-color: var(--acc); }

/* ----- меню пресетов ----- */

/* ----- меню пресетов ----- */
.menu-wrap { position: relative; }
.menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 300px;
  padding: 6px;
  border-radius: 10px;
  border: 1px solid var(--line-2);
  background: var(--panel);
  box-shadow: 0 18px 44px -24px #000;
  z-index: 100;
  animation: menuIn .14s ease-out;
}
@keyframes menuIn { from { opacity: 0; transform: translateY(-6px) scale(.98); } }
.menu-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  width: 100%;
  padding: 9px 10px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  text-align: left;
  cursor: pointer;
  transition: background .12s;
}
.menu-item:hover { background: rgba(255, 255, 255, .06); }
.menu-item .mi-ico {
  width: 26px; height: 26px;
  display: grid; place-items: center;
  border-radius: 7px;
  background: var(--acc-soft);
  color: var(--acc);
  font-size: 12px;
  flex: 0 0 auto;
}
.menu-item b { display: block; font-size: 12.5px; font-weight: 600; }
.menu-item span { display: block; font-size: 10.5px; color: var(--dim); margin-top: 1px; }
.menu-sep { height: 1px; background: var(--line); margin: 5px 8px; }

/* ============================================================
   Холст
   ============================================================ */
.stage {
  flex: 1;
  overflow: auto;
  padding: 20px;
  position: relative;
  scrollbar-gutter: stable;
}
.board {
  position: relative;
  min-height: calc(100dvh - var(--topbar-h) - 40px);
  border-radius: 16px;
  background: transparent;
}
body.editing .board {
  outline: 1px dashed var(--line-2);
  outline-offset: -1px;
}
.board-watermark {
  position: absolute;
  inset: 0;
  z-index: 0;
  display: grid;
  place-items: center;
  font-family: var(--display);
  font-size: clamp(46px, 12vw, 190px);
  font-weight: 600;
  letter-spacing: .06em;
  text-transform: uppercase;
  white-space: nowrap;
  color: rgba(255, 255, 255, .032);
  pointer-events: none;
  user-select: none;
  overflow: hidden;
}
body.compact .board-watermark { font-size: 15vw; }
body.kiosk .board-watermark { color: rgba(255, 255, 255, .025); }

/* ----- виджет ----- */
.widget {
  position: absolute;
  display: flex;
  flex-direction: column;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 14px 34px -30px rgba(0, 0, 0, .9);
  overflow: hidden;
  transition: border-color .18s;
  contain: layout style;
}
.widget:hover { border-color: var(--line-2); }
.widget.dragging {
  border-color: var(--acc);
  box-shadow: 0 22px 48px -28px #000;
  transition: none;
  z-index: 40;
}
.widget.settling { transition: border-color .2s; }

.w-head {
  flex: 0 0 42px;
  height: 42px;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 0 7px 0 12px;
  cursor: default;
  user-select: none;
  border-bottom: 1px solid transparent;
  transition: border-color .2s, background .2s;
  position: relative;
  z-index: 3;
}
body.editing .w-head { cursor: grab; }
.widget:hover .w-head { border-bottom-color: rgba(255, 255, 255, .045); }
body.editing .w-head:active { cursor: grabbing; }
.w-ico {
  width: 22px;
  height: 22px;
  display: grid;
  place-items: center;
  border-radius: 7px;
  background: var(--acc-soft);
  color: var(--acc);
  font-size: 11px;
  flex: 0 0 auto;
  font-family: var(--mono);
}
.w-title {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.w-actions {
  margin-left: auto;
  display: flex;
  gap: 1px;
  opacity: 0;
  transform: translateX(3px);
  transition: opacity .15s, transform .15s;
}
.widget:hover .w-actions,
.widget:focus-within .w-actions,
body.editing .w-actions { opacity: 1; transform: none; }
.w-btn {
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--dim);
  cursor: pointer;
  font-size: 12px;
  transition: background .12s, color .12s;
}
.w-btn:hover { background: rgba(255, 255, 255, .08); color: var(--text); }
.w-btn.active { background: var(--acc-soft); color: var(--acc); }
.w-btn[data-act="remove"]:hover { background: var(--danger-soft); color: var(--danger); }
.w-body {
  flex: 1;
  position: relative;
  min-height: 0;
  container-type: inline-size;
  overflow: hidden;
  z-index: 1;
}
.w-resize {
  position: absolute;
  right: 0;
  bottom: 0;
  width: 20px;
  height: 20px;
  cursor: nwse-resize;
  z-index: 6;
  opacity: 0;
  pointer-events: none;
  transition: opacity .15s;
}
body.editing .w-resize { opacity: 1; pointer-events: auto; }
.w-resize::before {
  content: "";
  position: absolute;
  right: 4px;
  bottom: 4px;
  width: 9px;
  height: 9px;
  border-right: 2px solid var(--acc);
  border-bottom: 2px solid var(--acc);
  border-radius: 0 0 2px 0;
}
.w-resize:hover::before { box-shadow: 2px 2px 0 color-mix(in srgb, var(--acc) 35%, transparent); }

/* ----- пустой холст ----- */
.empty {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 28px;
  z-index: 3;
}
.empty-card {
  position: relative;
  max-width: 590px;
  width: 100%;
  text-align: center;
  padding: 38px 34px 30px;
  border-radius: 18px;
  border: 1px solid var(--line);
  background: var(--panel);
  box-shadow: 0 24px 60px -45px #000;
  animation: rise .35s ease-out;
}
@keyframes rise { from { opacity: 0; transform: translateY(14px); } }
.empty-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 99px;
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--acc);
  background: var(--acc-soft);
  border: 1px solid color-mix(in srgb, var(--acc) 20%, transparent);
  margin-bottom: 18px;
}
.empty-title {
  font-family: var(--display);
  font-size: clamp(30px, 4.4vw, 45px);
  line-height: 1.06;
  font-weight: 600;
  letter-spacing: .015em;
  text-transform: uppercase;
  margin-bottom: 14px;
}
.empty-title .grad { color: var(--acc); }
.empty-text {
  max-width: 420px;
  margin: 0 auto 22px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
}
.empty-chips {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px;
  margin-bottom: 24px;
}
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 32px;
  padding: 0 11px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, .03);
  color: var(--muted);
  font-size: 11.5px;
  font-weight: 500;
  cursor: pointer;
  transition: background .15s, border-color .15s, color .15s;
}
.chip:hover { color: var(--text); border-color: color-mix(in srgb, var(--acc) 40%, transparent); background: var(--acc-soft); }
.chip .chip-ico { color: var(--acc); font-size: 12px; }
.empty-actions { display: flex; justify-content: center; gap: 8px; flex-wrap: wrap; margin-bottom: 18px; }
.empty-hint { font-size: 10.5px; color: var(--dim); display: flex; align-items: center; justify-content: center; gap: 5px; flex-wrap: wrap; }
.empty-hint kbd { font-size: 9px; padding: 3px 4px; }

/* ============================================================
   Оверлеи / модальные окна
   ============================================================ */
.overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(4, 6, 9, .72);
  animation: fadeIn .16s ease-out;
}
@keyframes fadeIn { from { opacity: 0; } }
.modal {
  width: 100%;
  max-width: 480px;
  max-height: calc(100dvh - 48px);
  overflow: auto;
  border-radius: 16px;
  border: 1px solid var(--line-2);
  background: var(--panel);
  box-shadow: 0 30px 80px -40px #000;
  animation: modalIn .18s ease-out;
}
@keyframes modalIn { from { opacity: 0; transform: translateY(10px) scale(.985); } }
.modal-wide { max-width: 820px; }
.modal-narrow { max-width: 400px; }
.modal-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 20px 22px 14px;
}
.modal-title { font-size: 17px; font-weight: 700; letter-spacing: -.02em; }
.modal-sub { font-size: 11.5px; color: var(--dim); margin-top: 3px; }
.modal-body { padding: 4px 22px 20px; display: flex; flex-direction: column; gap: 18px; }
.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 14px 20px;
  border-top: 1px solid var(--line);
  background: rgba(0, 0, 0, .18);
}
.modal-text { font-size: 12px; color: var(--muted); line-height: 1.55; }

/* ----- формы ----- */
.field { display: flex; flex-direction: column; gap: 8px; }
.field-label {
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--muted);
}
.field-hint { font-size: 10.5px; color: var(--dim); line-height: 1.45; }
.input, .textarea, .select {
  width: 100%;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: rgba(0, 0, 0, .28);
  color: var(--text);
  font-family: var(--font);
  font-size: 13px;
  padding: 9px 11px;
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.input:focus, .textarea:focus, .select:focus {
  border-color: color-mix(in srgb, var(--acc) 55%, transparent);
  box-shadow: 0 0 0 3px var(--acc-soft);
}
.textarea { min-height: 96px; resize: vertical; line-height: 1.5; }
.select { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: calc(100% - 16px) 50%, calc(100% - 11px) 50%; background-size: 5px 5px, 5px 5px; background-repeat: no-repeat; padding-right: 30px; }
.select option { background: var(--panel); color: var(--text); }
.btn-row { display: flex; gap: 7px; flex-wrap: wrap; }
.switch-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 12px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  cursor: pointer;
}
.switch-row .field-label { display: block; margin-bottom: 2px; }
.switch {
  appearance: none;
  width: 40px;
  height: 23px;
  border-radius: 99px;
  background: rgba(255, 255, 255, .1);
  border: 1px solid var(--line-2);
  position: relative;
  cursor: pointer;
  transition: background .2s, border-color .2s;
  flex: 0 0 auto;
}
.switch::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 15px;
  height: 15px;
  border-radius: 50%;
  background: var(--muted);
  transition: transform .2s cubic-bezier(.2, .9, .3, 1.2), background .2s;
}
.switch:checked { background: var(--acc-soft); border-color: var(--acc); }
.switch:checked::after { transform: translateX(17px); background: var(--acc); }

/* ----- темы ----- */
.theme-row { display: flex; gap: 8px; row-gap: 24px; flex-wrap: wrap; padding-bottom: 16px; }
.theme-dot {
  width: 44px;
  height: 34px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--panel);
  cursor: pointer;
  position: relative;
  display: grid;
  place-items: center;
  transition: border-color .15s;
}
.theme-dot:hover { border-color: var(--line-2); }
.theme-dot i {
  width: 16px; height: 16px; border-radius: 50%;
  background: var(--dot);
}
.theme-dot.active { border-color: var(--dot); }
.theme-dot small {
  position: absolute; bottom: -16px; left: 50%; transform: translateX(-50%);
  font-size: 9px; color: var(--dim); white-space: nowrap; letter-spacing: .02em;
}

/* ----- каталог ----- */
.catalog-tools {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  padding: 0 22px 12px;
}
.catalog-tools .input { flex: 1 1 220px; min-width: 0; }
.catalog {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 8px;
  padding: 0 22px 22px;
  max-height: min(58dvh, 540px);
  overflow: auto;
}
.cat-item {
  display: flex;
  align-items: flex-start;
  gap: 11px;
  padding: 12px 12px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, .022);
  text-align: left;
  cursor: pointer;
  transition: border-color .15s, background .15s;
}
.cat-item:hover {
  border-color: color-mix(in srgb, var(--acc) 45%, transparent);
  background: var(--acc-soft);
}
.catalog-note {
  grid-column: 1 / -1;
  padding: 14px 2px 2px;
  color: var(--dim);
  font-size: 10.5px;
  line-height: 1.5;
}
.catalog-note a { color: var(--acc); text-decoration: none; }
.catalog-note a:hover { text-decoration: underline; }
.cat-item .ci-ico {
  width: 32px; height: 32px;
  flex: 0 0 auto;
  display: grid; place-items: center;
  border-radius: 8px;
  background: rgba(255, 255, 255, .05);
  border: 1px solid var(--line);
  color: var(--acc);
  font-family: var(--mono);
  font-size: 13px;
}
.cat-item b { display: block; font-size: 12.5px; font-weight: 600; margin-bottom: 2px; }
.cat-item span { display: block; font-size: 10.5px; color: var(--dim); line-height: 1.4; }
.cat-item .ci-plus {
  margin-left: auto;
  color: var(--dim);
  font-size: 15px;
  line-height: 1;
  align-self: center;
  transition: color .15s, transform .15s;
}
.cat-item:hover .ci-plus { color: var(--acc); }

/* ============================================================
   Командная палитра
   ============================================================ */
.palette-overlay { align-items: start; padding-top: min(16vh, 150px); }
.palette {
  width: 100%;
  max-width: 620px;
  border-radius: 12px;
  border: 1px solid var(--line-2);
  background: var(--panel);
  box-shadow: 0 28px 70px -40px #000;
  overflow: hidden;
  animation: modalIn .18s ease-out;
}
.palette-search {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 15px 16px;
  border-bottom: 1px solid var(--line);
}
.palette-ico { color: var(--acc); font-size: 17px; }
.palette-search input {
  flex: 1;
  background: transparent;
  border: 0;
  outline: none;
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
}
.palette-search input::placeholder { color: var(--dim); }
.palette-list { max-height: min(46dvh, 380px); overflow: auto; padding: 6px; }
.pal-item {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 9px 11px;
  border-radius: 7px;
  cursor: pointer;
  border: 1px solid transparent;
}
.pal-item.active { background: rgba(255, 255, 255, .06); border-color: var(--line); }
.pal-item .pi-ico {
  width: 26px; height: 26px;
  display: grid; place-items: center;
  border-radius: 7px;
  background: var(--acc-soft);
  color: var(--acc);
  font-family: var(--mono);
  font-size: 11px;
  flex: 0 0 auto;
}
.pal-item .pi-ico.neutral { background: rgba(255, 255, 255, .06); color: var(--muted); }
.pal-item b { font-size: 12.5px; font-weight: 600; }
.pal-item small { margin-left: auto; font-size: 10px; color: var(--dim); }
.pal-item .pi-kind {
  font-size: 8.5px;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: var(--dim);
  border: 1px solid var(--line);
  border-radius: 5px;
  padding: 2px 5px;
  margin-left: auto;
}
.pal-empty { padding: 26px; text-align: center; color: var(--dim); font-size: 12px; }
.palette-foot {
  display: flex;
  gap: 18px;
  padding: 9px 14px;
  border-top: 1px solid var(--line);
  font-size: 10px;
  color: var(--dim);
  background: rgba(0, 0, 0, .2);
}
.palette-foot kbd { margin-right: 2px; }
.palette-foot b { color: var(--muted); }

/* ============================================================
   Тосты
   ============================================================ */
.toasts {
  position: fixed;
  left: 18px;
  bottom: 18px;
  z-index: 400;
  display: flex;
  flex-direction: column;
  gap: 6px;
  pointer-events: none;
}
.toast {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 9px 13px;
  border-radius: 8px;
  border: 1px solid var(--line-2);
  background: var(--panel);
  box-shadow: 0 12px 30px -22px #000;
  font-size: 12px;
  color: var(--muted);
  animation: toastIn .18s ease-out;
  max-width: 340px;
}
.toast.out { animation: toastOut .2s ease-in forwards; }
.toast b { color: var(--text); font-weight: 600; }
.toast .t-ico { color: var(--acc); font-size: 13px; }
.toast.warn .t-ico { color: var(--acc-2); }
.toast.err .t-ico { color: var(--danger); }
@keyframes toastIn { from { opacity: 0; transform: translateX(-10px); } }
@keyframes toastOut { to { opacity: 0; transform: translateX(-10px); } }

/* ============================================================
   Киоск
   ============================================================ */
body.kiosk .topbar {
  height: 0;
  flex-basis: 0;
  min-height: 0;
  padding: 0;
  border-bottom: 0;
  overflow: hidden;
  opacity: 0;
  pointer-events: none;
}
body.kiosk .stage { padding: 0 !important; }
body.kiosk .board {
  min-height: 100dvh;
  border-radius: 0;
  transform: translateY(calc(-1 * var(--top-shift, 0px)));
}
body.kiosk .w-head {
  height: 0;
  flex-basis: 0;
  padding: 0;
  border: 0;
  overflow: hidden;
  opacity: 0;
}
body.kiosk .w-actions { display: none; }
body.kiosk .w-resize { display: none; }
body.kiosk .empty-actions .btn-ghost, body.kiosk .empty-hint { display: none; }
.kiosk-exit {
  position: fixed;
  top: 12px;
  right: 12px;
  z-index: 500;
  opacity: .25;
  transition: opacity .2s;
}
.kiosk-exit:hover { opacity: 1; }

/* ----- чистый режим: только виджеты ----- */
body.clean-mode .topbar {
  height: 0;
  flex-basis: 0;
  min-height: 0;
  padding: 0;
  border-bottom: 0;
  overflow: hidden;
  opacity: 0;
  pointer-events: none;
}
body.clean-mode .stage { padding: 0 !important; }
body.clean-mode .board { transform: translateY(calc(-1 * var(--top-shift, 0px))); }
body.clean-mode .w-head {
  height: 0;
  flex-basis: 0;
  padding: 0;
  border: 0;
  overflow: hidden;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}
body.clean-mode .w-actions,
body.clean-mode .w-resize,
body.clean-mode .grx-w-head { display: none; }
body.clean-mode .board-watermark { color: rgba(255, 255, 255, .025); }
.clean-exit {
  position: fixed;
  top: 10px;
  right: 14px;
  z-index: 500;
  height: 28px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: rgba(13, 17, 23, .72);
  color: var(--dim);
  font-size: 9.5px;
  letter-spacing: .04em;
  cursor: pointer;
  opacity: .3;
  transition: opacity .15s, color .15s, border-color .15s;
}
.clean-exit:hover { opacity: 1; color: var(--text); border-color: var(--line-2); }

/* ============================================================
   Эффекты: тряска, поезд-оверлей
   ============================================================ */
body.shaking .app { animation: shake .62s cubic-bezier(.36, .07, .19, .97) both; }
@keyframes shake {
  10%, 90% { transform: translate3d(-2px, 1px, 0) rotate(-.12deg); }
  20%, 80% { transform: translate3d(4px, -2px, 0) rotate(.2deg); }
  30%, 50%, 70% { transform: translate3d(-7px, 3px, 0) rotate(-.3deg); }
  40%, 60% { transform: translate3d(7px, -4px, 0) rotate(.3deg); }
}

.takeover-host { position: fixed; inset: 0; z-index: 600; pointer-events: none; }
.takeover {
  position: fixed;
  inset: 0;
  background: #040507;
  overflow: hidden;
  pointer-events: auto;
  animation: fadeIn .18s ease-out;
  cursor: pointer;
}
.takeover.closing { animation: fadeOut .3s ease-in forwards; }
@keyframes fadeOut { to { opacity: 0; } }
.takeover-close {
  position: absolute;
  top: 16px;
  right: 18px;
  z-index: 20;
  font-size: 10px;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, .45);
  border: 1px solid rgba(255, 255, 255, .14);
  background: rgba(0, 0, 0, .35);
  padding: 7px 11px;
  border-radius: 8px;
  cursor: pointer;
}
.takeover-close:hover { color: #fff; border-color: rgba(255, 255, 255, .35); }

/* ============================================================
   Адаптив
   ============================================================ */
@media (max-width: 1120px) {
  .brand-sub { display: none; }
  .topbar-status { display: none; }
  .btn-label { display: none; }
  #btnAdd .btn-label { display: inline; }
}
@media (max-width: 900px) {
  .board-name { display: none; }
  .board-btn { padding: 0 9px; }
}
@media (max-width: 840px) {
  .pid-account { padding: 0 9px; }
}

body.compact .stage { padding: 14px; }
body.compact .board {
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 14px;
  background-image: none;
}
body.compact .widget {
  position: relative !important;
  left: auto !important;
  top: auto !important;
  width: 100% !important;
  height: auto !important;
  min-height: 280px;
  z-index: auto !important;
}
body.compact .w-resize { display: none; }
body.compact .w-actions { opacity: 1; transform: none; }
body.compact .empty { position: relative; min-height: 70dvh; }
body.compact .empty-title br { display: none; }

@media (max-width: 720px) {
  #btnEdit { display: none; }
  #btnAdd .btn-label { display: none; }
  #btnAdd { padding: 0 10px; }
  .board-name { display: none; }
  .board-btn { padding: 0 9px; }
  .brand-name { font-size: 14px; letter-spacing: .06em; }
  .brand-sub { display: none; }
  .topbar { padding: 0 10px; gap: 4px; }
  #btnPresets .btn-label { display: none; }
  .stage { padding: 10px; }
  .empty-card { padding: 28px 18px 24px; }
  .empty-actions { flex-direction: column; }
  .empty-actions .btn { width: 100%; }
  .modal-actions { flex-wrap: wrap; }
  .catalog { grid-template-columns: 1fr; }
  .palette-overlay { padding: 12px; padding-top: 10vh; }
}
@media (max-width: 520px) {
  #btnPresets, #btnTopbar { display: none; }
  .pid-account { padding: 0 8px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
  body.shaking .app { animation: none; }
}

/* ============================================================
   Прокрутка, диапазон и иконки
   ============================================================ */
* {
  scrollbar-width: thin;
  scrollbar-color: color-mix(in srgb, var(--acc) 42%, transparent) transparent;
}
*::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}
*::-webkit-scrollbar-track {
  background: transparent;
}
*::-webkit-scrollbar-thumb {
  min-height: 34px;
  border: 3px solid transparent;
  border-radius: 99px;
  background: linear-gradient(180deg,
    color-mix(in srgb, var(--acc) 52%, transparent),
    color-mix(in srgb, var(--acc-2) 46%, transparent));
  background-clip: content-box;
  transition: background .18s;
}
*::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(180deg, var(--acc), var(--acc-2));
  background-clip: content-box;
}
*::-webkit-scrollbar-corner { background: transparent; }

.stage::-webkit-scrollbar { width: 12px; }
.stage::-webkit-scrollbar-thumb { border-width: 3px; }
.w-body::-webkit-scrollbar,
.term-log::-webkit-scrollbar,
.catalog::-webkit-scrollbar,
.modal-body::-webkit-scrollbar,
.palette-list::-webkit-scrollbar { width: 8px; }
.w-body::-webkit-scrollbar-thumb,
.term-log::-webkit-scrollbar-thumb,
.catalog::-webkit-scrollbar-thumb,
.modal-body::-webkit-scrollbar-thumb,
.palette-list::-webkit-scrollbar-thumb { border-width: 2px; }

::selection {
  background: color-mix(in srgb, var(--acc) 32%, transparent);
  color: var(--text);
}

.ico {
  display: block;
  flex: 0 0 auto;
  pointer-events: none;
}
.w-ico .ico,
.ci-ico .ico,
.pi-ico .ico,
.t-ico .ico,
.chip-ico .ico,
.we-ico .ico { display: block; }
.w-btn .ico { opacity: .9; }
.w-btn:hover .ico { opacity: 1; }

.volume-field {
  padding: 13px 0 15px;
  border-bottom: 1px solid var(--line);
}
.volume-field .field-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}
.volume-field .field-label b {
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 600;
  color: var(--acc);
  letter-spacing: .04em;
}
.range {
  appearance: none;
  -webkit-appearance: none;
  display: block;
  width: 100%;
  height: 5px;
  margin: 0;
  border-radius: 99px;
  background: linear-gradient(90deg,
    var(--acc) 0 var(--fill, 70%),
    rgba(255, 255, 255, .1) var(--fill, 70%) 100%);
  outline: none;
  cursor: pointer;
}
.range::-webkit-slider-thumb {
  appearance: none;
  -webkit-appearance: none;
  width: 17px;
  height: 17px;
  border-radius: 50%;
  border: 2px solid var(--bg);
  background: var(--acc);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--acc) 14%, transparent);
  cursor: grab;
  transition: box-shadow .18s, transform .18s;
}
.range::-webkit-slider-thumb:hover { box-shadow: 0 0 0 6px color-mix(in srgb, var(--acc) 18%, transparent); }
.range::-webkit-slider-thumb:active { cursor: grabbing; transform: scale(1.08); }
.range::-moz-range-thumb {
  width: 15px;
  height: 15px;
  border-radius: 50%;
  border: 2px solid var(--bg);
  background: var(--acc);
  cursor: grab;
}
.range:focus-visible { outline: 2px solid var(--acc); outline-offset: 4px; }

.btn .btn-ico { display: grid; place-items: center; width: 14px; height: 14px; }
.pid-account-ico { display: grid; place-items: center; color: var(--acc); opacity: .95; }
.pid-account.guest .pid-account-ico { color: var(--dim); }
.pid-account.logged .pid-account-ico { color: var(--acc); }
.palette-ico svg { display: block; }
.icon-btn svg, .btn svg { display: block; }

.mi-ico svg { display: block; }


/* ----- редактирование прямо в киоске ----- */
.kiosk-exit {
  display: flex;
  align-items: center;
  gap: 8px;
}
.kiosk-exit .btn {
  height: 30px;
  padding: 0 11px;
  font-size: 10px;
}
.kiosk-edit-btn.active {
  color: var(--acc);
  border-color: color-mix(in srgb, var(--acc) 45%, transparent);
  background: var(--acc-soft);
}
body.kiosk.editing .topbar {
  flex: 0 0 var(--topbar-h);
  height: var(--topbar-h);
  min-height: var(--topbar-h);
  padding: 0 16px 0 20px;
  border-bottom: 1px solid var(--line);
  overflow: visible;
  opacity: 1;
  pointer-events: auto;
}
body.kiosk.editing .stage { padding: 20px !important; }
body.kiosk.editing .board {
  min-height: calc(100dvh - var(--topbar-h) - 40px);
  border-radius: 16px;
  transform: none;
}
body.kiosk.editing .w-head {
  height: 42px;
  flex-basis: 42px;
  padding: 0 7px 0 12px;
  border: 0;
  border-bottom: 1px solid transparent;
  overflow: visible;
  opacity: 1;
}
body.kiosk.editing .w-actions { display: flex; }
body.kiosk.editing .w-resize { display: block; }
body.kiosk.editing .widget:hover .w-head { border-bottom-color: rgba(255, 255, 255, .045); }

body.kiosk.editing .kiosk-exit {
  top: 74px;
  right: 16px;
  opacity: 1;
}
