/* Доска Solomon. Раскладка: верхняя панель, под ней доска на всю ширину с горизонтальной прокруткой колонок. */
:root {
  --bg: #eef1f4;
  --surface: #ffffff;
  --list: #f1f2f4;
  --ink: #172b4d;
  --muted: #5e6c84;
  --line: #dcdfe4;
  --accent: #0f6e78;
  --accent-ink: #ffffff;
  --danger: #b42318;
  --ok: #1f845a;
  --overlay: rgba(9, 30, 66, .54);
  --tint-1: rgba(9,30,66,.05); --tint-2: rgba(9,30,66,.08); --tint-3: rgba(9,30,66,.13);
  --shadow: 0 1px 1px rgba(9,30,66,.25), 0 0 1px rgba(9,30,66,.31);
  --shadow-lg: 0 8px 24px rgba(9,30,66,.25);
  --lbl-green: #4bce97; --lbl-yellow: #f5cd47; --lbl-orange: #fea362; --lbl-red: #f87168;
  --lbl-purple: #9f8fef; --lbl-blue: #579dff; --lbl-sky: #6cc3e0; --lbl-pink: #e774bb; --lbl-black: #8590a2;
  --f-display: "Archivo", "Helvetica Neue", Arial, sans-serif;
  --f-mono: "IBM Plex Mono", ui-monospace, Menlo, monospace;
  color-scheme: light;
}
/* Тёмная тема: по системе, пока пользователь не выбрал сам (data-theme на <html>, переключатель в шапке). */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #161a1d; --surface: #22272b; --list: #101204; --ink: #dee4ea; --muted: #9fadbc; --line: #38414a;
    --accent: #4fb9c3; --accent-ink: #0b1f22; --danger: #f87168; --ok: #4bce97; --overlay: rgba(0,0,0,.6);
    --shadow: 0 1px 1px rgba(0,0,0,.5); --shadow-lg: 0 8px 24px rgba(0,0,0,.6);
    --list: #101214;
    --tint-1: rgba(255,255,255,.04); --tint-2: rgba(255,255,255,.08); --tint-3: rgba(255,255,255,.15);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #161a1d; --surface: #22272b; --list: #101204; --ink: #dee4ea; --muted: #9fadbc; --line: #38414a;
  --accent: #4fb9c3; --accent-ink: #0b1f22; --danger: #f87168; --ok: #4bce97; --overlay: rgba(0,0,0,.6);
  --shadow: 0 1px 1px rgba(0,0,0,.5); --shadow-lg: 0 8px 24px rgba(0,0,0,.6);
  --list: #101214;
  --tint-1: rgba(255,255,255,.04); --tint-2: rgba(255,255,255,.08); --tint-3: rgba(255,255,255,.15);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 14px/1.43 var(--f-display); }
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
[hidden] { display: none !important; }
h1, h2, h3 { margin: 0; text-wrap: balance; }
.mono { font-family: var(--f-mono); }
.muted { color: var(--muted); }

.btn { border: 0; border-radius: 4px; padding: 6px 12px; background: var(--tint-2); color: var(--ink); font-weight: 500; }
.btn:hover { background: var(--tint-3); }
.btn.primary { background: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { background: var(--accent); filter: brightness(1.12); }
.btn.danger { background: transparent; color: var(--danger); }
.btn.ghost { background: transparent; }
.btn:disabled { opacity: .5; cursor: default; }

.input { width: 100%; min-width: 0; border: 1px solid var(--line); border-radius: 4px; padding: 7px 10px; background: var(--surface); }
textarea.input { resize: vertical; min-height: 64px; }
.field { display: grid; gap: 4px; font-size: 12px; font-weight: 600; color: var(--muted); }
.err { color: var(--danger); font-size: 13px; }

/* Верхняя панель */
.topbar { position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 12px; height: 48px;
  padding: env(safe-area-inset-top, 0px) max(12px, env(safe-area-inset-right, 0px)) 0 max(12px, env(safe-area-inset-left, 0px));
  background: var(--surface); border-bottom: 1px solid var(--line); }
.topbar .logo { display: flex; align-items: center; gap: 8px; font-weight: 800; text-decoration: none; color: var(--ink); }
.topbar .logo i { width: 22px; height: 22px; border-radius: 5px; background: var(--accent); display: inline-block; position: relative; }
.topbar .logo i::before, .topbar .logo i::after { content: ""; position: absolute; top: 4px; width: 5px; background: var(--accent-ink); border-radius: 1px; }
.topbar .logo i::before { left: 5px; height: 13px; } .topbar .logo i::after { left: 12px; height: 8px; }
.topbar nav { display: flex; gap: 4px; }
.topbar nav a { text-decoration: none; color: var(--ink); padding: 6px 10px; border-radius: 4px; font-weight: 500; }
.topbar nav a:hover, .topbar nav a.on { background: var(--tint-2); }
.topbar .spacer { flex: 1; }
.avatar { width: 28px; height: 28px; border-radius: 50%; display: inline-grid; place-items: center; font-size: 11px; font-weight: 700;
  background: var(--accent); color: var(--accent-ink); flex: none; text-transform: uppercase; }
.avatar.sm { width: 24px; height: 24px; font-size: 10px; }

/* Страницы */
/* Ширина постоянная (раньше в колонке #app страница сжималась по содержимому и «прыгала» при смене фильтров и вкладок). */
.page { width: 100%; max-width: 1100px; margin: 0 auto; align-self: center; padding: 28px max(16px, env(safe-area-inset-right, 0px)) 48px max(16px, env(safe-area-inset-left, 0px)); display: grid; gap: 20px; }
.page h1 { font-size: 22px; font-weight: 800; }
.section-title { font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }

/* Вход */
.auth { min-height: 100%; display: grid; place-items: center; padding: 24px 16px; }
.auth form { width: min(380px, 100%); background: var(--surface); border-radius: 8px; box-shadow: var(--shadow-lg); padding: 32px 28px; display: grid; gap: 14px; }
.auth h1 { font-size: 20px; text-align: center; }
.auth .sub { text-align: center; color: var(--muted); margin-top: -6px; }
.auth a { color: var(--accent); }
.pw { position: relative; display: block; }
.pw .input { padding-right: 38px; }
.pw-eye { position: absolute; right: 2px; top: 50%; transform: translateY(-50%); width: 32px; height: 30px; border: 0; background: transparent;
  color: var(--muted); display: grid; place-items: center; border-radius: 4px; cursor: pointer; }
.pw-eye:hover { color: var(--ink); }
.pw-rules { list-style: none; margin: -6px 0 0; padding: 0; display: grid; gap: 2px; font-size: 12px; color: var(--muted); }
.pw-rules li::before { content: "○"; display: inline-block; width: 16px; }
.pw-rules li.ok { color: var(--ok); }
.pw-rules li.ok::before { content: "✓"; }
.pw-meter { display: flex; align-items: center; gap: 10px; margin-top: -6px; font-size: 12px; color: var(--muted); }
.pw-meter[hidden] { display: none; }
.pw-meter-bars { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; flex: 1; }
.pw-meter-bars i { height: 4px; border-radius: 2px; background: var(--line); }
.pw-meter[data-level="0"] i.on { background: var(--danger); }
.pw-meter[data-level="1"] i.on { background: #e2a03f; }
.pw-meter[data-level="2"], .pw-meter[data-level="3"] { color: var(--ok); }
.pw-meter[data-level="2"] i.on, .pw-meter[data-level="3"] i.on { background: var(--ok); }
.pw-meter[data-level="0"] .pw-meter-text { color: var(--danger); }

/* Список досок */
.board-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 12px; }
.board-tile { height: 96px; border-radius: 6px; padding: 10px 12px; color: #fff; text-decoration: none; font-weight: 700; font-size: 16px;
  display: flex; flex-direction: column; justify-content: space-between; box-shadow: var(--shadow); position: relative; overflow: hidden; border: 0; text-align: left; }
.board-tile::after { content: ""; position: absolute; inset: 0; background: rgba(0,0,0,0); transition: background .1s; }
.board-tile:hover::after { background: rgba(0,0,0,.12); }
.board-tile small { font-weight: 500; font-size: 12px; opacity: .9; }
.board-tile.new { background: var(--tint-2); color: var(--ink); font-weight: 500; font-size: 14px; justify-content: center; align-items: center; }

/* Доска */
#app { height: 100%; display: flex; flex-direction: column; }
.board-page { display: flex; flex-direction: column; flex: 1; min-height: 0; }
.board-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 10px max(12px, env(safe-area-inset-right, 0px)) 10px max(12px, env(safe-area-inset-left, 0px));
  background: rgba(0,0,0,.18); color: #fff; }
.board-head .title { font-size: 18px; font-weight: 800; padding: 4px 8px; border-radius: 4px; background: transparent; border: 0; color: #fff; max-width: 100%; }
.board-head .title:hover { background: rgba(255,255,255,.2); }
.board-head input.title { background: #fff; color: #172b4d; }
.board-head .btn { background: rgba(255,255,255,.2); color: #fff; }
.board-head .btn:hover { background: rgba(255,255,255,.32); }
.board-head .btn.on { background: #fff; color: #172b4d; }
.board-head .seg { display: inline-flex; gap: 2px; background: rgba(0,0,0,.15); padding: 2px; border-radius: 6px; }
.board-head select { background: rgba(255,255,255,.2); color: #fff; border: 0; border-radius: 4px; padding: 6px 8px; }
.board-head select option { color: #172b4d; }
.board-head .spacer { flex: 1; }
.board-body { flex: 1; min-height: 0; overflow: auto; }

.lists { display: flex; align-items: flex-start; gap: 12px; padding: 12px max(12px, env(safe-area-inset-right, 0px)) 24px max(12px, env(safe-area-inset-left, 0px)); height: 100%; }
.list { flex: 0 0 272px; max-height: 100%; display: flex; flex-direction: column; background: var(--list); border-radius: 12px; box-shadow: var(--shadow); }
.list-head { display: flex; align-items: center; gap: 4px; padding: 8px 8px 4px 12px; cursor: grab; touch-action: none; }
.list-head h3 { flex: 1; font-size: 14px; font-weight: 700; padding: 4px 0; overflow-wrap: anywhere; cursor: pointer; }
.list-head input { flex: 1; }
.list-head .count { font-size: 12px; color: var(--muted); font-family: var(--f-mono); }
.icon-btn { border: 0; background: transparent; border-radius: 4px; width: 28px; height: 28px; display: grid; place-items: center; color: var(--muted); }
.icon-btn:hover { background: var(--tint-3); color: var(--ink); }
.cards { display: flex; flex-direction: column; gap: 8px; padding: 4px 8px; overflow-y: auto; min-height: 8px; }
.list-foot { padding: 4px 8px 8px; }
.add-card { width: 100%; text-align: left; border: 0; background: transparent; color: var(--muted); padding: 6px 8px; border-radius: 6px; }
.add-card:hover { background: var(--tint-3); color: var(--ink); }
.composer { display: grid; gap: 8px; }
.composer .row { display: flex; gap: 6px; align-items: center; }
.add-list { flex: 0 0 272px; background: rgba(255,255,255,.24); color: #fff; border: 0; border-radius: 12px; padding: 12px; text-align: left; font-weight: 500; }
.add-list:hover { background: rgba(255,255,255,.34); }
.add-list-form { flex: 0 0 272px; background: var(--list); border-radius: 12px; padding: 8px; }

.card { background: var(--surface); border-radius: 8px; box-shadow: var(--shadow); padding: 8px 10px; display: grid; gap: 6px; cursor: pointer; touch-action: none; user-select: none; position: relative; }
.card:hover { outline: 2px solid var(--accent); outline-offset: -2px; }
.card .labels { display: flex; flex-wrap: wrap; gap: 4px; }
.lbl { height: 8px; min-width: 40px; border-radius: 4px; }
.lbl.wide { height: auto; min-width: 0; padding: 1px 8px; font-size: 12px; font-weight: 600; color: #172b4d; }
.card .ctitle { overflow-wrap: anywhere; }
.card.done .ctitle { text-decoration: line-through; color: var(--muted); }
.badges { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; font-size: 12px; color: var(--muted); }
.badges .spacer { flex: 1; }
.badge { display: inline-flex; align-items: center; gap: 4px; padding: 1px 4px; border-radius: 3px; }
.badge.due-soon { background: #f5cd47; color: #533f04; }
.badge.overdue { background: #c9372c; color: #fff; }
.badge.done { background: #1f845a; color: #fff; }
.placeholder { border-radius: 8px; background: var(--tint-3); }
.list.placeholder { flex: 0 0 272px; border-radius: 12px; background: rgba(0,0,0,.18); box-shadow: none; }
.drag-ghost { position: fixed; z-index: 100; pointer-events: none; transform: rotate(3deg); box-shadow: var(--shadow-lg); opacity: .95; }

/* Карточка: окно */
.modal-bg { position: fixed; inset: 0; z-index: 50; background: var(--overlay); overflow-y: auto; display: flex; justify-content: center; align-items: flex-start;
  padding: max(24px, env(safe-area-inset-top, 0px)) max(12px, env(safe-area-inset-right, 0px)) 48px max(12px, env(safe-area-inset-left, 0px)); }
.modal { width: min(760px, 100%); background: var(--list); border-radius: 12px; padding: 20px; display: grid; gap: 18px; position: relative; }
.modal .close { position: absolute; top: 10px; right: 10px; }
.modal-title { font-size: 20px; font-weight: 700; border: 0; background: transparent; width: calc(100% - 40px); padding: 4px 6px; border-radius: 4px; resize: none; overflow: hidden; }
.modal-title:focus { background: var(--surface); }
.modal-grid { display: grid; grid-template-columns: minmax(0, 1fr) 200px; gap: 20px; }
.modal-main, .modal-side { display: grid; gap: 18px; align-content: start; min-width: 0; }
.modal-side .field select, .modal-side .field input { width: 100%; }
.modal-side .field input[type=checkbox] { width: auto; }
.block h4 { margin: 0 0 8px; font-size: 14px; font-weight: 700; }
.label-picker { display: flex; flex-wrap: wrap; gap: 6px; }
.label-chip { border: 2px solid transparent; border-radius: 4px; height: 28px; min-width: 44px; padding: 0 8px; font-size: 12px; font-weight: 600; color: #172b4d; }
.label-chip.on { border-color: var(--ink); }
.check-item { display: flex; align-items: flex-start; gap: 8px; padding: 4px 0; }
.check-item span { flex: 1; overflow-wrap: anywhere; }
.check-item.done span { text-decoration: line-through; color: var(--muted); }
.progress { height: 8px; background: var(--tint-3); border-radius: 4px; overflow: hidden; margin-bottom: 6px; }
.progress i { display: block; height: 100%; background: var(--accent); }
.comment { display: grid; grid-template-columns: auto 1fr; gap: 8px; }
.comment .body { background: var(--surface); border-radius: 8px; padding: 8px 10px; box-shadow: var(--shadow); white-space: pre-wrap; overflow-wrap: anywhere; }
.comment .meta { font-size: 12px; color: var(--muted); margin-bottom: 2px; }
.desc-view { white-space: pre-wrap; overflow-wrap: anywhere; background: var(--surface); border-radius: 6px; padding: 8px 10px; min-height: 48px; cursor: text; }
.desc-view.empty { color: var(--muted); }
@media (max-width: 640px) { .modal-grid { grid-template-columns: 1fr; } }

/* Гант */
.gantt { --day: 32px; position: relative; min-width: max-content; min-height: 100%; }
.gantt.zoom-week { --day: 12px; }
.gantt-row { display: flex; min-height: 36px; border-bottom: 1px solid var(--line); }
.gantt-name { position: sticky; left: 0; z-index: 3; flex: 0 0 260px; background: var(--surface); border-right: 1px solid var(--line); padding: 6px 10px; display: flex; align-items: center; gap: 8px; overflow: hidden; }
.gantt-name button { border: 0; background: transparent; text-align: left; padding: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; min-width: 0; }
.gantt-name button:hover { color: var(--accent); text-decoration: underline; }
.gantt-group .gantt-name { background: var(--list); font-weight: 700; }
.gantt-group { background: var(--list); }
.gantt-track { position: relative; flex: none; display: flex; align-items: center; }
.gantt-head { position: sticky; top: 0; z-index: 4; background: var(--surface); border-bottom: 1px solid var(--line); }
.gantt-head .gantt-name { z-index: 5; font-size: 12px; font-weight: 700; color: var(--muted); }
.gantt-months, .gantt-days { display: flex; }
.gantt-months div { border-left: 1px solid var(--line); font-size: 12px; font-weight: 700; white-space: nowrap; }
.gantt-months span { position: sticky; left: 266px; display: inline-block; padding: 2px 6px; }
@media (max-width: 560px) { .gantt-months span { left: 156px; } }
.gantt-days div { width: var(--day); flex: none; text-align: center; font-size: 11px; color: var(--muted); border-left: 1px solid var(--line); font-family: var(--f-mono); }
.gantt-days div.we { background: var(--tint-1); }
.gantt.zoom-week .gantt-days div { font-size: 0; }
.gantt.zoom-week .gantt-days div.mon { font-size: 9px; overflow: visible; text-align: left; }
.gantt-grid { position: absolute; inset: 0; display: flex; pointer-events: none; }
.gantt-grid div { width: var(--day); flex: none; border-left: 1px solid transparent; }
.gantt-grid div.we { background: var(--tint-1); }
.gantt-today { position: absolute; top: 0; bottom: 0; width: 2px; background: #c9372c; z-index: 2; pointer-events: none; }
.gantt-bar { position: absolute; top: 6px; height: 24px; border-radius: 4px; color: #fff; font-size: 12px; font-weight: 600; padding: 0 8px; display: flex; align-items: center;
  white-space: nowrap; overflow: hidden; cursor: grab; touch-action: none; user-select: none; box-shadow: var(--shadow); z-index: 1; }
.gantt-bar.done { opacity: .5; }
.gantt-bar .h { position: absolute; top: 0; bottom: 0; width: 8px; cursor: ew-resize; }
.gantt-bar .h.l { left: 0; } .gantt-bar .h.r { right: 0; }
.gantt-empty { position: sticky; left: 266px; margin: 4px 0; padding: 4px 10px; font-size: 12px; color: var(--muted); align-self: center; }
@media (max-width: 560px) { .gantt-empty { left: 156px; } }
.gantt-hint { padding: 10px 14px; color: var(--muted); font-size: 13px; }

/* Админка */
.table-wrap { overflow-x: auto; background: var(--surface); border-radius: 8px; box-shadow: var(--shadow); }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { font-size: 12px; color: var(--muted); font-weight: 700; text-transform: uppercase; letter-spacing: .04em; }
.pill { display: inline-block; padding: 1px 8px; border-radius: 99px; font-size: 12px; font-weight: 600; }
.pill.ok { background: #dcfff1; color: #216e4e; } .pill.wait { background: #fff7d6; color: #7f5f01; } .pill.off { background: #ffeceb; color: #ae2e24; }
.pill.admin { background: #e9f2ff; color: #0c66e4; }
.panel { background: var(--surface); border-radius: 8px; box-shadow: var(--shadow); padding: 16px; display: grid; gap: 12px; }
.form-row { display: flex; flex-wrap: wrap; gap: 10px; align-items: end; }
.form-row .field { flex: 1 1 200px; }
.linkbox { font-family: var(--f-mono); font-size: 12px; background: var(--list); padding: 8px; border-radius: 4px; overflow-wrap: anywhere; }
.notice { background: #fff7d6; color: #533f04; border-radius: 6px; padding: 10px 12px; }

.toast { position: fixed; left: 50%; bottom: max(20px, env(safe-area-inset-bottom, 0px)); transform: translateX(-50%); z-index: 200; background: #172b4d; color: #fff;
  padding: 10px 16px; border-radius: 6px; box-shadow: var(--shadow-lg); max-width: calc(100% - 32px); }

.popover { position: fixed; z-index: 60; background: var(--surface); border-radius: 8px; box-shadow: var(--shadow-lg); padding: 12px; width: 280px; display: grid; gap: 8px; }
.popover h4 { margin: 0; text-align: center; font-size: 14px; color: var(--muted); }
.popover .item { border: 0; background: transparent; text-align: left; padding: 6px 8px; border-radius: 4px; }
.popover .item:hover { background: var(--tint-2); }
.swatches { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }
.theme-btn { font-size: 16px; width: 34px; height: 34px; padding: 0; display: grid; place-items: center; }
.swatches button { height: 32px; border-radius: 4px; border: 2px solid transparent; background-size: cover !important; background-position: center !important; }
.swatches button.on { border-color: var(--ink); }

@media (max-width: 560px) {
  .topbar nav a span { display: none; }
  .list, .add-list, .add-list-form { flex-basis: 85vw; }
  .gantt-name { flex-basis: 150px; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); }
.tabs a { padding: 8px 14px; text-decoration: none; color: var(--muted); font-weight: 600; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tabs a.on { color: var(--ink); border-bottom-color: var(--accent); }
.table-wrap a { color: var(--accent); }
.gantt-head .gantt-track { display: block; }

/* Свои выпадающие списки и календарь (enhanceSelect, enhanceDate в app.js). Стандартных окон браузера нет. */
.dd, .dp { position: relative; display: block; min-width: 0; }
.dd-btn { width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 8px; text-align: left; border: 1px solid var(--line);
  border-radius: 4px; padding: 7px 10px; background: var(--surface); color: var(--ink); font-weight: 500; }
.dd-btn:hover { border-color: var(--muted); }
.dd-btn[aria-expanded="true"] { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.dd-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dd-arrow { flex: none; width: 7px; height: 7px; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: translateY(-2px) rotate(45deg); opacity: .7; transition: transform .15s; }
.dd-btn[aria-expanded="true"] .dd-arrow { transform: translateY(2px) rotate(225deg); }
.board-head .dd { display: inline-block; }
.board-head .dd-btn { background: rgba(255,255,255,.2); color: #fff; border: 0; padding: 6px 10px; min-width: 150px; }
.board-head .dd-btn:hover { background: rgba(255,255,255,.32); }
.board-head .dd-btn[aria-expanded="true"] { box-shadow: none; background: rgba(255,255,255,.32); }
.dd-panel { position: fixed; z-index: 90; background: var(--surface); color: var(--ink); border: 1px solid var(--line); border-radius: 8px; box-shadow: var(--shadow-lg);
  padding: 4px; display: grid; gap: 4px; max-width: calc(100vw - 16px); }
.dd-list { max-height: 260px; overflow-y: auto; display: grid; gap: 1px; }
.dd-item { display: flex; align-items: center; gap: 8px; width: 100%; border: 0; background: transparent; color: var(--ink); text-align: left; padding: 7px 10px 7px 8px; border-radius: 4px; }
.dd-item::before { content: ""; width: 14px; flex: none; text-align: center; color: var(--accent); }
.dd-item[aria-selected="true"] { color: var(--accent); font-weight: 600; }
.dd-item[aria-selected="true"]::before { content: "✓"; }
.dd-item:hover, .dd-item.active { background: var(--tint-2); }
.dd-item:focus-visible { outline: none; background: var(--tint-3); }
.dd-search { margin: 4px 4px 0; width: calc(100% - 8px); }
.dd-empty { padding: 8px 10px; color: var(--muted); font-size: 13px; }

.dp-text { padding-right: 38px; }
.dp-btn { position: absolute; right: 2px; top: 50%; transform: translateY(-50%); width: 32px; height: 30px; border: 0; background: transparent; color: var(--muted);
  display: grid; place-items: center; border-radius: 4px; }
.dp-btn:hover, .dp-btn[aria-expanded="true"] { color: var(--accent); background: var(--tint-2); }
.dp-panel { width: 320px; padding: 10px; gap: 8px; }
.dp-quick { display: flex; gap: 6px; }
.dp-chip { flex: 1 1 auto; white-space: nowrap; border: 0; border-radius: 4px; padding: 4px 6px; background: var(--tint-2); color: var(--ink); font-size: 13px; }
.dp-chip:hover { background: var(--tint-3); }
.dp-chip.on { background: var(--accent); color: var(--accent-ink); }
.dp-week, .dp-grid { display: grid; grid-template-columns: repeat(7, 1fr); text-align: center; }
.dp-week { font-size: 12px; color: var(--muted); border-bottom: 1px solid var(--line); padding-bottom: 6px; }
.dp-week .we { color: var(--danger); }
.dp-scroll { height: 264px; overflow-y: auto; overscroll-behavior: contain; scroll-snap-type: y proximity; }
.dp-month { padding: 4px 0 10px; scroll-snap-align: start; }
.dp-title { text-align: center; font-weight: 600; margin: 4px 0 6px; }
.dp-grid { row-gap: 2px; }
.dp-day { position: relative; height: 34px; border: 0; border-radius: 50%; background: transparent; color: var(--ink); font-size: 14px; width: 34px; justify-self: center; }
.dp-day.we { color: var(--danger); }
.dp-day:hover { background: var(--tint-2); }
.dp-day.today::after { content: ""; position: absolute; left: 50%; bottom: 3px; width: 4px; height: 4px; margin-left: -2px; border-radius: 50%; background: var(--accent); }
.dp-day.on { background: var(--accent); color: var(--accent-ink); font-weight: 700; }
.dp-day.on.today::after { background: var(--accent-ink); }
.dp-foot { display: flex; justify-content: space-between; border-top: 1px solid var(--line); padding-top: 6px; }

/* Вложения в карточке */
.attach-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin-bottom: 8px; }
.attach-hint { font-size: 12px; }
.attach-progress { font-size: 13px; color: var(--accent); margin-bottom: 8px; }
.attach-list { display: grid; gap: 8px; }
.attach { display: flex; gap: 12px; align-items: flex-start; padding: 6px; border-radius: 6px; }
.attach:hover { background: var(--tint-1); }
.attach-thumb { flex: none; width: 112px; height: 80px; border-radius: 4px; overflow: hidden; background: var(--tint-2); display: grid; place-items: center; text-decoration: none; color: var(--ink); }
.attach-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.attach-icon { display: grid; justify-items: center; gap: 2px; font-size: 26px; line-height: 1; }
.attach-icon small { font-size: 11px; font-weight: 700; color: var(--muted); }
.attach-info { min-width: 0; display: grid; gap: 2px; }
.attach-name { font-weight: 600; color: var(--ink); text-decoration: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.attach-name:hover { text-decoration: underline; }
.attach-meta { font-size: 12px; color: var(--muted); }
.attach-actions { display: flex; gap: 12px; font-size: 13px; }
.attach-actions a { color: var(--accent); }
.attach-del { border: 0; background: transparent; padding: 0; color: var(--danger); font-size: 13px; }
.attach-del:hover { text-decoration: underline; }
.modal.drop { outline: 3px dashed var(--accent); outline-offset: -8px; }
.modal.drop::after { content: "Отпустите, чтобы прикрепить"; position: absolute; inset: 0; display: grid; place-items: center; font-size: 18px; font-weight: 700;
  color: var(--accent); background: color-mix(in srgb, var(--surface) 80%, transparent); border-radius: inherit; pointer-events: none; }

/* Ссылки в тексте карточек, комментариев и журнала */
.ext-link { color: var(--accent); text-decoration: underline; overflow-wrap: anywhere; }
.ext-link:hover { text-decoration-thickness: 2px; }

/* Фото фоном на главной и в админке (body.photo-bg, ставит render() в app.js): красная BMW M4 (19.10.2026) */
body.photo-bg { background: #3a1d1a url(/bg/bmw-m4.jpg) center / cover no-repeat fixed; }
body.photo-bg .page > h1 { color: #fff; text-shadow: 0 1px 3px rgba(0,0,0,.6); }
body.photo-bg .tabs { background: var(--surface); border-radius: 8px; padding: 4px 8px 0; box-shadow: var(--shadow); }
body.photo-bg .board-tile.new { background: color-mix(in srgb, var(--surface) 85%, transparent); backdrop-filter: blur(4px); }
body.photo-bg .board-tile.new:hover { background: var(--surface); }

/* Комментарии: поле с файлами, файлы в комментарии, «Изменить / Удалить» */
.composer { display: grid; gap: 6px; border-radius: 8px; }
.composer.drop { outline: 2px dashed var(--accent); outline-offset: 4px; }
.composer-bar { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.cfiles { display: flex; flex-wrap: wrap; gap: 6px; }
.cbody { display: grid; gap: 6px; }
.cbody .cfiles { margin-top: 2px; }
.cfile { position: relative; }
.cfile-thumb { width: 96px; height: 72px; border-radius: 6px; overflow: hidden; background: var(--tint-2); display: grid; place-items: center; text-decoration: none; color: var(--ink); box-shadow: var(--shadow); }
.cfile-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.cfile-x { position: absolute; top: 3px; right: 3px; min-width: 22px; height: 22px; border: 0; border-radius: 11px; padding: 0 6px; background: rgba(0,0,0,.6); color: #fff; font-size: 12px; }
.cfile-x:hover { background: rgba(0,0,0,.8); }
.cfile-x.armed { background: var(--danger); }
.cactions { display: flex; gap: 12px; margin-top: 4px; font-size: 12px; }
.cactions button { border: 0; background: transparent; padding: 0; color: var(--muted); text-decoration: underline; }
.cactions button:hover { color: var(--ink); }
.cactions button.danger:hover { color: var(--danger); }

/* Кружок последнего комментатора на карточке и выбор цвета кружка */
.badge .avatar.sm { width: 18px; height: 18px; font-size: 8px; margin-left: 2px; }
.avatar-colors { display: flex; flex-wrap: wrap; gap: 6px; }
.avatar-color { width: 24px; height: 24px; border-radius: 50%; border: 2px solid transparent; padding: 0; }
.avatar-color.on { border-color: var(--ink); box-shadow: inset 0 0 0 2px var(--surface); }

/* Упоминания и отметки «есть новое» */
.mention { color: var(--accent); font-weight: 600; background: var(--tint-2); border-radius: 4px; padding: 0 3px; }
.mention.me { background: #e8710a; color: #fff; }
.mention-panel .dd-item { gap: 8px; }
.mention-panel .dd-item small { margin-left: auto; font-size: 11px; }
.card.is-fresh .ctitle { font-weight: 700; }
.fresh { position: absolute; top: 6px; right: 6px; width: 10px; height: 10px; border-radius: 50%; background: #0c66e4; box-shadow: 0 0 0 2px var(--surface); }
.fresh.at { width: 18px; height: 18px; top: -6px; right: -6px; display: grid; place-items: center; background: #e8710a; color: #fff; font-size: 11px; font-weight: 800; }
.tile-fresh, .tile-at { font-weight: 800; }

/* Листинги: плитки машин и счётчики этапов (21.10.2026) */
.car-tile { height: 112px; }
.car-tile .car-counts { display: flex; flex-wrap: wrap; gap: 2px 10px; font-family: var(--f-mono); font-size: 11px; }
details.panel > summary { cursor: pointer; list-style: none; }
details.panel > summary::-webkit-details-marker { display: none; }
details.panel:not([open]) { gap: 0; }
.board-head .car-total { color: #fff; opacity: .85; font-size: 13px; }
.board-head a.btn { text-decoration: none; }
body.photo-bg .sources-note { color: #fff; text-shadow: 0 1px 3px rgba(0,0,0,.7); margin: 0 0 12px; }

/* Access: глазок и «Copy» в строке таблицы (21.10.2026) */
.pw-eye.vault-eye { position: static; transform: none; display: inline-flex; align-items: center; justify-content: center; vertical-align: middle; margin-left: 4px; }
.vault-url a { display: inline; }
/* Таблицы админки: одна строка, многоточие, перетаскиваемый край столбца (21.10.2026) */
table.rt { table-layout: fixed; width: auto; }
table.rt th { position: relative; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
table.rt td { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
table.rt td > * { vertical-align: middle; }
.rt-grip { position: absolute; top: 0; right: 0; width: 8px; height: 100%; cursor: col-resize; touch-action: none; }
.rt-grip::after { content: ""; position: absolute; top: 25%; bottom: 25%; right: 3px; width: 2px; border-radius: 1px; background: var(--line); }
.rt-grip:hover::after, table.rt-resizing .rt-grip::after { background: var(--accent); }
table.rt-resizing { user-select: none; cursor: col-resize; }
.vault-copy.done { color: var(--ok, #1f845a); }
/* Ячейка с текстом и кнопками-иконками: текст обрезается, иконки всегда видны */
table.rt .rt-flex { display: flex; align-items: center; gap: 2px; min-width: 0; }
table.rt .rt-text { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
table.rt .rt-flex .pw-eye { flex: 0 0 auto; }

/* Карточка детали: фото, флажок Accept, просмотр крупно (21.10.2026) */
.card-cover { width: 100%; height: 120px; object-fit: cover; border-radius: 6px; display: block; background: var(--tint-2); pointer-events: none; }
.listing-modal { width: min(1040px, 100%); }
.listing-modal .modal-grid { grid-template-columns: minmax(0, 1fr) 240px; }
.ph-head { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.ph-head h4 { margin: 0; }
.ph-head .spacer { flex: 1; }
.ph-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.ph-tile { margin: 0; background: var(--surface); border-radius: 8px; overflow: hidden; box-shadow: var(--shadow); }
.ph-open { display: block; width: 100%; padding: 0; border: 0; background: var(--tint-2); cursor: zoom-in; aspect-ratio: 4 / 3; }
.ph-open img { width: 100%; height: 100%; object-fit: cover; display: block; }
.ph-tile figcaption { display: flex; align-items: center; gap: 6px; padding: 6px 8px; font-size: 12px; }
.ph-accept { display: inline-flex; align-items: center; gap: 4px; cursor: pointer; color: var(--ink); }
.ph-accept input { accent-color: var(--accent); width: 15px; height: 15px; }
.ph-num { color: var(--muted); font-family: var(--f-mono); margin-left: auto; }
.ph-del { border: 0; background: transparent; color: var(--muted); cursor: pointer; padding: 2px 4px; border-radius: 4px; font-size: 12px; }
.ph-del:hover, .ph-del.armed { color: var(--danger); background: var(--tint-2); }
.ph-tile.rejected .ph-open img { opacity: .35; filter: grayscale(1); }
.ph-tile.rejected figcaption { color: var(--muted); }
.lightbox { position: fixed; inset: 0; z-index: 70; background: rgba(0,0,0,.92); display: flex; align-items: center; justify-content: center; touch-action: pan-y; user-select: none; }
.lb-img { max-width: 94vw; max-height: 86vh; object-fit: contain; }
.lightbox.rejected .lb-img { opacity: .45; filter: grayscale(1); }
.lb-btn { position: absolute; border: 0; background: rgba(255,255,255,.12); color: #fff; width: 48px; height: 48px; border-radius: 24px; font-size: 28px; line-height: 1; cursor: pointer; }
.lb-btn:hover { background: rgba(255,255,255,.26); }
.lb-prev { left: 16px; top: 50%; transform: translateY(-50%); }
.lb-next { right: 16px; top: 50%; transform: translateY(-50%); }
.lb-bar { position: absolute; top: 12px; left: 16px; right: 16px; display: flex; align-items: center; gap: 16px; color: #fff; font-size: 14px; }
.lb-bar .lb-close { position: static; margin-left: auto; width: 40px; height: 40px; font-size: 18px; }
.lb-orig { color: #fff; opacity: .8; }
.lb-orig:hover { opacity: 1; }
