/* Портал арендатора МЗП — дизайн-система (общая для приложения арендатора и панели МЗП). */
:root {
  --bg: #f3f5f9; --surface: #ffffff; --surface-2: #f7f8fb; --line: #e4e8f0; --line-2: #d6dce8;
  --text: #0f172a; --text-2: #475569; --muted: #8a94a8;
  --brand: #1d4ed8; --brand-2: #2563eb; --brand-soft: #e8efff; --brand-ink: #ffffff;
  --ok: #059669; --ok-soft: #e3f6ee; --warn: #d97706; --warn-soft: #fdf3e2; --bad: #dc2626; --bad-soft: #fde8e8;
  --violet: #7c3aed; --violet-soft: #f0e9ff;
  --radius: 16px; --radius-sm: 12px; --shadow: 0 1px 2px rgba(15, 23, 42, .04), 0 4px 16px rgba(15, 23, 42, .06);
  --shadow-lg: 0 10px 40px rgba(15, 23, 42, .16);
  --safe-b: env(safe-area-inset-bottom, 0px); --safe-t: env(safe-area-inset-top, 0px);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0b1020; --surface: #131a2c; --surface-2: #182136; --line: #222c45; --line-2: #2c3857;
    --text: #e8edf7; --text-2: #aab4c8; --muted: #7783a0;
    --brand: #3b82f6; --brand-2: #60a5fa; --brand-soft: #172a4f;
    --ok: #34d399; --ok-soft: #0f2e25; --warn: #fbbf24; --warn-soft: #33270e; --bad: #f87171; --bad-soft: #3a1518;
    --violet: #a78bfa; --violet-soft: #251b45;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 4px 16px rgba(0, 0, 0, .25); --shadow-lg: 0 10px 40px rgba(0, 0, 0, .5);
    color-scheme: dark;
  }
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--bg); color: var(--text); }
body { font: 15px/1.45 -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased; min-height: 100vh; }
a { color: var(--brand-2); text-decoration: none; }
h1 { font-size: 28px; line-height: 1.15; margin: 0; letter-spacing: -.02em; font-weight: 750; }
h2 { font-size: 20px; margin: 0; letter-spacing: -.01em; font-weight: 700; }
h3 { font-size: 15px; margin: 0; font-weight: 650; }
.muted { color: var(--muted); } .t2 { color: var(--text-2); } .small { font-size: 13px; } .tiny { font-size: 12px; }
.hidden { display: none !important; }
.row { display: flex; align-items: center; gap: 10px; } .col { display: flex; flex-direction: column; gap: 10px; }
.spacer { flex: 1; } .wrap { flex-wrap: wrap; } .center { text-align: center; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; } .grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }

/* ---- кнопки и поля ---- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 0; border-radius: 12px;
  padding: 12px 16px; font: inherit; font-weight: 600; cursor: pointer; background: var(--surface-2); color: var(--text);
  transition: transform .08s ease, background .15s ease, opacity .15s; min-height: 44px; }
.btn:active { transform: scale(.98); }
.btn[disabled] { opacity: .5; pointer-events: none; }
.btn.primary { background: var(--brand); color: var(--brand-ink); }
.btn.primary:hover { background: var(--brand-2); }
.btn.danger { background: var(--bad); color: #fff; }
.btn.soft { background: var(--brand-soft); color: var(--brand-2); }
.btn.ghost { background: transparent; color: var(--brand-2); }
.btn.block { width: 100%; } .btn.sm { padding: 7px 12px; min-height: 34px; font-size: 14px; border-radius: 10px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field > span { font-size: 13px; color: var(--text-2); font-weight: 550; }
/* поля 16px — иначе iOS увеличивает страницу при фокусе */
.input, select.input, textarea.input { width: 100%; font: inherit; font-size: 16px; color: var(--text); background: var(--surface);
  border: 1px solid var(--line-2); border-radius: 12px; padding: 12px 14px; outline: none; min-height: 46px;
  transition: border-color .15s, box-shadow .15s; }
.input:focus { border-color: var(--brand-2); box-shadow: 0 0 0 4px color-mix(in srgb, var(--brand-2) 18%, transparent); }
textarea.input { min-height: 96px; resize: vertical; }
.input.code { font-size: 28px; letter-spacing: .4em; text-align: center; font-variant-numeric: tabular-nums; }
.seg { display: flex; background: var(--surface-2); border-radius: 12px; padding: 3px; gap: 3px; }
.seg button { flex: 1; border: 0; background: transparent; font: inherit; font-weight: 600; color: var(--text-2);
  padding: 8px 10px; border-radius: 9px; cursor: pointer; }
.seg button.on { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
.chips { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; }
.chip { flex: none; border: 1px solid var(--line-2); background: var(--surface); border-radius: 999px; padding: 7px 13px;
  font: inherit; font-size: 14px; font-weight: 550; color: var(--text-2); cursor: pointer; }
.chip.on { background: var(--brand); border-color: var(--brand); color: #fff; }

/* ---- карточки, списки ---- */
.card { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px; }
.card.flat { box-shadow: none; border: 1px solid var(--line); }
.list { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.item { display: flex; align-items: center; gap: 12px; padding: 13px 16px; border-bottom: 1px solid var(--line); cursor: pointer;
  color: inherit; min-height: 56px; }
.item:last-child { border-bottom: 0; } .item:active { background: var(--surface-2); }
.item .body { flex: 1; min-width: 0; } .item .title { font-weight: 600; } .item .sub { font-size: 13px; color: var(--text-2); }
.chev { color: var(--muted); flex: none; }
.ico { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; flex: none;
  background: var(--brand-soft); color: var(--brand-2); }
.ico.ok { background: var(--ok-soft); color: var(--ok); } .ico.warn { background: var(--warn-soft); color: var(--warn); }
.ico.bad { background: var(--bad-soft); color: var(--bad); } .ico.violet { background: var(--violet-soft); color: var(--violet); }
.ico.lg { width: 52px; height: 52px; border-radius: 16px; }
.badge { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 650; padding: 3px 9px;
  border-radius: 999px; background: var(--surface-2); color: var(--text-2); white-space: nowrap; }
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge.new { background: var(--brand-soft); color: var(--brand-2); } .badge.accepted, .badge.pending { background: var(--violet-soft); color: var(--violet); }
.badge.in_progress { background: var(--warn-soft); color: var(--warn); } .badge.done, .badge.approved, .badge.confirmed { background: var(--ok-soft); color: var(--ok); }
.badge.closed, .badge.cancelled { background: var(--surface-2); color: var(--muted); } .badge.rejected, .badge.overdue { background: var(--bad-soft); color: var(--bad); }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--bad); flex: none; }
.empty { text-align: center; padding: 44px 20px; color: var(--muted); }
.empty .ico { margin: 0 auto 12px; width: 56px; height: 56px; border-radius: 18px; }
.section-title { display: flex; align-items: baseline; justify-content: space-between; margin: 22px 4px 10px; }
.section-title h2 { font-size: 19px; }

/* ---- приложение арендатора ---- */
.app { max-width: 640px; margin: 0 auto; min-height: 100vh; padding: calc(var(--safe-t) + 8px) 16px calc(var(--safe-b) + 96px); }
.topbar { display: flex; align-items: center; gap: 10px; min-height: 48px; margin-bottom: 6px; }
.topbar .back { width: 38px; height: 38px; border-radius: 12px; border: 0; background: var(--surface); box-shadow: var(--shadow);
  display: grid; place-items: center; color: var(--text); cursor: pointer; }
.topbar h1 { font-size: 24px; }
.hello { padding: 8px 4px 2px; } .hello .org { color: var(--text-2); font-weight: 550; }
.quick { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-top: 16px; }
.quick button { border: 0; background: var(--surface); border-radius: 18px; box-shadow: var(--shadow); padding: 14px 6px 12px;
  display: flex; flex-direction: column; align-items: center; gap: 8px; font: inherit; font-size: 13px; font-weight: 600;
  color: var(--text); cursor: pointer; }
.quick button:active { transform: scale(.97); }
.sos { margin-top: 12px; display: flex; align-items: center; gap: 14px; background: linear-gradient(135deg, #ef4444, #b91c1c);
  color: #fff; border: 0; border-radius: 18px; padding: 14px 16px; width: 100%; font: inherit; text-align: left; cursor: pointer;
  box-shadow: 0 8px 24px rgba(220, 38, 38, .28); }
.sos .ico { background: rgba(255, 255, 255, .18); color: #fff; }
.news-strip { display: flex; gap: 12px; overflow-x: auto; scroll-snap-type: x mandatory; padding: 2px 2px 8px; scrollbar-width: none; }
.news-card { flex: 0 0 78%; max-width: 300px; scroll-snap-align: start; background: var(--surface); border-radius: var(--radius);
  box-shadow: var(--shadow); overflow: hidden; cursor: pointer; }
.news-card .cover { aspect-ratio: 16/9; background: linear-gradient(135deg, var(--brand), #0ea5e9); background-size: cover; background-position: center;
  display: grid; place-items: center; color: rgba(255,255,255,.9); }
.news-card .txt { padding: 12px 14px 14px; } .news-card .t { font-weight: 650; line-height: 1.3; display: -webkit-box;
  -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.tabbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; padding: 8px 12px calc(var(--safe-b) + 8px);
  background: color-mix(in srgb, var(--surface) 86%, transparent); backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px); border-top: 1px solid var(--line); }
.tabbar nav { max-width: 640px; margin: 0 auto; display: grid; grid-template-columns: repeat(5, 1fr); }
.tabbar a { display: flex; flex-direction: column; align-items: center; gap: 3px; font-size: 11px; font-weight: 600; color: var(--muted);
  padding: 4px 0; position: relative; }
.tabbar a.on { color: var(--brand-2); }
.tabbar .cnt { position: absolute; top: 0; left: 55%; background: var(--bad); color: #fff; font-size: 10px; min-width: 16px; height: 16px;
  border-radius: 8px; display: grid; place-items: center; padding: 0 4px; }
.fab { position: fixed; right: max(16px, calc(50% - 304px)); bottom: calc(var(--safe-b) + 84px); z-index: 25; width: 56px; height: 56px;
  border-radius: 18px; border: 0; background: var(--brand); color: #fff; box-shadow: var(--shadow-lg); display: grid; place-items: center; cursor: pointer; }
.cat-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.cat { border: 1px solid transparent; background: var(--surface); border-radius: 16px; box-shadow: var(--shadow); padding: 14px 8px;
  display: flex; flex-direction: column; align-items: center; gap: 8px; text-align: center; font: inherit; font-size: 13px; font-weight: 600;
  color: var(--text); cursor: pointer; min-height: 104px; }
.cat.on { border-color: var(--brand-2); background: var(--brand-soft); }
.steps { display: flex; gap: 6px; margin: 4px 0 16px; } .steps i { flex: 1; height: 4px; border-radius: 2px; background: var(--line-2); }
.steps i.on { background: var(--brand-2); }
.timeline { display: flex; gap: 6px; margin: 14px 0 4px; } .timeline .st { flex: 1; text-align: center; font-size: 11px; color: var(--muted); }
.timeline .st i { display: block; height: 4px; border-radius: 2px; background: var(--line-2); margin-bottom: 6px; }
.timeline .st.on { color: var(--text); font-weight: 600; } .timeline .st.on i { background: var(--brand-2); }
.chat { display: flex; flex-direction: column; gap: 8px; padding: 6px 0; }
.msg { max-width: 82%; padding: 9px 13px; border-radius: 18px; background: var(--surface); box-shadow: var(--shadow); white-space: pre-wrap; word-wrap: break-word; }
.msg.me { align-self: flex-end; background: var(--brand); color: #fff; border-bottom-right-radius: 6px; }
.msg.them { align-self: flex-start; border-bottom-left-radius: 6px; }
.msg .meta { font-size: 11px; opacity: .7; margin-top: 3px; }
.msg.event { align-self: center; background: transparent; box-shadow: none; font-size: 12px; color: var(--muted); padding: 2px 8px; }
.msg.internal { background: var(--warn-soft); color: var(--text); }
.composer { position: sticky; bottom: calc(var(--safe-b) + 76px); display: flex; gap: 8px; align-items: flex-end; background: var(--bg); padding: 8px 0; }
.composer textarea { min-height: 46px; max-height: 140px; }
.thumbs { display: flex; gap: 8px; flex-wrap: wrap; } .thumb { width: 76px; height: 76px; border-radius: 12px; object-fit: cover; background: var(--surface-2);
  border: 1px solid var(--line); cursor: zoom-in; }
.file-chip { display: inline-flex; align-items: center; gap: 6px; padding: 6px 10px; border-radius: 10px; background: var(--surface-2); font-size: 13px; }
.stars { display: flex; gap: 6px; } .stars button { border: 0; background: none; font-size: 30px; color: var(--line-2); cursor: pointer; padding: 0; }
.stars button.on { color: #f59e0b; }
.qr { background: #fff; border-radius: 20px; padding: 16px; width: min(280px, 80vw); margin: 10px auto; }
.qr img { width: 100%; display: block; }
.slots { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.slot { border: 1px solid var(--line-2); background: var(--surface); border-radius: 10px; padding: 9px 0; font: inherit; font-size: 14px;
  font-weight: 600; cursor: pointer; color: var(--text); font-variant-numeric: tabular-nums; }
.slot.busy { background: var(--surface-2); color: var(--muted); text-decoration: line-through; cursor: not-allowed; }
.slot.mine { background: var(--ok-soft); color: var(--ok); border-color: transparent; }
.slot.sel { background: var(--brand); color: #fff; border-color: var(--brand); }
.map { position: relative; aspect-ratio: 4/3; border-radius: var(--radius); overflow: hidden; background:
  linear-gradient(0deg, var(--surface-2), var(--surface)); box-shadow: var(--shadow); }
.map .b { position: absolute; transform: translate(-50%, -50%); border: 0; border-radius: 10px; padding: 5px 8px; font: inherit;
  font-size: 12px; font-weight: 700; background: var(--surface); color: var(--text); box-shadow: var(--shadow); cursor: pointer; white-space: nowrap; }
.map .b.mine { background: var(--brand); color: #fff; } .map .b.hit { outline: 3px solid var(--warn); }
.login { min-height: 100vh; display: flex; flex-direction: column; justify-content: center; max-width: 420px; margin: 0 auto;
  padding: calc(var(--safe-t) + 24px) 20px calc(var(--safe-b) + 24px); }
.logo { width: 64px; height: 64px; border-radius: 20px; background: linear-gradient(135deg, #1d4ed8, #0ea5e9); display: grid; place-items: center;
  color: #fff; box-shadow: 0 10px 30px rgba(29, 78, 216, .35); margin-bottom: 20px; }
.sheet-bg { position: fixed; inset: 0; background: rgba(8, 12, 24, .45); z-index: 50; display: flex; align-items: flex-end; justify-content: center;
  animation: fade .15s ease; }
.sheet { background: var(--bg); width: 100%; max-width: 640px; max-height: 92vh; overflow: auto; border-radius: 22px 22px 0 0;
  padding: 10px 16px calc(var(--safe-b) + 20px); animation: up .2s ease; }
.sheet .grab { width: 40px; height: 5px; border-radius: 3px; background: var(--line-2); margin: 0 auto 12px; }
@media (min-width: 700px) { .sheet-bg { align-items: center; } .sheet { border-radius: 22px; } }
.toast { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(var(--safe-b) + 92px); z-index: 60; background: var(--text);
  color: var(--bg); padding: 11px 16px; border-radius: 14px; font-weight: 600; box-shadow: var(--shadow-lg); max-width: 90vw; animation: fade .2s ease; }
.toast.bad { background: var(--bad); color: #fff; }
.skeleton { background: linear-gradient(90deg, var(--surface-2), var(--line), var(--surface-2)); background-size: 200% 100%;
  animation: sk 1.2s infinite; border-radius: 12px; }
.lightbox { position: fixed; inset: 0; z-index: 70; background: rgba(0, 0, 0, .9); display: grid; place-items: center; }
.lightbox img { max-width: 96vw; max-height: 90vh; border-radius: 8px; }
@keyframes up { from { transform: translateY(16px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes sk { to { background-position: -200% 0; } }
