/* Оформление как в HAIS GO («светлый минимализм»): тёплый светлый фон,
   белые карточки с тонкой рамкой, зелёный акцент, контурные значки меню,
   на ПК — боковое меню с группами, на телефоне — меню снизу.
   Тёмной темы нет, как и в HAIS GO: всегда светлое, даже при тёмной теме ОС (владелец, 12.10.2026). */
:root {
  --bg: #F5F3F0;
  --card: #FFFFFF;
  --head: #FAF9F7;
  --text: #1C1917;
  --text-mid: #44403C;
  --muted: #79716B;
  --faint: #A8A29E;
  --line: #E7E3DE;
  --navy: #1C1917;
  --accent: #1DA851;
  --accent-dark: #157E3C;
  --accent-soft: #EAF5EE;
  --ok: #15803D;
  --warn: #B45309;
  --warn-soft: #FBF3E6;
  --danger: #DC2626;
  --danger-soft: #FEF2F2;
  --star: #E6A700;
  --radius: 14px;
  --nav-h: 64px;
  --font: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-head: 'Manrope', 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  color-scheme: light;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font: 15px/1.45 var(--font);
  -webkit-text-size-adjust: 100%;
}
a { color: var(--accent-dark); }
button, input, select, textarea { font: inherit; color: inherit; }
[hidden] { display: none !important; }

/* --- каркас: телефон / планшет (по умолчанию) --- */
.shell, .main { display: block; }
.main { padding-bottom: calc(var(--nav-h) + env(safe-area-inset-bottom) + 12px); }
.side { display: contents; }
.side .side-brand, .side-group, .side-user, .pc-only { display: none; }

.topbar {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; justify-content: space-between;
  min-height: 62px;
  padding: env(safe-area-inset-top) 18px 0;
  background: var(--card);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 11px; text-decoration: none; color: var(--text); }
.brand img { flex-shrink: 0; border-radius: 8px; }
.brand > span { display: flex; flex-direction: column; min-width: 0; }
.brand-mark { white-space: nowrap; font-family: var(--font-head); font-size: 17px; font-weight: 800; letter-spacing: -0.01em; color: var(--navy); line-height: 1.1; }
.brand-sub { font-size: 10px; color: var(--accent); font-weight: 700; letter-spacing: 0.14em; text-transform: uppercase; margin-top: 2px; }

.nav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 10;
  display: flex;
  height: calc(var(--nav-h) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  background: var(--card); border-top: 1px solid var(--line);
}
.nav a {
  position: relative; flex: 1;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  padding: 10px 0 8px;
  text-decoration: none; color: var(--faint); font-size: 11px; font-weight: 500;
  border-top: 2.5px solid transparent; margin-top: -1px;
}
.nav a svg { width: 22px; height: 22px; flex-shrink: 0; display: block; }
.nav a.active { color: var(--accent); font-weight: 700; border-top-color: var(--accent); }
.badge {
  position: absolute; top: 5px; left: calc(50% + 6px);
  min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px;
  background: var(--danger); color: #fff; font-size: 11px; font-weight: 700; line-height: 18px; text-align: center;
}

/* --- каркас: ПК (как в HAIS GO — только при мыши, не по одной ширине) --- */
@media (min-width: 900px) and (pointer: fine) {
  .shell { display: flex; align-items: flex-start; min-height: 100vh; }
  .main { flex: 1; min-width: 0; padding: 0; }
  .topbar { display: none !important; }
  .mob-only { display: none; }
  .pc-only { display: inline; }
  .side {
    display: flex; flex-direction: column;
    width: 240px; flex-shrink: 0;
    position: sticky; top: 0; height: 100vh; overflow-y: auto;
    padding: 22px 14px 18px;
    background: var(--card); border-right: 1px solid var(--line);
  }
  .side .side-brand { display: flex; margin: 0 6px 18px; }
  .side-group {
    display: block; margin: 16px 12px 6px;
    font-size: 11px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--faint);
  }
  .nav {
    position: static; flex: 1; display: block;
    height: auto; padding: 0; border: 0; background: transparent;
  }
  .nav a {
    flex-direction: row; justify-content: flex-start; gap: 12px;
    padding: 10px 12px; margin: 0 0 2px; border: 0; border-radius: 10px;
    color: var(--text-mid); font-size: 14px; font-weight: 500;
  }
  .nav a svg { width: 20px; height: 20px; }
  .nav a:hover { background: var(--head); }
  .nav a.active { background: var(--accent-soft); color: var(--accent-dark); font-weight: 700; }
  .badge { position: static; margin-left: auto; }
  .side-user {
    display: flex; align-items: center; gap: 10px;
    padding-top: 14px; margin-top: 14px; border-top: 1px solid var(--line);
  }
  .main .view { max-width: 1100px; margin: 0; padding: 28px 36px; }
  .main .view.view-login { max-width: none; padding: 0; }
  .toast { bottom: 24px; }
}
.avatar {
  width: 34px; height: 34px; border-radius: 50%; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  background: var(--bg); color: var(--text-mid); font-weight: 700; font-size: 14px;
}
.who { flex: 1; min-width: 0; }
.who .name { font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.who .role { font-size: 11px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.btn-mini {
  background: transparent; border: 1px solid var(--line); color: var(--text-mid);
  border-radius: 8px; cursor: pointer; font-size: 12px; padding: 6px 10px; flex-shrink: 0;
}

/* --- общая разметка --- */
.view { max-width: 820px; margin: 0 auto; padding: 20px 16px; }
h1 { font-family: var(--font-head); font-size: 24px; font-weight: 800; letter-spacing: -0.01em; color: var(--navy); margin: 0; }
h2 { font-family: var(--font-head); font-size: 17px; font-weight: 800; color: var(--navy); margin: 0 0 14px; }
.page-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 18px; }
.page-head .h1sub { width: 100%; color: var(--muted); font-size: 14px; margin-top: -4px; }
@media not all and (min-width: 900px) and (pointer: fine) {
  .page-head h1 { font-size: 17px; }
  .page-head .h1sub { display: none; }
}
.muted { color: var(--muted); }
.small { font-size: 13px; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.spacer { flex: 1; }
.panel { background: var(--card); border-radius: var(--radius); padding: 14px 16px; margin-bottom: 10px; border: 1px solid var(--line); }
.empty { text-align: center; padding: 32px 16px; color: var(--muted); }
.hidden { display: none !important; }

/* --- формы --- */
label.field { display: block; margin-bottom: 16px; }
label.field:not(.switch) > span, .field-label {
  display: block; font-size: 12px; font-weight: 600; color: var(--text-mid); margin-bottom: 6px;
  letter-spacing: 0.04em; text-transform: uppercase;
}
div.field { margin-bottom: 16px; }
input[type=text], input[type=password], input[type=search], input[type=number], input[inputmode], select, textarea {
  width: 100%; padding: 13px 14px; border-radius: 10px;
  border: 1.5px solid var(--line); background: var(--card);
  font-size: 16px; /* меньше 16px — iOS увеличивает страницу при фокусе */
  outline: none;
}
textarea { min-height: 70px; resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: var(--accent); }
.form-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 4px; }
.form-actions select { grid-column: 1 / -1; }
@media (min-width: 700px) { .form-actions { grid-template-columns: 1fr auto auto; } .form-actions select { grid-column: auto; } }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 10px 16px; border-radius: 10px; border: 1px solid var(--line);
  background: var(--bg); cursor: pointer; text-decoration: none; color: var(--text-mid); font-weight: 600; font-size: 14px;
  min-height: 44px;
}
.btn.primary {
  background: var(--accent); border-color: var(--accent); color: #fff;
  font-family: var(--font-head); font-weight: 800; font-size: 15px;
  box-shadow: 0 6px 18px rgba(29, 168, 81, 0.28);
}
.btn.danger { background: var(--card); color: var(--danger); border: 1.5px solid var(--danger); }
.btn.block { width: 100%; }
.btn:disabled { opacity: .6; cursor: default; }
.btn.ghost { border-color: transparent; background: transparent; color: var(--accent-dark); padding-left: 0; }

/* Чипы — как подвкладки HAIS GO: выбранный залит тёмным, только текст. */
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { position: relative; }
.chip input { position: absolute; opacity: 0; pointer-events: none; }
.chip span {
  display: inline-block; padding: 6px 13px; border-radius: 99px; border: 1px solid var(--line);
  background: var(--card); color: var(--text-mid); font-size: 13px; font-weight: 600; cursor: pointer; user-select: none;
}
.chip input:checked + span { background: var(--navy); border-color: var(--navy); color: var(--card); }
.chip input:focus-visible + span { outline: 2px solid var(--accent); }
details.more > summary { cursor: pointer; color: var(--accent-dark); font-weight: 600; padding: 6px 0 12px; list-style: none; }
details.more > summary::-webkit-details-marker { display: none; }
details.more > summary::before { content: "▸ "; }
details.more[open] > summary::before { content: "▾ "; }
.switch { display: flex; align-items: center; gap: 10px; cursor: pointer; }
.switch input { width: 20px; height: 20px; accent-color: var(--accent); }

/* --- карточки лотов --- */
.lots { display: grid; gap: 10px; }
@media (min-width: 700px) { .lots { grid-template-columns: 1fr 1fr; } }
.lot {
  position: relative; display: block; text-decoration: none; color: var(--text);
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 14px 48px 12px 16px;
}
.lot:hover { border-color: #D6D1CB; }
.lot.unseen { border-left: 4px solid var(--accent); }
.lot .title { font-family: var(--font-head); font-size: 16px; font-weight: 800; margin-bottom: 4px; overflow-wrap: anywhere; }
.lot .sub { font-size: 14px; margin-bottom: 4px; overflow-wrap: anywhere; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.lot .cust { color: var(--muted); font-size: 13px; margin-bottom: 8px; overflow-wrap: anywhere; }
.lot .meta { display: flex; flex-wrap: wrap; gap: 6px 12px; font-size: 14px; align-items: center; }
.lot .meta + .meta { margin-top: 6px; }
.lot .price { font-family: var(--font-head); font-weight: 800; font-variant-numeric: tabular-nums; }
.lot .note { margin-top: 8px; font-size: 14px; background: var(--accent-soft); padding: 6px 8px; border-radius: 8px; white-space: pre-wrap; }
.tag { display: inline-block; font-size: 12px; font-weight: 700; padding: 3px 10px; border-radius: 99px; background: var(--accent-soft); color: var(--accent-dark); }
.tag.warn { background: var(--warn-soft); color: var(--warn); }
.tag.gray { background: var(--bg); color: var(--muted); font-weight: 600; }
.deadline.soon { color: var(--warn); font-weight: 600; }
.star {
  position: absolute; top: 6px; right: 4px; width: 44px; height: 44px;
  border: 0; background: transparent; font-size: 22px; cursor: pointer; color: var(--faint); line-height: 1;
}
.star.on { color: var(--star); }
.mark { background: rgba(255, 213, 0, .35); color: inherit; border-radius: 3px; padding: 0 1px; }

/* --- карточка лота --- */
.lot-title { font-size: 20px; margin-bottom: 12px; }
.kv { display: grid; grid-template-columns: minmax(110px, 34%) 1fr; gap: 0; font-size: 14px; margin: 0; }
.kv dt, .kv dd { padding: 10px 0; border-bottom: 1px solid var(--line); }
.kv dt { color: var(--muted); font-size: 12px; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; padding-right: 12px; }
.kv dd { margin: 0; overflow-wrap: anywhere; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; margin: 14px 0 0; }

/* --- вход (карточка как в HAIS GO) --- */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px; }
.login {
  width: 100%; max-width: 380px; margin: 0;
  background: var(--card); border: 1px solid var(--line); border-radius: 16px;
  padding: 44px 36px; box-shadow: 0 4px 24px rgba(28, 25, 23, 0.07);
}
.login .brand { margin-bottom: 28px; }
.login .btn.primary { width: 100%; min-height: 52px; margin-top: 4px; font-size: 16px; }
.error-box { background: var(--danger-soft); color: var(--danger); border: 1px solid #FECACA; padding: 10px 13px; border-radius: 8px; font-size: 13px; margin-top: 14px; }
.error-box:empty { display: none; }
.alert { background: var(--accent-soft); color: var(--ok); border: 1px solid #BBF7D0; padding: 11px 14px; border-radius: 10px; font-size: 13px; font-weight: 600; margin-bottom: 14px; }

/* --- уведомление --- */
.toast {
  position: fixed; left: 50%; transform: translateX(-50%);
  bottom: calc(var(--nav-h) + env(safe-area-inset-bottom) + 12px);
  background: var(--navy); color: var(--card); padding: 10px 16px; border-radius: 10px; font-size: 14px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, .2); z-index: 20; max-width: calc(100% - 32px);
}
.loading { text-align: center; padding: 48px 0; color: var(--faint); }
.filters-tabs { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 6px; margin-bottom: 12px; }
.filters-tabs .chip span { white-space: nowrap; }
