/* BrandMailOps – Orange/Black Rainbow theme
   - Works in both light and dark via CSS variables
   - Polishes: cards, buttons, badges, tables, inputs
   - Adds tasteful (but lively) animations with reduced-motion fallbacks
*/

/* === Variables =========================================================== */
:root {
  /* Brand ramp */
  --brand-orange: #ff7a18;
  --brand-orange-2: #ff4d00;
  --brand-pink:   #ff3d81;
  --brand-purple: #8a2be2;
  --brand-blue:   #3a86ff;
  --brand-teal:   #23d5ab;

  /* Primary mapping (used by your templates already) */
  --primary: var(--brand-orange);
  --primary-dark: #cc5f0f;

  /* Dark (default) surfaces & text */
  --bg:        #0b0b0f;
  --bg-soft:   #0f1016;
  --surface:   #12131c;
  --surface-2: #171a24;
  --surface-3: #1d2130;

  --text-primary:   #f8fafc;
  --text-secondary: #cbd5e1;
  --text-tertiary:  #94a3b8;

  --border:       rgba(255,255,255,.08);
  --border-light: rgba(255,255,255,.12);
  --bg-hover:     rgba(255,122,24,.09);

  --radius:    12px;
  --radius-lg: 16px;

  --shadow-sm: 0 2px 8px rgba(0,0,0,.25);
  --shadow-md: 0 6px 18px rgba(0,0,0,.28);
  --shadow-lg: 0 12px 38px rgba(0,0,0,.35);

  /* Rainbow goodness */
  --gradient-rainbow: linear-gradient(90deg,#ff7a18,#ff3d2e,#ff006f,#8a2be2,#3a86ff,#23d5ab);
  --gradient-orange:  linear-gradient(135deg,#ff7a18,#ff3d2e);
}
/* Light mode overrides */
html[data-theme="light"] {
  color-scheme: light;
  --bg:        #f8fafc;
  --bg-soft:   #f1f5f9;
  --surface:   #ffffff;
  --surface-2: #f6f8fb;
  --surface-3: #eef2f7;

  --text-primary:   #0f172a;
  --text-secondary: #334155;
  --text-tertiary:  #64748b;

  --border:       rgba(2,6,23,.08);
  --border-light: rgba(2,6,23,.12);
  --bg-hover:     rgba(255,122,24,.10);
}

/* === Base ================================================================ */
@import url("https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@300;400;500;600;700&display=swap");

html, body {
  background: var(--bg);
  color: var(--text-primary);
  font-family: "Space Grotesk", system-ui, -apple-system, Segoe UI, Roboto, "Helvetica Neue", Arial, "Noto Sans", "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol";
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
a:hover { text-decoration: none; }
/* Subtle ambient background glow (non-blocking) */
body::before {
  content: "";
  position: fixed; inset: -40vmax;
  background: radial-gradient(60vmax 60vmax at 15% 10%, rgba(255,122,24,.11), transparent 60%),
              radial-gradient(70vmax 70vmax at 80% 0%, rgba(138,43,226,.10), transparent 60%),
              radial-gradient(50vmax 50vmax at 50% 100%, rgba(58,134,255,.08), transparent 60%);
  filter: blur(40px) saturate(120%);
  z-index: -1;
  pointer-events: none;
  animation: ambientGlow 18s ease-in-out infinite alternate;
}

.main, .content {
  background: linear-gradient(170deg,
    var(--surface) 0%,
    var(--surface-emerald) 44%,
    var(--surface-teal) 76%,
    var(--surface-amber) 100%);
  transition: background var(--transition-slow);
}
html[data-theme="light"] .main,
html[data-theme="light"] .content {
  background: linear-gradient(170deg,
    var(--surface-3) 0%,
    var(--surface-emerald) 46%,
    var(--surface-teal) 78%,
    var(--surface-amber) 100%);
}
@keyframes ambientGlow { from { transform: scale(1); } to { transform: scale(1.04); } }

.alert-content ul.alert-list {
  margin: 8px 0 0;
  padding-left: 20px;
  list-style: disc;
}

.alert-content ul.alert-list li {
  margin: 4px 0;
  line-height: 1.4;
}

/* === Cards ============================================================== */
.card {
  background: linear-gradient(180deg, rgba(255,255,255,.03), rgba(255,255,255,.01));
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  backdrop-filter: blur(10px) saturate(140%);
  -webkit-backdrop-filter: blur(10px) saturate(140%);
  transition: transform .2s ease, box-shadow .25s ease, border-color .25s ease;
  position: relative; overflow: hidden;
}
.card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.card::after {
  content: "";
  position: absolute; inset: -2px; border-radius: inherit;
  background: conic-gradient(from 180deg at 50% 50%,
    rgba(255,122,24,.18), rgba(255,61,46,.14), rgba(138,43,226,.14),
    rgba(58,134,255,.14), rgba(35,213,171,.14), rgba(255,122,24,.18));
  filter: blur(14px); opacity: 0; transition: opacity .35s ease; z-index: -1;
}
.card:hover::after { opacity: .7; }

.card .card-header { border-bottom: 1px solid var(--border); background: linear-gradient(90deg, rgba(255,122,24,.08), transparent); }
.card .card-title  { font-weight: 700; letter-spacing: .2px; }
/* === Buttons ============================================================ */
.btn {
  --btn-bg: var(--surface-2);
  --btn-border: var(--border);
  display: inline-flex; align-items: center; gap: 10px;
  padding: 10px 14px; border-radius: 12px; border: 1px solid var(--btn-border);
  color: var(--text-primary); background: var(--btn-bg);
  box-shadow: 0 1px 0 rgba(255,255,255,.06) inset, 0 1px 2px rgba(0,0,0,.12);
  transition: transform .15s ease, box-shadow .22s ease, border-color .22s ease, background .22s ease, filter .22s ease;
  will-change: transform;
}
.btn i { font-size: 1rem; }
.btn:hover { transform: translateY(-1px); border-color: rgba(255,122,24,.35);
  box-shadow: 0 6px 18px rgba(255,122,24,.18), 0 1px 0 rgba(255,255,255,.10) inset; }
.btn:active { transform: translateY(0) scale(.98); filter: saturate(1.05); }



.btn-secondary {
  color: var(--text-on-primary); border: 0;
  background: linear-gradient(135deg,#8a2be2,#3a86ff);
  box-shadow: 0 12px 24px rgba(58,134,255,.25);
}

.btn-outline {
  background: transparent; color: var(--text-primary); border: 1px solid var(--border-light);
}
.btn-outline:hover {
  border-color: rgba(255,122,24,.45);
  background: radial-gradient(100% 100% at 50% 0, rgba(255,122,24,.12), transparent 60%);
}

.btn-sm { padding: 6px 10px; border-radius: 10px; font-size: .9rem; }

/* === Bulk Onboard Wizard =============================================== */
.bulk-wizard{display:grid;gap:24px;margin:0 auto;animation:fadeUp .35s ease-out both;}
.bulk-hero{background:linear-gradient(135deg,rgba(255,122,24,.16),rgba(58,134,255,.14));border:1px solid rgba(255,255,255,.18);border-radius:20px;padding:22px 26px;box-shadow:0 18px 30px rgba(15,23,42,.25);backdrop-filter:blur(14px);}
.bulk-steps{display:flex;gap:18px;flex-wrap:wrap;margin:0;padding:0;list-style:none;}
.bulk-step{flex:1 1 160px;min-width:140px;background:rgba(15,23,42,.45);border:1px solid rgba(255,255,255,.08);border-radius:16px;padding:14px 16px;display:flex;flex-direction:column;gap:8px;transition:transform .22s ease,box-shadow .22s ease, border .22s ease;color:var(--text-tertiary);}
.bulk-step.active{border-color:rgba(255,122,24,.65);color:var(--text-primary);box-shadow:0 16px 24px rgba(255,122,24,.18);background:linear-gradient(135deg,rgba(255,122,24,.28),rgba(35,213,171,.20));}
.bulk-step.complete{border-color:rgba(35,213,171,.6);color:var(--text-primary);background:linear-gradient(135deg,rgba(35,213,171,.24),rgba(79,155,255,.18));}
.bulk-step .label{font-weight:700;letter-spacing:.04em;text-transform:uppercase;font-size:12px;opacity:.85;}
.bulk-step .hint{font-size:13px;opacity:.75;}

.bulk-card{background:linear-gradient(180deg,rgba(255,255,255,.04),rgba(255,255,255,.01));border:1px solid rgba(255,255,255,.12);border-radius:18px;padding:24px;box-shadow:0 12px 28px rgba(15,23,42,.3);backdrop-filter:blur(12px);} 
.bulk-card h3{margin-top:0;font-size:20px;font-weight:700;letter-spacing:.02em;}
.bulk-grid{display:grid;gap:24px;grid-template-columns:repeat(auto-fit,minmax(260px,1fr));}
.bulk-stat{padding:18px;border-radius:16px;border:1px solid rgba(255,255,255,.15);background:linear-gradient(135deg,rgba(79,155,255,.18),rgba(15,23,42,.48));box-shadow:inset 0 1px 0 rgba(255,255,255,.08);display:flex;flex-direction:column;gap:6px;animation:fadeUp .32s ease backwards;}
.bulk-stat strong{font-size:28px;font-weight:800;color:var(--text-on-primary);}

.bulk-table{width:100%;border-collapse:separate;border-spacing:0 6px;}
.bulk-table thead th{font-size:12px;text-transform:uppercase;letter-spacing:.05em;padding:10px 12px;border:none;color:var(--text-tertiary);} 
.bulk-table tbody tr{background:rgba(15,23,42,.55);border:1px solid rgba(255,255,255,.1);box-shadow:0 12px 32px rgba(15,23,42,.28);transition:transform .2s ease,box-shadow .2s ease;}
.bulk-table tbody tr:hover{transform:translateY(-2px);box-shadow:0 16px 36px rgba(15,23,42,.32);} 
.bulk-table td{padding:12px 14px;border:none;vertical-align:middle;font-size:13px;color:var(--text-secondary);} 
.bulk-table code{background:rgba(15,23,42,.72);padding:2px 6px;border-radius:8px;border:1px solid rgba(255,255,255,.12);}

.badge-ready{display:inline-flex;align-items:center;gap:6px;padding:4px 10px;border-radius:999px;background:rgba(35,213,171,.16);border:1px solid rgba(35,213,171,.35);font-size:12px;color:#23d5ab;font-weight:600;}
.badge-running{display:inline-flex;align-items:center;gap:6px;padding:4px 10px;border-radius:999px;background:rgba(92,108,255,.18);border:1px solid rgba(92,108,255,.4);font-size:12px;color:#5c6cff;font-weight:600;}
.badge-update{background:rgba(79,155,255,.16);border:1px solid rgba(79,155,255,.35);color:#4f9bff;}
.badge-error{background:rgba(255,61,46,.16);border:1px solid rgba(255,61,46,.4);color:#ff4d46;}

.bulk-actions{display:flex;gap:16px;flex-wrap:wrap;margin-top:24px;}
.bulk-divider{height:1px;background:linear-gradient(90deg,rgba(255,255,255,.05),rgba(255,255,255,.22),rgba(255,255,255,.05));margin:24px 0;}
.bulk-log{border-radius:12px;padding:16px;background:rgba(15,23,42,.6);border:1px solid rgba(255,255,255,.12);font-family:"Space Grotesk",monospace;font-size:13px;max-height:260px;overflow:auto;}

@keyframes fadeUp{from{opacity:0;transform:translateY(12px);}to{opacity:1;transform:none;}}
/* === Badges ============================================================= */
.badge { display: inline-flex; align-items: center; gap: 6px;
  padding: .25rem .55rem; border-radius: 999px; border: 1px solid var(--border);
  background: linear-gradient(180deg, rgba(255,255,255,.04), rgba(255,255,255,.02));
  color: var(--text-secondary); font-weight: 600; letter-spacing: .2px; }
.badge-secondary {
  border-color: rgba(255,122,24,.35);
  background: radial-gradient(120% 120% at 0% 0%, rgba(255,122,24,.18), transparent 70%);
  color: var(--text-primary);
}

/* === Tables ============================================================= */
.table { width: 100%; border-collapse: collapse; }
.table thead th {
  text-align: left; font-size: .85rem; text-transform: uppercase; letter-spacing: .06em;
  color: var(--text-tertiary); padding: 12px; border-bottom: 1px solid var(--border);
  position: sticky; top: 0; background: var(--surface); backdrop-filter: blur(6px); z-index: 1;
}
.table tbody td { padding: 14px 12px; border-bottom: 1px solid var(--border); }
.table tbody tr {
  transition: background var(--transition-base), transform var(--transition-base), box-shadow var(--transition-base);
}
.table tbody tr:hover {
  background: var(--bg-hover);
  transform: translateY(-2px);
  box-shadow: 0 10px 28px rgba(61, 134, 161, 0.16);
}
/* === Inputs / Search ==================================================== */
.header-search { position: relative; }
.header-search .search-icon { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); opacity: .65; }
.header-search .search-input {
  padding: 10px 12px 10px 36px; min-width: 260px;
  border-radius: 999px; background: linear-gradient(180deg, rgba(255,255,255,.03), rgba(255,255,255,.01));
  border: 1px solid var(--border); color: var(--text-primary); outline: none;
  transition: border-color .2s ease, box-shadow .2s ease, background .2s ease;
}
.header-search .search-input::placeholder { color: var(--text-tertiary); }
.header-search .search-input:focus {
  border-color: rgba(255,122,24,.55); box-shadow: 0 0 0 3px rgba(255,122,24,.22);
  background: linear-gradient(180deg, rgba(255,255,255,.06), rgba(255,255,255,.02));
}
/* === Floating Compose + Theme Toggle =================================== */
.compose-fab {
  position: fixed; right: 24px; bottom: 24px; width: 56px; height: 56px;
  border-radius: 50%; display: inline-flex; align-items: center; justify-content: center;
  color: var(--text-on-primary); background: var(--gradient-rainbow); border: 0; z-index: 50;
  box-shadow: 0 18px 40px rgba(255,122,24,.35);
  transition: transform .22s ease, box-shadow .22s ease, filter .22s ease;
}
.compose-fab:hover { transform: translateY(-2px) scale(1.04); box-shadow: 0 22px 50px rgba(255,122,24,.45); filter: saturate(1.1); }
.compose-fab::after {
  content: ""; position: absolute; inset: -8px; border-radius: inherit;
  border: 2px solid rgba(255,122,24,.35); opacity: .4; animation: pulseRing 2s ease-out infinite;
}
@keyframes pulseRing { 0% { transform: scale(1); opacity:.6; } 70% { transform: scale(1.35); opacity:0; } 100% { opacity:0; } }

.theme-switch { position: fixed; left: 24px; bottom: 24px; z-index: 50; }
.theme-toggle {
  display: inline-flex; align-items: center; gap: 10px; padding: 10px 14px;
  border-radius: 999px; border: 1px solid var(--border);
  background: linear-gradient(180deg, rgba(255,255,255,.04), rgba(255,255,255,.01));
  color: var(--text-secondary); backdrop-filter: blur(8px);
  transition: transform .2s ease, border-color .2s ease, background .2s ease;
}
.theme-toggle:hover { transform: translateY(-1px); border-color: rgba(255,122,24,.35); }
.theme-toggle i { font-size: 1.1rem; }

/* Rainbow text helper */
.rainbow-text { background: var(--gradient-rainbow); -webkit-background-clip: text; background-clip: text; color: transparent; }

/* Scrollbar polish (webkit + firefox) */
* { scrollbar-width: thin; scrollbar-color: rgba(255,122,24,.6) rgba(100,116,139,.24); }
*::-webkit-scrollbar { width: 8px; height: 8px; }
*::-webkit-scrollbar-thumb { background: rgba(255,122,24,.65); border-radius: 8px; }
*::-webkit-scrollbar-track { background: rgba(100,116,139,.24); }
/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition: none !important; }
  .compose-fab::after { display: none !important; }
}
/* === Compose drawer ===================================================== */
#composeDrawer[hidden] { display: none !important; }

#composeDrawer {
  position: fixed; inset: 0; z-index: 60;
  display: grid; grid-template-areas: "stack";
}

#composeOverlay {
  grid-area: stack;
  position: relative;
  background: rgba(0,0,0,.45);
  backdrop-filter: blur(2px);
  opacity: 0; transition: opacity .18s ease;
}

#composePanel {
  grid-area: stack;
  align-self: end; justify-self: end;
  margin: 0 24px 24px 24px;
  width: min(720px, calc(100vw - 48px));
  border-radius: var(--radius-lg);
  background: var(--surface);
  border: 1px solid var(--border-light);
  box-shadow: var(--shadow-lg);
  transform: translateY(16px) scale(.98);
  opacity: 0; transition: transform .18s ease, opacity .18s ease;
  overflow: hidden;
}

/* Open state */
#composeDrawer.open #composeOverlay { opacity: 1; }
#composeDrawer.open #composePanel   { transform: translateY(0) scale(1); opacity: 1; }

/* Panel internals */
.compose-header {
  display:flex; align-items:center; justify-content:space-between;
  padding: 12px 14px; border-bottom: 1px solid var(--border);
  background: linear-gradient(90deg, rgba(255,122,24,.08), transparent);
}
.compose-header h3 { margin:0; font-weight:700; letter-spacing:.2px; }

.compose-row { padding: 12px 14px; display:grid; gap:8px; }
.compose-row label {
  color: var(--text-tertiary); font-size:.85rem;
  text-transform: uppercase; letter-spacing:.06em;
}

.compose-input, .compose-body {
  width: 100%;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text-primary);
  border-radius: 10px; padding: 10px 12px; outline: none;
  transition: border-color .2s ease, box-shadow .2s ease, background .2s ease;
}
.compose-input:focus, .compose-body:focus {
  border-color: rgba(255,122,24,.55);
  box-shadow: 0 0 0 3px rgba(255,122,24,.22);
  background: var(--surface-3);
}

.compose-actions {
  display:flex; align-items:center; gap:8px;
  padding: 12px 14px; border-top: 1px solid var(--border);
}
.compose-actions .grow { flex: 1 1 auto; }

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  #composeOverlay, #composePanel { transition: none !important; }
}
/* === Compose drawer ===================================================== */
#composeDrawer[hidden] { display: none !important; }

#composeDrawer {
  position: fixed; inset: 0; z-index: 60;
  display: grid; grid-template-areas: "stack";
}

#composeOverlay {
  grid-area: stack;
  position: relative;
  background: rgba(0,0,0,.45);
  backdrop-filter: blur(2px);
  opacity: 0; transition: opacity .18s ease;
}

#composePanel {
  grid-area: stack;
  align-self: end; justify-self: end;
  margin: 0 24px 24px 24px;
  width: min(720px, calc(100vw - 48px));
  border-radius: var(--radius-lg);
  background: var(--surface);
  border: 1px solid var(--border-light);
  box-shadow: var(--shadow-lg);
  transform: translateY(16px) scale(.98);
  opacity: 0; transition: transform .18s ease, opacity .18s ease;
  overflow: hidden;
}
/* Open state */
#composeDrawer.open #composeOverlay { opacity: 1; }
#composeDrawer.open #composePanel   { transform: translateY(0) scale(1); opacity: 1; }

/* Panel internals */
.compose-header {
  display:flex; align-items:center; justify-content:space-between;
  padding: 12px 14px; border-bottom: 1px solid var(--border);
  background: linear-gradient(90deg, rgba(255,122,24,.08), transparent);
}
.compose-header h3 { margin:0; font-weight:700; letter-spacing:.2px; }

.compose-row { padding: 12px 14px; display:grid; gap:8px; }
.compose-row label {
  color: var(--text-tertiary); font-size:.85rem;
  text-transform: uppercase; letter-spacing:.06em;
}

.compose-input, .compose-body {
  width: 100%;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text-primary);
  border-radius: 10px; padding: 10px 12px; outline: none;
  transition: border-color .2s ease, box-shadow .2s ease, background .2s ease;
}
.compose-input:focus, .compose-body:focus {
  border-color: rgba(255,122,24,.55);
  box-shadow: 0 0 0 3px rgba(255,122,24,.22);
  background: var(--surface-3);
}

.compose-actions {
  display:flex; align-items:center; gap:8px;
  padding: 12px 14px; border-top: 1px solid var(--border);
}
.compose-actions .grow { flex: 1 1 auto; }

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  #composeOverlay, #composePanel { transition: none !important; }
}
/* === Django Admin polish (login & header) =============================== */
body.login { min-height: 100vh; }

body.login #container {
  position: relative;
  margin-top: 6vh;
  background: linear-gradient(180deg, rgba(255,255,255,.06), rgba(255,255,255,.02));
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  backdrop-filter: blur(12px) saturate(160%);
  -webkit-backdrop-filter: blur(12px) saturate(160%);
  overflow: hidden;
}
body.login #container::after {
  content: "";
  position: absolute; inset: -2px; border-radius: inherit;
  background: conic-gradient(from 180deg at 50% 50%,
    rgba(255,122,24,.18), rgba(255,61,46,.14), rgba(138,43,226,.14),
    rgba(58,134,255,.14), rgba(35,213,171,.14), rgba(255,122,24,.18));
  filter: blur(14px); opacity: .65; z-index: -1;
}
body.login #header {
  background: transparent;
  border-bottom: 1px solid var(--border);
}
body.login #content {
  padding: 24px;
}

/* Make admin submit row/buttons feel on-brand */
body .submit-row input[type="submit"], 
body .submit-row input[type="button"],
body .submit-row input[type="reset"] {
  border-radius: 10px !important;
  border: 1px solid var(--border) !important;
  background: var(--surface-2) !important;
  color: var(--text-primary) !important;
  padding: 8px 12px !important;
  transition: transform .15s ease, box-shadow .22s ease, border-color .22s ease;
}
body .submit-row input[type="submit"]:hover,
body .submit-row input[type="button"]:hover {
  transform: translateY(-1px);
  border-color: rgba(255,122,24,.45) !important;
  box-shadow: 0 8px 24px rgba(255,122,24,.25);
}
/* Ensure our ambient glow also decorates the admin pages */
body::before {
  content: "";
  position: fixed; inset: -40vmax;
  background: radial-gradient(60vmax 60vmax at 15% 10%, rgba(255,122,24,.11), transparent 60%),
              radial-gradient(70vmax 70vmax at 80% 0%, rgba(138,43,226,.10), transparent 60%),
              radial-gradient(50vmax 50vmax at 50% 100%, rgba(58,134,255,.08), transparent 60%);
  filter: blur(40px) saturate(120%);
  z-index: -1;
  pointer-events: none;
  animation: ambientGlow 18s ease-in-out infinite alternate;
}
@keyframes ambientGlow { from { transform: scale(1); } to { transform: scale(1.04); } }
/* === Form controls: unify inputs, selects, textareas ===================== */
input[type=text], input[type=email], input[type=search], input[type=password],
input[type=number], input[type=url], input[type=tel], select, textarea, .form-control {
  -webkit-appearance: none; appearance: none;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text-primary);
  border-radius: 10px;
  padding: 10px 12px;
  outline: none;
  transition: border-color .2s ease, box-shadow .2s ease, background .2s ease;
}
input::placeholder, textarea::placeholder { color: var(--text-tertiary); }
input:focus, select:focus, textarea:focus, .form-control:focus {
  border-color: rgba(255,122,24,.55);
  box-shadow: 0 0 0 3px rgba(255,122,24,.22);
  background: var(--surface-3);
}
select {
  background-image: linear-gradient(180deg, rgba(255,255,255,.05), rgba(255,255,255,.02));
  padding-right: 36px;
}

/* === Sidebar collapse ==================================================== */
:root { --sidebar-w: 260px; }
.sidebar { width: var(--sidebar-w); }
.app[data-sidebar="collapsed"] { --sidebar-w: 72px; }
.app[data-sidebar="collapsed"] .sidebar { width: var(--sidebar-w); }
.app[data-sidebar="collapsed"] .sidebar .nav span { display: none; }
.sidebar .logo a i { margin-right: 8px; }
.app[data-sidebar="collapsed"] .sidebar .logo a {
  display: flex; justify-content: center; font-size: 0; overflow: hidden;
}
.app[data-sidebar="collapsed"] .sidebar .logo a i { margin-right: 0; font-size: 1.5rem; }
/* Fallback when there is no .app wrapper */
html[data-sidebar="collapsed"] { --sidebar-w: 72px; }
html[data-sidebar="expanded"]  { --sidebar-w: 260px; }
html[data-sidebar="collapsed"] .sidebar .nav span { display: none; }

/* === Mail: two-pane layout, sticky header, proper scroll ================= */
.email-container {
  display: grid; gap: 16px;
  grid-template-columns: minmax(280px, 360px) 1fr;
}
.email-list, .email-viewer {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}
.email-list {
  overflow-y: auto;
  max-height: calc(100vh - 180px); /* fits under header in most cases */
}
.email-list-header {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; padding: 10px 12px;
  background: linear-gradient(90deg, rgba(255,122,24,.08), transparent);
  border-bottom: 1px solid var(--border);
}
.email-item {
  display: grid; grid-template-columns: 22px 20px 1fr;
  align-items: start; gap: 12px;
  padding: 12px 14px; border-bottom: 1px solid var(--border);
  transition: background .2s ease; cursor: pointer;
}
.email-item:hover { background: var(--bg-hover); }
.email-item .email-header { display:flex; justify-content:space-between; gap:12px; }
.email-item .email-from, .email-item .email-subject, .email-item .email-preview {
  overflow: hidden; white-space: nowrap; text-overflow: ellipsis;
}
/* "Load more" button pinned to bottom of the list */
#loadMoreEmails { position: sticky; bottom: 0; }

/* Narrow: stack list, hide viewer until an item is opened */
@media (max-width: 900px){
  .email-container { grid-template-columns: 1fr; }
  .email-viewer { display: none; }
}
/* === Domains grid breathing room ======================================== */
.domains-container .domain-grid {
  display: grid; gap: 16px;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}

/* === Toasts ============================================================== */
.bmo-toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%) translateY(16px);
  background: var(--surface); color: var(--text-primary);
  border: 1px solid var(--border-light); border-radius: 999px;
  padding: 10px 14px; box-shadow: var(--shadow-md); z-index: 10000;
  opacity: 0; transition: transform .2s ease, opacity .2s ease;
}
.bmo-toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
/* Let flex/grid children shrink (prevents overflow) */
.main, .email-list, .email-viewer, .email-content { min-width: 0; }

/* Liquid glass sidebar surface */
.sidebar {
  background: linear-gradient(180deg, rgba(255,255,255,.04), rgba(255,255,255,.02));
  border-right: 1px solid var(--border);
  backdrop-filter: blur(10px) saturate(140%);
  -webkit-backdrop-filter: blur(10px) saturate(140%);
}

/* === Background job tray ================================================ */
.bulk-job-tray {
  position: fixed;
  right: 18px;
  bottom: 18px;
  width: min(320px, calc(100vw - 32px));
  display: flex;
  flex-direction: column;
  gap: 12px;
  z-index: 1030;
  font-size: 14px;
  max-height: min(70vh, 560px);
  overflow-x: hidden;
  overflow-y: auto;
}
.bulk-job-tray-head {
  font-weight: 600;
  color: var(--text-tertiary);
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .05em;
}
.bulk-job-tray-actions {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.bulk-job-clear {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid var(--border-light);
  background: rgba(255,255,255,.04);
  color: var(--text-tertiary);
  font-size: 11px;
  letter-spacing: .05em;
  text-transform: uppercase;
  cursor: pointer;
  transition: background .18s ease, color .18s ease, border-color .18s ease;
}
.bulk-job-clear i {
  font-size: .9rem;
}
.bulk-job-clear:hover {
  background: rgba(255,255,255,.10);
  color: var(--text-primary);
  border-color: rgba(255,255,255,.24);
}
.bulk-job-clear:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}
.bulk-job-tray-head .title {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.bulk-job-tray-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  flex: 1 1 auto;
  overflow-y: auto;
  padding-right: 4px;
}
.bulk-job-card {
  position: relative;
  padding: 14px 16px;
  background: var(--surface);
  border: 1px solid var(--border-light);
  border-radius: 14px;
  box-shadow: var(--shadow-md);
  transition: transform .18s ease, box-shadow .18s ease;
  cursor: pointer;
}
.bulk-job-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}
.bulk-job-card.is-running {
  border-color: rgba(92,108,255,.24);
}
.bulk-job-card.is-completed {
  border-color: rgba(64, 180, 91, .4);
}
.bulk-job-card.is-error {
  border-color: rgba(217, 48, 37, .4);
}
.bulk-job-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 6px;
}
.bulk-job-title {
  font-weight: 600;
  font-size: 14px;
  color: var(--text-primary);
  flex: 1;
  min-width: 0;
}
.bulk-job-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 2px 10px 2px 8px;
  border-radius: 999px;
  background: rgba(92,108,255,.16);
  color: #5c6cff;
  font-weight: 600;
  font-size: 11px;
  letter-spacing: .05em;
  text-transform: uppercase;
}
.bulk-job-chip::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  opacity: .6;
}
.bulk-job-chip.is-pulsing::before {
  animation: jobPulse 1.2s ease-in-out infinite;
}
.bulk-job-card.is-completed .bulk-job-chip {
  background: rgba(64,180,91,.18);
  color: #299548;
}
.bulk-job-card.is-error .bulk-job-chip {
  background: rgba(217,48,37,.18);
  color: #d93025;
}
.bulk-job-message {
  color: var(--text-secondary);
  margin: 6px 0 10px;
  font-size: 13px;
  line-height: 1.45;
}
.bulk-job-breakdown {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  color: var(--text-secondary);
  font-size: 13px;
  margin-bottom: 6px;
}
.bulk-job-breakdown span {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.bulk-job-breakdown .separator {
  color: var(--text-tertiary);
}
.bulk-job-breakdown .has-errors {
  color: #d93025;
  font-weight: 600;
}
.bulk-job-progress {
  height: 8px;
  background: rgba(255,255,255,.08);
  border-radius: 999px;
  overflow: hidden;
  position: relative;
  display: flex;
}
.bulk-job-progress span,
.bulk-job-progress .bulk-progress-segment {
  display: block;
  height: 100%;
  transition: width .25s ease;
  flex: 0 0 auto;
  background: var(--accent, #5c6cff);
}
.bulk-job-progress .bulk-progress-segment.is-success {
  background: #40b45b;
}
.bulk-job-progress .bulk-progress-segment.is-failed {
  background: #d93025;
}
.bulk-job-progress .bulk-progress-segment.is-active {
  background: linear-gradient(90deg, rgba(92,108,255,.35), rgba(92,108,255,.85));
}
.bulk-job-progress .bulk-progress-segment.is-queued {
  background: rgba(255,255,255,.14);
}
.bulk-job-card.is-running .bulk-job-progress .bulk-progress-segment.is-active {
  background: linear-gradient(90deg, rgba(92,108,255,.35), rgba(92,108,255,.85));
}
.bulk-job-card.is-error .bulk-job-progress .bulk-progress-segment {
  background: #d93025;
}
.bulk-job-card.is-completed .bulk-job-progress .bulk-progress-segment {
  background: #40b45b;
}
.bulk-job-progress-label {
  margin-top: 6px;
  font-size: 11px;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--text-tertiary);
}

.bulk-progress-alert {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
}
.bulk-progress-alert [data-progress-separator] {
  color: var(--text-tertiary);
}
.bulk-job-meta {
  color: var(--text-tertiary);
  font-size: 12px;
  margin-top: 10px;
}
.bulk-job-dismiss {
  position: absolute;
  top: 6px;
  right: 6px;
  border: none;
  background: transparent;
  color: var(--text-tertiary);
  padding: 4px;
  line-height: 1;
  border-radius: 6px;
  cursor: pointer;
}
.bulk-job-dismiss:hover {
  background: rgba(255,255,255,.08);
}
.bulk-job-recent {
  list-style: none;
  margin: 10px 0 0;
  padding: 8px 0 0;
  border-top: 1px solid var(--border-light);
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.bulk-job-recent li {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 12px;
  color: var(--text-secondary);
}
.bulk-job-recent li.has-errors {
  color: #d93025;
  font-weight: 600;
}
.bulk-job-recent .recent-label {
  font-weight: 600;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.bulk-job-recent .recent-status {
  margin-left: auto;
  color: var(--text-tertiary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.bulk-job-card.is-error .bulk-job-recent .recent-status {
  color: #d93025;
}

.bmo-toast[data-level="error"] { background: rgba(217,48,37,.12); color: #ffb4ab; }
.bmo-toast[data-level="warning"] { background: rgba(255,171,0,.14); color: #ffd699; }
.bmo-toast[data-level="success"] { background: rgba(64,180,91,.14); color: #d2f5d9; }

@media (max-width: 720px){
  .bulk-job-tray { right: 12px; left: 12px; width: auto; }
}

@keyframes jobPulse {
  0%, 100% { transform: scale(.6); opacity: .5; }
  50% { transform: scale(1); opacity: 1; }
}

/* === Liquid Glass Refresh (Apple-inspired) ============================= */
:root {
  --accent-sage: #5fb99d;
  --accent-teal: #3f9d94;
  --accent-forest: #2a6f66;
  --accent-tide: #3d86a1;
  --accent-amber: #f4bd70;
  --accent-violet: #7d82ff;
  --accent-rose: #ff9f8e;

  --primary: var(--accent-forest);
  --primary-dark: #21564d;

  --bg: #020509;
  --bg-soft: #04080f;
  --surface: rgba(9, 14, 22, 0.92);
  --surface-2: rgba(11, 18, 26, 0.94);
  --surface-3: rgba(13, 22, 32, 0.96);

  --surface-ink: rgba(11, 18, 28, 0.9);
  --surface-slate: rgba(14, 24, 34, 0.92);
  --surface-emerald: rgba(20, 34, 34, 0.82);
  --surface-teal: rgba(19, 32, 40, 0.84);
  --surface-amber: rgba(46, 34, 22, 0.78);
  --surface-indigo: rgba(20, 28, 44, 0.88);
  --surface-blue: rgba(18, 30, 46, 0.88);

  --surface-tint: rgba(82, 148, 156, 0.16);
  --surface-glow: rgba(68, 132, 170, 0.18);

  --text-primary: rgba(230, 238, 242, 0.98);
  --text-secondary: rgba(198, 214, 226, 0.86);
  --text-tertiary: rgba(148, 170, 186, 0.7);
  --text-on-primary: #f5fbff;
  --text-on-muted: rgba(204, 226, 238, 0.72);

  --border: rgba(92, 146, 168, 0.22);
  --border-light: rgba(92, 146, 168, 0.3);
  --bg-hover: rgba(72, 148, 164, 0.16);

  --radius: 16px;
  --radius-lg: 22px;

  --shadow-sm: 0 18px 36px rgba(0, 6, 12, 0.56);
  --shadow-md: 0 32px 60px rgba(0, 8, 14, 0.62);
  --shadow-lg: 0 46px 116px rgba(0, 6, 10, 0.7);

  --gradient-accent: linear-gradient(140deg, rgba(64, 152, 166, 0.92), rgba(96, 174, 204, 0.72));
  --gradient-secondary: linear-gradient(145deg, rgba(70, 138, 198, 0.82), rgba(96, 174, 204, 0.64));
  --gradient-rainbow: linear-gradient(135deg, rgba(96, 174, 204, 0.8), rgba(64, 152, 166, 0.86), rgba(125, 130, 255, 0.72), rgba(244, 189, 112, 0.66));
  --gradient-soft: linear-gradient(152deg, rgba(255, 255, 255, 0.18), rgba(96, 174, 204, 0.12), rgba(64, 152, 166, 0.1));

  --focus-ring: rgba(80, 156, 186, 0.24);
  --transition-base: 180ms ease;
  --transition-slow: 320ms ease;
}

html[data-theme="light"] {
  color-scheme: light;
  --bg: #f4f7f8;
  --bg-soft: #e9f0f3;
  --surface: rgba(255, 255, 255, 0.96);
  --surface-2: rgba(255, 255, 255, 0.98);
  --surface-3: rgba(255, 255, 255, 0.99);

  --surface-ink: rgba(236, 244, 248, 0.9);
  --surface-slate: rgba(232, 240, 246, 0.94);
  --surface-emerald: rgba(224, 240, 236, 0.94);
  --surface-teal: rgba(220, 236, 240, 0.94);
  --surface-amber: rgba(246, 233, 214, 0.9);
  --surface-indigo: rgba(228, 236, 248, 0.96);
  --surface-blue: rgba(220, 236, 248, 0.96);

  --surface-tint: rgba(96, 174, 204, 0.14);
  --surface-glow: rgba(64, 152, 166, 0.16);

  --text-primary: #152934;
  --text-secondary: #2d4a56;
  --text-tertiary: #4b646e;
  --text-on-primary: #0f212a;
  --text-on-muted: rgba(44, 74, 84, 0.7);

  --border: rgba(52, 118, 138, 0.16);
  --border-light: rgba(52, 118, 138, 0.24);
  --bg-hover: rgba(96, 174, 204, 0.1);

  --shadow-sm: 0 14px 30px rgba(36, 78, 92, 0.08);
  --shadow-md: 0 26px 54px rgba(40, 86, 104, 0.12);
  --shadow-lg: 0 38px 90px rgba(40, 86, 104, 0.14);

  --gradient-accent: linear-gradient(140deg, #3f9d94, #6dc7cf);
  --gradient-secondary: linear-gradient(145deg, #4d84c6, #6dc7cf);
  --gradient-rainbow: linear-gradient(135deg, #6dc7cf, #3f9d94, #7d82ff, #f4bd70);
  --gradient-soft: linear-gradient(152deg, rgba(255, 255, 255, 0.92), rgba(109, 199, 207, 0.14), rgba(63, 157, 148, 0.12));

  --focus-ring: rgba(96, 174, 204, 0.18);
}

/* Aurora backdrop */
body::before {
  background:
    radial-gradient(65vmax 60vmax at 15% 8%, rgba(64, 152, 166, 0.18), transparent 70%),
    radial-gradient(58vmax 58vmax at 82% 4%, rgba(125, 130, 255, 0.2), transparent 72%),
    radial-gradient(52vmax 60vmax at 55% 110%, rgba(255, 159, 120, 0.14), transparent 76%),
    radial-gradient(90vmax 90vmax at 38% 118%, rgba(4, 12, 24, 0.65), transparent 78%);
  filter: blur(90px) saturate(130%);
}
html[data-theme="light"] body::before {
  background:
    radial-gradient(65vmax 60vmax at 18% 14%, rgba(109, 199, 207, 0.22), transparent 70%),
    radial-gradient(58vmax 58vmax at 82% 2%, rgba(125, 130, 255, 0.22), transparent 72%),
    radial-gradient(52vmax 60vmax at 56% 108%, rgba(244, 189, 112, 0.18), transparent 76%),
    radial-gradient(90vmax 90vmax at 40% 120%, rgba(200, 216, 236, 0.62), transparent 78%);
  filter: blur(104px) saturate(124%);
}

/* Glass surfaces */
.card {
  background: linear-gradient(160deg,
    var(--surface-2) 0%,
    var(--surface) 52%,
    var(--surface-indigo) 100%);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  color: var(--text-primary);
  box-shadow: var(--shadow-sm);
  backdrop-filter: blur(28px) saturate(170%);
  -webkit-backdrop-filter: blur(28px) saturate(170%);
  position: relative;
  overflow: hidden;
  transition: transform var(--transition-base), box-shadow var(--transition-base), border-color var(--transition-base), background var(--transition-slow);
}
html[data-theme="light"] .card {
  background: linear-gradient(160deg,
    var(--surface-3) 0%,
    var(--surface-indigo) 46%,
    var(--surface-blue) 100%);
}
.card::after {
  content: "";
  position: absolute;
  inset: -18%;
  border-radius: inherit;
  background: radial-gradient(120% 120% at 0% 0%, rgba(104, 186, 206, 0.34), transparent 60%),
              radial-gradient(140% 140% at 100% 0%, rgba(255, 177, 132, 0.26), transparent 55%);
  mix-blend-mode: screen;
  opacity: 0.18;
  pointer-events: none;
  transition: opacity var(--transition-slow);
}
.card:hover {
  transform: translateY(-4px);
  border-color: rgba(104, 186, 206, 0.4);
  box-shadow: var(--shadow-md);
  background: linear-gradient(160deg,
    var(--surface-2) 0%,
    color-mix(in srgb, var(--surface) 80%, rgba(104, 186, 206, 0.32)) 55%,
    var(--surface-teal) 100%);
}
@supports not (color-mix(in srgb, #000, #000)) {
  .card:hover {
    background: linear-gradient(160deg,
      var(--surface-2) 0%,
      rgba(28, 62, 86, 0.84) 55%,
      var(--surface-teal) 100%);
  }
}
.card:hover::after,
.card:focus-within::after {
  opacity: 0.6;
}
.card:focus-within {
  border-color: rgba(104, 190, 208, 0.5);
  box-shadow: 0 0 0 3px var(--focus-ring);
}
.card .card-header {
  background: linear-gradient(140deg, rgba(61, 134, 161, 0.2), rgba(70, 134, 196, 0.14));
  border-bottom: 1px solid rgba(255, 255, 255, 0.14);
  transition: background var(--transition-slow), border-color var(--transition-base);
}
html[data-theme="light"] .card .card-header {
  border-bottom-color: rgba(40, 110, 128, 0.2);
  background: linear-gradient(140deg, rgba(61, 134, 161, 0.24), rgba(104, 190, 208, 0.18));
}

/* Buttons */
.btn {
  border: 1px solid rgba(255, 255, 255, 0.22);
  background: linear-gradient(150deg, rgba(255, 255, 255, 0.2), rgba(24, 36, 48, 0.12));
  color: var(--text-primary);
  backdrop-filter: blur(20px) saturate(165%);
  -webkit-backdrop-filter: blur(20px) saturate(165%);
  box-shadow: 0 16px 32px rgba(6, 18, 48, 0.24);
  transition: transform var(--transition-base), box-shadow var(--transition-base), border-color var(--transition-base), background var(--transition-slow), color var(--transition-base);
}

/* Sidebar navigation glow */
.sidebar .nav a {
  position: relative;
  overflow: hidden;
  border: 1px solid transparent;
  transition: background var(--transition-base), color var(--transition-base), border-color var(--transition-base), box-shadow var(--transition-base), transform var(--transition-base);
}
.sidebar .nav a::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(140deg, rgba(61, 134, 161, 0.18), rgba(70, 134, 196, 0.12));
  opacity: 0;
  transition: opacity var(--transition-base);
}
.sidebar .nav a:hover,
.sidebar .nav a:focus-visible {
  color: var(--text-on-primary);
  border-color: rgba(104, 190, 208, 0.42);
  box-shadow: 0 18px 32px rgba(61, 134, 161, 0.22);
  transform: translateX(6px);
}
.sidebar .nav a:hover::after,
.sidebar .nav a:focus-visible::after {
  opacity: 1;
}
.sidebar .nav a:focus-visible {
  outline: none;
}
.sidebar .nav a > * {
  position: relative;
  z-index: 1;
}
html[data-theme="light"] .btn {
  border-color: rgba(52, 118, 138, 0.16);
  background: linear-gradient(150deg, rgba(255, 255, 255, 0.92), rgba(226, 240, 245, 0.14));
}
.btn:hover {
  transform: translateY(-2px);
  border-color: rgba(61, 134, 161, 0.5);
  box-shadow: 0 22px 44px rgba(61, 134, 161, 0.24);
}
.btn:active {
  transform: translateY(0) scale(0.97);
  filter: saturate(1.08);
}
.btn:focus-visible {
  outline: 3px solid var(--focus-ring);
  outline-offset: 2px;
}
.btn-primary {
  background: var(--gradient-accent);
  border: 1px solid rgba(104, 190, 208, 0.55);
  color: var(--text-on-primary);
  text-shadow: 0 1px 4px rgba(8, 40, 28, 0.45);
  box-shadow: 0 28px 54px rgba(61, 134, 161, 0.34);
}
.btn-primary:hover {
  box-shadow: 0 32px 60px rgba(61, 134, 161, 0.4);
  filter: saturate(1.08);
}
.btn-secondary {
  background: var(--gradient-secondary);
  border: 1px solid rgba(98, 182, 206, 0.46);
  color: var(--text-on-primary);
  text-shadow: 0 1px 4px rgba(8, 32, 40, 0.38);
  box-shadow: 0 26px 52px rgba(70, 134, 196, 0.32);
}
.btn-outline {
  background: linear-gradient(150deg, rgba(255, 255, 255, 0.12), rgba(26, 38, 48, 0.1));
  border: 1px solid rgba(255, 255, 255, 0.24);
  color: var(--text-primary);
}
html[data-theme="light"] .btn-outline {
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.88), rgba(226, 240, 245, 0.14));
  border-color: rgba(52, 118, 138, 0.18);
}
.btn-outline:hover {
  background: linear-gradient(150deg, rgba(61, 134, 161, 0.18), rgba(70, 134, 196, 0.12));
  border-color: rgba(61, 134, 161, 0.48);
  color: var(--text-on-muted);
}

/* Search & form controls */
.header-search .search-input {
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: linear-gradient(150deg, rgba(255, 255, 255, 0.18), rgba(24, 36, 48, 0.1));
  color: var(--text-primary);
  backdrop-filter: blur(18px) saturate(160%);
  -webkit-backdrop-filter: blur(18px) saturate(160%);
  transition: background var(--transition-slow), border-color var(--transition-base), box-shadow var(--transition-base);
}
html[data-theme="light"] .header-search .search-input {
  border-color: rgba(52, 118, 138, 0.16);
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.86), rgba(226, 240, 245, 0.12));
}
.header-search .search-input:hover {
  border-color: rgba(61, 134, 161, 0.46);
  background: linear-gradient(150deg, rgba(255, 255, 255, 0.22), rgba(61, 134, 161, 0.14));
}
.header-search .search-input:focus {
  border-color: rgba(61, 134, 161, 0.58);
  box-shadow: 0 0 0 3px var(--focus-ring);
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.22), rgba(255, 255, 255, 0.06));
}

input[type=text], input[type=email], input[type=search], input[type=password],
input[type=number], input[type=url], input[type=tel], select, textarea, .form-control {
  background: linear-gradient(150deg, rgba(255, 255, 255, 0.16), rgba(26, 38, 48, 0.08));
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: var(--text-primary);
  backdrop-filter: blur(16px) saturate(150%);
  -webkit-backdrop-filter: blur(16px) saturate(150%);
  transition: background var(--transition-slow), border-color var(--transition-base), box-shadow var(--transition-base);
}
html[data-theme="light"] input[type=text], html[data-theme="light"] input[type=email],
html[data-theme="light"] input[type=search], html[data-theme="light"] input[type=password],
html[data-theme="light"] input[type=number], html[data-theme="light"] input[type=url],
html[data-theme="light"] input[type=tel], html[data-theme="light"] select,
html[data-theme="light"] textarea, html[data-theme="light"] .form-control {
  background: linear-gradient(150deg, rgba(255, 255, 255, 0.9), rgba(226, 240, 245, 0.12));
  border-color: rgba(52, 118, 138, 0.16);
}
input[type=text]:hover, input[type=email]:hover, input[type=search]:hover, input[type=password]:hover,
input[type=number]:hover, input[type=url]:hover, input[type=tel]:hover, select:hover, textarea:hover, .form-control:hover {
  border-color: rgba(61, 134, 161, 0.46);
  background: linear-gradient(150deg, rgba(255, 255, 255, 0.2), rgba(61, 134, 161, 0.12));
}
input[type=text]:focus, input[type=email]:focus, input[type=search]:focus, input[type=password]:focus,
input[type=number]:focus, input[type=url]:focus, input[type=tel]:focus, select:focus, textarea:focus, .form-control:focus {
  border-color: rgba(61, 134, 161, 0.58);
  box-shadow: 0 0 0 3px var(--focus-ring);
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.22), rgba(255, 255, 255, 0.06));
}

/* Badges */
.badge {
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.14), rgba(255, 255, 255, 0.03));
  border-color: rgba(255, 255, 255, 0.16);
  color: var(--text-secondary);
}
html[data-theme="light"] .badge {
  border-color: rgba(52, 118, 138, 0.18);
}
.badge-secondary {
  border-color: rgba(61, 134, 161, 0.42);
  background: linear-gradient(135deg, rgba(61, 134, 161, 0.22), rgba(70, 134, 196, 0.14));
  color: var(--text-primary);
}
.badge-ready {
  background: linear-gradient(135deg, rgba(86, 205, 143, 0.22), rgba(86, 205, 143, 0.08));
  border: 1px solid rgba(86, 205, 143, 0.4);
  color: #b9f4ce;
}
html[data-theme="light"] .badge-ready {
  color: #2c7a47;
}
.badge-running {
  background: linear-gradient(135deg, rgba(70, 134, 196, 0.22), rgba(61, 134, 161, 0.18));
  border: 1px solid rgba(70, 134, 196, 0.42);
  color: #d8edf6;
}
html[data-theme="light"] .badge-running {
  color: #174f62;
}
.badge-update {
  background: linear-gradient(135deg, rgba(70, 134, 196, 0.18), rgba(245, 194, 107, 0.16));
  border: 1px solid rgba(70, 134, 196, 0.38);
  color: #dfeef4;
}
.badge-error {
  background: linear-gradient(135deg, rgba(255, 69, 58, 0.26), rgba(255, 69, 58, 0.1));
  border: 1px solid rgba(255, 69, 58, 0.45);
  color: #ffc9c5;
}
html[data-theme="light"] .badge-error {
  color: #7a1410;
}

/* Bulk onboarding */
.bulk-hero {
  background: linear-gradient(155deg, rgba(12, 26, 34, 0.88) 0%, rgba(32, 46, 62, 0.72) 55%, rgba(44, 32, 18, 0.5) 100%);
  border: 1px solid rgba(255, 255, 255, 0.18);
  box-shadow: 0 34px 64px rgba(2, 10, 14, 0.42);
}
html[data-theme="light"] .bulk-hero {
  background: linear-gradient(155deg, rgba(255, 255, 255, 0.96) 0%, rgba(226, 240, 245, 0.28) 54%, rgba(245, 232, 214, 0.22) 100%);
  border-color: rgba(52, 118, 138, 0.14);
}
.bulk-step {
  background: linear-gradient(150deg, rgba(12, 24, 32, 0.78), rgba(32, 44, 58, 0.62));
  border: 1px solid rgba(92, 146, 168, 0.22);
  color: var(--text-tertiary);
  box-shadow: 0 16px 30px rgba(3, 12, 32, 0.28);
  transition: transform var(--transition-base), box-shadow var(--transition-base), border-color var(--transition-base), background var(--transition-slow);
}
html[data-theme="light"] .bulk-step {
  background: linear-gradient(150deg, rgba(255, 255, 255, 0.92), rgba(226, 240, 245, 0.2));
  border-color: rgba(52, 118, 138, 0.12);
}
.bulk-step.active {
  border-color: rgba(61, 134, 161, 0.54);
  color: var(--text-primary);
  box-shadow: 0 24px 46px rgba(61, 134, 161, 0.22);
  background: linear-gradient(150deg, rgba(61, 134, 161, 0.28), rgba(70, 134, 196, 0.2));
}
.bulk-step.complete {
  border-color: rgba(70, 134, 196, 0.4);
  color: var(--text-primary);
  background: linear-gradient(150deg, rgba(70, 134, 196, 0.22), rgba(245, 194, 107, 0.18));
}
.bulk-step:hover {
  transform: translateY(-4px);
  border-color: rgba(70, 134, 196, 0.38);
}
.bulk-card {
  background: linear-gradient(160deg, rgba(12, 28, 36, 0.88), rgba(34, 48, 60, 0.74));
  border: 1px solid rgba(255, 255, 255, 0.18);
  box-shadow: 0 28px 56px rgba(3, 12, 14, 0.38);
  backdrop-filter: blur(22px) saturate(165%);
  -webkit-backdrop-filter: blur(22px) saturate(165%);
  transition: transform var(--transition-base), box-shadow var(--transition-base), border-color var(--transition-base), background var(--transition-slow);
}
html[data-theme="light"] .bulk-card {
  background: linear-gradient(155deg, rgba(255, 255, 255, 0.97), rgba(226, 240, 245, 0.18), rgba(245, 232, 214, 0.18));
  border-color: rgba(52, 118, 138, 0.12);
}
.bulk-card:hover {
  transform: translateY(-6px);
  border-color: rgba(70, 134, 196, 0.34);
  box-shadow: 0 32px 64px rgba(3, 12, 14, 0.42);
}
.bulk-stat {
  border: 1px solid rgba(92, 146, 168, 0.28);
  background: linear-gradient(150deg, rgba(16, 32, 42, 0.74), rgba(61, 134, 161, 0.2));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.18);
  color: var(--text-secondary);
  transition: transform var(--transition-base), box-shadow var(--transition-base), border-color var(--transition-base), background var(--transition-slow);
}
html[data-theme="light"] .bulk-stat {
  background: linear-gradient(150deg, rgba(226, 240, 245, 0.24), rgba(61, 134, 161, 0.16));
  border-color: rgba(70, 134, 196, 0.24);
}
.bulk-stat:hover {
  transform: translateY(-4px);
  border-color: rgba(61, 134, 161, 0.36);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.22), 0 18px 36px rgba(61, 134, 161, 0.18);
}
.bulk-table tbody tr {
  background: linear-gradient(150deg, rgba(12, 24, 32, 0.8), rgba(32, 46, 62, 0.22));
  border: 1px solid rgba(255, 255, 255, 0.16);
  box-shadow: 0 16px 40px rgba(3, 12, 14, 0.3);
  transition: transform var(--transition-base), box-shadow var(--transition-base), border-color var(--transition-base), background var(--transition-slow);
}
html[data-theme="light"] .bulk-table tbody tr {
  background: linear-gradient(150deg, rgba(255, 255, 255, 0.94), rgba(226, 240, 245, 0.16));
  border-color: rgba(52, 118, 138, 0.12);
  box-shadow: 0 14px 34px rgba(36, 78, 92, 0.1);
}
.bulk-table tbody tr:hover {
  transform: translateY(-4px);
  border-color: rgba(61, 134, 161, 0.34);
  box-shadow: 0 18px 44px rgba(61, 134, 161, 0.22);
}
.bulk-table tbody tr:hover code {
  border-color: rgba(61, 134, 161, 0.32);
}
.bulk-table code {
  background: linear-gradient(150deg, rgba(10, 28, 36, 0.78), rgba(61, 134, 161, 0.2));
  border: 1px solid rgba(255, 255, 255, 0.18);
  transition: background var(--transition-base), border-color var(--transition-base);
}
html[data-theme="light"] .bulk-table code {
  background: linear-gradient(150deg, rgba(226, 240, 245, 0.14), rgba(61, 134, 161, 0.1));
  border-color: rgba(52, 118, 138, 0.16);
}
.bulk-divider {
  background: linear-gradient(90deg, rgba(255, 255, 255, 0.05), rgba(70, 134, 196, 0.26), rgba(245, 194, 107, 0.18));
}
html[data-theme="light"] .bulk-divider {
  background: linear-gradient(90deg, rgba(52, 118, 138, 0.05), rgba(61, 134, 161, 0.2), rgba(245, 194, 107, 0.18));
}
.bulk-log {
  background: linear-gradient(150deg, rgba(10, 24, 32, 0.74), rgba(34, 44, 60, 0.18));
  border: 1px solid rgba(255, 255, 255, 0.18);
}
html[data-theme="light"] .bulk-log {
  background: linear-gradient(150deg, rgba(255, 255, 255, 0.92), rgba(226, 240, 245, 0.16));
  border-color: rgba(52, 118, 138, 0.12);
}

/* Compose & floating actions */
.compose-header {
  background: linear-gradient(120deg, rgba(61, 134, 161, 0.12), rgba(125, 130, 255, 0.08));
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}
html[data-theme="light"] .compose-header {
  border-bottom-color: rgba(52, 118, 138, 0.14);
}
.compose-input, .compose-body {
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.12), rgba(255, 255, 255, 0.02));
  border: 1px solid rgba(255, 255, 255, 0.18);
  color: var(--text-primary);
  backdrop-filter: blur(18px) saturate(150%);
  -webkit-backdrop-filter: blur(18px) saturate(150%);
}
html[data-theme="light"] .compose-input, html[data-theme="light"] .compose-body {
  background: rgba(255, 255, 255, 0.82);
  border-color: rgba(40, 110, 128, 0.18);
}
.compose-input:focus, .compose-body:focus {
  border-color: rgba(61, 134, 161, 0.58);
  box-shadow: 0 0 0 3px var(--focus-ring);
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.2), rgba(255, 255, 255, 0.06));
}
.compose-fab {
  background: var(--gradient-rainbow);
  border: 1px solid rgba(98, 182, 206, 0.55);
  box-shadow: 0 32px 60px rgba(61, 134, 161, 0.38);
  color: var(--text-on-primary);
}
.compose-fab::after {
  border: 2px solid rgba(98, 182, 206, 0.4);
}
.compose-fab:hover {
  transform: translateY(-2px) scale(1.04);
  box-shadow: 0 38px 72px rgba(61, 134, 161, 0.45);
}
.theme-toggle {
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.12), rgba(98, 182, 206, 0.08));
  color: var(--text-secondary);
  backdrop-filter: blur(18px) saturate(160%);
  -webkit-backdrop-filter: blur(18px) saturate(160%);
}
html[data-theme="light"] .theme-toggle {
  border-color: rgba(52, 118, 138, 0.16);
  background: rgba(255, 255, 255, 0.72);
}
.theme-toggle:hover {
  border-color: rgba(98, 182, 206, 0.5);
  box-shadow: 0 18px 34px rgba(61, 134, 161, 0.22);
  color: var(--text-primary);
}

/* Scrollbars */
* {
  scrollbar-width: thin;
  scrollbar-color: rgba(98, 182, 206, 0.45) rgba(12, 20, 35, 0.3);
}
*::-webkit-scrollbar-thumb {
  background: rgba(98, 182, 206, 0.6);
}
*::-webkit-scrollbar-track {
  background: rgba(12, 20, 35, 0.28);
}
html[data-theme="light"] * {
  scrollbar-color: rgba(98, 182, 206, 0.45) rgba(226, 240, 230, 0.8);
}
html[data-theme="light"] *::-webkit-scrollbar-track {
  background: rgba(226, 240, 230, 0.8);
}

/* Text glow */
.rainbow-text {
  background: linear-gradient(120deg, #6de0c5, #43c483, #f4bd70);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

/* Admin tweaks */
body.login #container {
  background: linear-gradient(150deg, rgba(255, 255, 255, 0.18), rgba(98, 182, 206, 0.14));
  border: 1px solid rgba(255, 255, 255, 0.16);
  box-shadow: var(--shadow-lg);
  backdrop-filter: blur(24px) saturate(170%);
  -webkit-backdrop-filter: blur(24px) saturate(170%);
}
html[data-theme="light"] body.login #container {
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.92), rgba(224, 245, 234, 0.3));
  border-color: rgba(52, 118, 138, 0.12);
}
body.login #container::after {
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.28), transparent 60%);
  filter: none;
  opacity: 0.5;
}
body .submit-row input[type="submit"],
body .submit-row input[type="button"],
body .submit-row input[type="reset"] {
  border: 1px solid rgba(255, 255, 255, 0.18) !important;
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.16), rgba(255, 255, 255, 0.04)) !important;
  color: var(--text-primary) !important;
}
body .submit-row input[type="submit"]:hover,
body .submit-row input[type="button"]:hover {
  border-color: rgba(61, 134, 161, 0.48) !important;
  box-shadow: 0 12px 36px rgba(61, 134, 161, 0.26) !important;
}

/* Toast palette */
.bmo-toast[data-level="error"] {
  background: rgba(255, 69, 58, 0.2);
  color: #ffd7d4;
}
html[data-theme="light"] .bmo-toast[data-level="error"] {
  color: #7a1410;
}
.bmo-toast[data-level="warning"] {
  background: rgba(255, 204, 0, 0.18);
  color: #fff1c1;
}
html[data-theme="light"] .bmo-toast[data-level="warning"] {
  color: #7a5d00;
}
.bmo-toast[data-level="success"] {
  background: rgba(86, 205, 143, 0.2);
  color: #ccf5d9;
}
html[data-theme="light"] .bmo-toast[data-level="success"] {
  color: #1f5e32;
}

.bulk-job-recent li.has-errors,
.bulk-job-card.is-error .bulk-job-recent .recent-status {
  color: #ff453a;
}
