/* ============================================================
   Bulk Gmail Mailer — Design System
   Professional admin UI: dark sidebar, light content, responsive
   ============================================================ */
:root {
  /* ---- Ravan Mailer brand theme: fiery gold/orange-red on deep black-navy,
     matching the logo (crown gold "RAVAN" + blue mail accents on black) ---- */
  --sidebar-w: 240px;
  --bg: #f4f6fa;
  --surface: #ffffff;
  --border: #e3e8f0;
  --text: #1e2536;
  --muted: #6b7590;
  --primary: #ff7a1a;
  --primary-dk: #c2410c;
  --primary-lt: #fff1e0;
  --gold: #ffc93c;
  --gold-dk: #e0a800;
  --ember: #ff4d1c;
  --green: #16a34a;
  --green-lt: #f0fdf4;
  --red: #dc2626;
  --red-lt: #fef2f2;
  --amber: #d97706;
  --amber-lt: #fffbeb;
  --violet: #7c3aed;
  --violet-lt: #f5f3ff;
  --sidebar-bg: #0c0704;
  --sidebar-text: #b7ab9a;
  --sidebar-active: rgba(255, 122, 26, .16);
  --radius: 10px;
  --shadow: 0 1px 3px rgba(16, 24, 40, .08), 0 1px 2px rgba(16, 24, 40, .04);
  --shadow-lg: 0 10px 30px rgba(16, 24, 40, .14);
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font: 14px/1.55 -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--bg); color: var(--text);
  -webkit-font-smoothing: antialiased;
}
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 22px; font-weight: 700; letter-spacing: -.02em; }
h2 { font-size: 17px; font-weight: 650; }
h3 { font-size: 14.5px; font-weight: 650; color: var(--text); }
code, .mono { font-family: var(--mono); font-size: 12.5px; background: #eef1f6; padding: 1px 6px; border-radius: 5px; }
hr { border: none; border-top: 1px solid var(--border); margin: 14px 0; }

/* ---------- Layout ---------- */
.layout { display: flex; min-height: 100vh; }
.sidebar {
  width: var(--sidebar-w); color: var(--sidebar-text);
  position: fixed; inset: 0 auto 0 0; display: flex; flex-direction: column; z-index: 50;
  transition: transform .22s ease;
  background:
    radial-gradient(600px 260px at 15% -6%, rgba(255,122,26,.30), transparent 60%),
    radial-gradient(500px 240px at 100% 0%, rgba(255,201,60,.14), transparent 55%),
    linear-gradient(180deg, #140a05 0%, #0c0704 55%, #090604 100%);
  border-right: 1px solid #241408;
}
.sidebar .brand {
  display: flex; align-items: center; gap: 10px; padding: 16px 18px 14px;
  color: #fff; font-weight: 700; font-size: 15.5px; letter-spacing: -.01em;
  border-bottom: 1px solid #241408;
}
.brand-badge {
  width: 32px; height: 32px; border-radius: 9px; flex: none;
  background: linear-gradient(135deg, var(--gold), var(--ember));
  display: grid; place-items: center; font-size: 15px; color: #fff; overflow: hidden;
  box-shadow: 0 0 0 1px rgba(255,201,60,.35), 0 2px 8px rgba(255,77,28,.35);
}
.brand-badge img { width: 100%; height: 100%; object-fit: cover; display: block; }
.brand-name { background: linear-gradient(90deg, var(--gold), #fff6df 60%, var(--gold));
  -webkit-background-clip: text; background-clip: text; color: transparent; }
.sidebar nav { flex: 1; overflow-y: auto; padding: 6px 10px 10px; }
.nav-section { font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .09em; color: #8a7a63; padding: 14px 10px 5px; }
.nav-link {
  display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 8px;
  color: var(--sidebar-text); font-weight: 500; font-size: 13.5px; cursor: pointer; margin: 1px 0;
  border: none; background: none; width: 100%; text-align: left; text-decoration: none;
}
.nav-link:hover { background: rgba(255,122,26,.10); color: #ffe3c2; text-decoration: none; }
.nav-link.active { background: var(--sidebar-active); color: #fff; box-shadow: inset 2px 0 0 var(--primary); }
.nav-link .ico { width: 18px; text-align: center; flex: none; font-size: 14px; opacity: .95; }
.sidebar .foot { padding: 12px 14px; border-top: 1px solid #241408; font-size: 12px; }
.foot .user-line { color: #e8dcc8; display: flex; align-items: center; gap: 8px; }
.foot button { margin-top: 8px; }

.main { flex: 1; margin-left: var(--sidebar-w); display: flex; flex-direction: column; min-width: 0; }
main#content { margin-left: var(--sidebar-w); display: block; min-width: 0; }
@media(max-width:900px){ main#content { margin-left: 0; } }
.topbar {
  position: sticky; top: 0; z-index: 40; background: rgba(250,247,242,.92); backdrop-filter: blur(6px);
  display: flex; align-items: center; gap: 14px; padding: 13px 26px; border-bottom: 1px solid var(--border);
}
.topbar h1 { font-size: 18px; }
.topbar .spacer { flex: 1; }
.topbar .sub { color: var(--muted); font-size: 12.5px; }
.content { padding: 24px 26px 60px; max-width: 1280px; width: 100%; }
.menu-btn { display: none; }

/* ---------- Cards / panels ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.card .card-hd { padding: 14px 18px; border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.card .card-hd h2 { flex: 1; }
.card .card-bd { padding: 18px; }
.grid { display: grid; gap: 16px; }
.grid.cols-2 { grid-template-columns: 1fr 1fr; }
.grid.cols-3 { grid-template-columns: repeat(3, 1fr); }
.grid.cols-4 { grid-template-columns: repeat(4, 1fr); }

/* ---------- Stats ---------- */
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 15px 16px; box-shadow: var(--shadow); }
.stat .lbl { color: var(--muted); font-size: 11.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; }
.stat .val { font-size: 24px; font-weight: 750; letter-spacing: -.02em; margin-top: 3px; }
.stat .delta { font-size: 12px; color: var(--muted); margin-top: 2px; }
.stat.accent { border-left: 3px solid var(--primary); }
.stat.good { border-left: 3px solid var(--green); }
.stat.bad { border-left: 3px solid var(--red); }
.stat.warn { border-left: 3px solid var(--amber); }

/* ---------- Forms ---------- */
label.f { display: block; margin-bottom: 12px; }
label.f > span, .f-lbl { display: block; font-size: 12.5px; font-weight: 600; color: var(--muted); margin-bottom: 5px; }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=date], input[type=url], input[type=file], select, textarea {
  width: 100%; padding: 8.5px 11px; border: 1px solid #cdd5e1; border-radius: 8px;
  font: inherit; color: var(--text); background: #fff; transition: border .15s, box-shadow .15s;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(37,99,235,.13); }
textarea { resize: vertical; min-height: 90px; font-family: var(--mono); font-size: 12.5px; line-height: 1.5; }
input[type=file] { padding: 7px; background: #fafbfc; }
.field-row { display: flex; gap: 12px; flex-wrap: wrap; }
.field-row > label.f { flex: 1; min-width: 160px; margin-bottom: 0; }
.help { font-size: 12px; color: var(--muted); margin-top: 4px; }
.req::after { content: " *"; color: var(--red); }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 7px; padding: 8px 15px; border-radius: 8px;
  border: 1px solid transparent; font: inherit; font-weight: 600; font-size: 13.5px;
  cursor: pointer; background: var(--primary); color: #fff; transition: background .13s, box-shadow .13s;
  white-space: nowrap; user-select: none;
}
.btn:hover { background: var(--primary-dk); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn.sm { padding: 5px 10px; font-size: 12.5px; border-radius: 7px; }
.btn.xs { padding: 3px 8px; font-size: 11.5px; border-radius: 6px; }
.btn.secondary { background: #fff; color: var(--text); border-color: #cdd5e1; }
.btn.secondary:hover { background: #f6f8fb; }
.btn.ghost { background: transparent; color: var(--primary); }
.btn.ghost:hover { background: var(--primary-lt); }
.btn.danger { background: var(--red); }
.btn.danger:hover { background: #b91c1c; }
.btn.danger-o { background: #fff; color: var(--red); border-color: #f3c1c1; }
.btn.danger-o:hover { background: var(--red-lt); }
.btn.warn { background: var(--amber); }
.btn.warn:hover { background: #b45309; }
.btn.success { background: var(--green); }
.btn.success:hover { background: #15803d; }
.btn.block { width: 100%; justify-content: center; }
.btn-group { display: inline-flex; gap: 8px; flex-wrap: wrap; }

/* ---------- Tables ---------- */
.tbl-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius); background: #fff; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
.tbl th {
  text-align: left; padding: 9px 12px; background: #f9fafb; color: var(--muted);
  font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em;
  border-bottom: 1px solid var(--border); white-space: nowrap;
}
.tbl td { padding: 9px 12px; border-bottom: 1px solid #eef1f6; vertical-align: middle; }
.tbl tr:last-child td { border-bottom: none; }
.tbl tr:hover td { background: #fafbfd; }
.tbl td.actions { white-space: nowrap; }
.tbl .empty { text-align: center; color: var(--muted); padding: 34px 12px !important; }
.tbl-wrap + .pager { display: flex; align-items: center; gap: 10px; margin-top: 12px; }

/* ---------- Badges ---------- */
.badge { display: inline-flex; align-items: center; gap: 5px; padding: 2.5px 9px; border-radius: 999px; font-size: 11.5px; font-weight: 650; white-space: nowrap; }
.b-gray  { background: #eef1f6; color: #475467; }
.b-blue  { background: var(--primary-lt); color: var(--primary-dk); }
.b-green { background: var(--green-lt); color: var(--green); }
.b-red   { background: var(--red-lt); color: var(--red); }
.b-amber { background: var(--amber-lt); color: var(--amber); }
.b-violet{ background: var(--violet-lt); color: var(--violet); }

/* status dots */
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; margin-right: 6px; }
.dot.g { background: var(--green); } .dot.r { background: var(--red); }
.dot.a { background: var(--amber); } .dot.b { background: var(--primary); }
.dot.gr { background: #98a2b3; }

/* ---------- Alerts / notices ---------- */
.notice { padding: 11px 14px; border-radius: 8px; font-size: 13px; display: flex; gap: 9px; align-items: flex-start; margin-bottom: 14px; }
.notice .n-ico { flex: none; }
.n-info { background: var(--primary-lt); color: #1e40af; border: 1px solid #bfdbfe; }
.n-ok { background: var(--green-lt); color: #166534; border: 1px solid #bbf7d0; }
.n-warn { background: var(--amber-lt); color: #92400e; border: 1px solid #fde68a; }
.n-err { background: var(--red-lt); color: #991b1b; border: 1px solid #fecaca; }

/* ---------- Toasts ---------- */
#toasts { position: fixed; right: 18px; bottom: 18px; z-index: 300; display: flex; flex-direction: column; gap: 9px; max-width: 360px; }
.toast {
  background: #101828; color: #fff; padding: 11px 15px; border-radius: 9px; font-size: 13px;
  box-shadow: var(--shadow-lg); display: flex; gap: 9px; align-items: flex-start;
  animation: toast-in .22s ease;
}
.toast.ok { background: #065f46; } .toast.err { background: #991b1b; } .toast.warn { background: #92400e; }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }

/* ---------- Modal ---------- */
.modal-back {
  position: fixed; inset: 0; background: rgba(16,24,40,.5); z-index: 200;
  display: none; align-items: center; justify-content: center; padding: 20px; backdrop-filter: blur(2px);
}
.modal-back.open { display: flex; }
.modal {
  background: #fff; border-radius: 12px; box-shadow: var(--shadow-lg); width: 100%; max-width: 460px;
  animation: modal-in .18s ease; max-height: 92vh; display: flex; flex-direction: column;
}
.modal.wide { max-width: 760px; }
.modal.xw { max-width: 980px; }
@keyframes modal-in { from { opacity: 0; transform: scale(.97); } }
.modal .m-hd { padding: 15px 20px; border-bottom: 1px solid var(--border); display: flex; align-items: center; }
.modal .m-hd h3 { flex: 1; font-size: 15.5px; }
.modal .m-bd { padding: 18px 20px; overflow-y: auto; }
.modal .m-ft { padding: 13px 20px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 9px; }
.x-btn { background: none; border: none; font-size: 19px; color: var(--muted); cursor: pointer; padding: 0 2px; }
.x-btn:hover { color: var(--text); }

/* ---------- Tabs ---------- */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 16px; overflow-x: auto; }
.tab { padding: 8px 14px; border: none; background: none; cursor: pointer; font: inherit; font-weight: 600; color: var(--muted); border-bottom: 2px solid transparent; white-space: nowrap; }
.tab:hover { color: var(--text); }
.tab.active { color: var(--primary); border-bottom-color: var(--primary); }

/* ---------- Wizard ---------- */
.wiz-steps { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 18px; }
.wstep {
  display: flex; align-items: center; gap: 7px; padding: 5px 11px; border-radius: 999px;
  background: #eef1f6; color: var(--muted); font-size: 12px; font-weight: 600; cursor: default;
}
.wstep .n { width: 17px; height: 17px; border-radius: 50%; background: #fff; display: grid; place-items: center; font-size: 10.5px; }
.wstep.active { background: var(--primary); color: #fff; }
.wstep.active .n { background: rgba(255,255,255,.25); }
.wstep.done { background: var(--green-lt); color: var(--green); cursor: pointer; }
.wstep.done .n { background: var(--green); color: #fff; }
.wiz-body { min-height: 220px; }
.wiz-foot { display: flex; justify-content: space-between; gap: 10px; margin-top: 18px; }

/* ---------- Progress ---------- */
.pbar { height: 9px; background: #e8ecf3; border-radius: 999px; overflow: hidden; }
.pbar > div { height: 100%; background: linear-gradient(90deg, var(--gold-dk), var(--primary)); transition: width .5s ease; border-radius: 999px; }
.pbar.ok > div { background: var(--green); }
.meter { display: flex; gap: 4px; flex: 1; }
.meter > span { height: 34px; flex: 1; min-width: 4px; border-radius: 3px; background: #eef1f6; }
.meter > span.sent { background: var(--green); }
.meter > span.fail { background: var(--red); }
.meter > span.skip { background: #cbd5e1; }
.meter > span.supp { background: var(--violet); }
.meter > span.proc { background: var(--amber); animation: pulse 1s infinite alternate; }
@keyframes pulse { to { opacity: .55; } }

/* ---------- Preview frames ---------- */
.preview-frame {
  border: 1px solid var(--border); border-radius: 8px; background: #fff; overflow: auto;
  max-height: 420px; padding: 0;
}
.preview-frame iframe { width: 100%; height: 420px; border: none; background: #fff; }
.preview-plain { max-height: 420px; overflow: auto; padding: 14px; font-family: var(--mono); font-size: 12.5px; white-space: pre-wrap; background: #fff; }

/* ---------- Misc ---------- */
.kv { display: grid; grid-template-columns: 170px 1fr; gap: 7px 14px; font-size: 13px; }
.kv dt { color: var(--muted); font-weight: 600; }
.kv dd { font-family: var(--mono); font-size: 12.5px; word-break: break-all; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.right { text-align: right; }
.center { text-align: center; }
.nowrap { white-space: nowrap; }
.mt-1 { margin-top: 8px; } .mt-2 { margin-top: 14px; } .mt-3 { margin-top: 20px; }
.mb-1 { margin-bottom: 8px; } .mb-2 { margin-bottom: 14px; }
.flex { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.flex-between { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.hidden { display: none !important; }
.scrollbox { max-height: 300px; overflow: auto; }
.chk { display: flex; align-items: center; gap: 8px; font-size: 13.5px; cursor: pointer; padding: 3px 0; }
.chk input { width: auto; }
.radio-row { display: flex; gap: 14px; flex-wrap: wrap; padding: 4px 0; }
.pick-list { border: 1px solid var(--border); border-radius: 8px; max-height: 260px; overflow: auto; }
.pick-item { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-bottom: 1px solid #eef1f6; cursor: pointer; }
.pick-item:hover { background: #f8fafc; }
.pick-item:last-child { border-bottom: none; }
.pick-item .p-main { flex: 1; min-width: 0; }
.pick-item .p-sub { color: var(--muted); font-size: 12px; }
.empty-state { text-align: center; padding: 44px 20px; color: var(--muted); }
.empty-state .e-ico { font-size: 30px; margin-bottom: 8px; }
.skeleton { height: 14px; border-radius: 6px; background: linear-gradient(90deg,#eef1f6,#f8fafc,#eef1f6); background-size: 200% 100%; animation: sk 1.2s infinite; margin: 8px 0; }
@keyframes sk { to { background-position: -200% 0; } }

/* Login page — fiery gold/ember on deep black-navy, matching the Ravan Mailer logo */
.login-wrap {
  min-height: 100vh; display: grid; place-items: center; padding: 20px;
  background:
    radial-gradient(900px 420px at 20% 0%, rgba(255,122,26,.28), transparent 60%),
    radial-gradient(700px 380px at 100% 10%, rgba(255,201,60,.16), transparent 55%),
    radial-gradient(600px 500px at 50% 120%, rgba(255,77,28,.12), transparent 60%),
    linear-gradient(160deg, #0c0704 0%, #140a05 55%, #090604 100%);
}
.login-card {
  width: 100%; max-width: 410px; background: #fff; border-radius: 14px;
  box-shadow: 0 0 0 1px rgba(255,201,60,.18), 0 20px 60px rgba(0,0,0,.55);
  overflow: hidden;
}
.login-brand { padding: 26px 28px 0; text-align: center; }
.login-brand .logo-hero { width: 96px; height: 96px; margin: 0 auto 10px; border-radius: 16px; overflow: hidden;
  box-shadow: 0 0 0 1px rgba(255,201,60,.4), 0 8px 24px rgba(255,77,28,.35); }
.login-brand .logo-hero img { width: 100%; height: 100%; object-fit: cover; display: block; }
.login-brand h1 { background: linear-gradient(90deg, var(--gold-dk), var(--ember));
  -webkit-background-clip: text; background-clip: text; color: transparent; }
.login-card .card-bd { padding: 22px 28px 26px; }

/* ---------- Responsive ---------- */
@media (max-width: 960px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: none; box-shadow: var(--shadow-lg); }
  .main { margin-left: 0; }
  .menu-btn { display: inline-flex; }
  .content { padding: 18px 14px 60px; }
  .topbar { padding: 11px 14px; }
  .grid.cols-2, .grid.cols-3, .grid.cols-4 { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 620px) {
  .grid.cols-2, .grid.cols-3, .grid.cols-4 { grid-template-columns: 1fr; }
  .kv { grid-template-columns: 1fr; }
  .wiz-steps { gap: 4px; }
  .wstep { padding: 4px 8px; font-size: 11px; }
}
#scrim { position: fixed; inset: 0; background: rgba(16,24,40,.45); z-index: 45; display: none; }
#scrim.show { display: block; }
