/* =========================================================================
   CodeWTX Enterprise Mail & Collaboration Suite - Pure White Theme System
   Inspired by Outlook Web, Superhuman, and Apple Mail
   ========================================================================= */

:root {
  --bg-primary: #ffffff;
  --bg-secondary: #f8fafc;
  --bg-tertiary: #f1f5f9;
  --bg-card: #ffffff;
  --bg-hover: #f1f5f9;
  --bg-active: #e2e8f0;

  --border-light: #f1f5f9;
  --border-subtle: #e2e8f0;
  --border-medium: #cbd5e1;
  --border-focus: #2563eb;

  --text-primary: #0f172a;
  --text-secondary: #334155;
  --text-muted: #64748b;
  --text-subtle: #94a3b8;

  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --primary-light: #eff6ff;
  --primary-border: #bfdbfe;

  --success: #059669;
  --success-light: #ecfdf5;
  --success-border: #a7f3d0;

  --warning: #d97706;
  --warning-light: #fffbeb;
  --warning-border: #fde68a;

  --danger: #dc2626;
  --danger-light: #fef2f2;
  --danger-border: #fecaca;

  --radius-xs: 4px;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-xl: 18px;
  --radius-full: 9999px;

  --shadow-xs: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-sm: 0 1px 3px 0 rgba(0, 0, 0, 0.07), 0 1px 2px -1px rgba(0, 0, 0, 0.04);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.06), 0 2px 4px -2px rgba(0, 0, 0, 0.04);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.06), 0 4px 6px -4px rgba(0, 0, 0, 0.03);
  --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.08), 0 8px 10px -6px rgba(0, 0, 0, 0.04);

  --font-sans: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', Menlo, Monaco, Consolas, monospace;

  --header-height: 58px;
  --ribbon-height: 48px;
  --sidebar-width: 240px;
  --mail-list-width: 380px;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-sans);
  background-color: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  height: 100vh;
  overflow: hidden;
  user-select: none;
}

/* =========================================================================
   LOGIN VIEW
   ========================================================================= */

.login-container {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: radial-gradient(circle at 50% 10%, #ffffff 0%, #f8fafc 60%, #e2e8f0 100%);
  padding: 20px;
}

.login-card {
  width: 100%;
  max-width: 380px;
  background: #ffffff;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xl);
  padding: 36px 32px 28px 32px;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.05), 0 8px 10px -6px rgba(0, 0, 0, 0.03);
  animation: fadeIn 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.login-title {
  font-size: 24px;
  font-weight: 800;
  color: var(--text-primary);
  letter-spacing: -0.4px;
  margin-bottom: 24px;
  text-align: center;
}

.login-help-wrapper {
  margin-top: 18px;
  text-align: center;
}

.login-help-link {
  font-size: 13px;
  font-weight: 500;
  color: var(--primary);
  text-decoration: none;
  cursor: pointer;
  transition: color 0.15s ease, text-decoration 0.15s ease;
}

.login-help-link:hover {
  color: var(--primary-hover);
  text-decoration: underline;
}

.form-group {
  margin-bottom: 18px;
}

.form-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.input-wrapper svg {
  position: absolute;
  left: 14px;
  color: var(--text-subtle);
  pointer-events: none;
}

.form-input {
  width: 100%;
  padding: 10px 14px 10px 40px;
  background: #ffffff;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  font-size: 14px;
  font-family: inherit;
  color: var(--text-primary);
  transition: all 0.15s ease;
}

.form-input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.btn-primary {
  width: 100%;
  padding: 11px 18px;
  background: var(--primary);
  color: #ffffff;
  border: none;
  border-radius: var(--radius-md);
  font-size: 14px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  box-shadow: 0 2px 4px rgba(37, 99, 235, 0.2);
  transition: all 0.15s ease;
}

.btn-primary:hover {
  background: var(--primary-hover);
  box-shadow: 0 4px 8px rgba(37, 99, 235, 0.3);
  transform: translateY(-1px);
}

.btn-secondary {
  padding: 7px 13px;
  background: #ffffff;
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.15s ease;
}

.btn-secondary:hover {
  background: var(--bg-hover);
  border-color: var(--border-medium);
  color: var(--text-primary);
}



/* =========================================================================
   APP SHELL LAYOUT
   ========================================================================= */

.app-wrapper {
  display: flex;
  flex-direction: column;
  height: 100vh;
  width: 100vw;
  background: #ffffff;
}

/* Top Navigation Bar */
.top-navbar {
  height: var(--header-height);
  background: #ffffff;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  z-index: 50;
}

.brand-section {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-logo {
  width: 34px;
  height: 34px;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, #2563eb, #1d4ed8);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  font-weight: 800;
  font-size: 17px;
  box-shadow: 0 2px 4px rgba(37, 99, 235, 0.25);
}

.brand-info h1 {
  font-size: 15px;
  font-weight: 800;
  color: var(--text-primary);
  letter-spacing: -0.3px;
  line-height: 1.2;
}

.brand-info span {
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 500;
}

/* Omnisearch Bar in Header */
.header-search-bar {
  flex: 1;
  max-width: 480px;
  margin: 0 24px;
  position: relative;
}

.header-search-input {
  width: 100%;
  padding: 8px 14px 8px 38px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-full);
  font-size: 13px;
  font-family: inherit;
  color: var(--text-primary);
  transition: all 0.15s ease;
}

.header-search-input:focus {
  outline: none;
  background: #ffffff;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.header-search-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-subtle);
  pointer-events: none;
}

/* App Modules Switcher */
.app-tabs {
  display: flex;
  align-items: center;
  gap: 2px;
  background: var(--bg-secondary);
  padding: 3px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
}

.tab-btn {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  border: none;
  background: transparent;
  font-size: 13px;
  font-weight: 600;
  font-family: inherit;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.15s ease;
}

.tab-btn:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.7);
}

.tab-btn.active {
  background: #ffffff;
  color: var(--primary);
  box-shadow: var(--shadow-xs);
  border: 1px solid var(--border-light);
}

.tab-badge {
  background: var(--primary-light);
  color: var(--primary);
  font-size: 11px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: var(--radius-full);
}

/* Top Nav Right Actions */
.nav-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.status-pill {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--success-light);
  border: 1px solid var(--success-border);
  color: var(--success);
  padding: 4px 10px;
  border-radius: var(--radius-full);
  font-size: 12px;
  font-weight: 600;
}

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--success);
}

.user-profile-menu {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 3px 8px 3px 3px;
  border-radius: var(--radius-full);
  cursor: pointer;
  border: 1px solid transparent;
  transition: all 0.15s ease;
}

.user-profile-menu:hover {
  background: var(--bg-hover);
  border-color: var(--border-subtle);
}

.user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, #3b82f6, #2563eb);
  color: #ffffff;
  font-weight: 700;
  font-size: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.user-details {
  text-align: left;
  line-height: 1.2;
}

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

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

/* =========================================================================
   OUTLOOK COMMAND BAR / ACTION RIBBON
   ========================================================================= */

.outlook-ribbon {
  height: var(--ribbon-height);
  background: #ffffff;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  z-index: 40;
}

.ribbon-left {
  display: flex;
  align-items: center;
  gap: 8px;
}

.btn-ribbon-compose {
  padding: 7px 16px;
  background: var(--primary);
  color: #ffffff;
  border: none;
  border-radius: var(--radius-md);
  font-size: 13px;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  box-shadow: 0 2px 4px rgba(37, 99, 235, 0.2);
  transition: all 0.15s ease;
}

.btn-ribbon-compose:hover {
  background: var(--primary-hover);
  transform: translateY(-1px);
}

.ribbon-separator {
  width: 1px;
  height: 20px;
  background: var(--border-subtle);
  margin: 0 4px;
}

.ribbon-btn {
  padding: 6px 10px;
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all 0.12s ease;
}

.ribbon-btn:hover {
  background: var(--bg-hover);
  border-color: var(--border-subtle);
  color: var(--text-primary);
}

.ribbon-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.ribbon-btn-danger:hover {
  background: var(--danger-light);
  color: var(--danger);
  border-color: var(--danger-border);
}

.ribbon-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* =========================================================================
   MAIN APP BODY (COLUMNS)
   ========================================================================= */

.app-main {
  display: flex;
  flex: 1;
  height: calc(100vh - var(--header-height) - var(--ribbon-height));
  overflow: hidden;
  background: #ffffff;
}

/* Sidebar Navigation */
.app-sidebar {
  width: var(--sidebar-width);
  background: #ffffff;
  border-right: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  padding: 12px 10px;
  overflow-y: auto;
}

.nav-group-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-subtle);
  padding: 8px 10px 4px;
}

.folder-list {
  list-style: none;
  margin-bottom: 16px;
}

.folder-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  cursor: pointer;
  margin-bottom: 2px;
  border: 1.5px dashed transparent;
  transition: all 0.15s ease;
}

.folder-item:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.folder-item.active {
  background: var(--primary-light);
  color: var(--primary);
  font-weight: 700;
}

/* Drag-over state for drop targets */
.folder-item.drag-over {
  background: #eff6ff !important;
  border-color: var(--primary) !important;
  transform: scale(1.02);
  color: var(--primary) !important;
}

.folder-item-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.folder-badge {
  font-size: 11px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: var(--radius-full);
  background: var(--bg-active);
  color: var(--text-secondary);
}

.folder-item.active .folder-badge {
  background: var(--primary);
  color: #ffffff;
}

/* Storage Card at Sidebar Bottom */
.storage-card {
  margin-top: auto;
  background: var(--bg-secondary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 12px;
}

.storage-title {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.storage-bar-bg {
  width: 100%;
  height: 5px;
  background: var(--border-subtle);
  border-radius: var(--radius-full);
  overflow: hidden;
  margin-bottom: 6px;
}

.storage-bar-fill {
  height: 100%;
  background: var(--primary);
  border-radius: var(--radius-full);
}

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

/* =========================================================================
   MAIL LIST PANE (OUTLOOK STYLE THREAD ROWS)
   ========================================================================= */

.mail-list-pane {
  width: var(--mail-list-width);
  background: #ffffff;
  border-right: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  height: 100%;
}

.mail-list-header {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.mail-filter-tabs {
  display: flex;
  gap: 4px;
}

.filter-chip {
  padding: 4px 10px;
  border-radius: var(--radius-full);
  font-size: 12px;
  font-weight: 600;
  border: 1px solid var(--border-subtle);
  background: #ffffff;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.12s ease;
}

.filter-chip.active {
  background: var(--text-primary);
  color: #ffffff;
  border-color: var(--text-primary);
}

.mail-items-container {
  flex: 1;
  overflow-y: auto;
}

/* Draggable Mail Row */
.mail-item {
  display: flex;
  align-items: flex-start;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border-light);
  cursor: grab;
  transition: background 0.12s ease, opacity 0.2s ease, transform 0.2s ease;
  position: relative;
}

.mail-item:active {
  cursor: grabbing;
}

.mail-item.dragging {
  opacity: 0.4;
  background: var(--bg-hover);
}

.mail-item:hover {
  background: var(--bg-hover);
}

.mail-item.selected {
  background: #eff6ff;
  border-left: 3.5px solid var(--primary);
}

.mail-item.bulk-selected {
  background: #f0f7ff;
}

.mail-item.unread {
  background: #ffffff;
}

.mail-item.unread::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3.5px;
  background: var(--primary);
}

.mail-item.pinned {
  background: #fafafa;
  border-left: 3.5px solid #f59e0b;
}

.mail-item-checkbox {
  margin-right: 10px;
  margin-top: 2px;
  cursor: pointer;
}

.mail-item-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--bg-tertiary);
  color: var(--text-secondary);
  font-weight: 700;
  font-size: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-right: 10px;
  flex-shrink: 0;
}

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

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

.mail-sender {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: flex;
  align-items: center;
  gap: 6px;
}

.mail-item.unread .mail-sender {
  font-weight: 800;
}

.thread-count-badge {
  font-size: 11px;
  font-weight: 700;
  color: var(--primary);
  background: var(--primary-light);
  padding: 1px 5px;
  border-radius: var(--radius-full);
}

.mail-time {
  font-size: 11px;
  color: var(--text-subtle);
  flex-shrink: 0;
  margin-left: 6px;
}

.mail-subject {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 3px;
}

.mail-item.unread .mail-subject {
  font-weight: 700;
  color: var(--text-primary);
}

.mail-preview {
  font-size: 12px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Quick Hover Action Bar */
.mail-row-actions {
  display: none;
  align-items: center;
  gap: 4px;
  margin-top: 4px;
}

.mail-item:hover .mail-row-actions {
  display: flex;
}

.mail-item-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 4px;
}

.mail-badges {
  display: flex;
  gap: 4px;
}

.badge-tag {
  font-size: 10px;
  font-weight: 700;
  padding: 1px 5px;
  border-radius: var(--radius-sm);
  background: var(--bg-secondary);
  color: var(--text-muted);
  border: 1px solid var(--border-subtle);
}

.star-btn {
  background: transparent;
  border: none;
  cursor: pointer;
  color: var(--border-medium);
  padding: 2px;
  transition: color 0.12s ease;
}

.star-btn.starred {
  color: #f59e0b;
}

/* =========================================================================
   READING PANE (OUTLOOK CONVERSATION CHAIN & INLINE REPLY)
   ========================================================================= */

.reading-pane {
  flex: 1;
  background: #ffffff;
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow-y: auto;
}

.reading-empty {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: var(--text-subtle);
  padding: 40px;
  text-align: center;
}

.reading-empty svg {
  width: 56px;
  height: 56px;
  margin-bottom: 16px;
  stroke-width: 1.25;
  color: var(--border-medium);
}

.thread-container {
  padding: 24px 32px;
  max-width: 900px;
  margin: 0 auto;
  width: 100%;
}

.thread-header-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border-subtle);
}

.thread-subject-title {
  font-size: 20px;
  font-weight: 800;
  color: var(--text-primary);
  letter-spacing: -0.4px;
  line-height: 1.3;
}

.thread-meta-tags {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 6px;
}

/* Individual Message Card in the Conversation Chain */
.conversation-message-card {
  background: #ffffff;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  margin-bottom: 14px;
  box-shadow: var(--shadow-xs);
  transition: all 0.15s ease;
  overflow: hidden;
}

.conversation-message-card:hover {
  border-color: var(--border-medium);
}

/* Collapsed Header View (for older emails in chain) */
.card-header-collapsed {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 18px;
  cursor: pointer;
  background: var(--bg-secondary);
}

.card-header-collapsed:hover {
  background: var(--bg-hover);
}

.collapsed-sender {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-primary);
}

.collapsed-snippet {
  font-size: 13px;
  color: var(--text-muted);
  flex: 1;
  margin: 0 16px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.collapsed-date {
  font-size: 11px;
  color: var(--text-subtle);
}

/* Expanded Card View */
.card-header-expanded {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-light);
}

.sender-info-block {
  display: flex;
  align-items: center;
  gap: 12px;
}

.sender-avatar-md {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: linear-gradient(135deg, #2563eb, #1d4ed8);
  color: #ffffff;
  font-weight: 700;
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.sender-name-md {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-primary);
}

.sender-email-md {
  font-size: 12px;
  color: var(--text-muted);
}

.recipient-chips {
  font-size: 12px;
  color: var(--text-subtle);
}

.card-actions-mini {
  display: flex;
  align-items: center;
  gap: 4px;
}

.card-body-content {
  padding: 20px;
  font-size: 14.5px;
  line-height: 1.7;
  color: var(--text-secondary);
  word-break: break-word;
}

.card-body-content a {
  color: var(--primary);
  text-decoration: underline;
}

/* Security proof badges */
.security-verification-banner {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-subtle);
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  margin: 0 20px 16px;
  font-size: 11px;
}

.sec-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 7px;
  border-radius: var(--radius-full);
  font-weight: 600;
}

.sec-badge-pass {
  background: var(--success-light);
  color: var(--success);
  border: 1px solid var(--success-border);
}

/* =========================================================================
   OUTLOOK INLINE REPLY & FORWARD BOX
   ========================================================================= */

.inline-reply-container {
  margin-top: 20px;
  background: #ffffff;
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.reply-tabs-bar {
  display: flex;
  align-items: center;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border-subtle);
  padding: 4px 8px;
}

.reply-tab {
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 700;
  border: none;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  border-radius: var(--radius-sm);
}

.reply-tab.active {
  background: #ffffff;
  color: var(--primary);
  box-shadow: var(--shadow-xs);
}

.inline-reply-fields {
  padding: 8px 16px;
  border-bottom: 1px solid var(--border-light);
  font-size: 13px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 8px;
}

.inline-reply-editor {
  width: 100%;
  min-height: 120px;
  padding: 16px;
  border: none;
  outline: none;
  font-family: inherit;
  font-size: 14px;
  line-height: 1.6;
  color: var(--text-primary);
  resize: vertical;
}

/* Rich Text Formatting Bar */
.rich-text-toolbar {
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 6px 16px;
  background: #ffffff;
  border-top: 1px solid var(--border-light);
}

.fmt-btn {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius-xs);
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.1s ease;
}

.fmt-btn:hover {
  background: var(--bg-hover);
  border-color: var(--border-subtle);
  color: var(--text-primary);
}

.inline-reply-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  background: var(--bg-secondary);
  border-top: 1px solid var(--border-subtle);
}

/* =========================================================================
   COMPOSE MODAL (OUTLOOK NEW MAIL POPUP)
   ========================================================================= */

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.4);
  backdrop-filter: blur(2px);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  animation: fadeIn 0.15s ease;
}

.compose-window {
  width: 100%;
  max-width: 720px;
  background: #ffffff;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xl);
  border: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  max-height: 92vh;
}

.compose-header {
  padding: 12px 18px;
  background: #ffffff;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

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

.compose-close-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
  border-radius: var(--radius-sm);
}

.compose-close-btn:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.compose-field {
  display: flex;
  align-items: center;
  padding: 6px 18px;
  border-bottom: 1px solid var(--border-light);
}

.compose-field-label {
  width: 50px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
}

.compose-input {
  flex: 1;
  border: none;
  outline: none;
  font-size: 14px;
  font-family: inherit;
  color: var(--text-primary);
  padding: 4px 0;
}

.compose-editor-area {
  flex: 1;
  padding: 16px 18px;
  min-height: 220px;
  border: none;
  outline: none;
  font-size: 14px;
  font-family: inherit;
  line-height: 1.6;
  color: var(--text-primary);
  resize: vertical;
}

.compose-toolbar {
  padding: 10px 18px;
  background: var(--bg-secondary);
  border-top: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* Alert Notification Banner in Compose & Reading */
.alert-banner {
  padding: 10px 16px;
  margin: 12px 18px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  line-height: 1.5;
}

.alert-warning {
  background: var(--warning-light);
  border: 1px solid var(--warning-border);
  color: #92400e;
}

.alert-error {
  background: var(--danger-light);
  border: 1px solid var(--danger-border);
  color: var(--danger);
}

.alert-info {
  background: var(--primary-light);
  border: 1px solid var(--primary-border);
  color: var(--primary);
}

/* =========================================================================
   SUPERADMIN & RELAY MANAGER
   ========================================================================= */

.admin-container {
  flex: 1;
  background: var(--bg-secondary);
  padding: 24px 32px;
  overflow-y: auto;
}

.admin-header-card {
  background: #ffffff;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 20px 24px;
  margin-bottom: 20px;
  box-shadow: var(--shadow-xs);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.admin-header-title h2 {
  font-size: 20px;
  font-weight: 800;
  color: var(--text-primary);
  letter-spacing: -0.4px;
}

.admin-header-title p {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 2px;
}

.grid-metrics {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 14px;
  margin-bottom: 20px;
}

.metric-card {
  background: #ffffff;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 16px 18px;
  box-shadow: var(--shadow-xs);
}

.metric-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.4px;
  margin-bottom: 4px;
}

.metric-value {
  font-size: 22px;
  font-weight: 800;
  color: var(--text-primary);
  line-height: 1.2;
}

.metric-sub {
  font-size: 11px;
  color: var(--success);
  font-weight: 600;
  margin-top: 4px;
  display: flex;
  align-items: center;
  gap: 4px;
}

.admin-tabs {
  display: flex;
  gap: 6px;
  margin-bottom: 18px;
  border-bottom: 1px solid var(--border-subtle);
  padding-bottom: 8px;
}

.admin-tab-btn {
  padding: 7px 14px;
  border: 1px solid transparent;
  background: transparent;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 700;
  font-family: inherit;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.15s ease;
}

.admin-tab-btn:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.8);
}

.admin-tab-btn.active {
  background: #ffffff;
  color: var(--primary);
  border-color: var(--border-subtle);
  box-shadow: var(--shadow-xs);
}

.dns-card {
  background: #ffffff;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow-xs);
  margin-bottom: 20px;
}

.dns-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  margin-top: 14px;
}

.dns-table th {
  text-align: left;
  padding: 10px 12px;
  background: var(--bg-secondary);
  color: var(--text-muted);
  font-weight: 700;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 1px solid var(--border-subtle);
}

.dns-table td {
  padding: 12px;
  border-bottom: 1px solid var(--border-light);
  vertical-align: top;
}

.code-cell {
  font-family: var(--font-mono);
  font-size: 11.5px;
  background: var(--bg-secondary);
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
  word-break: break-all;
  display: inline-block;
}

.btn-copy {
  padding: 3px 7px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
  background: #ffffff;
  color: var(--text-secondary);
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  margin-left: 6px;
  transition: all 0.12s ease;
}

.btn-copy:hover {
  background: var(--primary-light);
  color: var(--primary);
}

.users-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.users-table th {
  text-align: left;
  padding: 10px 12px;
  background: var(--bg-secondary);
  color: var(--text-muted);
  font-weight: 700;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 1px solid var(--border-subtle);
}

.users-table td {
  padding: 12px;
  border-bottom: 1px solid var(--border-light);
  vertical-align: middle;
}

/* =========================================================================
   COLLABORATION (CALENDAR, TASKS, NOTES, CONTACTS)
   ========================================================================= */

.collab-container {
  flex: 1;
  background: #ffffff;
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow-y: auto;
  padding: 24px 32px;
}

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

.collab-title h2 {
  font-size: 20px;
  font-weight: 800;
  color: var(--text-primary);
  letter-spacing: -0.4px;
}

.collab-title p {
  font-size: 13px;
  color: var(--text-muted);
}

.kanban-board {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px;
  flex: 1;
}

.kanban-col {
  background: var(--bg-secondary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 14px;
  display: flex;
  flex-direction: column;
}

.kanban-col-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
  font-size: 13px;
  font-weight: 700;
  color: var(--text-primary);
}

.kanban-card {
  background: #ffffff;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 12px;
  margin-bottom: 10px;
  box-shadow: var(--shadow-xs);
  cursor: pointer;
  transition: all 0.15s ease;
}

.kanban-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}

.kanban-priority {
  font-size: 10px;
  font-weight: 700;
  padding: 1px 5px;
  border-radius: var(--radius-sm);
  text-transform: uppercase;
}

.priority-high { background: var(--danger-light); color: var(--danger); border: 1px solid var(--danger-border); }
.priority-medium { background: var(--warning-light); color: var(--warning); border: 1px solid var(--warning-border); }
.priority-low { background: #f0f9ff; color: #0284c7; border: 1px solid #bae6fd; }

.notes-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 18px;
}

.note-card {
  background: #ffffff;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 18px;
  box-shadow: var(--shadow-xs);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 160px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.note-card:hover {
  box-shadow: var(--shadow-md);
}

.note-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 6px;
}

.note-snippet {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.5;
  white-space: pre-line;
}

.contacts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}

.contact-card {
  background: #ffffff;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 16px;
  box-shadow: var(--shadow-xs);
  display: flex;
  align-items: center;
  gap: 14px;
  transition: all 0.15s ease;
}

.contact-card:hover {
  box-shadow: var(--shadow-md);
}

.contact-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--primary-light);
  color: var(--primary);
  font-weight: 800;
  font-size: 15px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Toast Notifications */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  background: #ffffff;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 12px 18px;
  box-shadow: var(--shadow-lg);
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 10px;
  animation: slideIn 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes slideIn {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

.toast-success { border-left: 4px solid var(--success); }
.toast-error { border-left: 4px solid var(--danger); }
.toast-warning { border-left: 4px solid var(--warning); }
.toast-info { border-left: 4px solid var(--primary); }

.toast-action-btn {
  background: transparent;
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-xs);
  color: var(--primary);
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  cursor: pointer;
  margin-left: 8px;
}

/* Attachment Chips & Previews */
.attachment-cards-container {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--border-light);
}

.attachment-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: #f8fafc;
  border: 1px solid var(--border-subtle);
  border-radius: 6px;
  text-decoration: none;
  color: var(--text-primary);
  font-size: 12px;
  transition: all 0.15s ease;
}

.attachment-chip:hover {
  background: #f1f5f9;
  border-color: var(--border-medium);
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.att-name {
  font-weight: 600;
  color: var(--text-primary);
  max-width: 180px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.att-size {
  font-size: 10.5px;
  color: var(--text-muted);
}

.att-download-icon {
  font-size: 12px;
  color: var(--primary);
  margin-left: 4px;
}

.compose-toggles {
  display: flex;
  gap: 4px;
  margin-left: auto;
}

.compose-toggle-btn {
  background: transparent;
  border: none;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 4px;
  transition: all 0.12s ease;
}

.compose-toggle-btn:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.compose-toggle-btn.active {
  color: var(--primary);
  background: #eff6ff;
}

.compose-attachment-preview {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 6px 16px;
  background: #f8fafc;
  border-bottom: 1px solid var(--border-light);
}

.compose-att-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 8px;
  background: #ffffff;
  border: 1px solid var(--border-subtle);
  border-radius: 4px;
  font-size: 11.5px;
  color: var(--text-primary);
}

.compose-att-remove {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 13px;
  padding: 0 2px;
}

.compose-att-remove:hover {
  color: var(--danger);
}

/* =========================================================================
   RESTRUCTURED UNIFIED LAYOUT & COLLAPSIBLE SIDEBAR
   ========================================================================= */

.app-layout {
  display: flex;
  height: 100vh;
  width: 100vw;
  background: #ffffff;
  overflow: hidden;
}

/* Unified Left Sidebar */
.left-nav-sidebar {
  width: 240px;
  min-width: 240px;
  background: #ffffff;
  border-right: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  height: 100vh;
  z-index: 70;
  transition: width 0.22s cubic-bezier(0.16, 1, 0.3, 1), min-width 0.22s cubic-bezier(0.16, 1, 0.3, 1);
  overflow-x: hidden;
  overflow-y: auto;
}

.app-layout.sidebar-collapsed .left-nav-sidebar {
  width: 68px;
  min-width: 68px;
}

/* Top Header of Left Menu */
.sidebar-header {
  height: 56px;
  min-height: 56px;
  border-bottom: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  padding: 0 14px;
}

.sidebar-brand-expanded {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
}

.brand-text {
  font-size: 20px;
  font-weight: 800;
  letter-spacing: -0.6px;
  color: #0f172a;
  background: linear-gradient(135deg, #0f172a 0%, #2563eb 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.sidebar-toggle-btn {
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  cursor: pointer;
  padding: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
}

.sidebar-toggle-btn:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
  border-color: var(--border-subtle);
}

.sidebar-brand-icon-only {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, #2563eb, #1d4ed8);
  border: none;
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  margin: 0 auto;
  box-shadow: 0 2px 5px rgba(37, 99, 235, 0.25);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.sidebar-brand-icon-only:hover {
  transform: scale(1.06);
  box-shadow: 0 4px 8px rgba(37, 99, 235, 0.35);
}

/* App Nav Section */
.nav-section-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-subtle);
  padding: 12px 14px 4px;
  white-space: nowrap;
}

.app-layout.sidebar-collapsed .nav-section-title {
  display: none;
}

.app-nav-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 6px 8px;
}

.app-nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-size: 13.5px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.12s ease;
  position: relative;
  white-space: nowrap;
}

.app-layout.sidebar-collapsed .app-nav-item {
  justify-content: center;
  padding: 10px 0;
}

.app-nav-item:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.app-nav-item.active {
  background: #eff6ff;
  color: var(--primary);
  font-weight: 700;
}

.app-layout.sidebar-collapsed .app-nav-item.active {
  background: #eff6ff;
}

.app-nav-item .nav-badge {
  margin-left: auto;
  background: var(--primary);
  color: #ffffff;
  font-size: 11px;
  font-weight: 700;
  padding: 1px 7px;
  border-radius: var(--radius-full);
}

.app-layout.sidebar-collapsed .app-nav-item .nav-badge {
  position: absolute;
  top: 4px;
  right: 10px;
  width: 8px;
  height: 8px;
  padding: 0;
  border-radius: 50%;
  text-indent: -9999px;
  margin-left: 0;
}

.sidebar-divider {
  height: 1px;
  background: var(--border-light);
  margin: 8px 12px;
}

/* Compose Buttons */
.sidebar-compose-wrapper {
  padding: 8px 12px;
}

.app-layout.sidebar-collapsed .sidebar-compose-wrapper {
  padding: 8px 0;
  display: flex;
  justify-content: center;
}

.btn-compose-expanded {
  width: 100%;
  padding: 10px 16px;
  background: var(--primary);
  color: #ffffff;
  border: none;
  border-radius: var(--radius-md);
  font-size: 13.5px;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  box-shadow: 0 2px 4px rgba(37, 99, 235, 0.2);
  transition: all 0.15s ease;
}

.btn-compose-expanded:hover {
  background: var(--primary-hover);
  box-shadow: 0 4px 8px rgba(37, 99, 235, 0.3);
  transform: translateY(-1px);
}

.btn-compose-collapsed {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: var(--primary);
  color: #ffffff;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 2px 5px rgba(37, 99, 235, 0.25);
  transition: all 0.15s ease;
}

.btn-compose-collapsed:hover {
  background: var(--primary-hover);
  transform: scale(1.08);
}

/* Sidebar Mail Folders */
.sidebar-folder-list {
  list-style: none;
  padding: 4px 8px;
}

.folder-nav-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  cursor: pointer;
  margin-bottom: 2px;
  border: 1.5px dashed transparent;
  transition: all 0.12s ease;
  white-space: nowrap;
}

.app-layout.sidebar-collapsed .folder-nav-item {
  justify-content: center;
  padding: 9px 0;
}

.folder-nav-item:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.folder-nav-item.active {
  background: var(--primary-light);
  color: var(--primary);
  font-weight: 700;
}

.folder-nav-item.drag-over {
  background: #eff6ff !important;
  border-color: var(--primary) !important;
  color: var(--primary) !important;
  transform: scale(1.02);
}

.folder-nav-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.folder-more-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  font-size: 12.5px;
  font-weight: 700;
  color: var(--text-muted);
  cursor: pointer;
  margin-bottom: 2px;
  transition: all 0.12s ease;
  user-select: none;
}

.app-layout.sidebar-collapsed .folder-more-toggle {
  justify-content: center;
  padding: 8px 0;
}

.folder-more-toggle:hover {
  background: var(--bg-hover);
  color: var(--primary);
}

.chevron-more {
  display: inline-flex;
  align-items: center;
  transition: transform 0.2s ease;
}

.chevron-more.open {
  transform: rotate(90deg);
}

.collapsible-folders-panel {
  padding-left: 6px;
  border-left: 2px solid var(--border-light);
  margin-left: 10px;
  margin-bottom: 6px;
}

.app-layout.sidebar-collapsed .collapsible-folders-panel {
  padding-left: 0;
  border-left: none;
  margin-left: 0;
}

.folder-nav-item.sub-item {
  font-size: 12.5px;
  padding: 6px 10px;
}

.app-layout.sidebar-collapsed .folder-nav-item.sub-item {
  padding: 8px 0;
}

.btn-empty-trash-mini {
  background: #fee2e2;
  border: 1px solid #fecaca;
  color: var(--danger);
  font-size: 10px;
  font-weight: 700;
  padding: 1px 5px;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.12s ease;
}

.btn-empty-trash-mini:hover {
  background: var(--danger);
  color: #ffffff;
}

/* Sidebar Footer */
.sidebar-footer {
  margin-top: auto;
  padding: 12px 10px;
  border-top: 1px solid var(--border-light);
  background: #ffffff;
}

.storage-mini-card {
  margin-bottom: 10px;
  padding: 8px 10px;
  background: var(--bg-secondary);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
}

.storage-mini-header {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  margin-bottom: 5px;
}

.storage-mini-bar {
  height: 4px;
  background: #e2e8f0;
  border-radius: 2px;
  overflow: hidden;
}

.storage-mini-fill {
  height: 100%;
  background: var(--primary);
  border-radius: 2px;
}

.sidebar-user-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 8px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.12s ease;
}

.app-layout.sidebar-collapsed .sidebar-user-card {
  justify-content: center;
  padding: 6px 0;
}

.sidebar-user-card:hover {
  background: var(--bg-hover);
}

.user-avatar-sm {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, #2563eb, #1d4ed8);
  color: #ffffff;
  font-size: 12px;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.user-info-sm {
  overflow: hidden;
}

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

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

/* =========================================================================
   MAIN VIEWPORT & TOP HEADER
   ========================================================================= */

.app-main-viewport {
  flex: 1;
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
  background: #ffffff;
}

.app-top-header {
  height: 54px;
  min-height: 54px;
  background: #ffffff;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 18px;
  z-index: 50;
}

.top-search-wrapper {
  position: relative;
  width: 440px;
}

.top-search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-subtle);
  pointer-events: none;
}

.top-search-input {
  width: 100%;
  padding: 7px 14px 7px 34px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-full);
  font-size: 13px;
  font-family: inherit;
  color: var(--text-primary);
  transition: all 0.15s ease;
}

.top-search-input:focus {
  outline: none;
  background: #ffffff;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.top-header-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.status-pulse-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #10b981;
  box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7);
  animation: pulseGreen 2s infinite;
}

@keyframes pulseGreen {
  0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7); }
  70% { transform: scale(1); box-shadow: 0 0 0 6px rgba(16, 185, 129, 0); }
  100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

.btn-shortcuts-badge {
  background: #ffffff;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 11.5px;
  font-weight: 600;
  padding: 4px 8px;
  cursor: pointer;
  transition: all 0.12s ease;
}

.btn-shortcuts-badge:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
  border-color: var(--border-medium);
}

.btn-empty-trash-top {
  background: #fee2e2;
  border: 1px solid #fecaca;
  color: var(--danger);
  font-size: 12px;
  font-weight: 700;
  padding: 5px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.12s ease;
}

.btn-empty-trash-top:hover {
  background: var(--danger);
  color: #ffffff;
}

/* =========================================================================
   BULK SELECTION RIBBON & LIST BAR
   ========================================================================= */

.bulk-ribbon-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #eff6ff;
  border-radius: var(--radius-sm);
  padding: 4px 10px;
  animation: fadeIn 0.15s ease;
}

.bulk-count-badge {
  background: var(--primary);
  color: #ffffff;
  font-size: 11px;
  font-weight: 800;
  padding: 2px 8px;
  border-radius: var(--radius-full);
}

.bulk-action-btn {
  background: #ffffff;
  border: 1px solid var(--primary-border);
  color: var(--primary);
  font-size: 12px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: var(--radius-xs);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  transition: all 0.12s ease;
}

.bulk-action-btn:hover {
  background: var(--primary);
  color: #ffffff;
}

.bulk-action-btn.btn-danger {
  border-color: var(--danger-border);
  color: var(--danger);
}

.bulk-action-btn.btn-danger:hover {
  background: var(--danger);
  color: #ffffff;
}

.master-select-wrapper {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  cursor: pointer;
  user-select: none;
}

/* =========================================================================
   FLOATING NEW EMAIL NOTIFICATION CARD
   ========================================================================= */

#new-mail-toast-container {
  position: fixed;
  top: 20px;
  right: 24px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 12px;
  pointer-events: none;
}

.new-mail-notification-card {
  pointer-events: auto;
  width: 380px;
  max-width: calc(100vw - 40px);
  background: #ffffff;
  border: 1px solid #bfdbfe;
  border-left: 5px solid var(--primary);
  border-radius: var(--radius-lg);
  box-shadow: 0 16px 36px -6px rgba(0, 0, 0, 0.14), 0 0 0 1px rgba(37, 99, 235, 0.08);
  padding: 16px;
  position: relative;
  overflow: hidden;
  animation: slideInNotif 0.35s cubic-bezier(0.16, 1, 0.3, 1);
  transition: transform 0.2s ease, opacity 0.2s ease;
}

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

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

.notif-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11.5px;
  font-weight: 700;
  color: var(--primary);
  background: #eff6ff;
  padding: 2px 8px;
  border-radius: var(--radius-full);
}

.pulse-dot-blue {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--primary);
  box-shadow: 0 0 0 0 rgba(37, 99, 235, 0.7);
  animation: pulseBlue 1.6s infinite;
}

@keyframes pulseBlue {
  0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(37, 99, 235, 0.7); }
  70% { transform: scale(1); box-shadow: 0 0 0 5px rgba(37, 99, 235, 0); }
  100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(37, 99, 235, 0); }
}

.notif-close-btn {
  background: transparent;
  border: none;
  font-size: 18px;
  color: var(--text-muted);
  cursor: pointer;
  line-height: 1;
  padding: 2px 6px;
  border-radius: var(--radius-xs);
}

.notif-close-btn:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.notif-body {
  display: flex;
  gap: 12px;
  cursor: pointer;
  margin-bottom: 12px;
}

.notif-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: linear-gradient(135deg, #3b82f6, #1d4ed8);
  color: #ffffff;
  font-weight: 800;
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 2px 6px rgba(37, 99, 235, 0.25);
}

.notif-details {
  flex: 1;
  overflow: hidden;
}

.notif-sender {
  font-size: 13.5px;
  font-weight: 800;
  color: var(--text-primary);
  margin-bottom: 2px;
}

.notif-subject {
  font-size: 13px;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.notif-preview {
  font-size: 12px;
  color: var(--text-muted);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  line-height: 1.4;
}

.notif-footer {
  display: flex;
  gap: 8px;
}

.notif-btn-open {
  flex: 1;
  padding: 6px 12px;
  background: var(--primary);
  color: #ffffff;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.12s ease;
}

.notif-btn-open:hover {
  background: var(--primary-hover);
}

.notif-btn-dismiss {
  padding: 6px 12px;
  background: #ffffff;
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.12s ease;
}

.notif-btn-dismiss:hover {
  background: var(--bg-hover);
}

.notif-progress-bar {
  position: absolute;
  bottom: 0;
  left: 0;
  height: 3px;
  background: var(--primary);
  animation: notifProgress 8s linear forwards;
}

@keyframes notifProgress {
  from { width: 100%; }
  to { width: 0%; }
}

/* Keyboard Shortcuts Modal Styling */
.shortcuts-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.shortcuts-table td {
  padding: 8px 10px;
  border-bottom: 1px solid var(--border-light);
}

.kbd-badge {
  display: inline-block;
  padding: 2px 7px;
  background: #f1f5f9;
  border: 1px solid #cbd5e1;
  border-radius: 4px;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  color: #0f172a;
  box-shadow: 0 1px 1px rgba(0,0,0,0.08);
}


