/* СВОИ ГОСТИ CRM — тёмная тема, фирменный голубой #74cfff */
* { margin: 0; padding: 0; box-sizing: border-box; }
:root {
  --bg: #0e1a24;
  --panel: #16283a;
  --panel2: #1d3349;
  --line: #274259;
  --text: #eaf4fb;
  --muted: #7fa3ba;
  --blue: #74cfff;
}
body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  font-size: 14px;
}
.hidden { display: none !important; }

/* ---- вход ---- */
.login-wrap {
  min-height: 100vh;
  display: flex; align-items: center; justify-content: center;
}
.login-card {
  width: 340px; padding: 40px 32px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 16px;
  display: flex; flex-direction: column; gap: 12px;
  text-align: center;
}
.login-card h1 { font-size: 24px; letter-spacing: .12em; }
.login-card h1 span, .brand span { color: var(--blue); }
.login-card .sub { color: var(--muted); font-size: 13px; margin-bottom: 12px; }
.login-card input {
  padding: 12px 14px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--text); font-size: 15px;
}
.login-card input:focus { outline: none; border-color: var(--blue); }
.login-card button {
  margin-top: 6px; padding: 12px;
  background: var(--blue); color: #06283f;
  border: none; border-radius: 10px;
  font-size: 15px; font-weight: 600; cursor: pointer;
}
.error { color: #ff9b9b; font-size: 13px; min-height: 18px; }

/* ---- каркас ---- */
.topbar {
  display: flex; align-items: center; gap: 20px;
  padding: 12px 20px;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 10;
}
.brand { font-weight: 700; letter-spacing: .1em; white-space: nowrap; }
.tabs { display: flex; gap: 6px; overflow-x: auto; flex: 1; }
.tabs button {
  padding: 8px 14px; white-space: nowrap;
  background: transparent; color: var(--muted);
  border: 1px solid transparent; border-radius: 999px;
  cursor: pointer; font-size: 13px;
}
.tabs button.active {
  color: var(--blue);
  border-color: var(--blue);
  background: #74cfff14;
}
.userbox { display: flex; align-items: center; gap: 10px; color: var(--muted); }
.ghost {
  background: transparent; color: var(--muted);
  border: 1px solid var(--line); border-radius: 8px;
  padding: 6px 12px; cursor: pointer;
}

/* ---- доска ---- */
.board {
  display: flex; gap: 12px;
  padding: 16px 20px;
  overflow-x: auto;
  align-items: flex-start;
  min-height: calc(100vh - 57px);
}
.col {
  min-width: 250px; width: 250px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  flex-shrink: 0;
}
.col-head {
  padding: 10px 12px;
  font-weight: 600; font-size: 13px;
  border-bottom: 3px solid var(--stage-color, var(--line));
  display: flex; justify-content: space-between; align-items: center;
}
.col-head .count { color: var(--muted); font-weight: 400; }
.col-body { padding: 8px; display: flex; flex-direction: column; gap: 8px; }
.card {
  background: var(--panel2);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 12px;
  cursor: pointer;
}
.card:hover { border-color: var(--blue); }
.card .name { font-weight: 600; margin-bottom: 4px; }
.card .meta { color: var(--muted); font-size: 12px; line-height: 1.5; }
.card .sum { color: var(--blue); font-weight: 600; font-size: 13px; margin-top: 4px; }
.add-btn {
  margin: 8px; padding: 10px;
  background: transparent; color: var(--muted);
  border: 1px dashed var(--line); border-radius: 10px;
  cursor: pointer; text-align: center;
}
.add-btn:hover { color: var(--blue); border-color: var(--blue); }

/* ---- модалка ---- */
.modal-back {
  position: fixed; inset: 0;
  background: #000a;
  display: flex; align-items: center; justify-content: center;
  z-index: 50;
}
.modal {
  width: min(440px, 92vw);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 22px;
  display: flex; flex-direction: column; gap: 10px;
}
.modal h2 { font-size: 16px; margin-bottom: 6px; }
.modal label { color: var(--muted); font-size: 12px; }
.modal input, .modal select {
  width: 100%; padding: 10px 12px;
  background: var(--bg); color: var(--text);
  border: 1px solid var(--line); border-radius: 8px;
}
.modal .row { display: flex; gap: 10px; }
.modal .row > * { flex: 1; }
.modal .actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 8px; }
.modal .primary {
  background: var(--blue); color: #06283f;
  border: none; border-radius: 8px; padding: 10px 18px;
  font-weight: 600; cursor: pointer;
}

/* ---- деньги в карточке ---- */
.money-grid {
  display: grid; grid-template-columns: 1fr auto;
  gap: 4px 16px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px 14px;
  font-size: 13px;
}
.money-grid span { color: var(--muted); }
.money-grid b { text-align: right; color: var(--blue); }

/* ---- журнал ---- */
.log-toggle { color: var(--muted); cursor: pointer; font-size: 13px; }
.log { max-height: 160px; overflow-y: auto; margin-top: 8px; }
.log-row {
  display: flex; gap: 10px;
  font-size: 12px; color: var(--muted);
  padding: 3px 0; border-bottom: 1px solid var(--line);
}
.modal { max-height: 90vh; overflow-y: auto; }

/* ---- переключатель Сделки / imBox ---- */
.view-switch { display: flex; gap: 4px; background: var(--bg);
  border: 1px solid var(--line); border-radius: 999px; padding: 3px; }
.view-switch button { padding: 6px 14px; border: none; border-radius: 999px;
  background: transparent; color: var(--muted); cursor: pointer; font-size: 13px; }
.view-switch button.active { background: var(--blue); color: #06283f; font-weight: 600; }

/* ---- imBox ---- */
.imbox { display: flex; height: calc(100vh - 57px); }
.conv-list { width: 320px; flex-shrink: 0; overflow-y: auto;
  border-right: 1px solid var(--line); background: var(--panel); }
.conv-item { padding: 12px 14px; border-bottom: 1px solid var(--line); cursor: pointer; }
.conv-item:hover, .conv-item.active { background: var(--panel2); }
.conv-item .top { display: flex; justify-content: space-between; gap: 8px; }
.conv-item .who { font-weight: 600; font-size: 13px; }
.conv-item .when { color: var(--muted); font-size: 11px; white-space: nowrap; }
.conv-item .preview { color: var(--muted); font-size: 12px; margin-top: 4px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.conv-item .badge { display: inline-block; font-size: 10px; padding: 2px 8px;
  border-radius: 999px; background: var(--bg); color: var(--blue);
  border: 1px solid var(--line); margin-top: 6px; margin-right: 4px; }
.chat { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.chat-head { padding: 12px 18px; border-bottom: 1px solid var(--line);
  background: var(--panel); display: flex; justify-content: space-between;
  align-items: center; gap: 10px; }
.chat-head .stage-pill { font-size: 12px; padding: 4px 12px; border-radius: 999px;
  border: 1px solid var(--line); }
.muted { color: var(--muted); }
.chat-body { flex: 1; overflow-y: auto; padding: 18px;
  display: flex; flex-direction: column; gap: 8px; }
.bubble { max-width: 70%; padding: 10px 14px; border-radius: 14px;
  font-size: 14px; line-height: 1.45; white-space: pre-wrap; }
.bubble.in  { align-self: flex-start; background: var(--panel2);
  border: 1px solid var(--line); }
.bubble.out { align-self: flex-end; background: #2b6d96; }
.bubble .stamp { display: block; font-size: 10px; color: #c9e5f5aa;
  margin-top: 4px; text-align: right; }
.chat-form { display: flex; gap: 10px; padding: 12px 18px;
  border-top: 1px solid var(--line); background: var(--panel); }
.chat-form input { flex: 1; padding: 12px 14px; background: var(--bg);
  color: var(--text); border: 1px solid var(--line); border-radius: 10px; }
.chat-form .primary { background: var(--blue); color: #06283f; border: none;
  border-radius: 10px; padding: 0 22px; font-weight: 600; cursor: pointer; }

/* ---- шахматка ---- */
.chess { padding: 16px 20px; }
.chess-toolbar { display: flex; gap: 10px; align-items: center; margin-bottom: 14px; }
.chess-toolbar select, .chess-toolbar input {
  padding: 9px 12px; background: var(--panel); color: var(--text);
  border: 1px solid var(--line); border-radius: 8px; }
.chess-toolbar .primary { background: var(--blue); color: #06283f; border: none;
  border-radius: 8px; padding: 9px 18px; font-weight: 600; cursor: pointer; }
.chess-grid-wrap { overflow-x: auto; border: 1px solid var(--line);
  border-radius: 12px; background: var(--panel); }
.chess-grid { display: grid; font-size: 12px; min-width: max-content; }
.cg-cell { border-right: 1px solid #1d33491f; border-bottom: 1px solid #27425933;
  min-height: 34px; }
.cg-room { position: sticky; left: 0; background: var(--panel); z-index: 2;
  padding: 7px 12px; border-right: 1px solid var(--line); white-space: nowrap; }
.cg-room .cat { color: var(--muted); font-size: 11px; }
.cg-floor { position: sticky; left: 0; grid-column: 1 / -1;
  background: var(--panel2); padding: 6px 12px; font-weight: 600;
  color: var(--blue); z-index: 2; }
.cg-day { padding: 6px 4px; text-align: center; color: var(--muted);
  border-right: 1px solid #27425933; border-bottom: 1px solid var(--line);
  background: var(--panel); position: sticky; top: 0; }
.cg-day.weekend { color: #f0a0a0; }
.cg-booking { grid-row: auto; margin: 3px 2px; padding: 4px 8px;
  border-radius: 6px; background: #2b6d96; color: #fff;
  overflow: hidden; white-space: nowrap; text-overflow: ellipsis;
  cursor: default; font-size: 11px; align-self: stretch; }

/* ---- гости и аналитика ---- */
.guests, .stats { padding: 16px 20px; }
.table { width: 100%; border-collapse: collapse; background: var(--panel);
  border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.table th { text-align: left; color: var(--muted); font-weight: 600;
  font-size: 12px; padding: 10px 14px; border-bottom: 1px solid var(--line); }
.table td { padding: 9px 14px; border-bottom: 1px solid #27425933; }
.stat-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 12px; margin-bottom: 18px; }
.stat-card { background: var(--panel); border: 1px solid var(--line);
  border-radius: 12px; padding: 16px 18px; display: flex;
  flex-direction: column; gap: 6px; }
.stat-card span { color: var(--muted); font-size: 12px; }
.stat-card b { color: var(--blue); font-size: 20px; }
.stat-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.stat-block h3 { font-size: 14px; margin-bottom: 10px; }
.stat-block details { margin-bottom: 8px; }
.stat-block summary { cursor: pointer; padding: 6px 0; color: var(--text); }
a.ghost { text-decoration: none; font-size: 13px; }
@media (max-width: 900px) { .stat-grid { grid-template-columns: 1fr; } }
