/* =====================================================================
   FacadeLive design system
   Themes: body.theme-staff (dark, default), body.theme-client (light),
           body.theme-staff.theme-mobile (foreman mobile).
   Page-specific styles go into wall.css / crew.css / jobs.css / foreman.css / links.css / client.css.
   ===================================================================== */

:root,
.theme-staff {
  --bg: #0b1215;
  --bg-elev: #0e171b;
  --sidebar: #0d1518;
  --panel: #111b20;
  --panel-2: #16232a;
  --panel-hover: #18262d;
  --border: #1f2c33;
  --border-strong: #2a3a42;
  --text: #e7eef0;
  --text-2: #c3cfd3;
  --muted: #8395a0;
  --faint: #5d6f79;

  --accent: #2dd4bf;
  --accent-hover: #5eead4;
  --accent-ink: #052e2a;          /* text on accent */
  --accent-soft: rgba(45, 212, 191, 0.12);
  --accent-text: #2dd4bf;

  --live: #ef4444;
  --live-ink: #ffffff;
  --live-soft: rgba(239, 68, 68, 0.14);
  --red: #ef4444;
  --red-text: #f87171;
  --red-soft: rgba(239, 68, 68, 0.14);
  --amber: #f59e0b;
  --amber-text: #fbbf24;
  --amber-soft: rgba(245, 158, 11, 0.14);
  --amber-border: rgba(245, 158, 11, 0.45);
  --green: #22c55e;
  --green-text: #34d399;
  --green-soft: rgba(52, 211, 153, 0.14);
  --gray-soft: rgba(148, 163, 184, 0.14);

  --track: #22323a;
  --today-marker: #e7eef0;
  --overlay: rgba(3, 8, 10, 0.72);
  --video-bg: #050a0c;

  --radius-sm: 6px;
  --radius: 10px;
  --radius-lg: 14px;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
  --font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --sidebar-w: 250px;
}

.theme-client {
  --bg: #f6f6f3;
  --bg-elev: #ffffff;
  --panel: #ffffff;
  --panel-2: #f3f4f1;
  --panel-hover: #f0f2ee;
  --border: #e4e6e1;
  --border-strong: #d4d8d2;
  --text: #13201f;
  --text-2: #33403f;
  --muted: #6b7774;
  --faint: #9aa4a1;

  --accent: #0f766e;
  --accent-hover: #115e59;
  --accent-ink: #ffffff;
  --accent-soft: #e6f4f1;
  --accent-text: #0f766e;

  --red-text: #dc2626;
  --red-soft: #fdecec;
  --amber: #e7a33a;
  --amber-text: #b26b00;
  --amber-soft: #fdf6e7;
  --amber-border: #f1d9a6;
  --green-text: #0f766e;
  --green-soft: #e6f4f1;
  --gray-soft: #eef0ec;

  --track: #e6e8e3;
  --today-marker: #13201f;
  --overlay: rgba(19, 32, 31, 0.45);
  --shadow: 0 10px 30px rgba(19, 32, 31, 0.12);
}

/* ---------- reset / base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, h4 { margin: 0; font-weight: 650; letter-spacing: -0.01em; }
h1 { font-size: 22px; }
h2 { font-size: 17px; }
h3 { font-size: 15px; }
p { margin: 0 0 10px; }
a { color: var(--accent-text); text-decoration: none; }
a:hover { text-decoration: underline; }
img, svg, video { max-width: 100%; }
video { display: block; background: var(--video-bg); }
button, input, select, textarea { font: inherit; color: inherit; }
hr { border: 0; border-top: 1px solid var(--border); margin: 16px 0; }
[x-cloak] { display: none !important; }

.muted { color: var(--muted); }
.faint { color: var(--faint); }
.mono { font-family: var(--mono); font-size: 0.95em; }
.nowrap { white-space: nowrap; }
.t-right { text-align: right; }
.t-center { text-align: center; }
.text-accent { color: var(--accent-text); }
.text-amber { color: var(--amber-text); }
.text-red { color: var(--red-text); }
.text-green { color: var(--green-text); }
.bold { font-weight: 650; }
.small { font-size: 12px; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hidden { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* section label: «РАБОТА И СРОК» */
.eyebrow {
  font-size: 12px; font-weight: 650; letter-spacing: 0.09em; text-transform: uppercase; color: var(--muted);
}

/* ---------- layout: staff app ---------- */
.app { display: flex; min-height: 100vh; }
.sidebar {
  width: var(--sidebar-w); flex: 0 0 var(--sidebar-w);
  background: var(--sidebar); border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh;
}
.sidebar-head { display: flex; align-items: center; justify-content: space-between; padding: 22px 20px 18px 24px; }
.logo { display: flex; align-items: center; gap: 12px; color: var(--text); font-weight: 650; font-size: 18px; }
.logo:hover { text-decoration: none; }
.logo-mark { width: 32px; height: 32px; border-radius: 8px; }
.sidebar-toggle { display: none; background: none; border: 0; color: var(--text); padding: 6px; cursor: pointer; }
.sidebar-nav { display: flex; flex-direction: column; gap: 2px; padding: 4px 14px 14px; flex: 1; min-height: 0; overflow-y: auto; }
.nav-item {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px; border-radius: var(--radius);
  color: var(--text-2); font-size: 15px;
}
.nav-item:hover { background: var(--panel); text-decoration: none; color: var(--text); }
.nav-item.is-active { background: var(--panel-2); color: var(--text); }
.nav-item.is-active .nav-icon { color: var(--accent); }
.nav-icon { width: 19px; height: 19px; flex: 0 0 19px; color: var(--muted); }
.nav-badge {
  margin-left: auto; min-width: 22px; height: 20px; padding: 0 7px; border-radius: 99px;
  background: var(--panel-2); color: var(--text-2); font-size: 12px; font-weight: 650;
  display: inline-flex; align-items: center; justify-content: center;
}
.nav-item.is-active .nav-badge { background: var(--border-strong); }
.nav-badge-live, .nav-item.is-active .nav-badge-live { background: var(--live); color: #fff; }
.nav-section {
  margin: 18px 12px 6px; font-size: 12px; font-weight: 650; letter-spacing: 0.1em;
  text-transform: uppercase; color: var(--faint);
}
.sidebar-org {
  margin: 0 12px 10px; font-size: 13px; font-weight: 650; color: var(--accent-text);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.row-actions { display: inline-flex; gap: 6px; justify-content: flex-end; }
/* superadmin acting inside an organization */
.org-banner {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  padding: 8px 16px; background: var(--amber-soft); border-bottom: 1px solid var(--amber-border);
  color: var(--amber-text); font-size: 14px;
}
.sidebar-user {
  margin-top: auto; padding: 16px 4px 4px; border-top: 1px solid var(--border);
  display: flex; align-items: center; gap: 8px;
}
.user-block { display: flex; align-items: center; gap: 12px; flex: 1; min-width: 0; color: var(--text); padding: 6px; border-radius: var(--radius); }
.user-block:hover { background: var(--panel); text-decoration: none; }
.user-meta { display: flex; flex-direction: column; min-width: 0; }
.user-name { font-weight: 650; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-role { font-size: 13px; color: var(--muted); line-height: 1.25; }

.avatar {
  width: 38px; height: 38px; flex: 0 0 38px; border-radius: 50%;
  background: #1d3a40; color: #bfe9e2; font-weight: 650; font-size: 13px;
  display: inline-flex; align-items: center; justify-content: center;
}
.avatar-sm { width: 28px; height: 28px; flex-basis: 28px; font-size: 11px; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.page-head {
  display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap;
  padding: 18px 28px; border-bottom: 1px solid var(--border); min-height: 68px;
}
.page-title { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; min-width: 0; }
.page-title h1 { font-size: 21px; }
.crumb { color: var(--muted); font-size: 15px; }
a.crumb:hover { color: var(--text); text-decoration: none; }
.page-sub { color: var(--muted); font-size: 14px; }
.page-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.page-body { padding: 22px 28px 40px; flex: 1; }

/* ---------- grid helpers ---------- */
.grid { display: grid; gap: 18px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid-main-side { grid-template-columns: minmax(0, 1fr) 380px; align-items: start; }
.grid-side-main { grid-template-columns: 380px minmax(0, 1fr); align-items: start; }
.stack { display: flex; flex-direction: column; gap: 18px; }
.stack-sm { display: flex; flex-direction: column; gap: 8px; }
.row { display: flex; align-items: center; gap: 10px; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.row-wrap { flex-wrap: wrap; }
.spacer { flex: 1; }
.mt-0 { margin-top: 0; } .mt-1 { margin-top: 6px; } .mt-2 { margin-top: 12px; } .mt-3 { margin-top: 18px; } .mt-4 { margin-top: 28px; }
.mb-0 { margin-bottom: 0; } .mb-1 { margin-bottom: 6px; } .mb-2 { margin-bottom: 12px; } .mb-3 { margin-bottom: 18px; }

/* ---------- cards / panels ---------- */
.card {
  background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius-lg);
  padding: 18px 20px;
}
.card-flush { padding: 0; overflow: hidden; }
.card-narrow { max-width: 480px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 14px; }
.card-title { font-size: 16px; }
.card-head .eyebrow { margin: 0; }
.card + .card { margin-top: 0; }
.panel-inset { background: var(--bg-elev); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 14px; }
.note-amber {
  background: var(--amber-soft); border: 1px solid var(--amber-border); border-radius: var(--radius);
  padding: 12px 14px; color: var(--text-2);
}
.note-amber b, .note-amber .note-title { color: var(--amber-text); font-weight: 650; }
.kv { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 18px; }
.kv-label { font-size: 12.5px; color: var(--muted); }
.kv-value { font-size: 16px; font-weight: 650; }
.big-date { font-size: 28px; font-weight: 700; letter-spacing: -0.02em; line-height: 1.15; }
.list-divided > * + * { border-top: 1px solid var(--border); }
.list-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 0; }

.empty-state { text-align: center; padding: 48px 20px; }
.empty-state h2 { margin-bottom: 6px; }
.empty-icon {
  width: 56px; height: 56px; margin: 0 auto 14px; border-radius: 50%;
  background: var(--accent-soft); color: var(--accent); display: flex; align-items: center; justify-content: center;
}

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 38px; padding: 0 16px; border-radius: var(--radius);
  border: 1px solid var(--border-strong); background: var(--panel); color: var(--text);
  font-weight: 600; font-size: 14px; line-height: 1; cursor: pointer; white-space: nowrap;
  transition: background 0.12s, border-color 0.12s, color 0.12s;
}
.btn:hover { background: var(--panel-hover); text-decoration: none; }
.btn:disabled, .btn.is-disabled { opacity: 0.5; cursor: not-allowed; }
.btn svg { flex: 0 0 auto; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn-ghost, .btn-outline { background: transparent; }
.btn-ghost { border-color: var(--border-strong); }
.btn-outline { border-color: var(--border-strong); }
.btn-ghost:hover, .btn-outline:hover { background: var(--panel-2); }
.btn-danger { background: var(--red-soft); border-color: rgba(239, 68, 68, 0.5); color: var(--red-text); }
.btn-danger:hover { background: rgba(239, 68, 68, 0.22); }
.btn-amber { background: var(--amber-soft); border-color: var(--amber-border); color: var(--amber-text); }
.btn-amber:hover { background: rgba(245, 158, 11, 0.24); }
.btn-text { background: none; border-color: transparent; color: var(--accent-text); padding: 0 6px; }
.btn-text:hover { background: none; text-decoration: underline; }
.btn-sm { height: 30px; padding: 0 11px; font-size: 13px; border-radius: 8px; }
.btn-lg { height: 48px; padding: 0 22px; font-size: 15.5px; border-radius: 12px; }
.btn-block { width: 100%; }
.btn.is-copied { color: var(--accent-text); }
.icon-btn {
  display: inline-flex; align-items: center; justify-content: center; width: 34px; height: 34px;
  border-radius: 8px; border: 0; background: transparent; color: var(--muted); cursor: pointer;
}
.icon-btn:hover { background: var(--panel-2); color: var(--text); }

/* ---------- badges ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 6px; height: 22px; padding: 0 8px; border-radius: 6px;
  font-size: 12px; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; white-space: nowrap;
  background: var(--gray-soft); color: var(--muted);
}
.badge-live { background: var(--live); color: #fff; border-radius: 7px; }
.badge-live::before {
  content: ""; width: 7px; height: 7px; border-radius: 50%; background: #fff;
  animation: fl-pulse 1.6s ease-in-out infinite;
}
.badge-amber { background: var(--amber-soft); color: var(--amber-text); }
.badge-red { background: var(--red-soft); color: var(--red-text); }
.badge-green { background: var(--green-soft); color: var(--green-text); }
.badge-accent { background: var(--accent-soft); color: var(--accent-text); }
.badge-gray { background: var(--gray-soft); color: var(--muted); }
.badge-dark { background: rgba(5, 10, 12, 0.72); color: #e7eef0; text-transform: none; letter-spacing: 0; font-weight: 600; backdrop-filter: blur(4px); }
.badge-lg { height: 26px; padding: 0 10px; font-size: 13px; }
@keyframes fl-pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.35; } }

/* status dot */
.dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: var(--faint); }
.dot-live { background: var(--live); box-shadow: 0 0 0 4px var(--live-soft); }
.dot-green { background: var(--green); }
.dot-amber { background: var(--amber); }

/* ---------- alerts ---------- */
.alert { padding: 11px 14px; border-radius: var(--radius); margin-bottom: 16px; border: 1px solid; font-size: 14px; }
.alert-error { background: var(--red-soft); border-color: rgba(239, 68, 68, 0.45); color: var(--red-text); }
.alert-success { background: var(--green-soft); border-color: rgba(52, 211, 153, 0.4); color: var(--green-text); }
.alert-info { background: var(--accent-soft); border-color: rgba(45, 212, 191, 0.35); color: var(--accent-text); }
.alert-warn { background: var(--amber-soft); border-color: var(--amber-border); color: var(--amber-text); }

/* ---------- tables ---------- */
.table-wrap { overflow-x: auto; margin: 0 -20px; padding: 0 20px; }
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th {
  text-align: left; font-size: 12px; font-weight: 650; letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--muted); padding: 10px 12px; border-bottom: 1px solid var(--border); white-space: nowrap;
}
.table td { padding: 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr:hover td { background: rgba(255, 255, 255, 0.015); }
.table tr.is-muted td { opacity: 0.55; }
.table tr.is-link { cursor: pointer; }
.cell-user { display: flex; align-items: center; gap: 10px; }

/* ---------- forms ---------- */
.form-stack { display: flex; flex-direction: column; gap: 14px; }
.form-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.form-actions { display: flex; gap: 10px; align-items: center; margin-top: 4px; flex-wrap: wrap; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field-label { font-size: 13px; color: var(--muted); font-weight: 500; }
.hint { font-size: 12.5px; color: var(--muted); margin: 0; }
.input, .select, .textarea {
  width: 100%; height: 42px; padding: 0 13px; border-radius: var(--radius);
  border: 1px solid var(--border-strong); background: var(--bg-elev); color: var(--text);
  outline: none; transition: border-color 0.12s, box-shadow 0.12s;
}
.textarea { height: auto; min-height: 90px; padding: 10px 13px; resize: vertical; line-height: 1.45; }
.input:focus, .select:focus, .textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.input::placeholder, .textarea::placeholder { color: var(--faint); }
.input[readonly] { color: var(--text-2); }
.select {
  appearance: none; -webkit-appearance: none; padding-right: 36px; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%238395a0' stroke-width='2.5' stroke-linecap='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 13px center;
}
input[type="date"].input { color-scheme: dark; }
.theme-client input[type="date"].input { color-scheme: light; }
/* input with trailing icon buttons (copy / reveal) */
.input-group { position: relative; display: flex; align-items: center; }
.input-group .input { padding-right: 84px; font-family: var(--mono); font-size: 14px; }
.input-group-actions { position: absolute; right: 6px; display: flex; gap: 2px; }

/* toggle switch: <label class="switch"><input type="checkbox" name="x"><span class="switch-track"></span><span>Сообщить клиенту</span></label> */
.switch { display: inline-flex; align-items: center; gap: 12px; cursor: pointer; user-select: none; }
.switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch-track {
  position: relative; width: 42px; height: 24px; flex: 0 0 42px; border-radius: 99px;
  background: var(--border-strong); transition: background 0.15s;
}
.switch-track::after {
  content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%;
  background: #fff; transition: transform 0.15s; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}
.switch input:checked + .switch-track { background: var(--accent); }
.switch input:checked + .switch-track::after { transform: translateX(18px); }
.switch input:focus-visible + .switch-track { box-shadow: 0 0 0 3px var(--accent-soft); }
/* row with label left, switch right */
.switch-row {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 12px 14px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--bg-elev);
  cursor: pointer;
}
.switch-row .switch-text { display: flex; flex-direction: column; }
.switch-row .switch-text small { color: var(--muted); font-size: 12.5px; }

/* radio / checkbox chips: <div class="chips"><label class="chip"><input type="radio" name="reason" value="wind"><span>Ветер</span></label>…</div> */
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { position: relative; cursor: pointer; }
.chip input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.chip span {
  display: inline-flex; align-items: center; height: 34px; padding: 0 14px; border-radius: 99px;
  border: 1px solid var(--border-strong); background: transparent; color: var(--text-2); font-size: 14px; font-weight: 500;
  transition: background 0.12s, border-color 0.12s, color 0.12s;
}
.chip:hover span { border-color: var(--muted); }
.chip input:checked + span { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 650; }
.chip input:focus-visible + span { box-shadow: 0 0 0 3px var(--accent-soft); }

/* radio cards (e.g. «Только эфир» / «Эфир и записи») */
.option-cards { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.option-card { position: relative; cursor: pointer; }
.option-card input { position: absolute; opacity: 0; }
.option-card > span {
  display: flex; flex-direction: column; gap: 2px; padding: 12px 14px; height: 100%;
  border: 1px solid var(--border-strong); border-radius: var(--radius); background: var(--bg-elev);
}
.option-card small { color: var(--muted); font-size: 12.5px; }
.option-card input:checked + span { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); background: var(--accent-soft); }

/* segmented control: <div class="segmented"><button class="seg is-active">Все</button><button class="seg">В эфире</button></div> */
.segmented {
  display: inline-flex; padding: 3px; gap: 2px; border-radius: 10px;
  background: var(--bg-elev); border: 1px solid var(--border);
}
.seg {
  height: 32px; padding: 0 13px; border: 0; border-radius: 7px; background: transparent;
  color: var(--muted); font-weight: 550; font-size: 14px; cursor: pointer; white-space: nowrap;
}
.seg:hover { color: var(--text); }
.seg.is-active, .seg[aria-pressed="true"] { background: var(--panel-2); color: var(--text); }
.segmented-sm .seg { height: 28px; padding: 0 10px; font-size: 13px; }

/* search input with icon */
.search { position: relative; }
.search .input { padding-left: 38px; }
.search svg { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }

/* ---------- modal ---------- */
.modal-overlay {
  position: fixed; inset: 0; z-index: 100; background: var(--overlay);
  display: flex; align-items: flex-start; justify-content: center; padding: 6vh 16px 24px; overflow-y: auto;
  animation: fl-fade 0.12s ease-out;
}
.modal {
  width: 100%; max-width: 560px; background: var(--panel); border: 1px solid var(--border-strong);
  border-radius: 16px; box-shadow: var(--shadow); animation: fl-pop 0.14s ease-out;
}
.modal-sm { max-width: 420px; }
.modal-lg { max-width: 820px; }
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 18px 20px 0; }
.modal-title { font-size: 18px; }
.modal-body { padding: 16px 20px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 10px; padding: 0 20px 18px; }
.modal-foot:empty { display: none; }
@keyframes fl-fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes fl-pop { from { opacity: 0; transform: translateY(8px) scale(0.98); } to { opacity: 1; transform: none; } }

/* ---------- video ---------- */
.video-frame {
  position: relative; background: var(--video-bg); border-radius: var(--radius-lg); overflow: hidden;
  aspect-ratio: 16 / 9; border: 1px solid var(--border);
}
.video-frame video { width: 100%; height: 100%; object-fit: contain; }
.video-overlay-top { position: absolute; top: 12px; left: 12px; right: 12px; display: flex; gap: 8px; align-items: center; pointer-events: none; }
.video-overlay-top .spacer { flex: 1; }
.video-offline {
  position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 6px; text-align: center; color: #c3cfd3;
  background: repeating-linear-gradient(90deg, rgba(255,255,255,0.025) 0 1px, transparent 1px 110px),
              repeating-linear-gradient(0deg, rgba(255,255,255,0.025) 0 1px, transparent 1px 64px), #0a1013;
}
.video-offline b { font-size: 16px; color: #e7eef0; }

/* ---------- progress bar (templates/partials/progress_bar.html) ---------- */
.pbar { position: relative; width: 100%; }
.pbar-top { position: relative; height: 20px; font-size: 12px; font-weight: 650; }
.pbar-today-label { position: absolute; bottom: 4px; transform: translateX(-50%); white-space: nowrap; color: var(--text); }
.pbar-was-label { position: absolute; bottom: 4px; transform: translateX(calc(-100% - 6px)); white-space: nowrap; color: var(--amber-text); font-weight: 600; }
.pbar-track { position: relative; height: 9px; border-radius: 99px; background: var(--track); }
.pbar-fill { position: absolute; z-index: 2; left: 0; top: 0; bottom: 0; border-radius: 99px; background: var(--accent); }
.pbar-ext {
  position: absolute; z-index: 1; top: 0; bottom: 0; border-radius: 0 99px 99px 0;
  background: repeating-linear-gradient(-45deg, var(--amber) 0 4px, rgba(245, 158, 11, 0.28) 4px 8px);
}
.pbar-was { position: absolute; z-index: 3; top: -5px; bottom: -5px; width: 2px; margin-left: -1px; background: var(--amber); border-radius: 1px; }
.pbar-deadline { position: absolute; z-index: 3; top: -5px; bottom: -5px; width: 2px; margin-left: -1px; background: var(--today-marker); opacity: 0.6; }
.pbar-today { position: absolute; z-index: 4; top: -6px; bottom: -6px; width: 2px; margin-left: -1px; background: var(--today-marker); border-radius: 1px; }
.pbar-bottom { display: flex; justify-content: space-between; margin-top: 8px; font-size: 12.5px; color: var(--muted); }
.pbar-bottom b { color: var(--text); font-weight: 650; }
.pbar.is-overdue .pbar-fill { background: var(--red); }
.pbar.is-done .pbar-fill { background: var(--green-text); }
.pbar-mini .pbar-track { height: 5px; }
.theme-client .pbar-suffix { display: none; }

/* ---------- misc components ---------- */
.kbd { font-family: var(--mono); font-size: 12px; padding: 1px 6px; border-radius: 5px; background: var(--panel-2); border: 1px solid var(--border); }
.steps { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 12px; counter-reset: step; }
.steps li { display: flex; gap: 14px; align-items: flex-start; counter-increment: step; }
.steps li::before {
  content: counter(step); flex: 0 0 26px; height: 26px; border-radius: 50%;
  background: var(--accent-soft); color: var(--accent-text); font-weight: 700; font-size: 13px;
  display: inline-flex; align-items: center; justify-content: center;
}
.timeline-chip {
  display: inline-flex; align-items: center; gap: 8px; height: 30px; padding: 0 10px; border-radius: 8px;
  border: 1px solid var(--border-strong); font-size: 13px; color: var(--text-2);
}
.timeline-chip b { color: var(--amber-text); font-weight: 700; }
.qr { background: #fff; padding: 10px; border-radius: var(--radius); display: inline-block; line-height: 0; }
.qr svg { width: 160px; height: 160px; }

/* ---------- login / error pages ---------- */
.center-page { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px 16px; }
.login-card { width: 100%; max-width: 380px; padding: 30px 28px; }
.login-logo { display: flex; align-items: center; gap: 12px; font-size: 22px; font-weight: 700; justify-content: center; }
.login-logo img { border-radius: 10px; }
.login-sub { text-align: center; margin: 8px 0 22px; }
.login-or { display: flex; align-items: center; gap: 12px; margin: 18px 0; color: var(--faint); font-size: 13px; }
.login-or::before, .login-or::after { content: ""; flex: 1; border-top: 1px solid var(--border); }
.error-card { text-align: center; max-width: 420px; width: 100%; padding: 36px 28px; }
.error-card h1 { margin-bottom: 18px; }
.error-code { font-size: 48px; font-weight: 800; color: var(--accent); line-height: 1; margin-bottom: 10px; }

/* =====================================================================
   Foreman mobile (body.theme-staff.theme-mobile) — p08/p09
   ===================================================================== */
.theme-mobile { background: var(--bg); }
.m-app { max-width: 560px; margin: 0 auto; min-height: 100vh; display: flex; flex-direction: column; }
.m-header {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; justify-content: space-between;
  gap: 10px; padding: 12px 16px; padding-top: max(12px, env(safe-area-inset-top));
  background: var(--bg); border-bottom: 1px solid var(--border);
}
.m-brand { display: flex; align-items: center; gap: 10px; color: var(--text); font-weight: 650; font-size: 16px; }
.m-brand:hover { text-decoration: none; }
.m-logo {
  width: 28px; height: 28px; border-radius: 7px; background: var(--accent); color: var(--accent-ink);
  font-size: 11px; font-weight: 800; display: inline-flex; align-items: center; justify-content: center;
}
.m-header-right { display: flex; align-items: center; gap: 4px; }
.m-user { color: var(--muted); font-size: 13.5px; }
.m-main { flex: 1; padding: 16px 16px calc(90px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: 12px; }
.m-section-title { font-size: 12.5px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); margin-top: 4px; }
.theme-mobile .card { padding: 14px 16px; border-radius: 12px; }
.theme-mobile .btn-lg { width: 100%; height: 50px; font-size: 16px; }
.m-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.m-action {
  display: flex; flex-direction: column; align-items: flex-start; gap: 8px; padding: 14px; min-height: 84px;
  border-radius: 12px; border: 1px solid var(--border); background: var(--panel); color: var(--text);
  font-weight: 650; font-size: 15px; cursor: pointer; text-align: left;
}
.m-action:hover { text-decoration: none; background: var(--panel-hover); }
.m-action svg { color: var(--accent); }
.m-tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  display: flex; justify-content: center; background: #ffffff; border-top: 1px solid #e4e6e1;
  padding-bottom: env(safe-area-inset-bottom);
}
.m-tabbar > * { flex: 1; max-width: 186px; }
.m-tab {
  display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 10px 4px 9px;
  color: #8a9592; font-size: 12.5px; font-weight: 550;
}
.m-tab:hover { text-decoration: none; color: #13201f; }
.m-tab.is-active { color: #0f766e; font-weight: 700; }

/* =====================================================================
   Client (body.theme-client) — p06/p07
   ===================================================================== */
.c-header { background: var(--panel); border-bottom: 1px solid var(--border); }
.c-header-inner {
  max-width: 1320px; margin: 0 auto; padding: 14px 24px; display: flex; align-items: center;
  justify-content: space-between; gap: 16px;
}
.c-brand { display: flex; align-items: center; gap: 12px; min-width: 0; }
.c-logo {
  width: 36px; height: 36px; flex: 0 0 36px; border-radius: 9px; background: var(--accent); color: #fff;
  font-weight: 800; font-size: 14px; display: inline-flex; align-items: center; justify-content: center;
}
.c-company { font-weight: 700; font-size: 18px; white-space: nowrap; }
.c-divider { width: 1px; height: 20px; background: var(--border-strong); margin: 0 6px; }
.c-tagline { color: var(--muted); font-size: 15px; white-space: nowrap; }
.c-header-right { display: flex; align-items: center; gap: 18px; }
.c-access { color: var(--muted); font-size: 14px; }
.theme-client .btn-outline { background: var(--panel); }
.c-main { max-width: 1320px; margin: 0 auto; padding: 24px 24px 48px; }
.c-tabbar { display: none; }
.c-tab {
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 10px 4px 9px;
  color: var(--faint); font-size: 12.5px; font-weight: 550; background: none; border: 0; cursor: pointer;
}
.c-tab:hover { text-decoration: none; }
.c-tab.is-active { color: var(--accent); font-weight: 700; }
.theme-client .card { border-radius: 14px; }
.theme-client .table tbody tr:hover td { background: var(--panel-2); }
.theme-client .avatar { background: var(--accent-soft); color: var(--accent); }

/* =====================================================================
   Responsive
   ===================================================================== */
@media (max-width: 1200px) {
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-main-side, .grid-side-main { grid-template-columns: minmax(0, 1fr) 340px; }
}

@media (max-width: 900px) {
  .app { flex-direction: column; }
  .sidebar { position: sticky; top: 0; z-index: 50; width: 100%; flex: 0 0 auto; height: auto; border-right: 0; border-bottom: 1px solid var(--border); }
  .sidebar-head { padding: 12px 16px; }
  .sidebar-toggle { display: inline-flex; }
  .sidebar-nav { display: none; padding: 0 12px 12px; max-height: calc(100vh - 60px); }
  .sidebar-nav.is-open { display: flex; }
  .sidebar-user { margin-top: 10px; }
  .page-head { padding: 14px 16px; min-height: 0; }
  .page-body { padding: 16px 16px 32px; }
  .grid-2, .grid-3, .grid-main-side, .grid-side-main { grid-template-columns: minmax(0, 1fr); }
  .form-row { grid-template-columns: minmax(0, 1fr); }
  .table-wrap { margin: 0 -16px; padding: 0 16px; }

  .c-header-inner { padding: 10px 16px; }
  .c-divider, .c-tagline, .c-access { display: none; }
  .c-company { font-size: 16px; }
  .c-main { padding: 16px 16px calc(84px + env(safe-area-inset-bottom)); }
  .c-tabbar {
    display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
    background: var(--panel); border-top: 1px solid var(--border); padding-bottom: env(safe-area-inset-bottom);
  }
}

@media (max-width: 560px) {
  .grid-4 { grid-template-columns: minmax(0, 1fr); }
  .option-cards { grid-template-columns: minmax(0, 1fr); }
  .kv { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .big-date { font-size: 24px; }
  .modal-overlay { padding: 0; align-items: flex-end; }
  .modal { border-radius: 16px 16px 0 0; max-height: 92vh; overflow-y: auto; }
  .c-header-right .btn-outline span { display: none; }
}
.cell-user a { color: var(--text); }

/* Superadmin-only navigation: red outline so it never passes for an org page (title gives the tip). */
.nav-item-super { box-shadow: inset 0 0 0 1px rgba(239, 68, 68, 0.55); }
.nav-item-super:hover, .nav-item-super.is-active { box-shadow: inset 0 0 0 1px rgba(239, 68, 68, 0.9); }
.nav-item-super + .nav-item-super { margin-top: 4px; }

/* «Удалить бригаду» on the crew edit page */
.crew-delete { margin-top: 16px; border-color: rgba(239, 68, 68, 0.35); }
.crew-delete .card-title { margin-bottom: 6px; }
.check { display: flex; gap: 8px; align-items: center; cursor: pointer; }
.check input { width: 16px; height: 16px; accent-color: var(--red-text); }

/* Product credit (partials/credit.html): Aleyron's red on the name, quiet everywhere else. */
.fl-credit { margin-top: auto; padding: 24px 16px 12px; text-align: center; font-size: 12.5px; color: var(--faint); }
.fl-credit a { color: #e82c2c; font-weight: 600; text-decoration: none; }
.fl-credit a:hover { text-decoration: underline; }
.center-page { position: relative; }
.center-page > .fl-credit { position: absolute; left: 0; right: 0; bottom: 0; }
