/* YOGABOM CRM — стили интерфейса */
:root {
  --bg: #f1f5f9;
  --card: #ffffff;
  --ink: #0f172a;
  --muted: #64748b;
  --line: #e2e8f0;
  --brand: #7c3aed;
  --brand-dark: #5b21b6;
  --accent: #0ea5e9;
  --ok: #16a34a;
  --warn: #d97706;
  --bad: #dc2626;
  --sidebar: #1e1b2e;
  --sidebar-ink: #c7c3dd;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(15, 23, 42, .06), 0 4px 14px rgba(15, 23, 42, .05);
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font: 15px/1.5 "Segoe UI", system-ui, -apple-system, sans-serif;
  background: var(--bg); color: var(--ink);
}
a { color: var(--brand-dark); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 24px; margin: 0; }
h2 { font-size: 16px; margin: 0 0 10px; }
h2.mt { margin-top: 22px; }
.muted { color: var(--muted); font-size: 13px; }
.strong { font-weight: 600; }
.mt { margin-top: 12px; }
code, pre { font-family: Consolas, monospace; font-size: 13px; background: #f8fafc; border-radius: 6px; }
pre { padding: 10px 12px; overflow-x: auto; white-space: pre-wrap; }

/* ---------- Каркас ---------- */
.layout { display: flex; min-height: 100vh; }
.sidebar {
  width: 224px; flex-shrink: 0; background: var(--sidebar); color: var(--sidebar-ink);
  display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh;
}
.brand {
  color: #fff; font-weight: 700; font-size: 19px; letter-spacing: .12em;
  padding: 20px 20px 6px;
}
.brand-sub { color: var(--brand); font-weight: 400; letter-spacing: .2em; margin-left: 6px; font-size: 14px; }
.sidebar nav { display: flex; flex-direction: column; padding: 10px 10px; gap: 2px; flex: 1; }
.sidebar nav a {
  color: var(--sidebar-ink); padding: 9px 12px; border-radius: 8px; font-size: 14px;
  display: flex; align-items: center; justify-content: space-between;
}
.sidebar nav a:hover { background: rgba(255,255,255,.06); text-decoration: none; color: #fff; }
.sidebar nav a.active { background: var(--brand); color: #fff; }
.nav-sep { font-size: 11px; text-transform: uppercase; letter-spacing: .1em; color: #7f7a9d; padding: 14px 12px 4px; }
.badge-count {
  background: var(--bad); color: #fff; border-radius: 10px; font-size: 11px;
  min-width: 18px; height: 18px; display: inline-flex; align-items: center;
  justify-content: center; padding: 0 5px;
}
.sidebar-footer { padding: 14px; border-top: 1px solid rgba(255,255,255,.08); }
.user-chip { color: #fff; font-size: 14px; margin-bottom: 8px; }
.user-chip small { display: block; color: #7f7a9d; font-size: 12px; }

.content { flex: 1; padding: 26px 30px 40px; max-width: 1280px; }
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 18px; flex-wrap: wrap; }
.head-actions { display: flex; align-items: center; gap: 8px; }

/* ---------- Карточки, сетки ---------- */
.card {
  background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 18px 20px; margin-bottom: 16px;
}
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; align-items: start; }
@media (max-width: 1000px) { .grid-2 { grid-template-columns: 1fr; } }
.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 16px; }
@media (max-width: 900px) { .stat-grid { grid-template-columns: repeat(2, 1fr); } }
.stat { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 14px 18px; }
.stat-num { font-size: 24px; font-weight: 700; }
.stat-label { color: var(--muted); font-size: 13px; }

.list-row { display: flex; align-items: center; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--line); }
.list-row:last-child { border-bottom: 0; }
.grow { flex: 1; min-width: 0; }
.time-chip {
  background: #f1ebfe; color: var(--brand-dark); font-weight: 600; font-size: 13px;
  border-radius: 8px; padding: 4px 9px; white-space: nowrap;
}

/* ---------- Кнопки, формы ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 6px; border: 1px solid transparent;
  border-radius: 9px; padding: 8px 14px; font-size: 14px; cursor: pointer;
  background: #e2e8f0; color: var(--ink); text-decoration: none; line-height: 1.2;
}
.btn:hover { text-decoration: none; filter: brightness(.97); }
.btn-primary { background: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-dark); }
.btn-secondary { background: #ede9fe; color: var(--brand-dark); }
.btn-ghost { background: transparent; border-color: var(--line); color: var(--muted); }
.btn-ghost:hover { color: var(--ink); }
.btn-danger { background: #fee2e2; color: var(--bad); }
.btn-sm { padding: 6px 11px; font-size: 13px; }
.btn-xs { padding: 2px 8px; font-size: 12px; }
.btn-block { width: 100%; justify-content: center; }

input, select, textarea {
  font: inherit; color: var(--ink); background: #fff; border: 1px solid var(--line);
  border-radius: 9px; padding: 8px 11px; width: 100%;
}
input:focus, select:focus, textarea:focus { outline: 2px solid #ddd6fe; border-color: var(--brand); }
textarea { resize: vertical; }
label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 10px; }
label input, label select, label textarea { margin-top: 4px; }
.form-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 4px 16px; }
.form-grid .span2 { grid-column: span 2; }
@media (max-width: 800px) { .form-grid { grid-template-columns: 1fr; } .form-grid .span2 { grid-column: span 1; } }
.form-card { max-width: 860px; }
.form-actions { display: flex; gap: 10px; margin-top: 12px; }
.checks { display: flex; flex-wrap: wrap; gap: 4px 16px; }
.check-label { display: inline-flex; align-items: center; gap: 6px; font-size: 14px; color: var(--ink); margin: 0; }
.check-label input { width: auto; margin: 0; }
fieldset { border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; margin: 0 0 12px; }
legend { font-size: 13px; color: var(--muted); padding: 0 6px; }
.inline-form { display: inline-flex; gap: 6px; align-items: center; }
.inline-form input, .inline-form select { width: auto; }

.filter-bar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 14px; }
.filter-bar input, .filter-bar select { width: auto; min-width: 160px; }
.filter-bar.card { padding: 14px 16px; }

/* ---------- Таблицы ---------- */
.table-wrap { overflow-x: auto; padding: 4px 6px; }
table { width: 100%; border-collapse: collapse; }
th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); padding: 8px 10px; border-bottom: 2px solid var(--line); }
td { padding: 9px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
tr:last-child td { border-bottom: 0; }
.row-actions { display: flex; gap: 6px; }

/* ---------- Плашки ---------- */
.pill {
  display: inline-flex; align-items: center; border-radius: 999px; padding: 2px 10px;
  font-size: 12px; font-weight: 600; background: #e2e8f0; color: #334155; white-space: nowrap;
}
.st-lead { background: #fef3c7; color: #92400e; }
.st-contacted { background: #dbeafe; color: #1e40af; }
.st-booked { background: #cffafe; color: #155e75; }
.st-active { background: #dcfce7; color: #166534; }
.st-regular { background: #ede9fe; color: #5b21b6; }
.st-sleeping { background: #ffedd5; color: #9a3412; }
.st-lost { background: #fee2e2; color: #991b1b; }
.bs-booked { background: #cffafe; color: #155e75; }
.bs-attended { background: #dcfce7; color: #166534; }
.bs-noshow { background: #ffedd5; color: #9a3412; }
.bs-cancelled { background: #e2e8f0; color: #475569; }
.pill-red { background: #fee2e2; color: #991b1b; }
.pill-gray { background: #e2e8f0; color: #475569; }
.tag {
  display: inline-flex; background: color-mix(in srgb, var(--tag, #6b7280) 14%, white);
  color: var(--tag, #6b7280); border-radius: 6px; padding: 1px 8px; font-size: 12px;
  font-weight: 600; margin: 1px 3px 1px 0;
}
.pills-cloud .pill { margin: 0 6px 6px 0; }
.overdue { color: var(--bad); font-weight: 600; }
.done-text { text-decoration: line-through; color: var(--muted); }
.check {
  width: 26px; height: 26px; border-radius: 8px; border: 1px solid var(--line);
  background: #fff; color: var(--ok); cursor: pointer; font-size: 14px;
}
.check:hover { background: #f0fdf4; }
.check-done { color: var(--muted); }

/* ---------- Флеш-сообщения ---------- */
.flashes { margin-bottom: 14px; }
.flash { border-radius: 10px; padding: 10px 14px; margin-bottom: 8px; font-size: 14px; box-shadow: var(--shadow); }
.flash-ok { background: #dcfce7; color: #14532d; }
.flash-error { background: #fee2e2; color: #7f1d1d; }

/* ---------- Вход ---------- */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: linear-gradient(135deg, #1e1b2e 0%, #3b2f63 60%, #5b21b6 100%); }
.login-card { background: #fff; border-radius: 16px; box-shadow: 0 20px 60px rgba(0,0,0,.35); padding: 34px 36px; width: 360px; }
.login-brand { font-size: 26px; font-weight: 700; letter-spacing: .12em; }
.login-brand span { color: var(--brand); font-weight: 400; letter-spacing: .2em; margin-left: 6px; font-size: 19px; }
.login-sub { color: var(--muted); font-size: 13px; margin: 4px 0 20px; }
.login-card label { margin-bottom: 4px; }
.login-card .btn { margin-top: 16px; }

/* ---------- Канбан ---------- */
.kanban { display: grid; grid-template-columns: repeat(7, 1fr); gap: 10px; align-items: start; overflow-x: auto; }
@media (max-width: 1200px) { .kanban { grid-template-columns: repeat(4, 1fr); } }
.kanban-col { background: #e8edf4; border-radius: var(--radius); padding: 10px; min-height: 120px; }
.kanban-head {
  font-weight: 700; font-size: 13px; margin-bottom: 10px; display: flex;
  justify-content: space-between; align-items: center; padding: 4px 6px;
}
.kanban-head .count { font-weight: 400; color: var(--muted); }
.kanban-card { background: #fff; border-radius: 10px; box-shadow: var(--shadow); padding: 10px 12px; margin-bottom: 8px; font-size: 13px; }
.kanban-card .strong { display: block; }
.kanban-move { display: flex; gap: 4px; margin-top: 6px; }
.kanban-empty { text-align: center; font-size: 12px; padding: 14px 0; }

/* ---------- Карточка клиента ---------- */
.client-layout { display: grid; grid-template-columns: 1fr 330px; gap: 16px; align-items: start; }
@media (max-width: 1000px) { .client-layout { grid-template-columns: 1fr; } }
.client-top { display: flex; justify-content: space-between; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 10px; }
.contact-row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 8px; }
.note-block { background: #f8fafc; border-left: 3px solid var(--brand); border-radius: 0 8px 8px 0; padding: 8px 12px; margin: 10px 0; font-size: 14px; }
.timeline { border-left: 2px solid var(--line); margin-left: 6px; padding-left: 16px; }
.tl-item { padding: 8px 0; }
.tl-date { font-size: 12px; }
.tl-body { margin-top: 2px; }
.tl-kind {
  display: inline-block; background: #ede9fe; color: var(--brand-dark); font-size: 11px;
  font-weight: 700; text-transform: uppercase; letter-spacing: .05em; border-radius: 5px;
  padding: 1px 7px; margin-right: 8px;
}
.client-side .card { padding: 14px 16px; }
.error-card { max-width: 480px; margin: 60px auto; text-align: center; }
.error-card h1 { font-size: 48px; color: var(--brand); }

/* ---------- Аналитика ---------- */
.chart { display: flex; flex-direction: column; gap: 7px; }
.chart-row { display: grid; grid-template-columns: 56px 1fr 110px; gap: 10px; align-items: center; }
.chart-label { text-align: right; }
.chart-bar-wrap { background: #f1f5f9; border-radius: 6px; height: 20px; overflow: hidden; }
.chart-bar { background: linear-gradient(90deg, var(--brand), #a78bfa); height: 100%; border-radius: 6px; min-width: 2px; }
.bar-alt { background: linear-gradient(90deg, var(--accent), #7dd3fc); }
.chart-value { font-size: 13px; font-weight: 600; white-space: nowrap; }

/* ---------- Прочее ---------- */
.tabs { display: flex; gap: 6px; margin-bottom: 14px; }
.tabs a {
  padding: 7px 16px; border-radius: 999px; font-size: 14px; color: var(--muted);
  background: #e8edf4;
}
.tabs a:hover { text-decoration: none; color: var(--ink); }
.tabs a.active { background: var(--brand); color: #fff; }
.import-box summary { cursor: pointer; font-weight: 600; }
.task-row { align-items: flex-start; }
.event-meta { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.form-layout { display: grid; grid-template-columns: 5fr 7fr; gap: 16px; align-items: start; }
@media (max-width: 1000px) { .form-layout { grid-template-columns: 1fr; } }
