/* ============================================================
   IA Secure Message Portal — Global Stylesheet
   Version: 2.0.0
   Brand: Argos dark glassmorphic — blue #0070f3, purple #7c3aed, cyan #00d4ff
   Fonts: Manrope (body), Fraunces (headings)
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Manrope:wght@400;500;600;700;800&family=Fraunces:wght@600;700&display=swap');

/* ─── CSS Variables ─────────────────────────────────────────── */
:root {
  /* Core accents */
  --blue:          #0070f3;
  --blue-mid:      #0090f0;
  --blue-lite:     #3db8ff;
  --purple:        #7c3aed;
  --cyan:          #00d4ff;

  /* Legacy alias — keep for any residual references */
  --teal:          #0070f3;
  --teal-dark:     #0050c8;
  --teal-light:    #3db8ff;
  --teal-faint:    rgba(0,112,243,0.12);
  --lime:          #00d4ff;
  --lime-dark:     #0090f0;
  --lime-light:    #3db8ff;
  --lime-faint:    rgba(0,212,255,0.1);
  --charcoal:      rgba(9,20,42,0.95);
  --charcoal-mid:  rgba(12,26,52,0.85);
  --charcoal-light:rgba(255,255,255,0.08);

  /* Backgrounds */
  --bg-body:       #030912;
  --bg-surface:    rgba(9,20,42,0.72);
  --bg-surface-hi: rgba(12,26,52,0.85);
  --bg-glass:      rgba(255,255,255,0.04);
  --bg-light:      #030912;
  --bg-card:       rgba(9,20,42,0.72);
  --bg-sidebar:    rgba(3,9,18,0.95);

  /* Text */
  --text-primary:  #cce0ff;
  --text-hi:       #ffffff;
  --text-muted:    #5f7fa0;
  --text-muted-hi: #8aaccc;
  --text-secondary:#8aaccc;
  --text-on-dark:  #cce0ff;

  /* Borders */
  --border:        rgba(255,255,255,0.08);
  --border-hi:     rgba(255,255,255,0.13);
  --border-glow:   rgba(0,112,243,0.4);
  --border-focus:  #0070f3;

  /* Status */
  --danger:        #f87171;
  --danger-dark:   #dc2626;
  --danger-faint:  rgba(248,113,113,0.12);
  --success:       #34d399;
  --success-faint: rgba(52,211,153,0.12);
  --warning:       #fbbf24;
  --warning-faint: rgba(251,191,36,0.12);
  --info:          #3db8ff;
  --info-faint:    rgba(61,184,255,0.12);

  /* Gradients */
  --grad-blue:     linear-gradient(135deg, #0050c8, #0090ff);
  --grad-mixed:    linear-gradient(135deg, #0050c8, #7c3aed);

  /* Shadows */
  --shadow-sm:     0 1px 3px rgba(0,0,0,.4);
  --shadow-md:     0 4px 16px rgba(0,0,0,.5);
  --shadow-lg:     0 8px 32px rgba(0,0,0,.6);

  /* Radii */
  --radius-sm:     8px;
  --radius-md:     14px;
  --radius-lg:     20px;
  --radius-pill:   999px;

  /* Layout */
  --sidebar-w:     240px;
  --topbar-h:      60px;
  --transition:    0.18s ease;
}

/* ─── Reset & Base ──────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 16px; scroll-behavior: smooth; }

body {
  font-family: 'Manrope', system-ui, sans-serif;
  font-size: 0.95rem;
  line-height: 1.6;
  color: var(--text-primary);
  background: var(--bg-body);
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, h5, h6 {
  font-family: 'Fraunces', Georgia, serif;
  font-weight: 700;
  line-height: 1.25;
  color: var(--text-hi);
}

a { color: var(--blue-lite); text-decoration: none; }
a:hover { color: var(--cyan); text-decoration: underline; }

img { max-width: 100%; display: block; }
ul { list-style: none; }

/* ─── Utility ───────────────────────────────────────────────── */
.sr-only {
  position: absolute; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0,0,0,0); border: 0;
}

.hidden { display: none !important; }
.mt-0 { margin-top: 0 !important; }
.mt-1 { margin-top: 0.5rem !important; }
.mt-2 { margin-top: 1rem !important; }
.mt-3 { margin-top: 1.5rem !important; }
.mb-1 { margin-bottom: 0.5rem !important; }
.mb-2 { margin-bottom: 1rem !important; }
.mb-3 { margin-bottom: 1.5rem !important; }
.text-center { text-align: center; }
.text-muted { color: var(--text-muted); font-size: 0.85rem; }
.fw-bold { font-weight: 700; }
.gap-1 { gap: 0.5rem; }
.gap-2 { gap: 1rem; }
.flex { display: flex; }
.flex-col { flex-direction: column; }
.align-center { align-items: center; }
.justify-between { justify-content: space-between; }
.w-full { width: 100%; }

/* ─── Logo Image classes ─────────────────────────────────────── */
.logo-img {
  height: 140px;
  object-fit: contain;
  border-radius: 14px;
  padding: 4px;
}

.footer-logo-img {
  height: 80px;
  object-fit: contain;
  opacity: 0.9;
}

/* ─── Logo Mark ─────────────────────────────────────────────── */
.logo-mark {
  display: inline-flex;
  align-items: center;
  gap: 0.625rem;
}

.logo-circle {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: var(--grad-blue);
  display: flex; align-items: center; justify-content: center;
  font-family: 'Fraunces', serif;
  font-size: 1rem; font-weight: 700;
  color: #fff;
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(0,112,243,.4);
}

.logo-circle.lg {
  width: 52px; height: 52px;
  font-size: 1.4rem;
}

.logo-text {
  font-family: 'Fraunces', serif;
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--text-hi);
  letter-spacing: 0.01em;
}

.logo-text span {
  display: block;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--blue-lite);
  margin-top: -2px;
  font-family: 'Manrope', sans-serif;
}

/* ─── Lock / Shield Icons (CSS-only) ────────────────────────── */
.icon-lock {
  display: inline-block;
  position: relative;
  width: 18px; height: 20px;
}
.icon-lock::before {
  content: '';
  position: absolute; bottom: 0; left: 0;
  width: 18px; height: 13px;
  background: currentColor;
  border-radius: 2px;
}
.icon-lock::after {
  content: '';
  position: absolute; top: 0; left: 4px;
  width: 10px; height: 10px;
  border: 2.5px solid currentColor;
  border-radius: 50% 50% 0 0;
  border-bottom: none;
}

.shield-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.shield-icon svg {
  width: 20px; height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* ─── Staff App Layout ──────────────────────────────────────── */
.app-shell {
  display: flex;
  min-height: 100vh;
}

/* Sidebar */
.sidebar {
  width: var(--sidebar-w);
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 100;
  transition: transform var(--transition);
  overflow-y: auto;
}

.sidebar-header {
  padding: 1.25rem 1rem;
  border-bottom: 1px solid var(--border);
}

.sidebar-nav {
  flex: 1;
  padding: 1rem 0;
}

.nav-section-label {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-muted);
  padding: 0.75rem 1.25rem 0.25rem;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.625rem 1.25rem;
  color: rgba(204,224,255,0.6);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: background var(--transition), color var(--transition);
  border-radius: 0;
  user-select: none;
  border-left: 3px solid transparent;
}

.nav-item:hover {
  background: rgba(255,255,255,.06);
  color: var(--text-hi);
  text-decoration: none;
}

.nav-item.active {
  background: rgba(0,112,243,0.15);
  color: var(--blue-lite);
  border-left-color: var(--blue-lite);
}

.nav-item svg {
  width: 18px; height: 18px;
  flex-shrink: 0;
  opacity: 0.8;
}

.nav-item.active svg { opacity: 1; }

.sidebar-footer {
  padding: 1rem 1.25rem;
  border-top: 1px solid var(--border);
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* Main content area */
.main-content {
  margin-left: var(--sidebar-w);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.topbar {
  height: var(--topbar-h);
  background: rgba(6,14,28,0.9);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.5rem;
  position: sticky;
  top: 0; z-index: 50;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: var(--shadow-sm);
}

.topbar-title {
  font-family: 'Fraunces', serif;
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-hi);
}

.topbar-user {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--text-muted-hi);
  font-size: 0.875rem;
}

.topbar-user .avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: var(--grad-blue);
  display: flex; align-items: center; justify-content: center;
  color: #fff;
  font-size: 0.8rem;
  font-weight: 700;
}

.page-content {
  flex: 1;
  padding: 2rem 2rem;
  max-width: 1100px;
  width: 100%;
}

/* ─── Cards ─────────────────────────────────────────────────── */
.card {
  background: var(--bg-surface);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-md);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  overflow: hidden;
}

.card-header {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.card-title {
  font-family: 'Fraunces', serif;
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-hi);
}

.card-body { padding: 1.25rem; }

.card-dark {
  background: var(--bg-surface-hi);
  border-color: var(--border-hi);
  color: var(--text-primary);
}

.card-dark .card-header {
  border-bottom-color: var(--border-hi);
}
.card-dark .card-title { color: var(--text-hi); }

/* ─── Buttons ───────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.5rem 1.1rem;
  font-family: 'Manrope', sans-serif;
  font-size: 0.875rem;
  font-weight: 700;
  border: none;
  border-radius: var(--radius-pill);
  cursor: pointer;
  transition: background var(--transition), box-shadow var(--transition), transform var(--transition);
  white-space: nowrap;
  text-decoration: none;
}

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

.btn-primary {
  background: var(--grad-blue);
  color: #fff;
  box-shadow: 0 8px 32px rgba(0,112,243,0.35);
}
.btn-primary:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 12px 40px rgba(0,112,243,0.5);
  color: #fff;
  text-decoration: none;
}

.btn-secondary {
  background: rgba(255,255,255,0.08);
  color: var(--text-primary);
  border: 1px solid var(--border-hi);
}
.btn-secondary:hover:not(:disabled) {
  background: rgba(255,255,255,0.13);
  color: var(--text-hi);
  text-decoration: none;
  transform: translateY(-1px);
}

.btn-danger {
  background: var(--danger-dark);
  color: #fff;
  box-shadow: 0 4px 16px rgba(220,38,38,0.3);
}
.btn-danger:hover:not(:disabled) {
  background: #b91c1c;
  color: #fff;
  text-decoration: none;
  transform: translateY(-1px);
}

.btn-outline {
  background: transparent;
  border: 2px solid var(--blue);
  color: var(--blue-lite);
}
.btn-outline:hover:not(:disabled) {
  background: rgba(0,112,243,0.12);
  text-decoration: none;
  transform: translateY(-1px);
}

.btn-ghost {
  background: transparent;
  color: var(--text-muted-hi);
}
.btn-ghost:hover:not(:disabled) {
  background: rgba(255,255,255,0.06);
  color: var(--text-hi);
  text-decoration: none;
}

.btn-sm {
  padding: 0.3rem 0.75rem;
  font-size: 0.8rem;
}

.btn-lg {
  padding: 0.75rem 1.75rem;
  font-size: 1rem;
}

.btn-block { width: 100%; }

/* Social/OIDC buttons */
.btn-microsoft {
  background: rgba(255,255,255,0.06);
  color: var(--text-primary);
  border: 1.5px solid var(--border-hi);
  gap: 0.625rem;
}
.btn-microsoft:hover:not(:disabled) {
  background: rgba(255,255,255,0.1);
  color: var(--text-hi);
  text-decoration: none;
}

.btn-google {
  background: rgba(255,255,255,0.06);
  color: var(--text-primary);
  border: 1.5px solid var(--border-hi);
  gap: 0.625rem;
}
.btn-google:hover:not(:disabled) {
  background: rgba(255,255,255,0.1);
  color: var(--text-hi);
  text-decoration: none;
}

/* ─── Forms ─────────────────────────────────────────────────── */
.form-group {
  margin-bottom: 1.125rem;
}

.form-label {
  display: block;
  font-weight: 700;
  font-size: 0.82rem;
  color: var(--text-muted-hi);
  margin-bottom: 0.35rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.form-input,
.form-select,
.form-textarea {
  width: 100%;
  padding: 0.625rem 0.875rem;
  font-family: 'Manrope', sans-serif;
  font-size: 0.925rem;
  color: #ffffff;
  background: rgba(255,255,255,0.06);
  border: 1.5px solid rgba(255,255,255,0.12);
  border-radius: var(--radius-sm);
  transition: border-color var(--transition), box-shadow var(--transition), background var(--transition);
  outline: none;
  appearance: none;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  border-color: var(--blue);
  background: rgba(255,255,255,0.09);
  box-shadow: 0 0 0 3px rgba(0,112,243,.2);
}

.form-input::placeholder,
.form-textarea::placeholder { color: rgba(255,255,255,0.25); }

.form-textarea {
  resize: vertical;
  min-height: 140px;
  line-height: 1.6;
}

.form-select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%238aaccc' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.75rem center;
  padding-right: 2.25rem;
}

.form-hint {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 0.3rem;
}

.form-error {
  font-size: 0.8rem;
  color: var(--danger);
  margin-top: 0.3rem;
  font-weight: 600;
}

/* OTP Input — large 6-digit code */
.otp-input {
  width: 100%;
  padding: 1rem;
  font-family: 'Manrope', monospace;
  font-size: 2.25rem;
  font-weight: 700;
  letter-spacing: 0.35em;
  text-align: center;
  color: #ffffff;
  background: rgba(255,255,255,0.06);
  border: 2px solid rgba(255,255,255,0.12);
  border-radius: var(--radius-md);
  transition: border-color var(--transition), box-shadow var(--transition);
  outline: none;
}

.otp-input:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 4px rgba(0,112,243,.2);
  background: rgba(255,255,255,0.09);
}

.otp-input::placeholder {
  color: rgba(255,255,255,0.2);
  letter-spacing: 0.35em;
}

/* ─── Status Badges ─────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.2rem 0.6rem;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  border-radius: 99px;
  white-space: nowrap;
}

.badge::before {
  content: '';
  width: 6px; height: 6px;
  border-radius: 50%;
  background: currentColor;
  flex-shrink: 0;
}

.badge-draft    { background: rgba(95,127,160,0.18);  color: #8aaccc; border: 1px solid rgba(138,172,204,0.2); }
.badge-sent     { background: rgba(0,112,243,0.15);   color: #3db8ff; border: 1px solid rgba(0,112,243,0.35); }
.badge-opened   { background: rgba(0,212,255,0.12);   color: #00d4ff; border: 1px solid rgba(0,212,255,0.3); }
.badge-replied  { background: rgba(124,58,237,0.15);  color: #a78bfa; border: 1px solid rgba(124,58,237,0.35); }
.badge-recalled { background: rgba(248,113,113,0.12); color: #f87171; border: 1px solid rgba(248,113,113,0.3); }
.badge-expired  { background: rgba(95,127,160,0.12);  color: #5f7fa0; border: 1px solid rgba(95,127,160,0.2); }

/* ─── Key/Value rows (profile, customer detail, status) ─────── */
.kv {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.6rem 0;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  font-size: 0.9rem;
}
.kv:last-child { border-bottom: 0; }
.kv > span { color: var(--text-muted); }
.kv > strong { color: var(--text-primary); text-align: right; word-break: break-word; }

/* ─── Attachments ───────────────────────────────────────────── */
.attach-list {
  margin-top: 0.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}
.attach-row {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.45rem 0.6rem;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: var(--radius-sm, 8px);
  font-size: 0.82rem;
  flex-wrap: wrap;
}
.attach-name {
  font-weight: 600;
  color: var(--text-primary);
  max-width: 260px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.attach-size { color: var(--text-muted); font-size: 0.76rem; }
.attach-row .badge { margin-left: auto; }
.attach-row .btn { padding: 0.25rem 0.6rem; }

/* ─── Notifications / Banners ───────────────────────────────── */
.alert {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.875rem 1rem;
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  font-weight: 600;
  margin-bottom: 1rem;
  line-height: 1.5;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.alert-success { background: var(--success-faint);  color: #34d399; border: 1px solid rgba(52,211,153,0.3); }
.alert-error   { background: var(--danger-faint);   color: #f87171; border: 1px solid rgba(248,113,113,0.3); }
.alert-warning { background: var(--warning-faint);  color: #fbbf24; border: 1px solid rgba(251,191,36,0.3); }
.alert-info    { background: var(--info-faint);     color: #3db8ff; border: 1px solid rgba(61,184,255,0.3); }

.alert-icon { font-size: 1.1rem; flex-shrink: 0; margin-top: 1px; }

/* ─── Thread List ────────────────────────────────────────────── */
.thread-table {
  width: 100%;
  border-collapse: collapse;
}

.thread-table th {
  text-align: left;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
  padding: 0.625rem 1rem;
  border-bottom: 2px solid var(--border-hi);
  white-space: nowrap;
}

.thread-table td {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
  font-size: 0.875rem;
  color: var(--text-primary);
}

.thread-table tr:last-child td { border-bottom: none; }

.thread-table tbody tr {
  transition: background var(--transition);
}

.thread-table tbody tr:hover { background: rgba(9,20,42,0.5); }

.thread-recipient {
  font-weight: 600;
  color: var(--text-hi);
}

.thread-subject {
  color: var(--text-muted-hi);
  max-width: 260px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.thread-date { color: var(--text-muted); font-size: 0.82rem; white-space: nowrap; }

.thread-actions {
  display: flex;
  gap: 0.5rem;
  justify-content: flex-end;
}

/* ─── Message Bubbles ───────────────────────────────────────── */
.message-thread {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  padding: 1.25rem;
}

.message-bubble-wrap {
  display: flex;
  flex-direction: column;
  max-width: 75%;
}

.message-bubble-wrap.staff {
  align-self: flex-end;
  align-items: flex-end;
}

.message-bubble-wrap.recipient {
  align-self: flex-start;
  align-items: flex-start;
}

.bubble-meta {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-bottom: 0.3rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.bubble-sender { font-weight: 700; }

.message-bubble {
  padding: 0.875rem 1.1rem;
  border-radius: var(--radius-md);
  font-size: 0.9rem;
  line-height: 1.65;
  white-space: pre-wrap;
  word-break: break-word;
}

.message-bubble.staff {
  background: linear-gradient(135deg, #0050c8, #0090ff);
  color: #fff;
  border-bottom-right-radius: 4px;
  box-shadow: 0 4px 16px rgba(0,112,243,0.3);
}

.message-bubble.recipient {
  background: rgba(255,255,255,0.08);
  color: var(--text-primary);
  border: 1px solid var(--border-hi);
  border-bottom-left-radius: 4px;
}

/* ─── Audit Timeline ────────────────────────────────────────── */
.audit-timeline {
  position: relative;
  padding-left: 1.5rem;
}

.audit-timeline::before {
  content: '';
  position: absolute;
  left: 0.5rem; top: 0; bottom: 0;
  width: 2px;
  background: var(--border-hi);
}

.audit-item {
  position: relative;
  padding: 0.5rem 0 0.5rem 1rem;
  font-size: 0.82rem;
  color: var(--text-muted-hi);
}

.audit-item::before {
  content: '';
  position: absolute;
  left: -1.125rem;
  top: 50%;
  transform: translateY(-50%);
  width: 10px; height: 10px;
  border-radius: 50%;
  background: var(--border-hi);
  border: 2px solid var(--bg-body);
}

.audit-item.event-sent::before     { background: var(--blue); }
.audit-item.event-opened::before   { background: var(--cyan); }
.audit-item.event-replied::before  { background: var(--purple); }
.audit-item.event-recalled::before { background: var(--danger); }
.audit-item.event-verified::before { background: var(--success); }

.audit-time {
  font-weight: 700;
  color: var(--text-muted);
  margin-right: 0.5rem;
}

.audit-label { color: var(--text-primary); }

/* ─── Read Receipt ──────────────────────────────────────────── */
.read-receipt {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  font-size: 0.78rem;
  color: var(--blue-lite);
  font-weight: 700;
  padding: 0.25rem 0.625rem;
  background: rgba(0,112,243,0.12);
  border-radius: 99px;
  border: 1px solid rgba(0,112,243,0.25);
}

.read-receipt.unread { color: var(--text-muted); background: rgba(255,255,255,0.05); border-color: var(--border); }

/* ─── Reply Box ─────────────────────────────────────────────── */
.reply-box {
  border-top: 1px solid var(--border);
  padding: 1.25rem;
  background: rgba(9,20,42,0.5);
}

.reply-box .form-textarea { min-height: 90px; }

.reply-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 0.75rem;
  gap: 0.5rem;
}

/* ─── Security Notice Banner ────────────────────────────────── */
.security-notice {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.875rem 1rem;
  background: rgba(0,112,243,0.08);
  border: 1px solid rgba(0,112,243,0.25);
  border-radius: var(--radius-sm);
  font-size: 0.82rem;
  color: var(--blue-lite);
  line-height: 1.5;
  margin-top: 1rem;
}

.security-notice-icon {
  flex-shrink: 0;
  margin-top: 1px;
}

/* ─── Modal ─────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 900;
  padding: 1rem;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

.modal {
  background: rgba(12,26,52,0.95);
  border: 1px solid var(--border-hi);
  border-radius: var(--radius-lg);
  box-shadow: 0 24px 80px rgba(0,0,0,.7), 0 0 0 1px rgba(0,112,243,0.15);
  max-width: 440px;
  width: 100%;
  padding: 1.75rem;
  animation: modalIn .15s ease;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
}

@keyframes modalIn {
  from { opacity: 0; transform: scale(.95) translateY(-8px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}

.modal-title {
  font-family: 'Fraunces', serif;
  font-size: 1.25rem;
  font-weight: 700;
  margin-bottom: 0.875rem;
  color: var(--text-hi);
}

.modal-body {
  color: var(--text-muted-hi);
  font-size: 0.9rem;
  margin-bottom: 1.5rem;
  line-height: 1.6;
}

.modal-actions {
  display: flex;
  gap: 0.625rem;
  justify-content: flex-end;
}

/* ─── Loading Spinner ───────────────────────────────────────── */
.spinner {
  display: inline-block;
  width: 20px; height: 20px;
  border: 2.5px solid rgba(255,255,255,0.1);
  border-top-color: var(--blue);
  border-radius: 50%;
  animation: spin .75s linear infinite;
}

.spinner.sm { width: 14px; height: 14px; border-width: 2px; }
.spinner.lg { width: 32px; height: 32px; border-width: 3px; }
.spinner.white { border-color: rgba(255,255,255,.15); border-top-color: #fff; }

@keyframes spin { to { transform: rotate(360deg); } }

.loading-center {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 3rem;
}

/* ─── Empty State ───────────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 3rem 2rem;
  color: var(--text-muted);
}

.empty-state-icon {
  font-size: 2.5rem;
  margin-bottom: 1rem;
  opacity: 0.4;
}

.empty-state p { font-size: 0.9rem; }

/* ─── Login Screen ──────────────────────────────────────────── */
.login-screen {
  min-height: 100vh;
  background: #030912;
  background-image:
    radial-gradient(ellipse at 20% 50%, rgba(0,112,243,0.14) 0%, transparent 55%),
    radial-gradient(ellipse at 80% 50%, rgba(124,58,237,0.1) 0%, transparent 55%);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}

.login-card {
  background: rgba(9,20,42,0.82);
  border: 1px solid var(--border-hi);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg), 0 0 0 1px rgba(0,112,243,0.08);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  padding: 2.25rem;
  width: 100%;
  max-width: 420px;
}

.login-header {
  text-align: center;
  margin-bottom: 2rem;
}

.login-subtitle {
  color: var(--text-muted);
  font-size: 0.85rem;
  margin-top: 0.75rem;
}

.login-card .form-label { color: var(--text-muted-hi); }

.login-card .form-input {
  background: rgba(255,255,255,.06);
  border-color: rgba(255,255,255,.12);
  color: #fff;
}

.login-card .form-input:focus {
  border-color: var(--blue);
  background: rgba(255,255,255,.09);
}

.login-card .form-input::placeholder { color: rgba(255,255,255,.25); }

/* ─── Divider ───────────────────────────────────────────────── */
.divider {
  display: flex;
  align-items: center;
  gap: 0.875rem;
  margin: 1.25rem 0;
  color: var(--text-muted);
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.divider::before, .divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border-hi);
}

/* ─── ════════════════════════════════════════════════════════ ─ */
/*    RECIPIENT PORTAL — isolated styles                          */
/* ════════════════════════════════════════════════════════════   */

.portal-body {
  min-height: 100vh;
  background: #030912;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  padding: 2rem 1rem 4rem;
  position: relative;
  overflow: hidden;
}

/* Ambient background orbs */
.portal-body::before {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(ellipse at 20% 30%, rgba(0,112,243,0.13) 0%, transparent 55%),
    radial-gradient(ellipse at 80% 70%, rgba(124,58,237,0.1) 0%, transparent 55%);
  z-index: 0;
}

.portal-body > * {
  position: relative;
  z-index: 1;
}

.portal-header {
  text-align: center;
  margin-bottom: 2rem;
}

/* Logo image in portal header */
.portal-logo-img {
  height: 130px;
  object-fit: contain;
  border-radius: 14px;
  margin: 0 auto 0.75rem;
  display: block;
}

.portal-logo-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  margin-bottom: 0.5rem;
}

.portal-logo-circle {
  width: 44px; height: 44px;
  border-radius: 50%;
  background: var(--grad-mixed);
  display: flex; align-items: center; justify-content: center;
  font-family: 'Fraunces', serif;
  font-size: 1.1rem; font-weight: 700;
  color: #fff;
  box-shadow: 0 4px 20px rgba(0,112,243,.4);
}

.portal-logo-text {
  text-align: left;
  line-height: 1.15;
}

.portal-logo-text strong {
  display: block;
  font-family: 'Fraunces', serif;
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-hi);
}

.portal-logo-text small {
  font-size: 0.72rem;
  color: var(--blue-lite);
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.portal-tagline {
  font-size: 0.82rem;
  color: var(--text-muted);
}

.portal-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg), 0 0 0 1px rgba(0,112,243,0.06);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  width: 100%;
  max-width: 580px;
  overflow: hidden;
}

.portal-card-header {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.portal-card-header .shield-badge {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: rgba(0,112,243,0.15);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  border: 1px solid rgba(0,112,243,0.3);
}

.portal-card-header h2 {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-hi);
}

.portal-card-header p {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: 1px;
}

.portal-card-body { padding: 1.5rem; }

/* Auth screen within portal */
.auth-section-title {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text-muted-hi);
  margin-bottom: 0.875rem;
}

.oidc-buttons {
  display: flex;
  flex-direction: column;
  gap: 0.625rem;
  margin-bottom: 0.5rem;
}

.oidc-logo {
  width: 20px; height: 20px;
  object-fit: contain;
}

/* OTP section */
.otp-section { margin-top: 0.5rem; }

.otp-sent-notice {
  font-size: 0.85rem;
  color: var(--text-muted-hi);
  margin-bottom: 1rem;
  line-height: 1.55;
}

.otp-sent-notice strong { color: var(--blue-lite); }

.resend-timer {
  text-align: center;
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-top: 0.75rem;
}

.resend-link {
  color: var(--blue-lite);
  font-weight: 700;
  cursor: pointer;
}

.resend-link:hover { text-decoration: underline; }

/* Portal message view */
.portal-thread-subject {
  font-family: 'Fraunces', serif;
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-hi);
  margin-bottom: 0.25rem;
}

.portal-thread-meta {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
}

.portal-messages { padding: 1rem 1.25rem; }

/* Portal footer */
.portal-footer {
  text-align: center;
  margin-top: 1.5rem;
  font-size: 0.75rem;
  color: var(--text-muted);
  line-height: 1.65;
}

.portal-footer a { color: var(--blue-lite); }
.portal-footer a:hover { color: var(--cyan); }

/* Portal footer logo */
.portal-footer-logo {
  height: 72px;
  object-fit: contain;
  opacity: 0.85;
  margin: 0 auto 0.5rem;
  display: block;
}

.portal-encrypted-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.25rem 0.75rem;
  background: rgba(0,112,243,0.15);
  border: 1px solid rgba(0,112,243,0.4);
  border-radius: 99px;
  font-size: 0.72rem;
  color: #3db8ff;
  font-weight: 700;
  margin-bottom: 0.5rem;
  letter-spacing: 0.04em;
}

/* Status screens (recalled / expired) */
.portal-status-card {
  text-align: center;
  padding: 3rem 2rem;
}

.portal-status-icon {
  font-size: 3rem;
  margin-bottom: 1rem;
}

.portal-status-title {
  font-family: 'Fraunces', serif;
  font-size: 1.4rem;
  font-weight: 700;
  margin-bottom: 0.625rem;
  color: var(--text-hi);
}

.portal-status-desc {
  color: var(--text-muted-hi);
  font-size: 0.9rem;
  max-width: 320px;
  margin: 0 auto;
  line-height: 1.6;
}

/* ─── Thread Detail — subject header ────────────────────────── */
.thread-detail-header {
  padding: 1.25rem;
  border-bottom: 1px solid var(--border);
}

.thread-detail-subject {
  font-family: 'Fraunces', serif;
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--text-hi);
  margin-bottom: 0.375rem;
}

.thread-detail-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.75rem;
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* ─── Info grid ─────────────────────────────────────────────── */
.info-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}

.info-item {
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.75rem 1rem;
}

.info-item-label {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 0.25rem;
}

.info-item-value {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-hi);
}

/* ─── Mobile Hamburger ──────────────────────────────────────── */
.hamburger {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.375rem;
  color: var(--text-primary);
}

.sidebar-overlay {
  display: none;
  position: fixed; inset: 0;
  background: rgba(0,0,0,.65);
  z-index: 99;
}

/* ─── Responsive ────────────────────────────────────────────── */
@media (max-width: 768px) {
  :root { --sidebar-w: 260px; }

  .sidebar {
    transform: translateX(-100%);
  }

  .sidebar.open {
    transform: translateX(0);
    box-shadow: var(--shadow-lg);
  }

  .sidebar-overlay.open { display: block; }

  .main-content { margin-left: 0; }

  .hamburger { display: flex; }

  .page-content { padding: 1.25rem 1rem; }

  .info-grid { grid-template-columns: 1fr; }

  .thread-table th:nth-child(3),
  .thread-table td:nth-child(3),
  .thread-table th:nth-child(4),
  .thread-table td:nth-child(4) { display: none; }

  .message-bubble-wrap { max-width: 88%; }

  .portal-body { padding: 1rem 0.75rem 3rem; }

  .modal { padding: 1.25rem; }
  .modal-actions { flex-direction: column-reverse; }
  .modal-actions .btn { width: 100%; }
}

@media (max-width: 480px) {
  .login-card { padding: 1.5rem 1.25rem; }
  .otp-input { font-size: 1.75rem; letter-spacing: 0.25em; }
  .portal-card-body { padding: 1rem; }
  .portal-logo-img { height: 100px; }
  .portal-footer-logo { height: 56px; }
}
