:root {
  --bg: #f3f0ea;
  --bg-elevated: #fffdf8;
  --ink: #1c2430;
  --muted: #5f6b7a;
  --line: #d9d2c6;
  --accent: #0f6e56;
  /*--accent-soft: #d8efe6;*/
  --accent-soft: #e2fff4; 
  --warn: #9a6700;
  --danger: #b42318;
  --pending: linear-gradient(90deg,rgba(138, 109, 59, 1) 0%, rgba(184, 131, 40, 1) 100%);
  --progress: linear-gradient(90deg,rgba(23, 92, 211, 1) 0%, rgba(74, 132, 232, 1) 100%);
  --sent: linear-gradient(120deg, rgba(15, 110, 86, 1) 0%, rgb(11 153 118) 100%);
  --failed: linear-gradient(90deg,rgba(180, 35, 24, 1) 0%, rgb(212, 81, 72) 100%);
  /*--shadow: 0 10px 30px rgba(28, 36, 48, 0.06);*/
  --shadow: 0 2px 15px rgb(26 122 70 / 18%);
  --radius: 14px;
  --font: "DM Sans", system-ui, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, monospace;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font);
  color: var(--ink);
  background:
    radial-gradient(circle at top left, rgba(15, 110, 86, 0.08), transparent 28%),
    linear-gradient(180deg, #efeae2 0%, var(--bg) 40%, #ebe6de 100%);

  background: radial-gradient(circle at top left, rgba(15, 110, 86, 0.08), transparent 28%), linear-gradient(180deg, #d8ffd7 0%, var(--bg) 40%, #ebe6de 100%);
  background: radial-gradient(circle at top left, rgba(15, 110, 86, 0.08), transparent 28%), linear-gradient(180deg, #d8ffd7c2 0%, var(--bg) 40%, #ebe6de 100%);
  background: radial-gradient(circle at top left, rgba(15, 110, 86, 0.08), transparent 28%), linear-gradient(180deg, #e5ffe5c2 0%, var(--bg) 40%, #ebe6de 100%);
  min-height: 100vh;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

.shell {
  display: grid;
  grid-template-columns: 1fr;
  min-height: 100vh;
}

.sidebar {
  background: #16342c;
  background: linear-gradient(133deg, rgba(22, 52, 44, 1) 0%, rgb(20 118 66 / 84%) 100%);

  color: #e7f3ee;
  padding: 1.4rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  position: fixed;
  height: 100vh;
  width: 215px;
}

.brand {
  display: flex;
  gap: 5px;
  align-items: center;
  padding: 0.25rem 0.5rem;
}
.brand-mark {
  width: 2rem;
  height: 2rem;
  border-radius: 2rem;
  display: grid;
  place-items: center;
  background: #0f6e56;
  background: #8bffd7;
    font-weight: 700;
    letter-spacing: 0.02em;
    padding: 2px;
    box-shadow: 0px 0px 17px 1px #59decc99;
}
.brand strong {
  display: block; 
  font-size: 1rem;
  font-size: 1.3rem;
  color: #9ff8e3;
}
.brand small {
  color: #9cb7ad;
  display: none;
}

.nav { 
  display: flex; flex-direction: column; gap: 0.35rem;
  /*padding: 10px;
  background: #00000030;
  border-radius: 0.7rem;
  */
}
.nav a {
  color: #c9ddd5;
  padding: 0.7rem 0.85rem;
  border-radius: 0.7rem;
  text-decoration: none;
  font-weight: 500;
}
.nav a:hover { 
  background: rgb(255 255 255 / 0%);
    text-decoration: none;
    text-shadow: 0px 0px 12px #ffffffc4;
    color: #ffffffe6;
}
.nav a.active {
  text-shadow: 0px 0px 12px #5cfb9ac9;
    /* background: #318b747a; */
    color: #fff;
    /* background: #07241c42; */
    color: #71efba;
}

.sidebar-foot {
  margin-top: 0px !important;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  padding: 0.8rem;
  color: #9cb7ad;
  font-size: 0.9rem;
}
.sign-out {
  color: #021812;
}
.user-chip {
  font-family: var(--mono);
  font-size: 0.8rem;
  color: #d7ebe3;
}

.main {
  padding: 1.5rem 1.75rem 2.5rem;
  max-width: 1640px;
  width: 100%;

  display: flex;
  flex-wrap: wrap;
  /* column-gap: 20px; */
  box-sizing: border-box;
  justify-content: space-between;
  flex-direction: row;
  align-content: flex-start;
    align-items: stretch;
  column-gap: 20px;
  padding-left: 240px;
}
@media (max-width: 900px) {
  .main {
    padding-left: 0px;
  }
}

.add-contact {
  max-width: 49%;
}
.add-phone {
  max-width: 49%;
}
.form-grid.add-phone,
.form-grid.available-phone {
  max-width: 100%;
  display: grid;
  grid-auto-flow: column;
  align-items: end;
}
.form-grid.available-phone .active-phone {
  padding-bottom: 12px;
  margin-right: -100px;
}
.panel.add-phone{
  max-width: 100%; 
  width: 100%;
}
.add-phone .form-grid {
  grid-template-columns: auto !important;
}
.send-sms {
  max-width: 1400px;
}
.page-head {
  width: 100%;
  display: flex;
}
.page-head h1 {
  margin: 0 0 1.25rem;
  font-size: 1.7rem;
  letter-spacing: -0.02em;
}

.flash {
  padding: 0.85rem 1rem;
  border-radius: 0.8rem;
  margin-bottom: 1rem;
  border: 1px solid var(--line);
  background: var(--bg-elevated);
  position:absolute;
  right: 30px;
  top: 30px;
}
.flash-success { border-color: #9fd0bc; background: var(--accent-soft); }
.flash-error { border-color: #f0b4ae; background: #fdecea; color: var(--danger); }

.grid-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.9rem;
  margin-bottom: 1.25rem;
}

.stat {
  background: var(--bg-elevated);
  border: 0px solid var(--line);
  border-radius: var(--radius);
  padding: 2rem 2.1rem;
  box-shadow: var(--shadow);

  padding: 2.1rem 2.2rem;
  /* margin-bottom: 1.1rem; */
  /* max-width: 49%; */
  width: 100% !important;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
}
.stat .label { color: var(--muted); font-size: 0.85rem; }
.stat .value {
  font-family: var(--mono);
  font-size: 1.7rem;
  font-weight: 500;
  margin-top: 0.35rem;
}

.chart {
  display: grid;
  grid-template-columns: repeat(var(--chart-cols, 14), minmax(0, 1fr));
  gap: 3px;
  align-items: end;
  min-height: 220px;
  padding: 0.25rem 0 0.5rem;
  overflow-x: auto;
}
.chart-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.35rem;
  min-width: 0;
}
.chart-bars {
  width: 100%;
  height: 160px;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}
.chart-stack {
  width: 100%;
  max-width: 100%;
  min-height: 2px;
  display: flex;
  flex-direction: column-reverse;
  border-radius: 0.35rem 0.35rem 0.15rem 0.15rem;
  overflow: hidden;
  background: transparent;
}
.chart-stack .seg { display: block; width: 100%; min-height: 2px; }
.seg-sent { background: var(--sent); }
.seg-failed { background: var(--failed); }
.seg-other { background: #b7c0ca; }
.chart-value {
  font-size: 0.7rem;
  color: var(--muted);
  line-height: 1;
}
.chart-label {
  font-size: 0.68rem;
  color: var(--muted);
  text-align: center;
  line-height: 1.15;
  /*white-space: nowrap;*/
}
.chart-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.9rem 1.2rem;
  margin-top: 0.85rem;
  font-size: 0.85rem;
  color: var(--muted);
}
.chart-legend span { display: inline-flex; align-items: center; gap: 0.4rem; }
.swatch {
  width: 0.7rem;
  height: 0.7rem;
  border-radius: 0.2rem;
  display: inline-block;
}
.swatch-sent { background: var(--sent); }
.swatch-failed { background: var(--failed); }
.swatch-other { background: #b7c0ca; }

.panel {
  background: var(--bg-elevated);
  border: 0px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow), inset 0px 0px 9px 4px #ffffff;
  padding: 2.1rem 2.2rem;
  margin-bottom: 1.1rem;

  /*max-width: 49%;*/
  width: 100% !important;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
/*
  background: linear-gradient(0deg, #fffbf0 0%, #fffdf8 14%, #ffffff 88%, #ffffff 100%);
  background: linear-gradient(0deg, rgba(255, 251, 240, 1) 0%, rgba(255, 252, 242, 1) 14%, rgba(255, 255, 255, 1) 88%, rgb(236 255 225) 100%);

  background: linear-gradient(0deg, rgb(234 234 234) 0%, rgb(245 245 245) 14%, rgba(255, 255, 255, 1) 88%, rgb(249 249 249) 100%);
  */
}
.panel h2 {
  margin: 0 0 0.9rem;
  font-size: 1.05rem;
}
.panel-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  margin-bottom: 0.9rem;
}
.panel-head h2 { margin: 0; }

.table-wrap { overflow-x: auto; }
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
}
th, td {
  text-align: left;
  padding: 0.7rem 0.55rem;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}
th { color: var(--muted); font-weight: 600; font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.04em; }
td.mono, .mono { font-family: var(--mono); font-size: 0.85rem; }
.message-cell { max-width: 280px; color: var(--muted); }

.badge {
  display: inline-block;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: capitalize;
  background: #eee;
}
.badge-pending { background: #f5e6c8; color: var(--pending); }
.badge-in_progress { background: #dcebff; color: var(--progress); }
.badge-sent { background: var(--accent-soft); color: var(--sent); }
.badge-failed { background: #fdecea; color: var(--failed); }
.badge-scheduled { background: #e8e4f5; color: #5b4b8a; }

.badge-plan {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  padding: 0.2rem 0.5rem;
  border-radius: 999px;
  background: #e8e4f5;
  color: #5b4b8a;
}
.badge-plan-free { background: #e8f0fe; color: #1a56db; }
.badge-plan-starter { background: #e7f6ef; color: #0f6e56; }
.badge-plan-basic { background: #e8f5e9; color: #2e7d32; }
.badge-plan-standard { background: #e3f2fd; color: #1565c0; }
.badge-plan-pro { background: #fff3e0; color: #e65100; }
.badge-plan-business { background: #f3e5f5; color: #6a1b9a; }
.badge-plan-enterprise { background: #212b36; color: #f4f7f5; }

.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1rem;
}
.filters a {
  padding: 0.45rem 0.8rem;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--bg-elevated);
  color: var(--ink);
  text-decoration: none;
  font-size: 0.9rem;
}
.filters a.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.form-grid {
  display: grid;
  gap: 0.9rem;
  column-gap: 20px;
  max-width: 1400px;
  justify-items: stretch;
  grid-template-columns: auto auto;
  align-items: start;
  /*-------------------*/

  display: grid;
  gap: 10px;
  column-gap: 30px;
  max-width: 1400px;
  justify-items: stretch;
  grid-template-columns: 49% 49%;
  align-items: start;
}
.add-contact .form-grid {
  grid-template-columns: auto !important;
}
.form-grid.login-form {
  grid-template-columns: auto !important;
}
label {
  display: grid;
  gap: 0.35rem;
  font-weight: 600;
  font-size: 0.9rem;
}
input[type="text"],
input[type="password"],
input[type="email"],
input[type="number"],
input[type="tel"],
input[type="date"],
input[type="time"],
input[type="datetime-local"],
input[type="url"],
input[type="search"],
input[type="color"],
input[type="file"],
input[type="range"],
textarea,
select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 0.7rem;
  padding: 0.75rem 0.85rem;
  font: inherit;
  background: #fff;
  color: var(--ink);
  /*box-shadow: var(--shadow);*/
}
textarea { min-height: 140px; resize: vertical; }
.help { color: var(--muted); font-weight: 400; font-size: 0.82rem; }

.schedule-input {
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 0.7rem;
  padding: 0.75rem 0.85rem;
  background: #fff;
  font-family: 'DM Sans';
    font-weight: 800;
}


.actions {
  display: flex;
  gap: 0.7rem;
  align-items: center;
}
.add-phone .actions {
  display: flex;
  gap: 0.7rem;
  align-items: center;
  justify-content: flex-end;
}
.btn {
  appearance: none;
  border: none;
  border-radius: 0.7rem;
  padding: 0.75rem 1.1rem;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  background: var(--accent);
  color: #fff;
}
.btn:hover { filter: brightness(1.05); }
.btn-secondary {
  background: transparent;
  color: var(--ink);
  border: 1px solid var(--line);
}

.mode-block {
  display: grid;
  gap: 0.9rem;
}
.mode-block[hidden] {
  display: none !important;
}

.member-picker {
  border: 1px solid var(--line);
  border-radius: 0.7rem;
  padding: 0.85rem 1rem;
  margin: 0;
}
.member-picker legend {
  padding: 0 0.35rem;
  font-weight: 600;
  font-size: 0.9rem;
}
.member-list {
  display: grid;
  gap: 0.45rem;
  max-height: 280px;
  overflow: auto;
}
.member-row {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  font-weight: 500;
}

.login-wrap {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 1.5rem;
}
.login-card {
  width: min(420px, 100%);
  background: var(--bg-elevated);
  border: 1px solid var(--line);
  border-radius: 1rem;
  box-shadow: var(--shadow);
  padding: 1.5rem;
}
.login-card h1 { margin: 0 0 0.35rem; font-size: 1.5rem; }
.login-card p { margin: 0 0 1.2rem; color: var(--muted); }

.phone-card {
  display: grid;
  gap: 0.35rem;
  padding: 1rem 0;
  border-bottom: 1px solid var(--line);
}
.phone-card:last-child { border-bottom: none; }
.phone-card .title { font-weight: 650; }
.muted { color: var(--muted); }
.empty { color: var(--muted); padding: 0.5rem 0; }

/* Inbox / conversation threads */
.inbox-layout {
  display: grid;
  grid-template-columns: minmax(260px, 340px) minmax(0, 1fr);
  grid-template-columns: minmax(655px, 540px) minmax(700px, 1fr);
  gap: 1rem;
  align-items: stretch;
  min-height: calc(100vh - 8rem);
}
.inbox-list,
.inbox-thread {
  display: flex;
  flex-direction: column;
  min-height: 0;
  margin: 0;
  max-height: 85vh;
}
.inbox-search {
  display: flex;
  gap: 0.45rem;
  align-items: center;
  flex-wrap: wrap;
}
.inbox-search input[type="text"] {
  min-width: 10rem;
  flex: 1;
  padding: 0.55rem 0.75rem;
  border: 1px solid var(--line);
  border-radius: 0.7rem;
  font: inherit;
}
.thread-list {
  list-style: none;
  margin: 0;
  padding: 0;
  overflow: auto;
  flex: 1;
}
.thread-item {
  display: block;
  padding: 0.85rem 0.75rem;
  border-bottom: 1px solid var(--line);
  color: inherit;
  text-decoration: none;
  border-radius: 0.6rem;
}
.thread-item:hover {
  background: rgba(15, 110, 86, 0.06);
  text-decoration: none;
}
.thread-item.active {
  background: var(--accent-soft);
}
.thread-item-top {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  align-items: baseline;
}
.thread-item-top strong {
  font-size: 0.98rem;
}
.thread-item-top time,
.thread-phone {
  font-size: 0.78rem;
  white-space: nowrap;
}
.thread-preview {
  margin-top: 0.35rem;
  color: var(--muted);
  font-size: 0.88rem;
  display: flex;
  gap: 0.4rem;
  align-items: baseline;
}
.dir-pill {
  font-size: 0.68rem;
  font-weight: 650;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 0.12rem 0.4rem;
  border-radius: 999px;
  flex-shrink: 0;
}
.dir-in { background: #e8f0ff; color: #1d4f91; }
.dir-out { background: var(--accent-soft); color: #0b5c47; }

.thread-empty {
  margin: auto;
  text-align: center;
  max-width: 28rem;
  padding: 2rem 1rem;
}
.thread-head {
  align-items: flex-start;
}
.chat-log {
  flex: 1;
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  padding: 0.25rem 0 1rem;
  min-height: 220px;
}
.bubble {
  max-width: min(34rem, 92%);
  padding: 0.75rem 0.9rem;
  border-radius: 1rem;
  border: 1px solid var(--line);
  background: #fff;
}
.bubble-in {
  align-self: flex-start;
  border-bottom-left-radius: 0.35rem;
  background: #fff;
}
.bubble-out {
  align-self: flex-end;
  border-bottom-right-radius: 0.35rem;
  background: var(--accent-soft);
  border-color: #b7e2d3;
}
.bubble-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem 0.7rem;
  align-items: center;
  font-size: 0.78rem;
  color: var(--muted);
  margin-bottom: 0.35rem;
}
.bubble-body {
  white-space: pre-wrap;
  word-break: break-word;
  line-height: 1.45;
}
.bubble-error {
  margin-top: 0.4rem;
  color: var(--danger);
  font-size: 0.82rem;
}
.reply-form {
  border-top: 1px solid var(--line);
  padding-top: 0.9rem;
  display: grid;
  gap: 0.7rem;
}
.reply-form textarea {
  width: 100%;
  padding: 0.7rem 0.85rem;
  border: 1px solid var(--line);
  border-radius: 0.7rem;
  font: inherit;
  resize: vertical;
}



@media (max-width: 900px) {
  .brand-mark {
    width: 1.3rem;
    height: 1.3rem;
  }
  .brand strong {
    font-size: 1rem;
  }
  .shell { grid-template-columns: 1fr; }
  .sidebar {
    flex-direction: row; flex-wrap: wrap; align-items: center; gap: 0.75rem;
    position: relative;
    height: unset;
    width: 100% !important;
  }
  
  .nav { flex-direction: row; flex-wrap: wrap; }
  
  .sidebar-foot {
    width: auto;
    flex-direction: row;
    justify-content: space-between;
    position: absolute;
    display: flex;
    right: 10px;
    top: 15px;
    align-content: flex-end;
    align-items: flex-end;
    gap: 10px;
  }
  .grid-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }

  .main {
    padding: 1.5rem 1.75rem 2.5rem;
    max-width: 100vw;
    width: 100%;
  }
  .form-grid {
    display: grid;
    gap: 0.9rem;
    column-gap: 20px;
    max-width: 1400px;
    justify-items: stretch;
    grid-template-columns: auto;
    align-items: start;
  }
  .form-grid.add-phone,
  .form-grid.available-phone {
    max-width: 100%;
    display: grid;
    grid-auto-flow: row;
    align-items: end;
  }
  .add-phone .actions {
    display: flex;
    gap: 0.7rem;
    align-items: center;
    justify-content: flex-start;
  }
  .add-contact {
    max-width: 100%;
  }
  .panel{
    padding: 1.2rem;
  }
  .panel-head {
    display: flex;
    justify-content: space-between;
    align-items: stretch;
    gap: 1rem;
    margin-bottom: 0.9rem;
    flex-direction: column;
  }
  .inbox-layout {
    grid-template-columns: 1fr;
    min-height: 0;
  }
  .inbox-list {
    max-height: 40vh;
  }
  .chat-log {
    min-height: 280px;
    max-height: 50vh;
  }
}

/*********************/
/*
:root {
  --radius: 14px;
  --font: "DM Sans", system-ui, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, monospace;
  --accent-soft: #1e6349;
  --line: #454545;
}

body {
  color: #e8f3ee;
  background: radial-gradient(ellipse 80% 50% at 10% -10%, rgba(45, 212, 168, 0.18), transparent 55%), radial-gradient(ellipse 50% 35% at 95% 5%, rgba(15, 110, 86, 0.28), transparent 50%), linear-gradient(180deg, #0d1a15 0%, #0b1411 40%, #0a1210 100%);
}

th, td {
  text-align: left;
  padding: 0.7rem 0.55rem;
  border-bottom: 1px solid var(--line);
}

.stat,
.panel {
  background: linear-gradient(160deg, rgba(26, 46, 38, 0.95), rgba(18, 32, 27, 0.98));
    border: 1px solid #0b1411;
    border-radius: calc(var(--radius) + 4px);
    padding: 1.75rem 1.5rem;
    margin-bottom: 1.25rem;
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.3);
    color: #e8f3ee;
}

.panel td{
  color: #a5d2a4;
}

h1 {
    margin: 0 0 0.5rem;
    font-size: clamp(1.7rem, 3vw, 2.2rem);
    letter-spacing: -0.02em;
    line-height: 1.15;
}

p {
  margin: 0;
  color: var(--muted);
  line-height: 1.55;
  max-width: 52rem;
}
  */