:root {
  --bg: #efece6;
  --card: #fbfaf7;
  --ink: #1c1b19;
  --muted: #6f6a62;
  --line: #ddd6cc;
  --accent: #1f4d3a;
  --danger: #8a3030;
  --ok: #1f4d3a;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  color: var(--ink);
  background: var(--bg);
  font: 14px/1.45 "Segoe UI", "Helvetica Neue", sans-serif;
}
button, input, select, textarea {
  font: inherit;
  color: inherit;
}
button, .btn {
  border: 1px solid var(--ink);
  background: var(--ink);
  color: #fff;
  padding: 6px 10px;
  cursor: pointer;
}
button.ghost, .ghost {
  background: transparent;
  color: var(--ink);
}
button.ok { background: var(--ok); border-color: var(--ok); }
button.danger { background: transparent; color: var(--danger); border-color: var(--danger); }
button:disabled { opacity: 0.5; cursor: default; }
input, select, textarea {
  width: 100%;
  border: 1px solid var(--line);
  background: #fff;
  padding: 7px 8px;
}
textarea { min-height: 64px; resize: vertical; }
label { display: block; margin-bottom: 10px; }
label span, .hint, th { color: var(--muted); font-size: 12px; }
.login {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}
.card {
  width: min(420px, 100%);
  background: var(--card);
  border: 1px solid var(--line);
  padding: 28px 24px;
}
.brand { font-size: 22px; letter-spacing: 0.14em; margin: 0 0 4px; }
.sub { color: var(--muted); margin: 0 0 18px; }
.shell { display: flex; align-items: stretch; min-height: 100vh; }
.side {
  position: sticky;
  top: 0;
  flex: 0 0 220px;
  width: 220px;
  min-width: 220px;
  max-width: 220px;
  height: 100vh;
  overflow: auto;
  border-right: 1px solid var(--line);
  padding: 22px 16px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  background: #f7f4ef;
}
.brand-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.nav-mark { display: none; font-weight: 600; }
.side nav { display: flex; flex-direction: column; gap: 4px; }
.shell.side-collapsed .side {
  flex-basis: 56px;
  width: 56px;
  min-width: 56px;
  max-width: 56px;
  padding: 12px 8px;
}
.shell.side-collapsed .brand,
.shell.side-collapsed .nav-label,
.shell.side-collapsed .who-details { display: none; }
.shell.side-collapsed .who { margin-top: auto; }
.shell.side-collapsed button.switch { padding: 0; }
.shell.side-collapsed .nav-mark { display: inline; }
.shell.side-collapsed .side a { text-align: center; padding: 8px 0; }
.shell.side-collapsed .brand-row { justify-content: center; }
.side a {
  color: inherit;
  text-decoration: none;
  padding: 8px 10px;
  overflow-wrap: anywhere;
}
.side a.active { background: #fff; border: 1px solid var(--line); }
.who { margin-top: auto; color: var(--muted); font-size: 12px; overflow-wrap: anywhere; }
.who strong { display: block; color: var(--ink); font-size: 14px; }
.main { flex: 1 1 auto; min-width: 0; padding: 28px 28px 48px; }
.top { display: flex; justify-content: space-between; gap: 16px; align-items: end; margin-bottom: 18px; }
h1 { font-size: 22px; font-weight: 600; margin: 0; }
h2 { font-size: 16px; margin: 28px 0 10px; }
h3 { font-size: 14px; margin: 16px 0 8px; }
.banner { padding: 8px 10px; border: 1px solid var(--line); margin-bottom: 12px; background: #fff; }
.banner.bad { border-color: var(--danger); color: var(--danger); }
.grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.stat { background: var(--card); border: 1px solid var(--line); padding: 12px; }
.stat b { display: block; font-size: 18px; margin-top: 4px; }
.table-wrap { overflow: auto; border: 1px solid var(--line); background: #fff; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: top; white-space: nowrap; }
table.payouts { border-collapse: separate; border-spacing: 0 12px; }
table.payouts th, table.payouts td {
  text-align: center;
  vertical-align: middle;
  padding: 16px 14px;
  background: #fff;
  border-top: 1px solid #8a8278;
  border-bottom: 1px solid #8a8278;
}
table.payouts td:first-child, table.payouts th:first-child { border-left: 1px solid #8a8278; }
table.payouts td:last-child, table.payouts th:last-child { border-right: 1px solid #8a8278; }
td.wrap, th.wrap { white-space: normal; }
.row-actions { display: flex; gap: 6px; flex-wrap: wrap; justify-content: center; }
.receipts { display: flex; gap: 6px; flex-wrap: wrap; max-width: 220px; white-space: normal; }
.receipts img { width: 54px; height: 54px; object-fit: cover; border: 1px solid var(--line); display: block; }
.receipt-list { display: flex; flex-direction: column; gap: 14px; margin: 12px 0; }
.receipt-card { border: 1px solid var(--line); background: #fff; padding: 10px; }
.receipt-card-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 8px; }
.receipt-card-head button { margin: 0; flex: none; }
.receipt-card img { display: block; width: 100%; max-height: 42vh; object-fit: contain; background: #f6f3ee; }
.receipt-card iframe { display: block; width: 100%; height: 42vh; border: 0; background: #f6f3ee; }
.receipt-card button { margin-top: 10px; }
.receipt-meta { margin: 8px 0 4px; }
.receipt-meta p { margin: 4px 0; }
.tabs { display: flex; gap: 8px; margin: 0 0 12px; }
.tabs button.active { background: var(--ink); color: #fff; border-color: var(--ink); }
.bot-events { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px 10px; margin: 8px 0; }
.bot-events label { margin: 0; font-size: 12px; }
.bot-list { display: flex; flex-direction: column; gap: 10px; }
.bot-list .tile { width: 100%; max-width: 720px; }
.bot-list .editor { width: min(720px, 100%); }
.form-grid { display: grid; grid-template-columns: repeat(4, minmax(140px, 1fr)); gap: 10px; align-items: end; }
.editor { background: var(--card); border: 1px solid var(--line); padding: 14px; margin: 10px 0 16px; }
.inline { display: flex; gap: 8px; align-items: center; }
.check { display: flex; gap: 8px; align-items: center; }
.check input { width: auto; }
.user-card, .percent-card { border-top: 1px solid var(--line); padding-top: 12px; margin-top: 12px; }
.section-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-top: 8px; }
.section-head h2 { margin: 16px 0 8px; }
.tiles { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-start; }
.tile { width: 180px; border: 1px solid var(--line); background: #fff; }
.tile.open { width: 360px; }
.tile-head { width: 100%; text-align: left; background: transparent; color: inherit; border: 0; padding: 12px; font-weight: 600; }
.tile.open .tile-head { border-bottom: 1px solid var(--line); }
.stack { display: flex; flex-direction: column; gap: 8px; padding: 10px; }
.stack label { margin: 0; }
button.switch { width: 100%; margin-top: 8px; }
.tile-hint { padding: 0 12px 10px; color: var(--muted); font-size: 12px; }
.stack-cell { display: flex; flex-direction: column; gap: 6px; white-space: normal; min-width: 90px; align-items: center; justify-content: center; }
.copy { cursor: pointer; }
.copy:hover { text-decoration: underline; }
button.sort { border: 0; background: transparent; color: var(--muted); padding: 0; font-size: 12px; }
button.icon-btn { width: 32px; min-width: 32px; height: 32px; padding: 0; display: inline-flex; align-items: center; justify-content: center; }
button.icon-btn svg { display: block; }
.filters { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0 12px; }
.filters label { flex: 1 1 140px; margin: 0; }
.pager { display: flex; gap: 8px; align-items: center; margin-top: 10px; }
.modal-back { position: fixed; inset: 0; z-index: 30; background: rgba(28, 27, 25, 0.45); display: flex; justify-content: center; align-items: flex-start; padding: 48px 16px; overflow: auto; }
.modal { width: min(720px, 100%); background: var(--card); border: 1px solid var(--line); padding: 16px; }
.modal-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 10px; }
.modal-head strong { flex: 1 1 auto; }
.modal.receipt-modal { width: min(420px, 100%); }
.money-table { margin: 12px 0 18px; }
.money-table th, .money-table td { text-align: center; vertical-align: middle; padding: 12px 14px; }
.qr svg { width: 180px; height: 180px; }
@media (max-width: 800px) {
  .shell { flex-direction: column; }
  .side {
    position: sticky;
    z-index: 2;
    width: 100%;
    min-width: 0;
    max-width: none;
    height: auto;
    flex: none;
    border-right: 0;
    border-bottom: 1px solid var(--line);
    padding: 12px;
    gap: 10px;
  }
  .shell.side-collapsed .side {
    width: 56px;
    min-width: 56px;
    max-width: 56px;
    height: 100vh;
  }
  .shell.side-collapsed .side nav { flex-direction: column; }
  .side nav { flex-direction: row; flex-wrap: wrap; }
  .who { margin-top: 0; }
  .main { width: 100%; padding: 16px 12px 40px; }
  .grid, .form-grid { grid-template-columns: 1fr; }
  .top { align-items: start; }
  h1 { font-size: 20px; }
  input, select, textarea { font-size: 16px; }
  button { min-height: 36px; }
}
