:root {
  --green-900: #005c4b;
  --green-800: #00755f;
  --green-700: #008069;
  --green-600: #00a884;
  --green-100: #dff8ec;
  --green-50: #f0fbf6;
  --ink: #111827;
  --muted: #667085;
  --line: #dbe7e1;
  --paper: #ffffff;
  --soft: #f7faf8;
  --bubble-in: #ffffff;
  --bubble-out: #d9fdd3;
  --shadow: 0 18px 50px rgba(9, 30, 26, 0.10);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at top left, rgba(0, 168, 132, 0.12), transparent 30%),
    linear-gradient(135deg, #eef8f3, #f7fbfa 45%, #eef7f2);
}

* { box-sizing: border-box; }
html, body { min-height: 100%; }
body { margin: 0; }
button, input, textarea, select { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: 0.62; }
.hidden { display: none !important; }
h1, h2, h3, p { margin: 0; }

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 292px minmax(0, 1fr);
  padding: 18px;
  gap: 18px;
}

.side-nav {
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid rgba(0, 128, 105, 0.12);
  border-radius: 24px;
  box-shadow: var(--shadow);
  padding: 18px;
  display: grid;
  grid-template-rows: auto auto auto 1fr auto;
  gap: 16px;
  min-height: calc(100vh - 36px);
}

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

.brand-mark {
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  border-radius: 16px;
  color: white;
  background: linear-gradient(145deg, var(--green-700), var(--green-900));
  font-size: 27px;
  box-shadow: 0 10px 26px rgba(0, 128, 105, 0.25);
}

.brand-row h1 {
  font-size: 18px;
  line-height: 1.1;
  color: var(--green-900);
}

.brand-row p, .login-card small, .panel-help, .hint, .chat-topbar p, .user-card p, .ai-card p, .info-card p, .form-title p {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.login-card, .ai-card, .user-card, .info-card, .builder-card {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 20px;
}

.login-card {
  padding: 14px;
  display: grid;
  gap: 10px;
}

.login-card__top {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
}

.status-dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: var(--green-600);
  box-shadow: 0 0 0 4px rgba(0, 168, 132, 0.13);
}

label {
  display: grid;
  gap: 7px;
  color: #344054;
  font-size: 13px;
  font-weight: 700;
}

input, textarea, select {
  width: 100%;
  border: 1px solid var(--line);
  background: #fbfdfc;
  color: var(--ink);
  border-radius: 14px;
  padding: 12px 13px;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

textarea { resize: vertical; min-height: 42px; }
input:focus, textarea:focus, select:focus {
  border-color: var(--green-600);
  box-shadow: 0 0 0 4px rgba(0, 168, 132, 0.10);
  background: white;
}

.btn, .icon-btn, .nav-item, .chip, .send-btn, .round-btn {
  border: 0;
  border-radius: 14px;
  font-weight: 800;
  transition: transform 0.12s ease, box-shadow 0.12s ease, background 0.12s ease;
}
.btn:active, .icon-btn:active, .nav-item:active, .chip:active, .send-btn:active, .round-btn:active { transform: translateY(1px); }

.btn {
  min-height: 42px;
  padding: 11px 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.btn-primary, .send-btn {
  background: linear-gradient(145deg, var(--green-600), var(--green-800));
  color: white;
  box-shadow: 0 10px 22px rgba(0, 128, 105, 0.20);
}
.btn-primary:hover, .send-btn:hover { box-shadow: 0 12px 28px rgba(0, 128, 105, 0.28); }
.btn-soft { background: var(--green-50); color: var(--green-900); border: 1px solid var(--line); }
.btn-outline { background: white; color: var(--green-800); border: 1px solid var(--line); }
.btn-ghost { background: #f4f7f6; color: var(--green-900); }
.btn-wide { width: 100%; }

.nav-list { display: grid; gap: 8px; }
.nav-item {
  width: 100%;
  display: grid;
  grid-template-columns: 26px 1fr auto;
  align-items: center;
  gap: 10px;
  background: transparent;
  color: #263238;
  padding: 13px;
  text-align: left;
}
.nav-item:hover { background: #f3faf7; }
.nav-item.active {
  background: var(--green-100);
  color: var(--green-900);
}
.nav-item.muted { opacity: 0.72; }
.nav-icon { font-size: 20px; }
.badge {
  min-width: 24px;
  height: 24px;
  border-radius: 999px;
  padding: 0 7px;
  display: inline-grid;
  place-items: center;
  color: white;
  background: var(--green-700);
  font-size: 12px;
}

.ai-card {
  align-self: end;
  padding: 18px;
  display: grid;
  gap: 10px;
  background: linear-gradient(180deg, #ffffff, #f3fbf7);
}
.ai-avatar {
  width: 52px;
  height: 52px;
  display: grid;
  place-items: center;
  border-radius: 18px;
  background: var(--green-900);
  color: white;
  font-size: 25px;
}
.ai-card h2 { font-size: 17px; color: var(--green-900); }
.pill {
  width: fit-content;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 28px;
  padding: 6px 10px;
  border-radius: 999px;
  background: #eef2f1;
  color: #44524f;
  font-size: 12px;
  font-weight: 800;
}
.pill.success { background: var(--green-100); color: var(--green-900); }
.pill.success span {
  width: 8px;
  height: 8px;
  border-radius: 99px;
  background: var(--green-600);
}

.user-card {
  padding: 12px;
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 10px;
  align-items: center;
}

.workspace {
  min-width: 0;
  min-height: calc(100vh - 36px);
  background: rgba(255, 255, 255, 0.88);
  border: 1px solid rgba(0, 128, 105, 0.12);
  border-radius: 24px;
  box-shadow: var(--shadow);
  overflow: hidden;
}

.workspace-chat {
  display: grid;
  grid-template-columns: 360px minmax(420px, 1fr) 310px;
}

.chat-list-panel, .detail-panel, .campaigns-list-panel {
  background: rgba(255, 255, 255, 0.86);
  min-width: 0;
}
.chat-list-panel, .campaigns-list-panel { border-right: 1px solid var(--line); }
.detail-panel { border-left: 1px solid var(--line); padding: 18px; display: grid; gap: 16px; align-content: start; }

.panel-header, .chat-topbar {
  min-height: 86px;
  padding: 18px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.72);
}
.eyebrow { color: var(--green-700); font-weight: 900; text-transform: uppercase; letter-spacing: 0.06em; font-size: 11px; margin-bottom: 4px; }
.panel-header h2, .chat-topbar h2 { font-size: 23px; }
.icon-btn {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  color: var(--green-900);
  background: #f3faf7;
  border: 1px solid var(--line);
  font-size: 18px;
}

.search-row {
  margin: 16px 18px 10px;
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 10px;
  align-items: center;
  padding: 0 12px;
  background: #f5f8f7;
  border: 1px solid var(--line);
  border-radius: 16px;
}
.search-row input { border: 0; box-shadow: none; background: transparent; padding: 13px 4px; }
.search-row input:focus { box-shadow: none; }

.filter-chips {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 4px 18px 14px;
}
.chip {
  padding: 9px 12px;
  color: #475467;
  background: #f7f9f8;
  border: 1px solid var(--line);
  white-space: nowrap;
}
.chip.active { background: var(--green-100); color: var(--green-900); }
.chip strong { margin-left: 4px; }

.conversation-list, .campaign-list {
  display: grid;
  gap: 6px;
  padding: 0 10px 16px;
  max-height: calc(100vh - 210px);
  overflow-y: auto;
}
.conversation-card, .campaign-card {
  width: 100%;
  border: 0;
  border-radius: 18px;
  padding: 12px;
  background: transparent;
  color: var(--ink);
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 12px;
  align-items: center;
  text-align: left;
}
.conversation-card:hover, .campaign-card:hover { background: #f4faf7; }
.conversation-card.active, .campaign-card.active { background: linear-gradient(90deg, var(--green-50), #ffffff); }
.conversation-card h3, .campaign-card h3 { font-size: 14px; margin-bottom: 4px; }
.conversation-card p, .campaign-card p { color: var(--muted); font-size: 12px; line-height: 1.35; }
.conversation-card time, .campaign-card time { color: var(--muted); font-size: 12px; }
.meta-right { display: grid; justify-items: end; gap: 8px; }

.avatar {
  width: 48px;
  height: 48px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  color: white;
  background: linear-gradient(145deg, var(--green-700), var(--green-900));
  font-weight: 900;
  position: relative;
  flex: 0 0 auto;
}
.avatar::after {
  content: "";
  position: absolute;
  right: 1px;
  bottom: 2px;
  width: 11px;
  height: 11px;
  border: 2px solid white;
  border-radius: 99px;
  background: #12b76a;
}
.avatar-small { width: 42px; height: 42px; font-size: 13px; }

.chat-main {
  min-width: 0;
  display: grid;
  grid-template-rows: auto 1fr auto auto;
  background:
    radial-gradient(circle at 18px 18px, rgba(0,128,105,0.035) 2px, transparent 3px) 0 0/38px 38px,
    #f8faf8;
}
.contact-head { display: flex; align-items: center; gap: 12px; min-width: 0; }
.contact-head h2 { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar-actions { display: flex; align-items: center; gap: 10px; }
.topbar-actions select { width: 138px; background: white; }

.messages {
  padding: 22px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.empty-chat, .empty-state {
  color: var(--muted);
  border: 1px dashed var(--line);
  background: rgba(255,255,255,0.7);
  border-radius: 20px;
  padding: 22px;
  text-align: center;
}
.empty-chat { margin: auto; max-width: 360px; }
.empty-chat div { font-size: 42px; margin-bottom: 8px; }
.empty-state.large { min-height: 260px; display: grid; place-items: center; }

.day-pill {
  align-self: center;
  background: #ffffff;
  color: #475467;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 800;
}
.message {
  max-width: min(72%, 620px);
  padding: 12px 14px 8px;
  border-radius: 18px;
  background: var(--bubble-in);
  box-shadow: 0 3px 16px rgba(16, 24, 40, 0.06);
  line-height: 1.45;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.message.out {
  align-self: flex-end;
  background: var(--bubble-out);
  border-top-right-radius: 8px;
}
.message.in {
  align-self: flex-start;
  border-top-left-radius: 8px;
}
.message small {
  display: block;
  margin-top: 5px;
  color: #667085;
  text-align: right;
  font-size: 11px;
}

.ai-suggestion {
  margin: 0 18px 10px;
  padding: 12px;
  border: 1px solid rgba(0,128,105,0.18);
  background: #ffffff;
  border-radius: 18px;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  align-items: center;
  box-shadow: 0 8px 24px rgba(16, 24, 40, 0.07);
}
.ai-suggestion p { color: #344054; margin-top: 5px; white-space: pre-wrap; }
.suggestion-actions { display: flex; gap: 8px; }

.composer {
  margin: 0 18px 10px;
  padding: 8px;
  border: 1px solid var(--line);
  background: white;
  border-radius: 18px;
  display: grid;
  grid-template-columns: 40px 1fr 40px 48px;
  gap: 8px;
  align-items: end;
}
.composer textarea {
  border: 0;
  box-shadow: none;
  background: transparent;
  padding: 10px 4px;
  max-height: 120px;
}
.composer textarea:focus { box-shadow: none; }
.round-btn {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  background: #f3f7f5;
  color: #475467;
}
.send-btn { width: 48px; height: 48px; display: grid; place-items: center; font-size: 20px; }
.tip-bar {
  width: fit-content;
  margin: 0 18px 14px;
  padding: 9px 12px;
  border-radius: 999px;
  background: var(--green-100);
  color: var(--green-900);
  font-size: 12px;
  font-weight: 800;
}

.info-card {
  padding: 16px;
  display: grid;
  gap: 14px;
}
.card-title-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.card-title-row h3 { font-size: 17px; }
.contact-profile { display: grid; grid-template-columns: auto 1fr; gap: 12px; align-items: center; }
.campaign-mini { text-align: left; display: grid; gap: 10px; }
.campaign-mini-row { display: grid; grid-template-columns: 24px 1fr; gap: 9px; color: #475467; font-size: 13px; }
.campaign-mini-row strong { color: var(--ink); }
.ai-toggle-card { grid-template-columns: 1fr auto; align-items: center; }
.switch input { display: none; }
.switch span {
  width: 54px;
  height: 30px;
  border-radius: 999px;
  display: block;
  background: #d0d5dd;
  position: relative;
}
.switch span::after {
  content: "";
  position: absolute;
  top: 4px;
  left: 4px;
  width: 22px;
  height: 22px;
  border-radius: 99px;
  background: white;
  box-shadow: 0 2px 6px rgba(0,0,0,0.18);
  transition: left 0.15s ease;
}
.switch input:checked + span { background: var(--green-600); }
.switch input:checked + span::after { left: 28px; }

.campaigns-workspace { display: grid; grid-template-columns: 340px minmax(0, 1fr); }
.campaigns-list-panel { padding-bottom: 16px; }
.panel-help { padding: 14px 18px; border-bottom: 1px solid var(--line); }
.campaign-builder { min-width: 0; display: grid; grid-template-rows: auto 1fr; background: var(--soft); }
.campaign-grid {
  padding: 20px;
  display: grid;
  grid-template-columns: minmax(360px, 470px) minmax(360px, 1fr);
  gap: 20px;
  overflow-y: auto;
}
.builder-card { padding: 18px; display: grid; gap: 14px; align-content: start; }
.form-title { display: flex; gap: 12px; align-items: center; }
.form-title > span {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: var(--green-100);
  color: var(--green-900);
  font-weight: 900;
}
.two-cols { display: grid; grid-template-columns: 1fr 130px; gap: 12px; }
.checkbox-line { grid-template-columns: auto 1fr; align-items: center; font-weight: 700; }
.checkbox-line input { width: 20px; height: 20px; accent-color: var(--green-700); }
.detail-card { min-height: 480px; }
.campaign-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.stat-box { background: #f7faf8; border: 1px solid var(--line); border-radius: 16px; padding: 12px; }
.stat-box strong { display: block; font-size: 24px; color: var(--green-900); }
.action-row { display: flex; flex-wrap: wrap; gap: 10px; }
.recipient-list { display: grid; gap: 8px; max-height: 320px; overflow-y: auto; }
.recipient-row { display: grid; grid-template-columns: 1fr auto; gap: 10px; padding: 10px; border-radius: 14px; background: #f7faf8; border: 1px solid var(--line); }
.recipient-row small { color: var(--muted); }

.toast {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 50;
  max-width: min(420px, calc(100vw - 44px));
  border-radius: 16px;
  background: var(--green-900);
  color: white;
  box-shadow: var(--shadow);
  padding: 14px 16px;
  font-weight: 750;
}

@media (max-width: 1220px) {
  .workspace-chat { grid-template-columns: 330px minmax(390px, 1fr); }
  .detail-panel { display: none; }
}

@media (max-width: 900px) {
  .app-shell { grid-template-columns: 1fr; padding: 0; gap: 0; }
  .side-nav {
    min-height: auto;
    border-radius: 0;
    border-left: 0;
    border-right: 0;
    grid-template-rows: auto auto auto;
  }
  .ai-card, .user-card { display: none; }
  .nav-list { grid-template-columns: repeat(2, 1fr); }
  .nav-item.muted { display: none; }
  .workspace { min-height: auto; border-radius: 0; border-left: 0; border-right: 0; box-shadow: none; }
  .workspace-chat, .campaigns-workspace, .campaign-grid { grid-template-columns: 1fr; }
  .chat-list-panel { min-height: 45vh; border-right: 0; border-bottom: 1px solid var(--line); }
  .conversation-list, .campaign-list { max-height: 48vh; }
  .chat-main { min-height: 72vh; }
  .topbar-actions { flex-direction: column; align-items: stretch; }
  .chat-topbar { align-items: flex-start; }
  .messages { padding: 16px; }
  .message { max-width: 88%; }
  .ai-suggestion { grid-template-columns: 1fr; }
  .composer { grid-template-columns: 38px 1fr 38px 46px; margin: 0 10px 10px; }
  .campaign-grid { padding: 12px; }
  .two-cols { grid-template-columns: 1fr; }
  .campaign-stats { grid-template-columns: 1fr; }
}
