:root {
  color-scheme: light;
  --bg: #f5f7f4;
  --panel: #ffffff;
  --ink: #172019;
  --muted: #637164;
  --line: #dfe6dc;
  --accent: #2f6b4f;
  --accent-strong: #1f4f39;
  --accent-soft: #e5f1ea;
  --warning: #a25d18;
  --danger: #9d2c2c;
  --shadow: 0 18px 45px rgba(30, 44, 34, 0.08);
}

* {
  box-sizing: border-box;
}

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

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

button {
  cursor: pointer;
}

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

.sidebar {
  border-right: 1px solid var(--line);
  background: #fbfcfa;
  padding: 24px;
  overflow-y: auto;
}

.brand-row,
.top-band,
.panel-heading,
.detail-header,
.timeline-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.eyebrow {
  margin: 0 0 5px;
  color: var(--accent);
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

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

h1 {
  margin-bottom: 0;
  font-size: 1.55rem;
}

h2 {
  max-width: 760px;
  margin-bottom: 0;
  font-size: clamp(1.7rem, 3vw, 3rem);
  line-height: 1.02;
}

h3 {
  margin-bottom: 0;
  font-size: 1.25rem;
}

h4 {
  margin-bottom: 0;
}

.workspace {
  padding: 30px;
  overflow-y: auto;
}

.top-band {
  margin-bottom: 24px;
}

.search-box,
label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 700;
}

.search-box {
  margin: 24px 0 14px;
}

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

textarea {
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(47, 107, 79, 0.14);
}

.action-row,
.filter-row,
.quick-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chip,
.icon-button,
.text-button,
.primary-action,
.secondary-action {
  border: 0;
  border-radius: 8px;
  font-weight: 800;
}

.chip {
  background: #edf2ea;
  color: var(--muted);
  padding: 8px 10px;
  font-size: 0.82rem;
}

.chip.active {
  background: var(--accent);
  color: #fff;
}

.icon-button,
.text-button {
  background: transparent;
  color: var(--accent);
  padding: 8px 10px;
}

.danger {
  color: var(--danger);
}

.primary-action,
.secondary-action {
  padding: 12px 16px;
}

.primary-action {
  background: var(--accent);
  color: #fff;
}

.primary-action:hover,
.secondary-action:hover {
  filter: brightness(0.95);
}

.secondary-action {
  background: var(--accent-soft);
  color: var(--accent-strong);
}

.full-width {
  width: 100%;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 20px;
}

.stats-grid article,
.panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.stats-grid article {
  padding: 18px;
}

.stats-grid span {
  display: block;
  margin-bottom: 4px;
  color: var(--accent-strong);
  font-size: 2rem;
  font-weight: 850;
}

.stats-grid p {
  margin-bottom: 0;
  color: var(--muted);
  font-weight: 700;
}

.editor-grid {
  display: grid;
  grid-template-columns: minmax(360px, 0.92fr) minmax(420px, 1.08fr);
  gap: 20px;
  align-items: start;
}

.panel {
  padding: 20px;
}

#contactForm,
.interaction-form {
  display: grid;
  gap: 16px;
}

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

.field-grid.compact {
  grid-template-columns: 1fr 1fr;
}

.contact-list {
  display: grid;
  gap: 10px;
  margin-top: 18px;
}

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

.contact-card:hover,
.contact-card.active {
  border-color: var(--accent);
  box-shadow: 0 8px 24px rgba(47, 107, 79, 0.12);
}

.contact-card strong {
  display: block;
  margin-bottom: 3px;
}

.contact-card span,
.contact-card small,
#detailMeta,
.timeline-header span {
  color: var(--muted);
}

.contact-card small {
  display: block;
  margin-top: 7px;
  font-weight: 700;
}

.detail-panel {
  min-height: 610px;
}

.empty-state {
  display: grid;
  min-height: 520px;
  align-content: center;
  justify-items: center;
  color: var(--muted);
  text-align: center;
}

.empty-state h3 {
  color: var(--ink);
}

.contact-detail {
  display: grid;
  gap: 18px;
}

.hidden {
  display: none;
}

.quick-link {
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-strong);
  padding: 8px 11px;
  text-decoration: none;
  font-size: 0.84rem;
  font-weight: 800;
}

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

.timeline-item {
  border-left: 3px solid var(--accent);
  border-radius: 0 8px 8px 0;
  background: #f8faf7;
  padding: 12px 14px;
}

.timeline-item header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
  text-transform: capitalize;
}

.timeline-item p {
  margin-bottom: 0;
  white-space: pre-wrap;
}

.empty-list {
  border: 1px dashed var(--line);
  border-radius: 8px;
  color: var(--muted);
  padding: 18px;
  text-align: center;
}

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

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

@media (max-width: 640px) {
  .workspace,
  .sidebar {
    padding: 18px;
  }

  .top-band,
  .brand-row,
  .panel-heading,
  .detail-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .stats-grid,
  .field-grid,
  .field-grid.compact {
    grid-template-columns: 1fr;
  }
}
