:root {
  --ink: #12131a;
  --paper: #f6f1e8;
  --orange: #f58231;
  --orange-dark: #d96a1c;
  --line: rgba(18, 19, 26, 0.14);
  --muted: #6b6770;
  --panel: #fffdf9;
  --shadow: 4px 4px 0 var(--ink);
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body.crm {
  font-family: Manrope, system-ui, sans-serif;
  background:
    radial-gradient(circle at 12% -10%, rgba(245, 130, 49, 0.16), transparent 42%),
    linear-gradient(180deg, #f8f3ea 0%, var(--paper) 55%, #efe8db 100%);
  color: var(--ink);
}
h1, h2 { font-family: Syne, Manrope, sans-serif; letter-spacing: -0.03em; margin: 0; }
a { color: inherit; }
button, input, select, textarea { font: inherit; }

.crm-main { width: min(1120px, calc(100% - 40px)); margin: 0 auto; padding: 28px 0 64px; }
.crm-eyebrow {
  margin: 0 0 8px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--orange-dark);
}
.crm-lede { margin: 8px 0 0; color: var(--muted); line-height: 1.5; }
.crm-flash {
  margin: 0 0 18px;
  padding: 14px 16px;
  border: 2px solid var(--ink);
  border-radius: 14px;
  background: #ffe56a;
  font-weight: 750;
}

.crm-top {
  border-bottom: 2px solid var(--ink);
  background: rgba(255, 253, 249, 0.92);
  backdrop-filter: blur(8px);
  position: sticky;
  top: 0;
  z-index: 10;
}
.crm-top__inner {
  width: min(1120px, calc(100% - 40px));
  margin: 0 auto;
  min-height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.crm-brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  font-weight: 800;
}
.crm-brand__mark {
  width: 36px;
  height: 36px;
  display: block;
  object-fit: contain;
  border: 0;
  border-radius: 0;
  background: transparent;
}
.crm-top__meta {
  display: flex;
  align-items: center;
  gap: 14px;
  color: var(--muted);
  font-size: 14px;
}

.crm-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 46px;
  padding: 0 18px;
  border: 2px solid var(--ink);
  border-radius: 999px;
  background: var(--orange);
  color: #fff;
  font-weight: 800;
  box-shadow: var(--shadow);
  cursor: pointer;
  text-decoration: none;
}
.crm-btn--small { min-height: 40px; padding: 0 14px; font-size: 14px; }
.crm-btn--ghost, .crm-ghost {
  background: transparent;
  border: 2px solid var(--ink);
  border-radius: 999px;
  min-height: 40px;
  padding: 0 14px;
  font-weight: 750;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  box-shadow: none;
  color: var(--ink);
}
.crm-btn--ghost { box-shadow: 3px 3px 0 var(--ink); background: var(--panel); }

.crm-login {
  min-height: calc(100vh - 40px);
  display: grid;
  place-items: center;
}
.crm-login__card {
  width: min(440px, 100%);
  padding: 34px;
  border: 2px solid var(--ink);
  border-radius: 24px;
  background: var(--panel);
  box-shadow: 8px 8px 0 var(--ink);
}
.crm-login h1 { font-size: clamp(28px, 5vw, 36px); }

.crm-form { display: grid; gap: 14px; margin-top: 22px; }
.crm-form label { display: grid; gap: 7px; font-size: 13px; font-weight: 750; }
.crm-form input,
.crm-form select,
.crm-form textarea {
  width: 100%;
  min-height: 46px;
  padding: 0 14px;
  border: 2px solid var(--ink);
  border-radius: 12px;
  background: #fff;
}
.crm-check {
  display: flex !important;
  align-items: center;
  gap: 8px;
  font-weight: 650 !important;
}
.crm-check input { width: auto; min-height: auto; }
.crm-error { margin: -6px 0 0; color: #b42318; font-size: 13px; font-weight: 700; }

.crm-dash__head { margin-bottom: 22px; }
.crm-dash h1 { font-size: clamp(34px, 6vw, 48px); }

.crm-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-bottom: 22px;
}
.crm-stat {
  padding: 18px 18px 16px;
  border: 2px solid var(--ink);
  border-radius: 18px;
  background: var(--panel);
  box-shadow: 4px 4px 0 var(--ink);
}
.crm-stat span { display: block; color: var(--muted); font-size: 12px; font-weight: 750; text-transform: uppercase; letter-spacing: 0.06em; }
.crm-stat strong { display: block; margin-top: 8px; font-size: 34px; font-family: Syne, Manrope, sans-serif; letter-spacing: -0.04em; }
.crm-stat--accent { background: var(--orange); color: #fff; }
.crm-stat--accent span { color: rgba(255,255,255,.85); }

.crm-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 18px;
}
.crm-filters input,
.crm-filters select {
  min-height: 42px;
  padding: 0 12px;
  border: 2px solid var(--ink);
  border-radius: 12px;
  background: #fff;
}
.crm-filters input[type="search"] { flex: 1 1 240px; }

.crm-list {
  display: grid;
  gap: 10px;
}
.crm-lead {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  padding: 18px 20px;
  border: 2px solid var(--ink);
  border-radius: 18px;
  background: var(--panel);
  text-decoration: none;
  box-shadow: 3px 3px 0 transparent;
  transition: transform .15s ease, box-shadow .15s ease;
}
.crm-lead:hover { transform: translate(-2px, -2px); box-shadow: 4px 4px 0 var(--ink); }
.crm-lead.is-unread { background: #fff8ef; border-color: var(--orange-dark); }
.crm-lead__title { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.crm-lead__title strong { font-size: 18px; }
.crm-lead p { margin: 6px 0 0; color: var(--muted); }
.crm-lead__preview { color: var(--ink) !important; opacity: 0.8; }
.crm-lead time { color: var(--muted); font-size: 13px; white-space: nowrap; font-weight: 650; }
.crm-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--orange);
  box-shadow: 0 0 0 2px #fff;
}

.crm-badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 9px;
  border: 1.5px solid var(--ink);
  border-radius: 999px;
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  background: #fff;
}
.crm-badge--new { background: #ffe56a; }
.crm-badge--contacted { background: #d7e8ff; }
.crm-badge--won { background: #c8f0d4; }
.crm-badge--archived { background: #ececec; color: var(--muted); }

.crm-empty {
  padding: 48px 24px;
  text-align: center;
  border: 2px dashed var(--ink);
  border-radius: 18px;
  background: rgba(255,255,255,.45);
}
.crm-empty h2 { margin-bottom: 8px; }
.crm-empty p { margin: 0; color: var(--muted); }

.crm-pagination { margin-top: 22px; display: flex; justify-content: center; gap: 10px; }

.crm-back {
  display: inline-flex;
  margin-bottom: 18px;
  font-weight: 750;
  text-decoration: none;
  color: var(--muted);
}
.crm-detail__grid {
  display: grid;
  grid-template-columns: 1.6fr 0.8fr;
  gap: 16px;
  align-items: start;
}
.crm-panel {
  padding: 26px;
  border: 2px solid var(--ink);
  border-radius: 22px;
  background: var(--panel);
  box-shadow: 6px 6px 0 var(--ink);
}
.crm-detail__head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
  margin-bottom: 22px;
}
.crm-detail h1 { font-size: clamp(30px, 5vw, 42px); }
.crm-meta {
  display: grid;
  gap: 14px;
  margin: 0 0 24px;
}
.crm-meta dt { font-size: 11px; font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.crm-meta dd { margin: 4px 0 0; font-weight: 700; }
.crm-meta a { color: var(--orange-dark); }
.crm-message h2 { font-size: 16px; margin-bottom: 10px; }
.crm-message p { margin: 0; white-space: pre-wrap; line-height: 1.6; font-size: 16px; }
.crm-panel--side h2 { font-size: 18px; margin-bottom: 4px; }
.crm-actions { margin-top: 16px; display: grid; gap: 10px; }

@media (max-width: 860px) {
  .crm-stats { grid-template-columns: 1fr 1fr; }
  .crm-detail__grid { grid-template-columns: 1fr; }
  .crm-lead { flex-direction: column; }
}
@media (max-width: 560px) {
  .crm-stats { grid-template-columns: 1fr; }
  .crm-top__meta span { display: none; }
}
