/* Kievznak CRM 2.0 — design tokens and components (see docs/app/design). */

:root {
  --ink: #1C232B;
  --ink-2: #4A5561;
  --muted: #5B6673;
  --faint: #9AA5B1;
  --line: #DCE2E8;
  --line-soft: #EDF0F3;
  --field: #CBD3DB;
  --paper: #FFFFFF;
  --ground: #E9EDF1;
  --sunk: #F4F6F8;
  --rail: #1C232B;
  --rail-on: #33404D;
  --rail-text: #AEB8C2;

  --blue: #0057B8;
  --blue-dark: #00408A;
  --blue-soft: #EAF2FC;
  --blue-ink: #003F87;
  --signal: #FFC400;
  --signal-soft: #FFF1BF;
  --signal-ink: #5E4A00;
  --ok: #2F7D4E;
  --ok-soft: #DDEFE3;
  --ok-ink: #1F5E36;
  --alert: #C62828;
  --alert-soft: #FBE1E1;
  --alert-ink: #9B1C1C;
  --warn: #E0A100;
  --warn-ink: #8A5A00;

  --radius: 12px;
  --radius-s: 8px;
  --shadow-pop: 0 18px 48px rgba(28, 35, 43, .28), 0 0 0 1px rgba(28, 35, 43, .06);
  --font: 'Onest', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-plate: 'Barlow Semi Condensed', 'Arial Narrow', 'Roboto Condensed', sans-serif;
  --rail-w: 76px;
  --tabbar-h: 64px;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; font-family: var(--font); font-size: 14px; line-height: 1.4; color: var(--ink);
  background: var(--ground); -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
}
a { color: var(--blue); text-decoration: none; }
a:hover { color: var(--blue-dark); }
button, input, select, textarea { font: inherit; color: inherit; }
svg { flex: none; }
h1, h2, h3 { margin: 0; font-weight: 600; letter-spacing: -.01em; }
.num { font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.nowrap { white-space: nowrap; }
.ell { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
[x-cloak], [hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }

/* ---------- shell ---------- */
.shell { display: flex; min-height: 100vh; min-height: 100dvh; }
.rail {
  position: sticky; top: 0; height: 100vh; height: 100dvh; width: var(--rail-w); flex: none;
  background: var(--rail); display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 14px 0 12px;
}
.rail .logo {
  display: flex; align-items: center; justify-content: center; width: 48px; height: 36px; margin-bottom: 10px;
  border: 2px solid #fff; border-radius: 6px; color: #fff; font-family: var(--font-plate); font-weight: 600; font-size: 19px; letter-spacing: .04em;
}
.rail a, .rail button.rail-item {
  width: 64px; display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 9px 0 7px; border-radius: 10px;
  color: var(--rail-text); font-size: 11px; line-height: 1.1; text-align: center; background: none; border: 0; cursor: pointer;
}
.rail a:hover, .rail button.rail-item:hover { color: #fff; background: rgba(255, 255, 255, .06); }
.rail a.on { background: var(--rail-on); color: #fff; }
.rail a .ext { font-size: 9px; opacity: .6; }
.rail .spacer { flex: 1; }

.rail .avatar { margin: 6px 0 2px; }
.avatar {
  width: 36px; height: 36px; border-radius: 18px; background: #DCE8F7; color: var(--blue-ink);
  display: inline-flex; align-items: center; justify-content: center; font-weight: 600; font-size: 13px;
}
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.page { padding: 16px 24px 24px; display: flex; flex-direction: column; gap: 12px; flex: 1; min-height: 0; }
.page-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.page-head h1 { font-size: 24px; margin-right: 6px; }
.page-head .grow { flex: 1; }

.tabbar { display: none; }

@media (max-width: 760px) {
  body { font-size: 15px; }
  .rail { display: none; }
  .page { padding: 12px 12px calc(var(--tabbar-h) + 24px + env(safe-area-inset-bottom)); }
  .page-head h1 { font-size: 22px; }
  .tabbar {
    display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; background: #fff; border-top: 1px solid var(--line);
    padding-bottom: env(safe-area-inset-bottom); justify-content: space-around;
  }
  .tabbar a, .tabbar button {
    flex: 1; height: var(--tabbar-h); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
    font-size: 11px; color: var(--muted); background: none; border: 0;
  }
  .tabbar a.on { color: var(--blue); font-weight: 500; }
  .hide-phone { display: none !important; }
}
@media (min-width: 761px) { .show-phone { display: none !important; } }

/* ---------- buttons & controls ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 38px; padding: 0 16px;
  border-radius: 9px; border: 1px solid var(--field); background: #fff; color: var(--ink); font-weight: 500; font-size: 14px;
  white-space: nowrap; cursor: pointer; text-decoration: none; transition: background-color .12s, border-color .12s;
}
.btn:hover { background: var(--sunk); color: var(--ink); }
.btn:disabled, .btn[aria-disabled="true"] { opacity: .55; cursor: default; }
.btn-primary { background: var(--blue); border-color: var(--blue); color: #fff; font-weight: 600; }
.btn-primary:hover { background: var(--blue-dark); border-color: var(--blue-dark); color: #fff; }
.btn-ok { background: var(--ok); border-color: var(--ok); color: #fff; font-weight: 600; }
.btn-ok:hover { background: #276943; color: #fff; }
.btn-lg { height: 52px; padding: 0 22px; font-size: 16px; border-radius: 11px; }
.btn-block { width: 100%; }
/* Кнопка Google: белая с фирменным значком — такой её ждут увидеть, и в кабинете она такая же. */
.btn-google { gap: 10px; background: #fff; color: var(--ink); }
.btn-google:hover { background: #fff; }
.btn-link { background: none; border: 0; color: var(--blue); padding: 0; height: auto; font-weight: 500; cursor: pointer; }
.icon-btn {
  display: inline-flex; align-items: center; justify-content: center; width: 38px; height: 38px; border-radius: 8px;
  border: 1px solid var(--field); background: #fff; color: var(--ink); cursor: pointer;
}
.icon-btn:hover { background: var(--sunk); }
.icon-btn:disabled { color: var(--faint); cursor: default; }
.kbd { font-size: 11px; line-height: 16px; padding: 0 5px; border-radius: 4px; border: 1px solid currentColor; opacity: .65; font-weight: 500; }
@media (hover: none) { .kbd { display: none; } }

.seg { display: inline-flex; height: 38px; border: 1px solid var(--field); border-radius: 8px; overflow: hidden; background: #fff; }
.seg > * { display: flex; align-items: center; padding: 0 12px; font-size: 13px; border: 0; border-right: 1px solid #E3E8ED; background: none; color: var(--ink); cursor: pointer; }
.seg > *:last-child { border-right: 0; }
.seg > template { display: none; }
.seg > .on { background: var(--ink); color: #fff; }

.tabs { display: flex; align-items: stretch; gap: 2px; height: 34px; overflow-x: auto; scrollbar-width: none; }
.tabs > * {
  display: flex; align-items: center; gap: 6px; padding: 0 11px; border-radius: 8px; font-size: 13px; white-space: nowrap;
  color: var(--ink-2); background: none; border: 0; cursor: pointer;
}
.tabs > * b { font-weight: 600; color: var(--ink); font-variant-numeric: tabular-nums; }
.tabs > .on { background: #fff; color: var(--ink); box-shadow: inset 0 0 0 1px var(--field); }

.chip {
  display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 12px; border-radius: 16px; background: #fff;
  border: 1px solid var(--field); font-size: 13px; color: var(--ink); white-space: nowrap; cursor: pointer;
}
.chip .n { color: var(--muted); font-variant-numeric: tabular-nums; }
.chip.on { background: var(--ink); color: #fff; border-color: var(--ink); }
.chip.on .n { color: var(--rail-text); }

.select {
  height: 34px; padding: 0 30px 0 11px; border-radius: 8px; border: 1px solid var(--field); background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%231C232B' stroke-width='2'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") no-repeat right 9px center;
  appearance: none; font-size: 13px; max-width: 220px;
}
.field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.field > span, .label { font-size: 12px; color: var(--muted); }
.input {
  height: 42px; border: 1px solid var(--field); border-radius: 8px; background: #fff; padding: 0 12px; width: 100%;
}
.input:focus { outline: none; border-color: var(--blue); box-shadow: 0 0 0 3px rgba(0, 87, 184, .15); }
textarea.input { height: auto; min-height: 74px; padding-top: 10px; resize: vertical; }

/* ---------- surfaces ---------- */
.panel { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); }
.panel-head { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-bottom: 1px solid #E3E8ED; }
.panel-head h2 { font-size: 15px; flex: 1; }
.empty { padding: 48px 16px; text-align: center; color: var(--muted); }
.empty b { display: block; color: var(--ink); font-size: 15px; margin-bottom: 4px; }

/* ---------- plate ---------- */
.plate {
  display: inline-flex; align-items: stretch; background: #fff; border: 1.5px solid var(--ink); border-radius: 3px; overflow: hidden;
  font-family: var(--font-plate); font-weight: 600; color: #111; white-space: nowrap; height: 24px; vertical-align: middle;
}
.plate .ua {
  background: var(--blue); color: #fff; display: flex; flex-direction: column; align-items: center; justify-content: space-between;
  font-family: var(--font); font-weight: 600; width: 12px; padding: 2px 0 1px; font-size: 5px; line-height: 1;
}
.plate .flag { display: flex; flex-direction: column; }
.plate .flag i { display: block; width: 8px; height: 3px; }
.plate .flag i:first-child { background: #3D8BFD; }
.plate .flag i:last-child { background: #FFD500; }
.plate .t { display: flex; align-items: center; letter-spacing: .04em; font-size: 17px; padding: 0 6px; }
.plate.dark { background: #15191E; border-color: #15191E; color: #fff; }
.plate.green .t { color: #1F8A4C; }
.plate.white-text { background: #15191E; color: #fff; }
.plate-m { height: 34px; border-width: 2px; border-radius: 5px; }
.plate-m .ua { width: 17px; padding: 3px 0 2px; font-size: 7px; }
.plate-m .flag i { width: 10px; height: 4px; }
.plate-m .t { font-size: 24px; padding: 0 9px; }
.plate-l { height: 118px; border-width: 4px; border-radius: 12px; }
.plate-l .ua { width: 56px; padding: 13px 0 9px; font-size: 21px; }
.plate-l .flag i { width: 32px; height: 11px; }
.plate-l .t { font-size: 90px; padding: 0 30px; }
@media (max-width: 760px) {
  .plate-l { height: 70px; border-width: 3px; border-radius: 8px; }
  .plate-l .ua { width: 32px; padding: 8px 0 6px; font-size: 12px; }
  .plate-l .flag i { width: 18px; height: 6px; }
  .plate-l .t { font-size: 52px; padding: 0 14px; }
}

/* the real blank of the plate type (goods.bg_path) with the text on it */
.plate-real {
  position: relative; display: inline-flex; height: 24px; border-radius: 3px; overflow: hidden; vertical-align: middle;
  background: #fff; box-shadow: inset 0 0 0 1px rgba(28, 35, 43, .18); font-size: 24px;
}
.plate-real > img { height: 100%; width: auto; display: block; max-width: none; }
.plate-real .pt {
  position: absolute; inset: 0 4% 0 4%; display: flex; flex-direction: column; align-items: center; justify-content: center;
  font-family: var(--font-plate); font-weight: 600; line-height: .95; white-space: nowrap; letter-spacing: .02em; color: var(--ink-plate, #111);
}
.plate-real .pt span { font-size: min(.62em, calc(var(--ar, 4.5) * 1.55em / var(--chars))); color: var(--ink); }
.plate-real.band .pt { left: 12%; }
.plate-real.two .pt span { font-size: min(.4em, calc(var(--ar, 1.3) * 1.5em / var(--chars))); }
.plate-real.two.band .pt span:first-child { padding-left: 16%; }
.plate-real-m { height: 34px; font-size: 34px; border-radius: 4px; }
.plate-real-l { height: 118px; font-size: 118px; border-radius: 10px; }
.plate-real.no-bg { box-shadow: inset 0 0 0 1.5px var(--ink); min-width: 4.2em; }
.plate-real.no-bg > img { display: none; }
.plate-real.no-bg .pt { position: static; inset: auto; padding: 0 .2em; }
@media (max-width: 760px) { .plate-real-l { height: 70px; font-size: 70px; border-radius: 7px; } }

/* ---------- status & tags ---------- */
.st { display: inline-flex; align-items: center; height: 22px; padding: 0 8px; border-radius: 5px; font-size: 12px; font-weight: 500; white-space: nowrap; }
.st-wait { background: #EEF0F2; color: var(--ink-2); }
.st-print { background: #DCE8F7; color: var(--blue-ink); }
.st-done { background: var(--ok-soft); color: var(--ok-ink); }
.st-rework, .st-error { background: var(--alert-soft); color: var(--alert-ink); }
.st-cancel { background: #F3F4F6; color: #8A949E; text-decoration: line-through; }
.st-mockup { background: #EFE7FB; color: #4B2A86; }
.tag { display: inline-flex; align-items: center; gap: 4px; height: 22px; padding: 0 7px; border-radius: 4px; font-size: 12px; font-weight: 500; white-space: nowrap; }
.tag-urgent { background: var(--signal); color: var(--ink); }
.tag-soon { background: var(--signal-soft); color: var(--signal-ink); }
.tag-late { background: var(--alert-soft); color: var(--alert-ink); }
.tag-info { background: var(--blue-soft); color: var(--blue-ink); }
.dot { width: 7px; height: 7px; border-radius: 4px; display: inline-block; }

/* ---------- data table ---------- */
.table-wrap { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); overflow: auto; position: relative; }
.dt { border-collapse: collapse; width: 100%; table-layout: fixed; }
.dt th {
  position: sticky; top: 0; z-index: 1; font-size: 12px; font-weight: 500; color: var(--muted); text-align: left; padding: 8px 12px;
  border-bottom: 1px solid var(--line); background: var(--sunk); white-space: nowrap;
}
.dt td { height: 40px; padding: 0 12px; border-bottom: 1px solid var(--line-soft); vertical-align: middle; white-space: nowrap; font-size: 13.5px; }
.dt tr:hover td { background: #F7F9FB; }
.dt td.r, .dt th.r { text-align: right; }
.dt tr.sel td { background: var(--blue-soft); }
.dt tr[data-href] { cursor: pointer; }

/* ---------- overlays ---------- */
.scrim { position: fixed; inset: 0; background: rgba(28, 35, 43, .28); z-index: 50; }
.pop { position: fixed; z-index: 51; background: #fff; border-radius: 14px; box-shadow: var(--shadow-pop); }
dialog.sheet {
  border: 0; padding: 0; border-radius: 14px; box-shadow: var(--shadow-pop); max-width: min(560px, calc(100vw - 24px)); width: 100%;
}
dialog.sheet::backdrop { background: rgba(28, 35, 43, .28); }
@media (max-width: 760px) {
  dialog.sheet { margin: auto 0 0; max-width: 100vw; border-radius: 16px 16px 0 0; padding-bottom: env(safe-area-inset-bottom); }
}

.toasts { position: fixed; z-index: 60; left: 50%; bottom: 24px; transform: translateX(-50%); display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
.toast {
  pointer-events: auto; background: var(--ink); color: #fff; padding: 10px 16px; border-radius: 10px; font-size: 14px;
  box-shadow: 0 8px 24px rgba(28, 35, 43, .28); display: flex; gap: 10px; align-items: center; max-width: calc(100vw - 32px);
}
.toast.error { background: var(--alert); }
/* One-click order changes (views/orders/_quick.php) */
.toast.warn { background: var(--signal); color: var(--ink); }
.qk { position: relative; display: inline-flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.qk-chip { border: 0; cursor: pointer; gap: 4px; font: inherit; font-size: 12px; font-weight: 500; }
.qk-chip:hover, .qk-chip[aria-expanded="true"] { box-shadow: 0 0 0 2px rgba(0, 87, 184, .35); }
.qk-caret { width: 0; height: 0; border-left: 4px solid transparent; border-right: 4px solid transparent; border-top: 4px solid currentColor; opacity: .6; }
.qk-tag { cursor: pointer; }
.qk-pop { position: absolute; z-index: 60; top: calc(100% + 6px); right: 0; width: 330px; background: #fff; border: 1px solid var(--line); border-radius: 12px;
  box-shadow: 0 12px 32px rgba(15, 30, 50, .18); padding: 10px; display: flex; flex-direction: column; gap: 10px; text-align: left; white-space: normal; cursor: default; }
.qk-group > b { display: block; font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); margin-bottom: 6px; }
.qk-opts { display: flex; flex-wrap: wrap; gap: 6px; }
.qk-opts .st { height: 30px; padding: 0 10px; font-size: 13px; border: 2px solid transparent; cursor: pointer; font-family: inherit; }
.qk-opts .st.on { border-color: var(--ink); font-weight: 700; }
.qk-u { height: 30px; padding: 0 10px; border: 1px solid var(--line); border-radius: 8px; background: #fff; font: inherit; font-size: 13px; cursor: pointer; color: var(--ink); }
.qk-u:hover { border-color: var(--blue); }
.qk-u.on { background: var(--signal); border-color: var(--signal); font-weight: 600; }
.qk-date { display: flex; align-items: center; gap: 8px; margin-top: 8px; font-size: 13px; color: var(--muted); }
.qk-date .input { height: 34px; flex: 1; }
.qk-sum { border: 0; background: none; padding: 2px 6px; margin: -2px -6px; border-radius: 6px; font: inherit; color: inherit; cursor: text; border-bottom: 1px dashed var(--line); }
.qk-sum:hover { background: var(--blue-soft); color: var(--blue-ink); }
.qk-pin { height: 32px; width: 110px; text-align: right; font-weight: 600; }
@media (max-width: 760px) {
  .qk-pop { position: fixed; left: 8px; right: 8px; top: auto; bottom: calc(var(--tabbar-h, 64px) + 8px + env(safe-area-inset-bottom)); width: auto; }
  .qk-opts .st, .qk-u { height: 40px; font-size: 14px; }
}

.toast.ok::before { content: ""; width: 8px; height: 8px; border-radius: 4px; background: #6BD49A; }
@media (max-width: 760px) { .toasts { bottom: calc(var(--tabbar-h) + 16px + env(safe-area-inset-bottom)); } }

/* global search */
.search-pop { left: 50%; top: 12px; transform: translateX(-50%); width: min(760px, calc(100vw - 24px)); overflow: hidden; }
.search-pop .search-in { display: flex; align-items: center; gap: 12px; height: 60px; padding: 0 18px; border-bottom: 1px solid var(--line-soft); }
.search-pop input { flex: 1; border: 0; outline: 0; font-size: 18px; min-width: 0; background: none; }
.search-results { max-height: min(60vh, 520px); overflow: auto; }
.search-results .sh { font-size: 12px; color: var(--muted); padding: 10px 18px 4px; }
.search-results .sr { display: flex; align-items: center; gap: 12px; min-height: 46px; padding: 6px 18px; color: var(--ink); }
.search-results .sr:hover, .search-results .sr.on { background: var(--blue-soft); }
.search-results mark { background: var(--signal-soft); color: inherit; border-radius: 2px; }
.search-foot { display: flex; gap: 18px; padding: 10px 18px; border-top: 1px solid var(--line-soft); background: #FAFBFC; font-size: 12px; color: var(--muted); }

/* htmx progress */
.htmx-indicator { opacity: 0; transition: opacity .2s; }
.htmx-request .htmx-indicator, .htmx-request.htmx-indicator { opacity: 1; }
.topbar-progress { position: fixed; top: 0; left: 0; height: 3px; background: var(--blue); z-index: 70; width: 0; transition: width .3s; }
body.htmx-request .topbar-progress { width: 70%; transition: width 4s cubic-bezier(.1, .7, .2, 1); }

/* ---------- login ---------- */
.login { min-height: 100vh; min-height: 100dvh; display: grid; place-items: center; padding: 24px; }
.login-card { width: min(380px, 100%); display: flex; flex-direction: column; gap: 18px; }
.login-card .brand { display: flex; align-items: center; gap: 12px; }
.login-card .brand .logo {
  display: flex; align-items: center; justify-content: center; width: 56px; height: 40px; border: 2.5px solid var(--ink); border-radius: 7px;
  font-family: var(--font-plate); font-weight: 600; font-size: 22px; letter-spacing: .04em; background: #fff;
}
.form-error { background: var(--alert-soft); color: var(--alert-ink); padding: 10px 12px; border-radius: 8px; font-size: 14px; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}

/* ---------- searchable select (app.js enhanceSelect) ---------- */
.kzs { position: relative; display: inline-flex; min-width: 0; vertical-align: middle; }
.field .kzs, .kzs:has(> .input) { display: flex; width: 100%; }
.kzs-native { position: absolute !important; opacity: 0; pointer-events: none; width: 1px !important; height: 1px !important; }
.kzs-btn { text-align: left; cursor: pointer; display: inline-flex; align-items: center; min-width: 0; width: 100%; }
.kzs-btn.select { max-width: 220px; }
.kzs-btn.select.wide { max-width: 320px; }
.kzs-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.kzs-btn.kzs-set.select { border-color: var(--ink); font-weight: 500; }
.kzs-pop {
  display: none; position: absolute; z-index: 45; top: calc(100% + 4px); left: 0; min-width: max(100%, 260px); max-width: min(420px, 92vw);
  background: #fff; border-radius: 10px; box-shadow: var(--shadow-pop); padding: 6px;
}
.kzs-pop.open { display: block; }   /* открытый список живёт в body, а не внутри .kzs */
.kzs-pop .input { height: 36px; margin-bottom: 4px; }
.kzs-list { max-height: 300px; overflow: auto; }
.kzs-opt {
  display: block; width: 100%; padding: 7px 10px; border: 0; background: none; border-radius: 6px; text-align: left; cursor: pointer;
  font-size: 13.5px; color: var(--ink); white-space: normal;
}
.kzs-opt.hi { background: var(--blue-soft); }
.kzs-opt:hover { background: var(--sunk); }
.kzs-opt.on { font-weight: 600; }
.kzs-none { padding: 10px; color: var(--muted); font-size: 13px; }
.kzs-opt.with-ico { display: flex; align-items: center; gap: 10px; }
.kzs-ico { flex: none; width: 44px; height: 24px; object-fit: contain; }
.kzs-btn .kzs-ico { width: 34px; height: 18px; margin-right: 8px; }
@media (max-width: 760px) {
  .kzs.open .kzs-pop { position: fixed; left: 8px; right: 8px; top: 64px; max-width: none; }
  .kzs-list { max-height: 60vh; }
}

/* Order files: mockups and photos (views/orders/_files.php) */
.ofiles { display: flex; flex-direction: column; gap: 8px; border-radius: 10px; transition: background .15s, box-shadow .15s; }
.ofiles.over { background: var(--blue-soft); box-shadow: 0 0 0 2px var(--blue); }
.ofiles-list { display: flex; flex-wrap: wrap; gap: 8px; }
.ofile { position: relative; }
.ofile-thumb { display: flex; align-items: center; justify-content: center; width: 112px; height: 76px; padding: 3px; border: 1px solid var(--line); border-radius: 8px; background: #fff; cursor: zoom-in; overflow: hidden; color: var(--ink-2); }
.ofile-thumb img { max-width: 100%; max-height: 100%; object-fit: contain; }
.ofile-doc { flex-direction: column; gap: 2px; font-size: 11px; font-weight: 600; cursor: pointer; }
.ofile-del { position: absolute; top: -6px; right: -6px; width: 20px; height: 20px; display: flex; align-items: center; justify-content: center; padding: 0; border: 0; border-radius: 10px;
  background: var(--ink); color: #fff; cursor: pointer; opacity: 0; transition: opacity .1s; }
.ofile:hover .ofile-del, .ofile-del:focus-visible { opacity: 1; }
@media (hover: none) { .ofile-del { opacity: .85; } }
.ofile-busy { width: 112px; height: 76px; display: flex; align-items: center; justify-content: center; gap: 6px; border: 1px dashed var(--line); border-radius: 8px; color: var(--muted); font-size: 12px; }
.spinner { width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--line); border-top-color: var(--blue); animation: kzspin .8s linear infinite; }
@keyframes kzspin { to { transform: rotate(360deg); } }
/* Поиск и «База знаний» переживают переход между страницами: их появление — CSS-анимация,
   а не x-transition, который залипал, если страницу переключили посреди анимации. */
.search-pop, .wiki-pop { animation: kzfade .12s ease-out; }
@keyframes kzfade { from { opacity: 0; } to { opacity: 1; } }
.ofiles-drop { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 10px 12px; border: 1px dashed var(--field); border-radius: 10px; color: var(--ink-2); cursor: pointer; font-size: 13px; }
.ofiles-drop:hover { border-color: var(--blue); color: var(--blue-ink); background: var(--blue-soft); }
.ofiles-drop > svg { color: var(--blue); flex: none; }
.ofiles-drop .small { margin-left: auto; }

/* Profile (/me) */
.me-page .page-head { align-items: center; gap: 14px; }
.avatar.avatar-lg { width: 52px; height: 52px; font-size: 20px; }
.me-tg { max-width: 760px; }
.me-tg-body { padding: 0 16px 16px; display: flex; flex-direction: column; gap: 12px; }
.me-tg-body > p { margin: 0; }
.me-tg-ok, .me-tg-none { display: flex; align-items: center; gap: 8px; padding: 10px 12px; border-radius: 10px; }
.me-tg-ok { background: var(--ok-soft); color: var(--ok-ink); }
.me-tg-ok b { margin-left: 4px; }
.me-tg-ok b + b::before { content: ", "; font-weight: 400; }
.me-tg-none { background: var(--sunk); color: var(--ink-2); }
.me-tg-link { display: flex; flex-direction: column; gap: 8px; padding: 12px; border-radius: 10px; background: var(--blue-soft); }
.me-tg-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.me-tg-wait { display: flex; align-items: center; gap: 8px; margin-top: 4px; font-weight: 500; }
.btn-link.red { color: var(--alert); }

/* A new version of the installed app is waiting (app.js: the update bar). */
.app-update {
  position: fixed; z-index: 70; left: 50%; transform: translateX(-50%); bottom: calc(76px + env(safe-area-inset-bottom));
  display: flex; align-items: center; gap: 12px; max-width: calc(100vw - 24px); padding: 10px 12px 10px 16px;
  background: #fff; border-radius: 12px; box-shadow: var(--shadow-pop); font-size: 14px;
}
@media (min-width: 761px) { .app-update { bottom: 24px; } }

/* Карточка сотрудника: «Ещё отделы» — сотрудник может вести и номера, и рекламу */
.check-row { display: flex; flex-wrap: wrap; gap: 14px; align-items: center; min-height: 40px; }


/* Установленное приложение на телефоне (значок на домашнем экране).
   Там страница прокручивается целиком, и во время рывка прокрутки iOS рисует нижнее меню поверх списка.
   Делаем как в обычном приложении: экран во всю высоту, прокручивается только содержимое, меню — обычный
   элемент под ним и в прокрутке не участвует. В браузере (Chrome, Safari) всё остаётся как было. */
@media (max-width: 760px) {
  html.standalone, html.standalone body { height: 100%; overflow: hidden; overscroll-behavior: none; }
  html.standalone body { display: flex; flex-direction: column; }
  html.standalone .shell { flex: 1; min-height: 0; }
  html.standalone .main { overflow-y: auto; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; }
  html.standalone .tabbar { position: static; flex: none; }
  html.standalone .page { padding-bottom: 24px; }
}
