:root {
  --text-xs:   clamp(0.7rem,  0.65rem + 0.2vw, 0.8rem);
  --text-sm:   clamp(0.8rem,  0.75rem + 0.25vw, 0.9rem);
  --text-base: clamp(0.9rem,  0.85rem + 0.25vw, 1rem);
  --text-lg:   clamp(1rem,    0.9rem  + 0.5vw,  1.25rem);
  --text-xl:   clamp(1.25rem, 1rem    + 1vw,    1.75rem);

  --space-1:0.25rem; --space-2:0.5rem; --space-3:0.75rem;
  --space-4:1rem;    --space-5:1.25rem; --space-6:1.5rem;
  --space-8:2rem;    --space-10:2.5rem; --space-12:3rem;

  --radius-sm:0.375rem; --radius-md:0.5rem;
  --radius-lg:0.875rem; --radius-xl:1.25rem; --radius-full:9999px;
  --transition: 180ms cubic-bezier(0.16,1,0.3,1);
  --font-body: 'Satoshi','Inter',sans-serif;
}

[data-theme="light"] {
  --bg:            #f2f1ee;
  --surface:       #fafaf8;
  --surface-2:     #ffffff;
  --surface-3:     #f0efec;
  --surface-4:     #e8e6e2;
  --divider:       #e2e0dc;
  --border:        #d8d6d1;
  --text:          #1a1917;
  --text-muted:    #6a6966;
  --text-faint:    #b0afac;
  --accent:        #01696f;
  --accent-hover:  #0c4e54;
  --accent-dim:    #d4edea;
  --success:       #437a22;
  --success-bg:    #e6f3dc;
  --warning:       #b07a00;
  --warning-bg:    #fdf3d6;
  --error:         #c23a4b;
  --error-bg:      #fde4e7;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.06);
  --shadow-md: 0 4px 16px rgba(0,0,0,0.08);
  --shadow-lg: 0 12px 40px rgba(0,0,0,0.12);
}

[data-theme="dark"] {
  --bg:            #0e0e0d;
  --surface:       #161614;
  --surface-2:     #1c1b19;
  --surface-3:     #232220;
  --surface-4:     #2a2927;
  --divider:       #2a2927;
  --border:        #333230;
  --text:          #e6e5e2;
  --text-muted:    #888785;
  --text-faint:    #4e4d4b;
  --accent:        #4f98a3;
  --accent-hover:  #227f8b;
  --accent-dim:    #1a3234;
  --success:       #6daa45;
  --success-bg:    #1a2f12;
  --warning:       #e8af34;
  --warning-bg:    #2a2010;
  --error:         #dd6974;
  --error-bg:      #2a1518;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.35);
  --shadow-md: 0 4px 16px rgba(0,0,0,0.45);
  --shadow-lg: 0 12px 40px rgba(0,0,0,0.55);
}

*,*::before,*::after{box-sizing:border-box;margin:0;padding:0}
html{font-size:16px;scroll-behavior:smooth}
body{
  font-family:var(--font-body);
  font-size:var(--text-sm);
  background:var(--bg);
  color:var(--text);
  min-height:100dvh;
  display:flex;
  overflow:hidden;
  -webkit-font-smoothing:antialiased;
}
button{cursor:pointer;background:none;border:none;font:inherit;color:inherit}
input{font:inherit;color:inherit}
::-webkit-scrollbar{width:6px;height:6px}
::-webkit-scrollbar-track{background:transparent}
::-webkit-scrollbar-thumb{background:var(--surface-4);border-radius:var(--radius-full)}
:focus-visible{outline:2px solid var(--accent);outline-offset:2px;border-radius:var(--radius-sm)}

/* ===== APP SHELL ===== */
.app{display:flex;width:100%;height:100dvh;overflow:hidden}

/* ===== SIDEBAR ===== */
.sidebar{
  width:220px;min-width:220px;
  background:var(--surface);
  border-right:1px solid var(--divider);
  display:flex;flex-direction:column;
  height:100dvh;overflow:hidden;
  transition:width var(--transition),min-width var(--transition);
  z-index:100;flex-shrink:0;
}

.sidebar-logo{
  padding:var(--space-4) var(--space-4);
  display:flex;align-items:center;gap:var(--space-3);
  border-bottom:1px solid var(--divider);flex-shrink:0;
  height:73px;
  box-sizing:border-box;
}
.logo-mark{
  width:26px;height:26px;border-radius:var(--radius-md);
  background:transparent;display:flex;align-items:center;justify-content:center;flex-shrink:0;
}
.logo-name{font-size:var(--text-base);font-weight:700;letter-spacing:-0.02em;white-space:nowrap}

.sidebar-nav{flex:1;overflow-y:auto;padding:var(--space-4) var(--space-2)}
.nav-group-label{
  padding:var(--space-2) var(--space-3) var(--space-2);
  font-size:10px;font-weight:600;letter-spacing:0.07em;text-transform:uppercase;
  color:var(--text-faint);white-space:nowrap;overflow:hidden;
}

.nav-item{
  display:flex;align-items:center;gap:var(--space-3);
  padding:var(--space-2) var(--space-3);
  border-radius:var(--radius-md);cursor:pointer;
  transition:background var(--transition),color var(--transition);
  white-space:nowrap;overflow:hidden;color:var(--text-muted);
  font-size:var(--text-sm);font-weight:500;margin-bottom:2px;user-select:none;
  position:relative;
}
.nav-item:hover{background:var(--surface-3);color:var(--text)}
.nav-item.active{background:var(--accent-dim);color:var(--accent)}
.nav-icon{width:18px;height:18px;flex-shrink:0;stroke-width:2}
.nav-label{flex:1;overflow:hidden;text-overflow:ellipsis}
.nav-count{
  font-size:var(--text-xs);
  font-weight:600;
  color:var(--text-faint);
  background:var(--surface-3);
  padding:2px 6px;
  border-radius:var(--radius-full);
  min-width:20px;
  text-align:center;
}
.nav-item.active .nav-count{
  background:var(--accent);
  color:#fff;
}

.sidebar-footer{
  border-top:1px solid var(--divider);
  padding:var(--space-3);
  flex-shrink:0;
}
.sidebar-account{
  display:flex;align-items:center;gap:var(--space-3);
  padding:var(--space-2);
  border-radius:var(--radius-md);
  cursor:pointer;
  transition:background var(--transition);
}
.sidebar-account:hover{background:var(--surface-3)}
.account-avatar{
  width:32px;height:32px;border-radius:var(--radius-full);
  background:var(--accent);color:#fff;
  display:flex;align-items:center;justify-content:center;
  font-weight:600;font-size:var(--text-sm);
  flex-shrink:0;
}
.account-info{flex:1;min-width:0}
.account-name{
  font-size:var(--text-xs);
  color:var(--text);
  font-weight:600;
  overflow:hidden;text-overflow:ellipsis;white-space:nowrap;
}
.account-status{
  font-size:11px;
  color:var(--text-muted);
  overflow:hidden;text-overflow:ellipsis;white-space:nowrap;
}
.account-expand{padding:var(--space-1);color:var(--text-faint)}
.sidebar-account.connected .account-status{
  color:var(--success);
}
.sidebar-account.disconnected .account-status{
  color:var(--warning);
}

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

.content-header{
  padding:var(--space-4) var(--space-6);
  border-bottom:1px solid var(--divider);
  background:var(--surface);
  display:grid;
  grid-template-columns:1fr auto 1fr;
  align-items:center;
  flex-shrink:0;
  position:absolute;
  top:0;
  left:0;
  right:0;
  z-index:10;
  gap:var(--space-4);
  height:73px;
}
.content-title{
  font-size:var(--text-xl);
  font-weight:600;
  letter-spacing:-0.02em;
  justify-self:start;
}
.header-actions{
  display:flex;
  align-items:center;
  gap:var(--space-3);
  justify-self:end;
}

.search-box{
  display:flex;
  align-items:center;
  gap:var(--space-2);
  background:var(--surface-3);
  border:1px solid var(--border);
  border-radius:var(--radius-full);
  padding:var(--space-2) var(--space-4);
  min-width:400px;
}
.search-input{
  border:none;
  background:transparent;
  outline:none;
  flex:1;
  font-size:var(--text-sm);
}
.search-input::placeholder{color:var(--text-faint)}

.icon-btn{
  width:36px;height:36px;
  display:flex;align-items:center;justify-content:center;
  border-radius:var(--radius-md);
  background:var(--surface-3);
  border:1px solid var(--border);
  transition:background var(--transition),transform var(--transition);
  color:var(--text-muted);
}
.icon-btn:hover{
  background:var(--surface-4);
  transform:translateY(-1px);
}

.content-body{
  flex:1;
  overflow-y:auto;
  padding:var(--space-6);
  padding-top:calc(73px + var(--space-6));
  margin-right:280px;
}

/* ===== EMAIL SECTIONS ===== */
.email-section{
  background:var(--surface);
  border:1px solid var(--divider);
  border-radius:var(--radius-lg);
  margin-bottom:var(--space-6);
  overflow:hidden;
}
.email-section:first-child{
  margin-top:var(--space-4);
}

.section-header{
  padding:var(--space-4) var(--space-5);
  border-bottom:1px solid var(--divider);
  display:flex;
  align-items:center;
  justify-content:space-between;
}
.section-title{
  display:flex;
  align-items:center;
  gap:var(--space-2);
}
.section-title h2{
  font-size:var(--text-base);
  font-weight:600;
  letter-spacing:-0.01em;
}
.section-actions{
  display:flex;
  align-items:center;
  gap:var(--space-3);
}

.unread-badge{
  font-size:10px;
  font-weight:700;
  letter-spacing:0.05em;
  color:var(--accent);
  background:var(--accent-dim);
  padding:4px 8px;
  border-radius:var(--radius-sm);
}
.count-badge{
  font-size:10px;
  font-weight:700;
  letter-spacing:0.05em;
  color:var(--warning);
}
.text-btn{
  font-size:var(--text-sm);
  font-weight:500;
  color:var(--accent);
  padding:var(--space-1) var(--space-2);
  border-radius:var(--radius-sm);
  transition:background var(--transition);
}
.text-btn:hover{background:var(--accent-dim)}

/* ===== EMAIL LIST ===== */
.email-list{}
.email-item{
  display:flex;
  gap:var(--space-4);
  padding:var(--space-4) var(--space-5);
  border-bottom:1px solid var(--divider);
  transition:background var(--transition);
  cursor:pointer;
  position:relative;
}
.email-item:last-child{border-bottom:none}
.email-item:hover{background:var(--surface-3)}
.email-item.unread{
  background:rgba(0,0,0,0.015);
}
[data-theme="dark"] .email-item.unread{
  background:rgba(255,255,255,0.02);
}

.email-avatar{
  width:40px;height:40px;
  border-radius:var(--radius-full);
  display:flex;align-items:center;justify-content:center;
  color:#fff;
  font-weight:600;
  font-size:var(--text-base);
  flex-shrink:0;
}

.email-content{
  flex:1;
  min-width:0;
}
.email-header{
  display:flex;
  align-items:center;
  justify-content:space-between;
  margin-bottom:var(--space-1);
}
.email-sender{
  font-weight:600;
  font-size:var(--text-sm);
  color:var(--text);
}
.email-date{
  font-size:var(--text-xs);
  color:var(--text-muted);
}
.email-subject{
  font-weight:500;
  font-size:var(--text-sm);
  color:var(--text);
  margin-bottom:var(--space-1);
}
.email-preview{
  font-size:var(--text-sm);
  color:var(--text-muted);
  line-height:1.5;
  margin-bottom:var(--space-2);
}

.email-meta{
  display:flex;
  align-items:center;
  gap:var(--space-2);
  font-size:var(--text-xs);
  color:var(--text-muted);
  margin-bottom:var(--space-1);
}
.email-from{}
.email-time{}

.email-tags{
  display:flex;
  gap:var(--space-2);
  flex-wrap:wrap;
}
.tag{
  font-size:9px;
  font-weight:700;
  letter-spacing:0.05em;
  padding:3px 8px;
  border-radius:var(--radius-sm);
  text-transform:uppercase;
}
.tag-payments{background:#fce7f3;color:#db2777}
.tag-rent{background:#fdf3d6;color:#b07a00}
.tag-utilities{background:#fde4e7;color:#c23a4b}
.tag-banking{background:#dbeafe;color:#2563eb}
.tag-work{background:#ede9fe;color:#7c3aed}
.tag-personal{background:#dcfce7;color:#16a34a}
.tag-replied{background:var(--success-bg);color:var(--success)}

/* Default style for custom categories */
.tag:not([class*="tag-"]){
  background:var(--accent-dim);
  color:var(--accent);
}

.email-dot{
  width:8px;height:8px;
  border-radius:var(--radius-full);
  background:var(--accent);
  flex-shrink:0;
  margin-top:6px;
}
.email-item:not(.unread) .email-dot{display:none}

.email-actions{
  display:flex;
  gap:var(--space-2);
  margin-top:var(--space-3);
}
.action-btn{
  font-size:var(--text-xs);
  font-weight:500;
  padding:6px 12px;
  border-radius:var(--radius-md);
  border:1px solid var(--border);
  transition:all var(--transition);
}
.action-btn-primary{
  background:var(--surface-2);
  border-color:var(--border);
  color:var(--text);
}
.action-btn-primary:hover{
  background:var(--accent);
  border-color:var(--accent);
  color:#fff;
}
.action-btn-secondary{
  background:transparent;
  color:var(--text-muted);
}
.action-btn-secondary:hover{
  background:var(--surface-3);
}

/* ===== RIGHT SIDEBAR ===== */
.right-sidebar{
  width:280px;
  min-width:280px;
  background:var(--bg);
  padding:var(--space-6) var(--space-4);
  overflow-y:auto;
  flex-shrink:0;
  position:absolute;
  right:0;
  top:73px;
  bottom:0;
}

.stat-card{
  background:var(--surface-2);
  border:1px solid var(--divider);
  border-radius:var(--radius-xl);
  padding:var(--space-8) var(--space-6);
  margin-bottom:var(--space-4);
  display:flex;
  flex-direction:column;
  gap:0;
  min-height:180px;
}
.stat-icon{
  width:40px;height:40px;
  border-radius:var(--radius-lg);
  display:flex;
  align-items:center;
  justify-content:center;
  flex-shrink:0;
  margin-bottom:var(--space-5);
}
.stat-icon i{
  width:20px !important;
  height:20px !important;
}
.stat-content{
  flex:1;
  text-align:center;
  display:flex;
  flex-direction:column;
  justify-content:center;
}
.stat-label{
  font-size:var(--text-sm);
  color:var(--text);
  margin-bottom:var(--space-4);
  font-weight:500;
  display:flex;
  align-items:center;
  justify-content:center;
  gap:var(--space-2);
}
.stat-value{
  font-size:3rem;
  font-weight:700;
  letter-spacing:-0.03em;
  color:var(--text);
  margin-bottom:var(--space-2);
  line-height:1;
}
.stat-meta{
  font-size:var(--text-sm);
  color:var(--text-muted);
}

.stat-card-weekly{
  flex-direction:column;
  gap:0;
  padding:var(--space-6);
  min-height:auto;
}
.stat-card-header{
  font-size:var(--text-base);
  font-weight:600;
  color:var(--text);
  margin-bottom:var(--space-4);
  padding-bottom:var(--space-3);
  border-bottom:1px solid var(--divider);
}
.weekly-stats{
  display:flex;
  flex-direction:column;
  gap:var(--space-3);
}
.weekly-stat-row{
  display:flex;
  justify-content:space-between;
  align-items:center;
}
.weekly-stat-row:last-child{border-bottom:none}
.weekly-stat-label{
  font-size:var(--text-sm);
  color:var(--text-muted);
  font-weight:400;
}
.weekly-stat-value{
  font-size:var(--text-lg);
  font-weight:700;
  color:var(--text);
}

/* ===== COMPOSE BUTTON ===== */
.compose-btn{
  position:fixed;
  bottom:var(--space-6);
  right:var(--space-6);
  background:var(--accent);
  color:#fff;
  padding:var(--space-3) var(--space-5);
  border-radius:var(--radius-full);
  display:flex;
  align-items:center;
  gap:var(--space-2);
  font-weight:600;
  font-size:var(--text-sm);
  box-shadow:var(--shadow-lg);
  transition:all var(--transition);
  z-index:60;
}
.compose-btn:hover{
  background:var(--accent-hover);
  transform:translateY(-2px);
  box-shadow:0 16px 48px rgba(0,0,0,0.15);
}
/* ===== CATEGORY MODAL ===== */
.category-modal{
  position:fixed;
  top:0;left:0;right:0;bottom:0;
  z-index:1000;
  display:flex;
  align-items:center;
  justify-content:center;
  opacity:0;
  transition:opacity 0.2s ease;
}
.category-modal.show{
  opacity:1;
}
.category-modal.closing{
  opacity:0;
}

.category-modal-overlay{
  position:absolute;
  top:0;left:0;right:0;bottom:0;
  background:rgba(0,0,0,0.5);
  backdrop-filter:blur(4px);
}

.category-modal-content{
  position:relative;
  background:var(--surface);
  border:1px solid var(--divider);
  border-radius:var(--radius-xl);
  width:90%;
  max-width:480px;
  box-shadow:var(--shadow-lg);
  transform:scale(0.95);
  transition:transform 0.2s ease;
}
.category-modal.show .category-modal-content{
  transform:scale(1);
}

.category-modal-header{
  padding:var(--space-5);
  border-bottom:1px solid var(--divider);
  display:flex;
  align-items:center;
  justify-content:space-between;
}
.category-modal-header h3{
  font-size:var(--text-lg);
  font-weight:600;
  letter-spacing:-0.01em;
}
.category-modal-close{
  width:32px;height:32px;
  display:flex;
  align-items:center;
  justify-content:center;
  border-radius:var(--radius-md);
  color:var(--text-muted);
  transition:background var(--transition);
}
.category-modal-close:hover{
  background:var(--surface-3);
}

.category-modal-body{
  padding:var(--space-5);
}
.category-modal-desc{
  font-size:var(--text-sm);
  color:var(--text-muted);
  margin-bottom:var(--space-4);
}

.category-list{
  display:grid;
  grid-template-columns:repeat(2,1fr);
  gap:var(--space-3);
  margin-bottom:var(--space-4);
}
.category-option{
  display:flex;
  align-items:center;
  gap:var(--space-3);
  padding:var(--space-3) var(--space-4);
  border:1px solid var(--border);
  border-radius:var(--radius-md);
  background:var(--surface-2);
  font-size:var(--text-sm);
  font-weight:500;
  transition:all var(--transition);
  cursor:pointer;
}
.category-option:hover{
  background:var(--accent-dim);
  border-color:var(--accent);
  color:var(--accent);
  transform:translateY(-1px);
}
.category-icon{
  width:18px;height:18px;
  flex-shrink:0;
}

.category-divider{
  text-align:center;
  color:var(--text-faint);
  font-size:var(--text-xs);
  font-weight:600;
  text-transform:uppercase;
  letter-spacing:0.05em;
  margin:var(--space-4) 0;
  position:relative;
}
.category-divider::before,
.category-divider::after{
  content:'';
  position:absolute;
  top:50%;
  width:calc(50% - 30px);
  height:1px;
  background:var(--divider);
}
.category-divider::before{left:0}
.category-divider::after{right:0}

.category-new{
  display:flex;
  gap:var(--space-2);
}
.category-input{
  flex:1;
  padding:var(--space-3) var(--space-4);
  border:1px solid var(--border);
  border-radius:var(--radius-md);
  background:var(--surface-2);
  font-size:var(--text-sm);
  outline:none;
  transition:border-color var(--transition);
}
.category-input:focus{
  border-color:var(--accent);
}
.category-input::placeholder{
  color:var(--text-faint);
}
.category-create-btn{
  display:flex;
  align-items:center;
  gap:var(--space-2);
  padding:var(--space-3) var(--space-4);
  background:var(--accent);
  color:#fff;
  border-radius:var(--radius-md);
  font-size:var(--text-sm);
  font-weight:600;
  transition:all var(--transition);
  white-space:nowrap;
}
.category-create-btn:hover{
  background:var(--accent-hover);
  transform:translateY(-1px);
}

/* ===== EMAIL DETAIL PANEL ===== */
.email-detail-panel{
  position:fixed;
  top:0;
  right:0;
  bottom:0;
  width:480px;
  background:var(--surface);
  border-left:1px solid var(--divider);
  box-shadow:-4px 0 24px rgba(0,0,0,0.08);
  transform:translateX(100%);
  transition:transform 0.3s cubic-bezier(0.16,1,0.3,1);
  z-index:200;
  display:flex;
  flex-direction:column;
  overflow:hidden;
}
.email-detail-panel.show{
  transform:translateX(0);
}

.email-detail-header{
  padding:var(--space-5);
  border-bottom:1px solid var(--divider);
  display:flex;
  align-items:center;
  justify-content:space-between;
  flex-shrink:0;
}
.email-detail-close{
  width:32px;height:32px;
  display:flex;
  align-items:center;
  justify-content:center;
  border-radius:var(--radius-md);
  color:var(--text-muted);
  transition:background var(--transition);
}
.email-detail-close:hover{
  background:var(--surface-3);
}

.email-detail-body{
  flex:1;
  overflow-y:auto;
  padding:var(--space-5);
}

.email-detail-from{
  display:flex;
  align-items:center;
  gap:var(--space-3);
  margin-bottom:var(--space-5);
}
.email-detail-avatar{
  width:48px;height:48px;
  border-radius:var(--radius-full);
  display:flex;
  align-items:center;
  justify-content:center;
  color:#fff;
  font-weight:600;
  font-size:var(--text-lg);
  flex-shrink:0;
}
.email-detail-sender-info{
  flex:1;
}
.email-detail-sender{
  font-weight:600;
  font-size:var(--text-base);
  color:var(--text);
  margin-bottom:2px;
}
.email-detail-email{
  font-size:var(--text-sm);
  color:var(--text-muted);
}

.email-detail-subject{
  font-size:var(--text-xl);
  font-weight:600;
  letter-spacing:-0.01em;
  color:var(--text);
  margin-bottom:var(--space-4);
}

.email-detail-meta{
  display:flex;
  gap:var(--space-4);
  margin-bottom:var(--space-5);
  padding-bottom:var(--space-4);
  border-bottom:1px solid var(--divider);
}
.email-detail-meta-item{
  display:flex;
  flex-direction:column;
  gap:var(--space-1);
}
.email-detail-meta-label{
  font-size:var(--text-xs);
  color:var(--text-faint);
  text-transform:uppercase;
  letter-spacing:0.05em;
  font-weight:600;
}
.email-detail-meta-value{
  font-size:var(--text-sm);
  color:var(--text-muted);
}

.email-detail-content{
  font-size:var(--text-base);
  line-height:1.7;
  color:var(--text);
}
.email-detail-content p{
  margin-bottom:var(--space-4);
}

/* ===== ACCOUNT SWITCHER MODAL ===== */
.account-modal{
  position:fixed;
  bottom:80px;
  left:20px;
  background:var(--surface);
  border:1px solid var(--divider);
  border-radius:var(--radius-xl);
  box-shadow:var(--shadow-lg);
  width:280px;
  z-index:500;
  opacity:0;
  transform:translateY(10px);
  transition:opacity 0.2s ease, transform 0.2s ease;
  pointer-events:none;
}
.account-modal.show{
  opacity:1;
  transform:translateY(0);
  pointer-events:all;
}

.account-modal-header{
  padding:var(--space-4);
  border-bottom:1px solid var(--divider);
}
.account-modal-title{
  font-size:var(--text-sm);
  font-weight:600;
  color:var(--text-muted);
  text-transform:uppercase;
  letter-spacing:0.05em;
}

.account-list{
  padding:var(--space-2);
  max-height:300px;
  overflow-y:auto;
}
.account-item{
  display:flex;
  align-items:center;
  gap:var(--space-3);
  padding:var(--space-3);
  border-radius:var(--radius-md);
  cursor:pointer;
  transition:background var(--transition);
}
.account-item:hover{
  background:var(--surface-3);
}
.account-item.active{
  background:var(--accent-dim);
}
.account-item-avatar{
  width:36px;height:36px;
  border-radius:var(--radius-full);
  background:var(--accent);
  color:#fff;
  display:flex;
  align-items:center;
  justify-content:center;
  font-weight:600;
  font-size:var(--text-sm);
  flex-shrink:0;
}
.account-item-info{
  flex:1;
  min-width:0;
}
.account-item-name{
  font-size:var(--text-sm);
  font-weight:500;
  color:var(--text);
  overflow:hidden;
  text-overflow:ellipsis;
  white-space:nowrap;
}
.account-item-email{
  font-size:var(--text-xs);
  color:var(--text-muted);
  overflow:hidden;
  text-overflow:ellipsis;
  white-space:nowrap;
}
.account-item-status{
  font-size:11px;
  color:var(--text-muted);
}
.account-item-check{
  color:var(--accent);
  opacity:0;
}
.account-item.active .account-item-check{
  opacity:1;
}

.account-modal-footer{
  padding:var(--space-2);
  border-top:1px solid var(--divider);
}
.add-account-btn{
  width:100%;
  display:flex;
  align-items:center;
  justify-content:center;
  gap:var(--space-2);
  padding:var(--space-3);
  border-radius:var(--radius-md);
  font-size:var(--text-sm);
  font-weight:500;
  color:var(--accent);
  transition:background var(--transition);
}
.add-account-btn:hover{
  background:var(--accent-dim);
}
.account-modal-actions{
  display:flex;
  flex-direction:column;
  gap:var(--space-2);
  padding:var(--space-2);
  border-top:1px solid var(--divider);
}
.account-modal-action{
  width:100%;
  display:flex;
  align-items:center;
  justify-content:center;
  gap:var(--space-2);
  padding:var(--space-3);
  border-radius:var(--radius-md);
  font-size:var(--text-sm);
  font-weight:600;
  border:1px solid var(--border);
  background:var(--surface-2);
  color:var(--text);
  transition:all var(--transition);
}
.account-modal-action:hover{
  background:var(--surface-3);
}
.account-modal-action.primary{
  background:var(--accent);
  border-color:var(--accent);
  color:#fff;
}
.account-modal-action.primary:hover{
  background:var(--accent-hover);
}
.account-modal-note{
  padding:0 var(--space-4) var(--space-4);
  font-size:var(--text-xs);
  color:var(--text-muted);
}
.empty-email-state{
  padding:var(--space-8) var(--space-5);
  text-align:center;
  color:var(--text-muted);
}
.empty-email-state h3{
  font-size:var(--text-base);
  color:var(--text);
  margin-bottom:var(--space-2);
}

/* Additional custom category colors */
.tag-subscription{background:#e0e7ff;color:#4f46e5}
.tag-subscriptions{background:#e0e7ff;color:#4f46e5}
.tag-shopping{background:#ffedd5;color:#ea580c}
.tag-travel{background:#cffafe;color:#0891b2}
.tag-health{background:#fed7aa;color:#c2410c}
.tag-education{background:#ddd6fe;color:#7c3aed}
.tag-social{background:#fbcfe8;color:#db2777}
.tag-finance{background:#d1fae5;color:#059669}
.tag-entertainment{background:#fce7f3;color:#be185d}
.tag-news{background:#e0f2fe;color:#0369a1}

/* ===== RESPONSES NEEDED MODAL ===== */
.responses-modal{
  position:fixed;
  top:0;left:0;right:0;bottom:0;
  z-index:1000;
  display:flex;
  align-items:center;
  justify-content:center;
  opacity:0;
  transition:opacity 0.2s ease;
  pointer-events:none;
}
.responses-modal.show{
  opacity:1;
  pointer-events:all;
}

.responses-modal-overlay{
  position:absolute;
  top:0;left:0;right:0;bottom:0;
  background:rgba(0,0,0,0.5);
  backdrop-filter:blur(4px);
}

.responses-modal-content{
  position:relative;
  background:var(--surface);
  border:1px solid var(--divider);
  border-radius:var(--radius-xl);
  width:90%;
  max-width:700px;
  max-height:80vh;
  box-shadow:var(--shadow-lg);
  transform:scale(0.95);
  transition:transform 0.2s ease;
  display:flex;
  flex-direction:column;
}
.responses-modal.show .responses-modal-content{
  transform:scale(1);
}

.responses-modal-header{
  padding:var(--space-5);
  border-bottom:1px solid var(--divider);
  display:flex;
  align-items:center;
  justify-content:space-between;
  flex-shrink:0;
}
.responses-modal-title{
  display:flex;
  align-items:center;
  gap:var(--space-3);
}
.responses-modal-title h3{
  font-size:var(--text-lg);
  font-weight:600;
  letter-spacing:-0.01em;
}
.responses-modal-close{
  width:32px;height:32px;
  display:flex;
  align-items:center;
  justify-content:center;
  border-radius:var(--radius-md);
  color:var(--text-muted);
  transition:background var(--transition);
}
.responses-modal-close:hover{
  background:var(--surface-3);
}

.responses-modal-body{
  flex:1;
  overflow-y:auto;
  padding:var(--space-4);
}

.responses-empty{
  text-align:center;
  padding:var(--space-12) var(--space-6);
  color:var(--text-muted);
}
.responses-empty-icon{
  width:64px;height:64px;
  margin:0 auto var(--space-4);
  color:var(--text-faint);
}
.responses-empty h4{
  font-size:var(--text-lg);
  font-weight:600;
  margin-bottom:var(--space-2);
  color:var(--text);
}
.responses-empty p{
  font-size:var(--text-sm);
}

.response-email-item{
  display:flex;
  gap:var(--space-4);
  padding:var(--space-4);
  border:1px solid var(--divider);
  border-radius:var(--radius-lg);
  margin-bottom:var(--space-3);
  transition:all var(--transition);
  cursor:pointer;
  background:var(--surface-2);
}
.response-email-item:hover{
  background:var(--surface-3);
  transform:translateY(-1px);
  box-shadow:var(--shadow-sm);
}
.response-email-item:last-child{
  margin-bottom:0;
}

.response-email-actions{
  display:flex;
  gap:var(--space-2);
  margin-top:var(--space-3);
}
.mark-responded-btn{
  font-size:var(--text-xs);
  font-weight:500;
  padding:6px 12px;
  border-radius:var(--radius-md);
  background:var(--success);
  color:#fff;
  transition:all var(--transition);
}
.mark-responded-btn:hover{
  background:var(--success);
  opacity:0.9;
  transform:translateY(-1px);
}

/* Multiple category selection */
.category-option{
  position:relative;
}
.category-check{
  position:absolute;
  right:var(--space-3);
  color:var(--accent);
  opacity:0;
  transition:opacity var(--transition);
}
.category-option.selected{
  background:var(--accent-dim);
  border-color:var(--accent);
  color:var(--accent);
}
.category-option.selected .category-check{
  opacity:1;
}

.category-add-btn{
  display:flex;
  align-items:center;
  gap:var(--space-2);
  padding:var(--space-3) var(--space-4);
  background:var(--surface-3);
  border:1px solid var(--border);
  color:var(--text);
  border-radius:var(--radius-md);
  font-size:var(--text-sm);
  font-weight:600;
  transition:all var(--transition);
  white-space:nowrap;
}
.category-add-btn:hover{
  background:var(--surface-4);
  border-color:var(--accent);
  transform:translateY(-1px);
}

.category-modal-footer{
  margin-top:var(--space-5);
  padding-top:var(--space-4);
  border-top:1px solid var(--divider);
}
.category-save-btn{
  width:100%;
  padding:var(--space-3) var(--space-4);
  background:var(--accent);
  color:#fff;
  border-radius:var(--radius-md);
  font-size:var(--text-sm);
  font-weight:600;
  transition:all var(--transition);
}
.category-save-btn:hover{
  background:var(--accent-hover);
  transform:translateY(-1px);
}

/* Email detail layout update */
.email-detail-panel{
  position:fixed;
  top:73px;
  right:0;
  bottom:0;
  width:420px;
  background:var(--surface);
  border-left:1px solid var(--divider);
  box-shadow:var(--shadow-lg);
  transform:translateX(100%);
  transition:transform 0.25s ease;
  display:flex;
  flex-direction:column;
}
.email-detail-panel.show{
  transform:translateX(0);
}
.email-detail-body{
  padding:var(--space-5);
  overflow-y:auto;
  flex:1;
}
.email-detail-footer{
  border-top:1px solid var(--divider);
  padding:var(--space-4) var(--space-5);
}
.email-detail-actions{
  display:flex;
  justify-content:flex-start;
  gap:var(--space-2);
}
.email-action-btn{
  flex:0 0 auto;
  display:flex;
  align-items:center;
  justify-content:center;
  gap:var(--space-1);
  padding:6px 12px;
  border-radius:999px;
  background:var(--surface-3);
  border:1px solid var(--divider);
  font-size:var(--text-xs);
  font-weight:500;
  color:var(--text);
  transition:all var(--transition);
}
.email-action-btn i{
  width:14px;
  height:14px;
}
.email-action-btn:hover{
  background:var(--accent-dim);
  border-color:var(--accent);
  color:var(--accent);
}

/* Theme toggle icon sizing */
#themeToggle svg{
  width:18px;
  height:18px;
}

/* Floating mail-style compose window */
.email-compose-window {
  position: fixed;
  right: 32px;
  bottom: 32px;
  width: 520px;
  max-width: calc(100% - 32px);
  max-height: 520px;
  background: var(--surface-2);
  border-radius: 12px;
  box-shadow: 0 18px 50px rgba(15, 23, 42, 0.35);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  opacity: 0;
  transform: translateY(16px);
  transition: opacity var(--transition), transform var(--transition);
  z-index: 120;
}

.email-compose-window.show {
  opacity: 1;
  transform: translateY(0);
}

.compose-toolbar {
  height: 44px;
  background: var(--surface-3);
  border-bottom: 1px solid var(--divider);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 12px 0 16px;
}

.compose-title {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
}

.compose-toolbar-actions {
  display: flex;
  gap: 4px;
}

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

.compose-icon-btn:hover {
  background: var(--surface-4);
}

.compose-fields {
  border-bottom: 1px solid var(--divider);
}

.compose-row {
  display: flex;
  align-items: center;
  padding: 6px 16px;
  gap: 8px;
}

.compose-row-label {
  width: 52px;
  font-size: 13px;
  color: var(--text-muted);
}

.compose-input {
  flex: 1;
  border: none;
  background: transparent;
  font-size: 13px;
  color: var(--text);
  outline: none;
}

.compose-cc-toggle {
  border: none;
  background: transparent;
  font-size: 12px;
  color: var(--accent);
  cursor: pointer;
}

.compose-body {
  flex: 1;
  padding: 8px 16px 0;
}

.compose-textarea {
  width: 100%;
  height: 100%;
  border: none;
  resize: none;
  outline: none;
  font-size: 13px;
  line-height: 1.5;
  color: var(--text);
  background: transparent;
}

.compose-footer {
  display: flex;
  align-items: center;
  padding: 8px 12px;
  gap: 4px;
  border-top: 1px solid var(--divider);
}

.compose-send-main {
  background: #2563eb;
  border: none;
  color: #fff;
  font-size: 13px;
  font-weight: 500;
  padding: 6px 18px;
  border-radius: 999px;
  cursor: pointer;
}

.compose-send-main:hover {
  background: #1d4ed8;
}

.compose-send-main:disabled {
  opacity: 0.7;
  cursor: progress;
}

.compose-footer-icon {
  border: none;
  background: transparent;
  height: 28px;
  width: 28px;
  border-radius: 999px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  color: var(--text-muted);
  cursor: pointer;
}

.compose-footer-icon:hover {
  background: var(--surface-3);
}

.app-toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  z-index: 600;
  transform: translate(-50%, 12px);
  opacity: 0;
  padding: 10px 14px;
  border-radius: var(--radius-md);
  background: var(--surface-2);
  border: 1px solid var(--divider);
  color: var(--text);
  box-shadow: var(--shadow-lg);
  font-size: var(--text-sm);
  font-weight: 500;
  transition: opacity var(--transition), transform var(--transition);
}

.app-toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

.app-toast-success {
  border-color: var(--success);
}

.app-toast-error {
  border-color: var(--error);
  color: var(--error);
}
