:root {
  --bg: #f6f4ef;
  --panel: #ffffff;
  --accent: #0b6b53;
  --accent-2: #e2b714;
  --text: #1b1b1b;
  --muted: #666;
  --border: #e0ddd6;
  --shadow: 0 6px 18px rgba(0,0,0,0.08);
  --font: "IBM Plex Sans", "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 18px;
  background: linear-gradient(120deg, #0b6b53, #044036);
  color: #fff;
}

.logo {
  font-weight: 700;
  letter-spacing: 0.5px;
}

.top-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

.search input {
  padding: 6px 10px;
  border-radius: 8px;
  border: 1px solid #1c7e63;
  background: #fff;
}

.btn {
  border: none;
  background: var(--accent-2);
  color: #141414;
  padding: 6px 10px;
  border-radius: 8px;
  cursor: pointer;
  text-decoration: none;
}

.content {
  padding: 16px;
}

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

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

.list-item {
  padding: 8px;
  border-bottom: 1px solid var(--border);
}

.list-item a {
  color: var(--text);
  text-decoration: none;
}

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

.tabs {
  display: flex;
  gap: 8px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 8px;
}

.tab {
  padding: 6px 8px;
  cursor: pointer;
  border-radius: 6px 6px 0 0;
}

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

.snapshot {
  display: flex;
  gap: 8px;
  margin-bottom: 8px;
  flex-wrap: wrap;
}

.snapshot .badge {
  background: #f0f0f0;
  border-radius: 999px;
  padding: 4px 8px;
  font-size: 12px;
}

.modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0,0,0,0.4);
  display: flex;
  justify-content: center;
  align-items: center;
}

.modal.hidden { display: none; }

.modal-content {
  background: #fff;
  width: 480px;
  border-radius: 12px;
  padding: 16px;
  box-shadow: var(--shadow);
}

#cmdk-results .result {
  padding: 6px;
  border-bottom: 1px solid var(--border);
}

.search-results {
  padding: 0 16px;
}

.flash {
  border-radius: 8px;
  padding: 8px 10px;
  margin-bottom: 10px;
  font-size: 13px;
}

.flash-ok {
  background: #e8f8ec;
  color: #0e5e29;
  border: 1px solid #b7e8c6;
}

.flash-error {
  background: #fdecec;
  color: #8f1d1d;
  border: 1px solid #f6c6c6;
}

.inline-form {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  margin: 8px 0 10px;
}

.inline-form input,
.inline-form select,
.stack-form input,
.stack-form select,
.stack-form textarea {
  padding: 6px 8px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: #fff;
  font: inherit;
}

.stack-form {
  display: grid;
  gap: 8px;
  margin: 8px 0 10px;
}

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

.banner {
  background: #fff3cd;
  color: #7a5c00;
  padding: 6px 12px;
  border-bottom: 1px solid var(--border);
}

.timeline-filters {
  margin-bottom: 10px;
}

.filters-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}

.filters-row input,
.filters-row select {
  padding: 6px 8px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: #fff;
}

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

.timeline-meta {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 4px;
}

.event-badge {
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  color: #1b1b1b;
  background: #e8e8e8;
}

.event-badge.status { background: #cfe9ff; }
.event-badge.task { background: #ffe9c7; }
.event-badge.appointment { background: #e9d6ff; }
.event-badge.billing { background: #d4f5de; }
.event-badge.sms { background: #ffe3e3; }
.event-badge.attachment { background: #e0f0ff; }
.event-badge.intake { background: #f8e1c6; }
.event-badge.audit { background: #f3f3f3; }
.event-badge.note { background: #f0f0f0; }

.event-type {
  font-size: 11px;
}

.timeline-summary {
  font-weight: 600;
}

.timeline-note {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}

.timeline-more {
  padding: 8px 0;
}

.chip {
  background: #f0f0f0;
  border-radius: 999px;
  padding: 2px 8px;
  font-size: 11px;
}

.link {
  color: var(--accent);
  text-decoration: none;
  font-size: 12px;
}

@media (max-width: 900px) {
  .split { grid-template-columns: 1fr; }
  .grid-two { grid-template-columns: 1fr; }
}
