/* ===== RESET & BASE ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; overflow: hidden; }
body {
  font-family: 'Segoe UI', -apple-system, BlinkMacSystemFont, 'Helvetica Neue', Arial, sans-serif;
  font-size: 14px;
  color: #242424;
  background: #F5F5F5;
  line-height: 1.4;
  -webkit-font-smoothing: antialiased;
}
button { font-family: inherit; cursor: pointer; border: none; background: none; font-size: inherit; }
input, textarea, select { font-family: inherit; font-size: inherit; }
a { color: #5B5FC7; text-decoration: none; }
a:hover { text-decoration: underline; }

/* ===== CSS VARIABLES ===== */
:root {
  --teams-purple: #6264A7;
  --teams-action: #5B5FC7;
  --teams-action-hover: #4F52B2;
  --teams-action-pressed: #444791;
  --surface-primary: #FFFFFF;
  --surface-secondary: #FAF9F8;
  --surface-tertiary: #F5F5F5;
  --text-primary: #242424;
  --text-secondary: #616161;
  --text-disabled: #BDBDBD;
  --border-color: #E0E0E0;
  --border-subtle: #EDEBE9;
  --hover-bg: #F5F5F5;
  --selected-bg: #E8E8F5;
  --danger: #C4314B;
  --danger-hover: #A4262C;
  --success: #107C10;
  --warning: #FFB900;
  --info: #0078D4;
  --radius-sm: 4px;
  --radius-md: 6px;
  --radius-lg: 8px;
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.08);
  --shadow-md: 0 2px 8px rgba(0,0,0,0.12);
  --shadow-lg: 0 4px 16px rgba(0,0,0,0.14);
  --shadow-xl: 0 8px 32px rgba(0,0,0,0.18);
  --transition: 200ms ease;
  --rail-width: 68px;
  --rail-collapsed: 48px;
  --topbar-height: 48px;
}

/* ===== SCROLLBAR ===== */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #C8C6C4; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #A19F9D; }

/* ===== AUTH SCREENS ===== */
.auth-screen {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100vh;
  background: linear-gradient(135deg, #F0F0F8 0%, #E8E8F0 100%);
}
.auth-card {
  background: var(--surface-primary);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xl);
  width: 400px;
  max-width: 94vw;
  padding: 40px 36px 36px;
  animation: fadeUp 300ms ease;
}
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideInRight {
  from { transform: translateX(20px); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}
@keyframes pulse {
  0%, 100% { opacity: 0.4; }
  50% { opacity: 1; }
}
.auth-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}
.auth-logo svg { width: 36px; height: 36px; }
.auth-logo span { font-size: 22px; font-weight: 700; color: var(--teams-purple); letter-spacing: -0.3px; }
.auth-logo.rail-brand {
  flex-direction: column;
  align-items: center;
  gap: 2px;
  margin-bottom: 0;
}
.auth-logo.rail-brand svg { width: 28px; height: 28px; }
.auth-logo.rail-brand span { font-size: 9px; font-weight: 700; color: var(--teams-purple); letter-spacing: 0.5px; }
.auth-subtitle { color: var(--text-secondary); margin-bottom: 28px; font-size: 13px; }
.auth-toggle {
  display: flex;
  background: var(--surface-tertiary);
  border-radius: var(--radius-sm);
  padding: 2px;
  margin-bottom: 24px;
}
.auth-toggle button {
  flex: 1;
  padding: 8px 0;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  border-radius: 3px;
  transition: all var(--transition);
}
.auth-toggle button.active {
  background: var(--surface-primary);
  color: var(--text-primary);
  box-shadow: var(--shadow-sm);
}

/* ===== FORM CONTROLS ===== */
.form-group { margin-bottom: 18px; position: relative; }
.form-group label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 6px;
}
.input-wrap {
  position: relative;
  display: flex;
  align-items: center;
}
.input-wrap input {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  font-size: 14px;
  color: var(--text-primary);
  background: var(--surface-primary);
  transition: border-color var(--transition), box-shadow var(--transition);
  outline: none;
}
.input-wrap input:focus {
  border-color: var(--teams-action);
  box-shadow: 0 0 0 1px var(--teams-action);
}
.input-wrap input.error {
  border-color: var(--danger);
  box-shadow: 0 0 0 1px var(--danger);
}
.input-wrap .toggle-pw {
  position: absolute;
  right: 8px;
  color: var(--text-secondary);
  padding: 4px;
  display: flex;
  align-items: center;
}
/* select to match inputs */
.form-select {
  width: 100%;
  padding: 9px 36px 9px 12px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  font-size: 14px;
  color: var(--text-primary);
  background: var(--surface-primary);
  transition: border-color var(--transition), box-shadow var(--transition);
  outline: none;
  cursor: pointer;
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg width='12' height='12' viewBox='0 0 12 12' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M3 4.5l3 3 3-3' stroke='%23616161' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 12px;
}
.form-select:focus {
  border-color: var(--teams-action);
  box-shadow: 0 0 0 1px var(--teams-action);
}
.form-select:hover { border-color: #C8C6C4; }
/* textarea to match inputs */
.form-textarea {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  font-size: 14px;
  color: var(--text-primary);
  background: var(--surface-primary);
  transition: border-color var(--transition), box-shadow var(--transition);
  outline: none;
  resize: vertical;
  font-family: inherit;
  line-height: 1.5;
}
.form-textarea:focus {
  border-color: var(--teams-action);
  box-shadow: 0 0 0 1px var(--teams-action);
}
.form-textarea::placeholder { color: var(--text-disabled); }
.input-wrap .toggle-pw:hover { color: var(--text-primary); }
.form-error {
  font-size: 12px;
  color: var(--danger);
  margin-top: 4px;
  display: none;
}
.form-error.show { display: block; }

/* password strength */
.pw-strength { margin-top: 6px; display: flex; gap: 3px; align-items: center; }
.pw-strength .bar { height: 3px; flex: 1; background: var(--border-color); border-radius: 2px; transition: background var(--transition); }
.pw-strength .label { font-size: 11px; margin-left: 6px; font-weight: 600; }
.pw-strength.s1 .bar:nth-child(1) { background: var(--danger); }
.pw-strength.s1 .label { color: var(--danger); }
.pw-strength.s2 .bar:nth-child(1), .pw-strength.s2 .bar:nth-child(2) { background: var(--warning); }
.pw-strength.s2 .label { color: #986F0B; }
.pw-strength.s3 .bar:nth-child(1), .pw-strength.s3 .bar:nth-child(2), .pw-strength.s3 .bar:nth-child(3) { background: #0078D4; }
.pw-strength.s3 .label { color: #0078D4; }
.pw-strength.s4 .bar { background: var(--success); }
.pw-strength.s4 .label { color: var(--success); }

.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 100%;
  padding: 10px 20px;
  background: var(--teams-action);
  color: #fff;
  font-weight: 600;
  font-size: 14px;
  border-radius: var(--radius-sm);
  transition: background var(--transition);
}
.btn-primary:hover { background: var(--teams-action-hover); }
.btn-primary:active { background: var(--teams-action-pressed); }
.btn-outline {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 16px;
  background: var(--surface-primary);
  color: var(--text-primary);
  font-weight: 600;
  font-size: 13px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  transition: all var(--transition);
}
.btn-outline:hover { background: var(--hover-bg); border-color: #C8C6C4; }
.btn-danger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 16px;
  background: var(--danger);
  color: #fff;
  font-weight: 600;
  font-size: 13px;
  border-radius: var(--radius-sm);
  transition: background var(--transition);
}
.btn-danger:hover { background: var(--danger-hover); }
.btn-ghost {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 6px 10px;
  color: var(--text-secondary);
  font-size: 13px;
  border-radius: var(--radius-sm);
  transition: all var(--transition);
}
.btn-ghost:hover { background: var(--hover-bg); color: var(--text-primary); }
.btn-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  transition: all var(--transition);
}
.btn-icon:hover { background: var(--hover-bg); color: var(--text-primary); }
.btn-icon svg { width: 18px; height: 18px; }

/* ===== MFA SCREEN ===== */
.mfa-digits {
  display: flex;
  gap: 8px;
  justify-content: center;
  margin: 24px 0;
}
.mfa-digits input {
  width: 44px;
  height: 52px;
  text-align: center;
  font-size: 22px;
  font-weight: 700;
  border: 2px solid var(--border-color);
  border-radius: var(--radius-md);
  outline: none;
  transition: border-color var(--transition), box-shadow var(--transition);
  color: var(--text-primary);
}
.mfa-digits input:focus {
  border-color: var(--teams-action);
  box-shadow: 0 0 0 1px var(--teams-action);
}

/* ===== APP SHELL ===== */
.app-shell {
  display: none;
  height: 100vh;
  flex-direction: row;
}
.app-shell.active { display: flex; }

/* ===== LEFT RAIL ===== */
.left-rail {
  width: var(--rail-width);
  min-width: var(--rail-width);
  background: var(--surface-primary);
  border-right: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 12px 0;
  z-index: 10;
  transition: width var(--transition), min-width var(--transition);
}
.rail-logo {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  margin-bottom: 20px;
  cursor: default;
}
.rail-nav { flex: 1; display: flex; flex-direction: column; gap: 2px; width: 100%; padding: 0 6px; }
.rail-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  width: 100%;
  padding: 10px 4px 8px;
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition);
  position: relative;
  text-align: center;
}
.rail-item:hover { background: var(--hover-bg); color: var(--text-primary); }
.rail-item.active {
  background: var(--selected-bg);
  color: var(--teams-action);
}
.rail-item.active::before {
  content: '';
  position: absolute;
  left: -6px;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 20px;
  background: var(--teams-action);
  border-radius: 0 2px 2px 0;
}
.rail-item svg { width: 22px; height: 22px; }
.rail-item span { font-size: 10px; font-weight: 600; line-height: 1.1; }
.rail-badge {
  position: absolute;
  top: 4px;
  right: 8px;
  min-width: 18px;
  height: 18px;
  background: var(--danger);
  border-radius: 9px;
  border: 2px solid var(--surface-primary);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
}
.rail-badge.dot {
  min-width: 8px;
  height: 8px;
  padding: 0;
  top: 6px;
  right: 10px;
  background: var(--teams-action);
}
.rail-bottom { padding: 0 6px; width: 100%; }
.rail-avatar {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  width: 100%;
  padding: 8px 4px;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: background var(--transition);
}
.rail-avatar:hover { background: var(--hover-bg); }
.avatar-circle {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--teams-purple);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
  position: relative;
  flex-shrink: 0;
}
.avatar-circle .presence {
  position: absolute;
  bottom: -1px;
  right: -1px;
  width: 10px;
  height: 10px;
  background: var(--success);
  border-radius: 50%;
  border: 2px solid var(--surface-primary);
}
.rail-avatar span { font-size: 10px; color: var(--text-secondary); font-weight: 600; }

/* ===== MAIN CONTENT ===== */
.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--surface-secondary);
  position: relative;
}

/* ===== TOP COMMAND BAR ===== */
.topbar {
  height: var(--topbar-height);
  min-height: var(--topbar-height);
  background: var(--surface-primary);
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  padding: 0 20px;
  gap: 12px;
}
.topbar-title { font-size: 16px; font-weight: 700; color: var(--text-primary); white-space: nowrap; }
.topbar-search {
  flex: 1;
  max-width: 400px;
  position: relative;
}
.topbar-search input {
  width: 100%;
  padding: 7px 12px 7px 34px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  font-size: 13px;
  outline: none;
  background: var(--surface-tertiary);
  color: var(--text-primary);
  transition: all var(--transition);
}
.topbar-search input:focus {
  background: var(--surface-primary);
  border-color: var(--teams-action);
  box-shadow: 0 0 0 1px var(--teams-action);
}
.topbar-search input::placeholder { color: var(--text-disabled); }
.topbar-search svg {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  width: 16px;
  height: 16px;
  color: var(--text-secondary);
  pointer-events: none;
}
.topbar-actions { display: flex; align-items: center; gap: 4px; margin-left: auto; }

/* ===== PAGE BASE ===== */
.page { display: none; flex-direction: column; flex: 1; overflow: hidden; }
.page.active { display: flex; }
.page-body { flex: 1; overflow-y: auto; padding: 20px; }

/* ===== INBOX PAGE - SPLIT VIEW ===== */
.inbox-layout {
  flex: 1;
  display: flex;
  overflow: hidden;
}

/* Folder sidebar */
.folder-sidebar {
  width: 200px;
  min-width: 200px;
  background: var(--surface-primary);
  border-right: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  padding: 12px 0;
}
.folder-section-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-secondary);
  padding: 8px 16px 4px;
  margin-top: 8px;
}
.folder-section-title:first-child { margin-top: 0; }
.folder-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 16px;
  cursor: pointer;
  transition: all var(--transition);
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 500;
  position: relative;
}
.folder-item:hover { background: var(--hover-bg); color: var(--text-primary); }
.folder-item.active { background: var(--selected-bg); color: var(--teams-action); font-weight: 600; }
.folder-item svg { width: 18px; height: 18px; flex-shrink: 0; }
.folder-item .folder-name { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.folder-item .folder-count {
  font-size: 11px;
  font-weight: 700;
  color: var(--teams-action);
  background: var(--selected-bg);
  padding: 1px 6px;
  border-radius: 10px;
  min-width: 20px;
  text-align: center;
}
.folder-item.active .folder-count { background: rgba(91,95,199,0.2); }
.folder-divider {
  height: 1px;
  background: var(--border-subtle);
  margin: 8px 16px;
}
.provider-label {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 16px 2px;
  font-size: 11px;
  color: var(--text-disabled);
}
.provider-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}
.provider-dot.google { background: #4285F4; }
.provider-dot.microsoft { background: #F25022; }

/* Thread list */
.thread-list-pane {
  width: 380px;
  min-width: 320px;
  background: var(--surface-secondary);
  border-right: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.thread-list-header {
  padding: 12px 16px;
  display: flex;
  align-items: center;
  gap: 8px;
  border-bottom: 1px solid var(--border-subtle);
  background: var(--surface-primary);
}
.thread-list-header .folder-label { font-weight: 700; font-size: 15px; flex: 1; }
.thread-list-filter {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 8px 16px;
  border-bottom: 1px solid var(--border-subtle);
  background: var(--surface-primary);
}
.thread-filter-btn {
  padding: 4px 12px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  border-radius: 12px;
  transition: all var(--transition);
  border: 1px solid transparent;
}
.thread-filter-btn:hover { background: var(--hover-bg); }
.thread-filter-btn.active { background: var(--selected-bg); color: var(--teams-action); border-color: rgba(91,95,199,0.3); }
.thread-list-scroll {
  flex: 1;
  overflow-y: auto;
}
.thread-item {
  display: flex;
  gap: 12px;
  padding: 12px 16px;
  cursor: pointer;
  transition: background var(--transition);
  border-bottom: 1px solid var(--border-subtle);
  position: relative;
}
.thread-item:hover { background: var(--hover-bg); }
.thread-item.active { background: var(--selected-bg); }
.thread-item.unread .thread-sender { font-weight: 700; color: var(--text-primary); }
.thread-item.unread .thread-preview { color: var(--text-primary); }
.thread-item.unread::before {
  content: '';
  position: absolute;
  left: 4px;
  top: 50%;
  transform: translateY(-50%);
  width: 6px;
  height: 6px;
  background: var(--teams-action);
  border-radius: 50%;
}
.thread-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
}
.thread-body { flex: 1; min-width: 0; }
.thread-top { display: flex; align-items: baseline; gap: 8px; margin-bottom: 2px; }
.thread-sender { font-size: 13px; font-weight: 600; color: var(--text-primary); flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.thread-time { font-size: 11px; color: var(--text-secondary); white-space: nowrap; flex-shrink: 0; }
.thread-subject { font-size: 13px; color: var(--text-primary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-bottom: 2px; }
.thread-preview { font-size: 12px; color: var(--text-secondary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.thread-meta { display: flex; align-items: center; gap: 6px; margin-top: 4px; }
.thread-tag {
  font-size: 10px;
  font-weight: 600;
  padding: 1px 6px;
  border-radius: 3px;
}
.thread-tag.google { background: #E8F0FE; color: #1A73E8; }
.thread-tag.microsoft { background: #FFF4E5; color: #D83B01; }
.thread-attachment-indicator {
  display: flex;
  align-items: center;
  color: var(--text-secondary);
}
.thread-attachment-indicator svg { width: 12px; height: 12px; }
.thread-count {
  font-size: 10px;
  font-weight: 700;
  color: var(--text-secondary);
  background: var(--surface-tertiary);
  padding: 1px 5px;
  border-radius: 3px;
}

/* Reading pane */
.reading-pane {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--surface-primary);
}
.reading-pane-empty {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: var(--text-disabled);
  gap: 12px;
}
.reading-pane-empty svg { width: 64px; height: 64px; opacity: 0.4; }
.reading-pane-empty p { font-size: 14px; }
.email-header {
  padding: 20px 24px 16px;
  border-bottom: 1px solid var(--border-subtle);
}
.email-subject { font-size: 20px; font-weight: 700; color: var(--text-primary); margin-bottom: 16px; line-height: 1.3; }
.email-participants {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}
.email-sender-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
}
.email-sender-info { flex: 1; min-width: 0; }
.email-sender-name { font-weight: 700; font-size: 14px; }
.email-sender-address { font-size: 12px; color: var(--text-secondary); }
.email-recipients { font-size: 12px; color: var(--text-secondary); margin-top: 2px; }
.email-date { font-size: 12px; color: var(--text-secondary); white-space: nowrap; flex-shrink: 0; margin-top: 2px; }
.email-actions-bar {
  display: flex;
  gap: 4px;
  margin-top: 12px;
}
.email-body-wrap {
  flex: 1;
  overflow-y: auto;
  padding: 24px;
}
.email-body {
  font-size: 14px;
  line-height: 1.7;
  color: var(--text-primary);
  max-width: 720px;
}
.email-body p { margin-bottom: 12px; }
.email-body .signature {
  margin-top: 24px;
  padding-top: 16px;
  border-top: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  font-size: 13px;
}
.email-attachments {
  padding: 12px 24px 16px;
  border-top: 1px solid var(--border-subtle);
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.email-attachment {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: var(--surface-tertiary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--transition);
  font-size: 13px;
}
.email-attachment:hover { background: var(--hover-bg); border-color: var(--border-color); }
.email-attachment svg { width: 18px; height: 18px; color: var(--text-secondary); }
.email-attachment .att-name { font-weight: 600; }
.email-attachment .att-size { color: var(--text-secondary); font-size: 11px; }
.email-quick-reply {
  padding: 12px 24px 16px;
  border-top: 1px solid var(--border-subtle);
  background: var(--surface-secondary);
}
.quick-reply-input {
  display: flex;
  gap: 8px;
  align-items: flex-end;
}
.quick-reply-input textarea {
  flex: 1;
  padding: 10px 14px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  resize: none;
  font-size: 13px;
  outline: none;
  min-height: 40px;
  max-height: 120px;
  background: var(--surface-primary);
  transition: border-color var(--transition);
}
.quick-reply-input textarea:focus {
  border-color: var(--teams-action);
}
.quick-reply-input textarea::placeholder { color: var(--text-disabled); }

/* ===== CHAT PAGE ===== */
.chat-layout {
  flex: 1;
  display: flex;
  overflow: hidden;
}
.chat-list-pane {
  width: 300px;
  min-width: 260px;
  background: var(--surface-primary);
  border-right: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.chat-list-header {
  padding: 12px 16px;
  display: flex;
  align-items: center;
  gap: 8px;
  border-bottom: 1px solid var(--border-subtle);
}
.chat-list-header h3 { flex: 1; font-size: 15px; font-weight: 700; }
.chat-search {
  padding: 8px 12px;
  border-bottom: 1px solid var(--border-subtle);
}
.chat-search input {
  width: 100%;
  padding: 7px 12px 7px 32px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  font-size: 13px;
  outline: none;
  background: var(--surface-tertiary);
  transition: all var(--transition);
}
.chat-search input:focus { background: var(--surface-primary); border-color: var(--teams-action); }
.chat-search { position: relative; }
.chat-search svg {
  position: absolute;
  left: 22px;
  top: 50%;
  transform: translateY(-50%);
  width: 14px;
  height: 14px;
  color: var(--text-secondary);
  pointer-events: none;
}
.chat-list-scroll { flex: 1; overflow-y: auto; }
.chat-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  cursor: pointer;
  transition: background var(--transition);
  border-bottom: 1px solid transparent;
}
.chat-item:hover { background: var(--hover-bg); }
.chat-item.active { background: var(--selected-bg); }
.chat-item .avatar-circle { width: 36px; height: 36px; font-size: 13px; }
.chat-item-body { flex: 1; min-width: 0; }
.chat-item-top { display: flex; align-items: baseline; gap: 8px; }
.chat-item-name { font-size: 13px; font-weight: 600; flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-item-time { font-size: 11px; color: var(--text-secondary); flex-shrink: 0; }
.chat-item-preview { font-size: 12px; color: var(--text-secondary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-item.unread .chat-item-name { font-weight: 700; }
.chat-item.unread .chat-item-preview { color: var(--text-primary); }
.chat-unread-badge {
  width: 8px;
  height: 8px;
  background: var(--teams-action);
  border-radius: 50%;
  flex-shrink: 0;
}

/* Chat message area */
.chat-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--surface-secondary);
}
.chat-header {
  padding: 12px 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--surface-primary);
  border-bottom: 1px solid var(--border-subtle);
  min-height: 56px;
}
.chat-header-info { flex: 1; }
.chat-header-info h3 { font-size: 15px; font-weight: 700; }
.chat-header-info p { font-size: 12px; color: var(--text-secondary); }
.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.chat-date-divider {
  text-align: center;
  font-size: 12px;
  color: var(--text-secondary);
  padding: 8px 0;
  position: relative;
}
.chat-date-divider::before,
.chat-date-divider::after {
  content: '';
  position: absolute;
  top: 50%;
  width: calc(50% - 60px);
  height: 1px;
  background: var(--border-subtle);
}
.chat-date-divider::before { left: 0; }
.chat-date-divider::after { right: 0; }
.chat-msg {
  display: flex;
  gap: 10px;
  max-width: 75%;
  animation: fadeUp 200ms ease;
}
.chat-msg.sent { align-self: flex-end; flex-direction: row-reverse; }
.chat-msg .msg-avatar { width: 28px; height: 28px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 700; color: #fff; flex-shrink: 0; margin-top: 4px; }
.chat-msg .msg-bubble {
  padding: 10px 14px;
  border-radius: 12px 12px 12px 4px;
  background: var(--surface-primary);
  box-shadow: var(--shadow-sm);
  font-size: 13px;
  line-height: 1.5;
  position: relative;
}
.chat-msg.sent .msg-bubble {
  background: var(--teams-action);
  color: #fff;
  border-radius: 12px 12px 4px 12px;
}
.chat-msg .msg-sender { font-size: 12px; font-weight: 700; margin-bottom: 2px; color: var(--text-primary); }
.chat-msg.sent .msg-sender { color: rgba(255,255,255,0.85); }
.chat-msg .msg-time { font-size: 10px; color: var(--text-disabled); margin-top: 4px; }
.chat-msg.sent .msg-time { color: rgba(255,255,255,0.6); }
.chat-msg .msg-reactions {
  display: flex;
  gap: 4px;
  margin-top: 6px;
}
.chat-msg .msg-reaction {
  font-size: 12px;
  padding: 2px 6px;
  background: var(--surface-tertiary);
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  cursor: pointer;
  transition: all var(--transition);
}
.chat-msg .msg-reaction:hover { background: var(--hover-bg); border-color: var(--border-color); }
.chat-input-area {
  padding: 12px 20px 16px;
  background: var(--surface-primary);
  border-top: 1px solid var(--border-subtle);
}
.chat-input-wrap {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  background: var(--surface-tertiary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 8px 12px;
  transition: border-color var(--transition);
}
.chat-input-wrap:focus-within { border-color: var(--teams-action); background: var(--surface-primary); }
.chat-input-wrap textarea {
  flex: 1;
  border: none;
  background: transparent;
  resize: none;
  outline: none;
  font-size: 13px;
  min-height: 22px;
  max-height: 120px;
  line-height: 1.5;
}
.chat-input-wrap textarea::placeholder { color: var(--text-disabled); }
.chat-input-tools { display: flex; gap: 2px; }
.typing-indicator {
  font-size: 12px;
  color: var(--text-secondary);
  padding: 4px 0 0;
  min-height: 20px;
}
.typing-dots {
  display: inline-flex;
  gap: 3px;
  margin-left: 4px;
  vertical-align: middle;
}
.typing-dots span {
  width: 4px;
  height: 4px;
  background: var(--text-secondary);
  border-radius: 50%;
  animation: pulse 1.2s ease infinite;
}
.typing-dots span:nth-child(2) { animation-delay: 0.2s; }
.typing-dots span:nth-child(3) { animation-delay: 0.4s; }

/* Chat empty state */
.chat-empty {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: var(--text-disabled);
  gap: 12px;
}
.chat-empty svg { width: 64px; height: 64px; opacity: 0.4; }

/* ===== SEARCH PAGE ===== */
.search-page-content { max-width: 800px; margin: 0 auto; width: 100%; }
.search-hero {
  text-align: center;
  padding: 40px 0 30px;
}
.search-hero h2 { font-size: 24px; font-weight: 700; margin-bottom: 8px; }
.search-hero p { color: var(--text-secondary); font-size: 14px; }
.search-big-input {
  position: relative;
  margin-bottom: 20px;
}
.search-big-input input {
  width: 100%;
  padding: 14px 20px 14px 48px;
  border: 2px solid var(--border-color);
  border-radius: var(--radius-lg);
  font-size: 16px;
  outline: none;
  background: var(--surface-primary);
  transition: all var(--transition);
  box-shadow: var(--shadow-sm);
}
.search-big-input input:focus {
  border-color: var(--teams-action);
  box-shadow: 0 0 0 3px rgba(91,95,199,0.15);
}
.search-big-input svg {
  position: absolute;
  left: 16px;
  top: 50%;
  transform: translateY(-50%);
  width: 20px;
  height: 20px;
  color: var(--text-secondary);
}
.search-filters {
  display: flex;
  gap: 8px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}
.search-filter-chip {
  padding: 6px 14px;
  border: 1px solid var(--border-color);
  border-radius: 20px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  background: var(--surface-primary);
  transition: all var(--transition);
  cursor: pointer;
}
.search-filter-chip:hover { border-color: var(--teams-action); color: var(--teams-action); }
.search-filter-chip.active { background: var(--teams-action); color: #fff; border-color: var(--teams-action); }
.search-results { display: flex; flex-direction: column; gap: 2px; }
.search-result-item {
  display: flex;
  gap: 14px;
  padding: 14px 16px;
  background: var(--surface-primary);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--transition);
}
.search-result-item:hover { background: var(--hover-bg); }
.search-result-icon {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.search-result-icon svg { width: 20px; height: 20px; }
.search-result-icon.email { background: #E8F0FE; color: #1A73E8; }
.search-result-icon.chat { background: #EDE8F5; color: var(--teams-purple); }
.search-result-body { flex: 1; min-width: 0; }
.search-result-title { font-weight: 600; font-size: 14px; margin-bottom: 2px; }
.search-result-title mark { background: #FFF3BF; border-radius: 2px; padding: 0 2px; }
.search-result-snippet { font-size: 12px; color: var(--text-secondary); line-height: 1.4; }
.search-result-snippet mark { background: #FFF3BF; border-radius: 2px; padding: 0 2px; }
.search-result-meta { font-size: 11px; color: var(--text-disabled); margin-top: 4px; display: flex; gap: 12px; }

/* ===== ACCOUNTS PAGE ===== */
.accounts-content { max-width: 700px; }
.account-card {
  background: var(--surface-primary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 20px;
  margin-bottom: 12px;
  transition: all var(--transition);
}
.account-card:hover { box-shadow: var(--shadow-sm); }
.account-card-header {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 16px;
}
.account-provider-icon {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  font-weight: 700;
  color: #fff;
}
.account-provider-icon.google { background: #4285F4; }
.account-provider-icon.microsoft { background: #F25022; }
.account-card-info { flex: 1; }
.account-card-info h4 { font-size: 15px; font-weight: 700; }
.account-card-info p { font-size: 13px; color: var(--text-secondary); }
.account-card-status { flex-shrink: 0; }
.account-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 16px;
}
.account-stat {
  padding: 10px 12px;
  background: var(--surface-tertiary);
  border-radius: var(--radius-md);
  text-align: center;
}
.account-stat .stat-val { font-size: 18px; font-weight: 700; color: var(--text-primary); }
.account-stat .stat-label { font-size: 11px; color: var(--text-secondary); margin-top: 2px; }
.account-card-actions {
  display: flex;
  gap: 8px;
  padding-top: 12px;
  border-top: 1px solid var(--border-subtle);
}
.sync-progress {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: var(--surface-tertiary);
  border-radius: var(--radius-md);
  margin-bottom: 12px;
}
.sync-progress .sync-bar { flex: 1; height: 4px; background: var(--border-color); border-radius: 2px; overflow: hidden; }
.sync-progress .sync-bar-fill { height: 100%; background: var(--teams-action); border-radius: 2px; transition: width 500ms ease; }
.sync-progress .sync-label { font-size: 12px; color: var(--text-secondary); white-space: nowrap; }
.add-account-card {
  background: var(--surface-primary);
  border: 2px dashed var(--border-color);
  border-radius: var(--radius-lg);
  padding: 32px;
  text-align: center;
  cursor: pointer;
  transition: all var(--transition);
}
.add-account-card:hover { border-color: var(--teams-action); background: #F5F5FA; }
.add-account-card svg { width: 40px; height: 40px; color: var(--text-disabled); margin-bottom: 8px; }
.add-account-card:hover svg { color: var(--teams-action); }
.add-account-card p { color: var(--text-secondary); font-size: 14px; }

/* ===== CALENDAR PAGE ===== */
.calendar-layout {
  flex: 1;
  display: flex;
  overflow: hidden;
}
.calendar-sidebar {
  width: 240px;
  min-width: 240px;
  background: var(--surface-primary);
  border-right: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  padding: 16px;
  overflow-y: auto;
}
.mini-cal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}
.mini-cal-header span { font-weight: 700; font-size: 14px; }
.mini-cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 2px;
  margin-bottom: 20px;
}
.mini-cal-grid .day-label {
  text-align: center;
  font-size: 10px;
  font-weight: 600;
  color: var(--text-secondary);
  padding: 4px 0;
}
.mini-cal-grid .day-cell {
  text-align: center;
  font-size: 12px;
  padding: 4px 0;
  border-radius: 50%;
  cursor: pointer;
  transition: all var(--transition);
  color: var(--text-primary);
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto;
}
.mini-cal-grid .day-cell:hover { background: var(--hover-bg); }
.mini-cal-grid .day-cell.today { background: var(--teams-action); color: #fff; font-weight: 700; }
.mini-cal-grid .day-cell.other-month { color: var(--text-disabled); }
.mini-cal-grid .day-cell.has-event::after {
  content: '';
  display: block;
  width: 4px;
  height: 4px;
  background: var(--teams-action);
  border-radius: 50%;
  position: absolute;
  bottom: 1px;
}
.mini-cal-grid .day-cell { position: relative; }
.mini-cal-grid .day-cell.today.has-event::after { background: #fff; }
.calendar-sidebar-section { margin-bottom: 16px; }
.calendar-sidebar-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-secondary);
  margin-bottom: 8px;
}
.calendar-toggle-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 0;
  font-size: 13px;
  cursor: pointer;
}
.calendar-toggle-item .cal-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}
.calendar-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.calendar-toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 20px;
  background: var(--surface-primary);
  border-bottom: 1px solid var(--border-subtle);
}
.calendar-toolbar .cal-title { font-size: 18px; font-weight: 700; flex: 1; }
.calendar-view-toggle {
  display: inline-flex;
  background: var(--surface-tertiary);
  border-radius: var(--radius-sm);
  padding: 2px;
}
.calendar-view-toggle button {
  padding: 5px 12px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  border-radius: 3px;
  transition: all var(--transition);
}
.calendar-view-toggle button.active {
  background: var(--surface-primary);
  color: var(--text-primary);
  box-shadow: var(--shadow-sm);
}
.week-grid {
  flex: 1;
  overflow-y: auto;
  display: grid;
  grid-template-columns: 60px repeat(7, 1fr);
  position: relative;
}
.week-header {
  display: contents;
}
.week-header-cell {
  text-align: center;
  padding: 10px 4px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  border-bottom: 1px solid var(--border-subtle);
  border-right: 1px solid var(--border-subtle);
  background: var(--surface-primary);
  position: sticky;
  top: 0;
  z-index: 2;
}
.week-header-cell .day-num {
  font-size: 20px;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.2;
}
.week-header-cell.today .day-num {
  background: var(--teams-action);
  color: #fff;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.time-gutter {
  font-size: 11px;
  color: var(--text-secondary);
  text-align: right;
  padding: 0 8px;
  position: relative;
  top: -7px;
  border-right: 1px solid var(--border-subtle);
}
.day-column {
  border-right: 1px solid var(--border-subtle);
  position: relative;
  min-height: 60px;
  border-bottom: 1px solid var(--border-subtle);
}
.cal-event {
  position: absolute;
  left: 2px;
  right: 2px;
  border-radius: var(--radius-sm);
  padding: 4px 6px;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  overflow: hidden;
  line-height: 1.3;
  transition: box-shadow var(--transition);
  z-index: 1;
}
.cal-event:hover { box-shadow: var(--shadow-md); }
.cal-event.purple { background: #EDE8F5; color: #5B2D90; border-left: 3px solid #6264A7; }
.cal-event.blue { background: #E5F0FA; color: #0054A6; border-left: 3px solid #0078D4; }
.cal-event.green { background: #E3F2E8; color: #0B6A0B; border-left: 3px solid #107C10; }
.cal-event.orange { background: #FFF4E5; color: #A4430A; border-left: 3px solid #D83B01; }
.cal-event.red { background: #FDE7E9; color: #9B2D30; border-left: 3px solid #C4314B; }
.cal-event .event-time { font-size: 10px; font-weight: 400; opacity: 0.8; }
.now-line {
  position: absolute;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--danger);
  z-index: 3;
}
.now-line::before {
  content: '';
  position: absolute;
  left: -4px;
  top: -3px;
  width: 8px;
  height: 8px;
  background: var(--danger);
  border-radius: 50%;
}

/* Event detail modal */
.event-detail-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  z-index: 200;
  align-items: center;
  justify-content: center;
  animation: fadeIn 150ms ease;
}
.event-detail-overlay.active { display: flex; }
.event-detail-card {
  background: var(--surface-primary);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xl);
  width: 480px;
  max-width: 94vw;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  animation: fadeUp 200ms ease;
  overflow: hidden;
}
.event-detail-banner {
  height: 8px;
  flex-shrink: 0;
}
.event-detail-banner.purple { background: #6264A7; }
.event-detail-banner.blue { background: #0078D4; }
.event-detail-banner.green { background: #107C10; }
.event-detail-banner.orange { background: #D83B01; }
.event-detail-banner.red { background: #C4314B; }
.event-detail-header {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 20px 24px 0;
}
.event-detail-header h3 { flex: 1; font-size: 20px; font-weight: 700; line-height: 1.3; }
.event-detail-header .actions { display: flex; gap: 2px; flex-shrink: 0; margin-top: -2px; }
.event-detail-body { flex: 1; overflow-y: auto; padding: 16px 24px 24px; }
.event-detail-row {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 10px 0;
}
.event-detail-row svg { width: 18px; height: 18px; color: var(--text-secondary); flex-shrink: 0; margin-top: 1px; }
.event-detail-row .edr-label { font-size: 12px; color: var(--text-secondary); margin-bottom: 2px; }
.event-detail-row .edr-value { font-size: 14px; color: var(--text-primary); }
.event-detail-row .edr-value a { color: var(--teams-action); }
.event-attendee-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 2px; }
.event-attendee-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px 4px 4px;
  background: var(--surface-tertiary);
  border-radius: 20px;
  font-size: 12px;
  font-weight: 500;
}
.event-attendee-chip .chip-avatar {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 9px;
  font-weight: 700;
  color: #fff;
}
.event-detail-footer {
  display: flex;
  gap: 8px;
  padding: 12px 24px 16px;
  border-top: 1px solid var(--border-subtle);
}
.event-detail-desc {
  font-size: 13px;
  line-height: 1.6;
  color: var(--text-primary);
  padding: 10px 14px;
  background: var(--surface-tertiary);
  border-radius: var(--radius-md);
  white-space: pre-wrap;
}

/* ===== CONTACTS PAGE ===== */
.contacts-layout {
  flex: 1;
  display: flex;
  overflow: hidden;
}
.contacts-list-pane {
  width: 320px;
  min-width: 280px;
  background: var(--surface-primary);
  border-right: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.contacts-list-header {
  padding: 12px 16px;
  display: flex;
  align-items: center;
  gap: 8px;
  border-bottom: 1px solid var(--border-subtle);
}
.contacts-list-header h3 { flex: 1; font-size: 15px; font-weight: 700; }
.contacts-search {
  padding: 8px 12px;
  border-bottom: 1px solid var(--border-subtle);
  position: relative;
}
.contacts-search input {
  width: 100%;
  padding: 7px 12px 7px 32px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  font-size: 13px;
  outline: none;
  background: var(--surface-tertiary);
  transition: all var(--transition);
}
.contacts-search input:focus { background: var(--surface-primary); border-color: var(--teams-action); }
.contacts-search svg {
  position: absolute;
  left: 22px;
  top: 50%;
  transform: translateY(-50%);
  width: 14px;
  height: 14px;
  color: var(--text-secondary);
  pointer-events: none;
}
.contacts-list-scroll { flex: 1; overflow-y: auto; }
.contact-group-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--teams-action);
  padding: 10px 16px 4px;
  background: var(--surface-secondary);
  position: sticky;
  top: 0;
  z-index: 1;
}
.contact-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  cursor: pointer;
  transition: background var(--transition);
}
.contact-item:hover { background: var(--hover-bg); }
.contact-item.active { background: var(--selected-bg); }
.contact-item .avatar-circle { width: 36px; height: 36px; font-size: 13px; }
.contact-item-info { flex: 1; min-width: 0; }
.contact-item-name { font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.contact-item-role { font-size: 11px; color: var(--text-secondary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.contact-item-presence {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}
.contact-item-presence.online { background: var(--success); }
.contact-item-presence.offline { background: var(--text-disabled); }
.contact-detail-pane {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--surface-secondary);
}
.contact-detail-empty {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: var(--text-disabled);
  gap: 12px;
}
.contact-detail-empty svg { width: 64px; height: 64px; opacity: 0.4; }
.contact-detail-header {
  background: var(--surface-primary);
  padding: 32px 32px 24px;
  text-align: center;
  border-bottom: 1px solid var(--border-subtle);
}
.contact-detail-avatar {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  font-weight: 700;
  color: #fff;
  margin: 0 auto 12px;
  position: relative;
}
.contact-detail-avatar .presence-lg {
  position: absolute;
  bottom: 2px;
  right: 2px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 3px solid var(--surface-primary);
}
.contact-detail-avatar .presence-lg.online { background: var(--success); }
.contact-detail-avatar .presence-lg.offline { background: var(--text-disabled); }
.contact-detail-name { font-size: 20px; font-weight: 700; margin-bottom: 2px; }
.contact-detail-role { font-size: 14px; color: var(--text-secondary); margin-bottom: 16px; }
.contact-detail-actions { display: flex; gap: 8px; justify-content: center; }
.contact-detail-body { flex: 1; overflow-y: auto; padding: 20px 32px; }
.contact-info-section { margin-bottom: 24px; }
.contact-info-section h4 {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-secondary);
  margin-bottom: 10px;
}
.contact-info-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px solid var(--border-subtle);
  font-size: 13px;
}
.contact-info-row:last-child { border-bottom: none; }
.contact-info-row svg { width: 16px; height: 16px; color: var(--text-secondary); flex-shrink: 0; }
.contact-info-row .info-label { color: var(--text-secondary); min-width: 80px; font-size: 12px; }
.contact-info-row .info-value { flex: 1; color: var(--text-primary); font-weight: 500; }
.contact-activity-item {
  display: flex;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border-subtle);
  font-size: 13px;
  cursor: pointer;
  transition: background var(--transition);
  margin: 0 -8px;
  padding-left: 8px;
  padding-right: 8px;
  border-radius: var(--radius-sm);
}
.contact-activity-item:hover { background: var(--hover-bg); }
.contact-activity-item:last-child { border-bottom: none; }
.contact-activity-icon {
  width: 28px;
  height: 28px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.contact-activity-icon svg { width: 14px; height: 14px; }
.contact-activity-icon.email { background: #E8F0FE; color: #1A73E8; }
.contact-activity-icon.chat { background: #EDE8F5; color: var(--teams-purple); }
.contact-activity-body { flex: 1; min-width: 0; }
.contact-activity-title { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.contact-activity-meta { font-size: 11px; color: var(--text-secondary); }

/* ===== SETTINGS PAGE ===== */
.settings-tabs {
  display: flex;
  border-bottom: 1px solid var(--border-subtle);
  padding: 0 20px;
  background: var(--surface-primary);
}
.settings-tabs button {
  padding: 12px 16px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-secondary);
  position: relative;
  transition: color var(--transition);
}
.settings-tabs button:hover { color: var(--text-primary); }
.settings-tabs button.active { color: var(--teams-action); }
.settings-tabs button.active::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 12px;
  right: 12px;
  height: 3px;
  background: var(--teams-action);
  border-radius: 2px 2px 0 0;
}
.tab-panel { display: none; }
.tab-panel.active { display: block; }
.settings-card {
  background: var(--surface-primary);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-subtle);
  padding: 24px;
  margin-bottom: 16px;
}
.settings-card h3 { font-size: 16px; font-weight: 700; margin-bottom: 4px; }
.settings-card p { font-size: 13px; color: var(--text-secondary); margin-bottom: 16px; }
.profile-header { display: flex; align-items: center; gap: 16px; margin-bottom: 24px; }
.profile-avatar {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: var(--teams-purple);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  font-weight: 700;
  flex-shrink: 0;
}
.profile-info h2 { font-size: 20px; font-weight: 700; }
.profile-info p { color: var(--text-secondary); font-size: 14px; }
.settings-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 0;
  border-bottom: 1px solid var(--border-subtle);
}
.settings-row:last-child { border-bottom: none; }
.settings-row .row-label h4 { font-size: 14px; font-weight: 600; }
.settings-row .row-label p { font-size: 12px; color: var(--text-secondary); margin-top: 2px; }
.toggle-switch {
  position: relative;
  width: 40px;
  height: 22px;
  cursor: pointer;
}
.toggle-switch input { opacity: 0; width: 0; height: 0; }
.toggle-switch .slider {
  position: absolute;
  inset: 0;
  background: var(--border-color);
  border-radius: 11px;
  transition: all var(--transition);
}
.toggle-switch .slider::before {
  content: '';
  position: absolute;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #fff;
  top: 2px;
  left: 2px;
  transition: all var(--transition);
  box-shadow: var(--shadow-sm);
}
.toggle-switch input:checked + .slider { background: var(--teams-action); }
.toggle-switch input:checked + .slider::before { transform: translateX(18px); }

/* status badge */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 600;
}
.badge.green { background: #E3F2E8; color: var(--success); }
.badge.yellow { background: #FFF4CE; color: #986F0B; }
.badge.red { background: #FDE7E9; color: var(--danger); }
.badge.blue { background: #E5F0FA; color: var(--info); }

/* ===== COMPOSE DIALOG ===== */
.compose-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  z-index: 200;
  align-items: center;
  justify-content: center;
  animation: fadeIn 150ms ease;
}
.compose-overlay.active { display: flex; }
.compose-dialog {
  background: var(--surface-primary);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xl);
  width: 640px;
  max-width: 94vw;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  animation: fadeUp 200ms ease;
}
.compose-header {
  display: flex;
  align-items: center;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-subtle);
}
.compose-header h3 { flex: 1; font-size: 16px; font-weight: 700; }
.compose-body { flex: 1; overflow-y: auto; padding: 16px 20px; }
.compose-field { margin-bottom: 12px; }
.compose-field label { display: block; font-size: 12px; font-weight: 600; color: var(--text-secondary); margin-bottom: 4px; }
.compose-field input,
.compose-field .form-select,
.compose-field .form-textarea {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  font-size: 14px;
  color: var(--text-primary);
  background: var(--surface-primary);
  outline: none;
  transition: border-color var(--transition), box-shadow var(--transition);
}
.compose-field input:focus,
.compose-field .form-select:focus,
.compose-field .form-textarea:focus {
  border-color: var(--teams-action);
  box-shadow: 0 0 0 1px var(--teams-action);
}
.compose-field input:hover,
.compose-field .form-select:hover,
.compose-field .form-textarea:hover { border-color: #C8C6C4; }
.compose-field .form-select {
  padding-right: 36px;
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg width='12' height='12' viewBox='0 0 12 12' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M3 4.5l3 3 3-3' stroke='%23616161' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 12px;
  cursor: pointer;
}
.compose-editor {
  min-height: 200px;
  padding: 12px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  outline: none;
  font-size: 14px;
  line-height: 1.6;
  overflow-y: auto;
}
.compose-editor:focus { border-color: var(--teams-action); }
.compose-editor[contenteditable]:empty::before {
  content: attr(data-placeholder);
  color: var(--text-disabled);
}
.compose-toolbar {
  display: flex;
  gap: 2px;
  padding: 8px 0;
  border-bottom: 1px solid var(--border-subtle);
  margin-bottom: 12px;
}
.compose-footer {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 20px;
  border-top: 1px solid var(--border-subtle);
}
.compose-footer .btn-primary { width: auto; }

/* ===== DIALOG ===== */
.dialog-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  z-index: 200;
  align-items: center;
  justify-content: center;
  animation: fadeIn 150ms ease;
}
.dialog-overlay.active { display: flex; }
.dialog-box {
  background: var(--surface-primary);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xl);
  width: 400px;
  max-width: 92vw;
  padding: 24px;
  animation: fadeUp 200ms ease;
}
.dialog-box h3 { font-size: 18px; font-weight: 700; margin-bottom: 8px; }
.dialog-box p { font-size: 14px; color: var(--text-secondary); margin-bottom: 20px; line-height: 1.5; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; }

/* ===== FILTER ROW ===== */
.filter-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 20px 0;
  margin-top: 16px;
  flex-wrap: wrap;
}
.segmented {
  display: inline-flex;
  background: var(--surface-primary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  overflow: hidden;
}
.segmented button {
  padding: 7px 14px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  transition: all var(--transition);
  border-right: 1px solid var(--border-color);
}
.segmented button:last-child { border-right: none; }
.segmented button:hover { background: var(--hover-bg); color: var(--text-primary); }
.segmented button.active { background: var(--teams-action); color: #fff; }

/* ===== NOTIFICATION DOT ===== */
.notif-dot {
  width: 6px;
  height: 6px;
  background: var(--teams-action);
  border-radius: 50%;
  display: inline-block;
}

/* ===== MOBILE ===== */
@media (max-width: 768px) {
  .left-rail { width: var(--rail-collapsed); min-width: var(--rail-collapsed); }
  .rail-item span, .rail-logo span, .rail-avatar span { display: none; }
  .rail-item { padding: 10px 4px; }
  .folder-sidebar { display: none; }
  .thread-list-pane { width: 100%; min-width: 0; }
  .reading-pane { display: none; }
  .reading-pane.mobile-active { display: flex; position: absolute; inset: 0; z-index: 50; }
  .chat-list-pane { width: 100%; min-width: 0; }
  .chat-main { display: none; }
  .chat-main.mobile-active { display: flex; position: absolute; inset: 0; z-index: 50; }
  .topbar-title { display: none; }
  .topbar-search { max-width: none; }
}
@media (max-width: 480px) {
  .segmented button { padding: 6px 8px; font-size: 12px; }
  .auth-card { padding: 28px 20px 24px; }
}

/* ===== UTILITY ===== */
.hidden { display: none !important; }
.flex { display: flex; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }
.mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mb-16 { margin-bottom: 16px; }
.text-center { text-align: center; }
