/* Crypto Terminal CRM — светлая тема, деловой стиль (ТЗ 15) */

:root {
  --ct-bg: #f4f6fa;
  --ct-surface: #ffffff;
  --ct-border: #e2e7f0;
  --ct-ink: #1b2233;
  --ct-muted: #5d6880;
  --ct-primary: #1f4ed8;
  --ct-primary-soft: #eaf0ff;
  --ct-accent: #0f9d76;
  --ct-sidebar-w: 236px;
  --ct-topbar-h: 56px;
  --ct-radius: 10px;
  --ct-shadow: 0 1px 2px rgba(20, 30, 60, .06), 0 8px 24px rgba(20, 30, 60, .05);
}

html, body { height: 100%; }

.ct-body {
  background: var(--ct-bg);
  color: var(--ct-ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue",
    "Noto Sans", Arial, sans-serif;
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
}

/* ---------- Topbar ---------- */
.ct-topbar {
  background: var(--ct-surface);
  border-bottom: 1px solid var(--ct-border);
  min-height: var(--ct-topbar-h);
  padding: .25rem .5rem;
  z-index: 1035;
}

.ct-brand { display: flex; align-items: center; gap: .55rem; text-decoration: none; }
.ct-brand-mark {
  display: inline-grid; place-items: center;
  width: 30px; height: 30px; border-radius: 8px;
  background: linear-gradient(135deg, #1f4ed8, #0f9d76);
  color: #fff; font-weight: 700; font-size: 13px; letter-spacing: .5px;
}
.ct-brand-text { font-weight: 600; font-size: 15px; color: var(--ct-ink); line-height: 1.1; }
.ct-brand-text small { display: block; font-size: 10.5px; color: var(--ct-muted); font-weight: 500; letter-spacing: .08em; text-transform: uppercase; }
.ct-search { flex: 1 1 320px; max-width: 460px; }

.ct-avatar {
  display: inline-grid; place-items: center;
  width: 26px; height: 26px; border-radius: 50%;
  background: var(--ct-primary-soft); color: var(--ct-primary);
  font-size: 11px; font-weight: 700;
}

/* ---------- Layout ---------- */
.ct-layout { display: flex; align-items: flex-start; min-height: calc(100vh - var(--ct-topbar-h)); }

.ct-sidebar {
  width: var(--ct-sidebar-w);
  flex: 0 0 var(--ct-sidebar-w);
  background: var(--ct-surface);
  border-right: 1px solid var(--ct-border);
  position: sticky;
  top: var(--ct-topbar-h);
  height: calc(100vh - var(--ct-topbar-h));
  overflow-y: auto;
}
.ct-sidebar-body { display: flex; flex-direction: column; height: 100%; padding: .75rem .5rem; }
.ct-sidebar-footer { margin-top: auto; padding: .75rem .5rem 0; border-top: 1px solid var(--ct-border); }

.ct-nav .nav-link {
  display: flex; align-items: center; gap: .6rem;
  color: var(--ct-muted); border-radius: 8px;
  padding: .5rem .65rem; font-weight: 500; font-size: 13.5px;
}
.ct-nav .nav-link:hover { background: #f1f4fa; color: var(--ct-ink); }
.ct-nav .nav-link.active { background: var(--ct-primary-soft); color: var(--ct-primary); font-weight: 600; }
.ct-nav .nav-link i { font-size: 15px; width: 18px; text-align: center; }

.ct-main { flex: 1 1 auto; min-width: 0; padding: 1.1rem 1.25rem 3rem; }

@media (max-width: 991.98px) {
  .ct-sidebar { position: static; height: auto; }
  .ct-main { padding: .9rem .75rem 2.5rem; }
}

/* ---------- Cards / blocks ---------- */
.ct-card {
  background: var(--ct-surface);
  border: 1px solid var(--ct-border);
  border-radius: var(--ct-radius);
  box-shadow: var(--ct-shadow);
}
.ct-card-header {
  padding: .7rem .95rem;
  border-bottom: 1px solid var(--ct-border);
  display: flex; align-items: center; gap: .5rem; flex-wrap: wrap;
}
.ct-card-header h2, .ct-card-header h3, .ct-card-header h6 { margin: 0; font-size: 14.5px; font-weight: 600; }
.ct-card-body { padding: .95rem; }

.ct-page-head {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 1rem; flex-wrap: wrap; margin-bottom: 1rem;
}
.ct-page-head h1 { font-size: 20px; font-weight: 650; margin: 0; }
.ct-page-head .ct-sub { color: var(--ct-muted); font-size: 13px; margin-top: .15rem; }

/* ---------- KPI ---------- */
.ct-kpi-grid {
  display: grid; gap: .75rem;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
}
.ct-kpi {
  background: var(--ct-surface); border: 1px solid var(--ct-border);
  border-radius: var(--ct-radius); padding: .8rem .9rem; box-shadow: var(--ct-shadow);
}
.ct-kpi-label { font-size: 11.5px; text-transform: uppercase; letter-spacing: .05em; color: var(--ct-muted); font-weight: 600; }
.ct-kpi-value { font-size: 22px; font-weight: 680; line-height: 1.2; margin-top: .25rem; }
.ct-kpi-hint { font-size: 12px; color: var(--ct-muted); margin-top: .1rem; }
.ct-kpi.is-warning { border-color: #ffd9a8; background: #fff9f0; }
.ct-kpi.is-danger { border-color: #ffc9c9; background: #fff5f5; }

/* ---------- Tables ---------- */
.ct-table-wrap { overflow-x: auto; }
.table.ct-table { font-size: 13px; margin-bottom: 0; }
.table.ct-table > thead > tr > th {
  font-size: 11.5px; text-transform: uppercase; letter-spacing: .04em;
  color: var(--ct-muted); font-weight: 650; white-space: nowrap;
  border-bottom: 1px solid var(--ct-border); background: #fafbfe;
  position: sticky; top: 0; z-index: 2;
}
.table.ct-table > tbody > tr > td { vertical-align: middle; }
.table.ct-table a { text-decoration: none; }
.table.ct-table a:hover { text-decoration: underline; }
.ct-nowrap { white-space: nowrap; }
.ct-cell-strong { font-weight: 600; }

/* ---------- Badges ---------- */
.ct-stage-badge {
  display: inline-flex; align-items: center; gap: .3rem;
  padding: .18rem .5rem; border-radius: 999px;
  font-size: 11.5px; font-weight: 600; color: #fff; white-space: nowrap;
}
.ct-chip {
  display: inline-block; padding: .12rem .45rem; border-radius: 6px;
  background: #f1f4fa; color: var(--ct-muted); font-size: 11.5px; font-weight: 600;
}
.ct-chip-danger { background: #fdecec; color: #b42318; }
.ct-chip-warning { background: #fff5e6; color: #a15c07; }
.ct-chip-success { background: #e8f7f1; color: #0a7c5a; }
.ct-chip-info { background: #eaf0ff; color: #1f4ed8; }

/* ---------- Kanban ---------- */
.ct-board { display: flex; gap: .7rem; overflow-x: auto; padding-bottom: 1rem; align-items: flex-start; }
.ct-board-col {
  flex: 0 0 272px; width: 272px;
  background: #eef1f7; border: 1px solid var(--ct-border);
  border-radius: var(--ct-radius); display: flex; flex-direction: column;
  max-height: calc(100vh - 210px);
}
.ct-board-col.is-over { outline: 2px dashed var(--ct-primary); outline-offset: -3px; background: #e6ecfb; }
.ct-board-head {
  padding: .55rem .6rem; border-bottom: 1px solid var(--ct-border);
  display: flex; align-items: center; justify-content: space-between; gap: .4rem;
  position: sticky; top: 0; background: #eef1f7; border-radius: var(--ct-radius) var(--ct-radius) 0 0;
}
.ct-board-title { font-size: 12.5px; font-weight: 650; display: flex; align-items: center; gap: .4rem; }
.ct-board-dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; }
.ct-board-list { padding: .5rem; overflow-y: auto; display: flex; flex-direction: column; gap: .45rem; min-height: 60px; }
.ct-lead-card {
  background: #fff; border: 1px solid var(--ct-border); border-radius: 8px;
  padding: .55rem .6rem; cursor: grab; box-shadow: 0 1px 1px rgba(20,30,60,.04);
}
.ct-lead-card:hover { border-color: #c7d2e8; }
.ct-lead-card.is-dragging { opacity: .45; }
.ct-lead-card .ct-lead-name { font-weight: 600; font-size: 13px; display: block; color: var(--ct-ink); text-decoration: none; }
.ct-lead-card .ct-lead-meta { font-size: 11.5px; color: var(--ct-muted); margin-top: .25rem; display: flex; gap: .4rem; flex-wrap: wrap; }

/* ---------- Timeline ---------- */
.ct-timeline { list-style: none; margin: 0; padding: 0; position: relative; }
.ct-timeline::before {
  content: ""; position: absolute; left: 11px; top: 4px; bottom: 4px;
  width: 2px; background: var(--ct-border);
}
.ct-timeline-item { position: relative; padding: 0 0 .9rem 2rem; }
.ct-timeline-dot {
  position: absolute; left: 4px; top: 3px; width: 16px; height: 16px;
  border-radius: 50%; background: #fff; border: 2px solid var(--ct-primary);
  display: grid; place-items: center; font-size: 8px; color: var(--ct-primary);
}
.ct-timeline-item.is-system .ct-timeline-dot { border-color: #adb5c4; color: #adb5c4; }
.ct-timeline-head { display: flex; align-items: baseline; gap: .5rem; flex-wrap: wrap; }
.ct-timeline-type { font-weight: 600; font-size: 13px; }
.ct-timeline-time { font-size: 11.5px; color: var(--ct-muted); }
.ct-timeline-body { font-size: 13px; margin-top: .2rem; white-space: pre-wrap; }

/* ---------- Misc ---------- */
.ct-empty { text-align: center; padding: 2.2rem 1rem; color: var(--ct-muted); }
.ct-empty i { font-size: 26px; display: block; margin-bottom: .5rem; opacity: .6; }

.ct-filter-bar { display: flex; gap: .5rem; flex-wrap: wrap; align-items: flex-end; }
.ct-filter-bar .form-label { font-size: 11.5px; font-weight: 600; color: var(--ct-muted); margin-bottom: .15rem; }

.ct-login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 1.5rem; background:
  radial-gradient(1000px 500px at 15% -10%, #e5ecff 0%, transparent 60%),
  radial-gradient(900px 520px at 95% 110%, #e3f6ef 0%, transparent 60%), var(--ct-bg); }
.ct-login-card { width: 100%; max-width: 408px; }

.ct-tabs .nav-link { font-size: 13px; font-weight: 600; color: var(--ct-muted); }
.ct-tabs .nav-link.active { color: var(--ct-primary); }

.ct-def-list { display: grid; grid-template-columns: minmax(130px, 38%) 1fr; gap: .35rem .75rem; font-size: 13px; }
.ct-def-list dt { color: var(--ct-muted); font-weight: 500; }
.ct-def-list dd { margin: 0; font-weight: 500; word-break: break-word; }

.ct-progress-thin { height: 6px; }
.ct-mono { font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, monospace; font-size: 12px; }

.ct-bar-row { display: flex; align-items: center; gap: .5rem; }
.ct-bar { flex: 1 1 auto; height: 10px; background: #eef1f7; border-radius: 999px; overflow: hidden; }
.ct-bar > span { display: block; height: 100%; background: var(--ct-primary); border-radius: 999px; }

.ct-calendar { width: 100%; table-layout: fixed; font-size: 12.5px; }
.ct-calendar th { text-align: center; font-size: 11px; text-transform: uppercase; color: var(--ct-muted); padding: .35rem; }
.ct-calendar td { border: 1px solid var(--ct-border); height: 94px; vertical-align: top; padding: .3rem; }
.ct-calendar td.out-month { background: #fafbfe; color: #aab3c5; }
.ct-calendar td.is-today { outline: 2px solid var(--ct-primary); outline-offset: -2px; }
.ct-calendar .ct-cal-day { font-weight: 650; font-size: 11.5px; }
.ct-calendar .ct-cal-task { display: block; font-size: 11px; padding: .1rem .25rem; border-radius: 4px; background: var(--ct-primary-soft); color: var(--ct-primary); margin-top: .15rem; text-decoration: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ct-calendar .ct-cal-task.is-overdue { background: #fdecec; color: #b42318; }

.ct-required::after { content: " *"; color: #dc3545; }

table.ct-table tbody tr.is-overdue td { background: #fff7f7; }
table.ct-table tbody tr.is-soon td { background: #fffbf2; }

.ct-copy-area { font-family: inherit; font-size: 13px; min-height: 160px; }

/* Печать отчётов */
@media print {
  .ct-topbar, .ct-sidebar, .ct-no-print { display: none !important; }
  .ct-main { padding: 0; }
  .ct-card { box-shadow: none; border-color: #ccc; }
}
