:root {
  --bg: #ffffff;
  --bg-soft: #f5f5f5;
  --card: #ffffff;
  --border: #d7d7d7;
  --border2: #eeeeee;
  --text: #111111;
  --muted: #666666;
  --danger: #991b1b;
  --success: #14532d;
  --radius: 5px;
  --header-h: 52px;
}

* {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
  font-size: 13px;
  line-height: 1.35;
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input,
select,
textarea {
  font: inherit;
}

.layout {
  min-height: 100vh;
  display: flex;
}

.sidebar {
  width: 210px;
  border-right: 1px solid var(--border);
  background: #fff;
  padding: 12px 10px;
  display: none;
  flex-direction: column;
  gap: 4px;
}

.sidebarLogo {
  font-size: 16px;
  font-weight: 800;
  letter-spacing: .12em;
  padding: 6px 10px 14px;
}

.sidebarNav {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.sidebarLink {
  min-height: 36px;
  display: flex;
  align-items: center;
  padding: 0 10px;
  border-radius: var(--radius);
  color: var(--muted);
  font-weight: 650;
}

.sidebarLink:hover {
  background: var(--bg-soft);
  color: var(--text);
}

.sidebarLink.active {
  background: #111;
  color: #fff;
}

.main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.topbar {
  min-height: var(--header-h);
  border-bottom: 1px solid var(--border);
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 10px;
  position: sticky;
  top: 0;
  z-index: 20;
}

.topbarTitle {
  font-size: 14px;
  font-weight: 750;
  min-width: 0;
}

.topbarRight {
  display: flex;
  align-items: center;
  gap: 6px;
}

.langSwitch {
  display: flex;
  gap: 4px;
}

.langBtn {
  height: 30px;
  min-width: 40px;
  border: 1px solid var(--border);
  background: #fff;
  border-radius: var(--radius);
  color: var(--text);
  font-size: 11px;
  font-weight: 700;
  padding: 0 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.langBtn.active {
  background: #111;
  color: #fff;
  border-color: #111;
}

.logoutForm {
  margin: 0;
}

.logoutBtn {
  height: 30px;
  padding: 0 9px;
  font-size: 11px;
}

.content {
  padding: 10px;
}

.pageHead {
  margin-bottom: 10px;
}

.pageHead h1 {
  margin: 0;
  font-size: 19px;
  font-weight: 800;
  line-height: 1.1;
}

.pageHead p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
}

.card,
.loginCard,
.details,
.cardForm,
.rateForm,
.tableWrap {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: none;
}

.cardBody {
  padding: 10px;
}

.k {
  color: var(--muted);
  font-weight: 700;
  font-size: 12px;
}

.v {
  font-size: 26px;
  font-weight: 850;
  margin-top: 4px;
}

.v.small {
  font-size: 13px;
  word-break: break-word;
}

.filter {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) 160px auto auto;
  gap: 6px;
  margin-bottom: 10px;
  align-items: center;
}

.filter button,
.filter .btn {
  width: auto;
  white-space: nowrap;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: #fff;
  color: var(--text);
  outline: none;
  padding: 0 9px;
  font-weight: 600;
}

input,
select {
  height: 38px;
}

textarea {
  min-height: 92px;
  padding-top: 8px;
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  border-color: #111;
}

button,
.btn {
  height: 38px;
  border: 1px solid #111;
  border-radius: var(--radius);
  background: #111;
  color: #fff;
  padding: 0 11px;
  font-weight: 750;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.btn.secondary {
  border-color: var(--border);
  background: #fff;
  color: #111;
}

.tableWrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

table {
  width: 100%;
  min-width: 760px;
  border-collapse: collapse;
}

th,
td {
  text-align: left;
  padding: 8px 10px;
  border-bottom: 1px solid var(--border2);
  white-space: nowrap;
}

th {
  font-size: 11px;
  color: var(--muted);
  font-weight: 800;
}

td {
  font-size: 12px;
  font-weight: 600;
}

.badge {
  display: inline-flex;
  align-items: center;
  height: 22px;
  padding: 0 7px;
  border-radius: 999px;
  border: 1px solid var(--border);
  font-size: 10px;
  font-weight: 800;
  background: #fff;
}

.details {
  display: grid;
  gap: 7px;
  padding: 10px;
  margin-bottom: 10px;
}

.details div {
  border-bottom: 1px solid var(--border2);
  padding-bottom: 7px;
}

.form {
  display: grid;
  gap: 8px;
}

.form label,
.rateForm label {
  font-size: 11px;
  font-weight: 800;
  color: var(--muted);
}

.cardForm {
  padding: 10px;
  margin-top: 10px;
}

.rateForm {
  display: grid;
  grid-template-columns: 1fr;
  gap: 7px;
  padding: 10px;
  margin-bottom: 10px;
}

.mt {
  margin-top: 14px;
}

.loginBody {
  min-height: 100vh;
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 12px;
  background: #fff;
}

.loginCard {
  width: 100%;
  max-width: 390px;
  padding: 14px;
}

.loginTop {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 14px;
}

.loginLogo {
  font-weight: 850;
  letter-spacing: .12em;
}

.loginCard h1 {
  margin: 0 0 6px;
  font-size: 22px;
}

.loginCard p {
  color: var(--muted);
  margin: 0 0 12px;
  font-size: 12px;
}

.alert {
  border: 1px solid #e5b4b4;
  background: #fff5f5;
  color: var(--danger);
  border-radius: var(--radius);
  padding: 8px 9px;
  margin-bottom: 10px;
  font-weight: 750;
}

.bottomNav {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  min-height: 56px;
  background: #fff;
  border-top: 1px solid var(--border);
  display: flex;
  padding-bottom: env(safe-area-inset-bottom);
  z-index: 50;
}

.bottomNavLink {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  font-size: 11px;
  font-weight: 750;
}

.bottomNavLink.active {
  color: #111;
}

@media (max-width: 1023px) {
  .content {
    padding-bottom: 76px;
  }
}

@media (min-width: 760px) {
  .grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .rateForm {
    grid-template-columns: 140px 1fr 140px 1fr;
    align-items: center;
  }

  .rateForm button {
    grid-column: 1 / -1;
  }
}

@media (min-width: 1024px) {
  .sidebar {
    display: flex;
  }

  .bottomNav {
    display: none;
  }

  .content {
    padding: 18px;
  }

  input,
  select,
  button,
  .btn {
    height: 36px;
  }
}

.orderRow {
  cursor: pointer;
  transition: background-color .12s ease;
}

.orderRow--pending {
  background: #fffbe6;
}

.orderRow--danger {
  background: #fff1f1;
}

.orderRow--success {
  background: #eefaf1;
}

.orderRow:hover {
  background: #f1f1f1;
}

.orderRow--pending:hover {
  background: #f3f1e6;
}

.orderRow--danger:hover {
  background: #f3eaea;
}

.orderRow--success:hover {
  background: #e6f1e8;
}

.badge--new,
.badge--waiting_payment,
.badge--payment_check,
.badge--paid,
.badge--payout_processing {
  background: #fff8d6;
  border-color: #e8d98a;
  color: #6f5c00;
}

.badge--completed {
  background: #e9f8ed;
  border-color: #b7e4c0;
  color: #14532d;
}

.badge--cancelled,
.badge--expired,
.badge--rejected {
  background: #fdecec;
  border-color: #f2b8b8;
  color: #991b1b;
}

.smallBtn {
  height: 28px;
  padding: 0 8px;
  font-size: 11px;
}

td form {
  margin: 0;
}

.compactDetails {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: #fff;
}

.compactDetails summary {
  min-height: 38px;
  display: flex;
  align-items: center;
  padding: 0 10px;
  font-weight: 800;
  cursor: pointer;
  border-bottom: 1px solid transparent;
}

.compactDetails[open] summary {
  border-bottom-color: var(--border2);
}

.compactForm {
  display: grid;
  grid-template-columns: 1fr;
  gap: 7px;
  padding: 10px;
}

.compactForm label {
  font-size: 11px;
  font-weight: 800;
  color: var(--muted);
}

@media (min-width: 760px) {
  .compactForm {
    grid-template-columns: 120px 1fr 120px 1fr;
    align-items: center;
  }

  .compactForm button {
    grid-column: 1 / -1;
  }
}

.smallLink {
  height: 28px;
  padding: 0 8px;
  font-size: 11px;
}

.clickRow {
  cursor: pointer;
}

.clickRow:hover {
  background: #f1f1f1;
}

.compactTable {
  min-width: 0;
}

.tableWrap--reserves {
  overflow-x: visible;
}

.reservesTable {
  table-layout: fixed;
  width: 100%;
}

.reservesTable th,
.reservesTable td {
  padding: 8px 8px;
}

.reservesTable th:nth-child(1),
.reservesTable td:nth-child(1) {
  width: 23%;
}

.reservesTable th:nth-child(2),
.reservesTable td:nth-child(2) {
  width: 31%;
}

.reservesTable th:nth-child(3),
.reservesTable td:nth-child(3) {
  width: 31%;
}

.reservesTable th:nth-child(4),
.reservesTable td:nth-child(4) {
  width: 15%;
  text-align: right;
}

.reservesTable td {
  overflow: hidden;
  text-overflow: ellipsis;
}

@media (max-width: 520px) {
  .reservesTable th,
  .reservesTable td {
    padding: 7px 6px;
    font-size: 11px;
  }

  .reservesTable th:nth-child(1),
  .reservesTable td:nth-child(1) {
    width: 22%;
  }

  .reservesTable th:nth-child(2),
  .reservesTable td:nth-child(2) {
    width: 32%;
  }

  .reservesTable th:nth-child(3),
  .reservesTable td:nth-child(3) {
    width: 32%;
  }

  .reservesTable th:nth-child(4),
  .reservesTable td:nth-child(4) {
    width: 14%;
  }

  .reservesTable .badge {
    height: 20px;
    padding: 0 6px;
    font-size: 10px;
  }
}

@media (max-width: 520px) {
  .bottomNavLink {
    font-size: 10px;
  }
}

.preLine {
  white-space: pre-line;
  overflow-wrap: anywhere;
}

.pageHead {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
}

.filterRow {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 8px;
  margin: 12px 0;
}

.formGrid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.checkLine {
  display: flex;
  gap: 8px;
  align-items: center;
  min-height: 42px;
}

.docsGrid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px;
}

.docCard {
  border: 1px solid #ddd;
  border-radius: 8px;
  padding: 10px;
}

.docCard img {
  width: 100%;
  max-height: 220px;
  object-fit: contain;
  border: 1px solid #ddd;
  border-radius: 6px;
  background: #f7f7f7;
}

.docMeta {
  display: grid;
  gap: 3px;
  margin-bottom: 8px;
  font-size: 13px;
}

.badge.ok {
  background: #e8f7ed;
  color: #166534;
  border: 1px solid #bbf7d0;
}

.badge.bad {
  background: #fee2e2;
  color: #991b1b;
  border: 1px solid #fecaca;
}

.badge.neutral {
  background: #f3f4f6;
  color: #374151;
  border: 1px solid #e5e7eb;
}

.dangerBtn {
  background: #991b1b;
  color: white;
  border: 0;
}

.primaryBtn {
  background: #111;
  color: white;
  border: 0;
}

@media (max-width: 760px) {
  .pageHead,
  .filterRow,
  .formGrid {
    grid-template-columns: 1fr;
    display: grid;
  }
}

.docCard {
  min-width: 0;
  overflow: hidden;
}

.docMeta {
  min-width: 0;
}

.docMeta span,
.docMeta b {
  overflow-wrap: anywhere;
  word-break: break-word;
  max-width: 100%;
}

.docPreviewImage {
  width: 100%;
  max-height: 220px;
  object-fit: contain;
  border: 1px solid #ddd;
  border-radius: 6px;
  background: #f7f7f7;
}

.docPreviewPdf {
  display: grid;
  place-items: center;
  gap: 8px;
  min-height: 160px;
  padding: 14px;
  border: 1px solid #ddd;
  border-radius: 6px;
  background: #f7f7f7;
  color: #111;
  text-decoration: none;
  font-weight: 800;
}

.docPreviewPdfIcon {
  display: grid;
  place-items: center;
  width: 74px;
  height: 96px;
  border: 2px solid #111;
  border-radius: 4px;
  background: #fff;
  font-size: 20px;
  font-weight: 950;
}

.docOpenBtn {
  display: inline-grid;
  place-items: center;
  min-height: 40px;
}

.filterRow {
  align-items: stretch;
}

.filterRow button,
.filterRow .secondaryBtn {
  height: 48px;
  min-height: 48px;
  display: inline-grid;
  place-items: center;
  padding: 0 18px;
  border-radius: 8px;
  text-decoration: none;
  white-space: nowrap;
  box-sizing: border-box;
}

.filterRow .secondaryBtn {
  border: 1px solid #d7d7d7;
  background: #fff;
  color: #111;
  font-weight: 800;
}

@media (max-width: 760px) {
  .filterRow button,
  .filterRow .secondaryBtn {
    width: 100%;
  }
}

.selectedRow {
  outline: 2px solid #111;
  outline-offset: -2px;
  background: #eef2ff !important;
}

.selectedRow td {
  font-weight: 900;
}

/* requisites dynamic form */
.formGrid {
  display: grid;
  grid-template-columns: repeat(3, minmax(220px, 1fr));
  gap: 14px;
  align-items: start;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

.field label {
  font-weight: 800;
  color: #666;
}

.field input,
.field select,
.field textarea {
  width: 100%;
  min-height: 44px;
  box-sizing: border-box;
  padding: 10px 12px;
  border: 1px solid #d7d7d7;
  border-radius: 8px;
  font: inherit;
  background: #fff;
}

.field textarea {
  min-height: 96px;
  resize: vertical;
}

.field--wide {
  grid-column: 1 / -1;
}

.compactForm button[type="submit"] {
  width: 100%;
  margin-top: 14px;
}

@media (max-width: 900px) {
  .formGrid {
    grid-template-columns: 1fr;
  }
}
