:root {
  color-scheme: light;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
  --ink: #202926;
  --muted: #68746f;
  --line: #e2e6e2;
  --surface: #fff;
  --canvas: #f6f7f5;
  --accent: #597568;
}

* {
  box-sizing: border-box;
}

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  background: var(--canvas);
  color: var(--ink);
}

.topbar {
  min-height: 72px;
  padding: 0 clamp(20px, 5vw, 72px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  flex: 0 0 auto;
  color: var(--ink);
  text-decoration: none;
}

.brand-mark {
  width: 29px;
  height: 29px;
  display: grid;
  place-items: center;
  border: 1px solid #9eafa5;
  border-radius: 9px;
  color: var(--accent);
  font-family: Georgia, serif;
  font-size: 17px;
}

.brand-name {
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.08em;
}

.primary-nav {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
}

.primary-nav a {
  padding: 9px 12px;
  border-radius: 7px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 550;
  text-decoration: none;
}

.primary-nav a:hover,
.primary-nav a[aria-current="page"] {
  background: #eef1ed;
  color: var(--ink);
}

.primary-nav a:focus-visible,
.brand:focus-visible,
.workflow-card:focus-visible {
  outline: 3px solid #87a596;
  outline-offset: 3px;
}

.privacy-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 11px;
}

.privacy-dot,
.status-dot,
.health-indicator {
  width: 7px;
  height: 7px;
  flex: 0 0 7px;
  border-radius: 50%;
  background: #97a39c;
}

main {
  width: min(1000px, calc(100% - 40px));
  min-height: calc(100vh - 145px);
  margin: 0 auto;
  padding: 72px 0 64px;
}

.view[hidden] {
  display: none;
}

.eyebrow,
.card-kicker,
.service-kicker {
  color: #78857f;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.14em;
}

.eyebrow {
  margin: 0 0 15px;
}

.eyebrow span {
  padding: 0 5px;
  color: #aab3ae;
}

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

h1 {
  max-width: 720px;
  margin-bottom: 12px;
  color: #26322d;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(36px, 5vw, 50px);
  font-weight: 400;
  letter-spacing: -0.04em;
  line-height: 1.1;
}

.intro {
  max-width: 580px;
  margin-bottom: 34px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.6;
}

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

.workflow-card,
.detail-card,
.empty-panel,
.service-card {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
}

.workflow-card {
  min-height: 210px;
  padding: 20px;
  display: flex;
  flex-direction: column;
  color: inherit;
  text-decoration: none;
  transition: border-color 120ms ease, transform 120ms ease;
}

.workflow-card:hover {
  transform: translateY(-2px);
  border-color: #b8c6be;
}

.card-heading,
.service-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.card-index {
  color: #98a39d;
  font-size: 10px;
  letter-spacing: 0.08em;
}

.status-label {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: #68746f;
  font-size: 10px;
  font-weight: 600;
  white-space: nowrap;
}

.workflow-card .status-dot,
.page-status .status-dot {
  background: #9ba79f;
}

.workflow-card h2,
.detail-card h2,
.empty-panel h2,
.service-card h2 {
  margin: 28px 0 8px;
  color: #26322d;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 23px;
  font-weight: 400;
  letter-spacing: -0.025em;
}

.workflow-card > p,
.detail-card > p:last-child,
.empty-panel > p:last-child,
.service-card > p {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.55;
}

.card-link {
  margin-top: auto;
  padding-top: 18px;
  color: var(--accent);
  font-size: 11px;
  font-weight: 650;
}

.card-link span {
  padding-left: 4px;
}

.service-card {
  margin-top: 18px;
  padding: 17px 19px;
}

.service-heading {
  justify-content: flex-start;
  gap: 10px;
}

.service-card h2 {
  margin: 11px 0 4px;
  font-family: inherit;
  font-size: 13px;
  font-weight: 650;
  letter-spacing: 0;
}

.service-card h3 {
  margin: 0 0 4px;
  color: #46544d;
  font-size: 12px;
  font-weight: 650;
}

.service-card > p {
  font-size: 11px;
}

[data-health="available"] .health-indicator {
  background: #3b8a67;
}

[data-health="unavailable"] .health-indicator {
  background: #ad6a56;
}

[data-health="checking"] .health-indicator {
  background: #b28c49;
}

.page-status {
  margin: -18px 0 22px;
}

.crm-controls,
.crm-tabs {
  display: flex;
  align-items: center;
  gap: 8px;
}

.crm-controls button {
  min-height: 34px;
  padding: 0 12px;
  border: 1px solid #dce2dd;
  border-radius: 7px;
  background: #f2f4f1;
  color: #68746f;
  font: inherit;
  font-size: 11px;
}

.crm-controls button:disabled {
  cursor: not-allowed;
  opacity: 1;
}

.crm-controls {
  justify-content: space-between;
  margin: -18px 0 20px;
  flex-wrap: wrap;
}

.crm-tabs {
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #eef1ed;
}

.crm-tabs button {
  border-color: transparent;
  background: transparent;
}

.crm-tabs button.selected {
  border-color: #dce2dd;
  background: var(--surface);
  color: var(--ink);
}

.crm-controls button.add-contact {
  border-color: #dce2dd;
  background: var(--surface);
  color: #68746f;
}

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

.detail-card,
.empty-panel {
  min-height: 165px;
  padding: 21px;
}

.card-kicker {
  margin: 0;
}

.detail-card h2,
.empty-panel h2 {
  margin: 24px 0 8px;
  font-size: 20px;
}

.empty-panel {
  max-width: 620px;
  min-height: 175px;
}

.empty-panel h2 {
  margin-top: 24px;
}

.email-inbox {
  margin-top: 24px;
}

.email-toolbar {
  min-height: 42px;
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.email-status {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
}

.email-refresh {
  min-height: 36px;
  padding: 0 14px;
  border: 1px solid #dce2dd;
  border-radius: 7px;
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-size: 12px;
  cursor: pointer;
}

.email-layout {
  display: grid;
  grid-template-columns: minmax(220px, 0.72fr) minmax(0, 1.7fr);
  align-items: start;
  gap: 14px;
}

.email-list {
  min-width: 0;
  display: grid;
  align-content: start;
  gap: 8px;
}

.email-message,
.email-detail {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
}

.email-message {
  width: 100%;
  padding: 13px 14px;
  display: grid;
  gap: 5px;
  text-align: left;
  color: var(--ink);
  font: inherit;
  cursor: pointer;
}

.email-message:hover,
.email-message.selected {
  border-color: #aebdb4;
  background: #f2f5f2;
}

.email-message-subject {
  overflow: hidden;
  font-size: 12px;
  font-weight: 650;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.email-message-sender,
.email-message-date {
  overflow: hidden;
  color: var(--muted);
  font-size: 10px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.email-detail {
  min-height: 250px;
  padding: clamp(18px, 3vw, 28px);
}

.email-detail > p {
  margin-bottom: 9px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

.email-detail .email-subject {
  margin: 0 0 16px;
  color: #26322d;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 25px;
  font-weight: 400;
  overflow-wrap: anywhere;
}

.email-detail .email-body {
  margin: 22px 0;
  color: var(--ink);
  font: inherit;
  font-size: 13px;
  line-height: 1.65;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.email-attachments-title {
  margin: 24px 0 10px;
  color: #78857f;
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.email-attachments {
  margin: 0;
  padding-left: 18px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.8;
  overflow-wrap: anywhere;
}

.email-attachments a {
  color: #456b58;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

.email-refresh:focus-visible,
.email-message:focus-visible,
.email-attachments a:focus-visible {
  outline: 3px solid #87a596;
  outline-offset: 3px;
}

footer {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 0 clamp(20px, 5vw, 72px) 22px;
  color: #8b9690;
  font-size: 10px;
  letter-spacing: 0.03em;
}

@media (max-width: 760px) {
  .topbar {
    padding: 16px 20px;
    flex-wrap: wrap;
    gap: 13px 18px;
  }

  .primary-nav {
    order: 3;
    width: 100%;
    justify-content: flex-start;
    overflow-x: auto;
  }

  .primary-nav a {
    padding: 8px 10px;
  }

  .crm-controls {
    align-items: flex-start;
  }

  .crm-tabs {
    max-width: 100%;
    overflow-x: auto;
  }

  main {
    padding-top: 48px;
  }

  .workspace-grid {
    grid-template-columns: 1fr;
  }

  .workflow-card {
    min-height: 176px;
  }

  .email-layout {
    grid-template-columns: 1fr;
  }

  .email-list {
    max-height: 340px;
    overflow-y: auto;
  }
}

@media (max-width: 520px) {
  .privacy-label {
    margin-left: auto;
  }

  .detail-grid {
    grid-template-columns: 1fr;
  }

  footer {
    flex-direction: column;
  }
}
