:root {
  --brand: #155faa;
  --brand-dark: #0f4a86;
  --bg: #f4f6f9;
  --card: #fff;
  --text: #1c2430;
  --muted: #667085;
  --border: #dde3ea;
  --danger: #c62828;
  --ok: #2e7d32;
  --warn: #b26a00;
  --bubble: #dcf8c6;
}
* { box-sizing: border-box; }
body { margin: 0; font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; background: var(--bg); color: var(--text); }
[hidden] { display: none !important; }
h1, h2, h3 { margin: 0 0 .75rem; line-height: 1.25; }
h1 { font-size: 1.4rem; } h2 { font-size: 1.15rem; } h3 { font-size: 1rem; margin-top: 1rem; }
h3 small { font-weight: normal; color: var(--muted); }

.topbar { display: flex; align-items: center; gap: 1rem; padding: .75rem 1rem; background: #fff; border-bottom: 1px solid var(--border); }
.logo { height: 36px; }
.title { font-weight: 600; font-size: 1.1rem; margin-right: auto; }
.badge { font-size: .75rem; font-weight: 600; padding: .2rem .55rem; border-radius: 99px; background: #fff3e0; color: var(--warn); }
.badge.live { background: #e8f5e9; color: var(--ok); }

main { max-width: 860px; margin: 1.25rem auto; padding: 0 16px; }
.card { background: var(--card); border: 1px solid var(--border); border-radius: 10px; padding: 1.1rem 1.25rem; margin-bottom: 1rem; }
.narrow { max-width: 380px; margin: 4rem auto; }

.tabs { display: flex; gap: .25rem; margin-bottom: 1rem; border-bottom: 1px solid var(--border); }
.tabs button { border: 0; background: none; padding: .6rem 1rem; font: inherit; color: var(--muted); cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tabs button.active { color: var(--brand); border-bottom-color: var(--brand); font-weight: 600; }

label { display: block; font-weight: 500; margin-bottom: .75rem; }
label.inline { display: inline-flex; align-items: center; gap: .4rem; margin: 0; font-weight: normal; cursor: pointer; }
input:not([type=checkbox]), textarea { width: 100%; font: inherit; padding: .55rem .7rem; border: 1px solid var(--border); border-radius: 7px; background: #fff; color: inherit; }
input:focus, textarea:focus { outline: 2px solid var(--brand); outline-offset: -1px; }
textarea { resize: vertical; }

button { font: inherit; padding: .5rem .95rem; border-radius: 7px; border: 1px solid var(--border); background: #fff; cursor: pointer; white-space: nowrap; }
button:hover { background: #f0f3f7; }
button.primary { background: var(--brand); border-color: var(--brand); color: #fff; font-weight: 600; }
button.primary:hover { background: var(--brand-dark); }
button.primary:disabled { opacity: .5; cursor: default; }
button.danger { color: var(--danger); }
button.link { border: 0; background: none; color: var(--brand); padding: .25rem; }
button.small { padding: .2rem .55rem; font-size: .85rem; }

.row { display: flex; gap: .5rem; align-items: center; }
.row > input { flex: 1; }
.row-between { display: flex; justify-content: space-between; align-items: center; gap: .75rem; flex-wrap: wrap; }
.row-end { display: flex; justify-content: flex-end; gap: .5rem; }
.hint { color: var(--muted); font-size: .85rem; margin-top: .3rem; }
.error { color: var(--danger); min-height: 1.2em; margin: .5rem 0 0; }
.over { color: var(--danger); font-weight: 600; }

.bubble { background: var(--bubble); border-radius: 8px 8px 8px 0; padding: .6rem .8rem; max-width: 520px; white-space: pre-wrap; word-wrap: break-word; color: #111; }
.bubble:empty::before { content: "Your message will appear here."; color: var(--muted); }

.checklist { list-style: none; padding: 0; margin: 0 0 1rem; display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: .4rem; }
.checklist li { border: 1px solid var(--border); border-radius: 7px; padding: .45rem .6rem; }
.checklist .muted { color: var(--muted); font-size: .85rem; }

.client-head { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; }
.client-head h2 { margin: 0 auto 0 0; }
.inactive { opacity: .55; }
table { width: 100%; border-collapse: collapse; margin: .75rem 0; }
th, td { text-align: left; padding: .45rem .4rem; border-bottom: 1px solid var(--border); vertical-align: top; }
th { font-size: .8rem; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .03em; }
td.actions { text-align: right; white-space: nowrap; }
.add-contact { display: grid; grid-template-columns: 1fr 1fr auto; gap: .5rem; }

.history-item { cursor: pointer; }
.history-item:hover { border-color: var(--brand); }
.history-item .body { margin: .35rem 0; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.stats { display: flex; gap: .9rem; flex-wrap: wrap; font-size: .85rem; color: var(--muted); }
.status { font-size: .8rem; font-weight: 600; padding: .1rem .45rem; border-radius: 99px; background: #eef1f5; }
.status.failed { background: #fdecea; color: var(--danger); }
.status.delivered, .status.read { background: #e8f5e9; color: var(--ok); }
.status.dry-run { background: #fff3e0; color: var(--warn); }

dialog { border: 1px solid var(--border); border-radius: 10px; padding: 1.25rem; max-width: 420px; width: calc(100% - 32px); }
dialog::backdrop { background: rgba(0,0,0,.35); }

@media (max-width: 600px) {
  .add-contact { grid-template-columns: 1fr; }
  .logo { height: 28px; }
  th:nth-child(3), td:nth-child(3) { display: none; }
}
