:root {
  color-scheme: light;
  --ink: #111111;
  --muted: #6d7b7d;
  --line: #d9dedf;
  --panel: #ffffff;
  --soft: #f6f7f7;
  --soft-strong: #e7ecec;
  --accent: #df1016;
  --accent-dark: #a60d11;
  --brand-black: #050606;
  --blue: #2d5f9a;
  --yellow: #a16a16;
  --red: #df1016;
  --shadow: 0 10px 30px rgba(17, 17, 17, 0.07);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  background: #f1f3f3;
  color: var(--ink);
  font-family: Arial, Helvetica, sans-serif;
  letter-spacing: 0;
}

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

button {
  border: 0;
  border-radius: 6px;
  min-height: 40px;
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

.icon-button {
  width: 40px;
  min-height: 40px;
  border-radius: 999px;
  background: var(--soft-strong);
  color: var(--ink);
  font-size: 24px;
  line-height: 1;
}

.app-shell {
  width: min(1680px, 100%);
  margin: 0 auto;
  padding: 24px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 18px;
  border: 1px solid var(--line);
  border-top: 4px solid var(--accent);
  border-radius: 8px;
  background: #ffffff;
  box-shadow: var(--shadow);
  padding: 18px;
}

.brand-header {
  display: flex;
  align-items: center;
  min-width: 0;
  gap: 18px;
}

.brand-logo {
  width: 186px;
  height: 78px;
  object-fit: contain;
  object-position: left center;
  border-right: 1px solid var(--line);
  padding-right: 18px;
}

.brand-copy {
  min-width: 0;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--accent);
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  color: var(--brand-black);
  font-size: clamp(26px, 3vw, 38px);
  line-height: 1.05;
}

h2 {
  margin-bottom: 4px;
  font-size: 18px;
}

h3 {
  margin-bottom: 10px;
  font-size: 14px;
}

.top-actions {
  display: flex;
  align-items: end;
  gap: 12px;
}

.role-switch {
  min-width: 210px;
}

label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #ffffff;
  color: var(--ink);
  padding: 10px 11px;
  outline: none;
}

textarea {
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.14);
}

.primary {
  background: var(--brand-black);
  color: #ffffff;
  padding: 0 16px;
  font-weight: 700;
}

.primary:hover {
  background: var(--accent);
}

.ghost {
  background: var(--soft-strong);
  color: var(--ink);
  padding: 0 12px;
  font-weight: 700;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(140px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.metric,
.panel,
.lead-column,
.manager-reports,
.report-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.metric {
  padding: 14px;
  border-top: 3px solid var(--accent);
}

.metric span {
  display: block;
  min-height: 18px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.metric strong {
  display: block;
  margin-top: 8px;
  font-size: 30px;
  line-height: 1;
}

.manager-reports {
  margin-bottom: 16px;
  padding: 16px;
}

.report-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(180px, 1fr));
  gap: 12px;
}

.report-card {
  min-height: 220px;
  padding: 14px;
  box-shadow: none;
}

.report-card h3 {
  font-size: 15px;
}

.action-list {
  display: grid;
  gap: 10px;
}

.action-item {
  border-bottom: 1px solid var(--line);
  padding-bottom: 10px;
}

.action-item:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

.action-title {
  margin: 0 0 4px;
  font-size: 13px;
  font-weight: 800;
}

.action-meta {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.workspace {
  display: grid;
  grid-template-columns: 300px minmax(360px, 1fr) minmax(380px, 560px);
  gap: 16px;
  align-items: start;
}

.panel,
.lead-column {
  padding: 16px;
}

.filters-panel,
.detail-panel {
  position: sticky;
  top: 16px;
}

.panel-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

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

.filters {
  display: grid;
  gap: 12px;
}

.report-block {
  margin-top: 22px;
}

.bar-list {
  display: grid;
  gap: 9px;
}

.bar-item {
  display: grid;
  gap: 5px;
}

.bar-line {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.bar-track {
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--soft-strong);
}

.bar-fill {
  height: 100%;
  border-radius: inherit;
  background: var(--brand-black);
}

.sort-pill,
.score-chip,
.status-chip,
.lock-chip {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.sort-pill {
  background: var(--soft-strong);
  color: var(--muted);
}

.lead-list {
  display: grid;
  gap: 10px;
}

.lead-card {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  padding: 14px;
  text-align: left;
}

.lead-card:hover,
.lead-card.is-active {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(223, 16, 22, 0.11);
}

.lead-main {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: start;
}

.lead-title {
  margin: 0 0 4px;
  font-size: 16px;
  font-weight: 800;
}

.lead-meta,
.lead-submeta {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.4;
}

.lead-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 12px;
}

.score-chip {
  background: #f3eeee;
  color: var(--accent-dark);
}

.score-chip.medium {
  background: #f7edda;
  color: var(--yellow);
}

.score-chip.low {
  background: #f6e8e6;
  color: var(--red);
}

.status-chip {
  background: var(--soft);
  color: var(--ink);
}

.empty-state {
  border: 1px dashed var(--line);
  border-radius: 8px;
  padding: 22px;
  background: var(--soft);
  color: var(--muted);
  line-height: 1.5;
}

.detail-heading {
  align-items: start;
}

.lock-chip {
  background: #f6e8e6;
  color: var(--red);
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.wide {
  grid-column: 1 / -1;
}

.questions {
  margin-top: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--soft);
  padding: 14px;
}

.questions ul {
  margin: 0;
  padding-left: 18px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.interaction-box {
  margin-top: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  padding: 14px;
}

.interaction-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.full-button {
  width: 100%;
  margin-top: 12px;
}

.history-list {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

.history-item {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--soft);
  padding: 10px;
}

.history-title {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  margin: 0 0 6px;
  color: var(--ink);
  font-size: 13px;
  font-weight: 800;
}

.history-text {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.4;
}

.contact-actions,
.form-actions {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-top: 14px;
}

.contact-actions button {
  background: #edf1f3;
  color: var(--brand-black);
  font-weight: 700;
  padding: 0 10px;
}

.order-link {
  width: 100%;
  margin-top: 10px;
  border: 1px solid rgba(223, 16, 22, 0.35);
  background: #fff0f0;
  color: var(--accent-dark);
  font-weight: 800;
}

.check-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 14px;
  color: var(--ink);
  font-size: 13px;
}

.check-row input {
  width: 18px;
  height: 18px;
}

.form-message {
  min-height: 22px;
  margin-top: 12px;
  color: var(--accent-dark);
  font-size: 13px;
  font-weight: 700;
}

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

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: none;
  place-items: center;
  padding: 18px;
  background: rgba(24, 33, 31, 0.48);
}

.modal-backdrop.is-open {
  display: grid;
}

.modal-backdrop[hidden] {
  display: none;
}

.modal-panel {
  width: min(760px, 100%);
  max-height: min(880px, 92vh);
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: 0 22px 70px rgba(24, 33, 31, 0.22);
  padding: 18px;
}

.order-modal {
  width: min(860px, 100%);
}

.order-note {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  padding: 18px;
}

.order-note h3 {
  margin-bottom: 12px;
  font-size: 20px;
}

.order-note-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.order-note-field {
  border-bottom: 1px solid var(--line);
  padding: 8px 0;
}

.order-note-field strong {
  display: block;
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 12px;
}

.order-note-field span {
  color: var(--ink);
  font-size: 14px;
}

.order-note-field.wide {
  grid-column: 1 / -1;
}

@media (max-width: 1180px) {
  .workspace {
    grid-template-columns: 280px minmax(340px, 1fr);
  }

  .report-grid {
    grid-template-columns: repeat(2, minmax(220px, 1fr));
  }

  .detail-panel {
    grid-column: 1 / -1;
    position: static;
  }
}

@media (max-width: 760px) {
  .app-shell {
    padding: 14px;
  }

  .topbar,
  .top-actions,
  .workspace,
  .metric-grid,
  .report-grid,
  .form-grid {
    grid-template-columns: 1fr;
  }

  .topbar,
  .top-actions {
    display: grid;
    align-items: stretch;
  }

  .brand-header {
    align-items: start;
    flex-direction: column;
  }

  .brand-logo {
    width: 172px;
    height: 68px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
    padding-right: 0;
    padding-bottom: 10px;
  }

  .metric-grid {
    display: grid;
  }

  .workspace {
    display: grid;
  }

  .filters-panel {
    position: static;
  }

  .contact-actions,
  .form-actions,
  .interaction-grid,
  .order-note-grid {
    grid-template-columns: 1fr;
  }

  .panel-title-row {
    align-items: start;
    flex-direction: column;
  }
}
