:root {
  --ink: #14231e;
  --muted: #607169;
  --line: #dce8e2;
  --paper: #f5f8f6;
  --card: #fff;
  --green: #17765b;
  --green2: #0c503d;
  --mint: #dff4ec;
  --amber: #d88712;
  --red: #b43a44;
  --shadow: 0 18px 50px rgba(21, 53, 42, 0.09);
  font-family:
    Inter,
    ui-sans-serif,
    system-ui,
    -apple-system,
    "Segoe UI",
    sans-serif;
  color: var(--ink);
  background: var(--paper);
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  min-height: 100vh;
}
button,
input,
select,
textarea {
  font: inherit;
}
button,
a {
  touch-action: manipulation;
}
.hidden {
  display: none !important;
}
.muted {
  color: var(--muted);
}
.fine {
  font-size: 0.77rem;
  line-height: 1.5;
  color: var(--muted);
}
.eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-size: 0.68rem;
  font-weight: 800;
  color: var(--green);
  margin: 0 0 0.35rem;
}
.brand-mark {
  width: 54px;
  height: 54px;
  border-radius: 17px;
  display: grid;
  place-items: center;
  background: linear-gradient(145deg, #2ca27d, var(--green2));
  color: #fff;
  font-weight: 900;
  font-size: 1.4rem;
  box-shadow: 0 12px 30px rgba(23, 118, 91, 0.28);
}
.brand-mark.small {
  width: 38px;
  height: 38px;
  border-radius: 12px;
  font-size: 1rem;
  flex: none;
}
.login-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(circle at 20% 10%, #d9f3e9, transparent 34%),
    radial-gradient(circle at 90% 90%, #dfeae5, transparent 38%), #f6f8f7;
}
.login-panel {
  width: min(430px, 100%);
  background: rgba(255, 255, 255, 0.94);
  padding: 42px;
  border: 1px solid rgba(255, 255, 255, 0.8);
  border-radius: 28px;
  box-shadow: var(--shadow);
}
.login-panel h1 {
  font-size: 2rem;
  margin: 0.7rem 0 0.4rem;
}
.stack {
  display: grid;
  gap: 16px;
  margin: 28px 0;
}
.stack label,
.field {
  font-size: 0.8rem;
  font-weight: 750;
  display: grid;
  gap: 7px;
}
.stack input,
.field input,
.field select,
.field textarea,
input,
select,
textarea {
  width: 100%;
  font-size: 1rem;
  border: 1px solid var(--line);
  border-radius: 11px;
  padding: 11px 12px;
  background: #fff;
  color: var(--ink);
  outline: none;
}
input:focus,
select:focus,
textarea:focus {
  border-color: #3e9e80;
  box-shadow: 0 0 0 3px rgba(62, 158, 128, 0.13);
}
button {
  min-height: 44px;
  border: 0;
  border-radius: 10px;
  padding: 10px 14px;
  font-weight: 750;
  cursor: pointer;
}
.primary {
  background: var(--green);
  color: #fff;
}
.primary:hover {
  background: var(--green2);
}
.secondary {
  background: var(--mint);
  color: var(--green2);
}
.danger {
  background: #fae9eb;
  color: var(--red);
}
.ghost {
  background: transparent;
  color: inherit;
  border: 1px solid var(--line);
}
.icon-button {
  display: none;
  background: var(--mint);
  padding: 9px 12px;
}
.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 244px 1fr;
}
.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  background: #102d24;
  color: #dff5ed;
  padding: 22px 15px;
  display: flex;
  flex-direction: column;
}
.brand {
  display: flex;
  align-items: center;
  gap: 11px;
  color: white;
  text-decoration: none;
  padding: 0 7px 20px;
  font-size: 0.79rem;
  line-height: 1.2;
}
.brand strong {
  font-size: 0.95rem;
}
.sidebar nav {
  display: grid;
  gap: 4px;
  overflow-y: auto;
}
.sidebar nav a {
  color: #bcd4cc;
  text-decoration: none;
  padding: 10px 12px;
  border-radius: 10px;
  font-size: 0.86rem;
  font-weight: 650;
}
.sidebar nav a:hover,
.sidebar nav a.active {
  background: rgba(255, 255, 255, 0.1);
  color: white;
}
.sidebar-foot {
  margin-top: auto;
  display: grid;
  gap: 10px;
  padding: 12px 5px;
}
.sidebar-foot .ghost {
  border-color: rgba(255, 255, 255, 0.18);
  color: white;
}
.workspace {
  min-width: 0;
}
.topbar {
  min-height: 92px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.86);
  backdrop-filter: blur(12px);
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 17px 30px;
  position: sticky;
  top: 0;
  z-index: 5;
}
.topbar h1 {
  font-size: 1.45rem;
  margin: 0;
}
.user-chip {
  margin-left: auto;
  display: grid;
  grid-template-columns: auto auto;
  column-gap: 8px;
  align-items: center;
  font-size: 0.81rem;
  font-weight: 750;
}
.user-chip small {
  grid-column: 2;
  color: var(--muted);
  font-weight: 500;
}
.presence {
  width: 10px;
  height: 10px;
  background: #34b58a;
  border-radius: 50%;
  grid-row: span 2;
  box-shadow: 0 0 0 4px #dff5ed;
}
.content {
  padding: 28px 30px 50px;
  max-width: 1500px;
  margin: 0 auto;
}
.hero {
  background: linear-gradient(120deg, #174b3b, #21795e);
  color: #fff;
  border-radius: 22px;
  padding: 26px 28px;
  margin-bottom: 22px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  box-shadow: var(--shadow);
}
.hero h2 {
  margin: 0 0 7px;
  font-size: 1.35rem;
}
.hero p {
  margin: 0;
  color: #d8eee6;
  max-width: 720px;
}
.grid {
  display: grid;
  gap: 16px;
}
.grid.metrics {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}
.grid.two {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
.grid.three {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 19px;
  box-shadow: 0 6px 24px rgba(24, 58, 47, 0.04);
}
.card h2,
.card h3 {
  margin: 0 0 12px;
}
.metric span {
  display: block;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 650;
}
.metric strong {
  display: block;
  font-size: 1.75rem;
  margin-top: 7px;
}
.metric small {
  color: var(--green);
}
.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 25px 0 12px;
}
.section-head h2 {
  font-size: 1rem;
  margin: 0;
}
.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.table-wrap {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
}
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
}
th,
td {
  text-align: left;
  padding: 11px 13px;
  border-bottom: 1px solid #e8efeb;
  vertical-align: middle;
}
th {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--muted);
  background: #fafcfb;
  white-space: nowrap;
}
tr:last-child td {
  border-bottom: 0;
}
.badge {
  display: inline-flex;
  align-items: center;
  width: max-content;
  border-radius: 999px;
  padding: 4px 8px;
  font-size: 0.68rem;
  font-weight: 800;
  background: rgba(255, 255, 255, 0.13);
  color: inherit;
}
.badge.active,
.badge.connected,
.badge.completed,
.badge.sent,
.badge.paid {
  background: #dff5ed;
  color: #14684f;
}
.badge.inactive,
.badge.draft,
.badge.pending {
  background: #eef2f0;
  color: #586960;
}
.badge.error,
.badge.failed,
.badge.cancelled {
  background: #fbe7e9;
  color: #a62d39;
}
.badge.running,
.badge.scheduled,
.badge.qr {
  background: #fff0d8;
  color: #8b590c;
}
.toolbar {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}
.toolbar input,
.toolbar select {
  width: auto;
  min-width: 180px;
}
.inline-form {
  display: grid;
  grid-template-columns: repeat(4, minmax(120px, 1fr)) auto;
  gap: 10px;
  align-items: end;
}
.empty {
  text-align: center;
  padding: 42px;
  color: var(--muted);
}
.notice {
  border-left: 4px solid var(--amber);
  background: #fff7e8;
  padding: 13px 15px;
  border-radius: 8px;
  font-size: 0.82rem;
  margin-bottom: 16px;
}
.notice.safe {
  border-color: var(--green);
  background: var(--mint);
}
.qr {
  max-width: 340px;
  width: 100%;
  border-radius: 18px;
  border: 1px solid var(--line);
}
.progress {
  height: 7px;
  background: #e5ece8;
  border-radius: 99px;
  overflow: hidden;
}
.progress > span {
  height: 100%;
  background: var(--green);
  display: block;
}
.toast {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 99;
  background: #18362c;
  color: white;
  padding: 12px 16px;
  border-radius: 10px;
  box-shadow: var(--shadow);
  opacity: 0;
  transform: translateY(10px);
  transition: 0.2s;
  pointer-events: none;
}
.toast.show {
  opacity: 1;
  transform: none;
}
.toast.error {
  background: #8e2832;
}
.split {
  display: grid;
  grid-template-columns: 330px 1fr;
  gap: 16px;
}
.conversation-list {
  max-height: 65vh;
  overflow: auto;
}
.conversation {
  display: block;
  width: 100%;
  text-align: left;
  background: white;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  padding: 14px;
}
.conversation:hover {
  background: #f3f8f5;
}
.messages {
  height: 52vh;
  overflow: auto;
  background: #edf3ef;
  border-radius: 12px;
  padding: 16px;
}
.bubble {
  width: max-content;
  max-width: 78%;
  background: #fff;
  padding: 9px 12px;
  border-radius: 12px;
  margin: 7px 0;
  font-size: 0.85rem;
}
.bubble.outbound {
  margin-left: auto;
  background: #d8f1e7;
}
.bubble time {
  display: block;
  color: var(--muted);
  font-size: 0.65rem;
  margin-top: 4px;
}
.tabs {
  display: flex;
  gap: 6px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 16px;
}
.tabs button {
  background: transparent;
  border-radius: 8px 8px 0 0;
}
.tabs button.active {
  background: var(--mint);
  color: var(--green2);
}
@media (max-width: 1050px) {
  .grid.metrics {
    grid-template-columns: repeat(2, 1fr);
  }
  .grid.three {
    grid-template-columns: 1fr;
  }
  .inline-form {
    grid-template-columns: 1fr 1fr;
  }
  .split {
    grid-template-columns: 1fr;
  }
  .conversation-list {
    max-height: 280px;
  }
}
@media (max-width: 760px) {
  .app-shell {
    display: block;
  }
  .sidebar {
    position: fixed;
    left: -270px;
    z-index: 20;
    width: 250px;
    transition: 0.2s;
  }
  .sidebar.open {
    left: 0;
    box-shadow: 20px 0 50px rgba(0, 0, 0, 0.2);
  }
  .icon-button {
    display: block;
  }
  .topbar {
    padding: 13px 16px;
    min-height: 78px;
  }
  .user-chip {
    display: none;
  }
  .content {
    padding: 18px 14px 40px;
  }
  .grid.metrics,
  .grid.two {
    grid-template-columns: 1fr;
  }
  .inline-form {
    grid-template-columns: 1fr;
  }
  .hero {
    align-items: flex-start;
    flex-direction: column;
    padding: 21px;
  }
  .card {
    padding: 15px;
  }
  .login-panel {
    padding: 30px 24px;
  }
  .toolbar input,
  .toolbar select {
    width: 100%;
  }
}
@media (prefers-reduced-motion: reduce) {
  * {
    scroll-behavior: auto !important;
    transition: none !important;
  }
}
