:root {
  --bg: #f5f7fb; --card: #ffffff; --tint: #eef4ff;
  --ink: #0b1220; --ink-2: #1d2939; --muted: #56607a; --faint: #8a93a8;
  --line: #e5e9f2; --line-2: #d6dce8;
  --brand: #0b6cf2; --brand-deep: #0849b0; --brand-soft: #e8f1ff;
  --wa: #25d366; --wa-deep: #128c4a; --wa-soft: #e7f9ee; --bubble: #d9fdd3;
  --warn: #b25e00; --warn-soft: #fff4e0; --bad: #c62828; --bad-soft: #fdecec;
  --radius: 16px;
  --shadow: 0 1px 2px #0b12200d, 0 8px 28px -14px #0b122030;
  --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 15px/1.5 var(--font); }
a { color: var(--brand); }
button, input, select, textarea { font: inherit; color: inherit; }
[hidden] { display: none !important; }
h1, h2, h3 { margin: 0; line-height: 1.25; }
h1 { font-size: 22px; } h2 { font-size: 18px; } h3 { font-size: 15px; }
.muted { color: var(--muted); } .faint { color: var(--faint); } .small { font-size: 13px; }
.mono { font-family: var(--mono); font-size: 13px; }

/* top bar */
.top { position: sticky; top: 0; z-index: 10; display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 10px max(16px, calc((100vw - 1120px) / 2)); background: #ffffffe8; backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); }
.brand span { display: flex; flex-direction: column; line-height: 1.1; }
.brand b { font-size: 17px; letter-spacing: -.01em; } .brand small { color: var(--muted); font-size: 12px; }
.top nav { display: flex; align-items: center; gap: 6px; }
main { max-width: 1120px; margin: 0 auto; padding: 20px 16px 80px; }

/* buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 10px 18px; border-radius: 12px; border: 1px solid transparent;
  background: var(--brand); color: #fff; font-weight: 600; cursor: pointer; text-decoration: none; transition: background .15s, transform .1s; }
.btn:hover { background: var(--brand-deep); } .btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.wa { background: var(--wa-deep); } .btn.wa:hover { background: #0e7a3f; }
.btn.line { background: #fff; color: var(--ink-2); border-color: var(--line-2); } .btn.line:hover { background: var(--bg); }
.btn.danger { background: #fff; color: var(--bad); border-color: #f2c4c4; } .btn.danger:hover { background: var(--bad-soft); }
.btn.big { padding: 14px 22px; font-size: 16px; border-radius: 14px; }
.btn.sm { padding: 6px 12px; font-size: 13px; border-radius: 10px; }
.ghost-btn { padding: 7px 12px; border-radius: 10px; border: 0; background: none; color: var(--ink-2); cursor: pointer; text-decoration: none; font-size: 14px; }
.ghost-btn:hover { background: var(--bg); }
.linkish { border: 0; background: none; color: var(--brand); cursor: pointer; padding: 0; text-decoration: underline; text-underline-offset: 2px; }

/* cards and layout */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px; }
.card + .card, .stack > * + * { margin-top: 16px; }
.grid { display: grid; grid-template-columns: 340px 1fr; gap: 16px; align-items: start; }
@media (max-width: 900px) { .grid { grid-template-columns: 1fr; } }
.row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.spread { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.section-title { display: flex; align-items: center; justify-content: space-between; margin: 28px 2px 12px; }

/* pills */
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 999px; font-size: 13px; font-weight: 600; background: var(--bg); color: var(--muted); border: 1px solid var(--line); white-space: nowrap; }
.pill::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: currentColor; opacity: .8; }
.pill.ok { background: var(--wa-soft); color: var(--wa-deep); border-color: #bfe9cf; }
.pill.warn { background: var(--warn-soft); color: var(--warn); border-color: #f5d9a8; }
.pill.bad { background: var(--bad-soft); color: var(--bad); border-color: #f2c4c4; }
.pill.info { background: var(--brand-soft); color: var(--brand-deep); border-color: #c9dcfb; }
.pill.plain::before { display: none; }

/* forms */
label.field { display: block; font-weight: 600; font-size: 14px; color: var(--ink-2); }
label.field > span.hint { display: block; font-weight: 400; color: var(--muted); font-size: 13px; margin-top: 2px; }
input[type=text], input[type=password], input[type=tel], input[type=time], select, textarea {
  width: 100%; margin-top: 6px; padding: 10px 12px; border: 1px solid var(--line-2); border-radius: 12px; background: #fff; outline: none; transition: border-color .15s, box-shadow .15s; }
input:focus, select:focus, textarea:focus { border-color: var(--brand); box-shadow: 0 0 0 3px #0b6cf226; }
textarea { min-height: 150px; resize: vertical; line-height: 1.5; }
input[type=time] { width: auto; margin: 0; padding: 6px 8px; }
.check { display: flex; align-items: center; gap: 8px; cursor: pointer; }
.check input { width: 18px; height: 18px; accent-color: var(--brand); }
.err { color: var(--bad); font-size: 14px; margin-top: 8px; }

/* login */
.login { max-width: 380px; margin: 12vh auto 0; text-align: center; }
.login img { margin-bottom: 12px; }
.login form { text-align: left; margin-top: 18px; }
.login .btn { width: 100%; margin-top: 14px; }

/* WhatsApp card */
.wa-card h2 { display: flex; align-items: center; gap: 8px; }
.qr-box { display: grid; place-items: center; margin: 16px 0; padding: 12px; border: 1px dashed var(--line-2); border-radius: 14px; min-height: 260px; background: #fff; }
.qr-box img { width: 240px; height: 240px; image-rendering: pixelated; }
.steps { margin: 0; padding-left: 20px; color: var(--ink-2); font-size: 14px; }
.steps li + li { margin-top: 4px; }
.code { font: 700 30px/1 var(--mono); letter-spacing: .12em; color: var(--ink); background: var(--tint); padding: 14px 18px; border-radius: 12px; text-align: center; }
.linked { display: flex; align-items: center; gap: 12px; padding: 12px; border-radius: 12px; background: var(--wa-soft); }
.linked .dot { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; background: var(--wa); color: #fff; font-size: 20px; flex: none; }
.spinner { width: 32px; height: 32px; border: 3px solid var(--line); border-top-color: var(--brand); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* new job */
.step { display: grid; grid-template-columns: 34px 1fr; gap: 14px; padding: 18px 0; border-top: 1px solid var(--line); }
.step:first-of-type { border-top: 0; padding-top: 6px; }
.step-num { width: 30px; height: 30px; border-radius: 50%; background: var(--brand-soft); color: var(--brand-deep); display: grid; place-items: center; font-weight: 700; }
.step.done .step-num { background: var(--wa); color: #fff; }
.step.locked { opacity: .45; pointer-events: none; }
.step h3 { margin: 4px 0 10px; font-size: 16px; }
.drop { display: grid; place-items: center; gap: 6px; text-align: center; padding: 26px 16px; border: 2px dashed var(--line-2); border-radius: 14px; background: var(--bg); cursor: pointer; transition: border-color .15s, background .15s; }
.drop:hover, .drop.over { border-color: var(--brand); background: var(--brand-soft); }
.drop b { font-size: 16px; }
.file-chip { display: inline-flex; align-items: center; gap: 8px; padding: 6px 12px; border-radius: 10px; background: var(--tint); font-weight: 600; font-size: 14px; max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
.map { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 12px; }
@media (max-width: 560px) { .map { grid-template-columns: 1fr; } }
.stats { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.table-wrap { overflow-x: auto; margin-top: 12px; border: 1px solid var(--line); border-radius: 12px; }
table { border-collapse: collapse; width: 100%; font-size: 13.5px; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; max-width: 260px; overflow: hidden; text-overflow: ellipsis; }
th { background: var(--bg); font-weight: 600; color: var(--muted); font-size: 12.5px; }
tr:last-child td { border-bottom: 0; }
td.hl, th.hl { background: var(--brand-soft); }
td.wrap { white-space: normal; min-width: 180px; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.chip { border: 1px solid var(--line-2); background: #fff; border-radius: 999px; padding: 3px 10px; font-size: 13px; cursor: pointer; font-family: var(--mono); }
.chip:hover { border-color: var(--brand); color: var(--brand); }
.compose { display: grid; grid-template-columns: 1fr 300px; gap: 16px; }
@media (max-width: 760px) { .compose { grid-template-columns: 1fr; } }
.phone { background: #efeae2; border-radius: 16px; padding: 14px; min-height: 160px; border: 1px solid var(--line); }
.phone .to { font-size: 12px; color: var(--muted); margin-bottom: 8px; }
.bubble { position: relative; margin-left: auto; max-width: 92%; background: var(--bubble); border-radius: 10px 0 10px 10px; padding: 8px 10px 18px; white-space: pre-wrap; word-wrap: break-word; font-size: 14px; box-shadow: 0 1px 1px #0000001a; }
.bubble .att { display: flex; align-items: center; gap: 6px; background: #ffffffa0; border-radius: 8px; padding: 6px 8px; margin-bottom: 6px; font-size: 13px; }
.bubble .tm { position: absolute; right: 8px; bottom: 3px; font-size: 11px; color: #667781; }
.timeline { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; margin-top: 12px; font-size: 13px; }
.timeline .msg { padding: 4px 9px; border-radius: 8px; background: var(--wa-soft); color: var(--wa-deep); font-weight: 600; }
.timeline .gap { color: var(--muted); }
.timeline .gap::before { content: "→ "; } .timeline .gap::after { content: " →"; }
.window { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 14px; }
.summary { margin-top: 16px; padding: 14px; border-radius: 12px; background: var(--tint); }
.start-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-top: 16px; }

/* jobs */
.job { display: block; color: inherit; text-decoration: none; }
.job + .job { margin-top: 12px; }
.job:hover { border-color: var(--line-2); }
.job-head { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; flex-wrap: wrap; }
.job-head h3 { font-size: 16px; }
.bar { height: 10px; border-radius: 999px; background: var(--bg); border: 1px solid var(--line); overflow: hidden; margin: 12px 0 8px; display: flex; }
.bar i { display: block; height: 100%; }
.bar .s { background: var(--wa); } .bar .f { background: #f1a3a3; } .bar .n { background: #c8cfdc; }
.job-meta { display: flex; gap: 14px; flex-wrap: wrap; font-size: 13.5px; color: var(--muted); }
.job-meta b { color: var(--ink); }
.next { display: inline-flex; align-items: center; gap: 8px; margin-top: 10px; padding: 8px 12px; border-radius: 10px; background: var(--brand-soft); color: var(--brand-deep); font-weight: 600; font-size: 14px; }
.next.night { background: #f1ecff; color: #4b33b5; } .next.off { background: var(--warn-soft); color: var(--warn); }
.job-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.empty { text-align: center; padding: 30px 16px; color: var(--muted); }
.note { margin-top: 10px; padding: 10px 12px; border-radius: 10px; background: var(--warn-soft); color: var(--warn); font-size: 14px; }

/* job page */
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 10px; margin-top: 16px; }
.tile { padding: 12px 14px; border-radius: 12px; background: var(--bg); border: 1px solid var(--line); }
.tile b { display: block; font-size: 24px; letter-spacing: -.02em; }
.tile span { font-size: 13px; color: var(--muted); }
.tabs { display: flex; gap: 6px; flex-wrap: wrap; margin: 18px 0 4px; }
.tab { padding: 6px 12px; border-radius: 999px; border: 1px solid var(--line-2); background: #fff; cursor: pointer; font-size: 13.5px; }
.tab.on { background: var(--ink); color: #fff; border-color: var(--ink); }
.back { display: inline-flex; gap: 6px; color: var(--muted); text-decoration: none; margin-bottom: 12px; font-size: 14px; }
.msg-box { white-space: pre-wrap; background: var(--bg); border-radius: 12px; padding: 12px; font-size: 14px; margin-top: 8px; }
.st { font-weight: 600; font-size: 12.5px; padding: 2px 8px; border-radius: 999px; background: var(--bg); color: var(--muted); }
.st.sent, .st.delivered { background: var(--wa-soft); color: var(--wa-deep); }
.st.read { background: #e3f2fd; color: #1565c0; } .st.replied { background: #ede7ff; color: #4b33b5; }
.st.failed, .st.not_on_whatsapp { background: var(--bad-soft); color: var(--bad); } .st.opted_out { background: var(--warn-soft); color: var(--warn); }
.st.sending { background: var(--brand-soft); color: var(--brand-deep); }

.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: var(--ink); color: #fff; padding: 10px 16px; border-radius: 12px; box-shadow: var(--shadow); z-index: 50; max-width: calc(100vw - 32px); font-size: 14px; }
.toast.bad { background: var(--bad); }
.list-row { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.list-row:last-child { border-bottom: 0; }
@media (max-width: 560px) {
  .card { padding: 16px; }
  .top nav .ghost-btn { padding: 6px 8px; }
  .brand small { display: none; }
  .ghost-btn { white-space: nowrap; }
  .step { grid-template-columns: 1fr; gap: 6px; }
}
@media (max-width: 420px) {
  .brand span { display: none; }
  .top { gap: 6px; } .top nav { gap: 2px; }
}
