/* ================= HOVERDEAL EMBLEM SPINNER ================= */
.emblem-spinner {
  width: 44px;
  height: 44px;
  object-fit: contain;
  animation: emblemSpin 1.4s cubic-bezier(0.4, 0, 0.2, 1) infinite;
  filter: drop-shadow(0 0 12px rgba(212, 175, 55, 0.45));
  display: inline-block;
  user-select: none;
  -webkit-user-select: none;
  transform-origin: center center;
}

.emblem-spinner.sm {
  width: 22px;
  height: 22px;
  filter: drop-shadow(0 0 6px rgba(212, 175, 55, 0.35));
}

.emblem-spinner.md {
  width: 36px;
  height: 36px;
  filter: drop-shadow(0 0 10px rgba(212, 175, 55, 0.45));
}

.emblem-spinner.lg {
  width: 64px;
  height: 64px;
  filter: drop-shadow(0 0 18px rgba(212, 175, 55, 0.6));
}

@keyframes emblemSpin {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

.loading-state-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 80px 20px;
  gap: 16px;
  color: var(--gold-light);
  text-align: center;
}

.loading-state-text {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--gold-light);
  letter-spacing: 0.3px;
}

/* App Splash / Auth Verification Screen */
.app-splash-screen {
  position: fixed;
  inset: 0;
  background: var(--bg-primary);
  z-index: 999;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  transition: opacity 0.35s cubic-bezier(0.16, 1, 0.3, 1), visibility 0.35s;
}

.app-splash-screen.fade-out {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.splash-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 20px;
}

.emblem-spinner-wrapper {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

.emblem-spinner-wrapper::before {
  content: '';
  position: absolute;
  width: 90px;
  height: 90px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(212, 175, 55, 0.25) 0%, transparent 70%);
  animation: pulseGlow 2s ease-in-out infinite alternate;
}

@keyframes pulseGlow {
  0% {
    transform: scale(0.85);
    opacity: 0.5;
  }
  100% {
    transform: scale(1.35);
    opacity: 1;
  }
}

.splash-text {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: 2px;
  text-transform: uppercase;
}

/* Status Tab Emblem in Navigation Bar */
.tab-status-emblem {
  width: 22px;
  height: 22px;
  object-fit: contain;
  transition: transform 0.2s ease, filter 0.2s ease;
  filter: drop-shadow(0 0 3px rgba(212, 175, 55, 0.35));
}

.tab-item[data-tab="status"]:hover .tab-status-emblem,
.tab-item[data-tab="status"]:active .tab-status-emblem {
  transform: scale(1.15);
  filter: drop-shadow(0 0 8px rgba(212, 175, 55, 0.8));
}

/* ================= LOGIN SCREEN ================= */
.login-screen {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  width: 100%;
  height: 100%;
  background: var(--bg-primary);
  z-index: 200;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: calc(24px + env(safe-area-inset-top, 0px)) 24px calc(24px + env(safe-area-inset-bottom, 0px));
  overflow-y: auto;
  box-sizing: border-box;
}

.login-card {
  width: 100%;
  max-width: 360px;
  background: var(--bg-surface);
  border: 1px solid var(--gold-border);
  border-radius: var(--radius-lg);
  padding: 32px 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.6), var(--gold-glow);
}

.login-logo {
  height: 52px;
  margin-bottom: 20px;
  object-fit: contain;
}

.login-title {
  font-size: 20px;
  font-weight: 800;
  color: var(--text-primary);
  margin-bottom: 4px;
  text-align: center;
}

.login-subtitle {
  font-size: 13px;
  color: var(--gold-light);
  margin-bottom: 24px;
  text-align: center;
}

.login-form {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
}

.form-input {
  width: 100%;
  background: var(--bg-secondary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  color: var(--text-primary);
  font-size: 14px;
  outline: none;
  transition: border-color 0.2s;
}

.form-input:focus {
  border-color: var(--gold-primary);
  box-shadow: 0 0 0 1px var(--gold-primary);
}

/* ================= QUICK FILTER BAR ================= */
.filter-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  background: var(--bg-primary);
  border-bottom: 1px solid var(--border-subtle);
  overflow-x: auto;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}

.filter-bar::-webkit-scrollbar {
  display: none;
}

.filter-chip {
  padding: 6px 14px;
  border-radius: var(--radius-full);
  background: var(--bg-surface);
  border: 1px solid var(--border-card);
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s ease;
}

.filter-chip:active {
  transform: scale(0.96);
}

.filter-chip.active {
  background: rgba(212, 175, 55, 0.15);
  border-color: var(--gold-primary);
  color: var(--gold-light);
}

.filter-badge {
  background: var(--gold-primary);
  color: #000000;
  font-size: 10px;
  font-weight: 800;
  padding: 1px 6px;
  border-radius: var(--radius-full);
  min-width: 16px;
  text-align: center;
  line-height: 1.3;
}

/* ================= MESSAGE LIST & ITEMS ================= */
.message-list {
  display: flex;
  flex-direction: column;
}

@keyframes itemEntrance {
  0% {
    opacity: 0;
    transform: translateY(6px);
  }
  100% {
    opacity: 1;
    transform: translateY(0);
  }
}

.message-item-wrapper {
  position: relative;
  overflow: hidden;
  border-bottom: 1px solid var(--border-subtle);
  background: #000000;
  animation: itemEntrance 0.25s cubic-bezier(0.16, 1, 0.3, 1) backwards;
}

.message-item-actions {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  z-index: 1;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s ease;
}

/* Only show actions when actively swiping */
.message-item-wrapper.is-swiping .message-item-actions {
  opacity: 1;
}

.action-swipe-left {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  font-size: 13px;
  font-weight: 700;
}

.action-archive-box {
  display: flex;
  align-items: center;
  gap: 7px;
  color: var(--gold-primary);
  transition: transform 0.15s ease;
}

.action-delete-box {
  display: none;
  align-items: center;
  gap: 7px;
  color: var(--accent-red);
  transition: transform 0.15s ease;
}

.message-item-wrapper.swipe-mode-delete .action-archive-box {
  display: none !important;
}

.message-item-wrapper.swipe-mode-delete .action-delete-box {
  display: flex !important;
}

.action-swipe-right {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--gold-primary);
  font-size: 13px;
  font-weight: 700;
}

/* Default / Read Message (Settled obsidian card) */
.message-item {
  position: relative;
  z-index: 2;
  background: #08080b; /* 100% OPAQUE so delete button underneath NEVER bleeds */
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  border-left: 3.5px solid transparent;
  transition: background 0.15s ease, transform 0.15s ease;
}

.message-item:active {
  background: #111116;
}

/* UNREAD Message (Prominent luxury elevated state) */
.message-item.unread {
  background: #13131b; /* 100% OPAQUE clearly distinct and brighter */
  border-left: 3.5px solid var(--gold-primary);
  box-shadow: inset 0 1px 0 rgba(212, 175, 55, 0.08);
}

.message-item.unread:active {
  background: #1a1a24;
}

.item-avatar-wrapper {
  position: relative;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.item-avatar {
  position: relative;
  overflow: hidden;
  width: 42px;
  height: 42px;
  border-radius: var(--radius-full);
  background: #141418;
  border: 1px solid #23232c;
  color: #727282;
  font-size: 13px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.item-avatar .avatar-img {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: var(--radius-full);
  z-index: 1;
}

.item-avatar .avatar-initials {
  position: relative;
  z-index: 0;
}

/* Prominent gold avatar for unread */
.item-avatar.avatar-unread {
  background: linear-gradient(135deg, rgba(212, 175, 55, 0.25) 0%, rgba(184, 142, 40, 0.1) 100%);
  border: 1.5px solid var(--gold-primary);
  color: var(--gold-light);
  box-shadow: 0 0 10px rgba(212, 175, 55, 0.25);
}

.item-content {
  flex: 1;
  min-width: 0;
}

.item-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 4px;
}

.item-sender-row {
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
  flex: 1;
}

/* Luminous gold unread indicator dot inside sender row */
.item-unread-dot {
  width: 8px;
  height: 8px;
  border-radius: var(--radius-full);
  background: var(--gold-primary);
  box-shadow: 0 0 8px rgba(212, 175, 55, 0.9);
  flex-shrink: 0;
}

.item-sender {
  font-size: 14.5px;
  font-weight: 500;
  color: #8c8c9e;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.message-item.unread .item-sender {
  font-weight: 700;
  color: #FFFFFF;
  font-size: 15px;
}

.item-date {
  font-size: 11.5px;
  color: #555564;
  white-space: nowrap;
  margin-left: 10px;
  flex-shrink: 0;
}

.message-item.unread .item-date {
  color: var(--gold-primary);
  font-weight: 600;
}

.item-subject {
  font-size: 13px;
  font-weight: 400;
  color: #6a6a7a;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 2px;
}

.message-item.unread .item-subject {
  font-weight: 600;
  color: #E0E0EC;
}

.item-footer {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 4px;
}

/* ================= MAIL READER VIEW ================= */
.reader-top-bar {
  box-sizing: content-box;
  height: 56px;
  padding-top: var(--safe-top);
  padding-left: 12px;
  padding-right: 12px;
  background: var(--bg-glass);
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
  z-index: 10;
}

.reader-scroll-area {
  flex: 1;
  overflow-y: auto;
  padding: 16px 16px calc(24px + var(--safe-bottom)) 16px;
  -webkit-overflow-scrolling: touch;
}

.reader-subject {
  font-size: 19px;
  font-weight: 800;
  color: var(--text-primary);
  line-height: 1.3;
  margin-bottom: 16px;
}

.reader-meta-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 16px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
}

.reader-meta-top {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  min-width: 0;
}

.reader-meta-info {
  flex: 1;
  min-width: 0;
}

.reader-sender-name {
  font-size: 14.5px;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.3;
}

.reader-sender-email {
  font-size: 12px;
  color: var(--gold-light);
  margin-top: 2px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.reader-to-line {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 4px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.reader-meta-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 10px;
  border-top: 1px solid var(--border-subtle);
  gap: 10px;
  min-width: 0;
}

.reader-date-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--gold-light);
  font-size: 11.5px;
  font-weight: 500;
  background: rgba(212, 175, 55, 0.08);
  border: 1px solid rgba(212, 175, 55, 0.2);
  border-radius: var(--radius-full);
  padding: 4px 10px;
  white-space: nowrap;
  flex-shrink: 0;
  box-sizing: border-box;
}

.reader-date-badge svg {
  color: var(--gold-primary);
  flex-shrink: 0;
}

.reader-date {
  font-size: 11.5px;
  color: inherit;
  white-space: nowrap;
}

/* Remote Image Warning */
.remote-image-warning {
  background: rgba(212, 175, 55, 0.08);
  border: 1px solid var(--gold-border);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  color: var(--gold-light);
}

.remote-image-warning button {
  color: var(--gold-primary);
  font-weight: 700;
  text-decoration: underline;
}

/* Sanitized Email Body */
.reader-body-container {
  color: var(--text-primary);
  font-size: 14px;
  line-height: 1.6;
  word-break: break-word;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 16px;
  margin-bottom: 24px;
  max-width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  box-sizing: border-box;
}

.reader-body-container table {
  max-width: 100% !important;
}

.reader-body-container img {
  max-width: 100% !important;
  height: auto !important;
  display: inline-block;
  vertical-align: middle;
  border-radius: 8px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
  border: 1px solid rgba(212, 175, 55, 0.15);
  transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
  cursor: zoom-in;
}

.reader-body-container img:hover {
  transform: scale(1.01);
  border-color: var(--gold-primary);
  box-shadow: 0 6px 20px rgba(212, 175, 55, 0.25);
}

.reader-body-container .hd-blocked-image {
  border: 1px dashed var(--gold-border);
  box-shadow: none;
  background: rgba(212, 175, 55, 0.05);
  cursor: default;
}

/* Attachments Container */
.attachments-section {
  margin-bottom: 24px;
}

.attachments-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-secondary);
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.attachments-grid {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.attachment-pill {
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-md);
  padding: 10px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.attachment-info {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.attachment-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.attachment-size {
  font-size: 11px;
  color: var(--text-muted);
}

/* ================= COMPOSER MODAL ================= */
/* ================= COMPOSER INTERFACE ================= */
.composer-top-bar {
  box-sizing: content-box;
  height: 56px;
  padding-top: var(--safe-top);
  padding-left: 16px;
  padding-right: 16px;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.4);
}

.composer-scroll-area {
  flex: 1;
  overflow-y: auto;
  padding: 16px 16px calc(32px + var(--safe-bottom)) 16px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  max-width: 900px;
  width: 100%;
  margin: 0 auto;
}

/* Symmetrical Recipient & Subject Card */
.composer-meta-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-md);
  padding: 4px 14px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.35);
  display: flex;
  flex-direction: column;
}

.composer-field {
  display: flex;
  align-items: center;
  border-bottom: 1px solid var(--border-subtle);
  padding: 10px 0;
  gap: 12px;
  position: relative;
  min-height: 44px;
}

.composer-field:last-child {
  border-bottom: none;
}

.composer-field-label {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-gold);
  width: 55px;
  flex-shrink: 0;
  letter-spacing: 0.3px;
}

.composer-chips-input {
  flex: 1;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  min-width: 0;
}

.recipient-chip {
  background: linear-gradient(135deg, rgba(212, 175, 55, 0.18) 0%, rgba(184, 142, 40, 0.1) 100%);
  border: 1px solid var(--gold-border);
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
}

.recipient-chip button {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--gold-light);
  font-size: 12px;
  line-height: 1;
  padding: 0;
  display: flex;
  align-items: center;
  transition: transform 0.15s ease, color 0.15s ease;
}

.recipient-chip button:hover {
  color: #ff6b6b;
  transform: scale(1.2);
}

.composer-input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: var(--text-primary);
  font-size: 14px;
  min-width: 140px;
  padding: 2px 0;
}

.composer-input::placeholder {
  color: var(--text-muted);
}

/* Autocomplete Floating Dropdown */
.autocomplete-dropdown {
  position: absolute;
  top: calc(100% + 4px);
  left: 67px;
  right: 0;
  background: #121218;
  border: 1px solid var(--gold-border, rgba(212, 175, 55, 0.3));
  border-radius: var(--radius-md, 12px);
  box-shadow: 0 14px 38px rgba(0, 0, 0, 0.75), 0 0 1px rgba(212, 175, 55, 0.4);
  max-height: 240px;
  overflow-y: auto;
  z-index: 100;
  padding: 6px;
  display: none;
  flex-direction: column;
  gap: 3px;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

.autocomplete-dropdown.active {
  display: flex;
  animation: autocompleteFadeIn 0.16s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes autocompleteFadeIn {
  from {
    opacity: 0;
    transform: translateY(-5px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.autocomplete-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: var(--radius-sm, 8px);
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
  user-select: none;
  border: 1px solid transparent;
  background: transparent;
}

.autocomplete-item:hover,
.autocomplete-item.focused {
  background: rgba(212, 175, 55, 0.14);
  border-color: rgba(212, 175, 55, 0.28);
}

.autocomplete-avatar {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-full, 9999px);
  background: linear-gradient(135deg, rgba(212, 175, 55, 0.25) 0%, rgba(184, 142, 40, 0.12) 100%);
  border: 1px solid var(--gold-border, rgba(212, 175, 55, 0.3));
  color: var(--gold-light, #f5e396);
  font-size: 11px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  letter-spacing: 0.5px;
}

.autocomplete-info {
  display: flex;
  flex-direction: column;
  min-width: 0;
  flex: 1;
}

.autocomplete-name {
  font-size: 13px;
  font-weight: 600;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.3;
}

.autocomplete-email {
  font-size: 11px;
  color: var(--gold-light, #e6ca65);
  opacity: 0.85;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.3;
}

.autocomplete-icon-add {
  color: var(--text-muted, #71717a);
  flex-shrink: 0;
  margin-left: auto;
  opacity: 0.4;
  transition: opacity 0.15s ease, color 0.15s ease, transform 0.15s ease;
}

.autocomplete-item:hover .autocomplete-icon-add,
.autocomplete-item.focused .autocomplete-icon-add {
  opacity: 1;
  color: var(--gold-primary, #d4af37);
  transform: scale(1.15);
}

@media (max-width: 480px) {
  .autocomplete-dropdown {
    left: 0;
  }
}

/* Symmetrical Main Editor Card */
.composer-editor-card {
  background: #0d0d12;
  border: 1.5px solid var(--border-card);
  border-radius: var(--radius-md);
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.45);
  display: flex;
  flex-direction: column;
  transition: border-color 0.25s ease, box-shadow 0.25s ease;
  overflow: hidden;
  position: relative;
}

.composer-editor-card:focus-within {
  border-color: var(--gold-primary);
  box-shadow: 0 0 20px rgba(212, 175, 55, 0.16);
}

/* Editor Toolbar */
.composer-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  padding: 8px 12px;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-subtle);
}

.composer-toolbar-left {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
}

.composer-toolbar-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
  margin-left: auto;
}

.toolbar-group {
  display: flex;
  align-items: center;
  gap: 4px;
}

.toolbar-divider {
  width: 1px;
  height: 20px;
  background: var(--border-card);
  margin: 0 4px;
}

.composer-tool-btn {
  width: 32px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.15s ease;
  padding: 0;
  font-size: 13px;
}

.composer-tool-btn:hover {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-primary);
  border-color: rgba(255, 255, 255, 0.1);
}

.composer-tool-btn.active {
  background: rgba(212, 175, 55, 0.2);
  color: var(--gold-light);
  border-color: var(--gold-border);
}

/* AI Formalize Button */
.btn-formalize-ai {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 0 14px;
  height: 32px;
  min-height: 32px;
  max-height: 32px;
  width: 154px;
  min-width: 154px;
  max-width: 154px;
  background: linear-gradient(135deg, rgba(212, 175, 55, 0.22) 0%, rgba(184, 142, 40, 0.12) 100%);
  border: 1px solid var(--gold-primary);
  border-radius: var(--radius-full);
  color: var(--gold-light);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
  box-shadow: 0 0 10px rgba(212, 175, 55, 0.15);
  white-space: nowrap;
  flex-shrink: 0;
  box-sizing: border-box;
  line-height: 1;
  user-select: none;
  -webkit-user-select: none;
  margin-left: 0;
}

.btn-formalize-ai:hover:not(:disabled) {
  background: linear-gradient(135deg, rgba(212, 175, 55, 0.35) 0%, rgba(184, 142, 40, 0.2) 100%);
  box-shadow: 0 0 16px rgba(212, 175, 55, 0.35);
  color: #fff;
}

.btn-formalize-ai:disabled,
.btn-formalize-ai.loading {
  opacity: 0.9;
  cursor: wait;
  pointer-events: none;
}

/* Spinner specifically tuned for AI button */
.btn-ai-spinner {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
  display: block;
  object-fit: contain;
  animation: emblemSpin 1s linear infinite;
  transform-origin: center center;
  filter: drop-shadow(0 0 3px rgba(212, 175, 55, 0.5));
}

/* HTML Mode Toggle Button */
.btn-toggle-html {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 0 10px;
  height: 32px;
  min-height: 32px;
  max-height: 32px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
  flex-shrink: 0;
  box-sizing: border-box;
  line-height: 1;
}

.btn-toggle-html:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-primary);
}

.btn-toggle-html.active {
  background: rgba(62, 139, 255, 0.18);
  border-color: rgba(62, 139, 255, 0.5);
  color: var(--accent-blue);
}

/* Body Area - Clearly delineated and comfortable */
.composer-textarea {
  flex: 1;
  min-height: 280px;
  padding: 16px 18px;
  background: transparent;
  color: var(--text-primary);
  font-size: 15px;
  line-height: 1.65;
  outline: none;
  overflow-y: auto;
  border-radius: 0;
  position: relative;
  word-break: break-word;
}

.composer-textarea:empty:before {
  content: attr(data-placeholder);
  color: var(--text-muted);
  pointer-events: none;
  display: block;
}

/* HTML Raw Code Editor */
.composer-html-area {
  flex: 1;
  min-height: 280px;
  padding: 16px 18px;
  background: #07070a;
  color: #a9dc76;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 13.5px;
  line-height: 1.6;
  border: none;
  outline: none;
  resize: vertical;
  width: 100%;
  box-sizing: border-box;
  display: none;
}

/* Editor Footer Status Bar */
.composer-editor-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 14px;
  background: var(--bg-surface);
  border-top: 1px solid var(--border-subtle);
  font-size: 11px;
  color: var(--text-muted);
}

.composer-footer-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.composer-mode-badge {
  padding: 2px 7px;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-subtle);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.4px;
  text-transform: uppercase;
}

.composer-mode-badge.html {
  background: rgba(62, 139, 255, 0.15);
  border-color: rgba(62, 139, 255, 0.35);
  color: var(--accent-blue);
}

.composer-footer-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ================= DRAWER NAVIGATION ================= */
.drawer-header {
  padding: 24px 20px 16px 20px;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  gap: 12px;
}

.drawer-user-info {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.drawer-user-name {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-primary);
}

.drawer-user-email {
  font-size: 12px;
  color: var(--gold-light);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.drawer-list {
  flex: 1;
  overflow-y: auto;
  padding: 12px 10px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.drawer-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  font-size: 14px;
  font-weight: 600;
  transition: all 0.22s cubic-bezier(0.16, 1, 0.3, 1);
  cursor: pointer;
  border: 1px solid transparent;
}

.drawer-item:hover {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-primary);
  transform: translateX(4px);
}

.drawer-item:active {
  transform: scale(0.98);
}

.drawer-item.active {
  background: rgba(212, 175, 55, 0.12);
  color: var(--gold-primary);
  border: 1px solid var(--gold-border);
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.3);
}

.drawer-item-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* Symmetrical Drawer Footer */
.drawer-footer {
  padding: 16px;
  border-top: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: var(--bg-surface);
  flex-shrink: 0;
  box-sizing: border-box;
}

.drawer-footer-btn {
  width: 100%;
  height: 44px;
  border-radius: var(--radius-md);
  padding: 0 16px;
  font-size: 13.5px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  border: 1px solid var(--border-card);
  background: var(--bg-secondary);
  color: var(--text-primary);
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  box-sizing: border-box;
  margin: 0 !important;
}

.drawer-footer-btn:hover {
  transform: translateY(-1.5px);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.5);
}

.drawer-footer-btn:active {
  transform: scale(0.97);
}

.drawer-footer-btn.status-btn {
  border-color: var(--gold-border);
  background: rgba(212, 175, 55, 0.06);
}

.drawer-footer-btn.status-btn:hover {
  border-color: var(--gold-primary);
  background: rgba(212, 175, 55, 0.15);
  color: var(--gold-light);
}

.drawer-footer-btn.status-btn img {
  width: 20px;
  height: 20px;
  object-fit: contain;
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.drawer-footer-btn.status-btn:hover img {
  transform: rotate(25deg) scale(1.12);
}

.drawer-footer-btn.logout-btn {
  border-color: var(--border-card);
  color: var(--text-secondary);
}

.drawer-footer-btn.logout-btn:hover {
  border-color: rgba(239, 68, 68, 0.5);
  background: rgba(239, 68, 68, 0.1);
  color: var(--accent-red);
}

.drawer-footer-btn.logout-btn svg {
  transition: transform 0.25s ease;
}

.drawer-footer-btn.logout-btn:hover svg {
  transform: translateX(3px);
}

/* ================= TOAST NOTIFICATIONS ================= */
.toast-container {
  position: fixed;
  top: calc(var(--safe-top) + 64px);
  left: 50%;
  transform: translateX(-50%);
  z-index: 150;
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 90%;
  max-width: 360px;
  pointer-events: none;
}

.toast-item {
  pointer-events: auto;
  background: var(--bg-surface);
  border: 1px solid var(--gold-border);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.7), 0 0 16px rgba(212, 175, 55, 0.2);
  border-radius: var(--radius-md);
  padding: 12px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--text-primary);
  font-size: 13px;
  animation: slideDownToast 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  transition: opacity 0.3s, transform 0.3s;
}

@keyframes slideDownToast {
  from {
    opacity: 0;
    transform: translateY(-12px) scale(0.96);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* ================= FLAG CHIP BUTTON ================= */
.flag-chip-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-full);
  padding: 5px 12px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.2s ease;
}

.flag-chip-btn.active {
  background: rgba(212, 175, 55, 0.15);
  border-color: var(--gold-primary);
  color: var(--gold-primary);
}

.flag-chip-btn:hover {
  border-color: var(--gold-light);
}

/* ================= DRAFT NOTICE BANNER ================= */
.draft-notice-banner {
  background: rgba(212, 175, 55, 0.12);
  border: 1px solid var(--gold-border);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

/* ================= ATTACHMENT RICH PREVIEWS ================= */

/* Single Hero Image Attachment */
.attachment-single-hero {
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-md);
  overflow: hidden;
  cursor: pointer;
  margin-bottom: 14px;
  transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
}

.attachment-single-hero:hover {
  border-color: var(--gold-primary);
  box-shadow: 0 6px 25px rgba(212, 175, 55, 0.2);
}

.attachment-hero-preview {
  position: relative;
  width: 100%;
  height: 220px;
  background: #09090d;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.attachment-hero-preview img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  transition: transform 0.3s ease;
}

.attachment-single-hero:hover .attachment-hero-preview img {
  transform: scale(1.03);
}

.attachment-hero-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.attachment-single-hero:hover .attachment-hero-overlay {
  opacity: 1;
}

.attachment-hero-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: rgba(18, 18, 24, 0.9);
  border: 1px solid var(--gold-primary);
  border-radius: var(--radius-full);
  padding: 6px 16px;
  color: var(--gold-light);
  font-size: 13px;
  font-weight: 600;
  backdrop-filter: blur(8px);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.6);
}

.attachment-hero-footer {
  padding: 12px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-top: 1px solid var(--border-subtle);
  background: var(--bg-surface);
}

.attachment-hero-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

/* Multi-image Grid */
.attachment-images-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(135px, 1fr));
  gap: 12px;
  margin-bottom: 14px;
}

.attachment-image-card {
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-md);
  overflow: hidden;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
  box-shadow: 0 3px 12px rgba(0, 0, 0, 0.4);
}

.attachment-image-card:hover {
  transform: translateY(-2px);
  border-color: var(--gold-primary);
  box-shadow: 0 6px 20px rgba(212, 175, 55, 0.2);
}

.attachment-image-thumb {
  position: relative;
  width: 100%;
  aspect-ratio: 4 / 3;
  background: #09090d;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.attachment-image-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s ease;
}

.attachment-image-card:hover .attachment-image-thumb img {
  transform: scale(1.06);
}

.attachment-badge-index {
  position: absolute;
  top: 6px;
  left: 6px;
  background: rgba(0, 0, 0, 0.7);
  border: 1px solid rgba(212, 175, 55, 0.4);
  color: var(--gold-light);
  font-size: 10px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: var(--radius-full);
  backdrop-filter: blur(4px);
  z-index: 2;
}

.attachment-image-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.2s ease;
  color: var(--gold-light);
  z-index: 1;
}

.attachment-image-card:hover .attachment-image-overlay {
  opacity: 1;
}

.attachment-image-meta {
  padding: 8px 10px;
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
  background: var(--bg-surface);
}

.attachment-submeta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}

.attachment-quick-dl {
  color: var(--text-muted);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 2px;
  border-radius: var(--radius-sm);
  transition: color 0.15s ease;
}

.attachment-quick-dl:hover {
  color: var(--gold-primary);
}

/* PDF Attachment Cards */
.attachment-pdf-card {
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-md);
  padding: 10px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
  transition: border-color 0.2s;
}

.attachment-pdf-card:hover {
  border-color: var(--gold-primary);
}

.attachment-pdf-preview {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
  min-width: 0;
  cursor: pointer;
}

.pdf-badge {
  position: relative;
  width: 42px;
  height: 42px;
  background: rgba(239, 68, 68, 0.12);
  border: 1px solid rgba(239, 68, 68, 0.3);
  border-radius: var(--radius-sm);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.pdf-tag {
  font-size: 8px;
  font-weight: 800;
  color: var(--accent-red);
  letter-spacing: 0.5px;
  margin-top: -3px;
}

.pdf-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.pdf-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ================= FULLSCREEN LIGHTBOX (IMAGES) ================= */
.lightbox-modal {
  position: fixed;
  inset: 0;
  background: rgba(5, 5, 7, 0.96);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  z-index: 250;
  display: none;
  flex-direction: column;
  opacity: 0;
  transition: opacity 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  overflow: hidden;
}

.lightbox-modal.active {
  display: flex;
  opacity: 1;
}

.lightbox-header {
  box-sizing: content-box;
  height: 56px;
  padding-top: var(--safe-top);
  padding-left: 14px;
  padding-right: 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  color: var(--text-primary);
  background: linear-gradient(180deg, rgba(0,0,0,0.9) 0%, rgba(0,0,0,0.3) 80%, transparent 100%);
  z-index: 15;
  flex-shrink: 0;
}

.lightbox-header-left,
.lightbox-header-right {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.lightbox-header-center {
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 1;
  min-width: 0;
}

.lightbox-title-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: rgba(18, 18, 24, 0.85);
  border: 1px solid var(--gold-border);
  border-radius: var(--radius-full);
  padding: 5px 12px;
  max-width: 65vw;
  box-shadow: 0 4px 14px rgba(0,0,0,0.5);
  backdrop-filter: blur(8px);
}

.lightbox-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}

.lightbox-counter {
  font-size: 11px;
  font-weight: 800;
  color: var(--gold-primary);
  background: rgba(212, 175, 55, 0.15);
  padding: 2px 7px;
  border-radius: var(--radius-full);
  white-space: nowrap;
  flex-shrink: 0;
}

/* On-screen Left & Right Navigation Arrow Buttons */
.lightbox-nav-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: rgba(18, 18, 24, 0.85);
  border: 1.5px solid var(--gold-border);
  color: var(--gold-light);
  display: none;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 20;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.lightbox-nav-btn:hover {
  background: rgba(212, 175, 55, 0.2);
  border-color: var(--gold-primary);
  color: #FFFFFF;
  transform: translateY(-50%) scale(1.08);
  box-shadow: 0 0 20px rgba(212, 175, 55, 0.4);
}

.lightbox-nav-btn:active {
  transform: translateY(-50%) scale(0.94);
}

.lightbox-nav-prev {
  left: 16px;
}

.lightbox-nav-next {
  right: 16px;
}

@media (max-width: 480px) {
  .lightbox-nav-btn {
    width: 42px;
    height: 42px;
  }
  .lightbox-nav-prev {
    left: 10px;
  }
  .lightbox-nav-next {
    right: 10px;
  }
}

.lightbox-body {
  flex: 1;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  touch-action: none;
  padding: 16px;
  min-height: 0;
}

.lightbox-body img {
  max-width: 92vw;
  max-height: 72vh;
  object-fit: contain;
  border-radius: var(--radius-sm);
  box-shadow: 0 16px 50px rgba(0, 0, 0, 0.85);
  transition: opacity 0.2s ease-out, transform 0.2s ease-out;
  user-select: none;
  -webkit-user-select: none;
}

.lightbox-loader {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  color: var(--gold-light);
  font-size: 13px;
  font-weight: 600;
  z-index: 5;
}

.lightbox-spinner {
  width: 36px;
  height: 36px;
  border: 3px solid rgba(212, 175, 55, 0.2);
  border-top-color: var(--gold-primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.lightbox-error {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px;
  text-align: center;
  z-index: 5;
}

/* Bottom Filmstrip Thumbnails */
.lightbox-filmstrip-bar {
  position: absolute;
  bottom: calc(72px + var(--safe-bottom));
  left: 0;
  right: 0;
  display: flex;
  justify-content: center;
  padding: 0 16px;
  z-index: 15;
  pointer-events: none;
}

.lightbox-filmstrip {
  display: flex;
  align-items: center;
  gap: 8px;
  max-width: 90vw;
  overflow-x: auto;
  padding: 6px 10px;
  background: rgba(14, 14, 18, 0.88);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-full);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  pointer-events: auto;
  scrollbar-width: none;
}

.lightbox-filmstrip::-webkit-scrollbar {
  display: none;
}

.lightbox-thumb {
  width: 40px;
  height: 40px;
  border-radius: 8px;
  overflow: hidden;
  border: 2px solid transparent;
  opacity: 0.55;
  cursor: pointer;
  transition: all 0.2s ease;
  flex-shrink: 0;
  background: #000;
}

.lightbox-thumb:hover {
  opacity: 0.9;
  transform: scale(1.05);
}

.lightbox-thumb.active {
  border-color: var(--gold-primary);
  opacity: 1;
  transform: scale(1.12);
  box-shadow: 0 0 12px rgba(212, 175, 55, 0.6);
}

.lightbox-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.lightbox-controls {
  position: absolute;
  bottom: calc(18px + var(--safe-bottom));
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 12px;
  background: rgba(20, 20, 26, 0.9);
  border: 1px solid var(--gold-border);
  border-radius: var(--radius-full);
  padding: 5px 14px;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  box-shadow: 0 8px 30px rgba(0,0,0,0.8);
  z-index: 15;
}

/* ================= FULLSCREEN PDF VIEWER ================= */
.pdf-viewer-modal {
  position: fixed;
  inset: 0;
  background: var(--bg-primary);
  z-index: 250;
  display: none;
  flex-direction: column;
  opacity: 0;
  transition: opacity 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.pdf-viewer-modal.active {
  display: flex;
  opacity: 1;
}

.pdf-viewer-header {
  padding-top: var(--safe-top);
  height: calc(56px + var(--safe-top));
  padding-left: 14px;
  padding-right: 14px;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}

.pdf-viewer-body {
  flex: 1;
  position: relative;
  background: #18181f;
  overflow: hidden;
}

.pdf-viewer-body iframe {
  width: 100%;
  height: 100%;
  border: none;
}

/* ================= AVATAR SYSTEM & POPOVER ================= */
.header-avatar-wrapper {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

.avatar-badge {
  position: relative;
  overflow: hidden;
  cursor: pointer;
  border: none;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  user-select: none;
  transition: transform 0.2s cubic-bezier(0.2, 0.8, 0.2, 1), box-shadow 0.2s ease;
}

.avatar-badge:hover {
  transform: scale(1.05);
  box-shadow: 0 0 14px rgba(212, 175, 55, 0.5);
}

.avatar-badge:active {
  transform: scale(0.95);
}

.avatar-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: var(--radius-full);
  display: block;
}

/* Avatar Popover Menu */
.avatar-popover {
  position: absolute;
  top: calc(100% + 12px);
  right: 0;
  width: 280px;
  background: rgba(18, 18, 24, 0.96);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border: 1px solid var(--gold-border);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.75), 0 0 20px rgba(212, 175, 55, 0.15);
  border-radius: var(--radius-md);
  padding: 14px;
  z-index: 1000;
  transform-origin: top right;
  animation: popover-slide-in 0.22s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes popover-slide-in {
  from {
    opacity: 0;
    transform: scale(0.92) translateY(-8px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

.popover-user-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border-subtle);
  margin-bottom: 8px;
}

.popover-avatar-wrap {
  position: relative;
  flex-shrink: 0;
}

.popover-avatar {
  width: 48px;
  height: 48px;
  font-size: 17px;
  font-weight: 800;
  box-shadow: 0 2px 10px rgba(212, 175, 55, 0.35);
}

.popover-avatar-badge-edit {
  position: absolute;
  bottom: -2px;
  right: -2px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--gold-primary);
  color: #000;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  border: 1.5px solid #000;
  transition: transform 0.15s ease;
  box-shadow: 0 2px 6px rgba(0,0,0,0.5);
}

.popover-avatar-badge-edit:hover {
  transform: scale(1.15);
}

.popover-user-info {
  flex: 1;
  min-width: 0;
}

.popover-name {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.popover-email {
  font-size: 11px;
  color: var(--gold-light);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 1px;
  opacity: 0.85;
}

.popover-menu {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.popover-menu-item {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: transparent;
  border: none;
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
  text-align: left;
}

.popover-menu-item svg {
  color: var(--gold-primary);
  flex-shrink: 0;
  transition: transform 0.15s ease;
}

.popover-menu-item:hover {
  background: rgba(212, 175, 55, 0.12);
  color: #fff;
}

.popover-menu-item:hover svg {
  transform: scale(1.1);
}

.popover-menu-item.danger {
  color: #ff6b6b;
}

.popover-menu-item.danger svg {
  color: #ff6b6b;
}

.popover-menu-item.danger:hover {
  background: rgba(255, 75, 75, 0.12);
}

.popover-menu-item.logout {
  color: #e57373;
}

.popover-menu-item.logout svg {
  color: #e57373;
}

.popover-menu-item.logout:hover {
  background: rgba(229, 115, 115, 0.12);
}

.popover-divider {
  height: 1px;
  background: var(--border-subtle);
  margin: 4px 0;
}

@keyframes modal-pop {
  0% {
    opacity: 0;
    transform: scale(0.92) translateY(16px);
  }
  100% {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

.modal-backdrop.avatar-modal-backdrop {
  z-index: 1500 !important;
}

/* Modal Source Chooser */
.avatar-source-card {
  max-width: 380px;
  width: 90%;
  background: var(--bg-surface);
  border: 1px solid var(--gold-border);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.8), 0 0 30px rgba(212, 175, 55, 0.2);
  animation: modal-pop 0.24s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.avatar-modal-header {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 20px;
}

.avatar-modal-icon {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
  background: rgba(212, 175, 55, 0.15);
  border: 1px solid var(--gold-border);
  color: var(--gold-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.avatar-options-grid {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 18px;
}

.avatar-choice-btn {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  background: #181820;
  border: 1px solid var(--border-card);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  text-align: left;
}

.avatar-choice-btn:hover {
  border-color: var(--gold-primary);
  background: #20202a;
  transform: translateY(-2px);
  box-shadow: 0 4px 14px rgba(212, 175, 55, 0.15);
}

.choice-icon-wrap {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.choice-icon-wrap.camera {
  background: linear-gradient(135deg, rgba(212, 175, 55, 0.25) 0%, rgba(184, 142, 40, 0.1) 100%);
  color: var(--gold-primary);
  border: 1px solid rgba(212, 175, 55, 0.3);
}

.choice-icon-wrap.gallery {
  background: linear-gradient(135deg, rgba(62, 139, 255, 0.25) 0%, rgba(30, 80, 180, 0.1) 100%);
  color: var(--accent-blue);
  border: 1px solid rgba(62, 139, 255, 0.3);
}

.choice-text {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.choice-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-primary);
}

.choice-desc {
  font-size: 11px;
  color: var(--text-secondary);
}

.choice-chevron {
  color: var(--text-muted);
  transition: transform 0.2s ease, color 0.2s ease;
}

.avatar-choice-btn:hover .choice-chevron {
  color: var(--gold-primary);
  transform: translateX(3px);
}

.modal-cancel-btn {
  width: 100%;
  padding: 12px;
  font-size: 14px;
  font-weight: 600;
}

/* Preview Modal */
.avatar-preview-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  margin: 18px 0;
}

.avatar-preview-circle {
  width: 140px;
  height: 140px;
  border-radius: 50%;
  border: 3px solid var(--gold-primary);
  box-shadow: 0 0 24px rgba(212, 175, 55, 0.35);
  overflow: hidden;
  background: #000;
  position: relative;
}

.avatar-preview-circle img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* ================= STANDALONE MOBILE INSTALLATION SCREEN (FULLSCREEN) ================= */
.standalone-fullscreen-screen {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  width: 100%;
  height: 100%;
  background-color: #070708;
  background-image: 
    radial-gradient(circle at 50% 0%, rgba(212, 175, 55, 0.16) 0%, transparent 60%),
    radial-gradient(circle at 50% 100%, rgba(212, 175, 55, 0.08) 0%, transparent 45%);
  z-index: 99999;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  display: flex;
  flex-direction: column;
  padding: calc(24px + env(safe-area-inset-top, 0px)) 18px calc(32px + env(safe-area-inset-bottom, 0px));
  box-sizing: border-box;
}

.standalone-content-wrap {
  width: 100%;
  max-width: 460px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.standalone-brand-logo {
  max-width: 175px;
  height: auto;
  object-fit: contain;
  margin-bottom: 16px;
  filter: drop-shadow(0 2px 10px rgba(0, 0, 0, 0.8));
}

.standalone-install-symbol {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 76px;
  height: 76px;
  margin-bottom: 16px;
}

.symbol-circle-glow {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: linear-gradient(135deg, rgba(212, 175, 55, 0.22) 0%, rgba(212, 175, 55, 0.06) 100%);
  border: 1.5px solid rgba(212, 175, 55, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 25px rgba(212, 175, 55, 0.25);
}

.symbol-halo-pulse {
  position: absolute;
  inset: -6px;
  border-radius: 50%;
  border: 1.5px solid rgba(212, 175, 55, 0.5);
  animation: pulseInstallHalo 2s infinite ease-out;
  pointer-events: none;
}

@keyframes pulseInstallHalo {
  0% { transform: scale(0.9); opacity: 0.9; }
  60% { transform: scale(1.25); opacity: 0; }
  100% { transform: scale(1.25); opacity: 0; }
}

.standalone-title {
  font-size: 22px;
  font-weight: 800;
  color: #FFFFFF;
  margin-bottom: 8px;
  text-align: center;
  letter-spacing: -0.3px;
}

.standalone-title-gold {
  color: var(--gold-primary);
  background: var(--gold-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.standalone-subtitle {
  font-size: 13.5px;
  line-height: 1.5;
  color: rgba(255, 255, 255, 0.72);
  text-align: center;
  margin-bottom: 18px;
  padding: 0 8px;
}

/* Platform Tabs Switcher */
.standalone-platform-tabs {
  display: flex;
  width: 100%;
  background: rgba(18, 18, 22, 0.85);
  border: 1px solid rgba(212, 175, 55, 0.22);
  border-radius: 14px;
  padding: 4px;
  gap: 4px;
  margin-bottom: 16px;
  box-sizing: border-box;
}

.platform-tab {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 4px;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 10px;
  color: rgba(255, 255, 255, 0.65);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.25s ease;
  white-space: nowrap;
}

.platform-tab.active {
  background: linear-gradient(135deg, rgba(212, 175, 55, 0.28) 0%, rgba(212, 175, 55, 0.1) 100%);
  border-color: rgba(212, 175, 55, 0.5);
  color: #D4AF37;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.4), 0 0 12px rgba(212, 175, 55, 0.2);
}

/* Guide Panels */
.guide-panel {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* Visual Action Card / Mockup */
.guide-action-card {
  width: 100%;
  background: #0D0D10;
  border: 1px solid rgba(212, 175, 55, 0.22);
  border-radius: 14px;
  padding: 12px 14px;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  gap: 10px;
  box-shadow: inset 0 0 15px rgba(0, 0, 0, 0.6);
}

.guide-action-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.guide-browser-url {
  flex: 1;
  min-width: 0;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 20px;
  padding: 5px 10px;
  font-size: 12px;
  color: rgba(255, 255, 255, 0.7);
  display: flex;
  align-items: center;
  gap: 6px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.guide-target-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: rgba(212, 175, 55, 0.2);
  border: 1.5px solid #D4AF37;
  color: #D4AF37;
  flex-shrink: 0;
}

.guide-target-btn.large {
  width: 44px;
  height: 44px;
}

.pulsing-halo {
  position: absolute;
  inset: -5px;
  border-radius: 14px;
  border: 1.5px solid #D4AF37;
  animation: pulseTargetRing 1.8s infinite ease-out;
  pointer-events: none;
}

@keyframes pulseTargetRing {
  0% { transform: scale(0.95); opacity: 0.9; }
  70% { transform: scale(1.3); opacity: 0; }
  100% { transform: scale(1.3); opacity: 0; }
}

.guide-pointer-text {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 700;
  color: #D4AF37;
  animation: bouncePointer 1.6s infinite ease-in-out;
}

@keyframes bouncePointer {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(3px); }
}

/* Steps List */
.guide-steps-container {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
}

.guide-step-row {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(212, 175, 55, 0.16);
  border-radius: 12px;
  padding: 12px 14px;
  box-sizing: border-box;
  text-align: left;
}

.step-badge {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: linear-gradient(135deg, #ECC86A 0%, #D4AF37 50%, #B88E28 100%);
  color: #000000;
  font-weight: 800;
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 2px 6px rgba(212, 175, 55, 0.35);
  margin-top: 1px;
}

.step-content {
  flex: 1;
  min-width: 0;
}

.step-title {
  font-size: 14px;
  font-weight: 700;
  color: #FFFFFF;
  margin-bottom: 2px;
}

.step-subtitle {
  font-size: 12.5px;
  line-height: 1.45;
  color: rgba(255, 255, 255, 0.7);
}

.kbd-symbol {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(212, 175, 55, 0.18);
  border: 1px solid rgba(212, 175, 55, 0.4);
  color: #D4AF37;
  border-radius: 4px;
  padding: 0 5px;
  font-size: 11px;
  font-weight: 700;
  vertical-align: middle;
  min-height: 18px;
}

.guide-footnote {
  font-size: 11.5px;
  color: rgba(255, 255, 255, 0.5);
  line-height: 1.4;
  text-align: center;
  margin-top: 4px;
}

/* Native Install Button */
.btn-native-install {
  width: 100%;
  padding: 13px;
  background: linear-gradient(135deg, #ECC86A 0%, #D4AF37 50%, #B88E28 100%);
  color: #000000;
  border: none;
  border-radius: var(--radius-full);
  font-weight: 700;
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(212, 175, 55, 0.35);
  margin-top: 6px;
}

/* Footer Actions */
.standalone-footer-actions {
  width: 100%;
  max-width: 460px;
  margin-top: 18px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.btn-check-standalone {
  width: 100%;
  height: 48px;
  background: linear-gradient(135deg, #ECC86A 0%, #D4AF37 50%, #B88E28 100%);
  color: #000000;
  font-weight: 700;
  font-size: 15px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  box-shadow: 0 4px 18px rgba(212, 175, 55, 0.35);
  cursor: pointer;
}

.btn-check-standalone:active {
  transform: scale(0.97);
}

.standalone-feedback-msg {
  width: 100%;
  padding: 12px 14px;
  border-radius: 12px;
  background: rgba(212, 175, 55, 0.12);
  border: 1px solid rgba(212, 175, 55, 0.4);
  color: #ECC86A;
  font-size: 12.5px;
  line-height: 1.45;
  text-align: center;
  box-sizing: border-box;
}

@keyframes shakeError {
  0%, 100% { transform: translateX(0); }
  20%, 60% { transform: translateX(-6px); }
  40%, 80% { transform: translateX(6px); }
}

/* Tab Bar Status Emblem */
.tab-item-status .tab-status-emblem {
  width: 22px;
  height: 22px;
  object-fit: contain;
  transition: transform 0.2s ease, filter 0.2s ease;
  filter: drop-shadow(0 2px 4px rgba(212, 175, 55, 0.35));
}

.tab-item-status.active .tab-status-emblem {
  transform: scale(1.12);
  filter: drop-shadow(0 0 8px rgba(212, 175, 55, 0.75));
}


