/* LIMIVEX WhatsApp. Light only, Limivex brand: azure does the talking, yellow is the spice. */
@font-face { font-family: "Satoshi"; src: url("/fonts/Satoshi-Regular.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Satoshi"; src: url("/fonts/Satoshi-Medium.woff2") format("woff2"); font-weight: 500; font-display: swap; }
@font-face { font-family: "Satoshi"; src: url("/fonts/Satoshi-Bold.woff2") format("woff2"); font-weight: 700; font-display: swap; }

:root {
  --azure: #032a47;
  --azure-lit: #0b3a5c;
  --yellow: #fdc004;
  --yellow-deep: #e4a000;
  --ink: #032a47;
  --grey: #666666;
  --line: rgb(0 0 0 / 0.1);
  --line-strong: rgb(0 0 0 / 0.18);
  --surface: #fafafa;
  --white: #ffffff;
  --ok: #15803d;
  --ok-bg: #ecf7ef;
  --warn-bg: #fff6d6;
  --err: #cb3434;
  --err-bg: #fbeaea;
  --radius: 12px;
  --display: "Albert Sans", system-ui, sans-serif;
  --body: "Satoshi", system-ui, sans-serif;
  --serif: "Instrument Serif", Georgia, serif;
  color-scheme: light;
}

* { box-sizing: border-box; }
html, body { margin: 0; background: var(--white); color: var(--ink); }
body { font: 400 15px/1.55 var(--body); -webkit-font-smoothing: antialiased; }
h1, h2, h3, h4 { font-family: var(--display); font-weight: 700; letter-spacing: -0.02em; margin: 0; line-height: 1.15; }
h1 { font-size: 30px; }
h2 { font-size: 21px; }
h3 { font-size: 16px; letter-spacing: -0.01em; }
p { margin: 0; }
a { color: var(--azure); }
.muted { color: var(--grey); }
.small { font-size: 13px; }
.num { font-variant-numeric: tabular-nums; }
.eyebrow { font: italic 400 17px/1 var(--serif); color: var(--grey); }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--yellow-deep); outline-offset: 2px; border-radius: 6px; }

/* ---- shell ---- */
.top { position: sticky; top: 0; z-index: 10; background: rgb(255 255 255 / 0.94); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); }
.top-in { max-width: 1240px; margin: 0 auto; padding: 12px 24px; display: flex; align-items: center; gap: 24px; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; }
.brand img { height: 22px; display: block; }
.brand span { font: 700 13px/1 var(--display); letter-spacing: 0.08em; text-transform: uppercase; color: var(--azure); border-left: 1px solid var(--line-strong); padding-left: 10px; }
.nav { display: flex; gap: 4px; flex: 1; overflow-x: auto; }
.nav a { text-decoration: none; color: var(--grey); padding: 7px 12px; border-radius: 999px; font-weight: 500; white-space: nowrap; }
.nav a:hover { color: var(--azure); background: var(--surface); }
.nav a.on { color: var(--azure); background: rgb(3 42 71 / 0.07); }
.who { display: flex; align-items: center; gap: 10px; }
.who select { max-width: 180px; }
main { max-width: 1240px; margin: 0 auto; padding: 32px 24px 80px; }

/* ---- controls ---- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 0; cursor: pointer; font: 500 14px/1 var(--body);
  padding: 11px 18px; border-radius: 999px; text-decoration: none; transition: transform .08s ease, box-shadow .15s ease; white-space: nowrap; }
.btn:active { transform: translateY(1px); }
.btn-primary { color: var(--white); background: linear-gradient(180deg, var(--azure-lit), var(--azure)); box-shadow: 0 1px 0 rgb(255 255 255 / 0.15) inset, 0 2px 6px rgb(3 42 71 / 0.25); }
.btn-primary:hover { box-shadow: 0 1px 0 rgb(255 255 255 / 0.15) inset, 0 4px 12px rgb(3 42 71 / 0.3); }
.btn-yellow { color: var(--azure); background: linear-gradient(180deg, var(--yellow), var(--yellow-deep)); box-shadow: 0 2px 6px rgb(228 160 0 / 0.35); }
.btn-ghost { color: var(--azure); background: var(--white); border: 1px solid var(--line-strong); }
.btn-ghost:hover { background: var(--surface); }
.btn-danger { color: var(--err); background: var(--white); border: 1px solid rgb(203 52 52 / 0.35); }
.btn-sm { padding: 7px 12px; font-size: 13px; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.link { background: none; border: 0; padding: 0; color: var(--azure); text-decoration: underline; cursor: pointer; font: inherit; }

label { display: block; font-weight: 500; font-size: 13px; margin-bottom: 6px; }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=time], input[type=search], select, textarea {
  width: 100%; font: 400 15px/1.4 var(--body); color: var(--ink); background: var(--white);
  border: 1px solid var(--line-strong); border-radius: 10px; padding: 10px 12px; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--azure); box-shadow: 0 0 0 3px rgb(3 42 71 / 0.1); }
textarea { resize: vertical; min-height: 110px; line-height: 1.5; }
.field { margin-bottom: 16px; }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.row > .grow { flex: 1; min-width: 160px; }
.check { display: flex; gap: 8px; align-items: center; font-weight: 400; font-size: 14px; cursor: pointer; margin: 0; }
.days { display: flex; gap: 6px; flex-wrap: wrap; }
.days label { margin: 0; }
.days input { position: absolute; opacity: 0; pointer-events: none; }
.days span { display: inline-block; min-width: 44px; text-align: center; padding: 7px 0; border-radius: 8px; border: 1px solid var(--line-strong); cursor: pointer; font-size: 13px; }
.days input:checked + span { background: var(--azure); color: var(--white); border-color: var(--azure); }
.days input:focus-visible + span { outline: 2px solid var(--yellow-deep); outline-offset: 2px; }

/* ---- surfaces ---- */
.card { background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; }
.card + .card { margin-top: 16px; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; }
.head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; margin-bottom: 24px; flex-wrap: wrap; }
.head .eyebrow { display: block; margin-bottom: 6px; }
.grid { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 24px; align-items: start; }
.stack > * + * { margin-top: 16px; }
.notice { padding: 12px 14px; border-radius: 10px; font-size: 14px; background: var(--warn-bg); border: 1px solid rgb(228 160 0 / 0.35); }
.notice.err { background: var(--err-bg); border-color: rgb(203 52 52 / 0.3); color: #8a2020; }
.notice.ok { background: var(--ok-bg); border-color: rgb(21 128 61 / 0.25); color: #0f5a2b; }
.notice ul { margin: 6px 0 0; padding-left: 18px; }
.empty { text-align: center; padding: 56px 24px; border: 1px dashed var(--line-strong); border-radius: var(--radius); }
.empty h2 { margin-bottom: 8px; }
.empty p { margin-bottom: 18px; color: var(--grey); }

.pill { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 500; padding: 3px 10px; border-radius: 999px; background: var(--surface); border: 1px solid var(--line); color: var(--grey); white-space: nowrap; }
.pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.pill.running, .pill.authorized, .pill.replied { color: var(--ok); background: var(--ok-bg); border-color: rgb(21 128 61 / 0.2); }
.pill.paused, .pill.pending, .pill.notAuthorized, .pill.starting { color: #8a6000; background: var(--warn-bg); border-color: rgb(228 160 0 / 0.3); }
.pill.failed, .pill.no_whatsapp, .pill.opted_out, .pill.blocked { color: var(--err); background: var(--err-bg); border-color: rgb(203 52 52 / 0.2); }
.pill.active { color: var(--azure); background: rgb(3 42 71 / 0.06); }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 0; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.stat { padding: 16px 18px; border-right: 1px solid var(--line); }
.stat:last-child { border-right: 0; }
.stat b { display: block; font: 700 26px/1.1 var(--display); letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.stat span { font-size: 12px; color: var(--grey); }

table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { text-align: left; font-weight: 500; font-size: 12px; color: var(--grey); padding: 10px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
td { padding: 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
tr.click { cursor: pointer; }
tr.click:hover td { background: var(--surface); }
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); }
.table-wrap table tr:last-child td { border-bottom: 0; }

.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin-bottom: 20px; overflow-x: auto; }
.tabs button { background: none; border: 0; padding: 10px 14px; font: 500 14px/1 var(--body); color: var(--grey); cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tabs button.on { color: var(--azure); border-bottom-color: var(--yellow); }

/* ---- campaign list ---- */
.camps { display: grid; gap: 12px; }
.camp { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 16px; align-items: center; padding: 18px 20px; border: 1px solid var(--line); border-radius: var(--radius); text-decoration: none; color: inherit; transition: border-color .15s ease, box-shadow .15s ease; }
.camp:hover { border-color: var(--line-strong); box-shadow: 0 4px 14px rgb(3 42 71 / 0.06); }
.camp h3 { margin-bottom: 6px; }
.camp .meta { display: flex; gap: 14px; flex-wrap: wrap; font-size: 13px; color: var(--grey); }

/* ---- signature: the day rail. A sequence is a line through time with a stop per message. ---- */
.rail { display: flex; align-items: flex-start; gap: 0; padding: 4px 0 0; overflow-x: auto; }
.rail .stop { flex: 0 0 auto; display: flex; flex-direction: column; align-items: center; min-width: 64px; }
.rail .dot { width: 30px; height: 30px; border-radius: 50%; border: 2px solid var(--azure); background: var(--white); display: grid; place-items: center; font: 700 12px/1 var(--display); color: var(--azure); }
.rail .stop.first .dot { background: var(--azure); color: var(--yellow); }
.rail .stop span { margin-top: 6px; font: 700 13px/1 var(--display); white-space: nowrap; }
.rail .stop small { color: var(--grey); font-size: 11px; margin-top: 3px; white-space: nowrap; }
.rail .gap { flex: 1 1 auto; min-width: 28px; height: 2px; margin-top: 14px; background: repeating-linear-gradient(90deg, var(--azure) 0 6px, transparent 6px 11px); position: relative; }
.rail .gap em { position: absolute; top: -18px; left: 50%; transform: translateX(-50%); font: italic 400 13px/1 var(--serif); color: var(--grey); white-space: nowrap; }
.rail.mini .dot { width: 18px; height: 18px; font-size: 0; border-width: 2px; }
.rail.mini .stop { min-width: 44px; }
.rail.mini .gap { margin-top: 8px; min-width: 14px; }
.rail.mini .stop span { font-size: 11px; margin-top: 4px; }

/* Today's sending rhythm: the window as a bar, a tick per planned send. */
.rhythm { margin-top: 10px; }
.rhythm .bar { position: relative; height: 34px; border-radius: 8px; background: var(--surface); border: 1px solid var(--line); overflow: hidden; }
.rhythm .done { position: absolute; inset: 0 auto 0 0; background: rgb(3 42 71 / 0.06); border-right: 2px solid var(--yellow); }
.rhythm .tick { position: absolute; top: 9px; width: 2px; height: 16px; border-radius: 1px; background: var(--azure); }
.rhythm .tick.past { opacity: .35; }
.rhythm .ends { display: flex; justify-content: space-between; font-size: 12px; color: var(--grey); margin-top: 4px; }

/* ---- sequence editor ---- */
.step { border: 1px solid var(--line); border-radius: var(--radius); background: var(--white); }
.step + .step { margin-top: 0; }
.step-head { display: flex; align-items: center; gap: 12px; padding: 14px 16px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.step-head h3, .step-head .muted { white-space: nowrap; }
.step-head .dayin { width: 74px; }
.step-head .dayin input { padding: 6px 8px; text-align: center; font-weight: 700; }
.step-body { padding: 16px; }
.var { margin-bottom: 14px; }
.var-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; }
.var-tag { font: 700 12px/1 var(--display); letter-spacing: .06em; color: var(--azure); background: var(--yellow); padding: 4px 8px; border-radius: 6px; }
.var-tools { display: flex; gap: 10px; align-items: center; font-size: 12px; color: var(--grey); }
.between { display: flex; align-items: center; gap: 10px; padding: 10px 0 10px 28px; color: var(--grey); font: italic 400 15px/1 var(--serif); }
.between::before { content: ""; width: 2px; height: 28px; background: repeating-linear-gradient(180deg, var(--azure) 0 5px, transparent 5px 9px); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { font: 500 12px/1 var(--body); padding: 6px 9px; border-radius: 999px; border: 1px solid var(--line-strong); background: var(--white); color: var(--azure); cursor: pointer; }
.chip:hover { background: var(--surface); }
.bubble { background: #e7f6dd; border-radius: 10px 10px 10px 2px; padding: 9px 12px; font-size: 14px; white-space: pre-wrap; margin-top: 6px; max-width: 520px; }
.bubble.in { background: var(--surface); border: 1px solid var(--line); border-radius: 10px 10px 2px 10px; margin-left: auto; }
.bubble-meta { font-size: 11px; color: var(--grey); margin-top: 3px; }
.thread { display: flex; flex-direction: column; gap: 8px; }
.thread .msg { display: flex; flex-direction: column; }
.thread .msg.in { align-items: flex-end; }

/* ---- CSV mapper ---- */
.drop { border: 2px dashed var(--line-strong); border-radius: var(--radius); padding: 32px; text-align: center; cursor: pointer; transition: border-color .15s, background .15s; }
.drop.over, .drop:hover { border-color: var(--azure); background: var(--surface); }
.drop input { display: none; }
.map { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; }

/* ---- QR ---- */
.qr { display: grid; place-items: center; width: 280px; height: 280px; margin: 0 auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--white); }
.qr img { width: 256px; height: 256px; image-rendering: pixelated; }
.steps-list { margin: 0; padding-left: 20px; }
.steps-list li { margin-bottom: 6px; }

dialog { border: 0; border-radius: 16px; padding: 0; width: min(560px, calc(100vw - 32px)); box-shadow: 0 24px 60px rgb(3 42 71 / 0.25); color: var(--ink); }
dialog::backdrop { background: rgb(3 42 71 / 0.35); }
.dlg { padding: 24px; }
.dlg h2 { margin-bottom: 14px; }
.dlg .actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 20px; }
.toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); background: var(--azure); color: var(--white); padding: 12px 18px; border-radius: 999px; font-size: 14px; z-index: 50; box-shadow: 0 8px 24px rgb(3 42 71 / 0.3); }
.toast.err { background: var(--err); }
code.secret { display: block; font-size: 15px; padding: 10px 12px; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; user-select: all; word-break: break-all; }

/* ---- sign in ---- */
.auth { min-height: 100vh; display: grid; grid-template-columns: 1fr 1fr; }
.auth-side { background: var(--surface); border-right: 1px solid var(--line); padding: 48px; display: flex; flex-direction: column; justify-content: space-between; }
.auth-side h1 { font-size: 40px; max-width: 420px; }
.auth-form { display: grid; place-items: center; padding: 32px 24px; }
.auth-form form { width: min(380px, 100%); }
.auth-form h2 { margin-bottom: 20px; }

@media (max-width: 900px) {
  .grid { grid-template-columns: 1fr; }
  .auth { grid-template-columns: 1fr; }
  .auth-side { min-height: auto; padding: 28px 24px; border-right: 0; border-bottom: 1px solid var(--line); }
  .auth-side h1 { font-size: 28px; }
  .top-in { flex-wrap: wrap; gap: 10px; padding: 10px 16px; }
  .nav { order: 3; width: 100%; }
  main { padding: 24px 16px 64px; }
  h1 { font-size: 25px; }
  .stat { border-right: 0; border-bottom: 1px solid var(--line); }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }
