:root {
  --bg: #f3efe6;
  --ink: #1c1915;
  --muted: #6f675c;
  --line: #e4dccf;
  --card: #fffcf7;
  --green: #1f4d3a;
  --green-2: #e7f2ec;
  --red: #9f2d2d;
  --red-2: #f8e8e6;
  --amber: #8a5a12;
  --amber-2: #f8efd8;
  --blue: #1e4e78;
  --blue-2: #e6f0f8;
  --gray-2: #eeeae3;
  --shadow: 0 10px 30px rgba(40, 30, 15, 0.06);
  font-family: "Segoe UI", "PingFang SC", "Noto Sans SC", sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink); font-size: 18px; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.error { color: var(--red); min-height: 1.2em; font-size: 13px; }

.login { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.login-card, .card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--shadow);
}
.login-card { width: min(420px, 100%); padding: 28px; display: grid; gap: 12px; }
.login-card label, .form label { display: grid; gap: 6px; font-size: 13px; color: var(--muted); }
input, select, textarea {
  width: 100%;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 10px;
  padding: 9px 11px;
}
textarea { min-height: 74px; resize: vertical; }
button, .btn {
  border: 0;
  background: var(--green);
  color: #fff;
  border-radius: 10px;
  padding: 9px 14px;
}
.btn.ghost, button.ghost { background: transparent; color: var(--ink); border: 1px solid var(--line); }
.btn.warn, button.warn { background: var(--red); }

.app { min-height: 100vh; display: grid; grid-template-columns: 220px 1fr; }
.side { background: #1c1915; color: #f6f1e8; padding: 22px 16px; display: flex; flex-direction: column; gap: 18px; }
.brand { font-weight: 700; letter-spacing: 0.04em; }
.side nav { display: grid; gap: 4px; }
.side a { color: #d9d0c3; text-decoration: none; padding: 9px 10px; border-radius: 9px; }
.side a.active, .side a:hover { background: #322c26; color: #fff; }
.side-foot { margin-top: auto; display: flex; justify-content: space-between; align-items: center; gap: 8px; font-size: 13px; }
.side-foot button { background: transparent; color: #f6f1e8; border: 1px solid #4a433b; padding: 6px 10px; }
main { padding: 22px 26px 40px; }
.top { display: flex; justify-content: space-between; gap: 16px; align-items: flex-end; margin-bottom: 16px; }
h1 { font-size: 28px; margin: 0; }
h2 { font-size: 20px; margin: 0 0 10px; }
.grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.stat { padding: 14px 16px; }
.stat b { display: block; font-size: 26px; margin-top: 4px; }
.stat span { color: var(--muted); font-size: 13px; }
.filters, .row-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.filters input, .filters select { width: auto; min-width: 140px; }
table { width: 100%; border-collapse: collapse; background: var(--card); border-radius: 14px; overflow: hidden; }
th, td { text-align: left; padding: 14px 12px; border-bottom: 1px solid var(--line); font-size: 17px; line-height: 1.6; vertical-align: middle; }
th { color: var(--muted); font-weight: 600; background: #faf7f2; }
tr.click:hover td { background: #f7f3eb; cursor: pointer; }
.chip { display: inline-flex; align-items: center; border-radius: 999px; padding: 2px 8px; font-size: 12px; background: var(--gray-2); }
.chip.ok { background: var(--green-2); color: var(--green); }
.chip.warn { background: var(--amber-2); color: var(--amber); }
.chip.bad { background: var(--red-2); color: var(--red); }
.chip.info { background: var(--blue-2); color: var(--blue); }
.money { font-variant-numeric: tabular-nums; }
.form { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.form .wide { grid-column: 1 / -1; }
.section { margin-top: 18px; }
.secret { display: flex; gap: 8px; }
.secret input { flex: 1; }
.lines { display: grid; gap: 8px; }
.line { display: grid; grid-template-columns: 72px 1fr 1fr 1fr 1fr; gap: 8px; }
.pay-line { display: grid; grid-template-columns: 80px 1fr auto; gap: 8px; align-items: center; }
.empty { padding: 28px; text-align: center; color: var(--muted); }
.table-wrap { overflow: auto; border-radius: 14px; border: 1px solid var(--line); }
.table-wrap table { border-radius: 0; }
td.clip { max-width: 160px; word-break: break-all; }
.linkish { background: none; color: var(--blue); padding: 0; text-decoration: underline; border-radius: 0; font-weight: 400; }
.linkish.num-gray { color: #9a948a; font-weight: 400; }
.linkish.num-live { color: #1a6fd4; font-weight: 700; }
button.tiny, .btn.tiny { padding: 4px 8px; font-size: 12px; }
button.row-btn { font-size: 17px; padding: 8px 16px; }
button.row-btn.warn { background: var(--red); }
.modal-back { position: fixed; inset: 0; background: rgba(28, 25, 21, 0.45); display: grid; place-items: center; padding: 24px; z-index: 5; }
.modal { width: min(560px, 100%); background: var(--card); border-radius: 16px; padding: 20px; display: grid; gap: 12px; box-shadow: var(--shadow); }
.modal h2 { margin: 0; }
.code-big { font-size: 32px; letter-spacing: 0.12em; font-weight: 700; }
.modal-actions { display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; }
.stack { display: grid; gap: 6px; }
.hint { font-size: 13px; color: var(--muted); margin-top: 8px; }
@media (max-width: 980px) {
  .app { grid-template-columns: 1fr; }
  .side { position: sticky; top: 0; z-index: 2; }
  .side nav { grid-auto-flow: column; overflow: auto; }
  .grid, .form { grid-template-columns: 1fr; }
}
