:root {
  color-scheme: light;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: #1d2320;
  background: #f5f7f4;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
}

button,
input {
  font: inherit;
}

select,
textarea {
  font: inherit;
}

.login-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background: #e8eee8;
}

.login-panel {
  width: min(420px, 100%);
  background: #ffffff;
  border: 1px solid #dfe6e1;
  border-radius: 8px;
  box-shadow: 0 18px 48px rgba(33, 45, 38, 0.12);
  padding: 28px;
}

.login-brand {
  color: #20362e;
  margin-bottom: 24px;
}

.login-brand span {
  color: #66736c;
}

.login-form {
  display: grid;
  gap: 14px;
}

.login-form label {
  display: grid;
  gap: 6px;
  color: #48554d;
  font-size: 13px;
  font-weight: 700;
}

.login-form input {
  width: 100%;
  height: 42px;
  border: 1px solid #cad5cd;
  border-radius: 8px;
  padding: 0 12px;
  background: #ffffff;
  color: #1d2320;
}

.login-form .primary-button {
  height: 42px;
  justify-content: center;
}

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

.sidebar {
  background: #20362e;
  color: #f8fbf7;
  padding: 24px 18px;
  display: flex;
  flex-direction: column;
  gap: 28px;
}

.brand {
  display: flex;
  gap: 12px;
  align-items: center;
}

.brand-mark {
  width: 44px;
  height: 44px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  background: #dceecf;
  color: #20362e;
  font-weight: 800;
}

.brand strong,
.brand span {
  display: block;
}

.brand span {
  color: #c3d2c8;
  font-size: 13px;
}

nav {
  display: grid;
  gap: 8px;
}

.nav-button {
  min-height: 42px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: #d8e3dc;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 12px;
  cursor: pointer;
  text-align: left;
}

.nav-button:hover,
.nav-button.active {
  background: #314a40;
  color: #ffffff;
}

.nav-button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.main {
  padding: 28px;
  overflow: auto;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 22px;
}

.topbar h1 {
  margin: 0;
  font-size: 28px;
  letter-spacing: 0;
}

.topbar p,
.panel-header p,
td span,
.campaign-row span,
.lead-row span,
.account-row span,
.timeline-item span,
.media-row span,
.fact span {
  margin: 4px 0 0;
  color: #66736c;
  font-size: 13px;
}

.icon-button,
.row-action,
.secondary-button,
.primary-button {
  width: 38px;
  height: 38px;
  border: 1px solid #d6ded8;
  border-radius: 8px;
  background: #ffffff;
  color: #20362e;
  display: inline-grid;
  place-items: center;
  cursor: pointer;
}

.primary-button,
.secondary-button {
  width: auto;
  padding: 0 14px;
  font-weight: 700;
}

.primary-button {
  background: #20362e;
  color: #ffffff;
  border-color: #20362e;
}

.top-actions,
.brand-selector {
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand-selector select {
  height: 38px;
  min-width: 180px;
  border: 1px solid #d6ded8;
  border-radius: 8px;
  background: #ffffff;
  padding: 0 10px;
}

.upcoming-bar {
  position: sticky;
  top: 0;
  z-index: 8;
  display: flex;
  align-items: center;
  gap: 10px;
  justify-content: space-between;
  margin: -6px 0 18px;
  padding: 10px 12px;
  border: 1px solid #cdddc9;
  border-radius: 8px;
  background: #f5fbf1;
  box-shadow: 0 8px 18px rgba(32, 54, 46, 0.08);
}

.upcoming-bar div {
  min-width: 0;
  flex: 1;
}

.upcoming-bar strong,
.upcoming-bar span {
  display: block;
}

.upcoming-bar span {
  color: #526058;
  font-size: 13px;
  margin-top: 3px;
}

.stack {
  display: grid;
  gap: 18px;
}

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

.wide-metrics {
  grid-template-columns: repeat(6, minmax(120px, 1fr));
}

.brand-strip {
  display: grid;
  grid-template-columns: minmax(220px, 0.35fr) 1fr;
  gap: 16px;
  background: #ffffff;
  border: 1px solid #dfe6e1;
  border-radius: 8px;
  padding: 16px;
}

.brand-strip strong,
.brand-strip span {
  display: block;
}

.brand-strip p {
  margin: 0;
  color: #48554d;
}

.metric,
.panel {
  background: #ffffff;
  border: 1px solid #dfe6e1;
  border-radius: 8px;
  box-shadow: 0 10px 30px rgba(33, 45, 38, 0.06);
}

.metric {
  padding: 16px;
  display: grid;
  gap: 8px;
}

.metric svg {
  color: #476d3b;
}

.metric span {
  color: #66736c;
  font-size: 13px;
}

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

.panel {
  padding: 18px;
}

.panel-header {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}

.panel-header h2 {
  margin: 0;
  font-size: 18px;
}

.two-column {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(320px, 0.75fr);
  gap: 18px;
}

.filters {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.filter-tabs {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.filter-tabs button {
  border: 1px solid #d6ded8;
  background: #f8faf7;
  border-radius: 8px;
  min-height: 36px;
  padding: 0 12px;
  cursor: pointer;
}

.filter-tabs button.active {
  background: #20362e;
  color: white;
  border-color: #20362e;
}

.filters label {
  display: flex;
  align-items: center;
  gap: 6px;
  color: #66736c;
  font-size: 13px;
}

.filters input {
  height: 36px;
  border: 1px solid #d6ded8;
  border-radius: 8px;
  padding: 0 9px;
}

.table-wrap {
  width: 100%;
  overflow: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th {
  color: #66736c;
  font-size: 12px;
  text-align: left;
  font-weight: 700;
  padding: 10px;
  border-bottom: 1px solid #e7ece8;
}

td {
  padding: 12px 10px;
  border-bottom: 1px solid #edf1ee;
  vertical-align: middle;
}

td strong,
td span {
  display: block;
}

.pills {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.pills span {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  border-radius: 999px;
  padding: 0 9px;
  background: #eef4ea;
  color: #35562d;
  font-size: 12px;
  font-weight: 700;
}

.pills .good {
  background: #e4f5de;
  color: #22601e;
}

.pills .meta {
  background: #e9f0ff;
  color: #2d4f9f;
}

.pills .hot {
  background: #fff0d9;
  color: #8a4d00;
}

.pills .warn {
  background: #fff0ed;
  color: #9b2f18;
}

.pills .quiet {
  background: #f1f2ef;
  color: #6c716a;
}

.campaign-list,
.lead-list,
.checklist,
.today-list,
.timeline,
.integration-grid,
.sync-actions,
.sync-runs,
.process-list {
  display: grid;
  gap: 10px;
}

.campaign-row,
.lead-row,
.account-row,
.media-row,
.task-row,
.timeline-item,
.integration-card,
.script-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 12px;
  background: #f8faf7;
  border: 1px solid #e4eae5;
  border-radius: 8px;
}

.task-row {
  min-height: 58px;
}

.task-row > div {
  min-width: 0;
  flex: 1;
}

.task-row strong,
.task-row span {
  display: block;
}

.task-tag {
  width: auto;
  border-radius: 999px;
  background: #eef4ea;
  color: #35562d;
  font-size: 12px;
  font-weight: 700;
  padding: 6px 10px;
  white-space: nowrap;
}

.media-row {
  align-items: flex-start;
}

.media-preview {
  width: 86px;
  height: 86px;
  border-radius: 8px;
  border: 1px solid #dce6dd;
  object-fit: cover;
  background: #eef4ef;
  flex: 0 0 auto;
}

.small-button {
  flex: 0 0 auto;
  padding: 8px 10px;
  font-size: 13px;
  text-decoration: none;
}

.tag-editor {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}

.tag-chip {
  border: 0;
  border-radius: 999px;
  background: #f1f2ef;
  color: #465249;
  cursor: pointer;
  font: inherit;
  padding: 6px 10px;
}

.tag-chip:hover {
  background: #e5ece2;
}

.inline-form {
  display: flex;
  gap: 8px;
}

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

.name-edit-form label {
  display: grid;
  gap: 6px;
  color: #66736c;
  font-size: 13px;
  font-weight: 700;
}

.name-edit-form input {
  width: 100%;
  min-height: 38px;
  border: 1px solid #dce4dc;
  border-radius: 8px;
  padding: 9px 10px;
}

.name-edit-form button {
  justify-self: start;
}

.quick-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.call-schedule-form {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) minmax(210px, 1fr) auto;
  gap: 8px;
  align-items: end;
  padding: 10px;
  border: 1px solid #dce6dd;
  border-radius: 8px;
  background: #f8faf7;
}

.call-schedule-form label {
  display: grid;
  gap: 6px;
  color: #66736c;
  font-size: 13px;
  font-weight: 700;
}

.call-schedule-form input,
.call-schedule-form select {
  width: 100%;
  min-height: 38px;
  border: 1px solid #dce4dc;
  border-radius: 8px;
  background: #ffffff;
  padding: 9px 10px;
}

.reply-form {
  display: grid;
  gap: 10px;
}

.quick-reply-box {
  display: grid;
  gap: 8px;
}

.quick-reply-box > strong {
  color: #20362e;
}

.quick-reply-list {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.quick-reply-chip {
  border: 1px solid #d6ded8;
  border-radius: 999px;
  background: #f8faf7;
  color: #20362e;
  cursor: pointer;
  font: inherit;
  font-weight: 700;
  min-height: 34px;
  padding: 0 12px;
}

.quick-reply-chip:hover {
  border-color: #9ab18f;
  background: #f2f7ef;
}

.reply-form textarea {
  width: 100%;
  min-height: 96px;
  border: 1px solid #dce4dc;
  border-radius: 8px;
  padding: 10px 12px;
  resize: vertical;
}

.reply-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.reply-actions span {
  color: #66736c;
  font-size: 13px;
  max-width: 680px;
}

.file-picker {
  display: grid;
  gap: 6px;
  color: #66736c;
  font-size: 13px;
  font-weight: 700;
}

.file-picker input {
  width: 100%;
  border: 1px solid #dce4dc;
  border-radius: 8px;
  padding: 9px 10px;
  background: #ffffff;
}

.attachment-grid {
  display: grid;
  grid-template-columns: minmax(160px, 220px) 1fr;
  gap: 10px;
  align-items: end;
}

.attachment-grid label {
  display: grid;
  gap: 6px;
  color: #66736c;
  font-size: 13px;
  font-weight: 700;
}

.attachment-grid select {
  width: 100%;
  min-height: 38px;
  border: 1px solid #dce4dc;
  border-radius: 8px;
  background: #ffffff;
  padding: 9px 10px;
}

.inline-form input {
  min-width: 0;
  flex: 1;
  border: 1px solid #dce4dc;
  border-radius: 8px;
  padding: 9px 10px;
}

.campaign-row > div:first-child,
.lead-row > div,
.account-row,
.timeline-item > div:last-child,
.media-row > div {
  min-width: 0;
}

.campaign-row strong,
.campaign-row span,
.lead-row strong,
.lead-row span,
.account-row strong,
.account-row span,
.timeline-item strong,
.timeline-item span,
.media-row strong,
.media-row span {
  display: block;
}

.numeric {
  text-align: right;
}

.detail-grid {
  display: grid;
  grid-template-columns: minmax(320px, 0.8fr) minmax(360px, 1.2fr);
  gap: 18px;
}

.detail-toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
}

.detail-toolbar span {
  color: #66736c;
  font-size: 13px;
  font-weight: 700;
}

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

.profile-facts {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}

.fact {
  border: 1px solid #e4eae5;
  border-radius: 8px;
  padding: 10px;
}

.fact strong {
  display: block;
  margin-top: 3px;
}

.timeline-item {
  justify-content: flex-start;
}

.timeline-item.outbound {
  background: #eef5ff;
  border-color: #d7e5ff;
}

.timeline-item.outbound .timeline-type {
  background: #dbeaff;
  color: #284b82;
}

.timeline-type {
  width: 92px;
  min-height: 28px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: #eaf1e4;
  color: #35562d;
  font-size: 12px;
  font-weight: 800;
}

.media-row {
  justify-content: flex-start;
  margin-bottom: 10px;
}

.script-card {
  display: block;
  margin-bottom: 10px;
}

.script-card p {
  margin: 8px 0 0;
  color: #48554d;
  line-height: 1.45;
}

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

.snippet-card {
  border: 1px solid #e4eae5;
  border-radius: 8px;
  background: #f8faf7;
  color: #20362e;
  cursor: pointer;
  font: inherit;
  padding: 10px 12px;
  text-align: left;
  line-height: 1.4;
  white-space: normal;
  width: 100%;
  overflow-wrap: anywhere;
}

.snippet-card strong,
.snippet-card span {
  display: block;
}

.snippet-card span {
  color: #66736c;
  font-size: 13px;
  margin-top: 4px;
}

.snippet-card:hover {
  border-color: #9ab18f;
  background: #f2f7ef;
}

.integration-card {
  display: grid;
  gap: 4px;
  align-items: start;
}

.integration-card span {
  color: #66736c;
  font-size: 13px;
}

.readiness-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 10px;
}

.check-card,
.sync-button,
.process-list div {
  border: 1px solid #e4eae5;
  border-radius: 8px;
  background: #f8faf7;
  padding: 12px;
}

.check-card {
  border-left: 4px solid #719a60;
}

.check-card.missing {
  border-left-color: #b9482b;
}

.check-card.warning {
  border-left-color: #c68a22;
}

.check-card strong,
.check-card span,
.sync-button strong,
.sync-button span,
.process-list strong,
.process-list span {
  display: block;
}

.check-card span,
.sync-button span,
.process-list span {
  color: #66736c;
  font-size: 13px;
  margin-top: 4px;
}

.check-card p {
  color: #48554d;
  margin: 8px 0 0;
  font-size: 13px;
  line-height: 1.4;
}

.sync-button {
  text-align: left;
  cursor: pointer;
}

.sync-button:hover {
  border-color: #9ab18f;
  background: #f2f7ef;
}

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

.form-grid label {
  display: grid;
  gap: 6px;
  color: #66736c;
  font-size: 13px;
  font-weight: 700;
}

.form-grid input,
.form-grid textarea,
.import-grid input,
.import-grid select,
.import-grid textarea {
  width: 100%;
  min-height: 38px;
  border: 1px solid #d6ded8;
  border-radius: 8px;
  padding: 9px 10px;
  color: #1d2320;
  background: #ffffff;
}

.form-grid textarea,
.import-grid textarea {
  min-height: 88px;
  resize: vertical;
}

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

.import-grid label {
  display: grid;
  gap: 6px;
  color: #66736c;
  font-size: 13px;
  font-weight: 700;
}

.import-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.import-actions span,
.import-result {
  color: #66736c;
  font-size: 13px;
}

.import-result {
  margin-top: 12px;
  border-left: 4px solid #719a60;
  background: #f8faf7;
  border-radius: 6px;
  padding: 10px 12px;
}

.span-2 {
  grid-column: 1 / -1;
}

.compact-form {
  margin-top: 16px;
}

.env-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 10px;
}

code {
  background: #f3f6f2;
  border: 1px solid #dfe6e1;
  border-radius: 8px;
  padding: 10px;
  color: #25352e;
}

.checklist div {
  border-left: 4px solid #719a60;
  background: #f8faf7;
  border-radius: 6px;
  padding: 10px 12px;
}

.alert,
.loading,
.empty,
.empty-state {
  color: #66736c;
}

.alert {
  background: #fff0ed;
  border: 1px solid #ffd4ca;
  color: #9b2f18;
  border-radius: 8px;
  padding: 12px;
  margin-bottom: 16px;
}

.notice {
  background: #edf7e9;
  border: 1px solid #cfe6c7;
  color: #2f5f2d;
  border-radius: 8px;
  padding: 12px;
  margin-bottom: 16px;
}

.empty,
.loading {
  padding: 18px;
}

.empty-state {
  display: grid;
  place-items: center;
  text-align: center;
  min-height: 320px;
}

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

  .sidebar {
    position: sticky;
    top: 0;
    z-index: 10;
    padding: 14px;
  }

  nav {
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }

  .nav-button {
    justify-content: center;
  }

  .nav-button span,
  .brand span {
    display: none;
  }

  .metrics-grid,
  .wide-metrics,
  .two-column,
  .detail-grid,
  .brand-strip,
  .form-grid,
  .call-schedule-form,
  .attachment-grid,
  .import-grid {
    grid-template-columns: 1fr;
  }

  .wide {
    grid-column: auto;
  }
}

@media (max-width: 640px) {
  .main {
    padding: 18px 12px;
  }

  .topbar {
    align-items: flex-start;
    gap: 12px;
    flex-direction: column;
  }

  .top-actions,
  .brand-selector {
    width: 100%;
    align-items: stretch;
  }

  .upcoming-bar,
  .task-row {
    align-items: stretch;
    flex-direction: column;
  }

  .brand-selector select {
    min-width: 0;
    flex: 1;
  }

  .metrics-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  nav {
    display: flex;
    overflow-x: auto;
  }

  .nav-button {
    flex: 0 0 44px;
  }

  .profile-facts {
    grid-template-columns: 1fr;
  }
}
