* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

:root {
  /* Colors */
  --primary: #0A1628;
  --primary-light: #1A2D4A;
  --accent: #C9A962;
  --accent-dark: #A68B4B;

  --bg: #F5F7FA;
  --bg-white: #FFFFFF;
  --bg-card: #FFFFFF;

  --text-primary: #0A1628;
  --text-secondary: #5A6B7D;
  --text-muted: #8A9AAD;
  --text-light: #B8C4CE;

  --border: #E5E9EF;
  --border-light: #F0F3F7;

  --success: #0D9F6E;
  --success-bg: rgba(13, 159, 110, 0.1);
  --danger: #DC3545;
  --danger-bg: rgba(220, 53, 69, 0.1);

  /* Spacing */
  --space-xs: 4px;
  --space-sm: 8px;
  --space-md: 16px;
  --space-lg: 24px;
  --space-xl: 32px;

  /* Radius */
  --radius-sm: 8px;
  --radius: 12px;
  --radius-lg: 16px;
  --radius-xl: 24px;

  /* Shadows */
  --shadow-sm: 0 1px 3px rgba(10, 22, 40, 0.06);
  --shadow: 0 4px 12px rgba(10, 22, 40, 0.08);
  --shadow-lg: 0 8px 24px rgba(10, 22, 40, 0.12);

  /* Safe areas */
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

html {
  font-size: 16px;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'Helvetica Neue', Arial, sans-serif;
  background: var(--bg);
  color: var(--text-primary);
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

body[data-theme="goldman"] {
  --primary: #07111F;
  --primary-light: #172B45;
  --accent: #D5B466;
  --accent-dark: #AA8845;
  --bg: #EEF2F6;
}

body[data-theme="citi"] {
  --primary: #003B70;
  --primary-light: #0E6BA8;
  --accent: #D71920;
  --accent-dark: #A80F15;
  --bg: #F3F8FC;
}

body[data-theme="chanel"] {
  --primary: #050505;
  --primary-light: #242424;
  --accent: #C5A572;
  --accent-dark: #92784E;
  --bg: #F7F4EF;
  --text-primary: #111111;
  --text-secondary: #4A4A4A;
}

#app {
  width: 100%;
  max-width: 100%;
  margin: 0 auto;
  min-height: 100vh;
  background: var(--bg);
  position: relative;
}

/* Header */
.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: var(--primary);
  color: white;
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-title {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 0.5px;
}

.menu-btn,
.icon-btn {
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  color: white;
  font-size: 18px;
  cursor: pointer;
  border-radius: var(--radius);
  position: relative;
}

.menu-btn:active,
.icon-btn:active {
  background: rgba(255,255,255,0.1);
}

.icon-btn .badge {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 18px;
  height: 18px;
  background: var(--danger);
  color: white;
  border-radius: 50%;
  font-size: 10px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Sidebar */
.sidebar-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0,0,0,0.5);
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s;
  z-index: 200;
}

.sidebar-overlay.active {
  opacity: 1;
  visibility: visible;
}

.app-sidebar {
  position: fixed;
  top: 0;
  left: 0;
  width: 280px;
  height: 100%;
  background: var(--primary);
  transform: translateX(-100%);
  transition: transform 0.3s ease;
  z-index: 300;
  display: flex;
  flex-direction: column;
}

.app-sidebar.active {
  transform: translateX(0);
}

.sidebar-header {
  padding: 24px 20px;
  border-bottom: 1px solid rgba(255,255,255,0.1);
}

.user-profile {
  display: flex;
  align-items: center;
  gap: 14px;
}

.user-avatar {
  width: 52px;
  height: 52px;
  background: linear-gradient(135deg, var(--accent), var(--accent-dark));
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--primary);
  font-weight: 700;
  font-size: 18px;
  overflow: hidden;
}

.user-avatar img {
  width: 52px;
  height: 52px;
  object-fit: cover;
  border-radius: 50%;
}

.user-name {
  display: block;
  color: white;
  font-weight: 600;
  font-size: 16px;
  margin-bottom: 2px;
}

.user-role {
  display: block;
  color: rgba(255,255,255,0.6);
  font-size: 13px;
}

.sidebar-nav {
  flex: 1;
  padding: 16px 12px;
  overflow-y: auto;
}

.sidebar-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  color: rgba(255,255,255,0.7);
  text-decoration: none;
  border-radius: var(--radius);
  margin-bottom: 4px;
  transition: all 0.2s;
  font-size: 15px;
  font-weight: 500;
}

.sidebar-item:hover {
  background: rgba(255,255,255,0.08);
  color: white;
}

.sidebar-item.active {
  background: linear-gradient(135deg, rgba(201, 169, 98, 0.2), rgba(201, 169, 98, 0.1));
  color: var(--accent);
}

.sidebar-item i {
  width: 22px;
  font-size: 18px;
  text-align: center;
}

.sidebar-footer {
  padding: 16px;
  border-top: 1px solid rgba(255,255,255,0.1);
}

.market-widget {
  display: flex;
  gap: 16px;
  padding: 12px 16px;
  background: rgba(255,255,255,0.05);
  border-radius: var(--radius);
  margin-top: 12px;
}

.market-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.market-item span:first-child {
  font-size: 11px;
  color: rgba(255,255,255,0.5);
  font-weight: 600;
}

.market-item .up {
  color: var(--success);
  font-size: 13px;
  font-weight: 700;
}

.market-item .down {
  color: var(--danger);
  font-size: 13px;
  font-weight: 700;
}

/* Main Content */
.app-main {
  padding: 16px;
  padding-bottom: calc(80px + var(--safe-bottom));
  min-height: calc(100vh - 56px);
}

.page {
  display: none;
  animation: fadeIn 0.3s ease;
}

.page.active {
  display: block;
}

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

.page-header {
  margin-bottom: 20px;
}

.page-header h1 {
  font-size: 28px;
  font-weight: 700;
  color: var(--text-primary);
}

/* Greeting */
.greeting-section {
  margin-bottom: 20px;
}

.greeting-section h1 {
  font-size: 24px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.greeting-section p {
  font-size: 14px;
  color: var(--text-muted);
}

.brand-brief {
  margin: 16px 0 20px;
  border-radius: var(--radius-xl);
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  color: white;
  overflow: hidden;
  box-shadow: var(--shadow-lg);
}

.brand-brief-copy {
  padding: 22px 20px 12px;
}

.brand-brief-copy span {
  color: var(--accent);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.brand-brief-copy h2 {
  margin-top: 8px;
  font-size: 24px;
  letter-spacing: 0;
}

.brand-brief-copy p {
  margin-top: 8px;
  color: rgba(255,255,255,0.72);
  line-height: 1.5;
  font-size: 14px;
}

.brand-metrics {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  border-top: 1px solid rgba(255,255,255,0.12);
  background: rgba(255,255,255,0.05);
}

.brand-metric {
  padding: 14px 12px;
  border-right: 1px solid rgba(255,255,255,0.12);
}

.brand-metric:last-child {
  border-right: none;
}

.brand-metric b {
  display: block;
  color: var(--accent);
  font-size: 22px;
}

.brand-metric span,
.brand-metric small {
  display: block;
}

.brand-metric span {
  margin-top: 4px;
  font-size: 12px;
  font-weight: 800;
}

.brand-metric small {
  margin-top: 3px;
  color: rgba(255,255,255,0.58);
  font-size: 11px;
}

/* Check-in Button */
.checkin-btn {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 18px;
  background: linear-gradient(135deg, var(--accent), var(--accent-dark));
  color: var(--primary);
  border: none;
  border-radius: var(--radius-lg);
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  margin-bottom: 20px;
  box-shadow: 0 4px 16px rgba(201, 169, 98, 0.35);
  transition: all 0.2s;
}

.checkin-btn:active {
  transform: scale(0.98);
}

.checkin-btn i {
  font-size: 18px;
}

/* Stats Row */
.stats-row {
  display: flex;
  background: var(--bg-white);
  border-radius: var(--radius-lg);
  padding: 20px;
  margin-bottom: 24px;
  box-shadow: var(--shadow-sm);
}

.stat-item {
  flex: 1;
  text-align: center;
}

.stat-num {
  display: block;
  font-size: 28px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.stat-label {
  font-size: 12px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.stat-divider {
  width: 1px;
  background: var(--border);
  margin: 0 16px;
}

/* Section */
.section {
  margin-bottom: 24px;
}

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

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

.see-all {
  font-size: 14px;
  color: var(--accent);
  text-decoration: none;
  font-weight: 600;
}

/* Quick Actions Grid */
.quick-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}

.quick-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 16px 8px;
  background: var(--bg-white);
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  transition: all 0.2s;
  box-shadow: var(--shadow-sm);
}

.quick-item:active {
  transform: scale(0.95);
}

.quick-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  color: white;
}

.quick-item span {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-primary);
}

/* Approval List */
.approval-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.approval-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px;
  background: var(--bg-white);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}

.approval-left {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
  min-width: 0;
}

.approval-avatar {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: 700;
  font-size: 14px;
  flex-shrink: 0;
}

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

.approval-title {
  display: block;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 2px;
}

.approval-meta {
  display: block;
  font-size: 12px;
  color: var(--text-muted);
}

.approval-actions {
  display: flex;
  gap: 8px;
  margin-left: 12px;
}

.action-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  transition: all 0.2s;
}

.action-btn:active {
  transform: scale(0.9);
}

.action-btn.approve {
  background: var(--success-bg);
  color: var(--success);
}

.action-btn.reject {
  background: var(--danger-bg);
  color: var(--danger);
}

/* Meeting List */
.meeting-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.meeting-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px;
  background: var(--bg-white);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}

.meeting-time-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 10px 14px;
  background: rgba(30, 90, 168, 0.08);
  border-radius: var(--radius-sm);
  min-width: 60px;
}

.meeting-time-box .time {
  font-size: 16px;
  font-weight: 700;
  color: #1E5AA8;
}

.meeting-time-box .period {
  font-size: 10px;
  font-weight: 600;
  color: #1E5AA8;
  text-transform: uppercase;
}

.meeting-info {
  flex: 1;
}

.meeting-title {
  display: block;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.meeting-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text-muted);
}

.meeting-meta i {
  font-size: 12px;
}

/* Workbench Grid */
.app-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}

.app-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 24px 16px;
  background: var(--bg-white);
  border: none;
  border-radius: var(--radius-lg);
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: all 0.2s;
}

.app-card:active {
  transform: scale(0.95);
}

.app-icon {
  width: 56px;
  height: 56px;
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  color: white;
}

.app-card span {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
}

.app-card small {
  display: block;
  margin-top: 6px;
  color: var(--text-muted);
  font-size: 12px;
  line-height: 1.35;
}

body[data-theme="chanel"] .app-header,
body[data-theme="chanel"] .app-sidebar,
body[data-theme="chanel"] .brand-brief {
  background: #050505;
}

body[data-theme="chanel"] .brand-brief {
  border: 1px solid #D8C8A8;
}

body[data-theme="chanel"] .profile-card,
body[data-theme="chanel"] .mail-list,
body[data-theme="chanel"] .settings-list,
body[data-theme="chanel"] .profile-deep-card,
body[data-theme="chanel"] .mail-detail-card,
body[data-theme="chanel"] .stat-item,
body[data-theme="chanel"] .app-card {
  box-shadow: none;
  border: 1px solid #E6DED1;
}

body[data-theme="citi"] .brand-brief {
  background: linear-gradient(135deg, #003B70, #0076A8);
}

body[data-theme="citi"] .checkin-btn,
body[data-theme="citi"] .compose-fab {
  background: #D71920;
  color: white;
}

/* Directory */
.search-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  background: var(--bg-white);
  border-radius: var(--radius);
  margin-bottom: 16px;
  box-shadow: var(--shadow-sm);
}

.search-bar i {
  color: var(--text-muted);
  font-size: 16px;
}

.search-bar input {
  flex: 1;
  border: none;
  background: transparent;
  font-size: 15px;
  outline: none;
}

.alpha-index {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  padding: 8px 0;
  margin-bottom: 16px;
}

.alpha-index span {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 600;
  color: var(--accent);
  cursor: pointer;
  border-radius: 6px;
}

.alpha-index span:active {
  background: var(--accent);
  color: white;
}

.contact-list {
  background: var(--bg-white);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.dept-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 16px;
  background: var(--bg);
  font-size: 13px;
  font-weight: 700;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.dept-header .count {
  background: var(--border);
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 11px;
}

.contact-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border-light);
}

.contact-item:last-child {
  border-bottom: none;
}

.contact-avatar {
  width: 48px;
  height: 48px;
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: 700;
  font-size: 15px;
  flex-shrink: 0;
}

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

.contact-name {
  display: block;
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 2px;
}

.contact-title {
  display: block;
  font-size: 13px;
  color: var(--text-muted);
}

.contact-actions {
  display: flex;
  gap: 8px;
}

.contact-actions button {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: none;
  background: var(--bg);
  color: var(--accent);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  transition: all 0.2s;
}

.contact-actions button:active {
  transform: scale(0.9);
  background: var(--accent);
  color: white;
}

/* Mail */
.mail-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
}

.mail-tab {
  padding: 10px 18px;
  background: var(--bg-white);
  border: none;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.2s;
}

.mail-tab.active {
  background: var(--primary);
  color: white;
}

.mail-list {
  background: var(--bg-white);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.mail-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 16px;
  border-bottom: 1px solid var(--border-light);
  cursor: pointer;
  position: relative;
}

.mail-item:last-child {
  border-bottom: none;
}

.mail-item.unread {
  background: rgba(30, 90, 168, 0.03);
}

.mail-star {
  color: var(--accent);
  font-size: 16px;
  margin-top: 2px;
  border: none;
  background: transparent;
  cursor: pointer;
}

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

.mail-sender {
  display: block;
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.mail-line {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.mail-subject {
  display: block;
  font-size: 14px;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 4px;
}

.mail-item.unread .mail-subject {
  font-weight: 500;
}

.mail-time {
  display: block;
  font-size: 12px;
  color: var(--text-muted);
}

.mail-snippet {
  display: block;
  font-size: 13px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.mail-tools {
  display: flex;
  gap: 8px;
  margin: -4px 0 16px;
  align-items: center;
}

.mail-search {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0 12px;
}

.mail-search input {
  width: 100%;
  height: 40px;
  border: none;
  outline: none;
  background: transparent;
  font-size: 14px;
}

.mail-filter {
  height: 40px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0 12px;
  background: var(--bg-white);
  color: var(--text-secondary);
  font-weight: 700;
  font-size: 13px;
}

.mail-filter.active {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}

.mail-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.mail-tags span {
  padding: 4px 7px;
  border-radius: var(--radius-sm);
  background: var(--bg);
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 700;
}

.priority-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--danger);
  position: absolute;
  top: 16px;
  right: 14px;
}

.mail-empty {
  padding: 24px;
  text-align: center;
  color: var(--text-muted);
}

.mail-detail {
  margin-top: 16px;
}

.mail-detail-card {
  background: var(--bg-white);
  border-radius: var(--radius-lg);
  padding: 18px;
  box-shadow: var(--shadow-sm);
}

.mail-detail-header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.mail-detail-from {
  display: block;
  font-weight: 700;
}

.mail-detail-role,
.mail-detail-time {
  color: var(--text-muted);
  font-size: 12px;
}

.mail-detail-card h2 {
  font-size: 18px;
  margin-bottom: 12px;
}

.mail-detail-card p {
  color: var(--text-secondary);
  line-height: 1.6;
  font-size: 14px;
}

.attachment-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 14px;
}

.attachment-list span {
  display: flex;
  gap: 8px;
  align-items: center;
  padding: 10px 12px;
  border-radius: var(--radius);
  background: var(--bg);
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 600;
}

.compose-fab {
  position: fixed;
  bottom: calc(80px + var(--safe-bottom));
  right: 20px;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--accent-dark));
  color: var(--primary);
  border: none;
  font-size: 20px;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(201, 169, 98, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.compose-fab:active {
  transform: scale(0.9);
}

.mail-page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.mail-page-header .compose-fab {
  position: static;
  width: auto;
  height: 38px;
  min-width: 82px;
  padding: 0 14px;
  border-radius: 12px;
  gap: 8px;
  font-size: 15px;
  font-weight: 800;
  box-shadow: 0 10px 22px rgba(201, 169, 98, 0.2);
}

.mail-page-header .compose-fab span {
  display: inline;
}

.mail-tabs {
  gap: 8px;
  margin-bottom: 10px;
}

.mail-tab {
  height: 36px;
  padding: 0 16px;
  border-radius: 999px;
  font-weight: 800;
}

.mail-tools {
  display: block;
  margin: 0 0 10px;
}

.mail-command-bar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(260px, .72fr);
  gap: 10px;
  margin-bottom: 10px;
}

.mail-search {
  min-height: 46px;
  padding: 0 14px;
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}

.mail-search input {
  height: 44px;
}

.mail-stat-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 7px;
}

.mail-stat-card {
  min-height: 46px;
  padding: 7px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-white);
  box-shadow: var(--shadow-sm);
}

.mail-stat-card strong,
.mail-stat-card span {
  display: block;
}

.mail-stat-card strong {
  font-size: 17px;
}

.mail-stat-card span {
  margin-top: 2px;
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 800;
}

.mail-filter-row {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 2px;
  scrollbar-width: none;
}

.mail-filter-row::-webkit-scrollbar {
  display: none;
}

.mail-filter {
  flex: 0 0 auto;
  height: 34px;
  min-width: 82px;
  border-radius: 999px;
  font-weight: 800;
}

.mail-list {
  display: grid;
  gap: 8px;
  background: transparent;
  border-radius: 0;
  overflow: visible;
  box-shadow: none;
}

.mail-item {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr);
  gap: 11px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--bg-white);
  box-shadow: var(--shadow-sm);
}

.mail-item:last-child {
  border-bottom: 1px solid var(--border);
}

.mail-item.active {
  border-color: rgba(201, 169, 98, .62);
  box-shadow: 0 0 0 2px rgba(201, 169, 98, .14);
}

.mail-item.unread {
  border-left: 3px solid var(--accent);
  background: #FFFCF3;
  padding-left: 10px;
}

.mail-avatar {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 11px;
  color: var(--primary);
  background: #F1EEE7;
  font-size: 13px;
  font-weight: 900;
}

.mail-avatar.hot {
  color: var(--primary);
  background: linear-gradient(135deg, var(--accent), #F0D58F);
}

.mail-content {
  min-width: 0;
}

.mail-line {
  align-items: center;
}

.mail-sender {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  margin-bottom: 0;
  font-weight: 800;
}

.mail-dot {
  width: 8px;
  height: 8px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: var(--danger);
}

.mail-subject-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 5px;
}

.mail-subject {
  margin-bottom: 0;
  color: var(--text-primary);
  font-weight: 800;
}

.mail-star {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  flex: 0 0 auto;
  margin-top: 0;
  border-radius: 50%;
  background: var(--bg);
}

.mail-star .fa-solid,
.mail-star.active {
  color: var(--accent);
}

.mail-snippet {
  display: -webkit-box;
  margin-top: 6px;
  white-space: normal;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.mail-tags {
  margin-top: 10px;
}

.mail-tags span {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  border-radius: 999px;
  font-weight: 800;
}

.mail-tags span.high,
.mail-priority.high {
  color: var(--danger);
  background: var(--danger-bg);
}

.priority-dot {
  display: none;
}

.mail-empty,
.mail-detail-card.empty {
  display: grid;
  place-items: center;
  gap: 8px;
  min-height: 180px;
  padding: 22px;
  border: 1px dashed var(--border);
  border-radius: var(--radius-lg);
  background: var(--bg-white);
  color: var(--text-muted);
  text-align: center;
}

.mail-empty strong,
.mail-detail-card.empty strong {
  color: var(--text-primary);
}

.mail-detail-card {
  padding: 16px;
  border: 1px solid var(--border);
}

.mail-detail-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.mail-priority {
  padding: 5px 9px;
  border-radius: 999px;
  color: var(--text-secondary);
  background: var(--bg);
  font-size: 12px;
  font-weight: 900;
}

.mail-detail-card h2 {
  margin-bottom: 12px;
  font-size: 20px;
}

.mail-detail-header {
  align-items: center;
  justify-content: flex-start;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: #FBFCFE;
}

.mail-detail-card p {
  margin-top: 12px;
}

.attachment-list {
  flex-direction: row;
  flex-wrap: wrap;
}

.attachment-list span {
  border-radius: var(--radius);
  background: var(--bg);
  font-weight: 800;
}

.mail-action-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}

.mail-action-row button {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 120px;
  justify-content: center;
}

.modal-content {
  padding: 16px;
  border-radius: var(--radius-xl) var(--radius-xl) var(--radius) var(--radius);
}

.modal-header {
  padding: 0 0 12px;
  border-bottom: none;
}

.modal-header span {
  font-size: 20px;
}

.modal-body {
  padding: 0;
}

.form-group {
  margin-bottom: 0;
  border-bottom: 1px solid var(--border);
}

.form-group input,
.form-group textarea {
  border: none;
  border-radius: 0;
  padding: 14px 0;
}

.form-group textarea {
  min-height: 150px;
}

.modal-footer {
  justify-content: flex-end;
  gap: 8px;
  padding: 12px 0 0;
  border-top: none;
  background: transparent;
}

.btn-secondary,
.btn-primary {
  flex: 0 0 auto;
  min-width: 112px;
  border-radius: 12px;
}

/* Profile Page */
.profile-card {
  background: var(--bg-white);
  border-radius: var(--radius-xl);
  overflow: hidden;
  box-shadow: var(--shadow);
  margin-bottom: 20px;
  position: relative;
}

.profile-header {
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  padding: 24px;
  display: flex;
  justify-content: center;
  border-radius: var(--radius-xl) var(--radius-xl) 0 0;
}

.company-badge {
  display: flex;
  align-items: center;
  gap: 10px;
  color: white;
}

.company-icon {
  width: 44px;
  height: 44px;
  background: linear-gradient(135deg, var(--accent), var(--accent-dark));
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--primary);
  font-size: 20px;
}

.company-logo-img {
  width: 44px;
  height: 44px;
  object-fit: contain;
  border-radius: var(--radius-sm);
}

.company-badge span {
  font-size: 18px;
  font-weight: 700;
}

.profile-body {
  text-align: center;
  padding: 28px 24px;
  background: var(--bg-white);
  position: relative;
  z-index: 1;
}

.profile-avatar {
  width: 88px;
  height: 88px;
  background: linear-gradient(135deg, var(--accent), var(--accent-dark));
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--primary);
  font-size: 32px;
  font-weight: 700;
  margin: 0 auto 16px;
  position: relative;
}

.avatar-img {
  width: 88px;
  height: 88px;
  object-fit: cover;
  border-radius: 50%;
  display: none;
}

.avatar-initials {
  display: block;
}

.status-dot {
  position: absolute;
  bottom: 4px;
  right: 4px;
  width: 18px;
  height: 18px;
  background: var(--success);
  border: 3px solid var(--bg-white);
  border-radius: 50%;
}

.profile-name {
  font-size: 24px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.profile-title {
  font-size: 16px;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 2px;
}

.profile-dept {
  font-size: 14px;
  color: var(--text-muted);
}

.profile-info {
  padding: 0 24px 20px;
  background: var(--bg-white);
}

.info-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  padding: 14px 0;
  border-bottom: 1px solid var(--border-light);
}

.info-row:last-child {
  border-bottom: none;
}

.info-label {
  flex: 0 0 34%;
  font-size: 14px;
  color: var(--text-muted);
  font-weight: 500;
}

.info-value {
  min-width: 0;
  max-width: 66%;
  overflow-wrap: anywhere;
  text-align: right;
  line-height: 1.45;
  font-size: 14px;
  color: var(--text-primary);
  font-weight: 600;
  font-family: 'SF Mono', Monaco, monospace;
}

.profile-actions {
  display: flex;
  gap: 12px;
  padding: 16px 24px;
  background: var(--bg);
  border-top: 1px solid var(--border-light);
}

.action-button {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 16px;
  background: var(--bg-white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  text-decoration: none;
  color: var(--text-primary);
  transition: all 0.2s;
}

.action-button:active {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}

.action-button i {
  font-size: 20px;
  color: var(--accent);
}

.action-button:active i {
  color: white;
}

.action-button span {
  font-size: 12px;
  font-weight: 600;
}

.profile-deep-card {
  background: var(--bg-white);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow-sm);
  margin-bottom: 20px;
}

.profile-deep-card h3 {
  font-size: 16px;
  margin-bottom: 10px;
}

.profile-deep-card p {
  color: var(--text-secondary);
  line-height: 1.6;
  font-size: 14px;
}

.skill-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}

.skill-row span {
  padding: 7px 10px;
  border-radius: var(--radius-sm);
  background: var(--bg);
  color: var(--primary);
  font-size: 12px;
  font-weight: 700;
}

/* Settings List */
.settings-list {
  background: var(--bg-white);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.settings-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px;
  border-bottom: 1px solid var(--border-light);
  background: transparent;
  border: none;
  border-bottom: 1px solid var(--border-light);
  width: 100%;
  cursor: pointer;
  text-align: left;
}

.settings-item:last-child {
  border-bottom: none;
}

.settings-item:active {
  background: var(--bg);
}

.settings-icon {
  width: 42px;
  height: 42px;
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 17px;
}

.settings-label {
  flex: 1;
  font-size: 15px;
  font-weight: 500;
  color: var(--text-primary);
}

.settings-item.logout .settings-label {
  color: var(--danger);
}

.settings-item i.fa-chevron-right {
  color: var(--text-light);
  font-size: 14px;
}

/* Placeholder */
.placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 80px 40px;
  background: var(--bg-white);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}

.placeholder i {
  font-size: 64px;
  color: var(--accent);
  margin-bottom: 16px;
}

.placeholder p {
  font-size: 18px;
  font-weight: 600;
  color: var(--text-primary);
}

/* Tab Bar */
.tab-bar {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 430px;
  display: flex;
  justify-content: space-around;
  align-items: center;
  padding: 8px 0;
  padding-bottom: calc(8px + var(--safe-bottom));
  background: var(--bg-white);
  border-top: 1px solid var(--border-light);
  box-shadow: 0 -4px 20px rgba(10, 22, 40, 0.05);
  z-index: 100;
}

.tab-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 8px 12px;
  color: var(--text-muted);
  text-decoration: none;
  transition: all 0.2s;
}

.tab-item.active {
  color: var(--accent);
}

.tab-item i {
  font-size: 20px;
}

.tab-item span {
  font-size: 10px;
  font-weight: 600;
}

/* Modal */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(10, 22, 40, 0.6);
  backdrop-filter: blur(8px);
  display: none;
  justify-content: center;
  align-items: flex-end;
  z-index: 400;
}

.modal.active {
  display: flex;
}

.modal-content {
  width: 100%;
  max-width: 430px;
  background: var(--bg-white);
  border-radius: var(--radius-xl) var(--radius-xl) 0 0;
  animation: slideUp 0.3s ease;
}

@keyframes slideUp {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}

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

.modal-header span {
  font-size: 17px;
  font-weight: 700;
  color: var(--text-primary);
}

.close-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: none;
  background: var(--bg);
  color: var(--text-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
}

.modal-body {
  padding: 20px;
}

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

.form-group input,
.form-group textarea {
  width: 100%;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 15px;
  outline: none;
  font-family: inherit;
}

.form-group input:focus,
.form-group textarea:focus {
  border-color: var(--accent);
}

.form-group textarea {
  min-height: 150px;
  resize: none;
}

.modal-footer {
  display: flex;
  gap: 12px;
  padding: 16px 20px;
  border-top: 1px solid var(--border-light);
  background: var(--bg);
}

.btn-secondary,
.btn-primary {
  flex: 1;
  padding: 14px;
  border-radius: var(--radius);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all 0.2s;
}

.btn-secondary {
  background: var(--bg-white);
  color: var(--text-primary);
  border: 1px solid var(--border);
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-dark));
  color: var(--primary);
}

/* Toast */
.toast {
  position: fixed;
  bottom: calc(90px + var(--safe-bottom));
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--primary);
  color: white;
  padding: 14px 28px;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 500;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s;
  z-index: 500;
}

.toast.show {
  opacity: 1;
  visibility: visible;
  transform: translateX(-50%) translateY(0);
}

/* Safe area for notch devices */
@supports (padding-bottom: env(safe-area-inset-bottom)) {
  .tab-bar {
    padding-bottom: calc(8px + env(safe-area-inset-bottom));
  }

  .app-main {
    padding-bottom: calc(80px + env(safe-area-inset-bottom));
  }
}

/* Compact mail composer override */
#composeModal .modal-content {
  padding: 16px;
  border-radius: var(--radius-xl) var(--radius-xl) var(--radius) var(--radius);
}

#composeModal .modal-header {
  padding: 0 0 12px;
  border-bottom: none;
}

#composeModal .modal-header span {
  font-size: 20px;
}

#composeModal .modal-body {
  padding: 0;
}

#composeModal .form-group {
  margin-bottom: 0;
  border-bottom: 1px solid var(--border);
}

#composeModal .form-group input,
#composeModal .form-group textarea {
  border: none;
  border-radius: 0;
  padding: 14px 0;
}

#composeModal .form-group textarea {
  min-height: 150px;
}

#composeModal .modal-footer {
  justify-content: flex-end;
  gap: 8px;
  padding: 12px 0 0;
  border-top: none;
  background: transparent;
}

#composeModal .btn-secondary,
#composeModal .btn-primary {
  flex: 0 0 auto;
  min-width: 112px;
  border-radius: 12px;
}

@media (max-width: 520px) {
  .mail-command-bar {
    grid-template-columns: 1fr;
  }

  .mail-filter-row {
    margin-right: calc(-1 * var(--space-md));
    margin-left: calc(-1 * var(--space-md));
    padding-right: var(--space-md);
    padding-left: var(--space-md);
  }

  .mail-action-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .mail-action-row button {
    width: 100%;
    min-width: 0;
  }
}
