:root {
  --bg: #f3f5f8;
  --ink: #1a2744;
  --muted: #5b677a;
  --line: #d5dce6;
  --primary: #3b82f6;
  --card: #fff;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--ink);
}
header {
  background: #162445;
  color: #fff;
  padding: 12px 22px;
  display: flex;
  gap: 16px;
  align-items: center;
}
header a { color: #cfe0ff; }
header .muted { color: #9aa8c2; font-size: 13px; }
main { padding: 22px; max-width: 1280px; margin: 0 auto; }
h1 { font-size: 22px; font-weight: 600; margin: 0 0 8px; }
h2 { font-size: 16px; margin: 0 0 12px; }
.muted { color: var(--muted); }
.toolbar { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; margin-bottom: 18px; }
.btn {
  display: inline-block;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  border-radius: 8px;
  padding: 9px 16px;
  text-decoration: none;
  cursor: pointer;
  font: inherit;
}
.btn.primary { background: var(--primary); color: #fff; border-color: var(--primary); }
.btn.danger { color: #b91c1c; border-color: #fecaca; background: #fff; }
.btn.danger:hover { background: #fef2f2; }
.btn.compact { padding: 5px 10px; font-size: 12px; }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 18px;
  margin-bottom: 16px;
}
.grid { width: 100%; border-collapse: collapse; background: #fff; border-radius: 12px; overflow: hidden; }
.grid th, .grid td { text-align: left; padding: 10px 12px; border-bottom: 1px solid #eef1f6; font-size: 13px; }
.grid th { background: #eef2f7; font-size: 12px; color: var(--muted); }
.grid tbody tr { cursor: pointer; }
.grid tbody tr:hover { background: #f8fbff; }
.mono { font-family: Consolas, monospace; font-size: 12px; max-width: 220px; overflow: hidden; text-overflow: ellipsis; }
.pill { display: inline-block; font-size: 11px; padding: 2px 8px; border-radius: 999px; margin-right: 4px; }
.pill.ok { background: #dcfce7; color: #166534; }
.pill.wait { background: #fef3c7; color: #92400e; }
.pill.warn { background: #fee2e2; color: #991b1b; }
.split { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 900px) { .split { grid-template-columns: 1fr; } }
.form label, .send label { display: block; font-weight: 600; font-size: 13px; margin: 10px 0 6px; }
.grid tbody tr.static { cursor: default; }
.form input, .send input, .form select, textarea {
  width: 100%;
  min-height: 36px;
  padding: 8px 12px;
  border: 1px solid #d0d5dd;
  border-radius: 8px;
  font: inherit;
}
fieldset { border: 1px solid var(--line); border-radius: 10px; padding: 12px; margin: 14px 0; }
.radio { font-weight: 400; display: flex; gap: 8px; align-items: center; margin: 6px 0; }
.radio input { width: auto; min-height: 0; }
.actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 16px; }
.error { color: #b91c1c; font-weight: 600; }
.ok { color: #15803d; font-weight: 600; }
dl { display: grid; grid-template-columns: 160px 1fr; gap: 6px 12px; margin: 0; }
dt { color: var(--muted); }
dd { margin: 0; }
textarea { font-family: Consolas, monospace; font-size: 12px; }
textarea.key {
  min-height: 8.5em;
  line-height: 1.45;
  padding: 10px 12px 16px;
  overflow: auto;
  overflow-wrap: anywhere;
  word-break: break-all;
  white-space: pre-wrap;
  resize: vertical;
}
.hide { display: none !important; }
.banner { background: #eef4ff; border: 1px solid #bfdbfe; border-radius: 10px; padding: 12px 14px; color: #1a2744; }
.products { display: flex; gap: 12px; margin: 8px 0 16px; }
.prod {
  flex: 1; text-align: left; border: 1px solid var(--line); border-radius: 12px; padding: 14px;
  background: #fff; cursor: pointer; font: inherit; color: inherit;
}
.prod.on { border-color: var(--primary); background: #f8fbff; }
.prod b { display: block; margin-bottom: 4px; }
.prod span { color: var(--muted); font-size: 12px; }
.packs { display: flex; gap: 8px; flex-wrap: wrap; margin: 8px 0 12px; }
.pack {
  flex: 1; min-width: 110px; border: 1px solid var(--line); border-radius: 10px; padding: 12px 8px;
  background: #fff; cursor: pointer; font: inherit; color: inherit;
}
.pack.on { border-color: var(--primary); background: #f8fbff; box-shadow: 0 0 0 1px var(--primary); }
.pack strong { display: block; font-size: 22px; margin: 4px 0; }
.pack span { color: var(--muted); font-size: 11px; }
.tranches { margin: 8px 0 12px; }
.chip {
  display: inline-block; border: 1px solid var(--line); background: #fff; border-radius: 8px;
  padding: 8px 12px; margin: 0 8px 8px 0; cursor: pointer; font: inherit;
}
.chip.on { border-color: var(--primary); background: #f8fbff; font-weight: 600; }
.custom { background: #f8fafc; border: 1px dashed var(--line); border-radius: 10px; padding: 12px; margin: 10px 0; }
.summary { background: #eef4ff; border-radius: 8px; padding: 10px 12px; font-size: 13px; }
.narrow { max-width: 460px; margin: 40px auto; }
header .user { margin-left: auto; display: flex; gap: 12px; align-items: center; }
form.inline { display: inline-flex; gap: 6px; align-items: center; margin: 0; }
form.inline input { min-height: 30px; padding: 4px 8px; border: 1px solid #d0d5dd; border-radius: 8px; font: inherit; font-size: 12px; width: 170px; }
.row-actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
button.link { background: none; border: none; color: #cfe0ff; cursor: pointer; font: inherit; padding: 0; text-decoration: underline; }
