/* Биржа Rever 3D — стиль как у rever3d.ru: Onest, светло-серая основа, оранжевый акцент */
:root {
  --ground: #e8eae6; --surface: #f8f9f6; --card: #ffffff; --ink: #141615; --muted: #535955; --line: #d5d8d3;
  --accent: #f37321; --accent-ink: #1a0c00; --accent-text: #b4500d;
  --stage: #1d201f; --stage-ink: #eef0ec; --stage-muted: #a3aaa4;
  --ok-bg: #dcefe2; --ok: #1d7a3e; --warn-bg: #fbe9cf; --warn: #8a4f00; --bad-bg: #f6dcda; --bad: #a3221b;
  --radius: 999px;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: Onest, system-ui, -apple-system, "Segoe UI", sans-serif; background: var(--ground); color: var(--ink); font-size: 16px; line-height: 1.5; }
a { color: var(--accent-text); }
button, input, select, textarea { font: inherit; color: inherit; }
[hidden] { display: none !important; }

.wrap { max-width: 1180px; margin: 0 auto; padding-left: 24px; padding-right: 24px; }

/* Шапка */
.top { background: var(--surface); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 10; }
.top .wrap { display: flex; align-items: center; gap: 24px; min-height: 64px; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 18px; text-decoration: none; color: var(--ink); }
.brand small { font-weight: 500; color: var(--muted); font-size: 14px; }
.tabs { display: flex; gap: 4px; flex-wrap: wrap; }
.tab { border: 0; background: none; padding: 10px 14px; border-radius: var(--radius); cursor: pointer; color: var(--muted); font-weight: 500; }
.tab:hover { color: var(--ink); background: var(--ground); }
.tab[aria-selected="true"] { color: var(--ink); background: var(--ground); font-weight: 600; }
.who { margin-left: auto; display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: 14px; }
.badge { display: inline-block; min-width: 20px; padding: 0 6px; border-radius: 10px; background: var(--accent); color: var(--accent-ink); font-size: 12px; font-weight: 700; text-align: center; line-height: 20px; }

/* Кнопки и поля */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 10px 20px; border-radius: var(--radius); border: 0; background: var(--accent); color: var(--accent-ink); font-weight: 600; cursor: pointer; text-decoration: none; }
.btn:hover { filter: brightness(1.05); }
.btn:disabled { opacity: .55; cursor: default; }
.btn.ghost { background: var(--card); color: var(--ink); box-shadow: inset 0 0 0 1px var(--line); }
.btn.dark { background: var(--ink); color: #fff; }
.btn.small { min-height: 36px; padding: 6px 14px; font-size: 14px; }
.btn.danger { background: var(--card); color: var(--bad); box-shadow: inset 0 0 0 1px #e6b9b5; }
.link-btn { border: 0; background: none; padding: 0; color: var(--accent-text); text-decoration: underline; cursor: pointer; }
.field { display: grid; gap: 6px; }
.field > span { font-size: 14px; font-weight: 600; }
.field small { color: var(--muted); font-size: 13px; }
.input { width: 100%; min-height: 44px; padding: 10px 14px; border: 1px solid var(--line); border-radius: 10px; background: var(--card); }
.input:focus { outline: 2px solid var(--accent); outline-offset: 1px; border-color: transparent; }
textarea.input { min-height: 88px; resize: vertical; }
.status { min-height: 1.5em; margin: 0; font-size: 14px; color: var(--muted); }
.status.error { color: var(--bad); }
.status.ok { color: var(--ok); }

/* Страница */
main { padding-top: 32px; padding-bottom: 80px; }
h1 { font-size: clamp(1.8rem, 3.4vw, 2.6rem); line-height: 1.08; letter-spacing: -.03em; margin: 0 0 8px; }
h2 { font-size: 22px; letter-spacing: -.02em; margin: 0 0 12px; }
.lead { color: var(--muted); margin: 0 0 24px; max-width: 60ch; }
.panel { background: var(--surface); border-radius: 16px; padding: 24px; }
.note { background: var(--warn-bg); color: var(--warn); padding: 14px 18px; border-radius: 12px; font-size: 15px; }
.note.bad { background: var(--bad-bg); color: var(--bad); }
.empty { text-align: center; color: var(--muted); padding: 56px 16px; background: var(--surface); border-radius: 16px; }

/* Вход */
.auth { max-width: 460px; margin: 6vh auto 0; }
.auth .panel { display: grid; gap: 16px; }
.auth .switch { display: flex; gap: 4px; background: var(--ground); padding: 4px; border-radius: var(--radius); }
.auth .switch .tab { flex: 1; }
.auth form { display: grid; gap: 14px; }

.rules { background: var(--ground); border-radius: 12px; padding: 14px 16px; font-size: 14px; }
.rules ul { margin: 6px 0 0; padding-left: 18px; display: grid; gap: 4px; }
.check { display: flex; gap: 10px; align-items: flex-start; font-size: 15px; cursor: pointer; }
.check input { width: 18px; height: 18px; margin-top: 2px; accent-color: var(--accent); }
.rating { display: inline-flex; align-items: center; gap: 4px; padding: 2px 10px; border-radius: 999px; background: var(--ground); color: var(--ink); font-weight: 600; font-size: 13px; }

/* Фильтры */
.filters { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; }
.chip { border: 1px solid var(--line); background: var(--card); padding: 8px 14px; border-radius: var(--radius); cursor: pointer; font-size: 14px; }
.chip[aria-pressed="true"] { background: var(--ink); color: #fff; border-color: var(--ink); }

/* Карточки заказов на бирже */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.card { background: var(--card); border-radius: 16px; overflow: hidden; display: grid; grid-template-rows: auto 1fr; }
.thumb { position: relative; aspect-ratio: 4 / 3; background: var(--stage); color: var(--stage-muted); display: grid; place-items: center; font-size: 14px; }
.thumb img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; display: block; }
.card-body { padding: 16px; display: grid; gap: 8px; align-content: start; }
.row { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; }
.muted { color: var(--muted); font-size: 14px; }
.tag { display: inline-block; padding: 2px 10px; border-radius: 6px; font-size: 13px; font-weight: 600; background: var(--ground); }
.tag.ok { background: var(--ok-bg); color: var(--ok); }
.tag.warn { background: var(--warn-bg); color: var(--warn); }
.tag.bad { background: var(--bad-bg); color: var(--bad); }
.pay { font-size: 24px; font-weight: 700; letter-spacing: -.02em; white-space: nowrap; }
.card-foot .tag { text-align: right; }
.card-foot { display: flex; justify-content: space-between; align-items: end; gap: 8px; margin-top: 4px; }

/* «Мои заказы» */
.list { display: grid; gap: 10px; }
.mine { background: var(--card); border-radius: 16px; padding: 18px; display: grid; gap: 12px; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) minmax(0, 1.2fr); }
.mine h3 { margin: 0; font-size: 18px; }
.mine .cell { display: grid; gap: 4px; align-content: start; justify-items: start; }
.files { margin: 0; padding: 0; list-style: none; display: grid; gap: 4px; }
.track { display: flex; gap: 8px; }
.track .input { min-width: 0; }
.rule { margin-top: 16px; font-size: 14px; color: var(--muted); }

/* Профиль */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-grid .wide { grid-column: 1 / -1; }
.suggest { position: relative; }
.suggest ul { position: absolute; left: 0; right: 0; top: 100%; margin: 4px 0 0; padding: 4px; list-style: none; background: var(--card); border: 1px solid var(--line); border-radius: 10px; z-index: 5; max-height: 260px; overflow: auto; }
.suggest li { padding: 8px 10px; border-radius: 6px; cursor: pointer; }
.suggest li[aria-selected="true"], .suggest li:hover { background: var(--ground); }

/* Кабинет оператора */
.cols { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; align-items: start; }
.col h2 { font-size: 16px; display: flex; justify-content: space-between; align-items: center; }
.item { background: var(--card); border-radius: 14px; padding: 14px; display: grid; gap: 8px; margin-bottom: 8px; }
.item.overdue { box-shadow: inset 4px 0 0 var(--bad); }
.item.done { box-shadow: inset 4px 0 0 var(--ok); }
.item .acts { display: flex; gap: 6px; flex-wrap: wrap; }
.inline { display: flex; gap: 8px; align-items: end; flex-wrap: wrap; }
.inline .field { flex: 1; min-width: 110px; }
.settings { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
table.tbl { width: 100%; border-collapse: collapse; background: var(--card); border-radius: 14px; overflow: hidden; }
.tbl th, .tbl td { text-align: left; padding: 12px; border-bottom: 1px solid var(--line); font-size: 14px; vertical-align: top; }
.tbl th { color: var(--muted); font-weight: 600; }
dialog { border: 0; border-radius: 16px; padding: 0; max-width: min(720px, calc(100vw - 32px)); width: 100%; }
dialog::backdrop { background: rgba(20, 22, 21, .45); }
.dlg { padding: 24px; display: grid; gap: 14px; }
.kv { display: grid; grid-template-columns: 160px 1fr; gap: 6px 16px; margin: 0; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; }
pre.text { white-space: pre-wrap; background: var(--surface); padding: 12px; border-radius: 10px; font: 13px/1.5 ui-monospace, Consolas, monospace; margin: 0; max-height: 240px; overflow: auto; }

@media (max-width: 900px) {
  .wrap { padding-left: 16px; padding-right: 16px; }
  .mine { grid-template-columns: 1fr; }
  .cols, .settings, .form-grid { grid-template-columns: 1fr; }
  .who { margin-left: 0; width: 100%; justify-content: space-between; padding-bottom: 8px; }
  .kv { grid-template-columns: 1fr; }
  .tbl th:nth-child(n+4), .tbl td:nth-child(n+4) { display: none; }
}
