:root {
  --bg: #f7f5ef;
  --ink: #202225;
  --muted: #70747c;
  --line: #dedbd2;
  --panel: #fffdf8;
  --accent: #0f766e;
  --accent-2: #b45309;
  --danger: #b42318;
  --soft: #e8f3ef;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 0;
}

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

button {
  min-height: 38px;
  border: 0;
  border-radius: 6px;
  padding: 0 14px;
  background: var(--accent);
  color: white;
  cursor: pointer;
}

button.secondary {
  background: #ece8de;
  color: var(--ink);
}

button.danger {
  background: var(--danger);
}

button.icon {
  width: 36px;
  padding: 0;
  background: #ece8de;
  color: var(--ink);
  font-size: 22px;
}

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 300px 1fr;
}

.sidebar {
  border-right: 1px solid var(--line);
  padding: 22px;
  background: #f1eee6;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.brand {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 28px;
  line-height: 1.1;
}

.brand p,
.eyebrow {
  color: var(--muted);
  font-size: 12px;
  margin-top: 5px;
}

.brand span {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 6px 10px;
  font-size: 13px;
  background: var(--panel);
}

label {
  display: grid;
  gap: 7px;
  color: #3c4046;
  font-size: 13px;
}

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

textarea {
  min-height: 80px;
  resize: vertical;
}

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

.sidebar-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.quick-nav {
  display: grid;
  gap: 8px;
  margin-top: auto;
}

.quick-nav button {
  text-align: left;
  background: transparent;
  color: var(--ink);
  border: 1px solid var(--line);
}

.quick-nav button.active {
  background: var(--ink);
  color: white;
  border-color: var(--ink);
}

main {
  min-width: 0;
  padding: 26px;
}

.toolbar {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  align-items: center;
  margin-bottom: 18px;
}

.toolbar h2,
.dialog-head h2 {
  font-size: 24px;
}

.stats {
  display: flex;
  gap: 10px;
}

.stats div {
  min-width: 104px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  padding: 10px 12px;
}

.stats span {
  display: block;
  font-size: 22px;
  font-weight: 700;
}

.stats small {
  color: var(--muted);
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}

.table-wrap {
  overflow: auto;
}

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

th,
td {
  padding: 13px 14px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
  font-size: 14px;
}

th {
  color: var(--muted);
  font-weight: 600;
  background: #faf8f2;
}

tr:hover td {
  background: #f8fbf9;
}

.name-cell strong,
.next-action strong {
  display: block;
}

.subtle {
  color: var(--muted);
  font-size: 12px;
  margin-top: 3px;
}

.pill {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  border-radius: 999px;
  padding: 3px 9px;
  background: var(--soft);
  color: #0d5d57;
  font-size: 12px;
  white-space: nowrap;
}

.status-strategic {
  background: #fff0d9;
  color: #8a4b00;
}

.status-active {
  background: #e8f3ef;
  color: #0d5d57;
}

.status-dormant {
  background: #f2e7e4;
  color: #8a2f24;
}

.row-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

.row-actions button {
  min-height: 32px;
}

dialog {
  width: min(860px, calc(100vw - 30px));
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0;
  background: var(--panel);
  color: var(--ink);
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.25);
}

dialog::backdrop {
  background: rgba(15, 17, 20, 0.42);
}

#contactForm {
  padding: 22px;
}

.dialog-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 18px;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

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

.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 18px;
}

#deleteContact {
  margin-right: auto;
}

.report-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  padding: 16px;
}

.metric,
.report-list {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: #fffefa;
}

.metric strong {
  display: block;
  font-size: 28px;
}

.metric span,
.report-list p {
  color: var(--muted);
  font-size: 13px;
}

.report-list {
  grid-column: span 2;
}

.report-list ul {
  margin: 12px 0 0;
  padding-left: 18px;
}

.report-list li {
  margin: 7px 0;
}

.hidden {
  display: none !important;
}

@media (max-width: 860px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

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

  .stats,
  .sidebar-actions {
    width: 100%;
    grid-template-columns: 1fr;
  }

  .stats {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

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

  .report-list {
    grid-column: span 1;
  }
}
