:root {
  --accent: #e01b27;
  --accent-dark: #b71720;
  --accent-soft: #fff1f2;
  --ink: #17181a;
  --ink-soft: #2a2c30;
  --muted: #6b6e73;
  --muted-soft: #93969b;
  --line: #e6e7ea;
  --paper: #e7e7e9;
  --panel: #ffffff;
  --panel-alt: #f7f7f8;
  --sidebar: #16171a;
  --sidebar-line: rgba(255, 255, 255, 0.08);
  --sidebar-text: #c7cad1;
  --sidebar-muted: #8b9099;
  --success-bg: #dcfce7;
  --success-fg: #15803d;
  --info-bg: #dbeafe;
  --info-fg: #1d4ed8;
  --neutral-bg: #f1f2f4;
  --neutral-fg: #52565c;
  --danger-bg: #fee2e2;
  --danger-fg: #b91c1c;
  --shadow: 0 18px 48px rgba(23, 24, 26, 0.08);
  --radius-lg: 24px;
  --radius-md: 18px;
  --radius-sm: 12px;
  --sidebar-width: 284px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  background: var(--paper);
  color: var(--ink);
  font-family: "Instrument Sans", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at top right, rgba(224, 27, 39, 0.08), transparent 28%),
    linear-gradient(180deg, #f0f0f2 0%, var(--paper) 100%);
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input,
select,
textarea {
  font: inherit;
}

img {
  max-width: 100%;
  height: auto;
}

h1,
h2,
h3,
h4,
h5,
h6 {
  margin: 0;
  font-family: "Sora", sans-serif;
  letter-spacing: -0.03em;
}

p {
  margin: 0;
}

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: var(--sidebar-width);
  display: flex;
  flex-direction: column;
  gap: 28px;
  padding: 28px 18px 22px;
  background:
    linear-gradient(180deg, rgba(224, 27, 39, 0.16), transparent 18%),
    var(--sidebar);
  color: var(--sidebar-text);
  border-right: 1px solid #26282d;
  z-index: 20;
}

.sidebar::after {
  content: "";
  position: absolute;
  inset: auto 24px 0;
  height: 160px;
  background: linear-gradient(180deg, transparent, rgba(255, 255, 255, 0.04));
  pointer-events: none;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 14px;
  color: #fff;
}

.brand span {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border-radius: 16px;
  background: var(--accent);
  box-shadow: 0 18px 30px rgba(224, 27, 39, 0.28);
  font-family: "Sora", sans-serif;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.12em;
}

.brand strong {
  display: block;
  font-size: 16px;
  line-height: 1;
  letter-spacing: -0.03em;
}

.nav {
  display: grid;
  gap: 6px;
}

.nav a {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 13px 14px;
  border: 1px solid transparent;
  border-radius: 16px;
  color: var(--sidebar-text);
  font-size: 14px;
  font-weight: 600;
  transition:
    transform 0.2s ease,
    border-color 0.2s ease,
    background 0.2s ease,
    color 0.2s ease;
}

.nav a:hover,
.nav a.active {
  transform: translateX(3px);
  color: #fff;
  border-color: rgba(224, 27, 39, 0.28);
  background: linear-gradient(135deg, rgba(224, 27, 39, 0.22), rgba(255, 255, 255, 0.04));
}

.nav i {
  width: 28px;
  font-family: "DM Mono", monospace;
  font-size: 10px;
  font-style: normal;
  color: var(--sidebar-muted);
}

.nav a:hover i,
.nav a.active i {
  color: #ffd5d8;
}

.sidebar-foot {
  margin-top: auto;
  padding: 18px 14px 0;
  border-top: 1px solid var(--sidebar-line);
  font-family: "DM Mono", monospace;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #fff;
}

.sidebar-foot small {
  display: block;
  margin-top: 7px;
  color: var(--sidebar-muted);
  text-transform: none;
  letter-spacing: 0;
  font-family: "Instrument Sans", system-ui, sans-serif;
}

.pulse {
  display: inline-block;
  width: 8px;
  height: 8px;
  margin-right: 8px;
  border-radius: 999px;
  background: #39c275;
  box-shadow: 0 0 0 6px rgba(57, 194, 117, 0.18);
}

.shell {
  min-height: 100vh;
  margin-left: var(--sidebar-width);
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  min-height: 82px;
  padding: 0 34px;
  border-bottom: 1px solid rgba(23, 24, 26, 0.06);
  background: rgba(247, 247, 248, 0.92);
  backdrop-filter: blur(14px);
}

.global-search {
  display: flex;
  align-items: center;
  gap: 16px;
  width: min(560px, 54%);
  padding: 0 18px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.82);
  box-shadow: 0 8px 24px rgba(23, 24, 26, 0.04);
}

.global-search label,
.eyebrow,
.head-note,
.sync strong,
.sync small,
.metric span,
.metric small,
th,
dt,
.readonly,
.back,
.quick-links a,
.pagination,
.login-rule,
.page-kicker {
  font-family: "DM Mono", monospace;
}

.global-search label {
  white-space: nowrap;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--muted);
}

.global-search input {
  flex: 1;
  min-width: 0;
  border: 0;
  background: transparent;
  padding: 15px 0;
  color: var(--ink);
  outline: 0;
}

.global-search input::placeholder {
  color: var(--muted-soft);
}

.global-search kbd {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 4px 8px;
  background: var(--panel-alt);
  font-size: 10px;
  color: var(--muted);
}

.userbox {
  display: flex;
  align-items: center;
  gap: 14px;
}

.userbox > div {
  display: grid;
  gap: 2px;
}

.userbox strong {
  font-size: 14px;
  font-weight: 700;
}

.userbox small {
  color: var(--muted);
  font-size: 12px;
}

.text-button,
.danger-link {
  border: 0;
  background: transparent;
  padding: 0;
  color: inherit;
  cursor: pointer;
}

.text-button {
  font-size: 12px;
  font-weight: 700;
  color: var(--accent);
}

.text-button:hover,
.danger-link:hover {
  text-decoration: underline;
}

.main {
  padding: 34px 30px 56px;
}

.messages {
  display: grid;
  gap: 10px;
  margin-bottom: 18px;
}

.messages p {
  padding: 14px 18px;
  border: 1px solid rgba(224, 27, 39, 0.18);
  border-radius: 14px;
  background: var(--accent-soft);
  color: var(--accent-dark);
  font-size: 14px;
}

.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 26px;
}

.page-head h1 {
  margin-top: 8px;
  font-size: clamp(36px, 4.4vw, 64px);
  line-height: 0.96;
}

.page-head p {
  color: var(--muted);
}

.eyebrow {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--muted);
}

.head-note {
  color: var(--muted);
  font-size: 11px;
}

.sync {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.76);
  box-shadow: var(--shadow);
}

.sync > span {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: #39c275;
  box-shadow: 0 0 0 5px rgba(57, 194, 117, 0.14);
}

.sync-bad > span {
  background: var(--accent);
  box-shadow: 0 0 0 5px rgba(224, 27, 39, 0.14);
}

.sync strong {
  display: block;
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.sync small {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 10px;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.metric {
  position: relative;
  min-height: 152px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 22px 20px;
  border: 1px solid var(--line);
  border-radius: 24px;
  background: var(--panel);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.metric::before {
  content: "";
  position: absolute;
  inset: 0 auto auto 0;
  width: 100%;
  height: 4px;
  background: linear-gradient(90deg, var(--ink), transparent);
  opacity: 0.08;
}

.metric-accent {
  background: linear-gradient(135deg, #fff 0%, #fff5f6 100%);
  border-color: rgba(224, 27, 39, 0.14);
}

.metric-accent::before {
  background: linear-gradient(90deg, var(--accent), transparent);
  opacity: 1;
}

.metric span,
.metric small {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.metric span {
  color: var(--muted);
}

.metric strong {
  margin-top: auto;
  font-family: "Sora", sans-serif;
  font-size: 42px;
  line-height: 1;
  letter-spacing: -0.05em;
}

.metric small {
  color: var(--muted-soft);
  line-height: 1.45;
}

.dashboard-grid,
.detail-grid,
.lead-layout {
  display: grid;
  gap: 22px;
}

.dashboard-grid {
  grid-template-columns: 2fr 1fr;
}

.detail-grid,
.lead-layout {
  grid-template-columns: 1.55fr 1fr;
  margin-bottom: 22px;
}

.panel {
  border: 1px solid var(--line);
  border-radius: 24px;
  background: var(--panel);
  box-shadow: var(--shadow);
  padding: 24px;
}

.panel-wide {
  grid-row: span 2;
}

.panel-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 18px;
}

.panel h2 {
  font-size: 22px;
}

.panel-head a,
.subtle-link {
  color: var(--accent);
  font-size: 13px;
  font-weight: 700;
}

.compact-list {
  display: grid;
}

.compact-list > a {
  display: grid;
  grid-template-columns: 72px minmax(120px, 1.2fr) 1fr auto;
  gap: 14px;
  align-items: center;
  padding: 15px 0;
  border-top: 1px solid var(--line);
  transition: color 0.2s ease;
}

.compact-list > a:hover strong,
.compact-list > a:hover b {
  color: var(--accent);
}

.compact-list time,
.compact-list span,
.compact-list small {
  color: var(--muted);
  font-size: 12px;
}

.compact-list strong,
.compact-list b {
  font-size: 13px;
}

.compact-list.stacked > a {
  grid-template-columns: 1fr auto;
}

.empty {
  padding: 28px !important;
  color: var(--muted) !important;
  text-align: center;
}

.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  padding: 16px;
  margin-bottom: 16px;
  border: 1px solid var(--line);
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.7);
  box-shadow: var(--shadow);
}

.filters input,
.filters select,
.form-stack input,
.form-stack select,
.form-stack textarea,
.inline-form select {
  min-width: 150px;
  padding: 11px 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
  color: var(--ink);
  outline: 0;
}

.filters input:focus,
.filters select:focus,
.form-stack input:focus,
.form-stack select:focus,
.form-stack textarea:focus,
.inline-form select:focus {
  border-color: rgba(224, 27, 39, 0.38);
  box-shadow: 0 0 0 4px rgba(224, 27, 39, 0.08);
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 10px 16px;
  border: 1px solid var(--ink);
  border-radius: 999px;
  background: transparent;
  color: var(--ink);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transition:
    transform 0.2s ease,
    border-color 0.2s ease,
    background 0.2s ease,
    color 0.2s ease,
    box-shadow 0.2s ease;
}

.button:hover {
  transform: translateY(-1px);
  border-color: var(--accent);
  color: var(--accent);
}

.button-primary {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
  box-shadow: 0 16px 28px rgba(224, 27, 39, 0.18);
}

.button-primary:hover {
  background: var(--accent-dark);
  color: #fff;
}

.table-wrap {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 24px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

table {
  width: 100%;
  min-width: 900px;
  border-collapse: collapse;
}

th {
  padding: 14px 16px;
  background: var(--panel-alt);
  color: var(--muted);
  font-size: 10px;
  text-align: left;
  text-transform: uppercase;
  letter-spacing: 0.12em;
}

td {
  padding: 15px 16px;
  border-top: 1px solid var(--line);
  font-size: 13px;
  vertical-align: middle;
}

td strong,
td small {
  display: block;
}

td small {
  margin-top: 4px;
  color: var(--muted);
}

.thumb {
  display: grid;
  grid-template-columns: 72px auto;
  gap: 10px;
  align-items: center;
}

.thumb img,
.thumb span {
  width: 72px;
  height: 48px;
  border-radius: 12px;
  object-fit: cover;
  background: var(--panel-alt);
  display: grid;
  place-items: center;
  color: var(--muted);
  font-size: 10px;
}

.mono {
  font-family: "DM Mono", monospace;
}

.badge {
  display: inline-flex !important;
  width: max-content;
  align-items: center;
  padding: 5px 10px;
  border-radius: 999px;
  border: 1px solid transparent;
  font-family: "DM Mono", monospace;
  font-size: 10px;
  text-transform: uppercase;
  white-space: nowrap;
}

.status-new {
  background: var(--accent-soft);
  color: var(--accent-dark);
}

.status-contacted,
.status-following {
  background: var(--info-bg);
  color: var(--info-fg);
}

.status-interested {
  background: var(--success-bg);
  color: var(--success-fg);
}

.status-not_interested,
.status-closed {
  background: var(--neutral-bg);
  color: var(--neutral-fg);
}

.status-spam,
.status-duplicate {
  background: var(--danger-bg);
  color: var(--danger-fg);
}

.pagination {
  display: flex;
  justify-content: center;
  gap: 20px;
  padding: 18px;
  color: var(--muted);
  font-size: 11px;
}

.back {
  display: inline-block;
  margin-bottom: 16px;
  color: var(--accent);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.detail-head {
  align-items: center;
}

.head-actions,
.quick-links,
.privacy-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.quick-links a {
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--panel);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.readonly {
  display: inline-flex;
  align-items: center;
  padding: 8px 12px;
  border-radius: 999px;
  background: var(--neutral-bg);
  color: var(--muted);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.hero-car,
.hero-placeholder {
  width: 100%;
  aspect-ratio: 16 / 9;
  border-radius: 20px;
}

.hero-car {
  object-fit: cover;
}

.hero-placeholder {
  display: grid;
  place-items: center;
  background: var(--panel-alt);
  color: var(--muted);
}

.gallery {
  display: flex;
  gap: 10px;
  margin-top: 12px;
  overflow: auto;
}

.gallery img {
  width: 104px;
  height: 70px;
  border-radius: 14px;
  object-fit: cover;
}

.facts dl,
.contact-data {
  display: grid;
  grid-template-columns: 1fr 1fr;
  margin-top: 18px;
}

.facts dl div,
.contact-data div {
  padding: 14px 0;
  border-top: 1px solid var(--line);
}

dt {
  color: var(--muted);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

dd {
  margin: 6px 0 0;
  font-size: 14px;
  font-weight: 600;
}

.contact-data .full {
  grid-column: 1 / -1;
}

.linked-object {
  padding-top: 20px;
  border-top: 1px solid var(--line);
}

.linked-object > span {
  color: var(--muted);
  font-family: "DM Mono", monospace;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.linked-object a {
  display: block;
  margin-top: 10px;
  padding: 18px;
  border-radius: 18px;
  background: linear-gradient(135deg, var(--ink) 0%, var(--ink-soft) 100%);
  color: #fff;
}

.linked-object small {
  display: block;
  margin-top: 6px;
  color: #b4b7bf;
}

.action-panel,
.notes {
  margin-bottom: 16px;
}

.current-status {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 16px 0;
}

.inline-form {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  margin-top: 8px;
}

.form-stack {
  display: grid;
  gap: 14px;
}

.form-stack label {
  display: grid;
  gap: 8px;
  font-size: 12px;
  font-weight: 700;
}

.form-stack .errorlist,
.form-stack .helptext {
  color: var(--muted);
  font-size: 11px;
}

.note-form {
  margin-top: 14px;
}

.notes article {
  padding: 13px 0;
  border-top: 1px solid var(--line);
}

.notes article p {
  margin: 0 0 7px;
  font-size: 13px;
}

.notes article small {
  color: var(--muted);
  font-size: 11px;
}

.danger-link {
  color: var(--accent);
  font-size: 12px;
  font-weight: 700;
}

.timeline {
  margin-top: 22px;
}

.timeline > div:not(.panel-head) {
  display: grid;
  grid-template-columns: 12px 140px 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 14px 0;
  border-top: 1px solid var(--line);
  font-size: 12px;
}

.timeline i {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: var(--accent);
  box-shadow: 0 0 0 5px rgba(224, 27, 39, 0.12);
}

.form-panel {
  max-width: 760px;
}

.login-page {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  background: linear-gradient(180deg, #ececee 0%, var(--paper) 100%);
}

.login-story {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 18px;
  padding: 54px 7vw;
  background:
    radial-gradient(circle at top left, rgba(224, 27, 39, 0.22), transparent 24%),
    linear-gradient(180deg, #17181a 0%, #101114 100%);
  color: #fff;
  overflow: hidden;
}

.login-story::after {
  content: "";
  position: absolute;
  right: -110px;
  bottom: -160px;
  width: 420px;
  height: 420px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow:
    0 0 0 70px rgba(255, 255, 255, 0.03),
    0 0 0 140px rgba(255, 255, 255, 0.02);
}

.brand-dark {
  position: absolute;
  top: 42px;
  left: 7vw;
}

.login-story h1 {
  max-width: 720px;
  font-size: clamp(48px, 6vw, 88px);
  line-height: 0.92;
}

.login-story h1 em {
  color: #ff7b83;
  font-style: normal;
}

.login-story > p:not(.eyebrow) {
  max-width: 480px;
  color: #c4c8cf;
  font-size: 16px;
  line-height: 1.6;
}

.login-rule {
  margin-top: 44px;
  padding-top: 18px;
  border-top: 1px solid rgba(255, 255, 255, 0.14);
  color: #d4d7dd;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.login-rule span {
  margin-right: 14px;
  color: #ff7b83;
}

.login-panel {
  display: grid;
  place-items: center;
  padding: 42px;
}

.login-panel > div {
  width: min(400px, 100%);
  padding: 34px;
  border: 1px solid rgba(23, 24, 26, 0.06);
  border-radius: 30px;
  background: rgba(255, 255, 255, 0.82);
  box-shadow: 0 28px 56px rgba(23, 24, 26, 0.08);
  backdrop-filter: blur(14px);
}

.login-panel h2 {
  margin: 8px 0 10px;
  font-size: 38px;
}

.muted {
  color: var(--muted);
  font-size: 13px;
}

.login-panel .form-stack {
  margin: 30px 0 18px;
}

.login-panel input {
  width: 100%;
}

.center-card {
  width: min(520px, 92%);
  margin: 10vh auto;
  padding: 40px;
  border: 1px solid var(--line);
  border-radius: 28px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.menu-button {
  display: none;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  padding: 10px 14px;
  font-size: 12px;
  font-weight: 700;
}

@media (max-width: 1200px) {
  .metric-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .dashboard-grid,
  .detail-grid,
  .lead-layout {
    grid-template-columns: 1fr;
  }

  .panel-wide {
    grid-row: auto;
  }
}

@media (max-width: 840px) {
  .sidebar {
    transform: translateX(-100%);
    transition: transform 0.25s ease;
  }

  .sidebar.is-open {
    transform: translateX(0);
  }

  .shell {
    margin-left: 0;
  }

  .menu-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  .topbar {
    padding: 0 16px;
  }

  .global-search {
    display: none;
  }

  .main {
    padding: 24px 16px 42px;
  }

  .page-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .metric-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .login-page {
    grid-template-columns: 1fr;
  }

  .login-story {
    min-height: 46vh;
    padding: 40px 24px;
  }

  .brand-dark {
    position: static;
  }

  .login-story h1 {
    font-size: 50px;
  }

  .login-panel {
    padding: 24px;
  }

  .login-panel > div {
    padding: 28px 24px;
  }

  .facts dl,
  .contact-data {
    grid-template-columns: 1fr;
  }

  .compact-list > a {
    grid-template-columns: 54px 1fr;
  }

  .compact-list > a span,
  .compact-list > a b,
  .compact-list > a time:last-child {
    display: none;
  }

  .timeline > div:not(.panel-head) {
    grid-template-columns: 12px 1fr;
  }
}

@media (max-width: 560px) {
  .metric-grid {
    grid-template-columns: 1fr;
  }

  .filters {
    padding: 14px;
  }

  .filters input,
  .filters select,
  .button {
    width: 100%;
  }

  .inline-form {
    grid-template-columns: 1fr;
  }

  .head-actions,
  .quick-links,
  .privacy-actions {
    width: 100%;
  }

  .button,
  .quick-links a {
    justify-content: center;
  }
}
