/* ============================================================
   Abraaj · WhatsApp Sender — brand tokens
   Swap the four --brand* / --accent values to match your logo.
   ============================================================ */
:root {
  --brand:        #0E5C54;  /* deep petrol-emerald — primary */
  --brand-dark:   #0A403A;
  --brand-soft:   #E6F0EE;
  --accent:       #C9A227;  /* warm gold — single accent */
  --accent-soft:  #F6EFD8;

  --bg:      #F5F7F7;
  --surface: #FFFFFF;
  --line:    #E2E8E6;
  --ink:     #14201E;
  --muted:   #5E6E6B;

  --queued:    #94A3A0;
  --sent:      #6E8FB8;
  --delivered: #2C7BD4;
  --read:      #16A34A;
  --failed:    #DC2626;

  --radius: 14px;
  --shadow: 0 1px 2px rgba(10,40,36,.05), 0 8px 28px rgba(10,40,36,.06);
  --font-display: 'Sora', system-ui, sans-serif;
  --font-body: 'Inter', system-ui, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font-family: var(--font-body);
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
h1, h2, .brand-text strong { font-family: var(--font-display); }
button { font-family: inherit; cursor: pointer; }
a { color: var(--brand); }

/* ---------- brand mark ---------- */
.brand { display: flex; align-items: center; gap: 12px; }
.brand-logo { height: 40px; width: auto; max-width: 150px; object-fit: contain; }
.brand-fallback {
  height: 40px; width: 40px; border-radius: 10px; display: flex; align-items: center;
  justify-content: center; font-family: var(--font-display); font-weight: 700; font-size: 20px;
  color: #fff; background: linear-gradient(135deg, var(--brand), var(--brand-dark));
}
.brand-text { display: flex; flex-direction: column; line-height: 1.1; }
.brand-text strong { font-size: 17px; letter-spacing: -.01em; }
.brand-text span { font-size: 12px; color: var(--muted); }

/* ============================================================
   LOGIN
   ============================================================ */
.login-screen {
  min-height: 100%; display: grid; place-items: center; padding: 24px;
  background:
    radial-gradient(1100px 500px at 100% -10%, rgba(201,162,39,.10), transparent 60%),
    linear-gradient(160deg, var(--brand-dark), var(--brand) 55%, #0c4f48);
}
.login-card {
  width: 100%; max-width: 380px; background: var(--surface); border-radius: 20px;
  padding: 32px 30px; box-shadow: 0 24px 60px rgba(6,30,27,.35);
}
.login-card .brand { margin-bottom: 26px; }
#login-form { display: flex; flex-direction: column; gap: 16px; }
label { font-size: 13px; font-weight: 500; color: var(--muted); display: flex; flex-direction: column; gap: 7px; }
input, textarea, select {
  font-family: inherit; font-size: 14px; color: var(--ink);
  padding: 11px 13px; border: 1px solid var(--line); border-radius: 10px;
  background: #fff; outline: none; transition: border-color .15s, box-shadow .15s;
}
input:focus, textarea:focus, select:focus { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
textarea { resize: vertical; }
.login-foot { text-align: center; color: var(--muted); font-size: 12px; margin: 22px 0 0; }
.error { color: var(--failed); font-size: 13px; margin: 4px 0 0; }

/* ---------- buttons ---------- */
.btn { border: 1px solid transparent; border-radius: 10px; padding: 11px 18px; font-size: 14px; font-weight: 600; }
.btn-primary { background: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-dark); }
.btn-primary:disabled { opacity: .5; cursor: not-allowed; }
.btn-block { width: 100%; }
.btn-ghost { background: #fff; border-color: var(--line); color: var(--ink); }
.btn-ghost:hover { border-color: var(--brand); color: var(--brand); }

/* ============================================================
   APP SHELL
   ============================================================ */
.app { display: grid; grid-template-columns: 248px 1fr; min-height: 100%; }
.sidebar {
  background: var(--brand-dark); color: #fff; padding: 24px 18px;
  display: flex; flex-direction: column; gap: 28px; position: sticky; top: 0; height: 100vh;
}
.brand-side .brand-text strong { color: #fff; }
.brand-side .brand-text span { color: rgba(255,255,255,.6); }
.brand-side .brand-fallback { background: rgba(255,255,255,.12); }
.sidebar nav { display: flex; flex-direction: column; gap: 4px; }
.nav-item {
  text-align: left; background: transparent; border: none; color: rgba(255,255,255,.72);
  padding: 11px 13px; border-radius: 9px; font-size: 14px; font-weight: 500;
}
.nav-item:hover { background: rgba(255,255,255,.07); color: #fff; }
.nav-item.active { background: rgba(255,255,255,.12); color: #fff; }
.logout {
  margin-top: auto; background: transparent; border: 1px solid rgba(255,255,255,.2);
  color: rgba(255,255,255,.8); padding: 10px; border-radius: 9px; font-size: 13px;
}
.logout:hover { border-color: var(--accent); color: var(--accent); }

.main { padding: 36px 40px 60px; max-width: 1080px; }
.view-head { margin-bottom: 26px; }
.view-head h1 { margin: 0 0 4px; font-size: 26px; letter-spacing: -.02em; }
.view-head p { margin: 0; color: var(--muted); font-size: 14px; }

/* ---------- cards / grid ---------- */
.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 22px; box-shadow: var(--shadow);
}
.card-title { margin: 0 0 16px; font-size: 13px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--brand); }
.field { margin-bottom: 16px; }
.field:last-child { margin-bottom: 0; }
.hint { color: var(--muted); font-weight: 400; text-transform: none; letter-spacing: 0; }
.param-label { font-size: 13px; color: var(--muted); display: block; margin-bottom: 8px; }
.preview {
  margin-top: 6px; font-size: 13px; color: var(--muted); background: var(--brand-soft);
  border-radius: 10px; padding: 12px 14px; line-height: 1.5; word-break: break-all;
}
.preview b { color: var(--brand-dark); }

.actions { display: flex; align-items: center; gap: 16px; margin-top: 22px; }
.send-status { font-size: 14px; color: var(--muted); }
.send-status.ok { color: var(--read); font-weight: 600; }
.send-status.err { color: var(--failed); font-weight: 600; }

/* ============================================================
   CAMPAIGNS
   ============================================================ */
.campaign-list { display: flex; flex-direction: column; gap: 12px; }
.campaign-row {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 18px 20px; box-shadow: var(--shadow); cursor: pointer; transition: border-color .15s;
}
.campaign-row:hover { border-color: var(--brand); }
.campaign-row .row-top { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.campaign-row h3 { margin: 0; font-size: 16px; font-family: var(--font-display); }
.campaign-meta { font-size: 12.5px; color: var(--muted); margin: 4px 0 14px; }
.pill { font-size: 11px; font-weight: 600; padding: 3px 10px; border-radius: 999px; text-transform: capitalize; }
.pill.queued, .pill.sending { background: var(--accent-soft); color: #8a6d10; }
.pill.done { background: #E2F3E8; color: #137a37; }
.pill.stopped { background: #f2e2e2; color: #9a2b2b; }

/* funnel bar */
.funnel { display: flex; height: 12px; border-radius: 999px; overflow: hidden; background: #EEF2F1; }
.funnel span { display: block; height: 100%; }
.funnel .s-sent { background: var(--sent); }
.funnel .s-delivered { background: var(--delivered); }
.funnel .s-read { background: var(--read); }
.funnel .s-failed { background: var(--failed); }
.legend { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 12px; font-size: 12.5px; color: var(--muted); }
.legend i { display: inline-block; width: 9px; height: 9px; border-radius: 3px; margin-right: 6px; vertical-align: middle; }
.legend b { color: var(--ink); }

#campaign-detail { margin-bottom: 22px; }
.back-link { background: none; border: none; color: var(--brand); font-weight: 600; padding: 0; margin-bottom: 14px; font-size: 14px; }
.rcpt-table { width: 100%; border-collapse: collapse; margin-top: 16px; font-size: 13px; }
.rcpt-table th { text-align: left; color: var(--muted); font-weight: 600; padding: 8px 10px; border-bottom: 1px solid var(--line); }
.rcpt-table td { padding: 8px 10px; border-bottom: 1px solid #F0F4F3; }
.status-tag { font-weight: 600; }
.status-tag.queued { color: var(--queued); }
.status-tag.sent { color: var(--sent); }
.status-tag.delivered { color: var(--delivered); }
.status-tag.read { color: var(--read); }
.status-tag.failed { color: var(--failed); }

/* ============================================================
   ACCOUNT
   ============================================================ */
.account-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 16px; margin-bottom: 22px; }
.stat {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 20px; box-shadow: var(--shadow);
}
.stat .k { font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.stat .v { font-family: var(--font-display); font-size: 24px; font-weight: 700; margin-top: 8px; }
.dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 7px; }
.dot.ok { background: var(--read); } .dot.bad { background: var(--failed); }
.note-card .muted { color: var(--muted); font-size: 14px; line-height: 1.6; margin: 0; }
.muted { color: var(--muted); }

@media (max-width: 820px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; flex-direction: row; align-items: center; flex-wrap: wrap; }
  .sidebar nav { flex-direction: row; flex-wrap: wrap; }
  .logout { margin: 0 0 0 auto; }
  .grid { grid-template-columns: 1fr; }
  .main { padding: 24px 18px 48px; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
