/* =========================================================================
   Intermail.ly v2 — Royal Blue & Obsidian Black Executive Theme
   هادئ، فاخر، معزول الحقوق 100%، بطاقات حقيقية للموبايل وتنبيهات بدون تداخل
   ========================================================================= */

:root {
  --bg-obsidian: #05070d;
  --bg-abyss: #090f1f;
  --bg-glass: rgba(9, 15, 31, 0.8);
  --bg-glass-strong: rgba(7, 11, 24, 0.94);
  --bg-elevated: rgba(15, 25, 52, 0.65);

  --royal-deep: #142a78;
  --royal: #1f3fbf;
  --royal-bright: #3b6cff;
  --royal-soft: rgba(59, 108, 255, 0.14);
  --royal-glow: rgba(59, 108, 255, 0.28);

  --border-subtle: rgba(59, 108, 255, 0.2);
  --border-strong: rgba(91, 140, 255, 0.44);

  --text-main: #e6eeff;
  --text-muted: #8b9cc2;
  --text-dim: #627399;

  --ok: #34d399;
  --ok-soft: rgba(52, 211, 153, 0.14);
  --warn: #fbbf24;
  --warn-soft: rgba(251, 191, 36, 0.14);
  --danger: #f87171;
  --danger-soft: rgba(248, 113, 113, 0.14);

  --radius-xl: 22px;
  --radius-lg: 16px;
  --radius-md: 12px;
  --radius-sm: 9px;
}

*, *::before, *::after {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  background-color: var(--bg-obsidian);
  color: var(--text-main);
  font-family: 'Cairo', system-ui, -apple-system, 'Segoe UI', Tahoma, sans-serif;
  line-height: 1.55;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

.font-mono {
  font-family: ui-monospace, 'Cascadia Code', 'JetBrains Mono', Consolas, monospace;
}

.hidden {
  display: none !important;
}

a {
  color: inherit;
  text-decoration: none;
}

button, input, select, textarea {
  font-family: inherit;
}

/* =========================================================================
   1. Auth & Registration Screen (Royal Blue & Obsidian)
   ========================================================================= */
.auth-screen {
  position: relative;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 1.75rem clamp(1.1rem, 5vw, 5.2rem) 4rem;
  overflow: hidden;
  background-color: var(--bg-obsidian);
}

.auth-backdrop {
  position: fixed;
  inset: 0;
  z-index: 0;
  background-color: var(--bg-obsidian);
  background-image: url('/assets/hero-wide.jpg');
  background-size: cover;
  background-position: left center;
  background-repeat: no-repeat;
}

.auth-scrim {
  position: fixed;
  inset: 0;
  z-index: 1;
  background:
    linear-gradient(to left, rgba(5, 7, 13, 0.95) 0%, rgba(5, 7, 13, 0.8) 44%, rgba(5, 7, 13, 0.25) 78%, rgba(5, 7, 13, 0.56) 100%),
    linear-gradient(to top, rgba(5, 7, 13, 0.96) 0%, transparent 28%);
}

.auth-panel {
  position: relative;
  z-index: 2;
  width: 100%;
  max-width: 485px;
  background: var(--bg-glass);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xl);
  padding: clamp(1.35rem, 2.8vw, 2.1rem);
  backdrop-filter: blur(22px);
  -webkit-backdrop-filter: blur(22px);
  box-shadow: 0 28px 80px rgba(0, 0, 0, 0.78), 0 0 70px rgba(31, 63, 191, 0.16);
}

.brand-lockup {
  display: flex;
  align-items: center;
  gap: 0.85rem;
}

.brand-logo {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  flex-shrink: 0;
  box-shadow: 0 0 24px rgba(59, 108, 255, 0.35);
}

.brand-title {
  font-size: 1.48rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--text-main);
  margin: 0;
}

.brand-title span {
  color: var(--royal-bright);
}

.brand-sub {
  margin: 0.12rem 0 0;
  font-size: 0.84rem;
  color: var(--text-muted);
}

.auth-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.35rem;
  padding: 0.3rem;
  margin-top: 1.15rem;
  border-radius: var(--radius-md);
  background: rgba(5, 7, 13, 0.78);
  border: 1px solid var(--border-subtle);
}

.auth-tab {
  padding: 0.5rem 0.65rem;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-muted);
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.16s ease;
}

.auth-tab.active {
  background: linear-gradient(135deg, rgba(31, 63, 191, 0.48), rgba(59, 108, 255, 0.22));
  border-color: var(--border-strong);
  color: #ffffff;
}

.auth-divider {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  margin: 0.9rem 0;
  color: var(--text-dim);
  font-size: 0.74rem;
  font-weight: 700;
}

.auth-divider::before,
.auth-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: rgba(59, 108, 255, 0.18);
}

.auth-features {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.55rem;
  margin: 1rem 0 0;
}

.auth-feat {
  background: rgba(15, 24, 48, 0.5);
  border: 1px solid rgba(59, 108, 255, 0.16);
  border-radius: var(--radius-md);
  padding: 0.55rem 0.7rem;
  font-size: 0.76rem;
  color: var(--text-main);
}

.auth-feat small {
  display: block;
  font-size: 0.7rem;
  color: var(--text-muted);
  margin-top: 0.08rem;
}

.auth-status-strip {
  position: relative;
  z-index: 2;
  margin-top: 1.1rem;
  max-width: 485px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
  padding: 0.55rem 0.95rem;
  border-radius: var(--radius-md);
  background: rgba(7, 11, 22, 0.72);
  border: 1px solid rgba(59, 108, 255, 0.16);
  font-size: 0.74rem;
  color: var(--text-muted);
  backdrop-filter: blur(10px);
}

.admin-pending-box {
  margin-top: 1rem;
  padding: 0.95rem;
  border-radius: var(--radius-md);
  background: rgba(14, 24, 52, 0.9);
  border: 1px solid var(--border-strong);
  font-size: 0.81rem;
}

.uid-chip {
  margin: 0.55rem 0;
  padding: 0.5rem 0.7rem;
  border-radius: var(--radius-sm);
  background: rgba(5, 7, 13, 0.84);
  border: 1px solid var(--border-subtle);
  font-size: 0.76rem;
  word-break: break-all;
  color: #b7ceff;
}

/* =========================================================================
   2. Buttons, Inputs & Surfaces
   ========================================================================= */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  padding: 0.65rem 1.05rem;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  font-size: 0.84rem;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.14s ease, background-color 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease, opacity 0.18s ease;
  white-space: nowrap;
}

.btn:active { transform: scale(0.98); }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }

.btn-primary {
  background: linear-gradient(135deg, #274bdb 0%, #1b38ad 100%);
  border-color: rgba(91, 140, 255, 0.5);
  color: #f4f7ff;
  box-shadow: 0 8px 22px rgba(23, 52, 168, 0.4);
}

.btn-primary:hover:not(:disabled) {
  background: linear-gradient(135deg, #355cf2 0%, #2445c4 100%);
  box-shadow: 0 10px 26px rgba(59, 108, 255, 0.46);
}

.btn-google {
  background: linear-gradient(135deg, #eef4ff 0%, #dbe6ff 100%);
  border-color: rgba(255, 255, 255, 0.6);
  color: #091022;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.35);
}

.btn-google:hover:not(:disabled) {
  background: #ffffff;
}

.btn-ghost {
  background: rgba(15, 25, 52, 0.62);
  border-color: var(--border-subtle);
  color: var(--text-main);
}

.btn-ghost:hover:not(:disabled) {
  background: rgba(31, 63, 191, 0.24);
  border-color: var(--border-strong);
}

.btn-ok {
  background: var(--ok-soft);
  border-color: rgba(52, 211, 153, 0.42);
  color: var(--ok);
}

.btn-ok:hover:not(:disabled) {
  background: rgba(52, 211, 153, 0.24);
}

.btn-danger {
  background: var(--danger-soft);
  border-color: rgba(248, 113, 113, 0.35);
  color: #fecaca;
}

.btn-danger:hover:not(:disabled) {
  background: rgba(248, 113, 113, 0.24);
}

.btn-sm { padding: 0.4rem 0.72rem; font-size: 0.76rem; border-radius: var(--radius-sm); }
.btn-xs { padding: 0.28rem 0.52rem; font-size: 0.72rem; border-radius: 7px; }
.btn-block { width: 100%; }

.input, .select, .textarea {
  width: 100%;
  background: rgba(5, 8, 18, 0.88);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 0.58rem 0.8rem;
  color: var(--text-main);
  font-size: 0.84rem;
  outline: none;
  transition: border-color 0.16s ease, box-shadow 0.16s ease;
}

.textarea { resize: vertical; min-height: 76px; }

.input:focus, .select:focus, .textarea:focus {
  border-color: var(--royal-bright);
  box-shadow: 0 0 0 3px rgba(59, 108, 255, 0.18);
}

.input::placeholder, .textarea::placeholder {
  color: var(--text-dim);
}

.field-label {
  display: block;
  font-size: 0.76rem;
  font-weight: 700;
  color: var(--text-muted);
  margin-bottom: 0.3rem;
}

.glass-card {
  background: var(--bg-glass);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

/* =========================================================================
   3. Dashboard Layout & Command Strip
   ========================================================================= */
.app-shell {
  min-height: 100vh;
  display: flex;
  background:
    radial-gradient(ellipse 80% 50% at 15% -10%, rgba(31, 63, 191, 0.18), transparent 65%),
    radial-gradient(ellipse 60% 40% at 90% 100%, rgba(20, 42, 120, 0.14), transparent 70%),
    var(--bg-obsidian);
}

.sidebar {
  width: 262px;
  flex-shrink: 0;
  background: rgba(7, 11, 22, 0.94);
  border-left: 1px solid var(--border-subtle);
  padding: 1.25rem 0.95rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  position: sticky;
  top: 0;
  height: 100vh;
  z-index: 20;
}

.nav-stack {
  display: flex;
  flex-direction: column;
  gap: 0.38rem;
  margin-top: 1.4rem;
}

.nav-item {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.65rem;
  padding: 0.7rem 0.85rem;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-muted);
  font-size: 0.86rem;
  font-weight: 700;
  cursor: pointer;
  text-align: right;
  transition: background-color 0.16s ease, color 0.16s ease, border-color 0.16s ease;
}

.nav-item:hover { background: rgba(59, 108, 255, 0.08); color: var(--text-main); }
.nav-item.active {
  background: linear-gradient(135deg, rgba(31, 63, 191, 0.34), rgba(59, 108, 255, 0.14));
  border-color: var(--border-strong);
  color: #ffffff;
}

.nav-item-main { display: flex; align-items: center; gap: 0.6rem; }

.nav-count {
  font-size: 0.72rem;
  padding: 0.08rem 0.48rem;
  border-radius: 999px;
  background: rgba(59, 108, 255, 0.18);
  color: #bdd3ff;
  font-family: ui-monospace, monospace;
}

.nav-count.is-alert { background: var(--danger-soft); color: #fecaca; }

.sidebar-footer {
  border-top: 1px solid var(--border-subtle);
  padding-top: 0.9rem;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.user-pill {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.5rem 0.65rem;
  border-radius: var(--radius-md);
  background: rgba(15, 25, 52, 0.55);
  border: 1px solid rgba(59, 108, 255, 0.16);
}

.user-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--royal);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 0.85rem;
  flex-shrink: 0;
}

.main-area {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.hero-strip {
  position: relative;
  padding: 1.15rem 1.4rem;
  border-bottom: 1px solid var(--border-subtle);
  overflow: hidden;
  background: var(--bg-abyss);
}

.hero-strip::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image: url('/assets/hero-wide.jpg');
  background-size: cover;
  background-position: left 36%;
  opacity: 0.24;
}

.hero-strip::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(to left, rgba(5, 7, 13, 0.94) 15%, rgba(7, 12, 26, 0.68) 65%, rgba(5, 7, 13, 0.84) 100%);
}

.hero-strip-inner {
  position: relative;
  z-index: 1;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.9rem;
}

.cmd-actions {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  flex-wrap: wrap;
}

.global-search-wrap {
  position: relative;
  width: 275px;
}

.global-search-wrap .input {
  padding-inline-end: 4.2rem;
  background: rgba(5, 7, 13, 0.78);
}

.kbd-hint {
  position: absolute;
  left: 0.55rem;
  top: 50%;
  transform: translateY(-50%);
  padding: 0.08rem 0.35rem;
  border-radius: 5px;
  background: rgba(59, 108, 255, 0.16);
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
  font-size: 0.68rem;
  font-family: ui-monospace, monospace;
  pointer-events: none;
}

.mode-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.25rem 0.65rem;
  border-radius: 999px;
  font-size: 0.73rem;
  font-weight: 700;
  background: var(--ok-soft);
  border: 1px solid rgba(52, 211, 153, 0.35);
  color: var(--ok);
}

.mode-badge.is-demo {
  background: var(--warn-soft);
  border-color: rgba(251, 191, 36, 0.4);
  color: var(--warn);
}

.content-wrap {
  padding: 1.2rem 1.4rem 2.5rem;
  max-width: 1380px;
  width: 100%;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

/* KPI & Distribution Bar */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.85rem;
}

.kpi-card {
  padding: 0.9rem 1.05rem;
  display: flex;
  flex-direction: column;
  gap: 0.22rem;
}

.kpi-label { font-size: 0.76rem; color: var(--text-muted); font-weight: 600; }
.kpi-val { font-size: 1.42rem; font-weight: 800; color: var(--text-main); font-family: ui-monospace, monospace; }
.kpi-val.is-blue { color: #7aa3ff; }
.kpi-val.is-ok { color: var(--ok); }
.kpi-val.is-danger { color: var(--danger); }

.dist-wrap {
  padding: 0.7rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.dist-bar {
  height: 7px;
  width: 100%;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  overflow: hidden;
  display: flex;
}

.dist-seg-ok { background: var(--ok); height: 100%; transition: width 0.25s ease; }
.dist-seg-blue { background: var(--royal-bright); height: 100%; transition: width 0.25s ease; }
.dist-seg-dim { background: #64748b; height: 100%; transition: width 0.25s ease; }
.dist-seg-danger { background: var(--danger); height: 100%; transition: width 0.25s ease; }

.dist-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.9rem;
  font-size: 0.74rem;
  color: var(--text-muted);
}

.dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-left: 0.3rem;
}

.pullback-banner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.85rem 1.05rem;
  border-radius: var(--radius-lg);
  background: linear-gradient(to left, rgba(248, 113, 113, 0.16), rgba(9, 15, 31, 0.9));
  border: 1px solid rgba(248, 113, 113, 0.45);
}

/* Panels & Mode Tabs */
.panel-grid {
  display: grid;
  grid-template-columns: 330px minmax(0, 1fr);
  gap: 1rem;
  align-items: start;
}

.panel-grid-eq {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  align-items: start;
}

.panel-box {
  padding: 1.1rem;
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
}

.section-title { margin: 0; font-size: 0.98rem; font-weight: 800; color: var(--text-main); }
.section-sub { margin: 0.12rem 0 0; font-size: 0.76rem; color: var(--text-muted); }

.form-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.65rem;
}

.mode-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.3rem;
  padding: 0.25rem;
  border-radius: var(--radius-md);
  background: rgba(5, 7, 13, 0.8);
  border: 1px solid var(--border-subtle);
}

.mode-tab {
  padding: 0.42rem 0.5rem;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-muted);
  font-size: 0.77rem;
  font-weight: 700;
  cursor: pointer;
}

.mode-tab.active {
  background: rgba(31, 63, 191, 0.38);
  border-color: var(--border-strong);
  color: #ffffff;
}

/* Bulk Action Bar */
.bulk-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
  padding: 0.6rem 0.85rem;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, rgba(31, 63, 191, 0.26), rgba(9, 15, 31, 0.9));
  border: 1px solid var(--border-strong);
}

/* Filter Pills & Toolbar */
.toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.65rem;
}

.pill-group { display: flex; flex-wrap: wrap; gap: 0.38rem; }

.pill {
  padding: 0.32rem 0.7rem;
  border-radius: 999px;
  border: 1px solid var(--border-subtle);
  background: rgba(9, 15, 31, 0.78);
  color: var(--text-muted);
  font-size: 0.75rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s ease;
}

.pill:hover { color: var(--text-main); border-color: var(--border-strong); }
.pill.active { background: var(--royal); border-color: var(--royal-bright); color: #ffffff; }

/* Tables */
.table-scroll { width: 100%; overflow-x: auto; }

.im-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.81rem;
}

.im-table th {
  text-align: right;
  padding: 0.56rem 0.48rem;
  font-size: 0.74rem;
  font-weight: 700;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border-subtle);
  white-space: nowrap;
}

.im-table td {
  padding: 0.58rem 0.48rem;
  border-bottom: 1px solid rgba(59, 108, 255, 0.1);
  vertical-align: middle;
}

.im-table tr:last-child td { border-bottom: none; }
.im-table tr:hover td { background: rgba(59, 108, 255, 0.05); }

.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.28rem;
  padding: 0.2rem 0.56rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  border: 1px solid transparent;
  white-space: nowrap;
}

.badge-ok { background: var(--ok-soft); border-color: rgba(52, 211, 153, 0.34); color: var(--ok); }
.badge-blue { background: var(--royal-soft); border-color: rgba(59, 108, 255, 0.36); color: #9fc0ff; }
.badge-warn { background: var(--warn-soft); border-color: rgba(251, 191, 36, 0.36); color: var(--warn); }
.badge-danger { background: var(--danger-soft); border-color: rgba(248, 113, 113, 0.4); color: var(--danger); }
.badge-dim { background: rgba(100, 116, 139, 0.18); border-color: rgba(148, 163, 184, 0.28); color: #cbd5e1; }

/* Domain Quota & Supplier Reliability */
.quota-bar {
  width: 100%;
  height: 6px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.07);
  overflow: hidden;
  margin-top: 0.25rem;
}

.quota-fill {
  height: 100%;
  border-radius: 999px;
  background: var(--royal-bright);
  transition: width 0.25s ease;
}

.quota-fill.is-warn { background: var(--warn); }
.quota-fill.is-danger { background: var(--danger); }

.supplier-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 0.75rem;
}

.supplier-card {
  padding: 0.85rem;
  border-radius: var(--radius-md);
  background: rgba(6, 10, 22, 0.82);
  border: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.supplier-card.has-risk {
  border-color: rgba(248, 113, 113, 0.45);
}

/* Inbox & Parser Sandbox */
.msg-list { display: flex; flex-direction: column; gap: 0.75rem; }

.msg-card {
  padding: 0.95rem 1.05rem;
  border-radius: var(--radius-md);
  background: rgba(8, 13, 27, 0.88);
  border: 1px solid var(--border-subtle);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.85rem;
}

.msg-card.is-pullback {
  border-color: rgba(248, 113, 113, 0.52);
  background: linear-gradient(to left, rgba(248, 113, 113, 0.12), rgba(8, 13, 27, 0.92));
}

.otp-box {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.42rem 0.82rem;
  border-radius: var(--radius-md);
  background: rgba(31, 63, 191, 0.22);
  border: 1px solid var(--border-strong);
  cursor: pointer;
}

.otp-digits { font-size: 1.28rem; font-weight: 800; letter-spacing: 0.15em; color: #ffffff; }
.otp-digits-lg { font-size: clamp(1.9rem, 5vw, 2.5rem); font-weight: 800; letter-spacing: 0.2em; color: #ffffff; }

.sandbox-box {
  border-radius: var(--radius-md);
  background: rgba(6, 10, 22, 0.78);
  border: 1px dashed var(--border-strong);
  padding: 0.9rem;
}

.code-pre {
  margin: 0;
  padding: 0.8rem;
  border-radius: var(--radius-md);
  background: rgba(4, 6, 12, 0.92);
  border: 1px solid rgba(59, 108, 255, 0.2);
  color: #b8ceff;
  font-size: 0.76rem;
  line-height: 1.6;
  overflow-x: auto;
  white-space: pre-wrap;
  word-break: break-word;
}

/* =========================================================================
   4. Modals & Bottom-Left Non-Overlapping Toasts
   ========================================================================= */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 120;
  background: rgba(2, 4, 10, 0.84);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.modal-card {
  width: 100%;
  max-width: 580px;
  max-height: 88vh;
  overflow-y: auto;
  background: #091022;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-xl);
  padding: 1.3rem;
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.85), 0 0 40px rgba(31, 63, 191, 0.24);
}

.toast-stack {
  position: fixed;
  bottom: 1.25rem;
  left: 1.25rem;
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  width: min(92vw, 360px);
  pointer-events: none;
}

.toast-item {
  padding: 0.65rem 0.95rem;
  border-radius: var(--radius-md);
  background: rgba(8, 14, 30, 0.96);
  border: 1px solid var(--border-strong);
  color: var(--text-main);
  font-size: 0.81rem;
  font-weight: 700;
  box-shadow: 0 14px 36px rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(10px);
}

.toast-item.is-ok { border-color: rgba(52, 211, 153, 0.55); color: var(--ok); }
.toast-item.is-err { border-color: rgba(248, 113, 113, 0.55); color: var(--danger); }

.mobile-nav { display: none; }

/* =========================================================================
   5. Standalone Client Handover Page (/handover.html)
   ========================================================================= */
.handover-screen {
  position: relative;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.4rem 0.95rem;
  background-color: var(--bg-obsidian);
  overflow: hidden;
}

.handover-card {
  position: relative;
  z-index: 2;
  width: 100%;
  max-width: 570px;
  padding: clamp(1.2rem, 3vw, 1.9rem);
}

.ho-progress-track {
  width: 100%;
  height: 4px;
  border-radius: 999px;
  background: rgba(59, 108, 255, 0.14);
  overflow: hidden;
  margin-top: 0.75rem;
}

.ho-progress-fill {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--royal), var(--royal-bright));
  transition: width 1s linear;
}

.ho-guide {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.5rem;
}

.ho-guide-step {
  padding: 0.5rem 0.55rem;
  border-radius: var(--radius-sm);
  background: rgba(7, 11, 24, 0.75);
  border: 1px solid rgba(59, 108, 255, 0.16);
  font-size: 0.73rem;
  color: var(--text-muted);
  text-align: center;
}

.ho-guide-step b {
  display: block;
  color: #dbe6ff;
  margin-bottom: 0.1rem;
}

.otp-hero {
  padding: 1.3rem 1rem;
  border-radius: var(--radius-lg);
  background: linear-gradient(145deg, rgba(20, 42, 120, 0.34), rgba(6, 10, 22, 0.92));
  border: 1px solid var(--border-strong);
  text-align: center;
  box-shadow: 0 0 40px rgba(31, 63, 191, 0.18);
}

/* =========================================================================
   6. Responsive & True Mobile Cards
   ========================================================================= */
@media (max-width: 1080px) {
  .panel-grid,
  .panel-grid-eq {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 900px) {
  .auth-screen {
    justify-content: center;
    padding: 1.2rem 0.9rem 2.5rem;
  }

  .auth-backdrop {
    background-image: url('/assets/hero-tall.jpg');
    background-position: center bottom;
  }

  .auth-scrim {
    background: linear-gradient(to bottom, rgba(5, 7, 13, 0.78) 0%, rgba(5, 7, 13, 0.58) 45%, rgba(5, 7, 13, 0.94) 100%);
  }

  .sidebar { display: none; }
  .main-area { padding-bottom: 5rem; }

  .hero-strip,
  .content-wrap {
    padding-left: 0.9rem;
    padding-right: 0.9rem;
  }

  .global-search-wrap { width: 100%; }

  .kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .form-grid-2 { grid-template-columns: 1fr; }
  .ho-guide { grid-template-columns: 1fr; }

  .toast-stack {
    bottom: 5.2rem;
    left: 50%;
    transform: translateX(-50%);
    text-align: center;
  }

  .mobile-nav {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    position: fixed;
    inset-inline: 0;
    bottom: 0;
    z-index: 50;
    background: rgba(6, 10, 20, 0.96);
    border-top: 1px solid var(--border-subtle);
    backdrop-filter: blur(16px);
    padding: 0.35rem 0.4rem calc(0.42rem + env(safe-area-inset-bottom));
    gap: 0.25rem;
  }

  .mobile-nav-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.14rem;
    padding: 0.4rem 0.2rem;
    border-radius: var(--radius-sm);
    border: none;
    background: transparent;
    color: var(--text-muted);
    font-size: 0.7rem;
    font-weight: 700;
    cursor: pointer;
  }

  .mobile-nav-btn.active {
    background: rgba(59, 108, 255, 0.22);
    color: #ffffff;
  }
}

@media (max-width: 720px) {
  .im-table.mobile-cards thead { display: none; }
  .im-table.mobile-cards,
  .im-table.mobile-cards tbody { display: block; width: 100%; }
  .im-table.mobile-cards tr {
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
    padding: 0.85rem;
    margin-bottom: 0.65rem;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-subtle);
    background: rgba(6, 10, 22, 0.78);
  }
  .im-table.mobile-cards td {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.6rem;
    padding: 0.25rem 0;
    border-bottom: 1px dashed rgba(59, 108, 255, 0.12);
    width: 100%;
  }
  .im-table.mobile-cards td:last-child { border-bottom: none; padding-top: 0.45rem; }
  .im-table.mobile-cards td[data-label]::before {
    content: attr(data-label);
    font-size: 0.73rem;
    font-weight: 700;
    color: var(--text-muted);
    flex-shrink: 0;
  }
}
