/* TImmins Tech CRM — custom styles layered on Bootstrap 5 */

:root {
  --crm-sidebar-width: 220px;
  --crm-sidebar-bg: #f7f7f5;
  --crm-sidebar-border: #e8e8e4;
  --crm-topbar-bg: #ffffff;
  --crm-topbar-border: #e8e8e4;
  --crm-body-bg: #f3f3f0;
  --crm-card-bg: #ffffff;
  --crm-text-muted: #6c757d;
  --crm-accent: #0d6efd;
}

/* ── Layout ───────────────────────────────────────────────── */
html, body { height: 100%; }

.crm-wrapper {
  display: flex;
  min-height: 100vh;
  background: var(--crm-body-bg);
}

/* ── Sidebar ──────────────────────────────────────────────── */
.crm-sidebar {
  width: var(--crm-sidebar-width);
  min-height: 100vh;
  background: var(--crm-sidebar-bg);
  border-right: 1px solid var(--crm-sidebar-border);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}

.crm-sidebar .brand {
  padding: 1.1rem 1.1rem 0.9rem;
  font-size: 15px;
  font-weight: 600;
  color: #1a1a1a;
  border-bottom: 1px solid var(--crm-sidebar-border);
  display: flex;
  align-items: center;
  gap: 8px;
}

.crm-sidebar .brand svg,
.crm-sidebar .brand i {
  opacity: 0.7;
}

.crm-nav {
  padding: 0.5rem 0;
  flex: 1;
}

.crm-nav-link {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 0.5rem 1.1rem;
  font-size: 13.5px;
  color: #555;
  text-decoration: none;
  border-left: 2px solid transparent;
  transition: all 0.12s;
}

.crm-nav-link:hover {
  color: #1a1a1a;
  background: rgba(0,0,0,0.04);
}

.crm-nav-link.active {
  color: #1a1a1a;
  background: #fff;
  border-left-color: var(--crm-accent);
  font-weight: 500;
}

.crm-nav-link i {
  font-size: 16px;
  width: 18px;
  text-align: center;
}

.crm-nav-section {
  padding: 0.6rem 1.1rem 0.2rem;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: #aaa;
  font-weight: 600;
}

.crm-sidebar-footer {
  padding: 0.75rem 1.1rem;
  border-top: 1px solid var(--crm-sidebar-border);
  font-size: 12px;
  color: var(--crm-text-muted);
}

/* ── Main content ─────────────────────────────────────────── */
.crm-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  overflow-x: hidden;
}

.crm-topbar {
  background: var(--crm-topbar-bg);
  border-bottom: 1px solid var(--crm-topbar-border);
  padding: 0.85rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 100;
}

.crm-topbar h1 {
  font-size: 16px;
  font-weight: 500;
  margin: 0;
}

.crm-content {
  padding: 1.5rem;
}

/* ── Metric cards ─────────────────────────────────────────── */
.crm-metric {
  background: #fff;
  border: 1px solid #eee;
  border-radius: 8px;
  padding: 1rem 1.1rem;
}

.crm-metric .label {
  font-size: 12px;
  color: var(--crm-text-muted);
  margin-bottom: 5px;
  font-weight: 500;
}

.crm-metric .value {
  font-size: 26px;
  font-weight: 600;
  line-height: 1.1;
}

.crm-metric .sub {
  font-size: 11px;
  color: #aaa;
  margin-top: 3px;
}

/* ── Tables ───────────────────────────────────────────────── */
.crm-table {
  background: #fff;
  border-radius: 8px;
  border: 1px solid #eee;
  overflow: hidden;
}

.crm-table table {
  margin: 0;
}

.crm-table thead th {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--crm-text-muted);
  background: #fafafa;
  border-bottom: 1px solid #eee;
  padding: 10px 14px;
  white-space: nowrap;
}

.crm-table tbody td {
  padding: 11px 14px;
  vertical-align: middle;
  font-size: 13.5px;
  border-color: #f0f0f0;
}

.crm-table tbody tr:last-child td { border-bottom: none; }
.crm-table tbody tr:hover td { background: #fafaf8; cursor: pointer; }

/* ── Avatar ───────────────────────────────────────────────── */
.crm-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 600;
  flex-shrink: 0;
}

/* ── Renewal cards ────────────────────────────────────────── */
.renewal-card {
  background: #fff;
  border: 1px solid #eee;
  border-radius: 8px;
  padding: 0.75rem 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  transition: background 0.12s;
  cursor: pointer;
  text-decoration: none;
  color: inherit;
}

.renewal-card:hover { background: #fafaf8; color: inherit; }
.renewal-card.urgent { border-color: #f5b5b5; }

.renewal-card .rc-left { display: flex; align-items: center; gap: 10px; }
.renewal-card .rc-info h6 { font-size: 13px; font-weight: 500; margin: 0 0 2px; }
.renewal-card .rc-info p  { font-size: 12px; color: var(--crm-text-muted); margin: 0; }

/* ── Search toolbar ───────────────────────────────────────── */
.crm-toolbar {
  display: flex;
  gap: 8px;
  margin-bottom: 1rem;
  flex-wrap: wrap;
  align-items: center;
}

.crm-toolbar .form-control,
.crm-toolbar .form-select {
  font-size: 13px;
  padding: 6px 10px;
  border-color: #ddd;
}

.crm-toolbar .form-control { max-width: 280px; }
.crm-toolbar .form-select  { max-width: 160px; }

/* ── Alert banner ─────────────────────────────────────────── */
.crm-alert {
  font-size: 13px;
  border-radius: 8px;
}

/* ── Section header ───────────────────────────────────────── */
.crm-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.65rem;
}

.crm-section-header h2 {
  font-size: 14px;
  font-weight: 500;
  margin: 0;
}

/* ── Buttons (size tweaks) ────────────────────────────────── */
.btn-xs { padding: 3px 8px; font-size: 12px; }

/* ── Login page ───────────────────────────────────────────── */
.crm-login-wrap {
  min-height: 100vh;
  background: var(--crm-body-bg);
  display: flex;
  align-items: center;
  justify-content: center;
}

.crm-login-card {
  background: #fff;
  border: 1px solid #eee;
  border-radius: 12px;
  padding: 2.5rem 2rem;
  width: 360px;
  max-width: 95vw;
}

.crm-login-card .brand {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 1.5rem;
  text-align: center;
}

/* ── Tags ─────────────────────────────────────────────────── */
.crm-tag {
  display: inline-block;
  background: #e9ecef;
  color: #495057;
  border-radius: 20px;
  padding: 2px 8px;
  font-size: 11px;
  font-weight: 500;
  margin-right: 3px;
}

/* ── Responsive ───────────────────────────────────────────── */
@media (max-width: 768px) {
  .crm-sidebar { display: none; }
  .crm-metric .value { font-size: 20px; }
}
