:root {
  --blue: #4058a8;
  --blue-dark: #17285f;
  --orange: #ff7f16;
  --ink: #151925;
  --muted: #667085;
  --paper: #f5f7fb;
  --line: #e2e7f0;
  --white: #fff;
  --soft: #eef2ff;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: Lato, system-ui, -apple-system, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--paper);
  line-height: 1.5;
}

a { color: var(--blue); font-weight: 800; text-decoration: none; }
h1, h2, h3 { color: var(--blue-dark); margin: 0 0 12px; line-height: 1.18; letter-spacing: 0; }
h1 { font-size: clamp(28px, 4vw, 42px); }
h2 { font-size: 24px; }
h3 { font-size: 18px; }

.top {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  align-items: center;
  padding: 18px 28px;
  background: var(--white);
  border-bottom: 1px solid var(--line);
}
.top strong { display: block; color: var(--blue-dark); font-size: 20px; }
.top span { color: var(--muted); font-size: 13px; }
.top nav { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.top nav a, .role {
  min-height: 36px;
  display: inline-flex;
  align-items: center;
  padding: 8px 11px;
  border-radius: 7px;
  background: #f2f5fb;
  color: var(--blue-dark);
  font-size: 14px;
}
.role { color: var(--muted); font-weight: 900; }

.app-shell { min-height: 100vh; display: grid; grid-template-columns: 250px minmax(0, 1fr); }
.side {
  position: sticky;
  top: 0;
  height: 100vh;
  background: #080b12;
  color: var(--white);
  padding: 22px 16px;
  display: flex;
  flex-direction: column;
  gap: 22px;
}
.side-brand strong { display: block; font-size: 21px; line-height: 1.15; }
.side-brand span { color: #a9b3c7; font-size: 13px; }
.side nav { display: grid; gap: 8px; }
.side nav a {
  min-height: 42px;
  display: flex;
  align-items: center;
  padding: 10px 12px;
  border-radius: 7px;
  color: #eef2ff;
  background: rgba(255,255,255,.06);
  font-weight: 900;
}
.side nav a:hover { background: rgba(255,127,22,.18); color: var(--white); }
.app-main { min-width: 0; }

.wrap { width: min(1220px, calc(100% - 32px)); margin: 32px auto; display: grid; gap: 22px; }
.card, .panel {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 24px;
  box-shadow: 0 14px 38px rgba(13, 24, 62, .08);
}
.panel { box-shadow: none; }
.grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.grid3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; }
.profile-grid { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(280px, .8fr); gap: 18px; align-items: start; }
.actions, .table-head, .profile-head {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: flex-start;
  flex-wrap: wrap;
}

.lead { font-size: 18px; color: var(--muted); margin: 0 0 16px; }
.muted { color: var(--muted); }
.small { font-size: 13px; color: var(--muted); }
.eyebrow { margin: 0 0 4px; color: var(--orange); font-weight: 900; text-transform: uppercase; font-size: 12px; letter-spacing: 0; }
.notice { border-left: 5px solid var(--blue); background: var(--soft); padding: 14px; border-radius: 7px; }
.error { border-left-color: #c0392b; background: #fff0ed; }

.payment { border-top: 4px solid var(--orange); }
.payment dl { display: grid; gap: 10px; margin: 16px 0; }
.payment div, .facts div {
  background: var(--paper);
  padding: 12px;
  border-radius: 7px;
}
.payment dt, .facts span, .stat span {
  font-size: 12px;
  color: var(--muted);
  font-weight: 900;
  text-transform: uppercase;
}
.payment dd { margin: 4px 0 0; font-weight: 900; color: var(--blue-dark); word-break: break-word; }

form, .form-section { display: grid; gap: 14px; }
.form-section {
  padding: 18px 0;
  border-top: 1px solid var(--line);
}
fieldset.form-section { border-right: 0; border-left: 0; border-bottom: 0; margin: 0; }
legend { color: var(--blue-dark); font-size: 18px; font-weight: 900; padding-right: 12px; }
.field span { display: block; font-weight: 900; margin-bottom: 6px; color: var(--blue-dark); }
input, textarea, select {
  width: 100%;
  min-height: 44px;
  border: 1px solid #cfd7e6;
  border-radius: 7px;
  padding: 10px 12px;
  font: inherit;
  background: var(--white);
}
textarea { min-height: 100px; resize: vertical; }
.checks { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px 16px; }
.checks label, .consent, .toggle {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  color: var(--ink);
}
.checks input, .consent input, .toggle input { width: auto; min-height: 0; margin-top: 5px; }

.btn, button {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  min-height: 44px;
  padding: 11px 18px;
  border: 0;
  border-radius: 7px;
  background: var(--orange);
  color: var(--white);
  font-weight: 900;
  cursor: pointer;
  font: inherit;
}
.btn.secondary { background: var(--blue); color: var(--white); }
.btn.ghost { background: #f2f5fb; color: var(--blue-dark); }
button.danger, .btn.danger { background: #b42318; color: var(--white); }
.small-btn { min-height: 34px; padding: 7px 10px; font-size: 13px; }

.filters {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  align-items: end;
}
.filter-actions, .inline-form { display: flex; gap: 10px; align-items: end; flex-wrap: wrap; }
.inline-form { margin: 0; }
.field.compact { min-width: 170px; }

table { width: 100%; border-collapse: collapse; background: var(--white); border-radius: 8px; overflow: hidden; }
th, td { padding: 12px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
th { background: var(--blue-dark); color: var(--white); }
.table-card { padding: 0; overflow: hidden; }
.table-card .table-head { padding: 20px 24px; }
.table-card table { border-radius: 0; }

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 6px 10px;
  border-radius: 7px;
  background: var(--orange);
  color: var(--white);
  font-size: 13px;
  font-weight: 900;
}
.badge.soft { background: var(--soft); color: var(--blue-dark); }
.facts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin: 18px 0; }
.facts strong { display: block; margin-top: 3px; color: var(--blue-dark); word-break: break-word; }
.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chips span {
  display: inline-flex;
  padding: 7px 10px;
  border-radius: 7px;
  background: #f2f5fb;
  color: var(--blue-dark);
  font-size: 13px;
  font-weight: 800;
}
.chips.compact span { font-size: 12px; padding: 5px 8px; }
.clean-list, .compact-list { margin: 0; padding-left: 18px; }
.compact-list { display: grid; gap: 4px; }

.stat strong {
  display: block;
  margin: 8px 0 2px;
  font-size: 34px;
  line-height: 1;
  color: var(--blue-dark);
}
.stat small { color: var(--muted); }
.quick-links { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; }
.link-card { display: grid; gap: 8px; color: var(--ink); }
.link-card strong { color: var(--blue-dark); font-size: 20px; }
.link-card span { color: var(--muted); font-weight: 500; }
.account-list { display: grid; gap: 16px; }
.account-card { display: grid; gap: 14px; }
.log-details { display: grid; gap: 6px; margin: 0; }
.log-details div { display: grid; grid-template-columns: 130px minmax(0, 1fr); gap: 8px; }
.log-details dt { color: var(--muted); font-size: 12px; font-weight: 900; }
.log-details dd { margin: 0; word-break: break-word; }

.board {
  display: grid;
  grid-template-columns: repeat(4, minmax(240px, 1fr));
  gap: 16px;
  align-items: start;
}
.board-column {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 8px;
  min-height: 300px;
  box-shadow: 0 14px 38px rgba(13, 24, 62, .08);
  overflow: hidden;
}
.board-column header {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
  padding: 14px 16px;
  background: #f2f5fb;
  border-bottom: 1px solid var(--line);
}
.board-column h2 { font-size: 18px; margin: 0; }
.counter {
  min-width: 28px;
  min-height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 7px;
  background: var(--blue-dark);
  color: var(--white);
  font-size: 13px;
  font-weight: 900;
}
.drop-zone { min-height: 220px; display: grid; align-content: start; gap: 10px; padding: 12px; }
.candidate-card {
  border: 1px solid var(--line);
  border-left: 4px solid var(--orange);
  border-radius: 8px;
  background: var(--white);
  padding: 12px;
  cursor: grab;
  display: grid;
  gap: 8px;
}
.candidate-card.dragging { opacity: .55; cursor: grabbing; }
.candidate-head {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: flex-start;
}
.candidate-head strong { color: var(--blue-dark); }
.candidate-head span { color: var(--muted); font-size: 13px; font-weight: 900; white-space: nowrap; }
.candidate-card p { margin: 0; color: var(--muted); font-size: 13px; }
.target-list { margin: 0; padding-left: 18px; display: grid; gap: 4px; font-size: 12px; color: var(--blue-dark); }
.target-list small { display: block; color: var(--muted); }
.target-list .blocked { color: #9a3412; }
.empty { padding: 12px; }

@media (max-width: 900px) {
  .app-shell { grid-template-columns: 1fr; }
  .side { position: static; height: auto; }
  .side nav { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid, .grid3, .profile-grid, .filters, .quick-links, .checks, .facts, .board { grid-template-columns: 1fr; }
  .top { display: block; }
  .top nav { margin-top: 12px; }
  table { display: block; overflow-x: auto; }
}

@media print {
  .top, .side, .actions button, .filters, .quick-links { display: none !important; }
  .app-shell { display: block; }
  body { background: #fff; }
  .card { box-shadow: none; }
  .board { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
