:root {
  --brand: #18181b;
  --brand-d: #000000;
  --bg: #f4f4f5;
  --card: #ffffff;
  --ink: #18181b;
  --muted: #71717a;
  --line: #e4e4e7;
  --danger: #18181b;
  --ok: #18181b;
  --warn: #52525b;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  background: var(--bg);
  color: var(--ink);
  font-size: 15px;
  line-height: 1.45;
}
.hidden { display: none !important; }

header#topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 12px;
  background: var(--brand); color: #fff; padding: 10px 14px;
}
.brand { cursor: pointer; white-space: nowrap; }
nav#nav { display: flex; gap: 4px; flex-wrap: wrap; flex: 1; }
nav#nav button, .user button {
  background: transparent; color: #fff; border: 1px solid rgba(255,255,255,.35);
  border-radius: 8px; padding: 5px 10px; cursor: pointer; font-size: 13px;
}
nav#nav button.active, nav#nav button:hover { background: rgba(255,255,255,.18); }
.user { display: flex; align-items: center; gap: 6px; white-space: nowrap; }
.user .name { max-width: 130px; overflow: hidden; text-overflow: ellipsis; }

main { max-width: 900px; margin: 0 auto; padding: 16px 14px 80px; }

.card {
  background: var(--card); border: 1px solid var(--line); border-radius: 12px;
  padding: 14px 16px; margin-bottom: 12px;
}
.muted { color: var(--muted); font-size: 13px; }
.row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.grow { flex: 1; }
.badge {
  display: inline-block; font-size: 11px; padding: 2px 7px; border-radius: 999px;
  background: #f4f4f5; color: #3f3f46; margin-right: 4px;
}
.badge.ok { background: #18181b; color: #ffffff; }
.badge.warn { background: #52525b; color: #ffffff; }
.badge.pending { background: #52525b; color: #ffffff; }
.badge.closed { background: #e4e4e7; color: #52525b; }
.badge.L1, .badge.L2 { background: #18181b; color: #ffffff; }

h1 { font-size: 20px; margin: 0 0 12px; }
h2 { font-size: 16px; margin: 14px 0 8px; }
h3 { font-size: 15px; margin: 0; }

input, select, textarea, button {
  font: inherit; border-radius: 8px;
}
input[type=text], input[type=password], input[type=tel], input[type=number], select, textarea {
  width: 100%; border: 1px solid var(--line); padding: 9px 10px; background: #fff; margin: 0 0 10px;
}
input:focus, select:focus, textarea:focus { border-color: #18181b; outline: none; }
button.primary {
  background: var(--brand); color: #fff; border: none; padding: 10px 16px; cursor: pointer; font-weight: 600;
}
button.primary:hover { background: var(--brand-d); }
button.ghost { background: #fff; border: 1px solid var(--line); padding: 8px 12px; cursor: pointer; }
button.ghost:hover { border-color: #18181b; }
button.danger { background: #fff; border: 1px solid #18181b; color: #18181b; padding: 6px 10px; cursor: pointer; font-weight: 600; }
button.small { padding: 4px 9px; font-size: 13px; }
a { color: #18181b; text-decoration: none; }
a:hover { text-decoration: underline; }

.filters { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 8px; margin-bottom: 12px; }
.filters input, .filters select { margin: 0; }

.auth { max-width: 420px; margin: 8vh auto; }
.auth .card { padding: 22px; }
.tabs { display: flex; gap: 6px; margin-bottom: 14px; }
.tabs button { flex: 1; padding: 9px; border: 1px solid var(--line); background: #fff; cursor: pointer; }
.tabs button.active { background: var(--brand); color: #fff; border-color: var(--brand); }

.chat-box { border: 1px solid var(--line); border-radius: 12px; height: 60vh; display: flex; flex-direction: column; overflow: hidden; }
.chat-msgs { flex: 1; overflow-y: auto; padding: 12px; }
.msg { max-width: 75%; margin: 6px 0; padding: 8px 12px; border-radius: 14px; white-space: pre-wrap; word-break: break-word; }
.msg.mine { margin-left: auto; background: var(--brand); color: #fff; border-bottom-right-radius: 4px; }
.msg.other { background: #e4e4e7; color: var(--ink); border-bottom-left-radius: 4px; }
.chat-input { display: flex; gap: 8px; padding: 10px; border-top: 1px solid var(--line); }
.chat-input input { margin: 0; }

.toast {
  position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%);
  background: #18181b; color: #fff; padding: 10px 16px; border-radius: 10px;
  opacity: 0; pointer-events: none; transition: opacity .2s; z-index: 100; max-width: 90%;
}
.toast.show { opacity: .95; }

.rate { color: #18181b; }
.small-list { list-style: none; padding: 0; margin: 0; }
.small-list li { padding: 8px 0; border-bottom: 1px solid var(--line); }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

.field { margin-bottom: 12px; }
.field > label { display: block; font-size: 12px; color: var(--muted); margin-bottom: 4px; }
.chk-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 6px; }
.chk {
  display: flex; align-items: center; gap: 8px; padding: 8px 10px;
  border: 1px solid var(--line); border-radius: 8px; cursor: pointer; font-size: 14px; background: #fff;
  user-select: none;
}
.chk input { margin: 0; accent-color: #18181b; }
.chk.checked { background: #f4f4f5; border-color: #18181b; }

/* Поддержка проекта (чаевые/пожертвования) */
.btn-channel {
  display: flex; align-items: center; gap: 8px;
  border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px;
  background: #fff; cursor: pointer; text-decoration: none; color: var(--ink);
  font-size: 14px; transition: border-color .15s, background .15s;
}
.btn-channel:hover { border-color: #18181b; background: #f4f4f5; }
.btn-channel code {
  font-size: 13px; color: #18181b; background: #f4f4f5;
  padding: 2px 6px; border-radius: 6px;
}
.support-hint {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  margin-top: 10px; padding: 10px 12px; border-radius: 10px;
  background: #f4f4f5; border: 1px solid #d4d4d8; color: #3f3f46; font-size: 14px;
}

button.fav { background: transparent; border: none; cursor: pointer; font-size: 18px; padding: 2px 4px; line-height: 1; }
img.venue-logo {
  width: 44px; height: 44px; object-fit: cover; border-radius: 10px;
  border: 1px solid var(--line); background: #fff; flex: none;
}
h1 img.venue-logo { width: 40px; height: 40px; vertical-align: middle; margin-right: 6px; border-radius: 10px; }
b.unread {
  display: inline-block; min-width: 18px; margin-left: 6px; padding: 1px 6px;
  border-radius: 999px; background: #18181b; color: #fff; font-size: 11px; text-align: center;
}
table.tbl { width: 100%; border-collapse: collapse; font-size: 14px; }
table.tbl th, table.tbl td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); }
table.tbl th { color: var(--muted); font-weight: 600; }

@media (max-width: 640px) { .two-col { grid-template-columns: 1fr; } }
