:root {
  --green: #0A7C5A;
  --green-deep: #075C43;
  --green-tint: #DDEFE7;
  --ink: #13201B;
  --ink-soft: #4E5E57;
  --paper: #EEF3F0;
  --surface: #FFFFFF;
  --line: #CFDCD5;
  --amber: #B7791F;
  --amber-tint: #FBF0DC;
  --red: #C2362F;
  --red-tint: #FBE5E3;
  --bubble: #DCF4E8;
  --display: "Familjen Grotesk", "Helvetica Neue", Arial, sans-serif;
  --body: "Atkinson Hyperlegible", "Helvetica Neue", Arial, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--paper); color: var(--ink); font: 16px/1.5 var(--body); min-height: 100vh; }
button, input, textarea, select { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--green); outline-offset: 2px; }
.hidden { display: none !important; }
code { font-size: .92em; background: var(--paper); padding: 1px 5px; border-radius: 4px; }

/* ---------- brand ---------- */
.wordmark { font-family: var(--display); font-weight: 700; letter-spacing: -0.02em; display: flex; align-items: center; gap: 10px; }
.wordmark svg { flex: none; }

/* ---------- form bits ---------- */
.field { display: block; margin-bottom: 14px; }
.field span { display: block; font-size: 14px; font-weight: 700; margin-bottom: 6px; }
.field small { display: block; color: var(--ink-soft); font-size: 13px; margin-top: 6px; }
input[type=text], input[type=email], input[type=password], input[type=tel], input[type=number], textarea, select {
  width: 100%; background: var(--surface); border: 1.5px solid var(--line); border-radius: 10px; padding: 11px 13px; font-size: 16px;
}
select { padding: 11px 10px; }
input:focus, textarea:focus, select:focus { border-color: var(--green); outline: none; box-shadow: 0 0 0 3px var(--green-tint); }
textarea { resize: vertical; min-height: 120px; }
.btn { border: 0; border-radius: 10px; padding: 12px 20px; font-weight: 700; cursor: pointer; background: var(--green); color: #fff; }
.btn:hover { background: var(--green-deep); }
.btn:disabled { opacity: .55; cursor: progress; }
.btn.quiet { background: var(--green-tint); color: var(--green-deep); }
.btn.quiet:hover { background: #CBE6DA; }
.btn.danger { background: var(--red-tint); color: var(--red); }
.btn.danger:hover { background: #F6D2CE; }
.btn.small { padding: 7px 12px; font-size: 14px; border-radius: 8px; }
.btn.full { width: 100%; }
.link-btn { font-size: 14px; color: var(--green-deep); cursor: pointer; text-decoration: underline; background: none; border: 0; padding: 0; }
.msg { font-size: 14px; margin-top: 12px; min-height: 1.5em; }
.msg.err { color: var(--red); }
.msg.ok { color: var(--green-deep); }

/* ---------- auth page ---------- */
.login { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; }
.login-box { width: 100%; max-width: 400px; }
.login .wordmark { font-size: 40px; margin-bottom: 8px; }
.login p.lead { color: var(--ink-soft); margin: 0 0 22px; }
.login .switch { background: #DDE7E2; }
.notice { border-radius: 12px; padding: 14px 16px; background: var(--green-tint); color: var(--green-deep); margin-bottom: 18px; font-size: 15px; }

/* ---------- admin viewing as a user ---------- */
.imp-bar { background: var(--amber-tint); color: #5A3E0C; border-bottom: 2px solid var(--amber); padding: 10px 20px; display: flex; gap: 16px; align-items: center; justify-content: center; flex-wrap: wrap; font-size: 15px; }
.imp-bar .btn { background: var(--ink); }
.imp-bar .btn:hover { background: #000; }

/* ---------- top bar ---------- */
header.bar { background: var(--ink); color: #fff; }
.bar-in { max-width: 1160px; margin: 0 auto; padding: 14px 20px; display: flex; align-items: center; gap: 20px; flex-wrap: wrap; }
.bar .wordmark { font-size: 24px; }
.bar .who { margin-right: auto; font-size: 14px; color: #B9C7C1; }
.bar .who a { color: #9FE3C6; margin-left: 10px; }
.phone-state { display: flex; align-items: center; gap: 10px; font-size: 14px; }
.bars { display: flex; align-items: flex-end; gap: 3px; height: 18px; }
.bars i { width: 4px; background: #5D6B65; border-radius: 1px; }
.bars i:nth-child(1) { height: 6px; } .bars i:nth-child(2) { height: 10px; }
.bars i:nth-child(3) { height: 14px; } .bars i:nth-child(4) { height: 18px; }
.phone-state.on .bars i { background: #5FD3A4; }
.phone-state.off .bars i:nth-child(1) { background: #F08A82; }
.quota { min-width: 180px; font-size: 14px; }
.quota-track { height: 6px; background: #2C3A34; border-radius: 3px; margin-top: 5px; overflow: hidden; }
.quota-fill { height: 100%; background: #5FD3A4; width: 0; transition: width .4s ease; }
.quota.warn .quota-fill { background: #F2B54B; }
.quota.full .quota-fill { background: #F08A82; }
.logout { background: none; border: 1px solid #43524B; color: #fff; border-radius: 8px; padding: 6px 12px; cursor: pointer; font-size: 14px; }
.logout:hover { border-color: #fff; }

/* ---------- announcement banner ---------- */
.site-banner { border-bottom: 1px solid transparent; }
.site-banner-in { max-width: 1160px; margin: 0 auto; padding: 11px 20px; display: flex; align-items: center; gap: 12px; font-size: 15px; }
.site-banner-text { flex: 1 1 auto; }
.site-banner-link { font-weight: 700; color: inherit; white-space: nowrap; }
.site-banner-x { background: none; border: 0; font-size: 22px; line-height: 1; cursor: pointer; color: inherit; opacity: .7; padding: 0 4px; }
.site-banner-x:hover { opacity: 1; }
.site-banner.info { background: #E3EEFB; color: #173F72; border-color: #C3D8F2; }
.site-banner.warning { background: var(--amber-tint); color: #5A3E0C; border-color: #EBD3A2; }
.site-banner.success { background: var(--green-tint); color: var(--green-deep); border-color: #B9DDCC; }
.site-banner.alert { background: var(--red-tint); color: #8A1F1A; border-color: #F0C3BE; }
#bPreview { border-radius: 12px; border-width: 1px; border-style: solid; }
#bPreview .site-banner-in { padding: 11px 14px; }
.banner-row { display: grid; grid-template-columns: 200px 1fr 180px; gap: 12px; }
@media (max-width: 760px) { .banner-row { grid-template-columns: 1fr; } }
.check { display: inline-flex; align-items: center; gap: 8px; font-weight: 700; font-size: 15px; cursor: pointer; }
.check input { width: 18px; height: 18px; accent-color: var(--green); }

/* ---------- layout ---------- */
main { max-width: 1160px; margin: 0 auto; padding: 28px 20px 60px; display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); gap: 28px; align-items: start; }
main.single { grid-template-columns: minmax(0, 1fr); }
@media (max-width: 900px) { main { grid-template-columns: minmax(0, 1fr); } }
h2 { font-family: var(--display); font-weight: 600; font-size: 22px; letter-spacing: -0.01em; margin: 0 0 4px; }
.sub { color: var(--ink-soft); font-size: 14px; margin: 0 0 18px; }
.panel { background: var(--surface); border-radius: 18px; padding: 24px; border: 1px solid var(--line); }
.stack { display: grid; gap: 28px; }

.switch { display: inline-flex; background: var(--paper); border-radius: 999px; padding: 4px; margin-bottom: 20px; }
.switch button { border: 0; background: none; padding: 7px 18px; border-radius: 999px; cursor: pointer; font-weight: 700; font-size: 14px; color: var(--ink-soft); }
.switch button[aria-pressed=true] { background: var(--surface); color: var(--ink); box-shadow: 0 1px 2px rgba(19,32,27,.15); }
.row { display: grid; grid-template-columns: 1fr 120px; gap: 12px; }
@media (max-width: 480px) { .row { grid-template-columns: 1fr; } }

/* live SMS preview */
.preview { margin: 6px 0 18px; background: var(--paper); border-radius: 14px; padding: 16px; }
.preview-head { display: flex; justify-content: space-between; font-size: 13px; color: var(--ink-soft); margin-bottom: 10px; }
.preview-head b { color: var(--ink); }
.bubbles { display: grid; gap: 6px; justify-items: end; }
.bubble { max-width: 88%; background: var(--bubble); border-radius: 16px 16px 4px 16px; padding: 9px 13px; white-space: pre-wrap; word-break: break-word; font-size: 15px; }
.bubble .part { display: block; font-size: 11px; color: var(--green-deep); font-weight: 700; margin-bottom: 2px; }
.bubble.empty { background: transparent; border: 1.5px dashed var(--line); color: var(--ink-soft); }
.preview.many .preview-head b { color: var(--amber); }

.otp-steps { display: grid; gap: 14px; }
.otp-line { display: grid; grid-template-columns: 1fr auto; gap: 10px; align-items: end; }
.otp-line .field { margin: 0; }
.code-input { letter-spacing: .4em; font-weight: 700; font-size: 20px !important; text-align: center; }

/* API key box */
.keybox { display: grid; grid-template-columns: 1fr auto; gap: 10px; align-items: center; background: var(--paper); border-radius: 12px; padding: 12px 14px; }
.keybox .k { font-family: ui-monospace, Menlo, monospace; font-size: 15px; word-break: break-all; }
.keybox.fresh { background: var(--amber-tint); }
.keynote { font-size: 13px; color: #6B4A10; margin-top: 8px; }
details.more { margin-top: 18px; border-top: 1px solid var(--line); padding-top: 14px; }
details.more summary { cursor: pointer; font-weight: 700; font-size: 15px; }
details.more pre { background: var(--ink); color: #E3EFEA; padding: 14px; border-radius: 10px; overflow-x: auto; font-size: 13px; line-height: 1.5; }

/* connect phone */
.pair { display: grid; grid-template-columns: 1fr 200px; gap: 20px; align-items: center; }
@media (max-width: 520px) { .pair { grid-template-columns: 1fr; justify-items: center; } }
.pair-steps { margin: 0; padding-left: 22px; display: grid; gap: 10px; }
.pair-steps li { padding-left: 4px; }
.qr-box { text-align: center; }
.qr { width: 200px; height: 200px; background: #fff; border: 1.5px solid var(--line); border-radius: 14px; padding: 8px; display: grid; place-items: center; }
.qr svg { width: 100%; height: 100%; display: block; }
.qr.expired { opacity: .25; }
.qr-fallback { font: 700 22px/1 ui-monospace, Menlo, monospace; letter-spacing: .1em; }
.qr-exp { font-size: 13px; color: var(--ink-soft); margin-top: 8px; font-variant-numeric: tabular-nums; }
.manual { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; align-items: center; font-size: 14px; }
.manual span { color: var(--ink-soft); }
.manual code { font-size: 15px; word-break: break-all; }
.other-server { display: grid; grid-template-columns: 1fr auto; gap: 10px; margin-top: 10px; align-items: center; }
.big-code { font-size: 20px !important; font-weight: 700; letter-spacing: .12em; }
.device { display: flex; gap: 16px; align-items: center; margin-top: 10px; }
.device-icon { width: 30px; height: 50px; color: var(--green); flex: none; }
.device-name { font-family: var(--display); font-size: 20px; font-weight: 600; }
.device-state { font-size: 15px; color: var(--ink-soft); }
.device-sims { font-size: 14px; color: var(--ink-soft); margin-top: 2px; }
.dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 7px; vertical-align: 1px; }
.dot.on { background: #1FA971; }
.dot.off { background: var(--red); }

/* network status */
.device-sims { display: grid; gap: 6px; margin-top: 8px; }
.net { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; font-size: 14px; color: var(--ink); }
.net-slot { font-size: 12px; font-weight: 700; color: var(--ink-soft); background: var(--paper); border-radius: 6px; padding: 1px 7px; }
.net-carrier { font-weight: 700; }
.net-gen { font-size: 12px; font-weight: 700; color: var(--green-deep); background: var(--green-tint); border-radius: 6px; padding: 1px 6px; }
.net-tag { font-size: 12px; font-weight: 700; color: #6B4A10; background: var(--amber-tint); border-radius: 6px; padding: 1px 6px; }
.net-warn, .warn-text { color: var(--red); font-weight: 700; }
.net-time { font-size: 12px; color: var(--ink-soft); }
.sig { display: inline-flex; align-items: flex-end; gap: 2px; height: 12px; vertical-align: -1px; }
.sig i { width: 3px; background: var(--line); border-radius: 1px; }
.sig i:nth-child(1) { height: 4px; } .sig i:nth-child(2) { height: 6px; } .sig i:nth-child(3) { height: 9px; } .sig i:nth-child(4) { height: 12px; }
.sig i.on { background: var(--green); }

/* history */
.hist-head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.filters { display: flex; gap: 6px; flex-wrap: wrap; margin: 4px 0 16px; }
.chip { border: 1.5px solid var(--line); background: var(--surface); border-radius: 999px; padding: 4px 12px; font-size: 13px; cursor: pointer; }
.chip[aria-pressed=true] { border-color: var(--ink); background: var(--ink); color: #fff; }
.list { display: grid; }
.item { display: grid; grid-template-columns: 1fr auto; gap: 4px 14px; padding: 13px 0; border-top: 1px solid var(--line); }
.item:first-child { border-top: 0; }
.item .to { font-weight: 700; font-variant-numeric: tabular-nums; }
.item .text { grid-column: 1 / -1; color: var(--ink-soft); font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.item .when { font-size: 13px; color: var(--ink-soft); text-align: right; }
.item .err { grid-column: 1 / -1; font-size: 13px; color: var(--red); }
.item .owner { font-size: 13px; color: var(--ink-soft); text-align: right; }
.tick { font-size: 13px; font-weight: 700; display: inline-flex; align-items: center; gap: 4px; }
.tick.queued, .tick.sent { color: var(--ink-soft); }
.tick.delivered { color: var(--green); }
.tick.failed, .tick.failed_local { color: var(--red); }
.empty-state { padding: 28px 0; text-align: center; color: var(--ink-soft); }
.banner { border-radius: 12px; padding: 12px 14px; font-size: 14px; margin-bottom: 18px; }
.banner.warn { background: var(--amber-tint); color: #6B4A10; }

/* ---------- admin ---------- */
.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
@media (max-width: 760px) { .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 16px 18px; }
.stat .n { font-family: var(--display); font-size: 30px; font-weight: 700; line-height: 1.1; font-variant-numeric: tabular-nums; }
.stat .l { font-size: 14px; color: var(--ink-soft); }
.stat.attn { border-color: var(--amber); background: var(--amber-tint); }
.table-wrap { overflow-x: auto; margin: 0 -24px; padding: 0 24px; }
table.users { width: 100%; border-collapse: collapse; font-size: 15px; min-width: 760px; }
table.users th { text-align: left; font-size: 13px; color: var(--ink-soft); font-weight: 700; padding: 8px 10px; border-bottom: 1.5px solid var(--line); }
table.users td { padding: 12px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.users tr:last-child td { border-bottom: 0; }
table.users .email { font-weight: 700; }
table.users .name { font-size: 13px; color: var(--ink-soft); }
table.users input.lim { width: 84px; padding: 6px 8px; font-size: 15px; }
table.users .ph { font-weight: 700; white-space: nowrap; }
table.users .num { font-variant-numeric: tabular-nums; }
.pill { display: inline-block; border-radius: 999px; padding: 2px 10px; font-size: 13px; font-weight: 700; }
.pill.active { background: var(--green-tint); color: var(--green-deep); }
.pill.pending { background: var(--amber-tint); color: #6B4A10; }
.pill.blocked { background: var(--red-tint); color: var(--red); }
.pill.admin { background: var(--ink); color: #fff; margin-left: 6px; }
.actions { display: flex; gap: 6px; flex-wrap: wrap; }

.toast { position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 20px); background: var(--ink); color: #fff; padding: 12px 18px; border-radius: 12px; font-size: 15px; opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; max-width: calc(100% - 32px); z-index: 10; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.err { background: var(--red); }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
#bText { min-height: 72px; }

.text.muted { color: #8a8f98; font-style: italic; }

/* ---------- footer ---------- */
.site-foot { border-top: 1px solid var(--line); background: var(--surface); color: var(--ink-soft); font-size: 14px; }
.site-foot-in { max-width: 1160px; margin: 0 auto; padding: 18px 20px; display: flex; flex-wrap: wrap; gap: 10px 24px; align-items: center; justify-content: space-between; }
.site-foot nav { display: flex; flex-wrap: wrap; gap: 6px 20px; }
.site-foot a { color: var(--ink-soft); text-decoration: none; }
.site-foot a:hover { color: var(--green); text-decoration: underline; }
.login { min-height: calc(100vh - 60px); }
.agree { font-size: 13px; color: var(--ink-soft); margin: 12px 0 0; text-align: center; }
.agree a { color: var(--green); }

/* ---------- legal pages ---------- */
.home-link { color: inherit; text-decoration: none; }
.legal-nav { margin-left: auto; display: flex; gap: 18px; }
.legal-nav a { color: #B9C7C1; text-decoration: none; font-size: 15px; }
.legal-nav a[aria-current="page"], .legal-nav a:hover { color: #9FE3C6; }
.legal { max-width: 760px; margin: 0 auto; padding: 36px 20px 64px; }
.legal h1 { font-family: var(--display); font-size: 38px; line-height: 1.1; letter-spacing: -0.02em; margin: 0 0 6px; }
.legal h2 { font-family: var(--display); font-size: 22px; margin: 34px 0 8px; }
.legal h3 { font-size: 16px; margin: 20px 0 4px; }
.legal p, .legal li { color: var(--ink); }
.legal ul { padding-left: 22px; }
.legal li { margin: 4px 0; }
.legal a { color: var(--green); }
.legal-date { color: var(--ink-soft); font-size: 14px; margin: 0 0 24px; }
.legal-callout { background: var(--green-tint); border-left: 4px solid var(--green); border-radius: 8px; padding: 14px 16px; margin: 20px 0; }
@media (max-width: 520px) { .legal h1 { font-size: 30px; } .site-foot-in { flex-direction: column; align-items: flex-start; } }
.site-foot a.foot-maker { color: var(--green); font-weight: 700; }

/* ---------- app download ---------- */
.app-dl { display: flex; gap: 16px; align-items: flex-start; background: var(--green-tint); border-radius: 12px; padding: 14px; margin: 0 0 18px; }
.app-dl-qr { flex: none; width: 112px; height: 112px; background: #fff; border-radius: 8px; padding: 4px; }
.app-dl-qr svg { width: 100%; height: 100%; display: block; }
.app-dl-body { min-width: 0; }
.app-dl-body .sub { margin: 4px 0 10px; }
.app-dl-body a:not(.btn) { color: var(--green-deep); word-break: break-all; }
.app-dl .btn.small { display: inline-block; text-decoration: none; }
.app-dl details.more { margin-top: 10px; }
.install-steps { margin: 8px 0 0; padding-left: 20px; font-size: 14px; color: var(--ink-soft); }
.install-steps li { margin: 3px 0; }
.get-app { text-align: center; font-size: 14px; color: var(--ink-soft); margin: 22px 0 0; }
.get-app a { color: var(--green); font-weight: 700; }
@media (max-width: 520px) { .app-dl-qr { display: none; } }

/* keep the footer at the bottom of short pages */
body { display: flex; flex-direction: column; }
body > main, body > article, body > section, body > header, body > div { width: 100%; }
.site-foot { margin-top: auto; width: 100%; }
#snippetGet { white-space: pre-wrap; word-break: break-all; }
